diff -c -rNbB attach_mod_v234/admin/admin_attach_cp.php attach_mod_v235/admin/admin_attach_cp.php
*** attach_mod_v234/admin/admin_attach_cp.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/admin/admin_attach_cp.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *	copyright			: (C) 2002 Meik Sievertsen
   *	email				: acyd.burn@gmx.de
   *
!  *	$Id: admin_attach_cp.php,v 1.10 2002/09/20 12:45:53 meik Exp $
   *
   ***************************************************************************/
  
--- 6,12 ----
   *	copyright			: (C) 2002 Meik Sievertsen
   *	email				: acyd.burn@gmx.de
   *
!  *	$Id: admin_attach_cp.php,v 1.14 2003/01/15 23:24:26 acydburn Exp $
   *
   ***************************************************************************/
  
***************
*** 35,43 ****
  require($phpbb_root_path . 'extension.inc');
  require('pagestart.' . $phpEx);
  
- include($phpbb_root_path . 'attach_mod/includes/functions_selects.' . $phpEx);
- include($phpbb_root_path . 'attach_mod/includes/functions_admin.' . $phpEx);
- 
  //
  // Init Variables
  //
--- 35,40 ----
***************
*** 346,362 ****
  
  	$upload_dir_size = get_formatted_dirsize();
  
! 	if ($attach_config['attachment_quota'] >= 1048576)
  	{
! 		$attachment_quota = round($attach_config['attachment_quota'] / 1048576 * 100) / 100 . ' ' . $lang['MB'];
  	}
! 	else if ($attach_config['attachment_quota'] >= 1024)
  	{
! 		$attachment_quota = round($attach_config['attachment_quota'] / 1024 * 100) / 100 . ' ' . $lang['KB'];
  	}
  	else
  	{
! 		$attachment_quota = $attach_config['attachment_quota'] . ' ' . $lang['Bytes'];
  	}
  
  	$sql = "SELECT count(*) AS total
--- 343,359 ----
  
  	$upload_dir_size = get_formatted_dirsize();
  
! 	if (intval($attach_config['attachment_quota']) >= 1048576)
  	{
! 		$attachment_quota = round(intval($attach_config['attachment_quota']) / 1048576 * 100) / 100 . ' ' . $lang['MB'];
  	}
! 	else if (intval($attach_config['attachment_quota']) >= 1024)
  	{
! 		$attachment_quota = round(intval($attach_config['attachment_quota']) / 1024 * 100) / 100 . ' ' . $lang['KB'];
  	}
  	else
  	{
! 		$attachment_quota = intval($attach_config['attachment_quota']) . ' ' . $lang['Bytes'];
  	}
  
  	$sql = "SELECT count(*) AS total
diff -c -rNbB attach_mod_v234/admin/admin_attachments.php attach_mod_v235/admin/admin_attachments.php
*** attach_mod_v234/admin/admin_attachments.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/admin/admin_attachments.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: admin_attachments.php,v 1.27 2002/11/03 12:44:38 meik Exp $
   *
   ***************************************************************************/
  
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: admin_attachments.php,v 1.40 2003/01/15 23:24:26 acydburn Exp $
   *
   ***************************************************************************/
  
***************
*** 28,33 ****
--- 28,34 ----
  	$module['Attachments']['Shadow_attachments'] = $filename . '?mode=shadow';
  	$module['Extensions']['Special_categories'] = $filename . '?mode=cats';
  	$module['Attachments']['Sync_attachments'] = $filename . '?mode=sync';
+ 	$module['Attachments']['Quota_limits'] = $filename . '?mode=quota';
  	return;
  }
  
***************
*** 38,45 ****
  require($phpbb_root_path . 'extension.inc');
  require('pagestart.' . $phpEx);
  
- include($phpbb_root_path . 'attach_mod/includes/functions_selects.'.$phpEx);
- include($phpbb_root_path . 'attach_mod/includes/functions_admin.'.$phpEx);
  include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
  
  //
--- 39,44 ----
***************
*** 54,59 ****
--- 53,67 ----
  	$mode = '';
  }
  
+ if( isset($HTTP_POST_VARS['e_mode']) || isset($HTTP_GET_VARS['e_mode']) )
+ {
+ 	$e_mode = ( isset($HTTP_POST_VARS['e_mode']) ) ? $HTTP_POST_VARS['e_mode'] : $HTTP_GET_VARS['e_mode'];
+ }
+ else
+ {
+ 	$e_mode = '';
+ }
+ 
  if(isset($HTTP_GET_VARS['size']) || isset($HTTP_POST_VARS['size']))
  {
  	$size = (isset($HTTP_POST_VARS['size'])) ? $HTTP_POST_VARS['size'] : $HTTP_GET_VARS['size'];
***************
*** 102,122 ****
  	$config_name = $row['config_name'];
  	$config_value = $row['config_value'];
  
! 	$new_attach[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $attach_config[$config_name];
  
  	if ((empty($size)) && (!$submit) && ($config_name == 'max_filesize'))
  	{
! 		$size = ($attach_config[$config_name] >= 1048576) ? 'mb' : ( ($attach_config[$config_name] >= 1024) ? 'kb' : 'b' );
  	} 
  
  	if ((empty($quota_size)) && (!$submit) && ($config_name == 'attachment_quota'))
  	{
! 		$quota_size = ($attach_config[$config_name] >= 1048576) ? 'mb' : ( ($attach_config[$config_name] >= 1024) ? 'kb' : 'b' );
  	}
  
  	if ((empty($pm_size)) && (!$submit) && ($config_name == 'max_filesize_pm'))
  	{
! 		$pm_size = ($attach_config[$config_name] >= 1048576) ? 'mb' : ( ($attach_config[$config_name] >= 1024) ? 'kb' : 'b' );
  	}
  
  	if ( (!$submit) && (($config_name == 'max_filesize') || ($config_name == 'attachment_quota') || ($config_name == 'max_filesize_pm')) )
--- 110,130 ----
  	$config_name = $row['config_name'];
  	$config_value = $row['config_value'];
  
! 	$new_attach[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? trim($HTTP_POST_VARS[$config_name]) : trim($attach_config[$config_name]);
  
  	if ((empty($size)) && (!$submit) && ($config_name == 'max_filesize'))
  	{
! 		$size = (intval($attach_config[$config_name]) >= 1048576) ? 'mb' : ( (intval($attach_config[$config_name]) >= 1024) ? 'kb' : 'b' );
  	} 
  
  	if ((empty($quota_size)) && (!$submit) && ($config_name == 'attachment_quota'))
  	{
! 		$quota_size = (intval($attach_config[$config_name]) >= 1048576) ? 'mb' : ( (intval($attach_config[$config_name]) >= 1024) ? 'kb' : 'b' );
  	}
  
  	if ((empty($pm_size)) && (!$submit) && ($config_name == 'max_filesize_pm'))
  	{
! 		$pm_size = (intval($attach_config[$config_name]) >= 1048576) ? 'mb' : ( (intval($attach_config[$config_name]) >= 1024) ? 'kb' : 'b' );
  	}
  
  	if ( (!$submit) && (($config_name == 'max_filesize') || ($config_name == 'attachment_quota') || ($config_name == 'max_filesize_pm')) )
***************
*** 166,173 ****
  		
  		if ($config_name == 'max_filesize')
  		{
! 			$old_size = $attach_config[$config_name];
! 			$new_size = $new_attach[$config_name];
  
  			if ($old_size != $new_size)
  			{
--- 174,181 ----
  		
  		if ($config_name == 'max_filesize')
  		{
! 			$old_size = intval($attach_config[$config_name]);
! 			$new_size = intval($new_attach[$config_name]);
  
  			if ($old_size != $new_size)
  			{
***************
*** 208,213 ****
--- 216,232 ----
  	}
  }
  
+ $cache_dir = $phpbb_root_path . '/cache';
+ $cache_file = $cache_dir . '/attach_config.php';
+ 
+ if ((file_exists($cache_dir)) && (is_dir($cache_dir)))
+ {
+ 	if (file_exists($cache_file))
+ 	{
+ 		@unlink($cache_file);
+ 	}
+ }
+ 
  $select_size_mode = size_select('size', $size);
  $select_quota_size_mode = size_select('quota_size', $quota_size);
  $select_pm_size_mode = size_select('pm_size', $pm_size);
***************
*** 247,260 ****
  		{
  			$path = 'c:/imagemagick/convert.exe';
  
! 			if (file_exists($path))
  			{
  				$imagick = $path;
  			}
  		}
  	} 
  
! 	if (file_exists(trim($imagick)))
  	{
  		$new_attach['img_imagick'] = trim($imagick);
  	}
--- 266,279 ----
  		{
  			$path = 'c:/imagemagick/convert.exe';
  
! 			if (@file_exists(@amod_realpath($path)))
  			{
  				$imagick = $path;
  			}
  		}
  	} 
  
! 	if (@file_exists(@amod_realpath(trim($imagick))))
  	{
  		$new_attach['img_imagick'] = trim($imagick);
  	}
***************
*** 287,293 ****
  
  	for ($i = 0; $i < $num_rows; $i++)
  	{
! 		$attach_config[$row[$i]['config_name']] = $row[$i]['config_value'];
  	}
  
  	if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
--- 306,312 ----
  
  	for ($i = 0; $i < $num_rows; $i++)
  	{
! 		$attach_config[$row[$i]['config_name']] = trim($row[$i]['config_value']);
  	}
  
  	if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
***************
*** 304,312 ****
  	//
  	// Does the target directory exist, is it a directory and writeable. (only test if ftp upload is disabled)
  	//
! 	if ($attach_config['allow_ftp_upload'] == '0')
  	{
! 		if ( !file_exists($upload_dir) )
  		{
  			$error = TRUE;
  			$error_msg = sprintf($lang['Directory_does_not_exist'], $attach_config['upload_dir']) . '<br />';
--- 323,331 ----
  	//
  	// Does the target directory exist, is it a directory and writeable. (only test if ftp upload is disabled)
  	//
! 	if (intval($attach_config['allow_ftp_upload']) == 0)
  	{
! 		if ( !@file_exists(@amod_realpath($upload_dir)) )
  		{
  			$error = TRUE;
  			$error_msg = sprintf($lang['Directory_does_not_exist'], $attach_config['upload_dir']) . '<br />';
***************
*** 355,360 ****
--- 374,385 ----
  			$error_msg = sprintf($lang['Ftp_error_login'], $attach_config['ftp_user']) . '<br />';
  		}
  		
+ 		if (!@ftp_pasv($conn_id, intval($attach_config['ftp_pasv_mode'])))
+ 		{
+ 			$error = TRUE;
+ 			$error_msg = $lang['Ftp_error_pasv_mode'];
+ 		}
+ 
  		if (!$error)
  		{
  			//
***************
*** 428,434 ****
  		'body' => 'admin/attach_manage_body.tpl')
  	);
  
! 	$yes_no_switches = array('disable_mod', 'allow_pm_attach', 'allow_ftp_upload', 'attachment_topic_review', 'display_order', 'show_apcp');
  
  	for ($i = 0; $i < count($yes_no_switches); $i++)
  	{
--- 453,459 ----
  		'body' => 'admin/attach_manage_body.tpl')
  	);
  
! 	$yes_no_switches = array('disable_mod', 'allow_pm_attach', 'allow_ftp_upload', 'attachment_topic_review', 'display_order', 'show_apcp', 'ftp_pasv_mode');
  
  	for ($i = 0; $i < count($yes_no_switches); $i++)
  	{
***************
*** 436,441 ****
--- 461,475 ----
  		eval("\$" . $yes_no_switches[$i] . "_no = ( \$new_attach['" . $yes_no_switches[$i] . "'] == '0' ) ? 'checked=\"checked\"' : '';");
  	}
  
+ 	if (!function_exists('ftp_connect'))
+ 	{
+ 		$template->assign_block_vars('switch_no_ftp', array());
+ 	}
+ 	else
+ 	{
+ 		$template->assign_block_vars('switch_ftp', array());
+ 	}
+ 
  	$template->assign_vars(array(
  		'L_MANAGE_TITLE' => $lang['Attach_settings'],
  		'L_MANAGE_EXPLAIN' => $lang['Manage_attachments_explain'],
***************
*** 444,449 ****
--- 478,484 ----
  		'L_ATTACHMENT_NUMBER_SETTINGS' => $lang['Attach_number_settings'],
  		'L_ATTACHMENT_OPTIONS_SETTINGS' => $lang['Attach_options_settings'],
  		'L_ATTACHMENT_FTP_SETTINGS' => $lang['ftp_info'],
+ 		'L_NO_FTP_EXTENSIONS' => $lang['No_ftp_extensions_installed'],
  		'L_UPLOAD_DIR' => $lang['Upload_directory'],
  		'L_UPLOAD_DIR_EXPLAIN' => $lang['Upload_directory_explain'],
  		'L_ATTACHMENT_IMG_PATH' => $lang['Attach_img_path'],
***************
*** 462,467 ****
--- 497,504 ----
  		'L_MAX_FILESIZE_EXPLAIN' => $lang['Max_filesize_attach_explain'],
  		'L_ATTACH_QUOTA' => $lang['Attach_quota'],
  		'L_ATTACH_QUOTA_EXPLAIN' => $lang['Attach_quota_explain'],
+ 		'L_DEFAULT_QUOTA_LIMIT' => $lang['Default_quota_limit'],
+ 		'L_DEFAULT_QUOTA_LIMIT_EXPLAIN' => $lang['Default_quota_limit_explain'],
  		'L_MAX_FILESIZE_PM' => $lang['Max_filesize_pm'],
  		'L_MAX_FILESIZE_PM_EXPLAIN' => $lang['Max_filesize_pm_explain'],
  		'L_MAX_ATTACHMENTS' => $lang['Max_attachments'],
***************
*** 482,487 ****
--- 519,526 ----
  		'L_ATTACHMENT_FTP_PATH_EXPLAIN' => $lang['Attach_ftp_path_explain'],
  		'L_ATTACHMENT_FTP_SERVER' => $lang['Ftp_server'],
  		'L_ATTACHMENT_FTP_SERVER_EXPLAIN' => $lang['Ftp_server_explain'],
+ 		'L_FTP_PASSIVE_MODE' => $lang['Ftp_passive_mode'],
+ 		'L_FTP_PASSIVE_MODE_EXPLAIN' => $lang['Ftp_passive_mode_explain'],
  		'L_DOWNLOAD_PATH' => $lang['Ftp_download_path'],
  		'L_DOWNLOAD_PATH_EXPLAIN' => $lang['Ftp_download_path_explain'],
  		'L_SHOW_APCP' => $lang['Show_apcp'],
***************
*** 492,497 ****
--- 531,540 ----
  		'S_FILESIZE' => $select_size_mode,
  		'S_FILESIZE_QUOTA' => $select_quota_size_mode,
  		'S_FILESIZE_PM' => $select_pm_size_mode,
+ 		'S_DEFAULT_UPLOAD_LIMIT' => default_quota_limit_select('default_upload_quota', intval(trim($new_attach['default_upload_quota']))),
+ 		'S_DEFAULT_PM_LIMIT' => default_quota_limit_select('default_pm_quota', intval(trim($new_attach['default_pm_quota']))),
+ 		'L_UPLOAD_QUOTA' => $lang['Upload_quota'],
+ 		'L_PM_QUOTA' => $lang['Pm_quota'],
  
  		'UPLOAD_DIR' => $new_attach['upload_dir'],
  		'ATTACHMENT_IMG_PATH' => $new_attach['upload_img'],
***************
*** 512,517 ****
--- 555,562 ----
  		'PM_ATTACH_NO' => $allow_pm_attach_no,
  		'FTP_UPLOAD_YES' => $allow_ftp_upload_yes,
  		'FTP_UPLOAD_NO' => $allow_ftp_upload_no,
+ 		'FTP_PASV_MODE_YES' => $ftp_pasv_mode_yes,
+ 		'FTP_PASV_MODE_NO' => $ftp_pasv_mode_no,
  		'TOPIC_REVIEW_YES' => $attachment_topic_review_yes,
  		'TOPIC_REVIEW_NO' => $attachment_topic_review_no,
  		'DISPLAY_ORDER_ASC' => $display_order_yes,
***************
*** 582,627 ****
  		'body' => 'admin/attach_shadow.tpl')
  	);
  
- 	if( isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['start']) )
- 	{
- 		$start = ( isset($HTTP_POST_VARS['start']) ) ? $HTTP_POST_VARS['start'] : $HTTP_GET_VARS['start'];
- 	}
- 	else
- 	{
- 		$start = 0;
- 	}
- 
- 	if( isset($HTTP_POST_VARS['num']) || isset($HTTP_GET_VARS['num']) )
- 	{
- 		$num = ( isset($HTTP_POST_VARS['num']) ) ? $HTTP_POST_VARS['num'] : $HTTP_GET_VARS['num'];
- 	}
- 	else
- 	{
- 		$num = 0;
- 	}
- 
  	$shadow_attachments = array();
  	$shadow_row = array();
- 	$max_attachments = 200;
- 
- 	if ($num == 0)
- 	{
- 		$sql = 'SELECT attach_id FROM ' . ATTACHMENTS_DESC_TABLE;
- 
- 		if ( !($result = $db->sql_query($sql)) )
- 		{
- 			message_die(GENERAL_ERROR, 'Could not get attachment informations', '', __LINE__, __FILE__, $sql);
- 		}
- 
- 		$num_attachments = $db->sql_numrows($result);
- 	}
- 	else
- 	{
- 		$num_attachments = $num;
- 	}
- 
- 	$hidden = '<input type="hidden" name="start" value="' . $start . '">';
- 	$hidden .= '<input type="hidden" name="num"' . $num_attachments . '">';
  	
  	$template->assign_vars(array(
  		'L_SHADOW_TITLE' => $lang['Shadow_attachments'],
--- 627,634 ----
***************
*** 634,655 ****
  		'L_DELETE_MARKED' => $lang['Delete_marked'],
  		'L_MARK_ALL' => $lang['Mark_all'],
  		'L_UNMARK_ALL' => $lang['Unmark_all'],
- 		'L_NEXT' => $lang['Next'],
  		
  		'S_HIDDEN' => $hidden,
  		'S_ATTACH_ACTION' => append_sid('admin_attachments.' . $phpEx . '?mode=shadow'))
  	);
  
- 	if ( ($start + $max_attachments < $num_attachments) )
- 	{
- 		$template->assign_block_vars('switch_next_screen', array());
- 
- 		$template->assign_vars(array(
- 			'S_NEXT' => append_sid('admin_attachments.' . $phpEx . '?mode=shadow&amp;start=' . ($start + $max_attachments) . '&amp;num=' . $num_attachments))
- 		);
- 	}
- 
  	$table_attachments = array();
  	$file_attachments = array();
  
  	//
--- 641,653 ----
  		'L_DELETE_MARKED' => $lang['Delete_marked'],
  		'L_MARK_ALL' => $lang['Mark_all'],
  		'L_UNMARK_ALL' => $lang['Unmark_all'],
  		
  		'S_HIDDEN' => $hidden,
  		'S_ATTACH_ACTION' => append_sid('admin_attachments.' . $phpEx . '?mode=shadow'))
  	);
  
  	$table_attachments = array();
+ 	$assign_attachments = array();
  	$file_attachments = array();
  
  	//
***************
*** 657,664 ****
  	//
  	$sql = "SELECT attach_id, physical_filename, comment 
  	FROM " . ATTACHMENTS_DESC_TABLE . "
! 	ORDER BY attach_id
! 	LIMIT " . $start . ", " . $max_attachments;
  
  	if ( !($result = $db->sql_query($sql)) )
  	{
--- 655,661 ----
  	//
  	$sql = "SELECT attach_id, physical_filename, comment 
  	FROM " . ATTACHMENTS_DESC_TABLE . "
! 	ORDER BY attach_id";
  
  	if ( !($result = $db->sql_query($sql)) )
  	{
***************
*** 674,679 ****
--- 671,690 ----
  		$i++;
  	}
  
+ 	$sql = "SELECT attach_id
+ 	FROM " . ATTACHMENTS_TABLE . "
+ 	GROUP BY attach_id";
+ 
+ 	if ( !($result = $db->sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not get attachment informations', '', __LINE__, __FILE__, $sql);
+ 	}
+ 
+ 	while ($row = $db->sql_fetchrow($result))
+ 	{
+ 		$assign_attachments[] = intval($row['attach_id']);
+ 	}
+ 
  	//
  	// collect all attachments on file-system
  	//
***************
*** 692,766 ****
  	{
  		if (count($table_attachments['attach_id']) > 0)
  		{
! 			if (!in_array($file_attachments[$i], $table_attachments['physical_filename']) )
  			{	
! 				$shadow_attachments[] = $file_attachments[$i];
  			}
  		}
  		else
  		{
! 			$shadow_attachments[] = $file_attachments[$i];
  		}
  	}
  
- 	// If all is well, go to the next step
- 	if (count($shadow_attachments) == 0)
- 	{
  		// Go through the Database and get those Files not stored at the Filespace
  		for ($i = 0; $i < count($table_attachments['attach_id']); $i++)
  		{
! 			if ( !in_array($table_attachments['physical_filename'][$i], $file_attachments))
  			{	
  				$shadow_row['attach_id'][] = $table_attachments['attach_id'][$i];
! 				$shadow_row['physical_filename'][] = $table_attachments['physical_filename'][$i];
  				$shadow_row['comment'][] = $table_attachments['comment'][$i];
  			}
  		}
  		
- 		// If all is well, go to the next step
- 		if (count($shadow_row) == 0)
- 		{
  			// Now look at the missing posts and PM's
  			for ($i = 0; $i < count($table_attachments['attach_id']); $i++)
  			{
  				if (!entry_exists($table_attachments['attach_id'][$i]))
  				{
  					$shadow_row['attach_id'][] = $table_attachments['attach_id'][$i];
! 					$shadow_row['physical_filename'][] = $table_attachments['physical_filename'][$i];
  					$shadow_row['comment'][] = $table_attachments['comment'][$i];
  				}
  			}
  
! 			// Ok, the last step
! 			// Nothing seems to be there if shadow_row is empty. We will not check all Posts and PM's marked as 'having Attachment', because this 
! 			// is done at Synchronizing Attachments
! 			if (count($shadow_row) != 0)
  			{
! 				for ($i = 0; $i < count($shadow_row['attach_id']); $i++)
  				{
! 					$template->assign_block_vars('table_shadow_row', array(
! 						'ATTACH_ID' => $shadow_row['attach_id'][$i],
! 						'ATTACH_FILENAME' => $shadow_row['physical_filename'][$i],
! 						'ATTACH_COMMENT' => ( trim($shadow_row['comment'][$i]) == '' ) ? $lang['No_file_comment_available'] : trim($shadow_row['comment'][$i]))
! 					);
! 				}
! 			}
! 		}
! 		else
! 		{
! 			for ($i = 0; $i < count($shadow_row['attach_id']); $i++)
! 			{
! 				$template->assign_block_vars('table_shadow_row', array(
! 					'ATTACH_ID' => $shadow_row['attach_id'][$i],
! 					'ATTACH_FILENAME' => $shadow_row['physical_filename'][$i],
! 					'ATTACH_COMMENT' => ( trim($shadow_row['comment'][$i]) == '' ) ? $lang['No_file_comment_available'] : trim($shadow_row['comment'][$i]))
! 				);
  			}
  		}
  
- 	}
- 	else
- 	{
  		for ($i = 0; $i < count($shadow_attachments); $i++)
  		{
  			$template->assign_block_vars('file_shadow_row', array(
--- 702,771 ----
  	{
  		if (count($table_attachments['attach_id']) > 0)
  		{
! 			if ($file_attachments[$i] != '')
  			{
! 				if (!in_array(trim($file_attachments[$i]), $table_attachments['physical_filename']) )
! 				{	
! 					$shadow_attachments[] = trim($file_attachments[$i]);
! 					// Delete this file from the file_attachments to not have double assignments in next steps
! 					$file_attachments[$i] = '';
! 				}
  			}
  		}
  		else
  		{
! 			if ($file_attachments[$i] != '')
! 			{
! 				$shadow_attachments[] = trim($file_attachments[$i]);
! 				// Delete this file from the file_attachments to not have double assignments in next steps
! 				$file_attachments[$i] = '';
! 			}
  		}
  	}
  
  	// Go through the Database and get those Files not stored at the Filespace
  	for ($i = 0; $i < count($table_attachments['attach_id']); $i++)
  	{
! 		if ($table_attachments['physical_filename'][$i] != '')
! 		{
! 			if ( !in_array(trim($table_attachments['physical_filename'][$i]), $file_attachments))
  			{	
  				$shadow_row['attach_id'][] = $table_attachments['attach_id'][$i];
! 				$shadow_row['physical_filename'][] = trim($table_attachments['physical_filename'][$i]);
  				$shadow_row['comment'][] = $table_attachments['comment'][$i];
+ 				// Delete this entry from the table_attachments, to not interfere with the next step
+ 				$table_attachments['attach_id'][$i] = -1;
+ 				$table_attachments['physical_filename'][$i] = '';
+ 				$table_attachments['comment'][$i] = '';
+ 			}
  		}
  	}
  
  	// Now look at the missing posts and PM's
  	for ($i = 0; $i < count($table_attachments['attach_id']); $i++)
  	{
+ 		if ($table_attachments['attach_id'][$i] != -1)
+ 		{
  			if (!entry_exists($table_attachments['attach_id'][$i]))
  			{
  				$shadow_row['attach_id'][] = $table_attachments['attach_id'][$i];
! 				$shadow_row['physical_filename'][] = trim($table_attachments['physical_filename'][$i]);
  				$shadow_row['comment'][] = $table_attachments['comment'][$i];
  			}
  		}
+ 	}
  
! 	// Now look for Attachment ID's defined for posts or topics but not defined at the Attachments Description Table
! 	for ($i = 0; $i < count($assign_attachments); $i++)
  	{
! 		if (!in_array($assign_attachments[$i], $table_attachments['attach_id']))
  		{
! 			$shadow_row['attach_id'][] = $assign_attachments[$i];
! 			$shadow_row['physical_filename'][] = $lang['Empty_file_entry'];
! 			$shadow_row['comment'][] = $lang['Empty_file_entry'];
  		}
  	}
  
  	for ($i = 0; $i < count($shadow_attachments); $i++)
  	{
  		$template->assign_block_vars('file_shadow_row', array(
***************
*** 770,777 ****
  				'U_ATTACHMENT' => $upload_dir . '/' . $shadow_attachments[$i])
  			);
  		}
- 	}
  
  }
  
  if ($submit && $mode == 'cats')
--- 775,789 ----
  			'U_ATTACHMENT' => $upload_dir . '/' . $shadow_attachments[$i])
  		);
  	}
  
+ 	for ($i = 0; $i < count($shadow_row['attach_id']); $i++)
+ 	{
+ 		$template->assign_block_vars('table_shadow_row', array(
+ 			'ATTACH_ID' => $shadow_row['attach_id'][$i],
+ 			'ATTACH_FILENAME' => $shadow_row['physical_filename'][$i],
+ 			'ATTACH_COMMENT' => ( trim($shadow_row['comment'][$i]) == '' ) ? $lang['No_file_comment_available'] : trim($shadow_row['comment'][$i]))
+ 		);
+ 	}
  }
  
  if ($submit && $mode == 'cats')
***************
*** 912,918 ****
  
  	for ($i = 0; $i < $num_rows; $i++)
  	{
! 		$attach_config[$row[$i]['config_name']] = $row[$i]['config_value'];
  	}
  
  	if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
--- 924,930 ----
  
  	for ($i = 0; $i < $num_rows; $i++)
  	{
! 		$attach_config[$row[$i]['config_name']] = trim($row[$i]['config_value']);
  	}
  
  	if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
***************
*** 931,944 ****
  	//
  	// Does the target directory exist, is it a directory and writeable. (only test if ftp upload is disabled)
  	//
! 	if ( ($attach_config['allow_ftp_upload'] == '0') && ($attach_config['img_create_thumbnail'] == '1') )
  	{
! 		if ( !file_exists($upload_dir) )
  		{
  			@mkdir($upload_dir, 0755);
  			@chmod($upload_dir, 0777);
  		
! 			if ( !file_exists($upload_dir) )
  			{
  				$error = TRUE;
  				$error_msg = sprintf($lang['Directory_does_not_exist'], $upload_dir) . '<br />';
--- 943,956 ----
  	//
  	// Does the target directory exist, is it a directory and writeable. (only test if ftp upload is disabled)
  	//
! 	if ( (intval($attach_config['allow_ftp_upload']) == 0) && (intval($attach_config['img_create_thumbnail']) == 1) )
  	{
! 		if ( !@file_exists(@amod_realpath($upload_dir)) )
  		{
  			@mkdir($upload_dir, 0755);
  			@chmod($upload_dir, 0777);
  		
! 			if ( !@file_exists(@amod_realpath($upload_dir)) )
  			{
  				$error = TRUE;
  				$error_msg = sprintf($lang['Directory_does_not_exist'], $upload_dir) . '<br />';
***************
*** 966,972 ****
  			}
  		}
  	}
! 	else if ( ($attach_config['allow_ftp_upload'] == '1') && ($attach_config['img_create_thumbnail'] == '1') )
  	{
  		//
  		// Check FTP Settings
--- 978,984 ----
  			}
  		}
  	}
! 	else if ( (intval($attach_config['allow_ftp_upload'])) && (intval($attach_config['img_create_thumbnail'])) )
  	{
  		//
  		// Check FTP Settings
***************
*** 989,994 ****
--- 1001,1012 ----
  			$error_msg = sprintf($lang['Ftp_error_login'], $attach_config['ftp_user']) . '<br />';
  		}
  		
+ 		if (!@ftp_pasv($conn_id, intval($attach_config['ftp_pasv_mode'])))
+ 		{
+ 			$error = TRUE;
+ 			$error_msg = $lang['Ftp_error_pasv_mode'];
+ 		}
+ 
  		if (!$error)
  		{
  			//
***************
*** 1054,1074 ****
  
  if ($mode == 'sync')
  {
- 	// TODO
- 	// Sync complete forum
  	$info = '';
  	@set_time_limit(0);
  	$sql = "SELECT topic_id	FROM " . TOPICS_TABLE;
  	if ( !($result = $db->sql_query($sql)) )
  	{
  		message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
  	}
  
  	while( $row = $db->sql_fetchrow($result) )
  	{
  		attachment_sync_topic($row['topic_id']);
  	}
  
  	// Sync Thumbnails (if a thumbnail is no longer there, delete it)
  	// Get all Posts/PM's with the Thumbnail Flag set
  	// Go through all of them and make sure the Thumbnail exist. If it does not exist, unset the Thumbnail Flag
--- 1072,1099 ----
  
  if ($mode == 'sync')
  {
  	$info = '';
  	@set_time_limit(0);
+ 
+ 	print_r('Sync Topics');
+ 	
  	$sql = "SELECT topic_id	FROM " . TOPICS_TABLE;
  	if ( !($result = $db->sql_query($sql)) )
  	{
  		message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
  	}
  
+ 	print_r('<br />');
+ 
  	while( $row = $db->sql_fetchrow($result) )
  	{
+ 		print_r('.');
  		attachment_sync_topic($row['topic_id']);
  	}
  
+ 	print_r('<br /><br />');
+ 	print_r('Sync Thumbnails');
+ 	
  	// Sync Thumbnails (if a thumbnail is no longer there, delete it)
  	// Get all Posts/PM's with the Thumbnail Flag set
  	// Go through all of them and make sure the Thumbnail exist. If it does not exist, unset the Thumbnail Flag
***************
*** 1079,1102 ****
  		message_die(GENERAL_ERROR, 'Could not get thumbnail informations', '', __LINE__, __FILE__, $sql);
  	}
  	
  	while ($row = $db->sql_fetchrow($result))
  	{
  		if (!thumbnail_exists($row['physical_filename']))
  		{
  			$info .= sprintf($lang['Sync_thumbnail_resetted'], $row['physical_filename']) . '<br />';
  			$sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . " SET thumbnail = 0 WHERE attach_id = " . $row['attach_id'];
  			if ( !($db->sql_query($sql)) )
  			{
! 				message_die(GENERAL_ERROR, 'Could not update thumbnail informations', '', __LINE__, __FILE__, $sql);
  			}
  		}
  	}
  	
! 	message_die(GENERAL_MESSAGE, $lang['Attach_sync_finished'] . '<br /><br />' . $info);
  
  	exit();
  }
  
  if ($error)
  {
  	$template->set_filenames(array(
--- 1104,1413 ----
  		message_die(GENERAL_ERROR, 'Could not get thumbnail informations', '', __LINE__, __FILE__, $sql);
  	}
  	
+ 	print_r('<br />');
+ 
  	while ($row = $db->sql_fetchrow($result))
  	{
+ 		print_r('.');
+ 
  		if (!thumbnail_exists($row['physical_filename']))
  		{
  			$info .= sprintf($lang['Sync_thumbnail_resetted'], $row['physical_filename']) . '<br />';
  			$sql = "UPDATE " . ATTACHMENTS_DESC_TABLE . " SET thumbnail = 0 WHERE attach_id = " . $row['attach_id'];
  			if ( !($db->sql_query($sql)) )
  			{
! 				$error = $db->sql_error();
! 				die('Could not update thumbnail informations -> ' . $error['message'] . ' -> ' . $sql);
  			}
  		}
  	}
  	
! 	die('<br /><br /><br />' . $lang['Attach_sync_finished'] . '<br /><br />' . $info);
  
  	exit();
  }
  
+ // Quota Limit Settings
+ if ($submit && $mode == 'quota')
+ {
+ 	//
+ 	// Change Quota Limit
+ 	//
+ 	$quota_change_list = ( isset($HTTP_POST_VARS['quota_change_list']) ) ? $HTTP_POST_VARS['quota_change_list'] : array();
+ 	$quota_desc_list = ( isset($HTTP_POST_VARS['quota_desc_list']) ) ? $HTTP_POST_VARS['quota_desc_list'] : array();
+ 	$filesize_list = ( isset($HTTP_POST_VARS['max_filesize_list']) ) ? $HTTP_POST_VARS['max_filesize_list'] : array();
+ 	$size_select_list = ( isset($HTTP_POST_VARS['size_select_list']) ) ? $HTTP_POST_VARS['size_select_list'] : array();
+ 
+ 	$allowed_list = array();
+ 
+ 	for ($i = 0; $i < count($quota_change_list); $i++)
+ 	{
+ 		$filesize_list[$i] = ( $size_select_list[$i] == 'kb' ) ? round($filesize_list[$i] * 1024) : ( ($size_select_list[$i] == 'mb') ? round($filesize_list[$i] * 1048576) : $filesize_list[$i] );
+ 
+ 		$sql = "UPDATE " . QUOTA_LIMITS_TABLE . " 
+ 		SET quota_desc = '" . trim(strip_tags($quota_desc_list[$i])) . "', quota_limit = " . $filesize_list[$i] . "
+ 		WHERE quota_limit_id = " . $quota_change_list[$i];
+ 		
+ 		if ( !($db->sql_query($sql)) )
+ 		{
+ 			message_die(GENERAL_ERROR, 'Couldn\'t update Quota Limits', '', __LINE__, __FILE__, $sql);
+ 		}
+ 	}
+ 	
+ 	//
+ 	// Delete Quota Limits
+ 	//
+ 	$quota_id_list = ( isset($HTTP_POST_VARS['quota_id_list']) ) ?  $HTTP_POST_VARS['quota_id_list'] : array();
+ 
+ 	$quota_id_sql = implode(', ', $quota_id_list);
+ 
+ 	if ($quota_id_sql != '')
+ 	{
+ 		$sql = 'DELETE 
+ 		FROM ' . QUOTA_LIMITS_TABLE . ' 
+ 		WHERE quota_limit_id IN (' . $quota_id_sql . ')';
+ 
+ 		if ( !($result = $db->sql_query($sql)) )
+ 		{
+ 			message_die(GENERAL_ERROR, 'Could not delete Quota Limits', '', __LINE__, __FILE__, $sql);
+ 		}
+ 
+ 		// Delete Quotas linked to this setting
+ 		$sql = 'DELETE 
+ 		FROM ' . QUOTA_TABLE . ' 
+ 		WHERE quota_limit_id IN (' . $quota_id_sql . ')';
+ 
+ 		if ( !($result = $db->sql_query($sql)) )
+ 		{
+ 			message_die(GENERAL_ERROR, 'Could not delete Quotas', '', __LINE__, __FILE__, $sql);
+ 		}
+ 
+ 	}
+ 		
+ 	//
+ 	// Add Quota Limit ?
+ 	//
+ 	$quota_desc = ( isset($HTTP_POST_VARS['quota_description']) ) ?  trim(strip_tags($HTTP_POST_VARS['quota_description'])) : '';
+ 	$filesize = ( isset($HTTP_POST_VARS['add_max_filesize']) ) ?  $HTTP_POST_VARS['add_max_filesize'] : '';
+ 	$size_select = ( isset($HTTP_POST_VARS['add_size_select']) ) ?  $HTTP_POST_VARS['add_size_select'] : '';
+ 	$add = ( isset($HTTP_POST_VARS['add_quota_check']) ) ? TRUE : FALSE;
+ 
+ 	if ($quota_desc != '' && $add)
+ 	{
+ 		//
+ 		// check Quota Description
+ 		//
+ 		$sql = 'SELECT quota_desc
+ 		FROM ' . QUOTA_LIMITS_TABLE;
+ 	
+ 		if ( !($result = $db->sql_query($sql)) )
+ 		{
+ 			message_die(GENERAL_ERROR, 'Could not query Quota Limits Table', '', __LINE__, __FILE__, $sql);
+ 		}
+ 			
+ 		$row = $db->sql_fetchrowset($result);
+ 		$num_rows = $db->sql_numrows($result);
+ 
+ 		if ( $num_rows > 0 )
+ 		{
+ 			for ($i = 0; $i < $num_rows; $i++)
+ 			{
+ 				if ($row[$i]['quota_desc'] == $quota_desc)
+ 				{
+ 					$error = TRUE;
+ 					if( isset($error_msg) )
+ 					{
+ 						$error_msg .= '<br />';
+ 					}
+ 					$error_msg .= sprintf($lang['Quota_limit_exist'], $extension_group);
+ 				}
+ 			}
+ 		}
+ 			
+ 		if (!$error)
+ 		{
+ 			$filesize = ( $size_select == 'kb' ) ? round($filesize * 1024) : ( ($size_select == 'mb') ? round($filesize * 1048576) : $filesize );
+ 		
+ 			$sql = "INSERT INTO " . QUOTA_LIMITS_TABLE . " (quota_desc, quota_limit) 
+ 			VALUES ('" . $quota_desc . "', " . $filesize . ")";
+ 	
+ 			if ( !($db->sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Could not add Quota Limit', '', __LINE__, __FILE__, $sql);
+ 			}
+ 		}
+ 
+ 	}
+ 
+ 	if (!$error)
+ 	{
+ 		$message = $lang['Attach_config_updated'] . '<br /><br />' . sprintf($lang['Click_return_attach_config'], '<a href="' . append_sid("admin_attachments.$phpEx?mode=quota") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
+ 
+ 		message_die(GENERAL_MESSAGE, $message);
+ 	}
+ 
+ }
+ 
+ if ($mode == 'quota')
+ {
+ 
+ 	$template->set_filenames(array(
+ 		'body' => 'admin/attach_quota_body.tpl')
+ 	);
+ 
+ 	$max_add_filesize = intval($attach_config['max_filesize']);
+ 	$size = ($max_add_filesize >= 1048576) ? 'mb' : ( ($max_add_filesize >= 1024) ? 'kb' : 'b' );
+ 
+ 	if ($max_add_filesize >= 1048576)
+ 	{
+ 		$max_add_filesize = round($max_add_filesize / 1048576 * 100) / 100;
+ 	}
+ 	else if ( $max_add_filesize >= 1024)
+ 	{
+ 		$max_add_filesize = round($max_add_filesize / 1024 * 100) / 100;
+ 	}
+ 
+ 	$template->assign_vars(array(
+ 		'L_MANAGE_QUOTAS_TITLE' => $lang['Manage_quotas'],
+ 		'L_MANAGE_QUOTAS_EXPLAIN' => $lang['Manage_quotas_explain'],
+ 		'L_SUBMIT' => $lang['Submit'],
+ 		'L_RESET' => $lang['Reset'],
+ 		'L_EDIT' => $lang['Edit'],
+ 		'L_VIEW' => $lang['View'],
+ 		'L_DESCRIPTION' => $lang['Description'],
+ 		'L_SIZE' => $lang['Max_filesize_attach'],
+ 		'L_ADD_NEW' => $lang['Add_new'],
+ 		'L_DELETE' => $lang['Delete'],
+ 		'MAX_FILESIZE' => $max_add_filesize,
+ 
+ 		'S_FILESIZE' => size_select('add_size_select', $size),
+ 		'L_REMOVE_SELECTED' => $lang['Remove_selected'],
+ 
+ 		'S_ATTACH_ACTION' => append_sid('admin_attachments.' . $phpEx . '?mode=quota'))
+ 	);
+ 
+ 	$sql = "SELECT * FROM " . QUOTA_LIMITS_TABLE . " ORDER BY quota_limit DESC";
+ 
+ 	if ( !($result = $db->sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
+ 	}
+ 	
+ 	$rows = $db->sql_fetchrowset($result);
+ 
+ 	for ($i = 0; $i < count($rows); $i++)
+ 	{
+ 		$size_format = ($rows[$i]['quota_limit'] >= 1048576) ? 'mb' : ( ($rows[$i]['quota_limit'] >= 1024) ? 'kb' : 'b' );
+ 
+ 		if ( $rows[$i]['quota_limit'] >= 1048576)
+ 		{
+ 			$rows[$i]['quota_limit'] = round($rows[$i]['quota_limit'] / 1048576 * 100) / 100;
+ 		}
+ 		else if($rows[$i]['quota_limit'] >= 1024)
+ 		{
+ 			$rows[$i]['quota_limit'] = round($rows[$i]['quota_limit'] / 1024 * 100) / 100;
+ 		}
+ 
+ 		$template->assign_block_vars('limit_row', array(
+ 			'QUOTA_NAME' => stripslashes($rows[$i]['quota_desc']),
+ 			'QUOTA_ID' => $rows[$i]['quota_limit_id'],
+ 			'S_FILESIZE' => size_select('size_select_list[]', $size_format),
+ 			'U_VIEW' => append_sid("admin_attachments.$phpEx?mode=$mode&amp;e_mode=view_quota&amp;quota_id=" . $rows[$i]['quota_limit_id']),
+ 			'MAX_FILESIZE' => $rows[$i]['quota_limit'])
+ 		);
+ 	}
+ }
+ 
+ if ($mode == 'quota' && $e_mode == 'view_quota')
+ {
+ 	if( isset($HTTP_POST_VARS['quota_id']) || isset($HTTP_GET_VARS['quota_id']) )
+ 	{
+ 		$quota_id = ( isset($HTTP_POST_VARS['quota_id']) ) ? intval($HTTP_POST_VARS['quota_id']) : intval($HTTP_GET_VARS['quota_id']);
+ 	}
+ 	else
+ 	{
+ 		message_die(GENERAL_MESSAGE, 'Invalid Call');
+ 	}
+ 
+ 	$template->assign_block_vars('switch_quota_limit_desc', array());
+ 
+ 	$sql = "SELECT * FROM " . QUOTA_LIMITS_TABLE . " WHERE quota_limit_id = " . $quota_id . " LIMIT 1";
+ 
+ 	if ( !($result = $db->sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
+ 	}
+ 	
+ 	$row = $db->sql_fetchrow($result);
+ 	
+ 	$template->assign_vars(array(
+ 		'L_QUOTA_LIMIT_DESC' => $row['quota_desc'],
+ 		'L_ASSIGNED_USERS' => $lang['Assigned_users'],
+ 		'L_ASSIGNED_GROUPS' => $lang['Assigned_groups'],
+ 		'L_UPLOAD_QUOTA' => $lang['Upload_quota'],
+ 		'L_PM_QUOTA' => $lang['Pm_quota'])
+ 	);
+ 	
+ 	$sql = "SELECT q.user_id, u.username, q.quota_type FROM " . QUOTA_TABLE . " q, " . USERS_TABLE . " u
+ 	WHERE q.quota_limit_id = " . $quota_id . " AND q.user_id <> 0 AND q.user_id = u.user_id";
+ 
+ 	if ( !($result = $db->sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
+ 	}
+ 	
+ 	$rows = $db->sql_fetchrowset($result);
+ 	$num_rows = $db->sql_numrows($result);
+ 
+ 	for ($i = 0; $i < $num_rows; $i++)
+ 	{
+ 		if ($rows[$i]['quota_type'] == QUOTA_UPLOAD_LIMIT)
+ 		{
+ 			$template->assign_block_vars('users_upload_row', array(
+ 				'USER_ID' => $rows[$i]['user_id'],
+ 				'USERNAME' => $rows[$i]['username'])
+ 			);
+ 		}
+ 		else if ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT)
+ 		{
+ 			$template->assign_block_vars('users_pm_row', array(
+ 				'USER_ID' => $rows[$i]['user_id'],
+ 				'USERNAME' => $rows[$i]['username'])
+ 			);
+ 		}
+ 	}
+ 
+ 	$sql = "SELECT q.group_id, g.group_name, q.quota_type FROM " . QUOTA_TABLE . " q, " . GROUPS_TABLE . " g
+ 	WHERE q.quota_limit_id = " . $quota_id . " AND q.group_id <> 0 AND q.group_id = g.group_id";
+ 
+ 	if ( !($result = $db->sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not get quota limits', '', __LINE__, __FILE__, $sql);
+ 	}
+ 	
+ 	$rows = $db->sql_fetchrowset($result);
+ 	$num_rows = $db->sql_numrows($result);
+ 
+ 	for ($i = 0; $i < $num_rows; $i++)
+ 	{
+ 		if ($rows[$i]['quota_type'] == QUOTA_UPLOAD_LIMIT)
+ 		{
+ 			$template->assign_block_vars('groups_upload_row', array(
+ 				'GROUP_ID' => $rows[$i]['group_id'],
+ 				'GROUPNAME' => $rows[$i]['group_name'])
+ 			);
+ 		}
+ 		else if ($rows[$i]['quota_type'] == QUOTA_PM_LIMIT)
+ 		{
+ 			$template->assign_block_vars('groups_pm_row', array(
+ 				'GROUP_ID' => $rows[$i]['group_id'],
+ 				'GROUPNAME' => $rows[$i]['group_name'])
+ 			);
+ 		}
+ 	}
+ }
+ 
+ 
  if ($error)
  {
  	$template->set_filenames(array(
diff -c -rNbB attach_mod_v234/admin/admin_extensions.php attach_mod_v235/admin/admin_extensions.php
*** attach_mod_v234/admin/admin_extensions.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/admin/admin_extensions.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: admin_extensions.php,v 1.16 2002/11/03 23:46:04 meik Exp $
   *
   ***************************************************************************/
  
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: admin_extensions.php,v 1.18 2003/01/15 23:24:26 acydburn Exp $
   *
   ***************************************************************************/
  
***************
*** 37,45 ****
  require($phpbb_root_path . 'extension.inc');
  require('pagestart.' . $phpEx);
  
- include($phpbb_root_path . 'attach_mod/includes/functions_selects.'.$phpEx);
- include($phpbb_root_path . 'attach_mod/includes/functions_admin.'.$phpEx);
- 
  //
  // Init Vars
  //
--- 37,42 ----
***************
*** 93,99 ****
  
  while ($row = $db->sql_fetchrow($result))
  {
! 	$attach_config[$row['config_name']] = $row['config_value'];
  }
  
  //
--- 90,96 ----
  
  while ($row = $db->sql_fetchrow($result))
  {
! 	$attach_config[$row['config_name']] = trim($row['config_value']);
  }
  
  //
***************
*** 504,510 ****
  
  	if ((empty($size)) && (!$submit))
  	{
! 		$max_add_filesize = $attach_config['max_filesize'];
  		
  		$size = ($max_add_filesize >= 1048576) ? 'mb' : ( ($max_add_filesize >= 1024) ? 'kb' : 'b' );
  	} 
--- 501,507 ----
  
  	if ((empty($size)) && (!$submit))
  	{
! 		$max_add_filesize = intval($attach_config['max_filesize']);
  		
  		$size = ($max_add_filesize >= 1048576) ? 'mb' : ( ($max_add_filesize >= 1024) ? 'kb' : 'b' );
  	} 
***************
*** 563,569 ****
  		//
  		if ( $extension_group[$i]['max_filesize'] == 0 )
  		{
! 			$extension_group[$i]['max_filesize'] = $attach_config['max_filesize'];
  		}
  
  		$size_format = ($extension_group[$i]['max_filesize'] >= 1048576) ? 'mb' : ( ($extension_group[$i]['max_filesize'] >= 1024) ? 'kb' : 'b' );
--- 560,566 ----
  		//
  		if ( $extension_group[$i]['max_filesize'] == 0 )
  		{
! 			$extension_group[$i]['max_filesize'] = intval($attach_config['max_filesize']);
  		}
  
  		$size_format = ($extension_group[$i]['max_filesize'] >= 1048576) ? 'mb' : ( ($extension_group[$i]['max_filesize'] >= 1024) ? 'kb' : 'b' );
diff -c -rNbB attach_mod_v234/attach_mod/attach_rules.php attach_mod_v235/attach_mod/attach_rules.php
*** attach_mod_v234/attach_mod/attach_rules.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/attach_rules.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: attach_rules.php,v 1.5 2002/11/03 23:46:04 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: attach_rules.php,v 1.9 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 38,44 ****
  }
  else
  {
! 	message_die(GENERAL_ERROR, 'You are not allowed to call this file');
  }
  
  //
--- 38,44 ----
  }
  else
  {
! 	message_die(GENERAL_ERROR, 'You are not allowed to call this file (ID:1)');
  }
  
  //
***************
*** 53,68 ****
  // 
  if ($privmsg)
  {
! 	$auth['auth_attachments'] = $attach_config['allow_pm_attach'];
  }
  else
  {
! 	$auth = auth(AUTH_ATTACH, $forum_id, $userdata);
  }
  
! if (!$auth['auth_attachments'])
  {
! 	message_die(GENERAL_ERROR, 'You are not allowed to call this file');
  }
  
  $template->set_filenames(array(
--- 53,69 ----
  // 
  if ($privmsg)
  {
! 	$auth['auth_attachments'] = intval($attach_config['allow_pm_attach']);
! 	$auth['auth_view'] = TRUE;
  }
  else
  {
! 	$auth = auth(AUTH_ALL, $forum_id, $userdata);
  }
  
! if (!( ($auth['auth_attachments']) && ($auth['auth_view'])))
  {
! 	message_die(GENERAL_ERROR, 'You are not allowed to call this file (ID:2)');
  }
  
  $template->set_filenames(array(
***************
*** 112,119 ****
  			$det_filesize = round($det_filesize / 1024 * 100) / 100; 
  		} 
            
  		$template->assign_block_vars('group_row', array(
! 			'GROUP_RULE_HEADER' => sprintf($lang['Group_rule_header'], $group_name, $det_filesize . ' ' . $size_lang))
  		);
  		
  		$sql = "SELECT extension
--- 113,122 ----
  			$det_filesize = round($det_filesize / 1024 * 100) / 100; 
  		} 
            
+ 		$max_filesize = ($det_filesize == 0) ? $lang['Unlimited'] : $det_filesize . ' ' . $size_lang;
+ 
  		$template->assign_block_vars('group_row', array(
! 			'GROUP_RULE_HEADER' => sprintf($lang['Group_rule_header'], $group_name, $max_filesize))
  		);
  		
  		$sql = "SELECT extension
diff -c -rNbB attach_mod_v234/attach_mod/attachment_mod.php attach_mod_v235/attach_mod/attachment_mod.php
*** attach_mod_v234/attach_mod/attachment_mod.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/attachment_mod.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: attachment_mod.php,v 1.11 2002/11/03 12:44:38 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: attachment_mod.php,v 1.17 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 40,64 ****
  
  function include_attach_lang()
  {
! 	global $phpbb_root_path, $phpEx, $lang, $board_config;
  	
  	//
  	// Include Language
  	//
  	$language = $board_config['default_lang'];
  
! 	if ( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_main_attach.'.$phpEx) )
  	{
! 		$language = 'english';
  	}
  
  	include($phpbb_root_path . 'language/lang_' . $language . '/lang_main_attach.' . $phpEx);
  
  	if ( defined('IN_ADMIN') )
  	{
! 		if( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.'.$phpEx) )
  		{
! 			$language = 'english';
  		}
  
  		include($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.' . $phpEx);
--- 40,64 ----
  
  function include_attach_lang()
  {
! 	global $phpbb_root_path, $phpEx, $lang, $board_config, $attach_config;
  	
  	//
  	// Include Language
  	//
  	$language = $board_config['default_lang'];
  
! 	if ( !@file_exists(@amod_realpath($phpbb_root_path . 'language/lang_' . $language . '/lang_main_attach.'.$phpEx)) )
  	{
! 		$language = $attach_config['board_lang'];
  	}
  
  	include($phpbb_root_path . 'language/lang_' . $language . '/lang_main_attach.' . $phpEx);
  
  	if ( defined('IN_ADMIN') )
  	{
! 		if( !@file_exists(@amod_realpath($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.'.$phpEx)) )
  		{
! 			$language = $attach_config['board_lang'];
  		}
  
  		include($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.' . $phpEx);
***************
*** 66,87 ****
  
  }
  
  //
  // Get Attachment Config
  //
  $attach_config = array();
  
! $sql = 'SELECT *
! FROM ' . ATTACH_CONFIG_TABLE;
! 	 
! if ( !($result = attach_sql_query($sql)) )
  {
! 	message_die(GENERAL_ERROR, 'Could not query attachment information', '', __LINE__, __FILE__, $sql);
  }
! 
! while ($row = $db->sql_fetchrow($result))
  {
! 	$attach_config[$row['config_name']] = trim($row['config_value']);
  }
  
  // Please do not change the include-order, it is valuable for proper execution.
--- 66,128 ----
  
  }
  
+ function get_config()
+ {
+ 	global $db, $board_config;
+ 
+ 	$attach_config = array();
+ 
+ 	$sql = 'SELECT *
+ 	FROM ' . ATTACH_CONFIG_TABLE;
+ 	 
+ 	if ( !($result = attach_sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not query attachment information', '', __LINE__, __FILE__, $sql);
+ 	}
+ 
+ 	while ($row = $db->sql_fetchrow($result))
+ 	{
+ 		$attach_config[$row['config_name']] = trim($row['config_value']);
+ 	}
+ 
+ 	$attach_config['board_lang'] = trim($board_config['default_lang']);
+ 
+ 	return ($attach_config);
+ }
+ 
  //
  // Get Attachment Config
  //
+ $cache_dir = $phpbb_root_path . '/cache';
+ $cache_file = $cache_dir . '/attach_config.php';
  $attach_config = array();
  
! if ((file_exists($cache_dir)) && (is_dir($cache_dir)))
  {
! 	if (file_exists($cache_file))
! 	{
! 		include($cache_file);
! 	}
! 	else
! 	{
! 		$attach_config = get_config();
! 		$fp = @fopen($cache_file, 'wt+');
! 		if ($fp)
! 		{
! 			@reset($attach_config);
! 			fwrite($fp, "<?php\n");
! 			while (list($key, $value) = @each($attach_config) )
! 			{
! 				fwrite($fp, '$attach_config[\'' . $key . '\'] = \'' . trim($value) . '\';' . "\n");
! 			}
! 			fwrite($fp, '?>');
! 			fclose($fp);
! 		}
! 	}
  }
! else
  {
! 	$attach_config = get_config();
  }
  
  // Please do not change the include-order, it is valuable for proper execution.
***************
*** 94,100 ****
  
  if ( defined('IN_ADMIN') )
  {
! 	if (!$attach_config['allow_ftp_upload'])
  	{
  		if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
  		{
--- 135,141 ----
  
  if ( defined('IN_ADMIN') )
  {
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
  		if ( ($attach_config['upload_dir'][0] == '/') || ( ($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':') ) )
  		{
***************
*** 109,118 ****
  	{
  		$upload_dir = $attach_config['download_path'];
  	}
  }
  else
  {
! 	if (!$attach_config['allow_ftp_upload'])
  	{
  		$upload_dir = $attach_config['upload_dir'];
  	}
--- 150,162 ----
  	{
  		$upload_dir = $attach_config['download_path'];
  	}
+ 
+ 	include($phpbb_root_path . 'attach_mod/includes/functions_selects.' . $phpEx);
+ 	include($phpbb_root_path . 'attach_mod/includes/functions_admin.' . $phpEx);
  }
  else
  {
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
  		$upload_dir = $attach_config['upload_dir'];
  	}
diff -c -rNbB attach_mod_v234/attach_mod/displaying.php attach_mod_v235/attach_mod/displaying.php
*** attach_mod_v234/attach_mod/displaying.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/displaying.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: displaying.php,v 1.25 2002/11/03 11:37:03 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: displaying.php,v 1.41 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 44,50 ****
  			$filename = substr($filename, 1, strlen($filename));
  		}
  
! 		if (file_exists($template->cachedir . $filename . '.php'))
  		{
  			@unlink($template->cachedir . $filename . '.php');
  		}
--- 44,50 ----
  			$filename = substr($filename, 1, strlen($filename));
  		}
  
! 		if (@file_exists(@amod_realpath($template->cachedir . $filename . '.php')))
  		{
  			@unlink($template->cachedir . $filename . '.php');
  		}
***************
*** 113,119 ****
  		$complete_filename = $template->root . '/' . $complete_filename;
  	}
  
! 	if (!file_exists($complete_filename))
  	{
  		die("Template->make_filename(): Error - file $complete_filename does not exist");
  	}
--- 113,119 ----
  		$complete_filename = $template->root . '/' . $complete_filename;
  	}
  
! 	if (!@file_exists(@amod_realpath($complete_filename)))
  	{
  		die("Template->make_filename(): Error - file $complete_filename does not exist");
  	}
***************
*** 144,150 ****
  {
  	global $attach_config, $is_auth;
  
! 	if ( (intval($switch_attachment) == 0) || (!$is_auth['auth_download']) || ($attach_config['disable_mod'] == '1') || (empty($attach_config['topic_icon'])) )
  	{
  		return ('');
  	}
--- 144,150 ----
  {
  	global $attach_config, $is_auth;
  
! 	if ( (intval($switch_attachment) == 0) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))) || (intval($attach_config['disable_mod'])) || ($attach_config['topic_icon'] == '') )
  	{
  		return ('');
  	}
***************
*** 161,167 ****
  {
  	global $attach_config, $is_auth;
  		
! 	if ( (intval($switch_attachment) == 0) || ($attach_config['disable_mod'] == '1') || (!$is_auth['auth_download']) )
  	{
  		return;
  	}
--- 161,167 ----
  {
  	global $attach_config, $is_auth;
  		
! 	if ( (intval($switch_attachment) == 0) || (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))) )
  	{
  		return;
  	}
***************
*** 170,182 ****
  }
  
  //
  // Initializes some templating variables for displaying Attachments in Posts
  //
  function init_display_post_attachments($switch_attachment)
  {
! 	global $attach_config, $db, $is_auth, $template, $lang, $postrow, $total_posts, $attachments;
  
! 	if ( (intval($switch_attachment) == 0) || ($attach_config['disable_mod'] == '1') || (!$is_auth['auth_download']))
  	{
  		return;
  	}
--- 170,209 ----
  }
  
  //
+ // Generate the Display Assign File Link
+ //
+ /*
+ function display_assign_link($post_id)
+ {
+ 	global $attach_config, $is_auth, $phpEx;
+ 
+ 	$image = 'templates/subSilver/images/icon_mini_message.gif';
+ 
+ 	if ( (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))) )
+ 	{
+ 		return ('');
+ 	}
+ 
+ 	$temp_url = append_sid("assign_file.$phpEx?p=" . $post_id);
+ 	$link = '<a href="' . $temp_url . '" target="_blank"><img src="' . $image . '" alt="Add File" title="Add File" border="0" /></a>';
+ 	
+ 	return ($link);
+ }
+ */
+ 
+ //
  // Initializes some templating variables for displaying Attachments in Posts
  //
  function init_display_post_attachments($switch_attachment)
  {
! 	global $attach_config, $db, $is_auth, $template, $lang, $postrow, $total_posts, $attachments, $forum_row, $forum_topic_data;
  
! 	if ( (empty($forum_topic_data)) && (!empty($forum_row)) )
! 	{
! 		$switch_attachment = $forum_row['topic_attachment'];
! 	}
! 
! 	if ( (intval($switch_attachment) == 0) || (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))))
  	{
  		return;
  	}
***************
*** 236,244 ****
  {
  	global $attach_config, $userdata;
  
! 	$auth = ( $userdata['user_level'] == ADMIN ) ? '1' : $attach_config['allow_pm_attach'];
  	
! 	if ( (!attachment_exists_db($privmsg_id, PAGE_PRIVMSGS)) || ($auth == 0) || ($attach_config['disable_mod'] == '1') || (empty($attach_config['topic_icon'])) )
  	{
  		return ('');
  	}
--- 263,271 ----
  {
  	global $attach_config, $userdata;
  
! 	$auth = ( $userdata['user_level'] == ADMIN ) ? 1 : intval($attach_config['allow_pm_attach']);
  	
! 	if ( (!attachment_exists_db($privmsg_id, PAGE_PRIVMSGS)) || (!$auth) || (intval($attach_config['disable_mod'])) || ($attach_config['topic_icon'] == '') )
  	{
  		return ('');
  	}
***************
*** 253,275 ****
  //
  function display_pm_attachments($privmsgs_id, $switch_attachment)
  {
! 	global $attach_config, $userdata;
  		
  	if ( $userdata['user_level'] == ADMIN )
  	{
! 		$auth_download = '1';
  	}
  	else
  	{
! 		$auth_download = $attach_config['allow_pm_attach'];
  	}
  
! 	if ( (intval($switch_attachment) == 0) || ($attach_config['disable_mod'] == '1') || (!$auth_download) )
  	{
  		return;
  	}
  
  	display_attachments($privmsgs_id);
  }
  
  //
--- 280,307 ----
  //
  function display_pm_attachments($privmsgs_id, $switch_attachment)
  {
! 	global $attach_config, $userdata, $template, $lang;
  		
  	if ( $userdata['user_level'] == ADMIN )
  	{
! 		$auth_download = 1;
  	}
  	else
  	{
! 		$auth_download = intval($attach_config['allow_pm_attach']);
  	}
  
! 	if ( (intval($switch_attachment) == 0) || (intval($attach_config['disable_mod'])) || (!$auth_download) )
  	{
  		return;
  	}
  
  	display_attachments($privmsgs_id);
+ 	
+ 	$template->assign_block_vars('switch_attachments', array());
+ 	$template->assign_vars(array(
+ 		'L_DELETE_ATTACHMENTS' => $lang['Delete_attachments'])
+ 	);
  }
  
  //
***************
*** 281,294 ****
  
  	if ( $userdata['user_level'] == ADMIN )
  	{
! 		$auth_download = '1';
  	}
  	else
  	{
! 		$auth_download = $attach_config['allow_pm_attach'];
  	}
  
! 	if ( (intval($switch_attachment) == 0) || ($attach_config['disable_mod'] == '1') || (!$auth_download))
  	{
  		return;
  	}
--- 313,326 ----
  
  	if ( $userdata['user_level'] == ADMIN )
  	{
! 		$auth_download = 1;
  	}
  	else
  	{
! 		$auth_download = intval($attach_config['allow_pm_attach']);
  	}
  
! 	if ( (intval($switch_attachment) == 0) || (intval($attach_config['disable_mod'])) || (!$auth_download))
  	{
  		return;
  	}
***************
*** 332,338 ****
  {
  	global $attach_config, $attachments;
  		
! 	if ( (intval($switch_attachment) == 0) || ($attach_config['disable_mod'] == '1') || (!$is_auth['auth_download']) || (intval($attach_config['attachment_topic_review']) == 0))
  	{
  		return;
  	}
--- 364,370 ----
  {
  	global $attach_config, $attachments;
  		
! 	if ( (intval($switch_attachment) == 0) || (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))) || (intval($attach_config['attachment_topic_review']) == 0))
  	{
  		return;
  	}
***************
*** 355,361 ****
  {
  	global $attach_config;
  
! 	if ( ($attach_config['disable_mod'] == '1') || (!$is_auth['auth_download']) || (intval($attach_config['attachment_topic_review']) == 0))
  	{
  		return;
  	}
--- 387,393 ----
  {
  	global $attach_config;
  
! 	if ( (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))) || (intval($attach_config['attachment_topic_review']) == 0))
  	{
  		return;
  	}
***************
*** 375,381 ****
  //
  function display_attachments_preview($attachment_list, $attachment_filesize_list, $attachment_filename_list, $attachment_comment_list, $attachment_extension_list, $attachment_thumbnail_list)
  {
! 	global $attach_config, $is_auth, $allowed_extensions, $lang, $userdata, $display_categories, $upload_dir, $upload_icons, $template, $db;
  
  	if (count($attachment_list) != 0)
  	{
--- 407,413 ----
  //
  function display_attachments_preview($attachment_list, $attachment_filesize_list, $attachment_filename_list, $attachment_comment_list, $attachment_extension_list, $attachment_thumbnail_list)
  {
! 	global $attach_config, $is_auth, $allowed_extensions, $lang, $userdata, $display_categories, $upload_dir, $upload_icons, $template, $db, $theme;
  
  	if (count($attachment_list) != 0)
  	{
***************
*** 383,402 ****
  			
  		init_complete_extensions_data();
  
- 		$template->assign_vars(array(
- 			'L_KILOBYTE' => $lang['KB'])
- 		);
- 
  		$template->assign_block_vars('postrow', array());
  		$template->assign_block_vars('postrow.attach', array());
  	
  		for ($i = 0; $i < count($attachment_list); $i++)
  		{
  			$filename = $upload_dir . '/' . $attachment_list[$i];
  			$thumb_filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $attachment_list[$i];
! 			$filesize = round(($attachment_filesize_list[$i] / MEGABYTE), 2);
  			$display_name = $attachment_filename_list[$i];
! 			$comment = stripslashes(trim(nl2br($attachments_comment_list[$i])));
  			
  			$extension = strtolower(trim($attachment_extension_list[$i]));
  
--- 415,446 ----
  			
  		init_complete_extensions_data();
  
  		$template->assign_block_vars('postrow', array());
  		$template->assign_block_vars('postrow.attach', array());
  	
+ 		// Another 'i have to fix minor phpBB2 Bugs...' patch
+ 		$template->assign_vars(array(
+ 			'T_BODY_TEXT' => '#'.$theme['body_text'])
+ 		);
+ 
  		for ($i = 0; $i < count($attachment_list); $i++)
  		{
  			$filename = $upload_dir . '/' . $attachment_list[$i];
  			$thumb_filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $attachment_list[$i];
! 
! 			$filesize = $attachment_filesize_list[$i];
! 			$size_lang = ($filesize >= 1048576) ? $lang['MB'] : ( ($filesize >= 1024) ? $lang['KB'] : $lang['Bytes'] );
! 			if ($filesize >= 1048576)
! 			{
! 				$filesize = (round((round($filesize / 1048576 * 100) / 100), 2));
! 			}
! 			else if ($filesize >= 1024)
! 			{
! 				$filesize = (round((round($filesize / 1024 * 100) / 100), 2));
! 			}
! 
  			$display_name = $attachment_filename_list[$i];
! 			$comment = stripslashes(trim(nl2br($attachment_comment_list[$i])));
  			
  			$extension = strtolower(trim($attachment_extension_list[$i]));
  
***************
*** 417,422 ****
--- 461,476 ----
  			if (!$denied)
  			{
  				//
+ 				// Some basic Template Vars
+ 				//
+ 				$template->assign_vars(array(
+ 					'L_DESCRIPTION' => $lang['Description'],
+ 					'L_DOWNLOAD' => $lang['Download'],
+ 					'L_FILENAME' => $lang['File_name'],
+ 					'L_FILESIZE' => $lang['Filesize'])
+ 				);
+ 		
+ 				//
  				// define category
  				//
  				$image = FALSE;
***************
*** 433,439 ****
  				{
  					$swf = TRUE;
  				}
! 				else if ( (intval($display_categories[$extension]) == IMAGE_CAT) && (intval($attach_config['img_display_inlined']) == 1) )
  				{
  					if ( (intval($attach_config['img_link_width']) != 0) || (intval($attach_config['img_link_height']) != 0) )
  					{
--- 487,493 ----
  				{
  					$swf = TRUE;
  				}
! 				else if ( (intval($display_categories[$extension]) == IMAGE_CAT) && (intval($attach_config['img_display_inlined'])) )
  				{
  					if ( (intval($attach_config['img_link_width']) != 0) || (intval($attach_config['img_link_height']) != 0) )
  					{
***************
*** 477,483 ****
  						'DOWNLOAD_NAME' => $display_name,
  						'IMG_SRC' => $filename,
  						'FILESIZE' => $filesize,
! 						'COMMENT' => $comment)
  					);
  				}
  			
--- 531,539 ----
  						'DOWNLOAD_NAME' => $display_name,
  						'IMG_SRC' => $filename,
  						'FILESIZE' => $filesize,
! 						'SIZE_VAR' => $size_lang,
! 						'COMMENT' => $comment,
! 						'L_DOWNLOADED_VIEWED' => $lang['Viewed'])
  					);
  				}
  			
***************
*** 491,497 ****
  						'IMG_SRC' => $filename,
  						'IMG_THUMB_SRC' => $thumb_filename,
  						'FILESIZE' => $filesize,
! 						'COMMENT' => $comment)
  					);
  				}
  
--- 547,555 ----
  						'IMG_SRC' => $filename,
  						'IMG_THUMB_SRC' => $thumb_filename,
  						'FILESIZE' => $filesize,
! 						'SIZE_VAR' => $size_lang,
! 						'COMMENT' => $comment,
! 						'L_DOWNLOADED_VIEWED' => $lang['Viewed'])
  					);
  				}
  
***************
*** 504,510 ****
  						'U_DOWNLOAD_LINK' => $filename,
  						'DOWNLOAD_NAME' => $display_name,
  						'FILESIZE' => $filesize,
! 						'COMMENT' => $comment)
  					);
  				}
  			
--- 562,570 ----
  						'U_DOWNLOAD_LINK' => $filename,
  						'DOWNLOAD_NAME' => $display_name,
  						'FILESIZE' => $filesize,
! 						'SIZE_VAR' => $size_lang,
! 						'COMMENT' => $comment,
! 						'L_DOWNLOADED_VIEWED' => $lang['Viewed'])
  					);
  				}
  			
***************
*** 519,526 ****
  						'U_DOWNLOAD_LINK' => $filename,
  						'DOWNLOAD_NAME' => $display_name,
  						'FILESIZE' => $filesize,
  						'COMMENT' => $comment,
! 		
  						'WIDTH' => $width,
  						'HEIGHT' => $height)
  					);
--- 579,587 ----
  						'U_DOWNLOAD_LINK' => $filename,
  						'DOWNLOAD_NAME' => $display_name,
  						'FILESIZE' => $filesize,
+ 						'SIZE_VAR' => $size_lang,
  						'COMMENT' => $comment,
! 						'L_DOWNLOADED_VIEWED' => $lang['Viewed'],
  						'WIDTH' => $width,
  						'HEIGHT' => $height)
  					);
***************
*** 530,545 ****
  				{
  					$upload_image = '';
  
! 					if ( (!empty($attach_config['upload_img'])) && (empty($upload_icons[$extension])) )
  					{
! 						$upload_image = '<img src="' . $attach_config['upload_img'] . '" alt="" />';
  					}
! 					else if (!empty($upload_icons[$extension]))
  					{
! 						$upload_image = '<img src="' . $upload_icons[$extension] . '" alt="" />';
  					}
  
! 					$target_blank = ( (intval($display_categories[$extension]) == IMAGE_CAT) ) ? 'target="_blank"' : '';
  					
  					//
  					// display attachment
--- 591,606 ----
  				{
  					$upload_image = '';
  
! 					if ( ($attach_config['upload_img'] != '') && ($upload_icons[$extension] == '') )
  					{
! 						$upload_image = '<img src="' . $attach_config['upload_img'] . '" alt="" border="0" />';
  					}
! 					else if (trim($upload_icons[$extension]) != '')
  					{
! 						$upload_image = '<img src="' . $upload_icons[$extension] . '" alt="" border="0" />';
  					}
  
! 					$target_blank = 'target="_blank"';
  					
  					//
  					// display attachment
***************
*** 550,556 ****
--- 611,619 ----
  						
  						'DOWNLOAD_NAME' => $display_name,
  						'FILESIZE' => $filesize,
+ 						'SIZE_VAR' => $size_lang,
  						'COMMENT' => $comment,
+ 						'L_DOWNLOADED_VIEWED' => $lang['Downloaded'],
  						'TARGET_BLANK' => $target_blank)
  					);
  				}
***************
*** 583,591 ****
  	
  	for ($i = 0; $i < $num_attachments; $i++)
  	{
  		$filename = $upload_dir . '/' . $attachments['_' . $post_id][$i]['physical_filename'];
! 		$filesize = round(($attachments['_' . $post_id][$i]['filesize'] / MEGABYTE), 2);
! 		$display_name = $attachments['_' . $post_id][$i]['real_filename']; //( empty($attachments[$i]['comment']) ) ? $attachments[$i]['filename'] : $attachrow[$i]['comment'];
  		$comment = stripslashes(trim(nl2br($attachments['_' . $post_id][$i]['comment'])));
  
  		$attachments['_' . $post_id][$i]['extension'] = strtolower(trim($attachments['_' . $post_id][$i]['extension']));
--- 646,680 ----
  	
  	for ($i = 0; $i < $num_attachments; $i++)
  	{
+ 		//
+ 		// Some basic things...
+ 		//
  		$filename = $upload_dir . '/' . $attachments['_' . $post_id][$i]['physical_filename'];
! 		$thumbnail_filename = $upload_dir . '/' . THUMB_DIR . '/t_' . $attachments['_' . $post_id][$i]['physical_filename'];
! 	
! 		$upload_image = '';
! 
! 		if ( ($attach_config['upload_img'] != '') && (trim($upload_icons[$attachments['_' . $post_id][$i]['extension']]) == '') )
! 		{
! 			$upload_image = '<img src="' . $attach_config['upload_img'] . '" alt="" border="0" />';
! 		}
! 		else if (trim($upload_icons[$attachments['_' . $post_id][$i]['extension']]) != '')
! 		{
! 			$upload_image = '<img src="' . $upload_icons[$attachments['_' . $post_id][$i]['extension']] . '" alt="" border="0" />';
! 		}
! 		
! 		$filesize = $attachments['_' . $post_id][$i]['filesize'];
! 		$size_lang = ($filesize >= 1048576) ? $lang['MB'] : ( ($filesize >= 1024) ? $lang['KB'] : $lang['Bytes'] );
! 		if ($filesize >= 1048576)
! 		{
! 			$filesize = (round((round($filesize / 1048576 * 100) / 100), 2));
! 		}
! 		else if ($filesize >= 1024)
! 		{
! 			$filesize = (round((round($filesize / 1024 * 100) / 100), 2));
! 		}
! 
! 		$display_name = $attachments['_' . $post_id][$i]['real_filename']; 
  		$comment = stripslashes(trim(nl2br($attachments['_' . $post_id][$i]['comment'])));
  
  		$attachments['_' . $post_id][$i]['extension'] = strtolower(trim($attachments['_' . $post_id][$i]['extension']));
***************
*** 607,612 ****
--- 696,711 ----
  		if (!$denied)
  		{
  			//
+ 			// Some basic Template Vars
+ 			//
+ 			$template->assign_vars(array(
+ 				'L_DESCRIPTION' => $lang['Description'],
+ 				'L_DOWNLOAD' => $lang['Download'],
+ 				'L_FILENAME' => $lang['File_name'],
+ 				'L_FILESIZE' => $lang['Filesize'])
+ 			);
+ 			
+ 			//
  			// define category
  			//
  			$image = FALSE;
***************
*** 623,629 ****
  			{
  				$swf = TRUE;
  			}
! 			else if ( (intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT) && (intval($attach_config['img_display_inlined']) == 1) )
  			{
  				if ( (intval($attach_config['img_link_width']) != 0) || (intval($attach_config['img_link_height']) != 0) )
  				{
--- 722,728 ----
  			{
  				$swf = TRUE;
  			}
! 			else if ( (intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT) && (intval($attach_config['img_display_inlined'])) )
  			{
  				if ( (intval($attach_config['img_link_width']) != 0) || (intval($attach_config['img_link_height']) != 0) )
  				{
***************
*** 663,680 ****
  				//
  				// Images
  				//
  				$template->assign_block_vars('postrow.attach.cat_images', array(
  					'DOWNLOAD_NAME' => $display_name,
! 					'IMG_SRC' => append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id']),
  					'FILESIZE' => $filesize,
  					'COMMENT' => $comment,
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  
  				//
  				// Directly Viewed Image ... update the download count
  				//
! 				if ($download_modes[$attachments['_' . $post_id][$i]['extension']] == PHYSICAL)
  				{
  					$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
  					SET download_count = download_count + 1 
--- 762,794 ----
  				//
  				// Images
  				//
+ 				if ((intval($attach_config['allow_ftp_upload'])) && (trim($attach_config['download_path']) == ''))
+ 				{
+ 					$img_source = append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id']);
+ 					$download_link = TRUE;
+ 				}
+ 				else
+ 				{
+ 					$img_source = $filename;
+ 					$download_link = FALSE;
+ 				}
+ 
  				$template->assign_block_vars('postrow.attach.cat_images', array(
  					'DOWNLOAD_NAME' => $display_name,
! 					'S_UPLOAD_IMAGE' => $upload_image,
! 
! 					'IMG_SRC' => $img_source,
  					'FILESIZE' => $filesize,
+ 					'SIZE_VAR' => $size_lang,
  					'COMMENT' => $comment,
+ 					'L_DOWNLOADED_VIEWED' => $lang['Viewed'],
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  
  				//
  				// Directly Viewed Image ... update the download count
  				//
! 				if (!$download_link)
  				{
  					$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
  					SET download_count = download_count + 1 
***************
*** 693,704 ****
  				//
  				// Images, but display Thumbnail
  				//
  				$template->assign_block_vars('postrow.attach.cat_thumb_images', array(
  					'DOWNLOAD_NAME' => $display_name,
  					'IMG_SRC' => append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id']),
! 					'IMG_THUMB_SRC' => append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1'),
  					'FILESIZE' => $filesize,
  					'COMMENT' => $comment,
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  			}
--- 806,830 ----
  				//
  				// Images, but display Thumbnail
  				//
+ 				if ( (intval($attach_config['allow_ftp_upload'])) && (trim($attach_config['download_path']) == '') )
+ 				{
+ 					$thumb_source = append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id'] . '&thumb=1');
+ 				}
+ 				else
+ 				{
+ 					$thumb_source = $thumbnail_filename;
+ 				}
+ 				
  				$template->assign_block_vars('postrow.attach.cat_thumb_images', array(
  					'DOWNLOAD_NAME' => $display_name,
+ 					'S_UPLOAD_IMAGE' => $upload_image,
+ 
  					'IMG_SRC' => append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id']),
! 					'IMG_THUMB_SRC' => $thumb_source,
  					'FILESIZE' => $filesize,
+ 					'SIZE_VAR' => $size_lang,
  					'COMMENT' => $comment,
+ 					'L_DOWNLOADED_VIEWED' => $lang['Viewed'],
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  			}
***************
*** 710,727 ****
  				//
  				$template->assign_block_vars('postrow.attach.cat_stream', array(
  					'U_DOWNLOAD_LINK' => $filename,
  //					'U_DOWNLOAD_LINK' => append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id']),
  					'DOWNLOAD_NAME' => $display_name,
  					'FILESIZE' => $filesize,
  					'COMMENT' => $comment,
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  
  				//
! 				// Viewed/Heared File ... update the download count
  				//
- 				if ($download_modes[$attachments['_' . $post_id][$i]['extension']] == PHYSICAL)
- 				{
  					$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
  					SET download_count = download_count + 1 
  					WHERE attach_id = ' . $attachments['_' . $post_id][$i]['attach_id'];
--- 836,855 ----
  				//
  				$template->assign_block_vars('postrow.attach.cat_stream', array(
  					'U_DOWNLOAD_LINK' => $filename,
+ 					'S_UPLOAD_IMAGE' => $upload_image,
+ 
  //					'U_DOWNLOAD_LINK' => append_sid('download.' . $phpEx . '?id=' . $attachments['_' . $post_id][$i]['attach_id']),
  					'DOWNLOAD_NAME' => $display_name,
  					'FILESIZE' => $filesize,
+ 					'SIZE_VAR' => $size_lang,
  					'COMMENT' => $comment,
+ 					'L_DOWNLOADED_VIEWED' => $lang['Viewed'],
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  
  				//
! 				// Viewed/Heared File ... update the download count (download.php is not called here)
  				//
  				$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
  				SET download_count = download_count + 1 
  				WHERE attach_id = ' . $attachments['_' . $post_id][$i]['attach_id'];
***************
*** 732,739 ****
  					}
  				}
  
- 			}
- 			
  			if ($swf)
  			{
  				//
--- 860,865 ----
***************
*** 743,753 ****
  						
  				$template->assign_block_vars('postrow.attach.cat_swf', array(
  					'U_DOWNLOAD_LINK' => $filename,
  					'DOWNLOAD_NAME' => $display_name,
  					'FILESIZE' => $filesize,
  					'COMMENT' => $comment,
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']),
- 
  					'WIDTH' => $width,
  					'HEIGHT' => $height)
  				);
--- 869,882 ----
  						
  				$template->assign_block_vars('postrow.attach.cat_swf', array(
  					'U_DOWNLOAD_LINK' => $filename,
+ 					'S_UPLOAD_IMAGE' => $upload_image,
+ 
  					'DOWNLOAD_NAME' => $display_name,
  					'FILESIZE' => $filesize,
+ 					'SIZE_VAR' => $size_lang,
  					'COMMENT' => $comment,
+ 					'L_DOWNLOADED_VIEWED' => $lang['Viewed'],
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']),
  					'WIDTH' => $width,
  					'HEIGHT' => $height)
  				);
***************
*** 753,762 ****
  				);
  
  				//
! 				// Viewed/Heared File ... update the download count
  				//
- 				if ($download_modes[$attachments['_' . $post_id][$i]['extension']] == PHYSICAL)
- 				{
  					$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
  					SET download_count = download_count + 1 
  					WHERE attach_id = ' . $attachments['_' . $post_id][$i]['attach_id'];
--- 882,889 ----
  				);
  
  				//
! 				// Viewed/Heared File ... update the download count (download.php is not called here)
  				//
  				$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' 
  				SET download_count = download_count + 1 
  				WHERE attach_id = ' . $attachments['_' . $post_id][$i]['attach_id'];
***************
*** 766,786 ****
  						message_die(GENERAL_MESSAGE, 'Couldn\'t update attachment download count', '', __LINE__, __FILE__, $sql);
  					}
  				}
- 			}
  
  			if ($link)
  			{
- 				$upload_image = '';
- 
- 				if ( (!empty($attach_config['upload_img'])) && (empty($upload_icons[$attachments['_' . $post_id][$i]['extension']])) )
- 				{
- 					$upload_image = '<img src="' . $attach_config['upload_img'] . '" alt="" />';
- 				}
- 				else if (!empty($upload_icons[$attachments['_' . $post_id][$i]['extension']]))
- 				{
- 					$upload_image = '<img src="' . $upload_icons[$attachments['_' . $post_id][$i]['extension']] . '" alt="" />';
- 				}
- 
  				$target_blank = ( (intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT) ) ? 'target="_blank"' : '';
  
  				//
--- 893,901 ----
***************
*** 792,799 ****
--- 907,917 ----
  						
  					'DOWNLOAD_NAME' => $display_name,
  					'FILESIZE' => $filesize,
+ 					'SIZE_VAR' => $size_lang,
  					'COMMENT' => $comment,
  					'TARGET_BLANK' => $target_blank,
+ 
+ 					'L_DOWNLOADED_VIEWED' => $lang['Downloaded'],
  					'L_DOWNLOAD_COUNT' => sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']))
  				);
  						
diff -c -rNbB attach_mod_v234/attach_mod/includes/constants.php attach_mod_v235/attach_mod/includes/constants.php
*** attach_mod_v234/attach_mod/includes/constants.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/constants.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: constants.php,v 1.15 2002/11/03 12:44:38 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: constants.php,v 1.20 2003/01/16 11:11:56 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 52,57 ****
--- 52,63 ----
  define('FORBIDDEN_EXTENSIONS_TABLE', $table_prefix . 'forbidden_extensions');
  define('ATTACHMENTS_DESC_TABLE', $table_prefix . 'attachments_desc');
  define('ATTACHMENTS_TABLE', $table_prefix . 'attachments');
+ define('QUOTA_TABLE', $table_prefix . 'attach_quota');
+ define('QUOTA_LIMITS_TABLE', $table_prefix . 'quota_limits');
+ 
+ // Pages
+ define('PAGE_UACP', -32);
+ define('PAGE_RULES', -33);
  
  // Misc
  define('MEGABYTE', 1024);
***************
*** 62,67 ****
  // Forum Extension Group Permissions
  define('GPERM_ALL', 0); // ALL FORUMS
  
! define('ATTACH_VERSION', '2.3.4');
  
  ?>
\ No newline at end of file
--- 68,77 ----
  // Forum Extension Group Permissions
  define('GPERM_ALL', 0); // ALL FORUMS
  
! // Quota Types
! define('QUOTA_UPLOAD_LIMIT', 1);
! define('QUOTA_PM_LIMIT', 2);
! 
! define('ATTACH_VERSION', '2.3.5');
  
  ?>
\ No newline at end of file
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_admin.php attach_mod_v235/attach_mod/includes/functions_admin.php
*** attach_mod_v234/attach_mod/includes/functions_admin.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_admin.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_admin.php,v 1.6 2002/10/25 16:49:23 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_admin.php,v 1.11 2003/01/16 10:48:15 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 26,31 ****
--- 26,110 ----
  //
  
  //
+ // Set/Change Quotas
+ //
+ function process_quota_settings($mode, $id, $quota_type, $quota_limit_id = -1)
+ {
+ 	global $db;
+ 
+ 	if ($mode == 'user')
+ 	{
+ 		if ($quota_limit_id == -1)
+ 		{
+ 			$sql = "DELETE FROM " . QUOTA_TABLE . " WHERE user_id = " . $id . " AND quota_type = " . $quota_type;
+ 		}
+ 		else
+ 		{
+ 			// Check if user is already entered
+ 			$sql = "SELECT user_id FROM " . QUOTA_TABLE . " WHERE user_id = " . $id . " AND quota_type = " . $quota_type;
+ 
+ 			if( !($result = attach_sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Could not get Entry', '', __LINE__, __FILE__, $sql);
+ 			}
+ 
+ 			if ($db->sql_numrows($result) == 0)
+ 			{
+ 				$sql = "INSERT INTO " . QUOTA_TABLE . " (user_id, group_id, quota_type, quota_limit_id) 
+ 				VALUES (" . $id . ", 0, " . $quota_type . ", " . $quota_limit_id . ")";
+ 			}
+ 			else
+ 			{
+ 				$sql = "UPDATE " . QUOTA_TABLE . " SET quota_limit_id = " . $quota_limit_id . " WHERE user_id = " . $id . " AND quota_type = " . $quota_type;
+ 			}
+ 		}
+ 	
+ 		if( !($result = attach_sql_query($sql)) )
+ 		{
+ 			message_die(GENERAL_ERROR, 'Unable to update quota Settings', '', __LINE__, __FILE__, $sql);
+ 		}
+ 		
+ 	}
+ 	else if ($mode == 'group')
+ 	{
+ 		if ($quota_limit_id == -1)
+ 		{
+ 			$sql = "DELETE FROM " . QUOTA_TABLE . " WHERE group_id = " . $id . " AND quota_type = " . $quota_type;
+ 
+ 			if( !($result = attach_sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Unable to delete quota Settings', '', __LINE__, __FILE__, $sql);
+ 			}
+ 		}
+ 		else
+ 		{
+ 			// Check if user is already entered
+ 			$sql = "SELECT group_id FROM " . QUOTA_TABLE . " WHERE group_id = " . $id . " AND quota_type = " . $quota_type;
+ 
+ 			if( !($result = attach_sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Could not get Entry', '', __LINE__, __FILE__, $sql);
+ 			}
+ 
+ 			if ($db->sql_numrows($result) == 0)
+ 			{
+ 				$sql = "INSERT INTO " . QUOTA_TABLE . " (user_id, group_id, quota_type, quota_limit_id) 
+ 				VALUES (0, " . $id . ", " . $quota_type . ", " . $quota_limit_id . ")";
+ 			}
+ 			else
+ 			{
+ 				$sql = "UPDATE " . QUOTA_TABLE . " SET quota_limit_id = " . $quota_limit_id . " WHERE group_id = " . $id . " AND quota_type = " . $quota_type;
+ 			}
+ 	
+ 			if( !($result = attach_sql_query($sql)) )
+ 			{
+ 				message_die(GENERAL_ERROR, 'Unable to update quota Settings', '', __LINE__, __FILE__, $sql);
+ 			}
+ 		}
+ 	}
+ }
+ 
+ //
  // sort multi-dimensional Array
  //
  function sort_multi_array ($sort_array, $key, $sort_order, $pre_string_sort = -1) 
***************
*** 145,155 ****
  
  	$file_attachments = array(); 
  
! 	if (!$attach_config['allow_ftp_upload'])
  	{
- 		$dir = opendir($upload_dir);
  
! 		while($file = readdir($dir))
  		{
  			if( ($file != 'index.php') && ($file != '.htaccess') && (!is_dir($upload_dir . '/' . $file)) && (!is_link($upload_dir . '/' . $file)) )
  			{
--- 224,235 ----
  
  	$file_attachments = array(); 
  
! 	if (!intval($attach_config['allow_ftp_upload']))
! 	{
! 		if ($dir = @opendir($upload_dir))
  		{
  
! 			while($file = @readdir($dir))
  			{
  				if( ($file != 'index.php') && ($file != '.htaccess') && (!is_dir($upload_dir . '/' . $file)) && (!is_link($upload_dir . '/' . $file)) )
  				{
***************
*** 161,166 ****
--- 241,251 ----
  		}
  		else
  		{
+ 			message_dir(GENERAL_ERROR, 'Is Safe Mode Restriction in effect ? The Attachment Mod seems to be unable to collect the Attachments within the upload Directory. Try to use FTP Upload to circumvent this error.');
+ 		}
+ 	}
+ 	else
+ 	{
  		$conn_id = attach_init_ftp();
  
  		$file_listing = array();
***************
*** 202,208 ****
  
  	$upload_dir_size = 0;
  
! 	if (!$attach_config['allow_ftp_upload'])
  	{
  	
  		if ($dirname = @opendir($upload_dir))
--- 287,293 ----
  
  	$upload_dir_size = 0;
  
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
  	
  		if ($dirname = @opendir($upload_dir))
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_attach.php attach_mod_v235/attach_mod/includes/functions_attach.php
*** attach_mod_v234/attach_mod/includes/functions_attach.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_attach.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_attach.php,v 1.22 2002/11/03 23:46:04 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_attach.php,v 1.31 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 195,201 ****
  {
  	global $lang, $attach_config;
  
! 	$server = ( empty($attach_config['ftp_server']) ) ? 'localhost' : $attach_config['ftp_server'];
  	
  	$ftp_path = ( $mode == MODE_THUMBNAIL ) ? $attach_config['ftp_path'] . '/' . THUMB_DIR : $attach_config['ftp_path'];
  
--- 195,201 ----
  {
  	global $lang, $attach_config;
  
! 	$server = ( $attach_config['ftp_server'] == '' ) ? 'localhost' : $attach_config['ftp_server'];
  	
  	$ftp_path = ( $mode == MODE_THUMBNAIL ) ? $attach_config['ftp_path'] . '/' . THUMB_DIR : $attach_config['ftp_path'];
  
***************
*** 213,218 ****
--- 213,223 ----
  		message_die(GENERAL_ERROR, sprintf($lang['Ftp_error_login'], $attach_config['ftp_user']));
  	}
  		
+ 	if (!@ftp_pasv($conn_id, intval($attach_config['ftp_pasv_mode'])))
+ 	{
+ 		message_die(GENERAL_ERROR, $lang['Ftp_error_pasv_mode']);
+ 	}
+ 	
  	$result = @ftp_chdir($conn_id, $ftp_path);
  
  	if (!$result)
***************
*** 230,236 ****
  {
  	global $upload_dir, $attach_config, $lang;
  
! 	if (!$attach_config['allow_ftp_upload'])
  	{
  		if ($mode == MODE_THUMBNAIL)
  		{
--- 235,241 ----
  {
  	global $upload_dir, $attach_config, $lang;
  
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
  		if ($mode == MODE_THUMBNAIL)
  		{
***************
*** 243,254 ****
  
  		$deleted = @unlink($filename);
  
! 		if (@file_exists($filename) ) 
  		{
  			$filesys = eregi_replace('/','\\', $filename);
  			$deleted = @system("del $filesys");
  
! 			if (@file_exists($filename)) 
  			{
  				$deleted = @chmod ($filename, 0775);
  				$deleted = @unlink($filename);
--- 248,259 ----
  
  		$deleted = @unlink($filename);
  
! 		if (@file_exists(@amod_realpath($filename)) ) 
  		{
  			$filesys = eregi_replace('/','\\', $filename);
  			$deleted = @system("del $filesys");
  
! 			if (@file_exists(@amod_realpath($filename))) 
  			{
  				$deleted = @chmod ($filename, 0775);
  				$deleted = @unlink($filename);
***************
*** 334,342 ****
  {
  	global $upload_dir, $attach_config;
  
! 	if (!$attach_config['allow_ftp_upload'])
  	{
! 		if( !@file_exists($upload_dir . '/' . $filename) )
  		{
  			return (FALSE);
  		}
--- 339,347 ----
  {
  	global $upload_dir, $attach_config;
  
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
! 		if( !@file_exists(@amod_realpath($upload_dir . '/' . $filename)) )
  		{
  			return (FALSE);
  		}
***************
*** 388,396 ****
  {
  	global $upload_dir, $attach_config;
  
! 	if (!$attach_config['allow_ftp_upload'])
  	{
! 		if( !@file_exists($upload_dir . '/' . THUMB_DIR . '/t_' . $filename) )
  		{
  			return (FALSE);
  		}
--- 393,401 ----
  {
  	global $upload_dir, $attach_config;
  
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
! 		if( !@file_exists(@amod_realpath($upload_dir . '/' . THUMB_DIR . '/t_' . $filename)) )
  		{
  			return (FALSE);
  		}
***************
*** 524,530 ****
  		return ($attachments);
  	}
  
! 	$display_order = ( $attach_config['display_order'] == '0' ) ? 'DESC' : 'ASC';
  	
  	$sql = "SELECT a.post_id, d.*
  	FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d
--- 529,535 ----
  		return ($attachments);
  	}
  
! 	$display_order = ( intval($attach_config['display_order']) == 0 ) ? 'DESC' : 'ASC';
  	
  	$sql = "SELECT a.post_id, d.*
  	FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d
***************
*** 575,581 ****
  		return ($attachments);
  	}
  
! 	$display_order = ( $attach_config['display_order'] == '0' ) ? 'DESC' : 'ASC';
  	
  	$sql = "SELECT a.privmsgs_id, d.*
  	FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d
--- 580,586 ----
  		return ($attachments);
  	}
  
! 	$display_order = ( intval($attach_config['display_order']) == 0 ) ? 'DESC' : 'ASC';
  	
  	$sql = "SELECT a.privmsgs_id, d.*
  	FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d
***************
*** 629,634 ****
--- 634,684 ----
  }
  
  //
+ // Count Filesize for Attachments in Users PM Boxes (Do not count the SENT Box)
+ //
+ function get_total_attach_pm_filesize($direction, $user_id)
+ {
+ 	global $db;
+ 
+ 	if (($direction != 'from_user') && ($direction != 'to_user'))
+ 	{
+ 		return (0);
+ 	}
+ 	else
+ 	{
+ 		$user_sql = ($direction == 'from_user') ? '(a.user_id_1 = ' . intval($user_id) . ')' : '(a.user_id_2 = ' . intval($user_id) . ')';
+ 	}
+ 
+ 	$sql = "SELECT a.attach_id
+ 	FROM " . ATTACHMENTS_TABLE . " a, " . PRIVMSGS_TABLE . " p
+ 	WHERE " . $user_sql . " AND (a.privmsgs_id != 0) AND (a.privmsgs_id = p.privmsgs_id) AND (p.privmsgs_type != " . PRIVMSGS_SENT_MAIL . ")";
+ 
+ 	if ( !($result = attach_sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not query Attachment Informations', '', __LINE__, __FILE__, $sql);
+ 	}
+ 				
+ 	$pm_filesize_total = 0;
+ 	$rows = $db->sql_fetchrowset($result);
+ 	$num_rows = $db->sql_numrows($result);
+ 	$attach_id = array();
+ 
+ 	if ($num_rows == 0)
+ 	{
+ 		return ($pm_filesize_total);
+ 	}
+ 	
+ 	for ($i = 0; $i < $num_rows; $i++)
+ 	{
+ 		$attach_id[] = $rows[$i]['attach_id'];
+ 	}
+ 
+ 	$attach_id = implode(', ', $attach_id);
+ 				
+ 	return (get_total_attach_filesize($attach_id));
+ }
+ 
+ //
  // Prune Attachments <- called from includes/prune.php
  //
  function prune_attachments($sql_post)
***************
*** 682,702 ****
  	$post_list = $db->sql_fetchrowset($result);
  	$num_posts = $db->sql_numrows($result);
  
  	$post_ids = array();
  
! 	for ($i = 0; $i < count($post_list); $i++)
  	{
! 		$post_ids[] = $post_list[$i]['post_id'];
  	}
  
! 	if (count($post_ids) == 0)
  	{
  		return;
  	}
  	
! 	$whereclause = 'WHERE post_id IN (' .	implode(', ', $post_ids) . ')';
! 
! 	$sql = "SELECT attach_id FROM " . ATTACHMENTS_TABLE . " " . $whereclause;
  		
  	if ( !($result = attach_sql_query($sql)) )
  	{
--- 732,757 ----
  	$post_list = $db->sql_fetchrowset($result);
  	$num_posts = $db->sql_numrows($result);
  
+ 	if ($num_posts == 0)
+ 	{
+ 		return;
+ 	}
+ 	
  	$post_ids = array();
  
! 	for ($i = 0; $i < $num_posts; $i++)
  	{
! 		$post_ids[] = intval($post_list[$i]['post_id']);
  	}
  
! 	$post_id_sql = implode(', ', $post_ids);
! 	
! 	if ($post_id_sql == '')
  	{
  		return;
  	}
  	
! 	$sql = "SELECT attach_id FROM " . ATTACHMENTS_TABLE . " WHERE post_id IN (" . $post_id_sql . ") LIMIT 1";
  		
  	if ( !($result = attach_sql_query($sql)) )
  	{
***************
*** 714,720 ****
  		
  	for ($i = 0; $i < count($post_ids); $i++)
  	{
! 		$sql = "SELECT attach_id FROM " . ATTACHMENTS_TABLE . " WHERE post_id = " . $post_ids[$i];
  
  		if ( !($result = attach_sql_query($sql)) )
  		{
--- 769,775 ----
  		
  	for ($i = 0; $i < count($post_ids); $i++)
  	{
! 		$sql = "SELECT attach_id FROM " . ATTACHMENTS_TABLE . " WHERE post_id = " . $post_ids[$i] . " LIMIT 1";
  
  		if ( !($result = attach_sql_query($sql)) )
  		{
***************
*** 727,733 ****
  
  		if ( !(attach_sql_query($sql)) )
  		{
! 			message_die(GENERAL_ERROR, 'Couldn\'t update Topics Table', '', __LINE__, __FILE__, $sql);
  		}
  	}
  }
--- 782,788 ----
  
  		if ( !(attach_sql_query($sql)) )
  		{
! 			message_die(GENERAL_ERROR, 'Couldn\'t update Posts Table', '', __LINE__, __FILE__, $sql);
  		}
  	}
  }
***************
*** 739,747 ****
  {
  	$extension = strrchr(strtolower($filename), '.');
  	$extension[0] = ' ';
! 	$extension = strtolower(trim($extension));
! 
! 	return ($extension);
  }
  
  //
--- 794,800 ----
  {
  	$extension = strrchr(strtolower($filename), '.');
  	$extension[0] = ' ';
! 	return (strtolower(trim($extension)));
  }
  
  //
***************
*** 752,755 ****
--- 805,852 ----
  	return (substr($filename, 0, strrpos(strtolower(trim($filename)), '.')));
  }
  
+ // 
+ // Check if a user is within Group
+ //
+ function user_in_group($user_id, $group_id)
+ {
+ 	global $db;
+ 
+ 	if ((empty($user_id)) || (empty($group_id)))
+ 	{
+ 		return (FALSE);
+ 	}
+ 	
+ 	$sql = "SELECT u.group_id FROM " . USER_GROUP_TABLE . " u, " . GROUPS_TABLE . " g 
+ 	WHERE (g.group_single_user = 0) AND (u.group_id = g.group_id) AND (u.user_id = " . $user_id . ") AND (g.group_id = " . $group_id . ")
+ 	LIMIT 1";
+ 			
+ 	if ( !($result = attach_sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, 'Could not get User Group', '', __LINE__, __FILE__, $sql);
+ 	}
+ 
+ 	if ($db->sql_numrows($result) == 0)
+ 	{
+ 		return (FALSE);
+ 	}
+ 	else
+ 	{
+ 		return (TRUE);
+ 	}
+ }
+ 
+ // -> from phpBB 2.0.4
+ // This function is for compatibility with PHP 4.x's realpath()
+ // function.  In later versions of PHP, it needs to be called
+ // to do checks with some functions.  Older versions of PHP don't
+ // seem to need this, so we'll just return the original value.
+ // dougk_ff7 <October 5, 2002>
+ function amod_realpath($path)
+ {
+ 	global $phpbb_root_path, $phpEx;
+ 
+ 	return (!@function_exists('realpath') || !@realpath($phpbb_root_path . 'includes/functions.'.$phpEx)) ? $path : @realpath($path);
+ }
+ 
  ?>
\ No newline at end of file
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_delete.php attach_mod_v235/attach_mod/includes/functions_delete.php
*** attach_mod_v234/attach_mod/includes/functions_delete.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_delete.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_delete.php,v 1.4 2002/08/31 13:33:42 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_delete.php,v 1.6 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 30,36 ****
  //
  function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -1)
  {
! 	global $attach_config, $db;
  
  	//
  	// Generate Array, if it's not an array
--- 30,36 ----
  //
  function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = -1)
  {
! 	global $db;
  
  	//
  	// Generate Array, if it's not an array
***************
*** 162,173 ****
  		$sql_id = 'post_id';
  	}
  
! 	$sql = "DELETE FROM " . ATTACHMENTS_TABLE . " WHERE attach_id IN (" . implode(', ', $attach_id_array) . ") AND " . $sql_id . " IN (" . implode(', ', $post_id_array) . ")";
! 	
! 	if ( !(attach_sql_query($sql)) )
! 	{
! 		message_die(GENERAL_ERROR, $lang['Error_deleted_attachments'], '', __LINE__, __FILE__, $sql);
! 	}
  
  	for ($i = 0; $i < count($attach_id_array); $i++)
  	{
--- 162,168 ----
  		$sql_id = 'post_id';
  	}
  
! 	$delete_attachment_sql = "DELETE FROM " . ATTACHMENTS_TABLE . " WHERE attach_id IN (" . implode(', ', $attach_id_array) . ") AND " . $sql_id . " IN (" . implode(', ', $post_id_array) . ")";
  	
  	for ($i = 0; $i < count($attach_id_array); $i++)
  	{
***************
*** 218,223 ****
--- 213,223 ----
  		}
  	}
  	
+ 	if ( !(attach_sql_query($delete_attachment_sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, $lang['Error_deleted_attachments'], '', __LINE__, __FILE__, $sql);
+ 	}
+ 
  	//
  	// Now Sync the Topic/PM
  	//
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_filetypes.php attach_mod_v235/attach_mod/includes/functions_filetypes.php
*** attach_mod_v234/attach_mod/includes/functions_filetypes.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_filetypes.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_filetypes.php,v 1.2 2002/10/25 16:49:23 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_filetypes.php,v 1.3 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 70,76 ****
  //
  function image_getdimension($file)
  {
- 	global $attach_config;
  
  	$size = @getimagesize($file);
  
--- 70,75 ----
***************
*** 354,360 ****
  
  function swf_getdimension($file)
  {
- 	global $attach_config;
  
  	$size = @getimagesize($file);
  
--- 353,358 ----
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_includes.php attach_mod_v235/attach_mod/includes/functions_includes.php
*** attach_mod_v234/attach_mod/includes/functions_includes.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_includes.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_includes.php,v 1.8 2002/11/03 12:49:06 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_includes.php,v 1.20 2003/01/17 09:29:45 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 105,118 ****
  {
  	global $phpbb_root_path, $board_config, $phpEx, $faq, $attach_config;
  
! 	if ($attach_config['disable_mod'] == '1')
  	{
  		return;
  	}
  
  	if ($lang_file == 'lang_faq')
  	{
! 		if ( !file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_faq_attach.'.$phpEx) )
  		{
  			include($phpbb_root_path . 'language/lang_english/lang_faq_attach.'.$phpEx);
  		}
--- 105,118 ----
  {
  	global $phpbb_root_path, $board_config, $phpEx, $faq, $attach_config;
  
! 	if (intval($attach_config['disable_mod']))
  	{
  		return;
  	}
  
  	if ($lang_file == 'lang_faq')
  	{
! 		if ( !@file_exists(@amod_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_faq_attach.'.$phpEx)) )
  		{
  			include($phpbb_root_path . 'language/lang_english/lang_faq_attach.'.$phpEx);
  		}
***************
*** 224,239 ****
  {
  	global $lang, $attach_config, $phpEx, $forum_id;
  
! 	if ($attach_config['disable_mod'] == '1')
  	{
  		return;
  	}
  
! //	$rules_link = '(<a href="attach_rules.' . $phpEx . '?f=' . $forum_id . '" target="_blank">Rules</a>)';
! 	
  //	$s_auth_can .= ( ( $is_auth['auth_attachments'] ) ? $rules_link . ' ' . $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '<br />';
! 	$s_auth_can .= ( ( $is_auth['auth_attachments'] ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '<br />';
! 	$s_auth_can .= ( ( $is_auth['auth_download'] ) ? $lang['Rules_download_can'] : $lang['Rules_download_cannot'] ) . '<br />';
  }
  
  ?>
\ No newline at end of file
--- 224,613 ----
  {
  	global $lang, $attach_config, $phpEx, $forum_id;
  
! 	if (intval($attach_config['disable_mod']))
  	{
  		return;
  	}
  
! 	// If you want to have the rules window link within the forum view too, comment out the two lines, and comment the third line
! //	$rules_link = '(<a href="attach_mod/attach_rules.' . $phpEx . '?f=' . $forum_id . '" target="_blank">Rules</a>)';
  //	$s_auth_can .= ( ( $is_auth['auth_attachments'] ) ? $rules_link . ' ' . $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '<br />';
! 	$s_auth_can .= ( ( $is_auth['auth_attachments'] && $is_auth['auth_post'] ) ? $lang['Rules_attach_can'] : $lang['Rules_attach_cannot'] ) . '<br />';
! 
! 	$s_auth_can .= ( ( $is_auth['auth_download'] && $is_auth['auth_read'] ) ? $lang['Rules_download_can'] : $lang['Rules_download_cannot'] ) . '<br />';
! }
! 
! //
! // Called from admin_users.php and admin_groups.php in order to process Quota Settings
! //
! function attachment_quota_settings($admin_mode, $submit = FALSE, $mode)
! {
! 	global $template, $db, $HTTP_POST_VARS, $lang, $group_id;
! 
! 	if ($admin_mode == 'user')
! 	{
! 		if (!$submit && $mode != 'save')
! 		{
! 			if( isset( $HTTP_GET_VARS[POST_USERS_URL]) || isset( $HTTP_POST_VARS[POST_USERS_URL]) )
! 			{
! 				$user_id = ( isset( $HTTP_POST_VARS[POST_USERS_URL]) ) ? intval( $HTTP_POST_VARS[POST_USERS_URL]) : intval( $HTTP_GET_VARS[POST_USERS_URL]);
! 				$this_userdata = get_userdata($user_id);
! 				if( !$this_userdata )
! 				{
! 					return;
! 				}
! 			}
! 			else
! 			{
! 				$this_userdata = get_userdata( $HTTP_POST_VARS['username'] );
! 				if( !$this_userdata )
! 				{
! 					return;
! 				}
! 			}
! 
! 			$user_id = $this_userdata['user_id'];
! 		}
! 		else
! 		{
! 			$user_id = intval( $HTTP_POST_VARS['id'] );
! 
! 			$this_userdata = get_userdata($user_id);
! 			if( !$this_userdata )
! 			{
! 				return;
! 			}
! 		}
! 	}
! 	
! 	if ($admin_mode == 'user' && !$submit && $mode != 'save')
! 	{
! 		// Show the contents
! 		$sql = "SELECT quota_limit_id, quota_type FROM " . QUOTA_TABLE . " WHERE user_id = " . $user_id;
! 
! 		if( !($result = attach_sql_query($sql)) )
! 		{
! 			message_die(GENERAL_ERROR, 'Unable to get Quota Settings', '', __LINE__, __FILE__, $sql);
! 		}
! 
! 		$pm_quota = -1;
! 		$upload_quota = -1;
! 		
! 		while ($row = $db->sql_fetchrow($result))
! 		{
! 			if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT)
! 			{
! 				$upload_quota = $row['quota_limit_id'];
! 			}
! 			else if ($row['quota_type'] == QUOTA_PM_LIMIT)
! 			{
! 				$pm_quota = $row['quota_limit_id'];
! 			}
! 		}
! 		
! 		$template->assign_vars(array(
! 			'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('user_upload_quota', $upload_quota),
! 			'S_SELECT_PM_QUOTA' => quota_limit_select('user_pm_quota', $pm_quota),
! 			'L_UPLOAD_QUOTA' => $lang['Upload_quota'],
! 			'L_PM_QUOTA' => $lang['Pm_quota'])
! 		);
! 	}
! 
! 	if ($admin_mode == 'user' && $submit && $HTTP_POST_VARS['deleteuser'])
! 	{
! 		process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, -1);
! 		process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, -1);
! 	}
! 	else if ($admin_mode == 'user' && $submit && $mode == 'save')
! 	{
! 		// Get the contents
! 		$upload_quota = intval($HTTP_POST_VARS['user_upload_quota']);
! 		$pm_quota = intval($HTTP_POST_VARS['user_pm_quota']);
! 
! 		if ($upload_quota <= 0)
! 		{
! 			process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, -1);
! 		}
! 		else
! 		{
! 			process_quota_settings($admin_mode, $user_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
! 		}
! 
! 		if ($pm_quota <= 0)
! 		{
! 			process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, -1);
! 		}
! 		else
! 		{
! 			process_quota_settings($admin_mode, $user_id, QUOTA_PM_LIMIT, $pm_quota);
! 		}
! 	}
! 
! 	if ($admin_mode == 'group' && $mode == 'newgroup')
! 	{
! 		return;
! 	}
! 
! 	if ($admin_mode == 'group' && !$submit && isset($HTTP_POST_VARS['edit']))
! 	{
! 		// Show the contents
! 		$sql = "SELECT quota_limit_id, quota_type FROM " . QUOTA_TABLE . " WHERE group_id = " . $group_id;
! 
! 		if( !($result = attach_sql_query($sql)) )
! 		{
! 			message_die(GENERAL_ERROR, 'Unable to get Quota Settings', '', __LINE__, __FILE__, $sql);
! 		}
! 
! 		$pm_quota = -1;
! 		$upload_quota = -1;
! 		
! 		while ($row = $db->sql_fetchrow($result))
! 		{
! 			if ($row['quota_type'] == QUOTA_UPLOAD_LIMIT)
! 			{
! 				$upload_quota = $row['quota_limit_id'];
! 			}
! 			else if ($row['quota_type'] == QUOTA_PM_LIMIT)
! 			{
! 				$pm_quota = $row['quota_limit_id'];
! 			}
! 		}
! 		
! 		$template->assign_vars(array(
! 			'S_SELECT_UPLOAD_QUOTA' => quota_limit_select('group_upload_quota', $upload_quota),
! 			'S_SELECT_PM_QUOTA' => quota_limit_select('group_pm_quota', $pm_quota),
! 			'L_UPLOAD_QUOTA' => $lang['Upload_quota'],
! 			'L_PM_QUOTA' => $lang['Pm_quota'])
! 		);
! 	}
! 
! 	if ($admin_mode == 'group' && $submit && isset($HTTP_POST_VARS['group_delete']))
! 	{
! 		process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, -1);
! 		process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, -1);
! 	}
! 	else if ($admin_mode == 'group' && $submit)
! 	{
! 		// Get the contents
! 		$upload_quota = intval($HTTP_POST_VARS['group_upload_quota']);
! 		$pm_quota = intval($HTTP_POST_VARS['group_pm_quota']);
! 
! 		if ($upload_quota <= 0)
! 		{
! 			process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, -1);
! 		}
! 		else
! 		{
! 			process_quota_settings($admin_mode, $group_id, QUOTA_UPLOAD_LIMIT, $upload_quota);
! 		}
! 
! 		if ($pm_quota <= 0)
! 		{
! 			process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, -1);
! 		}
! 		else
! 		{
! 			process_quota_settings($admin_mode, $group_id, QUOTA_PM_LIMIT, $pm_quota);
! 		}
! 	}
! 
! }
! 
! //
! // Called from usercp_viewprofile, displays the User Upload Quota Box, Upload Stats and a Link to the User Attachment Control Panel
! // Groups are able to be grabbed, but it's not used within the Attachment Mod. ;)
! //
! function display_upload_attach_box_limits($user_id, $group_id = -1)
! {
! 	global $attach_config, $board_config, $phpbb_root_path, $lang, $db, $template, $phpEx, $userdata;
! 	
! 	if (($userdata['user_level'] != ADMIN) && ($userdata['user_id'] != $user_id))
! 	{
! 		return;
! 	}
! 
! 	// Return if the user is not within the to be listed Group
! 	if ($group_id != -1)
! 	{
! 		if (!user_in_group($user_id, $group_id))
! 		{
! 			return;
! 		}
! 	}
! 	
! 	$attachments = new attach_posting();
! 
! 	$attachments->PAGE = PAGE_INDEX;
! 	
! 	// Get the assigned Quota Limit. For Groups, we are directly getting the value, because this Quota can change from user to user.
! 	if ($group_id != -1)
! 	{
! 		$sql = "SELECT l.quota_limit FROM " . QUOTA_TABLE . " q, " . QUOTA_LIMITS_TABLE . " l
! 		WHERE (q.group_id = " . $group_id . ") AND (q.quota_type = " . QUOTA_UPLOAD_LIMIT . ") 
! 		AND (q.quota_limit_id = l.quota_limit_id) LIMIT 1";
! 
! 		if ( !($result = attach_sql_query($sql)) )
! 		{
! 			message_die(GENERAL_ERROR, 'Could not get Group Quota', '', __LINE__, __FILE__, $sql);
! 		}
! 
! 		if ($db->sql_numrows($result) > 0)
! 		{
! 			$row = $db->sql_fetchrow($result);
! 			$attach_config['upload_filesize_limit'] = intval($row['quota_limit']);
! 		}
! 		else
! 		{
! 			// Set Default Quota Limit
! 			$quota_id = intval($attach_config['default_upload_quota']);
! 
! 			if ($quota_id == 0)
! 			{
! 				$attach_config['upload_filesize_limit'] = intval($attach_config['attachment_quota']);
! 			}
! 			else
! 			{
! 				$sql = "SELECT quota_limit FROM " . QUOTA_LIMITS_TABLE . "
! 				WHERE quota_limit_id = " . $quota_id . " LIMIT 1";
! 
! 				if ( !($result = attach_sql_query($sql)) )
! 				{
! 					message_die(GENERAL_ERROR, 'Could not get Quota Limit', '', __LINE__, __FILE__, $sql);
! 				}
! 	
! 				if ($db->sql_numrows($result) > 0)
! 				{
! 					$row = $db->sql_fetchrow($result);
! 					$attach_config['upload_filesize_limit'] = intval($row['quota_limit']);
! 				}
! 				else
! 				{
! 					$attach_config['upload_filesize_limit'] = intval($attach_config['attachment_quota']);
! 				}
! 			}
! 		}
! 	}
! 	else
! 	{
! 		$attachments->get_quota_limits($user_id);
! 	}
! 
! 	if ( intval($attach_config['upload_filesize_limit']) == 0 )
! 	{
! 		$upload_filesize_limit = intval($attach_config['attachment_quota']);
! 	}
! 	else
! 	{
! 		$upload_filesize_limit = intval($attach_config['upload_filesize_limit']);
! 	}
! 
! 	if ($upload_filesize_limit == 0)
! 	{
! 		$user_quota = $lang['Unlimited'];
! 	}
! 	else
! 	{
! 		$size_lang = ($upload_filesize_limit >= 1048576) ? $lang['MB'] : ( ($upload_filesize_limit >= 1024) ? $lang['KB'] : $lang['Bytes'] );
! 
! 		if ($upload_filesize_limit >= 1048576)
! 		{
! 			$user_quota = (round($upload_filesize_limit / 1048576 * 100) / 100) . ' ' . $size_lang;
! 		}
! 		else if ($upload_filesize_limit >= 1024)
! 		{
! 			$user_quota = (round($upload_filesize_limit / 1024 * 100) / 100) . ' ' . $size_lang;
! 		}
! 		else
! 		{
! 			$user_quota = ($upload_filesize_limit) . ' ' . $size_lang;
! 		}
! 	}
! 
! 	//
! 	// Get all attach_id's the specific user posted, but only uploads to the board and not Private Messages
! 	//
! 	$sql = "SELECT attach_id 
! 	FROM " . ATTACHMENTS_TABLE . "
! 	WHERE (user_id_1 = " . $user_id . ") AND (privmsgs_id = 0)
! 	GROUP BY attach_id";
! 		
! 	if ( !($result = attach_sql_query($sql)) )
! 	{
! 		message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
! 	}
! 		
! 	$attach_ids = $db->sql_fetchrowset($result);
! 	$num_attach_ids = $db->sql_numrows($result);
! 	$attach_id = array();
! 
! 	for ($j = 0; $j < $num_attach_ids; $j++)
! 	{
! 		$attach_id[] = intval($attach_ids[$j]['attach_id']);
! 	}
! 
! 	$upload_filesize = (count($attach_id) > 0) ? get_total_attach_filesize(implode(',', $attach_id)) : 0;
! 
! 	$size_lang = ($upload_filesize >= 1048576) ? $lang['MB'] : ( ($upload_filesize >= 1024) ? $lang['KB'] : $lang['Bytes'] );
! 
! 	if ($upload_filesize >= 1048576)
! 	{
! 		$user_uploaded = (round($upload_filesize / 1048576 * 100) / 100) . ' ' . $size_lang;
! 	}
! 	else if ($upload_filesize >= 1024)
! 	{
! 		$user_uploaded = (round($upload_filesize / 1024 * 100) / 100) . ' ' . $size_lang;
! 	}
! 	else
! 	{
! 		$user_uploaded = ($upload_filesize) . ' ' . $size_lang;
! 	}
! 
! 	$upload_limit_pct = ( $upload_filesize_limit > 0 ) ? round(( $upload_filesize / $upload_filesize_limit ) * 100) : 0;
! 	$upload_limit_img_length = ( $upload_filesize_limit > 0 ) ? round(( $upload_filesize / $upload_filesize_limit ) * $board_config['privmsg_graphic_length']) : 0;
! 	$upload_limit_remain = ( $upload_filesize_limit > 0 ) ? $upload_filesize_limit - $upload_filesize : 100;
! 
! 	$l_box_size_status = sprintf($lang['Upload_percent_profile'], $upload_limit_pct);
! 
! 	$template->assign_block_vars('switch_upload_limits', array());
! 
! 	$template->assign_vars(array(
! 		'L_UACP' => $lang['UACP'],
! 		'L_UPLOAD_QUOTA' => $lang['Upload_quota'],
! 		'U_UACP' => append_sid($phpbb_root_path . 'uacp.' . $phpEx . '?u=' . $user_id),
! 		'UPLOADED' => sprintf($lang['User_uploaded_profile'], $user_uploaded),
! 		'QUOTA' => sprintf($lang['User_quota_profile'], $user_quota),
! 		'UPLOAD_LIMIT_IMG_WIDTH' => $upload_limit_img_length, 
! 		'UPLOAD_LIMIT_PERCENT' => $upload_limit_pct, 
! 		'PERCENT_FULL' => $l_box_size_status)
! 	);
! 
! }
! 
! //
! // Function responsible for viewonline (within viewonline.php and the admin index page)
! //
! // added directly after the switch statement
! // viewonline.php:
! //		perform_attach_pageregister($row['session_page']);
! // admin/index.php:
! //		perform_attach_pageregister($onlinerow_reg[$i]['user_session_page'], TRUE);
! //		perform_attach_pageregister($onlinerow_guest[$i]['session_page'], TRUE);
! //
! function perform_attach_pageregister($session_page, $in_admin = FALSE)
! {
! 	global $location, $location_url, $lang;
! 
! 	switch ($session_page)
! 	{
! 		case (PAGE_UACP):
! 			$location = $lang['User_acp_title'];
! 			$location_url = ($in_admin) ? "index.$phpEx?pane=right" : "index.$phpEx";
! 			break;
! 		case (PAGE_RULES):
! 			$location = $lang['Rules_page'];
! 			$location_url = ($in_admin) ? "index.$phpEx?pane=right" : "index.$phpEx";
! 			break;
! 	}
  }
  
  ?>
\ No newline at end of file
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_selects.php attach_mod_v235/attach_mod/includes/functions_selects.php
*** attach_mod_v234/attach_mod/includes/functions_selects.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_selects.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_selects.php,v 1.6 2002/08/12 17:42:53 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_selects.php,v 1.9 2002/12/12 19:47:29 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 189,192 ****
--- 189,264 ----
  	return ($select_field);
  }
  
+ function quota_limit_select($select_name, $default_quota = -1)
+ {
+ 	global $db, $lang;
+ 		
+ 	$sql = "SELECT quota_limit_id, quota_desc
+ 	FROM " . QUOTA_LIMITS_TABLE . "
+ 	ORDER BY quota_limit ASC";
+ 
+ 	if ( !($result = attach_sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, "Couldn't query Quota Limits Table", "", __LINE__, __FILE__, $sql);
+ 	}
+ 
+ 	$quota_select = '<select name="' . $select_name . '">';
+ 	$quota_name[0]['quota_limit_id'] = -1;
+ 	$quota_name[0]['quota_desc'] = $lang['Not_assigned'];
+ 
+ 	if ( ($db->sql_numrows($result)) > 0 )
+ 	{
+ 		$rows = $db->sql_fetchrowset($result);
+ 		for ($i = 0; $i < count($rows); $i++)
+ 		{
+ 			$quota_name[] = $rows[$i];
+ 		}
+ 	}
+ 
+ 	for($i = 0; $i < count($quota_name); $i++)
+ 	{
+ 		$selected = ( $quota_name[$i]['quota_limit_id'] == $default_quota ) ? ' selected="selected"' : '';
+ 		$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
+ 	}
+ 	$quota_select .= '</select>';
+ 
+ 	return($quota_select);
+ }
+ 
+ function default_quota_limit_select($select_name, $default_quota = 0)
+ {
+ 	global $db, $lang;
+ 		
+ 	$sql = "SELECT quota_limit_id, quota_desc
+ 	FROM " . QUOTA_LIMITS_TABLE . "
+ 	ORDER BY quota_limit ASC";
+ 
+ 	if ( !($result = attach_sql_query($sql)) )
+ 	{
+ 		message_die(GENERAL_ERROR, "Couldn't query Quota Limits Table", "", __LINE__, __FILE__, $sql);
+ 	}
+ 
+ 	$quota_select = '<select name="' . $select_name . '">';
+ 	$quota_name[0]['quota_limit_id'] = 0;
+ 	$quota_name[0]['quota_desc'] = $lang['No_quota_limit'];
+ 
+ 	if ( ($db->sql_numrows($result)) > 0 )
+ 	{
+ 		$rows = $db->sql_fetchrowset($result);
+ 		for ($i = 0; $i < count($rows); $i++)
+ 		{
+ 			$quota_name[] = $rows[$i];
+ 		}
+ 	}
+ 
+ 	for($i = 0; $i < count($quota_name); $i++)
+ 	{
+ 		$selected = ( $quota_name[$i]['quota_limit_id'] == $default_quota ) ? ' selected="selected"' : '';
+ 		$quota_select .= '<option value="' . $quota_name[$i]['quota_limit_id'] . '"' . $selected . '>' . $quota_name[$i]['quota_desc'] . '</option>';
+ 	}
+ 	$quota_select .= '</select>';
+ 
+ 	return($quota_select);
+ }
+ 
  ?>
\ No newline at end of file
diff -c -rNbB attach_mod_v234/attach_mod/includes/functions_thumbs.php attach_mod_v235/attach_mod/includes/functions_thumbs.php
*** attach_mod_v234/attach_mod/includes/functions_thumbs.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/includes/functions_thumbs.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_thumbs.php,v 1.16 2002/11/03 12:44:38 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: functions_thumbs.php,v 1.21 2003/01/15 23:24:26 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 24,29 ****
--- 24,34 ----
  //
  // All Attachment Functions needed to create Thumbnails
  //
+ if ( !defined('IN_PHPBB') )
+ {
+ 	die('Hacking attempt');
+ 	exit;
+ }
  
  $imagick = '';
  
***************
*** 86,131 ****
  		$imagick = $attach_config['img_imagick'];
  		return (TRUE);
  	}
- 	
- 	if (eregi('convert', $imagick)) 
- 	{
- 		return (TRUE);
- 	} 
- 	else if ($imagick != 'none') 
- 	{
- 		if (!eregi('WIN', PHP_OS)) 
- 		{
- 			$retval = @exec('whereis convert');
- 			$paths = explode(' ', $retval);
- 
- 			if (is_array($paths)) 
- 			{
- 				for ( $i=0; $i < sizeof($paths); $i++) 
- 				{
- 					$path = basename($paths[$i]);
- 
- 					if ($path == 'convert') 
- 					{
- 						$imagick = $paths[$i];
- 						return (TRUE);
- 					}
- 				}
- 			}
- 		}
- 		else if (eregi('WIN', PHP_OS))
- 		{
- 			$path = 'c:/imagemagick/convert.exe';
- 
- 			if (file_exists($path))
- 			{
- 				$imagick = $path;
- 				return (TRUE);
- 			}
- 		}
- 
- 		$imagick = 'none';
- 		return (FALSE);
- 	} 
  	else 
  	{
  		return (FALSE);
--- 91,96 ----
***************
*** 161,171 ****
  
  	$min_filesize = intval($attach_config['img_min_thumb_filesize']);
  
! 	$img_filesize = (file_exists($source)) ? filesize($source) : false;
  
  	$destination = trim($destination);
  
! 	if (!$img_filesize || $img_filesize <= $min_filesize)  // $this->min_filesize ist die minimale Thumbnail-Size
  	{
  		return (FALSE);
  	}
--- 126,136 ----
  
  	$min_filesize = intval($attach_config['img_min_thumb_filesize']);
  
! 	$img_filesize = (@file_exists(@amod_realpath($source))) ? filesize($source) : false;
  
  	$destination = trim($destination);
  
! 	if (!$img_filesize || $img_filesize <= $min_filesize) 
  	{
  		return (FALSE);
  	}
***************
*** 182,188 ****
  	$tmp_path = '';
  	$old_file = '';
  
! 	if ($attach_config['allow_ftp_upload'])
  	{
  		$old_file = $new_file;
  
--- 147,153 ----
  	$tmp_path = '';
  	$old_file = '';
  
! 	if (intval($attach_config['allow_ftp_upload']))
  	{
  		$old_file = $new_file;
  
***************
*** 209,215 ****
  	{
  		if (is_array($size) && count($size) > 0) 
  		{
! 			exec($imagick . ' -quality 90 -antialias -sample ' . $new_size[0] . 'x' . $new_size[1] . ' ' . $source . ' ' . $new_file);
  		}
  	} 
  	else 
--- 174,180 ----
  	{
  		if (is_array($size) && count($size) > 0) 
  		{
! 			@exec($imagick . ' -quality 90 -antialias -sample ' . $new_size[0] . 'x' . $new_size[1] . ' ' . $source . ' ' . $new_file);
  		}
  	} 
  	else 
***************
*** 223,255 ****
  			switch ($type) 
  			{
  				case '1' :
! 					$im = @ImageCreateFromGIF($source);
! 					$new_im = @ImageCreate($new_size[0], $new_size[1]);
! 					@ImageCopyResized($new_im, $im, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
! 					@ImageGIF($new_im, $new_file);
  					break;
  				case '2' :
! 					$im = @ImageCreateFromJPEG($source);
! 					$new_im = @ImageCreate($new_size[0], $new_size[1]);
! 					@ImageCopyResized($new_im, $im, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
! 					@ImageJPEG($new_im, $new_file, 90);
  					break;
  				case '3' :
! 					$im = @ImageCreateFromPNG($source);
! 					$new_im = @ImageCreate($new_size[0], $new_size[1]);
! 					@ImageCopyResized($new_im, $im, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
! 					@ImagePNG($new_im, $new_file);
  					break;
  			}
  		}
  	}
  
! 	if (!file_exists($new_file))
  	{
  		return (FALSE);
  	}
  
! 	if ($attach_config['allow_ftp_upload'])
  	{
  		$result = ftp_file($new_file, $old_file, $this->type, TRUE); // True for disable error-mode
  		if (!$result)
--- 188,220 ----
  			switch ($type) 
  			{
  				case '1' :
! 					$im = imagecreatefromgif($source);
! 					$new_im = imagecreate($new_size[0], $new_size[1]);
! 					imagecopyresized($new_im, $im, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
! 					imagegif($new_im, $new_file);
  					break;
  				case '2' :
! 					$im = imagecreatefromjpeg($source);
! 					$new_im = imagecreate($new_size[0], $new_size[1]);
! 					imagecopyresized($new_im, $im, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
! 					imagejpeg($new_im, $new_file, 90);
  					break;
  				case '3' :
! 					$im = imagecreatefrompng($source);
! 					$new_im = imagecreate($new_size[0], $new_size[1]);
! 					imagecopyresized($new_im, $im, 0, 0, 0, 0, $new_size[0], $new_size[1], $size[0], $size[1]);
! 					imagepng($new_im, $new_file);
  					break;
  			}
  		}
  	}
  
! 	if (!@file_exists(@amod_realpath($new_file)))
  	{
  		return (FALSE);
  	}
  
! 	if (intval($attach_config['allow_ftp_upload']))
  	{
  		$result = ftp_file($new_file, $old_file, $this->type, TRUE); // True for disable error-mode
  		if (!$result)
diff -c -rNbB attach_mod_v234/attach_mod/pm_attachments.php attach_mod_v235/attach_mod/pm_attachments.php
*** attach_mod_v234/attach_mod/pm_attachments.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/pm_attachments.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: pm_attachments.php,v 1.9 2002/10/12 22:44:34 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: pm_attachments.php,v 1.17 2003/01/17 09:29:45 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 50,58 ****
  	//
  	function preview_attachments()
  	{
! 		global $attach_config, $is_auth, $userdata;
  
! 		if ( (!$attach_config['allow_pm_attach']) && ($userdata['user_level'] != ADMIN) )
  		{
  			return (FALSE);
  		}
--- 50,58 ----
  	//
  	function preview_attachments()
  	{
! 		global $attach_config, $userdata;
  
! 		if ( (!intval($attach_config['allow_pm_attach'])) && ($userdata['user_level'] != ADMIN) )
  		{
  			return (FALSE);
  		}
***************
*** 65,71 ****
  	//
  	function insert_attachment_pm($a_privmsgs_id)
  	{
! 		global $db, $is_auth, $mode, $attach_config, $privmsg_sent_id, $userdata, $to_userdata;
  
  		//
  		// Insert Attachment ?
--- 65,71 ----
  	//
  	function insert_attachment_pm($a_privmsgs_id)
  	{
! 		global $db, $mode, $attach_config, $privmsg_sent_id, $userdata, $to_userdata;
  
  		//
  		// Insert Attachment ?
***************
*** 75,81 ****
  			$a_privmsgs_id = $privmsg_sent_id;
  		}
  		
! 		if ((!empty($a_privmsgs_id)) && ( $mode == 'post' || $mode == 'reply' || $mode == 'edit' ) && ( ($attach_config['allow_pm_attach'] )  || ($userdata['user_level'] == ADMIN) ))
  		{
  			$this->do_insert_attachment('attach_list', 'pm', $a_privmsgs_id);
  			$this->do_insert_attachment('last_attachment', 'pm', $a_privmsgs_id);
--- 75,81 ----
  			$a_privmsgs_id = $privmsg_sent_id;
  		}
  		
! 		if ((!empty($a_privmsgs_id)) && ( $mode == 'post' || $mode == 'reply' || $mode == 'edit' ) && ( (intval($attach_config['allow_pm_attach']) )  || ($userdata['user_level'] == ADMIN) ))
  		{
  			$this->do_insert_attachment('attach_list', 'pm', $a_privmsgs_id);
  			$this->do_insert_attachment('last_attachment', 'pm', $a_privmsgs_id);
***************
*** 145,151 ****
  
  		if (count($mark_list))
  		{
! 			$delete_sql_id = implode(', ', $mark_list);
  
  			if ( ($delete_all) && ($confirm) )
  			{
--- 145,155 ----
  
  		if (count($mark_list))
  		{
! 			$delete_sql_id = '';
! 			for ($i = 0; $i < count($mark_list); $i++)
! 			{
! 				$delete_sql_id .= (($delete_sql_id != '') ? ', ' : '') . intval($mark_list[$i]);
! 			}
  
  			if ( ($delete_all) && ($confirm) )
  			{
***************
*** 156,173 ****
  	}
  
  	//
  	// For Private Messaging
  	//
  	function privmsgs_attachment_mod($mode)
  	{
! 		global $attach_config, $is_auth, $template, $lang, $userdata, $HTTP_POST_VARS, $phpbb_root_path, $phpEx, $db;
! 		global $confirm, $delete, $delete_all, $post_id, $privmsgs_id, $privmsg_id, $submit, $refresh, $mark_list;
  
! 		if ( (!$attach_config['allow_pm_attach']) && ($userdata['user_level'] != ADMIN) )
  		{
  			return;
  		}
  
  		if (!$refresh)
  		{
  			$add_attachment_box = ( !empty($HTTP_POST_VARS['add_attachment_box']) ) ? TRUE : FALSE;
--- 160,216 ----
  	}
  
  	//
+ 	// Display the Attach Limit Box (move it to displaying.php ?)
+ 	// 
+ 	function display_attach_box_limits()
+ 	{
+ 		global $folder, $attach_config, $board_config, $template, $lang, $userdata, $db;
+ 
+ 		$this->get_quota_limits();
+ 
+ 		if ( intval($attach_config['pm_filesize_limit']) == 0 )
+ 		{
+ 			$pm_filesize_limit = intval($attach_config['attachment_quota']);
+ 		}
+ 		else
+ 		{
+ 			$pm_filesize_limit = intval($attach_config['pm_filesize_limit']);
+ 		}
+ 
+ 		$pm_filesize_total = get_total_attach_pm_filesize('to_user', $userdata['user_id']);
+ 
+ 		$attach_limit_pct = ( $pm_filesize_limit > 0 ) ? round(( $pm_filesize_total / $pm_filesize_limit ) * 100) : 0;
+ 		$attach_limit_img_length = ( $pm_filesize_limit > 0 ) ? round(( $pm_filesize_total / $pm_filesize_limit ) * $board_config['privmsg_graphic_length']) : 0;
+ 		$attach_limit_remain = ( $pm_filesize_limit > 0 ) ? $pm_filesize_limit - $pm_filesize_total : 100;
+ 
+ 		$l_box_size_status = sprintf($lang['Attachbox_limit'], $attach_limit_pct);
+ 
+ 		$template->assign_vars(array(
+ 			'ATTACHBOX_LIMIT_IMG_WIDTH' => $attach_limit_img_length, 
+ 			'ATTACHBOX_LIMIT_PERCENT' => $attach_limit_pct, 
+ 
+ 			'ATTACH_BOX_SIZE_STATUS' => $l_box_size_status)
+ 		);
+ 	}
+ 	
+ 	//
  	// For Private Messaging
  	//
  	function privmsgs_attachment_mod($mode)
  	{
! 		global $attach_config, $template, $lang, $userdata, $HTTP_POST_VARS, $phpbb_root_path, $phpEx, $db;
! 		global $confirm, $delete, $delete_all, $post_id, $privmsgs_id, $privmsg_id, $submit, $refresh, $mark_list, $folder;
  
! 		if ( (!intval($attach_config['allow_pm_attach'])) && ($userdata['user_level'] != ADMIN) )
  		{
  			return;
  		}
  
+ 		if ($folder != 'outbox')
+ 		{
+ 			$this->display_attach_box_limits();
+ 		}
+ 		
  		if (!$refresh)
  		{
  			$add_attachment_box = ( !empty($HTTP_POST_VARS['add_attachment_box']) ) ? TRUE : FALSE;
diff -c -rNbB attach_mod_v234/attach_mod/posting_attachments.php attach_mod_v235/attach_mod/posting_attachments.php
*** attach_mod_v234/attach_mod/posting_attachments.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/attach_mod/posting_attachments.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: posting_attachments.php,v 1.31 2002/11/03 23:46:04 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: posting_attachments.php,v 1.51 2003/01/17 09:29:45 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 79,84 ****
--- 79,239 ----
  	}
  	
  	//
+ 	// Get Quota Limits
+ 	//
+ 	function get_quota_limits($user_id = -1)
+ 	{
+ 		global $userdata, $attach_config, $db;
+ 
+ 		//
+ 		// Define Filesize Limits (Prepare Quota Settings)
+ 		// Priority: Group, User, Management
+ 		//
+ 		// This method is somewhat query intensive, but i think because this one is only executed while attaching a file, 
+ 		// it does not make much sense to come up with an new db-entry.
+ 		// Maybe i will change this in a future version, where you are able to disable the User Quota Feature at all (using
+ 		// Default Limits for all Users/Groups)
+ 		//
+ 
+ 		// Change this to 'user;group' if you want to have first priority on user quota settings.
+ 		$priority = 'group;user';
+ 		
+ 		if ( $userdata['user_level'] == ADMIN )
+ 		{
+ 			$attach_config['pm_filesize_limit'] = 0; // Unlimited
+ 			$attach_config['upload_filesize_limit'] = 0; // Unlimited
+ 			return;
+ 		}
+ 
+ 		if ($this->page == PAGE_PRIVMSGS)
+ 		{
+ 			$quota_type = QUOTA_PM_LIMIT;
+ 			$limit_type = 'pm_filesize_limit';
+ 			$default = 'max_filesize_pm';
+ 		}
+ 		else
+ 		{
+ 			$quota_type = QUOTA_UPLOAD_LIMIT;
+ 			$limit_type = 'upload_filesize_limit';
+ 			$default = 'attachment_quota';
+ 		}
+ 
+ 		if ($user_id == -1)
+ 		{
+ 			$user_id = $userdata['user_id'];
+ 		}
+ 		
+ 		$priority = explode(';', $priority);
+ 		$found = FALSE;
+ 
+ 		for ($i = 0; $i < count($priority); $i++)
+ 		{
+ 			if (($priority[$i] == 'group') && (!$found))
+ 			{
+ 				//
+ 				// Get Group Quota, if we find one, we have our quota
+ 				//
+ 				$sql = "SELECT u.group_id FROM " . USER_GROUP_TABLE . " u, " . GROUPS_TABLE . " g 
+ 				WHERE (g.group_single_user = 0) AND (u.group_id = g.group_id) AND (u.user_id = " . $user_id . ")";
+ 			
+ 				if ( !($result = attach_sql_query($sql)) )
+ 				{
+ 					message_die(GENERAL_ERROR, 'Could not get User Group', '', __LINE__, __FILE__, $sql);
+ 				}
+ 
+ 				if ($db->sql_numrows($result) > 0)
+ 				{
+ 					$rows = $db->sql_fetchrowset($result);
+ 					$group_id = array();
+ 
+ 					for ($j = 0; $j < count($rows); $j++)
+ 					{
+ 						$group_id[] = $rows[$j]['group_id'];
+ 					}
+ 
+ 					$sql = "SELECT l.quota_limit FROM " . QUOTA_TABLE . " q, " . QUOTA_LIMITS_TABLE . " l
+ 					WHERE (q.group_id IN (" . implode(',', $group_id) . ")) AND (q.group_id <> 0) AND (q.quota_type = " . $quota_type . ") 
+ 					AND (q.quota_limit_id = l.quota_limit_id) ORDER BY l.quota_limit DESC LIMIT 1";
+ 
+ 					if ( !($result = attach_sql_query($sql)) )
+ 					{
+ 						message_die(GENERAL_ERROR, 'Could not get Group Quota', '', __LINE__, __FILE__, $sql);
+ 					}
+ 
+ 					if ($db->sql_numrows($result) > 0)
+ 					{
+ 						$row = $db->sql_fetchrow($result);
+ 						$attach_config[$limit_type] = $row['quota_limit'];
+ 						$found = TRUE;
+ 					}
+ 				}
+ 			}
+ 
+ 			if (($priority[$i] == 'user') && (!$found))
+ 			{
+ 				//
+ 				// Get User Quota, if the user is not in a group or the group has no quotas
+ 				//
+ 				$sql = "SELECT l.quota_limit FROM " . QUOTA_TABLE . " q, " . QUOTA_LIMITS_TABLE . " l
+ 				WHERE (q.user_id = " . $user_id . ") AND (q.user_id <> 0) AND (q.quota_type = " . $quota_type . ") 
+ 				AND (q.quota_limit_id = l.quota_limit_id) LIMIT 1";
+ 
+ 				if ( !($result = attach_sql_query($sql)) )
+ 				{
+ 					message_die(GENERAL_ERROR, 'Could not get User Quota', '', __LINE__, __FILE__, $sql);
+ 				}
+ 
+ 				if ($db->sql_numrows($result) > 0)
+ 				{
+ 					$row = $db->sql_fetchrow($result);
+ 					$attach_config[$limit_type] = $row['quota_limit'];
+ 					$found = TRUE;
+ 				}
+ 			}
+ 		}
+ 
+ 		if (!$found)
+ 		{
+ 			// Set Default Quota Limit
+ 			$quota_id = ($quota_type == QUOTA_UPLOAD_LIMIT) ? intval($attach_config['default_upload_quota']) : intval($attach_config['default_pm_quota']);
+ 
+ 			if ($quota_id == 0)
+ 			{
+ 				$attach_config[$limit_type] = $attach_config[$default];
+ 			}
+ 			else
+ 			{
+ 				$sql = "SELECT quota_limit FROM " . QUOTA_LIMITS_TABLE . "
+ 				WHERE quota_limit_id = " . $quota_id . " LIMIT 1";
+ 
+ 				if ( !($result = attach_sql_query($sql)) )
+ 				{
+ 					message_die(GENERAL_ERROR, 'Could not get Default Quota Limit', '', __LINE__, __FILE__, $sql);
+ 				}
+ 	
+ 				if ($db->sql_numrows($result) > 0)
+ 				{
+ 					$row = $db->sql_fetchrow($result);
+ 					$attach_config[$limit_type] = $row['quota_limit'];
+ 				}
+ 				else
+ 				{
+ 					$attach_config[$limit_type] = $attach_config[$default];
+ 				}
+ 			}
+ 		}
+ 
+ 		// Never exceed the complete Attachment Upload Quota
+ 		if ($quota_type == QUOTA_UPLOAD_LIMIT)
+ 		{
+ 			if (intval($attach_config[$limit_type]) > intval($attach_config[$default]))
+ 			{
+ 				$attach_config[$limit_type] = $attach_config[$default];
+ 			}
+ 		}
+ 	}
+ 	
+ 	//
  	// Handle all modes... (intern)
  	//
  	function handle_attachments($mode)
***************
*** 110,121 ****
  			if ( $userdata['user_level'] == ADMIN )
  			{
  				$is_auth['auth_attachments'] = '1';
  				$max_attachments = ADMIN_MAX_ATTACHMENTS;
  			}
  			else
  			{
! 				$is_auth['auth_attachments'] = $attach_config['allow_pm_attach'];
! 				$max_attachments = $attach_config['max_attachments_pm'];
  			}
  		}
  		else
--- 265,278 ----
  			if ( $userdata['user_level'] == ADMIN )
  			{
  				$is_auth['auth_attachments'] = '1';
+ 				$is_auth['auth_read'] = TRUE;
  				$max_attachments = ADMIN_MAX_ATTACHMENTS;
  			}
  			else
  			{
! 				$is_auth['auth_attachments'] = intval($attach_config['allow_pm_attach']);
! 				$is_auth['auth_read'] = TRUE;
! 				$max_attachments = intval($attach_config['max_attachments_pm']);
  			}
  		}
  		else
***************
*** 126,139 ****
  			}
  			else
  			{
! 				$max_attachments = $attach_config['max_attachments'];
  			}
  		}
  		
  		//
  		// nothing, if the user is not authorized or attachment mod disabled
  		//
! 		if ( ($attach_config['disable_mod'] == '1') || (!$is_auth['auth_attachments']) )
  		{
  			return (FALSE);
  		}
--- 283,296 ----
  			}
  			else
  			{
! 				$max_attachments = intval($attach_config['max_attachments']);
  			}
  		}
  		
  		//
  		// nothing, if the user is not authorized or attachment mod disabled
  		//
! 		if ( (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_attachments']) && ($is_auth['auth_read']))) )
  		{
  			return (FALSE);
  		}
***************
*** 177,183 ****
  			}
  			else
  			{
! 				$auth = ( $attach_config['allow_pm_attach'] ) ? TRUE : FALSE;
  			}
  
  			if (count($attachments) == 1)
--- 334,340 ----
  			}
  			else
  			{
! 				$auth = ( intval($attach_config['allow_pm_attach']) ) ? TRUE : FALSE;
  			}
  
  			if (count($attachments) == 1)
***************
*** 232,237 ****
--- 389,419 ----
  					if ( $this->num_attachments < intval($max_attachments) )
  					{
  						$this->upload_attachment($this->page);
+ 
+ 						if ( (!$error) && ($this->post_attach) )
+ 						{
+ 							array_unshift($this->attachment_list, $this->attach_filename);
+ 							array_unshift($this->attachment_comment_list, $this->file_comment);
+ 							array_unshift($this->attachment_filename_list, $this->filename);
+ 							array_unshift($this->attachment_extension_list, $this->extension);
+ 							array_unshift($this->attachment_mimetype_list, $this->type);
+ 							array_unshift($this->attachment_filesize_list, $this->filesize);
+ 							array_unshift($this->attachment_filetime_list, $this->filetime);
+ 							array_unshift($this->attachment_id_list, '-1');
+ 							array_unshift($this->attachment_thumbnail_list, $this->thumbnail);
+ 
+ 							$this->file_comment = '';
+ 
+ 							// This Variable is set to FALSE here, because the Attachment Mod enter Attachments into the
+ 							// Database in two modes, one if the id_list is -1 and the second one if post_attach is true
+ 							// Since post_attach is automatically switched to true if an Attachment got added to the filesystem,
+ 							// but we are assigning an id of -1 here, we have to reset the post_attach variable to FALSE.
+ 							//
+ 							// This is very relevant, because it could happen that the post got not submitted, but we do not
+ 							// know this circumstance here. We could be at the posting page or we could be redirected to the entered
+ 							// post. :)
+ 							$this->post_attach = FALSE;
+ 						}
  					}
  					else
  					{
***************
*** 477,483 ****
  					}
  				}
  				
! 				if( ( ($add_attachment) || ($preview) ) && ($this->filename != '') )
  				{
  					if( $this->num_attachments < intval($max_attachments) ) 
  					{
--- 659,665 ----
  					}
  				}
  				
! 				if (( ($add_attachment) || ($preview) ) && ($this->filename != '') )
  				{
  					if( $this->num_attachments < intval($max_attachments) ) 
  					{
***************
*** 600,606 ****
  				// insert attachment into db, here the user submited it directly 
  				//
  				$sql = "INSERT INTO " . ATTACHMENTS_DESC_TABLE . " (physical_filename, real_filename, comment, extension, mimetype, filesize, filetime, thumbnail) 
! 				VALUES ( '" . $this->attach_filename . "', '" . str_replace("'", "''", $this->filename) . "', '" . trim($this->file_comment) . "', '" . $this->extension . "', '" . $this->type . "', " . $this->filesize . ", " . $this->filetime . ", " . $this->thumbnail . ")";
  	
  				//
  				// Inform the user that his post has been created, but nothing is attached
--- 782,788 ----
  				// insert attachment into db, here the user submited it directly 
  				//
  				$sql = "INSERT INTO " . ATTACHMENTS_DESC_TABLE . " (physical_filename, real_filename, comment, extension, mimetype, filesize, filetime, thumbnail) 
! 				VALUES ( '" . $this->attach_filename . "', '" . str_replace("'", "''", stripslashes($this->filename)) . "', '" . trim($this->file_comment) . "', '" . $this->extension . "', '" . $this->type . "', " . $this->filesize . ", " . $this->filetime . ", " . $this->thumbnail . ")";
  	
  				//
  				// Inform the user that his post has been created, but nothing is attached
***************
*** 633,639 ****
  		//
  		// Choose what to display
  		//
! 		if ($attach_config['show_apcp'])
  		{
  			if ( !empty($HTTP_POST_VARS['add_attachment_box']) )
  			{
--- 815,821 ----
  		//
  		// Choose what to display
  		//
! 		if (intval($attach_config['show_apcp']))
  		{
  			if ( !empty($HTTP_POST_VARS['add_attachment_box']) )
  			{
***************
*** 697,703 ****
  
  		if ( count($this->attachment_list) > 0 )
  		{
! 			if ($attach_config['show_apcp'])
  			{
  				$template->assign_block_vars('switch_posted_attachments', array());
  			}
--- 879,885 ----
  
  		if ( count($this->attachment_list) > 0 )
  		{
! 			if (intval($attach_config['show_apcp']))
  			{
  				$template->assign_block_vars('switch_posted_attachments', array());
  			}
***************
*** 738,744 ****
  				'L_ADD_ATTACHMENT' => $lang['Add_attachment'],
  
  				'FILE_COMMENT' => stripslashes(htmlspecialchars($this->file_comment)),
! 				'FILESIZE' => $attach_config['max_filesize'],
  				'FILENAME' => $this->filename,
  
  				'S_FORM_ENCTYPE' => $form_enctype)	
--- 920,926 ----
  				'L_ADD_ATTACHMENT' => $lang['Add_attachment'],
  
  				'FILE_COMMENT' => stripslashes(htmlspecialchars($this->file_comment)),
! 				'FILESIZE' => intval($attach_config['max_filesize']),
  				'FILENAME' => $this->filename,
  
  				'S_FORM_ENCTYPE' => $form_enctype)	
***************
*** 829,836 ****
  
  			$row = $db->sql_fetchrow($result);
  
! 			$allowed_filesize = ( $row['max_filesize'] != 0 ) ? $row['max_filesize'] : $attach_config['max_filesize'];
! 			$cat_id = $row['cat_id'];
  			$auth_cache = trim($row['forum_permissions']);
  
  			//
--- 1011,1018 ----
  
  			$row = $db->sql_fetchrow($result);
  
! 			$allowed_filesize = ( intval($row['max_filesize']) != 0 ) ? intval($row['max_filesize']) : intval($attach_config['max_filesize']);
! 			$cat_id = intval($row['cat_id']);
  			$auth_cache = trim($row['forum_permissions']);
  
  			//
***************
*** 903,909 ****
  			{
  				list($width, $height) = image_getdimension($file);
  
! 				if ( ($width != 0) && ($height != 0) && ($attach_config['img_max_width'] != 0) && ($attach_config['img_max_height'] != 0) )
  				{
  					if ( ($width > intval($attach_config['img_max_width'])) || ($height > intval($attach_config['img_max_height'])) )
  					{
--- 1085,1091 ----
  			{
  				list($width, $height) = image_getdimension($file);
  
! 				if ( ($width != 0) && ($height != 0) && (intval($attach_config['img_max_width']) != 0) && (intval($attach_config['img_max_height']) != 0) )
  				{
  					if ( ($width > intval($attach_config['img_max_width'])) || ($height > intval($attach_config['img_max_height'])) )
  					{
***************
*** 942,950 ****
  			}
  
  			//
! 			// Check our quota
  			//
! 			if ($attach_config['attachment_quota'] != 0)
  			{
  				$sql = 'SELECT sum(filesize) as total FROM ' . ATTACHMENTS_DESC_TABLE;
  
--- 1124,1132 ----
  			}
  
  			//
! 			// Check our complete quota
  			//
! 			if (intval($attach_config['attachment_quota']) != 0)
  			{
  				$sql = 'SELECT sum(filesize) as total FROM ' . ATTACHMENTS_DESC_TABLE;
  
***************
*** 956,962 ****
  				$row = $db->sql_fetchrow($result);
  				$total_filesize = $row['total'];
  
! 				if ($total_filesize + $this->filesize > $attach_config['attachment_quota'])
  				{
  					$error = TRUE;
  					if(!empty($error_msg))
--- 1138,1144 ----
  				$row = $db->sql_fetchrow($result);
  				$total_filesize = $row['total'];
  
! 				if ($total_filesize + $this->filesize > intval($attach_config['attachment_quota']))
  				{
  					$error = TRUE;
  					if(!empty($error_msg))
***************
*** 968,1006 ****
  
  			}
  
  			//
! 			// If we are at Private Messaging, check our PM Quota
  			//
! 			if ($this->page == PAGE_PRIVMSGS)
  			{
- 				$to_user = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';
- 				
  				$sql = "SELECT attach_id
  				FROM " . ATTACHMENTS_TABLE . "
! 				WHERE (user_id_1 = " . $userdata['user_id'] . ") AND (privmsgs_id != 0)";
! 				// user_id_1 is the from address
  
! 				if ( !($result = attach_sql_query($sql)) )
  				{
! 					message_die(GENERAL_ERROR, 'Could not query Attachment Informations', '', __LINE__, __FILE__, $sql);
  				}
  				
  				$attach_ids = $db->sql_fetchrowset($result);
  				$num_attach_ids = $db->sql_numrows($result);
  				$attach_id = array();
  
  				if ($num_attach_ids > 0)
  				{
! 					for ($i = 0; $i < $num_attach_ids; $i++)
  					{
! 						$attach_id[] = $attach_ids[$i]['attach_id'];
  					}
  
! 					$attach_id = implode(', ', $attach_id);
  				
! 					$total_filesize = get_total_attach_filesize($attach_id);
  
! 					if ( ($total_filesize + $this->filesize > $attach_config['max_filesize_pm']) && ($userdata['user_level'] != ADMIN) ) 
  					{
  						$error = TRUE;
  						if(!empty($error_msg))
--- 1150,1241 ----
  
  			}
  
+ 			$this->get_quota_limits();
+ 
  			//
! 			// Check our user quota
  			//
! 			if ($this->page != PAGE_PRIVMSGS)
! 			{
! 				if (intval($attach_config['upload_filesize_limit']) != 0)
  				{
  					$sql = "SELECT attach_id 
  					FROM " . ATTACHMENTS_TABLE . "
! 					WHERE (user_id_1 = " . $userdata['user_id'] . ") AND (privmsgs_id = 0)
! 					GROUP BY attach_id";
  		
! 					if ( !($result = $db->sql_query($sql)) )
  					{
! 						message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
  					}
  		
  					$attach_ids = $db->sql_fetchrowset($result);
  					$num_attach_ids = $db->sql_numrows($result);
  					$attach_id = array();
  
+ 					for ($i = 0; $i < $num_attach_ids; $i++)
+ 					{
+ 						$attach_id[] = intval($attach_ids[$i]['attach_id']);
+ 					}
+ 			
  					if ($num_attach_ids > 0)
  					{
! 						//
! 						// Now get the total filesize
! 						//
! 						$sql = "SELECT sum(filesize) as total
! 						FROM " . ATTACHMENTS_DESC_TABLE . "
! 						WHERE attach_id IN (" . implode(', ', $attach_id) . ")";
! 
! 						if ( !($result = attach_sql_query($sql)) )
! 						{
! 							message_die(GENERAL_ERROR, 'Could not query total filesize', '', __LINE__, __FILE__, $sql);
! 						}
! 
! 						$row = $db->sql_fetchrow($result);
! 						$total_filesize = $row['total'];
! 					}
! 					else
  					{
! 						$total_filesize = 0;
  					}
  
! 					if ($total_filesize + $this->filesize > intval($attach_config['upload_filesize_limit']))
! 					{
! 						$upload_filesize_limit = intval($attach_config['upload_filesize_limit']);
! 						$size_lang = ($upload_filesize_limit >= 1048576) ? $lang['MB'] : ( ($upload_filesize_limit >= 1024) ? $lang['KB'] : $lang['Bytes'] );
! 
! 						if ($upload_filesize_limit >= 1048576)
! 						{
! 							$upload_filesize_limit = round($upload_filesize_limit / 1048576 * 100) / 100;
! 						}
! 						else if($upload_filesize_limit >= 1024)
! 						{
! 							$upload_filesize_limit = round($upload_filesize_limit / 1024 * 100) / 100;
! 						}
! 			
! 						$error = TRUE;
! 						if(!empty($error_msg))
! 						{
! 							$error_msg .= '<br />';
! 						}
! 						$error_msg .= sprintf($lang['User_upload_quota_reached'], $upload_filesize_limit, $size_lang);
! 					}
! 				}
! 			}
! 					
! 			//
! 			// If we are at Private Messaging, check our PM Quota
! 			//
! 			if ($this->page == PAGE_PRIVMSGS)
! 			{
! 				$to_user = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';
  				
! 				if (intval($attach_config['pm_filesize_limit']) != 0)
! 				{
! 					$total_filesize = get_total_attach_pm_filesize('from_user', $userdata['user_id']);
  
! 					if ( ($total_filesize + $this->filesize > intval($attach_config['pm_filesize_limit'])) ) 
  					{
  						$error = TRUE;
  						if(!empty($error_msg))
***************
*** 1026,1059 ****
  					}
  
  					$row = $db->sql_fetchrow($result);
! 					$user_id = $row['user_id'];
  
! 					$sql = "SELECT attach_id
! 					FROM " . ATTACHMENTS_TABLE . "
! 					WHERE (user_id_2 = " . $userdata['user_id'] . ") AND (privmsgs_id != 0)";
! 					// user_id_2 is the to address
  
! 					if ( !($result = attach_sql_query($sql)) )
  					{
! 						message_die(GENERAL_ERROR, 'Could not query Attachment Informations', '', __LINE__, __FILE__, $sql);
! 					}
! 				
! 					$attach_ids = $db->sql_fetchrowset($result);
! 					$num_attach_ids = $db->sql_numrows($result);
! 					$attach_id = array();
! 
! 					if ($num_attach_ids > 0)
! 					{
! 						for ($i = 0; $i < $num_attach_ids; $i++)
! 						{
! 							$attach_id[] = $attach_ids[$i]['attach_id'];
! 						}
! 
! 						$attach_id = implode(', ', $attach_id);
! 				
! 						$total_filesize = get_total_attach_filesize($attach_id);
  						
! 						if ($total_filesize + $this->filesize > $attach_config['max_filesize_pm'])
  						{
  							$error = TRUE;
  							if(!empty($error_msg))
--- 1261,1275 ----
  					}
  
  					$row = $db->sql_fetchrow($result);
! 					$user_id = intval($row['user_id']);
  					
! 					$this->get_quota_limits($user_id);
  
! 					if (intval($attach_config['pm_filesize_limit']) != 0)
  					{
! 						$total_filesize = get_total_attach_pm_filesize('to_user', $user_id);
  						
! 						if ($total_filesize + $this->filesize > intval($attach_config['pm_filesize_limit'])) 
  						{
  							$error = TRUE;
  							if(!empty($error_msg))
***************
*** 1077,1083 ****
  	
  				$this->filename = stripslashes($r_file);
  
! 				$this->attach_filename = str_replace(' ', '_', $this->filename);
  				
  				$this->attach_filename = rawurlencode($this->attach_filename);
  				$this->attach_filename = preg_replace("/%(\w{2})/", "_", $this->attach_filename);
--- 1293,1300 ----
  	
  				$this->filename = stripslashes($r_file);
  
! 				$this->attach_filename = strtolower($this->filename);
! 				$this->attach_filename = str_replace(' ', '_', $this->attach_filename);
  				
  				$this->attach_filename = rawurlencode($this->attach_filename);
  				$this->attach_filename = preg_replace("/%(\w{2})/", "_", $this->attach_filename);
***************
*** 1093,1099 ****
  				//
  				// Do we have to create a thumbnail ?
  				//
! 				if ( ($cat_id == IMAGE_CAT) && ($attach_config['img_create_thumbnail'] == '1') )
  				{
  					$this->thumbnail = 1;
  				}
--- 1310,1316 ----
  				//
  				// Do we have to create a thumbnail ?
  				//
! 				if ( ($cat_id == IMAGE_CAT) && (intval($attach_config['img_create_thumbnail'])) )
  				{
  					$this->thumbnail = 1;
  				}
***************
*** 1104,1110 ****
  			//
  			if (!$error) 
  			{
! 				if ( !($attach_config['allow_ftp_upload']) )
  				{
  					//
  					// Descide the Upload method
--- 1321,1327 ----
  			//
  			if (!$error) 
  			{
! 				if ( !(intval($attach_config['allow_ftp_upload'])) )
  				{
  					//
  					// Descide the Upload method
***************
*** 1159,1165 ****
  	//
  	function move_uploaded_attachment($upload_mode, $file)
  	{
! 		global $attach_config, $error, $error_msg, $lang, $upload_dir;
  
  		switch ($upload_mode)
  		{
--- 1376,1382 ----
  	//
  	function move_uploaded_attachment($upload_mode, $file)
  	{
! 		global $error, $error_msg, $lang, $upload_dir;
  
  		switch ($upload_mode)
  		{
***************
*** 1296,1302 ****
  	{
  		global $attach_config, $is_auth, $userdata;
  
! 		if ( ($attach_config['disable_mod'] == '1') || (!$is_auth['auth_attachments']) )
  		{
  			return (FALSE);
  		}
--- 1513,1519 ----
  	{
  		global $attach_config, $is_auth, $userdata;
  
! 		if ( (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_attachments']) && ($is_auth['auth_read']))) )
  		{
  			return (FALSE);
  		}
***************
*** 1314,1320 ****
  		//
  		// Insert Attachment ?
  		//
! 		if ((!empty($post_id)) && ( $mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost' ) && ( $is_auth['auth_attachments'] ))
  		{
  			$this->do_insert_attachment('attach_list', 'post', $post_id);
  			$this->do_insert_attachment('last_attachment', 'post', $post_id);
--- 1531,1537 ----
  		//
  		// Insert Attachment ?
  		//
! 		if ((!empty($post_id)) && ( $mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost' ) && ($is_auth['auth_attachments']) && ($is_auth['auth_read']))
  		{
  			$this->do_insert_attachment('attach_list', 'post', $post_id);
  			$this->do_insert_attachment('last_attachment', 'post', $post_id);
diff -c -rNbB attach_mod_v234/download.php attach_mod_v235/download.php
*** attach_mod_v234/download.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/download.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: download.php,v 1.20 2002/11/02 17:49:57 meik Exp $
   *
   *
   ***************************************************************************/
--- 6,12 ----
   *   copyright            : (C) 2002 Meik Sievertsen
   *   email                : acyd.burn@gmx.de
   *
!  *   $Id: download.php,v 1.27 2003/01/15 23:24:27 acydburn Exp $
   *
   *
   ***************************************************************************/
***************
*** 20,32 ****
   *
   ***************************************************************************/
  
- /*
- $mtime = microtime();    
- $mtime = explode(" ",$mtime);    
- $mtime = $mtime[1] + $mtime[0];    
- $starttime = $mtime; 
- */
- 
  if ( defined('IN_PHPBB') )
  {
  	die('Hacking attempt');
--- 20,25 ----
***************
*** 44,50 ****
  }
  else
  {
! 	$download_id = '';
  }
  
  if( isset($HTTP_POST_VARS['thumb']) || isset($HTTP_GET_VARS['thumb']) )
--- 37,43 ----
  }
  else
  {
! 	$download_id = -1;
  }
  
  if( isset($HTTP_POST_VARS['thumb']) || isset($HTTP_GET_VARS['thumb']) )
***************
*** 56,78 ****
  	$thumbnail = FALSE;
  }
  
- 
- if( isset($HTTP_POST_VARS['rn']) || isset($HTTP_GET_VARS['rn']) )
- {
- 	$real_name = ( isset($HTTP_POST_VARS['rn']) ) ? $HTTP_POST_VARS['rn'] : $HTTP_GET_VARS['rn'];
- }
- else
- {
- 	$real_name = '';
- }
- 
  //
  // Begin Functions
  //
  function send_file_to_browser($real_filename, $mimetype, $physical_filename, $upload_dir, $attach_id)
  {
  	global $_SERVER, $HTTP_USER_AGENT, $HTTP_SERVER_VARS, $lang, $db;
- //	global $starttime, $mtime;
  
  	if ($upload_dir == '')
  	{
--- 49,60 ----
***************
*** 85,95 ****
  
  	$gotit = FALSE;
  
! 	if (!$attach_config['allow_ftp_upload'])
  	{
! 		$fp = @fopen($filename, 'rb');
! 
! 		if (!$fp)
  		{
  			message_die(GENERAL_ERROR, $lang['Error_no_attachment'] . "<br /><br /><b>404 File Not Found:</b> The File <i>" . $filename . "</i> does not exist.");
  		}
--- 67,75 ----
  
  	$gotit = FALSE;
  
! 	if (!intval($attach_config['allow_ftp_upload']))
  	{
! 		if (@!file_exists(@amod_realpath($filename)))
  		{
  			message_die(GENERAL_ERROR, $lang['Error_no_attachment'] . "<br /><br /><b>404 File Not Found:</b> The File <i>" . $filename . "</i> does not exist.");
  		}
***************
*** 167,182 ****
  		}
  	}
  
- /*	$mtime = microtime(); 
- 	$mtime = explode(" ",$mtime); 
- 	$mtime = $mtime[1] + $mtime[0]; 
- 	$endtime = $mtime; 
- 	$totaltime = ($endtime - $starttime);
- 
- 	$sql = "INSERT INTO debug_time (attach_id, estimated_time) VALUES (" . $attach_id . ", " . $totaltime . ")";
- 	$db->sql_query($sql);
- */
- 
  	//
  	// Send out the Headers
  	//
--- 147,152 ----
***************
*** 180,222 ****
  	//
  	// Send out the Headers
  	//
- 
  	if ($browser_agent == 'ie')
  	{
- //		header('Content-Type: ' . $mimetype . '; name="' . $real_filename . '"');
  		header('Content-Type: ' . $mimetype);
  		header('Content-Disposition: inline; filename="' . $real_filename . '"');
- 		header('Expires: 0');
- 		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- 		header('Pragma: public');
  	} 
  	else
  	{
  		header('Content-Type: ' . $mimetype . '; name="' . $real_filename . '"');
! 		header("Content-Disposition: attachment; filename=" . $real_filename);
! 		header("Expires: 0");
! 		header("Pragma: no-cache");
  	}
  	
- /*
- 	// For those wanting to explain the Download too.
- 	if ( defined('ATTACH_QUERY_DEBUG') )
- 	{
- 		global $starttime, $attach_sql_time, $userdata, $attach_sql_report, $attach_num_queries, $debug_output;
- 		$mtime = explode(' ', microtime());
- 		$totaltime = $mtime[0] + $mtime[1] - $starttime;
- 
- 		if ($attach_sql_time > 0)
- 		{
- 			$fp = fopen('explain/d' . $userdata['user_id'] . '.html', 'wt');
- 			fwrite($fp, $attach_sql_report);
- 			$str = "<pre><b>The Attachment Mod generated " . $attach_num_queries . " queries,\nspending " . $attach_sql_time . ' doing MySQL queries and ' . ($totaltime - $attach_sql_time) . ' doing PHP things.</b></pre>';
- 			fwrite($fp, $str);
- 			fclose($fp);
- 		}
- 	}
- */
- 
  	//
  	// Now send the File Contents to the Browser
  	//
--- 150,166 ----
  	//
  	// Send out the Headers
  	//
  	if ($browser_agent == 'ie')
  	{
  		header('Content-Type: ' . $mimetype);
  		header('Content-Disposition: inline; filename="' . $real_filename . '"');
  	} 
  	else
  	{
  		header('Content-Type: ' . $mimetype . '; name="' . $real_filename . '"');
! 		header('Content-Disposition: attachment; filename=' . $real_filename);
  	}
  	
  	//
  	// Now send the File Contents to the Browser
  	//
***************
*** 220,245 ****
  	//
  	// Now send the File Contents to the Browser
  	//
- 
  	if ($gotit)
  	{
! 		while(!feof($fp)) 
! 		{
! 			print fread($fp, 100000);
! 		}
! 		fclose($fp);
! //		readfile($filename);
  	}
! 	else if ((!$gotit) && ($attach_config['allow_ftp_upload']))
  	{
  		$conn_id = attach_init_ftp();
  
! 		$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
  
  		$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : $upload_dir . '/tmp';
  		$tmp_filename = @tempnam($tmp_path, 't0000');
  
! 		@unlink($tmp_filename); // unlink for safety on php4.0.3+
  
  		$mode = FTP_BINARY;
  		if ( (preg_match("/text/i", $mimetype)) || (preg_match("/html/i", $mimetype)) )
--- 164,183 ----
  	//
  	// Now send the File Contents to the Browser
  	//
  	if ($gotit)
  	{
! 		readfile($filename);
  	}
! 	else if ((!$gotit) && (intval($attach_config['allow_ftp_upload'])))
  	{
  		$conn_id = attach_init_ftp();
  
! 		$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
  
  		$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : $upload_dir . '/tmp';
  		$tmp_filename = @tempnam($tmp_path, 't0000');
  
! 		@unlink($tmp_filename);
  
  		$mode = FTP_BINARY;
  		if ( (preg_match("/text/i", $mimetype)) || (preg_match("/html/i", $mimetype)) )
***************
*** 247,253 ****
  			$mode = FTP_ASCII;
  		}
  
! 		$result = ftp_get($conn_id, $tmp_filename, $physical_filename, $mode);
  
  		if (!$result) 
  		{
--- 185,191 ----
  			$mode = FTP_ASCII;
  		}
  
! 		$result = @ftp_get($conn_id, $tmp_filename, $physical_filename, $mode);
  
  		if (!$result) 
  		{
***************
*** 277,306 ****
  $userdata = session_pagestart($user_ip, PAGE_INDEX);
  init_userprefs($userdata);
  
! if (empty($download_id) && empty($real_name))
  {
  	message_die(GENERAL_ERROR, $lang['No_attachment_selected']);
  }
  
! $mimetypes = array();
! 
! if (($attach_config['disable_mod'] == '1') && ($userdata['user_level'] != ADMIN))
  {
  	message_die(GENERAL_MESSAGE, $lang['Attachment_feature_disabled']);
  }
  	
! if ($download_id)
! {
! 	$sql = 'SELECT *
! 	FROM ' . ATTACHMENTS_DESC_TABLE . '
! 	WHERE attach_id = ' . intval($download_id);
! }
! else if ($real_name)
! {
! 	$sql = "SELECT *
! 	FROM " . ATTACHMENTS_DESC_TABLE . " 
! 	WHERE attach_filename = '" . $real_name . "'";
! }
  
  if ( !($result = attach_sql_query($sql)) )
  {
--- 214,232 ----
  $userdata = session_pagestart($user_ip, PAGE_INDEX);
  init_userprefs($userdata);
  
! if ($download_id == -1)
  {
  	message_die(GENERAL_ERROR, $lang['No_attachment_selected']);
  }
  
! if ((intval($attach_config['disable_mod']) == 1) && ($userdata['user_level'] != ADMIN))
  {
  	message_die(GENERAL_MESSAGE, $lang['Attachment_feature_disabled']);
  }
  	
! $sql = 'SELECT *
! FROM ' . ATTACHMENTS_DESC_TABLE . '
! WHERE attach_id = ' . intval($download_id);
  
  if ( !($result = attach_sql_query($sql)) )
  {
***************
*** 349,364 ****
  		$forum_id = $row['forum_id'];
  
  		$is_auth = array();
! 		$is_auth = auth(AUTH_DOWNLOAD, $forum_id, $userdata); 
  
! 		if ( $is_auth['auth_download'] )
  		{
  			$authorised = TRUE;
  		}
  	}
  	else
  	{
! 		if ( ($attach_config['allow_pm_attach']) && ( ($userdata['user_id'] == $auth_pages[$i]['user_id_2']) || ($userdata['user_id'] == $auth_pages[$i]['user_id_1']) ) || ($userdata['user_level'] == ADMIN) )
  		{
  			$authorised = TRUE;
  		}
--- 275,290 ----
  		$forum_id = $row['forum_id'];
  
  		$is_auth = array();
! 		$is_auth = auth(AUTH_ALL, $forum_id, $userdata); 
  
! 		if ( $is_auth['auth_download'] && $is_auth['auth_read'] )
  		{
  			$authorised = TRUE;
  		}
  	}
  	else
  	{
! 		if ( (intval($attach_config['allow_pm_attach'])) && ( ($userdata['user_id'] == $auth_pages[$i]['user_id_2']) || ($userdata['user_id'] == $auth_pages[$i]['user_id_1']) ) || ($userdata['user_level'] == ADMIN) )
  		{
  			$authorised = TRUE;
  		}
***************
*** 423,453 ****
  	}
  }
  
- /*if ( !(attachment_exists($attachment['physical_filename'])) )
- {
- 	message_die(GENERAL_MESSAGE, $lang['Error_no_attachment']);
- }*/
- 
  //
  // Determine the 'presenting'-method
  //
  if ($download_mode == PHYSICAL_LINK)
  {
! 	$header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
! 	if ($attach_config['allow_ftp_upload'])
  	{
! 		header($header_location . $attach_config['download_path'] . '/' . $attachment['physical_filename']);
! 		exit();
  	}
  	else
  	{
! 		header($header_location . $upload_dir . '/' . $attachment['physical_filename']);
! 		exit();
  	}
  }
  else
  {
! 	if ($attach_config['allow_ftp_upload'])
  	{
  		send_file_to_browser($attachment['real_filename'], $attachment['mimetype'], $attach_config['download_path'] . '/' . $attachment['physical_filename'] , '', $attachment['attach_id']);
  		exit();
--- 349,396 ----
  	}
  }
  
  //
  // Determine the 'presenting'-method
  //
  if ($download_mode == PHYSICAL_LINK)
  {
! 	$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
! 	$server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['server_name']));
! 	$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
! 	$script_name = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($board_config['script_path']));
! 
! 	if ($script_name[strlen($script_name)] != '/')
  	{
! 		$script_name .= '/';
! 	}
! 
! 	if (intval($attach_config['allow_ftp_upload']))
! 	{
! 		$url = $attach_config['download_path'] . '/' . $attachment['physical_filename'];
! 		$redirect_path = $url;
  	}
  	else
  	{
! 		$url = $upload_dir . '/' . $attachment['physical_filename'];
! //		$url = preg_replace('/^\/?(.*?\/)?$/', '\1', trim($url));
! 		$redirect_path = $server_protocol . $server_name . $server_port . $script_name . $url;
! 	}
! 
! 	// Redirect via an HTML form for PITA webservers
! 	if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
! 	{
! 		header('Refresh: 0; URL=' . $redirect_path);
! 		echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $redirect_path . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $redirect_path . '">HERE</a> to be redirected</div></body></html>';
! 		exit;
  	}
+ 
+ 	// Behave as per HTTP/1.1 spec for others
+ 	header('Location: ' . $redirect_path);
+ 	exit;
  }
  else
  {
! 	if (intval($attach_config['allow_ftp_upload']))
  	{
  		send_file_to_browser($attachment['real_filename'], $attachment['mimetype'], $attach_config['download_path'] . '/' . $attachment['physical_filename'] , '', $attachment['attach_id']);
  		exit();
diff -c -rNbB attach_mod_v234/language/lang_english/lang_admin_attach.php attach_mod_v235/language/lang_english/lang_admin_attach.php
*** attach_mod_v234/language/lang_english/lang_admin_attach.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/language/lang_english/lang_admin_attach.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *     copyright            : (C) 2002 Meik Sievertsen
   *     email                : acyd.burn@gmx.de
   *
!  *     $Id: lang_admin_attach.php,v 1.26 2002/11/02 12:56:41 meik Exp $
   *
   ****************************************************************************/
  
--- 6,12 ----
   *     copyright            : (C) 2002 Meik Sievertsen
   *     email                : acyd.burn@gmx.de
   *
!  *     $Id: lang_admin_attach.php,v 1.35 2002/12/21 17:30:01 acydburn Exp $
   *
   ****************************************************************************/
  
***************
*** 31,36 ****
--- 31,37 ----
  $lang['Extension_group_manage'] = 'Extension Groups Control';
  $lang['Special_categories'] = 'Special Categories';
  $lang['Sync_attachments'] = 'Synchronize Attachments';
+ $lang['Quota_limits'] = 'Quota Limits';
  
  // Attachments -> Management
  $lang['Attach_settings'] = 'Attachment Settings';
***************
*** 51,61 ****
  $lang['Show_apcp_explain'] = 'Choose whether to display the Attachment Posting Control Panel (yes) or the old method with two Boxes for Attaching Files and editing your posted Attachments (no) within your Posting Screen. The look of it is very hard to explain, therefore it\'s best to try it out.';
  
  $lang['Max_filesize_attach'] = 'Filesize';
! $lang['Max_filesize_attach_explain'] = 'Maximum filesize for attachments (in bytes). A value of 0 means \'unlimited\'. This Setting is restricted by your Server Configuration. For example, if your php Configuration only allows a maximum of 2 MB uploads, this cannot be overwritten by the Mod.';
  $lang['Attach_quota'] = 'Attachment Quota';
! $lang['Attach_quota_explain'] = 'Maximum Disk Space ALL Attachments can hold on your Webspace.';
  $lang['Max_filesize_pm'] = 'Maximum Filesize in Private Messages Folder';
! $lang['Max_filesize_pm_explain'] = 'Maximum Disk Space Attachments can use up in each User\'s Private Message box.'; 
  
  $lang['Max_attachments'] = 'Maximum Number of Attachments';
  $lang['Max_attachments_explain'] = 'The maximum number of attachments allowed in one post.';
--- 52,64 ----
  $lang['Show_apcp_explain'] = 'Choose whether to display the Attachment Posting Control Panel (yes) or the old method with two Boxes for Attaching Files and editing your posted Attachments (no) within your Posting Screen. The look of it is very hard to explain, therefore it\'s best to try it out.';
  
  $lang['Max_filesize_attach'] = 'Filesize';
! $lang['Max_filesize_attach_explain'] = 'Maximum filesize for Attachments. A value of 0 means \'unlimited\'. This Setting is restricted by your Server Configuration. For example, if your php Configuration only allows a maximum of 2 MB uploads, this cannot be overwritten by the Mod.';
  $lang['Attach_quota'] = 'Attachment Quota';
! $lang['Attach_quota_explain'] = 'Maximum Disk Space ALL Attachments can hold on your Webspace. A value of 0 means \'unlimited\'.';
  $lang['Max_filesize_pm'] = 'Maximum Filesize in Private Messages Folder';
! $lang['Max_filesize_pm_explain'] = 'Maximum Disk Space Attachments can use up in each User\'s Private Message box. A value of 0 means \'unlimited\'.';
! $lang['Default_quota_limit'] = 'Default Quota Limit';
! $lang['Default_quota_limit_explain'] = 'Here you are able to select the Default Quota Limit automatically assigned to newly registered Users and Users without an defined Quota Limit. The Option \'No Quota Limit\' is for not using any Attachment Quotas, instead using the default Settings you have defined within this Management Panel.';
  
  $lang['Max_attachments'] = 'Maximum Number of Attachments';
  $lang['Max_attachments_explain'] = 'The maximum number of attachments allowed in one post.';
***************
*** 77,88 ****
  $lang['Attach_ftp_path'] = 'FTP Path to your upload directory';
  $lang['Attach_ftp_path_explain'] = 'The Directory where your Attachments will be stored. This Directory doesn\'t have to be chmodded. Please don\'t enter your IP or FTP-Address here, this input field is only for the FTP Path.<br />For example: /home/web/uploads';
  $lang['Ftp_download_path'] = 'Download Link to FTP Path';
! $lang['Ftp_download_path_explain'] = 'Enter the Path to your FTP Path, where your Attachments are stored. Please enter the complete path, for example http://www.mystorage.com/phpBB2/upload. A trailing slash will be removed.<br />Leave this field empty, if you have the path outside of your web-root. But with this field empty you can\'t use the physical download method.';
  
  // Attachments -> Shadow Attachments
  $lang['Shadow_attachments_explain'] = 'Here you can delete attachment data from postings when the files are missing from your filesystem, and delete files that are no longer attached to any postings. You can download or view a file if you click on it; if no link is present, the file does not exist.';
  $lang['Shadow_attachments_file_explain'] = 'Delete all attachments files that exist on your filesystem and are not assigned to an existing post.';
  $lang['Shadow_attachments_row_explain'] = 'Delete all posting attachment data for files that don\'t exist on your filesystem.';
  
  // Attachments -> Sync
  $lang['Sync_thumbnail_resetted'] = 'Thumbnail resetted for Attachment: %s'; // replace %s with physical Filename
--- 80,96 ----
  $lang['Attach_ftp_path'] = 'FTP Path to your upload directory';
  $lang['Attach_ftp_path_explain'] = 'The Directory where your Attachments will be stored. This Directory doesn\'t have to be chmodded. Please don\'t enter your IP or FTP-Address here, this input field is only for the FTP Path.<br />For example: /home/web/uploads';
  $lang['Ftp_download_path'] = 'Download Link to FTP Path';
! $lang['Ftp_download_path_explain'] = 'Enter the URL to your FTP Path, where your Attachments are stored.<br />If you are using a Remote FTP Server, please enter the complete url, for example http://www.mystorage.com/phpBB2/upload.<br />If you are using your Local Host to store your Files, you are able to enter the url path relative to your phpBB2 Directory, for example \'upload\'.<br />A trailing slash will be removed. Leave this field empty, if the FTP Path is not accessible from the Internet. With this field empty you are unable to use the physical download method.';
! $lang['Ftp_passive_mode'] = 'Enable FTP Passive Mode';
! $lang['Ftp_passive_mode_explain'] = 'The PASV command requests that the remote server open a port for the data connection and return the address of that port. The remote server listens on that port and the client connects to it.';
! 
! $lang['No_ftp_extensions_installed'] = 'You are not able to use the FTP Upload Methods, because FTP Extensions are not compiled into your PHP Installation.';
  
  // Attachments -> Shadow Attachments
  $lang['Shadow_attachments_explain'] = 'Here you can delete attachment data from postings when the files are missing from your filesystem, and delete files that are no longer attached to any postings. You can download or view a file if you click on it; if no link is present, the file does not exist.';
  $lang['Shadow_attachments_file_explain'] = 'Delete all attachments files that exist on your filesystem and are not assigned to an existing post.';
  $lang['Shadow_attachments_row_explain'] = 'Delete all posting attachment data for files that don\'t exist on your filesystem.';
+ $lang['Empty_file_entry'] = 'Empty File Entry';
  
  // Attachments -> Sync
  $lang['Sync_thumbnail_resetted'] = 'Thumbnail resetted for Attachment: %s'; // replace %s with physical Filename
***************
*** 144,155 ****
  
  // Extensions -> Extension Groups Control -> Group Permissions
  $lang['Group_permissions_title'] = 'Extension Group Permissions -> \'%s\''; // Replace %s with the Groups Name
! $lang['Group_permissions_explain'] = 'Here you are able to restrict the selected Extension Group to certain Forums (defined in the Allowed Forums Box). The Default is to allow Extension Groups to all Forums the User is able to Attach Files into (the normal way the Attachment Mod did it since the beginning). Just add those Forums you want the Extension Group (the Extensions within this Group) to be allowed there, the default ALL FORUMS will disappear when you add Forums to the List. You are able to re-add ALL FORUMS at any given Time. If you add a Forum to your Board and the Permission is set to ALL FORUMS nothing will change. But if you have changed and restricted the access to certain Forums, you have to check back here to add your newly created Forum. It is easy to do this automatically, but this will force you to edit a bunch of Files, therefore i have chosen the way it is now. Please have in mind, that all of your Forums will be listed here.';
  $lang['Note_admin_empty_group_permissions'] = 'NOTE:<br />Within the below listed Forums your Users are normally allowed to attach files, but since no Extension Group is allowed to be attached there, your Users are unable to attach anything. If they try, they will receive Error Messages. Maybe you want to set the Permission \'Post Files\' to ADMIN at these Forums.<br /><br />';
  $lang['Add_forums'] = 'Add Forums';
  $lang['Add_selected'] = 'Add Selected';
  $lang['Perm_all_forums'] = 'ALL FORUMS';
  
  // Attachments -> Control Panel
  $lang['Control_panel_title'] = 'File Attachment Control Panel';
  $lang['Control_panel_explain'] = 'Here you can view and manage all attachments based on Users, Attachments, Views etc...';
--- 152,170 ----
  
  // Extensions -> Extension Groups Control -> Group Permissions
  $lang['Group_permissions_title'] = 'Extension Group Permissions -> \'%s\''; // Replace %s with the Groups Name
! $lang['Group_permissions_explain'] = 'Here you are able to restrict the selected Extension Group to Forums of your choice (defined in the Allowed Forums Box). The Default is to allow Extension Groups to all Forums the User is able to Attach Files into (the normal way the Attachment Mod did it since the beginning). Just add those Forums you want the Extension Group (the Extensions within this Group) to be allowed there, the default ALL FORUMS will disappear when you add Forums to the List. You are able to re-add ALL FORUMS at any given Time. If you add a Forum to your Board and the Permission is set to ALL FORUMS nothing will change. But if you have changed and restricted the access to certain Forums, you have to check back here to add your newly created Forum. It is easy to do this automatically, but this will force you to edit a bunch of Files, therefore i have chosen the way it is now. Please keep in mind, that all of your Forums will be listed here.';
  $lang['Note_admin_empty_group_permissions'] = 'NOTE:<br />Within the below listed Forums your Users are normally allowed to attach files, but since no Extension Group is allowed to be attached there, your Users are unable to attach anything. If they try, they will receive Error Messages. Maybe you want to set the Permission \'Post Files\' to ADMIN at these Forums.<br /><br />';
  $lang['Add_forums'] = 'Add Forums';
  $lang['Add_selected'] = 'Add Selected';
  $lang['Perm_all_forums'] = 'ALL FORUMS';
  
+ // Attachments -> Quota Limits
+ $lang['Manage_quotas'] = 'Manage Attachment Quota Limits';
+ $lang['Manage_quotas_explain'] = 'Here you are able to add/delete/change Quota Limits. You are able to assign these Quota Limits to Users and Groups later. To assign a Quota Limit to a User, you have to go to Users->Management, select the User and you will see the Options at the bottom. To assign a Quota Limit to a Group, go to Groups->Management, select the Group to edit it, and you will see the Configuration Settings. If you want to see, which Users and Groups are assigned to a specific Quota Limit, click on \'View\' at the left of the Quota Description.';
+ $lang['Assigned_users'] = 'Assigned Users';
+ $lang['Assigned_groups'] = 'Assigned Groups';
+ $lang['Quota_limit_exist'] = 'The Quota Limit %s exist already.'; // Replace %s with the Quota Description
+ 
  // Attachments -> Control Panel
  $lang['Control_panel_title'] = 'File Attachment Control Panel';
  $lang['Control_panel_explain'] = 'Here you can view and manage all attachments based on Users, Attachments, Views etc...';
diff -c -rNbB attach_mod_v234/language/lang_english/lang_main_attach.php attach_mod_v235/language/lang_english/lang_main_attach.php
*** attach_mod_v234/language/lang_english/lang_main_attach.php	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/language/lang_english/lang_main_attach.php	Fri Jan 17 11:59:34 2003
***************
*** 6,12 ****
   *     copyright            : (C) 2002 Meik Sievertsen
   *     email                : acyd.burn@gmx.de
   *
!  *     $Id: lang_main_attach.php,v 1.15 2002/11/03 23:54:52 meik Exp $
   *
   ****************************************************************************/
  
--- 6,12 ----
   *     copyright            : (C) 2002 Meik Sievertsen
   *     email                : acyd.burn@gmx.de
   *
!  *     $Id: lang_main_attach.php,v 1.27 2003/01/16 11:11:56 acydburn Exp $
   *
   ****************************************************************************/
  
***************
*** 31,37 ****
  $lang['Sorry_auth_view_attach'] = 'Sorry but you are not authorized to view or download this Attachment';
  
  // Viewtopic -> Display of Attachments
! $lang['Download_number'] = 'File downloaded or viewed %d time(s)'; // replace %d with count
  $lang['Extension_disabled_after_posting'] = 'The Extension \'%s\' was deactivated by an board admin, therefore this Attachment is not displayed.'; // used in Posts and PM's, replace %s with mime type
  
  // Posting/PM -> Initial Display
--- 31,42 ----
  $lang['Sorry_auth_view_attach'] = 'Sorry but you are not authorized to view or download this Attachment';
  
  // Viewtopic -> Display of Attachments
! $lang['Description'] = 'Description'; // used in Administration Panel too...
! $lang['Downloaded'] = 'Downloaded';
! $lang['Download'] = 'Download'; // this Language Variable is defined in lang_admin.php too, but we are unable to access it from the main Language File
! $lang['Filesize'] = 'Filesize';
! $lang['Viewed'] = 'Viewed';
! $lang['Download_number'] = '%d Time(s)'; // replace %d with count
  $lang['Extension_disabled_after_posting'] = 'The Extension \'%s\' was deactivated by an board admin, therefore this Attachment is not displayed.'; // used in Posts and PM's, replace %s with mime type
  
  // Posting/PM -> Initial Display
***************
*** 95,107 ****
--- 100,126 ----
  $lang['Ftp_error_path'] = 'Could not access ftp directory: \'%s\'. Please check your FTP Settings.';
  $lang['Ftp_error_upload'] = 'Could not upload files to ftp directory: \'%s\'. Please check your FTP Settings.';
  $lang['Ftp_error_delete'] = 'Could not delete files in ftp directory: \'%s\'. Please check your FTP Settings.<br />Another reason for this error could be the non-existence of the Attachment, please check this first in Shadow Attachments.';
+ $lang['Ftp_error_pasv_mode'] = 'Unable to enable/disable FTP Passive Mode';
  
  // Attach Rules Window
+ $lang['Rules_page'] = 'Attachment Rules';
  $lang['Attach_rules_title'] = 'Allowed Extension Groups and their Sizes';
  $lang['Group_rule_header'] = '%s -> Maximum Upload Size: %s'; // Replace first %s with Extension Group, second one with the Size STRING
  $lang['Allowed_extensions_and_sizes'] = 'Allowed Extensions and Sizes';
  $lang['Note_user_empty_group_permissions'] = 'NOTE:<br />You are normally allowed to attach files within this Forum, <br />but since no Extension Group is allowed to be attached here, <br />you are unable to attach anything. If you try, <br />you will receive an Error Message.<br />';
  
+ // Quota Variables
+ $lang['Upload_quota'] = 'Upload Quota';
+ $lang['Pm_quota'] = 'PM Quota';
+ $lang['User_upload_quota_reached'] = 'Sorry, you have reached your maximum Upload Quota Limit of %d %s'; // replace %d with Size, %s with Size Lang (MB for example)
+ 
+ // User Attachment Control Panel
+ $lang['User_acp_title'] = 'User ACP';
+ $lang['UACP'] = 'User Attachment Control Panel';
+ $lang['User_uploaded_profile'] = 'Uploaded: %s';
+ $lang['User_quota_profile'] = 'Quota: %s';
+ $lang['Upload_percent_profile'] = '%d%% of total';
+ 
  // Common Variables
  $lang['Bytes'] = 'Bytes';
  $lang['KB'] = 'KB';
***************
*** 110,114 ****
--- 129,136 ----
  $lang['Test_settings'] = 'Test Settings';
  $lang['Not_assigned'] = 'Not Assigned';
  $lang['No_file_comment_available'] = 'No File Comment available';
+ $lang['Attachbox_limit'] = 'Your Attachbox is %d%% full';
+ $lang['No_quota_limit'] = 'No Quota Limit';
+ $lang['Unlimited'] = 'Unlimited';
  
  ?>
\ No newline at end of file
diff -c -rNbB attach_mod_v234/templates/subSilver/add_attachment_body.tpl attach_mod_v235/templates/subSilver/add_attachment_body.tpl
*** attach_mod_v234/templates/subSilver/add_attachment_body.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/add_attachment_body.tpl	Fri Jan 17 11:59:34 2003
***************
*** 8,18 ****
  
  	<tr> 
  		<td class="row1"><span class="gen"><b>{L_FILE_NAME}</b></span></td> 
! 	    <td class="row2"><span class="genmed"><input type="file" name="fileupload" size=40 maxlength="{FILESIZE}" value="{FILENAME}" class="post"> </span></td> 
  	</tr> 
  	<tr> 
  		<td class="row1"><span class="gen"><b>{L_FILE_COMMENT}</b></span></td> 
! 	    <td class="row2"><span class="genmed"><textarea name="filecomment" rows="3" cols="35" wrap="virtual" size=40 class="post">{FILE_COMMENT}</textarea></span>
  		<input type="submit" name="add_attachment" value="{L_ADD_ATTACHMENT}" class="liteoption" /> </span></td> 
  	</tr> 
  
--- 8,18 ----
  
  	<tr> 
  		<td class="row1"><span class="gen"><b>{L_FILE_NAME}</b></span></td> 
! 	    <td class="row2"><span class="genmed"><input type="file" name="fileupload" size="40" maxlength="{FILESIZE}" value="{FILENAME}" class="post" /></span></td> 
  	</tr> 
  	<tr> 
  		<td class="row1"><span class="gen"><b>{L_FILE_COMMENT}</b></span></td> 
! 	    <td class="row2"><span class="genmed"><textarea name="filecomment" rows="3" cols="35" wrap="virtual" size="40" class="post">{FILE_COMMENT}</textarea></span>
  		<input type="submit" name="add_attachment" value="{L_ADD_ATTACHMENT}" class="liteoption" /> </span></td> 
  	</tr> 
  
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_cat_body.tpl attach_mod_v235/templates/subSilver/admin/attach_cat_body.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_cat_body.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/admin/attach_cat_body.tpl	Fri Jan 17 11:59:34 2003
***************
*** 11,40 ****
  	  <th class="thHead" colspan="2">{L_SETTINGS_CAT_IMAGES}<br />{L_ASSIGNED_GROUP}: {S_ASSIGNED_GROUP_IMAGES}</th>
  	</tr>
  	<tr>
! 		<td class="row1">{L_DISPLAY_INLINED}<br /><span class="gensmall">{L_DISPLAY_INLINED_EXPLAIN}</span></td>
! 		<td class="row2" width="100"><input type="radio" name="img_display_inlined" value="1" {DISPLAY_INLINED_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="img_display_inlined" value="0" {DISPLAY_INLINED_NO} /> {L_NO}</td>
  	</tr>
  <!-- BEGIN switch_thumbnail_support -->
  	<tr>
! 		<td class="row1">{L_CREATE_THUMBNAIL}<br /><span class="gensmall">{L_CREATE_THUMBNAIL_EXPLAIN}</span></td>
! 		<td class="row2" width="100"><input type="radio" name="img_create_thumbnail" value="1" {CREATE_THUMBNAIL_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="img_create_thumbnail" value="0" {CREATE_THUMBNAIL_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_MIN_THUMB_FILESIZE}<br /><span class="gensmall">{L_MIN_THUMB_FILESIZE_EXPLAIN}</span></td>
! 		<td class="row2" width="100"><input type="text" size="7" maxlength="15" name="img_min_thumb_filesize" value="{IMAGE_MIN_THUMB_FILESIZE}" class="post" /> {L_BYTES}</td>
  	</tr>
  <!-- END switch_thumbnail_support -->
  	<tr>
! 		<td class="row1">{L_IMAGICK_PATH}<br /><span class="gensmall">{L_IMAGICK_PATH_EXPLAIN}</span></td>
! 		<td class="row2" width="100"><input type="text" size="20" maxlength="200" name="img_imagick" value="{IMAGE_IMAGICK_PATH}" class="post" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_MAX_IMAGE_SIZE} <br /><span class="gensmall">{L_MAX_IMAGE_SIZE_EXPLAIN}</span></td>
! 		<td class="row2" width="100"><input type="text" size="3" maxlength="4" name="img_max_width" value="{IMAGE_MAX_WIDTH}" class="post" /> x <input type="text" size="3" maxlength="4" name="img_max_height" value="{IMAGE_MAX_HEIGHT}" class="post" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_IMAGE_LINK_SIZE} <br /><span class="gensmall">{L_IMAGE_LINK_SIZE_EXPLAIN}</span></td>
! 		<td class="row2" width="100"><input type="text" size="3" maxlength="4" name="img_link_width" value="{IMAGE_LINK_WIDTH}" class="post" /> x <input type="text" size="3" maxlength="4" name="img_link_height" value="{IMAGE_LINK_HEIGHT}" class="post" /></td>
  	</tr>
  	<tr>
  		<td class="catBottom" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="search_imagick" value="{L_SEARCH_IMAGICK}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="cat_settings" value="{L_TEST_SETTINGS}" class="liteoption" /></td>
--- 11,40 ----
  	  <th class="thHead" colspan="2">{L_SETTINGS_CAT_IMAGES}<br />{L_ASSIGNED_GROUP}: {S_ASSIGNED_GROUP_IMAGES}</th>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_DISPLAY_INLINED}<br /><span class="gensmall">{L_DISPLAY_INLINED_EXPLAIN}</span></td>
! 		<td class="row2"><input type="radio" name="img_display_inlined" value="1" {DISPLAY_INLINED_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="img_display_inlined" value="0" {DISPLAY_INLINED_NO} /> {L_NO}</td>
  	</tr>
  <!-- BEGIN switch_thumbnail_support -->
  	<tr>
! 		<td class="row1" width="80%">{L_CREATE_THUMBNAIL}<br /><span class="gensmall">{L_CREATE_THUMBNAIL_EXPLAIN}</span></td>
! 		<td class="row2"><input type="radio" name="img_create_thumbnail" value="1" {CREATE_THUMBNAIL_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="img_create_thumbnail" value="0" {CREATE_THUMBNAIL_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_MIN_THUMB_FILESIZE}<br /><span class="gensmall">{L_MIN_THUMB_FILESIZE_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="7" maxlength="15" name="img_min_thumb_filesize" value="{IMAGE_MIN_THUMB_FILESIZE}" class="post" /> {L_BYTES}</td>
  	</tr>
  <!-- END switch_thumbnail_support -->
  	<tr>
! 		<td class="row1" width="80%">{L_IMAGICK_PATH}<br /><span class="gensmall">{L_IMAGICK_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="200" name="img_imagick" value="{IMAGE_IMAGICK_PATH}" class="post" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_MAX_IMAGE_SIZE} <br /><span class="gensmall">{L_MAX_IMAGE_SIZE_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="3" maxlength="4" name="img_max_width" value="{IMAGE_MAX_WIDTH}" class="post" /> x <input type="text" size="3" maxlength="4" name="img_max_height" value="{IMAGE_MAX_HEIGHT}" class="post" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_IMAGE_LINK_SIZE} <br /><span class="gensmall">{L_IMAGE_LINK_SIZE_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="3" maxlength="4" name="img_link_width" value="{IMAGE_LINK_WIDTH}" class="post" /> x <input type="text" size="3" maxlength="4" name="img_link_height" value="{IMAGE_LINK_HEIGHT}" class="post" /></td>
  	</tr>
  	<tr>
  		<td class="catBottom" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="search_imagick" value="{L_SEARCH_IMAGICK}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="cat_settings" value="{L_TEST_SETTINGS}" class="liteoption" /></td>
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_extension_groups.tpl attach_mod_v235/templates/subSilver/admin/attach_extension_groups.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_extension_groups.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/admin/attach_extension_groups.tpl	Fri Jan 17 11:59:34 2003
***************
*** 30,44 ****
        <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
  	  <tr>
    	  <td class="row1" align="center" valign="middle" width="10%" wrap="nowrap">&nbsp;</td>
! 	  <td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension_group" value="{ADD_GROUP_NAME}" /></td>
  	  </tr>
  	  </table>
  	  </td>
  	  <td class="row2" align="center" valign="middle">{S_SELECT_CAT}</td>
  	  <td class="row1" align="center" valign="middle"><input type="checkbox" name="add_allowed" /></td>
  	  <td class="row2" align="center" valign="middle">{S_ADD_DOWNLOAD_MODE}</td>
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="15" maxlength="100" name="add_upload_icon" value="{UPLOAD_ICON}" /></td>
! 	  <td class="row2" align="center" valign="middle"><input type="text" size="3" maxlength="15" name="add_max_filesize" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
  	  <td class="row1" align="center" valign="middle">&nbsp;</td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_group_check" /></td>
  	</tr>
--- 30,44 ----
        <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
  	  <tr>
    	  <td class="row1" align="center" valign="middle" width="10%" wrap="nowrap">&nbsp;</td>
! 	  <td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension_group" class="post" value="{ADD_GROUP_NAME}" /></td>
  	  </tr>
  	  </table>
  	  </td>
  	  <td class="row2" align="center" valign="middle">{S_SELECT_CAT}</td>
  	  <td class="row1" align="center" valign="middle"><input type="checkbox" name="add_allowed" /></td>
  	  <td class="row2" align="center" valign="middle">{S_ADD_DOWNLOAD_MODE}</td>
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="15" maxlength="100" name="add_upload_icon" class="post" value="{UPLOAD_ICON}" /></td>
! 	  <td class="row2" align="center" valign="middle"><input type="text" size="3" maxlength="15" name="add_max_filesize" class="post" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
  	  <td class="row1" align="center" valign="middle">&nbsp;</td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_group_check" /></td>
  	</tr>
***************
*** 62,76 ****
        <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
  	  <tr>
  		<td class="row1" align="center" valign="middle" width="10%" wrap="nowrap"><b><span class="gensmall"><a href="{grouprow.U_VIEWGROUP}" class="gensmall">{grouprow.CAT_BOX}</a></span></b></td>
! 		<td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="100" name="extension_group_list[]" value="{grouprow.EXTENSION_GROUP}" /></td>
  	  </tr>
  	  </table>
  	  </td>
  	  <td class="row2" align="center" valign="middle">{grouprow.S_SELECT_CAT}</td>
  	  <td class="row1" align="center" valign="middle"><input type="checkbox" name="allowed_list[]" value="{grouprow.GROUP_ID}" {grouprow.S_ALLOW_SELECTED} /></td>
  	  <td class="row2" align="center" valign="middle">{grouprow.S_DOWNLOAD_MODE}</td>
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="15" maxlength="100" name="upload_icon_list[]" value="{grouprow.UPLOAD_ICON}" /></td>
! 	  <td class="row2" align="center" valign="middle"><input type="text" size="3" maxlength="15" name="max_filesize_list[]" value="{grouprow.MAX_FILESIZE}" /> {grouprow.S_FILESIZE}</td>
  	  <td class="row1" align="center" valign="middle"><span class="gensmall"><a href="{grouprow.U_FORUM_PERMISSIONS}" class="gensmall">{L_FORUM_PERMISSIONS}</a></span></td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="group_id_list[]" value="{grouprow.GROUP_ID}" /></td>
  	</tr>
--- 62,76 ----
        <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
  	  <tr>
  		<td class="row1" align="center" valign="middle" width="10%" wrap="nowrap"><b><span class="gensmall"><a href="{grouprow.U_VIEWGROUP}" class="gensmall">{grouprow.CAT_BOX}</a></span></b></td>
! 		<td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="100" name="extension_group_list[]" class="post" value="{grouprow.EXTENSION_GROUP}" /></td>
  	  </tr>
  	  </table>
  	  </td>
  	  <td class="row2" align="center" valign="middle">{grouprow.S_SELECT_CAT}</td>
  	  <td class="row1" align="center" valign="middle"><input type="checkbox" name="allowed_list[]" value="{grouprow.GROUP_ID}" {grouprow.S_ALLOW_SELECTED} /></td>
  	  <td class="row2" align="center" valign="middle">{grouprow.S_DOWNLOAD_MODE}</td>
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="15" maxlength="100" name="upload_icon_list[]" class="post" value="{grouprow.UPLOAD_ICON}" /></td>
! 	  <td class="row2" align="center" valign="middle"><input type="text" size="3" maxlength="15" name="max_filesize_list[]" class="post" value="{grouprow.MAX_FILESIZE}" /> {grouprow.S_FILESIZE}</td>
  	  <td class="row1" align="center" valign="middle"><span class="gensmall"><a href="{grouprow.U_FORUM_PERMISSIONS}" class="gensmall">{L_FORUM_PERMISSIONS}</a></span></td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="group_id_list[]" value="{grouprow.GROUP_ID}" /></td>
  	</tr>
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_extensions.tpl attach_mod_v235/templates/subSilver/admin/attach_extensions.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_extensions.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/admin/attach_extensions.tpl	Fri Jan 17 11:59:34 2003
***************
*** 18,25 ****
  	  <th class="thRight">&nbsp;{L_ADD_NEW}&nbsp;</th>
  	</tr>
  	<tr>
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="30" maxlength="100" name="add_extension_explain" value="{ADD_EXTENSION_EXPLAIN}" /></td>
! 	  <td class="row2" align="center" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension" value="{ADD_EXTENSION}" /></td>
  	  <td class="row1" align="center" valign="middle">{S_ADD_GROUP_SELECT}</td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td>
  	</tr>
--- 18,25 ----
  	  <th class="thRight">&nbsp;{L_ADD_NEW}&nbsp;</th>
  	</tr>
  	<tr>
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="30" maxlength="100" name="add_extension_explain" class="post" value="{ADD_EXTENSION_EXPLAIN}" /></td>
! 	  <td class="row2" align="center" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension" class="post" value="{ADD_EXTENSION}" /></td>
  	  <td class="row1" align="center" valign="middle">{S_ADD_GROUP_SELECT}</td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td>
  	</tr>
***************
*** 35,41 ****
  <!-- BEGIN extension_row -->
  	<tr> 
  	  <input type="hidden" name="extension_change_list[]" value="{extension_row.EXT_ID}" />
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="30" maxlength="100" name="extension_explain_list[]"  value="{extension_row.EXTENSION_EXPLAIN}" /></td>
  	  <td class="row2" align="center" valign="middle"><b><span class="gen">{extension_row.EXTENSION}</span></b></td>
  	  <td class="row1" align="center" valign="middle">{extension_row.S_GROUP_SELECT}</td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="extension_id_list[]" value="{extension_row.EXT_ID}" /></td>
--- 35,41 ----
  <!-- BEGIN extension_row -->
  	<tr> 
  	  <input type="hidden" name="extension_change_list[]" value="{extension_row.EXT_ID}" />
! 	  <td class="row1" align="center" valign="middle"><input type="text" size="30" maxlength="100" name="extension_explain_list[]" class="post" value="{extension_row.EXTENSION_EXPLAIN}" /></td>
  	  <td class="row2" align="center" valign="middle"><b><span class="gen">{extension_row.EXTENSION}</span></b></td>
  	  <td class="row1" align="center" valign="middle">{extension_row.S_GROUP_SELECT}</td>
  	  <td class="row2" align="center" valign="middle"><input type="checkbox" name="extension_id_list[]" value="{extension_row.EXT_ID}" /></td>
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_forbidden_extensions.tpl attach_mod_v235/templates/subSilver/admin/attach_forbidden_extensions.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_forbidden_extensions.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/admin/attach_forbidden_extensions.tpl	Fri Jan 17 11:59:34 2003
***************
*** 16,22 ****
  	  <th class="thRight">&nbsp;{L_ADD_NEW}&nbsp;</th>
  	</tr>
  	<tr>
! 		<td class="row1" align="center" valign="middle"><input type="text" size="8" maxlength="15" name="add_extension" value=""/></td>
  		<td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td>
  	</tr>
  	<tr align="right">
--- 16,22 ----
  	  <th class="thRight">&nbsp;{L_ADD_NEW}&nbsp;</th>
  	</tr>
  	<tr>
! 		<td class="row1" align="center" valign="middle"><input type="text" size="8" maxlength="15" name="add_extension" class="post" value=""/></td>
  		<td class="row2" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td>
  	</tr>
  	<tr align="right">
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_manage_body.tpl attach_mod_v235/templates/subSilver/admin/attach_manage_body.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_manage_body.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/admin/attach_manage_body.tpl	Fri Jan 17 11:59:34 2003
***************
*** 11,29 ****
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1">{L_UPLOAD_DIR}<br /><span class="gensmall">{L_UPLOAD_DIR_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="25" maxlength="100" name="upload_dir" value="{UPLOAD_DIR}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_IMG_PATH}<br /><span class="gensmall">{L_IMG_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="25" maxlength="100" name="upload_img" value="{ATTACHMENT_IMG_PATH}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_TOPIC_ICON}<br /><span class="gensmall">{L_TOPIC_ICON_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="25" maxlength="100" name="topic_icon" value="{TOPIC_ICON}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_DISPLAY_ORDER}<br /><span class="gensmall">{L_DISPLAY_ORDER_EXPLAIN}</span></td>
  		<td class="row2">
  		<table border=0 cellpadding=0 cellspacing=0>
  			<tr>
--- 11,29 ----
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_UPLOAD_DIR}<br /><span class="gensmall">{L_UPLOAD_DIR_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="25" maxlength="100" name="upload_dir" class="post" value="{UPLOAD_DIR}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_IMG_PATH}<br /><span class="gensmall">{L_IMG_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="25" maxlength="100" name="upload_img" class="post" value="{ATTACHMENT_IMG_PATH}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_TOPIC_ICON}<br /><span class="gensmall">{L_TOPIC_ICON_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="25" maxlength="100" name="topic_icon" class="post" value="{TOPIC_ICON}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_DISPLAY_ORDER}<br /><span class="gensmall">{L_DISPLAY_ORDER_EXPLAIN}</span></td>
  		<td class="row2">
  		<table border=0 cellpadding=0 cellspacing=0>
  			<tr>
***************
*** 38,112 ****
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_FILESIZE_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1">{L_MAX_FILESIZE}<br /><span class="gensmall">{L_MAX_FILESIZE_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACH_QUOTA}<br /><span class="gensmall">{L_ATTACH_QUOTA_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="8" maxlength="15" name="attachment_quota" value="{ATTACHMENT_QUOTA}" /> {S_FILESIZE_QUOTA}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_MAX_FILESIZE_PM}<br /><span class="gensmall">{L_MAX_FILESIZE_PM_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize_pm" value="{MAX_FILESIZE_PM}" /> {S_FILESIZE_PM}</td>
  	</tr>
  	<tr>
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_NUMBER_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1">{L_MAX_ATTACHMENTS}<br /><span class="gensmall">{L_MAX_ATTACHMENTS_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments" value="{MAX_ATTACHMENTS}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_MAX_ATTACHMENTS_PM}<br /><span class="gensmall">{L_MAX_ATTACHMENTS_PM_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments_pm" value="{MAX_ATTACHMENTS_PM}" /></td>
  	</tr>
  	<tr>
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_OPTIONS_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1">{L_DISABLE_MOD}<br /><span class="gensmall">{L_DISABLE_MOD_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="disable_mod" value="1" {DISABLE_MOD_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="disable_mod" value="0" {DISABLE_MOD_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_PM_ATTACH}<br /><span class="gensmall">{L_PM_ATTACH_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="allow_pm_attach" value="1" {PM_ATTACH_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="allow_pm_attach" value="0" {PM_ATTACH_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_TOPIC_REVIEW}<br /><span class="gensmall">{L_ATTACHMENT_TOPIC_REVIEW_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="attachment_topic_review" value="1" {TOPIC_REVIEW_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="attachment_topic_review" value="0" {TOPIC_REVIEW_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_SHOW_APCP}<br /><span class="gensmall">{L_SHOW_APCP_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="show_apcp" value="1" {SHOW_APCP_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="show_apcp" value="0" {SHOW_APCP_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_FTP_UPLOAD}<br /><span class="gensmall">{L_FTP_UPLOAD_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="allow_ftp_upload" value="1" {FTP_UPLOAD_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="allow_ftp_upload" value="0" {FTP_UPLOAD_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_FTP_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_FTP_SERVER}<br /><span class="gensmall">{L_ATTACHMENT_FTP_SERVER_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="ftp_server" value="{FTP_SERVER}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_FTP_PATH}<br /><span class="gensmall">{L_ATTACHMENT_FTP_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="ftp_path" value="{FTP_PATH}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_DOWNLOAD_PATH}<br /><span class="gensmall">{L_DOWNLOAD_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="download_path" value="{DOWNLOAD_PATH}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_FTP_USER}</td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="ftp_user" value="{FTP_USER}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1">{L_ATTACHMENT_FTP_PASS}</td>
! 		<td class="row2"><input type="password" size="10" maxlength="20" name="ftp_pass" value="{FTP_PASS}" /></td>
  	</tr>
! 
  	<tr>
  		<td class="catBottom" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="settings" value="{L_TEST_SETTINGS}" class="liteoption" /></td>
  	</tr>
--- 38,141 ----
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_FILESIZE_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_MAX_FILESIZE}<br /><span class="gensmall">{L_MAX_FILESIZE_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize" class="post" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_ATTACH_QUOTA}<br /><span class="gensmall">{L_ATTACH_QUOTA_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="8" maxlength="15" name="attachment_quota" class="post" value="{ATTACHMENT_QUOTA}" /> {S_FILESIZE_QUOTA}</td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_MAX_FILESIZE_PM}<br /><span class="gensmall">{L_MAX_FILESIZE_PM_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize_pm" class="post" value="{MAX_FILESIZE_PM}" /> {S_FILESIZE_PM}</td>
! 	</tr>
! 	<tr>
! 		<td class="row1" width="80%">{L_DEFAULT_QUOTA_LIMIT}<br /><span class="gensmall">{L_DEFAULT_QUOTA_LIMIT_EXPLAIN}</span></td>
! 		<td class="row2">
! 		<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
! 		<tr>
! 			<td nowrap="nowrap">{S_DEFAULT_UPLOAD_LIMIT}</td>
! 			<td nowrap="nowrap"><span class="gensmall">&nbsp;{L_UPLOAD_QUOTA}&nbsp;</span></td>
! 		</tr>
! 		<tr>
! 			<td nowrap="nowrap">{S_DEFAULT_PM_LIMIT}</td>
! 			<td nowrap="nowrap"><span class="gensmall">&nbsp;{L_PM_QUOTA}&nbsp;</span></td>
! 		</tr>
! 		</table>
! 		</td>
  	</tr>
  	<tr>
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_NUMBER_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_MAX_ATTACHMENTS}<br /><span class="gensmall">{L_MAX_ATTACHMENTS_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments" class="post" value="{MAX_ATTACHMENTS}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_MAX_ATTACHMENTS_PM}<br /><span class="gensmall">{L_MAX_ATTACHMENTS_PM_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments_pm" class="post" value="{MAX_ATTACHMENTS_PM}" /></td>
  	</tr>
  	<tr>
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_OPTIONS_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_DISABLE_MOD}<br /><span class="gensmall">{L_DISABLE_MOD_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="disable_mod" value="1" {DISABLE_MOD_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="disable_mod" value="0" {DISABLE_MOD_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_PM_ATTACH}<br /><span class="gensmall">{L_PM_ATTACH_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="allow_pm_attach" value="1" {PM_ATTACH_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="allow_pm_attach" value="0" {PM_ATTACH_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_TOPIC_REVIEW}<br /><span class="gensmall">{L_ATTACHMENT_TOPIC_REVIEW_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="attachment_topic_review" value="1" {TOPIC_REVIEW_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="attachment_topic_review" value="0" {TOPIC_REVIEW_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_SHOW_APCP}<br /><span class="gensmall">{L_SHOW_APCP_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="show_apcp" value="1" {SHOW_APCP_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="show_apcp" value="0" {SHOW_APCP_NO} /> {L_NO}</td>
  	</tr>
+ <!-- BEGIN switch_ftp -->
  	<tr>
! 		<td class="row1" width="80%">{L_FTP_UPLOAD}<br /><span class="gensmall">{L_FTP_UPLOAD_EXPLAIN}</span></td>
  		<td class="row2"><input type="radio" name="allow_ftp_upload" value="1" {FTP_UPLOAD_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="allow_ftp_upload" value="0" {FTP_UPLOAD_NO} /> {L_NO}</td>
  	</tr>
  	<tr>
  	  <th class="thHead" colspan="2">{L_ATTACHMENT_FTP_SETTINGS}</th>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_FTP_SERVER}<br /><span class="gensmall">{L_ATTACHMENT_FTP_SERVER_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="ftp_server" class="post" value="{FTP_SERVER}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_FTP_PATH}<br /><span class="gensmall">{L_ATTACHMENT_FTP_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="ftp_path" class="post" value="{FTP_PATH}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_DOWNLOAD_PATH}<br /><span class="gensmall">{L_DOWNLOAD_PATH_EXPLAIN}</span></td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="download_path" class="post" value="{DOWNLOAD_PATH}" /></td>
  	</tr>
  	<tr>
! 		<td class="row1" width="80%">{L_FTP_PASSIVE_MODE}<br /><span class="gensmall">{L_FTP_PASSIVE_MODE_EXPLAIN}</span></td>
! 		<td class="row2"><input type="radio" name="ftp_pasv_mode" value="1" {FTP_PASV_MODE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="ftp_pasv_mode" value="0" {FTP_PASV_MODE_NO} /> {L_NO}</td>
! 	</tr>
! 	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_FTP_USER}</td>
! 		<td class="row2"><input type="text" size="20" maxlength="100" name="ftp_user" class="post" value="{FTP_USER}" /></td>
! 	</tr>
! 	<tr>
! 		<td class="row1" width="80%">{L_ATTACHMENT_FTP_PASS}</td>
! 		<td class="row2"><input type="password" size="10" maxlength="20" name="ftp_pass" class="post" value="{FTP_PASS}" /></td>
! 	</tr>
! <!-- END switch_ftp -->
! <!-- BEGIN switch_no_ftp -->
! 	<input type="hidden" name="allow_ftp_upload" value="0" />
! 	<tr>
! 	  <th class="thHead" colspan="2">{L_ATTACHMENT_FTP_SETTINGS}</th>
  	</tr>
  	<tr>
! 	  <td class="row1" colspan="2" align="center"><span class="gen">{L_NO_FTP_EXTENSIONS}</span></td>
  	</tr>
! <!-- END switch_no_ftp -->
  	<tr>
  		<td class="catBottom" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" class="liteoption" />&nbsp;&nbsp;<input type="submit" name="settings" value="{L_TEST_SETTINGS}" class="liteoption" /></td>
  	</tr>
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_quota_body.tpl attach_mod_v235/templates/subSilver/admin/attach_quota_body.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_quota_body.tpl	Thu Jan  1 01:00:00 1970
--- attach_mod_v235/templates/subSilver/admin/attach_quota_body.tpl	Fri Jan 17 11:59:34 2003
***************
*** 0 ****
--- 1,147 ----
+ 
+ <h1>{L_MANAGE_QUOTAS_TITLE}</h1>
+ 
+ <p>{L_MANAGE_QUOTAS_EXPLAIN}</p>
+ 
+ <form method="post" action="{S_ATTACH_ACTION}">
+   <table width="99%" align="center" cellpadding="4" cellspacing="1" border="0" class="forumline">
+ 	<tr> 
+ 	  <td class="catHead" colspan="5" align="center" height="28"><span class="cattitle">{L_MANAGE_QUOTAS_TITLE}</span> 
+ 	  </td>
+ 	</tr>
+ 	<tr>
+ 		<th class="thCornerL">{L_DESCRIPTION}</th>
+ 		<th class="thTop">{L_SIZE}</th>
+ 		<th class="thCornerR">{L_ADD_NEW}</th>
+ 	</tr>
+ 	<tr>
+ 		<td class="row1" align="center" valign="middle"><input type="text" size="20" maxlength="25" name="quota_description" class="post" value=""/></td>
+ 		<td class="row2" align="center" valign="middle"><input type="text" size="8" maxlength="15" name="add_max_filesize" class="post" value="{MAX_FILESIZE}" /> {S_FILESIZE}</td>
+ 		<td class="row1" align="center" valign="middle"><input type="checkbox" name="add_quota_check" /></td>
+ 	</tr>
+ 	<tr align="right">
+ 	  <td class="catBottom" colspan="5" height="29"> {S_HIDDEN_FIELDS} <input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
+ 	</tr>
+ 	<tr>
+ 		<th class="thCornerL">{L_DESCRIPTION}</th>
+ 		<th class="thTop">{L_SIZE}</th>
+ 		<th class="thCornerR">{L_DELETE}</th>
+ 	</tr>
+ <!-- BEGIN limit_row -->
+ 	<tr> 
+ 	  <td class="row1" align="center" valign="middle">
+ 		<input type="hidden" name="quota_change_list[]" value="{limit_row.QUOTA_ID}" />
+       <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0">
+ 	  <tr>
+ 		<td class="row1" align="center" valign="middle" width="10%" wrap="nowrap"><b><span class="gensmall"><a href="{limit_row.U_VIEW}" class="gensmall">{L_VIEW}</a></span></b></td>
+ 		<td class="row1" align="left" valign="middle"><input type="text" size="20" maxlength="25" name="quota_desc_list[]" class="post" value="{limit_row.QUOTA_NAME}" /></td>
+ 	  </tr>
+ 	  </table>
+ 	  </td>	
+ 	  <td class="row2" align="center" valign="middle"><input type="text" size="8" maxlength="15" name="max_filesize_list[]" class="post" value="{limit_row.MAX_FILESIZE}" /> {limit_row.S_FILESIZE}</td>
+ 	  <td class="row1" align="center" valign="middle"><input type="checkbox" name="quota_id_list[]" value="{limit_row.QUOTA_ID}" /></td>
+ 	</tr>
+ <!-- END limit_row -->
+ 	<tr align="right">
+ 	  <td class="catBottom" colspan="5" height="29"> <input type="submit" name="submit" class="liteoption" value="{L_SUBMIT}" /></td>
+ 	</tr>
+ </table>
+ </form>
+ 
+ <!-- {QUOTA_LIMIT_SETTINGS} -->
+ 
+ <!-- BEGIN switch_quota_limit_desc -->
+ <center><h1>{L_QUOTA_LIMIT_DESC}</h1></center>
+ 
+ <table width="99%" cellspacing="0" cellpadding="0" border="0" align="center">
+ 	<tr>
+ 		<td align="left" width="49%">
+ 			<table width="100%" class="forumline" cellspacing="1" cellpadding="4" border="0" align="left">
+ 				<tr>
+ 					<th>{L_ASSIGNED_USERS} - {L_UPLOAD_QUOTA}</th>
+ 				</tr>
+ 				<tr>
+ 					<td class="row1" align="center">
+ 						<select style="width:99%" name="entries[]" multiple="multiple" size="5">
+ <!-- END switch_quota_limit_desc -->
+ 						<!-- BEGIN users_upload_row -->
+ 						<option value="{users_upload_row.USER_ID}">{users_upload_row.USERNAME}</option>
+ 						<!-- END users_upload_row -->
+ <!-- BEGIN switch_quota_limit_desc -->
+ 						</select>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 		<td width="2%">
+ 			&nbsp;&nbsp;&nbsp;
+ 		</td>
+ 		<td align="right" width="49%">
+ 			<table width="100%" class="forumline" cellspacing="1" cellpadding="4" border="0" align="right">
+ 				<tr>
+ 					<th>{L_ASSIGNED_GROUPS} - {L_UPLOAD_QUOTA}</th>
+ 				</tr>
+ 				<tr>
+ 					<td class="row1" align="center">
+ 					<select style="width:99%" name="entries[]" multiple="multiple" size="5">
+ <!-- END switch_quota_limit_desc -->
+ 					<!-- BEGIN groups_upload_row -->
+ 					<option value="{groups_upload_row.GROUP_ID}">{groups_upload_row.GROUPNAME}</option>
+ 					<!-- END groups_upload_row -->
+ <!-- BEGIN switch_quota_limit_desc -->
+ 					</select>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 	</tr>
+ 	<tr>
+ 		<td colspan="3">
+ 			&nbsp;&nbsp;&nbsp;
+ 		</td>
+ 	</tr>
+ 	<tr>
+ 		<td align="left" width="49%">
+ 			<table width="100%" class="forumline" cellspacing="1" cellpadding="4" border="0" align="left">
+ 				<tr>
+ 					<th>{L_ASSIGNED_USERS} - {L_PM_QUOTA}</th>
+ 				</tr>
+ 				<tr>
+ 					<td class="row1" align="center">
+ 						<select style="width:99%" name="entries[]" multiple="multiple" size="5">
+ <!-- END switch_quota_limit_desc -->
+ 						<!-- BEGIN users_pm_row -->
+ 						<option value="{users_pm_row.USER_ID}">{users_pm_row.USERNAME}</option>
+ 						<!-- END users_pm_row -->
+ <!-- BEGIN switch_quota_limit_desc -->
+ 						</select>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 		<td width="2%">
+ 			&nbsp;&nbsp;&nbsp;
+ 		</td>
+ 		<td align="right" width="49%">
+ 			<table width="100%" class="forumline" cellspacing="1" cellpadding="4" border="0" align="right">
+ 				<tr>
+ 					<th>{L_ASSIGNED_GROUPS} - {L_PM_QUOTA}</th>
+ 				</tr>
+ 				<tr>
+ 					<td class="row1" align="center">
+ 					<select style="width:99%" name="entries[]" multiple="multiple" size="5">
+ <!-- END switch_quota_limit_desc -->
+ 					<!-- BEGIN groups_pm_row -->
+ 					<option value="{groups_pm_row.GROUP_ID}">{groups_pm_row.GROUPNAME}</option>
+ 					<!-- END groups_pm_row -->
+ <!-- BEGIN switch_quota_limit_desc -->
+ 					</select>
+ 					</td>
+ 				</tr>
+ 			</table>
+ 		</td>
+ 	</tr>
+ </table>
+ <!-- END switch_quota_limit_desc -->
+ 
+ <br clear="all" />
diff -c -rNbB attach_mod_v234/templates/subSilver/admin/attach_shadow.tpl attach_mod_v235/templates/subSilver/admin/attach_shadow.tpl
*** attach_mod_v234/templates/subSilver/admin/attach_shadow.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/admin/attach_shadow.tpl	Fri Jan 17 11:59:34 2003
***************
*** 68,80 ****
  	</tr>
    </table>
  
-   <!-- BEGIN switch_next_screen -->
- <table width="100%" cellspacing="0" cellpadding="0" border="0">
-   <tr>
- 	<td align="right"><b><span class="gensmall">&nbsp;<a href="{S_NEXT}" class="gensmall">{L_NEXT}</a>&nbsp;&nbsp;</span></b></td>
-   </tr>
- </table>
-   <!-- END switch_next_screen -->
  </form>
  
  <br clear="all" />
--- 68,73 ----
diff -c -rNbB attach_mod_v234/templates/subSilver/uacp_body.tpl attach_mod_v235/templates/subSilver/uacp_body.tpl
*** attach_mod_v234/templates/subSilver/uacp_body.tpl	Thu Jan  1 01:00:00 1970
--- attach_mod_v235/templates/subSilver/uacp_body.tpl	Fri Jan 17 11:59:34 2003
***************
*** 0 ****
--- 1,79 ----
+ 
+ <b><center>{L_UACP} :: {USERNAME}</center></b>
+ 
+ <script language="Javascript" type="text/javascript">
+ 	//
+ 	// Should really check the browser to stop this whining ...
+ 	//
+ 	function select_switch(status)
+ 	{
+ 		for (i = 0; i < document.attach_list.length; i++)
+ 		{
+ 			document.attach_list.elements[i].checked = status;
+ 		}
+ 	}
+ </script>
+ 
+ <form method="post" name="attach_list" action="{S_MODE_ACTION}">
+   <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
+ 	<tr> 
+ 	  <td align="left" nowrap="nowrap">
+ 	  <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
+ 	<tr>
+ 		<td class="nav" align="left"><a class="nav" href="{U_INDEX}">{L_INDEX}</a></td>
+ 	</tr>
+ </table>
+ 		</td>
+ 	  <td align="right" nowrap="nowrap"><span class="genmed">{L_SELECT_SORT_METHOD}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp; 
+ 		<input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
+ 		</span>
+ 	  </td>
+ 	</tr>
+   </table>
+   <table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
+ 	<tr> 
+ 	  <th height="25" class="thCornerL">#</th>
+ 	  <th class="thTop">{L_FILENAME}</th>
+ 	  <th class="thTop">{L_FILECOMMENT}</th>
+ 	  <th class="thTop">{L_EXTENSION}</th>
+ 	  <th class="thTop">{L_SIZE}</th>
+ 	  <th class="thTop">{L_DOWNLOADS}</th>
+ 	  <th class="thTop">{L_POST_TIME}</th>
+ 	  <th class="thTop">{L_POSTED_IN_TOPIC}</th>
+ 	  <th class="thCornerR">{L_DELETE}</th>
+ 	</tr>
+ 	<!-- BEGIN attachrow -->
+ 	<tr> 
+ 	  <td class="{attachrow.ROW_CLASS}" align="center"><span class="gen">&nbsp;{attachrow.ROW_NUMBER}&nbsp;</span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center"><span class="gen"><a href="{attachrow.U_VIEW_ATTACHMENT}" class="gen" target="_blank">{attachrow.FILENAME}</a></span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center"><span class="gen">{attachrow.COMMENT}</span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center"><span class="gen">{attachrow.EXTENSION}</span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center" valign="middle"><span class="gen"><b>{attachrow.SIZE}</b></span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center" valign="middle"><span class="gen"><b>{attachrow.DOWNLOAD_COUNT}</b></span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center" valign="middle"><span class="gensmall">{attachrow.POST_TIME}</span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{attachrow.POST_TITLE}</span></td>
+ 	  <td class="{attachrow.ROW_CLASS}" align="center">{attachrow.S_DELETE_BOX}</td>
+ 	  {attachrow.S_HIDDEN}
+ 	</tr>
+ 	<!-- END attachrow -->
+ 	<tr> 
+ 	  <td class="catBottom" colspan="9" height="28" align="right"> 
+ 		<input type="submit" name="delete" value="{L_DELETE_MARKED}" class="liteoption" />
+ 	  </td>
+ 	</tr>
+   </table>
+ 
+   {S_USER_HIDDEN}
+ 
+   <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
+ 	<tr> 
+ 	  <td align="right" valign="top" nowrap="nowrap"><b><span class="gensmall"><a href="javascript:select_switch(true);" class="gensmall">{L_MARK_ALL}</a> :: <a href="javascript:select_switch(false);" class="gensmall">{L_UNMARK_ALL}</a></span></b></td>
+ 	</tr>
+   </table>
+ 
+ <table width="100%" cellspacing="0" cellpadding="0" border="0">
+   <tr> 
+ 	<td><span class="nav">{PAGE_NUMBER}</span></td>
+ 	<td align="right"><span class="nav">{PAGINATION}&nbsp;</span></td>
+   </tr>
+ </table></form>
diff -c -rNbB attach_mod_v234/templates/subSilver/viewtopic_attach_body.tpl attach_mod_v235/templates/subSilver/viewtopic_attach_body.tpl
*** attach_mod_v234/templates/subSilver/viewtopic_attach_body.tpl	Fri Jan 17 11:59:39 2003
--- attach_mod_v235/templates/subSilver/viewtopic_attach_body.tpl	Fri Jan 17 11:59:34 2003
***************
*** 1,13 ****
  
! 		  <!-- BEGIN attach -->
! 			  <br /><br /><hr><br />
            
  			<!-- BEGIN denyrow -->
! 			  <span class="postbody">[{postrow.attach.denyrow.L_DENIED}]</span><br /><br />
  			<!-- END denyrow -->
- 
  			<!-- BEGIN cat_stream -->
! 			<span class="postbody">{postrow.attach.cat_stream.COMMENT}</span><br />
    			<object id="wmp" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> 
              <param name="FileName" value="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}"> 
              <param name="ShowControls" value="1"> 
--- 1,49 ----
  
! <style type="text/css">
! <!--
! td.attachrow		{ font: normal 11px Verdana, Arial, Helvetica, sans-serif; color : {T_BODY_TEXT}; border-color : {T_BODY_TEXT}; }
! table.attachtable	{ font: normal 12px Verdana, Arial, Helvetica, sans-serif; color : {T_BODY_TEXT}; border-color : {T_BODY_TEXT};	border-collapse : collapse; }
! -->
! </style>
! 		
! <!-- BEGIN attach -->
! 	<br /><br />
            
  	<!-- BEGIN denyrow -->
! 	<center><hr width="95%"></hr></center>
! 	<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
! 	<tr>
! 		<td width="100%" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.denyrow.L_DENIED}</span></b></td>
! 	</tr>
! 	</table>
! 	<center><hr width="95%"></hr></center>
  	<!-- END denyrow -->
  	<!-- BEGIN cat_stream -->
! 	<center><hr width="95%"></hr></center>
! 	<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
! 	<tr>
! 		<td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_stream.DOWNLOAD_NAME}</span></b></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td>
! 		<td width="75%" class="attachrow">
! 			<table width="100%" border="0" cellpadding="0" cellspacing="4" align="center">
! 			<tr>
! 				<td class="attachrow"><span class="genmed">{postrow.attach.cat_stream.COMMENT}</span></td>
! 			</tr>
! 			</table>
! 		</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.FILESIZE} {postrow.attach.cat_stream.SIZE_VAR}</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.L_DOWNLOADED_VIEWED}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_stream.L_DOWNLOAD_COUNT}</span></td>
! 	</tr>
! 	<tr>
! 		<td colspan="2" align="center"><br />
  		<object id="wmp" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> 
  		<param name="FileName" value="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}"> 
          <param name="ShowControls" value="1"> 
***************
*** 19,62 ****
              <param name="AnimationStart" value="0"> 
              <param name="Loop" value="0"> 
  			<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 autostart=0 visible=1 animationatstart=0 loop=0></embed> 
!             </object>
!   		    <br /><span class="gensmall">{postrow.attach.cat_stream.DOWNLOAD_NAME} - {postrow.attach.cat_stream.L_DOWNLOAD_COUNT}</span><br /><br />
  			<!-- END cat_stream -->
- 
  			<!-- BEGIN cat_swf -->
!   		    <span class="postbody">{postrow.attach.cat_swf.COMMENT}<br />
! 			<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH="{postrow.attach.cat_swf.WIDTH}" HEIGHT="{postrow.attach.cat_swf.HEIGHT}"> 
! 			<PARAM NAME=movie VALUE="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}"> 
! 			<PARAM NAME=loop VALUE=1> 
! 			<PARAM NAME=quality VALUE=high> 
! 			<PARAM NAME=scale VALUE=noborder> 
! 			<PARAM NAME=wmode VALUE=transparent> 
! 			<PARAM NAME=bgcolor VALUE=#000000> 
! 			<EMBED src="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}" loop=1 quality=high scale=noborder wmode=transparent bgcolor=#000000  WIDTH="{postrow.attach.cat_swf.WIDTH}" HEIGHT="{postrow.attach.cat_swf.HEIGHT}" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> 
! 			</OBJECT> 
! 			<br /><span class="gensmall">{postrow.attach.cat_swf.DOWNLOAD_NAME} - {postrow.attach.cat_swf.L_DOWNLOAD_COUNT}</span><br /><br />
  			<!-- END cat_swf -->
- 
  			<!-- BEGIN cat_images -->
! 			  <span class="postbody">{postrow.attach.cat_images.COMMENT}<br />
! 			  <img src="{postrow.attach.cat_images.IMG_SRC}" alt="{postrow.attach.cat_images.DOWNLOAD_NAME}" /></span><br />
! 			  
! 			  <span class="gensmall">{postrow.attach.cat_images.DOWNLOAD_NAME} - {postrow.attach.cat_images.L_DOWNLOAD_COUNT}</span><br /><br />
  			<!-- END cat_images -->
- 
  			<!-- BEGIN cat_thumb_images -->
! 			  <span class="postbody">{postrow.attach.cat_thumb_images.COMMENT}<br />
! 			  <a href="{postrow.attach.cat_thumb_images.IMG_SRC}" target="_blank">
! 			  <img src="{postrow.attach.cat_thumb_images.IMG_THUMB_SRC}" alt="{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}" border="0" /></a></span><br />
! 			  
! 			  <span class="gensmall">{postrow.attach.cat_thumb_images.DOWNLOAD_NAME} - {postrow.attach.cat_thumb_images.L_DOWNLOAD_COUNT}</span><br /><br />
  			<!-- END cat_thumb_images -->
- 
  			<!-- BEGIN attachrow -->
! 			  <span class="postbody">{postrow.attach.attachrow.COMMENT}</span><br />
! 			  <span class="postbody">{postrow.attach.attachrow.S_UPLOAD_IMAGE} 
! 			  <a href="{postrow.attach.attachrow.U_DOWNLOAD_LINK}" {postrow.attach.attachrow.TARGET_BLANK}>{postrow.attach.attachrow.DOWNLOAD_NAME}</a> - {postrow.attach.attachrow.FILESIZE} {L_KILOBYTE}<br /></span>
! 			  <span class="gensmall">{postrow.attach.attachrow.L_DOWNLOAD_COUNT}</span><br /><br />
  			<!-- END attachrow -->
  		
! 		  <!-- END attach -->		  
--- 55,197 ----
  		<param name="AnimationStart" value="0"> 
  		<param name="Loop" value="0"> 
  		<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="{postrow.attach.cat_stream.U_DOWNLOAD_LINK}" name=MediaPlayer2 showcontrols=1 showdisplay=0 showstatusbar=1 autosize=1 autostart=0 visible=1 animationatstart=0 loop=0></embed> 
! 		</object> <br /><br />
! 		</td>
! 	</tr>
! 	</table>
! 	<center><hr width="95%"></hr></center>
  	<!-- END cat_stream -->
  	<!-- BEGIN cat_swf -->
! 	<center><hr width="95%"></hr></center>
! 	<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
! 	<tr>
! 		<td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_swf.DOWNLOAD_NAME}</span></b></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td>
! 		<td width="75%" class="attachrow">
! 			<table width="100%" border="0" cellpadding="0" cellspacing="4" align="center">
! 			<tr>
! 				<td class="attachrow"><span class="genmed">{postrow.attach.cat_swf.COMMENT}</span></td>
! 			</tr>
! 			</table>
! 		</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.FILESIZE} {postrow.attach.cat_swf.SIZE_VAR}</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.L_DOWNLOADED_VIEWED}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_swf.L_DOWNLOAD_COUNT}</span></td>
! 	</tr>
! 	<tr>
! 		<td colspan="2" align="center"><br />
! 		<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="{postrow.attach.cat_swf.WIDTH}" height="{postrow.attach.cat_swf.HEIGHT}"> 
! 		<param name=movie value="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}"> 
! 		<param name=loop value=1> 
! 		<param name=quality value=high> 
! 		<param name=scale value=noborder> 
! 		<param name=wmode value=transparent> 
! 		<param name=bgcolor value=#000000> 
! 		<embed src="{postrow.attach.cat_swf.U_DOWNLOAD_LINK}" loop=1 quality=high scale=noborder wmode=transparent bgcolor=#000000  width="{postrow.attach.cat_swf.WIDTH}" height="{postrow.attach.cat_swf.HEIGHT}" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> 
! 		</object><br /><br />
! 		</td>
! 	</tr>
! 	</table>
! 	<center><hr width="95%"></hr></center>
  	<!-- END cat_swf -->
  	<!-- BEGIN cat_images -->
! 	<center><hr width="95%"></hr></center>
! 	<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
! 	<tr>
! 		<td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_images.DOWNLOAD_NAME}</span></b></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td>
! 		<td width="75%" class="attachrow">
! 			<table width="100%" border="0" cellpadding="0" cellspacing="4" align="center">
! 			<tr>
! 				<td class="attachrow"><span class="genmed">{postrow.attach.cat_images.COMMENT}</span></td>
! 			</tr>
! 			</table>
! 		</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.FILESIZE} {postrow.attach.cat_images.SIZE_VAR}</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.L_DOWNLOADED_VIEWED}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_images.L_DOWNLOAD_COUNT}</span></td>
! 	</tr>
! 	<tr>
! 		<td colspan="2" align="center"><br /><img src="{postrow.attach.cat_images.IMG_SRC}" alt="{postrow.attach.cat_images.DOWNLOAD_NAME}" border="0" /><br /><br /></td>
! 	</tr>
! 	</table>
! 	<center><hr width="95%"></hr></center>
  	<!-- END cat_images -->
  	<!-- BEGIN cat_thumb_images -->
! 	<center><hr width="95%"></hr></center>
! 	<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
! 	<tr>
! 		<td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}</span></b></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td>
! 		<td width="75%" class="attachrow">
! 			<table width="100%" border="0" cellpadding="0" cellspacing="4" align="center">
! 			<tr>
! 				<td class="attachrow"><span class="genmed">{postrow.attach.cat_thumb_images.COMMENT}</span></td>
! 			</tr>
! 			</table>
! 		</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.FILESIZE} {postrow.attach.cat_thumb_images.SIZE_VAR}</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.L_DOWNLOADED_VIEWED}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.cat_thumb_images.L_DOWNLOAD_COUNT}</span></td>
! 	</tr>
! 	<tr>
! 		<td colspan="2" align="center"><br /><a href="{postrow.attach.cat_thumb_images.IMG_SRC}" target="_blank"><img src="{postrow.attach.cat_thumb_images.IMG_THUMB_SRC}" alt="{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}" border="0" /></a><br /><br /></td>
! 	</tr>
! 	</table>
! 	<center><hr width="95%"></hr></center>
  	<!-- END cat_thumb_images -->
  	<!-- BEGIN attachrow -->
! 	<center><hr width="95%"></hr></center>
! 	<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
! 	<tr>
! 		<td width="100%" colspan="3" class="spaceRow" align="center"><b><span class="gen">{postrow.attach.attachrow.DOWNLOAD_NAME}</span></b></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_DESCRIPTION}:</span></td>
! 		<td width="75%" class="attachrow">
! 			<table width="100%" border="0" cellpadding="0" cellspacing="4" align="center">
! 			<tr>
! 				<td class="attachrow"><span class="genmed">{postrow.attach.attachrow.COMMENT}</span></td>
! 			</tr>
! 			</table>
! 		</td>
! 		<td rowspan="4" align="center" width="10%" class="attachrow">{postrow.attach.attachrow.S_UPLOAD_IMAGE}<br /><a href="{postrow.attach.attachrow.U_DOWNLOAD_LINK}" {postrow.attach.attachrow.TARGET_BLANK} class="genmed"><b>{L_DOWNLOAD}</b></a></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILENAME}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.DOWNLOAD_NAME}</span></td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{L_FILESIZE}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.FILESIZE} {postrow.attach.attachrow.SIZE_VAR}</td>
! 	</tr>
! 	<tr>
! 		<td width="15%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.L_DOWNLOADED_VIEWED}:</span></td>
! 		<td width="75%" class="attachrow"><span class="genmed">&nbsp;{postrow.attach.attachrow.L_DOWNLOAD_COUNT}</span></td>
! 	</tr>
! 	</table>
! 	<center><hr width="95%"></hr></center>
  	<!-- END attachrow -->
  	
! <!-- END attach -->
diff -c -rNbB attach_mod_v234/uacp.php attach_mod_v235/uacp.php
*** attach_mod_v234/uacp.php	Thu Jan  1 01:00:00 1970
--- attach_mod_v235/uacp.php	Fri Jan 17 11:59:34 2003
***************
*** 0 ****
--- 1,425 ----
+ <?php
+ /***************************************************************************
+  *                                 uacp.php
+  *                            -------------------
+  *   begin                : Oct 30, 2002
+  *   copyright            : (C) 2002 Meik Sievertsen
+  *   email                : acyd.burn@gmx.de
+  *
+  *   $Id: uacp.php,v 1.6 2003/01/13 18:19:48 acydburn Exp $
+  *
+  *
+  ***************************************************************************/
+ 
+ /***************************************************************************
+  *
+  *   This program is free software; you can redistribute it and/or modify
+  *   it under the terms of the GNU General Public License as published by
+  *   the Free Software Foundation; either version 2 of the License, or
+  *   (at your option) any later version.
+  *
+  ***************************************************************************/
+ 
+ /**
+  * User Attachment Control Panel
+  *
+  * From this 'Control Panel' the user is able to view/delete his Attachments.
+  */
+ 
+ define('IN_PHPBB', true);
+ $phpbb_root_path = './';
+ include($phpbb_root_path . 'extension.inc');
+ include($phpbb_root_path . 'common.'.$phpEx);
+ 
+ //
+ // Start session management
+ //
+ $userdata = session_pagestart($user_ip, PAGE_PROFILE);
+ init_userprefs($userdata);
+ //
+ // End session management
+ //
+ 
+ //
+ // Obtain initial var settings
+ //
+ if(isset($HTTP_GET_VARS[POST_USERS_URL]) || isset($HTTP_POST_VARS[POST_USERS_URL]))
+ {
+ 	$user_id = (isset($HTTP_POST_VARS[POST_USERS_URL])) ? $HTTP_POST_VARS[POST_USERS_URL] : $HTTP_GET_VARS[POST_USERS_URL];
+ }
+ else
+ {
+ 	message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
+ }
+ 
+ $user_id = ($user_id == '-1') ? ANONYMOUS : intval($user_id);
+ 
+ $profiledata = get_userdata($user_id);
+ 
+ if ($user_id == ANONYMOUS)
+ {
+ 	$profiledata['user_id'] = ANONYMOUS;
+ 	$profiledata['username'] = $lang['Guest'];
+ }
+ else
+ {
+ 	$profiledata['user_id'] = intval($profiledata['user_id']);
+ }
+ 
+ if ( ($profiledata['user_id'] != $userdata['user_id']) && ($userdata['user_level'] != ADMIN) )
+ {
+ 	message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
+ }
+ 
+ $page_title = $lang['User_acp_title'];
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+ 
+ if( !@file_exists(@amod_realpath($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.'.$phpEx)) )
+ {
+ 	$language = 'english';
+ }
+ 
+ include($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.' . $phpEx);
+ 
+ $start = ( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;
+ 
+ if(isset($HTTP_POST_VARS['order']))
+ {
+ 	$sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
+ }
+ else if(isset($HTTP_GET_VARS['order']))
+ {
+ 	$sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
+ }
+ else
+ {
+ 	$sort_order = '';
+ }
+ 
+ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
+ {
+ 	$mode = (isset($HTTP_POST_VARS['mode'])) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
+ }
+ else
+ {
+ 	$mode = '';
+ }
+ 
+ $mode_types_text = array($lang['Sort_Filename'], $lang['Sort_Comment'], $lang['Sort_Extension'], $lang['Sort_Size'], $lang['Sort_Downloads'], $lang['Sort_Posttime'], /*$lang['Sort_Posts']*/);
+ $mode_types = array('real_filename', 'comment', 'extension', 'filesize', 'downloads', 'post_time'/*, 'posts'*/);
+ 
+ if (empty($mode))
+ {
+ 	$mode = 'real_filename';
+ 	$sort_order = 'ASC';
+ }
+ 
+ //
+ // Pagination ?
+ //
+ $do_pagination = TRUE;
+ 
+ //
+ // Set Order
+ //
+ $order_by = '';
+ 
+ switch($mode)
+ {
+ 	case 'filename':
+ 		$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ 	case 'comment':
+ 		$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ 	case 'extension':
+ 		$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ 	case 'filesize':
+ 		$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ 	case 'downloads':
+ 		$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ 	case 'post_time':
+ 		$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ 	default:
+ 		$mode = 'a.real_filename';
+ 		$sort_order = 'ASC';
+ 		$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['topics_per_page'];
+ 		break;
+ }
+ 
+ //
+ // Set select fields
+ //
+ if (count($mode_types_text) > 0)
+ {
+ 	$select_sort_mode = '<select name="mode">';
+ 
+ 	for($i = 0; $i < count($mode_types_text); $i++)
+ 	{
+ 		$selected = ($mode == $mode_types[$i]) ? ' selected="selected"' : '';
+ 		$select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
+ 	}
+ 	$select_sort_mode .= '</select>';
+ }
+ 
+ if (!empty($sort_order))
+ {
+ 	$select_sort_order = '<select name="order">';
+ 	if($sort_order == 'ASC')
+ 	{
+ 		$select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
+ 	}
+ 	else
+ 	{
+ 		$select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
+ 	}
+ 	$select_sort_order .= '</select>';
+ }
+ 
+ $delete = ( isset($HTTP_POST_VARS['delete']) ) ? TRUE : FALSE;
+ $delete_id_list = ( isset($HTTP_POST_VARS['delete_id_list']) ) ?  $HTTP_POST_VARS['delete_id_list'] : array();
+ 
+ $confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : FALSE;
+ 
+ if ( ($confirm) && (count($delete_id_list) > 0) )
+ {
+ 	$attachments = array();
+ 
+ 	delete_attachment(-1, $delete_id_list);
+ }
+ else if ( ($delete) && (count($delete_id_list)) > 0 )
+ {
+ 	//
+ 	// Not confirmed, show confirmation message
+ 	//	
+ 	$hidden_fields = '<input type="hidden" name="view" value="' . $view . '" />';
+ 	$hidden_fields .= '<input type="hidden" name="mode" value="' . $mode . '" />';
+ 	$hidden_fields .= '<input type="hidden" name="order" value="' . $sort_order . '" />';
+ 	$hidden_fields .= '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $profiledata['user_id'] . '" />';
+ 	$hidden_fields .= '<input type="hidden" name="start" value="' . $start . '" />';
+ 
+ 	for($i = 0; $i < count($delete_id_list); $i++)
+ 	{
+ 		$hidden_fields .= '<input type="hidden" name="delete_id_list[]" value="' . $delete_id_list[$i] . '" />';
+ 	}
+ 
+ 	$template->set_filenames(array(
+ 		'confirm' => 'confirm_body.tpl')
+ 	);
+ 
+ 	$template->assign_vars(array(
+ 		'MESSAGE_TITLE' => $lang['Confirm'],
+ 		'MESSAGE_TEXT' => $lang['Confirm_delete_attachments'],
+ 
+ 		'L_YES' => $lang['Yes'],
+ 		'L_NO' => $lang['No'],
+ 
+ 		'S_CONFIRM_ACTION' => append_sid($phpbb_root_path . 'uacp.' . $phpEx),
+ 		'S_HIDDEN_FIELDS' => $hidden_fields)
+ 	);
+ 
+ 	$template->pparse('confirm');
+ 	
+ 	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+ 
+ 	exit;
+ }
+ 
+ $hidden_fields = '';
+ 	
+ $template->set_filenames(array(
+ 	'body' => 'uacp_body.tpl')
+ );
+ 
+ $total_rows = 0;
+ 	
+ $username = $profiledata['username'];
+ 
+ $s_hidden = '<input type="hidden" name="' . POST_USERS_URL . '" value="' . $profiledata['user_id'] . '">';
+ 
+ //
+ // Assign Template Vars
+ //
+ $template->assign_vars(array(
+ 	'L_SUBMIT' => $lang['Submit'],
+ 	'L_UACP' => $lang['UACP'],
+ 	'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
+ 	'L_ORDER' => $lang['Order'],
+ 	'L_FILENAME' => $lang['File_name'],
+ 	'L_FILECOMMENT' => $lang['File_comment_cp'],
+ 	'L_EXTENSION' => $lang['Extension'],
+ 	'L_SIZE' => $lang['Size_in_kb'],
+ 	'L_DOWNLOADS' => $lang['Downloads'],
+ 	'L_POST_TIME' => $lang['Post_time'],
+ 	'L_POSTED_IN_TOPIC' => $lang['Posted_in_topic'],
+ 	'L_DELETE' => $lang['Delete'],
+ 	'L_DELETE_MARKED' => $lang['Delete_marked'],
+ 	'L_MARK_ALL' => $lang['Mark_all'],
+ 	'L_UNMARK_ALL' => $lang['Unmark_all'],
+ 
+ 	'USERNAME' => $profiledata['username'],
+ 
+ 	'S_USER_HIDDEN' => $s_hidden,
+ 	'S_MODE_ACTION' => append_sid('uacp.' . $phpEx),
+ 	'S_MODE_SELECT' => $select_sort_mode,
+ 	'S_ORDER_SELECT' => $select_sort_order)
+ );
+ 
+ $sql = "SELECT attach_id 
+ FROM " . ATTACHMENTS_TABLE . "
+ WHERE user_id_1 = " . $profiledata['user_id'] . "
+ GROUP BY attach_id";
+ 		
+ if ( !($result = attach_sql_query($sql)) )
+ {
+ 	message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
+ }
+ 		
+ $attach_ids = $db->sql_fetchrowset($result);
+ $num_attach_ids = $db->sql_numrows($result);
+ 
+ if ($num_attach_ids == 0)
+ {
+ 	message_die(GENERAL_MESSAGE, 'For some reason no Attachments are assigned to the User "' . $username . '".');
+ }
+ 		
+ $total_rows = $num_attach_ids;
+ 
+ $attach_id = array();
+ 
+ for ($j = 0; $j < $num_attach_ids; $j++)
+ {
+ 	$attach_id[] = $attach_ids[$j]['attach_id'];
+ }
+ 			
+ $sql = "SELECT a.*
+ FROM " . ATTACHMENTS_DESC_TABLE . " a
+ WHERE a.attach_id IN (" . implode(', ', $attach_id) . ") " .
+ $order_by;
+ 		
+ if ( !($result = attach_sql_query($sql)) )
+ {
+ 	message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
+ }
+ 
+ $attachments = $db->sql_fetchrowset($result);
+ $num_attach = $db->sql_numrows($result);
+ 
+ if (count($attachments) > 0)
+ {
+ 	for ($i = 0; $i < count($attachments); $i++)
+ 	{
+ 		$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . $attachments[$i]['attach_id'] . '" />';
+ 
+ 		for ($j = 0; $j < count($delete_id_list); $j++)
+ 		{
+ 			if ($delete_id_list[$j] == $attachments[$i]['attach_id'])
+ 			{
+ 				$delete_box = '<input type="checkbox" name="delete_id_list[]" value="' . $attachments[$i]['attach_id'] . '" checked />';
+ 				break;
+ 			}
+ 		}
+ 
+ 		$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
+ 		$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
+ 
+ 		//
+ 		// Is the Attachment assigned to more than one post ?
+ 		// If it's not assigned to any post, it's an private message thingy. ;)
+ 		//
+ 		$post_titles = array();
+ 
+ 		$sql = "SELECT *
+ 		FROM " . ATTACHMENTS_TABLE . "
+ 		WHERE attach_id = " . $attachments[$i]['attach_id'];
+ 
+ 		if ( !($result = attach_sql_query($sql)) )
+ 		{
+ 			message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
+ 		}
+ 
+ 		$ids = $db->sql_fetchrowset($result);
+ 		$num_ids = $db->sql_numrows($result);
+ 
+ 		for ($j = 0; $j < $num_ids; $j++)
+ 		{
+ 			if ($ids[$j]['post_id'] != 0)
+ 			{
+ 				$sql = "SELECT t.topic_title
+ 				FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
+ 				WHERE p.post_id = " . $ids[$j]['post_id'] . " AND p.topic_id = t.topic_id
+ 				GROUP BY t.topic_id, t.topic_title";
+ 
+ 				if ( !($result = attach_sql_query($sql)) )
+ 				{
+ 					message_die(GENERAL_ERROR, 'Couldn\'t query topic', '', __LINE__, __FILE__, $sql);
+ 				}
+ 
+ 				$row = $db->sql_fetchrow($result);
+ 				$post_title = $row['topic_title'];
+ 
+ 				if (strlen($post_title) > 32)
+ 				{
+ 					$post_title = substr($post_title, 0, 30) . '...';
+ 				}
+ 
+ 				$view_topic = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $ids[$j]['post_id'] . '#' . $ids[$j]['post_id']);
+ 
+ 				$post_titles[] = '<a href="' . $view_topic . '" class="gen" target="_blank">' . $post_title . '</a>';
+ 			}
+ 			else
+ 			{
+ 				$post_titles[] = $lang['Private_Message'];
+ 			}
+ 		}
+ 
+ 		$post_titles = implode('<br />', $post_titles);
+ 
+ 		$hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . $attachments[$i]['attach_id'] . '">';
+ 
+ 		$template->assign_block_vars('attachrow', array(
+ 			'ROW_NUMBER' => $i + ( $HTTP_GET_VARS['start'] + 1 ),
+ 			'ROW_COLOR' => '#' . $row_color,
+ 			'ROW_CLASS' => $row_class,
+ 
+ 			'FILENAME' => $attachments[$i]['real_filename'],
+ 			'COMMENT' => stripslashes(trim(nl2br($attachments[$i]['comment']))),
+ 			'EXTENSION' => $attachments[$i]['extension'],
+ 			'SIZE' => round(($attachments[$i]['filesize'] / MEGABYTE), 2),
+ 			'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
+ 			'POST_TIME' => create_date($board_config['default_dateformat'], $attachments[$i]['filetime'], $board_config['board_timezone']),
+ 			'POST_TITLE' => $post_titles,
+ 
+ 			'S_DELETE_BOX' => $delete_box,
+ 			'S_HIDDEN' => $hidden_field,
+ 			'U_VIEW_ATTACHMENT' => append_sid($phpbb_root_path . 'download.' . $phpEx . '?id=' . $attachments[$i]['attach_id']))
+ //			'U_VIEW_POST' => ($attachments[$i]['post_id'] != 0) ? append_sid("../viewtopic." . $phpEx . "?" . POST_POST_URL . "=" . $attachments[$i]['post_id'] . "#" . $attachments[$i]['post_id']) : '')
+ 		);
+ 			
+ 	}
+ }
+ 
+ //
+ // Generate Pagination
+ //
+ if ( ($do_pagination) && ($total_rows > $board_config['topics_per_page']) )
+ {
+ 	$pagination = generate_pagination($phpbb_root_path . 'uacp.' . $phpEx . '?mode=' . $mode . '&amp;order=' . $sort_order . '&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'], $total_rows, $board_config['topics_per_page'], $start).'&nbsp;';
+ 
+ 	$template->assign_vars(array(
+ 		'PAGINATION' => $pagination,
+ 		'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_rows / $board_config['topics_per_page'] )), 
+ 
+ 		'L_GOTO_PAGE' => $lang['Goto_page'])
+ 	);
+ }
+ 
+ $template->pparse('body');
+ 
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+ 
+ ?>
\ No newline at end of file
