diff -x .svn -ruN 0.7.7.src/class2.php 0.7.11.src/class2.php
--- 0.7.7.src/class2.php	2006-11-24 21:38:19.000000000 -0600
+++ 0.7.11.src/class2.php	2007-12-29 13:01:24.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/class2.php,v $
-|     $Revision: 1.322 $
-|     $Date: 2006/11/25 03:38:19 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.355 $
+|     $Date: 2007/12/29 19:01:24 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 //
@@ -83,7 +83,7 @@
 
 //
 // D: Setup PHP error handling
-//    (Now we can see PHP errors)
+//    (Now we can see PHP errors) -- but note that DEBUG is not yet enabled!
 //
 $error_handler = new error_handler();
 set_error_handler(array(&$error_handler, "handle_error"));
@@ -110,9 +110,26 @@
 }
 
 define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE : FALSE));
-$srvtmp = explode(".",$_SERVER['HTTP_HOST']);
+
+// Define the domain name and subdomain name.
+if(is_numeric(str_replace(".","",$_SERVER['HTTP_HOST']))){
+	$srvtmp = "";  // Host is an IP address.
+}else{
+	$srvtmp = explode(".",$_SERVER['HTTP_HOST']);
+}
+
 define("e_SUBDOMAIN", (count($srvtmp)>2 && $srvtmp[2] ? $srvtmp[0] : FALSE)); // needs to be available to e107_config.
 
+if(e_SUBDOMAIN)
+{
+   	unset($srvtmp[0]);
+}
+
+define("e_DOMAIN",(count($srvtmp) > 1 ? (implode(".",$srvtmp)) : FALSE)); // if it's an IP it must be set to FALSE.
+
+unset($srvtmp);
+
+
 //  Ensure thet '.' is the first part of the include path
 $inc_path = explode(PATH_SEPARATOR, ini_get('include_path'));
 if($inc_path[0] != ".") {
@@ -128,7 +145,7 @@
 @include_once(realpath(dirname(__FILE__).'/e107_config.php'));
 if(!isset($ADMIN_DIRECTORY)){
 	// e107_config.php is either empty, not valid or doesn't exist so redirect to installer..
-	header("Location: install.php");
+  	header("Location: install.php");
 }
 
 //
@@ -178,7 +195,7 @@
 
 //define("e_QUERY", $matches[2]);
 //define("e_QUERY", $_SERVER['QUERY_STRING']);
-$e_QUERY = $tp->post_toForm($e_QUERY);
+$e_QUERY = str_replace("&","&amp;",$tp->post_toForm($e_QUERY));
 define("e_QUERY", $e_QUERY);
 //$e_QUERY = e_QUERY;
 
@@ -341,16 +358,31 @@
 define("SITEURL", SITEURLBASE.e_HTTP);
 
 // let the subdomain determine the language (when enabled).
-if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'] && ($pref['user_tracking'] == "session")){
-		e107_ini_set("session.cookie_domain",$pref['multilanguage_subdomain']);
-		require_once(e_HANDLER."language_class.php");
-		$lng = new language;
-        if(e_SUBDOMAIN == "www"){
-        	$GLOBALS['elan'] = $pref['sitelanguage'];
+
+if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'] && ($pref['user_tracking'] == "session") && e_DOMAIN && MULTILANG_SUBDOMAIN !== FALSE){
+
+		$mtmp = explode("\n",$pref['multilanguage_subdomain']);
+        foreach($mtmp as $val)
+		{
+        	if(e_DOMAIN == trim($val))
+			{
+            	$domain_active = TRUE;
+			}
 		}
-		elseif($eln = $lng->convert(e_SUBDOMAIN))
+
+		if($domain_active || ($pref['multilanguage_subdomain'] == "1"))
 		{
-          	$GLOBALS['elan'] = $eln;
+			e107_ini_set("session.cookie_domain",".".e_DOMAIN);
+			require_once(e_HANDLER."language_class.php");
+			$lng = new language;
+	        if(e_SUBDOMAIN == "www" || e_SUBDOMAIN === FALSE)
+			{
+	        	$GLOBALS['elan'] = $pref['sitelanguage'];
+			}
+			elseif($eln = $lng->convert(e_SUBDOMAIN))
+			{
+	          	$GLOBALS['elan'] = $eln;
+			}
 		}
 }
 
@@ -407,7 +439,7 @@
 if (isset($_POST['setlanguage']) || isset($_GET['elan']) || isset($GLOBALS['elan'])) {
 	if($_GET['elan'])  // query support, for language selection splash pages. etc
 	{
-		$_POST['sitelanguage'] = $_GET['elan'];
+		$_POST['sitelanguage'] = str_replace(array(".","/","%"),"",$_GET['elan']);
 	}
 	if($GLOBALS['elan'] && !isset($_POST['sitelanguage']))
 	{
@@ -424,7 +456,7 @@
 		$_COOKIE['e107language_'.$pref['cookie_name']] = $_POST['sitelanguage'];
 		if (strpos(e_SELF, ADMINDIR) === FALSE) {
 			$locat = ((!$_GET['elan'] && e_QUERY) || (e_QUERY && e_LANCODE)) ? e_SELF."?".e_QUERY : e_SELF;
-		  		header("Location:".$locat);
+		  	 	header("Location:".$locat);
 		}
 	}
 }
@@ -512,14 +544,14 @@
 init_session();
 
 // for multi-language these definitions needs to come after the language loaded.
-define("SITENAME", trim($tp->toHTML($pref['sitename'], "", "emotes_off defs no_make_clickable")));
+define("SITENAME", trim($tp->toHTML($pref['sitename'], "", "emotes_off, defs, no_make_clickable")));
 define("SITEBUTTON", $pref['sitebutton']);
-define("SITETAG", $tp->toHTML($pref['sitetag'], FALSE, "emotes_off defs"));
-define("SITEDESCRIPTION", $tp->toHTML($pref['sitedescription'], "", "emotes_off defs"));
+define("SITETAG", $tp->toHTML($pref['sitetag'], FALSE, "emotes_off, defs"));
+define("SITEDESCRIPTION", $tp->toHTML($pref['sitedescription'], "", "emotes_off, defs"));
 define("SITEADMIN", $pref['siteadmin']);
 define("SITEADMINEMAIL", $pref['siteadminemail']);
-define("SITEDISCLAIMER", $tp->toHTML($pref['sitedisclaimer'], "", "emotes_off defs"));
-define("SITECONTACTINFO", $tp->toHTML($pref['sitecontactinfo'], TRUE, "emotes_off defs"));
+define("SITEDISCLAIMER", $tp->toHTML($pref['sitedisclaimer'], "", "emotes_off, defs"));
+define("SITECONTACTINFO", $tp->toHTML($pref['sitecontactinfo'], TRUE, "emotes_off, defs"));
 
 // legacy module.php file loading.
 if (isset($pref['modules']) && $pref['modules']) {
@@ -531,6 +563,10 @@
 	}
 }
 
+
+$js_body_onload = array();			// Initialise this array in case a module wants to add to it
+
+
 // Load e_modules after all the constants, but before the themes, so they can be put to use.
 if(isset($pref['e_module_list']) && $pref['e_module_list']){
 	foreach ($pref['e_module_list'] as $mod){
@@ -552,7 +588,7 @@
 		// arg1 = theme to check
 		global $ADMIN_DIRECTORY, $tp, $e107;
 
-		if (strpos(e_QUERY, "themepreview") !== FALSE) {
+		if (ADMIN && strpos(e_QUERY, "themepreview") !== FALSE) {
 			list($action, $id) = explode('.', e_QUERY);
 			require_once(e_HANDLER."theme_handler.php");
 			$themeArray = themeHandler :: getThemes("id");
@@ -637,7 +673,7 @@
 
 $e107->ban();
 
-if($pref['force_userupdate'] && USER) {
+if(varset($pref['force_userupdate']) && USER) {
 	if(force_userupdate()) {
 		header("Location: ".e_BASE."usersettings.php?update");
 	}
@@ -648,12 +684,12 @@
 define("e_SIGNUP", e_BASE.(file_exists(e_BASE."customsignup.php") ? "customsignup.php" : "signup.php"));
 define("e_LOGIN", e_BASE.(file_exists(e_BASE."customlogin.php") ? "customlogin.php" : "login.php"));
 
-if ($pref['membersonly_enabled'] && !USER && e_PAGE != e_SIGNUP && e_PAGE != "index.php" && e_PAGE != "fpw.php" && e_PAGE != e_LOGIN && strpos(e_PAGE, "admin") === FALSE && e_PAGE != 'membersonly.php' && e_PAGE != 'sitedown.php') {
+if ($pref['membersonly_enabled'] && !USER && e_SELF != SITEURL.e_SIGNUP && e_SELF != SITEURL."index.php" && e_SELF != SITEURL."fpw.php" && e_SELF != SITEURL.e_LOGIN && strpos(e_PAGE, "admin") === FALSE && e_SELF != SITEURL.'membersonly.php' && e_SELF != SITEURL.'sitedown.php') {
 	header("Location: ".e_HTTP."membersonly.php");
 	exit;
 }
 
-$sql->db_Delete("tmp", "tmp_time < '".(time() - 300)."' AND tmp_ip!='data' AND tmp_ip!='submitted_link'");
+$sql->db_Delete("tmp", "tmp_time < ".(time() - 300)." AND tmp_ip!='data' AND tmp_ip!='submitted_link'");
 
 
 
@@ -717,6 +753,8 @@
 
 $menu_data = $e107cache->retrieve("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE));
 $menu_data = $eArrayStorage->ReadArray($menu_data);
+$eMenuList=array();
+$eMenuActive=array();
 if(!is_array($menu_data)) {
 	if ($sql->db_Select('menus', '*', "menu_location > 0 AND menu_class IN (".USERCLASS_LIST.") ORDER BY menu_order")) {
 		while ($row = $sql->db_Fetch()) {
@@ -801,11 +839,14 @@
 
 if (Empty($pref['newsposts']) ? define("ITEMVIEW", 15) : define("ITEMVIEW", $pref['newsposts']));
 
-if ($pref['antiflood1'] == 1) {
-	define('FLOODPROTECT', TRUE);
-	define('FLOODTIMEOUT', $pref['antiflood_timeout']);
-}else{
-	define('FLOODPROTECT', FALSE);
+if ($pref['antiflood1'] == 1) 
+{
+  define('FLOODPROTECT', TRUE);
+  define('FLOODTIMEOUT', max(varset($pref['antiflood_timeout'],10),3));
+}
+else
+{
+  define('FLOODPROTECT', FALSE);
 }
 
 $layout = isset($layout) ? $layout : '_default';
@@ -845,7 +886,13 @@
 //@require_once(e_HANDLER."debug_handler.php");
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 function js_location($qry){
-	echo "<script type='text/javascript'>document.location.href='{$qry}'</script>\n"; exit;
+	global $error_handler;
+	if (count($error_handler->errors)) {
+		echo $error_handler->return_errors();
+		exit;
+	} else {
+		echo "<script type='text/javascript'>document.location.href='{$qry}'</script>\n"; exit;
+	}
 }
 
 function check_email($email) {
@@ -860,9 +907,11 @@
 		return TRUE;
 	}
 
+	if (is_numeric($var) && !$var) return TRUE;		// Accept numeric class zero - 'PUBLIC'
+
 	if (!$var || $var == "")
-	{
-		return TRUE;
+	{	// ....but an empty string or NULL variable is not valid
+		return FALSE;
 	}
 
 	if(strpos($var, ",") !== FALSE)
@@ -999,11 +1048,11 @@
 	$qry = "
 	SELECT u.*, ue.* FROM #user AS u
 	LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id
-	WHERE u.user_id='{$uid}' {$extra}
+	WHERE u.user_id = {$uid} {$extra}
 	";
 	if (!$sql->db_Select_gen($qry))
 	{
-		$qry = "SELECT * FROM #user AS u WHERE u.user_id='{$uid}' {$extra}";
+		$qry = "SELECT * FROM #user AS u WHERE u.user_id = {$uid} {$extra}";
 		if(!$sql->db_Select_gen($qry))
 		{
 			return FALSE;
@@ -1048,39 +1097,38 @@
 
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 
-function save_prefs($table = 'core', $uid = USERID, $row_val = '') {
-	global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage;
-	if ($table == 'core') {
-		if ($row_val == '') {
-			// Save old version as a backup
-			if(!$sql->db_Update('core', "e107_value='".addslashes($PrefCache)."' WHERE e107_name='SitePrefs_Backup'")){
-				$sql->db_Insert('core', "'SitePrefs', '".addslashes($PrefCache)."'");
-			}
-
-			// traverse the pref array, with toDB on everything
-			$_pref = $tp -> toDB($pref, true, true);
-			// Create the data to be stored
-			$PrefCache1 = $eArrayStorage->WriteArray($_pref);
-			if(!$sql->db_Update('core', "e107_value='{$PrefCache1}' WHERE e107_name = 'SitePrefs'")){
-				$sql->db_Insert('core', "'SitePrefs', '{$PrefCache1}'");
-			}
-			ecache::clear('SitePrefs');
-		}
-	} else {
-
-		$_user_pref = $tp -> toDB($user_pref);
-
-		$tmp=addslashes(serialize($_user_pref));
-		$sql->db_Update("user", "user_prefs='$tmp' WHERE user_id=".intval($uid));
-		return $tmp;
-	}
+function save_prefs($table = 'core', $uid = USERID, $row_val = '')
+{
+  global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage;
+  if ($table == 'core')
+  {
+	if ($row_val == '')
+	{		// Save old version as a backup first
+	  $sql->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('SitePrefs_Backup', '".addslashes($PrefCache)."') ");
+
+	  // Now save the updated values
+	  // traverse the pref array, with toDB on everything
+	  $_pref = $tp -> toDB($pref, true, true);
+	  // Create the data to be stored
+	  $sql->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('SitePrefs', '".$eArrayStorage->WriteArray($_pref)."') ");
+	  ecache::clear('SitePrefs');
+	}
+  }
+  else
+  {
+	$_user_pref = $tp -> toDB($user_pref);
+	$tmp=addslashes(serialize($_user_pref));
+	$sql->db_Update("user", "user_prefs='$tmp' WHERE user_id=".intval($uid));
+	return $tmp;
+  }
 }
 
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 
 class e_online {
 	function online($online_tracking = false, $flood_control = false) {
-		if($online_tracking == true || $flood_control == true) {
+		if($online_tracking == true || $flood_control == true)
+		{
 			global $online_timeout, $online_warncount, $online_bancount;
 			if(!isset($online_timeout)) {
 				$online_timeout = 300;
@@ -1100,7 +1148,8 @@
 			$ip = $e107->getip();
 			$udata = (USER === true ? USERID.".".USERNAME : "0");
 
-			if (USER) {
+			if (USER)
+			{
 				// Find record that matches IP or visitor, or matches user info
 				if ($sql->db_Select("online", "*", "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'")) {
 					$row = $sql->db_Fetch();
@@ -1136,7 +1185,9 @@
 				} else {
 					$sql->db_Insert("online", " '".time()."', '0', '{$udata}', '{$ip}', '{$page}', 1, 0");
 				}
-			} else {
+			}
+			else
+			{
 				//Current page request is from a visitor
 				if ($sql->db_Select("online", "*", "`online_ip` = '{$ip}' AND `online_user_id` = '0'")) {
 					$row = $sql->db_Fetch();
@@ -1153,14 +1204,16 @@
 					}
 					$sql->db_Update("online", $query);
 				} else {
-					$sql->db_Insert("online", " '".time()."', 'null', '0', '{$ip}', '{$page}', 1, 0");
+					$sql->db_Insert("online", " '".time()."', '0', '0', '{$ip}', '{$page}', 1, 0");
 				}
 			}
 
-			if (ADMIN || $pref['autoban'] != 1) {
+		if (ADMIN || ($pref['autoban'] != 1 && $pref['autoban'] != 2) || (!isset($row['online_pagecount']))) // Auto-Ban is switched off. (0 or 3)
+			{
 				$row['online_pagecount'] = 1;
 			}
-			if ($row['online_pagecount'] > $online_bancount && $row['online_ip'] != "127.0.0.1") {
+
+			if ($row['online_pagecount'] > $online_bancount && ($row['online_ip'] != "127.0.0.1")) {
 				$sql->db_Insert("banlist", "'{$ip}', '0', 'Hit count exceeded ({$row['online_pagecount']} requests within allotted time)' ");
 				$e_event->trigger("flood", $ip);
 				exit;
@@ -1188,7 +1241,9 @@
 			define("GUESTS_ONLINE", $total_online - $members_online);
 			define("ON_PAGE", $sql->db_Count("online", "(*)", "WHERE `online_location` = '{$page}' "));
 			define("MEMBER_LIST", $member_list);
-		} else {
+		}
+		else
+		{
 			define("e_TRACKING_DISABLED", true);
 			define("TOTAL_ONLINE", "");
 			define("MEMBERS_ONLINE", "");
@@ -1352,17 +1407,17 @@
 // $something = pref;  // Bug if pref not set         ==> $something = varset(pref);
 // $something = isset(pref) ? pref : "";              ==> $something = varset(pref);
 // $something = isset(pref) ? pref : default;         ==> $something = varset(pref,default);
-// $something = isset(pref) && pref ? pref : default; ==> $something = varset(pref,default, true);
+// $something = isset(pref) && pref ? pref : default; ==> use varsettrue(pref,default)
 //
-function varset(&$val,$default='',$testvalue=false) {
+function varset(&$val,$default='') {
 	if (isset($val)) {
-		return (!$testvalue || $val) ? $val : $default;
+		return $val;
 	}
 	return $default;
 }
-function defset($str,$default='',$testvalue=false) {
+function defset($str,$default='') {
 	if (defined($str)) {
-		return (!$testvalue || constant($str)) ? constant($str) : $default;
+		return constant($str);
 	}
 	return $default;
 }
@@ -1386,7 +1441,7 @@
 }
 
 // -----------------------------------------------------------------------------
-function table_exists($check) {
+function table_exists($check) { 
 	if (!$GLOBALS['mySQLtablelist']) {
 		$tablist=mysql_list_tables($GLOBALS['mySQLdefaultdb']);
 		while (list($temp) = mysql_fetch_array($tablist)) {
@@ -1418,6 +1473,9 @@
 			if (ADMIN === TRUE) {
 				$clist[] = e_UC_ADMIN;
 			}
+			if (getperms('0')) {
+			  $clist[] = e_UC_MAINADMIN;
+			}
 		} else {
 			$clist[] = e_UC_GUEST;
 		}
@@ -1463,21 +1521,28 @@
 }
 
 if(!function_exists("print_a")) {
+	$charset = "utf-8";
+	if(defined("CHARSET")) {
+		$charset = CHARSET;
+	}
 	function print_a($var, $return = false) {
 		if(!$return){
-			echo '<pre>'.print_r($var, true).'</pre>';
+			echo '<pre>'.htmlspecialchars(print_r($var, true), ENT_QUOTES, $charset).'</pre>';
 			return true;
 		} else {
-			return '<pre>'.print_r($var, true).'</pre>';
+			return '<pre>'.htmlspecialchars(print_r($var, true), ENT_QUOTES, $charset).'</pre>';
 		}
 	}
 }
 
-function force_userupdate() {
 
+// Check that all required user fields (including extended fields) are valid.
+// Return TRUE if update required
+function force_userupdate()
+{
 	global $sql,$pref,$currentUser;
 
-	if (e_PAGE == "usersettings.php" || strpos(e_SELF, ADMINDIR) == TRUE)
+	if (e_PAGE == "usersettings.php" || strpos(e_SELF, ADMINDIR) == TRUE || (defined("FORCE_USERUPDATE") && (FORCE_USERUPDATE == FALSE)))
 	{
 		return FALSE;
 	}
@@ -1492,6 +1557,8 @@
 		}
     }
 
+	if (!varset($pref['disable_emailcheck'],TRUE) && !trim($currentUser['user_email'])) return TRUE;
+
 	if($sql -> db_Select("user_extended_struct", "user_extended_struct_name", "user_extended_struct_required = '1'"))
 	{
 		while($row = $sql -> db_Fetch())
@@ -1514,6 +1581,9 @@
 	var $debug = false;
 
 	function error_handler() {
+		//
+		// This is initialized before the current debug level is known
+		//
 		if ((isset($_SERVER['QUERY_STRING']) && strpos($_SERVER['QUERY_STRING'], 'debug=') !== FALSE) || isset($_COOKIE['e107_debug_level'])) {
 			$this->debug = true;
 			error_reporting(E_ALL);
@@ -1523,9 +1593,10 @@
 	}
 
 	function handle_error($type, $message, $file, $line, $context) {
+		$startup_error = (!defined('E107_DEBUG_LEVEL')); // Error before debug system initialized
 		switch($type) {
 			case E_NOTICE:
-			if ($this->debug == true) {
+			if ($startup_error || E107_DBG_ALLERRORS) {
 				$error['short'] = "Notice: {$message}, Line {$line} of {$file}<br />\n";
 				$trace = debug_backtrace();
 				$backtrace[0] = (isset($trace[1]) ? $trace[1] : "");
@@ -1535,7 +1606,7 @@
 			}
 			break;
 			case E_WARNING:
-			if ($this->debug == true) {
+			if ($startup_error || E107_DBG_BASIC) {
 				$error['short'] = "Warning: {$message}, Line {$line} of {$file}<br />\n";
 				$trace = debug_backtrace();
 				$backtrace[0] = (isset($trace[1]) ? $trace[1] : "");
@@ -1562,10 +1633,18 @@
 	function return_errors() {
 		$index = 0; $colours[0] = "#C1C1C1"; $colours[1] = "#B6B6B6";
 		$ret = "<table class='fborder'>\n";
-		foreach ($this->errors as $key => $value) {
-			$ret .= "\t<tr>\n\t\t<td class='forumheader3' >{$value['short']}</td><td><input class='button' type ='button' style='cursor: hand; cursor: pointer;' size='30' value='Back Trace' onclick=\"expandit('bt_{$key}')\" /></td>\n\t</tr>\n";
-			$ret .= "\t<tr>\n<td style='display: none;' colspan='2' id='bt_{$key}'>".print_a($value['trace'], true)."</td></tr>\n";
-			if($index == 0) { $index = 1; } else { $index = 0; }
+		if (E107_DBG_ERRBACKTRACE)
+		{
+			foreach ($this->errors as $key => $value) {
+				$ret .= "\t<tr>\n\t\t<td class='forumheader3' >{$value['short']}</td><td><input class='button' type ='button' style='cursor: hand; cursor: pointer;' size='30' value='Back Trace' onclick=\"expandit('bt_{$key}')\" /></td>\n\t</tr>\n";
+				$ret .= "\t<tr>\n<td style='display: none;' colspan='2' id='bt_{$key}'>".print_a($value['trace'], true)."</td></tr>\n";
+				if($index == 0) { $index = 1; } else { $index = 0; }
+			}
+		} else {
+			foreach ($this->errors as $key => $value)
+			{
+				$ret .= "<tr class='forumheader3'><td>{$value['short']}</td></tr>\n";
+			}
 		}
 		$ret .= "</table>";
 		return $ret;
@@ -1609,4 +1688,4 @@
 	}
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/comment.php 0.7.11.src/comment.php
--- 0.7.7.src/comment.php	2006-10-12 08:44:28.000000000 -0500
+++ 0.7.11.src/comment.php	2007-12-08 08:49:56.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/comment.php,v $
-|     $Revision: 1.52 $
-|     $Date: 2006/10/12 13:44:28 $
-|     $Author: lisa_ $
+|     $Revision: 1.55 $
+|     $Date: 2007/12/08 14:49:56 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -29,62 +29,80 @@
 $cobj =& new comment;
 
 $temp_query = explode(".", e_QUERY);
-$action = $temp_query[0];
-$table = $temp_query[1];
-$id = (isset($temp_query[2]) ? intval($temp_query[2]) : "");
-$nid = (isset($temp_query[3]) ? intval($temp_query[3]) : "");
-$xid = (isset($temp_query[4]) ? intval($temp_query[4]) : "");
+$action = $temp_query[0];			// Usually says 'comment' - may say 'reply'
+$table = $temp_query[1];			// Table containing item associated with comment(s)
+$id  = intval(varset($temp_query[2], ""));	// ID of item associated with comments (e.g. news ID)
+											// For reply with nested comments, its the ID of the comment
+$nid = intval(varset($temp_query[3], ""));	// Action - e.g. 'edit'. Or news ID for reply with nested comments
+$xid = intval(varset($temp_query[4], ""));	// ID of target comment
+global $comment_edit_query;
+//$comment_edit_query = '';
+//if ($temp_query[3] == 'edit') $comment_edit_query = $temp_query[0].".".$temp_query[1].".".$temp_query[2];
+$comment_edit_query = $temp_query[0].".".$temp_query[1].".".$temp_query[2];
 unset($temp_query);
 
-if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit'])) {
+if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit'])) 
+{
 	if(!ANON && !USER)
 	{
 		header("location: ".e_BASE."index.php");
 		exit;
 	}
 
-	if($table == "poll") {
-		if (!$sql->db_Select("polls", "poll_title", "`poll_id` = {$id} AND `poll_comment` = 1")) {
+	if($table == "poll") 
+	{
+		if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1")) 
+		{
 			header("location: ".e_BASE."index.php");
 			exit;
 		}
-	} else if($table == "news") {
-		if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = {$id} AND `news_allow_comments` = 0")) {
+	} else if($table == "news") 
+	{
+		if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0")) 
+		{
 			header("location: ".e_BASE."index.php");
 			exit;
 		}
 	}
 
-	$pid = (isset($_POST['pid']) ? $_POST['pid'] : 0);
-	$pid = intval($pid);
+//	$pid = (isset($_POST['pid']) ? $_POST['pid'] : 0);
+//	$pid = intval($pid);
+	$pid = intval(varset($_POST['pid'], 0));
 
-	$editpid = intval((isset($_POST['editpid']) ? $_POST['editpid'] : false));
+	$editpid = intval(varset($_POST['editpid'], 0));		// ID of the specific comment being edited
 
 	$clean_authorname = $_POST['author_name'];
 	$clean_comment = $_POST['comment'];
 	$clean_subject = $_POST['subject'];
 
 	$cobj->enter_comment($clean_authorname, $clean_comment, $table, $id, $pid, $clean_subject);
-	if ($table == "news") {
+	if ($table == "news") 
+	{
 		$e107cache->clear("news");
-	} else {
+	} 
+	else 
+	{
 		$e107cache->clear("comment.php?{$table}.{$id}");
 	}
 
-	if($editpid) {
+	if($editpid) 
+	{
 		$redir = preg_replace("#\.edit.*#si", "", e_QUERY);
 		header("Location: ".e_SELF."?{$redir}");
 		exit;
 	}
 }
 
+
 if (isset($_POST['replysubmit']))
 {
-
-	if ($table == "news" && !$sql->db_Select("news", "news_allow_comments", "news_id='{$nid}' ")) {
+	if ($table == "news" && !$sql->db_Select("news", "news_allow_comments", "news_id='{$nid}' ")) 
+	{
 		header("location:".e_BASE."index.php");
 		exit;
-	} else {
+	} 
+	else 
+	{
 		$row = $sql->db_Fetch();
 		if (!$row['news_id']) {
 			$pid = (isset($_POST['pid']) ? $_POST['pid'] : 0);
@@ -137,29 +155,41 @@
 	}
 }
 
-if ($action == "reply") {
-	if (!$pref['nested_comments']) {
+$comment_ob_start = FALSE;
+if ($action == "reply") 
+{
+	if (!$pref['nested_comments']) 
+	{
 		header("Location: ".e_BASE."comment.php?comment.{$table}.{$nid}");
 		exit;
 	}
+	
 	$query = "`comment_id` = '{$id}' LIMIT 0,1";
-	if ($sql->db_Select("comments", "comment_subject", "`comment_id` = '{$id}'")) {
+	if ($sql->db_Select("comments", "comment_subject", "`comment_id` = '{$id}'")) 
+	{
 		list($comments['comment_subject']) = $sql->db_Fetch();
-		$not_parsed_subject = $comments['comment_subject'];
-		$subject = $tp->toHTML($comments['comment_subject']);
-
+		$subject = $comments['comment_subject'];
+		$subject_header = $tp->toHTML($comments['comment_subject']);
 	}
-	if ($subject == "") {
-		if ($table == "news") {
-			if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' ")) {
-				header("location: ".e_BASE."index.php");
-				exit;
-			} else {
-				list($news['news_title']) = $sql->db_Fetch();
-				$subject = $news['news_title'];
-				$title = COMLAN_100;
-			}
-		} elseif ($table == "poll") {
+	
+	if ($subject == "") 
+	{
+	  if ($table == "news") 
+	  {
+		if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' ")) 
+		{
+		  header("location: ".e_BASE."index.php");
+		  exit;
+		} 
+		else 
+		{
+		  list($news['news_title']) = $sql->db_Fetch();
+		  $subject = $news['news_title'];
+		  $title = COMLAN_100;
+		}
+	  } 
+	  elseif ($table == "poll") 
+	  {
 			if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' ")) {
 				header("location:".e_BASE."index.php");
 				exit;
@@ -168,15 +198,21 @@
 				$subject = $poll['poll_title'];
 				$title = COMLAN_101;
 			}
-		} elseif ($table == "content") {
+	  } 
+	  elseif ($table == "content") 
+	  {
 			$sql->db_Select("content", "content_heading", "content_id='{$nid}'");
 			$subject = $content['content_heading'];
-		} elseif ($table == "bugtracker") {
+	  } 
+	  elseif ($table == "bugtracker") 
+	  {
 			$sql->db_Select("bugtrack", "bugtrack_summary", "bugtrack_id='{$nid}'");
 			$subject = $content['content_heading'];
-		}
+	  }
 	}
-	if ($table == "content") {
+
+	if ($table == "content") 
+	{
 		$sql->db_Select("content", "content_type", "content_id='{$nid}'");
 		list($content['content_type']) = $sql->db_Fetch();
 		if ($content['content_type'] == "0") {
@@ -193,22 +229,27 @@
 
 	define('e_PAGETITLE', $title." / ".COMLAN_99." / ".COMLAN_102.$subject."");
 	require_once(HEADERF);
-} else {
-
-
-	if ($cache = $e107cache->retrieve("comment.php?{$table}.{$id}")) {
+} 
+else 
+{
+	if ($cache = $e107cache->retrieve("comment.php?{$table}.{$id}")) 
+	{
 		require_once(HEADERF);
 		echo $cache;
 		require_once(FOOTERF);
 		exit;
-	} else {
-		if ($table == "news") {
+	} 
+	else 
+	{
+		if ($table == "news") 
+		{
 			/*
 			changes by jalist 19/01/05:
 			updated db query removed one call
 			*/
 
-			if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
+			if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) 
+			{
 				$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 				LEFT JOIN #user AS u ON n.news_author = u.user_id
 				LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
@@ -217,7 +258,9 @@
 				AND n.news_id={$id}
 				AND n.news_allow_comments=0
 				GROUP by n.news_id";
-			} else {
+			} 
+			else 
+			{
 				$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 				LEFT JOIN #user AS u ON n.news_author = u.user_id
 				LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
@@ -226,26 +269,34 @@
 				AND n.news_allow_comments=0";
 			}
 
-			if (!$sql->db_Select_gen($query)) {
+			if (!$sql->db_Select_gen($query)) 
+			{
 				header("location:".e_BASE."index.php");
 				exit;
-			} else {
+			} 
+			else 
+			{
 				$news = $sql->db_Fetch();
 				$subject = $tp->toForm($news['news_title']);
 				define("e_PAGETITLE", COMLAN_100." / ".COMLAN_99." / {$subject}");
 				require_once(HEADERF);
 				ob_start();
+				$comment_ob_start = TRUE;
 				$ix = new news;
 				$ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments.
 				$field = $news['news_id'];
 				$comtype = 0;
 			}
 		}
-		else if($table == "poll") {
-			if (!$sql->db_Select("polls", "*", "poll_id='{$id}'")) {
+		else if($table == "poll") 
+		{
+			if (!$sql->db_Select("polls", "*", "poll_id='{$id}'")) 
+			{
 				header("location:".e_BASE."index.php");
 				exit;
-			} else {
+			} 
+			else 
+			{
 				$row = $sql->db_Fetch();
 				$comments_poll = $row['poll_comment'];
 				$subject = $row['poll_title'];
@@ -266,18 +317,14 @@
 	}
 }
 
-if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news"){
+if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news")
+{
 	echo "<span class='smalltext'><b>".$pref['trackbackString']."</b> ".$e107->http_path.e_PLUGIN."trackback/trackback.php?pid={$id}</span>";
 }
 $field = ($field ? $field : ($id ? $id : ""));
 $width = (isset($width) && $width ? $width : "");
 $cobj->compose_comment($table, $action, $field, $width, $subject, $rate=FALSE);
 
-if (!strstr(e_QUERY, "poll")) {
-	$cache = ob_get_contents();
-	$e107cache->set("comment.php?{$table}.{$field}", $cache);
-}
-ob_end_flush(); // dump the buffer we started
 
 
 if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news"){
@@ -320,6 +367,13 @@
 	}
 }
 
+if (!strstr(e_QUERY, "poll")) 
+{
+  $cache = ob_get_contents();
+  $e107cache->set("comment.php?{$table}.{$field}", $cache);
+}
+if ($comment_ob_start) ob_end_flush(); // dump the buffer we started
+
 
 require_once(FOOTERF);
 
diff -x .svn -ruN 0.7.7.src/contact.php 0.7.11.src/contact.php
--- 0.7.7.src/contact.php	2006-11-09 13:57:47.000000000 -0600
+++ 0.7.11.src/contact.php	2007-09-06 02:25:25.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/contact.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/11/09 19:57:47 $
+|     $Revision: 1.13 $
+|     $Date: 2007/09/06 07:25:25 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -37,10 +37,11 @@
 
 	$error = "";
 
-	$sender_name = $tp->toEmail($_POST['author_name'],TRUE);
+	$sender_name = $tp->toEmail($_POST['author_name'],TRUE,"rawtext");
 	$sender = check_email($_POST['email_send']);
-	$subject = $tp->toEmail($_POST['subject'],TRUE);
-	$body = $tp->toEmail($_POST['body'],TRUE);
+	$subject = $tp->toEmail($_POST['subject'],TRUE,"rawtext");
+	$body = $tp->toEmail($_POST['body'],TRUE,"rawtext");
+
 
 // Check Image-Code
     if (isset($_POST['rand_num']) && !$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
@@ -66,6 +67,7 @@
     }
 
 
+
 // Check email address on remote server (if enabled).
 	if ($pref['signup_remote_emailcheck'] && $error == "")
 	{
@@ -88,7 +90,10 @@
     if(!$error)
 	{
 		$body .= "\n\nIP:\t".USERIP."\n";
-		$body .= "User:\t#".USERID." ".USERNAME."\n";
+		if(USERID !== FALSE)
+		{
+			$body .= "User:\t#".USERID." ".USERNAME."\n";
+		}
 
 		if(!$_POST['contact_person'] && isset($pref['sitecontacts'])) // only 1 person, so contact_person not posted.
 		{
@@ -102,12 +107,12 @@
 			}
 			else
 			{
-        		$query = $pref['sitecontacts'] . " IN (user_class) ";
+				$query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) ";
 			}
 		}
 		else
 		{
-      		$query = "user_id = ".$_POST['contact_person'];
+      		$query = "user_id = ".intval($_POST['contact_person']);
 		}
 
     	if($sql -> db_Select("user", "user_name,user_email",$query." LIMIT 1"))
diff -x .svn -ruN 0.7.7.src/content.php 0.7.11.src/content.php
--- 0.7.7.src/content.php	2005-12-24 16:53:38.000000000 -0600
+++ 0.7.11.src/content.php	2007-12-27 19:16:55.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/content.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2005/12/24 22:53:38 $
-|     $Author: sweetas $
+|     $Revision: 1.20 $
+|     $Date: 2007/12/28 01:16:55 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 	
@@ -30,6 +30,7 @@
 		//this will only work if the three main parents are not renamed !
 		if(!$sql -> db_Select("pcontent", "content_id", "content_heading='".$tp -> toDB($tmp[0])."'")){
 			header("location:".e_PLUGIN."content/content.php");
+			exit;
 		}else{
 			$row = $sql -> db_Fetch();
 		}
@@ -39,9 +40,13 @@
 			
 			$tmp[1] = intval($tmp[1]);
 			header("location:".e_PLUGIN."content/content.php?content.".$tmp[1]);
+			exit;
 
-		}else{											//content recent page
+		}
+		else
+		{											//content recent page
 			header("location:".e_PLUGIN."content/content.php?recent.".$row['content_id']);
+			exit;
 		}
 
 	}elseif ($tmp[0] == "article" || $tmp[0] == "review") {
@@ -49,25 +54,35 @@
 		if (is_numeric($tmp[1])) {						//item view
 			$tmp[1] = intval($tmp[1]);
 			header("location:".e_PLUGIN."content/content.php?content.".$tmp[1]);
-		
-		}elseif($tmp[1] == "cat" ) {					//category page
+			exit;
+		}
+		elseif($tmp[1] == "cat" ) {					//category page
 			
 			if(!$tmp[2] || $tmp[2] == "0") {			//all categories
 				//$mainparent = $aa -> getMainParent($tmp[2]);
 				//header("location:".e_PLUGIN."content/content.php?cat.list.".$mainparent."");
 				header("location:".e_PLUGIN."content/content.php");
+				exit;
 			
 			}else{										//view category
 				header("location:".e_PLUGIN."content/content.php?cat.".$tmp[2]);
+				exit;
 			}
 		
-		} else {										//recent page
+		}
+		else
+		{										//recent page
 			header("location:".e_PLUGIN."content/content.php?recent.".$row['content_id']);
+			exit;
 		}
-	}else{												//redirect to new content main page
+	}
+	else
+	{												//redirect to new content main page
 		header("location:".e_PLUGIN."content/content.php");
+		exit;
 	}
 }
+header("location:".e_BASE."index.php");
+exit;
 //##### END REDIRECTION MANAGEMENT -------------------------------------------------------------------------
-
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/download.php 0.7.11.src/download.php
--- 0.7.7.src/download.php	2006-11-11 22:10:15.000000000 -0600
+++ 0.7.11.src/download.php	2007-11-21 16:52:26.000000000 -0600
@@ -11,108 +11,175 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/download.php,v $
-|     $Revision: 1.77 $ - with modifications
-|     $Date: 2006/11/12 04:10:15 $
-|     $Author: mrpete $
+|     $Revision: 1.94 $ 
+|     $Date: 2007/11/21 22:52:26 $
+|     $Author: e107steved $
 |
-| Modifications by steved:
-|	1. Can display sub-categories which contain sub-sub categories and files
-|	2. New $pref['download_subsub'] - if defined and '0', doesn't display sub-sub categories
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
 require_once(e_HANDLER."comment_class.php");
 require_once(e_FILE."shortcode/batch/download_shortcodes.php");
-unset($text);
-$agreetext = $tp->toHTML($pref['agree_text'],TRUE,"parse_sc");
+
 $cobj = new comment;
 global $tp;
 
-if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:100%"); }
+$dl_text = '';			// Output variable
 
-// To prevent display of sub-categories on the main display, un-comment the following line
-//$pref['download_subsub'] = '0';
+if(!defined("USER_WIDTH")) { define("USER_WIDTH","width:100%"); }
 
+// Following two now set in prefs
+// To prevent display of sub-categories on the main display, change the value in the following line from '1' to '0'
+//$pref['download_subsub'] = '1';
+// To include file counts and sizes from subcategories and subsubcategories in superior categories, change the following to '1'
+//$pref['download_incinfo'] = '1';
 
 /* define images */
 define("IMAGE_DOWNLOAD", (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/".IMODE."/download.png"));
 define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/".IMODE."/new.png"));
 
-/* define image style */
+$template_load_core = '
+  $template_name = $load_template.".php";
+  if (is_readable(THEME."templates/".$template_name))
+  {
+	require_once(THEME."templates/".$template_name);
+  }
+  elseif (is_readable(THEME.$template_name))
+  {
+	require_once(THEME.$template_name);
+  }
+  else
+  {
+	require_once(e_THEME."templates/".$template_name);
+  }
+';
+
 
 if (!e_QUERY || $_GET['elan'])
 {
-	require_once(HEADERF);
-	// no qs - render categories ...
-
-	if($cacheData = $e107cache->retrieve("download_cat",720)) // expires every 12 hours.
-	{
-		echo $cacheData;
+  $action = 'maincats';		// List categories
+  $maincatval = '';			// Show all main categories
+}
+else
+{	// Get parameters from the query
+  $maincatval = '';			// Show all main categories
+  $tmp = explode(".", e_QUERY);
+  if (is_numeric($tmp[0]))			// $tmp[0] at least must be valid
+  {
+	$dl_from = intval($tmp[0]);
+	$action = varset(preg_replace("#\W#", "", $tp -> toDB($tmp[1])),'list');
+	$id = intval($tmp[2]);
+	$view = intval($tmp[3]);
+	$order = preg_replace("#\W#", "", $tp -> toDB($tmp[4]));
+	$sort = preg_replace("#\W#", "", $tp -> toDB($tmp[5]));
+  }
+  else
+  {
+	$action = preg_replace("#\W#", "", $tp -> toDB($tmp[0]));
+	$id = intval($tmp[1]);
+	$errnum = intval(varset($tmp[2],0));
+  }
+  switch ($action)
+  {
+    case 'list' :	// Category-based listing
+	  if (isset($_POST['view'])) extract($_POST);
+	  if (!isset($dl_from)) $dl_from = 0;
+
+	  // Get category type, page title
+	  if ($sql->db_Select("download_category", "download_category_name,download_category_description,download_category_parent,download_category_class", "(download_category_id='{$id}') AND (download_category_class IN (".USERCLASS_LIST."))") )
+	  {
+		$row = $sql->db_Fetch();
+		extract($row);
+		$type = $download_category_name;
+		$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
+		define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
+	  }
+	  else
+	  {  // No access to this category
+		define("e_PAGETITLE", PAGE_NAME);
+		require_once(HEADERF);
+		$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
 		require_once(FOOTERF);
 		exit;
-	}
+	  }
+	  if ($download_category_parent == 0)
+	  {  // It's a main category - change the listing type required
+	    $action = 'maincats';
+		$maincatval = $id;
+	  }
+	  break;
+	case 'view' :	// Details of individual download
+	  break;
+	case 'report' :
+	  break;
+	case 'mirror' :
+	  break;
+	case 'error' :		// Errors passed from request.php
+	  define("e_PAGETITLE", PAGE_NAME);
+	  require_once(HEADERF);
+	  switch ($errnum)
+	  {
+	    case 1 : 
+		  $errmsg = LAN_dl_63;			// No permissions
+		  break;
+		case 2 : 
+		  $errmsg = LAN_dl_62;			// Quota exceeded
+		  break;
+		default:
+		  $errmsg = LAN_dl_61." ".$errnum;		// Generic error - shouldn't happen
+	  }
+	  $ns->tablerender(LAN_dl_61, "<div style='text-align:center'>".$errmsg."</div>");
+	  require_once(FOOTERF);
+	  exit;
+  }
+}
 
+if (!isset($order))	$order = varset($pref['download_order'],"download_datestamp");
+if (!isset($sort))	$sort =  varset($pref['download_sort'], "DESC");
+if (!isset($view))	$view =  varset($pref['download_view'], "10");
 
-	if (!$DOWNLOAD_CAT_PARENT_TABLE)
+
+//--------------------------------------------------
+//			GENERATE DISPLAY TEXT
+//--------------------------------------------------
+switch ($action)
+{	// Displaying main category or categories
+  case 'maincats' :
+    require_once(HEADERF);
+	if ($cacheData = $e107cache->retrieve("download_cat".$maincatval,720)) // expires every 12 hours.
 	{
-		if (is_readable(THEME."templates/download_template.php"))
-		{
-			require_once(THEME."templates/download_template.php");
-		}
-		elseif (is_readable(THEME."download_template.php"))
-		{
-			require_once(THEME."download_template.php");
-		}
-		else
-		{
-			require_once(e_BASE.$THEMES_DIRECTORY."templates/download_template.php");
-		}
+	  echo $cacheData;
+	  require_once(FOOTERF);
+	  exit;
 	}
+
+	// Load the theme
+	$load_template = 'download_template';
+	if (!isset($DOWNLOAD_CAT_PARENT_TABLE)) eval($template_load_core);
+
     if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
 
-	$qry = "
-	SELECT dc.*, SUM(d.download_filesize) AS d_size,
-	COUNT(d.download_id) AS d_count,
-	MAX(d.download_datestamp) as d_last,
-	SUM(d.download_requested) as d_requests,
-	COUNT(d2.download_id) AS d_subcount,
-	SUM(d2.download_filesize) AS d_subsize,
-	SUM(d2.download_requested) as d_subrequests
-	FROM #download_category AS dc
-	LEFT JOIN #download AS d ON dc.download_category_id = d.download_category AND d.download_active > 0 AND d.download_visible IN (".USERCLASS_LIST.")
-	LEFT JOIN #download_category as dc2 ON dc2.download_category_parent=dc.download_category_id
-	LEFT JOIN #download AS d2 ON dc2.download_category_id = d2.download_category AND d2.download_active > 0 AND d2.download_visible IN (".USERCLASS_LIST.")
-	WHERE dc.download_category_class IN (".USERCLASS_LIST.")
-	GROUP by dc.download_category_id ORDER by dc.download_category_order
-	";
-	if (!$sql->db_Select_gen($qry))
+	// Read in tree of categories which this user is allowed to see
+    $dl = new down_cat_handler(varset($pref['download_subsub'],1),USERCLASS_LIST,$maincatval,varset($pref['download_incinfo'],FALSE));
+
+	if ($dl->down_count == 0)
 	{
-		$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
-		require_once(FOOTERF);
-		exit;
+	  $ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_2."</div>");
+	  require_once(FOOTERF);
+	  exit;
 	}
 	else
 	{
-		while($row = $sql->db_Fetch())
+	  $download_cat_table_string = "";    // Notice removal
+	  foreach($dl->cat_tree as $row)
+	  {  // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
+		$download_cat_table_string .= parse_download_cat_parent_table($row);
+		foreach($row['subcats'] as $crow)
 		{
-			$catList[$row['download_category_parent']][] = $row;
-		}
-		foreach($catList[0] as $row)
-		{  // Display main category headings, then sub-categories, optionally with sub-sub categories expanded
-			$download_cat_table_string .= parse_download_cat_parent_table($row);
-			foreach($catList[$row['download_category_id']] as $crow)
-			{
-			  if (isset($pref['download_subsub']) && ($pref['download_subsub'] == '0'))
-			  {  // Don't display sub-sub categories here
-				$download_cat_table_string .= parse_download_cat_child_table($crow, FALSE);
-			  }
-			  else
-			  {		// Display sub-sub categories
-				$download_cat_table_string .= parse_download_cat_child_table($crow, $catList[$crow['download_category_id']]);
-			  }
-			}
+		  $download_cat_table_string .= parse_download_cat_child_table($crow);
 		}
+	  }
 	}
 
 	$download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
@@ -128,42 +195,28 @@
 		</form>";
 
 	$download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
-	$text .= $download_cat_table_start.$download_cat_table_string.$download_cat_table_end;
-
+	$dl_text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end; 
 
 	ob_start();
 
-	if($DOWNLOAD_CAT_TABLE_RENDERPLAIN) {
-		echo $text;
-	} else {
-		$ns->tablerender(LAN_dl_18.$type, $text);
+	if(isset($DOWNLOAD_CAT_TABLE_RENDERPLAIN) && $DOWNLOAD_CAT_TABLE_RENDERPLAIN)
+	{
+	  echo $dl_text;
+	}
+	else 
+	{
+	  $ns->tablerender(LAN_dl_18, $dl_text);
 	}
 
 	$cache_data = ob_get_flush();
-	$e107cache->set("download_cat", $cache_data);
+	$e107cache->set("download_cat".$maincatval, $cache_data);
 
 	require_once(FOOTERF);
 	exit;
-}
+  // Add other 'cases' here
+}  // End switch ($action)
 
 
-// Got a query string from now on
-$tmp = explode(".", e_QUERY);
-if (is_numeric($tmp[0]))
-{
-	$from = intval($tmp[0]);
-	$action = preg_replace("#\W#", "", $tp -> toDB($tmp[1]));
-	$id = intval($tmp[2]);
-	$view = intval($tmp[3]);
-	$order = preg_replace("#\W#", "", $tp -> toDB($tmp[4]));
-	$sort = preg_replace("#\W#", "", $tp -> toDB($tmp[5]));
-}
- else
-{
-	$action = preg_replace("#\W#", "", $tp -> toDB($tmp[0]));
-	$id = intval($tmp[1]);
-}
-
 if (isset($_POST['commentsubmit']))
 {
 	if (!$sql->db_Select("download", "download_comment", "download_id = '{$id}' "))
@@ -181,58 +234,22 @@
 			$clean_subject = $_POST['subject'];
 
 			$cobj->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject);
-			$e107cache->clear("comment.download.{$sub_action}");
+//			$e107cache->clear("comment.download.{$sub_action}");	$sub_action not used here
+			$e107cache->clear("comment.download");
 		}
 	}
 }
 
-//  -------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-if ($action == "list") {
-
-	if (isset($_POST['view'])) {
-		extract($_POST);
-	}
-
-	if (!$from) {
-		$from = 0;
-	}
-	if (!$order) {
-		$order = ($pref['download_order'] ? $pref['download_order'] : "download_datestamp");
-	}
-	if (!$sort) {
-		$sort = ($pref['download_sort'] ? $pref['download_sort'] : "DESC");
-	}
-	if (!$view) {
-		$view = ($pref['download_view'] ? $pref['download_view'] : "10");
-	}
-
-	$total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
-
-// Next three lines extract page title
-	if ($sql->db_Select("download_category", "*", "(download_category_id='{$id}') AND (download_category_class IN (".USERCLASS_LIST."))") )
-	{
-	$row = $sql->db_Fetch();
-	extract($row);
-
-	$type = $download_category_name;
-
-	$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
-	define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
-	}
-	else
-	{  // No access to this category
-	  define("e_PAGETITLE", PAGE_NAME);
-	  require_once(HEADERF);
-	  $ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
-	  require_once(FOOTERF);
-	  exit;
-	}
+//====================================================
+//				LIST
+//====================================================
+if ($action == "list") 
+{
+  $total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
 
-	require_once(HEADERF);
+  require_once(HEADERF);
 
 	/* SHOW SUBCATS ... */
-
 	if($sql -> db_Select("download_category", "download_category_id", "download_category_parent='{$id}' "))
 	{
 		/* there are subcats - display them ... */
@@ -249,18 +266,10 @@
 		";
 		$sql->db_Select_gen($qry);
 		$scArray = $sql -> db_getList();
-		if (!$DOWNLOAD_CAT_PARENT_TABLE)
-		{
-			if (file_exists(THEME."download_template.php"))
-			{
-				require_once(THEME."download_template.php");
-			}
-			else
-			{
-				require_once(e_BASE.$THEMES_DIRECTORY."templates/download_template.php");
-			}
-		}
+		$load_template = 'download_template';
+		if (!isset($DOWNLOAD_CAT_PARENT_TABLE)) eval($template_load_core);
 		if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
+
 		foreach($scArray as $row)
 		{
 			$download_cat_table_string .= parse_download_cat_child_table($row, FALSE);
@@ -303,24 +312,18 @@
 	$DOWNLOAD_CATEGORY_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
 
 	$DOWNLOAD_CATEGORY = $tp->toHTML($download_category_name,FALSE,"emotes_off, no_make_clickable");
-	$DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE);
+	$DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE,'description');
 
-	if (!$DOWNLOAD_LIST_TABLE) {
-		if (file_exists(THEME."download_template.php")) {
-			require_once(THEME."download_template.php");
-		} else {
-			require_once(e_BASE.$THEMES_DIRECTORY."templates/download_template.php");
-		}
-	}
+	$load_template = 'download_template';
+	if (!isset($DOWNLOAD_LIST_TABLE)) eval($template_load_core);
     if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
 
 	$gen = new convert;
 	require_once(e_HANDLER."rate_class.php");
 	$rater = new rater;
-	$sql = new db;
-	 $sql2 = new db;
+	$tdownloads = 0;
 
-	$filetotal = $sql->db_Select("download", "*", "download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.") ORDER BY {$order} {$sort} LIMIT {$from}, {$view}");
+	$filetotal = $sql->db_Select("download", "*", "download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.") ORDER BY {$order} {$sort} LIMIT {$dl_from}, {$view}");
 	$ft = ($filetotal < $view ? $filetotal : $view);
 	while ($row = $sql->db_Fetch()) {
 		extract($row);
@@ -336,27 +339,42 @@
 	$text .= $download_list_table_start.$download_list_table_string.$download_list_table_end;
 
 
-	if($DOWNLOAD_LIST_TABLE_RENDERPLAIN) {
+	if ($filetotal)
+	{  // Only show list if some files in it
+	  if($DOWNLOAD_LIST_TABLE_RENDERPLAIN) 
+	  {
 		echo $text;
-	} else {
+	  } 
+	  else 
+ 	  {
 		$ns->tablerender($type, $text);
+	  }
 	}
 
+	if(!isset($DOWNLOAD_LIST_NEXTPREV))
+	{
+        $sc_style['DOWNLOAD_LIST_NEXTPREV']['pre'] = "<div class='nextprev'>";
+		$sc_style['DOWNLOAD_LIST_NEXTPREV']['post'] = "</div>";
+
+    	$DOWNLOAD_LIST_NEXTPREV = "
+			<div style='text-align:center;margin-left:auto;margin-right:auto'>{DOWNLOAD_BACK_TO_CATEGORY_LIST}<br /><br />
+            {DOWNLOAD_LIST_NEXTPREV}
+			</div>";
+    }
 
-	echo "<div style='text-align:center;margin-left:auto;margin-right:auto'><a href='".e_SELF."'>".LAN_dl_9."</a><br /><br />";
-	$parms = $total_downloads.",".$view.",".$from.",".e_SELF."?[FROM].list.{$id}.{$view}.{$order}.{$sort}.";
-	echo ($total_downloads > $view) ? "<div class='nextprev'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>" : "";
-    echo "</div>";
+	$nextprev_parms = $total_downloads.",".$view.",".$dl_from.",".e_SELF."?[FROM].list.{$id}.{$view}.{$order}.{$sort}.";
+    echo $tp->parseTemplate($DOWNLOAD_LIST_NEXTPREV, TRUE, $download_shortcodes);
 
 	require_once(FOOTERF);
 	exit;
 }    // end of action=="list"
 
 
-//  ---------------- View Mode ---------------------------------------------------------------------------------------------------------------------------------------------------
-
-if ($action == "view") {
-
+//====================================================
+//				VIEW
+//====================================================
+if ($action == "view") 
+{
 	$gen = new convert;
 
 	$highlight_search = FALSE;
@@ -381,15 +399,8 @@
 
 	$dl = $sql -> db_Fetch();
 
-	if (!isset($DOWNLOAD_VIEW_TABLE) && is_readable(THEME."download_template.php"))
-	{
-		include_once(THEME."download_template.php");
- 	}
-	else
-	{
-        include_once(e_THEME."templates/download_template.php");
-	}
-
+	$load_template = 'download_template';
+	if (!isset($DOWNLOAD_VIEW_TABLE)) eval($template_load_core);
 	if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
     if(!isset($DL_VIEW_PAGETITLE))
 	{
@@ -445,9 +456,11 @@
 
 }
 
-//  ---------------- Report Broken Link Mode ---------------------------------------------------------------------------------------------------------------------------------------------------
-
-if ($action == "report" && check_class($pref['download_reportbroken'])) {
+//====================================================
+//				REPORT BROKEN LINKS
+//====================================================
+if ($action == "report" && check_class($pref['download_reportbroken'])) 
+{
 	if (!$sql->db_Select("download", "*", "download_id = {$id} AND download_active > 0")) {
 		require_once(HEADERF);
 		require_once(FOOTERF);
@@ -513,20 +526,16 @@
 	exit;
 }
 
-//  ---------------- Mirror Mode ---------------------------------------------------------------------------------------------------------------------------------------------------
-
 
+//====================================================
+//				MIRRORS
+//====================================================
 if($action == "mirror")
 {
 	require_once(HEADERF);
 
-	if (!$DOWNLOAD_MIRROR_START) {
-		if (file_exists(THEME."download_template.php")) {
-			require_once(THEME."download_template.php");
-		} else {
-			require_once(e_BASE.$THEMES_DIRECTORY."templates/download_template.php");
-		}
-	}
+	$load_template = 'download_template';
+	if (!isset($DOWNLOAD_MIRROR_START)) eval($template_load_core);
 
 	$sql -> db_Select("download_mirror");
 	$mirrorList = $sql -> db_getList("ALL", 0, 200, "mirror_id");
@@ -623,112 +632,97 @@
 	}
 }
 
-function parse_download_cat_parent_table($row) {
+
+
+
+function parse_download_cat_parent_table($row) 
+{
 	global $tp,$current_row,$DOWNLOAD_CAT_PARENT_TABLE;
 	extract($row);
 	$current_row = ($current_row) ? 0 : 1;  // Alternating CSS for each row.(backwards compatible)
 
-
 	$template = ($current_row == 1) ? $DOWNLOAD_CAT_PARENT_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_PARENT_TABLE);
 
-	if (check_class($download_category_class)) {
-		$parent_status == "open";
+	$DOWNLOAD_CAT_MAIN_ICON = '';
+	$DOWNLOAD_CAT_MAIN_NAME = '';
+	$DOWNLOAD_CAT_MAIN_DESCRIPTION = '';
+	
+	if (check_class($download_category_class)) 
+	{
 		if(strstr($download_category_icon, chr(1)))
 		{
 			list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
 		}
-		$DOWNLOAD_CAT_MAIN_ICON .= ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
-		$DOWNLOAD_CAT_MAIN_NAME .= $tp->toHTML($download_category_name,FALSE,"emotes_off, no_make_clickable");
-	} else {
-		$parent_status == "closed";
+		$DOWNLOAD_CAT_MAIN_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
+		$DOWNLOAD_CAT_MAIN_NAME = $tp->toHTML($download_category_name,FALSE,"emotes_off, no_make_clickable");
+		$DOWNLOAD_CAT_MAIN_DESCRIPTION = $tp->toHTML($row['download_category_description'],TRUE,'DESCRIPTION');
 	}
 	return(preg_replace("/\{(.*?)\}/e", '$\1', $template));
 }
 
-function parse_download_cat_child_table($row, $subList)
-{
 
+	  function get_cat_icons($source, $count)
+	  {
+	    if (!$source) return "&nbsp;";
+	    list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1));
+	    if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE];
+		return 	"<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='' style='float: left' />";
+	  }
+	
+	  function check_new_download($last_val)
+	  {
+		if(USER && ($last_val > USERLV))
+		{
+		  return "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
+		}
+		else
+		{
+		  return "";
+		}
+	  }
+
+
+function parse_download_cat_child_table($row)
+{
 	global $tp,$current_row, $DOWNLOAD_CAT_CHILD_TABLE, $DOWNLOAD_CAT_SUBSUB_TABLE;
 
 	$current_row = ($current_row) ? 0 : 1;  // Alternating CSS for each row.(backwards compatible)
 	$template = ($current_row == 1) ? $DOWNLOAD_CAT_CHILD_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_CHILD_TABLE);
-
-
-	if(USER && $row['d_last'] > USERLV){
-		$new = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
-	}else{
-		$new = "";
-	}
-
-	list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $row['download_category_icon']);
-	if (!$download_category_icon_empty)
-	{
-		$download_category_icon_empty = $download_category_icon;
-	}
-
-	if(!$row['d_count'] && !$row['d_subcount'])
-	{
-		$download_icon = "<img src='".e_IMAGE."icons/{$download_category_icon_empty}' alt='' style='float: left' />";
-	}
-	else
-	{
-		$download_icon = "<img src='".e_IMAGE."icons/{$download_category_icon}' alt='' style='float: left' />";
-	}
-
-	$DOWNLOAD_CAT_SUB_ICON = ($row['download_category_icon'] ? $download_icon : "&nbsp;");
-	$DOWNLOAD_CAT_SUB_NEW_ICON = $new;
+	
+	$DOWNLOAD_CAT_SUB_ICON = get_cat_icons($row['download_category_icon'],$row['d_count']);
+	$DOWNLOAD_CAT_SUB_NEW_ICON = check_new_download($row['d_last_subs']);
 	$dcatname=$tp->toHTML($row['download_category_name'],FALSE,"emotes_off, no_make_clickable");
 	$DOWNLOAD_CAT_SUB_NAME = ($row['d_count'] ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$dcatname."</a>" : $dcatname);
-	$DOWNLOAD_CAT_SUB_NAME_LINKED = "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$$dcatname."</a>";
-	$DOWNLOAD_CAT_SUB_DESCRIPTION = $tp->toHTML($row['download_category_description']);
-	$DOWNLOAD_CAT_SUB_COUNT = ($row['d_subcount'] ? $row['d_subcount'] : $row['d_count']);
-	$DOWNLOAD_CAT_SUB_SIZE = parsesize(($row['d_subsize'] ? $row['d_subsize'] : $row['d_size']));
-	$DOWNLOAD_CAT_SUB_DOWNLOADED = intval(($row['d_subrequests'] ? $row['d_subrequests'] : $row['d_requests']));
+	$DOWNLOAD_CAT_SUB_NAME_LINKED = "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$dcatname."</a>";
+	$DOWNLOAD_CAT_SUB_DESCRIPTION = $tp->toHTML($row['download_category_description'],TRUE,'description');
+	$DOWNLOAD_CAT_SUB_COUNT = $row['d_count'];
+	$DOWNLOAD_CAT_SUB_SIZE = parsesize( $row['d_size']);
+	$DOWNLOAD_CAT_SUB_DOWNLOADED = intval( $row['d_requests']);
 	$DOWNLOAD_CAT_SUBSUB = "";
 	// check for subsub cats ...
-	if($subList != FALSE)
+	foreach($row['subsubcats'] as $subrow)
 	{
-		foreach($subList as $subrow)
-		{
-			list($sub_download_category_icon, $sub_download_category_icon_empty) = explode(chr(1), $subrow['download_category_icon']);
-			if (!$sub_download_category_icon_empty)
-			{
-				$sub_download_category_icon_empty = $sub_download_category_icon;
-			}
-
-			if(!$row['d_count'] && !$row['d_subcount'])
-			{
-				$sub_download_icon = "<img src='".e_IMAGE."icons/{$sub_download_category_icon_empty}' alt='' style='float: left' />";
-			}
-			else
-			{
-				$sub_download_icon = "<img src='".e_IMAGE."icons/{$sub_download_category_icon}' alt='' style='float: left' />";
-			}
-
-			$DOWNLOAD_CAT_SUBSUB_ICON = ($subrow['download_category_icon'] ? "$sub_download_icon" : "&nbsp;");
-			$DOWNLOAD_CAT_SUBSUB_DESCRIPTION = $tp->toHTML($subrow['download_category_description']);
-			$DOWNLOAD_CAT_SUBSUB_COUNT = intval($subrow['d_count']);
-			$DOWNLOAD_CAT_SUBSUB_SIZE = parsesize($subrow['d_size']);
-			$DOWNLOAD_CAT_SUBSUB_DOWNLOADED = intval($subrow['d_requests']);
-
-			if(USER && $subrow['d_last'] > USERLV)	{
-				$subsub_new = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
-			}else {
-				$subsub_new = "";
-			}
-			$DOWNLOAD_CAT_SUBSUB_NEW_ICON = $subsub_new;
-			$DOWNLOAD_CAT_SUBSUB_NAME = ($subrow['d_count'] ? "<a href='".e_BASE."download.php?list.".$subrow['download_category_id']."'>".$tp->toHTML($subrow['download_category_name'])."</a>" : $tp->toHTML($subrow['download_category_name'],FALSE,"emotes_off, no_make_clickable"));
-			$DOWNLOAD_CAT_SUBSUB .= preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_SUBSUB_TABLE);
-		}
+	  $DOWNLOAD_CAT_SUBSUB_ICON = get_cat_icons($subrow['download_category_icon'],$subrow['d_count']);
+	  $DOWNLOAD_CAT_SUBSUB_DESCRIPTION = $tp->toHTML($subrow['download_category_description'],TRUE,'description');
+	  $DOWNLOAD_CAT_SUBSUB_COUNT = intval($subrow['d_count']);
+	  $DOWNLOAD_CAT_SUBSUB_SIZE = parsesize($subrow['d_size']);
+	  $DOWNLOAD_CAT_SUBSUB_DOWNLOADED = intval($subrow['d_requests']);
+
+	  $DOWNLOAD_CAT_SUBSUB_NEW_ICON = check_new_download($subrow['d_last']);
+	  $DOWNLOAD_CAT_SUBSUB_NAME = ($subrow['d_count'] ? "<a href='".e_BASE."download.php?list.".$subrow['download_category_id']."'>".$tp->toHTML($subrow['download_category_name'])."</a>" : $tp->toHTML($subrow['download_category_name'],FALSE,"emotes_off, no_make_clickable"));
+	  $DOWNLOAD_CAT_SUBSUB .= preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_SUBSUB_TABLE);
 	}
 
 	return(preg_replace("/\{(.*?)\}/e", '$\1', $template));
 }
 
 
-function parse_download_list_table($row) {
+function parse_download_list_table($row) 
+{
+// ***** $agreetext may not need to be global
 	global $download_shortcodes,$tp,$current_row,$DOWNLOAD_LIST_TABLE, $rater, $pref, $gen, $agreetext;
 
+	$agreetext = $tp->toHTML($pref['agree_text'],TRUE,"parse_sc");
 	$current_row = ($current_row) ? 0 : 1;  // Alternating CSS for each row.(backwards compatible)
 	$template = ($current_row == 1) ? $DOWNLOAD_LIST_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_LIST_TABLE);
 
@@ -736,4 +730,155 @@
 
 }
 
+
+//=============================================
+//		DOWNLOAD CATEGORY CLASS
+//=============================================
+
+class down_cat_handler
+{
+  var $cat_tree;			// Initialised with all categories in a tree structure
+  var $cat_count;			// Count visible subcats and subsubcats
+  var $down_count;			// Counts total downloads
+  
+  function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
+  {  // Constructor - make a copy of the tree for re-use
+     // $nest_level = 0 merges subsubcats with subcats. >0 creates full tree.
+	 // If load-class non-null, assumed to be a 'class set' such as USERCLASS_LIST
+	 // If $accum is TRUE, include file counts and sizes in superior categories
+	define("SUB_PREFIX","-->");				// Added in front of sub categories
+	define("SUBSUB_PREFIX","---->");		// Added in front of sub-sub categories
+    $this->cat_tree = $this->down_cat_tree($nest_level,$load_class, $main_cat_load, $accum);
+  }
+  
+  
+// Function returns a 'tree' of download categories, subcategories, and sub-sub-categories.
+// Returns empty array if nothing defined
+// Within the 'main category' level of the nesting, array 'subcats' has the next level's info
+// Within the 'sub-category' level of the nesting, array 'subsubcats' has the next level's info
+// If $main_cat_load is numeric, and the value of a 'main' category, only that main category is displayed.
+//		(Unpredictable if $main_cat_load is some other category)
+	function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
+	{
+	  global $sql2;
+
+	  $catlist = array();
+	  $this->cat_count = 0;
+	  $this->down_count = 0;
+	  $temp2 = "";
+	  $temp1 = "";
+	  if ($load_cat_class != "")
+	  {
+		$temp1 = " WHERE dc.download_category_class IN ({$load_cat_class}) ";
+		$temp2 = "AND d.download_visible IN ({$load_cat_class}) ";
+	  }
+	  
+	  $qry = "
+	  SELECT dc.*, 
+	  dc1.download_category_parent AS d_parent1, dc1.download_category_order,
+	  SUM(d.download_filesize) AS d_size, 
+	  COUNT(d.download_id) AS d_count,
+	  MAX(d.download_datestamp) as d_last,
+	  SUM(d.download_requested) as d_requests
+	  FROM #download_category as dc 
+	  LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent 
+	  LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent 
+	  LEFT JOIN #download AS d on d.download_category = dc.download_category_id AND d.download_active > 0 {$temp2}
+	  {$temp1}
+	  GROUP by dc.download_category_id
+	  ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order";   // This puts main categories first, then sub-cats, then sub-sub cats
+
+  	  if (!$sql2->db_Select_gen($qry)) return $catlist;
+	  
+	  while ($row = $sql2->db_Fetch()) 
+	  {
+	    $tmp = $row['download_category_parent'];
+	    if ($tmp == '0')
+	    {  // Its a main category
+		  if (!is_numeric($main_cat_load) || ($main_cat_load == $row['download_category_id']))
+		  {
+		    $row['subcats'] = array();
+	        $catlist[$row['download_category_id']] = $row;
+		  }
+	    }
+	    else
+	    {
+	      if (isset($catlist[$tmp]))
+		  {  // Sub-Category
+		    $this->cat_count++;
+			$this->down_count += $row['d_count'];
+		    $catlist[$tmp]['subcats'][$row['download_category_id']] = $row;
+		    $catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array();
+		    $catlist[$tmp]['subcats'][$row['download_category_id']]['d_last_subs'] = 
+					$catlist[$tmp]['subcats'][$row['download_category_id']]['d_last'];
+		  }
+		  else
+		  {  // Its a sub-sub category
+		    if (isset($catlist[$row['d_parent1']]['subcats'][$tmp]))
+			{
+		      $this->cat_count++;
+			  $this->down_count += $row['d_count'];
+			  if ($accum || ($nest_level == 0))
+			  {  // Add the counts into the subcategory values
+				$catlist[$row['d_parent1']]['subcats'][$tmp]['d_size'] += $row['d_size'];
+				$catlist[$row['d_parent1']]['subcats'][$tmp]['d_count'] += $row['d_count'];
+				$catlist[$row['d_parent1']]['subcats'][$tmp]['d_requests'] += $row['d_requests'];
+			  }
+		      if ($nest_level == 0)
+			  {  // Reflect subcat dates in category
+				if ($catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] < $row['d_last'])
+				    $catlist[$row['d_parent1']]['subcats'][$tmp]['d_last'] = $row['d_last'];
+			  }
+			  else
+		      {
+		        $catlist[$row['d_parent1']]['subcats'][$tmp]['subsubcats'][$row['download_category_id']] = $row;
+		      }
+		       // Separately accumulate 'last update' for subcat plus associated subsubcats
+			  if ($catlist[$row['d_parent1']]['subcats'][$tmp]['d_last_subs'] < $row['d_last'])
+				    $catlist[$row['d_parent1']]['subcats'][$tmp]['d_last_subs'] = $row['d_last'];
+			}
+	      }
+	    }
+	  }
+	  return $catlist;
+	}
+
+	
+// Rest of the class isn't actually used normally, but print_tree() might help with debug	
+
+    function print_cat($cat, $prefix,$postfix)
+	{
+	  $text = "<tr><td>".$cat['download_category_id']."</td><td>".$cat['download_category_parent']."</td><td>";
+	  $text .= $prefix.htmlspecialchars($cat['download_category_name']).$postfix."</td><td>".$cat['d_size']."</td>";
+	  $text .= "<td>".$cat['d_count']."</td><td>".$cat['d_requests']."</td><td>".strftime('%H:%M %d-%m-%Y',$cat['d_last'])."</td>";
+	  $text .= "</tr>";
+	  return $text;
+	}
+
+	function print_tree()
+	{ 
+	  echo "<table><tr><th>ID</th><th>Parent</th><th>Name</th><th>Bytes</th><th>Files</th><th>Requests</th><th>Last Download</th><tr>";
+	  foreach ($this->cat_tree as $thiscat)
+	  {  // Main categories
+		$scprefix = SUB_PREFIX;
+        echo $this->print_cat($thiscat,'<strong>','</strong>');
+	    foreach ($thiscat['subcats'] as $sc)
+	    {  // Sub-categories
+		  $sscprefix = SUBSUB_PREFIX;
+		  echo $this->print_cat($sc,$scprefix,'');
+		  foreach ($sc['subsubcats'] as $ssc)
+		  {  // Sub-sub categories
+		    echo $this->print_cat($ssc,$sscprefix,'');
+		  }
+		}
+	  }
+	  echo "</table>";
+	return;
+    }
+	
+}
+
+
+
+
 ?>
diff -x .svn -ruN 0.7.7.src/e107_admin/ad_links.php 0.7.11.src/e107_admin/ad_links.php
--- 0.7.7.src/e107_admin/ad_links.php	2006-02-16 15:51:39.000000000 -0600
+++ 0.7.11.src/e107_admin/ad_links.php	2006-12-01 00:41:19.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ad_links.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/02/16 21:51:39 $
-|     $Author: whoisrich $
+|     $Revision: 1.37 $
+|     $Date: 2006/12/01 06:41:19 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -442,7 +442,7 @@
 	8 => array(e_ADMIN."emoticon.php", ADLAN_58, ADLAN_59, "F", 1, E_16_EMOTE, E_32_EMOTE),
 	9 => array(e_ADMIN."filemanager.php", ADLAN_30, ADLAN_31, "6", 4, E_16_FILE, E_32_FILE),
 	10 => array(e_ADMIN."frontpage.php", ADLAN_60, ADLAN_61, "G", 1, E_16_FRONT, E_32_FRONT),
-	11 => array(e_ADMIN."image.php", ADLAN_105, ADLAN_106, "5", 1, E_16_IMAGES, E_32_IMAGES),
+	11 => array(e_ADMIN."image.php", ADLAN_105, ADLAN_106, "A", 1, E_16_IMAGES, E_32_IMAGES),
 	12 => array(e_ADMIN."links.php", ADLAN_138, ADLAN_139, "I", 1, E_16_LINKS, E_32_LINKS),
 	13 => array(e_ADMIN."wmessage.php", ADLAN_28, ADLAN_29, "M", 3, E_16_WELCOME, E_32_WELCOME),
 	14 => array(e_ADMIN."ugflag.php", ADLAN_40, ADLAN_41, "9", 4, E_16_MAINTAIN, E_32_MAINTAIN),
@@ -462,4 +462,4 @@
 	28 => array(e_ADMIN."fileinspector.php", ADLAN_147, ADLAN_148, "Y", 4, E_16_INSPECT, E_32_INSPECT),
 	29 => array(e_ADMIN."notify.php", ADLAN_149, ADLAN_150, "O", 4, E_16_NOTIFY, E_32_NOTIFY)
 	);
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_admin/admin.php 0.7.11.src/e107_admin/admin.php
--- 0.7.7.src/e107_admin/admin.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/admin.php	2007-06-11 14:27:34.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/admin.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.40 $
+|     $Date: 2007/06/11 19:27:34 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -145,13 +145,15 @@
 }
 
 // auto db update
-if ('0' == ADMINPERMS) {
-	require_once(e_ADMIN.'update_routines.php');
-	update_check();
+if ('0' == ADMINPERMS) 
+{
+  $dont_check_update = TRUE;		// This reduces frequency of checks
+  require_once(e_ADMIN.'update_routines.php');
+  update_check();
 }
 // end auto db update
 
-if (e_QUERY == 'purge') {
+if (e_QUERY == 'purge' && getperms('0')) {
 	$admin_log->purge_log_events(false);
 }
 
@@ -178,15 +180,15 @@
 			}
 			if ($mode == 'default') {
 				$text .= "<td class='td' style='text-align:left; vertical-align:top; width:20%; white-space:nowrap'
-					onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">".$icon." ".$tp->toHTML($title,FALSE,"defs emotes_off")."</td>";
+					onmouseover=\"eover(this, 'forumheader5')\" onmouseout=\"eover(this, 'td')\" onclick=\"document.location.href='".$link."'\">".$icon." ".$tp->toHTML($title,FALSE,"defs,emotes_off")."</td>";
 			}
 			else if ($mode == 'classis') {
 				$text .= "<td style='text-align:center; vertical-align:top; width:20%'><a href='".$link."' title='$description'>".$icon."</a><br />
-					<a href='".$link."' title='$description'><b>".$tp->toHTML($title,FALSE,"defs emotes_off")."</b></a><br /><br /></td>";
+					<a href='".$link."' title='$description'><b>".$tp->toHTML($title,FALSE,"defs,emotes_off")."</b></a><br /><br /></td>";
 			}elseif ($mode == 'beginner'){
                 $text .= "<td style='text-align:center; vertical-align:top; width:20%' ><a href='".$link."' >".$icon."</a>
 					<div style='padding:5px'>
-					<a href='".$link."' title='".$description."' style='text-decoration:none'><b>".$tp->toHTML($title,FALSE,"defs emotes_off")."</b></a></div><br /><br /><br /></td>";
+					<a href='".$link."' title='".$description."' style='text-decoration:none'><b>".$tp->toHTML($title,FALSE,"defs,emotes_off")."</b></a></div><br /><br /><br /></td>";
 			}
 			$td++;
 		}
@@ -211,27 +213,30 @@
 
 function admin_info() {
 	global $tp;
-	$text = "<div style='text-align:center'>
-		<table style='width: 100%; border-collapse:collapse; border-spacing:0px;'>
-		<tr>
-		<td style='width: 33%; vertical-align: top'>";
-
-	$text .= $tp->parseTemplate('{ADMIN_STATUS}');
-
-	$text .= "</td>
-		<td style='width: 33%; vertical-align: top'>";
 
-	$text .= $tp->parseTemplate('{ADMIN_LATEST}');
+	$width = (getperms('0')) ? "33%" : "50%";
 
-	$text .= "</td>
-		<td style='width: 33%; vertical-align: top'>";
+	$ADMIN_INFO_TEMPLATE = "
+	<div style='text-align:center'>
+		<table style='width: 100%; border-collapse:collapse; border-spacing:0px;'>
+		<tr>
+			<td style='width: ".$width."; vertical-align: top'>
+			{ADMIN_STATUS}
+			</td>
+			<td style='width:".$width."; vertical-align: top'>
+			{ADMIN_LATEST}
+			</td>";
 
-	$text .= $tp->parseTemplate('{ADMIN_LOG}');
+    	if(getperms('0'))
+		{
+			$ADMIN_INFO_TEMPLATE .= "
+			<td style='width:".$width."; vertical-align: top'>{ADMIN_LOG}</td>";
+    	}
 
-	$text .= "</td>
+   	$ADMIN_INFO_TEMPLATE .= "
 		</tr></table></div>";
 
-	return $text;
+	return $tp->parseTemplate($ADMIN_INFO_TEMPLATE);
 }
 
 function status_request() {
diff -x .svn -ruN 0.7.7.src/e107_admin/admin_log.php 0.7.11.src/e107_admin/admin_log.php
--- 0.7.7.src/e107_admin/admin_log.php	2006-10-25 16:13:28.000000000 -0500
+++ 0.7.11.src/e107_admin/admin_log.php	2006-11-30 21:56:09.000000000 -0600
@@ -11,13 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/admin_log.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/10/25 21:13:28 $
+|     $Revision: 1.9 $
+|     $Date: 2006/12/01 03:56:09 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-
+if (!getperms('0'))
+{
+	header('location:'.e_BASE.'index.php');
+	exit;
+}
 require_once("auth.php");
 $text = "";
 $amount = 30;
diff -x .svn -ruN 0.7.7.src/e107_admin/administrator.php 0.7.11.src/e107_admin/administrator.php
--- 0.7.7.src/e107_admin/administrator.php	2006-11-10 09:59:14.000000000 -0600
+++ 0.7.11.src/e107_admin/administrator.php	2007-10-05 00:31:14.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/administrator.php,v $
-|     $Revision: 1.33 $
-|     $Date: 2006/11/10 15:59:14 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.34 $
+|     $Date: 2007/10/05 05:31:14 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -191,7 +191,7 @@
 	$text .= checkb("Y", $a_perms).ADMSLAN_67."<br />";			// file inspector
 	$text .= checkb("O", $a_perms).ADMSLAN_68."<br />";			// notify
 	$text .= checkb("7", $a_perms).ADMSLAN_26."<br />";			// Oversee news categories
-	$text .= checkb("8", $a_perms).ADMSLAN_27."<br />";			// Oversee link categories
+  //	$text .= checkb("8", $a_perms).ADMSLAN_27."<br />";		// Oversee link categories - NOWPLUGIN
 	$text .= checkb("C", $a_perms).ADMSLAN_64."<br />";			// Clear Cache - Previously moderate chatbox
 	$text .= checkb("9", $a_perms).ADMSLAN_28."<br />";			// Take site down for maintenance
 	$text .= checkb("W", $a_perms).ADMSLAN_65."<br /><br />";	// Configure mail settings and mailout
@@ -212,7 +212,7 @@
 //	$text .= checkb("K", $a_perms).ADMSLAN_42."<br />";					// Post reviews    - NOW PLUGIN
 //	$text .= checkb("L", $a_perms).ADMSLAN_43."<br />";					// Post content pages - NOW PLUGIN
 	$text .= checkb("R", $a_perms).ADMSLAN_44."<br />";			// Post downloads
-	$text .= checkb("U", $a_perms).ADMSLAN_45."<br />";			// Post polls
+//	$text .= checkb("U", $a_perms).ADMSLAN_45."<br />";			// Post polls  - NOW PLUGIN.
 	$text .= checkb("M", $a_perms).ADMSLAN_46."<br />";			// Welcome message
 	$text .= checkb("N", $a_perms).ADMSLAN_47."<br /><br />";	// Moderate submitted news
 
diff -x .svn -ruN 0.7.7.src/e107_admin/auth.php 0.7.11.src/e107_admin/auth.php
--- 0.7.7.src/e107_admin/auth.php	2006-11-24 23:34:28.000000000 -0600
+++ 0.7.11.src/e107_admin/auth.php	2007-08-15 19:00:26.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/auth.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/11/25 05:34:28 $
+|     $Revision: 1.15 $
+|     $Date: 2007/08/16 00:00:26 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -23,152 +23,154 @@
 @include_once(e_LANGUAGEDIR."English/admin/lan_admin.php");
 if (ADMIN)
 {
-	define("ADMIN_PAGE", true);
-	require_once(e_ADMIN."header.php");
+    define("ADMIN_PAGE", true);
+    require_once(e_ADMIN."header.php");
 }
 else
 {
-	$use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
-	if ($use_imagecode)
-	{
-		require_once(e_HANDLER."secure_img_handler.php");
-		$sec_img = new secure_image;
-	}
-
-	if ($_POST['authsubmit'])
-	{
-		$obj = new auth;
-
-		if($use_imagecode)
-		{
-			if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
-			{
-				echo "<script type='text/javascript'>document.location.href='../index.php'</script>\n";
-				header("location: ../index.php");
-				exit;
-			}
-		}
-
-		$row = $authresult = $obj->authcheck($_POST['authname'], $_POST['authpass']);
-		if ($row[0] == "authfail") {
-			echo "<script type='text/javascript'>document.location.href='../index.php'</script>\n";
-			header("location: ../index.php");
-			exit;
-		} else {
-
-			$userpass = md5($_POST['authpass']);
-			$cookieval = $row['user_id'].".".md5($userpass);
-
-			$sql->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['authname'])."'");
-			list($user_id, $user_name, $userpass) = $sql->db_Fetch();
-			if ($pref['user_tracking'] == "session") {
-				$_SESSION[$pref['cookie_name']] = $cookieval;
-			} else {
-				cookie($pref['cookie_name'], $cookieval, (time()+3600 * 24 * 30));
-			}
-			echo "<script type='text/javascript'>document.location.href='admin.php'</script>\n";
-		}
-	}
-
-	$e_sub_cat = 'logout';
-	require_once(e_ADMIN."header.php");
-
-	if (ADMIN == FALSE) {
-		$obj = new auth;
-		$obj->authform();
-		require_once(e_ADMIN."footer.php");
-		exit;
-	}
+    $use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
+    if ($use_imagecode)
+    {
+        require_once(e_HANDLER."secure_img_handler.php");
+        $sec_img = new secure_image;
+    }
+
+    if ($_POST['authsubmit'])
+    {
+        $obj = new auth;
+
+        if($use_imagecode)
+        {
+            if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
+            {
+                echo "<script type='text/javascript'>document.location.href='../index.php'</script>\n";
+                header("location: ../index.php");
+                exit;
+            }
+        }
+
+        $row = $authresult = $obj->authcheck($_POST['authname'], $_POST['authpass']);
+        if ($row[0] == "authfail") {
+            echo "<script type='text/javascript'>document.location.href='../index.php'</script>\n";
+            header("location: ../index.php");
+            exit;
+        } else {
+
+            $userpass = md5($_POST['authpass']);
+            $cookieval = $row['user_id'].".".md5($userpass);
+
+            $sql->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['authname'])."'");
+            list($user_id, $user_name, $userpass) = $sql->db_Fetch();
+            if ($pref['user_tracking'] == "session") {
+                $_SESSION[$pref['cookie_name']] = $cookieval;
+            } else {
+                cookie($pref['cookie_name'], $cookieval, (time()+3600 * 24 * 30));
+            }
+            echo "<script type='text/javascript'>document.location.href='admin.php'</script>\n";
+        }
+    }
+
+    $e_sub_cat = 'logout';
+    require_once(e_ADMIN."header.php");
+
+    if (ADMIN == FALSE) {
+        $obj = new auth;
+        $obj->authform();
+        require_once(e_ADMIN."footer.php");
+        exit;
+    }
 }
 
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 class auth
 {
 
-	function authform()
-	{
-		/*
-		# Admin auth login
-		#
-		# - parameters	none
-		# - return		null
-		# - scope		public
-		*/
-
-		global $use_imagecode, $sec_img;
-
-		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."'>\n
-			<table style='width:50%' class='fborder'>
-			<tr>
-			<td style='width:35%' class='forumheader3'>".ADLAN_89."</td>
-			<td class='forumheader3' style='text-align:center'><input class='tbox' type='text' name='authname' size='30' value='$authname' maxlength='20' />\n</td>
-			</tr>
-			<tr>
-			<td style='width:35%' class='forumheader3'>".ADLAN_90."</td>
-			<td class='forumheader3' style='text-align:center'><input class='tbox' type='password' name='authpass' size='30' value='' maxlength='20' />\n</td>
-			</tr>
-			";
-
-		if ($use_imagecode) {
-			$text .= "
-			<tr>
-			<td style='width:35%' class='forumheader3'>".ADLAN_152."</td>
-			<td style='text-align:center'>
-			<input type='hidden' name='rand_num' value='".$sec_img->random_number."'>".
-			$sec_img->r_image().
-			"<br /><input class='tbox' type='text' name='code_verify' size='15' maxlength='20' /></td>
-			</tr>
-			";
-		}
-
-		$text .= "
-			<tr>
-			<td colspan='2' style='text-align:center' class='forumheader'>
-
-			<input class='button' type='submit' name='authsubmit' value='".ADLAN_91."' />
-			</td>
-			</tr>
-			</table>
-			</form>
-			</div>";
-
-		$au = new e107table;
-		$au->tablerender(ADLAN_92, $text);
-	}
-
-	function authcheck($authname, $authpass)
-	{
-		/*
-		# Admin auth check
-		# - parameter #1:                string $authname, entered name
-		# - parameter #2:                string $authpass, entered pass
-		# - return                                boolean if fail, else result array
-		# - scope                                        public
-		*/
-		global $tp;
-		$sql_auth = new db;
-		$authname = $tp -> toDB(preg_replace("/\sOR\s|\=|\#/", "", $authname));
-		if ($sql_auth->db_Select("user", "*", "user_loginname='$authname' AND user_admin='1' "))
-		{
-			$row = $sql_auth->db_Fetch();
-		}
-		else
-		{
-			if ($sql_auth->db_Select("user", "*", "user_name='$authname' AND user_admin='1' "))
-			{
-				$row = $sql_auth->db_Fetch();
-			}
-		}
-		if($row['user_id'])
-		{
-			if($row['user_password'] == md5($authpass))
-			{
-				return $row;
-			}
-		}
-		return array("authfail");
-	}
+    function authform()
+    {
+        /*
+        # Admin auth login
+        #
+        # - parameters  none
+        # - return      null
+        # - scope       public
+        */
+
+        global $use_imagecode, $sec_img;
+
+        $text = "<div style='padding:20px;text-align:center'>
+            <form method='post' action='".e_SELF."'>\n
+            <table style='width:50%' class='fborder'>
+            <tr>
+            <td rowspan='4' style='vertical-align:middle;width:65px'>".(file_exists(THEME."images/password.png") ? "<img src='".THEME_ABS."images/password.png' alt='' />\n" : "<img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' />\n" )."</td>
+            <td style='width:35%' class='forumheader3'>".ADLAN_89."</td>
+            <td class='forumheader3' style='text-align:center'><input class='tbox' type='text' name='authname' size='30' value='$authname' maxlength='20' />\n</td>
+
+            </tr>
+            <tr>
+            <td style='width:35%' class='forumheader3'>".ADLAN_90."</td>
+            <td class='forumheader3' style='text-align:center'><input class='tbox' type='password' name='authpass' size='30' value='' maxlength='20' />\n</td>
+            </tr>
+            ";
+
+        if ($use_imagecode) {
+            $text .= "
+            <tr>
+            <td style='width:35%' class='forumheader3'>".ADLAN_152."</td>
+            <td style='text-align:center'>
+            <input type='hidden' name='rand_num' value='".$sec_img->random_number."'>".
+            $sec_img->r_image().
+            "<br /><input class='tbox' type='text' name='code_verify' size='15' maxlength='20' /></td>
+            </tr>
+            ";
+        }
+
+        $text .= "
+            <tr>
+            <td colspan='2' style='text-align:center' class='forumheader'>
+
+            <input class='button' type='submit' name='authsubmit' value='".ADLAN_91."' />
+            </td>
+            </tr>
+            </table>
+            </form>
+            </div>";
+
+        $au = new e107table;
+        $au->tablerender(ADLAN_92, $text);
+    }
+
+    function authcheck($authname, $authpass)
+    {
+        /*
+        # Admin auth check
+        # - parameter #1:                string $authname, entered name
+        # - parameter #2:                string $authpass, entered pass
+        # - return                                boolean if fail, else result array
+        # - scope                                        public
+        */
+        global $tp;
+        $sql_auth = new db;
+        $authname = $tp -> toDB(preg_replace("/\sOR\s|\=|\#/", "", $authname));
+        if ($sql_auth->db_Select("user", "*", "user_loginname='$authname' AND user_admin='1' "))
+        {
+            $row = $sql_auth->db_Fetch();
+        }
+        else
+        {
+            if ($sql_auth->db_Select("user", "*", "user_name='$authname' AND user_admin='1' "))
+            {
+                $row = $sql_auth->db_Fetch();
+            }
+        }
+        if($row['user_id'])
+        {
+            if($row['user_password'] == md5($authpass))
+            {
+                return $row;
+            }
+        }
+        return array("authfail");
+    }
 }
 
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
diff -x .svn -ruN 0.7.7.src/e107_admin/banlist.php 0.7.11.src/e107_admin/banlist.php
--- 0.7.7.src/e107_admin/banlist.php	2006-11-17 21:09:40.000000000 -0600
+++ 0.7.11.src/e107_admin/banlist.php	2007-02-11 04:33:52.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/banlist.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/11/18 03:09:40 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2007/02/11 10:33:52 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -96,6 +96,7 @@
 	</form>
 	</div>";
 
+$text .= "<div style='text-align:center'><br />".BANLAN_13."<a href='".e_ADMIN."users.php'><img src='".e_IMAGE."admin_images/users_16.png' alt='' /></a></div>";
 if(!varsettrue($pref['enable_rdns']))
 {
 	$text .= "<div style='text-align:center'><br />".BANLAN_12."</div>";
diff -x .svn -ruN 0.7.7.src/e107_admin/banner.php 0.7.11.src/e107_admin/banner.php
--- 0.7.7.src/e107_admin/banner.php	2006-10-24 08:34:38.000000000 -0500
+++ 0.7.11.src/e107_admin/banner.php	2007-10-30 17:47:04.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/banner.php,v $
-|     $Revision: 1.28 $
-|     $Date: 2006/10/24 13:34:38 $
-|     $Author: mrpete $
+|     $Revision: 1.30 $
+|     $Date: 2007/10/30 22:47:04 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -38,8 +38,9 @@
 	list($action, $sub_action, $id) = explode(".", e_QUERY);
 }
 
-$reject = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', '.DS_Store');
-$images = $fl->get_files(e_IMAGE."banners/","",$reject);
+//$reject = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', '.DS_Store');
+//$images = $fl->get_files(e_IMAGE."banners/","",$reject);
+$images = $fl->get_files(e_IMAGE."banners/","","standard");
 
 if (isset($_POST['update_menu'])) {
 
@@ -201,7 +202,7 @@
 				<tr><td colspan='8'>&nbsp;</td></tr>";
 		}
 	}
-	$text .= "</table></div>";
+	$text .= "</table>";
 
 	$ns->tablerender(BNRLAN_42, $text);
 }
@@ -437,10 +438,10 @@
 
 
 		<tr><td colspan='2' style='text-align:center' class='forumheader'>";
-	$text .= ($sub_action == "edit" && $id ? "<input class='button' type='submit' name='updatebanner' value='".BNRLAN_40."' /><input type='hidden' name='eid' value='".$id."'" : "<input class='button' type='submit' name='createbanner' value='".BNRLAN_41."' />");
+	$text .= ($sub_action == "edit" && $id ? "<input class='button' type='submit' name='updatebanner' value='".BNRLAN_40."' /><input type='hidden' name='eid' value='".$id."' />" : "<input class='button' type='submit' name='createbanner' value='".BNRLAN_41."' />");
 
 	$text .= "</td></tr></table>
-		</form>";
+		</form></div>";
 
 	$ns->tablerender(BNRLAN_42, $text);
 
diff -x .svn -ruN 0.7.7.src/e107_admin/core_image.php 0.7.11.src/e107_admin/core_image.php
--- 0.7.7.src/e107_admin/core_image.php	2006-11-29 20:17:51.000000000 -0600
+++ 0.7.11.src/e107_admin/core_image.php	2008-01-01 09:50:31.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/core_image.php,v $
-|     $Revision: 1.43 $
-|     $Date: 2006/11/30 02:17:51 $
+|     $Revision: 1.48 $
+|     $Date: 2008/01/01 15:50:31 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -24,12 +24,12 @@
   array (
     'includes' => 
     array (
-      'beginner.php' => '399d299a1ad1dece1776fa3e477fdd31',
-      'cascade.php' => 'f02f4e7c20f7590a19681f0324307800',
-      'categories.php' => 'a99113a6cabb51bc0bcded28892a0957',
-      'classis.php' => '5648c4272072a1f3bbf2665329d480bd',
-      'combo.php' => '416828015462d3e305c002a3798ad76e',
-      'compact.php' => '2c5c2b4d66971f1b0aaa0ac8e81097e7',
+      'beginner.php' => 'bbed82298047a4553e408cc460afe20b',
+      'cascade.php' => 'b6fa1c7dddd3d44390b71ee08a4f0e51',
+      'categories.php' => 'b63b8bbc5027de63f37bbce566227c4f',
+      'classis.php' => '428698ddfb7a4b1c5365bd351b2de43f',
+      'combo.php' => 'a358842dea4d9c7c6a5865f8a3f392d6',
+      'compact.php' => 'f8c7597e80b8a763651a58dc76ef23e0',
     ),
     'sql' => 
     array (
@@ -39,20 +39,20 @@
       ),
       'core_pg.php' => 'af38d186d0a03cde899b4e0939b6ee6c',
       'core_sql.php' => 'cc00538c4f8b87a107ac6d2dacbaf9b2',
-      'extended_country.php' => '0ef441f85dc0628bbf00c91e1163f114',
+      'extended_country.php' => '9d6cf4a6e013a60c58d4687076bd187e',
     ),
-    'ad_links.php' => 'd4d181f5337ba8bc939828d9068c8d43',
-    'admin.php' => '3300cf551a1fa5ecc473e2f355c97ea7',
+    'ad_links.php' => 'bc9520a672754b6b283f734f9cbca86c',
+    'admin.php' => '0aa618a93b1e78e0887cc1ec82de36eb',
     'admin_classis.php' => 'ed861d18477db9ce0bc3620a69443723',
     'admin_combo.php' => '8958300a2a42fd2aa68977d566c1edb9',
     'admin_etalkers.php' => '9d684ef56c54bbf919e3346927cf4509',
-    'admin_log.php' => '38c702ad61600d3c48851ee1dc868dfd',
+    'admin_log.php' => '4ee20cbf87c1a2dbabb7d75631146736',
     'adminb.php' => '1e31b2ad3907c7cba29dca04342cee1d',
-    'administrator.php' => 'bd8de4773ebe49ab0884ba3d1c19568c',
+    'administrator.php' => '84ec839970d100c68448de2b63ba552e',
     'article.php' => '7b21dc8ef4bc68ceb9ecf4d1c519a645',
-    'auth.php' => '6bdf6b7895598b70c76e219069b930c6',
-    'banlist.php' => 'f858a52c69ad86e1ed66127434a12915',
-    'banner.php' => '3913e712c16227a49c5333b7f0e64489',
+    'auth.php' => '0489d40c8305057ac8c2ff8cc74603c6',
+    'banlist.php' => '6ff4252414f390d5080d778e59198a12',
+    'banner.php' => 'bb6d203021939774c49c9788a2e7f62a',
     'cache.php' => '62fc17d1f4c6db977c66642c5a76127a',
     'cascade.php' => '3d70a650778f09e6c85efd91b6ab5e4a',
     'categories.php' => 'cbbed37d26ab602700d46a0cb1955205',
@@ -61,51 +61,51 @@
     'comment.php' => '96f04e71003de6b6a6ea3a0f2ede285d',
     'compact.php' => '20bccea2ef81cc86a86782fa4841e45f',
     'content.php' => 'bf2239404990afed185913002429e682',
-    'core_image.php' => 'e989fac71ee65a3db9047565d6f34b48',
-    'cpage.php' => '57ab65c7fa55e1dcfc5f3a9a94bc2528',
-    'credits.php' => '322fe1169cd992db88624e84d7f51288',
-    'db.php' => 'a48795e26302b874c1fe397689f01d9f',
-    'db_verify.php' => 'e14434e165ac07b4cb630809dd4b3150',
+    'core_image.php' => 'e392369f7fa5962e9b233e76f1d8b37e',
+    'cpage.php' => '8b80b073be56d598ab8f443d3ef690e7',
+    'credits.php' => 'b4f6bcab2c92096560e768538abf46f1',
+    'db.php' => '74e4d75fbafe9a8493fbba384ae6f97f',
+    'db_verify.php' => '0699ccfd73686113023ee99cf406e6ce',
     'docs.php' => 'e5ebdd8fd30362636cfe1a3878b3fb18',
-    'download.php' => '636316389ea0a9dd8d6dc7b9d2044c81',
+    'download.php' => '399896dc9d2e26630684b0aaad4469de',
     'e107_update.php' => 'c23624862e7dc50fab29aa1890c7872a',
-    'emoticon.php' => '4139a4c00680ed7b94bb2848bb9c7cec',
-    'fileinspector.php' => '7430c97538e5d63ced422b4d552344ae',
-    'filemanager.php' => 'af7dfc6ef908953d0208cd18ba5d444d',
+    'emoticon.php' => '9403ce6e8c4dc4ab34d32b3d74a1d699',
+    'fileinspector.php' => 'e1d831bfb0ca6a9244a4ced5b0d85fc3',
+    'filemanager.php' => '413763a3c6aac1f79fcb3f9e737bce27',
     'filetypes_.php' => 'f951037335e993337792606cc1475cec',
     'fla.php' => 'c44c289dcdbe2bcf53305103275ce899',
-    'footer.php' => '0cc1b838f19770de51917dd614b7b246',
-    'frontpage.php' => '78acc7a2d9f879636291a2b45d06c80a',
-    'header.php' => 'a61922daac7e562e86251bd9a67877f3',
-    'image.php' => 'fc510663610cbf4b53eec2f9948999b6',
+    'footer.php' => '920ba235b135867f519bcb91a84d7dcb',
+    'frontpage.php' => 'c61f2a921f92152fc504fdfe01eed44a',
+    'header.php' => '75bff92e3637acfdf7721b7cf6bfc528',
+    'image.php' => '4aa59015397245198d883c6a66d3ae41',
     'index.php' => 'e4e143ee2d34d4ce1f17b3f043cc6cd6',
-    'lancheck.php' => '8b8fea89e7d9a0dc3d1931971a9b4939',
-    'language.php' => '67569d7ab4a4e25984c19353a143e31c',
-    'links.php' => '39c7ab07f379c047fe20f0415735b474',
-    'mailout.php' => '9779b609afed1f62c16bf7694f1a68e5',
-    'menus.php' => '1abba8d34311ca3795d37d4526a41042',
+    'lancheck.php' => 'f5d4236d741882e9e67767ca27d5e186',
+    'language.php' => '4c98b96069996d7a98830b8e44a04592',
+    'links.php' => 'b56bca703d01637c39e2d811d6ceb796',
+    'mailout.php' => '12834d6d1c8adfb001b9670faae7c8c0',
+    'menus.php' => '816ba85a06f966b9bbc59c53d31c1bc6',
     'message.php' => 'a598b5e493298500d81b815f1455280b',
-    'meta.php' => '346305add7d4a15981103cd42ae02d15',
-    'modcomment.php' => 'b8787d8ebce9cc813ccaa416ec3a923c',
-    'newspost.php' => '6aba9db62369e328f78f623644ea04a8',
+    'meta.php' => 'bf6ed9bf9d938f9618fb1c4e53632323',
+    'modcomment.php' => '623f402310e3c19651b92fc071cd6e42',
+    'newspost.php' => 'e24dcfb893be1a994942c6f5a7d74b07',
     'notify.php' => 'a988fd7416b4595e72975b22ccc6362b',
     'phpinfo.php' => '994ea857810fe5f47ac8612f570aadb1',
-    'plugin.php' => '3714121cbb762b83f29f28a9fa1d094f',
-    'prefs.php' => 'e9ac6b838ef5368d1861481e629c8c08',
+    'plugin.php' => 'a46b431f57fbe4cc2c17ccd46d676c69',
+    'prefs.php' => '2912441ff848a15cfb7c4e9612bf8cbe',
     'review.php' => '1919d31943803a66cb2d12828bd92db2',
     'search.php' => 'b1239e5af6795205648d8965ec3a1ec9',
     'theme.php' => 'b05f7265501a3e1c5e7c47cb3f891831',
     'ugflag.php' => 'b3b47767137dd7ea5e3726150507e158',
-    'update_routines.php' => '16e3369df255bb5d6f76e8288830e3e1',
+    'update_routines.php' => '698d8846651f790d25d6fac3d620992c',
     'updateadmin.php' => '770fff43134883ea4d502498b28d70d2',
-    'upload.php' => '69b274043c816b5a8c7241c20de0b9fb',
+    'upload.php' => '26cedc21eaee3f3719e7a8aa591de10c',
     'userclass.php' => 'b7fd96c785b6f3eead88fd5acd5760ad',
-    'userclass2.php' => 'f0a95f4feecabe0d801b4a7f64c89ec0',
+    'userclass2.php' => 'e6feec2b3767627cd6dfbdab15bfe681',
     'userinfo.php' => 'fcbb4c620a0a9ed430588ee7539fb2d7',
-    'users.php' => '97cf741f0e67b3be9a55232c4a189932',
-    'users_extended.php' => 'c0cc2efb094dbb76b7e73fd31aedd06a',
-    'users_extended_predefined.php' => 'a1bd4adc6a6c1996e304b467aed9d2c0',
-    'ver.php' => '50bdc51a07a780bad3c7b109feeb22b1',
+    'users.php' => 'df9ed7837559fb17f80f541898b2a292',
+    'users_extended.php' => '9ebda71ed00ed212b96f07ff0e4ebf2e',
+    'users_extended_predefined.php' => '51128e45b6620f7b6ead6fbd8521b43e',
+    'ver.php' => 'ca06dc320c478688a436224deb8a2c27',
     'wmessage.php' => '17afb0f8ef07cfd675cd92e9f7e606a3',
   ),
   $coredir['docs'] => 
@@ -137,8 +137,8 @@
         'Welcome_Message' => 'd3a3a4dfd02ec7258dd91364be7d6aa8',
       ),
     ),
-    'README.html' => '0f900f790eb4081e213fef89b92a5125',
-    'README_UPGRADE.html' => 'bd278a384e14d6306fc557a0560231fe',
+    'README.html' => 'eb640d43409eaedf9e40f9c1bd894432',
+    'README_UPGRADE.html' => '6361898777db8b0b106672a94cf8a520',
     'gpl.txt' => 'e19d8295ecad01988af40b5a943bd55f',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
     'style.css' => '2e3b2c9e4bff6d8de091af58589faa1c',
@@ -151,30 +151,30 @@
       'blockquote.bb' => '2cfbbd3ab3fe2872d1a9873223d21522',
       'br.bb' => 'cb8d211703f0459735baa8dfbebb4bb4',
       'center.bb' => '5a1957946e3d8898a0b3d86650771809',
-      'code.bb' => 'fbc07a20865e76438614cb49d4f50b4b',
+      'code.bb' => '15d5237cb3d77aaa80e830ffeb6f6bbb',
       'color.bb' => '98b9d0ddcc76d2ee37af0f36eab8b1c3',
       'email.bb' => '123a8b604a28524320639ba1e09bef35',
-      'file.bb' => '37ef44e5f420205d6c4f4519e69e7a32',
-      'flash.bb' => 'd008adf0a77ce5b3398e908765247646',
+      'file.bb' => '655f2a241ed9ba30d37803ba6d6338bc',
+      'flash.bb' => 'b1000e9022a43d79457e0a58b4b5e611',
       'hide.bb' => 'cf30f78c78855565b0bf868a01142fb8',
       'html.bb' => '9938499c3ef8c80a2598b9c3aed7e371',
       'i.bb' => 'ec842cfda8a6f33d53f8232763b56719',
-      'img.bb' => '55dbceb76b1d0f3ac070c0122ed7ee10',
+      'img.bb' => 'deb454995839ad49939500d5d93d718b',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'justify.bb' => '016500f910beb0f820dd58c4915f2489',
       'left.bb' => '990ddba32b14bea648745cc373035bde',
-      'link.bb' => '0682a13d56650ba5ca6859e9da761e6b',
-      'list.bb' => 'a2b5f8075b9752bb5b60c3862c5d96ca',
-      'php.bb' => '18bfe745513afb3bb7ec4d69f0683d95',
+      'link.bb' => 'f845e7f940da691975fee559ebfc775b',
+      'list.bb' => 'b8a3e5c98d6ebc1f1ca1a122bd7ced0e',
+      'php.bb' => 'e4ec86c0947ef2544f19d260c05d74ac',
       'quote.bb' => '12bfbba32661e309a33972e388b0e912',
       'right.bb' => '9bd60ca738b30f35742a0049c5efc191',
       'size.bb' => 'bd62172ecb7083b85b534c2e45e79d48',
       'spoiler.bb' => '5929f20a04438093df87b7246e843bf0',
       'stream.bb' => '9661057e8db23c681e3ec2340ff3a4fa',
-      'textarea.bb' => '51f2669f52dfec3ed57f38402fcc7652',
+      'textarea.bb' => 'c9af59e1cd5aedc873f40f40727b3685',
       'time.bb' => '3d83b0dfa9b139004bb19ee34b142b44',
       'u.bb' => '7f8703e65a5f24bd9d2edd5fc0dfef48',
-      'url.bb' => 'ded6e905c2f5d9a12707d3bfa63d1d82',
+      'url.bb' => '29664480211309ec4b003a5e9e7505fa',
     ),
     'cache' => 
     array (
@@ -206,7 +206,7 @@
       'import_mapper.php' => '78a98bfedbe66b043e8562bcd6449125',
       'import_readme.txt' => 'a76f8a52208d648e1c9e3afe71929755',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'mambo.php' => 'bbcff57b96ca83045d9f4afa982a6ff4',
+      'mambo.php' => '650c4fa28067b0d8b71d371f130db894',
       'phpbb2.php' => '80bdbe33731a881d122d68003096c4ad',
       'phpnuke.php' => '732653b3f39cf02364be2dcb0f065f3a',
     ),
@@ -233,94 +233,95 @@
     array (
       'batch' => 
       array (
-        'bbcode_shortcodes.php' => 'ea6a74e0a309ad82b29f3fa467e77c39',
-        'comment_shortcodes.php' => 'd443298b9ca99525f12817f6a3234706',
+        'bbcode_shortcodes.php' => '284b0c6a768247d73db4a1ab90a0fd8c',
+        'comment_shortcodes.php' => '454799a0dbcdb22ef8b68855563afe23',
         'contact_shortcodes.php' => 'd593f9dadff312c61eb27e32457d7f95',
-        'download_shortcodes.php' => '7ab132b79c308f5d010743e135dedce3',
+        'download_shortcodes.php' => '32538901c6422a55ffd8e0f14083ce7c',
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         'news_archives.php' => '1115fe90b0de9f170fce31c94680dabf',
-        'news_shortcodes.php' => '6db3c049835db41b7fdace7e6c494d81',
-        'signup_shortcodes.php' => '8726a38b93ea99fc74355f6188723c8f',
+        'news_shortcodes.php' => 'df540d57991039798244a506754735ee',
+        'signup_shortcodes.php' => 'fbaad5179aa055dcd04f5bfdc6614782',
         'sitedown_shortcodes.php' => '3ae9199cbae645d23869d517a5f6cef4',
-        'user_shortcodes.php' => '7f8fb9882adb3bcffdbd41435e62f154',
-        'usersettings_shortcodes.php' => '0ba56f47a83cdbbdf3a5c72475ec100c',
+        'user_shortcodes.php' => '314d01ff5be91f80629db329b2b61d4a',
+        'usersettings_shortcodes.php' => '21d6fd90f2efd6e7229fcf37d6ec689e',
       ),
       'admin_alt_nav.sc' => '412e8fb7acac7746ea48b17854decfc4',
       'admin_credits.sc' => '0eb1784fcb76e13c8addd81d9a741074',
       'admin_docs.sc' => 'b010b7ac7618fa669c8777754a8337c6',
-      'admin_help.sc' => '1ad9d6f1c5af06e7ce2d0e1744b02cd4',
+      'admin_help.sc' => 'ba6d4dff807a99eca5be742f259732a9',
       'admin_icon.sc' => 'e479849c3b09aae88aae3532b0550a92',
       'admin_lang.sc' => 'f5bf42455eb337119639528aa7fea705',
       'admin_latest.sc' => '96a92eb5000eb6e8f120b70734239968',
-      'admin_log.sc' => 'ad42fe098b732d8985cd44b11a3402d5',
+      'admin_log.sc' => '68d201ee791ca1a72faee5dd643d3578',
       'admin_logged.sc' => 'dec16fb0a9f5485db6ca1b4955753c2e',
-      'admin_logo.sc' => 'ff7174ceae0a5e01bfd0bc7a343c16a4',
+      'admin_logo.sc' => 'bcfbd47e276c41bb3e13fd29346fa6d1',
       'admin_menu.sc' => '33785fcda56c60c219a4cc30f6018f5b',
       'admin_msg.sc' => '1906530f20e337964878fd144b1047c5',
       'admin_nav.sc' => 'c22be64cb31ee333f0510f6dd8778363',
-      'admin_plugins.sc' => 'cdf52aad6688cde7741d695a62be944d',
-      'admin_preset.sc' => 'f27d1c59bb7459581fde09d29cfe6303',
+      'admin_plugins.sc' => '67b6ef3a70b37eb92ae585f20334b9ca',
+      'admin_preset.sc' => '57769dcbc4c658c8b14fbc0b19b94a28',
       'admin_pword.sc' => 'abbe3f9d2709e86cfb37b378f2b3d13f',
       'admin_sel_lan.sc' => '6c2dbc4e17bdcc5f5260664ddb8c3280',
-      'admin_siteinfo.sc' => '63bfd9a632b66f9368337983dd921537',
-      'admin_status.sc' => 'ee77ec3ec0d56adfdc8681900a85bfc6',
+      'admin_siteinfo.sc' => '7a8d2349bb68ce064cfbfb70dc559288',
+      'admin_status.sc' => 'dd09c0b576dba2e5e9c710d7a932c9cf',
+      'admin_update.sc' => '8d9dba8124282e7e230b0883b7aed849',
       'admin_userlan.sc' => 'cbaf3dda959b6a36f6b3f4cf0a6f7536',
-      'banner.sc' => '4a23a473eb15c7afbedbd4816f3922ea',
+      'banner.sc' => 'b5d2407d670146f95bb3c36edc2ca42d',
       'breadcrumb.sc' => '0591ee7dc26ded7ac9a359dea4b8fdf6',
-      'custom.sc' => 'eae664abbaed381856936600574839a7',
+      'custom.sc' => 'cf3f40d5afdff518cb98bfab464ca170',
       'e_image.sc' => '3819fdf5b9dfc7b189fb4073d33ae0d5',
-      'email.sc' => 'a864fe0d78a0c9641b36d65688c63b10',
+      'email.sc' => 'e363b6b54037a8c80b373b76994c8db9',
       'email_item.sc' => 'a23b3abbb722bbf5bc58be9d23906583',
-      'emailto.sc' => '05843b1a7c7feb8f4985a55ac01ba9f3',
+      'emailto.sc' => '2a090d41cd91744486aa4f74519f3c4b',
       'extended.sc' => '868d45e725d7565a1d9c5b743aba0967',
       'extended_icon.sc' => 'db16dbaa0dfa2f8fc944ba87c15a09d1',
       'extended_text.sc' => '5a1426815f88bb2239912638af30beb0',
       'extended_value.sc' => '1b720e5d3155c6d4a1464fc1e9cac5f1',
-      'imageselector.sc' => '31d9db59fdc34235656d40a275e63c26',
+      'imageselector.sc' => '5f8b371a8d6cf9f1b538d7bce18e6814',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'languagelinks.sc' => '46f5c006e1b1f5e5b941a6330711bf77',
+      'languagelinks.sc' => '9a233913b41de783edaa68c46abadf65',
       'linkstyle.sc' => '5ed64d972bc892a798f80179878f1266',
-      'logo.sc' => '9fb4b737a74ac8d1168fa29fe88766ac',
-      'menu.sc' => '44ea3e93ac49feeda0632a76773e2829',
+      'logo.sc' => '7989dac8bea9ec4c0da489fb942ae507',
+      'menu.sc' => 'cb91e43756bf3ab6e2dd7d5e1241fec2',
       'news_alt.sc' => '25596ffed2cf4bed831b80397c77e295',
-      'news_categories.sc' => 'c520fdee0b041b3622c93ca85f63f6fb',
+      'news_categories.sc' => 'b2ae6f1ca052c9e858d4c2c860e8a5bf',
       'news_category.sc' => '25596ffed2cf4bed831b80397c77e295',
       'newsfile.sc' => 'afe0363c51236eacdf1a5434d17533a3',
       'newsimage.sc' => '75738371cff6146174ea00971730a0da',
-      'nextprev.sc' => 'c1c872831b48abb3c34d531e8ccdf2da',
+      'nextprev.sc' => '8fbd81c6f1a3274aa8b587e48660d566',
       'picture.sc' => '0f4d00920f1ddbac7293549862b3c0da',
-      'plugin.sc' => '3b827418651f2a8f070d1cf80fe2405f',
+      'plugin.sc' => 'be06266acd86f06b244dd27266df8f12',
       'print_item.sc' => '8ca4f150e4758249c346dd0edd5623f3',
       'profile.sc' => 'ea7fc4eca12f39e19a735d2014fe341f',
       'search.sc' => '12a174161a186e9a936fc10c946f0517',
       'setstyle.sc' => '88ec920b668233bd21ba95e2cdd607e7',
       'sitecontactinfo.sc' => '5467f65cd62b910389014b5fb8b33fe5',
       'sitedescription.sc' => 'c617f50a35752e7cb8de2d15f7e6b614',
-      'sitedisclaimer.sc' => 'cd111b6abc576ca1ab70c103f3f2a49b',
+      'sitedisclaimer.sc' => '6a9e25a899608fd05a56e90a3f4bfd38',
       'sitelinks.sc' => '754259e3bdab4efc147d92b50efdf262',
-      'sitelinks_alt.sc' => '24ee01a0e4b5181620320b936a63245e',
+      'sitelinks_alt.sc' => '1d63ead427f90e80b29f48c24abaadf6',
       'sitename.sc' => 'a62bd1e1600931a2585f16b611fd0c6b',
       'sitetag.sc' => '338e16589e67c9fe45613e3c6dbb9b0d',
       'stylesheet.sc' => '40a390253676a08790cbadcd434619b3',
+      'theme_disclaimer.sc' => '606d98f47c1a64b179d9baf6e6930dbc',
       'uploadfile.sc' => '85ea5b2a10cde7c2267a40c359694aed',
       'user_avatar.sc' => '1501550f2414900d47edee2621b2e624',
-      'user_extended.sc' => '8fdffc090d07e85ceb203542ecbb0d32',
-      'wmessage.sc' => 'b6bf7054c5f9ece93c13f2f1bfd13a31',
+      'user_extended.sc' => '2b22b0b1c7b64321973b5d6589e94958',
+      'wmessage.sc' => 'c24f80349ceafd36f6cf0d6ec6875fa7',
     ),
-    'def_e107_prefs.php' => '0886a4b7774f246f31aa027d4b8eb18b',
+    'def_e107_prefs.php' => 'fab29e04144174fe0689010680cedab0',
     'e107.css' => 'e5cfa4047831f19def7df032ef8bc830',
-    'e107.js' => '2089336ebd5204061afce9be3094ad73',
+    'e107.js' => 'd4eb3815432359319aaa37608815f85f',
     'e_ajax.js' => 'b583773e72852158e27af8a9bba7c97f',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
     'nav_menu.css' => '58ca165986f7428fb05e8b7b82c2ee13',
     'nav_menu.js' => 'f6345dfb29d05884a5017ff17ed36387',
     'nav_menu_alt.js' => 'cbfeb53bb0dfc7136f097c00265731ff',
-    'popup.js' => 'a9d1e17d0a4c399736fc7bf16ac48fa8',
+    'popup.js' => 'd09d2c542ac320a8b9690a36aebdb0c4',
     'resetcore.php' => '8329fb938f7ae0058ab9582efc098c4c',
     'sleight_img.gif' => '7616b49c48ca0cd6cbd15e9f747c8886',
     'sleight_js.php' => '038fc3cccae701fab1c6aa35339a0853',
     'thumb.php' => '1506afd0bc12c8663688f7ca449aa853',
-    'user.js' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
   $coredir['handlers'] => 
   array (
@@ -340,7 +341,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'menuarrow.gif' => 'b5a91d7a2755198b2eb729541ad3288c',
       'menuarrow2.gif' => '1f8c673c8f76832febaeeac88a5f4353',
-      'sample.php' => '1d99312cd3ba1d6b9ef0484e6d138641',
+      'sample.php' => '6f26d5318cc966af3489c7878ce87288',
     ),
     'phpmailer' => 
     array (
@@ -348,11 +349,11 @@
       array (
         'phpmailer.lang-en.php' => 'dca429b3dfc000a241f32ed11d3a6aca',
       ),
-      'class.phpmailer.php' => 'cf32be10ca659080ad4550acd26c102e',
-      'class.pop3.php' => '5a96ba537abceb27300abeef11041302',
-      'class.smtp.php' => 'dcae7f76c4549f804401195e06e2cb3a',
+      'class.phpmailer.php' => '41bbfce3f86dc09ba7eca4e716d6aa29',
+      'class.pop3.php' => '15ad99c609a248dcb1dbd10b68dcc326',
+      'class.smtp.php' => 'e9f2821680e2d42f2f2285a7f5009ab6',
       'e107.htaccess' => '507de3fb6f951cafa6b1a346d232604f',
-      'mailout_process.php' => '51fae3c946ebe47c33b298c36ef6f545',
+      'mailout_process.php' => '5933e84899b54c073729c1d54b0078d7',
     ),
     'search' => 
     array (
@@ -362,16 +363,16 @@
       'advanced_pages.php' => '82c313fb52d708bd9aaad142a00dc2c4',
       'advanced_user.php' => '0f1f1668327d513090f6e13824d281ad',
       'comments_download.php' => '2cabddfffb2986e96bb7779da03d1f0a',
-      'comments_news.php' => '771713752895af10bfa75c3c2bac4d1e',
+      'comments_news.php' => '37a65c88e38713fe0ae324928e1006a6',
       'comments_page.php' => '6e5a89313087d403e30cfeb8ddf4da78',
-      'comments_user.php' => 'caa387a56d6f1b35610e80061e18cc1c',
+      'comments_user.php' => 'cc0a7a6550cbe8fdaa200ae49a1725bb',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'search_comment.php' => 'd6969967014e8c14e613bad64a091253',
-      'search_download.php' => 'ba62e1be41cdd3457cfc2be8de146d01',
+      'search_download.php' => 'ad2776a005adc703798e0f543d36bd92',
       'search_event.php' => '17c68ea4f5728e87e7009b96b978006c',
       'search_news.php' => 'bc0321e07ae69c925ac83a72ae67c136',
-      'search_pages.php' => '57521d1569a214c3ccb99406561a229f',
-      'search_user.php' => '90b545d731c887cef2715096d52cb968',
+      'search_pages.php' => 'd88764c2463c3a9a3776252ae0642d88',
+      'search_user.php' => '09d6c3a85872a9b894d1afccf94bf31d',
     ),
     'tiny_mce' => 
     array (
@@ -423,7 +424,7 @@
           ),
           'config.php' => '4e178e32efb96453c26523ded26f6ee7',
           'editor_plugin.js' => 'e16d63db65af69d1db26ff64b706a0d9',
-          'ibrowser.php' => '1865b7afd71373cfff0cb986b632ee35',
+          'ibrowser.php' => 'ee1a24596dfa9d77950fed1acbb24bc3',
         ),
         'iespell' => 
         array (
@@ -649,44 +650,39 @@
       'tiny_mce_gzip.php' => '846511eed428312feca1f0e5fec6cd91',
       'tiny_mce_popup.js' => '0a5ce4187f9d2f58e36302d7d40bf3d2',
       'tiny_mce_src.js' => '1a99b9dcd773d76df1fee42e072cb1a4',
-      'wysiwyg.php' => '3cc70beacb90d7c9ea9dcfea7288a8be',
+      'wysiwyg.php' => '031aadf6f50c2ff354bd2ec4c1425e9c',
     ),
     'admin_handler.php' => '2d593943e40bf02d5d46cf6b6af6b7e7',
-    'admin_log_class.php' => 'a19c073089c6149a755e253133594d65',
+    'admin_log_class.php' => 'df69d03d7e9b3c28ad48573aa7ce50bf',
     'arraystorage_class.php' => '4862b38926c8f68029c95d31990435a4',
     'avatar_handler.php' => '54c9f790d9f17e30f52b8011633d486c',
-    'bbcode_handler.php' => '4871033a545a98c465e3b0aa6e911374',
-    'cache_handler.php' => 'e9b35486958d34ecf84afb69bed7fe16',
-    'comment_class.php' => 'e525ee48e0f89300368bf201aed95783',
-    'date_handler.php' => '900262e3d47034c444cf3da1abc9371d',
-    'db_debug_class.php' => 'a1ac847f296f4701473806f80d5f7d23',
-    'debug_handler.php' => 'fe93f06640b293a65a068d800c22daf6',
+    'bbcode_handler.php' => '53fae188dcfbc9496927fa4389d90ecc',
+    'cache_handler.php' => '87bea235aa6d8e55f1268675b237ae43',
+    'comment_class.php' => '7e95510be7b981212bee432920de0034',
+    'date_handler.php' => 'dc0f62d02024e515f5db56230882676f',
+    'db_debug_class.php' => '3ca3cd41bb506223eccad1601194bcaf',
+    'debug_handler.php' => '9fa1acc69ef4cfc2593345c3866841d3',
     'e107_Compat_handler.php' => 'e76211b3178e4a9724933ecfe85ba8ea',
-    'e107_class.php' => '4ce6554308d42363e08c45c5b711df27',
-    'e_parse_class.php' => '39060ea3a2092ca529710b0fc4d69037',
+    'e107_class.php' => 'f23c42b45c8dd2730f0b1823030c7cbd',
+    'e_parse_class.php' => '23862dc8a96578af4487dcb619fc9c86',
     'emailprint_class.php' => 'c7de0da4205693ddb952e9723a7fc226',
-    'emote.php' => 'b5d34cd652e828769f49b855b090c96f',
-    'emote_filter.php' => 'fedbb8c9daf1acd5f6dbbb9914b05dc4',
-    'encrypt_handler.php' => '7a6f592c0900d68fcf5cbf7b0eb1e364',
-    'equery_secure.php' => '00121b097ba978d5330349abbd350737',
+    'emote.php' => 'bbda3eafde2bb54c645194bf72dd47e3',
+    'emote_filter.php' => '6348bb4a8adf203fccc2b5ecf4bff378',
+    'encrypt_handler.php' => 'de4230eb5dc1541306a43f83b6a04671',
     'event_class.php' => 'd14906b7576984e7d9467c097e285b65',
     'file_class.php' => 'f193a200c2717c932e3dd1ae7d378fcb',
-    'form_handler.php' => '67deba10eb6acf65d941b760deec6134',
-    'forum.php' => 'da5c0d4378b7288610945979d269a79c',
-    'forum_include.php' => '8b562f8ba508cc3572c84b443c4e7a6c',
-    'forum_mod.php' => 'fd1adbf1660996aeb4f51384506e0045',
+    'form_handler.php' => 'f2776c53505b3d942cd916df0bb44fe1',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-    'input_class.php' => 'f819fe76d1fa518f430410aa4e6c803e',
-    'language_class.php' => '93fe59f6606cafbf4dddb8546fdd3a9b',
-    'level_handler.php' => 'a231a4e63fcf4f498f9bfd7411250faf',
-    'login.php' => 'cc67e51d6ea138cb66b9ada17adebaac',
+    'language_class.php' => '09b1ed80a0e4a23b5cad01b6600d7a8b',
+    'level_handler.php' => '8ad6a092a84bef9c29912699b4a6263c',
+    'login.php' => 'c8e1c2e6722129eeb73deb4baadbb5e2',
     'magpie_rss.php' => '1297fc8132b5ec0a2c04436b38ec6aee',
-    'mail.php' => '407db4ce0e57e22b7db8252af7f3085d',
+    'mail.php' => '248bc747f9b99bd66acc3442b5c8d926',
     'mail_validation_class.php' => '75e722bf8c6975349ec402682323314e',
-    'message_handler.php' => '176ebf4b88fb8267f143d28714bda42b',
-    'mysql_class.php' => '4dc9c8b12ad9395b93c2452197c64259',
-    'news_class.php' => 'c8c699da336670173562ede6f0f6a27c',
-    'notify_class.php' => '2b2908df0eb85e94686bfed263389e77',
+    'message_handler.php' => 'b6adb65802a3b790d7f8d0735a72364b',
+    'mysql_class.php' => '0fa3faf0fa129da9f26b30bf9517d985',
+    'news_class.php' => 'f38ba4ef117796455094cdb4952aa54c',
+    'notify_class.php' => '9f5603e38b5614ce9772bbde70a7eae2',
     'np_class.php' => '68a8edcf50703e47e19f165c1a108a45',
     'override_class.php' => 'a1f7451103a7fb47f3e541c31cf32343',
     'parser_functions.php' => '81daef0e484ee070d440e4ebc9bc8095',
@@ -695,33 +691,33 @@
     'pcltar.lib.php' => 'b9313066aad3049bb0041099137a648e',
     'pcltrace.lib.php' => 'eb165fe908cc30c85975b7d35614990b',
     'pclzip.lib.php' => '1b0212a9a1e09b781172c8f6964296c2',
-    'php_compatibility_handler.php' => 'f77929f2cd211a855516e3e72873ee99',
-    'plugin_class.php' => 'd05c2666377d3c51de5c79119a56edc8',
+    'php_compatibility_handler.php' => '04e73e8835f5fd14a5febd20028c27d9',
+    'plugin_class.php' => '6a6d576a19c6d751944dd36b4925f942',
     'pop3_class.php' => '3164abd686583e15f96901ab722cd272',
     'popup_handler.php' => '8915aa18adc4e69df003becaf508003d',
     'pref_class.php' => '4d2d63ee3f969ee742d6b989863b11e7',
-    'preset_class.php' => '5a4df9b9b87aa3862dda2afd44165acd',
+    'preset_class.php' => 'a687add695b164e133e4c6375c5791fc',
     'profanity_filter.php' => 'd41dc2dcd84a33f37f3ea1200fef3814',
-    'rate_class.php' => '21ab83661e35eeb568386dc907a9726c',
-    'ren_help.php' => '75ebce4f529d186cede57846d7f63693',
-    'resize_handler.php' => '44e5777433fa18d97e80a4c16552f785',
+    'rate_class.php' => 'be7d6c95e9e702eddf6c93e0de6344e1',
+    'ren_help.php' => 'f0410eed0dd683e8e1b75c4b980107e2',
+    'resize_handler.php' => '49ec3b36dcd96ce97390101099e1ed6b',
     'search_class.php' => 'fe9c65c10349512b91164b8b67e724be',
-    'secure_img_handler.php' => '18e7e3827ad38b79c3ff46b67e6627e1',
-    'secure_img_render.php' => 'e772c2042868b1d9ecafbee3b4eab4ef',
+    'secure_img_handler.php' => '2cf9d9bb7616a5cc9d04d782a7bf8611',
+    'secure_img_render.php' => '7364c99eec3f7881b7e4c0a10fc75cdf',
     'session_handler.php' => '54f987aa4f0f2a31c646d9e0f81cd061',
-    'shortcode_handler.php' => '845f8b0fdfe8b6d273d8e02f3cf8efd5',
-    'sitelinks_class.php' => '64e7edf9541a0256066b9b636e550c18',
+    'shortcode_handler.php' => '28d1ae2afb2413189019407aac4cc61d',
+    'sitelinks_class.php' => '583a8a2d52581ce17a3765b1e75230aa',
     'smtp.php' => '71008c80b0a5e12faef990c0560f8226',
-    'theme_handler.php' => 'b38c4812a67c22705a15a263c66f3c92',
+    'theme_handler.php' => '35399d6f406cb070f874803a1e6352a3',
     'traffic_class.php' => 'd9939fec7c60e3c8b95111dca22ce918',
     'traffic_class_display.php' => '4583aae09eb49619d1b302160c27b721',
-    'upload_handler.php' => '8720ea79c13c327e5c1c019daf077d4c',
-    'user_extended_class.php' => '893014f71353a16c7eadaed563ac5dc7',
+    'upload_handler.php' => '2a99ef0d03871f7d4f862c1dcc9ac036',
+    'user_extended_class.php' => 'ed8dcb0d2b05f9fc285937a0939de2ad',
     'user_func.php' => 'bb871abafb6c91109c809afa9514afcc',
-    'user_select_class.php' => '5f08187de31a562d5ea8ad88e1f6a3b2',
-    'userclass_class.php' => '141c0e6732238a2c8d2dbfee515fb376',
+    'user_select_class.php' => 'd0ce7bea9522abbea48869734f8953ec',
+    'userclass_class.php' => '6e64e881c71fbc7e87c2f4e9df941e9d',
     'usersession_class.php' => 'dcd6889bc9e8a11cba08fdd13f629615',
-    'xml_class.php' => '2625ffa68fd7516ddf64eea40e47f218',
+    'xml_class.php' => 'e0ee6f1aec86b5416adc2725f35af285',
   ),
   $coredir['images'] => 
   array (
@@ -1186,24 +1182,19 @@
         'help' => 
         array (
           'administrator.php' => 'bfc3305d4af30024ef36e2c3cac685d5',
-          'article.php' => '3c7df3956134df9dfc86a4a67b73d78b',
-          'banlist.php' => '589e0268a08606ff935ee928292602c7',
+          'banlist.php' => 'c250d64286674097b02906f4d71aa2f7',
           'cache.php' => 'f889aa4a1889a3112699c899eb655744',
-          'chatbox.php' => 'd5aede1254e7e48e3e8733f18f6ec0ce',
-          'content.php' => 'dcf60ff22635488c42b4a99243bdf9f2',
-          'cpage.php' => '66e658a3daca00f9fe6d9bb1e5016eef',
+          'cpage.php' => '021075ecadbb8683c0f567e91428e112',
           'custommenu.php' => 'bc2d5fff1395d8495a45b80da77b7665',
           'db.php' => '56210313eb216b42cedde3f548461f70',
           'download.php' => 'dcfce12aec25465d48762456414ca9db',
           'emoticon.php' => '44293ed224e20f90dc81554c1064842a',
-          'fileinspector.php' => 'b2ad72e245b79f582ee54c9ed1b7319b',
+          'fileinspector.php' => '5357e4315bc463b69d829355287b6b01',
           'filemanager.php' => '62e147fa032aa065b11a139d3d53a241',
-          'forum.php' => '161249fcb72351dee1b5b56fda1a15be',
           'frontpage.php' => '44e0a1156408e6ccffed96f35a516d04',
           'image.php' => '11a6e5190f22d4c3586b440a15203fdb',
           'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
           'language.php' => '514346599719d0abc2f0a947945c77c8',
-          'link_category.php' => '5352ce360022a7fc0882fb77603405cb',
           'links.php' => 'c9c06673b3d7089ac9a729e1601b82c4',
           'list_menu_conf.php' => '88bd581ba21987493206e430885cd3f0',
           'mailout.php' => '5050871042ba40b90e0dac92c29dab0b',
@@ -1211,13 +1202,11 @@
           'menus2.php' => '2249f7d8b325af8945ed1a5a3e9721e2',
           'meta.php' => '6c85ff99c2707a2d6e73ac990971ba83',
           'news_category.php' => '0c0bfcbb20aea2de7508c5cc3c4826f9',
-          'newsfeed.php' => '93f7ef1481d3fc59ecde4d40ad6b6c84',
           'newspost.php' => '13fda1563ee88b65ebd855113ec7caef',
           'notify.php' => '96e76c0244bf06754516ced2bbb6a760',
           'phpinfo.php' => '201f61e8c6ba0619083a30143af56625',
           'poll.php' => '3adef894abf1c1920a311899071ff8ee',
           'prefs.php' => '4cc47a077677b93cdede1ca55e3b354f',
-          'review.php' => '6997e7c8d919246f698837c0ba3693b3',
           'search.php' => 'e9b596e5e8855fe87e8905cf0dc9a6bd',
           'theme.php' => '7ac282adfbb1f04fc10a6aa07c11e7bf',
           'ugflag.php' => '3c686a412439317be96965a4f31bb720',
@@ -1228,62 +1217,61 @@
           'users_extended.php' => 'b73f20ff4c7d9f9b9eae883b300b2426',
           'wmessage.php' => '5aa5f420a6b29adad555ef7e55bd932f',
         ),
-        'lan_admin.php' => 'ae4bbdef3610765b59d67e2858707177',
+        'lan_admin.php' => '80ec3744049875359cc8bef4a61944e6',
         'lan_admin_log.php' => '0f9dacdf93cb2d6a4145487de304cb87',
         'lan_administrator.php' => '83b1eaead32e6c500d42a74c40b059a5',
-        'lan_banlist.php' => '4b00aa5ed58a9f78ad1cbefb74dedb33',
+        'lan_banlist.php' => 'eab999e2192f8806d3c296a51ff7b304',
         'lan_banner.php' => '11d2439138f74b116de4697e066f7ca5',
         'lan_cache.php' => '0926abdc99274d71157280c9d58749e0',
         'lan_cpage.php' => 'c95be0bafa672c32d75394f94bb3af02',
         'lan_credits.php' => 'aae0c491eb54b8c529013691755044a1',
-        'lan_db.php' => 'c68b85a8b0c9817d3b996a5eac953b7f',
-        'lan_db_verify.php' => '6c6067d3b23c7c0d9f36cb17867dc80a',
+        'lan_db.php' => '74ecf348cdf654a125c7c9fd42a3aca2',
+        'lan_db_verify.php' => 'f354b3a5832e4817bcb2171b2845047d',
         'lan_docs.php' => '9df02b4a6fafef4e9be2962bfeaed509',
-        'lan_download.php' => '5b3e7f94055a824fbdecd45bdd67afe6',
+        'lan_download.php' => 'e2b7224f4413ba3e8941f1ee1e2f8649',
         'lan_e107_update.php' => '46f96e33e39b17c2ba54ef3011082041',
-        'lan_emoticon.php' => '58e2c1f2752eff0f4ec7e1e0c126e3b8',
+        'lan_emoticon.php' => 'cdafc88ae36b74acf802baf6e78d07d7',
         'lan_fileinspector.php' => '70c6b39a6d29f3c77df604e2293d43b5',
         'lan_filemanager.php' => '8955a0b3b7730d3f008957108525ccb8',
         'lan_fla.php' => 'a987a7502238c9f1dae9555d944ebd38',
-        'lan_footer.php' => '74880a9ba3fbe4524bc2f0987e936ab6',
+        'lan_footer.php' => '6469f66f5deddfd43182480282e23e67',
         'lan_frontpage.php' => '37ec01b89e67032f33498cb43e44bdc9',
         'lan_header.php' => '2a339d027e92c0d53501986fcfd71a0f',
-        'lan_image.php' => '573f928e8753db0df958df0cbdedc07c',
+        'lan_image.php' => 'cccfadd86c9101cbbe2da49d2693c374',
         'lan_lancheck.php' => '7615ba9c34ea6b3b5867d27e834acb54',
-        'lan_language.php' => 'fdc99671777e203514aae7f52939d561',
+        'lan_language.php' => 'c5a7d84c75d2434218f2b80367cd1b78',
         'lan_links.php' => '07972ca8826ee35f36ef825ff793a991',
         'lan_mailout.php' => 'bf59b50787dae47c9db0603ba86e169d',
         'lan_menus.php' => 'aff6368b11b30bea0515de7cbad89dde',
         'lan_message.php' => 'bcfd03068e0ee9d76eb1a3df969bb544',
         'lan_meta.php' => '31801b3e9c137a3b22d58e5d80d291c8',
         'lan_modcomment.php' => '7f8738c7c0b3ab882f4b9c330136b6b3',
-        'lan_newspost.php' => '0868c7b3d37352144cf2d424d97e8670',
+        'lan_newspost.php' => 'ebe79009f612996ed1115d7fe063449e',
         'lan_notify.php' => '65a1a5a108c74ba8b2db5592c06a1ecd',
-        'lan_plugin.php' => '29ced1cfb16745f64bbbce037b8d74ba',
-        'lan_prefs.php' => '08bc01aee9d766842262e2a158c31010',
-        'lan_search.php' => '039a04acb5ab8b3ef5b617e1c1fcf7bc',
-        'lan_theme.php' => '20dab981133d2106e89afe3f14169166',
+        'lan_plugin.php' => 'aa4460908fa164ec014cc13c0f567991',
+        'lan_prefs.php' => 'fd91f2780e38d89c2bf8e2c68d98e80a',
+        'lan_search.php' => '40348a80633b22b4013d2d21e623969c',
+        'lan_theme.php' => '193c87b22b71daf4d434a672c873f96c',
         'lan_ugflag.php' => '29f0ad8c752be1bf98cc067534994711',
         'lan_updateadmin.php' => 'ae3d2be7d92db3c4dd11f1e73fafeb7b',
-        'lan_upload.php' => '5a01a0c1676c4b21551ce427866edfe7',
+        'lan_upload.php' => '2343ae710abf563db9beba208370675e',
         'lan_userclass.php' => '3eedcbd961e57434d6c64f9321fddb59',
         'lan_userclass2.php' => 'e475c31e99b4867d9517705b584f5a44',
         'lan_userinfo.php' => '241d3c717696a30d97152aec8f5fcdf2',
-        'lan_users.php' => 'cc6c5b0856d4fb77f6c9cd1f31005e8c',
-        'lan_users_extended.php' => '9ae08fd0f346cf0319dc935c992f1036',
+        'lan_users.php' => '411653528916798eef8867bb81eb4ed4',
+        'lan_users_extended.php' => '23c942fbd86499777f6c1b862d0cf5a9',
         'lan_wmessage.php' => '27b96105500cdfa56bc27e391a0c2f3b',
       ),
-      'English.php' => '92d7499a17a92e1c3259e5ed3dc61444',
+      'English.php' => '737802cb8d3c4cbf03327944272bcf1e',
       'lan_banner.php' => '92308af6029553992ebc4a46e97d4e1d',
-      'lan_comment.php' => '19332dfe1a3261c78e7e67dfdf984017',
+      'lan_comment.php' => '5077890a26c5264752f585bd49dd4965',
       'lan_contact.php' => 'f6ec02eb9a5effc567f8483071105e66',
       'lan_date.php' => 'af33dd14b696babe19fd09e386c200c5',
-      'lan_download.php' => 'a66ac115b0016fda2c45091353e59890',
-      'lan_email.php' => '797f6f5e516475e8202fc171997ebdf1',
-      'lan_equery_secure.php' => '90ce9b58fa3ee0bc424dc9eab0a9b92e',
+      'lan_download.php' => '5abdb7ce5e02a3f9f2da4860fce905a7',
+      'lan_email.php' => '499e255fe29b037d49ea7b50fa679c09',
       'lan_error.php' => 'e63c154a52b72318443b0044d48ef9dd',
-      'lan_fpw.php' => '85470fb3dad6d9f765fe366f49e045eb',
-      'lan_installer.php' => '81560fd3264c885295b060968a6d0570',
+      'lan_fpw.php' => 'cb552bb8035414854363a77d844b194b',
+      'lan_installer.php' => '106c6c4936d861a4ea0ab53af7a7e9e6',
       'lan_links.php' => 'c309a9bc93d06a914bdc735efc9190cb',
       'lan_login.php' => '3bf7ecb7c00be86b54c83370fab6f8c6',
       'lan_mail_handler.php' => '001b336311279c058df01c2ae04aa87d',
@@ -1299,20 +1287,20 @@
       'lan_print.php' => '8a3e985622e8dfcc82487b0165c2bf3a',
       'lan_rate.php' => '02191b8a77011476d4e3e554387c01d5',
       'lan_ren_help.php' => '1ca40febf5f376f3dd7190f46cd26f02',
-      'lan_search.php' => '01bed4f43957214885351de0d18e0e5c',
-      'lan_signup.php' => 'bba7802c9f6fa2a5d6c3a179e7b88fec',
+      'lan_search.php' => '60c1954cd9e67fe0ef3b7176978597cc',
+      'lan_signup.php' => '29a369ad3d821d0511b3015641f3290c',
       'lan_sitedown.php' => '65c55fc812ceff72c4aba3f56dbaf4cc',
       'lan_sitelinks.php' => 'ca292ed1c514df28d693b3e8cdc6baec',
-      'lan_submitnews.php' => 'ca6c4a8e2828f6317e56a8e4bff34d2a',
+      'lan_submitnews.php' => 'b07d8acc4221fc35ee5f655f2c8e55ce',
       'lan_top.php' => 'eaf2c17d7c6e40e4e660e9a6dea851a1',
-      'lan_upload.php' => '52254da910f370cf89a14c080516e7fb',
-      'lan_upload_handler.php' => 'f61e83d33b48733bbf58c4189103b0bc',
+      'lan_upload.php' => 'fbfe1ac4ac209eb227f1992e1906d5a9',
+      'lan_upload_handler.php' => 'b97489a3c1ce2d23ea0cb1310e6aa4e5',
       'lan_user.php' => '992526de41f3848bcbcfb1134449522d',
-      'lan_user_extended.php' => '890b9ce3e1cebdc59d098a3465f7d151',
+      'lan_user_extended.php' => 'b003a855dda0633552c71fdc4b12120a',
       'lan_user_select.php' => '5632220cb249c60e812c3592f086039c',
       'lan_userclass.php' => 'be226be048b076da4873e6d23b9b6b77',
       'lan_userposts.php' => '976fa5108d96acf116bbd177d9b0f38a',
-      'lan_usersettings.php' => '76e37338a24462d18e3d405d70351913',
+      'lan_usersettings.php' => '5635c6dd65a4682216aadf54cd931c46',
     ),
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
@@ -1339,7 +1327,7 @@
       ),
       'alt_auth_adminmenu.php' => '3dddfee80a662a804a06d833ad9d2670',
       'alt_auth_conf.php' => '1aedac47a6220c61425f89a96fc766b0',
-      'alt_auth_login_class.php' => '0d10f8eab79b15e28effa341aa6b6cea',
+      'alt_auth_login_class.php' => 'd395dd61c8414835d7a2c9e9a9f6674f',
       'alt_auth_readme.txt' => '75b056df0169fa9a03bb31633d7fcbdb',
       'alt_login_class.php' => '343de18d3ab651476e092c72d484ae41',
       'ldap_auth.php' => '4d740c0d4ba51a7a8437df5fd6de3b85',
@@ -1367,8 +1355,8 @@
       array (
         'English.php' => 'bc4d844c9b0b8bb553913eb462542620',
       ),
-      'archive.php' => '8fbd24eafa2349e682fffcbcdfbddbc1',
-      'blogcalendar_menu.php' => '512b4589bee3e51d54dffa57dd2347a0',
+      'archive.php' => '4549998368bb79053db9343b9d1e7bc6',
+      'blogcalendar_menu.php' => '5b8f10870951812d9702255d129e40e8',
       'calendar.php' => '4c05e65f098d38d7ed84783a479d999e',
       'config.php' => '8bf4ecf1ebf7b0a2628081ebdee358bb',
       'functions.php' => 'f2cf77b89db87b5ac5d2a3935fd4ac59',
@@ -1420,12 +1408,12 @@
       ),
       'search' => 
       array (
-        'search_parser.php' => '05b18b0087a2816766543bce7da0b5b1',
+        'search_parser.php' => '46ad148c6924dff0789cffa7240d895a',
       ),
-      'admin_config.php' => '1c338819605771130c4becf79f05cf06',
+      'admin_config.php' => '637d77a1f80e4fc40d4772e285e52a82',
       'calendar.php' => 'cd96dede903591eb4e609ae9b1aea129',
-      'calendar_menu.php' => '1cef409ba6b91f87b2c7361b9f3f5d7e',
-      'calendar_shortcodes.php' => '902d42e033e1d4ea3d1424be96f249d7',
+      'calendar_menu.php' => '89fa2cc5825235633565c48682940e16',
+      'calendar_shortcodes.php' => '11527ca7c08d741317d6b4c467428067',
       'calendar_sql.php' => '39899457df794d8b56c58d3b1c8db88e',
       'calendar_template.php' => 'd852ceef7f6c8c10c5b10db571e16ccb',
       'e_list.php' => 'bc86836aabe7f01b4285d512a3079e9e',
@@ -1433,13 +1421,13 @@
       'e_rss.php' => '077b415bf70aaae7b8de3d55a5912632',
       'e_search.php' => 'a1681c6fed9972dd140b72b3ebfbd3c8',
       'ecal_class.php' => '8aca3973a9722d4e29aabcf54b488c99',
-      'event.php' => '5edb018949600600fe3769e6507f4704',
+      'event.php' => '8af08a9c55c2f1b8c78dadc0cf6d2565',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'next_event_menu.php' => '6d1819f703dc045efa0fd1a4041e6545',
-      'plugin.php' => '7e5ed3e5d637ff6239c0e7ed8ec84e35',
+      'plugin.php' => '350495d7a23233b13d47792c1c65e0a3',
       'readme.pdf' => 'bde9420355a7306b71df8c5143575347',
       'subs_menu.php' => '816619639ab421ff3229f6536bb33416',
-      'subscribe.php' => 'a7e9baffa5250f183edcc3449a0b0bfa',
+      'subscribe.php' => '4bb2bd64a5ef6aa97f9d70e0401ee465',
     ),
     'chatbox_menu' => 
     array (
@@ -1463,10 +1451,10 @@
         'search_advanced.php' => 'b7a8eab8e5969256ab578277c92d3c47',
         'search_parser.php' => 'c576ea7d07ce91c106c3bae38912237c',
       ),
-      'admin_chatbox.php' => '75780140254afd39349fe286a5c72669',
-      'chat.php' => '860bf5dbfc5f861df1f74f0c944e6957',
+      'admin_chatbox.php' => '6f1214cbae4b9154a4c5e779b307fe44',
+      'chat.php' => '9841a76774363747857756af2efa089a',
       'chat_template.php' => 'cf97b7663cd4177f9c7ac299318ef8e5',
-      'chatbox_menu.php' => '350f84c6d36f7ba4b8ac6e7edf3d3280',
+      'chatbox_menu.php' => 'b6b23b0ebdff7d4bccaff45896edabf6',
       'chatbox_sql.php' => 'aeb0d501ff23212e304f7f9a83d6926d',
       'e_list.php' => '11fde3fe8b58bec52bc6220053498509',
       'e_notify.php' => '379fbef832829bc4e9188b9fed62f31f',
@@ -1485,7 +1473,7 @@
         ),
         'English.php' => 'a6414a6871116b964cc12d77d72b2748',
       ),
-      'clock.js' => '576433d4e5242c567e6c6d0d97b7ca73',
+      'clock.js' => '98871f097e7b77f981df163421edb721',
       'clock_menu.php' => 'e0d33629ca46324479cf344eb2bdbdd8',
       'config.php' => 'b5c6e83c7f9141ade22165ed62ed1884',
     ),
@@ -1496,7 +1484,7 @@
         'English.php' => '10c5f9fd588de9eaa9bf96b42b11b535',
       ),
       'comment_menu.php' => 'd3991926641aecf015f1acd6a3baeda6',
-      'comment_menu_shortcodes.php' => '4c212b7efffa496ec8b5280528d46259',
+      'comment_menu_shortcodes.php' => '5235639944dc6888113f4615c595ae5d',
       'comment_menu_template.php' => '17f0cb0b44f43d0cf62770f2b7cb4526',
       'config.php' => 'd8e5bd9258392c98d02009d552401aa4',
     ),
@@ -1511,18 +1499,18 @@
       array (
         'English.php' => 'fa122fc7d21d653f3bea9f1a790cb173',
       ),
-      'compliance_menu.php' => '4d0b73ff1df3ee7003286d61ad443478',
+      'compliance_menu.php' => '86b24e279294b5fc15099f08e5214fe3',
     ),
     'content' => 
     array (
       'handlers' => 
       array (
-        'content_class.php' => '596da39e8137e9a92c93425abc2623c4',
+        'content_class.php' => '4400a94a9eb69518387405b6ad2682d5',
         'content_convert_class.php' => '2e05d94418f8960eaac431741ce402a1',
-        'content_db_class.php' => '1029aa4c0652a3d846592b4494c8e7a4',
+        'content_db_class.php' => '7f4bdd8379cff76434631731968c5d8f',
         'content_defines.php' => '784711a6c68dc17c7752fb084400229c',
-        'content_form_class.php' => '64e3e202792d28b837e2a86fc953fde6',
-        'content_preset.php' => 'd3bccd4ed8b20426222fadbeb6063cba',
+        'content_form_class.php' => '3f9f7a0dfc6801dd240b2a47d8f30ff6',
+        'content_preset.php' => 'b91ea8f88734c800267bcf9761f2ea94',
       ),
       'images' => 
       array (
@@ -1600,8 +1588,8 @@
       array (
         'English' => 
         array (
-          'lan_content.php' => '45d9ccc1d7a7d16b0332d5a0049bb836',
-          'lan_content_admin.php' => '856dfef2e8887b83040ccbb5b33f088a',
+          'lan_content.php' => 'd6713020953b1639800b1c465af6a741',
+          'lan_content_admin.php' => '8f25ada52878c4c2d9107f55a828c468',
           'lan_content_frontpage.php' => '1593838cd7ec925d50576a815bd3c9ee',
           'lan_content_help.php' => 'd7cea6d1b8db2650fce4962ddfcd295d',
           'lan_content_search.php' => '2b479bcefdb3b45f19c93ea5ae6bd221',
@@ -1615,7 +1603,7 @@
       array (
         'search_advanced.php' => 'c6c6ae35cd1020d27a861ac693347560',
         'search_comments.php' => '34b14edbe1d2e8fbac541dc03262b21d',
-        'search_parser.php' => '279e6a587720b6686f7f71d847f54f35',
+        'search_parser.php' => 'bd879427b3e98dea676b02fc4271f8e6',
       ),
       'templates' => 
       array (
@@ -1624,12 +1612,12 @@
           'content_archive_template.php' => '62bb9c57b8d97b412d589cac9bf201e1',
           'content_author_template.php' => '2f6f195b33d930334ae20cc60b8ebbcd',
           'content_cat_template.php' => '5470141c7a45562e154813450ce2c5c6',
-          'content_content_template.php' => 'bc29f18104b597287e028b812651461c',
+          'content_content_template.php' => 'c98f26d1ef3325bd38a950169020d8a0',
           'content_content_template_bigtext.php' => '66fa5e0429ce2b3c1e1a74a1a01fdc25',
           'content_content_template_blackonwhite.php' => 'd0d7f73a3c1e269f10980879156dcdd2',
           'content_content_template_whiteonblack.php' => '7200173ea254fde9a8e9dc33f030c791',
           'content_np_template.php' => '2ad6c3c80a4fd2e14de8d2c8ba75fb9f',
-          'content_recent_template.php' => 'ed27692b0ab66df27fead9bc5015dde7',
+          'content_recent_template.php' => 'e9cc5090b83159131b2e9da83c6c4dbb',
           'content_score_template.php' => '4272ddd2bfeb3698a88876411eab716c',
           'content_search_template.php' => '30e7bf5ba4a25ab6f1eca9b522e75597',
           'content_searchresult_template.php' => 'ea466f98d73a18d1e727fb3b4708a678',
@@ -1637,15 +1625,15 @@
         ),
         'content_manager_template.php' => '6ab7ef97e7f4312f64766097aa9f0fc1',
         'content_submit_type_template.php' => '7b02354f168c4584ddd25ae8cca95977',
-        'content_type_template.php' => '09a3aaa479ecd0a50055998fc18b7110',
+        'content_type_template.php' => '178512ba5abfce22a227339ecb5f0f73',
       ),
-      'admin_content_config.php' => 'eadd444a88a1942065596ec5d710abde',
+      'admin_content_config.php' => '5eaadc48ca7f9d18cfcbba35937e778e',
       'content.js' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'content.php' => 'f714bcd07b21c334ecbc143c6361d17e',
-      'content_manager.php' => '2ca76d9420ea8c40d91fa410f099e19b',
-      'content_shortcodes.php' => '6eec7325d2ccaabafa89f0f76ac91a78',
+      'content.php' => 'f50ddf3a0d5d630357fbb935e40ba149',
+      'content_manager.php' => 'ca564f775f6a34bfe8df6dbf3da3bd91',
+      'content_shortcodes.php' => '96a10b5cbb7f7f37d7fbcf147f5b2969',
       'content_sql.php' => '2632a603dd04ed62bbb3f011d3c5de41',
-      'content_submit.php' => '00b3c60d1ef87219af86ab253dc732d4',
+      'content_submit.php' => '15c56c828ea76a15aff7f020c0806d8f',
       'content_update.php' => '3820d50a8de13fe523bc58e949229e67',
       'content_update_check.php' => '83b6aa48eb79b70555f5d2d578baa07d',
       'e_comment.php' => 'e5a8abcc72deaf2fe9c0a8b5eb4887ea',
@@ -1654,10 +1642,10 @@
       'e_latest.php' => 'a2ddba2f8b0e67309960926086a0c985',
       'e_list.php' => '07f0e1369439b9927ac11d48b6deeb06',
       'e_meta.php' => 'cbb645eebdedb216511c413fe64991a8',
-      'e_notify.php' => '71dceb8ed800b8aa97dbc7a79628a8a5',
+      'e_notify.php' => '66aca77c03a989a7466472266ff76939',
       'e_rss.php' => '76954b881d598f26ecaebb4422f87696',
       'e_search.php' => 'd86c2f562c466bd7200974bd16f07c45',
-      'e_status.php' => 'e327fef8f0ea1ad19fe9579b4f2ebe91',
+      'e_status.php' => '8ff6f7bd53147cbefecaadf3747378b2',
       'help.php' => '950985bb6c445147d901bb4fb00b0f1d',
       'plugin.php' => 'cfb9004ff38e24cb87370ceb9017867f',
     ),
@@ -1685,9 +1673,9 @@
         'centered.php' => '39693534a9eb1b5e00d263fb22b4ded3',
         'default.php' => '4ae642d4bfc6b53350d75197182330f7',
       ),
-      'admin_config.php' => '61506bca5d21856190eb627f4b603975',
+      'admin_config.php' => '773de81a3c2d8bdbb714e280277500ec',
       'e_rss.php' => 'e3b277cca6f5262dcee948434aacfc5e',
-      'featurebox.php' => '196e5d4286ac7b19cfa34e66ec382979',
+      'featurebox.php' => '58326f62f0251b8660d3040097cdd958',
       'plugin.php' => '39f2a1375fe640e6cda8347ff7ab8de3',
     ),
     'forum' => 
@@ -1809,17 +1797,17 @@
       array (
         'English' => 
         array (
-          'lan_forum.php' => '8496b78042381e1eb0e55919386b1261',
-          'lan_forum_admin.php' => '796328f81eb77d6c218ad978e83911b9',
+          'lan_forum.php' => '9875770dea852891260e131cd6f07882',
+          'lan_forum_admin.php' => 'd4689a6f1c8ce14fa4172eaa86508c56',
           'lan_forum_conf.php' => '44f0d7ca6da7d71004e1acd9c1f04f70',
           'lan_forum_frontpage.php' => '5ac941c384cf10a76b6ab040f7ee7986',
-          'lan_forum_post.php' => 'd92f497d14b273b09d3f6e1c3dffea21',
+          'lan_forum_post.php' => '369a256d811d2a36f9a49448c7ee3cc1',
           'lan_forum_search.php' => 'dd1263ff01cf0b71991de16756677f68',
           'lan_forum_stats.php' => 'ecccb2b57c568336e5b1accfa29ad08b',
           'lan_forum_uploads.php' => '840b741edd3f2d8fcc340b29804689b5',
           'lan_forum_viewforum.php' => '7b44a441080e2b1a40b8c37944d9a719',
           'lan_forum_viewtopic.php' => '867fb663d2d3cff381f01f08db23de98',
-          'lan_newforumposts_menu.php' => 'affcfab7c6a7dfa7ba9fd1c134075919',
+          'lan_newforumposts_menu.php' => '24b49b30384cc3caef121fd6c2f2f590',
         ),
       ),
       'search' => 
@@ -1829,41 +1817,41 @@
       ),
       'templates' => 
       array (
-        'forum_icons_template.php' => 'ac7e8c8f02f32719f64cd5bde7ec5f20',
+        'forum_icons_template.php' => '7a1550fd2f17636cdfd257e6a3c5708a',
         'forum_post_template.php' => 'f1017fb9b9ae6c73691d27b4da2d8cd3',
-        'forum_posted_template.php' => 'eea66e0ed7f2d2a51c5e01a07cb871aa',
+        'forum_posted_template.php' => 'd0790156815c4f32a794becbe68da4cc',
         'forum_preview_template.php' => '11b636f1bcccded162fcf42880df5b5d',
         'forum_template.php' => '725a50b55d6e76a9844821992601aa67',
-        'forum_viewforum_template.php' => '004aacb79877ac05b538d320c8294b85',
-        'forum_viewtopic_template.php' => '57b91f8b3ad09f48010d4d4958623f26',
+        'forum_viewforum_template.php' => 'b57d11f7e8b34a77b95d8a7154dbfc7e',
+        'forum_viewtopic_template.php' => '86bb9e4bb1cb15c4f311783899e736a4',
       ),
       'e_emailprint.php' => '8a41fe10faf7c2293a65bd66e598dd82',
       'e_frontpage.php' => 'c939394e051b055ccbc963d17b1a1d46',
       'e_latest.php' => 'ba485c38b9ab90c0f572a2397b49c9f5',
-      'e_linkgen.php' => 'e0cdc0183ce0cf9adbbec54271c55766',
+      'e_linkgen.php' => '3184982dc3f9321a1d85df7cc41acf70',
       'e_list.php' => '523f01012192923c6901b7c088101ec0',
       'e_rss.php' => '2d0f0839621d9d4539895e2047a76476',
       'e_search.php' => '663a93cb1f0d05351ecbb85a3bf721d4',
       'e_status.php' => 'e707e64a960612d443e16906faaf0e22',
-      'forum.php' => '35a1744e058ca88ee47e966088ac1923',
-      'forum_admin.php' => '741d27d12226bc98e4576697f4b97efc',
-      'forum_class.php' => 'cec775f3d1561a4262c76c438c02de69',
-      'forum_conf.php' => 'a4a4e140bda4b3d7cd73abd03170dc5b',
-      'forum_mod.php' => 'bc6667cba8050bd3a2c015dea9bcd730',
-      'forum_post.php' => 'd651a56661feb695867f8b914e2ed5d0',
-      'forum_post_shortcodes.php' => '1b976852110cac3652082c43777e3dc3',
-      'forum_shortcodes.php' => '06545816dec1484394144caeffb71a39',
+      'forum.php' => '0bd4c27751efefb21188c3b483a822a7',
+      'forum_admin.php' => '17d086b87f55405546d2db805ed95598',
+      'forum_class.php' => '4d6d9eabf1659593be329988f58927fc',
+      'forum_conf.php' => '6cacab70081de88058215040494143b8',
+      'forum_mod.php' => 'edd98521f3e8c94534c72b39bbc131ee',
+      'forum_post.php' => '002ded97314d02b2f07522ac04ea3ac1',
+      'forum_post_shortcodes.php' => '58d0390a6fa95d713603a203025eb3f2',
+      'forum_shortcodes.php' => '4ea46b16b799b6c4bbf7e65ebce6ff19',
       'forum_sql.php' => '3355b8219c200d8d669ce08e59053465',
-      'forum_stats.php' => '9906e300c4764aa55e54d745ff3bc471',
+      'forum_stats.php' => '60f85eb68183f58c59696073a463c125',
       'forum_test.php' => 'ed668e3268952cb268b3f4aca0d2e37a',
       'forum_update.php' => '8e1fed1bae66e84eb3ad0235a60f0c69',
       'forum_update_check.php' => '95b6355554098357b5648807c4e95705',
-      'forum_uploads.php' => '3ae344a843771d9ee6e578a1ddd84f8c',
-      'forum_viewforum.php' => '53b717a8e1515fde643c25b89ae92e25',
+      'forum_uploads.php' => '64ef8a41ae3938271710a64d622bb830',
+      'forum_viewforum.php' => '2f35f7cafbc651fe80991d4b7c83c1ed',
       'forum_viewtopic.php' => 'ab460e959ba4523374375e92abebb874',
       'index.php' => '1d225ecdb6dfb425fcdd39501ed196c7',
-      'newforumposts_menu.php' => '294da398e0ec6c0114c8d41e203cd411',
-      'newforumposts_menu_config.php' => '8c7c855777e097fe6b8d92f9ef4e527b',
+      'newforumposts_menu.php' => '0f8bc9fdf06e0edc12e08f843b873f8d',
+      'newforumposts_menu_config.php' => '264e2763fdd9f384af958c3d76272a5e',
       'plugin.php' => '871a97116e50c74039db5f2e3c96d040',
     ),
     'gsitemap' => 
@@ -1877,7 +1865,7 @@
       array (
         'gsitemap_English.php' => '350d69eb976b596ee599530d5e6bff1c',
       ),
-      'admin_config.php' => '4a582593a83c6353f6b2c49371623301',
+      'admin_config.php' => 'fa16c78782068e63df9cc9d1301f289b',
       'gsitemap_sql.php' => '81a34608c8cdd19c51fece5a25109159',
       'plugin.php' => 'c88f725348400384ef5721432e9ad169',
     ),
@@ -1893,7 +1881,7 @@
       array (
         'English.php' => 'd78c5a1f0cd1dafde8fe3bf33083db1e',
       ),
-      'admin_integrity_check.php' => '0336e89bd0664a6e4ad9ff2c1ba9c236',
+      'admin_integrity_check.php' => 'fc38aac66a949bc1737ccd86b5c4b569',
       'plugin.php' => 'b32f26e2fc819c93a60a0c53692888fa',
     ),
     'lastseen' => 
@@ -1919,7 +1907,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => '2ccba0ca70987d6c5bfece279e25957f',
+        'English.php' => '0e6f9fa458d2a33b91ae81db30d2527e',
       ),
       'link_images' => 
       array (
@@ -1935,17 +1923,17 @@
       'e_comment.php' => '13b0aa38e21d08a535276a7526cedde2',
       'e_frontpage.php' => '0a352c2a0b559b9d930943f1928f9d45',
       'e_latest.php' => '6ab452dd2d2d46749d5149c5fd1905fc',
-      'e_list.php' => '9a49a4d6a015fb3fff2cda7a4ef788c1',
+      'e_list.php' => '41486a930bbaf136d0a371c3201aa0e6',
       'e_notify.php' => 'eab13b015f9b5fa679fef28f63d72dde',
       'e_rss.php' => 'd213cc9cc0d5eeed3442b861e565961e',
       'e_search.php' => '7a7416dde4bc42481cf92431f4832b65',
       'e_status.php' => 'e1b28e610e6f89277440430a2f8747d8',
       'help.php' => 'a8495b50a8243ebbb3e37c8bcb169184',
-      'link_class.php' => '54cdcb1762817c504b6d81ed7924ad96',
+      'link_class.php' => 'd0fe2ec97894b8b6917db210e4fcdc38',
       'link_defines.php' => '1c9c8a4d29cac5f35e2164805bb3eca6',
-      'link_menu.php' => '20fd34d3e851223a174d56533dbb83a6',
-      'link_shortcodes.php' => '614948aa511415a9d151b16a0518c4ba',
-      'links.php' => '10d1f4b2e4ac07ad1a17c60ad5cee6a0',
+      'link_menu.php' => '3520965348d79de448646454ddb04565',
+      'link_shortcodes.php' => 'b5a7e82698ff7574d1d777cdf834386d',
+      'links.php' => 'e90962ab7e3c65d29830deb12b5b96ae',
       'links_page_sql.php' => 'ebe16a35037a69b93eaa929782ca66ba',
       'links_template.php' => 'b578512e4b94cd623ee3cfcf5d0be178',
       'plugin.php' => 'b05df4d36293f4c2e2b949b3006cc712',
@@ -1959,12 +1947,12 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'ad0d4babe14fbc9317ba40e34833bd58',
+        'English.php' => 'b135d2e84df7694ff086d7715eb2898e',
       ),
-      'admin_config.php' => '84e9d47d8301b15c0ea3e88c2d7b68dd',
-      'linkwords.php' => '6dbac4b16a1acaef98748f838f2fbf2e',
+      'admin_config.php' => 'fc16dfe98e95a1a80669ef9ec6d67899',
+      'linkwords.php' => '3fdd194464d07cd1ccbbeca79732a2c6',
       'linkwords_sql.php' => '33f4d40e8da9aa758c512d4847f6d5d7',
-      'plugin.php' => 'cda5616cc5cdb77a82392fe4d34d3ab4',
+      'plugin.php' => 'eff85c9026041473b4fb5cc355ef51ad',
     ),
     'list_new' => 
     array (
@@ -1989,20 +1977,20 @@
       ),
       'languages' => 
       array (
-        'English.php' => '3f559f59bef22144d80b09ea599732ba',
+        'English.php' => '93b83d6d3e219b957a0aeb31e9cdaadf',
       ),
       'section' => 
       array (
         'list_comment.php' => '5efa984e2682a3fd37cffc87d8e8f94c',
-        'list_download.php' => 'd0c7e07e3fe2372c7a8eda1562793b67',
-        'list_members.php' => 'e49b1b7cfad6246287a43e59f803cef3',
+        'list_download.php' => '3102c9800ca28fa39e5bea9ec29efaa5',
+        'list_members.php' => 'f2cec9a4125081502c309f794f72dc1b',
         'list_news.php' => '7faa1d6728ff1e692aa834ac4027c4e0',
       ),
-      'admin_list_config.php' => '6a0ec89c7fc52da5ba7cfe7ba647d530',
+      'admin_list_config.php' => 'ca675031ff789bcf4f75e9ce98d86b87',
       'list.php' => '40e2923674835fe1c404219d164e7a92',
-      'list_class.php' => 'd114b0dc8172a77aea197a0d42084fa8',
+      'list_class.php' => '3a9e726f920139c0b3e628113ab443ea',
       'list_new_menu.php' => 'b130b1aeb94b0c494dc77f6c58c7a19c',
-      'list_recent_menu.php' => '83c2f61863857d3ce02539a668e98083',
+      'list_recent_menu.php' => 'a8cffc271ef0637df899195561e07cb4',
       'list_shortcodes.php' => '1c4972d09e83f1945c6652126bba6248',
       'list_template.php' => 'ca73750411b19f1b8df71c5111fe1789',
       'plugin.php' => 'c39cfd9c145036b3cfbfca56aef150dc',
@@ -2098,24 +2086,24 @@
       array (
         'admin' => 
         array (
-          'English.php' => 'a60ef592a7abd135da04b6cc482c992b',
+          'English.php' => '06b1c15da4d655b002cd2a5c9e59852e',
         ),
-        'English.php' => '583eaac1a83c65da8e8d697ea4dd8058',
+        'English.php' => 'c4f4a5f7525aae287a2aec94f5aef830',
       ),
       'logs' => 
       array (
         'null.txt' => 'd41d8cd98f00b204e9800998ecf8427e',
       ),
       'admin_config.php' => '67f5b9dd7f192b2dc8ca820a348f9ba7',
-      'consolidate.php' => '1a17455630a62ef78d2c14778845df31',
-      'e_meta.php' => '70eae996ff1b54a3ddc1cea0a737320b',
-      'log.php' => '5ae5383b4abb6273e4d2b45850559d52',
+      'consolidate.php' => '98cc86b8054e93d3f86f150504f0940b',
+      'e_meta.php' => '6f94262ca53688c5466e906f0d2f9dd4',
+      'log.php' => '309b0e75cb210dabbfbb17b940576435',
       'log_sql.php' => '6593acd37950a8e486b0fc1490cf1750',
       'log_update.php' => '619bea78d9c76a1ec0cd4c44eeda36c5',
       'log_update_check.php' => 'f4e7f5fb3767e4c19adae8cb5e41e62c',
-      'loginfo.php' => '68c8cc11daadec40bfbae1f4b9ece53a',
-      'plugin.php' => 'b078f64e2aab381fb9f99a109dd96262',
-      'stats.php' => 'd4d9200b6df966437eb88aefc8a8e3c3',
+      'loginfo.php' => '854e51cd364a5f34bbb98559a1d997a5',
+      'plugin.php' => 'b15d463132ce97a2f6e06af1a0a976d3',
+      'stats.php' => '07f505dcde9167765847d0419c67aec1',
     ),
     'login_menu' => 
     array (
@@ -2124,8 +2112,8 @@
         'English.php' => '3be9768e81217f108c055cff9f15c8d5',
       ),
       'config.php' => '5f0c8229c96c4d4cf5a806bfc8d1a1c4',
-      'login_menu.php' => '5617c07086b77c79d5c1e6548928536f',
-      'login_menu_shortcodes.php' => '4232d61c5e9f401c023de6888cbe4d99',
+      'login_menu.php' => 'f666063fe9ec095244f2f0366511cf06',
+      'login_menu_shortcodes.php' => '8eab22364c2413bd5957406cca4dabf3',
       'login_menu_template.php' => '88e210369bd4f7ba640e0008b274d782',
     ),
     'newforumposts_main' => 
@@ -2142,7 +2130,7 @@
       ),
       'admin_config.php' => '965609648b5052dad40742d8c76b8bf9',
       'newforumposts.sc' => '92de176e2d3503f91b9389d053d34348',
-      'newforumposts_main.php' => '53e0ce09459853547bd35154e74f25e8',
+      'newforumposts_main.php' => '11236c5ba693d7f86b2349e1a0606a7d',
       'plugin.php' => '81caf517e35d6fdb13bf56fb6ab5395e',
     ),
     'newsfeed' => 
@@ -2166,8 +2154,8 @@
       'e_frontpage.php' => '2a8967b05bef4a2eb6b771ca44e6bf01',
       'help.php' => '7942458e34eb69cdad92cc7d9454f626',
       'newsfeed.php' => 'b822c0fa9ace6409cef05d73eeae3ff5',
-      'newsfeed_functions.php' => 'a06e7301f737550e69d18c85dc1a3153',
-      'newsfeed_menu.php' => '4ab274b2b3dde37f3807457aaeead9d9',
+      'newsfeed_functions.php' => 'f2a9d1c7ee7d30c3002bc754614aedb8',
+      'newsfeed_menu.php' => 'c6719765d152055b42afd2e9ae7b55e5',
       'plugin.php' => '9518316c3bbd37326a4c1383ae1d550d',
     ),
     'newsletter' => 
@@ -2181,7 +2169,7 @@
       array (
         'English.php' => '5fe08735f2bf070770827d051fcd69cd',
       ),
-      'admin_config.php' => 'c6e4733cffed8bac3cbc27115476404e',
+      'admin_config.php' => '22db9734164abc83043b3bb986f4d54b',
       'newsletter_menu.php' => 'f8b8ab30443dea6a8dbb2e27c17799d6',
       'plugin.php' => '5c491459a08ab61854fb5a8f56230f66',
     ),
@@ -2193,17 +2181,17 @@
       ),
       'languages' => 
       array (
-        'English.php' => '80ef79863e369f62df51b9659551a432',
+        'English.php' => 'e63cf09582f478d2ff58be425172c10a',
       ),
-      'online_extended_menu.php' => '16d72e57d0cae0206e0a079638f23d83',
+      'online_extended_menu.php' => '8e6ef2cc774b9c43ee628ec04c000ff1',
     ),
     'online_menu' => 
     array (
       'languages' => 
       array (
-        'English.php' => 'e7753b75880a1b606b6f525d736893cb',
+        'English.php' => 'bd66c994b8542abd18b70669d43ecfee',
       ),
-      'online_menu.php' => 'ba0b67252034c72c5a002aef708082bc',
+      'online_menu.php' => '0f7f9207ed2831dd50811d22a131a2d3',
     ),
     'other_news_menu' => 
     array (
@@ -2211,8 +2199,8 @@
       array (
         'English.php' => 'b04593965071e6f5bd46286fadcec456',
       ),
-      'other_news2_menu.php' => '23ffe78f7e74092c6505bec603c04ec0',
-      'other_news_menu.php' => '43943c839fbd809ae19b75ca7b296451',
+      'other_news2_menu.php' => '0bbd3ae78d234000ac84adb5f5d04195',
+      'other_news_menu.php' => 'f51dfcfb4bb737285af7b824aa1342d4',
     ),
     'pdf' => 
     array (
@@ -2240,7 +2228,7 @@
           'iso-8859-9.map' => '4d8ddb1b69f39e44b88addd04269e684',
           'koi8-r.map' => 'ed1be11b650e23bcf0804524d0299e73',
           'koi8-u.map' => 'd445ee6c5ec5f2edd31fdc48724dd168',
-          'makefont.php' => '412c5335ef10e2fed8038a8ac5798971',
+          'makefont.php' => 'edf1f21f1463ff604f7ee7edcbdc1d9c',
         ),
         'courier.php' => '16234bee90ef280e42cb167d1ba2c60e',
         'helvetica.php' => '3dbdc93d4d688b45bfc6f4e49c45116e',
@@ -2264,13 +2252,13 @@
         'English.php' => 'cdc4aab2e1c8caf5ddf209e32946c623',
       ),
       'admin_pdf_config.php' => 'ab75370cbef1f9e7d32448717071eb82',
-      'e107pdf.php' => '2911ada133d8c7b104f553e8232361e1',
+      'e107pdf.php' => '08533fb50ba86d606ab74f993a30fb95',
       'fpdf.css' => '35c07d5049ac6e55b8ab473c6dc38bf0',
-      'fpdf.php' => '47653b1a92f6a51cec644abc9b267bdc',
+      'fpdf.php' => 'da7385d29345f1c12fe85b6cacf5e905',
       'pdf.php' => '9c05a56fbb296b60cddcfc68ec1ae2c3',
       'pdf.sc' => 'cd179b47d126ac55eb48cdbdbd4c1a19',
       'plugin.php' => 'd5aba62f42496d21e3ec8d48ded5b3ba',
-      'ufpdf.php' => 'fe9444d6d9c0553bd06fc1904b0df484',
+      'ufpdf.php' => 'ba87afe3cb2f777f921ea8a3a0457abd',
     ),
     'pm' => 
     array (
@@ -2297,25 +2285,25 @@
       array (
         'admin' => 
         array (
-          'English.php' => '8c6ed48f14ef1bf19bc22f97b48494db',
+          'English.php' => 'f30bf8da455c1573531b2d9ac3397f4f',
         ),
-        'English.php' => 'ac6ca2e308d6d15e11b4d322298bf3c9',
+        'English.php' => 'a44c2c8b5b71a6f863ccf89acb9ef5ee',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'plugin.php' => 'c89f4e634476ef16447a5375f39ce495',
-      'pm.php' => 'a5aa043661c8230e93b8cb4effcc8007',
-      'pm_class.php' => 'df040f82c02af492432c132c0887a9f5',
-      'pm_conf.php' => '4219da868fbcd4ea43ecb050eec83fac',
+      'pm.php' => 'e0597865c2ef1d9a6ccc80fb1101f685',
+      'pm_class.php' => '1e927b58800d229fe53d01c901eb744d',
+      'pm_conf.php' => '814f47b30db1aa07075469c0d1bcc4c0',
       'pm_default.php' => '0213fb9bcfe60d37041f44136727649b',
-      'pm_func.php' => '4b9c0a299c8995c1e6f6aab4071d2e17',
+      'pm_func.php' => '272fe7e8516081d5f645a75b3e349aed',
       'pm_notes.txt' => 'df26332907da1f35c4731d8893aea23e',
-      'pm_shortcodes.php' => '944e2f2957ae880e49684f724cad8ab1',
+      'pm_shortcodes.php' => 'd1724a0b4d71996bf47758db99aed5dd',
       'pm_sql.php' => '4608486c1027c6485dc32674fd536dc5',
       'pm_template.php' => 'cc1bdd12537404e75f9bd6dca8022292',
       'pm_update.php' => 'e66fc6610e273471a212471e07598710',
       'pm_update_check.php' => 'a5b341b5373844cdfc1f961fb3d3151f',
-      'private_msg_menu.php' => 'ae1b1a633de92742b1d8460a6fa5d9fb',
-      'sendpm.sc' => '8e2ef687982946d62df06bf6e9bdbc24',
+      'private_msg_menu.php' => '71c696f7977dacaed9b4005f036c6035',
+      'sendpm.sc' => '6318c4f90564ce0bbd87a3e16c03c30b',
     ),
     'poll' => 
     array (
@@ -2329,7 +2317,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => '36b348fdefe092023ee513a4b1e6aaae',
+        'English.php' => 'cef29d01cf75fee6eb333d68db0c1c67',
       ),
       'search' => 
       array (
@@ -2339,11 +2327,11 @@
       array (
         'poll_template.php' => '0c83f7e4984e9a0b8bbc196262cc650f',
       ),
-      'admin_config.php' => 'ba8fbd550cb0e34cdf445d117f5c93cc',
-      'oldpolls.php' => 'ae016f0aa026a6a9de8af8d24de53ff9',
+      'admin_config.php' => 'eeea52c7fab3125610a8e3903c0be8c9',
+      'oldpolls.php' => '4a873e55c457ae529acb447b28e06780',
       'plugin.php' => '6dff875dd04ce5d602f4b64b7732610e',
       'poll.php' => 'b51353ac9b1d4f9664b954d528644547',
-      'poll_class.php' => 'd5e58aa6c9ab5b63d51ab7b36fdf52f0',
+      'poll_class.php' => '122e323dd89c832f16bb84418cc2a895',
       'poll_menu.php' => 'b2e1d5b8d5e8cacf51e2724446b663c1',
       'poll_sql.php' => 'ffe53748dbd1504f7c4204027814064a',
     ),
@@ -2359,10 +2347,10 @@
     array (
       'images' => 
       array (
-        'rss1.png' => 'c25701747091968c0f31dfc76f2cefbd',
-        'rss2.png' => '9382a50cb221e9e6b829df2a7f52d461',
-        'rss3.png' => '0a9bb4cb46a75b34db034ce6f2b763e6',
-        'rss4.png' => '9f9b20c3cdd5cee6072eda153278bef7',
+        'rss1.png' => '9f64a2ca9d7779e5e7b61fbb4078f2b0',
+        'rss2.png' => 'd6b9e345e98b794845331a890616cac7',
+        'rss3.png' => 'ba7ab2130a34daf1ee89f62856a4fe6f',
+        'rss4.png' => '71a5149dceffdae203aa569c2100657c',
         'rss_16.png' => '276d6e7671548aea71f2c64b026d731f',
         'rss_32.png' => '22602a166d61764a13184506dd75ea6c',
       ),
@@ -2371,11 +2359,11 @@
         'English.php' => '90ba4c3b30c128eac2a16d0007416c89',
       ),
       'admin_prefs.php' => '511047205732e1f3a5098052e3a2eb4e',
-      'e_meta.php' => 'cec75314cf27f19abc2ee1cbaa15c99a',
+      'e_meta.php' => 'af7e8b4a56e0d4cbb7a469dea4b86f9c',
       'plugin.php' => '46b1e37c9d18e6872083425afb3115fa',
-      'rss.php' => 'd2da7783fcbfe777929b54f93bf16a73',
+      'rss.php' => 'df74feab6752fd849e0e706c38dbea0f',
       'rss_menu.php' => '1be0ce84109cbbbcdadf68cc93fb5c20',
-      'rss_shortcodes.php' => '5f78ac16412442bb16f729c6e71c582a',
+      'rss_shortcodes.php' => '740879dc0f3e68bcb125521d32977601',
       'rss_sql.php' => 'efee18037cab9fbf35cdf81f97efc2a3',
       'rss_template.php' => '023614657d162b0f155fbe50e6e3dce2',
     ),
@@ -2411,12 +2399,12 @@
       array (
         'English.php' => 'e482c4c1b04b71a713e8aa21cb4b047c',
       ),
-      'admin_config.php' => 'd1222ea1494b8b8c06247e72fb5d2f9f',
-      'e_meta.php' => 'dee500df70205a00f524a0b0720205c9',
-      'modtrackback.php' => '97d65e889ac0682d106186d4c989e6ca',
+      'admin_config.php' => '33cdfe877fe26c13f06e973e23d076d1',
+      'e_meta.php' => 'f773d59990b39abd93a8a18f676d5770',
+      'modtrackback.php' => '120f0b85ca303f8ad9b1d9877a0be163',
       'plugin.php' => 'faaf0e70297414b7f61db1a8f030a02c',
       'trackback.php' => '68d35830a04bc5283cf0ab718b3ee2f2',
-      'trackbackClass.php' => '40cf1ea472926781f7ce51d0a9653f6e',
+      'trackbackClass.php' => 'd1ea513f324fc8583042f7c16dc5215f',
     ),
     'tree_menu' => 
     array (
@@ -2425,7 +2413,7 @@
         'English.php' => 'be4478e772ee1e1189a57284891582d8',
       ),
       'config.php' => 'a78276d858ff5dcaf1980939ea0d9578',
-      'tree_menu.php' => '81ddba9d61a54caa9c8b74d80ae1f439',
+      'tree_menu.php' => 'be6a4a6eb1a8b545189b4d82b248d4ba',
     ),
     'userlanguage_menu' => 
     array (
@@ -2433,7 +2421,7 @@
       array (
         'English.php' => '11eb945ea792024fc2ecd881d77781d7',
       ),
-      'userlanguage_menu.php' => '86492340899ebf9da2fd44250544814a',
+      'userlanguage_menu.php' => 'abd699d94fcb5a8d37054b5a151360e8',
     ),
     'usertheme_menu' => 
     array (
@@ -2459,7 +2447,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => '5634193f9c40908e7753db6c3b557c37',
+        'English.php' => 'c79dc31d640dc7c326cbd80bb6f078ac',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'b841409838526ba769866861bf236100',
@@ -2505,14 +2493,14 @@
       ),
       'languages' => 
       array (
-        'English.php' => '267a4652945d08b0a14d421c47d7cdf8',
+        'English.php' => '26454ba6dd4086079a0dd6730eafa2c6',
       ),
-      'forum_template.php' => '5236c9308b808d1c0c96aa4b8647ccec',
+      'forum_template.php' => '0d1308c873ec62aa483a97915e790fa2',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newsfeed_template.php' => 'bf35ae0a44194fb397c9816bd81c7522',
       'preview.jpg' => '1f1e5815a674ceb1eaa562caa0e23607',
       'style.css' => '31dbd50ef3ff04150146f4b618c18385',
-      'theme.php' => '533543688af3450cd14bdc170466c960',
+      'theme.php' => 'ae959d0742632c6b95373b34f2a7f69a',
     ),
     'human_condition' => 
     array (
@@ -2529,7 +2517,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'e9de51bdb55910fdc36ebcf96dd86396',
+        'English.php' => '850337759329160bc46544817b1d5ca8',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newforumpost.php' => '6a9cd60b76c00cd41384f21ce1265860',
@@ -2574,12 +2562,12 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'bcd2c57395cc693ee791c8cdc5a7e420',
+        'English.php' => 'f2f6486c4d8f11528bf6cd44dbc5373d',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'a4b48f473468c22cb5f03054eda08794',
       'style.css' => 'bb2e6303ad7fed8a1119fd08b7bd11e8',
-      'theme.php' => '1f15d7afdfee8ca33bd2667085cee2bc',
+      'theme.php' => '18a3f6c6802b51f8d98626190b27c494',
     ),
     'jayya' => 
     array (
@@ -2594,6 +2582,7 @@
         'admin_unlock.png' => '184c7a4c28517e01f3fda3c77f4c5d01',
         'admin_unstick.png' => '87309a3d62a49f3432888c79ece6fb5e',
         'announce.png' => 'eff175ae24b46fb0ee49a34cc6ca9e1e',
+        'closed.png' => '228e1b606811f415c253e851f779fea1',
         'closed_small.png' => '228e1b606811f415c253e851f779fea1',
         'delete.png' => '7c20906029cbc1fc0c7c64d26d2868e2',
         'e.png' => '6c335c5d89cc241296a45eddb888ee95',
@@ -2603,7 +2592,7 @@
         'fcap2.png' => '0a733fe6e51713f13276eec753da2d9c',
         'fcap2orig.png' => '5f6f45697bc185d51f2c06d904642aad',
         'finfobar.png' => '71585c0c2d3340ece8cf769a135286b9',
-        'forum_icons_template.php' => '7b54f527b4da7200128d6e1e33918080',
+        'forum_icons_template.php' => '5be0c43f7e4beadd660d02467905f626',
         'main_admin.png' => '4033115a6d4c622f16e23c7d82bc1bd9',
         'moderator.png' => 'd3100a24d0bf141c8d3e5445d24b712a',
         'new.png' => 'f80e5840a07b08c9502af386b9c6c928',
@@ -2656,16 +2645,16 @@
       ),
       'languages' => 
       array (
-        'English.php' => '6d5c404d3f5949d55660c3ba47ad338c',
+        'English.php' => 'a17223b305835b22475b0cd9ada9c367',
       ),
-      'admin_template.php' => 'a894a1c9e20bb7b895e1151854a1083e',
+      'admin_template.php' => 'd62d017059658f2ed757b7b00809cae7',
       'canvas.css' => 'acdfee6441e3dc292657ca469b669df4',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => 'ac9d2df99166eb5ce87c16bb146bc413',
       'pepper.css' => 'bcd1ac74e7cacb3ace1396355f238cc8',
       'preview.jpg' => '1d775846dbe1b7ea66065fc0eac72eaa',
       'style.css' => 'c406d47937f253e08d655b1d1008a6c2',
-      'theme.php' => '82d43fe4ce914385611be80b3bc37bc9',
+      'theme.php' => 'db2c61ffe769dd7f6a5aa50951d1e3f3',
     ),
     'khatru' => 
     array (
@@ -2698,22 +2687,22 @@
       ),
       'languages' => 
       array (
-        'English.php' => '66e19fa68eda6e34636ff907c328bb9e',
+        'English.php' => '6f36a7d081a0e715bab58115990f5289',
       ),
-      'download_template.php' => 'a9742a3e65ac83e279cabee1e1e50fb6',
-      'forum_post_template.php' => 'fef4832dd26316448ef939cb2eb35931',
-      'forum_posted_template.php' => '66bb8c27404c12d7e784745685f1f398',
+      'download_template.php' => '7f75f3bc5d34971eed94a6950338872f',
+      'forum_post_template.php' => '98a5c625a01ff128d1f91ccdce82c014',
+      'forum_posted_template.php' => 'daea1ec546752501459de41d6792faa8',
       'forum_preview_template.php' => '4455c6b5e0991211db66dad466274bc0',
       'forum_template.php' => '93227cac477be310f0e5a1f6b4a310e5',
-      'forum_viewforum_template.php' => '23b68de8f4d06ce6e22f281668d612d3',
-      'forum_viewtopic_template.php' => 'e26e8e97cbe85e2b248a221af5148537',
+      'forum_viewforum_template.php' => 'fd1e11b7929537e893966f3a4259df8d',
+      'forum_viewtopic_template.php' => '9fd02192239781ffd835af2d90a8c4c0',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newforumpost.php' => 'bd44d5240db6fb7af02138dd2499a8ef',
       'news_template.php' => '0f5b689c4ad3d212934707f44b959b11',
       'poll_template.php' => 'c01388206c3cf373ff04e01c38485d99',
       'preview.png' => 'b164565b63d086a6a5a28fd76097487c',
       'style.css' => 'be699284eb74ccbd6543eac6f60754ea',
-      'theme.php' => '91a9e9dd2439516210c1f0b29437a9ed',
+      'theme.php' => 'ba435e387dabd2ca94d7124d46693fd0',
     ),
     'kubrick' => 
     array (
@@ -2732,14 +2721,14 @@
       ),
       'languages' => 
       array (
-        'English.php' => '05890778f266bd0669aac13c92103ba8',
+        'English.php' => '29e32afa6cb7251090bed09b73521875',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'cb94c52db72d1ba8bd4d1e08ee41cbfb',
       'style.css' => '0f93072e98199ac87d3d2957cda402b9',
       'theme.js' => '092a48b0a95fcb44c48236c40948eb13',
-      'theme.php' => '449b35c64b081ab7061a97daec5ae1c0',
-      'ul.sc' => '94dc33c24a82bbe2c357d4ac165d8c09',
+      'theme.php' => 'd87f3c2136ed889cfe6741c4167490ca',
+      'ul.sc' => 'd06064877926df43530b0039a4a30069',
     ),
     'lamb' => 
     array (
@@ -2770,24 +2759,24 @@
       ),
       'languages' => 
       array (
-        'English.php' => '22dbd47c4a9f41af9d1bf3cbce5e19c9',
+        'English.php' => '9d1ea4ad30dea8e0d9992c25cd108773',
       ),
       'alt_style.css' => 'e9ee5679b9218c1c7d89c98c2f95b701',
       'alt_theme.php' => '09fc4de57c31e85eac390e643d401ed7',
       'chat_template.php' => '8a57696d7ecb512823073c64768c8ed7',
       'download_template.php' => 'b6e968dc3f6d17d161b0105b67ae2903',
-      'forum_post_template.php' => 'f1a897cbd307b7f0324a501f6664540d',
-      'forum_posted_template.php' => '56a97c40620ae669bca178f30ffdd044',
+      'forum_post_template.php' => 'aa066f09f3214ac59e484859441e1a75',
+      'forum_posted_template.php' => '98bb7439c9d7c183bcaf9d556656804f',
       'forum_preview_template.php' => '2391640ab5380b18ac17e54a99feb29f',
-      'forum_template.php' => '8c5f8a4dedc4829aca2c4f418ac49ceb',
-      'forum_viewforum_template.php' => '4cdfeb489d50e1e90be0ac8a4af60cf0',
-      'forum_viewtopic_template.php' => 'e0d6f0a2678206fa4542ee3ec6459333',
+      'forum_template.php' => 'bc95ea3fe78fc262a1560ffaa0ea7c39',
+      'forum_viewforum_template.php' => 'e7a90d1f598d3335428e3c5bc7ecf6d4',
+      'forum_viewtopic_template.php' => '86e8fb0953c7a9815ad03288ebac71c0',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newforumpost.php' => '7ec9f0bb87045e10862dc2b7dcc9757d',
       'news_template.php' => '0f5b689c4ad3d212934707f44b959b11',
       'preview.jpg' => '184658c1d2222cd0137cc445fcc785ea',
       'style.css' => '475d1badb0a770d6da07c350ffd6dcb7',
-      'theme.php' => '6ca169bb182d7ef950c2b27ed88d28d2',
+      'theme.php' => '62adf3ecacca0967dd85ffa2c6160c2f',
     ),
     'leaf' => 
     array (
@@ -2833,7 +2822,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'b89b3b5688c29ffe9ad8ec70ce414db8',
+        'English.php' => '7c2f577df7617578663237457db91d15',
       ),
       'bluehigh.ttf' => 'd3003ad3a5de2a785fbb898c89cf40ff',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
@@ -2841,8 +2830,8 @@
       'preview.png' => '804c22db1f71223d10e6f7b8b85f69a9',
       'style.css' => 'e7392ac143d7daa82882e906b5413c31',
       'theme.js' => '16285b5ba2631979457e5e2ec1cf10af',
-      'theme.php' => '9c7ebc86ae47a457591fdd86337cb11e',
-      'ul.sc' => '7614f31e4b096439bea1cd7c9f9ee0e9',
+      'theme.php' => '07f4075ab49042785a57acf28764b9a9',
+      'ul.sc' => '40e66ba9fbd2f99d59b9f7f9ba55256c',
     ),
     'newsroom' => 
     array (
@@ -2853,10 +2842,14 @@
         'logo_bg.png' => '2a38a1ac257ff1d975e15a5169221fd8',
         'logo_text.png' => 'a578be578c320aa365e9bf4ae07abe23',
       ),
+      'languages' => 
+      array (
+        'English.php' => '82b1cf2d4de26ac839bf47b08a28f81f',
+      ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'de22b398f66e271fdd908ac31f25e7e4',
       'style.css' => 'bd8715343b586a898a6e4e7875e2f6b6',
-      'theme.php' => '5ee241f2ee0f5f852512101261bcad84',
+      'theme.php' => 'd310e828e6ec8e6e741e05b81d38c019',
     ),
     'reline' => 
     array (
@@ -2898,7 +2891,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => '30da9e1ef04e5f1fef38ae3d23e0f3c4',
       'style.css' => 'aa2df8aa8519c802f10e3eddfd95aed3',
-      'theme.php' => '67949514e7139dcbf5dbb9b29d221940',
+      'theme.php' => '95a8b982b579004939da9a08678770d6',
     ),
     'sebes' => 
     array (
@@ -2925,31 +2918,31 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'a9e7139c84a52e4b164c460a6428b317',
       'style.css' => '2520113be12170cc926299ac4ece598d',
-      'theme.php' => '9e888e822f698fbb187bd602ec3ca7c4',
+      'theme.php' => 'f8959c9374250d4ae616c1ad958992c7',
     ),
     'templates' => 
     array (
-      'admin_template.php' => '57aec9f3ef5be669eb7fd47b3635a1b1',
-      'banner_template.php' => '5c52f8c726bf4d8e2f843703c2bb24d4',
-      'bbcode_template.php' => 'fe842867e0501311a9edd6363560fdaf',
+      'admin_template.php' => 'aedfda791297d2d2301ca3c2d14b9d7c',
+      'banner_template.php' => '7dce0864e00519643d986c18dfe79bc9',
+      'bbcode_template.php' => '884969ebee7a4a328a88f308f04c7822',
       'comment_template.php' => 'be07b00f84a5fbbeeef3ad557294700d',
-      'contact_template.php' => '7ac53206a020fa101c8ea0be32db6e75',
-      'download_template.php' => 'da2e5aa05a326a17a976bf9d789dd509',
-      'email_template.php' => '8fdbeb00322c889ebf52e43b5b58fb42',
-      'footer_default.php' => '7178149c3035e2b16bb843eb0e9f529b',
-      'fpw_template.php' => '8db941158070fc816be8111953b786fd',
-      'header_default.php' => '958e7c6df8090617caa2d97277a4acff',
+      'contact_template.php' => 'beee7004f0235889e55c69d2472d7779',
+      'download_template.php' => '5681bcd3468ce80571394a0a68fb0926',
+      'email_template.php' => '4ca383970db88c07d7e6162fd016fe43',
+      'footer_default.php' => '633f17fe5dbb3865de99b9e65eecc190',
+      'fpw_template.php' => '326abf6c01f19246a9ebe07e64d07ead',
+      'header_default.php' => 'e7b5cb81653ecdd8d7bfc8e9916a3e80',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'login_template.php' => '8952e4916524b95a3b3f75979e85a58c',
+      'login_template.php' => 'cd32f6bad43c829a8fa6e166a987c987',
       'membersonly_template.php' => '14635660ab8f2daed92f4260ed0f3fa1',
-      'online_template.php' => '0b98cb57967fb6a4d0015a8feb2ecd1c',
+      'online_template.php' => '97ff2933cef883a08756aed1527a3349',
       'search_template.php' => '100782de2e0ac37b7286bc2a1f65a2c2',
-      'signup_template.php' => '2ba1f894bbba7b332cace51b8dc6e31a',
-      'sitedown_template.php' => '85de9cb71af3df0f6e3ef44386d67d6e',
+      'signup_template.php' => 'f85131cd59fd0d19bd071adeabdcb7ef',
+      'sitedown_template.php' => '5e7c7db5ff15ed4a866d3fb46377c247',
       'trackback_template.php' => 'fd54d8c26c75f9d380e8ec90860b0107',
-      'user_template.php' => '40a17b45d7aad1c613fadec6453d75a4',
-      'userposts_template.php' => '6f9724081a0be3c5f974d16c92860c9d',
-      'usersettings_template.php' => '20d0f1ac95d0abe28ada5a98e987b70d',
+      'user_template.php' => '6338b0faa7ad36c8ecd89cfd0f933d90',
+      'userposts_template.php' => '4b86473e3ca67cbba7790b2395db345f',
+      'usersettings_template.php' => 'f3e3837913dca2349b8f422cb4fef38c',
     ),
     'vekna_blue' => 
     array (
@@ -2977,49 +2970,49 @@
       'nav_menu.css' => '74b91306b957f69bc390ed612df76ac9',
       'preview.jpg' => 'fbb8bde5f9eb4f8efc39f85234959823',
       'style.css' => 'b11955766d34da3f5ee12aa7ca734655',
-      'theme.php' => '4e523e4af469271fbfbe5527b8ea859a',
+      'theme.php' => '1a7cbeaf958bed83418158d97f8cd9f6',
     ),
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
   'article.php' => 'ee3b7df97cb467d35263bedf589abf98',
   'backend.php' => '312552577f67c7965a76bda84b949a64',
   'banner.php' => '6328a170fd3ee6f75ebdd2472f3fb397',
-  'class2.php' => '37696f5a30279e2ad8322862c788b067',
-  'comment.php' => 'b75934b785dd22089fa9d0b2723916a9',
-  'contact.php' => '77d372dad7c0a662b5dd837f8ce32228',
-  'content.php' => '10e6c1a9e2180598f8edd8f49022f26b',
-  'download.php' => '7be94c51d2d19953966d02c3f5e266de',
+  'class2.php' => 'a9c116a36a957e2d5a3560b0870529e4',
+  'comment.php' => 'a3eac4d5b478d7c46ed1399f8d6984b7',
+  'contact.php' => '80a5445731a44a4a27df0819a5b31e97',
+  'content.php' => '0eaa8d6a20548b6842ade24b9a0bf4ae',
+  'download.php' => 'efd6d9ef9f48e15d3416b7c6273a4ed4',
   'e107.htaccess' => 'c5e1ad68b41f947be285926c0f81d914',
   'e107_config.php' => 'd41d8cd98f00b204e9800998ecf8427e',
-  'email.php' => 'c786469d105283c6735a62172bb63865',
-  'error.php' => 'fe3ca6cc7b5947e43aead577a23128fe',
+  'email.php' => '6f5a6b9bd588d7f774f4e1a731efa937',
+  'error.php' => 'bc5af0f64bf07c2cacf7e7dcbf681ccd',
   'favicon.ico' => '5fceb78b9124ddae4027396d7cfcd328',
   'forum.php' => '3c10184d52685d7c9a6906a967b7e3d8',
   'forum_viewforum.php' => '4b9fcc3a820ed2f93b4dc707c3ebe3b4',
   'forum_viewtopic.php' => '5fea10d40850fd6f72cfbec7a328e120',
-  'fpw.php' => 'd599b553d2bdd87520615addfb55b573',
-  'gsitemap.php' => '4ebcfff3b23717454bb6b3538dd54565',
+  'fpw.php' => 'cf1d99007ec405101e8973073d4dbb39',
+  'gsitemap.php' => '5a3d81b0d9ca3f41c6a8c46155c41cc7',
   'index.php' => '960de1b196ffa6e7887fe99ae65fa682',
   'links.php' => 'bed206fc2abe8f1307ef4db3b7fee63e',
-  'login.php' => '6dbfe3d33ddd132cc85f5cb52b692f8c',
+  'login.php' => '266af1e60ea470873db56085d72d065e',
   'membersonly.php' => '0903a2ef48312a12ce81b2fa17fe0233',
-  'news.php' => '39b13f3be2acd01f8f28fb1cbfcbfaf8',
-  'online.php' => '947d1170bdc6cf524541d901f238f1a9',
-  'page.php' => '75881aa5f0a3b478bd65feb353863af7',
-  'print.php' => 'c115f1f57a0f6c691e5ce0e5b2d5b27a',
-  'rate.php' => '19160ac5ab1600124219c2b61c9c4a12',
-  'request.php' => '1cf6897842a4c804e33373e03c6b0ada',
+  'news.php' => '8ced9468ea4fd7b6e9257461e4db2e45',
+  'online.php' => 'bac185f5a2f38560c8944663380d612b',
+  'page.php' => '79775867711338d023f54f7bff43c82c',
+  'print.php' => '82e7c7267881349a4ef5e11f3efb6de8',
+  'rate.php' => '4730b1d1cf3ace6af2179fb52a521366',
+  'request.php' => '3e2514a378f5ceab71d4a31f81109bb0',
   'robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
-  'search.php' => '44bd9ed61fafe34b64a5d109ef2ec9d7',
-  'signup.php' => '6cfcc3d5d9fd54add87a960cac1d2032',
+  'search.php' => 'bab96f6885d0ca153ed52be19876de32',
+  'signup.php' => '1a14bd2bb9d552edb98746dba7e5de93',
   'sitedown.php' => '7a2d95fb0976ce5ab287a403b118acfa',
-  'subcontent.php' => '468072ef82e179b6ed5ff20a4eb36225',
-  'submitnews.php' => '090f7107c0f8c8636a84516a3cdfcfad',
-  'top.php' => '26cae358e9c9a83bfa686832231a2718',
-  'upload.php' => 'd7e5209dcd6f7964f0a6655e1f5ef8a5',
-  'user.php' => 'bcbc7a76b14c83784949613b6bf61b3d',
-  'userposts.php' => 'ffdb5e83f7f061ce19a376e5529c4a9d',
-  'usersettings.php' => '44aea0d3fb8906c41c84a31ed5054c6d',
+  'subcontent.php' => '5a534e399228320e38056244e944357d',
+  'submitnews.php' => '347abdf2aacaa48522c99d7a873cfbc8',
+  'top.php' => '9d7f39ec5411241994a7bd2777f592aa',
+  'upload.php' => 'b3a9d21c82ccf91dd49935323334766f',
+  'user.php' => 'a3db994bcbe384c003b4eb144d161482',
+  'userposts.php' => '519d09a0b5f38a31d280f50eff92a19a',
+  'usersettings.php' => '569e7574019bc919aed2cc1b83c36c07',
 );
 
 $deprecated_image = array (
@@ -3234,6 +3227,7 @@
     ),
     'default.css' => '54d8e232fe73969b593f71df2afd6995',
     'style.css' => 'd62b27257e32cc08296930879a6df478',
+    'user.js' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
   $coredir['handlers'] => 
   array (
@@ -3976,7 +3970,12 @@
       array (
       ),
     ),
+    'equery_secure.php' => '00121b097ba978d5330349abbd350737',
     'errorhandler_class.php' => 'b169b03bc392d49864077e8010abd800',
+    'forum.php' => 'da5c0d4378b7288610945979d269a79c',
+    'forum_include.php' => '8b562f8ba508cc3572c84b443c4e7a6c',
+    'forum_mod.php' => '0ef4ab19bc8002337b2d3582c59874c9',
+    'input_class.php' => 'f819fe76d1fa518f430410aa4e6c803e',
     'poll_class.php' => '006ed3500ada715d561997ab4bd0eb5e',
     'security_handler.php' => '5e858bf7b977021b74bfcc55c0d8f9f4',
     'shortcuts.php' => '49ef7425046fce13b1fcef4fea3dcd63',
@@ -4337,7 +4336,14 @@
       array (
         'help' => 
         array (
+          'article.php' => '3c7df3956134df9dfc86a4a67b73d78b',
+          'chatbox.php' => 'df26b116189f5c3b615311ee4fc2fdc6',
+          'content.php' => 'dcf60ff22635488c42b4a99243bdf9f2',
+          'forum.php' => '161249fcb72351dee1b5b56fda1a15be',
+          'link_category.php' => '5352ce360022a7fc0882fb77603405cb',
           'log.php' => '553fd4414b98f4aa5f0f6e1f8f7b0ad6',
+          'newsfeed.php' => '93f7ef1481d3fc59ecde4d40ad6b6c84',
+          'review.php' => '6997e7c8d919246f698837c0ba3693b3',
         ),
         'lan_admin.php.bak' => 'c8bd5eb16d7834de1975b2ac3cd301e3',
         'lan_article.php' => '78d8dba28058eb99e32fc670fed68f34',
@@ -4361,6 +4367,7 @@
       'lan_article.php' => '7cb2200110e779d2be72b32b5adae9e4',
       'lan_chat.php' => '1216025ec3eb4295cb7b7920d9c6d5f4',
       'lan_content.php' => '175020e7d6e637c7c560c7b710e7da67',
+      'lan_equery_secure.php' => '90ce9b58fa3ee0bc424dc9eab0a9b92e',
       'lan_forum.php' => 'ca5e1c87b06b0b4c76aa17222a2049b9',
       'lan_forum_post.php' => 'e354153441043fabd0cdd6ed99be37a7',
       'lan_forum_viewforum.php' => 'ae655efbf1d88f64a6f9436894767a64',
@@ -5434,6 +5441,9 @@
       'images' => 
       array (
       ),
+      'languages' => 
+      array (
+      ),
     ),
     'nordranious' => 
     array (
@@ -5696,12 +5706,12 @@
   'CHANGES.txt' => '20499ea696da01da57ff542cb8cc90ce',
   'Copy of class2.php' => '4bc75d69d5486bb439f681467ccb9256',
   'Copy of forum_post.php' => '0063a6cdd546d5f90374bbb3ae342a2a',
-  'README.txt' => 'f4ae5aa39099819a240951d0694fe105',
+  'README.txt' => 'b7c272abfd2426ac41a9e0851da77e7a',
   'ReadMe_English_iso-8859-1.txt' => 'a15c32416143ecdebb10fab747a9065a',
   'chat.php' => 'f99ca9a68e350852ff12b6f201ff46e4',
   'e107_6171_readme.txt' => '7f411eaafccc974f91447c8efd9992d4',
   'forum_post.php' => 'b4537a7296252a0d8c010824b698259b',
-  'install.php' => 'f6c6c7a5151ead93de10528d3a38092d',
+  'install.php' => '2e6a5693e9d057cf1c3690c01e26ffca',
   'oldpolls.php' => '2758e56550195c508819c6062b950bc3',
   'readme.txt' => 'ff257006036939e779d287cdfee3b4b3',
   'sitemap.php' => 'd72fdc265a68f5a3b8a5d4b51d776f84',
diff -x .svn -ruN 0.7.7.src/e107_admin/cpage.php 0.7.11.src/e107_admin/cpage.php
--- 0.7.7.src/e107_admin/cpage.php	2006-11-08 14:47:43.000000000 -0600
+++ 0.7.11.src/e107_admin/cpage.php	2007-10-08 15:18:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/cpage.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/11/08 20:47:43 $
-|     $Author: e107coders $
+|     $Revision: 1.41 $
+|     $Date: 2007/10/08 20:18:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -36,7 +36,7 @@
 	$action     = $tmp[0];
 	$sub_action = $tmp[1];
 	$id         = $tmp[2];
-	$from       = ($tmp[3] ? $tmp[3] : 0);
+	$from       = varset($tmp[3],0);
 }
 
 if(isset($_POST['submitPage']))
@@ -127,12 +127,12 @@
 			{
 				$text .= "
 				<tr>
-				<td style='width:5%; text-align: center;' class='forumheader3'>$pge[page_id]</td>
-				<td style='width:60%' class='forumheader3'><a href='".($pge[page_theme] ? e_ADMIN."menus.php" : e_BASE."page.php?{$pge[page_id]}" )."'>$pge[page_title]</a></td>
-				<td style='width:15%; text-align: center;' class='forumheader3'>".($pge[page_theme] ? "menu" : "page")."</td>
+				<td style='width:5%; text-align: center;' class='forumheader3'>{$pge['page_id']}</td>
+				<td style='width:60%' class='forumheader3'><a href='".($pge['page_theme'] ? e_ADMIN."menus.php" : e_BASE."page.php?{$pge['page_id']}" )."'>{$pge['page_title']}</a></td>
+				<td style='width:15%; text-align: center;' class='forumheader3'>".($pge['page_theme'] ? "menu" : "page")."</td>
 				<td style='width:20%; text-align: center;' class='forumheader3'>
-				<a href='".e_SELF."?".($pge[page_theme] ? "createm": "create").".edit.{$pge[page_id]}'>".ADMIN_EDIT_ICON."</a>
-				<input type='image' title='".LAN_DELETE."' name='delete[{$pge[page_id]}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".CUSLAN_4." [ ID: $pge[page_id] ]')\"/>
+				<a href='".e_SELF."?".($pge['page_theme'] ? "createm": "create").".edit.{$pge['page_id']}'>".ADMIN_EDIT_ICON."</a>
+				<input type='image' title='".LAN_DELETE."' name='delete[{$pge['page_id']}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".CUSLAN_4." [ ID: $pge[page_id] ]')\"/>
 				</td>
 				</tr>";
 			}
@@ -167,9 +167,13 @@
 
 		global $sql, $tp, $ns, $pref, $sub_action, $id;
 
-		if ($sub_action == "edit" && !$_POST['preview'] && !$_POST['submit'])
+		if ($sub_action == "edit" && !isset($_POST['preview']) && !isset($_POST['submit']))
 		{
-			if ($sql->db_Select("page", "*", "page_id='$id' "))
+        	$query = "SELECT p.*,l.link_name,m.menu_name FROM #page AS p
+			LEFT JOIN #links AS l ON l.link_url='page.php?".$id."'
+			LEFT JOIN #menus AS m ON m.menu_path='$id' WHERE p.page_id ='$id' LIMIT 1";
+
+            if ($sql->db_Select_gen($query))
 			{
 				$row                          = $sql->db_Fetch();
 				$page_class                   = $row['page_class'];
@@ -178,14 +182,10 @@
 				$page_rating_flag             = $row['page_rating_flag'];
 				$page_comment_flag            = $row['page_comment_flag'];
 				$page_display_authordate_flag = $row['page_author'];
+				$page_link 					  = varset($row['link_name'],'');
 				$data                         = $tp -> toFORM($row['page_text']);
 				$edit                         = TRUE;
-			}
-
-			if ($sql -> db_Select("links", "*", "link_url='page.php?".$id."'"))
-			{
-				$row = $sql -> db_Fetch();
-				$page_link = $row['link_name'];
+				$menu_name					  = $tp -> toFORM($row['menu_name']);
 			}
 		}
 
@@ -193,22 +193,13 @@
 		<form method='post' action='".e_SELF."' id='dataform' enctype='multipart/form-data'>
 		<table style='".ADMIN_WIDTH."' class='fborder'>";
 
-		if($mode)
+		if($mode)  // menu mode.
 		{
 			$text .= "<tr>
 			<td style='width:25%' class='forumheader3'>".CUSLAN_7."</td>
-			<td style='width:75%' class='forumheader3'>";
-
-			if($edit)
-			{
-				$text .= $page_theme;
-			}
-			else
-			{
-				$text .= "<input class='tbox' type='text' name='menu_name' size='30' value='".$menu_name."' maxlength='50' />";
-			}
-
-			$text .= "</td>
+			<td style='width:75%' class='forumheader3'>
+           <input class='tbox' type='text' name='menu_name' size='30' value='".$menu_name."' maxlength='50' />
+		   	</td>
 			</tr>";
 		}
 
@@ -223,7 +214,7 @@
 
 		require_once(e_HANDLER."ren_help.php");
 		$insertjs = (!e_WYSIWYG)?"rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' style='width:95%'": "rows='25' style='width:100%' ";
-		$data = $tp->toForm($data);
+		$data = $tp->toForm($data,FALSE,TRUE);	// Make sure we convert HTML tags to entities
 		$text .= "<textarea class='tbox' id='data' name='data' cols='80'   $insertjs>".(strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data))."</textarea>";
 
 		$text .= "<br />".display_help('',"cpage")."</td>
@@ -307,12 +298,21 @@
 		$page_text = $tp -> toDB($_POST['data']);
 		$pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0);
 
+
 		if($mode)
-		{
-			$update = $sql -> db_Update("page", "page_title='$page_title', page_text='$page_text', page_author='$pauthor', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".$_POST['page_ip_restrict']."' WHERE page_id='$mode'");
+		{	// Don't think $_POST['page_ip_restrict'] is ever set.
+
+			$update = $sql -> db_Update("page", "page_title='$page_title', page_text='$page_text', page_author='$pauthor', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."' WHERE page_id='$mode'");
 			$e107cache->clear("page_{$mode}");
 			$e107cache->clear("page-t_{$mode}");
 
+			if($type)
+			{
+				$menu_name = $tp -> toDB($_POST['menu_name']); // not to be confused with menu-caption.
+				$sql -> db_Update("menus", "menu_name='$menu_name' WHERE menu_path='$mode' ");
+				$update++;
+			}
+
 			if ($_POST['page_link'])
 			{
 				if ($sql -> db_Select("links", "link_id", "link_url='page.php?".$mode."' && link_name!='".$tp -> toDB($_POST['page_link'])."'"))
@@ -335,7 +335,7 @@
 					$e107cache->clear("sitelinks");
 				}
 			}
-			admin_update($update, 'update', "Page updated in database.");
+			admin_update($update, 'update', LAN_UPDATED);
 		}
 		else
 		{
diff -x .svn -ruN 0.7.7.src/e107_admin/credits.php 0.7.11.src/e107_admin/credits.php
--- 0.7.7.src/e107_admin/credits.php	2006-10-28 20:00:20.000000000 -0500
+++ 0.7.11.src/e107_admin/credits.php	2007-04-12 14:40:43.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/credits.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/10/29 01:00:20 $
-|     $Author: e107coders $
+|     $Revision: 1.17 $
+|     $Date: 2007/04/12 19:40:43 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -104,7 +104,7 @@
 <title>".PAGE_NAME."</title>
 <meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
 <meta http-equiv='content-style-type' content='text/css' />
-<link rel='stylesheet' href='".e_THEME."lamb/style.css' type='text/css' />
+<link rel='stylesheet' href='".THEME."style.css' type='text/css' />
 </head>
 <body style='padding: 0; margin: 0; background-color: #e8e8e8; color: #8E8E8E'>
 
diff -x .svn -ruN 0.7.7.src/e107_admin/db.php 0.7.11.src/e107_admin/db.php
--- 0.7.7.src/e107_admin/db.php	2006-10-14 10:53:46.000000000 -0500
+++ 0.7.11.src/e107_admin/db.php	2007-10-26 04:43:03.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/db.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/10/14 15:53:46 $
+|     $Revision: 1.23 $
+|     $Date: 2007/10/26 09:43:03 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -153,8 +153,13 @@
 
 }
 
+
 function plugin_viewscan()
 {
+  $error_messages = array(0 => DBLAN_31, 1 =>DBLAN_32, 2 =>DBLAN_33, 3 => DBLAN_34);
+  $error_image = array("integrity_pass.png","integrity_fail.png","warning.png","blank.png");
+
+
 		global $sql, $pref, $ns, $tp;
 		require_once(e_HANDLER."plugin_class.php");
 		$ep = new e107plugin;
@@ -167,15 +172,36 @@
 				<div style='text-align:center'>  <table class='fborder' style='".ADMIN_WIDTH."'>
 				<tr><td class='fcaption'>".DBLAN_24."</td>
 				<td class='fcaption'>".DBLAN_25."</td>
-				<td class='fcaption'>".DBLAN_26."</td>
+				<td class='fcaption'>".DBLAN_26."<br />".DBLAN_30."</td>
 				<td class='fcaption'>".DBLAN_27."</td>";
 
         $sql -> db_Select("plugin", "*", "plugin_id !='' order by plugin_path ASC"); // Must order by path to pick up duplicates. (plugin names may change).
-		while($row = $sql-> db_Fetch()){
+		while($row = $sql-> db_Fetch())
+		{
 			$text .= "<tr>
-				<td class='forumheader3'>".$tp->toHtml($row['plugin_name'],FALSE,"defs")."</td>
+				<td class='forumheader3'>".$tp->toHtml($row['plugin_name'],FALSE,"defs,emotes_off")."</td>
                 <td class='forumheader3'>".$row['plugin_path']."</td>
-				<td class='forumheader3'>".str_replace(",","<br />",$row['plugin_addons'])."</td>
+				<td class='forumheader3'>";
+				
+			if (trim($row['plugin_addons']))
+			{
+			  $nl_code = '';
+			  foreach(explode(',',$row['plugin_addons']) as $this_addon)
+			  {
+			    $ret_code = 3;		// Default to 'not checked
+			    if (strpos($this_addon,'e_') === 0)
+			    {
+//			      echo "Checking: ".$row['plugin_path'].":".$this_addon."<br />";
+			      $ret_code = $ep->checkAddon($row['plugin_path'],$this_addon);		// See whether spaces before opening tag or after closing tag
+			    }
+				$text .= "<div style='border-bottom:1px dotted #cccccc'>";
+				$text .= "<img src='".e_IMAGE."fileinspector/".$error_image[$ret_code]."' alt=\"".$error_messages[$ret_code]."\" title=\"".$error_messages[$ret_code]."\" style='vertical-align:middle;height:16px;width:16px' />\n";
+			    $text .= trim($this_addon);	// $ret_code - 0=OK, 1=content error, 2=access error
+			    $text .= "</div>";
+			  }
+			}
+			
+			$text .= "</td>
 				<td class='forumheader3' style='text-align:center'>";
             if($previous == $row['plugin_path'])
 			{
@@ -191,6 +217,7 @@
 			</tr>";
 			$previous = $row['plugin_path'];
 		}
+//		$text .= "<tr><td colspan='4' class='forumheader3'>".DBLAN_30."</td></tr>";
         $text .= "</table></div></form>";
         $ns -> tablerender(ADLAN_CL_7, $text);
 
diff -x .svn -ruN 0.7.7.src/e107_admin/db_verify.php 0.7.11.src/e107_admin/db_verify.php
--- 0.7.7.src/e107_admin/db_verify.php	2006-10-28 20:00:20.000000000 -0500
+++ 0.7.11.src/e107_admin/db_verify.php	2007-11-24 09:42:40.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/db_verify.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2006/10/29 01:00:20 $
-|     $Author: e107coders $
+|     $Revision: 1.26 $
+|     $Date: 2007/11/24 15:42:40 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -50,7 +50,7 @@
 			$id = str_replace("_sql","",$file);
         	$tables[$id] = $sql_data;
 		}else{
-        	echo $filename." is not readable<br />";
+        	echo $filename.DBLAN_22."<br />";
 		}
     }
 
@@ -99,23 +99,30 @@
 
 }
 
-function get_current($tab, $prefix = "") {
-	if (!$prefix) {
-		$prefix = MPREFIX;
-	}
-	$result = mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
-	$qry = 'SHOW CREATE TABLE `'.$prefix.$tab."`";
-	$z = mysql_query($qry);
-	if ($z) {
-		$row = mysql_fetch_row($z);
-		return str_replace("`", "", stripslashes($row[1]));
-	} else {
 
-		return FALSE;
-	}
+// Get list of fields and keys for a table
+function get_current($tab, $prefix = "") 
+{  
+  if (!$prefix) 
+  {
+	$prefix = MPREFIX;
+  }
+  $result = mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
+  $qry = 'SHOW CREATE TABLE `'.$prefix.$tab."`";
+  $z = mysql_query($qry);
+  if ($z) 
+  {
+	$row = mysql_fetch_row($z);
+	return str_replace("`", "", stripslashes($row[1]));
+  } 
+  else 
+  {
+	return FALSE;
+  }
 }
 
-function check_tables($what) {
+function check_tables($what) 
+{
 	global $tablines;
 	global $table_list;
 	global $ns;
@@ -123,6 +130,8 @@
 	$table_list = "";
 	read_tables($what);
 
+	$fix_active = FALSE;			// Flag set as soon as there's a fix - enables 'Fix it' button
+	
 	$text = "<form method='post' action='".e_SELF."' id='checktab'>
 		<div style='text-align:center'>
 		<table style='".ADMIN_WIDTH."' class='fborder'>
@@ -132,94 +141,148 @@
 		<td class='fcaption' style='text-align:center'>".DBLAN_6."</td>
 		<td class='fcaption' style='text-align:center'>".DBLAN_7."</td>
 		</tr>";
-	foreach(array_keys($table_list) as $k) {
-
-		$prefix = MPREFIX;
-		$current_tab = get_current($k, $prefix);
-		unset($fields);
-		unset($xfields);
-		if ($current_tab) {
-			$lines = split("\n", $current_tab);
-			$fieldnum = 0;
-			foreach($tablines[$k] as $x) {
-				$fieldnum++;
-				$ffound = 0;
-				list($fname, $fparams) = split(" ", $x, 2);
-				if ($fname == "KEY") {
-					list($key, $keyname, $keyparms) = split(" ", $x, 3);
-					$fname = $key." ".$keyname;
-					$fparams = $keyparms;
-				}
-				$fields[$fname] = 1;
-				$fparams = ltrim(rtrim($fparams));
-				$fparams = preg_replace("/\r?\n$|\r[^\n]$|,$/", "", $fparams);
+	foreach(array_keys($table_list) as $k) 
+	{	// $k is the DB table name (less prefix)
+	  $prefix = MPREFIX;
+	  $current_tab = get_current($k, $prefix);		// Get list of fields and keys from actual table
+	  unset($fields);
+	  unset($xfields);
+	  if ($current_tab) 
+	  {
+		$lines = split("\n", $current_tab);			// Create one element of $lines per field or other line of info
+		$fieldnum = 0;
+		foreach($tablines[$k] as $x) 
+		{	// $x is a line of the DB definition from the *_sql.php file
+		  $x = str_replace('  ',' ',$x);				// Remove double spaces
+		  $fieldnum++;
+		  $ffound = 0;
+		  list($fname, $fparams) = split(" ", $x, 2);
+		  if ($fname == "KEY") 
+		  {
+			list($key, $keyname, $keyparms) = split(" ", $x, 3);
+			$fname = $key." ".$keyname;
+			$fparams = $keyparms;
+		  }
+		  $fields[$fname] = 1;
+		  $fparams = ltrim(rtrim($fparams));
+		  $fparams = preg_replace("/\r?\n$|\r[^\n]$|,$/", "", $fparams);
+
+		  if(stristr($k, "lan_") !== FALSE && $cur != 1)
+		  {
+			$text .= "<tr><td colspan='6' class='fcaption'>".ADLAN_132."</td></tr>";
+			$cur = 1;
+		  };
 
-			if(stristr($k, "lan_") !== FALSE && $cur != 1){
-				$text .= "<tr><td colspan='6' class='fcaption'>".ADLAN_132."</td></tr>";
-				$cur = 1;
-			};
 
 
+		  $text .= "<tr><td class='forumheader3'>$k</td><td class='forumheader3'>$fname";
+		  if (strpos($fparams, "KEY") !== FALSE) 
+		  {
+			$text .= " $fparams";
+		  }
+		  $text .= "</td>";
+		  $s = 0;
+		  $xfieldnum = -1;
+		  foreach($lines as $l) 
+		  {
+			$xfieldnum++;
+			list($xl, $tmp) = split("\n", $l, 2);			// $tmp should be null
+			$xl = ltrim(rtrim(stripslashes($xl)));
+			$xl = preg_replace("/\r?\n$|\r[^\n]$/", "", $xl);
+			$xl = str_replace('  ',' ',$xl);				// Remove double spaces
+			list($xfname, $xfparams) = split(" ", $xl, 2);	// Field name and the rest
+
+			if ($xfname == "KEY") 
+			{
+			  list($key, $keyname, $keyparms) = split(" ", $xl, 3);
+			  $xfname = $key." ".$keyname;
+			  $xfparams = $keyparms;
+			}
 
-				$text .= "<tr><td class='forumheader3'>$k</td><td class='forumheader3'>$fname";
-				if (strpos($fparams, "KEY") !== FALSE) {
-					$text .= " $fparams";
+			if ($xfname != "CREATE" && $xfname != ")") 
+			{
+			  $xfields[$xfname] = 1;
+			}
+			$xfparams = preg_replace("/,$/", "", $xfparams);
+			$fparams = preg_replace("/,$/", "", $fparams);
+			if ($xfname == $fname) 
+			{  // Field names match - or it could be the word 'KEY' and its name which matches
+			  $ffound = 1;
+//			  echo "Field: ".$xfname."   Actuals: ".$xfparams."   Expected: ".$fparams."<br />";
+			  $xfsplit = explode(' ',$xfparams);
+			  $fsplit  = explode(' ',$fparams);
+			  $skip = FALSE;
+			  $i = 0;
+			  $fld_err = FALSE;
+			  foreach ($xfsplit as $xf)
+			  {
+			    if ($skip)
+				{
+				  $skip = FALSE;
+//				  echo "  Unskip: ".$xf."<br />";
 				}
-				$text .= "</td>";
-				$s = 0;
-				$xfieldnum = -1;
-				foreach($lines as $l) {
-					$xfieldnum++;
-					list($xl, $tmp) = split("\n", $l, 2);
-					$xl = ltrim(rtrim(stripslashes($xl)));
-					$xl = preg_replace("/\r?\n$|\r[^\n]$/", "", $xl);
-					list($xfname, $xfparams) = split(" ", $xl, 2);
-
-					if ($xfname == "KEY") {
-						list($key, $keyname, $keyparms) = split(" ", $xl, 3);
-						$xfname = $key." ".$keyname;
-						$xfparams = $keyparms;
-					}
-
-					if ($xfname != "CREATE" && $xfname != ")") {
-						$xfields[$xfname] = 1;
-					}
-					$xfparams = preg_replace("/,$/", "", $xfparams);
-					$fparams = preg_replace("/,$/", "", $fparams);
-					if ($xfname == $fname) {
-						$ffound = 1;
-						if (strcasecmp($fparams, $xfparams) != 0) {
-							$text .= "<td class='forumheader' style='text-align:center'>".DBLAN_8."</td>";
-							$text .= "<td class='forumheader3' style='text-align:center'>".DBLAN_9."<div class='indent'>".$xfparams."</div><b>".DBLAN_10."</b><div class='indent'>".$fparams." <br />".fix_form($k,$fname,$fparams,"alter")."</div></td>";
-							$fix_active = TRUE;
-						} elseif($fieldnum != $xfieldnum) {
-							$text .= "<td class='fcaption' style='text-align:center'>".DBLAN_5." ".DBLAN_8."</td>
-								<td class='forumheader3' style='text-align:center'>".DBLAN_9." #{$xfieldnum}<br />".DBLAN_10." #{$fieldnum}</td>";
-						} else {
-							$text .= "<td class='forumheader3' style='text-align:center;'>OK</td>
-								<td class='forumheader3' style='text-align:center'>&nbsp;</td>";
-						}
-					}
+				elseif (strcasecmp(trim($xf),'collate') == 0)
+				{	// Strip out the collation definition
+				  $skip = TRUE;
+//				  echo "Skip = ".$xf;
 				}
-
-				if ($ffound == 0) {
-					$text .= "<td class='forumheader' style='text-align:center'><strong><em>".DBLAN_11."</em></strong></td>
-						<td class='forumheader3' style='text-align:center'><b>".DBLAN_10." [$fparams]</b><br />".fix_form($k,$fname,$fparams,"insert",$prev_fname)."<br /></td>";
-					$fix_active = TRUE;
-				}
-				$prev_fname = $fname;
-				$text .= "</tr>\n";
-			}
-			foreach(array_keys($xfields) as $tf) {
-				if (!$fields[$tf] && $k != "user_extended") {
-					$fix_active = TRUE;
-					$text .= "<tr><td class='forumheader3' style='text-align:center'>$k</td><td class='forumheader3' style='text-align:center'>$tf</td><td class='forumheader3' style='text-align:center'><strong><em>".DBLAN_12."</em></strong></td><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$fparams,"drop")."</td></tr>";
+				else
+				{
+//				  echo "Compare: ".$xf." - ".$fsplit[$i]."<br />";
+				  // Since VARCHAR and CHAR are interchangeable, convert to CHAR (strictly, VARCHAR(3) and smalller becomes CHAR() )
+				  if (stripos($xf,'VARCHAR') === 0) $xf = substr($xf,3);
+				  if (stripos($fsplit[$i],'VARCHAR') === 0) $fsplit[$i] = substr($fsplit[$i],3);
+				  if (strcasecmp(trim($xf),trim($fsplit[$i])) != 0) 
+				  {
+				    $fld_err = TRUE;
+//					echo "Mismatch: ".$xf." - ".$fsplit[$i]."<br />";
+				  }
+				  $i++;
 				}
+			  }
+
+			  if ($fld_err)
+			  {
+				$text .= "<td class='forumheader' style='text-align:center'>".DBLAN_8."</td>";
+				$text .= "<td class='forumheader3' style='text-align:center'>".DBLAN_9."<div class='indent'>".$xfparams."</div><b>".DBLAN_10."</b><div class='indent'>".$fparams." <br />".fix_form($k,$fname,$fparams,"alter")."</div></td>";
+				$fix_active = TRUE;
+			  } 
+			  elseif ($fieldnum != $xfieldnum) 
+			  {  // Field numbers different - missing field?
+				$text .= "<td class='fcaption' style='text-align:center'>".DBLAN_5." ".DBLAN_8."</td>
+						<td class='forumheader3' style='text-align:center'>".DBLAN_9." #{$xfieldnum}<br />".DBLAN_10." #{$fieldnum}</td>";
+			  } 
+			  else 
+			  {
+				$text .= "<td class='forumheader3' style='text-align:center;'>OK</td>
+						<td class='forumheader3' style='text-align:center'>&nbsp;</td>";
+			  }
 			}
-		} else {	// Table Missing.
-			$text .= "<tr><td class='forumheader3' style='text-align:center'>$k</td><td class='forumheader3' style='text-align:center'>&nbsp;</td><td class='forumheader' style='text-align:center'>".DBLAN_13."<br /><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$tablines[$k],"create")."</td></tr>";
+		  }		// Finished checking one field
+
+		  if ($ffound == 0) 
+		  {
+			$text .= "<td class='forumheader' style='text-align:center'><strong><em>".DBLAN_11."</em></strong></td>
+					<td class='forumheader3' style='text-align:center'><b>".DBLAN_10." [$fparams]</b><br />".fix_form($k,$fname,$fparams,"insert",$prev_fname)."<br /></td>";
+			$fix_active = TRUE;
+		  }
+		  $prev_fname = $fname;
+		  $text .= "</tr>\n";
+		}
+		foreach(array_keys($xfields) as $tf) 
+		{
+		  if (!$fields[$tf] && $k != "user_extended") 
+		  {
 			$fix_active = TRUE;
+			$text .= "<tr><td class='forumheader3' style='text-align:center'>$k</td><td class='forumheader3' style='text-align:center'>$tf</td><td class='forumheader3' style='text-align:center'><strong><em>".DBLAN_12."</em></strong></td><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$fparams,"drop")."</td></tr>";
+		  }
 		}
+	  } 
+	  else 
+	  {	// Table Missing.
+		$text .= "<tr><td class='forumheader3' style='text-align:center'>$k</td><td class='forumheader3' style='text-align:center'>&nbsp;</td><td class='forumheader' style='text-align:center'>".DBLAN_13."<br /><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$tablines[$k],"create")."</td></tr>";
+		$fix_active = TRUE;
+	  }
 	}
 	$text .= "</table></div>";
 
diff -x .svn -ruN 0.7.7.src/e107_admin/download.php 0.7.11.src/e107_admin/download.php
--- 0.7.7.src/e107_admin/download.php	2006-10-26 18:36:27.000000000 -0500
+++ 0.7.11.src/e107_admin/download.php	2007-12-22 08:03:15.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/download.php,v $
-|     $Revision: 1.93 $
-|     $Date: 2006/10/26 23:36:27 $
-|     $Author: e107coders $
+|     $Revision: 1.101 $
+|     $Date: 2007/12/22 14:03:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -78,7 +78,7 @@
 $amount = 50;
 
 
-if($file_array = $fl->get_files(e_DOWNLOAD, "","standard",2)){
+if($file_array = $fl->get_files(e_DOWNLOAD, "","standard",5)){
 		sort($file_array);
 }
 
@@ -122,15 +122,19 @@
 }
 
 
-if(isset($_POST['update_catorder'])){
- 	foreach($_POST['catorder'] as $key=>$order){
-		if($_POST['catorder'][$key]){
-			$sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'");
-	  	}
+if(isset($_POST['update_catorder']))
+{
+  foreach($_POST['catorder'] as $key=>$order)
+  {
+	if (is_numeric($_POST['catorder'][$key]))
+	{
+	  $sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'");
 	}
-   	$ns->tablerender("", "<div style='text-align:center'><b>".LAN_UPDATED."</b></div>");
+  }
+  $ns->tablerender("", "<div style='text-align:center'><b>".LAN_UPDATED."</b></div>");
 }
 
+
 if (isset($_POST['updateoptions']))
 {
 	$pref['download_php'] = $_POST['download_php'];
@@ -142,6 +146,8 @@
 	$pref['agree_text'] = $tp->toDB($_POST['agree_text']);
 	$pref['download_denied'] = $tp->toDB($_POST['download_denied']);
 	$pref['download_reportbroken'] = $_POST['download_reportbroken'];
+	if ($_POST['download_subsub']) $pref['download_subsub'] = '1'; else $pref['download_subsub'] = '0';
+	if ($_POST['download_incinfo']) $pref['download_incinfo'] = '1'; else $pref['download_incinfo'] = '0';
 	save_prefs();
 	$message = DOWLAN_65;
 }
@@ -256,26 +262,45 @@
 	$text = "<div style='text-align:center'>
 		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
 		<table style='".ADMIN_WIDTH."' class='fborder'>
+		<colgroup>
+		<col style='width:70%' />
+		<col style='width:30%' />
+		</colgroup>
 		<tr>
-		<td style='width:70%' class='forumheader3'>".DOWLAN_69."</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>";
+		<td class='forumheader3'>".DOWLAN_69."</td>
+		<td class='forumheader3' style='text-align:left'>";
 	$c = $pref['download_php'] ? " checked = 'checked' " : "";
+	$ssc = ((!isset($pref['download_subsub'])) || ($pref['download_subsub'] == '1')) ? " checked = 'checked' " : "";
+	$sacc = (varset($pref['download_incinfo'],0) == '1') ? " checked = 'checked' " : "";
 	$text .= "<input type='checkbox' name='download_php' value='1' {$c} /> <span class='smalltext'>".DOWLAN_70."</span></td>
 		</tr>
+
+		<tr>
+		<td class='forumheader3'>".DOWLAN_158."</td>
+		<td class='forumheader3' style='text-align:left'>
+		<input type='checkbox' name='download_subsub' value='1' {$ssc} /> </td>
+		</tr>
+
 		<tr>
-		<td style='width:70%' class='forumheader3'>
+		<td class='forumheader3'>".DOWLAN_159."</td>
+		<td class='forumheader3' style='text-align:left'>
+		<input type='checkbox' name='download_incinfo' value='1' {$sacc} /> </td>
+		</tr>
+
+		<tr>
+		<td class='forumheader3'>
 		".DOWLAN_55."
 		</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>
+		<td class='forumheader3' style='text-align:left'>
 		<select name='download_view' class='tbox'>". ($pref['download_view'] == 5 ? "<option selected='selected'>5</option>" : "<option>5</option>"). ($pref['download_view'] == 10 ? "<option selected='selected'>10</option>" : "<option>10</option>"). ($pref['download_view'] == 15 ? "<option selected='selected'>15</option>" : "<option>15</option>"). ($pref['download_view'] == 20 ? "<option selected='selected'>20</option>" : "<option>20</option>"). ($pref['download_view'] == 50 ? "<option selected='selected'>50</option>" : "<option>50</option>")."
 		</select>
 		</td>
 		</tr>
 
-		<tr><td style='width:70%' class='forumheader3'>
+		<tr><td class='forumheader3'>
 		".DOWLAN_56."
 		</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>
+		<td class='forumheader3' style='text-align:left'>
 
 		<select name='download_order' class='tbox'>";
 		$order_options = array("download_id"=>"Id No.","download_datestamp"=>LAN_DATE,"download_requested"=>ADLAN_24,"download_name"=>DOWLAN_59,"download_author"=>DOWLAN_15);
@@ -287,44 +312,44 @@
 		$text .= "</select>
 		</td>
 		</tr>
-		<tr><td style='width:70%' class='forumheader3'>
+		<tr><td class='forumheader3'>
 		".LAN_ORDER."
 		</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>
+		<td class='forumheader3' text-align:left'>
 		<select name='download_sort' class='tbox'>". ($pref['download_sort'] == "ASC" ? "<option value='ASC' selected='selected'>".DOWLAN_62."</option>" : "<option value='ASC'>".DOWLAN_62."</option>"). ($pref['download_sort'] == "DESC" ? "<option value='DESC' selected='selected'>".DOWLAN_63."</option>" : "<option value='DESC'>".DOWLAN_63."</option>")."
 		</select>
 		</td>
 		</tr>
 
 		<tr>
-		<td style='width:70%' class='forumheader3'>".DOWLAN_151."</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>". r_userclass("download_reportbroken", $_POST['download_reportbroken'])."</td>
+		<td class='forumheader3'>".DOWLAN_151."</td>
+		<td class='forumheader3' style='text-align:left'>". r_userclass("download_reportbroken", $pref['download_reportbroken'])."</td>
 		</tr>
 
 		<tr>
-		<td style='width:70%' class='forumheader3'>".DOWLAN_150."</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>". ($pref['download_email'] ? "<input type='checkbox' name='download_email' value='1' checked='checked' />" : "<input type='checkbox' name='download_email' value='1' />")."</td>
+		<td class='forumheader3'>".DOWLAN_150."</td>
+		<td class='forumheader3' style='text-align:left'>". ($pref['download_email'] ? "<input type='checkbox' name='download_email' value='1' checked='checked' />" : "<input type='checkbox' name='download_email' value='1' />")."</td>
 		</tr>
 
 		<tr>
-		<td style='width:70%' class='forumheader3'>".DOWLAN_100."</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>". ($agree_flag ? "<input type='checkbox' name='agree_flag' value='1' checked='checked' />" : "<input type='checkbox' name='agree_flag' value='1' />")."</td>
+		<td class='forumheader3'>".DOWLAN_100."</td>
+		<td class='forumheader3' style='text-align:left'>". ($agree_flag ? "<input type='checkbox' name='agree_flag' value='1' checked='checked' />" : "<input type='checkbox' name='agree_flag' value='1' />")."</td>
 		</tr>
 
 
 
-		<tr><td style='width:70%' class='forumheader3'>
+		<tr><td class='forumheader3'>
 		".DOWLAN_101."
 		</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>
-		<textarea class='tbox' name='agree_text' cols='59' rows='3'>$agree_text</textarea>
+		<td class='forumheader3' style='text-align:left'>
+		<textarea class='tbox' name='agree_text' cols='59' rows='3'>{$agree_text}</textarea>
 		</td>
 		</tr>
 
-		<tr><td style='width:70%' class='forumheader3'>
+		<tr><td class='forumheader3'>
 		".DOWLAN_146."
 		</td>
-		<td class='forumheader3' style='width:30%;text-align:left'>
+		<td class='forumheader3' style='text-align:left'>
 		<textarea class='tbox' name='download_denied' cols='59' rows='3'>".$pref['download_denied']."</textarea>
 		</td>
 		</tr>
@@ -455,7 +480,8 @@
             $search_display = explode("|",$pref['admin_download_disp']);
 		}
 
-         $query = "SELECT d.*, dc.* FROM #download AS d	LEFT JOIN #download_category AS dc ON dc. download_category_id  = d.download_category";
+//         $query = "SELECT d.*, dc.* FROM #download AS d	LEFT JOIN #download_category AS dc ON dc. download_category_id  = d.download_category";
+         $query = "SELECT d.*, dc.* FROM `#download` AS d	LEFT JOIN `#download_category` AS dc ON dc. download_category_id  = d.download_category";
 
 		if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") {
 			$query .= " WHERE  download_url REGEXP('".$_POST['searchquery']."') OR download_author REGEXP('".$_POST['searchquery']."') OR download_description  REGEXP('".$_POST['searchquery']."') ";
@@ -467,92 +493,115 @@
 			$query .= " ORDER BY ".($sub_action ? $sub_action : $sortorder)." ".($id ? $id : "DESC")."  LIMIT $from, $amount";
 		}
 
-      	if ($sql->db_Select_gen($query)) {
-			$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")."
+      	if ($dl_count = $sql->db_Select_gen($query)) 
+		{
+		  $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")."
 				<table class='fborder' style='width:99%'>
 				<tr>
 				<td style='width:5%' class='fcaption'>ID</td>
 				";
 
 // Search Display Column header.----------
-			foreach($search_display as $disp){
-				if($disp == "download_name"){
-					$text .= "<td class='fcaption'><a href='".e_SELF."?main.download_name.".($id == "desc" ? "asc" : "desc").".$from'>".DOWLAN_27."</a></td>";
-				}else{
-					$repl = array("download_","_");
-					$text .= "<td class='fcaption'><a href='".e_SELF."?main.$disp.".($id == "desc" ? "asc" : "desc").".$from'>".ucwords(str_replace($repl," ",$disp))."</a></td>";
-				}
+		  foreach($search_display as $disp)
+		  {
+			if($disp == "download_name")
+			{
+			  $text .= "<td class='fcaption'><a href='".e_SELF."?main.download_name.".($id == "desc" ? "asc" : "desc").".$from'>".DOWLAN_27."</a></td>";
+			}
+			else
+			{
+			  $repl = array("download_","_");
+			  $text .= "<td class='fcaption'><a href='".e_SELF."?main.$disp.".($id == "desc" ? "asc" : "desc").".$from'>".ucwords(str_replace($repl," ",$disp))."</a></td>";
 			}
+		  }
 
-// ------------------------------
-			$text .="
-				<td style='width:10%' class='fcaption'>".LAN_OPTIONS."</td>
-				</tr>";
-			while ($row = $sql->db_Fetch()) {
-				extract($row);
-				$text .= "<tr>
-					<td style='width:5%;vertical-align:top' class='forumheader3'>$download_id</td>";
 
-// Display Chosen options -------------------------------------
-        $bolean_list = array("download_active","download_comment");
+		  $text .="<td style='width:10%' class='fcaption'>".LAN_OPTIONS."</td></tr>";
 
-		foreach($search_display as $disp){
-			$text .= "<td class='forumheader3' style='vertical-align:top'>";
+		  while ($row = $sql->db_Fetch()) 
+		  {
+			$text .= "<tr><td style='width:5%;vertical-align:top' class='forumheader3'>".$row['download_id']."</td>";
 
-        	if($disp == "download_name"){
-        		$text .= "<a href='".e_BASE."download.php?view.$download_id'>$download_name</a>";
-			}elseif($disp == "download_category"){
-				$text .= $row['download_category_name']."&nbsp;";
-        	}elseif($disp == "download_datestamp"){
-				$text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp])."&nbsp;" : "&nbsp";
-			}elseif($disp == "download_class" || $disp == "download_visible"){
-				$text .= r_userclass_name($row[$disp])."&nbsp;";
-        	}elseif($disp == "download_filesize"){
-				$text .= ($row[$disp]) ? round(($row[$disp] / 1000))." Kb&nbsp;" : "&nbsp";
-			}elseif($disp == "download_thumb"){
-				$text .= ($row[$disp]) ? "<img src='".e_FILE."downloadthumbs/".$row[$disp]."' alt='' />" : "";
-        	}elseif($disp == "download_image"){
-				$text .= "<a rel='external' href='".e_FILE."downloadimages/".$row[$disp]."' >".$row[$disp]."</a>&nbsp;";
-			}elseif($disp == "download_description"){
-				$text .= $tp->toHTML($row[$disp],TRUE)."&nbsp;";
-            }elseif($disp == "download_active"){
-				if($row[$disp]== 1){ $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help' />\n"; 	}
-				elseif($row[$disp]== 2){ $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' /><img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' />\n"; 	}
-				else{ $text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help' />\n";  }
-			}elseif($disp == "download_comment"){
-                $text .= ($row[$disp]) ? ADMIN_TRUE_ICON : "&nbsp;";
-			}else{
-				$text .= $row[$disp]."&nbsp;";
-        	}
+			// Display Chosen options 
+			foreach($search_display as $disp)
+			{
+			  $text .= "<td class='forumheader3' style='vertical-align:top'>";
+			  switch ($disp)
+			  {
+			    case "download_name" :
+        		  $text .= "<a href='".e_BASE."download.php?view.".$row['download_id']."'>".$row['download_name']."</a>";
+				  break;
+				case "download_category" :
+				  $text .= $row['download_category_name']."&nbsp;";
+				  break;
+				case "download_datestamp" :
+				  $text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp])."&nbsp;" : "&nbsp";
+				  break;
+				case "download_class" :
+				case "download_visible" :
+				  $text .= r_userclass_name($row[$disp])."&nbsp;";
+				  break;
+				case "download_filesize" :
+				  $text .= ($row[$disp]) ? round(($row[$disp] / 1000))." Kb&nbsp;" : "&nbsp";
+				  break;
+				case "download_thumb" :
+				  $text .= ($row[$disp]) ? "<img src='".e_FILE."downloadthumbs/".$row[$disp]."' alt='' />" : "";
+				  break;
+				case "download_image" :
+				  $text .= "<a rel='external' href='".e_FILE."downloadimages/".$row[$disp]."' >".$row[$disp]."</a>&nbsp;";
+				  break;
+				case "download_description" :
+				  $text .= $tp->toHTML($row[$disp],TRUE)."&nbsp;";
+				  break;
+				case "download_active" :
+				  if($row[$disp]== 1)
+				  { 
+				    $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help' />\n"; 	
+				  }
+				  elseif($row[$disp]== 2)
+				  { 
+				    $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' /><img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' />\n"; 	
+				  }
+				  else
+				  { 
+				    $text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help' />\n";  
+				  }
+				  break;
+				case "download_comment" :
+                  $text .= ($row[$disp]) ? ADMIN_TRUE_ICON : "&nbsp;";
+				  break;
+				default :
+				  $text .= $row[$disp]."&nbsp;";
+			  }
+			  $text .= "</td>";
+			}
 
-			$text .= "</td>";
-		}
-// -------------------------------------------------------------
 
 			$text .= "
 					<td style='width:20%;vertical-align:top; text-align:center' class='forumheader3'>
-					<a href='".e_SELF."?create.edit.{$download_id}'>".ADMIN_EDIT_ICON."</a>
-					<input type='image' title='".LAN_DELETE."' name='delete[main_{$download_id}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(DOWLAN_33." [ID: $download_id ]")."') \" />
+					<a href='".e_SELF."?create.edit.".$row['download_id']."'>".ADMIN_EDIT_ICON."</a>
+					<input type='image' title='".LAN_DELETE."' name='delete[main_".$row['download_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(DOWLAN_33." [ID: ".$row['download_id']." ]")."') \" />
 					</td>
 					</tr>";
-			}
-			$text .= "</table></form>";
-		} else {
-			$text .= "<div style='text-align:center'>".DOWLAN_6."</div>";
+		  }
+		  $text .= "</table></form>";
+		} 
+		else 
+		{	// 'No downloads yet'
+		  $text .= "<div style='text-align:center'>".DOWLAN_6."</div>";
 		}
 		$text .= "</div>";
 
-// Next-Previous. ==========================
-
+		// Next-Previous.
 		$downloads = $sql->db_Count("download");
-		if ($downloads > $amount && !$_POST['searchquery']) {
+		if ($downloads > $amount && !$_POST['searchquery']) 
+		{
 			$parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.download_id.desc.")."[FROM]";
 			$text .= "<br />".$tp->parseTemplate("{NEXTPREV={$parms}}");
 		}
 
 
-// Search  & display options etc. =========================.
-
+		// Search  & display options etc.
 		$text .= "<br /><form method='post' action='".e_SELF."'>\n<p>\n<input class='tbox' type='text' name='searchquery' size='20' value='' maxlength='50' />\n<input class='button' type='submit' name='searchsubmit' value='".DOWLAN_51."' />\n</p>";
 
 		$text .= "<div style='cursor:pointer' onclick=\"expandit('sdisp')\">".LAN_DISPLAYOPT."</div>";
@@ -786,17 +835,15 @@
 			</tr>
 
 			<tr>
-			<td style='width:20%' class='forumheader3' ><span style='cursor:help' title='if using mirrors, select how they will be displayed'>Mirror display type:</span></td>
+			<td style='width:20%' class='forumheader3' ><span style='cursor:help' title='".DOWLAN_154."'>".DOWLAN_155."</span></td>
 			<td style='width:80%' class='forumheader3'>
 
-			<input type='radio' name='download_mirror_type' value='1'".($download_mirror_type ? " checked='checked'" : "")." /> show mirror list, allow user to choose mirror<br />
-			<input type='radio' name='download_mirror_type' value='0'".(!$download_mirror_type ? " checked='checked'" : "")." /> use random mirror - no user choice
+			<input type='radio' name='download_mirror_type' value='1'".($download_mirror_type ? " checked='checked'" : "")." /> ".DOWLAN_156."<br />
+			<input type='radio' name='download_mirror_type' value='0'".(!$download_mirror_type ? " checked='checked'" : "")." /> ".DOWLAN_157."
 			</td>
 			</tr>";
 		}
 
-
-
 			$text .= "<tr>
 			<td style='width:20%' class='forumheader3'>".DOWLAN_15.":</td>
 			<td style='width:80%' class='forumheader3'>
@@ -876,7 +923,6 @@
         if(!$download_datestamp){
         	$download_datestamp = time();
 	   	}
-		$cal_options['firstDay'] = 0;
 		$cal_options['showsTime'] = false;
 		$cal_options['showOthers'] = false;
 		$cal_options['weekNumbers'] = false;
@@ -1475,7 +1521,7 @@
 				<tr>
 				<td style='width: 10%; text-align: center;' class='forumheader3'>$mirror_id</td>
 				<td style='width: 30%;' class='forumheader3'>".$tp -> toHTML($mirror_name)."</td>
-				<td style='width: 30%;' class='forumheader3'>".($mirror_image ? "<img src='".e_FILE."downloadimages/".$mirror_image."' alt='' />" : "None")."</td>
+				<td style='width: 30%;' class='forumheader3'>".($mirror_image ? "<img src='".e_FILE."downloadimages/".$mirror_image."' alt='' />" : DOWLAN_28)."</td>
 				<td style='width: 30%; text-align: center;' class='forumheader3'>
 				<a href='".e_SELF."?mirror.edit.{$mirror_id}'>".ADMIN_EDIT_ICON."</a>
 				<input type='image' title='".LAN_DELETE."' name='delete[mirror_{$mirror_id}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".DOWLAN_137." [ID: $mirror_id ]')\"/>
diff -x .svn -ruN 0.7.7.src/e107_admin/emoticon.php 0.7.11.src/e107_admin/emoticon.php
--- 0.7.7.src/e107_admin/emoticon.php	2006-11-28 02:43:02.000000000 -0600
+++ 0.7.11.src/e107_admin/emoticon.php	2007-06-04 14:17:37.000000000 -0500
@@ -11,42 +11,51 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/emoticon.php,v $
-|     $Revision: 1.35 $
-|     $Date: 2006/11/28 08:43:02 $
-|     $Author: e107coders $
+|     $Revision: 1.40 $
+|     $Date: 2007/06/04 19:17:37 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../class2.php");
-if (!getperms("F")) {
+if (!getperms("F")) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
+
 $e_sub_cat = 'emoticon';
 
 require_once("auth.php");
 
-if(!$sql->db_Count("core", "(*)", "e107_name = 'emote_default'"))
-{
+if(!$sql->db_Count("core", "(*)", "WHERE e107_name = 'emote_default'"))
+{	// Set up the default emotes
 	$tmp = 'a:28:{s:9:"alien!png";s:6:"!alien";s:10:"amazed!png";s:7:"!amazed";s:9:"angry!png";s:11:"!grr !angry";s:12:"biglaugh!png";s:4:"!lol";s:11:"cheesey!png";s:10:":D :oD :-D";s:12:"confused!png";s:10:":? :o? :-?";s:7:"cry!png";s:19:"&| &-| &o| :(( !cry";s:8:"dead!png";s:21:"x) xo) x-) x( xo( x-(";s:9:"dodge!png";s:6:"!dodge";s:9:"frown!png";s:10:":( :o( :-(";s:7:"gah!png";s:10:":@ :o@ :o@";s:8:"grin!png";s:10:":D :oD :-D";s:9:"heart!png";s:6:"!heart";s:8:"idea!png";s:10:":! :o! :-!";s:7:"ill!png";s:4:"!ill";s:7:"mad!png";s:13:"~:( ~:o( ~:-(";s:12:"mistrust!png";s:9:"!mistrust";s:11:"neutral!png";s:10:":| :o| :-|";s:12:"question!png";s:2:"?!";s:12:"rolleyes!png";s:10:"B) Bo) B-)";s:7:"sad!png";s:4:"!sad";s:10:"shades!png";s:10:"8) 8o) 8-)";s:7:"shy!png";s:4:"!shy";s:9:"smile!png";s:10:":) :o) :-)";s:11:"special!png";s:3:"%-6";s:12:"suprised!png";s:10:":O :oO :-O";s:10:"tongue!png";s:21:":p :op :-p :P :oP :-P";s:8:"wink!png";s:10:";) ;o) ;-)";}';
-	$sql->db_Insert("core", "'emote_default', '$tmp' ");
+	$sql->db_Insert("core", "'emote_default', '{$tmp}' ");
 }
 
+
+// Change the active emote pack
 if (isset($_POST['active']))
 {
-	if ($pref['smiley_activate'] != $_POST['smiley_activate']) {
-		$pref['smiley_activate'] = $_POST['smiley_activate'];
-		save_prefs();
-		$update = true;
-	}
-	admin_update($update);
+if ($pref['smiley_activate'] != $_POST['smiley_activate']) 
+{
+	$pref['smiley_activate'] = $_POST['smiley_activate'];
+	save_prefs();
+	$update = true;
+  }
+  admin_update($update);
 }
 
-/* get packs */
 
+/* get packs */
 require_once(e_HANDLER."file_class.php");
 $fl = new e_file;
 $emote = new emotec;
+$one_pack = FALSE;
+
+
+// Check for pack-related buttons pressed
 foreach($_POST as $key => $value)
 {
 	if(strstr($key, "subPack_"))
@@ -56,24 +65,42 @@
 		break;
 	}
 
+	if(strstr($key, "XMLPack_"))
+	{
+		$subpack = str_replace("XMLPack_", "", $key);
+		$emote -> emoteXML($subpack);
+		break;
+	}
+
 	if(strstr($key, "defPack_"))
 	{
 		$pref['emotepack'] = str_replace("defPack_", "", $key);
 		save_prefs();
 		break;
 	}
+
+	if(strstr($key, "scanPack_"))
+	{
+		$one_pack = str_replace("scanPack_", "", $key);
+		break;
+	}
 }
 
+
+
 $check = TRUE;
-$check = $emote -> installCheck();
-if($check!==FALSE){
+//$check = $emote -> installCheck();
+$check = $emote -> installCheck($one_pack);
+if($check!==FALSE)
+{
 	$emote -> listPacks();
 }
 
+
+
 class emotec
 {
-
-	var $packArray;
+	var $packArray;			// Stores an array of all available emote packs (as subdirectory names)
 
 	function emotec()
 	{
@@ -82,14 +109,15 @@
 		$this -> packArray = $fl -> get_dirs(e_IMAGE."emotes");
 
 		if(isset($_POST['sub_conf']))
-		{
-			$this -> saveConf();
+		{	// Update stored pack configuration
+		  $this -> saveConf();
 		}
 	}
 
+
+	// List available emote packs
 	function listPacks()
 	{
-
 		global $ns, $fl, $pref;
 
 		$text = "<div style='text-align:center'>
@@ -123,27 +151,42 @@
 		<td class='forumheader' style='width: 20%;'>".EMOLAN_9."</td>
 		";
 
-		$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*');
+		$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '\.bak$');
 		foreach($this -> packArray as $pack)
 		{
+		  $can_scan = FALSE;
 			$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$pack, "", $reject);
 
 			$text .= "
 			<tr>
-			<td class='forumheader' style='width: 20%;'>$pack</td>
+			<td class='forumheader' style='width: 20%;'>{$pack}</td>
 			<td class='forumheader' style='width: 20%;'>
 			";
 
 			foreach($emoteArray as $emote)
 			{
+			  if (strstr($emote['fname'], ".pak") 
+			  || strstr($emote['fname'], ".xml") 
+			  || strstr($emote['fname'], "phpBB"))
+			  {
+				$can_scan = TRUE;		// Allow re-scan of config files
+			  }
+			  elseif  (!strstr($emote['fname'], ".txt") && !strstr($emote['fname'], ".bak") && !strstr($emote['fname'], ".html") && !strstr($emote['fname'], ".php") )
+			  {  // Emote file found
 				$text .= "<img src='".$emote['path'].$emote['fname']."' alt='' /> ";
+			  }
 			}
 
 			$text .= "</td>
 			<td class='forumheader3' style='width: 10%; text-align: center;'>".($pref['emotepack'] == $pack ? EMOLAN_10 : "<input class='button' type='submit' name='defPack_".$pack."' value=\"".EMOLAN_11."\" />")."</td>
-			<td class='forumheader3' style='width: 20%; text-align: center;'><input class='button' type='submit' name='subPack_".$pack."' value=\"".EMOLAN_12."\" /></td>
-			</tr>
-			";
+			<td class='forumheader3' style='width: 20%; text-align: center;'>
+				<input class='button' type='submit' name='subPack_".$pack."' value=\"".EMOLAN_12."\" />";
+			if ($can_scan && ($pack != 'default'))
+			{
+			  $text .= "<br /><br /><input class='button' type='submit' name='scanPack_".$pack."' value=\"".EMOLAN_26."\" />";
+			}
+			$text .= "<br /><br /><input class='button' type='submit' name='XMLPack_".$pack."' value=\"".EMOLAN_28."\" />";
+			$text .= "</td></tr>";
 		}
 
 		$text .= "
@@ -153,24 +196,29 @@
 		$ns -> tablerender(EMOLAN_13, $text);
 	}
 
+
+	// Configure an individual emote pack
 	function emoteConf($packID)
 	{
-
 		global $ns, $fl, $pref, $sysprefs, $tp;
 		$corea = "emote_".$packID;
 
 		$emotecode = $sysprefs -> getArray($corea);
 
-		$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore');
+		$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$');
 		$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, "", $reject);
 
 		$eArray = array();
 		foreach($emoteArray as $value)
 		{
-			if(!strstr($value['fname'], ".php") && !strstr($value['fname'], ".txt") && !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".xml") && !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html"))
-			{
-				$eArray[] = array('path' => $value['path'], 'fname' => $value['fname']);
-			}
+		  if(!strstr($value['fname'], ".php") 
+		  && !strstr($value['fname'], ".txt") 
+		  && !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".bak") 
+		  && !strstr($value['fname'], ".xml") 
+		  && !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html"))
+		  {
+			$eArray[] = array('path' => $value['path'], 'fname' => $value['fname']);
+		  }
 		}
 
 		$text = "
@@ -187,57 +235,147 @@
 		{
 			$ename = $emote['fname'];
 			$evalue = str_replace(".", "!", $ename);
+			$file_back = '';
+			$text_back = '';
 
+			if (!isset($emotecode[$evalue]))
+			{
+			  $file_back = ' background-color: #FF8000;';
+			}
+			elseif (!$emotecode[$evalue])
+			{
+			   $text_back = ' background-color: #FF8000';
+			}
 			$text .= "
 			<tr>
-			<td class='forumheader3' style='width: 20%;'>".$ename."</td>
+			<td class='forumheader3' style='width: 20%;{$file_back}'>".$ename."</td>
 			<td class='forumheader3' style='width: 20%; text-align: center;'><img src='".$emote['path'].$ename."' alt='' /></td>
-			<td class='forumheader3' style='width: 60%;'><input style='width: 80%' class='tbox' type='text' name='$evalue' value='".$tp -> toForm($emotecode[$evalue])."' maxlength='200' /></td>
+			<td class='forumheader3' style='width: 60%;{$text_back}'><input style='width: 80%' class='tbox' type='text' name='{$evalue}' value='".$tp -> toForm(varset($emotecode[$evalue],''))."' maxlength='200' /></td>
 			</tr>
 			";
 		}
 
 		$text .= "
 		<tr>
-		<td style='text-align: center;' colspan='3' class='forumheader'><input class='button' type='submit' name='sub_conf' value='".EMOLAN_14."' /></td>
+		<td class='forumheader'>".count($eArray)." files</td>
+		<td style='text-align: center;' colspan='2' class='forumheader'><input class='button' type='submit' name='sub_conf' value='".EMOLAN_14."' /></td>
 		</tr>
 
 		</table>
-		<input type='hidden' name='packID' value='$packID' />
+		<input type='hidden' name='packID' value='{$packID}' />
 		</form>";
 		$ns -> tablerender(EMOLAN_15.": '".$packID."'", $text);
+	}
+
+
+	// Generate an XML file - packname.xml in root emoticon directory
+	function emoteXML($packID, $strip_xtn = TRUE)
+	{
+		global $fl, $pref, $sysprefs, $tp;
+		
+		$fname = e_IMAGE."emotes/".$packID."/emoticons.xml";
+		$backname = e_IMAGE."emotes/".$packID."/emoticons.bak";
+		
+		$corea = "emote_".$packID;
+		$emotecode = $sysprefs -> getArray($corea);
 
+		$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$');
+		$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, "", $reject);
+
+		$eArray = array();
+		foreach($emoteArray as $value)
+		{
+		  if(!strstr($value['fname'], ".php") 
+		  && !strstr($value['fname'], ".txt") 
+		  && !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".bak") 
+		  && !strstr($value['fname'], ".xml") 
+		  && !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html"))
+		  {
+			$eArray[] = $value['fname'];
+		  }
+		}
+
+		$f_string = "<?xml version=\"1.0\"?".">\n<messaging-emoticon-map >\n\n\n";
+
+		foreach($eArray as $emote)
+		{
+			// Optionally strip file extension
+		  $evalue = str_replace(".", "!", $emote);
+		  if ($strip_xtn) $ename = substr($emote,0,strrpos($emote,'.'));
+		  $f_string .= "<emoticon file=\"{$ename}\">\n";
+		  foreach (explode(' ',$tp -> toForm($emotecode[$evalue])) as $v)
+		  {
+		    if (trim($v)) $f_string .= "\t<string>{$v}</string>\n";
+		  }
+		  $f_string .= "</emoticon>\n";
+		}
+
+		$f_string .= "\n</messaging-emoticon-map>\n";
+
+		if (is_file($backname)) unlink($backname);		// Delete any old backup
+		
+		if (is_file($fname)) rename($fname,$backname);
+		if (file_put_contents($fname,$f_string) === FALSE)
+		{
+		  echo "<br /><div style='text-align: center;'>".EMOLAN_30."<b>".$fname."</b></div><br />";
+		}
+		else
+		{
+		  echo "<br /><div style='text-align: center;'>".EMOLAN_29."<b>".$fname."</b></div><br />";
+		}
 	}
 
+
+	// Save configuration for an emote pack that's been edited
 	function saveConf()
 	{
 		global $ns, $sql, $tp;
 
 		$packID = $_POST['packID'];
 		unset($_POST['sub_conf'], $_POST['packID']);
-
-		foreach($_POST as $key => $value)
+/*
+		foreach($_POST as $key => $value)		// $key is file name, with '.' already replaced by '!'
 		{
-			$key = str_replace("_", "!", $key);
-			$_POST[$key] = $value;
+		  unset($_POST[$key]);
+//		  $key = str_replace("_", "!", $key);	// Why?
+//		  $key = str_replace(".", "!", $key);	// Don't think we need this, either
+		  $_POST[$key] = $value;
 		}
-
+*/
 		$encoded_emotes = $tp -> toDB($_POST);
 		$tmp = addslashes(serialize($encoded_emotes));
 
-		if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'")) {
-			admin_update($sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='emote_".$packID."' "), 'update', EMOLAN_16);
-		} else {
-			admin_update($sql->db_Insert("core", "'emote_".$packID."', '$tmp' "), 'insert', EMOLAN_16);
+		if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'")) 
+		{
+		  admin_update($sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='emote_".$packID."' "), 'update', EMOLAN_16);
+		} 
+		else 
+		{
+		  admin_update($sql->db_Insert("core", "'emote_".$packID."', '$tmp' "), 'insert', EMOLAN_16);
 		}
 	}
 
-	function installCheck()
+
+	// Identify currently selected emote pack. Read in any new ones
+	// Return false to disable listing of packs
+	function installCheck($do_one = FALSE)
 	{
 		global $sql, $fl;
+
+		// Pick up a list of emote packs from the database
+		$pack_local = array();
+		if ($sql->db_Select("core","*","`e107_name` LIKE 'emote_%'",TRUE))
+		{
+		  while ($row = $sql->db_Fetch())
+		  {
+		    $pack_local[substr($row['e107_name'],6)] = TRUE;
+		  }
+		}
+		
 		foreach($this -> packArray as $value)
 		{
-			if(strpos($value,' ')!==FALSE){
+			if(strpos($value,' ')!==FALSE)
+			{	// Highlight any directory names containing spaces - not allowed
 				global $ns;
 				$msg = "
 				<div style='text-align:center;'><b>".EMOLAN_17."<br />".EMOLAN_18."</b><br /><br />
@@ -255,10 +393,20 @@
 				$ns->tablerender(EMOLAN_21, $msg);
 				return FALSE;
 			}
-			if(!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' "))
-			{
+
+		  if (array_key_exists($value,$pack_local))
+		  {
+		    unset($pack_local[$value]);
+		  }
+			
+			if (($do_one == $value) || !$do_one &&  (!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' ")))
+			{  // Pack info not in DB, or to be re-scanned
+			  $no_error = TRUE;
+			  $File_type = 'Unknown';
+				// Array of all files in the directory of the selected emote pack
 				$fileArray = $fl -> get_files(e_IMAGE."emotes/".$value);
-				foreach($fileArray as $file)
+				$confFile = '';
+				foreach($fileArray as $k => $file)
 				{
 					if(strstr($file['fname'], ".xml"))
 					{
@@ -272,9 +420,14 @@
 					{
 						$confFile = array('file' => $file['fname'], 'type' => "php");
 					}
+					if ($confFile)
+					{
+					  unset($fileArray[$k]);
+					  break;
+					}
 				}
 
-				/* .pak file ------------------------------------------------------------------------------------------------------------------------------------ */
+				/* .pak file */
 				if($confFile['type'] == "pak")
 				{
 					$filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
@@ -282,72 +435,165 @@
 					$contentArray = array();
 					foreach($pakconf as $line)
 					{
-						if(trim($line) && strstr($line, "=+") && !strstr($line, ".txt") && !strstr($line, ".html") && !strstr($line, "cvs")) $contentArray[] = $line;
+					  if(trim($line) && strstr($line, "=+") && !strstr($line, ".txt") && !strstr($line, ".html") && !strstr($line, "cvs")) $contentArray[] = $line;
 					}
 					$confArray = array();
 					foreach($contentArray as $pakline)
 					{
-						$tmp = explode("=+:", $pakline);
-						$confIC = str_replace(".", "!", $tmp[0]);
-						$confArray[$confIC] = trim($tmp[2]);
+					  $tmp = explode("=+:", $pakline);
+					  $confIC = str_replace(".", "!", $tmp[0]);
+					  $confArray[$confIC] = trim($tmp[2]);
 					}
 					$tmp = addslashes(serialize($confArray));
-					$sql->db_Insert("core", "'emote_".$value."', '$tmp' ");
-					echo "<div style='text-align: center;'><b>New emote pak found: '</b> ".$value."'</div>";
+					$File_type = EMOLAN_22;
 				}
-				/* end ----------------------------------------------------------------------------------------------------------------------------------------- */
+				/* end  */
 
-				/* .xml file ------------------------------------------------------------------------------------------------------------------------------------ */
+				/* .xml file  */
 				if($confFile['type'] == "xml")
 				{
 					$filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
 
-					$handle = fopen ($filename, "r");
-					$contents = fread ($handle, filesize ($filename));
-					fclose ($handle);
-
-					preg_match_all("#\<emoticon file=\"(.*?)\"\>(.*?)\<\/emoticon\>#si", $contents, $match);
+//					$handle = fopen ($filename, "r");
+//					$contents = fread ($handle, filesize ($filename));	// Get the XML file for the emote pack
+//					fclose ($handle);
+					$contents = file_get_contents($filename);
 					$confArray = array();
+					$xml_type = 0;
 
-					for($a=0; $a<=(count($match[0])); $a++)
+					if ((strpos($contents, "<icon>") !== FALSE) && (strpos($contents, "<icondef>") !== FALSE))
+					{ 	// xep-0038 format
+					/* Example:
+					  <icon>
+						<text>:-)</text>
+						<text>:)</text>
+						<object mime="image/png">happy.png</object>
+						<object mime="audio/x-wav">choir.wav</object>
+					  </icon>*/
+					  preg_match_all("#\<icon>(.*?)\<\/icon\>#si", $contents, $match);
+					
+					  $xml_type = 1;
+						// $match[0] - complete emoticon entry
+						// $match[1] - match string and object specification 
+					  $item_index = 1;
+					}
+					elseif (strpos($contents, "<emoticon") !== FALSE)
+					{	//  "Original" E107 format (as used on KDE, although they may be changing to XEP-0038)
+					  preg_match_all("#\<emoticon file=\"(.*?)\"\>(.*?)\<\/emoticon\>#si", $contents, $match);
+					
+					  $xml_type = 2;
+						// $match[0] - complete emoticon entry
+						// $match[1] - filename (may or may not not have file extension/suffix)
+						// $match[2] - match string(s) representing emote
+					  $item_index = 2;
+					}
+					
+					if ($xml_type)
 					{
-						preg_match_all("#\<string\>(.*?)\<\/string\>#si", $match[0][$a], $match2);
-
-						$codet = "";
-						foreach($match2[1] as $code)
+					  for($a=0; $a < count($match[0]); $a++)
+					  {
+					    $e_file = '';
+					    switch ($xml_type)
 						{
-							$codet .= $code." ";
+						  case 1 :		// xep-0038
+							// Pull out a file name (only support first image type) - its in $fmatch[1]
+							if (preg_match("#\<object\s*?mime\=[\"\']image\/.*?\>(.*?)\<\/object\>#si",$match[1][$a],$fmatch))
+							{
+							  $e_file = $fmatch[1];
+//							  echo "xep-0038 file: ".$e_file."<br />";
+							  // Pull out all match strings - need to pick out any language definitions for posterity
+							  // but currently accept all language strings
+							  preg_match_all("#\<text(?:\s*?\>|\s*?xml\:lang\=\"(.*?)\"\>)(.*?)\<\/text\>#si", $match[1][$a], $match2);
+							  // $match2[1] is the languages
+							  // $match2[2] is the match strings
+							  $codet = implode(" ",$match2[2]);
+							}
+							break;
+						  case 2 :
+						    $e_file = $match[1][$a];
+							// Now pull out all the 'match' strings
+							preg_match_all("#\<string\>(.*?)\<\/string\>#si", $match[2][$a], $match2);
+							$codet = implode(" ",$match2[1]);
+							break;
 						}
+						// $e_file has the emote file name
+						// $match2 has an array of substitution strings
+
 
+						$file = '';
 						foreach($fileArray as $emote)
-						{
-							if(strstr($emote['fname'], $match[1][$a]))
+						{ // Check that the file exists
+					      if (strpos($e_file,".") === FALSE)
+						  {  // File extension not specified - accept any file extension for match
+							if(strpos($emote['fname'], $e_file.".") === 0)
 							{
-								$file = str_replace(".", "!", $emote['fname']);
+						      $file = str_replace(".", "!", $emote['fname']);
+							  break;
 							}
-						}
-						$confArray[$file] = $codet;
+						  }
+						  else
+						  {    // File extension specified - do simple match
+							if($emote['fname'] == $e_file)
+							{
+						      $file = str_replace(".", "!", $emote['fname']);
+							  break;
+						    }
+						  }
+					    }
+					  // Only add if the file exists. OK if no definition - might want to be added
+					  if ($file) $confArray[$file] = $codet;
+					  }
+					}
+					else
+					{
+					  echo "Unsupported XML File Format<br /><br />";
+					  $no_error = FALSE;
 					}
 
+
+					// Save pack info in the database
 					$tmp = addslashes(serialize($confArray));
-					$sql->db_Insert("core", "'emote_".$value."', '$tmp' ");
-					echo "<div style='text-align: center;'><b>New emote xml pak found: '</b> ".$value."'</div>";
+					$File_type = EMOLAN_23;
 				}
 
 				if($confFile['type'] == "php")
 				{
-					echo "<b>.conf file found</b>: installing '".$value."'<br />";
+					echo EMOLAN_25."'".$value."'<br />";
 					include_once(e_IMAGE."emotes/".$value."/".$confFile['file']);
-					$sql->db_Insert("core", "'emote_".$value."', '$_emoteconf' ");
-					echo "<div style='text-align: center;'><b>New emote php found: '</b> ".$value."'</div>";
+					$File_type = EMOLAN_24;
+					$tmp = $_emoteconf;		// Use consistent name
+				}
+				
+				if ($no_error)
+				{
+				  if ($do_one)
+				  {	// Assume existing pack
+				    $sql->db_Update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$value."'");
+				  }
+				  else
+				  {	// Assume new pack
+				    $sql->db_Insert("core", "'emote_".$value."', '{$tmp}' ");
+				  }
+				  echo "<div style='text-align: center;'><b>".$File_type." '</b> ".$value."'</div>";
+				}
+				else
+				{  // Error occurred
+				  echo "<div style='text-align: center;'><b>".EMOLAN_27." '</b> ".$value."'</div>";
 				}
-				/* end ----------------------------------------------------------------------------------------------------------------------------------------- */
-
 			}
 		}
+	  if (count($pack_local))
+	  {
+	    foreach ($pack_local as $p => $d)
+		{
+	      echo "Missing files for pack: ".$p." - deleted in database<br />";
+		  $sql->db_Delete("core","`e107_name` = 'emote_{$p}'");
+		}
+	  }
+	  return TRUE;
 	}
+  
 }
-
 require_once("footer.php");
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_admin/fileinspector.php 0.7.11.src/e107_admin/fileinspector.php
--- 0.7.7.src/e107_admin/fileinspector.php	2006-05-16 08:29:26.000000000 -0500
+++ 0.7.11.src/e107_admin/fileinspector.php	2007-09-27 15:11:35.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/fileinspector.php,v $
-|     $Revision: 1.37 $
-|     $Date: 2006/05/16 13:29:26 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.38 $
+|     $Date: 2007/09/27 20:11:35 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -54,7 +54,8 @@
 	var $count = array();
 	var $results = 0;
 	
-	function file_inspector() {
+	function file_inspector() 
+	{
 		global $e107;
 		set_time_limit(240);
 		$this -> root_dir = $e107 -> file_path;
@@ -220,112 +221,197 @@
 		
 		return $list;
 	}
+
+
+
+
+	// Given a full path and filename, looks it up in the list to determine valid actions; returns:
+	//	  'check' - file is expected to be present, and validity is to be checked
+	//	  'ignore' - file may or may not be present - check its validity if found, but not an error if missing
+	//	  'uncalc' - file must be present, but its integrity cannot be checked.
+	//	  'nocalc' - file may be present, but its integrity cannot be checked. Not an error if missing
+	function check_action($dir, $name)
+	{
+	  global $coredir;
+	  
+	  if ($name == 'e_inspect.php') return 'nocalc';		// Special case for plugin integrity checking
+	  
+	  $filename = $dir.'/'.$name;
+	  $admin_dir = $this -> root_dir.'/'.$coredir['admin'].'/';
+	  $image_dir  = $this -> root_dir.'/'.$coredir['images'].'/';
+	  $test_list = array(
+			$admin_dir.'core_image.php' => 'uncalc',
+			$admin_dir.'filetypes.php' => 'uncalc',
+			$admin_dir.'filetypes_.php' => 'ignore',
+			$admin_dir.'admin_filetypes.php' => 'nocalc',
+			$this -> root_dir.'/e107_config.php' => 'uncalc',
+			$this -> root_dir.'/e107.htaccess' => 'ignore',
+			$this -> root_dir.'/install.php' => 'ignore',
+			$image_dir.'adminlogo.png' => 'uncalc',				// Users often change logo
+			$image_dir.'logo.png' => 'uncalc'
+		);
+	  if (isset($test_list[$filename])) return $test_list[$filename];
+	  return 'check';
+	}
+
 	
-	function inspect($list, $deprecated, $level, $dir, &$tree_end, &$parent_expand) {
-		global $coredir;
-		unset ($childOut);
-		$parent_expand = false;
-		if (substr($dir, -1) == '/') {
-			$dir = substr($dir, 0, -1);
-		}
-		$dir_id = dechex(crc32($dir));
-		$this -> files[$dir_id]['.']['level'] = $level;
-		$this -> files[$dir_id]['.']['parent'] = $this -> parent;
-		$this -> files[$dir_id]['.']['file'] = $dir;
-		$directory = $level ? basename($dir) : SITENAME;
-		$level++;
-		
-		foreach ($list as $key => $value) {
-			$this -> parent = $dir_id;
-			if (is_array($value)) {
-				$path = $dir.'/'.$key;
-				$child_open = false;
-				$child_end = true;
-				$sub_text .= $this -> inspect($value, $deprecated[$key], $level, $path, $child_end, $child_expand);
-				$tree_end = false;
-				if ($child_expand) {
-					$parent_expand = true;
-					$last_expand = true;
-				}
-			} else {
-					$path = $dir.'/'.$key;
-					$fid = strtolower($key);
+	// This function does the real work
+	//  $list -
+	//	$deprecated
+	// 	$level
+	//	$dir
+	//	&$tree_end
+	//	&$parent_expand
+	function inspect($list, $deprecated, $level, $dir, &$tree_end, &$parent_expand) 
+	{
+	  global $coredir;
+	
+	  unset ($childOut);
+	  $parent_expand = false;
+	  if (substr($dir, -1) == '/') 
+	  {
+		$dir = substr($dir, 0, -1);
+	  }
+	  $dir_id = dechex(crc32($dir));
+	  $this -> files[$dir_id]['.']['level'] = $level;
+	  $this -> files[$dir_id]['.']['parent'] = $this -> parent;
+	  $this -> files[$dir_id]['.']['file'] = $dir;
+	  $directory = $level ? basename($dir) : SITENAME;
+	  $level++;
+		
+	  foreach ($list as $key => $value) 
+	  {
+		$this -> parent = $dir_id;
+		if (is_array($value)) 
+		{ // Entry is a subdirectory - recurse another level
+		  $path = $dir.'/'.$key;
+		  $child_open = false;
+		  $child_end = true;
+		  $sub_text .= $this -> inspect($value, $deprecated[$key], $level, $path, $child_end, $child_expand);
+		  $tree_end = false;
+		  if ($child_expand) 
+		  {
+			$parent_expand = true;
+			$last_expand = true;
+		  }
+		} 
+		else 
+		{
+		  $path = $dir.'/'.$key;
+		  $fid = strtolower($key);
+		  $this -> files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
+		  if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE) 
+		  {	// We're checking a file here
+			if ($_POST['core'] != 'none') 
+			{		// Look at core files
+			  $this -> count['core']['num']++;
+			  $this -> count['core']['size'] += $this -> files[$dir_id][$fid]['size'];
+			  if ($_POST['regex']) 
+			  {	// Developer prefs activated - search file contents according to regex
+				$file_content = file($path);		// Get contents of file
+				if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE) 
+				{
+				  if ($this -> files[$dir_id][$fid]['lines'] = preg_grep("#".$_POST['regex']."#".$_POST['mod'], $file_content))
+				  {	// Search string found - add file to list
 					$this -> files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
-					if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE) {
-						if ($_POST['core'] != 'none') {
-							$this -> count['core']['num']++;
-							$this -> count['core']['size'] += $this -> files[$dir_id][$fid]['size'];
-							if ($_POST['regex']) {
-								$file_content = file($path);
-								if (($this -> files[$dir_id][$fid]['size'] = filesize($path)) !== FALSE) {
-									if ($this -> files[$dir_id][$fid]['lines'] = preg_grep("#".$_POST['regex']."#".$_POST['mod'], $file_content)){
-										$this -> files[$dir_id][$fid]['file'] = ($_POST['type'] == 'tree') ? $key : $path;
-										$this -> files[$dir_id][$fid]['icon'] = 'file_core.png';
-										$dir_icon = 'fileinspector.png';
-										$parent_expand = TRUE;
-										$this -> results++;
-									} else {
-										unset($this -> files[$dir_id][$fid]);
-										$known[$dir_id][$fid] = true;
-										$dir_icon = ($dir_icon == 'fileinspector.png') ? $dir_icon : 'folder.png';
-									}
-								}
-							} else {
-								//if (strpos($dir.'/'.$key, 'htmlarea') === false) {
-									if ($_POST['integrity']) {
-										if ($dir.'/'.$key != $this -> root_dir.'/'.$coredir['admin'].'/core_image.php' && $dir.'/'.$key != $this -> root_dir.'/e107_config.php') {
-											if ($this -> checksum($path) != $value) {
-												$this -> count['fail']['num']++;
-												$this -> count['fail']['size'] += $this -> files[$dir_id][$fid]['size'];
-												$this -> files[$dir_id][$fid]['icon'] = 'file_fail.png';
-												$dir_icon = 'folder_fail.png';
-												$parent_expand = TRUE;
-											} else {
-												$this -> count['pass']['num']++;
-												$this -> count['pass']['size'] += $this -> files[$dir_id][$fid]['size'];
-												if ($_POST['core'] != 'fail') {
-													$this -> files[$dir_id][$fid]['icon'] = 'file_check.png';
-													$dir_icon = ($dir_icon == 'folder_fail.png' || $dir_icon == 'folder_missing.png') ? $dir_icon : 'folder_check.png';
-												} else {
-													unset($this -> files[$dir_id][$fid]);
-													$known[$dir_id][$fid] = true;
-												}
-											}
-										} else {
-											$this -> count['uncalculable']['num']++;
-											$this -> count['uncalculable']['size'] += $this -> files[$dir_id][$fid]['size'];
-											if ($_POST['core'] != 'fail') {
-												$this -> files[$dir_id][$fid]['icon'] = 'file_uncalc.png';
-											} else {
-												unset($this -> files[$dir_id][$fid]);
-												$known[$dir_id][$fid] = true;
-											}
-										}
-									} else {
-										$this -> files[$dir_id][$fid]['icon'] = 'file_core.png';
-									}
-								//} else {
-								//	$this -> count['warning']['num']++;
-								//	$this -> count['warning']['size'] += $this -> files[$dir_id][$fid]['size'];
-								//	$this -> files[$dir_id][$fid]['icon'] = 'file_warning.png';
-								//	$dir_icon = 'folder_warning.png';
-								//	$parent_expand = TRUE;
-								//}
-							}
-						} else {
-							unset ($this -> files[$dir_id][$fid]);
-							$known[$dir_id][$fid] = true;
-						}
-					} else if ($_POST['missing']) {
-						$this -> count['missing']['num']++;
-						$this -> files[$dir_id][$fid]['icon'] = 'file_missing.png';
-						$dir_icon = ($dir_icon == 'folder_fail.png') ? $dir_icon : 'folder_missing.png';
+					$this -> files[$dir_id][$fid]['icon'] = 'file_core.png';
+					$dir_icon = 'fileinspector.png';
+					$parent_expand = TRUE;
+					$this -> results++;
+				  } 
+				  else 
+				  {	// Search string not found - discard from list
+					unset($this -> files[$dir_id][$fid]);
+					$known[$dir_id][$fid] = true;
+					$dir_icon = ($dir_icon == 'fileinspector.png') ? $dir_icon : 'folder.png';
+				  }
+				}
+			  } 
+			  else 
+			  {	
+				if ($_POST['integrity']) 
+				{	// Actually check file integrity
+				  switch ($this_action = $this->check_action($dir,$key))
+				  {
+					case 'ignore' :
+				    case 'check' :
+					  if ($this -> checksum($path) != $value) 
+					  {
+						$this -> count['fail']['num']++;
+						$this -> count['fail']['size'] += $this -> files[$dir_id][$fid]['size'];
+						$this -> files[$dir_id][$fid]['icon'] = 'file_fail.png';
+						$dir_icon = 'folder_fail.png';
 						$parent_expand = TRUE;
-					} else {
-						unset ($this -> files[$dir_id][$fid]);
-					}
+					  } 
+					  else 
+					  {
+						$this -> count['pass']['num']++;
+						$this -> count['pass']['size'] += $this -> files[$dir_id][$fid]['size'];
+						if ($_POST['core'] != 'fail') 
+						{
+						  $this -> files[$dir_id][$fid]['icon'] = 'file_check.png';
+						  $dir_icon = ($dir_icon == 'folder_fail.png' || $dir_icon == 'folder_missing.png') ? $dir_icon : 'folder_check.png';
+						} 
+						else 
+						{
+						  unset($this -> files[$dir_id][$fid]);
+						  $known[$dir_id][$fid] = true;
+						}
+					  }
+					  break;
+					case 'uncalc' :
+					case 'nocalc' :
+					  $this -> count['uncalculable']['num']++;
+					  $this -> count['uncalculable']['size'] += $this -> files[$dir_id][$fid]['size'];
+					  if ($_POST['core'] != 'fail')
+					  {
+						$this -> files[$dir_id][$fid]['icon'] = 'file_uncalc.png';
+					  } 
+					  else 
+					  {
+						unset($this -> files[$dir_id][$fid]);
+						$known[$dir_id][$fid] = true;
+					  }
+					  break;
+				  }
+				} 
+				else 
+				{	// Just identify as core file
+				  $this -> files[$dir_id][$fid]['icon'] = 'file_core.png';
+				}
+			  }
+			} 
+			else 
+			{
+			  unset ($this -> files[$dir_id][$fid]);
+			  $known[$dir_id][$fid] = true;
+			}
+		  } 
+		  else if ($_POST['missing']) 
+		  {
+			switch ($this_action = $this->check_action($dir,$key))
+			{
+			  case 'check' :
+			  case 'uncalc' :
+				$this -> count['missing']['num']++;
+				$this -> files[$dir_id][$fid]['icon'] = 'file_missing.png';
+				$dir_icon = ($dir_icon == 'folder_fail.png') ? $dir_icon : 'folder_missing.png';
+				$parent_expand = TRUE;
+				break;
+			  case 'ignore' :
+			  case 'nocalc' :
+			    // These files can be missing without error - delete from the list
+				unset ($this -> files[$dir_id][$fid]);
+				$known[$dir_id][$fid] = true;
+			    break;
 			}
+		  } 
+		  else 
+		  {
+			unset ($this -> files[$dir_id][$fid]);
+		  }
 		}
+	  }
 		
 		if ($_POST['noncore'] || $_POST['oldcore']) {
 			$handle = opendir($dir.'/');
@@ -613,9 +699,9 @@
 		$data .= "|     GNU General Public License (http://gnu.org).\n";
 		$data .= "|\n";
 		$data .= "|     \$Source: /cvsroot/e107/e107_0.7/e107_admin/fileinspector.php,v $\n";
-		$data .= "|     \$Revision: 1.37 $\n";
-		$data .= "|     \$Date: 2006/05/16 13:29:26 $\n";
-		$data .= "|     \$Author: mcfly_e107 $\n";
+		$data .= "|     \$Revision: 1.38 $\n";
+		$data .= "|     \$Date: 2007/09/27 20:11:35 $\n";
+		$data .= "|     \$Author: e107steved $\n";
 		$data .= "+----------------------------------------------------------------------------+\n";
 		$data .= "*/\n\n";
 		$data .= "if (!defined('e107_INIT')) { exit; }\n\n";
diff -x .svn -ruN 0.7.7.src/e107_admin/filemanager.php 0.7.11.src/e107_admin/filemanager.php
--- 0.7.7.src/e107_admin/filemanager.php	2006-11-15 09:55:40.000000000 -0600
+++ 0.7.11.src/e107_admin/filemanager.php	2007-10-25 20:09:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/filemanager.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/11/15 15:55:40 $
-|     $Author: lisa_ $
+|     $Revision: 1.22 $
+|     $Date: 2007/10/26 01:09:07 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -24,10 +24,8 @@
 $e_sub_cat = 'filemanage';
 require_once("auth.php");
 
-
 $pubfolder = (str_replace("../","",e_QUERY) == str_replace("../","",e_FILE."public/")) ? TRUE : FALSE;
 
-
 $imagedir = e_IMAGE."filemanager/";
 
 	$dir_options[0] = FMLAN_47;
@@ -45,7 +43,8 @@
 	$path = str_replace("../", "", $adchoice[0]);
 }
 
-if($path == "/")
+$ok = (e_QUERY == '' || '../'.substr(e_QUERY, 0, strlen(e_FILE)-3) == e_FILE || '../'.substr(e_QUERY, 0, strlen(e_IMAGE)-3) == e_IMAGE);
+if($path == "/" || !$ok)
 {
 	$path = $adchoice[0];
 	echo "<b>Debug</b> ".$path." <br />";
diff -x .svn -ruN 0.7.7.src/e107_admin/footer.php 0.7.11.src/e107_admin/footer.php
--- 0.7.7.src/e107_admin/footer.php	2006-10-14 08:01:41.000000000 -0500
+++ 0.7.11.src/e107_admin/footer.php	2007-08-18 08:47:47.000000000 -0500
@@ -11,16 +11,52 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/footer.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2006/10/14 13:01:41 $
-|     $Author: e107coders $
+|     $Revision: 1.26 $
+|     $Date: 2007/08/18 13:47:47 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-
 if (!defined('e107_INIT')) { exit; }
+$In_e107_Footer = TRUE;	// For registered shutdown function
 
-global $ADMIN_FOOTER, $footer_js, $sql;
+global $eTraffic, $error_handler, $db_time, $sql, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $ADMIN_FOOTER, $e107;
 
+//
+// SHUTDOWN SEQUENCE
+//
+// The following items have been carefully designed so page processing will finish properly
+// Please DO NOT re-order these items without asking first! You WILL break something ;)
+// These letters match the USER footer (that's why there is B.1,B.2)
+//
+// A Ensure sql and traffic objects exist
+// B.1 Clear cache if over a week old
+// B.2 Send the footer templated data
+// C Dump any/all traffic and debug information
+// [end of regular-page-only items]
+// D Close the database connection
+// E Themed footer code
+// F Configured footer scripts
+// G Browser-Server time sync script (must be the last one generated/sent)
+// H Final HTML (/body, /html)
+// I collect and send buffered page, along with needed headers
+//
+
+//
+// A Ensure sql and traffic objects exist
+//
+
+if(!is_object($sql)){
+	// reinstigate db connection if another connection from third-party script closed it ...
+	$sql = new db;
+	$sql -> db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
+}
+if (!is_object($eTraffic)) {
+	$eTraffic = new e107_traffic;
+	$eTraffic->Bump('Lost Traffic Counters');
+}
+//
+// B.1 Clear cache if over a week old
+//
 if (ADMIN == TRUE) {
 	if ($pref['cachestatus']) {
 		if (!$sql->db_Select('generic', '*', "gen_type='empty_cache'"))
@@ -38,50 +74,121 @@
 		}
 	}
 }
+
+
+//
+// B.2 Send footer template
+//
+if(varset($e107_popup)!=1){
+
 if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
 	parse_admin($ADMIN_FOOTER);
 }
-$eTimingStop = microtime();
-global $eTimingStart, $eTraffic;
-$rendertime = number_format($eTraffic->TimeDelta( $eTimingStart, $eTimingStop ), 4);
-$db_time    = number_format($db_time,4);
-$rinfo = '';
-
-if($pref['displayrendertime']){ $rinfo .= "Render time: {$rendertime} second(s); {$db_time} of that for queries. "; }
-if($pref['displaysql']){ $rinfo .= "DB queries: ".$sql -> db_QueryCount().". "; }
-if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
-echo ($rinfo ? "\n<div style='text-align:center' class='smalltext'>{$rinfo}</div>\n" : "");
 
-if($error_handler->debug == true) {
-	echo "
-	<br /><br />";
 
+	//
+	// C Dump all debug and traffic information
+	//
+	$eTimingStop = microtime();
+	global $eTimingStart;
+	$rendertime = number_format($eTraffic->TimeDelta( $eTimingStart, $eTimingStop ), 4);
+	$db_time    = number_format($db_time,4);
+	$rinfo = '';
+
+	if($pref['displayrendertime']){ $rinfo .= CORE_LAN11.$rendertime.CORE_LAN12.$db_time.CORE_LAN13; }
+	if($pref['displaysql']){ $rinfo .= CORE_LAN15.$sql -> db_QueryCount().". "; }
+	if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= CORE_LAN16.$e107->get_memory_usage(); }
+	if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
+	echo ($rinfo ? "\n<div style='text-align:center' class='smalltext'>{$rinfo}</div>\n" : "");
+
+
+	if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) {
+		global $db_debug;
+		echo "\n<!-- DEBUG -->\n";
+		$db_debug->Show_All();
+	}
+
+	/*
+	changes by jalist 24/01/2005:
+	show sql queries
+	usage: add ?showsql to query string, must be admin
+	*/
+
+	if(ADMIN && isset($queryinfo) && is_array($queryinfo))
+	{
+		$c=1;
+		$mySQLInfo = $sql->mySQLinfo;
+		echo "<table class='fborder' style='width: 100%;'>
+		<tr>
+		<td class='fcaption' style='width: 5%;'>ID</td><td class='fcaption' style='width: 95%;'>SQL Queries</td>\n</tr>\n";
+		foreach ($queryinfo as $infovalue)
+		{
+			echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
+			$c++;
+		}
+		echo "</table>";
+	}
+
+} // End of regular-page footer (the above NOT done for popups)
+
+//
+// D Close DB connection. We're done talking to underlying MySQL
+//
+	$sql -> db_Close();  // Only one is needed; the db is only connected once even with several $sql objects
+
+	//
+	// Just before we quit: dump quick timer if there is any
+	// Works any time we get this far. Not calibrated, but it is quick and simple to use.
+	// To use: eQTimeOn(); eQTimeOff();
+	//
+	$tmp = eQTimeElapsed();
+	if (strlen($tmp)) {
+		global $ns;
+		$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
+	}
+
+if ($pref['developer']) {
+	global $oblev_at_start,$oblev_before_start;
+	if (ob_get_level() != $oblev_at_start) {
+		$oblev = ob_get_level();
+		$obdbg = "<div style='text-align:center' class='smalltext'>Software defect detected; ob_*() level {$oblev} at end instead of ($oblev_at_start). POPPING EXTRA BUFFERS!</div>";
+		while (ob_get_level() > $oblev_at_start) {
+			ob_end_flush();
+		}
+		echo $obdbg;
+	}
+	// 061109 PHP 5 has a bug such that the starting level might be zero or one.
+	// Until they work that out, we'll disable this message.
+	// Devs can re-enable for testing as needed.
+	//
+	if (0 && $oblev_before_start != 0) {
+		$obdbg = "<div style='text-align:center' class='smalltext'>Software warning; ob_*() level {$oblev_before_start} at start; this page not properly integrated into its wrapper.</div>";
+		echo $obdbg;
+	}
+}
+
+if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) {
 	echo "
+	<br /><br />
 	<div>
 		<h3>PHP Errors:</h3><br />
 		".$error_handler->return_errors()."
 	</div>
 	";
-	$tmp = $eTraffic->Display();
-	if (strlen($tmp)) {
-		$ns->tablerender('Traffic Counters', $tmp);
-	}
-
-	$tmp = $db_debug->Show_Performance();
-	if (strlen($tmp)) {
-		$ns->tablerender('Time Analysis', $tmp);
-	}
-	$tmp = $db_debug->Show_SQL_Details();
-	if (strlen($tmp)) {
-		$ns->tablerender('SQL Analysis', $tmp);
-	}
 }
 
+//
+// E Last themed footer code, usually JS
+//
 if (function_exists('theme_foot'))
 {
 	echo theme_foot();
 }
 
+//
+// F any included JS footer scripts
+//
+global $footer_js;
 if(isset($footer_js) && is_array($footer_js))
 {
 	$footer_js = array_unique($footer_js);
@@ -92,8 +199,56 @@
 	}
 }
 
+//
+// G final JS script keeps user and server time in sync.
+//   It must be the last thing created before sending the page to the user.
+//
+// see e107.js and class2.php
+// This must be done as late as possible in page processing.
+$_serverTime=time();
+$lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0;
+if (abs($_serverTime - $lastSet) > 120) {
+	/* update time delay every couple of minutes.
+	* Benefit: account for user time corrections and changes in internet delays
+	* Drawback: each update may cause all server times to display a bit different
+	*/
+	echo "<script type='text/javascript'>\n";
+	echo "SyncWithServerTime('{$_serverTime}');
+       </script>\n";
+}
+
+//
+// H Final HTML
+//
 echo "</body></html>";
 
-$sql->db_Close();
+//
+// I Send the buffered page data, along with appropriate headers
+//
+$page = ob_get_clean();
+
+$etag = md5($page);
+header("Cache-Control: must-revalidate");
+header("ETag: {$etag}");
+
+$pref['compression_level'] = 6;
+if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
+	$browser_support = true;
+}
+if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) {
+	$server_support = true;
+}
+if(varset($pref['compress_output'],false) && $server_support == true && $browser_support == true) {
+	$level = intval($pref['compression_level']);
+	$page = gzencode($page, $level);
+	header("Content-Encoding: gzip", true);
+	header("Content-Length: ".strlen($page), true);
+	echo $page;
+} else {
+	header("Content-Length: ".strlen($page), true);
+	echo $page;
+}
 
-?>
+unset($In_e107_Footer);
+$e107_Clean_Exit=TRUE;	// For registered shutdown function -- let it know all is well!
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_admin/frontpage.php 0.7.11.src/e107_admin/frontpage.php
--- 0.7.7.src/e107_admin/frontpage.php	2006-07-07 22:57:35.000000000 -0500
+++ 0.7.11.src/e107_admin/frontpage.php	2007-07-08 16:08:18.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/frontpage.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2006/07/08 03:57:35 $
-|     $Author: e107coders $
+|     $Revision: 1.24 $
+|     $Date: 2007/07/08 21:08:18 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -132,7 +132,7 @@
 
 		if (isset($pref['frontpage']['all'])) {
 			$text .= "<tr>
-			<td class='forumheader3'>All Users</td>
+			<td class='forumheader3'>".FRTLAN_31."</td>
 			<td class='forumheader3'>".$pref['frontpage']['all']."</td>
 			<td class='forumheader3' style='text-align:center'>
 			<input type='image' title='".LAN_EDIT."' name='edit[all]' src='".ADMIN_EDIT_ICON_PATH."' />
diff -x .svn -ruN 0.7.7.src/e107_admin/header.php 0.7.11.src/e107_admin/header.php
--- 0.7.7.src/e107_admin/header.php	2006-07-07 21:23:46.000000000 -0500
+++ 0.7.11.src/e107_admin/header.php	2007-05-17 15:14:45.000000000 -0500
@@ -12,22 +12,66 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_admin/header.php,v $
-|   $Revision: 1.56 $
-|   $Date: 2006/07/08 02:23:46 $
-|   $Author: e107coders $
+|   $Revision: 1.61 $
+|   $Date: 2007/05/17 20:14:45 $
+|   $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 define("ADMIN_AREA",TRUE);
 define("USER_AREA",FALSE);
+$sql->db_Mark_Time('(Header Top)');
 
-// send the charset to the browser - overides spurious server settings with the lan pack settings.
+//
+// *** Code sequence for headers ***
+// IMPORTANT: These items are in a carefully constructed order. DO NOT REARRANGE
+// without checking with experienced devs! Various subtle things WILL break.
+//
+// We realize this is a bit (!) of a mess and hope to make further cleanups in a future release.
+//
+// A: Admin Defines and Links
+// B: Send HTTP headers that come before any html
+// C: Send start of HTML
+// D: Send JS
+// E: Send CSS
+// F: Send Meta Tags and Icon links
+// G: Send final theme headers (theme_head() function)
+// H: Generate JS for image preloading (setup for onload)
+// I: Calculate onload() JS functions to be called
+// J: Send end of html <head> and start of <body>
+// K: (The rest is ignored for popups, which have no menus)
+// L: (optional) Body JS to disable right clicks
+// M: Send top of body for custom pages and for news
+// N: Send other top-of-body HTML
+//
+// Load order notes for devs
+// * Browsers wait until ALL HTML has loaded before executing ANY JS
+// * The last CSS tag downloaded supercedes earlier CSS tags
+// * Browsers don't care when Meta tags are loaded. We load last due to
+//   a quirk of e107's log subsystem.
+// * Multiple external <link> file references slow down page load. Each one requires
+//   browser-server interaction even when cached.
+//
+
+//
+// A: Admin Defines and Links
+//
+require_once(e_ADMIN.'ad_links.php');
+//
+// B: Send HTTP headers (these come before ANY html)
+//
+
+// send the charset to the browser - overrides spurious server settings with the lan pack settings.
 header("Content-type: text/html; charset=".CHARSET, true);
 
-require_once(e_ADMIN.'ad_links.php');
-echo defined('STANDARDS_MODE') ? "" :
- "<?xml version='1.0' encoding='".CHARSET."' ?>";
+
+echo (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='".CHARSET."' "."?".">\n")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
+
+//
+// B.2: Include admin LAN defines
+//
+
 if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_header.php')) {
 	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_header.php");
 } else {
@@ -69,54 +113,44 @@
 	define("ADMIN_DELETE_ICON_PATH", e_IMAGE."admin_images/delete_16.png");
 }
 
-echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
-	<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
+//
+// C: Send start of HTML
+//
+
+echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
 	<head>
 	<title>".SITENAME." : ".LAN_head_4."</title>\n";
-echo "<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
-	<meta http-equiv='content-style-type' content='text/css' />\n";
-if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss'])) {
-	$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? THEME_ABS.'admin_'.$pref['admincss'] : THEME_ABS.$pref['admincss'];
-	echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
-} else if (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss'])) {
-	$css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? THEME_ABS.'admin_'.$pref['themecss'] : THEME_ABS.$pref['themecss'];
-	echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
-} else {
-	$css_file = file_exists(THEME.'admin_style.css') ? THEME_ABS.'admin_style.css' : THEME_ABS.'style.css';
-	echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
-}
 
-if (!isset($no_core_css) || !$no_core_css) {
-	echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n";
-}
-
-// ---------- Favicon ---------
-if (file_exists(THEME."favicon.ico")) {
-	echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n";
-}elseif (file_exists(e_BASE."favicon.ico")) {
-	echo "<link rel='icon' href='".SITEURL."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".SITEURL."favicon.ico' type='image/xicon' />\n";
+//
+// D: Send JS
+//
+echo "<!-- *JS* -->\n";
+
+// Wysiwyg JS support on or off.
+// your code should run off e_WYSIWYG
+if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") {
+	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
+	define("e_WYSIWYG",TRUE);
+	echo wysiwyg($e_wysiwyg);
+}else{
+	define("e_WYSIWYG",FALSE);
 }
 
-
-if (function_exists('theme_head')) {
-   	echo theme_head();
-}
 if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
 	echo "<script type='text/javascript' src='".e_FILE_ABS."e107.js'></script>\n";
 }
-if (file_exists(THEME."theme.js")) {
-	echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n";
-}
-if (filesize(e_FILE.'user.js')) {
-	echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n";
-}
-if (function_exists("headerjs")) {
-	echo headerjs();
+	if (file_exists(THEME.'theme.js')) { echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n"; }
+	if (filesize(e_FILE.'user.js')) { echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n"; }
+
+if (isset($eplug_js) && $eplug_js) {
+	echo "\n<!-- eplug_js -->\n";
+	echo "<script type='text/javascript' src='{$eplug_js}'></script>\n";
 }
 if (isset($htmlarea_js) && $htmlarea_js) {
 	echo $htmlarea_js;
 }
-if (strpos(e_SELF, 'fileinspector.php') === FALSE) {
+if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0")) 
+{
 echo "<script type='text/javascript'>
 <!--
 function savepreset(ps,pid){
@@ -129,32 +163,123 @@
 //-->
 </script>\n";
 }
-if (isset($eplug_js) && $eplug_js) {
-	echo "<script type='text/javascript' src='{$eplug_js}'></script>\n";
-}
+
+if (function_exists('headerjs')){echo headerjs();  }
+
+//
+// E: Send CSS
+//
+echo "<!-- *CSS* -->\n";
+
 if (isset($eplug_css) && $eplug_css) {
-	echo "\n<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
+	echo "\n<!-- eplug_css -->\n";
+	echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
 }
-if(check_class($pref['post_html']) && $pref['wysiwyg'] && $e_wysiwyg == TRUE){
-  	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
-	echo wysiwyg($e_wysiwyg);
-	define("e_WYSIWYG",TRUE);
-}else{
-	define("e_WYSIWYG",FALSE);
+
+echo "<!-- Theme css -->\n";
+if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss'])) {
+	$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? THEME_ABS.'admin_'.$pref['admincss'] : THEME_ABS.$pref['admincss'];
+	echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
+} else if (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss']))
+{
+	$css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? THEME_ABS.'admin_'.$pref['themecss'] : THEME_ABS.$pref['themecss'];
+	echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
+
+
+} 
+else 
+{
+	$css_file = file_exists(THEME.'admin_style.css') ? THEME_ABS.'admin_style.css' : THEME_ABS.'style.css';
+	echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
+}
+if (!isset($no_core_css) || !$no_core_css) {
+	echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n";
 }
-// load plugin header-data.
-foreach($pref['e_meta_list'] as $val)
+
+
+//
+// F: Send Meta Tags and Icon links
+//
+echo "<!-- *META* -->\n";
+
+// Multi-Language meta-tags with merge and override option.
+
+echo "<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
+<meta http-equiv='content-style-type' content='text/css' />\n";
+
+// --- Load plugin Meta files and eplug_ before others --------
+if (is_array($pref['e_meta_list']))
 {
-	if(is_readable(e_PLUGIN.$val."/e_meta.php"))
+	foreach($pref['e_meta_list'] as $val)
 	{
-		require_once(e_PLUGIN.$val."/e_meta.php");
+		if(is_readable(e_PLUGIN.$val."/e_meta.php"))
+		{
+			echo "<!-- $val meta -->\n";
+			require_once(e_PLUGIN.$val."/e_meta.php");
+		}
 	}
 }
 
 
+// ---------- Favicon ---------
+if (file_exists(THEME."favicon.ico")) {
+	echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n";
+}elseif (file_exists(e_BASE."favicon.ico")) {
+	echo "<link rel='icon' href='".SITEURL."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".SITEURL."favicon.ico' type='image/xicon' />\n";
+}
+
+//
+// G: Send Theme Headers
+//
+
+
+if(function_exists('theme_head')){
+	echo "\n<!-- *THEME HEAD* -->\n";
+	echo theme_head();
+}
+
+
+//
+// H: Generate JS for image preloads [user mode only]
+//
+echo "\n<!-- *PRELOAD* -->\n";
+
+//
+// I: Calculate JS onload() functions for the BODY tag [user mode only]
+//
+$body_onload = "";
 
+
+//
+// J: Send end of <head> and start of <body>
+//
 echo "</head>
-<body>\n";
+<body".$body_onload.">\n";
+$sql->db_Mark_Time("End Head, Start Body");
+
+//
+// K: (The rest is ignored for popups, which have no menus)
+//
+
+// require $e107_popup =1; to use it as header for popup without menus
+if(!isset($e107_popup))
+{
+	$e107_popup = 0;
+}
+if ($e107_popup != 1) {
+	
+
+//
+// L: (optional) Body JS to disable right clicks [reserved; user mode]
+//
+
+//
+// M: Send top of body for custom pages and for news [user mode only]
+//
+
+//
+// N: Send other top-of-body HTML
+//
 
 $ns = new e107table;
 $e107_var = array();
@@ -235,7 +360,7 @@
 				}
 				$replace[0] = str_replace(" ", "&nbsp;", $e107_vars[$act]['text']);
 				$replace[1] = $e107_vars[$act]['link'];
-				if ($e107_vars[$act]['include']!='') {
+				if (!empty($e107_vars[$act]['include'])) {
 					$replace[2] = $e107_vars[$act]['include'];
 				} else {
 					$replace[2] = $js ? "onclick=\"showhideit('".$act."');\"" : "onclick=\"document.location='".$e107_vars[$act]['link']."'; disabled=true;\"";
@@ -329,8 +454,10 @@
 	}
 }
 
+$sql->db_Mark_Time('Parse Admin Header');
 if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
 	parse_admin($ADMIN_HEADER);
 }
-
+$sql->db_Mark_Time('(End: Parse Admin Header)');
+}
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_admin/image.php 0.7.11.src/e107_admin/image.php
--- 0.7.7.src/e107_admin/image.php	2006-11-11 06:36:48.000000000 -0600
+++ 0.7.11.src/e107_admin/image.php	2007-12-07 13:52:47.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/image.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/11/11 12:36:48 $
-|     $Author: mrpete $
+|     $Revision: 1.19 $
+|     $Date: 2007/12/07 19:52:47 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -62,7 +62,7 @@
 			$row = $sql->db_Fetch();
 			extract($row);
 			$avname=avatar($user_image);
-			if (strpos($avname,"http://")===FALSE) 
+			if (strpos($avname,"http://")===FALSE)
 			{ // Internal file, so unlink it
 				@unlink($avname);
 			}
@@ -76,7 +76,7 @@
 if (isset($_POST['update_options'])) {
 	$pref['image_post'] = $_POST['image_post'];
 	$pref['resize_method'] = $_POST['resize_method'];
-	$pref['im_path'] = $tp->toDB($_POST['im_path']);
+	$pref['im_path'] = trim($tp->toDB($_POST['im_path']));
 	$pref['image_post_class'] = $_POST['image_post_class'];
 	$pref['image_post_disabled_method'] = $_POST['image_post_disabled_method'];
 	$pref['enable_png_image_fix'] = $_POST['enable_png_image_fix'];
@@ -180,7 +180,7 @@
 		<td class='forumheader3'>".$pref['im_height']."</td>
 		<td class='forumheader3'>".IMALAN_39."</td>
 		</tr>";
-	
+
 	//
 	// Loop through avatar field for every user
 	//
@@ -188,12 +188,12 @@
 	if ($sql->db_Select("user", "*", "user_image!=''")) {
 		while ($row = $sql->db_Fetch()) {
 			extract($row);
-	
+
 	//
 	// Check size
 	//
 			$avname=avatar($user_image);
-			if (strpos($avname,"http://")!==FALSE) 
+			if (strpos($avname,"http://")!==FALSE)
 			{
 				$iAVexternal++;
 				$bAVext=TRUE;
@@ -226,8 +226,8 @@
 					}
 				}
 			}
-	
-	// 
+
+	//
 	// If not found or too big, allow delete
 	//
 			if (strlen($sBadImage))
@@ -276,6 +276,34 @@
 	$ns->tablerender(IMALAN_37, $text);
 }
 
+if(function_exists('gd_info'))
+{
+	$gd_info = gd_info();
+	$gd_version = $gd_info['GD Version'];
+}
+else
+{
+	$gd_version = "<span style='color:red'> ".IMALAN_55."</span>";
+}
+
+$IM_NOTE = "";
+if($pref['im_path'] != "")
+{
+  $im_file = $pref['im_path'].'convert';
+	if(!file_exists($im_file))
+	{
+		$IM_NOTE = "<br /><span style='color:red'>".IMALAN_52."</span>";
+	}
+	else
+	{
+		$cmd = "{$im_file} -version";
+		$tmp = `$cmd`;
+		if(strpos($tmp, "ImageMagick") === FALSE)
+		{
+			$IM_NOTE = "<br /><span style='color:red'>".IMALAN_53."</span>";
+		}
+	}
+}
 
 $text = "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."'>
@@ -296,25 +324,7 @@
 	".IMALAN_10."<br />
 	<span class='smalltext'>".IMALAN_11."</span>
 	</td>
-	<td style='width:25%;text-align:center' class='forumheader3' >
-
-
-	<select class='tbox' name='image_post_class'>
-	<option value='".e_UC_PUBLIC."'".($pref['image_post_class'] == e_UC_PUBLIC ? " selected='selected'" : "").">".IMALAN_30."</option>
-	<option value='".e_UC_GUEST."'".($pref['image_post_class'] == e_UC_GUEST ? " selected='selected'" : "").">".IMALAN_31."</option>
-	<option value='".e_UC_MEMBER."'".($pref['image_post_class'] == e_UC_MEMBER ? " selected='selected'" : "").">".IMALAN_32."</option>
-	<option value='".e_UC_ADMIN."'".($pref['image_post_class'] == e_UC_ADMIN ? " selected='selected'" : "").">".IMALAN_33."</option>\n";
-
-
-if ($sql->db_Select("userclass_classes")) {
-	while ($row = $sql->db_Fetch()) {
-		extract($row);
-		$text .= "<option value='".$userclass_id."'".($pref['image_post_class'] == $userclass_id ? " selected='selected'" : "").">$userclass_name</option>\n";
-	}
-}
-$text .= "</select>
-
-	</td>
+	<td style='width:25%;text-align:center' class='forumheader3' >".r_userclass('image_post_class',$pref['image_post_class'],"off","public,guest,nobody,member,admin,main,classes")."</td>
 	</tr>
 
 	<tr>
@@ -328,7 +338,7 @@
 	</tr>
 
 	<tr>
-	<td style='width:75%' class='forumheader3'>".IMALAN_3."<br /><span class='smalltext'>".IMALAN_4."</span></td>
+	<td style='width:75%' class='forumheader3'>".IMALAN_3."<br /><span class='smalltext'>".IMALAN_4."</span><br />".IMALAN_54." {$gd_version}</td>
 	<td style='width:25%;text-align:center' class='forumheader3' >
 	<select name='resize_method' class='tbox'>". ($pref['resize_method'] == "gd1" ? "<option selected='selected'>gd1</option>" : "<option>gd1</option>"). ($pref['resize_method'] == "gd2" ? "<option selected='selected'>gd2</option>" : "<option>gd2</option>"). ($pref['resize_method'] == "ImageMagick" ? "<option selected='selected'>ImageMagick</option>" : "<option>ImageMagick</option>")."
 	</select>
@@ -339,6 +349,7 @@
 	<td style='width:75%' class='forumheader3'>".IMALAN_5."<br /><span class='smalltext'>".IMALAN_6."</span></td>
 	<td style='width:25%;text-align:center' class='forumheader3' >
 	<input class='tbox' type='text' name='im_path' size='40' value=\"".$pref['im_path']."\" maxlength='200' />
+	{$IM_NOTE}
 	</td></tr>
 
 	<tr>
diff -x .svn -ruN 0.7.7.src/e107_admin/includes/beginner.php 0.7.11.src/e107_admin/includes/beginner.php
--- 0.7.7.src/e107_admin/includes/beginner.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/includes/beginner.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/beginner.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.14 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -25,52 +25,65 @@
 	Header("Location:". e_ADMIN."admin.php");
 }
 
-$text = "<div style='text-align:center;vertical-align:middle'><br /><br />
+	$buts = "";
+	$text = "<div style='text-align:center;vertical-align:middle'><br /><br />
 	<table style='".ADMIN_WIDTH.";margin-top:auto;margin-bottom:auto' >";
 
- //	$newarray[28] = array(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", 2, E_16_PLUGMANAGER, E_32_PLUGMANAGER);
+ 	//	$newarray[28] = array(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", 2, E_16_PLUGMANAGER, E_32_PLUGMANAGER);
 
-  $selection = array(22,12,17,25,5,19,7,23,28,26);
- // $selection = array(21,11,17,24,5,19,7,27,28,25);
-	foreach($selection as $id){
-	$text .= render_links($newarray[$id][0],$newarray[$id][1],$newarray[$id][2],$newarray[$id][3],$newarray[$id][6],'beginner');
+  	$selection = array(22,12,17,25,5,19,7,23,28,26);
+ 	// $selection = array(21,11,17,24,5,19,7,27,28,25);
+	foreach($selection as $id)
+	{
+		$buts .= render_links($newarray[$id][0],$newarray[$id][1],$newarray[$id][2],$newarray[$id][3],$newarray[$id][6],'beginner');
+	}
+
+	$text .= $buts;
+	$text .= render_clean();
+	$text .= "\n</table><br /></div>";
+
+	$text .= "<div class='smalltext' style='text-align:center'>".ADLAN_144." <a href='".e_SELF."?mode=e_advanced' >".ADLAN_145."</a>&nbsp;&nbsp;</div>";
+
+	if($buts != '')
+	{
+		$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
 	}
 
-$text .= "\n</tr></table><br /></div>";
 
-$text .= "<div class='smalltext' style='text-align:center'>".ADLAN_144." <a href='".e_SELF."?mode=e_advanced' >".ADLAN_145."</a>&nbsp;&nbsp;</div>";
 
-$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
 
 
 
-$text = "<div style='text-align:center'>
+	$text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
 
-$text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_32_PLUGMANAGER, "classis");
+	$text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_32_PLUGMANAGER, "classis");
 
-if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) {
-	while ($row = $sql->db_Fetch()) {
-		extract($row);
-		include(e_PLUGIN.$plugin_path."/plugin.php");
-		if ($eplug_conffile) {
-			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs emotes_off");
-			$plugin_icon = $eplug_icon ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
-			$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
+	if ($sql->db_Select("plugin", "*", "plugin_installflag=1"))
+	{
+		while ($row = $sql->db_Fetch())
+		{
+			extract($row);
+			include(e_PLUGIN.$plugin_path."/plugin.php");
+			if ($eplug_conffile)
+			{
+				$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
+				$plugin_icon = $eplug_icon ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
+				$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
+			}
+			unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon);
 		}
-		unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon);
 	}
-}
 
-ksort($plugin_array, SORT_STRING);
-foreach ($plugin_array as $plug_key => $plug_value) {
-	$text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'classis');
-}
-
-$text .= render_clean();
+	ksort($plugin_array, SORT_STRING);
+	foreach ($plugin_array as $plug_key => $plug_value)
+	{
+		$text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'classis');
+	}
 
-$text .= "</table></div>";
+	$text .= render_clean();
+	$text .= "</table></div>";
 
-$ns->tablerender(ADLAN_CL_7, $text);
+	$ns->tablerender(ADLAN_CL_7, $text);
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_admin/includes/cascade.php 0.7.11.src/e107_admin/includes/cascade.php
--- 0.7.7.src/e107_admin/includes/cascade.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/includes/cascade.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/cascade.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.11 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -39,7 +39,7 @@
 		extract($row);
 		include(e_PLUGIN.$plugin_path."/plugin.php");
 		if ($eplug_conffile) {
-			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs emotes_off");
+			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
 			$plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN.$eplug_icon_small."' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN;
 			$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
 		}
diff -x .svn -ruN 0.7.7.src/e107_admin/includes/categories.php 0.7.11.src/e107_admin/includes/categories.php
--- 0.7.7.src/e107_admin/includes/categories.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/includes/categories.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/categories.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -49,7 +49,7 @@
 				extract($row);
 				include(e_PLUGIN.$plugin_path."/plugin.php");
 				if ($eplug_conffile) {
-					$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs emotes_off");
+					$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
 					$plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN.$eplug_icon_small."' alt='".$eplug_caption."' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN;
 					$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
 					//$text_rend = render_links(e_PLUGIN.$plugin_path."/".$eplug_conffile, $eplug_name, $eplug_caption, "P".$plugin_id, $plugin_icon, 'default');
diff -x .svn -ruN 0.7.7.src/e107_admin/includes/classis.php 0.7.11.src/e107_admin/includes/classis.php
--- 0.7.7.src/e107_admin/includes/classis.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/includes/classis.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,27 +11,29 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/classis.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "<div style='text-align:center'>
-	<table style='".ADMIN_WIDTH."'>";
+$buts = "";
 
-while (list($key, $funcinfo) = each($newarray)) {
-	$text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
+while (list($key, $funcinfo) = each($newarray))
+{
+	$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
+}
+if($buts != "")
+{
+    $text = "<div style='text-align:center'>
+			<table style='".ADMIN_WIDTH."'>";
+	$text .= $buts;
+ 	$text .= render_clean();
+ 	$text .= "</table></div>";
+	$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
 }
-
-$text .= render_clean();
-
-$text .= "</table></div>";
-
-$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
-
 $text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
 
@@ -42,7 +44,7 @@
 		extract($row);
 		include(e_PLUGIN.$plugin_path."/plugin.php");
 		if ($eplug_conffile) {
-			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs emotes_off");
+			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
 			$plugin_icon = $eplug_icon ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
 			$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
 		}
diff -x .svn -ruN 0.7.7.src/e107_admin/includes/combo.php 0.7.11.src/e107_admin/includes/combo.php
--- 0.7.7.src/e107_admin/includes/combo.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/includes/combo.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/combo.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,20 +21,20 @@
 
 $text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
-
+$buts = "";
 while (list($key, $funcinfo) = each($newarray)) {
-	$text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
+	$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
 }
-
+$text .= $buts;
 while ($td <= 5) {
-	$text_cat .= "<td class='td' style='width:20%;' ></td>";
+	$text .= "<td class='td' style='width:20%;' ></td>";
 	$td++;
 }
 $td = 1;
-
 $text .= "</tr></table></div>";
-
-$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
+if($buts != ""){
+	$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
+}
 
 $text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
@@ -46,7 +46,7 @@
 		extract($row);
 		include(e_PLUGIN.$plugin_path."/plugin.php");
 		if ($eplug_conffile) {
-			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs emotes_off");
+			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
 			$plugin_icon = $eplug_icon ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
 			$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
 		}
diff -x .svn -ruN 0.7.7.src/e107_admin/includes/compact.php 0.7.11.src/e107_admin/includes/compact.php
--- 0.7.7.src/e107_admin/includes/compact.php	2006-11-16 04:41:46.000000000 -0600
+++ 0.7.11.src/e107_admin/includes/compact.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,20 +11,21 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/compact.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/16 10:41:46 $
-|     $Author: e107coders $
+|     $Revision: 1.13 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
-
+$buts = "";
 $text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
 
 while (list($key, $funcinfo) = each($newarray)) {
-	$text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
+	$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
 }
+$text .= $buts;
 
 $text_cat = '';
 while ($td <= 5) {
@@ -35,8 +36,9 @@
 
 $text .= "</tr></table></div>";
 
-$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
-
+if($buts !=""){
+	$ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
+}
 
 $text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
@@ -48,7 +50,7 @@
 		extract($row);
 		include(e_PLUGIN.$plugin_path."/plugin.php");
 		if ($eplug_conffile) {
-			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs emotes_off");
+			$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
 			$plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN.$eplug_icon_small."' alt='' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN;
 			$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
 		}
diff -x .svn -ruN 0.7.7.src/e107_admin/lancheck.php 0.7.11.src/e107_admin/lancheck.php
--- 0.7.7.src/e107_admin/lancheck.php	2006-11-22 17:20:14.000000000 -0600
+++ 0.7.11.src/e107_admin/lancheck.php	2007-11-02 17:01:44.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     ©Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,24 +11,24 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/lancheck.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2006/11/22 23:20:14 $
-|     $Author: e107coders $
+|     $Revision: 1.27 $
+|     $Date: 2007/11/02 22:01:44 $
+|     $Author: e107steved $
 |	  With code from Izydor and Lolo.
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
 if (!getperms("0")) {
 	header("location:".e_BASE."index.php");
-	 exit;
+	exit;
 }
-	$e_sub_cat = 'language';
-	require_once("auth.php");
+$e_sub_cat = 'language';
+require_once("auth.php");
 
-	$qry = explode("|",e_QUERY);
-	$f = $qry[0];
-	$lan = $qry[1];
-	$mode = $qry[2];
+$qry = explode("|",e_QUERY);
+$f = $qry[0];
+$lan = $qry[1];
+$mode = $qry[2];
 
 // Write the language file.
 if(isset($_POST['submit']))
@@ -38,9 +38,9 @@
 	$kom_start = chr(47)."*";
 	$kom_end = "*".chr(47);
 
-    if($_POST['root'])
+	if($_POST['root'])
 	{
-    	$writeit = $_POST['root'];
+		$writeit = $_POST['root'];
 	}
 
 	$old_kom = "";
@@ -49,13 +49,13 @@
 	foreach($data as $line)
 	{
 
-    	if (strpos($line,$kom_start) !== False && $old_kom == "")
+		if (strpos($line,$kom_start) !== False && $old_kom == "")
 		{
-      		$in_kom=1;
-    	}
-    	if ($in_kom) { $old_kom.=$line; }
-    	if (strpos($line,$kom_end) !== False && $in_kom) {$in_kom = 0;}
-    }
+			$in_kom=1;
+		}
+		if ($in_kom) { $old_kom.=$line; }
+		if (strpos($line,$kom_end) !== False && $in_kom) {$in_kom = 0;}
+	}
 
 
 	$message = "<div style='text-align:left'><br />";
@@ -94,14 +94,14 @@
 
 		if (strpos($_POST['newdef'][$i],"ndef++") !== FALSE )
 		{
-      		$defvar = str_replace("ndef++","",$_POST['newdef'][$i]);
-      		$notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {";
-      		$notdef_end = "}\n";
+			$defvar = str_replace("ndef++","",$_POST['newdef'][$i]);
+			$notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {";
+			$notdef_end = "}\n";
 		}
-    	else
+		else
 		{
-      		$defvar = $_POST['newdef'][$i];
-    	}
+			$defvar = $_POST['newdef'][$i];
+		}
 
 		if($_POST['newdef'][$i] == "LC_ALL" && isset($_POST['root']))
 		{
@@ -112,7 +112,7 @@
 		{
 			$message .= $notdef_start.$func.'('.$quote.htmlentities($defvar).$quote.',"'.$deflang.'");<br />'.$notdef_end;
 			$input .= $notdef_start.$func."(".$quote.$defvar.$quote.", ".chr(34).$deflang.chr(34).");".$notdef_end;
-        }
+		}
 	}
 
 	$message .="<br />";
@@ -123,19 +123,19 @@
 	$fp = @fopen($writeit,"w");
 	if(!@fwrite($fp, $input))
 	{
-    	$caption = LAN_ERROR;
-    	$message = LAN_CHECK_17;
-  	}
+		$caption = LAN_ERROR;
+		$message = LAN_CHECK_17;
+	}
 	else
 	{
-    	$caption = LAN_SAVED." <b>$lan/".$writeit."</b>";
-  	}
+		$caption = LAN_SAVED." <b>$lan/".$writeit."</b>";
+	}
 	fclose($writeit);
 
 	$message .= "<form method='post' action='".e_SELF."' id='select_lang'>
-			<div style='text-align:center'><br />";
+	<div style='text-align:center'><br />";
 	$message .= "<br /><br /><input class='button' type='submit' name='language_sel' value=\"".LAN_BACK."\" />
-			<input type='hidden' name='language' value='$lan' /></div></form>";
+	<input type='hidden' name='language' value='$lan' /></div></form>";
 
 
 	$ns -> tablerender($caption, $message);
@@ -151,46 +151,46 @@
 
 	if (!$mode)
 	{
-    	$dir1 =  e_BASE.$LANGUAGES_DIRECTORY."English/";
-    	$f1=$f;
-    	$dir2 =  e_BASE.$LANGUAGES_DIRECTORY.$lan."/";
-    	$f2=$f;
+		$dir1 =  e_BASE.$LANGUAGES_DIRECTORY."English/";
+		$f1=$f;
+		$dir2 =  e_BASE.$LANGUAGES_DIRECTORY.$lan."/";
+		$f2=$f;
 	}
 	else
 	{
- 		$fullpath_orig = $f;
+		$fullpath_orig = $f;
 		$fullpath_trans = str_replace("English",$lan,$f);
 
-        $f1 = basename($fullpath_orig);
-	  	$f2 = basename($fullpath_trans);
-	  	$dir1 = dirname($fullpath_orig)."/";
-        $dir2 = dirname($fullpath_trans)."/";
-  	}
+		$f1 = basename($fullpath_orig);
+		$f2 = basename($fullpath_trans);
+		$dir1 = dirname($fullpath_orig)."/";
+		$dir2 = dirname($fullpath_trans)."/";
+	}
 
- 	edit_lanfiles($dir1,$dir2,$f1,$f2);
+	edit_lanfiles($dir1,$dir2,$f1,$f2);
 
 }
 
 // ===========================================================================
 
 $core_plugins = array(
-	"alt_auth","banner_menu","blogcalendar_menu","calendar_menu","chatbox_menu",
-	"clock_menu","comment_menu","compliance_menu","content","counter_menu",
-	"featurebox","forum","gsitemap","integrity_check","lastseen","links_page",
-	"linkwords","list_new","log","login_menu","newforumposts_main","newsfeed",
-	"newsletter","online_extended_menu","online_menu","other_news_menu","pdf",
-	"pm","poll","powered_by_menu","rss_menu","search_menu","sitebutton_menu",
-	"trackback","tree_menu","userlanguage_menu","usertheme_menu"
-	);
+"alt_auth","banner_menu","blogcalendar_menu","calendar_menu","chatbox_menu",
+"clock_menu","comment_menu","compliance_menu","content","counter_menu",
+"featurebox","forum","gsitemap","integrity_check","lastseen","links_page",
+"linkwords","list_new","log","login_menu","newforumposts_main","newsfeed",
+"newsletter","online_extended_menu","online_menu","other_news_menu","pdf",
+"pm","poll","powered_by_menu","rss_menu","search_menu","sitebutton_menu",
+"trackback","tree_menu","userlanguage_menu","usertheme_menu"
+);
 
 $core_themes = array("crahan","e107v4a","human_condition","interfectus","jayya",
-	"khatru","kubrick","lamb","leaf","reline","sebes","vekna_blue");
+"khatru","kubrick","lamb","leaf","reline","sebes","vekna_blue");
 
 
 if(isset($_POST['language_sel']) && isset($_POST['language'])){
 
-  	$ns -> tablerender(LAN_CHECK_3.": ".$_POST['language'],check_core_lanfiles($_POST['language']));
-  	$ns -> tablerender(LAN_CHECK_3.": ".$_POST['language']."/admin",check_core_lanfiles($_POST['language'],"admin/"));
+	$ns -> tablerender(LAN_CHECK_3.": ".$_POST['language'],check_core_lanfiles($_POST['language']));
+	$ns -> tablerender(LAN_CHECK_3.": ".$_POST['language']."/admin",check_core_lanfiles($_POST['language'],"admin/"));
 
 	$plug_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
 	<tr>
@@ -209,7 +209,7 @@
 	$plug_text .= "</table>";
 	$ns -> tablerender(ADLAN_CL_7,$plug_text);
 
-    $theme_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
+	$theme_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
 	<tr>
 	<td class='fcaption'>Theme</td>
 	<td class='fcaption'>".LAN_CHECK_16."</td>
@@ -244,66 +244,66 @@
 
 	$keys = array_keys($English);
 
- 	sort($keys);
+	sort($keys);
 
 	foreach($keys as $k)
 	{
 		if($k != "bom")
 		{
-    		$lnk = $k;
+			$lnk = $k;
 			$k_check = str_replace("English",$checklan,$k);
-    		if(array_key_exists($k,$check))
+			if(array_key_exists($k,$check))
 			{
-	 			$text .= "<tr><td class='forumheader3' style='width:45%'>{$lnk}</td>";
-      			$subkeys = array_keys($English[$k]);
+				$text .= "<tr><td class='forumheader3' style='width:45%'>{$lnk}</td>";
+				$subkeys = array_keys($English[$k]);
 
-      	   		$er="";
-                $utf_error = "";
+				$er="";
+				$utf_error = "";
 
 				$bomkey = str_replace(".php","",$k_check);
-       			$bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
+				$bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
 
-      			foreach($subkeys as $sk)
+				foreach($subkeys as $sk)
 				{
-                   	if($utf_error == "" && !is_utf8($check[$k][$sk]))
+					if($utf_error == "" && !is_utf8($check[$k][$sk]))
 					{
 						$utf_error = "<i>".LAN_CHECK_19."</i><br />";
 					}
 
 					if($sk == "LC_ALL"){
-                    	$check[$k][$sk] = str_replace(chr(34).chr(34),"",$check[$k][$sk]);
+						$check[$k][$sk] = str_replace(chr(34).chr(34),"",$check[$k][$sk]);
 					}
 
 					if((!array_key_exists($sk,$check[$k]) && $English[$k][$sk] != "") || (trim($check[$k][$sk]) == "" && $English[$k][$sk] != ""))
 					{
 
-          	   			$er .= ($er) ? "<br />" : "";
-          				$er .= $sk." ".LAN_CHECK_5;
-        			}
-      			}
+						$er .= ($er) ? "<br />" : "";
+						$er .= $sk." ".LAN_CHECK_5;
+					}
+				}
 
 				$style = ($er) ? "forumheader2" : "forumheader3";
-       			$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
+				$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
 				$text .= $bom_error . $utf_error;
 				$text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."<br />";
 				$text .= "</div></td>";
-    		}
+			}
 			else
 			{
-      			$text .= "<tr>
+				$text .= "<tr>
 				<td class='forumheader3' style='width:45%'>{$lnk}</td>
 				<td class='forumheader' style='width:50%'>".LAN_CHECK_4."</td>"; // file missing.
-    		}
-    		// Leave in EDIT button for all entries - to allow re-translation of bad entries.
-        	$subpath = ($subdir!='') ? $subdir.$k : $k;
-    		$text .="<td class='forumheader3' style='width:5%;text-align:center'>
-    		<input class='tbox' type='button' style='width:60px' name='but_$i' value=\"".LAN_EDIT."\" onclick=\"window.location='".e_SELF."?".$subpath."|".$_POST['language']."'\" /> ";
-    		$text .="</td></tr>";
+			}
+			// Leave in EDIT button for all entries - to allow re-translation of bad entries.
+			$subpath = ($subdir!='') ? $subdir.$k : $k;
+			$text .="<td class='forumheader3' style='width:5%;text-align:center'>
+			<input class='tbox' type='button' style='width:60px' name='but_$i' value=\"".LAN_EDIT."\" onclick=\"window.location='".e_SELF."?".$subpath."|".$_POST['language']."'\" /> ";
+			$text .="</td></tr>";
 		}
-  	}
+	}
 	$text .= "</table>";
 
- 	return $text;
+	return $text;
 }
 
 
@@ -315,8 +315,8 @@
 
 	if(is_file($fname))
 	{
-    	$data = file($fname);
-    	$ret=$ret + fill_phrases_array($data,$type);
+		$data = file($fname);
+		$ret=$ret + fill_phrases_array($data,$type);
 		if(substr($data[0],0,5) != "<?php")
 		{
 			$key = str_replace(".php","",$fname);
@@ -329,8 +329,8 @@
 
 	if(is_file($fname))
 	{
-    	$data = file($fname);
-    	$ret=$ret + fill_phrases_array($data,$type);
+		$data = file($fname);
+		$ret=$ret + fill_phrases_array($data,$type);
 		if(substr($data[0],0,5) != "<?php")
 		{
 			$key = str_replace(".php","",$fname);
@@ -343,43 +343,43 @@
 
 function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
 {
-    require_once(e_HANDLER."file_class.php");
-    $fl = new e_file;
+	require_once(e_HANDLER."file_class.php");
+	$fl = new e_file;
 	$ret = array();
 
-    if($lang_array = $fl->get_files($comp_dir, ".php","standard",$depth)){
-        sort($lang_array);
-    }
-
-   	$regexp = (strpos($comp_dir,e_LANGUAGEDIR) !== FALSE) ? "#.php#" : "#".$lang."#";
-
-    foreach($lang_array as $f)
-    {
-            if(preg_match($regexp,$f['path'].$f['fname']) && is_file($f['path'].$f['fname']))
+	if($lang_array = $fl->get_files($comp_dir, ".php","standard",$depth)){
+		sort($lang_array);
+	}
+
+	$regexp = (strpos($comp_dir,e_LANGUAGEDIR) !== FALSE) ? "#.php#" : "#".$lang."#";
+
+	foreach($lang_array as $f)
+	{
+		if(preg_match($regexp,$f['path'].$f['fname']) && is_file($f['path'].$f['fname']))
+		{
+			$data = file($f['path'].$f['fname']);
+			$relpath = str_replace($comp_dir,"",$f['path']);
+			if(substr($data[0],0,5) != "<?php")
 			{
-                $data = file($f['path'].$f['fname']);
-				$relpath = str_replace($comp_dir,"",$f['path']);
- 				if(substr($data[0],0,5) != "<?php")
-				{
-					$key = str_replace(".php","",$relpath.$f['fname']);
-					$ret['bom'][$key] = $f['fname'];
-				}
-				if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang.".php")
-				{
-					$f['fname'] = "English.php";  // change the key for the main language file.
-				}
+				$key = str_replace(".php","",$relpath.$f['fname']);
+				$ret['bom'][$key] = $f['fname'];
+			}
+			if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang.".php")
+			{
+				$f['fname'] = "English.php";  // change the key for the main language file.
+			}
 
-				if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang."_custom.php")
-				{
-					$f['fname'] = "English_custom.php";  // change the key for the main language file.
-				}
+			if($f['path'].$f['fname'] == e_LANGUAGEDIR.$lang."/".$lang."_custom.php")
+			{
+				$f['fname'] = "English_custom.php";  // change the key for the main language file.
+			}
 
-                $ret=$ret + fill_phrases_array($data,$relpath.$f['fname']);
+			$ret=$ret + fill_phrases_array($data,$relpath.$f['fname']);
 
-            }
-    }
+		}
+	}
 
-    return $ret;
+	return $ret;
 
 }
 
@@ -387,98 +387,98 @@
 function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan){
 	global $ns,$sql;
 
-    $folder['P'] = e_PLUGIN.$comp_name;
+	$folder['P'] = e_PLUGIN.$comp_name;
 	$folder['T'] = e_THEME.$comp_name;
 	$comp_dir = $folder[$mode];
 
-   	$baselang = get_comp_lan_phrases($comp_dir."/languages/","English",1);
-   	$check = get_comp_lan_phrases($comp_dir."/languages/",$target_lan,1);
+	$baselang = get_comp_lan_phrases($comp_dir."/languages/","English",1);
+	$check = get_comp_lan_phrases($comp_dir."/languages/",$target_lan,1);
 
 	$text = "";
 	$keys = array_keys($baselang);
 	sort($keys);
 
 	foreach($keys as $k)
-		{
-      		$lnk = $k;
-      		//echo "klucz ".$k."<br />";
-      		$k_check = str_replace("English",$target_lan,$k);
-      		if(array_key_exists($k_check,$check))
-			{
-        		$text .= "<tr>
-				<td class='forumheader3' style='width:20%'>".$comp_name."</td>
-				<td class='forumheader3' style='width:25%'>".str_replace("English/","",$lnk)."</td>";
-
-				$subkeys = array_keys($baselang[$k]);
-        		$er="";
-                $utf_error = "";
+	{
+		$lnk = $k;
+		//echo "klucz ".$k."<br />";
+		$k_check = str_replace("English",$target_lan,$k);
+		if(array_key_exists($k_check,$check))
+		{
+			$text .= "<tr>
+			<td class='forumheader3' style='width:20%'>".$comp_name."</td>
+			<td class='forumheader3' style='width:25%'>".str_replace("English/","",$lnk)."</td>";
+
+			$subkeys = array_keys($baselang[$k]);
+			$er="";
+			$utf_error = "";
 
-				$bomkey = str_replace(".php","",$k_check);
-       			$bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
+			$bomkey = str_replace(".php","",$k_check);
+			$bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
 
-        		foreach($subkeys as $sk)
+			foreach($subkeys as $sk)
+			{
+				if($utf_error == "" && !is_utf8($check[$k_check][$sk]))
 				{
-                   	if($utf_error == "" && !is_utf8($check[$k_check][$sk]))
-					{
-						$utf_error = "<i>".LAN_CHECK_19."</i><br />";
-					}
-
-          			if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != ""))
-					{
-            			$er .= ($er) ? "<br />" : "";
-            			$er .= $sk." ".LAN_CHECK_5;
-          			}
-        		}
+					$utf_error = "<i>".LAN_CHECK_19."</i><br />";
+				}
 
-				$style = ($er) ? "forumheader2" : "forumheader3";
-       			$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
-				$text .= $bom_error . $utf_error;
-         		$text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."<br />";
-				$text .= "</div></td>";
-      		}
-			else
-			{
-        		$text .= "<tr>
-				<td class='forumheader3' style='width:20%'>".$comp_name."</td>
-				<td class='forumheader3' style='width:25%'>".str_replace("English/","",$lnk)."</td>
-				<td class='forumheader' style='width:50%'><span style='cursor:pointer' title=\"".str_replace("English",$target_lan,$lnk)."\">".LAN_CHECK_4."</span></td>";
-      		}
+				if(!array_key_exists($sk,$check[$k_check]) || (trim($check[$k_check][$sk]) == "" && $baselang[$k][$sk] != ""))
+				{
+					$er .= ($er) ? "<br />" : "";
+					$er .= $sk." ".LAN_CHECK_5;
+				}
+			}
 
-      		$text .="<td class='forumheader3' style='width:5%;text-align:center'>
-      		<input class='tbox' type='button' style='width:60px' name='but_$i' value=\"".LAN_EDIT."\" onclick=\"window.location='".e_SELF."?".$comp_dir."/languages/".$lnk."|".$target_lan."|file'\" /> ";
-      		$text .="</td></tr>";
+			$style = ($er) ? "forumheader2" : "forumheader3";
+			$text .= "<td class='{$style}' style='width:50%'><div class='smalltext'>";
+			$text .= $bom_error . $utf_error;
+			$text .= (!$er && !$bom_error && !$utf_error) ? LAN_OK : $er."<br />";
+			$text .= "</div></td>";
+		}
+		else
+		{
+			$text .= "<tr>
+			<td class='forumheader3' style='width:20%'>".$comp_name."</td>
+			<td class='forumheader3' style='width:25%'>".str_replace("English/","",$lnk)."</td>
+			<td class='forumheader' style='width:50%'><span style='cursor:pointer' title=\"".str_replace("English",$target_lan,$lnk)."\">".LAN_CHECK_4."</span></td>";
 		}
 
+		$text .="<td class='forumheader3' style='width:5%;text-align:center'>
+		<input class='tbox' type='button' style='width:60px' name='but_$i' value=\"".LAN_EDIT."\" onclick=\"window.location='".e_SELF."?".$comp_dir."/languages/".$lnk."|".$target_lan."|file'\" /> ";
+		$text .="</td></tr>";
+	}
+
 
 
-  // if (!$known) {$text = LAN_CHECK_18." : --> ".$fname." :: ".$dname;}
-  return $text;
+	// if (!$known) {$text = LAN_CHECK_18." : --> ".$fname." :: ".$dname;}
+	return $text;
 }
 
 function edit_lanfiles($dir1,$dir2,$f1,$f2){
-  global $ns,$sql,$lan;
+	global $ns,$sql,$lan;
 
-/*    echo "<br />dir1 = $dir1";
-    echo "<br />file1 = $f1";
+	/*    echo "<br />dir1 = $dir1";
+	echo "<br />file1 = $f1";
 
-    echo "<br />dir2 = $dir2";
-    echo "<br />file2 = $f2";*/
+	echo "<br />dir2 = $dir2";
+	echo "<br />file2 = $f2";*/
 
-    if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file.
+	if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file.
 	{
-        $f2 = $lan.".php";
-        $root_file = e_LANGUAGEDIR.$lan."/".$lan.".php";
-    }
+		$f2 = $lan.".php";
+		$root_file = e_LANGUAGEDIR.$lan."/".$lan.".php";
+	}
 	else
 	{
-        $root_file = $dir2.$f2;
+		$root_file = $dir2.$f2;
 	}
 
-    if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file.
+	if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file.
 	{
-        $f2 = $lan."_custom.php";
-        $root_file = e_LANGUAGEDIR.$lan."/".$lan."_custom.php";
-    }
+		$f2 = $lan."_custom.php";
+		$root_file = e_LANGUAGEDIR.$lan."/".$lan."_custom.php";
+	}
 
 
 	$writable = (is_writable($dir2)) ? TRUE : FALSE;
@@ -493,31 +493,31 @@
 	$subkeys = array_keys($trans['orig']);
 	foreach($subkeys as $sk)
 	{
-    	$rowamount = round(strlen($trans['orig'][$sk])/34)+1;
-    	$hglt1=""; $hglt2="";
-    	if ($trans['tran'][$sk] == "" && $trans['orig'][$sk]!="") {
+		$rowamount = round(strlen($trans['orig'][$sk])/34)+1;
+		$hglt1=""; $hglt2="";
+		if ($trans['tran'][$sk] == "" && $trans['orig'][$sk]!="") {
 			$hglt1="<span style='font-style:italic;font-weight:bold;color:red'>";
 			$hglt2="</span>";
 		}
-    	$text .="<tr>
-    	<td class='forumheader3' style='width:10%;vertical-align:top'>".$hglt1.htmlentities($sk).$hglt2."</td>
-    	<td class='forumheader3' style='width:40%;vertical-align:top'>".htmlentities(str_replace("ndef++","",$trans['orig'][$sk])) ."</td>";
-    	$text .= "<td class='forumheader3' style='width:50%;vertical-align:top'>";
-    	$text .= ($writable) ? "<textarea  class='tbox' name='newlang[]' rows='$rowamount' cols='45' style='height:100%'>" : "";
+		$text .="<tr>
+		<td class='forumheader3' style='width:10%;vertical-align:top'>".$hglt1.htmlentities($sk).$hglt2."</td>
+		<td class='forumheader3' style='width:40%;vertical-align:top'>".htmlentities(str_replace("ndef++","",$trans['orig'][$sk])) ."</td>";
+		$text .= "<td class='forumheader3' style='width:50%;vertical-align:top'>";
+		$text .= ($writable) ? "<textarea  class='tbox' name='newlang[]' rows='$rowamount' cols='45' style='height:100%'>" : "";
 		$text .= str_replace("ndef++","",$trans['tran'][$sk]);
 		$text .= ($writable) ? "</textarea>" : "";
-    	//echo "orig --> ".$trans['orig'][$sk]."<br />";
-    	if (strpos($trans['orig'][$sk],"ndef++") !== False)
+		//echo "orig --> ".$trans['orig'][$sk]."<br />";
+		if (strpos($trans['orig'][$sk],"ndef++") !== False)
 		{
-      		//echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."<br />";
-      		$text .= "<input type='hidden' name='newdef[]' value='ndef++".$sk."' />";
-    	}
-    	else
+			//echo "+orig --> ".$trans['orig'][$sk]." <> ".strpos($trans['orig'][$sk],"ndef++")."<br />";
+			$text .= "<input type='hidden' name='newdef[]' value='ndef++".$sk."' />";
+		}
+		else
 		{
 			$text .= "<input type='hidden' name='newdef[]' value='".$sk."' />";
 		}
 		$text .="</td></tr>";
-  	}
+	}
 
 	//Check if directory is writable
 	if($writable)
@@ -528,11 +528,11 @@
 
 		if($root_file)
 		{
-    		$text .= "<input type='hidden' name='root' value='".$root_file."' />";
+			$text .= "<input type='hidden' name='root' value='".$root_file."' />";
 		}
 
 		$text .= "</td></tr>";
-    }
+	}
 
 	$text .= "
 	</table>
@@ -540,10 +540,10 @@
 	</div>";
 
 	$text .= "<form method='post' action='".e_SELF."' id='select_lang'>
-			<div style='text-align:center'><br />";
+	<div style='text-align:center'><br />";
 	$text .= (!$writable) ? "<br />".$dir2.$f2.LAN_NOTWRITABLE : "";
 	$text .= "<br /><br /><input class='button' type='submit' name='language_sel' value=\"".LAN_BACK."\" />
-			<input type='hidden' name='language' value='$lan' /></div></form>";
+	<input type='hidden' name='language' value='$lan' /></div></form>";
 
 
 	$caption = LAN_CHECK_3." <b>".$dir2.$f2."</b> -> <b>".$lan."</b>";
@@ -558,19 +558,19 @@
 	$retloc = array();
 
 	foreach($data as $line){
-        //echo "line--> ".$line."<br />";
+		//echo "line--> ".$line."<br />";
 		if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE)
 		{
 			$indef=1;
 			$bigline="";
 			// echo "big1 -->".$line."<br />";
 		}
-        if ($indef)
+		if ($indef)
 		{
 			$bigline.=str_replace("\n","",$line);
 			// echo "big2 -->".$line."<br />";
 		}
-        if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE)
+		if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE)
 		{
 			$indef=0;
 			$we_have_bigline=1;
@@ -583,7 +583,7 @@
 			$we_have_bigline=0;
 		}
 
-        if ((strpos($line,"define(") !== FALSE && strpos($line,");") !== FALSE && substr(ltrim($line),0,2) != "//") || $we_have_bigline || strpos($line,"setlocale(") !== FALSE)
+		if ((strpos($line,"define(") !== FALSE && strpos($line,");") !== FALSE && substr(ltrim($line),0,2) != "//") || $we_have_bigline || strpos($line,"setlocale(") !== FALSE)
 		{
 
 			if ($we_have_bigline)
@@ -596,8 +596,8 @@
 			//echo "_ndefline -->".$line."<br />";
 			if (strpos($line,"defined(") !== FALSE )
 			{
-            	$ndef = "ndef++";
-            	$line = substr($line,strpos($line,"define("));
+				$ndef = "ndef++";
+				$line = substr($line,strpos($line,"define("));
 			}
 
 			if(strpos($line,"setlocale(") !== FALSE)
@@ -611,42 +611,40 @@
 			else
 			{
 
-            //echo "ndefline: ".$line."<br />";
-          		if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$matches) ||
-             	preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$matches) ||
-             	preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$matches) ||
-             	preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$matches) ||
-             	preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$matches) ||
-             	preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$matches)){
-            	//echo "get_lan -->".$matches[1]." :: ".$ndef.$matches[2]."<br />";
-            	$retloc[$type][$matches[1]]= $ndef.$matches[2];
-            	}
+				//echo "ndefline: ".$line."<br />";
+				if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$matches) ||
+				preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$matches) ||
+				preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$matches) ||
+				preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$matches) ||
+				preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$matches) ||
+				preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$matches))
+				{
+					//echo "get_lan -->".$matches[1]." :: ".$ndef.$matches[2]."<br />";
+					if(!isset($retloc[$type][$matches[1]]))
+					{
+						$retloc[$type][$matches[1]]= $ndef.$matches[2];
+					}
+				}
 			}
-         }
-      }
+		}
+	}
 
-      return $retloc;
-    }
+	return $retloc;
+}
+
+//--------------------------------------------------------------------
 
 
-function is_utf8($string) {
-   // From http://w3.org/International/questions/qa-forms-utf-8.html
-	if(strtolower(CHARSET) != "utf-8" || $string == "")
+function is_utf8($str) {
+	/*
+	* @see http://hsivonen.iki.fi/php-utf8/   validation.php
+	*/
+	if(strtolower(CHARSET) != "utf-8" || $str == "")
 	{
 		return TRUE;
 	}
 
-    return preg_match('%^(?:
-         [\x09\x0A\x0D\x20-\x7E]
-       | [\xC2-\xDF][\x80-\xBF]
-       |  \xE0[\xA0-\xBF][\x80-\xBF]
-       | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}
-       |  \xED[\x80-\x9F][\x80-\xBF]
-       |  \xF0[\x90-\xBF][\x80-\xBF]{2}
-       | [\xF1-\xF3][\x80-\xBF]{3}
-       |  \xF4[\x80-\x8F][\x80-\xBF]{2}
-	)*$%xs', $string);
-
+	return (preg_match('/^.{1}/us',$str,$ar) == 1);
 }
 
 
@@ -660,7 +658,7 @@
 	}
 
 	if($action == "modify"){
-    	$action = "db";
+		$action = "db";
 	}
 	$var['main']['text'] = LAN_PREFS;
 	$var['main']['link'] = e_ADMIN."language.php";
@@ -676,5 +674,3 @@
 
 	show_admin_menu(ADLAN_132, $action, $var);
 }
-
-?>
diff -x .svn -ruN 0.7.7.src/e107_admin/language.php 0.7.11.src/e107_admin/language.php
--- 0.7.7.src/e107_admin/language.php	2006-11-06 04:46:23.000000000 -0600
+++ 0.7.11.src/e107_admin/language.php	2007-09-20 16:36:44.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/language.php,v $
-|     $Revision: 1.37 $
-|     $Date: 2006/11/06 10:46:23 $
+|     $Revision: 1.40 $
+|     $Date: 2007/09/20 21:36:44 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
 if (!getperms("ML"))
 {
-	header("location:".e_BASE."index.php");
-	exit;
+    header("location:".e_BASE."index.php");
+    exit;
 }
 
 $e_sub_cat = 'language';
@@ -34,26 +34,21 @@
 $message = "";
 
 if (e_QUERY) {
-	$tmp = explode('.', e_QUERY);
-	$action = $tmp[0];
-	$sub_action = $tmp[1];
-	$id = $tmp[2];
-	unset($tmp);
+    $tmp = explode('.', e_QUERY);
+    $action = $tmp[0];
+    $sub_action = $tmp[1];
+    $id = $tmp[2];
+    unset($tmp);
 }
 
 if (isset($_POST['submit_prefs']) && isset($_POST['mainsitelanguage'])) {
 
-	$pref['multilanguage']	= $_POST['multilanguage'];
-	if($_POST['multilanguage_subdomain']){
-    	$pref['multilanguage_subdomain'] = ".".$_POST['multilanguage_subdomain'];
-	}else{
-    	$pref['multilanguage_subdomain'] = "";
-	}
+    $pref['multilanguage']  = $_POST['multilanguage'];
+    $pref['multilanguage_subdomain'] = $_POST['multilanguage_subdomain'];
+    $pref['sitelanguage'] = $_POST['mainsitelanguage'];
 
-	$pref['sitelanguage'] = $_POST['mainsitelanguage'];
-
-	save_prefs();
-	$ns->tablerender(LAN_SAVED, "<div style='text-align:center'>".LAN_SETSAVED."</div>");
+    save_prefs();
+    $ns->tablerender(LAN_SAVED, "<div style='text-align:center'>".LAN_SETSAVED."</div>");
 
 }
 
@@ -61,17 +56,17 @@
 // ----------------- delete tables ---------------------------------------------
 if (isset($_POST['del_existing']) && $_POST['lang_choices']) {
 
-	$lang = strtolower($_POST['lang_choices']);
-	foreach ($tabs as $del_table) {
-		if (db_Table_exists($lang."_".$del_table)) {
-			$qry = "DROP TABLE ".$mySQLprefix."lan_".$lang."_".$del_table;
-		echo $qry;
-			$message .= (mysql_query($qry)) ? $_POST['lang_choices']." ".$del_table." deleted<br />" :
-			 $_POST['lang_choices']." $del_table couldn't be deleted<br />";
-		}
-	}
-	global $cachevar;
-	unset($cachevar['table_list']);
+    $lang = strtolower($_POST['lang_choices']);
+    foreach ($tabs as $del_table) {
+        if (db_Table_exists($lang."_".$del_table)) {
+            $qry = "DROP TABLE ".$mySQLprefix."lan_".$lang."_".$del_table;
+        echo $qry;
+            $message .= (mysql_query($qry)) ? $_POST['lang_choices']." ".$del_table." deleted<br />" :
+             $_POST['lang_choices']." $del_table couldn't be deleted<br />";
+        }
+    }
+    global $cachevar;
+    unset($cachevar['table_list']);
 
 }
 
@@ -79,38 +74,38 @@
 
 if (isset($_POST['create_tables']) && $_POST['language']) {
 
-	$table_to_copy = array();
-	$lang_to_create = array();
+    $table_to_copy = array();
+    $lang_to_create = array();
 
 
-	foreach ($tabs as $value) {
-		$lang = strtolower($_POST['language']);
-		if (isset($_POST[$value])) {
+    foreach ($tabs as $value) {
+        $lang = strtolower($_POST['language']);
+        if (isset($_POST[$value])) {
             $copdata = ($_POST['copydata_'.$value]) ? 1 : 0;
-			if (copy_table($value, "lan_".$lang."_".$value, $_POST['drop'],$copdata)) {
-				$message .= " ".$_POST['language']." ".$value." created<br />";
-			} else {
-				$message .= (!$_POST['drop'])? " ".$_POST['language']." ".$value." ".LANG_LAN_00."<br />" : $_POST['language']." ".$value." ".LANG_LAN_01."<br />";
-			}
-		} elseif(db_Table_exists($lang."_".$value)) {
-			if ($_POST['remove']) {
-				// Remove table.
-				$message .= (mysql_query("DROP TABLE ".$mySQLprefix."lan_".$lang."_".$value)) ? $_POST['language']." ".$value." ".LAN_DELETED."<br />" :  $_POST['language']." $value ".LANG_LAN_02."<br />";
-			} else {
-				// leave table.
-				$message = $_POST['language']." ".$value." was disabled but left intact.";
-			}
-		}
-	}
+            if (copy_table($value, "lan_".$lang."_".$value, $_POST['drop'],$copdata)) {
+                $message .= " ".$_POST['language']." ".$value." created<br />";
+            } else {
+                $message .= (!$_POST['drop'])? " ".$_POST['language']." ".$value." ".LANG_LAN_00."<br />" : $_POST['language']." ".$value." ".LANG_LAN_01."<br />";
+            }
+        } elseif(db_Table_exists($lang."_".$value)) {
+            if ($_POST['remove']) {
+                // Remove table.
+                $message .= (mysql_query("DROP TABLE ".$mySQLprefix."lan_".$lang."_".$value)) ? $_POST['language']." ".$value." ".LAN_DELETED."<br />" :  $_POST['language']." $value ".LANG_LAN_02."<br />";
+            } else {
+                // leave table.
+                $message = $_POST['language']." ".$value." was disabled but left intact.";
+            }
+        }
+    }
     global $cachevar;
-	unset($cachevar['table_list']);
+    unset($cachevar['table_list']);
 }
 
 
 
-	if(isset($message) && $message){
-  		$ns->tablerender(LAN_OK, $message);
-	}
+    if(isset($message) && $message){
+        $ns->tablerender(LAN_OK, $message);
+    }
 
 
 
@@ -118,15 +113,15 @@
 
 
 if (!e_QUERY || $action == 'main' && !$_POST['language'] && !$_POST['edit_existing']) {
-	multilang_prefs();
+    multilang_prefs();
 }
 
 if ($action == 'db') {
-	multilang_db();
+    multilang_db();
 }
 
 if($action == "tools"){
-	show_tools();
+    show_tools();
 }
 
 
@@ -136,262 +131,262 @@
 // Grab Language configuration. ---
 if ($_POST['edit_existing']) {
 
-	$text .= "
-	<form method='post' action='".e_SELF."?db' >
-	<div style='text-align:center'>
-	<table class='fborder' style='".ADMIN_WIDTH."'>\n";
-
-	foreach ($tabs as $table_name) {
-		$installed = strtolower($_POST['lang_choices'])."_".$table_name;
-		if (stristr($_POST['lang_choices'], $installed) === FALSE) {
-			$text .= "<tr>
-				<td style='width:30%' class='forumheader3'>".ucfirst(str_replace("_", " ", $table_name))."</td>\n
-				<td style='width:70%' class='forumheader3'>\n";
-			$selected = (db_Table_exists($installed)) ? "checked='checked'" : "";
-			$text .= "<input type=\"checkbox\" id='$table_name' name=\"$table_name\" value=\"1\" $selected onclick=\"if(document.getElementById('$table_name').checked){document.getElementById('datacopy_$table_name').style.display = '';} \"  />";
-			$text .= "<span id='datacopy_$table_name' style='display:none'>".LANG_LAN_15."<input type=\"checkbox\" name=\"copydata_$table_name\" value=\"1\" /> </span>";
-			$text .= "</td></tr>\n";
-		}
-	}
-
-	$text .= "
-	<tr><td class='forumheader3' colspan='2'>&nbsp;
-	<input type='hidden' name='language' value='".$_POST['lang_choices']."' />
-	</td></tr>";
-
-	// ===========================================================================
-
-	// Drop tables ?
-	$text .= "<tr><td class='forumheader3'><b>".LANG_LAN_07."</b></td>
-		<td class='forumheader3'>".$rs->form_checkbox("drop", 1)."\n
-		<span class=\"smalltext\" >".LANG_LAN_08."</span></td></tr>\n
-
-		<tr>
-			<td class='forumheader3'><b>".LANG_LAN_10."</b></td>
-			<td class='forumheader3'>".$rs->form_checkbox("remove", 1)."\n
-	   		<span class=\"smalltext\" >".LANG_LAN_11."</span></td>
-		</tr>
-
-		<tr>
-			<td colspan='2' style='width:100%; text-align: center;' class='forumheader' >";
-
-			$button_capt = LANG_LAN_06. " / ". LAN_UPDATE;
-			$text .="<input type='submit' class='button' name='create_tables' value=\"".$button_capt."\" />";
+    $text .= "
+    <form method='post' action='".e_SELF."?db' >
+    <div style='text-align:center'>
+    <table class='fborder' style='".ADMIN_WIDTH."'>\n";
+
+    foreach ($tabs as $table_name) {
+        $installed = strtolower($_POST['lang_choices'])."_".$table_name;
+        if (stristr($_POST['lang_choices'], $installed) === FALSE) {
+            $text .= "<tr>
+                <td style='width:30%' class='forumheader3'>".ucfirst(str_replace("_", " ", $table_name))."</td>\n
+                <td style='width:70%' class='forumheader3'>\n";
+            $selected = (db_Table_exists($installed)) ? "checked='checked'" : "";
+            $text .= "<input type=\"checkbox\" id='$table_name' name=\"$table_name\" value=\"1\" $selected onclick=\"if(document.getElementById('$table_name').checked){document.getElementById('datacopy_$table_name').style.display = '';} \"  />";
+            $text .= "<span id='datacopy_$table_name' style='display:none'>".LANG_LAN_15."<input type=\"checkbox\" name=\"copydata_$table_name\" value=\"1\" /> </span>";
+            $text .= "</td></tr>\n";
+        }
+    }
+
+    $text .= "
+    <tr><td class='forumheader3' colspan='2'>&nbsp;
+    <input type='hidden' name='language' value='".$_POST['lang_choices']."' />
+    </td></tr>";
 
-	   $text .="</td>
-		</tr>
+    // ===========================================================================
 
-	</table></div>\n";
+    // Drop tables ?
+    $text .= "<tr><td class='forumheader3'><b>".LANG_LAN_07."</b></td>
+        <td class='forumheader3'>".$rs->form_checkbox("drop", 1)."\n
+        <span class=\"smalltext\" >".LANG_LAN_08."</span></td></tr>\n
 
-	$text .= $rs->form_close();
-	$ns->tablerender($_POST['lang_choices'], $text);
+        <tr>
+            <td class='forumheader3'><b>".LANG_LAN_10."</b></td>
+            <td class='forumheader3'>".$rs->form_checkbox("remove", 1)."\n
+            <span class=\"smalltext\" >".LANG_LAN_11."</span></td>
+        </tr>
+
+        <tr>
+            <td colspan='2' style='width:100%; text-align: center;' class='forumheader' >";
+
+            $button_capt = LANG_LAN_06. " / ". LAN_UPDATE;
+            $text .="<input type='submit' class='button' name='create_tables' value=\"".$button_capt."\" />";
+
+       $text .="</td>
+        </tr>
+
+    </table></div>\n";
+
+    $text .= $rs->form_close();
+    $ns->tablerender($_POST['lang_choices'], $text);
 }
 
 require_once(e_ADMIN."footer.php");
 
 // ---------------------------------------------------------------------------
 function multilang_prefs() {
-	global $ns, $pref,$lanlist;
+    global $ns, $pref,$lanlist;
 
-	$text = "<div style='text-align:center'>
-		<form method='post' action='".e_SELF."' id='linkform'>
-		<table style='".ADMIN_WIDTH."' class='fborder'>";
-
-
-	$text .= "<tr>
-
-		<td style='width:80%' class='forumheader3'>".LANG_LAN_14.": </td>
-		<td style='width:20%; text-align:center' class='forumheader3'>";
-
-
-	$text .= "
-		<select name='mainsitelanguage' class='tbox'>\n";
-		$sellan = preg_replace("/lan_*.php/i", "", $pref['sitelanguage']);
-		foreach($lanlist as $lan){
-			$sel =  ($lan == $sellan) ? "selected='selected'" : "";
-    		$text .= "<option value='{$lan}' {$sel}>".$lan."</option>\n";
-		}
-
-	$text .= "</select>
-		</td>
-		</tr>";
-
-	$text .= "
-		<tr>
-		<td style='width:80%' class='forumheader3'>".LANG_LAN_12.": </td>
-		<td style='width:20%;text-align:center' class='forumheader3'>";
-	$checked = ($pref['multilanguage'] == 1) ? "checked='checked'" : "";
-	$text .= "<input type='checkbox' name='multilanguage'   value='1' $checked />
-		</td>
-		</tr>
-		";
-
-	$text .= "
-	<tr>
-	<td style='width:80%' class='forumheader3'>".LANG_LAN_18."<br />
-	<span class='smalltext'>".LANG_LAN_19."<br />".LANG_LAN_20."</span></td>
-	<td style='width:20%;text-align:center' class='forumheader3'>www.";
-	$text .= "<input class='tbox' type='text' name='multilanguage_subdomain'   value=\"".substr($pref['multilanguage_subdomain'],1)."\" />
-	</td>
-	</tr>
-	";
-
-
-	$text .= "<tr style='vertical-align:top'>
-		<td colspan='2' style='text-align:center' class='forumheader'>";
-	$text .= "<input class='button' type='submit' name='submit_prefs' value='".LAN_SAVE."' />";
-	$text .= "</td>
-		</tr>
-		</table>
-		</form>
-		</div>";
+    $text = "<div style='text-align:center'>
+        <form method='post' action='".e_SELF."' id='linkform'>
+        <table style='".ADMIN_WIDTH."' class='fborder'>";
+
+
+    $text .= "<tr>
+
+        <td style='width:80%' class='forumheader3'>".LANG_LAN_14.": </td>
+        <td style='width:20%; text-align:center' class='forumheader3'>";
+
+
+    $text .= "
+        <select name='mainsitelanguage' class='tbox'>\n";
+        $sellan = preg_replace("/lan_*.php/i", "", $pref['sitelanguage']);
+        foreach($lanlist as $lan){
+            $sel =  ($lan == $sellan) ? "selected='selected'" : "";
+            $text .= "<option value='{$lan}' {$sel}>".$lan."</option>\n";
+        }
+
+    $text .= "</select>
+        </td>
+        </tr>";
+
+    $text .= "
+        <tr>
+        <td style='width:80%' class='forumheader3'>".LANG_LAN_12.": </td>
+        <td style='width:20%;text-align:center' class='forumheader3'>";
+    $checked = ($pref['multilanguage'] == 1) ? "checked='checked'" : "";
+    $text .= "<input type='checkbox' name='multilanguage'   value='1' $checked />
+        </td>
+        </tr>
+        ";
+
+    $text .= "
+    <tr>
+    <td style='width:80%' class='forumheader3'>".LANG_LAN_18."<br />
+    <span class='smalltext'>".LANG_LAN_19."<br />".LANG_LAN_20."</span></td>
+    <td style='width:20%;text-align:center' class='forumheader3'>";
+    $text .= "<textarea name='multilanguage_subdomain' rows='5' cols='15' style='width:80%'>".$pref['multilanguage_subdomain']."</textarea>
+    </td>
+    </tr>
+    ";
+
+
+    $text .= "<tr style='vertical-align:top'>
+        <td colspan='2' style='text-align:center' class='forumheader'>";
+    $text .= "<input class='button' type='submit' name='submit_prefs' value='".LAN_SAVE."' />";
+    $text .= "</td>
+        </tr>
+        </table>
+        </form>
+        </div>";
 
-	$caption = LANG_LAN_13; // "Language Preferences";
-	$ns->tablerender($caption, $text);
+    $caption = LANG_LAN_13; // "Language Preferences";
+    $ns->tablerender($caption, $text);
 }
 
 // ----------------------------------------------------------------------------
 
 function db_Table_exists($table)
 {
-	global $mySQLdefaultdb;
-	$tables = getcachedvars("table_list");
-	if(!$tables)
-	{
-		$tablist = mysql_list_tables($mySQLdefaultdb);
-		while($tmp = mysql_fetch_array($tablist))
-		{
-			$tables[] = $tmp[0];
-		}
-		cachevars("table_list", $tables);
-	}
-	return in_array(strtolower(MPREFIX."lan_".$table), $tables);
+    global $mySQLdefaultdb;
+    $tables = getcachedvars("table_list");
+    if(!$tables)
+    {
+        $tablist = mysql_list_tables($mySQLdefaultdb);
+        while($tmp = mysql_fetch_array($tablist))
+        {
+            $tables[] = $tmp[0];
+        }
+        cachevars("table_list", $tables);
+    }
+    return in_array(strtolower(MPREFIX."lan_".$table), $tables);
 }
 // ----------------------------------------------------------------------------
 
 function copy_table($oldtable, $newtable, $drop = FALSE, $data = FALSE)
 {
-	global $sql;
-	$old = MPREFIX.strtolower($oldtable);
-	$new = MPREFIX.strtolower($newtable);
-	if($drop)
-	{
-		$sql->db_Select_gen("DROP TABLE IF EXISTS {$new}");
-	}
-
-	//Get $old table structure
-	$sql->db_Select_gen('SET SQL_QUOTE_SHOW_CREATE = 1');
-	$qry = "SHOW CREATE TABLE {$old}";
-	if($sql->db_Select_gen($qry))
-	{
-		$row = $sql->db_Fetch();
-		$qry = $row[1];
-		$qry = str_replace($old, $new, $qry);
-	}
-	$result = mysql_query($qry);
-	if(!$result)
-	{
-		return FALSE;
-	}
-	if ($data)  //We need to copy the data too
-	{
-		$qry = "INSERT INTO {$new} SELECT * FROM {$old}";
-		$sql->db_Select_gen($qry);
-	}
-	return TRUE;
+    global $sql;
+    $old = MPREFIX.strtolower($oldtable);
+    $new = MPREFIX.strtolower($newtable);
+    if($drop)
+    {
+        $sql->db_Select_gen("DROP TABLE IF EXISTS {$new}");
+    }
+
+    //Get $old table structure
+    $sql->db_Select_gen('SET SQL_QUOTE_SHOW_CREATE = 1');
+    $qry = "SHOW CREATE TABLE {$old}";
+    if($sql->db_Select_gen($qry))
+    {
+        $row = $sql->db_Fetch();
+        $qry = $row[1];
+        $qry = str_replace($old, $new, $qry);
+    }
+    $result = mysql_query($qry);
+    if(!$result)
+    {
+        return FALSE;
+    }
+    if ($data)  //We need to copy the data too
+    {
+        $qry = "INSERT INTO {$new} SELECT * FROM {$old}";
+        $sql->db_Select_gen($qry);
+    }
+    return TRUE;
 }
 
 // ----------------------------------------------------------------------------
 
 function table_list() {
-	// grab default language lists.
-	global $mySQLdefaultdb;
+    // grab default language lists.
+    global $mySQLdefaultdb;
 
-	$exclude[] = "banlist";		$exclude[] = "banner";
-	$exclude[] = "cache";		$exclude[] = "core";
-	$exclude[] = "online";		$exclude[] = "parser";
-	$exclude[] = "plugin";		$exclude[] = "user";
-	$exclude[] = "upload";		$exclude[] = "userclass_classes";
-	$exclude[] = "rbinary";		$exclude[] = "session";
-	$exclude[] = "tmp";	 		$exclude[] = "flood";
-	$exclude[] = "stat_info";	$exclude[] = "stat_last";
-	$exclude[] = "submit_news";	$exclude[] = "rate";
-	$exclude[] = "stat_counter";$exclude[] = "user_extended";
-	$exclude[] = "user_extended_struc";
-	$exclude[] = "pm_messages";
-	$exclude[] = "pm_blocks";
-
-	$tables = mysql_list_tables($mySQLdefaultdb);
-
-	while (list($temp) = mysql_fetch_array($tables))
-	{
-		if(strpos($temp, MPREFIX) === 0)
-		{
-			$e107tab = str_replace(MPREFIX, "", $temp);
-			if (!in_array($e107tab, $exclude) && stristr($e107tab, "lan_") === FALSE)
-			{
-				$tabs[] = $e107tab;
-			}
-		}
-	}
+    $exclude[] = "banlist";     $exclude[] = "banner";
+    $exclude[] = "cache";       $exclude[] = "core";
+    $exclude[] = "online";      $exclude[] = "parser";
+    $exclude[] = "plugin";      $exclude[] = "user";
+    $exclude[] = "upload";      $exclude[] = "userclass_classes";
+    $exclude[] = "rbinary";     $exclude[] = "session";
+    $exclude[] = "tmp";         $exclude[] = "flood";
+    $exclude[] = "stat_info";   $exclude[] = "stat_last";
+    $exclude[] = "submit_news"; $exclude[] = "rate";
+    $exclude[] = "stat_counter";$exclude[] = "user_extended";
+    $exclude[] = "user_extended_struc";
+    $exclude[] = "pm_messages";
+    $exclude[] = "pm_blocks";
+
+    $tables = mysql_list_tables($mySQLdefaultdb);
+
+    while (list($temp) = mysql_fetch_array($tables))
+    {
+        if((strpos($temp, MPREFIX) === 0) || MPREFIX=='')
+        {
+            $e107tab = str_replace(MPREFIX, "", $temp);
+            if (!in_array($e107tab, $exclude) && stristr($e107tab, "lan_") === FALSE)
+            {
+                $tabs[] = $e107tab;
+            }
+        }
+    }
 
-	return $tabs;
+    return $tabs;
 }
 
 
 // ------------- render form ---------------------------------------------------
 function multilang_db(){
-	global $pref,$ns,$tp,$rs,$lanlist,$tabs;
+    global $pref,$ns,$tp,$rs,$lanlist,$tabs;
 
-	if(isset($pref['multilanguage']) && $pref['multilanguage']){
-		$caption = LANG_LAN_16; // language
-		$text = MLAD_LAN_4."<br /><br />";
-
-
-		// Choose Language to Edit:
-		$text = "<div style='text-align:center'>
-		<div style='".ADMIN_WIDTH.";margin-left: auto; margin-right: auto;'>
-		<table class='fborder' style='width:99%; margin-top: 1px;'>
-		<tr><td class='fcaption'>".ADLAN_132."</td>
-		<td class='fcaption'>".LANG_LAN_03."</td>
-		<td class='fcaption'>".LAN_OPTIONS."</td>
-		</tr>\n\n";
-		sort($lanlist);
-		for($i = 0; $i < count($lanlist); $i++)
-		{
-			$installed = 0;
-
-			$text .= "<tr><td class='forumheader3' style='width:30%'>".$lanlist[$i]."</td><td class='forumheader3'>\n";
-			foreach ($tabs as $tab_name) {
-				if (db_Table_exists(strtolower($lanlist[$i])."_".$tab_name)) {
-					$text .= $tab_name.", ";
-					$installed++;
-				}
-			}
-        	if($lanlist[$i] == $pref['sitelanguage']){
-        		$text .= "<div style='text-align:center'><i>".LANG_LAN_17."</i></div>";
-			}else{
-				$text .= (!$installed)? "<div style='text-align:center'><i>".LANG_LAN_05."</i></div>" : "";
-			}
-			$text .= "</td><td class='forumheader3' style='width:20%;white-space:nowrap;text-align:right'>\n";
-			$text .= $rs->form_open("post", e_SELF."?modify", "lang_form_".str_replace(" ", "_", $lanlist[$i]));
-			$text .= "<div style='text-align: center'>\n";
-   			if ($installed) {
-				$text .= " <input type='submit' class='button' name='edit_existing' value='".LAN_EDIT."' />\n";
-		   		$text .= " <input type='submit' class='button' name='del_existing' value='".LAN_DELETE."' onclick=\"return jsconfirm('Delete all tables in ".$lanlist[$i]." ?')\" />\n";
-			} elseif($lanlist[$i] != $pref['sitelanguage']) {
-				$text .= "<input type='submit' class='button' name='edit_existing' value='".LAN_CREATE."' />\n";
-			}
-			$text .= "<input type='hidden' name='lang_choices' value='".$lanlist[$i]."' />";
-   			$text .= "</div>";
-			$text .= $rs->form_close();
-			$text .= "</td></tr>";
-		}
+    if(isset($pref['multilanguage']) && $pref['multilanguage']){
+        $caption = LANG_LAN_16; // language
+        $text = MLAD_LAN_4."<br /><br />";
+
+
+        // Choose Language to Edit:
+        $text = "<div style='text-align:center'>
+        <div style='".ADMIN_WIDTH.";margin-left: auto; margin-right: auto;'>
+        <table class='fborder' style='width:99%; margin-top: 1px;'>
+        <tr><td class='fcaption'>".ADLAN_132."</td>
+        <td class='fcaption'>".LANG_LAN_03."</td>
+        <td class='fcaption'>".LAN_OPTIONS."</td>
+        </tr>\n\n";
+        sort($lanlist);
+        for($i = 0; $i < count($lanlist); $i++)
+        {
+            $installed = 0;
+
+            $text .= "<tr><td class='forumheader3' style='width:30%'>".$lanlist[$i]."</td><td class='forumheader3'>\n";
+            foreach ($tabs as $tab_name) {
+                if (db_Table_exists(strtolower($lanlist[$i])."_".$tab_name)) {
+                    $text .= $tab_name.", ";
+                    $installed++;
+                }
+            }
+            if($lanlist[$i] == $pref['sitelanguage']){
+                $text .= "<div style='text-align:center'><i>".LANG_LAN_17."</i></div>";
+            }else{
+                $text .= (!$installed)? "<div style='text-align:center'><i>".LANG_LAN_05."</i></div>" : "";
+            }
+            $text .= "</td><td class='forumheader3' style='width:20%;white-space:nowrap;text-align:right'>\n";
+            $text .= $rs->form_open("post", e_SELF."?modify", "lang_form_".str_replace(" ", "_", $lanlist[$i]));
+            $text .= "<div style='text-align: center'>\n";
+            if ($installed) {
+                $text .= " <input type='submit' class='button' name='edit_existing' value='".LAN_EDIT."' />\n";
+                $text .= " <input type='submit' class='button' name='del_existing' value='".LAN_DELETE."' onclick=\"return jsconfirm('Delete all tables in ".$lanlist[$i]." ?')\" />\n";
+            } elseif($lanlist[$i] != $pref['sitelanguage']) {
+                $text .= "<input type='submit' class='button' name='edit_existing' value='".LAN_CREATE."' />\n";
+            }
+            $text .= "<input type='hidden' name='lang_choices' value='".$lanlist[$i]."' />";
+            $text .= "</div>";
+            $text .= $rs->form_close();
+            $text .= "</td></tr>";
+        }
 
-		$text .= "</table></div></div>";
+        $text .= "</table></div></div>";
 
-		$ns->tablerender($caption, $text);
-	}
+        $ns->tablerender($caption, $text);
+    }
 }
 
 
@@ -399,67 +394,67 @@
 
 function show_tools()
 {
-	global $ns;
+    global $ns;
 
-	include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php");
+    include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php");
 
-	$text .= "
-	<form name='lancheck' method='post' action='".e_ADMIN."lancheck.php'>
-	<table class='fborder' style='".ADMIN_WIDTH."'>
-	<tr>
-	<td class='fcaption'>".LAN_CHECK_1."</td>
-	<td class='forumheader3' style='text-align:center'>
-	<select name='language' class='tbox'>
-	<option value=''>".LAN_SELECT."</option>";
-
-	$languages = explode(",",e_LANLIST);
-	sort($languages);
-
-	foreach($languages as $lang)
-	{
-		if($lang != "English")
-		{
-	   		$text .= "<option value='{$lang}' >{$lang}</option>\n";
-		}
-	}
-
-	$text .= "
-	</select>
-	<input type='submit' name='language_sel' value=\"".LAN_CHECK_2."\" class='button' />
-	</td></tr>
-	</table></form>";
+    $text .= "
+    <form name='lancheck' method='post' action='".e_ADMIN."lancheck.php'>
+    <table class='fborder' style='".ADMIN_WIDTH."'>
+    <tr>
+    <td class='fcaption'>".LAN_CHECK_1."</td>
+    <td class='forumheader3' style='text-align:center'>
+    <select name='language' class='tbox'>
+    <option value=''>".LAN_SELECT."</option>";
+
+    $languages = explode(",",e_LANLIST);
+    sort($languages);
+
+    foreach($languages as $lang)
+    {
+        if($lang != "English")
+        {
+            $text .= "<option value='{$lang}' >{$lang}</option>\n";
+        }
+    }
 
-	$ns->tablerender(LANG_LAN_21, $text);
+    $text .= "
+    </select>
+    <input type='submit' name='language_sel' value=\"".LAN_CHECK_2."\" class='button' />
+    </td></tr>
+    </table></form>";
+
+    $ns->tablerender(LANG_LAN_21, $text);
 }
 
 
 // ----------------------------------------------------------------------------
 
 function language_adminmenu() {
-	global $action,$pref;
-	if ($action == "") {
-		$action = "main";
-	}
-
-	if($action == "modify"){
-    	$action = "db";
-	}
-	$var['main']['text'] = LAN_PREFS;
-	$var['main']['link'] = e_SELF;
-
-	if(isset($pref['multilanguage']) && $pref['multilanguage']){
-		$var['db']['text'] = LANG_LAN_03;
-		$var['db']['link'] = e_SELF."?db";
-	}
+    global $action,$pref;
+    if ($action == "") {
+        $action = "main";
+    }
+
+    if($action == "modify"){
+        $action = "db";
+    }
+    $var['main']['text'] = LAN_PREFS;
+    $var['main']['link'] = e_SELF;
+
+    if(isset($pref['multilanguage']) && $pref['multilanguage']){
+        $var['db']['text'] = LANG_LAN_03;
+        $var['db']['link'] = e_SELF."?db";
+    }
 
-	$lcnt = explode(",",e_LANLIST);
+    $lcnt = explode(",",e_LANLIST);
     if(count($lcnt) > 1)
-	{
-		$var['tools']['text'] = ADLAN_CL_6;
-		$var['tools']['link'] = e_SELF."?tools";
+    {
+        $var['tools']['text'] = ADLAN_CL_6;
+        $var['tools']['link'] = e_SELF."?tools";
     }
 
-	show_admin_menu(ADLAN_132, $action, $var);
+    show_admin_menu(ADLAN_132, $action, $var);
 }
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_admin/links.php 0.7.11.src/e107_admin/links.php
--- 0.7.7.src/e107_admin/links.php	2006-11-11 20:24:21.000000000 -0600
+++ 0.7.11.src/e107_admin/links.php	2007-10-13 14:08:21.000000000 -0500
@@ -11,9 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/links.php,v $
-|     $Revision: 1.66 $
-|     $Date: 2006/11/12 02:24:21 $
-|     $Author: e107coders $
+|     $Revision: 1.70 $
+|     $Date: 2007/10/13 19:08:21 $
+|     $Author: e107steved $
+|
+| links.php?debug shows stored data for each link after name (before constant conversion)
 +----------------------------------------------------------------------------+
 */
 
@@ -42,29 +44,41 @@
 $rs = new form;
 $linkpost = new links;
 
-if (e_QUERY) {
-	$tmp = explode('.', e_QUERY);
-	$action = $tmp[0];
-	$sub_action = $tmp[1];
-	$id = $tmp[2];
-	unset($tmp);
+$action = '';
+if (e_QUERY) 
+{
+  $tmp = explode('.', e_QUERY);
+  $action = $tmp[0];
+  $sub_action = $tmp[1];
+  $id = $tmp[2];
+  unset($tmp);
 }
 
+define("URL_SEPARATOR",'X');		// Used in names of 'inc' and 'dec' fields
+
+$incdec_action = '';
 foreach(array_keys($_POST) as $k)
 {
-	if (preg_match("#(.*?)_delete_(\d+)(.*)#", $k, $matches))
-	{
-		$delete = $matches[1];
-		$del_id = $matches[2];
-	}
+  if (preg_match("#(.*?)_delete_(\d+)(.*)#", $k, $matches))
+  {
+	$delete = $matches[1];
+	$del_id = $matches[2];
+  }
+  elseif (!$incdec_action && (preg_match("#^(inc|dec)".URL_SEPARATOR."(\d+)".URL_SEPARATOR."(\d+)_[x|y]#", $k, $matches)))
+  {
+    $incdec_action = $matches[1];
+	$linkid = intval($matches[2]);
+	$link_order = intval($matches[3]);
+  }
 }
 
-if(isset($_POST['generate_sublinks']) && isset($_POST['sublink_type']) && $_POST['sublink_parent'] !="" ){
-
+if(isset($_POST['generate_sublinks']) && isset($_POST['sublink_type']) && $_POST['sublink_parent'] !="" )
+{
 	$subtype = $_POST['sublink_type'];
 	$sublink = $linkpost->sublink_list($subtype);
-    if(!is_object($sql2)){
-    	$sql2 = new db;
+    if(!is_object($sql2))
+	{
+      $sql2 = new db;
 	}
 
 	$sql -> db_Select("links", "*", "link_id = '".$_POST['sublink_parent']."'");
@@ -95,30 +109,27 @@
 	}
 }
 
-if (isset($_POST['inc'])) {
-	$qs = explode(".", $_POST['inc']);
-	$linkid = $qs[0];
-	$link_order = $qs[1];
-	$sql->db_Update("links", "link_order=link_order+1 WHERE link_order='".($link_order-1)."'");
-	$sql->db_Update("links", "link_order=link_order-1 WHERE link_id='".$linkid."'");
-}
-
-if (isset($_POST['dec'])) {
-	$qs = explode(".", $_POST['dec']);
-	$linkid = $qs[0];
-	$link_order = $qs[1];
-	$sql->db_Update("links", "link_order=link_order-1 WHERE link_order='".($link_order+1)."'");
-	$sql->db_Update("links", "link_order=link_order+1 WHERE link_id='".$linkid."'");
-}
-
-if (isset($_POST['update'])) {
-
-	foreach ($_POST['link_order'] as $loid) {
-		$tmp = explode(".", $loid);
-		$sql->db_Update("links", "link_order=".$tmp[1]." WHERE link_id=".$tmp[0]);
+if ($incdec_action == 'inc') 
+{
+  $sql->db_Update("links", "link_order=link_order+1 WHERE link_order='".intval($link_order-1)."'");
+  $sql->db_Update("links", "link_order=link_order-1 WHERE link_id='".intval($linkid)."'");
+}
+elseif ($incdec_action =='dec') 
+{
+  $sql->db_Update("links", "link_order=link_order-1 WHERE link_order='".intval($link_order+1)."'");
+  $sql->db_Update("links", "link_order=link_order+1 WHERE link_id='".intval($linkid)."'");
+}
+
+if (isset($_POST['update'])) 
+{
+	foreach ($_POST['link_order'] as $loid) 
+	{
+	  $tmp = explode(".", $loid);
+	  $sql->db_Update("links", "link_order=".intval($tmp[1])." WHERE link_id=".intval($tmp[0]));
 	}
-	foreach ($_POST['link_class'] as $lckey => $lcid) {
-	 	$sql->db_Update("links", "link_class='".$lcid."' WHERE link_id=".$lckey);
+	foreach ($_POST['link_class'] as $lckey => $lcid) 
+	{
+	 	$sql->db_Update("links", "link_class='".$lcid."' WHERE link_id=".intval($lckey));
 	}
 	$e107cache->clear("sitelinks");
 	$linkpost->show_message(LAN_UPDATED);
@@ -161,6 +172,11 @@
 	$linkpost->show_existing_items();
 }
 
+if ($action == 'debug') 
+{
+  $linkpost->show_existing_items(TRUE);
+}
+
 if ($action == 'opt') {
 	$linkpost->show_pref_options();
 }
@@ -178,6 +194,7 @@
 {
 	var $link_total;
 	var $aIdOptPrep, $aIdOptData, $aIdOptTest;
+	var $debug_dis = FALSE;
 
 	function getLinks()
 	{
@@ -267,9 +284,11 @@
 		return $ret;
 	}
 
-	function show_existing_items()
+	function show_existing_items($dbg_display=FALSE)
 	{
 		global $sql, $rs, $ns, $tp, $linkArray;
+		$this->debug_dis = $dbg_display;
+		
 		if (count($linkArray))
 		{
 
@@ -315,11 +334,11 @@
 		$this->aIdOptPrep = $this->prepOpts($this->aIdOptData);
 	}
 
-	function display_row($row2, $indent = FALSE) {
-		global $sql, $rs, $ns, $tp, $linkArray,$previous_cat;
+	function display_row($row2, $indent = FALSE) 
+	{
+		global $sql, $rs, $ns, $tp, $linkArray, $previous_cat;
 		extract($row2);
 
-		//
 		if($link_category > 1 && $link_category != $previous_cat)
 		{
         	$text .= "
@@ -338,43 +357,49 @@
 		{
 			$link_name = $this->linkName( $link_name );
 		}
+		
+		if ($this->debug_dis)
+		{
+		  $link_name.= ' ['.$link_url.']';
+		}
 
-		if ($indent) {
-			$subimage = "<img src='".e_IMAGE."admin_images/sublink.png' alt='' />";
-			$subspacer = ($indent > 1) ? " style='padding-left: ".(($indent - 1) * 16)."px'" : "";
-			$subindent = "<td".$subspacer.">".$subimage."</td>";
+		if ($indent) 
+		{
+		  $subimage = "<img src='".e_IMAGE."admin_images/sublink.png' alt='' />";
+		  $subspacer = ($indent > 1) ? " style='padding-left: ".(($indent - 1) * 16)."px'" : "";
+		  $subindent = "<td".$subspacer.">".$subimage."</td>";
 		}
 
-				$text .= "<tr><td class='forumheader3' style='text-align: center; vertical-align: middle' title='".$link_description."'>";
-				$text .= $link_button ? "<img src='".e_IMAGE."icons/".$link_button."' alt='' /> ":
-				"";
-				$text .= "</td><td class='forumheader3' title='".$link_description."'>
+		$text .= "<tr><td class='forumheader3' style='text-align: center; vertical-align: middle' title='".$link_description."'>";
+		$text .= $link_button ? "<img src='".e_IMAGE."icons/".$link_button."' alt='' /> ":
+		"";
+		$text .= "</td><td class='forumheader3' title='".$link_description."'>
 				<table cellspacing='0' cellpadding='0' border='0' style='width: 100%'>
 				<tr>
-				".$subindent."
+			".$subindent."
 				<td style='".($indent ? "" : "font-weight:bold;")."width: 100%'>".$link_name."</td>
 				</tr>
 				</table>
 				</td>";
-				$text .= "<td style='text-align:center; white-space: nowrap' class='forumheader3'>";
-				$text .= "<a href='".e_SELF."?create.sub.{$link_id}'><img src='".e_IMAGE."admin_images/sublink_16.png' title='".LINKLAN_10."' alt='".LINKLAN_10."' /></a>&nbsp;";
-				$text .= "<a href='".e_SELF."?create.edit.{$link_id}'>".ADMIN_EDIT_ICON."</a>&nbsp;";
-				$text .= "<input type='image' title='".LAN_DELETE."' name='main_delete_{$link_id}' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_58." [ $link_name ]")."') \" />";
-				$text .= "</td>";
-				$text .= "<td style='text-align:center' class='forumheader3'>".r_userclass("link_class[".$link_id."]", $link_class, "off", "public,guest,nobody,member,admin,classes")."</td>";
-				$text .= "<td style='text-align:center; white-space: nowrap' class='forumheader3'>";
-				$text .= "<input type='image' src='".e_IMAGE."admin_images/up.png' title='".LCLAN_30."' value='".$link_id.".".$link_order."' name='inc' />";
-				$text .= "<input type='image' src='".e_IMAGE."admin_images/down.png' title='".LCLAN_31."' value='".$link_id.".".$link_order."' name='dec' />";
-				$text .= "</td>";
-				$text .= "<td style='text-align:center' class='forumheader3'>";
-				$text .= "<select name='link_order[]' class='tbox'>\n";
-				$text .= $this->genOpts( $this->aIdOptPrep, $this->aIdOptTest, $link_order, $link_id );
-				$text .= "</select>";
-				$text .= "</td>";
-				$text .= "</tr>";
-
-	return $text;
+		$text .= "<td style='text-align:center; white-space: nowrap' class='forumheader3'>";
+		$text .= "<a href='".e_SELF."?create.sub.{$link_id}'><img src='".e_IMAGE."admin_images/sublink_16.png' title='".LINKLAN_10."' alt='".LINKLAN_10."' /></a>&nbsp;";
+		$text .= "<a href='".e_SELF."?create.edit.{$link_id}'>".ADMIN_EDIT_ICON."</a>&nbsp;";
+		$text .= "<input type='image' title='".LAN_DELETE."' name='main_delete_{$link_id}' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_58." [ $link_name ]")."') \" />";
+		$text .= "</td>";
+		$text .= "<td style='text-align:center' class='forumheader3'>".r_userclass("link_class[".$link_id."]", $link_class, "off", "public,guest,nobody,member,admin,classes")."</td>";
+		$text .= "<td style='text-align:center; white-space: nowrap' class='forumheader3'>";
+		$name_suffix = URL_SEPARATOR.$link_id.URL_SEPARATOR.$link_order;
+		$text .= "<input name='inc".$name_suffix."' type='image' src='".e_IMAGE."admin_images/up.png' title='".LCLAN_30."' />";
+		$text .= "<input name='dec".$name_suffix."' type='image' src='".e_IMAGE."admin_images/down.png' title='".LCLAN_31."' />";
+		$text .= "</td>";
+		$text .= "<td style='text-align:center' class='forumheader3'>";
+		$text .= "<select name='link_order[]' class='tbox'>\n";
+		$text .= $this->genOpts( $this->aIdOptPrep, $this->aIdOptTest, $link_order, $link_id );
+		$text .= "</select>";
+		$text .= "</td>";
+		$text .= "</tr>";
 
+	  return $text;
 	}
 
 
@@ -663,7 +688,7 @@
 	</table>
 	</form>
 	</div>";
-	$ns->tablerender("Sublinks Generator", $text);
+	$ns->tablerender(LINKLAN_4, $text);
 }
 
 
@@ -784,6 +809,9 @@
 	$var['sub']['text'] = LINKLAN_4;
 	$var['sub']['link'] = e_SELF."?sublinks";
 
+//	$var['debug']['text'] = "List DB";
+//	$var['debug']['link'] = e_SELF."?debug";
+
 	show_admin_menu(LCLAN_68, $action, $var);
 }
 
diff -x .svn -ruN 0.7.7.src/e107_admin/mailout.php 0.7.11.src/e107_admin/mailout.php
--- 0.7.7.src/e107_admin/mailout.php	2006-11-29 16:27:40.000000000 -0600
+++ 0.7.11.src/e107_admin/mailout.php	2007-10-28 08:03:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/mailout.php,v $
-|     $Revision: 1.59 $
-|     $Date: 2006/11/29 22:27:40 $
-|     $Author: e107coders $
+|     $Revision: 1.62 $
+|     $Date: 2007/10/28 13:03:16 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -33,7 +33,7 @@
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_users.php");
 require_once(e_HANDLER."userclass_class.php");
 
-if (isset($_POST['testemail'])) {
+if (isset($_POST['testemail']) && getperms("0")) {
     if(trim($_POST['testaddress']) == ""){
 		$message = MAILAN_19;
 	}else{
@@ -122,18 +122,13 @@
 	$_POST['mail_id']  = time();
 
 	$sql->db_Select_gen($qry);
-	if (ob_get_level() == 0) {
-		ob_start();
-	}
+
 	while ($row = $sql->db_Fetch()) {
 		$qry = "0,'sendmail', '".$_POST['mail_id']."', '".$row['user_id']."', '', '0', \"".$tp->toDB($_POST['email_subject'])."\" ";
 		if($sql2 -> db_Insert("generic", $qry)){
 			$c++;
 		}
-		ob_flush();
-		flush();
 	}
-	ob_end_flush();
 
 	$debug = (e_MENU == "debug") ? "?[debug]" : "";
 
@@ -246,9 +241,9 @@
 
 //. Update Preferences.
 
-if (isset($_POST['updateprefs'])) {
+if (isset($_POST['updateprefs']) && getperms("0")) {
 	$pref['mailer'] = $_POST['mailer'];
-	$pref['sendmail'] = $_POST['sendmail'];
+	if (strpos($_POST['sendmail'],'sendmail') !== FALSE) $pref['sendmail'] = $_POST['sendmail'];
 	$pref['smtp_server'] = $tp->toDB($_POST['smtp_server']);
 	$pref['smtp_username'] = $tp->toDB($_POST['smtp_username']);
 	$pref['smtp_password'] = $tp->toDB($_POST['smtp_password']);
@@ -276,7 +271,7 @@
 
 // ----------------- Actions ----------------------------------------------->
 
-if(e_QUERY == "prefs"){
+if((e_QUERY == "prefs") && getperms("0")){
 	show_prefs();
 }
 
@@ -778,7 +773,7 @@
 	<div style='position:absolute; bottom:30px; right:125px'>
 	<table class='fborder' style='background-color: #fff'>
 	<tr><td class='forumheader3'>
-	<select class='tbox' name='sc_sel' onchange=\"addtext(this.value); expandit('{$container}')\">
+	<select class='tbox' name='sc_sel' onchange=\"addtext(this.value); this.selectedIndex= 0; expandit('{$container}')\">
 	<option value=''> -- </option>\n";
 
 	$sc = array(
diff -x .svn -ruN 0.7.7.src/e107_admin/menus.php 0.7.11.src/e107_admin/menus.php
--- 0.7.7.src/e107_admin/menus.php	2006-09-30 15:08:57.000000000 -0500
+++ 0.7.11.src/e107_admin/menus.php	2007-03-06 13:59:36.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/menus.php,v $
-|     $Revision: 1.48 $
-|     $Date: 2006/09/30 20:08:57 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.51 $
+|     $Date: 2007/03/06 19:59:36 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -33,35 +33,45 @@
 
 $menus_equery = explode('.', e_QUERY);
 
-if (isset($_POST['custom_select'])) {
+if (isset($_POST['custom_select'])) 
+{
 	$menus_equery[1] = $_POST['custom_select'];
 	//header("location:".e_SELF."?".$_POST['custom_select']);
 	//exit;
-} else if (!isset($menus_equery[1])) {
+}
+ else if (!isset($menus_equery[1])) 
+{
 	$menus_equery[1] = '';
 }
 
-if ($menus_equery[1] == '' || $menus_equery[1] == 'default_layout') {
+
+if ($menus_equery[1] == '' || $menus_equery[1] == 'default_layout') 
+{
 	$menus_header = $HEADER;
 	$menus_footer = $FOOTER;
 }
-else if ($menus_equery[1] == 'custom_layout') {
+else if ($menus_equery[1] == 'custom_layout') 
+{
 	$menus_header = $CUSTOMHEADER ? $CUSTOMHEADER :
 	$HEADER;
 	$menus_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER :
 	$FOOTER;
 }
-else if ($menus_equery[1] == 'newsheader_layout') {
+else if ($menus_equery[1] == 'newsheader_layout') 
+{
 	$menus_header = $NEWSHEADER ? $NEWSHEADER :
 	$HEADER;
 	$menus_footer = $FOOTER;
-} else {
+} 
+else 
+{
 	$menus_header = $CUSTOMHEADER[$menus_equery[1]] ? $CUSTOMHEADER[$menus_equery[1]] :
 	$HEADER;
 	$menus_footer = $CUSTOMFOOTER[$menus_equery[1]] ? $CUSTOMFOOTER[$menus_equery[1]] :
 	$FOOTER;
 }
 
+
 $layouts_str = $HEADER.$FOOTER;
 if ($NEWSHEADER) {
 	$layouts_str .= $NEWSHEADER;
@@ -118,11 +128,16 @@
 }
 // =============
 
-foreach ($_POST['menuAct'] as $k => $v) {
-	if (trim($v)) {
-		$id = $k;
-		list($menu_act, $location, $position, $newloc) = explode(".", $_POST['menuAct'][$k]);
+if (isset($_POST['menuAct']))
+{
+  foreach ($_POST['menuAct'] as $k => $v) 
+  {
+	if (trim($v)) 
+	{
+	  $id = $k;
+	  list($menu_act, $location, $position, $newloc) = explode(".", $_POST['menuAct'][$k]);
 	}
+  }
 }
 
 if ($menu_act == 'config') {
@@ -224,29 +239,40 @@
 }
 
 if (strpos(e_QUERY, 'configure') === FALSE)
-{
+{  // Scan plugin directories to see if menus to add
 	$efile = new e_file;
 	$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
-	foreach($fileList as $file) {
-		list($parent_dir) = explode('/',str_replace(e_PLUGIN,"",$file['path']));
-		$file['path'] = str_replace(e_PLUGIN,"",$file['path']);
-		$file['fname'] = str_replace(".php","",$file['fname']);
-		if (!$sql->db_Count("menus", "(*)", "WHERE menu_name='{$file['fname']}'")) {
-			if (file_exists(e_PLUGIN.$parent_dir."/plugin.php")) {
-				include(e_PLUGIN.$parent_dir."/plugin.php");
-				if ($sql->db_Select("plugin", "*", "plugin_path='".$eplug_folder."' AND plugin_installflag='1' ")) {
-					$sql->db_Insert("menus", " 0, '{$file['fname']}', 0, 0, 0, '' ,'{$file['path']}'");
-					$message .= "<b>".MENLAN_10." - ".$file['fname']."</b><br />";
-				}
-			} else {
-				$sql->db_Insert("menus", " 0, '{$file['fname']}', 0, 0, 0, '' ,'{$file['path']}'");
-				$message .= "<b>".MENLAN_10." - ".$file['fname']."</b><br />";
-			}
+	foreach($fileList as $file) 
+	{
+	  list($parent_dir) = explode('/',str_replace(e_PLUGIN,"",$file['path']));
+	  $file['path'] = str_replace(e_PLUGIN,"",$file['path']);
+	  $file['fname'] = str_replace(".php","",$file['fname']);
+	  $valid_menu = FALSE;
+	  $existing_menu = $sql->db_Count("menus", "(*)", "WHERE menu_name='{$file['fname']}'");
+	  if (file_exists(e_PLUGIN.$parent_dir."/plugin.php")) 
+	  {
+		include(e_PLUGIN.$parent_dir."/plugin.php");
+		if ($sql->db_Select("plugin", "*", "plugin_path='".$eplug_folder."' AND plugin_installflag='1' ")) 
+		{  // Its a 'new style' plugin with a plugin.php file - ionly include if plugin installed
+		  $valid_menu = TRUE;		// Whether new or existing, include in list
+		}
+	  } 
+	  else 
+	  {  // Just add the menu anyway
+		  $valid_menu = TRUE;
+	  }
+	  if ($valid_menu) 
+	  {
+	    $menustr .= "&".str_replace(".php", "", $file['fname']);
+		if (!$existing_menu)
+		{  // New menu to add to list
+		  $sql->db_Insert("menus", " 0, '{$file['fname']}', 0, 0, 0, '' ,'{$file['path']}'");
+		  $message .= "<b>".MENLAN_10." - ".$file['fname']."</b><br />";
 		}
-		$menustr .= "&".str_replace(".php", "", $file['fname']);
+	  }
 	}
 
-$sql2 = new db;
+if (!is_object($sql2)) $sql2 = new db;		// Shouldn't be needed
 foreach ($menu_areas as $menu_act) {
 	if ($sql->db_Select("menus", "*", "menu_location='$menu_act' ORDER BY menu_order ASC")) {
 		$c = 1;
@@ -408,51 +434,67 @@
 	}
 }
 
-function checklayout($str) {
-	global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp;
+function checklayout($str) 
+{	// Displays a basic representation of the theme
+	global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp, $menus_equery;
 
-	if (strstr($str, "LOGO")) {
-		echo $tp -> parseTemplate("{LOGO}");
+	if (strstr($str, "LOGO")) 
+	{
+	  echo $tp -> parseTemplate("{LOGO}");
 	}
-	else if(strstr($str, "SITENAME")) {
-		echo "<div style='padding: 2px'>[SiteName]</div>";
+	else if(strstr($str, "SITENAME")) 
+	{
+	  echo "<div style='padding: 2px'>[SiteName]</div>";
 	}
-	else if (strstr($str, "SITETAG")) {
-		echo "<div style='padding: 2px'>[SiteTag]</div>";
+	else if (strstr($str, "SITETAG")) 
+	{
+	  echo "<div style='padding: 2px'>[SiteTag]</div>";
 	}
-	else if (strstr($str, "SITELINKS")) {
-		echo "<div style='padding: 2px; text-align: center'>[SiteLinks]</div>";
+	else if (strstr($str, "SITELINKS")) 
+	{
+	  echo "<div style='padding: 2px; text-align: center'>[SiteLinks]</div>";
+	}
+	else if (strstr($str, "LANGUAGELINKS")) 
+	{
+	  echo "<div class=text style='padding: 2px; text-align: center'>[Language]</div>";	
 	}
-	else if (strstr($str, "CUSTOM")) {
-		$cust = preg_replace("/\W*\{CUSTOM=(.*?)(\+.*)?\}\W*/si", "\\1", $str);
-		echo "<div style='padding: 2px'>[".$cust."]</div>";
+	else if (strstr($str, "CUSTOM")) 
+	{
+	  $cust = preg_replace("/\W*\{CUSTOM=(.*?)(\+.*)?\}\W*/si", "\\1", $str);
+	  echo "<div style='padding: 2px'>[".$cust."]</div>";
 	}
 	// Display embedded Plugin information.
-	else if (strstr($str, "PLUGIN")){
+	else if (strstr($str, "PLUGIN"))
+	{
 		$plug = preg_replace("/\{PLUGIN=(.*?)\}/si", "\\1", $str);
 		$plug = trim($plug);
-		if (file_exists((e_PLUGIN."{$plug}/{$plug}_config.php"))){
-			$link = e_PLUGIN."{$plug}/{$plug}_config.php";
+		if (file_exists((e_PLUGIN."{$plug}/{$plug}_config.php")))
+		{
+		  $link = e_PLUGIN."{$plug}/{$plug}_config.php";
 		}
 
-		if(file_exists((e_PLUGIN.$plug."/config.php"))){
-			$link = e_PLUGIN.$plug."/config.php";
+		if(file_exists((e_PLUGIN.$plug."/config.php")))
+		{
+		  $link = e_PLUGIN.$plug."/config.php";
 		}
 
 		$plugtext = ($link) ? "(".MENLAN_34.":<a href='$link' title='".MENLAN_16."'>".MENLAN_16."</a>)" : "(".MENLAN_34.")" ;
 		echo "<br />";
 		$ns -> tablerender($plug, $plugtext);
 	}
-	else if (strstr($str, "MENU")) {
+	else if (strstr($str, "MENU")) 
+	{
 		$ns = new e107table;
 		$menu = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $str);
-		if (isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false) {
-			echo $sc_style['MENU']['pre'];
+		if (isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false) 
+		{
+		  echo $sc_style['MENU']['pre'];
 		}
 		echo "<div style='text-align:center; font-size:14px' class='fborder'><div class='forumheader'><b>".MENLAN_14."  ".$menu."</b></div></div><br />";
 		$text = "&nbsp;";
 		$sql9 = new db;
-		if ($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' ")) {
+		if ($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' ")) 
+		{
 			unset($text);
 			echo $frm->form_open("post", e_SELF."?configure.".$menus_equery[1], "frm_menu_".intval($menu));
 
@@ -469,12 +511,12 @@
 				$conf = '';
 				if (file_exists(e_PLUGIN."{$menu_path}/{$menu_name}_menu_config.php"))
 				{
-					$conf = "config.{$menu_path}.{$menu_name}_menu_config";
+				  $conf = "config.{$menu_path}.{$menu_name}_menu_config";
 				}
 
 				if($conf == '' && file_exists(e_PLUGIN."{$menu_path}/config.php"))
 				{
-					$conf = "config.{$menu_path}.config";
+				  $conf = "config.{$menu_path}.config";
 				}
 
 				$text .= "<select id='menuAct_$menu_id' name='menuAct[$menu_id]' class='tbox' onchange='this.form.submit()' >";
diff -x .svn -ruN 0.7.7.src/e107_admin/meta.php 0.7.11.src/e107_admin/meta.php
--- 0.7.7.src/e107_admin/meta.php	2006-06-06 23:08:33.000000000 -0500
+++ 0.7.11.src/e107_admin/meta.php	2007-03-23 16:45:51.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/meta.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/06/07 04:08:33 $
-|     $Author: e107coders $
+|     $Revision: 1.18 $
+|     $Date: 2007/03/23 21:45:51 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -77,14 +77,14 @@
 	<tr>
     <td style='width:25%' class='forumheader3'>".METLAN_9."</td>
     <td style='width:75%' class='forumheader3'>
-	<input class='tbox' style='width:90%' size='70' type='text' name='meta_description' value='".$meta_diz[$current_lang]."' />
+	<textarea class='tbox' title='meta_description' id='meta_description' name='meta_description' cols='70' rows='4' style='width:90%'>".$tp->toForm($meta_diz[$current_lang])."</textarea>
 	</td>
 	</tr>
 
 	<tr>
 	<td style='width:25%' class='forumheader3'>".METLAN_10."</td>
     <td style='width:75%' class='forumheader3'>
-	<input class='tbox' style='width:90%' size='70' type='text' name='meta_keywords' value='".$meta_keywords[$current_lang]."' />
+	<textarea class='tbox' title='meta_keywords' id='meta_keywords' name='meta_keywords' cols='70' rows='4' style='width:90%'>".$tp->toForm($meta_keywords[$current_lang])."</textarea>
 	</td>
 	</tr>
 
diff -x .svn -ruN 0.7.7.src/e107_admin/modcomment.php 0.7.11.src/e107_admin/modcomment.php
--- 0.7.7.src/e107_admin/modcomment.php	2006-02-24 12:36:35.000000000 -0600
+++ 0.7.11.src/e107_admin/modcomment.php	2007-03-18 10:00:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/modcomment.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/02/24 18:36:35 $
-|     $Author: whoisrich $
+|     $Revision: 1.17 $
+|     $Date: 2007/03/18 15:00:45 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -142,7 +142,7 @@
 	<input type='hidden' name='current_lock' value='".$comment_lock."' />
 	</td>
 	</tr>
-	<tr><td colspan='5' class='fcaption'>comments (".$total_comments." ".($total_comments == "1" ? MDCLAN_11 : MDCLAN_12).", ".$total_blocked." ".MDCLAN_13.")</td></tr>
+	<tr><td colspan='5' class='fcaption'>".MDCLAN_12." (".$total_comments." ".($total_comments == "1" ? MDCLAN_11 : MDCLAN_12).", ".$total_blocked." ".MDCLAN_13.")</td></tr>
 	".$comments."
 	<tr><td colspan='5' class='forumheader' style='text-align:center'>".MDCLAN_9."</td></tr>
 	<tr><td colspan='5' class='forumheader' style='text-align:center'><input class='button' type='submit' name='moderate' value='".MDCLAN_8."' /></td></tr>
diff -x .svn -ruN 0.7.7.src/e107_admin/newspost.php 0.7.11.src/e107_admin/newspost.php
--- 0.7.7.src/e107_admin/newspost.php	2006-11-12 12:48:14.000000000 -0600
+++ 0.7.11.src/e107_admin/newspost.php	2007-10-26 16:50:57.000000000 -0500
@@ -11,9 +11,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_admin/newspost.php,v $
-|   $Revision: 1.138 $
-|   $Date: 2006/11/12 18:48:14 $
-|   $Author: e107coders $
+|   $Revision: 1.146 $
+|   $Date: 2007/10/26 21:50:57 $
+|   $Author: e107steved $
 +---------------------------------------------------------------+
 
 */
@@ -44,7 +44,7 @@
 
 $newspost = new newspost;
 require_once("auth.php");
-$pst->save_preset(); // save and render result using unique name
+$pst->save_preset('news_datestamp'); // save and render result using unique name. Don't save item datestamp
 
 require_once(e_HANDLER."userclass_class.php");
 require_once(e_HANDLER."news_class.php");
@@ -57,11 +57,15 @@
 $ix = new news;
 
 
-if (e_QUERY) {
-	list($action, $sub_action, $id, $from) = explode(".", e_QUERY);
-	$id = intval($id);
-	$from = intval($from);
-	unset($tmp);
+if (e_QUERY) 
+{
+  $tmp = explode(".", e_QUERY);
+  $action = $tmp[0];
+  $sub_action = varset($tmp[1],'');
+  $id = intval(varset($tmp[2],0));
+  $sort_order = varset($tmp[2],'desc');
+  $from = intval(varset($tmp[3],0));
+  unset($tmp);
 }
 
 $from = ($from ? $from : 0);
@@ -150,6 +154,7 @@
 if (isset($_POST['submit_news'])) {
 
 	$newspost->submit_item($sub_action, $id);
+	$e107cache->clear("news.php");
 	$e107cache->clear("othernews");
 	$e107cache->clear("othernews2");
 	$action = "main";
@@ -216,8 +221,9 @@
 	$newspost->show_message(NWSLAN_119);
 }
 
-if (!e_QUERY || $action == "main") {
-	$newspost->show_existing_items($action, $sub_action, $id, $from, $amount);
+if (!e_QUERY || $action == "main") 
+{
+  $newspost->show_existing_items($action, $sub_action, $sort_order, $from, $amount);
 }
 
 if ($action == "create") {
@@ -271,52 +277,58 @@
 require_once("footer.php");
 exit;
 
-class newspost {
-
-
-	function show_existing_items($action, $sub_action, $id, $from, $amount) {
-		// ##### Display scrolling list of existing news items ---------------------------------------------------------------------------------------------------------
-		global $sql, $rs, $ns, $tp;
-		$text = "<div style='text-align:center'>";
-
-		if (isset($_POST['searchquery'])) {
-			$query = "news_title REGEXP('".$_POST['searchquery']."') OR news_body REGEXP('".$_POST['searchquery']."') OR news_extended REGEXP('".$_POST['searchquery']."') ORDER BY news_datestamp DESC";
-			} else {
-			$query = "ORDER BY ".($sub_action ? $sub_action : "news_datestamp")." ".($id ? $id : "DESC")."  LIMIT $from, $amount";
-		}
-
-		if ($sql->db_Select("news", "*", $query, ($_POST['searchquery'] ? 0 : "nowhere")))
-		{
+class newspost 
+{
 
-			$newsarray = $sql -> db_getList();
-			$text .= "
+	function show_existing_items($action, $sub_action, $sort_order, $from, $amount) 
+	{
+	  // ##### Display scrolling list of existing news items
+	  global $sql, $ns, $tp;
+	  $text = "<div style='text-align:center'>";
+
+	  if (!$sort_order) $sort_order = 'desc';
+	  if ($sort_order != 'asc') $sort_order = 'desc';
+	  $sort_link = $sort_order == 'asc' ? 'desc' : 'asc';		// Effectively toggle setting for headings
+	  
+	  if (isset($_POST['searchquery'])) 
+	  {
+		$query = "news_title REGEXP('".$_POST['searchquery']."') OR news_body REGEXP('".$_POST['searchquery']."') OR news_extended REGEXP('".$_POST['searchquery']."') ORDER BY news_datestamp DESC";
+	  } 
+	  else 
+	  {
+		$query = "ORDER BY ".($sub_action ? $sub_action : "news_datestamp")." ".strtoupper($sort_order)."  LIMIT {$from}, {$amount}";
+	  }
+
+	  if ($sql->db_Select("news", "*", $query, ($_POST['searchquery'] ? 0 : "nowhere")))
+	  {
+		$newsarray = $sql -> db_getList();
+		$text .= "
 			<form action='".e_SELF."' id='newsform' method='post'>
 			<table class='fborder' style='".ADMIN_WIDTH."'>
 			<tr>
-			<td style='width:5%' class='fcaption'><a href='".e_SELF."?main.news_id.".($id == "desc" ? "asc" : "desc").".$from'>".LAN_NEWS_45."</a></td>
-			<td style='width:55%' class='fcaption'><a href='".e_SELF."?main.news_title.".($id == "desc" ? "asc" : "desc").".$from'>".NWSLAN_40."</a></td>
+			<td style='width:5%' class='fcaption'><a href='".e_SELF."?main.news_id.{$sort_link}.{$from}'>".LAN_NEWS_45."</a></td>
+			<td style='width:55%' class='fcaption'><a href='".e_SELF."?main.news_title.{$sort_link}.{$from}'>".NWSLAN_40."</a></td>
 			<td style='width:15%' class='fcaption'>".LAN_NEWS_49."</td>
 			<td style='width:15%' class='fcaption'>".LAN_OPTIONS."</td>
 			</tr>";
-			$ren_type = array("default","title","other-news","other-news 2");
-			foreach($newsarray as $row)
-			{
-				extract($row);
+		$ren_type = array("default","title","other-news","other-news 2");
+		foreach($newsarray as $row)
+		{
+		  extract($row);
 
 				// Note: To fix the alignment bug. Put both buttons inside the Form.
 				// But make EDIT a 'button' and DELETE 'submit'
-
-				$text .= "<tr>
-				<td style='width:5%' class='forumheader3'>$news_id</td>
-				<td style='width:55%' class='forumheader3'><a href='".e_BASE."news.php?item.$news_id.$news_category'>".($news_title ? $tp->toHTML($news_title,"","no_hook,emotes_off,no_make_clickable") : "[".NWSLAN_42."]")."</a></td>
+		  $text .= "<tr>
+				<td style='width:5%' class='forumheader3'>{$news_id}</td>
+				<td style='width:55%' class='forumheader3'><a href='".e_BASE."news.php?item.{$news_id}.{$news_category}'>".($news_title ? $tp->toHTML($news_title,"","no_hook,emotes_off,no_make_clickable") : "[".NWSLAN_42."]")."</a></td>
 				<td style='20%' class='forumheader3'>";
-				$text .= $ren_type[$news_render_type];
-				if($news_sticky)
-				{
-					$sicon = (file_exists(THEME."images/sticky.png") ? THEME."images/sticky.png" : e_IMAGE."generic/".IMODE."/sticky.png");
-					$text .= " <img src='".$sicon."' alt='' />";
-				}
-				$text .= "
+		  $text .= $ren_type[$news_render_type];
+		  if($news_sticky)
+		  {
+			$sicon = (file_exists(THEME."images/sticky.png") ? THEME."images/sticky.png" : e_IMAGE."generic/".IMODE."/sticky.png");
+			$text .= " <img src='".$sicon."' alt='' />";
+		  }
+		  $text .= "
 				</td>
 
 				<td style='width:15%; text-align:center' class='forumheader3'>
@@ -324,27 +336,31 @@
 				<input type='image' title='".LAN_DELETE."' name='delete[main_{$news_id}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".NWSLAN_39." [ID: $news_id ]')\"/>
 				</td>
 				</tr>";
-			}
-			$text .= "</table></form>";
-			} else {
-			$text .= "<div style='text-align:center'>".NWSLAN_43."</div>";
 		}
+		$text .= "</table></form>";
+	  } 
+	  else 
+	  {
+		$text .= "<div style='text-align:center'>".NWSLAN_43."</div>";
+	  }
 
-		$newsposts = $sql->db_Count("news");
+	  $newsposts = $sql->db_Count("news");
 
-		if (!$_POST['searchquery']) {
-            $parms = $newsposts.",".$amount.",".$from.",".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.news_datestamp.desc.")."[FROM]";
-            $text .= "<br />".$tp->parseTemplate("{NEXTPREV={$parms}}");
+	  if (!$_POST['searchquery']) 
+	  {
+        $parms = $newsposts.",".$amount.",".$from.",".e_SELF."?".(e_QUERY ? "$action.$sub_action.$sort_order." : "main.news_datestamp.desc.")."[FROM]";
+        $text .= "<br />".$tp->parseTemplate("{NEXTPREV={$parms}}");
 
-		}
+	  }
 
-		$text .= "<br /><form method='post' action='".e_SELF."'>\n<p>\n<input class='tbox' type='text' name='searchquery' size='20' value='' maxlength='50' />\n<input class='button' type='submit' name='searchsubmit' value='".NWSLAN_63."' />\n</p>\n</form>\n</div>";
+	  $text .= "<br /><form method='post' action='".e_SELF."'>\n<p>\n<input class='tbox' type='text' name='searchquery' size='20' value='' maxlength='50' />\n<input class='button' type='submit' name='searchsubmit' value='".NWSLAN_63."' />\n</p>\n</form>\n</div>";
 
 
 
-		$ns->tablerender(NWSLAN_4, $text);
+	  $ns->tablerender(NWSLAN_4, $text);
 	}
 
+
 	function show_options($action) {
 		global $sql;
 
@@ -419,15 +435,18 @@
 		<td style='width:20%' class='forumheader3'>".NWSLAN_6.": </td>
 		<td style='width:80%' class='forumheader3'>";
 
-		if (!$sql->db_Select("news_category")) {
+		if (!$sql->db_Select("news_category"))
+		{
 			$text .= NWSLAN_10;
-			} else {
-
-			$text .= "
-			<select name='cat_id' class='tbox'>";
+		}
+		else
+		{
+			$text .= "\t<select name='cat_id' class='tbox'>\n";
 
-			while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch()) {
-				$text .= ($_POST['cat_id'] == $cat_id ? "<option value='$cat_id' selected='selected'>".$cat_name."</option>" : "<option value='$cat_id'>".$cat_name."</option>");
+			while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
+			{
+				$sel = ($_POST['cat_id'] == $cat_id) ? "selected='selected'" : "";
+				$text .= "<option value='$cat_id' {$sel}>".$tp->toHTML($cat_name,FALSE,"defs")."</option>\n";
 			}
 			$text .= "</select>";
 		}
@@ -465,7 +484,7 @@
 		<tr>
 		<td style='width:20%' class='forumheader3'>".NWSLAN_14.":</td>
 		<td style='width:80%' class='forumheader3'>
-		<a style='cursor: pointer; cursor: hand' onclick=\"expandit(this);$ff_expand\">".NWSLAN_83."</a>
+		<a style='cursor: pointer' onclick=\"expandit(this);$ff_expand\">".NWSLAN_83."</a>
 		<div style='display:none'>
 		<textarea class='tbox' id='news_extended' name='news_extended' cols='80' style='width:95%' $insertjs>".(strstr($tp->post_toForm($_POST['news_extended']), "[img]http") ? $tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_extended'])))."</textarea>
 		". display_help("helpc", 'extended')."
@@ -476,7 +495,7 @@
 		<tr>
 		<td style='width:20%' class='forumheader3'>".NWSLAN_66.":</td>
 		<td style='width:80%' class='forumheader3'>
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".NWSLAN_69."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".NWSLAN_69."</a>
 		<div style='display: none;'>";
 
 		if (!FILE_UPLOADS)
@@ -545,7 +564,7 @@
 		$text .= "<tr>
 		<td style='width:20%' class='forumheader3'>".NWSLAN_15.":</td>
 		<td style='width:80%' class='forumheader3'>
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".NWSLAN_18."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".NWSLAN_18."</a>
 		<div style='display: none;'>
 
 		". ($_POST['news_allow_comments'] ? "<input name='news_allow_comments' type='radio' value='0' />".LAN_ENABLED."&nbsp;&nbsp;<input name='news_allow_comments' type='radio' value='1' checked='checked' />".LAN_DISABLED : "<input name='news_allow_comments' type='radio' value='0' checked='checked' />".LAN_ENABLED."&nbsp;&nbsp;<input name='news_allow_comments' type='radio' value='1' />".LAN_DISABLED)."
@@ -556,7 +575,7 @@
 		<tr>
 		<td style='width:20%' class='forumheader3'>".NWSLAN_73.":</td>
 		<td style='width:80%' class='forumheader3'>
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".NWSLAN_74."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".NWSLAN_74."</a>
 		<div style='display: none;'>";
 		$ren_type = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2");
 		foreach($ren_type as $key=>$value) {
@@ -573,7 +592,7 @@
 		<td style='width:20%' class='forumheader3'>".NWSLAN_19.":</td>
 		<td style='width:80%' class='forumheader3'>
 
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".NWSLAN_72."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".NWSLAN_72."</a>
 		<div style='display: none;'>
 
 		<br />
@@ -581,7 +600,6 @@
 
 		$_startdate = ($_POST['news_start'] > 0) ? date("d/m/Y", $_POST['news_start']) : "";
 
-		$cal_options['firstDay'] = 0;
 		$cal_options['showsTime'] = false;
 		$cal_options['showOthers'] = false;
 		$cal_options['weekNumbers'] = false;
@@ -598,7 +616,6 @@
 
 		unset($cal_options);
 		unset($cal_attrib);
-		$cal_options['firstDay'] = 0;
 		$cal_options['showsTime'] = false;
 		$cal_options['showOthers'] = false;
 		$cal_options['weekNumbers'] = false;
@@ -618,14 +635,13 @@
 		".LAN_NEWS_32.":
 		</td>
 		<td class='forumheader3'>
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".LAN_NEWS_33."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".LAN_NEWS_33."</a>
 		<div style='display: none;'>";
 		$update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : "";
 
 		$_update_datestamp = ($_POST['news_datestamp'] > 0 && !strpos($_POST['news_datestamp'],"/")) ? date("d/m/Y H:i:s", $_POST['news_datestamp']) : trim($_POST['news_datestamp']);
 		unset($cal_options);
 		unset($cal_attrib);
-		$cal_options['firstDay'] = 0;
 		$cal_options['showsTime'] = true;
 		$cal_options['showOthers'] = true;
 		$cal_options['weekNumbers'] = false;
@@ -649,7 +665,7 @@
 		</td>
 		<td class='forumheader3'>
 
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".NWSLAN_84."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".NWSLAN_84."</a>
 		<div style='display: none;'>
 		".r_userclass_check("news_userclass", $_POST['news_class'], "nobody,public,guest,member,admin,classes,language")."
 		</div>
@@ -662,7 +678,7 @@
 		</td>
 		<td class='forumheader3'>
 
-		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".LAN_NEWS_29."</a>
+		<a style='cursor: pointer' onclick='expandit(this);'>".LAN_NEWS_29."</a>
 		<div style='display: none;'>
 		";
 		if($_POST['news_sticky'])
@@ -678,7 +694,7 @@
 		if($pref['trackbackEnabled']){
 			$text .= "<tr>
 			<td class='forumheader3'>".LAN_NEWS_34.":</td>
-			<td class='forumheader3'><a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".LAN_NEWS_35."</a>
+			<td class='forumheader3'><a style='cursor: pointer' onclick='expandit(this);'>".LAN_NEWS_35."</a>
 			<div style='display: none;'>
 			<span class='smalltext'>";
 			/* pingback */
@@ -859,7 +875,7 @@
 		<td class='forumheader3' style='width:70%'>
 		".$rs->form_text("category_button", 60, $category_icon, 100)."
 		<br />
-		<input class='button' type ='button' style='cursor:hand' size='30' value='".NWSLAN_54."' onclick='expandit(this)' />
+		<input class='button' type ='button' style='cursor: pointer' size='30' value='".NWSLAN_54."' onclick='expandit(this)' />
 		<div id='caticn' style='display:none'>";
 		while (list($key, $icon) = each($iconlist)) {
 			$text .= "<a href=\"javascript:insertext('$icon','category_button','caticn')\"><img src='".e_IMAGE."icons/".$icon."' style='border:0' alt='' /></a>\n ";
@@ -913,7 +929,7 @@
 			}
 			$text .= "</table></form>";
 			} else {
-			$text .= "<div style='text-align:center'><div style='vertical-align:center'>".NWSLAN_10."</div>";
+			$text .= "<div style='text-align:center'><div style='vertical-align:middle'>".NWSLAN_10."</div>";
 		}
 		$text .= "</div>";
 		$ns->tablerender(NWSLAN_51, $text);
@@ -994,7 +1010,7 @@
 		$text .= " <tr>
 		<td class='forumheader3' style='width:60%'><span class='defaulttext'>".NWSLAN_106."</span></td>
 		<td class='forumheader3' style='width:40%'>
-		".r_userclass("subnews_class", $pref['subnews_class']). "</td></tr>";
+		".r_userclass("subnews_class", $pref['subnews_class'],"off","nobody,public,guest,member,admin,classes"). "</td></tr>";
 
 
 		$text .= "
diff -x .svn -ruN 0.7.7.src/e107_admin/plugin.php 0.7.11.src/e107_admin/plugin.php
--- 0.7.7.src/e107_admin/plugin.php	2006-11-11 22:03:44.000000000 -0600
+++ 0.7.11.src/e107_admin/plugin.php	2007-05-30 15:35:41.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/plugin.php,v $
-|     $Revision: 1.68 $
-|     $Date: 2006/11/12 04:03:44 $
-|     $Author: mrpete $
+|     $Revision: 1.73 $
+|     $Date: 2007/05/30 20:35:41 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -84,9 +84,9 @@
 			if(!$unarc) {
 				/* unarc failed ... */
 				if($fileType == "zip") {
-					$error = "PCLZIP extract error: '".$archive -> errorName(TRUE)."'";
+					$error = EPL_ADLAN_46." '".$archive -> errorName(TRUE)."'";
 				} else {
-					$error = "PCLTAR extract error: ".PclErrorString().", code: ".intval(PclErrorCode());
+					$error = EPL_ADLAN_47.PclErrorString().", ".EPL_ADLAN_48.intval(PclErrorCode());
 				}
 				$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_42." ".$archiveName." ".$error);
 				require_once("footer.php");
@@ -124,7 +124,8 @@
 	$id = intval($id);
 	$plug = $plugin->getinfo($id);
 	//Uninstall Plugin
-	if ($plug['plugin_installflag'] == TRUE ) {
+	if ($plug['plugin_installflag'] == TRUE ) 
+	{
 		include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
 
 		$func = $eplug_folder.'_uninstall';
@@ -149,7 +150,7 @@
 		}
 		else
 		{
-			$text .= "Tables not deleted during uninstall process by request<br />";
+			$text .= EPL_ADLAN_49."<br />";
 		}
 
 		if (is_array($eplug_prefs)) {
@@ -180,7 +181,7 @@
 		{
 			foreach($eplug_array_pref as $key => $val)
 			{
-				$plugin->manage_plugin_prefs('remove', $key, $val);
+				$plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
 			}
 		}
 
@@ -195,7 +196,7 @@
 		}
 
 		if (is_array($eplug_user_prefs)) {
-			$sql = new db;
+			if (!is_object($sql)){ $sql = new db; }
 			$sql->db_Select("core", " e107_value", " e107_name='user_entended'");
 			$row = $sql->db_Fetch();
 			$user_entended = unserialize($row[0]);
@@ -217,7 +218,7 @@
 		}
 
 		if ($eplug_link) {
-			$plugin->manage_link('remove', '', $eplug_link_name);
+			$plugin->manage_link('remove', $eplug_link_url, $eplug_link_name);
 		}
 
 		if ($eplug_userclass) {
@@ -229,6 +230,12 @@
 		$plugin -> manage_notify('remove', $eplug_folder);
 
 		$sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' ");
+		if (isset($pref['plug_installed'][$plug['plugin_path']]))
+		{
+		  unset($pref['plug_installed'][$plug['plugin_path']]);
+		  save_prefs();
+		}
+
 
 		if($_POST['delete_files'])
 		{
@@ -317,8 +324,24 @@
 		$plugin->manage_prefs('remove', $upgrade_remove_prefs);
 	}
 
+	if (is_array($upgrade_add_array_pref))
+	{
+	  foreach($upgrade_add_array_pref as $key => $val)
+	  {
+		$plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val);
+	  }
+	}
+
+	if (is_array($upgrade_remove_array_pref))
+	{
+	  foreach($upgrade_remove_array_pref as $key => $val)
+	  {
+		$plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val);
+	  }
+	}
+
 	if (is_array($upgrade_add_user_prefs)) {
-		$sql = new db;
+		if (!is_object($sql)){ $sql = new db; }
 		$sql->db_Select("core", " e107_value", " e107_name='user_entended'");
 		$row = $sql->db_Fetch();
 		$user_entended = unserialize($row[0]);
@@ -335,7 +358,7 @@
 	}
 
 	if (is_array($upgrade_remove_user_prefs)) {
-		$sql = new db;
+		if (!is_object($sql)){ $sql = new db; }  
 		$sql->db_Select("core", " e107_value", " e107_name='user_entended'");
 		$row = $sql->db_Fetch();
 		$user_entended = unserialize($row[0]);
@@ -355,6 +378,8 @@
 
 	$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL;
 	$sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$id' ");
+	$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; 			// Update the version
+	save_prefs();			
 	$ns->tablerender(EPL_ADLAN_34, $text);
 
 	$plugin -> save_addon_prefs();
@@ -418,7 +443,8 @@
 
 		include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
 
- 		if ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest) {
+		// See whether plugin needs install - it does if any of the 'configuration' variables are set
+ 		if ($eplug_conffile || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_array_pref) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_module || $eplug_userclass || $eplug_status || $eplug_latest) {
 			$img = (!$plug['plugin_installflag'] ? "<img src='".e_IMAGE."admin_images/uninstalled.png' alt='' />" : "<img src='".e_IMAGE."admin_images/installed.png' alt='' />");
 		} else {
 			$img = "<img src='".e_IMAGE."admin_images/noinstall.png' alt='' />";
diff -x .svn -ruN 0.7.7.src/e107_admin/prefs.php 0.7.11.src/e107_admin/prefs.php
--- 0.7.7.src/e107_admin/prefs.php	2006-11-17 20:29:09.000000000 -0600
+++ 0.7.11.src/e107_admin/prefs.php	2007-11-07 16:34:38.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/prefs.php,v $
-|     $Revision: 1.96 $
-|     $Date: 2006/11/18 02:29:09 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.103 $
+|     $Date: 2007/11/07 22:34:38 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -46,7 +46,7 @@
 
 if (isset($_POST['updateprefs']))
 {
-	unset($_POST['updateprefs']);
+	unset($_POST['updateprefs'],$_POST['sitelanguage']);
 
 	$_POST['cookie_name'] = str_replace(array(" ","."), "_", $_POST['cookie_name']);
 	$_POST['cookie_name'] = preg_replace("#[^a-zA-Z0-9_]#", "", $_POST['cookie_name']);
@@ -54,11 +54,38 @@
 	$_POST['siteurl']     = trim($_POST['siteurl']) ? trim($_POST['siteurl']) : SITEURL;
 	$_POST['siteurl']     = substr($_POST['siteurl'], -1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/";
 
+	// If email verification, email address is required!
+	if ($_POST['user_reg_veri'] == 1) $_POST['disable_emailcheck'] = 0;
+
+// Table of range checking values - min and max for numerics. Only do the important ones
+	$pref_limits = array(
+	  'loginname_maxlength' => array('min' => 10, 'max' => 100, 'default' => 30),
+	  'displayname_maxlength' => array('min' => 5, 'max' => 30, 'default' => 15),
+	  'antiflood_timeout' => array('min' => 3, 'max' => 300, 'default' => 10)
+	);
+
 	foreach($_POST as $key => $value)
 	{
-		$pref[$key] = $tp->toDB($value);
+	  if (isset($pref_limits[$key]))
+	  {	// Its a numeric value to check
+	    if (is_numeric($value))
+		{
+		  if ($value < $pref_limits[$key]['min']) $value = $pref_limits[$key]['min'];
+		  if ($value > $pref_limits[$key]['max']) $value = $pref_limits[$key]['max'];
+		}
+		else
+		{
+		  $value = $pref_limits[$key]['default'];
+		} 
+	    $pref[$key] = $value;
+	  }
+	  else
+	  {
+	    $pref[$key] = $tp->toDB($value);
+	  }
 	}
 
+
 	$e107cache->clear();
 	save_prefs();
 	$sql -> db_Select_gen("TRUNCATE ".MPREFIX."online");
@@ -130,36 +157,40 @@
 	<form method='post' action='".e_SELF."'>
 	<div id='main' style='text-align:center'>
 	<table style='width:100%' class='fborder'>
+	<colgroup>
+	  <col style='width:50%' />
+	  <col style='width:50%' />
+	</colgroup>
 	<tr>
 	<td class='fcaption' title='".PRFLAN_80."' style='text-align:left;' colspan='2'>".PRFLAN_1."</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_2."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_2."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<input class='tbox' type='text' name='sitename' size='50' value='".$pref['sitename']."' maxlength='100' />
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_3."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_3."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<input class='tbox' type='text' name='siteurl' size='50' value='".$pref['siteurl']."' maxlength='150' /><br />
 	".($pref['siteurl'] == SITEURL ? "" : "<br />( ".PRFLAN_159.": <b>".SITEURL."</b> )")."
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_134."<br /><span class='smalltext'>".PRFLAN_135."</span></td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_134."<br /><span class='smalltext'>".PRFLAN_135."</span></td>
+	<td style='text-align:right' class='forumheader3'>
 	<input type='radio' name='redirectsiteurl' value='1'".($pref['redirectsiteurl'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
 	<input type='radio' name='redirectsiteurl' value='0'".(!$pref['redirectsiteurl'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_4."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>";
+	<td class='forumheader3'>".PRFLAN_4."</td>
+	<td style='text-align:right' class='forumheader3'>";
 
     $param = "sitebutton,".e_IMAGE.",".SITEBUTTON.",81px,30px,";
     $text .= $tp->parseTemplate("{IMAGESELECTOR={$param}}");
@@ -169,57 +200,71 @@
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_5."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_5."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitetag' cols='59' rows='3'>".$pref['sitetag']."</textarea>
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_6."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_6."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitedescription' cols='59' rows='6'>".$pref['sitedescription']."</textarea>
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_7."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_7."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<input class='tbox' type='text' name='siteadmin' size='50' value='".SITEADMIN."' maxlength='100' />
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_8."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_8."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<input class='tbox' type='text' name='siteadminemail' size='50' value='".SITEADMINEMAIL."' maxlength='100' />
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_162."<br /><span class='smalltext'>".PRFLAN_163."</span></td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_174."<br /><span class='smalltext'>".PRFLAN_175."</span></td>
+	<td style='text-align:right' class='forumheader3'>
+	<input class='tbox' type='text' name='replyto_name' size='50' value='".$pref['replyto_name']."' maxlength='100' />
+	</td>
+	</tr>
+
+	<tr>
+	<td class='forumheader3'>".PRFLAN_176."<br /><span class='smalltext'>".PRFLAN_177."</span></td>
+	<td style='text-align:right' class='forumheader3'>
+	<input class='tbox' type='text' name='replyto_email' size='50' value='".$pref['replyto_email']."' maxlength='100' />
+	</td>
+	</tr>
+
+	<tr>
+	<td class='forumheader3'>".PRFLAN_162."<br /><span class='smalltext'>".PRFLAN_163."</span></td>
+	<td style='text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitecontactinfo' cols='59' rows='6'>".$pref['sitecontactinfo']."</textarea>
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_168."<br /><span class='smalltext'>".PRFLAN_169."</span></td>
-	<td style='width:50%; text-align:right' class='forumheader3'>".r_userclass("sitecontacts",$pref['sitecontacts'],"off","nobody main admin userclasses")."
+	<td class='forumheader3'>".PRFLAN_168."<br /><span class='smalltext'>".PRFLAN_169."</span></td>
+	<td style='text-align:right' class='forumheader3'>".r_userclass("sitecontacts",$pref['sitecontacts'],"off","nobody,main,admin,userclasses")."
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_164."<br /><span class='smalltext'>".PRFLAN_165."</span></td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_164."<br /><span class='smalltext'>".PRFLAN_165."</span></td>
+	<td style='text-align:right' class='forumheader3'>
 	<input type='radio' name='contact_emailcopy' value='1'".($pref['contact_emailcopy'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
 	<input type='radio' name='contact_emailcopy' value='0'".(!$pref['contact_emailcopy'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
 	</td>
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".PRFLAN_9."</td>
-	<td style='width:50%; text-align:right' class='forumheader3'>
+	<td class='forumheader3'>".PRFLAN_9."</td>
+	<td style='text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitedisclaimer' cols='59' rows='6'>".$pref['sitedisclaimer']."</textarea>
 	</td>
 	</tr>
@@ -261,7 +306,8 @@
 	</td>
 	</tr>
 	";
-if(function_exists("memory_get_usage")){
+if(function_exists("memory_get_usage"))
+{
 	$text .= "
 	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_137." </td>
@@ -484,7 +530,7 @@
 	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_155.":</td>
 	<td class='forumheader3' style='width:50%;text-align:right' >
-	".r_userclass('displayname_class',$pref['displayname_class'],'off','nobody, public, admin, classes')."
+	".r_userclass('displayname_class',$pref['displayname_class'],'off','nobody,public,admin,classes')."
 	<input class='button' type='submit' name='submit_resetdisplaynames' value='".PRFLAN_156."' />
 	</td>
 	</tr>
@@ -492,7 +538,14 @@
 	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_158.":</td>
 	<td class='forumheader3' style='width:50%;text-align:right' >
-	<input type='text' class='tbox' size='3' name='displayname_maxlength' value='".$pref['displayname_maxlength']."' />
+	<input type='text' class='tbox' size='3' name='displayname_maxlength' value='".varset($pref['displayname_maxlength'],15)."' />
+	</td>
+	</tr>
+
+	<tr>
+	<td style='width:50%' class='forumheader3'>".PRFLAN_172.":</td>
+	<td class='forumheader3' style='width:50%;text-align:right' >
+	<input type='text' class='tbox' size='3' name='loginname_maxlength' value='".varset($pref['loginname_maxlength'],30)."' />
 	</td>
 	</tr>
 
@@ -617,7 +670,7 @@
 	<tr>
 	<td class='forumheader3' style='width:50%;'>".PRFLAN_116.":  <div class='smalltext'>".PRFLAN_117."</div></td>
 	<td class='forumheader3' style='width:50%; text-align: right;'>
-	".r_userclass('post_html',$pref['post_html'],'off','nobody, public, member, admin, main, classes')."
+	".r_userclass('post_html',$pref['post_html'],'off','nobody,public,member,admin,main,classes')."
 	</td>
 	</tr>\n
 
@@ -640,7 +693,7 @@
 	<tr>
 	<td class='forumheader3' style='width:50%;'>".PRFLAN_131.":  <div class='smalltext'>".PRFLAN_132."</div></td>
 	<td class='forumheader3' style='width:50%; text-align: right;'>
-	".r_userclass('php_bbcode',$pref['php_bbcode'],'off','nobody, admin, classes')."
+	".r_userclass('php_bbcode',$pref['php_bbcode'],'off','nobody,admin,classes')."
 	</td>
 	</tr>\n
 
@@ -926,6 +979,14 @@
 	<td style='width:50%; text-align:right' class='forumheader3'>{$auth_dropdown}</td>
 	</tr>
 
+	<tr>
+	<td style='width:50%' class='forumheader3'>".PRFLAN_173."<br /><span class='smalltext'>&nbsp;</span></td>
+	<td style='width:50%; text-align:right' class='forumheader3'>
+	<input type='radio' name='check_updates' value='1'".($pref['check_updates'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
+	<input type='radio' name='check_updates' value='0'".(!$pref['check_updates'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
+	</td>
+	</tr>
+
 	";
 
 $text .= pref_submit();
diff -x .svn -ruN 0.7.7.src/e107_admin/sql/extended_country.php 0.7.11.src/e107_admin/sql/extended_country.php
--- 0.7.7.src/e107_admin/sql/extended_country.php	2006-04-29 01:45:38.000000000 -0500
+++ 0.7.11.src/e107_admin/sql/extended_country.php	2007-07-18 15:08:28.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/sql/extended_country.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/04/29 06:45:38 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2007/07/18 20:08:28 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 header("location:../index.php");
@@ -179,7 +179,7 @@
 INSERT INTO user_extended_country VALUES('NIU', 'Niue', 'Oceania', 'Polynesia', 'NU');
 INSERT INTO user_extended_country VALUES('NFK', 'Norfolk Island', 'Oceania', 'Australia and New Zealand', 'NF');
 INSERT INTO user_extended_country VALUES('NOR', 'Norway', 'Europe', 'Nordic Countries', 'NO');
-INSERT INTO user_extended_country VALUES('CIV', 'CÃ´te dâ€™Ivoire', 'Africa', 'Western Africa', 'CI');
+INSERT INTO user_extended_country VALUES('CIV', 'Côte d\'Ivoire', 'Africa', 'Western Africa', 'CI');
 INSERT INTO user_extended_country VALUES('OMN', 'Oman', 'Asia', 'Middle East', 'OM');
 INSERT INTO user_extended_country VALUES('PAK', 'Pakistan', 'Asia', 'Southern and Central Asia', 'PK');
 INSERT INTO user_extended_country VALUES('PLW', 'Palau', 'Oceania', 'Micronesia', 'PW');
@@ -197,7 +197,7 @@
 INSERT INTO user_extended_country VALUES('FRA', 'France', 'Europe', 'Western Europe', 'FR');
 INSERT INTO user_extended_country VALUES('GUF', 'French Guiana', 'South America', 'South America', 'GF');
 INSERT INTO user_extended_country VALUES('PYF', 'French Polynesia', 'Oceania', 'Polynesia', 'PF');
-INSERT INTO user_extended_country VALUES('REU', 'RÃ©union', 'Africa', 'Eastern Africa', 'RE');
+INSERT INTO user_extended_country VALUES('REU', 'Réunion', 'Africa', 'Eastern Africa', 'RE');
 INSERT INTO user_extended_country VALUES('ROM', 'Romania', 'Europe', 'Eastern Europe', 'RO');
 INSERT INTO user_extended_country VALUES('RWA', 'Rwanda', 'Africa', 'Eastern Africa', 'RW');
 INSERT INTO user_extended_country VALUES('SWE', 'Sweden', 'Europe', 'Nordic Countries', 'SE');
diff -x .svn -ruN 0.7.7.src/e107_admin/update_routines.php 0.7.11.src/e107_admin/update_routines.php
--- 0.7.7.src/e107_admin/update_routines.php	2006-11-17 12:17:38.000000000 -0600
+++ 0.7.11.src/e107_admin/update_routines.php	2007-06-11 14:27:34.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/update_routines.php,v $
-|     $Revision: 1.192 $
-|     $Date: 2006/11/17 18:17:38 $
-|     $Author: sweetas $
+|     $Revision: 1.194 $
+|     $Date: 2007/06/11 19:27:34 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -40,13 +40,43 @@
 if (!defined("LAN_UPDATE_8")) { define("LAN_UPDATE_8", ""); }
 if (!defined("LAN_UPDATE_9")) { define("LAN_UPDATE_9", ""); }
 
+
+
+$dbupdate = array();
+
+global $e107cache;
+	if (is_readable(e_ADMIN."ver.php"))
+	{
+		include(e_ADMIN."ver.php");
+	}
+
+
+// If $dont_check_update is both defined and TRUE on entry, a check for update is done only once per 24 hours.
+$dont_check_update = varset($dont_check_update, FALSE);
+
+
+if ($dont_check_update === TRUE)
+{
+  $dont_check_update = FALSE;
+  if ($tempData = $e107cache->retrieve("nq_admin_updatecheck",3600, TRUE))
+  {	// See when we last checked for an admin update
+    list($last_time, $dont_check_update,$last_ver) = explode(',',$tempData);
+	if ($last_ver != $e107info['e107_version']) 
+	{
+	  $dont_check_update = FALSE;	// Do proper check on version change
+	}
+  }
+}
+
+if (!$dont_check_update)
+{ 
 if($sql->db_Select("plugin", "plugin_version", "plugin_path = 'forum' AND plugin_installflag='1' ")) {
 	if(file_exists(e_PLUGIN.'forum/forum_update_check.php'))
 	{
 		include_once(e_PLUGIN.'forum/forum_update_check.php');
 	}
 }
-if ($sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."stat_info") && $sql -> db_Select("plugin", "*", "plugin_path = 'log' AND plugin_installflag='1'")) {
+if (mysql_table_exists("stat_info") && $sql -> db_Select("plugin", "*", "plugin_path = 'log' AND plugin_installflag='1'")) {
 	if(file_exists(e_PLUGIN.'log/log_update_check.php'))
 	{
 		include_once(e_PLUGIN.'log/log_update_check.php');
@@ -79,8 +109,17 @@
 $dbupdate["611_to_612"] = LAN_UPDATE_8." .611 ".LAN_UPDATE_9." .612";
 $dbupdate["603_to_604"] = LAN_UPDATE_8." .603 ".LAN_UPDATE_9." .604";
 
-function update_check() {
-	global $ns, $dbupdate, $dbupdatep;
+}
+
+function update_check() 
+{
+  global $ns, $dont_check_update, $e107info;
+  
+  $update_needed = FALSE;
+  
+  if ($dont_check_update === FALSE)
+  {
+	global $dbupdate, $dbupdatep, $e107cache;
 	foreach($dbupdate as $func => $rmks) {
 		if (function_exists("update_".$func)) {
 			if (!call_user_func("update_".$func, FALSE)) {
@@ -98,6 +137,13 @@
 			}
 		}
 	}
+  	$e107cache->set("nq_admin_updatecheck", time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE);
+  }
+  else  
+  {
+    $update_needed = ($dont_check_update == '2');
+  }
+
 
 	if ($update_needed === TRUE) {
 		$txt = "<div style='text-align:center;'>".ADLAN_120;
@@ -106,7 +152,11 @@
 		</form></div>";
 		$ns->tablerender(LAN_UPDATE, $txt);
 	}
-}
+}		// Function update_check
+
+
+
+
 /*
 // ------------------------------- .7.1 to .7.2 etc ----------------------------------
 function update_701_to_702($type='') {
@@ -429,7 +479,7 @@
 
 
 		// start links update -------------------------------------------------------------------------------------------
-			if ($sql->db_Query("SHOW COLUMNS FROM ".MPREFIX."link_category")) {
+			if (mysql_table_exists("link_category")) {
 				global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY;
 
 				$sql->db_Select_gen("CREATE TABLE ".MPREFIX."links_page_cat (
@@ -1189,7 +1239,7 @@
 				$ue->convert_old_fields();
 			}
 
-			if ($sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."links_page_cat")) {
+			if (mysql_table_exists("links_page_cat") && $sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."links_page_cat")) {
 				while ($row = $sql -> db_Fetch()) {
 					if ($row['Field'] == 'link_category_order' && strpos($row['Type'], 'int') === FALSE) {
 						mysql_query("ALTER TABLE `".MPREFIX."links_page_cat` CHANGE `link_category_order` `link_category_order` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL;");
@@ -1269,7 +1319,7 @@
 			mysql_query("ALTER TABLE `".MPREFIX."news` CHANGE `news_thumbnail` `news_thumbnail` TEXT NOT NULL;");
 
 			// Add forum indexes, remove any extras
-			if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."forum_t"))
+			if (mysql_table_exists('forum_t') && $sql -> db_Query("SHOW INDEX FROM ".MPREFIX."forum_t"))
 			{
 				$a = array("PRIMARY", "thread_id", "thread_parent", "thread_datestamp", "thread_forum_id");
 				while ($row = $sql -> db_Fetch())
@@ -1372,7 +1422,7 @@
 
 		// Check if update is needed to 0.7. -----------------------------------------------
 		global $pref;
-		if (!$sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."user_extended")) {
+		if (!mysql_table_exists("user_extended")) {
 			return update_needed();
 		}
 
@@ -1388,7 +1438,7 @@
 			return update_needed();
 		}
 
-		if ($sql->db_Query("SHOW INDEX FROM ".MPREFIX."forum_t"))
+		if (mysql_table_exists('forum_t') && $sql->db_Query("SHOW INDEX FROM ".MPREFIX."forum_t"))
 		{
 			$a = array("PRIMARY", "thread_parent", "thread_datestamp", "thread_forum_id");
 			while ($row = $sql->db_Fetch())
@@ -1405,7 +1455,7 @@
 			}
 		}
 
-		if ($sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."news")) {
+		if (mysql_table_exists('news') && $sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."news")) {
 			while ($row = $sql -> db_Fetch()) {
 				if ($row['Field'] == 'news_thumbnail' && strpos($row['Null'], 'YES') !== FALSE) {
 					return update_needed();
@@ -1413,7 +1463,7 @@
 			}
 		}
 
-		if ($sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."links_page_cat")) {
+		if (mysql_table_exists('links_page_cat') && $sql -> db_Query("SHOW COLUMNS FROM ".MPREFIX."links_page_cat")) {
 			while ($row = $sql -> db_Fetch()) {
 				if ($row['Field'] == 'link_category_order' && strpos($row['Type'], 'int') === FALSE) {
 					return update_needed();
@@ -1501,7 +1551,7 @@
 		 	return update_needed();
 		}
 
-		if($sql->db_Select("links_page") && $sql->db_Field("links_page",11) != "link_author"){
+		if(mysql_table_exists("links_page") && $sql->db_Field("links_page",11) != "link_author"){
 		  	return update_needed();
 		}
 
@@ -1612,7 +1662,7 @@
 		mysql_query("ALTER TABLE ".MPREFIX."content ADD content_pe_icon TINYINT( 1 ) UNSIGNED NOT NULL AFTER content_review_score");
 		} else {
    		global $mySQLdefaultdb;
-		if ($sql->db_Query("SHOW COLUMNS FROM ".MPREFIX."link_category")) {
+		if (mysql_table_exists("link_category")) {
 			$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."link_category");
 			$columns = mysql_num_fields($fields);
 			for ($i = 0; $i < $columns; $i++) {
diff -x .svn -ruN 0.7.7.src/e107_admin/upload.php 0.7.11.src/e107_admin/upload.php
--- 0.7.7.src/e107_admin/upload.php	2006-02-20 13:29:52.000000000 -0600
+++ 0.7.11.src/e107_admin/upload.php	2007-09-22 07:40:14.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/upload.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/02/20 19:29:52 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2007/09/22 12:40:14 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -220,7 +220,7 @@
 
 	$activeUploads = $sql -> db_getList();
 
-	$text .= UPLLAN_20." ".($active_uploads == 1 ? UPLAN_IS : UPLAN_ARE).$active_uploads." ".UPLLAN_21.($active_uploads == 1 ? "" : "s")." ...";
+	$text .= UPLLAN_20." ".($active_uploads == 1 ? UPLAN_IS : UPLAN_ARE).$active_uploads." ".($active_uploads == 1 ? UPLLAN_21 : UPLLAN_27)." ...";
 
 	$text .= "</td></tr>";
 
@@ -276,7 +276,7 @@
 
 	<tr>
 	<td style='width:70%' class='forumheader3'>".UPLLAN_33."<br />
-	<span class='smalltext'>".UPLLAN_34." ".ini_get('upload_max_filesize')." )</span></td>
+	<span class='smalltext'>".UPLLAN_34." (upload_max_filesize = ".ini_get('upload_max_filesize').", post_max_size = ".ini_get('post_max_size')." )</span></td>
 	<td style='width:30%' class='forumheader3'>". $rs->form_text("upload_maxfilesize", 10, $pref['upload_maxfilesize'], 10)."
 	</td>
 	</tr>
diff -x .svn -ruN 0.7.7.src/e107_admin/userclass2.php 0.7.11.src/e107_admin/userclass2.php
--- 0.7.7.src/e107_admin/userclass2.php	2006-10-24 08:34:38.000000000 -0500
+++ 0.7.11.src/e107_admin/userclass2.php	2006-12-24 07:27:24.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/userclass2.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/10/24 13:34:38 $
+|     $Revision: 1.22 $
+|     $Date: 2006/12/24 13:27:24 $
 |     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
@@ -294,8 +294,8 @@
 		</td></tr>
 		<tr><td colspan='2' style='text-align:center' class='forumheader'>
 		<input class='button' type='button' value='".UCSLAN_19." ".$userclass_name." ".UCSLAN_20."' onclick='saveMe($userclass_id);' />
-		</tr>
 		</td>
+		</tr>
 		</table>";
 
 }
@@ -303,6 +303,45 @@
 $text .= "</form>
 	</div>";
 
+//
+// Show a table of all userclasses and who can manage them
+//
+// lazy get list again
+$class_total = $sql->db_Select("userclass_classes", "*", "ORDER BY userclass_name", "nowhere");
+
+$text .= "<br /><div style='text-align:center'>
+	<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr>
+	<td class='fcaption'>".UCSLAN_12."</td>
+	<td class='fcaption'>".UCSLAN_24."</td>
+	<td class='fcaption'>".UCSLAN_13."</td>
+	</tr>\n";
+	
+if ($class_total == "0")
+{
+	$text .= "<tr><td colspan='3'>".UCSLAN_7."</td></tr>";
+}
+else
+{
+	while ($row = $sql->db_Fetch())
+	{
+		$rEditClass = $row['userclass_editclass'];
+		if (check_class($rEditClass) || getperms("0"))
+		{
+			if(!isset($rEditClass))
+			{
+				$rEditClass = e_UC_ADMIN;
+			}
+
+			$text .= "<tr>
+			<td class='forumheader3'>{$row['userclass_name']}</td>
+			<td class='forumheader3'>".r_userclass_name($rEditClass)."</td>
+			<td class='forumheader3'>{$row['userclass_description']}</td>\n";
+		}
+	}
+}
+$text .="</table>";
+
 $ns->tablerender(UCSLAN_21, $text);
 
 require_once("footer.php");
diff -x .svn -ruN 0.7.7.src/e107_admin/users.php 0.7.11.src/e107_admin/users.php
--- 0.7.7.src/e107_admin/users.php	2006-11-28 12:16:36.000000000 -0600
+++ 0.7.11.src/e107_admin/users.php	2007-11-01 17:01:29.000000000 -0500
@@ -11,33 +11,41 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users.php,v $
-|     $Revision: 1.88 $
-|     $Date: 2006/11/28 18:16:36 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.92 $
+|     $Date: 2007/11/01 22:01:29 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
 
-if (!getperms("4")) {
-	header("location:".e_BASE."index.php");
-	 exit;
+if (!getperms("4")) 
+{
+  header("location:".e_BASE."index.php");
+  exit;
 }
 
-if (isset($_POST['useraction']) && $_POST['useraction'] == 'userinfo') {
+
+if (isset($_POST['useraction']) && $_POST['useraction'] == 'userinfo') 
+{
 	header('location:'.e_ADMIN."userinfo.php?".$tp -> toDB($_POST['userip']));
 	exit;
 }
 
-if (isset($_POST['useraction']) && $_POST['useraction'] == 'usersettings') {
+
+if (isset($_POST['useraction']) && $_POST['useraction'] == 'usersettings') 
+{
 	header('location:'.e_BASE."usersettings.php?".$tp -> toDB($_POST['userid']));
 	exit;
 }
 
-if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass') {
+
+if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass') 
+{
 	header('location:'.e_ADMIN."userclass.php?".$tp -> toDB($_POST['userid'].".".e_QUERY));
 	exit;
 }
 
+
 $e_sub_cat = 'users';
 $user = new users;
 require_once("auth.php");
@@ -61,28 +69,39 @@
 
 
 // ------- Check for Bounces --------------
-if(isset($_POST['check_bounces'])){
-	$user->check_bounces();
+$bounce_act = '';
+if (isset($_POST['check_bounces'])) $bounce_act = 'first_check';
+if (isset($_POST['delnonbouncesubmit'])) $bounce_act = 'delnonbounce';
+if (isset($_POST['clearemailbouncesubmit'])) $bounce_act = 'clearemailbounce';
+if (isset($_POST['delcheckedsubmit'])) $bounce_act = 'delchecked';
+if (isset($_POST['delallsubmit'])) $bounce_act = 'delall';
+if ($bounce_act)
+{
+	$user->check_bounces($bounce_act, implode(',',$_POST['delete_email']));
 	require_once("footer.php");
 	exit;
 }
 
 
-// ------- Resend Email. --------------
-if (isset($_POST['resend_mail'])) {
 
-	$user->resend($_POST['resend_id'],$_POST['resend_key'],$_POST['resend_name'],$_POST['resend_email']);
 
+// ------- Resend Email. --------------
+if (isset($_POST['resend_mail'])) 
+{
+	$user->resend($_POST['resend_id'],$_POST['resend_key'],$_POST['resend_name'],$_POST['resend_email']);
 }
+
 // ------- Resend Email. --------------
-if(isset($_POST['resend_to_all'])){
+if(isset($_POST['resend_to_all']))
+{
 	$user->resend_to_all();
 }
 
 
 
 // ------- Test Email. --------------
-if (isset($_POST['test_mail'])) {
+if (isset($_POST['test_mail'])) 
+{
 	require_once(e_HANDLER."mail_validation_class.php");
 	list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL);
 	$validator = new email_validation_class;
@@ -113,8 +132,11 @@
 	$ns->tablerender($caption, $text);
 	unset($id, $action, $sub_cation);
 }
+
+
 // ------- Update Options. --------------
-if (isset($_POST['update_options'])) {
+if (isset($_POST['update_options'])) 
+{
 	$pref['avatar_upload'] = (FILE_UPLOADS ? $_POST['avatar_upload'] : 0);
 	$pref['im_width'] = $_POST['im_width'];
 	$pref['im_height'] = $_POST['im_height'];
@@ -128,8 +150,11 @@
 	save_prefs();
 	$user->show_message(USRLAN_1);
 }
+
+
 // ------- Prune Users. --------------
-if (isset($_POST['prune'])) {
+if (isset($_POST['prune'])) 
+{
 	$e107cache->clear("online_menu_totals");
 	$text = USRLAN_56." ";
 	$bantype = $_POST['prune_type'];
@@ -146,6 +171,8 @@
 	$ns->tablerender(USRLAN_57, "<div style='text-align:center'><b>".$text."</b></div>");
 	unset($text);
 }
+
+
 // ------- Quick Add User --------------
 if (isset($_POST['adduser'])) {
 	$e107cache->clear("online_menu_totals");
@@ -200,13 +227,27 @@
 	}
 }
 
+
+// ------- Bounce --> Unverified --------------
+if (isset($_POST['useraction']) && $_POST['useraction'] == "reqverify") 
+{
+	$sql->db_Select("user", "*", "user_id='".$_POST['userid']."'");
+	$row = $sql->db_Fetch();
+	extract($row);
+	$sql->db_Update("user", "user_ban='2' WHERE user_id='".$_POST['userid']."' ");
+	$user->show_message("User now has to verify");
+	$action = "main";
+	if(!$sub_action) {$sub_action = "user_id"; }
+}
+
+
+
 // ------- Ban User. --------------
 if (isset($_POST['useraction']) && $_POST['useraction'] == "ban")
 {
   //	$sub_action = $_POST['userid'];
 	$sql->db_Select("user", "*", "user_id='".$_POST['userid']."'");
 	$row = $sql->db_Fetch();
-//	 extract($row);
 	if ($row['user_perms'] == "0")
 	{
 		$user->show_message(USRLAN_7);
@@ -237,6 +278,8 @@
 	$action = "main";
 	if(!$sub_action){$sub_action = "user_id"; }
 }
+
+
 // ------- Unban User --------------
 if (isset($_POST['useraction']) && $_POST['useraction'] == "unban") {
 	$sql->db_Select("user", "*", "user_id='".$_POST['userid']."'");
@@ -287,7 +330,7 @@
 // ------- Delete User --------------
 if (isset($_POST['useraction']) && $_POST['useraction'] == 'deluser') {
 	if ($_POST['confirm']) {
-		if ($sql->db_Delete("user", "user_id='".$_POST['userid']."' AND user_perms != '0'")) {
+		if ($sql->db_Delete("user", "user_id='".$_POST['userid']."' AND user_perms != '0' AND user_perms != '0.'")) {
 		   $sql->db_Delete("user_extended", "user_extended_id='".$_POST['userid']."' ");
 			$user->show_message(USRLAN_10);
 		}
@@ -422,21 +465,29 @@
 
 require_once("footer.php");
 
-class users{
 
-	function show_existing_users($action, $sub_action, $id, $from, $amount) {
-		// ##### Display scrolling list of existing news items ---------------------------------------------------------------------------------------------------------
 
+
+
+class users
+{
+
+	function show_existing_users($action, $sub_action, $id, $from, $amount) 
+	{
 		global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref,$unverified;
 		// save the display choices.
-		if(isset($_POST['searchdisp'])){
+		if(isset($_POST['searchdisp']))
+		{
 			$pref['admin_user_disp'] = implode("|",$_POST['searchdisp']);
 			save_prefs();
 		}
 
-		if(!$pref['admin_user_disp']){
+		if(!$pref['admin_user_disp'])
+		{
 			$search_display = array("user_name","user_class");
-		}else{
+		}
+		else
+		{
 			$search_display = explode("|",$pref['admin_user_disp']);
 		}
 
@@ -625,37 +676,53 @@
 					<select name='useraction' onchange='this.form.submit()' class='tbox' style='width:75%'>
 					<option selected='selected' value=''>&nbsp;</option>";
 
-				if ($user_perms != "0") {
+				if ($user_perms != "0") 
+				{
 					$text .= "<option value='userinfo'>".USRLAN_80."</option>
 						<option value='usersettings'>".LAN_EDIT."</option>";
-
-					if ($user_ban == 1) {
-						$text .= "<option value='unban'>".USRLAN_33."</option>\n";
-					}
-					else if($user_ban == 2) {
-						$text .= "<option value='ban'>".USRLAN_30."</option>
+				  switch ($user_ban)
+				  {
+					case 0 : 
+						$text .= "<option value='ban'>".USRLAN_30."</option>\n";
+					  break;
+				    case 1 :		// Banned user
+					  $text .= "<option value='unban'>".USRLAN_33."</option>\n";
+					  break;
+				    case 2 :		// Unverified
+					  $text .= "<option value='ban'>".USRLAN_30."</option>
 							<option value='verify'>".USRLAN_32."</option>
 							<option value='resend'>".USRLAN_112."</option>
 							<option value='test'>".USRLAN_118."</option>";
-					} else {
-						$text .= "<option value='ban'>".USRLAN_30."</option>\n";
-					}
-
-					if (!$user_admin && !$user_ban && $user_ban != 2 && getperms('3')) {
+					  break;
+				    case 3 :		// Bounced
+					  $text .= "<option value='ban'>".USRLAN_30."</option>
+							<option value='reqverify'>".USRLAN_151."</option>
+							<option value='verify'>".USRLAN_152."</option>
+							<option value='test'>".USRLAN_118."</option>";
+					  break;
+					default :
+				  }
+					if (!$user_admin && !$user_ban && $user_ban != 2 && getperms('3')) 
+					{
 						$text .= "<option value='admin'>".USRLAN_35."</option>\n";
 					}
-					else if ($user_admin && $user_perms != "0" && getperms('3')) {
+					else if ($user_admin && $user_perms != "0" && getperms('3')) 
+					{
 						$text .= "<option value='unadmin'>".USRLAN_34."</option>\n";
 					}
 
 				}
-				if ($user_perms == "0" && !getperms("0")) {
+				if ($user_perms == "0" && !getperms("0")) 
+				{
 					$text .= "";
-				} elseif($user_id != USERID || getperms("0") ) {
+				} 
+				elseif($user_id != USERID || getperms("0") ) 
+				{
 					$text .= "<option value='userclass'>".USRLAN_36."</option>\n";
 				}
 
-				if ($user_perms != "0") {
+				if ($user_perms != "0") 
+				{
 					$text .= "<option value='deluser'>".LAN_DELETE."</option>\n";
 				}
 				$text .= "</select></div>";
@@ -735,11 +802,12 @@
 	function show_options($action) {
 
 		global $unverified;
-		// ##### Display options ---------------------------------------------------------------------------------------------------------
-		if ($action == "") {
+		// ##### Display options 
+		if ($action == "") 
+		{
 			$action = "main";
 		}
-		// ##### Display options ---------------------------------------------------------------------------------------------------------
+		// ##### Display options 
 		$var['main']['text'] = USRLAN_71;
 		$var['main']['link'] = e_SELF;
 
@@ -969,19 +1037,22 @@
 		}
 
 
-		define("RETURNADDRESS", (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$id.".".$key : SITEURL."/signup.php?activate.".$id.".".$key));
+		$return_address = (substr(SITEURL, -1) == "/") ? SITEURL."signup.php?activate.".$id.".".$key : SITEURL."/signup.php?activate.".$id.".".$key;
 
 		$message = LAN_EMAIL_01." ".$name."\n\n".LAN_SIGNUP_24." ".SITENAME.".\n".LAN_SIGNUP_21."...\n\n";
-		$message .= RETURNADDRESS . "\n\n".SITENAME."\n".SITEURL;
+		$message .= $return_address . "\n\n".SITENAME."\n".SITEURL;
 
         $mailheader_e107id = $id;
 
 		require_once(e_HANDLER."mail.php");
-	  	if(sendemail($email, LAN_404." ".SITENAME, $message)){
+	  	if(sendemail($email, LAN_404." ".SITENAME, $message))
+		{
 	   //		echo str_replace("\n","<br>",$message);
-			$this->show_message(USRLAN_140.": <a href='mailto:".$email."?body=".RETURNADDRESS."' title=\"".DUSRLAN_7."\" >".$name."</a> (".$row['user_language'].") ");
-	  	}else{
-    		$this->show_message(USRLAN_141.": ".$name);
+		  $this->show_message(USRLAN_140.": <a href='mailto:".$email."?body=".$return_address."' title=\"".DUSRLAN_7."\" >".$name."</a> (".$row['user_language'].") ");
+	  	}
+		else
+		{
+    	  $this->show_message(USRLAN_141.": ".$name);
 	  	}
 
 	}
@@ -1016,47 +1087,152 @@
 			}
 	}
 
+
+
 // ---------------------------------------------------------------------
+//		Bounce handling
+// ---------------------------------------------------------------------
+// $bounce_act has the task to perform:
+//	'first_check' - initial read of list of bounces
+//	'delnonbounce' - delete any emails that aren't bounces
+//  'clearemailbounce' - delete email address for any user whose emails bounced
+//	'delchecked' - delete the emails whose comma-separated IDs are in $bounce_arr
+//	'delall' - delete all bounced emails
+
+    function check_bounces($bounce_act='first_check', $bounce_arr = '')
+	{
+	  global $sql,$pref;
+      include(e_HANDLER."pop3_class.php");
 
-    function check_bounces(){
-		global $sql,$pref;
-        include(e_HANDLER."pop3_class.php");
+	  if (!trim($bounce_act)) $bounce_act='first_check';
 
-		$obj= new receiveMail($pref['mail_bounce_user'],$pref['mail_bounce_pass'],$pref['mail_bounce_email'],$pref['mail_bounce_pop3'],'pop3','110');
+//	  echo "Check bounces. Action: {$bounce_act}; Entries: {$bounce_arr}<br />";
+
+	  $obj= new receiveMail($pref['mail_bounce_user'],$pref['mail_bounce_pass'],$pref['mail_bounce_email'],$pref['mail_bounce_pop3'],'pop3','110');
+	  $del_count = 0;
+	  if ($bounce_act !='first_check')
+	  { // Must do some deleting
 		$obj->connect();
 		$tot=$obj->getTotalMails();
-        $found = FALSE;
-		$DEL = ($pref['mail_bounce_delete']) ? TRUE : FALSE;
-        $text = "<br /><div><table class='fborder' style='".ADMIN_WIDTH."'>
-		<tr><td class='fcaption' style='width:5%'>#</td><td class='fcaption'>e107-id</td><td class='fcaption'>email</td><td class='fcaption'>Subject</td><td class='fcaption'>Bounce</td></tr>\n";
-		for($i=1;$i<=$tot;$i++)	{
-			 $head=$obj->getHeaders($i);
-
-            if($head['bounce']){
-		   		if (ereg('.*X-e107-id:(.*)MIME', $obj->getBody($i), $result)){
-					if($result[1]){
-						$id[$i] = intval($result[1]);
-						$found = TRUE;
+		$del_array = explode(',',$bounce_arr);
+		for($i=1;$i<=$tot;$i++)	
+		{	// Scan all emails; delete current one if meets the criteria
+		    $dodel = FALSE;
+		    switch ($bounce_act)
+			{
+			  case 'delnonbounce' :
+				$head=$obj->getHeaders($i);
+				$dodel = (!$head['bounce']);
+			    break;
+			  case 'clearemailbounce' :
+				if (!in_array($i, $del_array)) break;
+				$head=$obj->getHeaders($i);
+				if($head['bounce'])
+				{
+				  if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)) $usr_email = trim($result[0]);
+				  if ($sql->db_Select('user','user_id, user_name, user_email',"user_email='".$usr_email."' "))
+				  {
+				    $row = $sql->db_Fetch();
+				    if ($sql->db_Update('user',"`user_email`='' WHERE `user_id` = '".$row['user_id']."' ") !== FALSE)
+					{
+//					  echo "Deleting user email {$row['user_email']} for user {$row['user_name']}, id={$row['user_id']}<br />";
+					  $dodel = TRUE;
 					}
+				  }
+				}
+			    break;
+			  case 'delall' :
+			    $dodel = TRUE;
+				break;
+			  case 'delchecked' :
+			    $dodel = in_array($i, $del_array);
+			    break;
+			}
+			if ($dodel)
+			{
+//			  echo "Delete email ID {$i}<br />";
+			  $obj->deleteMails($i);
+			  $del_count++;			// Keep track of number of emails deleted
+			}
+		}	// End - Delete one email
+		$obj->close_mailbox();	// This actually deletes the emails
+	  }		// End of email deletion
 
-        		}elseif(preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)){
-                	if($result[0] && $result[0] != $pref['mail_bounce_email']){
-						$emails[$i] = "'".$result[0]."'";
-						$found = TRUE;
-					}elseif($result[1] && $result[1] != $pref['mail_bounce_email']){
-                    	$emails[$i] = "'".$result[1]."'";
-						$found = TRUE;
-					}
 
-				}
-				 	if($DEL && $found){ $obj->deleteMails($i); }
+	// Now list the emails that are left
+	  $obj->connect();
+	  $tot=$obj->getTotalMails();
+      $found = FALSE;
+	  $DEL = ($pref['mail_bounce_delete']) ? TRUE : FALSE;
+	  
+      $text = "<br /><div><form  method='post' action='".e_SELF.$qry."'><table class='fborder' style='".ADMIN_WIDTH."'>
+		<tr><td class='fcaption' style='width:5%'>#</td><td class='fcaption'>e107-id</td><td class='fcaption'>email</td><td class='fcaption'>Subject</td><td class='fcaption'>Bounce</td></tr>\n";
 
+
+		
+	  for($i=1;$i<=$tot;$i++)	
+	  {
+		$head=$obj->getHeaders($i);
+        if($head['bounce'])
+		{	// Its a 'bounce' email
+		  if (ereg('.*X-e107-id:(.*)MIME', $obj->getBody($i), $result))
+		  {
+			if($result[1])
+			{
+			  $id[$i] = intval($result[1]);		// This should be a user ID - but not on special mailers!
+			  //	Try and pull out an email address from body - should be the one that failed
+			  if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result))
+			  {
+				$emails[$i] = "'".$result[0]."'";						
+			  }
+			  $found = TRUE;
+			}
+		  }
+		  elseif (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result))
+		  {
+            if($result[0] && $result[0] != $pref['mail_bounce_email'])
+			{
+			  $emails[$i] = "'".$result[0]."'";
+			  $found = TRUE;
+			}
+			elseif($result[1] && $result[1] != $pref['mail_bounce_email'])
+			{
+              $emails[$i] = "'".$result[1]."'";
+			  $found = TRUE;
 			}
+		  }
+		  if ($DEL && $found)
+		  { 	// Auto-delete bounced emails once noticed (if option set)
+		    $obj->deleteMails($i); 
+			$del_count++;
+		  }
+		}
+		else
+		{  // Its a warning message or similar
+//			  $id[$i] = '';			// Don't worry about an ID for now
+//				Try and pull out an email address from body - should be the one that failed
+		  if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result))
+		  {
+			$wmails[$i] = "'".$result[0]."'";						
+		  }
+		}
+		
+		$text .= "<tr><td class='forumheader3'>".$i."</td><td class='forumheader3'>".$id[$i]."</td><td class='forumheader3'>".(isset($emails[$i]) ? $emails[$i] : $wmails[$i])."</td><td class='forumheader3'>".$head['subject']."</td><td class='forumheader3'>".($head['bounce'] ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON);
+		$text .= "<input type='checkbox' name='delete_email[]' value='{$i}' /></td></tr>\n";
+	  }
 
-			$text .= "<tr><td class='forumheader3'>".$i."</td><td class='forumheader3'>".$id[$i]."</td><td class='forumheader3'>".$emails[$i]."</td><td class='forumheader3'>".$head['subject']."</td><td class='forumheader3'>".($head['bounce'] ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON)."</td></tr>";
 
-		}
-		$text .= "</table></div>";
+
+	  if ($tot)
+	  { // Option to delete emails - only if there are some in the list
+		  $text .= "</table><table style='".ADMIN_WIDTH."'><tr>
+			<td class='forumheader3' style='text-align: center;'><input class='button' type='submit' name='delnonbouncesubmit' value='".USRLAN_153."' /></td>\n
+			<td class='forumheader3' style='text-align: center;'><input class='button' type='submit' name='clearemailbouncesubmit' value='".USRLAN_154."' /></td>\n
+			<td class='forumheader3' style='text-align: center;'><input class='button' type='submit' name='delcheckedsubmit' value='".USRLAN_149."' /></td>\n
+			<td class='forumheader3' style='text-align: center;'><input class='button' type='submit' name='delallsubmit' value='".USRLAN_150."' /></td>\n
+			</td></tr>";
+	  }
+	  $text .= "</table></form></div>";
 
 		array_unique($id);
 		array_unique($emails);
@@ -1064,18 +1240,27 @@
         $all_ids = implode(",",$id);
 		$all_emails = implode(",",$emails);
 
-		$obj->close_mailbox();
-        $found = count($id) + count($emails);
-	  	if($ed = $sql -> db_Update("user", "user_ban=3 WHERE (user_id IN (".$all_ids.") OR user_email IN (".$all_emails.")) AND user_sess !='' ")){
-        	$this->show_message(LAN_UPDATED."<br >Found $tot, updated $ed / $found".$text);
-	  	}else{
-       		$this->show_message(LAN_UPDATED_FAILED."<br >Found $tot, not updated $ed / $found".$text);
-   	  	}
+		$obj->close_mailbox();					// This will actually delete emails
+
+												// $tot has total number of emails in the mailbox
+        $found = count($emails);				// $found - Number of bounce emails found
+												// $del_count has number of emails deleted
+
+
+		// Update bounce status for users
+	  	$ed = $sql -> db_Update("user", "user_ban=3 WHERE (`user_id` IN (".$all_ids.") OR `user_email` IN (".$all_emails.")) AND user_sess !='' ");
+		if (!$ed) $ed = '0';
+		$this->show_message(str_replace(array('{TOTAL}','{DELCOUNT}','{DELUSER}','{FOUND}'),
+										array($tot,$del_count,$ed,$found),USRLAN_155).$text);
 
 	}
 
-}
-function users_adminmenu() {
+}		// End class users
+
+
+
+function users_adminmenu() 
+{
 	global $user;
 	global $action;
 	$user->show_options($action);
diff -x .svn -ruN 0.7.7.src/e107_admin/users_extended.php 0.7.11.src/e107_admin/users_extended.php
--- 0.7.7.src/e107_admin/users_extended.php	2006-11-07 17:46:19.000000000 -0600
+++ 0.7.11.src/e107_admin/users_extended.php	2007-04-14 12:24:06.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users_extended.php,v $
-|     $Revision: 1.39 $
-|     $Date: 2006/11/07 23:46:19 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.44 $
+|     $Date: 2007/04/14 17:24:06 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -26,6 +26,11 @@
 	header("location:".e_SELF);
 	exit;
 }
+if (isset($_POST['cancel_cat']))
+{
+	header("location:".e_SELF."?cat");
+	exit;
+}
 
 $e_sub_cat = 'user_extended';
 $user = new users_ext;
@@ -91,20 +96,34 @@
 
 if (isset($_POST['add_field']))
 {
+  $ue_field_name = str_replace(' ','_',trim($_POST['user_field']));		// Replace space with underscore - better security
+  if (preg_match('#^\w+$#',$ue_field_name) === 1)						// Check for allowed characters, finite field length
+  {
 	if($_POST['user_type']==4)
 	{
     	$_POST['user_values'] = array($_POST['table_db'],$_POST['field_id'],$_POST['field_value'],$_POST['field_order']);
 	}
 	$new_values = make_delimited($_POST['user_values']);
 	$new_parms = $tp->toDB($_POST['user_include']."^,^".$_POST['user_regex']."^,^".$_POST['user_regexfail']."^,^".$_POST['user_hide']);
-	$result = admin_update($ue->user_extended_add($_POST['user_field'], $_POST['user_text'], $_POST['user_type'], $new_parms, $new_values, $_POST['user_default'], $_POST['user_required'], $_POST['user_read'], $_POST['user_write'], $_POST['user_applicable'], 0, $_POST['user_parent']), 'insert', EXTLAN_29);
-	if(!$result)
-	{
-		if($ue->user_extended_reserved($_POST['user_field']))
-		{
-			$message = "[user_".$tp->toHTML($_POST['user_field'])."] ".EXTLAN_74;
-		}
+	
+// Check to see if its a reserved field name before adding to database
+	if($ue->user_extended_reserved($ue_field_name))
+	{  // Reserved field name
+	  $message = "[user_".$tp->toHTML($ue_field_name)."] ".EXTLAN_74;
 	}
+	else
+	{
+	  $result = admin_update($ue->user_extended_add($ue_field_name, $_POST['user_text'], $_POST['user_type'], $new_parms, $new_values, $_POST['user_default'], $_POST['user_required'], $_POST['user_read'], $_POST['user_write'], $_POST['user_applicable'], 0, $_POST['user_parent']), 'insert', EXTLAN_29);
+	  if(!$result)
+	  {
+		$message = EXTLAN_75;
+	  }
+	}
+  }
+  else
+  {
+    $message = EXTLAN_76." : ".$tp->toHTML($ue_field_name);
+  }
 }
 
 if (isset($_POST['update_field'])) {
@@ -137,10 +156,15 @@
 	}
 }
 
+// Delete category
 if ($_POST['eu_action'] == "delcat")
 {
 	list($_id, $_name) = explode(",",$_POST['key']);
-	if($ue->user_extended_remove($_id, $_name))
+	if (count($ue->user_extended_get_fields($_id)) > 0)
+	{
+	  $message = EXTLAN_77;
+	}
+	elseif($ue->user_extended_remove($_id, $_name))
 	{
 		$message = EXTLAN_41;
 	}
@@ -626,6 +650,13 @@
 			$i=0;
 			foreach($catList as $ext)
 			{
+				if ($ext['user_extended_struct_order'] != $i)
+				{
+					$ext['user_extended_struct_order'] = $i;
+					$xID=$ext['user_extended_struct_id'];
+					$sql->db_Update("user_extended_struct", "user_extended_struct_order=$i WHERE user_extended_struct_type = 0 AND user_extended_struct_id=$xID");
+				}
+
 				$text .= "
 				<td class='forumheader3'>{$ext['user_extended_struct_name']}</td>
 				</td>
@@ -639,12 +670,12 @@
 				if($i > 0)
 				{
 					$text .= "
-					<input type='image' alt='' title='".EXTLAN_26."' src='".e_IMAGE."/admin_images/up.png' name='catup' value='{$ext['user_extended_struct_id']}' />
+					<input type='image' alt='' title='".EXTLAN_26."' src='".e_IMAGE."/admin_images/up.png' name='catup' value='{$ext['user_extended_struct_id']}.{$i}' />
 					";
 				}
 				if($i <= count($catList)-2)
 				{
-					$text .= "<input type='image' alt='' title='".EXTLAN_25."' src='".e_IMAGE."/admin_images/down.png' name='catdown' value='{$ext['user_extended_struct_id']}' />";
+					$text .= "<input type='image' alt='' title='".EXTLAN_25."' src='".e_IMAGE."/admin_images/down.png' name='catdown' value='{$ext['user_extended_struct_id']}.{$i}' />";
 				}
 				$text .= "
 				</form>
@@ -976,7 +1007,7 @@
 		var ftype;
 		var helptext;
 		";
-		for($i=0; $i<=7; $i++)
+		for($i=1; $i<=8; $i++)
 		{
 			$type_const = "UE_LAN_{$i}";
 			$help_const = "EXTLAN_HELP_{$i}";
diff -x .svn -ruN 0.7.7.src/e107_admin/users_extended_predefined.php 0.7.11.src/e107_admin/users_extended_predefined.php
--- 0.7.7.src/e107_admin/users_extended_predefined.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_admin/users_extended_predefined.php	2007-01-17 14:46:54.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users_extended_predefined.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2007/01/17 20:46:54 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -53,4 +53,5 @@
 	);
 
 	return $ue_field;
-}
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_admin/ver.php 0.7.11.src/e107_admin/ver.php
--- 0.7.7.src/e107_admin/ver.php	2006-11-29 20:17:01.000000000 -0600
+++ 0.7.11.src/e107_admin/ver.php	2008-01-01 09:49:40.000000000 -0600
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ver.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/11/30 02:17:01 $
+|     $Revision: 1.23 $
+|     $Date: 2008/01/01 15:49:40 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$e107info['e107_version'] = "0.7.7";
+$e107info['e107_version'] = "0.7.11";
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_config.php 0.7.11.src/e107_config.php
--- 0.7.7.src/e107_config.php	2006-11-30 08:54:40.000000000 -0600
+++ 0.7.11.src/e107_config.php	2008-01-18 14:52:28.000000000 -0600
@@ -1,26 +1,25 @@
 <?php
+
 /*
-+---------------------------------------------------------------+
-|        e107 website system
-|        /e107_config.php
++----------------------------------------------------+
+|   e107 website system
+|   e107_config.php
 |
-|        Steve Dunstan 2001-2002
-|        http://e107.org
-|        jalist@e107.org
+|   ©Steve Dunstan 2001-2002
+|   http://e107.org
+|   jalist@e107.org
 |
-|        Released under the terms and conditions of the
-|        GNU General Public License (http://gnu.org).
-+---------------------------------------------------------------+
-
+|   Released under the terms and conditions of the
+|   GNU General Public License (http://gnu.org).
++----------------------------------------------------+
 This file has been generated by the installation script.
-
 */
 
-$mySQLserver    = "[% mysql.e107.sqlhost %]";
-$mySQLuser      = "[% mysql.e107.sqluser %]";
-$mySQLpassword  = "[% mysql.e107.sqlpass %]";
-$mySQLdefaultdb = "[% mysql.e107.sqldb %]";
-$mySQLprefix    = "[% table_prefix %]_";
+$mySQLserver    = '[% mysql.e107.sqlhost %]';
+$mySQLuser      = '[% mysql.e107.sqluser %]';
+$mySQLpassword  = '[% mysql.e107.sqlpass %]';
+$mySQLdefaultdb = '[% mysql.e107.sqldb %]';
+$mySQLprefix    = '[% table_prefix %]_';
 
 $ADMIN_DIRECTORY     = "e107_admin/";
 $FILES_DIRECTORY     = "e107_files/";
@@ -31,4 +30,5 @@
 $LANGUAGES_DIRECTORY = "e107_languages/";
 $HELP_DIRECTORY      = "e107_docs/help/";
 $DOWNLOADS_DIRECTORY = "e107_files/downloads/";
+
 ?>
diff -x .svn -ruN 0.7.7.src/e107_docs/README.html 0.7.11.src/e107_docs/README.html
--- 0.7.7.src/e107_docs/README.html	2006-10-31 15:16:29.000000000 -0600
+++ 0.7.11.src/e107_docs/README.html	2007-02-03 11:52:02.000000000 -0600
@@ -4,9 +4,9 @@
 <!-- Version Info:
 
 $Source: /cvsroot/e107/e107_0.7/e107_docs/README.html,v $
-$Revision: 1.13 $
-$Date: 2006/10/31 21:16:29 $
-$Author: e107coders $
+$Revision: 1.14 $
+$Date: 2007/02/03 17:52:02 $
+$Author: e107steved $
 
 -->
 <title>e107 Readme</title>
@@ -18,14 +18,19 @@
 <div id='mainbox'> <a href="http://e107.org"><img src="../e107_images/logo.png" alt="Logo" style="border:0" /></a> <br />
   <br />
   <span class="smalltext">© Steve Dunstan 2002. See gpl.txt for license details.</span><br />
+  <hr />
   <br />
-  <br />
+  <a id='latest_info'></a><span class="headertext">Latest Information</span><br />  Please see the documentation at <a href="http://e107.org">e107.org</a> for the latest <a href="http://wiki.e107.org/?title=HOWTO:Install_e107">installation</a> and <a href="http://wiki.e107.org/?title=HOWTO:Upgrade_to_a_newer_version_of_e107_0.7xx">upgrade</a> documents. If you are upgrading from version 0.617 or earlier, there is a separate <a href="http://wiki.e107.org/?title=HOWTO:Upgrade_e107_from_0.6xx">upgrade guide</a>. The information on the web site supercedes any information in this file.
+  
+  There is also additional information on troubleshooting any problems which might arise, and on how to set up and use E107.
+  <br /><br />
+  <hr />
   <a href="#requirements">Requirements</a> | <a href="#installing">Installing</a> | <a href="#upgrading">Upgrading</a> | <a href="#security">Security</a> | <a href="#backup">Backing Up and Restoring Your Database</a> | <a href="#problems">Common Problems</a> | <a href="#support">Support</a> | <a href="#development">Development</a> | <a href="#thankyou">Thank You</a> | <a href="#disclaimer">Disclaimer</a><br />
   <br />
   <br />
   <a id='requirements'></a><span class="headertext">Requirements</span>
   <ul>
-    <li>e107 requires a webserver that has PHP 4.3 (or newer) and MySQL 3.22 (or newer), contact your host if you're not sure if you have these installed.</li>
+    <li>e107 requires a webserver that has PHP 4.3 (or newer) and MySQL 3.22 (or newer - 4.21 or newer preferred), contact your host if you're not sure if you have these installed.</li>
     <li>If you host your own site you can download <a href="http://php.net">PHP</a> and <a href="http://mysql.com">MySQL</a> and install them yourself, both are free.</li>
     <li>You will need your MySQL username and password, and a database for content storage. Don't worry if you only have one database, e107 is happy to share it's database with other applications.</li>
     <li>A complete e107 install requires approximately 9MB of disk space on your server, although this should be reduced dramatically for most users by removing the plugins and themes they won't be using, simply by removing the relevant folder.</li>
@@ -130,7 +135,7 @@
     </li>
     <li>Cut these lines from <span style="text-decoration: underline;">class2.php</span> and paste them into <span style="text-decoration: underline;">e107_config.php</span>. Now you can change the folder names from here.<br /><br /></li>
 
-    <li>If this is a <span style="text-decoration: underline;"><b>NEW INSTALL</b></span> the folder names are already in e107_config.php. They have been left in class2.php for backwards compatibility. They will be removed from there in the future.<br /><br /></li>
+    <li>If this is a <span style="text-decoration: underline;"><b>NEW INSTALL</b></span> the folder names are already in e107_config.php.<br /><br /></li>
 
     <li>This procedure depends on you completing the steps above and making sure the file paths are located in e107_config.php now.</li>
     <li>To rename your e107_admin directory (or any of your other directories), first rename the folder in the usual manner using your FTP client. Then open e107_config.php from the root directory of your e107 installation in a text editor, and find the following line near the top of the file ...<br />
@@ -155,7 +160,7 @@
     <li><b>e107 forums</b><br />
       <a href='http://e107.org/forum.php'>http://e107.org/forum.php</a></li>
     <li><b>e107 faq</b><br />
-      <a href='http://e107faq.bkwon.net'>http://e107faq.bkwon.net</a></li>
+      <a href='http://e107faq.bkwon.net'>http://e107faq.org</a></li>
     <li><b>IRC channel</b><br />
       #e107 on <a href='irc://freenode.net'>irc.freenode.net</a><br /></li>
 
diff -x .svn -ruN 0.7.7.src/e107_docs/README_UPGRADE.html 0.7.11.src/e107_docs/README_UPGRADE.html
--- 0.7.7.src/e107_docs/README_UPGRADE.html	2006-10-31 15:16:29.000000000 -0600
+++ 0.7.11.src/e107_docs/README_UPGRADE.html	2007-02-03 11:52:02.000000000 -0600
@@ -4,9 +4,9 @@
 <!-- Version Info:
 
 $Source: /cvsroot/e107/e107_0.7/e107_docs/README_UPGRADE.html,v $
-$Revision: 1.5 $
-$Date: 2006/10/31 21:16:29 $
-$Author: e107coders $
+$Revision: 1.6 $
+$Date: 2007/02/03 17:52:02 $
+$Author: e107steved $
 
 -->
 <title>e107 Readme</title>
@@ -18,14 +18,20 @@
 <div id='mainbox'> <a href="http://e107.org"><img src="../e107_images/logo.png" alt="Logo" style="border:0" /></a> <br />
   <br />
   <span class="smalltext">© Steve Dunstan 2002. See gpl.txt for license details.</span><br />
+  <hr />
   <br />
+  <a id='latest_info'></a><span class="headertext">Latest Information</span><br />  Please see the documentation at <a href="http://e107.org">e107.org</a> for the latest <a href="http://wiki.e107.org/?title=HOWTO:Install_e107">installation</a> and <a href="http://wiki.e107.org/?title=HOWTO:Upgrade_to_a_newer_version_of_e107_0.7xx">upgrade</a> documents. If you are upgrading from version 0.617 or earlier, there is a separate <a href="http://wiki.e107.org/?title=HOWTO:Upgrade_e107_from_0.6xx">upgrade guide</a>. The information on the web site supercedes any information in this file.
+  
+  There is also additional information on troubleshooting any problems which might arise, and on how to set up and use E107.
+  <br /><br />
+  <hr />
   <br />
   <a id='upgrading'></a><span class="headertext">Upgrading</span><br />
   <br />
 0.6175 -> .7 Upgrade Guide
 <pre>
 e107 has undergone a lot of changes from .617 to .7 and bkwon has compiled a comprehensive list of these over
-at click to open link in new window .
+at <a href="e107faq.org">e107faq.org</a>. There are also changelogs for the various versions of 0.7 in the documentation at <a href="http://e107.org">e107.org</a>.
 
 Essential Points
 
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/code.bb 0.7.11.src/e107_files/bbcode/code.bb
--- 0.7.7.src/e107_files/bbcode/code.bb	2006-11-18 13:50:51.000000000 -0600
+++ 0.7.11.src/e107_files/bbcode/code.bb	2007-10-07 15:50:53.000000000 -0500
@@ -1,14 +1,20 @@
 global $pref, $e107cache, $tp;
 
-if($pref['smiley_activate']) {
+if($pref['smiley_activate']) 
+{
+	if (!is_object($tp->e_emote))
+	{
+		require_once(e_HANDLER.'emote_filter.php');
+		$tp->e_emote = new e_emoteFilter;
+	}
 	$code_text = $tp->e_emote->filterEmotesRev($code_text);
 }
 
-$search = array(E_NL,'&#092;','&#036;', '&lt');
+$search = array(E_NL,'&#092;','&#036;', '&lt;');
 $replace = array("\r\n","\\",'$', '<');
 $code_text = str_replace($search, $replace, $code_text);
 
-if($pref['useGeshi'] && file_exists(e_PLUGIN."geshi/geshi.php")) {
+if(varset($pref['useGeshi']) && file_exists(e_PLUGIN."geshi/geshi.php")) {
 
 	$code_md5 = md5($code_text);
 	if(!$CodeCache = $e107cache->retrieve('GeshiParsed_'.$code_md5)) {
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/file.bb 0.7.11.src/e107_files/bbcode/file.bb
--- 0.7.7.src/e107_files/bbcode/file.bb	2006-10-25 11:24:09.000000000 -0500
+++ 0.7.11.src/e107_files/bbcode/file.bb	2007-07-12 14:12:45.000000000 -0500
@@ -1,10 +1,10 @@
 global $pref, $fromadmin;
 
-if (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin)
+if ((e_PAGE == 'page.php') || (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin))
 {
 	$image = (file_exists(THEME."images/file.png") ? THEME."images/file.png" : e_IMAGE."generic/".IMODE."/file.png");
 	list($fname, $uc) = explode("^", $parm."^");
-	if(isset($uc))
+	if($uc)
 	{
 		if(!check_class($uc))
 		{
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/flash.bb 0.7.11.src/e107_files/bbcode/flash.bb
--- 0.7.7.src/e107_files/bbcode/flash.bb	2006-07-05 00:43:58.000000000 -0500
+++ 0.7.11.src/e107_files/bbcode/flash.bb	2006-12-17 08:19:32.000000000 -0600
@@ -1,6 +1,6 @@
 // USAGE: [flash=width,height]http://www.example.com/file.swf[/flash]
 
-$movie_path   = "http://".eregi_replace("http://", "",$code_text);
+$movie_path   = (substr($code_text,0,4) == "http") ? "http://".eregi_replace("http://", "",$code_text) : $code_text;
 $movie_path   = $tp -> toAttribute($movie_path);
 
 $parm_array   = explode(",",$parm);
@@ -18,4 +18,5 @@
 		<param name='movie'   value='$movie_path' />
 		<param name='quality' value='high' />
 		<param name='allowscriptaccess' value='samedomain' />
-		</object>";
\ No newline at end of file
+		</object>";
+
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/img.bb 0.7.11.src/e107_files/bbcode/img.bb
--- 0.7.7.src/e107_files/bbcode/img.bb	2006-04-05 07:19:19.000000000 -0500
+++ 0.7.11.src/e107_files/bbcode/img.bb	2007-11-07 15:44:51.000000000 -0600
@@ -1,62 +1,75 @@
 global $pref;
 if (preg_match("#\.php\?.*#",$code_text)){return "";}
 global $IMAGES_DIRECTORY, $FILES_DIRECTORY, $e107;
-$search = array('"', '{E_IMAGE}', '{E_FILE}');
-$replace = array('&#039;', $e107->base_path.$IMAGES_DIRECTORY, $e107->base_path.$FILES_DIRECTORY);
+$search = array('"', '{E_IMAGE}', '{E_FILE}', '{e_IMAGE}', '{e_FILE}');
+$replace = array('&#039;', $e107->base_path.$IMAGES_DIRECTORY, $e107->base_path.$FILES_DIRECTORY, $e107->base_path.$IMAGES_DIRECTORY, $e107->base_path.$FILES_DIRECTORY);
 $code_text = str_replace($search, $replace, $code_text);
 unset($imgParms);
 $imgParms['class']="bbcode";  
 $imgParms['alt']='';
-$imgParms['style']="vertical-align:middle; border:0";
 
 $code_text = $tp -> toAttribute($code_text);
 
-if($parm) {
-	$parm = preg_replace('#onerror *=#i','',$parm);
-	$parm = str_replace("amp;", "&", $parm);
-	parse_str($parm,$tmp);
-	foreach($tmp as $p => $v) {
-		$imgParms[$p]=$v;
-	}
+if($parm)
+{
+    $parm = preg_replace('#onerror *=#i','',$parm);
+    $parm = str_replace("amp;", "&", $parm);
+    parse_str($parm,$tmp);
+    foreach($tmp as $p => $v)
+	{
+        $imgParms[$p]=$v;
+    }
 }
 $parmStr="";
-foreach($imgParms as $k => $v) {
-	$parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
+foreach($imgParms as $k => $v)
+{
+    $parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
 }
 
 
-if(file_exists(e_IMAGE."newspost_images/".$code_text))
+if((strpos($code_text,'../') === FALSE) && file_exists(e_IMAGE."newspost_images/".$code_text))
 {
-	$code_text = e_IMAGE."newspost_images/".$code_text;
+    $code_text = e_IMAGE."newspost_images/".$code_text;
 }
 
-if (!$postID) {
-	return "<img src='".$code_text."' {$parmStr} />";
-} else {
-	if(strstr($postID,'class:')) {
-		$uc = substr($postID,6);
-	}
-	if ($pref['image_post']) {
-		if($uc == '') {
-			if (!function_exists('e107_userGetuserclass')) {
-				require_once(e_HANDLER.'user_func.php');
-			}
-			$uc = e107_userGetuserclass($postID);
-		}
-		if (check_class($pref['image_post_class'],$uc)) {
-			return "<img src='".$code_text."' {$parmStr} />";
-		}
+if (!$postID || $postID == 'admin')
+{
+    return "<img src='".$code_text."' {$parmStr} />";
+}
+else
+{
+    if(strstr($postID,'class:'))
+	{
+        $uc = substr($postID,6);
+    }
+    if ($pref['image_post'])
+	{
+        if(!isset($uc) || ($uc == ''))
+		{
+            if (!function_exists('e107_userGetuserclass'))
+			{
+                require_once(e_HANDLER.'user_func.php');
+            }
+            $uc = e107_userGetuserclass($postID);
+        }
+        if (check_class($pref['image_post_class'],$uc))
+		{
+            return "<img src='".$code_text."' {$parmStr} />";
+        }
+        else
+        {
+            return ($pref['image_post_disabled_method'] ? "[ image disabled ]" : "Image: $code_text");
+        }
+    }
+    else
+    {
+        if ($pref['image_post_disabled_method'])
+		{
+            return '[ image disabled ]';
+        }
 		else
 		{
-			return ($pref['image_post_disabled_method'] ? "[ image disabled ]" : "Image: $code_text");
-		}
-	}
-	else
-	{
-		if ($pref['image_post_disabled_method']) {
-			return '[ image disabled ]';
-		} else {
-			return "Image: $code_text";
-		}
-	}
-}
\ No newline at end of file
+            return "Image: $code_text";
+        }
+    }
+}
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/link.bb 0.7.11.src/e107_files/bbcode/link.bb
--- 0.7.7.src/e107_files/bbcode/link.bb	2006-11-27 02:29:18.000000000 -0600
+++ 0.7.11.src/e107_files/bbcode/link.bb	2007-12-24 10:12:37.000000000 -0600
@@ -1,26 +1,53 @@
 global $pref;
 
-$parm     = trim($parm);
-$external = (($pref['links_new_window'] || strpos($parm, 'external') === 0) && substr($parm,0,1) != "#") ? " rel='external'" : "";
+/*
+	[link=$parm $extras]$code_text[/link]
+	Correct Usage:
+	[link=http://mysite.com external]My text[/link]
+	[link=http://mysite.com rel=external]My text[/link]
+	[link=external]http://mysite.com[/link]
+	[link]http://mysite.com[/link]
+	[link=mailto:myemail@email.com]My name[/link]
+	Historic usage:
+	[link=external=http://mysite.com]My text[/link]
+*/
+
+
+	$parm = trim($parm);
+
+	/* Fix for people using link=external= */
+	if(strpos($parm,"external=") !== FALSE)
+	{
+		list($extras,$parm) = explode("=",$parm);
+		$parm = $parm." ".$extras;
+	}
+
+	if(substr($parm,0,6) == "mailto")
+	{
+		list($pre,$email) = explode(":",$parm);
+		list($p1,$p2) = explode("@",$email);
+		$p2=rawurlencode($p2);			// Primarily to pick up spaces, which are not allowed
+		return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
+	}
+
+	list($link,$extras) = explode(" ",$parm);
+
+	if(!$parm) $link = $code_text;
+
+	if($link == "external" && $extras == "")
+	{
+		$link = $code_text;
+    	$extras = "rel=external";
+	}
+
+	if($extras == "external" || strpos($extras,"rel=external")!==FALSE)
+	{
+    	$insert = "rel='external' ";
+	}
+	else
+	{
+    	$insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : "";
+    }
+	if (strtolower(substr($link,0,11)) == 'javascript:') return '';
+	return "<a class='bbcode' href='".$tp -> toAttribute($link)."' ".$insert.">".$code_text."</a>";
 
-if(strpos($parm,"{e_")!==FALSE){
-	$external = "";
-}
-
-if(substr($parm,0,6) == "mailto")
-{
-	list($pre,$email) = explode(":",$parm);
-	list($p1,$p2) = explode("@",$email);
-	return "<a class='bbcode' rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"$p1\"+\"@\"+\"$p2\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
-}
-
-if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
-{
-	$parm = preg_replace('#^external.#is', '', $parm);
-	return "<a class='bbcode' href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
-}
-
-else
-{
-	return "<a class='bbcode' href='".$tp -> toAttribute($link_text)."'".$external.">".$code_text."</a>";
-}
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/list.bb 0.7.11.src/e107_files/bbcode/list.bb
--- 0.7.7.src/e107_files/bbcode/list.bb	2006-02-10 09:31:51.000000000 -0600
+++ 0.7.11.src/e107_files/bbcode/list.bb	2007-09-03 19:16:20.000000000 -0500
@@ -1,7 +1,7 @@
-
-
-/* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list] */
-/* Tag: ordered list [list=<list type>]*line 1*line2*line 3*line 4*line5 etc[/list] */
+/* Tag: unordered list [list][*]line 1[*]line2[*]line 3[*]line 4[*]line5 etc[/list]  - preferred */
+/* Tag: ordered list [list=<list type>][*]line 1[*]line2[*]line 3[*]line 4[*]line5 etc[/list]  - preferred */
+/* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list]  - legacy*/
+/* Tag: ordered list [list=<list type>]*line 1*line2*line 3*line 4*line5 etc[/list] - legacy */
 /* valid list types: 
 				disc
 				circle
@@ -13,36 +13,31 @@
 				upper-alpha	A, B, C
 */
 
+if (strpos($code_text,"[*]") !== FALSE)
+{
+  $listitems = explode("[*]", $code_text);
+}
+else
+{
+  $listitems = explode("*", $code_text);
+}
 
-
-if(preg_match("#\[list\](.*?)\[/list\]#si", $full_text, $match))
+if ($parm == '')
+{	/* unordered list */
+  $listtext = "<ul class='bbcode'>";
+  $trailer = "</ul>";
+}
+else
 {
-	/* unordered list */
-	$listitems = explode("*", $match[1]);
-	$listtext = "<ul>";
-	foreach($listitems as $item)
-	{
-		if($item && $item != E_NL)
-		{
-			$listtext .= "<li>$item</li>";
-		}
-	}
-	$listtext .= "</ul>";
-	return $listtext;
+  $type = $tp -> toAttribute($parm);
+  $listtext = "\n<ol class='bbcode' style='list-style-type: $type'>";
+  $trailer = "</ol>";
 }
-else if(preg_match("#\[list=(.*?)\](.*?)\[/list\]#si", $full_text, $match))
+foreach($listitems as $item)
 {
-	$type = $tp -> toAttribute($match[1]);
-	$listitems = $match[2];
-	$listitems = explode("*", $match[2]);
-	$listtext = "\n<ol style='list-style-type: $type'>";
-	foreach($listitems as $item)
-	{
-		if($item && $item != E_NL)
-		{
-			$listtext .= "<li>$item</li>";
-		}
-	}
-	$listtext .= "</ol>";
-	return $listtext;
-}
\ No newline at end of file
+  if($item && $item != E_NL)
+  {
+	$listtext .= "<li class='bbcode'>$item</li>";
+  }
+}
+return $listtext.$trailer;
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/php.bb 0.7.11.src/e107_files/bbcode/php.bb
--- 0.7.7.src/e107_files/bbcode/php.bb	2005-09-16 07:46:34.000000000 -0500
+++ 0.7.11.src/e107_files/bbcode/php.bb	2007-10-25 19:32:50.000000000 -0500
@@ -1,4 +1,5 @@
-$search = array("&quot;", "&#039;", "&#036;", "<br />", "[E_NL]", "-&gt;");
+if($sep != '' || $parm != '') { return $full_text; }
+$search = array("&quot;", "&#039;", "&#036;", '<br />', E_NL, "-&gt;");
 $replace = array('"', "'", "$", "\n", "\n", "->");
 $code_text = str_replace($search, $replace, $code_text);
 return eval($code_text);
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/textarea.bb 0.7.11.src/e107_files/bbcode/textarea.bb
--- 0.7.7.src/e107_files/bbcode/textarea.bb	2006-02-10 09:31:51.000000000 -0600
+++ 0.7.11.src/e107_files/bbcode/textarea.bb	2007-01-08 15:11:36.000000000 -0600
@@ -1,20 +1,10 @@
-
-
 /* Tag: [textarea name=name&style=style&row=rows&whatever=whatever]value[/textarea] */
 
-
 $tastr = "";
-
 parse_str($parm, $tmp);
 
 foreach($tmp as $key => $p)
 {
-	$tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' ";
+  $tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' ";
 }
-
-
-preg_match ("#\](.*?)\[/textarea#", $full_text, $match);
-$value = $match[1];
-
-return "<textarea $tastr>$value</textarea>";
-
+return "<textarea $tastr>$code_text</textarea>";
diff -x .svn -ruN 0.7.7.src/e107_files/bbcode/url.bb 0.7.11.src/e107_files/bbcode/url.bb
--- 0.7.7.src/e107_files/bbcode/url.bb	2006-02-17 13:13:54.000000000 -0600
+++ 0.7.11.src/e107_files/bbcode/url.bb	2007-08-08 14:40:29.000000000 -0500
@@ -6,9 +6,11 @@
 if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
 {
 	$parm = preg_replace('#^external.#is', '', $parm);
+	if (strtolower(substr($parm,0,11)) == 'javascript:') return '';
 	return "<a href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
 }
 else
 {
+  if (strtolower(substr($code_text,0,11)) == 'javascript:') return '';
 	return "<a href='".$tp -> toAttribute($code_text)."'".$external.">".$code_text."</a>";
 }
diff -x .svn -ruN 0.7.7.src/e107_files/def_e107_prefs.php 0.7.11.src/e107_files/def_e107_prefs.php
--- 0.7.7.src/e107_files/def_e107_prefs.php	2006-11-07 14:16:40.000000000 -0600
+++ 0.7.11.src/e107_files/def_e107_prefs.php	2007-12-07 13:52:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/def_e107_prefs.php,v $
-|     $Revision: 1.59 $
-|     $Date: 2006/11/07 20:16:40 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.64 $
+|     $Date: 2007/12/07 19:52:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -48,6 +48,14 @@
   'anon_post' => '0',
   'user_reg' => '1',
   'use_coppa' => '1',
+  'membersonly_enabled' => '0',
+  'signup_pass_len' => '',
+  'signup_maxip' => '3',
+  'signup_disallow_text' => '',
+  'displayname_class' => 255,
+  'displayname_maxlength' => 15,
+  'loginname_maxlength' => 30,
+  
   'profanity_filter' => '0',
   'profanity_replace' => '[censored]',
   'smiley_activate' => '',
@@ -65,7 +73,7 @@
   'user_tracking' => 'cookie',
   'cookie_name' => 'e107cookie',
   'resize_method' => 'gd2',
-  'im_path' => '/usr/X11R6/bin/convert',
+  'im_path' => '/usr/X11R6/bin/',
   'im_quality' => '80',
   'im_width' => '120',
   'im_height' => '100',
@@ -117,7 +125,6 @@
   'wysiwyg' => '0',
   'old_np' => '0',
   'make_clickable' => '0',
-  'signup_maxip' => '3',
   'track_online' => '1',
   'emotepack' => 'default',
   'xup_enabled' => '1',
@@ -132,9 +139,6 @@
   'post_html' => '254',
   'redirectsiteurl' => '0',
   'admin_alerts_uniquemenu' => '0',
-  'membersonly_enabled' => '0',
-  'signup_pass_len' => '',
-  'signup_disallow_text' => '',
   'signup_text_after' => '',
   'null' => '',
   'links_new_window' => '1',
@@ -150,12 +154,12 @@
   'comments_icon' => '0',
   'nested_comments' => '1',
   'allowCommentEdit' => '0',
-  'rss_feeds' => '1',
   'admincss' => 'style.css',
   'developer' => '0',
   'download_email' => '0',
   'comments_disabled' => '0',
-  'memberlist_access' => '253'
+  'memberlist_access' => '253',
+  'check_updates' => '1'
 );
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_files/e107.js 0.7.11.src/e107_files/e107.js
--- 0.7.7.src/e107_files/e107.js	2006-04-29 17:52:38.000000000 -0500
+++ 0.7.11.src/e107_files/e107.js	2007-12-19 14:21:57.000000000 -0600
@@ -5,9 +5,9 @@
 |	e107 website system - Javascript File.
 |
 |	$Source: /cvsroot/e107/e107_0.7/e107_files/e107.js,v $
-|	$Revision: 1.19 $
-|	$Date: 2006/04/29 22:52:38 $
-|	$Author: e107coders $
+|	$Revision: 1.26 $
+|	$Date: 2007/12/19 20:21:57 $
+|	$Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -34,24 +34,23 @@
  */
 function SyncWithServerTime(serverTime)
 {
-	if (serverTime) {
+	if (serverTime) 
+	{
 	  	/* update time difference cookie */
-		tdCookie='e107_tdOffset=';
-		tdSetTimeCookie='e107_tdSetTime=';
-		serverDelta=Math.floor(localTime-serverTime);
-	  	document.cookie = tdCookie+serverDelta;
-	  	document.cookie = tdSetTimeCookie+(localTime-serverDelta); /* server time when set */
+		var serverDelta=Math.floor(localTime-serverTime);
+	  	document.cookie = 'e107_tdOffset='+serverDelta+'; path=/';
+	  	document.cookie = 'e107_tdSetTime='+(localTime-serverDelta)+'; path=/'; /* server time when set */
 	}
 
-	tzCookie = 'e107_tzOffset=';
-	if (document.cookie.indexOf(tzCookie) < 0) {
+	var tzCookie = 'e107_tzOffset=';
+//	if (document.cookie.indexOf(tzCookie) < 0) {
 		/* set if not already set */
-		timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */
-		document.cookie = tzCookie + timezoneOffset;
-	}
+		var timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */
+		document.cookie = tzCookie + timezoneOffset+'; path=/';
+//	}
 }
-
-if(document.getElementById&&!document.all){ns6=1;}else{ns6=0;}
+var ns6=0;
+if(document.getElementById&&!document.all){ns6=1;}
 var agtbrw=navigator.userAgent.toLowerCase();
 var operaaa=(agtbrw.indexOf('opera')!=-1);
 var head="display:''";
@@ -155,6 +154,18 @@
 
 function setCheckboxes(the_form, do_check, the_cb){
 	var elts = (typeof(document.forms[the_form].elements[the_cb]) != 'undefined') ? document.forms[the_form].elements[the_cb] : document.forms[the_form].elements[the_cb];
+	if(document.getElementById(the_form))
+	{
+		if(the_cb)
+		{
+			var elts =(typeof(document.getElementById(the_form).elements[the_cb]) != 'undefined') ? document.getElementById(the_form).elements[the_cb] : document.getElementById(the_form).elements[the_cb];
+		}
+		else
+		{
+        	var elts = document.getElementById(the_form);
+		}
+	}
+
 	var elts_cnt  = (typeof(elts.length) != 'undefined') ? elts.length : 0;
 	if(elts_cnt){
 		for(var i = 0; i < elts_cnt; i++){
@@ -196,6 +207,17 @@
 	return;
 }
 
+function mozSwap(txtarea, newtext){
+	var selLength = txtarea.textLength;
+	var selStart = txtarea.selectionStart;
+	var selEnd = txtarea.selectionEnd;
+	if (selEnd == 1 || selEnd == 2) selEnd = selLength;
+	var s1 = (txtarea.value).substring(0,selStart);
+	var s3 = (txtarea.value).substring(selEnd, selLength);
+	txtarea.value = s1 + newtext + s3;
+	return;
+}
+
 function storeCaret (textAr){
 	e107_selectedInputArea = textAr;
 	if (textAr.createTextRange){
@@ -203,20 +225,40 @@
 	}
 }
 
-function addtext(text, emote){
-	if (window.e107_selectedInputArea){
+function addtext(text, emote)
+{
+  var val = new Array(2);
+	if (window.e107_selectedInputArea)
+	{
 		var ta = e107_selectedInputArea;
-		if (emote != true){
+		if (emote != true)
+		{  // Split if its a paired bbcode
 			val = text.split('][');
-			}
-		else { val = text; }
+			if (val[0] == text) val[1] = '';
+		}
+		else
+		{
+		val = text;
+		}
 
-		if ((clientVer >= 4) && is_ie && is_win){
+		if ((clientVer >= 4) && is_ie && is_win)
+		{
 			theSelection = document.selection.createRange().text; /* wrap selected text */
-			if (theSelection) {
-				if (emote != true){
+			if (theSelection)
+			{
+				if (emote != true)
+				{
+				  if (val[1] == '')
+				  {  // Single piece of text
+					document.selection.createRange().text = val[0];
+				  }
+				  else
+				  {  // bbcode
 					document.selection.createRange().text = val[0] +']' +  theSelection + '[' + val[1];
-				} else {
+				  }
+				}
+				else
+				{
 					document.selection.createRange().text = val + theSelection;
 				}
 				ta.focus();
@@ -224,26 +266,45 @@
 				return;
 			}
 
-		}else if (ta.selectionEnd && (ta.selectionEnd - ta.selectionStart > 0)){
-			if (emote != true){
+		}
+		else
+		  if (ta.selectionEnd && (ta.selectionEnd - ta.selectionStart > 0))
+		  { // Selected text here
+			if (emote != true)
+			{
+			  if  (val[1] != '')
+			  {  // BBCode to wrap
 				mozWrap(ta, val[0] +']', '[' + val[1]); /* wrap selected text */
-			} else {
+			  }
+			  else
+			  {  // Single piece of text to insert, and delete any selected text
+				mozSwap(ta, text); /* wrap selected text */
+			  }
+			}
+			else
+			{
 				mozWrap(ta, val, ''); /* wrap selected text */
 			}
 			return;
-		}
+		  }
 		text = ' ' + text + ' ';
-		if (ta.createTextRange && e107_selectedRange) {
+		if (ta.createTextRange && e107_selectedRange)
+		{
 			var caretPos = e107_selectedRange; /* IE */
 			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
-		} else if (ta.selectionStart || ta.selectionStart == '0') { /* Moz */
+		}
+		else
+		  if (ta.selectionStart || ta.selectionStart == '0')
+		  { /* Moz */
 		   	var startPos = ta.selectionStart;
 			var endPos = ta.selectionEnd;
 			var charb4 = ta.value.charAt(endPos-1);
 			ta.value = ta.value.substring(0, endPos)+ text + ta.value.substring(endPos);
-		} else {
+		  }
+		  else
+		  {
 			ta.value  += text;
-		}
+		  }
 		ta.focus();
 	}
 }
@@ -304,16 +365,16 @@
 		}
 }
 
-function preview_image(src_val,img_path){
+function preview_image(src_val,img_path, not_found)
+{
 	var ta;
-	var desti
-
 	var desti = src_val + '_prev';
+
 	ta = document.getElementById(src_val).value;
 	if(ta){
 		document.getElementById(desti).src = img_path + ta;
 	}else{
-		document.getElementById(desti).src = '".e_IMAGE."generic/blank.gif';
+		document.getElementById(desti).src = not_found;
 	}
 	return;
 }
diff -x .svn -ruN 0.7.7.src/e107_files/import/mambo.php 0.7.11.src/e107_files/import/mambo.php
--- 0.7.7.src/e107_files/import/mambo.php	2005-05-12 16:34:56.000000000 -0500
+++ 0.7.11.src/e107_files/import/mambo.php	2007-08-03 16:10:43.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/import/mambo.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/05/12 21:34:56 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2007/08/03 21:10:43 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -132,8 +132,9 @@
 
 $block = ($mos['block']) ? 2 : 0;
 $admin = ($mos['usertype'] == "superadministrator") ? 1 : 0;
+$class = '';			// Potential class allocation - can edit to list class numbers here
 $query = "INSERT INTO ".$mySQLprefix."user VALUES (";
-$query .= "0, \"".$mos['name']."\", \"".$mos['username']."\", '', \"".$mos['password']."\", '', \"".$mos['email']."\", '', '', '', '', '', '', '', '', '', \"1\", \"".$mos['regDate']."\", \"".$mos['lvDate']."\", \"\", \"\", \"\", \"\", \"\", \"\", \"$block\", '', '', '', '', \"$admin\", \"".$mos['name']."\", \"$class\", 0, 0, 0 ";
+$query .= "0, '".$mos['name']."', '".$mos['username']."', '', '".$mos['password']."', '', '".$mos['email']."', '', '', '', '1', '".$mos['regDate']."', '".$mos['lvDate']."', 0, 0, 0, 0, 0, '', '{$block}', '', '', '', 0, '{$admin}', '".$mos['name']."', '{$class}', '', '', 0, '' ";
 $query .= ")";
 $message = mysql_query($query, $e107Connection) ? LAN_CREATED: LAN_CREATED_FAILED;
 
diff -x .svn -ruN 0.7.7.src/e107_files/popup.js 0.7.11.src/e107_files/popup.js
--- 0.7.7.src/e107_files/popup.js	2005-06-26 19:17:14.000000000 -0500
+++ 0.7.11.src/e107_files/popup.js	2007-08-16 14:30:39.000000000 -0500
@@ -20,11 +20,11 @@
 //resize method for popup window (resize to fit contents)
 function resizeWinTo() {
 	if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }
-	if( !document.images[0].height || window.doneAlready ) { return; } //in case images are disabled
+	if( !document.images[0].height || window.doneAlready ) { return false; } //in case images are disabled
 	var oH = getRefToDivMod( 'myID' ); if( !oH ) { return false; }
 	var oW = oH.clip ? oH.clip.width : oH.offsetWidth;
 	var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
-	if( !oH || window.doneAlready ) { return; } //in case images are disabled
+	if( !oH || window.doneAlready ) { return false; } //in case images are disabled
 	window.doneAlready = true; //for Safari and Opera
 	/*//no idea why this is in here
 	if(document.getElementsByTagName) {
@@ -45,6 +45,7 @@
 	//'var scW = screen.availWidth ? screen.availWidth : screen.width;
 	//'var scH = screen.availHeight ? screen.availHeight : screen.height;
 	//'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }
+	return false;
 }
 
 
@@ -154,4 +155,5 @@
 
 	imgWin.document.close();
 	if( imgWin.focus ) { imgWin.focus(); }
+	return false;
 }
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_help.sc 0.7.11.src/e107_files/shortcode/admin_help.sc
--- 0.7.7.src/e107_files/shortcode/admin_help.sc	2005-11-13 20:40:17.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/admin_help.sc	2007-12-24 12:01:03.000000000 -0600
@@ -1,30 +1,36 @@
-if (ADMIN) {
-	global $ns, $pref;
-	if (!($handle=opendir(e_LANGUAGEDIR.e_LANGUAGE."/admin/help/"))) {
-		$handle=opendir(e_LANGUAGEDIR."English/admin/help/");
+if (!ADMIN) return '';
+
+  $helpfile = '';
+  global $ns, $pref;			// Used by the help renderer
+
+  if(strpos(e_SELF, e_ADMIN_ABS) !== FALSE)
+  {
+	if (is_readable(e_LANGUAGEDIR.e_LANGUAGE."/admin/help/".e_PAGE)) 
+	{
+	  $helpfile = e_LANGUAGEDIR.e_LANGUAGE."/admin/help/".e_PAGE;
+	} 
+	elseif (is_readable(e_LANGUAGEDIR."English/admin/help/".e_PAGE)) 
+	{
+	  $helpfile = e_LANGUAGEDIR."English/admin/help/".e_PAGE;
 	}
-	ob_start();
-	$text = "";
-	while(false !== ($file = readdir($handle))) {
-		if ($file != "." && $file != ".." && $file != "CVS") {
-			if (strpos(e_SELF, $file) !== FALSE) {
-				if (is_readable(e_LANGUAGEDIR.e_LANGUAGE."/admin/help/".$file)) {
-					include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/help/".$file);
-				} else if (is_readable(e_LANGUAGEDIR."English/admin/help/".$file)) {
-					include_once(e_LANGUAGEDIR."English/admin/help/".$file);
-				}
-			}
-		}
+  }
+  else
+  {
+	$plugpath = getcwd()."/help.php"; // deprecated file. For backwards compat. only. 
+	$eplugpath = getcwd()."/e_help.php";
+	if(is_readable($eplugpath))
+	{
+	  $helpfile = $eplugpath;
 	}
-	closedir($handle);
-   $plugpath = getcwd()."/help.php";
-	if(file_exists($plugpath))
+	elseif(is_readable($plugpath))
 	{
-		@require_once($plugpath);
+	  $helpfile = $plugpath;
 	}
-	$help_text = ob_get_contents();
-	ob_end_clean();
-	return $help_text;
-}
-
+  }
+  if (!$helpfile) return '';
 
+  ob_start();
+  include_once($helpfile);
+  $help_text = ob_get_contents();
+  ob_end_clean();
+  return $help_text;
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_log.sc 0.7.11.src/e107_files/shortcode/admin_log.sc
--- 0.7.7.src/e107_files/shortcode/admin_log.sc	2006-10-24 12:23:18.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/admin_log.sc	2007-07-16 15:50:15.000000000 -0500
@@ -1,8 +1,9 @@
-if (ADMIN) {
+if (getperms('0'))
+{
 	if (!function_exists('admin_log')) {
 		function admin_log() {
 			global $sql, $ns;
-			$text = E_16_ADMINLOG." <a style='cursor: pointer; cursor: hand' onclick=\"expandit('adminlog')\">".ADLAN_116."</a>\n";
+			$text = E_16_ADMINLOG." <a style='cursor: pointer' onclick=\"expandit('adminlog')\">".ADLAN_116."</a>\n";
 			if (e_QUERY == "logall") {
 				$text .= "<div id='adminlog'>";
 				$cnt = $sql -> db_Select("dblog", "*", "ORDER BY `dblog_datestamp` DESC", "no_where");
@@ -17,8 +18,11 @@
 				$text .= "<li>{$datestamp} - {$row['dblog_title']}</li>";
 			}
 			$text .= ($cnt ? "</ul>" : "");
+			$text .= "[ <a href='".e_ADMIN."admin_log.php?logall'>".ADLAN_117."</a> ]";
 
-			$text .= "[ <a href='".e_ADMIN."admin_log.php?logall'>".ADLAN_117."</a> ][ <a href='".e_ADMIN."admin_log.php?purge'>".ADLAN_118."</a> ]\n</div>";
+			$text .= "<br />[ <a href='".e_ADMIN."admin_log.php?purge' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\">".ADLAN_118."</a> ]\n";
+
+			$text .= "</div>";
 
 			return $ns -> tablerender(ADLAN_135, $text, '', TRUE);
 		}
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_logo.sc 0.7.11.src/e107_files/shortcode/admin_logo.sc
--- 0.7.7.src/e107_files/shortcode/admin_logo.sc	2006-04-29 01:01:26.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/admin_logo.sc	2007-01-28 15:13:05.000000000 -0600
@@ -18,7 +18,7 @@
 
 $dimensions = getimagesize($path);
 
-$image = "<img class='logo admin_logo' src='".$logo."' style='width: ".$dimensions[0]."px; height: ".$dimensions[1]."px' alt='Admin Area' />\n";
+$image = "<img class='logo admin_logo' src='".$logo."' style='width: ".$dimensions[0]."px; height: ".$dimensions[1]."px' alt='".ADLAN_153."' />\n";
 
 if (isset($link) && $link) {
 	if ($link == 'index') {
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_plugins.sc 0.7.11.src/e107_files/shortcode/admin_plugins.sc
--- 0.7.7.src/e107_files/shortcode/admin_plugins.sc	2005-02-04 02:17:24.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/admin_plugins.sc	2006-12-04 07:45:11.000000000 -0600
@@ -13,22 +13,24 @@
 				}
 			}
 		}
-		foreach(array_keys($e107_plug) as $xplug){
-			if (file_exists(e_PLUGIN.$e107_plug[$xplug]."/admin_info.php")) {
-				if ($pref['admin_alerts_uniquemenu'] == 1) {
-					$text .= "<b>".$xplug."</b><br />";
-				} else {
-					$text = "";
-				}
-				require_once(e_PLUGIN.$e107_plug[$xplug]."/admin_info.php");
-				$text .= "<br />";
-				if ($pref['admin_alerts_uniquemenu'] != 1) {
-					$caption = $xplug;
-					$ns -> tablerender($caption, $text);
-				} else {
+		if (is_array($e107_plug)) {
+			foreach(array_keys($e107_plug) as $xplug){
+				if (file_exists(e_PLUGIN.$e107_plug[$xplug]."/admin_info.php")) {
+					if ($pref['admin_alerts_uniquemenu'] == 1) {
+						$text .= "<b>".$xplug."</b><br />";
+					} else {
+						$text = "";
+					}
+					require_once(e_PLUGIN.$e107_plug[$xplug]."/admin_info.php");
 					$text .= "<br />";
+					if ($pref['admin_alerts_uniquemenu'] != 1) {
+						$caption = $xplug;
+						$ns -> tablerender($caption, $text);
+					} else {
+						$text .= "<br />";
+					}
+					$i++;
 				}
-				$i++;
 			}
 		}
     
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_preset.sc 0.7.11.src/e107_files/shortcode/admin_preset.sc
--- 0.7.7.src/e107_files/shortcode/admin_preset.sc	2005-12-27 13:19:39.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/admin_preset.sc	2007-02-07 15:21:33.000000000 -0600
@@ -1,4 +1,5 @@
-if(ADMIN){
+if(ADMIN && getperms("0"))
+{
 	global $sql,$pst,$ns,$tp,$e_wysiwyg,$pref;
 	if(isset($pst) && $pst->form && $pst->page){
 		$thispage = urlencode(e_SELF."?".e_QUERY);
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_siteinfo.sc 0.7.11.src/e107_files/shortcode/admin_siteinfo.sc
--- 0.7.7.src/e107_files/shortcode/admin_siteinfo.sc	2006-04-18 03:53:36.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/admin_siteinfo.sc	2006-12-30 12:16:10.000000000 -0600
@@ -32,6 +32,8 @@
 	<br />
 	".FOOTLAN_3." ".$e107info['e107_version']."
 	<br /><br />
+	<b>".FOOTLAN_18."</b>
+	<br />".$pref['sitetheme']."<br /><br />
 	<b>".FOOTLAN_5."</b>
 	<br />
 	".$themename." v".$themeversion." ".($themeauthor ? FOOTLAN_6.' '.$themeauthor : '')." ".($themedate ? "(".$themedate.")" : "");
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_status.sc 0.7.11.src/e107_files/shortcode/admin_status.sc
--- 0.7.7.src/e107_files/shortcode/admin_status.sc	2006-10-14 09:08:27.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/admin_status.sc	2007-05-11 16:04:03.000000000 -0500
@@ -1,4 +1,5 @@
-if (ADMIN) {
+if (getperms('0') || getperms('4')) 
+{
 	if (!function_exists('admin_status')) {
 		function admin_status() {
 			global $sql, $ns, $pref;
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/admin_update.sc 0.7.11.src/e107_files/shortcode/admin_update.sc
--- 0.7.7.src/e107_files/shortcode/admin_update.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/admin_update.sc	2007-07-18 14:53:41.000000000 -0500
@@ -0,0 +1,59 @@
+// $Id: admin_update.sc,v 1.6 2007/07/18 19:53:41 e107steved Exp $
+
+	if (!ADMIN) return "";
+
+	global $e107cache,$ns, $pref;
+	if (!varset($pref['check_updates'], FALSE)) return "";
+	
+	if (is_readable(e_ADMIN."ver.php"))
+	{
+		include(e_ADMIN."ver.php");
+	}
+
+	$feed = "http://sourceforge.net/export/rss2_projfiles.php?group_id=63748&rss_limit=5";
+	$e107cache->CachePageMD5 = md5($e107info['e107_version']);
+
+    if($cacheData = $e107cache->retrieve("updatecheck",3600, TRUE))
+    {
+   	  	return $ns -> tablerender(LAN_NEWVERSION, $cacheData);
+    }
+
+	// Don't check for updates if running locally (comment out the next line to allow check - but 
+	// remember it can cause delays/errors if its not possible to access the Internet
+	if ((strpos(e_SELF,'localhost') !== FALSE) || (strpos(e_SELF,'127.0.0.1') !== FALSE)) return '';
+
+	require_once(e_HANDLER."xml_class.php");
+	$xml = new parseXml;
+	require_once(e_HANDLER."magpie_rss.php");
+
+    $ftext = "";
+	if($rawData = $xml -> getRemoteXmlFile($feed))
+	{
+	  $rss = new MagpieRSS( $rawData );
+      list($cur_version,$tag) = explode(" ",$e107info['e107_version']);
+      $c = 0;
+	  foreach($rss->items as $val)
+	  {
+		$search = array((strstr($val['title'],"(")),"e107","released"," v");
+		$version = trim(str_replace($search,"",$val['title']));
+
+	 	if(version_compare($version,$cur_version)==1)
+		{
+        	$ftext = "<a rel='external' href='".$val['link']."' >e107 v".$version."</a><br />\n";
+            break;
+		}
+		$c++;
+	  }
+	}
+	else
+	{  // Error getting data
+	  $ftext = ADLAN_154;
+	}
+
+	$e107cache->set("updatecheck", $ftext, TRUE);
+	if($ftext)
+	{
+		return $ns -> tablerender(LAN_NEWVERSION, $ftext);
+	}
+
+
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/banner.sc 0.7.11.src/e107_files/shortcode/banner.sc
--- 0.7.7.src/e107_files/shortcode/banner.sc	2005-12-27 13:19:39.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/banner.sc	2007-10-08 15:10:46.000000000 -0500
@@ -1,3 +1,4 @@
+// $Id: banner.sc,v 1.18 2007/10/08 20:10:46 e107steved Exp $
 global $sql, $tp, $ns, $menu_pref;
 $ret = "";
 
@@ -9,19 +10,21 @@
 AND banner_active IN (".USERCLASS_LIST.")
 ORDER BY RAND($seed)";
 
-if($sql -> db_Select("banner", "*", $query)){
+if($sql -> db_Select("banner", "*", $query))
+{
 	$row = $sql->db_Fetch();
 
 	if(!$row['banner_image'])
 	{
-		return "<a href='".e_HTTP."banner.php?".$row['banner_id']."' rel='external'>no image assigned to this banner</a>";
+	  return "<a href='".e_HTTP."banner.php?".$row['banner_id']."' rel='external'>no image assigned to this banner</a>";
 	}
 
 	$fileext1 = substr(strrchr($row['banner_image'], "."), 1);
 	$sql->db_Update("banner", "banner_impressions=banner_impressions+1 WHERE banner_id='{$row['banner_id']}' ");
-	if ($fileext1 == 'swf')
+	switch ($fileext1)
 	{
-		return "
+	  case 'swf' :
+		return  "
 		<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"468\" height=\"60\">\n
 			<param name=\"movie\" value=\"".e_IMAGE_ABS."banners/".$row['banner_image']."\">\n
 			<param name=\"quality\" value=\"high\">\n
@@ -29,16 +32,17 @@
 			<embed src=\"".e_IMAGE_ABS."banners/".$row['banner_image']."\" width=\"468\" height=\"60\" scale=\"noborder\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>
 		</object>
 		";
-	}
-	elseif($fileext1 == 'php' || $fileext1 == 'html' || $fileext1 == 'js')
-	{
+	  case 'html' :
+	  case 'js' :
+	  case 'php' :			// Code - may 'echo' text, or may return it as a value
 		$file_data = file_get_contents(e_IMAGE."banners/".$row['banner_image']);
 		return $file_data;
+	  default :
+		$ban_ret = "<img src='".e_IMAGE_ABS."banners/".$row['banner_image']."' alt='".$row['banner_clickurl']."' style='border:0' />";
 	}
-	else
-	{
-		return "<a href='".e_HTTP."banner.php?".$row['banner_id']."' rel='external'><img src='".e_IMAGE_ABS."banners/".$row['banner_image']."' alt='".$row['banner_clickurl']."' style='border:0' /></a>";
-	}
-} else {
-	return "&nbsp;";
+	return "<a href='".e_HTTP."banner.php?".$row['banner_id']."' rel='external'>".$ban_ret."</a>";
+} 
+else 
+{
+  return "&nbsp;";
 }
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/bbcode_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/bbcode_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/bbcode_shortcodes.php	2006-07-16 14:56:46.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/batch/bbcode_shortcodes.php	2007-06-13 14:36:15.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/bbcode_shortcodes.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/07/16 19:56:46 $
-|     $Author: e107coders $
+|     $Revision: 1.13 $
+|     $Date: 2007/06/13 19:36:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -37,9 +37,16 @@
 $rand = rand(1000,9999);
 $imagedir_display = str_replace("../","",$bbcode_imagedir);
 
-if($parm == "emotes" && $pref['comments_emoticons'] && $pref['smiley_activate'] && !e_WYSIWYG)
+if($parm == "emotes")
 {
+  if ($pref['comments_emoticons'] && $pref['smiley_activate'] && !e_WYSIWYG)
+  {
 	$bbcode['emotes'] = array("expandit","emoticon_selector_".$rand, LANHELP_44, "emotes.png", "Emoticon_Select", "emoticon_selector_".$rand);
+  }
+  else
+  {	// If emotes disabled, don't return anything (without this we return an empty image reference)
+    return '';
+  }
 }
 
 // Format: $bbcode['UNIQUE_NAME'] = array(ONCLICK_FUNC, ONCLICK_VAR, HELPTEXT, ICON, INCLUDE_FUNC, INCLUDE_FUNCTION_VAR);
@@ -91,15 +98,15 @@
 
 
 $_onclick_func = ($bbcode[$parm][0]) ? $bbcode[$parm][0] : $bbcode_func;
-$_onclick_var = $bbcode[$parm][1];
-$_helptxt = $bbcode[$parm][2];
-$_function = $bbcode[$parm][4];
-$_function_var = $bbcode[$parm][5];
+$_onclick_var = varset($bbcode[$parm][1],'');
+$_helptxt = varset($bbcode[$parm][2],'');
+$_function = varset($bbcode[$parm][4],'');
+$_function_var = varset($bbcode[$parm][5],'');
 
 
 if($bbcode[$parm])  // default - insert text.
 {
-	$text = "\n<img class='bbcode bbcode_buttons' style='cursor:pointer' src='".$iconpath[$parm]."' alt='' title='".$helptxt."' onclick=\"{$_onclick_func}('".$_onclick_var."')\" ".($bbcode_helpactive ? "onmouseout=\"{$bbcode_help}(''{$bbcode_tag})\" onmouseover=\"{$bbcode_help}('".$_helptxt."'{$bbcode_tag})\"" : "" )." />\n";
+	$text = "\n<img class='bbcode bbcode_buttons' style='cursor:pointer' src='".$iconpath[$parm]."' alt='' title='".$_helptxt."' onclick=\"{$_onclick_func}('".$_onclick_var."')\" ".($bbcode_helpactive ? "onmouseout=\"{$bbcode_help}(''{$bbcode_tag})\" onmouseover=\"{$bbcode_help}('".$_helptxt."'{$bbcode_tag})\"" : "" )." />\n";
 }
 
 if($_function)
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/comment_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/comment_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/comment_shortcodes.php	2006-11-06 04:00:52.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/batch/comment_shortcodes.php	2007-08-17 14:23:02.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/comment_shortcodes.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/11/06 10:00:52 $
-|     $Author: lisa_ $
+|     $Revision: 1.21 $
+|     $Date: 2007/08/17 19:23:02 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -97,7 +97,7 @@
 SC_END
 
 SC_BEGIN COMMENTEDIT
-global $COMMENTEDIT, $pref, $comrow;
+global $COMMENTEDIT, $pref, $comrow, $comment_edit_query;
 if ($pref['allowCommentEdit'] && USER && $comrow['user_id'] == USERID && $comrow['comment_lock'] != "1")
 {
 	if (!strstr(e_QUERY, "."))
@@ -106,7 +106,7 @@
 	}
 	else
 	{
-		return "<a href='".e_SELF."?".e_QUERY.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
+		return "<a href='".e_SELF."?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
 	}
 }
 else
@@ -123,7 +123,7 @@
 SC_BEGIN IPADDRESS
 global $IPADDRESS, $comrow;
 require_once(e_HANDLER."encrypt_handler.php");
-return (ADMIN ? "<a href='".e_BASE."userposts.php?0.comments.".$comrow['comment_ip']."'>".COMLAN_330." ".decode_ip($comrow['comment_ip'])."</a>" : "");
+return (ADMIN ? "<a href='".e_BASE."userposts.php?0.comments.".$comrow['user_id']."'>".COMLAN_330." ".decode_ip($comrow['comment_ip'])."</a>" : "");
 SC_END
 
 SC_BEGIN LEVEL
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/download_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/download_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/download_shortcodes.php	2006-11-26 20:23:16.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/batch/download_shortcodes.php	2007-10-12 14:54:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/download_shortcodes.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/11/27 02:23:16 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.27 $
+|     $Date: 2007/10/12 19:54:27 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -27,7 +27,7 @@
 }
 if($parm == "request"){
 
-	$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc defs"));
+	$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc, defs"));
 	if($row['download_mirror_type']){
 		$text = ($pref['agree_flag'] ? "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' title='".LAN_dl_32."'>");
 	}else{
@@ -115,7 +115,7 @@
 
 SC_BEGIN DOWNLOAD_LIST_LINK
 global $tp,$row,$pref;
-$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc defs"));
+$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc, defs"));
 	if($row['download_mirror_type']){
 		return ($pref['agree_flag'] ? "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' >");
 	}else{
@@ -123,6 +123,10 @@
 	}
 SC_END
 
+SC_BEGIN DOWNLOAD_LIST_NEXTPREV
+	global $nextprev_parms,$tp;
+ 	return $tp->parseTemplate("{NEXTPREV={$nextprev_parms}}");
+SC_END
 
 
 // ---------------------- Download View ----------------------------------------
@@ -155,7 +159,7 @@
 
 SC_BEGIN DOWNLOAD_CATEGORY_DESCRIPTION
 global $tp,$dl;
-$text = $tp -> toHTML($dl['download_category_description'], TRUE);
+$text = $tp -> toHTML($dl['download_category_description'], TRUE,'description');
 if($parm){
 	return substr($text,0,$parm);
 }else{
@@ -175,8 +179,12 @@
 SC_END
 
 SC_BEGIN DOWNLOAD_VIEW_NAME_LINKED
-global $dl;
-return "<a href='".e_BASE."request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
+global $pref,$dl,$tp;
+if ($pref['agree_flag'] == 1) {
+	return "<a href='".e_BASE."request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc, defs"))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
+} else {
+	return "<a href='".e_BASE."request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
+}
 SC_END
 
 SC_BEGIN DOWNLOAD_VIEW_AUTHOR
@@ -200,7 +208,7 @@
 SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION
 global $tp, $dl;
 $maxlen = ($parm ? intval($parm) : 0);
-$text = ($dl['download_description'] ?  $tp->toHTML($dl['download_description'], TRUE) : "");
+$text = ($dl['download_description'] ?  $tp->toHTML($dl['download_description'], TRUE, 'description') : "");
 if($maxlen){
 	return substr($text, 0, $maxlen);
 }else{
@@ -240,7 +248,6 @@
 {
 	return LAN_dl_75;
 }
-
 SC_END
 
 SC_BEGIN DOWNLOAD_VIEW_IMAGEFULL
@@ -251,7 +258,7 @@
 SC_BEGIN DOWNLOAD_VIEW_LINK
 global $pref,$dl,$tp;
 if ($pref['agree_flag'] == 1) {
-	$dnld_link = "<a href='".e_BASE."request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc defs"))."');\">";
+	$dnld_link = "<a href='".e_BASE."request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc, defs"))."');\">";
 } else {
 	$dnld_link = "<a href='".e_BASE."request.php?".$dl['download_id']."'>";
 }
@@ -373,7 +380,7 @@
 SC_END
 
 SC_BEGIN DOWNLOAD_VIEW_REQUESTED_LAN
-return LAN_dl_18;
+return LAN_dl_77;
 SC_END
 
 SC_BEGIN DOWNLOAD_VIEW_LINK_LAN
@@ -415,6 +422,10 @@
 return "<a href='".e_BASE."download.php?list.".$dl['download_category']."'>".LAN_dl_35."</a>";
 SC_END
 
+SC_BEGIN DOWNLOAD_BACK_TO_CATEGORY_LIST
+	return "<a href='".e_SELF."'>".LAN_dl_9."</a>";
+SC_END
+
 
 //  ---------------   Download - Admin  -----------------------------------
 
@@ -427,9 +438,10 @@
 	  	SELECT dc.download_category_name, dc.download_category_order, dc.download_category_id, dc.download_category_parent,
 	  	dc1.download_category_parent AS d_parent1
 	  	FROM #download_category AS dc
-	  	LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent AND dc1.download_category_class IN (".USERCLASS_LIST.")";
-        $qry .= " WHERE dc.download_category_class IN (".USERCLASS_LIST.") ";
-	 	$qry .= " ORDER by dc.download_category_parent, dc.download_category_order";
+	  	LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent AND dc1.download_category_class IN (".USERCLASS_LIST.")
+	    LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent ";
+        if (ADMIN === FALSE) $qry .= " WHERE dc.download_category_class IN (".USERCLASS_LIST.") ";
+	 	$qry .= " ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order";   // This puts main categories first, then sub-cats, then sub-sub cats
 
   	  	if (!$sql->db_Select_gen($qry))
 	  	{
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/news_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/news_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/news_shortcodes.php	2006-11-11 22:04:59.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/batch/news_shortcodes.php	2007-11-08 15:05:51.000000000 -0600
@@ -11,29 +11,30 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/news_shortcodes.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2006/11/12 04:04:59 $
-|     $Author: mrpete $
+|     $Revision: 1.34 $
+|     $Date: 2007/11/08 21:05:51 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 include_once(e_HANDLER.'shortcode_handler.php');
 $news_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+if(!$GLOBALS['NEWS_CSSMODE']){ $GLOBALS['NEWS_CSSMODE'] = "news"; }
 /*
 SC_BEGIN NEWSTITLE
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return $tp -> toHTML($news_item['news_title'], TRUE, 'parse_sc,no_hook,emotes_off, no_make_clickable');
+return $tp -> toHTML($news_item['news_title'], TRUE, 'TITLE');
 SC_END
 
 SC_BEGIN NEWSBODY
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$news_body = $tp -> toHTML($news_item['news_body'], TRUE, 'parse_sc, fromadmin', $news_item['news_author']);
-if($news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE)) {
-    $news_extended = $tp -> toHTML($news_item['news_extended'], TRUE, 'parse_sc, fromadmin', $news_item['news_author']);
+$news_body = $tp -> toHTML($news_item['news_body'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
+if($news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != "noextend") {
+    $news_extended = $tp -> toHTML($news_item['news_extended'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
     $news_body .= "<br /><br />".$news_extended;
 }
 return $news_body;
@@ -44,7 +45,7 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
-return "<a href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."'  src='".$category_icon."' alt='' /></a>";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_icon' href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."'  src='".$category_icon."' alt='' /></a>";
 SC_END
 
 SC_BEGIN NEWSHEADER
@@ -62,8 +63,8 @@
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$category_name = $tp -> toHTML($news_item['category_name']);
-return "<a style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".e_BASE."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
+$category_name = $tp -> toHTML($news_item['category_name'],FALSE,"defs");
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".e_BASE."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
 SC_END
 
 SC_BEGIN NEWSAUTHOR
@@ -77,7 +78,7 @@
 	}
 	else
 	{
-		return "<a href='".e_BASE."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
+		return "<a class='".$GLOBALS['NEWS_CSSMODE']."_author' href='".e_BASE."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
 	}
 }
 return "<a href='http://e107.org'>e107</a>";
@@ -110,6 +111,10 @@
 
 SC_BEGIN NEWSCOMMENTS
 global $pref, $sql;
+if($pref['comments_disabled'] == 1)
+{
+	return;
+}
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $news_item['news_comment_total'] = $sql->db_Select("comments", "*", "comment_item_id='".$news_item['news_id']."' AND comment_type='0' ");
@@ -182,7 +187,7 @@
 SC_BEGIN EXTENDED
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-if ($news_item['news_extended'] && strpos(e_QUERY, 'extend') === FALSE) {
+if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == "force")) {
 	if (defined("PRE_EXTENDEDSTRING")) {
 		$es1 = PRE_EXTENDEDSTRING;
 	}
@@ -192,7 +197,7 @@
 	if (isset($_POST['preview'])) {
 		return $es1.EXTENDEDSTRING.$es2."<br />".$news_item['news_extended'];
 	} else {
-		return $es1."<a href='".e_BASE."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
+		return $es1."<a class='".$GLOBALS['NEWS_CSSMODE']."_extendstring' href='".e_BASE."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
 	}
 } else {
 	return "";
@@ -232,13 +237,13 @@
 SC_BEGIN NEWSTHUMBNAIL
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='news_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
+return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='".$GLOBALS['NEWS_CSSMODE']."_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
 SC_END
 
 SC_BEGIN NEWSIMAGE
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='news_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
+return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='".$GLOBALS['NEWS_CSSMODE']."_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
 SC_END
 
 SC_BEGIN STICKY_ICON
@@ -250,7 +255,8 @@
 SC_BEGIN NEWSTITLELINK
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return "<a style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'>".$news_item['news_title']."</a>";
+$mode = ($parm == "extend") ? "extend" : "item";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_titlelink' style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".e_BASE."news.php?".$mode.".".$news_item['news_id'].".".$news_item['news_category']."' title=\"".$news_item['news_title']."\" >".$news_item['news_title']."</a>";
 SC_END
 
 SC_BEGIN NEWSCATICON
@@ -259,18 +265,15 @@
 $param = getcachedvars('current_news_param');
 $category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
 if($param['caticon'] == ""){$param['caticon'] = "border:0px";}
-return "<a href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_caticon' href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
 SC_END
 
 SC_BEGIN TRACKBACK
 global $pref;
+if(!varsettrue($pref['trackbackEnabled'])) return '';
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-if(isset($pref['trackbackEnabled'])) {
-	return ($param['trackbackbeforestring'] ? $param['trackbackbeforestring'] : "")."<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."#track'>".$param['trackbackstring'].$news_item['tb_count']."</a>".($param['trackbackafterstring'] ? $param['trackbackafterstring'] : "");
-} else {
-	return "";
-}
+return ($param['trackbackbeforestring'] ? $param['trackbackbeforestring'] : "")."<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."#track'>".$param['trackbackstring'].$news_item['tb_count']."</a>".($param['trackbackafterstring'] ? $param['trackbackafterstring'] : "");
 SC_END
 
 SC_BEGIN NEWSINFO
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/signup_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/signup_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/signup_shortcodes.php	2006-08-25 10:14:58.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/batch/signup_shortcodes.php	2007-10-11 14:46:05.000000000 -0500
@@ -11,9 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/signup_shortcodes.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/08/25 15:14:58 $
-|     $Author: e107coders $
+|     $Revision: 1.14 $
+|     $Date: 2007/10/11 19:46:05 $
+|     $Author: e107steved $
+|
+| Mods to show extended field categories
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -67,19 +69,30 @@
 }
 SC_END
 
+SC_BEGIN SIGNUP_XUP_ACTION
+global $pref, $tp, $SIGNUP_XUP_BUTTON, $signup_shortcodes;
+if(isset($pref['xup_enabled']) && $pref['xup_enabled'])
+{
+// Puts the button to allow XUP signup onto the 'normal' signup screen
+	return $tp->parseTemplate($SIGNUP_XUP_BUTTON, TRUE, $signup_shortcodes);
+}
+SC_END
+
 
 SC_BEGIN SIGNUP_DISPLAYNAME
 global $pref, $rs;
 if (check_class($pref['displayname_class']))
 {
-	return $rs->form_text("name", 30, ($_POST['name'] ? $_POST['name'] : $name), 30);
+  $dis_name_len = varset($pref['displayname_maxlength'],15);
+  return $rs->form_text("name", $dis_name_len+5, ($_POST['name'] ? $_POST['name'] : $name), $dis_name_len);
 }
 SC_END
 
 
 SC_BEGIN SIGNUP_LOGINNAME
 global $rs;
-return $rs->form_text("loginname", 30,  ($_POST['loginname'] ? $_POST['loginname'] : $loginname), 30);
+$log_name_length = varset($pref['loginname_maxlength'],30);
+return $rs->form_text("loginname", $log_name_length+5,  ($_POST['loginname'] ? $_POST['loginname'] : $loginname), $log_name_length);
 SC_END
 
 SC_BEGIN SIGNUP_REALNAME
@@ -121,7 +134,8 @@
 
 SC_BEGIN SIGNUP_HIDE_EMAIL
 global $rs;
-return $rs->form_radio("hideemail", 0, 1)." ".LAN_SIGNUP_10."&nbsp;&nbsp;".$rs->form_radio("hideemail", 0)." ".LAN_200;
+$default_email_setting = 1;   // Gives option of turning into a pref later if wanted
+return $rs->form_radio("hideemail", 1, $default_email_setting==1)." ".LAN_SIGNUP_10."&nbsp;&nbsp;".$rs->form_radio("hideemail",  0,$default_email_setting==0)." ".LAN_200;
 SC_END
 
 
@@ -146,30 +160,52 @@
 
 
 SC_BEGIN SIGNUP_EXTENDED_USER_FIELDS
-global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $EXTENDED_USER_FIELD_REQUIRED;
+global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $EXTENDED_USER_FIELD_REQUIRED, $SIGNUP_EXTENDED_CAT;
 $text = "";
 
-$extList = $usere->user_extended_get_fieldList();
-
 $search = array(
 '{EXTENDED_USER_FIELD_TEXT}',
 '{EXTENDED_USER_FIELD_REQUIRED}',
 '{EXTENDED_USER_FIELD_EDIT}'
 );
 
-foreach($extList as $ext)
-{
-	if($ext['user_extended_struct_required'] == 1 || $ext['user_extended_struct_required'] == 2)
-	{
-		$replace = array(
-			$tp->toHTML($ext['user_extended_struct_text'], '', 'emotes_off defs'),
-			($ext['user_extended_struct_required'] == 1 ? $EXTENDED_USER_FIELD_REQUIRED : ''),
-			$usere->user_extended_edit($ext, $_POST['ue']['user_'.$ext['user_extended_struct_name']])
-		);
-		$text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);
-	}
+
+// What we need is a list of fields, ordered first by parent, and then by display order?
+// category entries are `user_extended_struct_type` = 0
+// 'unallocated' entries are `user_extended_struct_parent` = 0
+
+// Get a list of defined categories
+$catList = $usere->user_extended_get_categories(FALSE);
+// Add in category zero - the 'no category' category
+array_unshift($catList,array('user_extended_struct_parent' => 0, 'user_extended_struct_id' => '0'));
+
+
+
+foreach($catList as $cat)
+{
+  $extList = $usere->user_extended_get_fieldList($cat['user_extended_struct_id']);
+
+  $done_heading = FALSE;
+  
+  foreach($extList as $ext)
+  {
+  	if($ext['user_extended_struct_required'] == 1 || $ext['user_extended_struct_required'] == 2)
+   	{
+      if(!$done_heading  && ($cat['user_extended_struct_id'] > 0))
+      {	// Add in a heading
+		$text .= str_replace('{EXTENDED_CAT_TEXT}', $tp->toHTML($cat['user_extended_struct_name'], '', 'emotes_off defs'), $SIGNUP_EXTENDED_CAT);
+		$done_heading = TRUE;
+	  }
+  	  $replace = array(
+    			$tp->toHTML($ext['user_extended_struct_text'], '', 'emotes_off defs'),
+    			($ext['user_extended_struct_required'] == 1 ? $EXTENDED_USER_FIELD_REQUIRED : ''),
+    			$usere->user_extended_edit($ext, $_POST['ue']['user_'.$ext['user_extended_struct_name']])
+        );
+      $text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);
+    }
+  }
 }
-	return $text;
+return $text;
 SC_END
 
 SC_BEGIN SIGNUP_SIGNATURE
@@ -192,7 +228,7 @@
 	$text = "
 	<input class='tbox' style='width:80%' id='avatar' type='text' name='image' size='40' value='$image' maxlength='100' />
 
-	<input class='button' type ='button' style='cursor:hand' size='30' value='".LAN_SIGNUP_27."' onclick='expandit(this)' />
+	<input class='button' type ='button' style='cursor:pointer' size='30' value='".LAN_SIGNUP_27."' onclick='expandit(this)' />
 	<div style='display:none' >";
 	$avatarlist[0] = "";
 	$handle = opendir(e_IMAGE."avatars/");
@@ -213,17 +249,18 @@
 	$text .= "<br />
 	</div><br />";
 
-	if ($pref['avatar_upload'] && FILE_UPLOADS)
+    // Intentionally disable uploadable avatar and photos at this stage
+	if (false && $pref['avatar_upload'] && FILE_UPLOADS)
 	{
 		$text .= "<br /><span class='smalltext'>".LAN_SIGNUP_25."</span> <input class='tbox' name='file_userfile[]' type='file' size='40' />
 		<br /><div class='smalltext'>".LAN_SIGNUP_34."</div>";
 	}
 
-	if ($pref['photo_upload'] && FILE_UPLOADS)
+	if (false && $pref['photo_upload'] && FILE_UPLOADS)
 	{
 		$text .= "<br /><span class='smalltext'>".LAN_SIGNUP_26."</span> <input class='tbox' name='file_userfile[]' type='file' size='40' />
 		<br /><div class='smalltext'>".LAN_SIGNUP_34."</div>";
-	}
+	}  
 	return $text;
 }
 SC_END
@@ -284,6 +321,18 @@
 return $rs->form_password("password2xup", 30, $password2, 20);
 SC_END
 
+SC_BEGIN SIGNUP_IS_MANDATORY
+global $pref;
+if (isset($parm))
+{
+  switch ($parm)
+  {
+    case 'email' : if (varset($pref['disable_emailcheck'],FALSE)) return '';
+  }
+}
+return " *";
+SC_END
+
 */
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/user_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/user_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/user_shortcodes.php	2006-10-14 18:41:11.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/batch/user_shortcodes.php	2007-12-19 14:34:28.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/user_shortcodes.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2006/10/14 23:41:11 $
-|     $Author: e107coders $
+|     $Revision: 1.26 $
+|     $Date: 2007/12/19 20:34:28 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -25,8 +25,12 @@
 global $sql;
 if(!$chatposts = getcachedvars('total_chatposts'))
 {
+  $chatposts = 0;				// In case plugin not installed
+  if (isset($pref['plug_installed']['chatbox_menu']))
+  {
 	$chatposts = $sql->db_Count("chatbox");
-	cachevars('total_chatposts', $chatposts);
+  }
+  cachevars('total_chatposts', $chatposts);
 }
 return $chatposts;
 SC_END
@@ -76,8 +80,12 @@
 global $sql, $user;
 if(!$chatposts = getcachedvars('total_chatposts'))
 {
+  $chatposts = 0;			// In case plugin not installed
+  if (isset($pref['plug_installed']['chatbox_menu']))
+  {
 	$chatposts = $sql->db_Count("chatbox");
-	cachevars('total_chatposts', $chatposts);
+  }
+  cachevars('total_chatposts', $chatposts);
 }
 return round(($user['user_chats']/$chatposts) * 100, 2);
 SC_END
@@ -184,7 +192,7 @@
 
 SC_BEGIN USER_EMAIL
 global $user,$tp;
-return ($user['user_hideemail'] && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($user['user_email'],"no_replace");
+return ($user['user_hideemail'] && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($user['user_email'],FALSE,"no_replace");
 SC_END
 
 SC_BEGIN USER_ICON
@@ -278,8 +286,11 @@
 SC_END
 
 SC_BEGIN USER_SENDPM
-global $tp, $user;
-return $tp->parseTemplate("{SENDPM={$user['user_id']}}");
+global $pref, $tp, $user;
+if(isset($pref['plug_installed']['pm']) && ($user['user_id'] > 0))
+{
+  return $tp->parseTemplate("{SENDPM={$user['user_id']}}");
+}
 SC_END
 
 SC_BEGIN USER_RATING
@@ -318,7 +329,8 @@
 SC_END
 
 SC_BEGIN USER_JUMP_LINK
-global $sql, $user;
+global $sql, $user, $full_perms;
+if (!$full_perms) return;
 if(!$userjump = getcachedvars('userjump'))
 {
 	$sql->db_Select("user", "user_id, user_name", "ORDER BY user_id ASC", "no-where");
@@ -411,7 +423,7 @@
 $ueCatList = $ue->user_extended_get_categories();
 $ueFieldList = $ue->user_extended_get_fields();
 $ueCatList[0][0] = array('user_extended_struct_name' => LAN_410);
-
+$ret = "";
 foreach($ueCatList as $catnum => $cat)
 {
 	$key = $cat[0]['user_extended_struct_name'];
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/batch/usersettings_shortcodes.php 0.7.11.src/e107_files/shortcode/batch/usersettings_shortcodes.php
--- 0.7.7.src/e107_files/shortcode/batch/usersettings_shortcodes.php	2006-10-25 10:27:19.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/batch/usersettings_shortcodes.php	2007-07-23 15:05:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/usersettings_shortcodes.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/10/25 15:27:19 $
-|     $Author: e107coders $
+|     $Revision: 1.27 $
+|     $Date: 2007/07/23 20:05:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -22,9 +22,11 @@
 /*
 SC_BEGIN USERNAME
 global $rs, $curVal, $pref;
+// This is the 'display name'
 if (check_class($pref['displayname_class']))
 {
-	return $rs->form_text("username", 20, $curVal['user_name'], $pref['displayname_maxlength'], "tbox");
+  $dis_name_len = varset($pref['displayname_maxlength'],15);
+  return $rs->form_text("username", $dis_name_len, $curVal['user_name'], $dis_name_len, "tbox");
 }
 else
 {
@@ -36,7 +38,8 @@
 global $rs, $curVal;
 if (ADMIN && getperms("4"))
 {
-	return $rs->form_text("loginname", 20, $curVal['user_loginname'], 100, "tbox");
+  $log_name_length = varset($pref['loginname_maxlength'],30);
+  return $rs->form_text("loginname", $log_name_length, $curVal['user_loginname'], $log_name_length, "tbox");
 }
 else
 {
@@ -169,7 +172,7 @@
 global $pref;
 if ($pref['avatar_upload'] && FILE_UPLOADS)
 {
-		return "<input class='tbox' name='file_userfile[]' type='file' size='47' />";
+		return "<input class='tbox' name='file_userfile[avatar]' type='file' size='47' />";
 }
 SC_END
 
@@ -180,7 +183,7 @@
 
 SC_BEGIN AVATAR_CHOOSE
 $ret = "
-<input class='button' type ='button' style=' cursor:hand' size='30' value='".LAN_403."' onclick='expandit(this)' />
+<input class='button' type ='button' style=' cursor:pointer' size='30' value='".LAN_403."' onclick='expandit(this)' />
 <div style='display:none' >";
 $avatarlist[0] = "";
 $handle = opendir(e_IMAGE."avatars/");
@@ -209,7 +212,8 @@
 global $pref;
 if ($pref['photo_upload'] && FILE_UPLOADS)
 {
-		return "<input class='tbox' name='file_userfile[]' type='file' size='47' />";
+	return "<input type='checkbox' name='user_delete_photo' value='1' />".LAN_USET_16."<br />\n
+	        <input class='tbox' name='file_userfile[photo]' type='file' size='47' />";
 }
 SC_END
 
@@ -227,7 +231,7 @@
 $qry = "
 SELECT * FROM #user_extended_struct
 WHERE user_extended_struct_applicable IN (".$tp -> toDB($curVal['userclass_list'], true).")
-AND user_extended_struct_write IN (".$tp -> toDB($curVal['userclass_list'], true).")
+AND user_extended_struct_write IN (".USERCLASS_LIST.")
 AND user_extended_struct_type = 0
 ORDER BY user_extended_struct_order ASC
 ";
@@ -240,9 +244,9 @@
 foreach($catList as $cat)
 {
 	cachevars("extendedcat_{$cat['user_extended_struct_id']}", $cat);
-	$ret .= $tp->parseTemplate("{USEREXTENDED_CAT={$cat['user_extended_struct_id']}}", FALSE, $usersettings_shortcodes);
+  	$ret .= $tp->parseTemplate("{USEREXTENDED_CAT={$cat['user_extended_struct_id']}}", TRUE, $usersettings_shortcodes);
 }
-return $ret;
+ return $ret;
 SC_END
 
 SC_BEGIN USEREXTENDED_CAT
@@ -283,7 +287,7 @@
 		foreach($fieldList as $field)
 		{
 			cachevars("extendedfield_{$cat['user_extended_struct_name']}", $field);
-			$ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", FALSE, $usersettings_shortcodes);
+			$ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes);
 		}
 	}
 }
@@ -322,7 +326,7 @@
 
 if($fInfo)
 {
-	$fname = $tp->toHTML($fInfo['user_extended_struct_text'], "", "emotes_off defs");
+	$fname = $tp->toHTML($fInfo['user_extended_struct_text'], "", "emotes_off, defs");
 	if($fInfo['user_extended_struct_required'] == 1)
 	{
 		$fname = str_replace("{FIELDNAME}", $fname, $REQUIRED_FIELD);
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/custom.sc 0.7.11.src/e107_files/shortcode/custom.sc
--- 0.7.7.src/e107_files/shortcode/custom.sc	2006-11-28 17:18:43.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/custom.sc	2007-04-15 00:02:16.000000000 -0500
@@ -1,25 +1,28 @@
-global $tp;
+global $tp,$pref;
 $ret = "";
 $custom_query = explode('+', $parm);
 switch($custom_query[0])
 {
 		case "login":
 		case "login noprofile":
-				@include_once(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
-				@include_once(e_PLUGIN."login_menu/languages/English.php");
+				include_lan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
+
+				$sep = (defined("LOGINC_SEP")) ? LOGINC_SEP : "<span class='loginc sep'>.:.</span>";
 
 				if (USER == TRUE){
-						$ret .= "<span class='mediumtext'>".LOGIN_MENU_L5." ".USERNAME."&nbsp;&nbsp;&nbsp;.:. ";
+						$ret .= "<span class='mediumtext'><span class='loginc welcome'>".LOGIN_MENU_L5." ".USERNAME."</span>&nbsp;&nbsp;&nbsp;".$sep." ";
 						if(ADMIN == TRUE){
-								$ret .= "<a href='".e_ADMIN."admin.php'>".LOGIN_MENU_L11."</a> .:. ";
+								$ret .= "<a class='loginc admin' href='".e_ADMIN."admin.php'>".LOGIN_MENU_L11."</a> ".$sep." ";
 						}
-						$ret .= ($custom_query[0] != "login noprofile") ? "<a href='".e_BASE."user.php?id.".USERID."'>".LOGIN_MENU_L13."</a>\n.:. ":"";
-						$ret .= "<a href='" . e_BASE . "usersettings.php'>".LOGIN_MENU_L12."</a> .:. <a href='".e_BASE."index.php?logout'>".LOGIN_MENU_L8."</a> .:.</span>";
+						$ret .= ($custom_query[0] != "login noprofile") ? "<a class='loginc profile' href='".e_BASE."user.php?id.".USERID."'>".LOGIN_MENU_L13."</a>\n".$sep." ":"";
+						$ret .= "<a class='loginc usersettings' href='" . e_BASE . "usersettings.php'>".LOGIN_MENU_L12."</a> ".$sep." <a class='loginc logout' href='".e_BASE."index.php?logout'>".LOGIN_MENU_L8."</a> ".$sep."</span>";
 				} else {
-						$ret .= "<form method='post' action='".e_SELF."'>\n<div class='loginc_div'>\n".LOGIN_MENU_L1."<input class='tbox loginc user' type='text' name='username' size='15' value='$username' maxlength='20' />&nbsp;&nbsp;\n".LOGIN_MENU_L2."<input class='tbox loginc pass' type='password' name='userpass' size='15' value='' maxlength='20' />&nbsp;&nbsp;\n<input type='checkbox' name='autologin' value='1' />".LOGIN_MENU_L6."&nbsp;&nbsp;\n<input class='button loginc' type='submit' name='userlogin' value='".LOGIN_MENU_L28."' />";
+						$ret .= "<form method='post' action='".e_SELF."'>\n<div class='loginc_div'>\n".LOGIN_MENU_L1."<input class='tbox loginc user' type='text' name='username' size='15' value='$username' maxlength='20' />&nbsp;&nbsp;\n".LOGIN_MENU_L2."<input class='tbox loginc pass' type='password' name='userpass' size='15' value='' maxlength='20' />&nbsp;&nbsp;\n";
+						$ret .= ($pref['user_tracking'] == "cookie") ? "<input type='checkbox' name='autologin' value='1' />".LOGIN_MENU_L6."&nbsp;&nbsp;\n" : "";
+						$ret .= "<input class='button loginc' type='submit' name='userlogin' value='".LOGIN_MENU_L28."' />";
 						if($pref['user_reg'])
 						{
-							$ret .= "&nbsp;&nbsp;<a href='".e_SIGNUP."'>".LOGIN_MENU_L3."</a>";
+							$ret .= "&nbsp;&nbsp;<a class='loginc signup' href='".e_SIGNUP."'>".LOGIN_MENU_L3."</a>";
 						}
 						$ret .= "</div>\n</form>";
 				}
@@ -27,7 +30,7 @@
 				break;
 
 		case "search":
-				if(!USER && $pref['search_restrict'] == 1)
+				if(!check_class($pref['search_restrict']))
 				{
 						return "";
 				}
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/email.sc 0.7.11.src/e107_files/shortcode/email.sc
--- 0.7.7.src/e107_files/shortcode/email.sc	2005-07-05 12:12:00.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/email.sc	2006-12-31 09:11:04.000000000 -0600
@@ -4,7 +4,7 @@
 if (substr($parm, -5) == '-link')
 {
 	$parm = substr($parm, 0, -5);
-	return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($parm);
+	return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($parm,TRUE);
 }
 else
 {
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/emailto.sc 0.7.11.src/e107_files/shortcode/emailto.sc
--- 0.7.7.src/e107_files/shortcode/emailto.sc	2006-03-16 07:07:55.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/emailto.sc	2007-10-27 15:19:26.000000000 -0500
@@ -1,17 +1,3 @@
-global $pref;
-
-if (!USER)
-{
-	return "";
-}
-
+if (!USER) { return ""; }
 $image = IMAGE_email;
-
-if(is_numeric($parm))
-{
-	return "<a href='".e_BASE."emailmember.php?id.{$parm}'>{$image}</a>";
-}
-else
-{
-	return "<a href='mailto:{$parm}'>{$image}</a>";
-}
+return "<a href='mailto:{$parm}'>{$image}</a>";
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/imageselector.sc 0.7.11.src/e107_files/shortcode/imageselector.sc
--- 0.7.7.src/e107_files/shortcode/imageselector.sc	2006-05-31 01:33:28.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/imageselector.sc	2007-05-28 13:48:59.000000000 -0500
@@ -1,4 +1,4 @@
-// $Id: imageselector.sc,v 1.4 2006/05/31 06:33:28 e107coders Exp $
+// $Id: imageselector.sc,v 1.5 2007/05/28 18:48:59 e107steved Exp $
 
 global $sql,$parm;
 
@@ -24,7 +24,7 @@
     $height = ($height) ? $height : "*";
     $label = ($label) ? $label : " -- -- ";
 
-	$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"preview_image('$name','$path');\">
+	$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"preview_image('$name','$path','".e_IMAGE_ABS."generic/blank.gif');\">
 	<option value=''>".$label."</option>\n";
 	foreach($imagelist as $icon)
 	{
@@ -34,7 +34,7 @@
 	}
 	$text .= "</select>";
 
-	$pvw_default = ($default) ? $path.$default : e_IMAGE."generic/blank.gif";
+	$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
   	$text .= "&nbsp;<img id='{$name}_prev' src='{$pvw_default}' alt='' style='width:{$width};height:{$height}' />\n";
 
 
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/languagelinks.sc 0.7.11.src/e107_files/shortcode/languagelinks.sc
--- 0.7.7.src/e107_files/shortcode/languagelinks.sc	2006-09-10 18:59:55.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/languagelinks.sc	2007-10-30 16:43:18.000000000 -0500
@@ -1,4 +1,4 @@
-// $Id: languagelinks.sc,v 1.6 2006/09/10 23:59:55 e107coders Exp $
+// $Id: languagelinks.sc,v 1.7 2007/10/30 21:43:18 e107coders Exp $
 global $pref;
 $sep = (defined("LANGLINKS_SEPARATOR")) ? LANGLINKS_SEPARATOR : "|&nbsp;";
 $cursub = explode(".",$_SERVER['HTTP_HOST']);
@@ -28,13 +28,13 @@
 		$subdom = (isset($cursub[2])) ? $cursub[0] : "";
 
 		if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain']){
-        	$link = (e_QUERY) ? str_replace($_SERVER['HTTP_HOST'],$code.$pref['multilanguage_subdomain'],e_SELF)."?".e_QUERY : str_replace($_SERVER['HTTP_HOST'],$code.$pref['multilanguage_subdomain'],e_SELF);
+        	$link = (e_QUERY) ? str_replace($_SERVER['HTTP_HOST'],$code.".".e_DOMAIN,e_SELF)."?".e_QUERY : str_replace($_SERVER['HTTP_HOST'],$code.".".e_DOMAIN,e_SELF);
 		}
 		else{
 			$link = (e_QUERY) ? e_SELF."?[".$code."]".e_QUERY : e_SELF."?[".$code."]";
 		}
 		if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'] && $val == $pref['sitelanguage']){
-        	$link = str_replace($code.$pref['multilanguage_subdomain'],"www".$pref['multilanguage_subdomain'],$link);
+        	$link = str_replace($code.".".e_DOMAIN,"www.".e_DOMAIN,$link);
 		}
 		$class = ($val == e_LANGUAGE) ? "languagelink_active" : "languagelink";
     	$ret[] =  "<a class='{$class}' href='{$link}' title=\"".$name."\">".$name."</a>\n";
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/logo.sc 0.7.11.src/e107_files/shortcode/logo.sc
--- 0.7.7.src/e107_files/shortcode/logo.sc	2006-04-27 13:49:14.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/logo.sc	2007-11-18 08:04:56.000000000 -0600
@@ -1,33 +1,36 @@
-parse_str($parm);
+parse_str($parm);		// Optional {LOGO=file=file_name} or {LOGO=link=url} or {LOGO=file=file_name&link=url}
+						// Paths to image file, link are relative to site base
 
 if (isset($file) && $file && is_readable($file))
 {
-	$logo = $file;
-	$path = $file;
+	$logo = e_HTTP.$file;						// HTML path
+	$path = e_BASE.$file;						// PHP path
 }
 else if (is_readable(THEME."images/e_logo.png"))
 {
-	$logo = THEME_ABS."images/e_logo.png";
-	$path = THEME."images/e_logo.png";
+	$logo = THEME_ABS."images/e_logo.png";		// HTML path
+	$path = THEME."images/e_logo.png";			// PHP path
 }
 else
 {
-	$logo = e_IMAGE."logo.png";
-	$path = $logo;
+	$logo = e_IMAGE_ABS."logo.png";				// HTML path
+	$path = e_IMAGE."logo.png";					// PHP path
 }
 
 $dimensions = getimagesize($path);
 
 $image = "<img class='logo' src='".$logo."' style='width: ".$dimensions[0]."px; height: ".$dimensions[1]."px' alt='".SITENAME."' />\n";
 
-if (isset($link) && $link) {
-	if ($link == 'index') {
-		$image = "<a href='".e_BASE."index.php'>".$image."</a>";
-	}
-	else
-	{
-		$image = "<a href='".$link."'>".$image."</a>";
-	}
+if (isset($link) && $link) 
+{
+  if ($link == 'index') 
+  {
+	$image = "<a href='".e_HTTP."index.php'>".$image."</a>";
+  }
+  else
+  {	
+	$image = "<a href='".e_HTTP.$link."'>".$image."</a>";
+  }
 }
 
 return $image;
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/menu.sc 0.7.11.src/e107_files/shortcode/menu.sc
--- 0.7.7.src/e107_files/shortcode/menu.sc	2006-10-14 08:13:45.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/menu.sc	2007-05-11 14:58:08.000000000 -0500
@@ -1,4 +1,4 @@
-/* $Id: menu.sc,v 1.27 2006/10/14 13:13:45 lisa_ Exp $ */
+/* $Id: menu.sc,v 1.28 2007/05/11 19:58:08 e107steved Exp $ */
 global $sql;
 global $ns;
 global $eMenuList;
@@ -103,7 +103,7 @@
 		}
 		$sql->db_Mark_Time("(After ".$mname.")");
 		if ($error_handler->debug == true) {
-			echo "\n<!-- Menu Start: ".$mname." -->\n";			
+			echo "\n<!-- Menu End: ".$mname." -->\n";			
 		}
 	}
 }
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/news_categories.sc 0.7.11.src/e107_files/shortcode/news_categories.sc
--- 0.7.7.src/e107_files/shortcode/news_categories.sc	2006-05-13 17:06:01.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/news_categories.sc	2007-02-06 09:46:17.000000000 -0600
@@ -79,7 +79,7 @@
 		$replace[0] = ($category_icon) ? "<a href='".e_BASE."news.php?cat.".$category_id."'><img src='".e_IMAGE."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
 
 		$search[1] = "/\{NEWSCATEGORY\}(.*?)/si";
-		$replace[1] = ($category_name) ? "<a href='".e_BASE."news.php?cat.".$category_id."' style='".$param['catlink']."' >".$tp->toHTML($category_name)."</a>" : "";
+		$replace[1] = ($category_name) ? "<a href='".e_BASE."news.php?cat.".$category_id."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
 
 		$text3 .= ($t % $nbr_cols == 0) ? "<tr>" : "";
 		$text3 .= "\n<td style='".NEWSCAT_CELL."; width:$wid%;'>\n";
@@ -121,4 +121,4 @@
 
 	$text3 .= "</table></div>";
 
-return $text3;
\ No newline at end of file
+return $text3;
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/nextprev.sc 0.7.11.src/e107_files/shortcode/nextprev.sc
--- 0.7.7.src/e107_files/shortcode/nextprev.sc	2006-11-03 16:30:20.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/nextprev.sc	2007-08-17 23:17:09.000000000 -0500
@@ -6,27 +6,28 @@
 
 $parm_count = substr_count($parm, ",");
 
-while($parm_count < 4)
+while($parm_count < 5)
 {
-	$parm .= ",";
-	$parm_count++;
+    $parm .= ",";
+    $parm_count++;
 }
 
-$p = explode(",", $parm, 5);
+$p = explode(",", $parm, 6);
 
 $total_items = intval($p[0]);
 $perpage = intval($p[1]);
 $current_start = intval($p[2]);
 $url = trim($p[3]);
 $caption = trim($p[4]);
+$pagetitle = explode("|",trim($p[5]));
 
-if($total_items < $perpage) {	return ""; }
+if($total_items < $perpage) {   return ""; }
 
 $caption = (!$caption || $caption == "off") ? NP_3."&nbsp;" : $caption;
 
 while(substr($url, -1) == ".")
 {
-	$url=substr($url, 0, -1);
+    $url=substr($url, 0, -1);
 }
 
 $current_page = ($current_start/$perpage) + 1;
@@ -34,163 +35,165 @@
 
 if($total_pages > 1)
 {
-	if(isset($pref['old_np']) && $pref['old_np'])
-	{
+    if(isset($pref['old_np']) && $pref['old_np'])
+    {
 
-		$NP_PRE_ACTIVE = "";
-		$NP_POST_ACTIVE = "";
-		$NP_STYLE = "";
+        $NP_PRE_ACTIVE = "";
+        $NP_POST_ACTIVE = "";
+        $NP_STYLE = "";
 
         if(!defined("NEXTPREV_NOSTYLE") || NEXTPREV_NOSTYLE==FALSE){
-        	$NP_PRE_ACTIVE = "[";
+            $NP_PRE_ACTIVE = "[";
             $NP_POST_ACTIVE = "] ";
-			$NP_STYLE = "style='text-decoration:underline'";
-		}
+            $NP_STYLE = "style='text-decoration:underline'";
+        }
 
 
-		//	Use OLD nextprev method
-		$nppage = '';
-		$nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
-		if ($total_pages > 10)
-		{
-			$current_page = ($current_start/$perpage)+1;
-
-			for($c = 0; $c <= 2; $c++)
-			{
-				if($perpage * $c == $current_start)
-				{
-					$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-				}
-				else
-				{
-					$link = str_replace("[FROM]", ($perpage * $c), $url);
-					$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-
-				}
-			}
-
-			if ($current_page >= 3 && $current_page <= 5)
-			{
-				for($c = 3; $c <= $current_page; $c++)
-				{
-					if($perpage * $c == $current_start)
-					{
-						$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-					}
-					else
-					{
-						$link = str_replace("[FROM]", ($perpage * $c), $url);
-						$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-					}
-				}
-			}
-			else if($current_page >= 6 && $current_page <= ($total_pages-5))
-			{
-				$nppage .= " ... ";
-				for($c = ($current_page-2); $c <= $current_page; $c++)
-				{
-					if($perpage * $c == $current_start)
-					{
-						$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-					}
-					else
-					{
-						$link = str_replace("[FROM]", ($perpage * $c), $url);
-						$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-					}
-				}
-			}
-			$nppage .= " ... ";
-
-			if (($current_page+5) > $total_pages && $current_page != $total_pages)
-			{
-				$tmp = ($current_page-2);
-			}
-			else
-			{
-				$tmp = $total_pages-3;
-			}
-
-			for($c = $tmp; $c <= ($total_pages-1); $c++)
-			{
-				if($perpage * $c == $current_start)
-				{
-					$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-				}
-				else
-				{
-					$link = str_replace("[FROM]", ($perpage * $c), $url);
-					$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-				}
-			}
-
-		}
-		else
-		{
-			for($c = 0; $c < $total_pages; $c++)
-			{
-				if($perpage * $c == $current_start)
-				{
-					$nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-				}
-				else
-				{
-					$link = str_replace("[FROM]", ($perpage * $c), $url);
-					$nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-				}
-			}
-		}
+        //  Use OLD nextprev method
+        $nppage = '';
+        $nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
+        if ($total_pages > 10)
+        {
+            $current_page = ($current_start/$perpage)+1;
+
+            for($c = 0; $c <= 2; $c++)
+            {
+                if($perpage * $c == $current_start)
+                {
+                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                }
+                else
+                {
+                    $link = str_replace("[FROM]", ($perpage * $c), $url);
+                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+
+                }
+            }
+
+            if ($current_page >= 3 && $current_page <= 5)
+            {
+                for($c = 3; $c <= $current_page; $c++)
+                {
+                    if($perpage * $c == $current_start)
+                    {
+                        $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                    }
+                    else
+                    {
+                        $link = str_replace("[FROM]", ($perpage * $c), $url);
+                        $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                    }
+                }
+            }
+            else if($current_page >= 6 && $current_page <= ($total_pages-5))
+            {
+                $nppage .= " ... ";
+                for($c = ($current_page-2); $c <= $current_page; $c++)
+                {
+                    if($perpage * $c == $current_start)
+                    {
+                        $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                    }
+                    else
+                    {
+                        $link = str_replace("[FROM]", ($perpage * $c), $url);
+                        $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                    }
+                }
+            }
+            $nppage .= " ... ";
+
+            if (($current_page+5) > $total_pages && $current_page != $total_pages)
+            {
+                $tmp = ($current_page-2);
+            }
+            else
+            {
+                $tmp = $total_pages-3;
+            }
+
+            for($c = $tmp; $c <= ($total_pages-1); $c++)
+            {
+                if($perpage * $c == $current_start)
+                {
+                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                }
+                else
+                {
+                    $link = str_replace("[FROM]", ($perpage * $c), $url);
+                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                }
+            }
+
+        }
+        else
+        {
+            for($c = 0; $c < $total_pages; $c++)
+            {
+                if($perpage * $c == $current_start)
+                {
+                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                }
+                else
+                {
+                    $link = str_replace("[FROM]", ($perpage * $c), $url);
+                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                }
+            }
+        }
         $nppage .= "\n\n<!-- End of Next/Prev -->\n\n";
-		return $caption.$nppage;
-	}
+        return $caption.$nppage;
+    }
 
-	// Use NEW nextprev method
-	$np_parm['template'] = "[PREV]&nbsp;&nbsp;[DROPDOWN]&nbsp;&nbsp;[NEXT]";
-	$np_parms['prev'] = "&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;";
-	$np_parms['next'] = "&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;";
-	$np_parms['np_class'] = 'tbox npbutton';
-	$np_parms['dropdown_class'] = 'tbox npdropdown';
-
-	if($cached_parms = getcachedvars('nextprev'))
-	{
-		$tmp = $cached_parms;
-		foreach($tmp as $key => $val)
-		{
-			$np_parms[$key]=$val;
-		}
-	}
-
-	$prev="";
-	$next="";
-	if($current_page > 1)
-	{
-		$prevstart = ($current_start - $perpage);
-		$link = str_replace("[FROM]", $prevstart, $url);
-		$prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>";
-	}
-	if($current_page < $total_pages)
-	{
-		$nextstart = ($current_start + $perpage);
-		$link = str_replace("[FROM]", $nextstart, $url);
-		$next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>";
-	}
-	$dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>";
-	for($i = 1; $i <= $total_pages; $i++)
-	{
-		$sel = "";
-		if($current_page == $i)
-		{
-			$sel = " selected='selected' ";
-		}
-		$newstart = ($i-1)*$perpage;
-		$link = str_replace("[FROM]", $newstart, $url);
-		$dropdown .= "<option value='{$link}' {$sel}>{$i}</option>\n";
-	}
-	$dropdown .= "</select>";
-	$ret = $np_parm['template'];
-	$ret = str_replace('[DROPDOWN]', $dropdown, $ret);
-	$ret = str_replace('[PREV]', $prev, $ret);
-	$ret = str_replace('[NEXT]', $next, $ret);
-	return $caption.$ret;
+    // Use NEW nextprev method
+    $np_parm['template'] = "[PREV]&nbsp;&nbsp;[DROPDOWN]&nbsp;&nbsp;[NEXT]";
+    $np_parms['prev'] = "&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;";
+    $np_parms['next'] = "&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;";
+    $np_parms['np_class'] = 'tbox npbutton';
+    $np_parms['dropdown_class'] = 'tbox npdropdown';
+
+    if($cached_parms = getcachedvars('nextprev'))
+    {
+        $tmp = $cached_parms;
+        foreach($tmp as $key => $val)
+        {
+            $np_parms[$key]=$val;
+        }
+    }
+
+    $prev="";
+    $next="";
+    if($current_page > 1)
+    {
+        $prevstart = ($current_start - $perpage);
+        $link = str_replace("[FROM]", $prevstart, $url);
+        $prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>";
+    }
+    if($current_page < $total_pages)
+    {
+        $nextstart = ($current_start + $perpage);
+        $link = str_replace("[FROM]", $nextstart, $url);
+        $next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>";
+    }
+    $dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>";
+    for($i = 1; $i <= $total_pages; $i++)
+    {
+        $sel = "";
+        if($current_page == $i)
+        {
+            $sel = " selected='selected' ";
+        }
+        $newstart = ($i-1)*$perpage;
+        $link = str_replace("[FROM]", $newstart, $url);
+        $c = $i-1;
+        $title = ($pagetitle[$c]) ? $pagetitle[$c] : $i;
+        $dropdown .= "<option value='{$link}' {$sel}>{$title}</option>\n";
+    }
+    $dropdown .= "</select>";
+    $ret = $np_parm['template'];
+    $ret = str_replace('[DROPDOWN]', $dropdown, $ret);
+    $ret = str_replace('[PREV]', $prev, $ret);
+    $ret = str_replace('[NEXT]', $next, $ret);
+    return $caption.$ret;
 }
 return "";
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/plugin.sc 0.7.11.src/e107_files/shortcode/plugin.sc
--- 0.7.7.src/e107_files/shortcode/plugin.sc	2006-01-21 13:36:58.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/plugin.sc	2007-10-07 16:21:26.000000000 -0500
@@ -3,6 +3,7 @@
 
 $path = $tp -> toDB(dirname($menu));
 $name = $tp -> toDB(basename($menu));
+$plugin_file = "";
 if($path == '.')
 {
 	$path = $menu;
@@ -50,7 +51,25 @@
 				include_once(e_PLUGIN.$path."/languages/English.php");
 			}
 		}
-		include_once(e_PLUGIN.$path."/".$name.".php");
-		$sql->db_Mark_Time("(After $name)");
+		$plugin_file = e_PLUGIN.$path."/".$name.".php";
 	}
-}
\ No newline at end of file
+}
+else
+{
+	if(is_readable(e_PLUGIN.$path."/".$name.".php"))
+	{
+		$sql->db_Mark_Time($name);
+		include_lan(e_PLUGIN.$path."/languages/".e_LANGUAGE.".php");
+		$plugin_file = e_PLUGIN.$path."/".$name.".php";
+	}
+}
+
+if($plugin_file != "")
+{
+	ob_start();
+	include(e_PLUGIN.$path."/".$name.".php");
+	$buff = ob_get_contents();
+	ob_end_clean();
+	$sql->db_Mark_Time("(After $name)");
+	return $buff;
+}
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/sitedisclaimer.sc 0.7.11.src/e107_files/shortcode/sitedisclaimer.sc
--- 0.7.7.src/e107_files/shortcode/sitedisclaimer.sc	2006-07-02 21:07:10.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/sitedisclaimer.sc	2007-07-12 16:19:17.000000000 -0500
@@ -1,4 +1,3 @@
 global $tp;
 $ret = $tp->toHtml(SITEDISCLAIMER,TRUE,"constants defs");
-$ret .=(defined("THEME_DISCLAIMER") && $pref['displaythemeinfo'] ? THEME_DISCLAIMER : "");
 return $ret;
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/sitelinks_alt.sc 0.7.11.src/e107_files/shortcode/sitelinks_alt.sc
--- 0.7.7.src/e107_files/shortcode/sitelinks_alt.sc	2006-07-24 18:50:13.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/sitelinks_alt.sc	2007-05-23 14:57:00.000000000 -0500
@@ -3,9 +3,9 @@
 |     e107 website system
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/sitelinks_alt.sc,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/07/24 23:50:13 $
-|     $Author: e107coders $
+|     $Revision: 1.39 $
+|     $Date: 2007/05/23 19:57:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -39,7 +39,7 @@
 		if ($cat_open == 1){
 			$text .= " rel='external' ";
 		}
-		$text .= ">".$tp->toHTML($cat_title,"","defs no_hook")."</a>";
+		$text .= ">".$tp->toHTML($cat_title,"","defs, no_hook")."</a>";
 		return $text;
 	}
 
@@ -47,7 +47,7 @@
 		global $tp;
 
 		$cat_link = (strpos($cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link;
-        $cat_link = $tp->replaceConstants($cat_link,TRUE);
+		$cat_link = $tp->replaceConstants($cat_link, TRUE, TRUE);
 
 		if ($cat_open == 4 || $cat_open == 5){
 			$dimen = ($cat_open == 4) ? "600,400" : "800,600";
@@ -71,7 +71,7 @@
 		if ($cat_img != 'no_icons') {
 			$text .= "<span class='menuItemBuffer'>".$cat_img."</span>";
 		}
-		$text .= "<span class='menuItemText'>".$tp->toHTML($cat_title,"","defs no_hook")."</span>";
+		$text .= "<span class='menuItemText'>".$tp->toHTML($cat_title,"","defs, no_hook")."</span>";
 		if ($cat_id) {
 			$text .= "<span class=\"menuItemArrow\">&#9654;</span>";
 		}
@@ -104,7 +104,7 @@
 	// Loops thru parents.--------->
     global $tp;
     foreach ($linklist['head_menu'] as $lk) {
-        $lk['link_url'] = $tp -> replaceConstants($lk['link_url'],TRUE);
+        $lk['link_url'] = $tp -> replaceConstants($lk['link_url'], TRUE, TRUE);
 		if ($params[0] == 'no_icons') {
 			$link_icon = 'no_icons';
 		} else {
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/theme_disclaimer.sc 0.7.11.src/e107_files/shortcode/theme_disclaimer.sc
--- 0.7.7.src/e107_files/shortcode/theme_disclaimer.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/theme_disclaimer.sc	2007-07-12 16:19:17.000000000 -0500
@@ -0,0 +1,3 @@
+global $tp;
+$ret =(defined("THEME_DISCLAIMER") && $pref['displaythemeinfo'] ? THEME_DISCLAIMER : "");
+return $ret;
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/user_extended.sc 0.7.11.src/e107_files/shortcode/user_extended.sc
--- 0.7.7.src/e107_files/shortcode/user_extended.sc	2006-10-14 18:41:11.000000000 -0500
+++ 0.7.11.src/e107_files/shortcode/user_extended.sc	2007-10-13 14:46:42.000000000 -0500
@@ -1,16 +1,14 @@
-//USAGE:  {EXTENDED=<field_name>.[text|value|icon].<user_id>}
-//EXAMPLE: {EXTENDED=user_gender.value.5}  will show the value of the extended field user_gender for user #5
+//USAGE:  {EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
+//EXAMPLE: {EXTENDED=gender.value.5}  will show the value of the extended field user_gender for user #5
 include(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
 $parms = explode(".", $parm);
-global $currentUser, $sql, $tp, $loop_uid, $e107;
+global $currentUser, $sql, $tp, $loop_uid, $e107, $sc_style;
 if(isset($loop_uid) && intval($loop_uid) == 0) { return ""; }
-$ueStruct = getcachedvars("user_extended_struct");
-if(!$ueStruct)
-{
-	require_once(e_HANDLER."user_extended_class.php");
-	$ueStruct = e107_user_extended::user_extended_getStruct();
-	cachevars("user_extended_struct", $ueStruct);
-}
+$key = $parms[0].".".$parms[1];
+$sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
+$sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
+include_once(e_HANDLER."user_extended_class.php");
+$ueStruct = e107_user_extended::user_extended_getStruct();
 
 $uid = intval($parms[2]);
 if($uid == 0)
@@ -31,31 +29,50 @@
 $udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
 if($udata['user_admin'] == 1)
 {
-	$udata['user_class'].= ",".e_UC_ADMIN;
+  $udata['user_class'].= ",".e_UC_ADMIN;
 }
 
-if (
-!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class'])
-|| !check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read'])
-|| ($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID))
-|| (!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1 
-&& strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID)
-)
+
+// Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
+if ($parms[0] != LAN_410)
 {
+  $ret_cause = 0;
+  if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class'])) $ret_cause = 1;
+  if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read'])) $ret_cause = 2;
+  if (($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID))) $ret_cause = 3;
+  if ((!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1 
+	&& strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID)) $ret_cause = 4;
+  if ($ret_cause != 0)
+  {
 	return FALSE;
+  }
 }
 
-if ($parms[1] == 'text')
+if($parms[1] == 'text_value')
 {
-	$text_val = $ueStruct["user_".$parms[0]]['user_extended_struct_text'];
-	if($text_val)
+	$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
+	if($_value)
 	{
-		return (defined($text_val) ? constant($text_val) : $text_val);
-	}
-	else
-	{
-		return TRUE;
+		$__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
+		$__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
+		$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
+		$_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : "");
+		return $__pre.$_text.$_mid.$_value.$__post;
 	}
+	return false;
+}
+
+if ($parms[1] == 'text')
+{
+  $text_val = $ueStruct["user_".$parms[0]]['user_extended_struct_text'];
+  if($text_val)
+  {
+	return (defined($text_val) ? constant($text_val) : $text_val);
+  }
+  else
+  {
+	return TRUE;
+  }
 }
 
 if ($parms[1] == 'icon')
@@ -103,4 +120,4 @@
 	}
 	return FALSE;
 }
-return TRUE;
+return FALSE;
diff -x .svn -ruN 0.7.7.src/e107_files/shortcode/wmessage.sc 0.7.11.src/e107_files/shortcode/wmessage.sc
--- 0.7.7.src/e107_files/shortcode/wmessage.sc	2006-11-13 04:21:17.000000000 -0600
+++ 0.7.11.src/e107_files/shortcode/wmessage.sc	2007-01-19 23:11:40.000000000 -0600
@@ -1,4 +1,4 @@
-// $Id: wmessage.sc,v 1.17 2006/11/13 10:21:17 e107coders Exp $
+// $Id: wmessage.sc,v 1.20 2007/01/20 05:11:40 mrpete Exp $
 $prefwmsc = isset($pref['wmessage_sc']) && $pref['wmessage_sc'];
 if (($prefwmsc && $parm == "header") || (!$prefwmsc && ($parm !='header')) ){
 	return;
@@ -59,9 +59,9 @@
 			{
 				while ($row = $sql->db_Fetch())
 				{
-					$wmessage .= $tp->toHTML($row['gen_chardata'], TRUE, 'parse_sc defs', 'admin')."<br />";
+					$wmessage .= $tp->toHTML($row['gen_chardata'], TRUE, 'BODY, defs', 'admin')."<br />";
 					if(!$wmcaption){
-						$wmcaption = $tp->toHTML($row['gen_ip'], TRUE, 'defs');
+						$wmcaption = $tp->toHTML($row['gen_ip'], TRUE, 'TITLE');
 					}
 				}
 			}
diff -x .svn -ruN 0.7.7.src/e107_handlers/admin_log_class.php 0.7.11.src/e107_handlers/admin_log_class.php
--- 0.7.7.src/e107_handlers/admin_log_class.php	2006-10-24 12:02:57.000000000 -0500
+++ 0.7.11.src/e107_handlers/admin_log_class.php	2007-11-04 03:10:41.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/admin_log_class.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/10/24 17:02:57 $
-|     $Author: e107coders $
+|     $Revision: 1.10 $
+|     $Date: 2007/11/04 09:10:41 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -89,9 +89,9 @@
 	function log_event ($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE) {
 		global $e107, $sql, $tp;
 		if($event_type >= $this->_options['log_level']) {
-			$event_title = $tp -> toDB($event_title, true);
-			$event_detail = $tp -> toDB($event_detail, true);
-			$event_type = $tp -> toDB($event_type, true);
+			$event_title = $tp -> toDB($event_title, true,false,'no_html');
+			$event_detail = $tp -> toDB($event_detail, true,false,'no_html');
+			$event_type = $tp -> toDB($event_type, true,false,'no_html');
 			$time_stamp = time();
 			$uid = (USERID !== FALSE) ? USERID : '0';
 			$ip = $e107->getip();
diff -x .svn -ruN 0.7.7.src/e107_handlers/bbcode_handler.php 0.7.11.src/e107_handlers/bbcode_handler.php
--- 0.7.7.src/e107_handlers/bbcode_handler.php	2006-11-27 03:38:20.000000000 -0600
+++ 0.7.11.src/e107_handlers/bbcode_handler.php	2007-11-13 01:30:19.000000000 -0600
@@ -1,5 +1,4 @@
 <?php
-
 /*
 + ----------------------------------------------------------------------------+
 |     e107 website system
@@ -12,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/bbcode_handler.php,v $
-|     $Revision: 1.48 $
-|     $Date: 2006/11/27 09:38:20 $
+|     $Revision: 1.61 $
+|     $Date: 2007/11/13 07:30:19 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -22,11 +21,8 @@
 
 class e_bbcode
 {
-
-	var $bbList;
-	var $bbLocation;
-	var $single_bb;
-	var $List;
+	var $bbList;			// Caches the file contents for each bbcode processed
+	var $bbLocation;		// Location for each file - 'core' or a plugin name
 
 	function e_bbcode()
 	{
@@ -46,110 +42,222 @@
 			$this->bbLocation[$c] = 'core';
 		}
 
-
 		// grab list of plugin bbcodes.
 		if(isset($pref['bbcode_list']) && $pref['bbcode_list'] != '')
 		{
-        	foreach($pref['bbcode_list'] as $path=>$namearray)
+			foreach($pref['bbcode_list'] as $path=>$namearray)
 			{
 				foreach($namearray as $code=>$uclass)
 				{
-                	$this->bbLocation[$code] = $path;
+					$this->bbLocation[$code] = $path;
 				}
 			}
 		}
 
-
+		// Eliminate duplicates
 		$this->bbLocation = array_diff($this->bbLocation, array(''));
 		krsort($this->bbLocation);
-		$this->List = array_keys($this->bbLocation);
-		while($this->List[count($this->List)-1]{0} == "_")
-		{
-			array_unshift($this->List, array_pop($this->List));
-		}
-		if(($_c = array_search('code', $this->List)) !== FALSE)
-		{
-			unset($this->List[$c]);
-			array_unshift($this->List, "code");
-		}
-
 	}
 
-	function parseBBCodes($text, $p_ID)
+	// If $bb_strip is TRUE, all bbcodes are stripped. If FALSE, none are stripped.
+	// If a comma separated (lower case) list is passed, only the listed codes are stripped (and the rest are processed)
+	function parseBBCodes($value, $p_ID, $force_lower = 'default', $bb_strip = FALSE)
 	{
-		global $code;
 		global $postID;
-		global $single_bb;
-		global $_matches;
 		$postID = $p_ID;
-		$done = false;
-		$single_bb = false;
-		$i=0;
 
-		$tmplist = array();
-		foreach($this->List as $code)
-		{
-			if("_" == $code[0])
+
+		if (strlen($value) <= 6) return $value;     // Don't waste time on trivia!
+		if ($force_lower == 'default') $force_lower = TRUE;	// Set the default behaviour if not overridden
+		$code_stack = array();				// Stack for unprocessed bbcodes and text
+		$unmatch_stack = array();				// Stack for unmatched bbcodes
+		$result = '';							// Accumulates fully processed text
+		$stacktext = '';						// Accumulates text which might be subject to one or more bbcodes
+		$nopro = FALSE;						// Blocks processing within [code]...[/code] tags
+
+		$strip_array = array();
+		if (!is_bool($bb_strip))
+		{
+			$strip_array = explode(',',$bb_strip);
+		}
+		$pattern = '#^\[(/?)([A-Za-z_]+)(\d*)([=:]?)(.*?)]$#i';	// Pattern to split up bbcodes
+		// $matches[0] - same as the input text
+		// $matches[1] - '/' for a closing tag. Otherwise empty string
+		// $matches[2] - the bbcode word
+		// $matches[3] - any digits immediately following the bbcode word
+		// $matches[4] - '=' or ':' according to the separator used
+		// $matches[5] - any parameter
+
+		$content = preg_split('#(\[(?:\w|/\w).*?\])#mis', $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+
+		foreach ($content as $cont)
+		{  // Each chunk is either a bbcode or a piece of text
+			$is_proc = FALSE;
+			while (!$is_proc)
 			{
-				if(strpos($text, "[".substr($code, 1)) !== FALSE)
-				{
-					$tmplist[] = $code;
+				$oddtext = '';
+				if ($cont[0] == '[')
+				{  // We've got a bbcode - split it up and process it
+					$match_count = preg_match($pattern,$cont,$matches);
+					$bbparam = (isset($matches[5])) ? $matches[5] : '';
+					$bbword = (isset($matches[2])) ? $matches[2] : '';
+					if($cont[1] != '/')
+					{ 
+						$bbstart = $cont;
+						$bbsep = varset($matches[4]);
+					}
+					if ($force_lower) $bbword = strtolower($bbword);
+					if ($nopro && ($bbword == 'code') && ($matches[1] == '/')) $nopro = FALSE;		// End of code block
+					if (($bbword) && ($bbword == trim($bbword)) && !$nopro)
+					{  // Got a code to process here
+						if (($bb_strip === TRUE) || in_array($bbword,$strip_array))
+						{
+							$is_proc = TRUE;		// Just discard this bbcode
+						}
+						else
+						{
+
+							if ($matches[1] == '/')
+							{  // Closing code to process
+								$found = FALSE;
+								$i = 0;
+								while ($i < count($code_stack))
+								{     // See if code is anywhere on the stack.
+									if (($code_stack[$i]['type'] == 'bbcode') && ($code_stack[$i]['code'] == $bbword) && ($code_stack[0]['numbers'] == $matches[3]))
+									{
+										$found = TRUE;
+										break;
+									}
+									$i++;
+								}
+
+								if ($found)
+								{
+									$found = FALSE;   // Use as 'done' variable now
+									// Code is on stack - $i has index number. Process text, discard unmatched open codes, process 'our' code
+									while ($i > 0) { $unmatch_stack[] = array_shift($code_stack); $i--; }    // Get required code to top of stack
+
+									// Pull it off using array_shift - this keeps it as a zero-based array, newest first.
+									while (!$found && (count($code_stack) != 0))
+									{
+										switch ($code_stack[0]['type'])
+										{
+											case 'text' :
+												$stacktext = $code_stack[0]['code'].$stacktext;   // Need to insert text at front
+												array_shift($code_stack);
+												break;
+											case 'bbcode' :
+												if (($code_stack[0]['code'] == $bbword) && ($code_stack[0]['numbers'] == $matches[3]))
+												{
+													$stacktext = $this->proc_bbcode($bbword,$code_stack[0]['param'],$stacktext,$bbparam, $bbsep, $bbstart.$stacktext.$cont);
+													array_shift($code_stack);
+													// Intentionally don't terminate here - may be some text we can clean up
+													$bbword='';    // Necessary to make sure we don't double process if several instances on stack
+													while (count($unmatch_stack) != 0) { array_unshift($code_stack,array_pop($unmatch_stack));  }
+												}
+												else
+												{
+													$found = TRUE;  // Terminate on unmatched bbcode
+												}
+												break;
+										}
+										if (count($code_stack) == 0)
+										{
+											$result .= $stacktext;
+											$stacktext = '';
+											$found = TRUE;
+										}
+									}
+									$is_proc = TRUE;
+								}
+							}
+							else
+							{  // Opening code to process
+								// If its a single code, we can process it now. Otherwise just stack the value
+								if (array_key_exists('_'.$bbword,$this->bbLocation))
+								{  // Single code to process
+									if (count($code_stack) == 0)
+									{
+										$result .= $this->proc_bbcode('_'.$bbword,$bbparam);
+									}
+									else
+									{
+										$stacktext .= $this->proc_bbcode('_'.$bbword,$bbparam);
+									}
+									$is_proc = TRUE;
+								}
+								elseif (array_key_exists($bbword,$this->bbLocation))
+								{
+									if ($stacktext != '')
+									{ // Stack the text we've accumulated so far
+										array_unshift($code_stack,array('type' => 'text','code' => $stacktext));
+										$stacktext = '';
+									}
+									array_unshift($code_stack,array('type' => 'bbcode','code' => $bbword, 'numbers'=> $matches[3], 'param'=>$bbparam));
+									if ($bbword == 'code') $nopro = TRUE;
+									$is_proc = TRUE;
+								}
+							}
+
+						}
+					}
+					// Next lines could be deleted - but gives better rejection of 'stray' opening brackets
+					if ((!$is_proc) && (($temp = strrpos($cont,"[")) !== 0))
+					{
+						$oddtext = substr($cont,0,$temp);
+						$cont = substr($cont,$temp);
+					}
 				}
-			}
-			else
-			{
-				if(strpos($text, "[{$code}") !== FALSE && strpos($text, "[/{$code}") !== FALSE)
-				{
-					$tmplist[] = $code;
+
+				if (!$is_proc)
+				{  // We've got some text between bbcodes (or possibly text in front of a bbcode)
+					if ($oddtext == '') { $oddtext = $cont; $is_proc = TRUE; }
+					if (count($code_stack) == 0)
+					{  // Can just add text to answer
+						$result .= $oddtext;
+					}
+					else
+					{  // Add to accumulator at this level
+						$stacktext .= $oddtext;
+					}
 				}
 			}
 		}
 
-		foreach($tmplist as $code)
+		// Basically done - just tidy up now
+		// If there's still anything on the stack, we need to process it
+		while (count($code_stack) != 0)
 		{
-			if("_" == $code{0})
-			{
-				$code = substr($code, 1);
-				$this->single_bb = true;
-				$pattern = "#\[({$code})(\d*)(.*?)\]#s";
-			}
-			else
+			switch ($code_stack[0]['type'])
 			{
-				$this->single_bb = false;
-				$pattern = "#\[({$code})(\d*)(.*?)\](.*?)\[\/{$code}\\2\]#s";
-			}
-			$i=0;
-			while($code && ($pos = strpos($text, "[{$code}")) !== false)
-			{
-				$text = preg_replace_callback($pattern, array($this, 'doCode'), $text);
-				$leftover_code = $_matches[1].$_matches[2];
-				$text = str_replace("[{$leftover_code}", "&#091;{$leftover_code}", $text);
-				if ($i == strpos($text, "[{$code}")) { break; }
-
-				if ($pos == ($i = strpos($text,"[{$code}")))
-    			{
-        			$pattern2 = "#\[({$code})(\d*)(.*?)\]#s";
-        			$text = preg_replace_callback($pattern2, array($this, 'doCode'), $text);
-        			$leftover_code = $_matches[1].$_matches[2];
-        			$text = str_replace("[{$leftover_code}", "&#091;{$leftover_code}", $text);
-    			}
+				case 'text' :
+					$stacktext = $code_stack[0]['code'].$stacktext;   // Need to insert text at front
+					array_shift($code_stack);
+					break;
+				case 'bbcode' :
+					$stacktext = '['.$code_stack[0]['code'].']'.$stacktext;   // To discard unmatched codes, delete this line
+					array_shift($code_stack);  		// Just discard any unmatched bbcodes
+					break;
 			}
 		}
-		return $text;
+		$result .= $stacktext;
+		return $result;
 	}
 
-	function doCode($matches)
+
+
+	function proc_bbcode($code, $param1='',$code_text_par='', $param2='', $sep='', $full_text='')
+	// Invoke an actual bbcode handler
+	// $code - textual value of the bbcode (already begins with '_' if a single code)
+	// $param1 - any text after '=' in the opening code
+	// $code_text_par - text between the opening and closing codes
+	// $param2 - any text after '=' for the closing code
 	{
-		global $tp, $postID, $full_text, $code_text, $parm, $_matches;
-		$_matches = $matches;
-		$full_text = $tp->replaceConstants($matches[0]);
-		$code = $matches[1];
-		$parm = substr($matches[3], 1);
-		$code_text = $tp->replaceConstants($matches[4]);
-		if($this->single_bb == true)
-		{
-			$code = '_'.$code;
-		}
+		global $tp, $postID, $code_text, $parm;
+		$parm = $param1;
+
+		$code_text = $code_text_par;
+
 		if (E107_DEBUG_LEVEL)
 		{
 			global $db_debug;
@@ -157,18 +265,17 @@
 		}
 
 		if (is_array($this->bbList) && array_key_exists($code, $this->bbList))
-		{
+		{	// Check the bbcode 'cache'
 			$bbcode = $this->bbList[$code];
 		}
 		else
-		{
+		{	// Find the file
 			if ($this->bbLocation[$code] == 'core')
 			{
 				$bbFile = e_FILE.'bbcode/'.strtolower(str_replace('_', '', $code)).'.bb';
 			}
 			else
-			{
-				// Add code to check for plugin bbcode addition
+			{	// Add code to check for plugin bbcode addition
 				$bbFile = e_PLUGIN.$this->bbLocation[$code].'/'.strtolower($code).'.bb';
 			}
 			if (file_exists($bbFile))
@@ -202,4 +309,5 @@
 		return $bbcode_output.$bbcode_return;
 	}
 }
-?>
+
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/cache_handler.php 0.7.11.src/e107_handlers/cache_handler.php
--- 0.7.7.src/e107_handlers/cache_handler.php	2006-11-17 07:26:38.000000000 -0600
+++ 0.7.11.src/e107_handlers/cache_handler.php	2007-12-08 18:10:43.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/cache_handler.php,v $
-|     $Revision: 1.35 $
-|     $Date: 2006/11/17 13:26:38 $
-|     $Author: mrpete $
+|     $Revision: 1.36 $
+|     $Date: 2007/12/09 00:10:43 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,8 +24,8 @@
 * Class to cache data as files, improving site speed and throughput.
 *
 * @package     e107
-* @version     $Revision: 1.35 $
-* @author      $Author: mrpete $
+* @version     $Revision: 1.36 $
+* @author      $Author: e107coders $
 */
 class ecache {
 
@@ -63,7 +63,8 @@
 					$CheckTag = '_'.$this->CachePageMD5;
 				}
 			} else {
-				$CheckTag = '';
+				// Check if a custom CachePageMD5 is in use in e_module.php.  
+				$CheckTag = ($this->CachePageMD5) ? "_".$this->CachePageMD5 : "";
 			}
 		} else {
 			$CheckTag = '';
diff -x .svn -ruN 0.7.7.src/e107_handlers/calendar/sample.php 0.7.11.src/e107_handlers/calendar/sample.php
--- 0.7.7.src/e107_handlers/calendar/sample.php	2005-03-30 13:34:38.000000000 -0600
+++ 0.7.11.src/e107_handlers/calendar/sample.php	2007-10-07 15:24:14.000000000 -0500
@@ -16,8 +16,7 @@
 ";
 echo $cal->make_input_field(
            // calendar options go here; see the documentation and/or calendar-setup.js
-           array('firstDay'       => 1, // show Monday first
-                 'showsTime'      => true,
+           array('showsTime'      => true,
                  'showOthers'     => true,
                  'ifFormat'       => '%Y/%m/%d %I:%M %P',
                  'weekNumbers'    => false,
@@ -31,7 +30,6 @@
 echo "</td></tr><tr><td>";
 unset($cal_options);
 unset($cal_attrib);
-$cal_options['firstDay'] = 0;
 $cal_options['showsTime'] = false;
 $cal_options['showOthers'] = false;
 $cal_options['weekNumbers'] = true;
diff -x .svn -ruN 0.7.7.src/e107_handlers/comment_class.php 0.7.11.src/e107_handlers/comment_class.php
--- 0.7.7.src/e107_handlers/comment_class.php	2006-11-11 22:04:27.000000000 -0600
+++ 0.7.11.src/e107_handlers/comment_class.php	2007-08-08 14:27:50.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/comment_class.php,v $
-|     $Revision: 1.67 $
-|     $Date: 2006/11/12 04:04:27 $
-|     $Author: mrpete $
+|     $Revision: 1.71 $
+|     $Date: 2007/08/08 19:27:50 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,6 +22,7 @@
 
 @include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");
 @include_once(e_LANGUAGEDIR."English/lan_comment.php");
+global $comment_shortcodes;
 require_once(e_FILE."shortcode/batch/comment_shortcodes.php");
 
 /**
@@ -265,8 +266,8 @@
 
 		$text = $tp -> parseTemplate($renderstyle, TRUE, $comment_shortcodes);
 
-		if ($action == "comment" && $pref['nested_comments']) {
-
+		if ($action == "comment" && $pref['nested_comments']) 
+		{
 			$type = $this -> getCommentType($thistable);
 			$sub_query = "
 			SELECT c.*, u.*, ue.*
@@ -277,20 +278,20 @@
 			ORDER BY comment_datestamp
 			";
 
-			$sql2 = new db;	/* a new db must be created here, for nested comment  */
-			if ($sub_total = $sql2->db_Select_gen($sub_query)) {
-				while ($row1 = $sql2->db_Fetch()) {
-					if ($pref['nested_comments']) {
-						$width = $width + 3;
-						if ($width > 80) {
-							$width = 80;
-						}
-					}
-					$text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating);
-					unset($width);
+			$sql_nc = new db;	/* a new db must be created here, for nested comment  */
+			if ($sub_total = $sql_nc->db_Select_gen($sub_query)) 
+			{
+			  while ($row1 = $sql_nc->db_Fetch()) 
+			  {
+				if ($pref['nested_comments']) 
+				{
+				  $width = min($width + 3, 80);
 				}
+				$text .= $this->render_comment($row1, $table, $action, $id, $width, $subject, $addrating);
+				unset($width);
+			  }
 			}
-		}
+		}		// End (nested comment handling)
 		//echo $text;
 		return stripslashes($text);
 	}
@@ -487,6 +488,10 @@
 		WHERE c.comment_item_id='".intval($id)."' AND c.comment_type='".$tp -> toDB($type, true)."' ORDER BY c.comment_datestamp";
 
 		$text = "";
+		$comment = '';
+		$modcomment = '';
+		$lock = '';
+		$ret['comment'] = '';
 
 		if ($comment_total = $sql->db_Select_gen($query))
 		{
@@ -702,8 +707,8 @@
 		if ($comment_total = $sql->db_Select_gen($query))
 		{
 			$width = 0;
-			while ($row = $sql->db_Fetch()){
-
+			while ($row = $sql->db_Fetch())
+			{
 				$ret = array();
 
 				//date
@@ -718,14 +723,16 @@
 
 				//comment text
 				$comment = strip_tags(preg_replace("/\[.*\]/", "", $row['comment_comment'])); // remove bbcode
-				$ret['comment_comment'] = $tp->toHTML($comment, FALSE, "", "", $pref['menu_wordwrap']);
+				$ret['comment_comment'] = $tp->toHTML($comment, FALSE, "", "", $pref['main_wordwrap']);
 
 				//subject
 				$ret['comment_subject'] = $tp->toHTML($row['comment_subject'], TRUE);
 
-				// news
-				if($row['comment_type'] == "0"){
-					if($sql2 -> db_Select("news", "*", "news_id='".$row['comment_item_id']."' AND news_class REGEXP '".e_CLASS_REGEXP."' ")){
+				switch ($row['comment_type'])
+				{
+				  case '0' :	// news
+					if($sql2 -> db_Select("news", "*", "news_id='".$row['comment_item_id']."' AND news_class REGEXP '".e_CLASS_REGEXP."' "))
+					{
 						$row2 = $sql2 -> db_Fetch();
 
 						$ret['comment_type']				= COMLAN_TYPE_1;
@@ -734,14 +741,15 @@
 						$ret['comment_category_heading']	= COMLAN_TYPE_1;
 						$ret['comment_category_url']		= e_BASE."news.php";
 					}
-				//	article, review or content page
-				}elseif($row['comment_type'] == "1"){
-
-				//	downloads
-				}elseif($row['comment_type'] == "2"){
-					$mp = MPREFIX;
-					$qryd = "SELECT download_name, {$mp}download_category.download_category_class, {$mp}download_category.download_category_id, {$mp}download_category.download_category_name FROM {$mp}download LEFT JOIN {$mp}download_category ON {$mp}download.download_category={$mp}download_category.download_category_id WHERE {$mp}download.download_id={$row['comment_item_id']} AND {$mp}download_category.download_category_class REGEXP '".e_CLASS_REGEXP."' ";
-					if($sql2->db_Select_gen($qryd)){
+					break;
+					
+				  case '1' :	//	article, review or content page - defunct category, but filter them out
+					break;
+					
+				  case '2' :	//	downloads
+					$qryd = "SELECT d.download_name, dc.download_category_class, dc.download_category_id, dc.download_category_name FROM #download AS d LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id WHERE d.download_id={$row['comment_item_id']} AND dc.download_category_class REGEXP '".e_CLASS_REGEXP."' ";
+					if($sql2->db_Select_gen($qryd))
+					{
 						$row2 = $sql2->db_Fetch();
 
 						$ret['comment_type']				= COMLAN_TYPE_2;
@@ -750,67 +758,52 @@
 						$ret['comment_category_heading']	= $row2['download_category_name'];
 						$ret['comment_category_url']		= e_BASE."download.php?list.".$row2['download_category_id'];
 					}
-				/*
-				//	faq (should use an e_comment.php file)
-				}elseif($row['comment_type'] == "3"){
-					if($sql2 -> db_Select("faq", "faq_question", "faq_id='".$row['comment_item_id']."' ")){
-						$row2 = $sql2 -> db_Fetch();
-
-						$ret['comment_type']				= COMLAN_TYPE_3;
-						$ret['comment_title']				= $tp -> toHTML($row2['faq_question'], TRUE,'emotes_off, no_make_clickable');
-						$ret['comment_url']					= e_PLUGIN."faq/faq.php?view.".$row2['comment_item_id'];
-					}
-				*/
-				//	poll
-				}elseif($row['comment_type'] == "4"){
-					if($sql2 -> db_Select("polls", "*", "poll_id='".$row['comment_item_id']."' ")){
+					break;
+						// '3' was FAQ
+				  case '4' :	//	poll
+					if($sql2 -> db_Select("polls", "*", "poll_id='".$row['comment_item_id']."' "))
+					{
 						$row2 = $sql2 -> db_Fetch();
 
 						$ret['comment_type']				= COMLAN_TYPE_4;
 						$ret['comment_title']				= $tp -> toHTML($row2['poll_title'], TRUE,'emotes_off, no_make_clickable');
 						$ret['comment_url']					= e_BASE."comment.php?comment.poll.".$row['comment_item_id'];
 					}
-				/*
-				//	docs (should use an e_comment.php file)
-				}elseif($row['comment_type'] == "5"){
-					//$str .= $bullet." <b><a href='http://e107.org/docs/main.php?$comment_item_id'>Doc $comment_item_id</a></b><br />";
-					//$str .= ($recent_pref['comments_cat'] ? $style_pre."".LIST_31."<br />" : "").($recent_pref['comments_author'] ? $style_pre."".($comment_author_id == 0 ? $comment_author_name : "<a href='".e_BASE."user.php?id.".$comment_author_name."'>".$comment_author_name."</a>" )."<br />" : "").($recent_pref['comments_date'] ? $style_pre."".$datestamp."<br />" : "");
-
-				//	bugtracker (should use an e_comment.php file)
-				}elseif($row['comment_type'] == "6"){
-					if($sql2 -> db_Select("bugtrack2_bugs", "bugtrack2_bugs_summary", "bugtrack2_bugs_id='".$row['comment_item_id']."' ")){
-						$row2 = $sql2 -> db_Fetch();
-
-						$ret['comment_type']				= COMLAN_TYPE_6;
-						$ret['comment_title']				= $tp -> toHTML($row2['bugtrack2_bugs_summary'], TRUE,'emotes_off, no_make_clickable');
-						$ret['comment_url']					= e_PLUGIN."bugtracker2/bugtracker2.php?0.bug.".$row['comment_item_id'];
-					}
-				//	ideas (should use an e_comment.php file)
-				}elseif($row['comment_type'] == "ideas"){
-					if($sql2 -> db_Select("ideas", "ideas_summary", "ideas_id='".$row['comment_item_id']."' ")){
-						$row2 = $sql2 -> db_Fetch();
-
-						$ret['comment_type']				= COMLAN_TYPE_7;
-						$ret['comment_title']				= $tp -> toHTML($row2['ideas_summary'], TRUE,'emotes_off, no_make_clickable');
-						$ret['comment_url']					= e_PLUGIN."ideas/ideas.php?show.".$row['comment_item_id'];
-					}
-				*/
-				//	userprofile
-				}elseif($row['comment_type'] == "profile"){
+					break;
+					
+					// '5' was docs
+					// '6' was bugtracker
+					// 'ideas' was implemented
+			
+				  case 'profile' :		//	userprofile
 					if(USER)
 					{
 						$ret['comment_type']				= COMLAN_TYPE_8;
 						$ret['comment_title']				= $comment_author_name;
 						$ret['comment_url']					= e_BASE."user.php?id.".$row['comment_item_id'];
 					}
-				}elseif(isset($e_comment[$row['comment_type']]) && is_array($e_comment[$row['comment_type']])){
-					$var = $e_comment[$row['comment_type']];
-					$qryp='';
-					//new method must use the 'qry' variable
-					if(isset($var) && $var['qry']!=''){
-						if($installed = $sql2 -> db_Select("plugin", "*", "plugin_path = '".$var['plugin_path']."' AND plugin_installflag = '1' ")){
+					break;
+
+				  case 'page' :		//	Custom Page
+					$ret['comment_type']				= COMLAN_TYPE_PAGE;
+					$ret['comment_title']				= $ret['comment_subject'] ? $ret['comment_subject'] : $ret['comment_comment'];
+					$ret['comment_url']					= e_BASE."page.php?".$row['comment_item_id'];
+					break;
+
+				  default :
+					if(isset($e_comment[$row['comment_type']]) && is_array($e_comment[$row['comment_type']]))
+					{
+					  $var = $e_comment[$row['comment_type']];
+					  $qryp='';
+						//new method must use the 'qry' variable
+					  if(isset($var) && $var['qry']!='')
+					  {
+//						if ($installed = $sql2 -> db_Select("plugin", "*", "plugin_path = '".$var['plugin_path']."' AND plugin_installflag = '1' "))
+						if ($installed = isset($pref['plug_installed'][$var['plugin_path']]))
+						{
 							$qryp = str_replace("{NID}", $row['comment_item_id'], $var['qry']);
-							if($sql2 -> db_Select_gen($qryp)){
+							if($sql2 -> db_Select_gen($qryp))
+							{
 								$row2 = $sql2 -> db_Fetch();
 								$ret['comment_type']				= $var['plugin_name'];
 								$ret['comment_title']				= $tp -> toHTML($row2[$var['db_title']], TRUE,'emotes_off, no_make_clickable');
@@ -820,7 +813,9 @@
 							}
 						}
 					//old method
-					}else{
+					  }
+					  else
+					  {
 						if($sql2 -> db_Select($var['db_table'], $var['db_title'], $var['db_id']." = '".$row['comment_item_id']."' ")){
 							$row2 = $sql2 -> db_Fetch();
 							$ret['comment_type']				= $var['plugin_name'];
@@ -829,20 +824,24 @@
 							$ret['comment_category_heading']	= $var['plugin_name'];
 							$ret['comment_category_url']		= $var['plugin_name'];
 						}
+					  }
 					}
-				}
-				if($ret['comment_title']){
+				  }		// End Switch
+				  if($ret['comment_title'])
+				  {
 					$reta[] = $ret;
 					$valid++;
-				}
-				if($amount && $valid>=$amount){
+				  }
+				  if($amount && $valid>=$amount)
+				  {
 					return $reta;
+				  }
+				}
+			//loop if less records found than given $amount - probably because we discarded some
+				if($amount && ($valid<$amount))
+				{
+				  $reta = $this->getCommentData($amount, $from+$amount, $qry, $valid, $reta);
 				}
-			}
-			//loop if less records found than given $amount
-			if($amount && $valid<$amount){
-				$reta = $this->getCommentData($amount, $from+$amount, $qry, $valid, $reta);
-			}
 		}
 		return $reta;
 	}
diff -x .svn -ruN 0.7.7.src/e107_handlers/date_handler.php 0.7.11.src/e107_handlers/date_handler.php
--- 0.7.7.src/e107_handlers/date_handler.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/date_handler.php	2007-02-18 07:10:18.000000000 -0600
@@ -11,9 +11,10 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/date_handler.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2007/02/18 13:10:18 $
+|     $Author: e107steved $
+|
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -49,15 +50,11 @@
 	}
 
 	function computeLapse($older_date, $newer_date = FALSE, $mode = FALSE, $show_secs = TRUE, $format = 'long') 
-	{
-
-		/*
+	{	/*
 		$mode = TRUE :: return array
 		$mode = FALSE :: return string
 		*/
 
-		$newer_date = ($newer_date == FALSE ? (time()) : $newer_date);
-		$since = $newer_date - $older_date;
 		if($format == 'short')
 		{
 			$sec = LANDT_09;
@@ -72,36 +69,77 @@
 			$min = LANDT_06;
 			$mins = LANDT_06s;
 		}
+/*
+  If we want an absolutely accurate result, main problems arise from the varying numbers of days in a month.
+  If we go over a month boundary, then we need to add days to end of start month, plus days in 'end' month
+  If start day > end day, we cross a month boundary. Calculate last day of start date. Otherwise we can just do a simple difference.
+*/
+		$newer_date = ($newer_date == FALSE ? (time()) : $newer_date);
+		if($older_date>$newer_date)
+		{  // Just in case the wrong way round
+		  $tmp=$newer_date; 
+		  $newer_date=$older_date; 
+		  $older_date=$tmp; 
+		}
+		$new_date = getdate($newer_date);
+		$old_date = getdate($older_date);
+		$result   = array();
+		$outputArray = array();
 
-		$timings = array(
-			array(31536000 , LANDT_01,LANDT_01s),
-			array(2592000 , LANDT_02, LANDT_02s),
-			array(604800, LANDT_03, LANDT_03s),
-			array(86400 , LANDT_04, LANDT_04s),
-			array(3600 , LANDT_05, LANDT_05s),
-			array(60 , $min, $mins)
-		);
-		if($show_secs)
+		$params   = array(
+					  6 => array('seconds',60, $sec, $secs),
+					  5 => array('minutes',60, $min, $mins),
+					  4 => array('hours',24, LANDT_05, LANDT_05s),
+					  3 => array('mday', -1, LANDT_04, LANDT_04s),
+					  2 => array('',-3, LANDT_03, LANDT_03s),
+					  1 => array('mon',12, LANDT_02, LANDT_02s),
+					  0 => array('year', -2, LANDT_01,LANDT_01s)
+					);
+
+		$cy = 0;
+		foreach ($params as $parkey => $parval)
 		{
-			$timings[] = array(1 , $sec, $secs);
+		  if ($parkey == 2)
+		  {
+		    $result['2'] = floor($result['3']/7);
+			$result['3'] = fmod($result['3'],7);
+		  }
+		  else
+		  {
+		    $tmp = $new_date[$parval[0]] - $old_date[$parval[0]] - $cy;
+			$scy = $cy;
+		    $cy = 0;
+		    if ($tmp < 0)
+		    {
+		      switch ($parval[1])
+			  {
+			    case -1 :    // Wrapround on months - special treatment
+			      $tempdate = getdate(mktime(0,0,0,$old_date['mon']+1,1,$old_date['year']) - 1);  // Last day of month
+				  $tmp = $tempdate['mday'] - $old_date['mday'] + $new_date['mday'] - $scy;
+				  $cy = 1;
+			      break;
+			    case -2 :		// Year wraparound - shouldn't happen
+				case -3 : 		// Week processing - this shouldn't happen either
+				  echo "Code bug!<br />";
+			      break;
+			    default :
+		          $cy = 1;
+				  $tmp += $parval[1];
+			}
+		  }
+		  $result[$parkey] = $tmp;
+		  }
 		}
-		$newer_date = ($newer_date == FALSE ? (time()) : $newer_date);
-		$since = $newer_date - $older_date;
 
-		$outputArray = array();
-		$total = $since;
-		$value = FALSE;
-		foreach($timings as $time)
+		// Generate output array, add text
+		for ($i = 0; $i < ($show_secs ? 7 : 6); $i++)
 		{
-			$seconds = floor($total / $time[0]);
-			if($seconds || $value)
-			{
-				$outputArray[] = $seconds." ".($seconds == 1 ? $time[1] : $time[2]);
-				$value = TRUE;
-			}
-			$total = fmod($total, $time[0]);
+		  if (($i > 4) || ($result[$i] != 0))
+		  {  // Only show non-zero values, except always show minutes/seconds
+		    $outputArray[] = $result[$i]." ".($result[$i] == 1 ? $params[$i][2] : $params[$i][3]);
+		  }
 		}
 		return ($mode ? $outputArray : implode(", ", $outputArray));
 	}
-
-}
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/db_debug_class.php 0.7.11.src/e107_handlers/db_debug_class.php
--- 0.7.7.src/e107_handlers/db_debug_class.php	2006-11-09 10:50:23.000000000 -0600
+++ 0.7.11.src/e107_handlers/db_debug_class.php	2006-12-05 03:54:57.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/db_debug_class.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/11/09 16:50:23 $
+|     $Revision: 1.19 $
+|     $Date: 2006/12/05 09:54:57 $
 |     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
@@ -32,6 +32,7 @@
 	var $scbbcodes = array();
 	var $scbcount;
 	var $deprecated_funcs = array();
+	var $aLog = array();	// Generalized debug log (only seen during debug)
 
 	function e107_db_debug() {
 		global $eTimingStart;
@@ -46,6 +47,38 @@
 		'DB Time' => 0,
 		'DB Count' => 0
 		);
+		
+		register_shutdown_function('e107_debug_shutdown');
+	}
+
+//
+// Add your new Show function here so it will display in debug output!
+//
+	function Show_All() 
+	{
+		global $eTraffic;
+		
+		$this->ShowIf('Debug Log', $this->Show_Log());
+		$this->ShowIf('Traffic Counters', $eTraffic->Display());
+		$this->ShowIf('Time Analysis', $this->Show_Performance());
+		$this->ShowIf('SQL Analysis', $this->Show_SQL_Details());
+		$this->ShowIf('Shortcodes / BBCode',$this->Show_SC_BB());
+		$this->ShowIf('Paths', $this->Show_PATH());
+		$this->ShowIf('Deprecated Function Usage', $this->Show_DEPRECATED());
+	}
+	
+	function ShowIf($title,$str)
+	{
+		global $ns;
+		
+		if (!isset($ns)) {
+			echo "Why did ns go away?<br/>";
+			$ns = new e107table;
+		}
+		
+		if (strlen($str)) {
+			$ns->tablerender($title, $str);
+		}
 	}
 
 	function Mark_Time($sMarker) { // Should move to traffic_class?
@@ -82,14 +115,17 @@
 		list($qtype,$args) = explode(" ", ltrim($query), 2);
 
 		$nFields=0;
-		if (!strcasecmp($qtype,'SELECT')) {
+		$bExplained = FALSE;
+		if (!strcasecmp($qtype,'SELECT') || !strcasecmp($qtype,'(SELECT')) {
 			$sQryRes=is_null($rli) ? mysql_query("EXPLAIN $query") : mysql_query("EXPLAIN $query", $rli);
 
 			if ($sQryRes) { // There's something to explain
 			$nFields = mysql_num_fields($sQryRes);
+			$bExplained = TRUE;
 			}
 		} else {
 			$sQryRes = $origQryRes;
+			$bExplained = FALSE;
 			$nFields=0;
 		}
 
@@ -106,7 +142,7 @@
 		$t['nFields']=$nFields;
 		$t['time']=$mytime;
 
-		if ($sQryRes != 1) {
+		if ($bExplained) {
 			$bRowHeaders=FALSE;
 			while ($row = @mysql_fetch_assoc($sQryRes)) {
 				if (!$bRowHeaders) {
@@ -162,12 +198,12 @@
 		if ($badCount) {
 			$text .= "\n<table class='fborder'>\n";
 			$text .= "<tr><td class='fcaption' colspan='2'><b>$badCount Query Errors!</b></td></tr>\n";
-			$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Query</b></td></tr>\n";
+			$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Query / Error</b></td></tr>\n";
 
 			foreach ($this->aSQLdetails as $idx => $cQuery) {
 				if (!$cQuery['ok']) {
-					$text .= "<tr><td class='forumheader3' style='text-align:right'>{$idx}&nbsp;</td>
-    	       	        <td class='forumheader3'>".$cQuery['query']."</td></tr>\n";
+					$text .= "<tr><td class='forumheader3' rowspan='2' style='text-align:right'>{$idx}&nbsp;</td>
+    	       	        <td class='forumheader3'>".$cQuery['query']."</td></tr>\n<tr><td class='forumheader3'>".$cQuery['error']."</td></tr>\n";
 				}
 			}
 			$text .= "\n</table><br/>\n";
@@ -457,6 +493,98 @@
 			return $text;
 		}
 	}
+	
+//
+// Simple debug-level 'console' log
+// Record a "nice" debug message with
+// $db_debug->log("message");
+//
+	function log($message,$TraceLev=1)
+	{
+		if (!E107_DBG_BASIC){
+			return FALSE;
+		}
+		if ($TraceLev)
+		{
+			$bt = debug_backtrace();
+			$this->aLog[] =	array (
+				'Message'   => $message,
+				'Function'	=> (isset($bt[$TraceLev]['type']) && ($bt[$TraceLev]['type'] == '::' || $bt[$TraceLev]['type'] == '->') ? $bt[$TraceLev]['class'].$bt[$TraceLev]['type'].$bt[$TraceLev]['function'].'()' : $bt[$TraceLev]['function']).'()',
+				'File'	=> $bt[$TraceLev]['file'],
+				'Line'	=> $bt[$TraceLev]['line']
+			);
+		} else {
+			$this->aLog[] =	array (
+				'Message'   => $message,
+				'Function' => '',
+				'File' => '',
+				'Line' => ''
+			);
+		}
+	}
+
+	function Show_Log(){
+		if (!E107_DBG_BASIC || !count($this->aLog)){
+			return FALSE;
+		}
+		//
+		// Dump the debug log
+		//
+
+		$text .= "\n<table class='fborder'>\n";
+
+		$bRowHeaders=FALSE;
+		
+		foreach ($this->aLog as $curLog) 
+		{
+			if (!$bRowHeaders) {
+				$bRowHeaders=TRUE;
+				$text .= "<tr class='fcaption'><td><b>".implode("</b></td><td><b>", array_keys($curLog))."</b></td></tr>\n";
+			}
+
+			$text .= "<tr class='forumheader3'><td>".implode("&nbsp;</td><td>", array_values($curLog))."&nbsp;</td></tr>\n";
+		}
+
+		$text .= "</table><br/>\n";
+
+		return $text;
+	}
+}
+
+function e107_debug_shutdown()
+{
+global $error_handler,$e107_Clean_Exit,$In_e107_Footer,$ADMIN_DIRECTORY;
+	if (isset($e107_Clean_Exit)) return;
+
+	if (!isset($In_e107_Footer))
+	{
+		if (defset('ADMIN_AREA'))
+		{
+			$filewanted=realpath(dirname(__FILE__)).'/../'.$ADMIN_DIRECTORY.'footer.php';
+			require_once($filewanted);
+		} else if (defset('USER_AREA'))
+		{
+			$filewanted=realpath(dirname(__FILE__)).'/../'.FOOTERF;
+			require_once($filewanted);
+		}
+	}
+// 
+// Error while in the footer, or during startup, or during above processing
+//
+	if (isset($e107_Clean_Exit)) return; // We've now sent a footer...
+	
+//	echo isset($In_e107_Footer) ? "In footer" : "In startup".'<br>';
+
+	while (ob_get_level() > 0) {
+		ob_end_flush();
+	}
+	if (isset($error_handler))
+	{		
+		echo "<br /><div><h3>PHP Errors:</h3><br />".$error_handler->return_errors()."</div>\n";
+	} else {
+		echo "<b>e107 Shutdown while no error_handler available!</b>";
+	}
+	echo "</body></html>";
 }
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/debug_handler.php 0.7.11.src/e107_handlers/debug_handler.php
--- 0.7.7.src/e107_handlers/debug_handler.php	2006-11-09 10:50:32.000000000 -0600
+++ 0.7.11.src/e107_handlers/debug_handler.php	2006-12-04 07:32:10.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/debug_handler.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2006/11/09 16:50:32 $
+|     $Revision: 1.21 $
+|     $Date: 2006/12/04 13:32:10 $
 |     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
@@ -58,7 +58,7 @@
 //
 
 // Basic levels
-define('E107_DBG_BASIC',		(E107_DEBUG_LEVEL & 1));       // basics: worst php errors, sql errors, etc
+define('E107_DBG_BASIC',		(E107_DEBUG_LEVEL & 1));       // basics: worst php errors, sql errors, log, etc
 define('E107_DBG_SQLQUERIES',	(E107_DEBUG_LEVEL & 2));       // display all sql queries
 define('E107_DBG_TRAFFIC',		(E107_DEBUG_LEVEL & 4));       // display traffic counters
 define('E107_DBG_FILLIN8',		(E107_DEBUG_LEVEL & 8));       // fill in what it is
@@ -73,9 +73,9 @@
 define('E107_DBG_PATH',     	(E107_DEBUG_LEVEL &  1024));    // show e107 predefined paths
 define('E107_DBG_BBSC',     	(E107_DEBUG_LEVEL &  2048));    // Show BBCode/ Shortcode usage in postings
 define('E107_DBG_SC',       	(E107_DEBUG_LEVEL &  4096));    // Dump (inline) SC filenames as used
-define('E107_DBG_FILLIN8192',	(E107_DEBUG_LEVEL &  8192));    // fill in what it is
+define('E107_DBG_ERRBACKTRACE',	(E107_DEBUG_LEVEL &  8192));    // show backtrace for php errors
 define('E107_DBG_DEPRECATED', (E107_DEBUG_LEVEL & 16384));    // Show use of deprecated functions
-define('E107_DBG_ALLERRORS',	(E107_DEBUG_LEVEL & 32768));   // show ALL errors//...
+define('E107_DBG_ALLERRORS',	(E107_DEBUG_LEVEL & 32768));   // show ALL php errors (including notices), not just fatal issues
 
 class e107_debug {
 
@@ -87,30 +87,45 @@
 		'all'		 	  => 255,     // all basics
 		'basic'			=> 255,     // all basics
 		'b'				  => 255,     // all basics
-		'warn'			=> 1,       // just warnings, parse errrors, etc
+		'warn'			=> 1,       // just php warnings, parse errrors, debug log, etc
 		'showsql'		=> 2,       // sql basics
 		'counts'		=> 4,       // traffic counters
 
 		'detail'		=> 32767,   // all details
 		'd' 			  => 32767,   // all details
-		'time' 			=> 256,     // time details
-		'sql' 			=> 512,     // sql details
+		'time' 			=> 257,     // time details and php errors
+		'sql' 			=> 513,     // sql details and php errors
 		'paths' 		=> 1024,		// dump path strings
 		'bbsc' 			=> 2048,		// show bb and sc details
 		'sc'			  => 4096,   		// Shortcode paths dumped inline
+		'backtrace' => 8192,		// show backtrace when PHP has errors
 		'deprecated'	=> 16384,   // show if code is using deprecated functions
 		'notice'		=> 32768,   // you REALLY don't want all this, do you?
-		'everything'=> 65535,
+		'everything'=> 61439,   //(65535-4096) everything we know, and the rumors too
+		                        // (but shortcode paths removed: inline debug breaks pages!
 	);
 
 	function e107_debug() {
 		if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU, $debug_param) || isset($_COOKIE['e107_debug_level'])) {
+			$dVals=0;
 			if (isset($_COOKIE['e107_debug_level'])) {
-				$dVal = substr($_COOKIE['e107_debug_level'],6);
+				$dVals = substr($_COOKIE['e107_debug_level'],6);
 			}
 			if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU)) {
-				$dVal = $debug_param[1] == '=' ? $debug_param[2] : 'everything';
+				$dVals = $debug_param[1] == '=' ? $debug_param[2] : 'everything';
 			}
+			
+			$aDVal = explode('.',$dVals); // support multiple values, OR'd together
+			$dVal = 0;
+			foreach ($aDVal as $curDVal)
+			{
+				if (isset($this->aDebugShortcuts[$curDVal])) {
+					$dVal |= $this->aDebugShortcuts[$curDVal];
+				} else {
+					$dVal |= $curDVal;
+				}
+			}
+				
 			if (isset($debug_param[3]))
 			{
 				if ($debug_param[3] == '+' || $debug_param[3] == 'stick')
@@ -123,13 +138,9 @@
 				}
 			}
 
-			if (isset($this->aDebugShortcuts[$dVal])) {
-				$this->debug_level = $this->aDebugShortcuts[$dVal];
-			} else {
 				$this->debug_level = $dVal;
 			}
 		}
-	}
 
 	function set_error_reporting() {
 	}
diff -x .svn -ruN 0.7.7.src/e107_handlers/e107_class.php 0.7.11.src/e107_handlers/e107_class.php
--- 0.7.7.src/e107_handlers/e107_class.php	2006-11-29 17:32:20.000000000 -0600
+++ 0.7.11.src/e107_handlers/e107_class.php	2007-08-13 14:56:24.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e107_class.php,v $
-|     $Revision: 1.56 $
-|     $Date: 2006/11/29 23:32:20 $
-|     $Author: e107coders $
+|     $Revision: 1.61 $
+|     $Date: 2007/08/13 19:56:24 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -104,7 +104,14 @@
 			define("e_LANGUAGEDIR_ABS", e_HTTP.$LANGUAGES_DIRECTORY);
 
 			define("e_DOCS", e_BASE.$HELP_DIRECTORY);
-			define("e_DOCROOT", $_SERVER['DOCUMENT_ROOT']."/");
+			if(isset($_SERVER['DOCUMENT_ROOT'])) 
+			{ 
+			  define("e_DOCROOT", $_SERVER['DOCUMENT_ROOT']."/"); 
+			} 
+			else 
+			{ 
+			  define("e_DOCROOT", false); 
+			}
 
 			define("e_DOCS_ABS", e_HTTP.$HELP_DIRECTORY);
 
@@ -169,14 +176,13 @@
 			if (getenv('HTTP_X_FORWARDED_FOR')) {
 				$ip=$_SERVER['REMOTE_ADDR'];
 				if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)) {
-					$ip2 = array(
-					'/^0\./',
-					'/^127\.0\.0\.1/',
-					'/^192\.168\..*/',
-					'/^172\.16\..*/',
-					'/^10..*/',
-					'/^224..*/',
-					'/^240..*/'
+				$ip2 = array('#^0\..*#', 
+					'#^127\..*#', 							// Local loopbacks
+					'#^192\.168\..*#', 						// RFC1918 - Private Network
+					'#^172\.(?:1[6789]|2\d|3[01])\..*#', 	// RFC1918 - Private network
+					'#^10\..*#', 							// RFC1918 - Private Network
+					'#^169\.254\..*#', 						// RFC3330 - Link-local, auto-DHCP 
+					'#^2(?:2[456789]|[345][0-9])\..*#'		// Single check for Class D and Class E
 					);
 					$ip = preg_replace($ip2, $ip, $ip3[1]);
 				}
@@ -206,18 +212,18 @@
 	function get_memory_usage(){
 		if(function_exists("memory_get_usage")){
 			$memusage = memory_get_usage();
-			$memunit = 'b';
+			$memunit = CORE_LAN_B;
 			if ($memusage > 1048576){
 				$memusage = $memusage / 1024;
-				$memunit = 'kb';
+				$memunit = CORE_LAN_KB;
 			}
 			if ($memusage > 1048576){
 				$memusage = $memusage / 1024;
-				$memunit = 'mb';
+				$memunit = CORE_LAN_MB;
 			}
 			if ($memusage > 1048576){
 				$memusage = $memusage / 1024;
-				$memunit = 'gb';
+				$memunit = CORE_LAN_GB;
 			}
 			return (number_format($memusage, 0).$memunit);
 		} else {
diff -x .svn -ruN 0.7.7.src/e107_handlers/e_parse_class.php 0.7.11.src/e107_handlers/e_parse_class.php
--- 0.7.7.src/e107_handlers/e_parse_class.php	2006-11-28 22:22:40.000000000 -0600
+++ 0.7.11.src/e107_handlers/e_parse_class.php	2007-12-30 03:49:42.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e_parse_class.php,v $
-|     $Revision: 1.176 $
-|     $Date: 2006/11/29 04:22:40 $
-|     $Author: e107coders $
+|     $Revision: 1.203 $
+|     $Date: 2007/12/30 09:49:42 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -26,18 +26,107 @@
 	var $e_pf;
 	var $e_emote;
 	var $e_hook;
-	var $search = array('&#39;', '&#039;', '&quot;', 'onerror', '&gt;', '&amp;#039;', '&amp;quot;');
-	var $replace = array("'", "'", '"', 'one<i></i>rror', '>', "'", '"');
+	var $search = array('&#39;', '&#039;', '&quot;', 'onerror', '&gt;', '&amp;#039;', '&amp;quot;', ' & ');
+	var $replace = array("'", "'", '"', 'one<i></i>rror', '>', "'", '"', ' &amp; ');
 	var $e_highlighting;		// Set to TRUE or FALSE once it has been calculated
 	var $e_query;			// Highlight query
 
+		// toHTML Action defaults. For now these match existing convention.
+		// Let's reverse the logic on the first set ASAP; too confusing!
+	var $e_modSet = array();
+	var	$e_optDefault = array(
+		'context' => 'olddefault',			// default context: all "opt-out" conversions :(
+		'fromadmin' => FALSE,
+
+			// Enabled by Default
+		'value'	=> FALSE,					// Restore entity form of quotes and such to single characters - TRUE disables
+
+		'nobreak' => FALSE,					// Line break compression - TRUE removes multiple line breaks
+		'retain_nl' => FALSE,				// Retain newlines - wraps to \n instead of <br /> if TRUE
+
+		'no_make_clickable' => FALSE,		// URLs etc are clickable - TRUE disables
+		'no_replace' => FALSE,				// Replace clickable links - TRUE disables (only if no_make_clickable not set)
+
+	  	'emotes_off' => FALSE,				// Convert emoticons to graphical icons - TRUE disables conversion
+		'emotes_on'  => FALSE,				// FORCE conversion to emotes, even if syspref is disabled
+
+		'no_hook' => FALSE,					// Hooked parsers (TRUE disables completely)
+
+		// Disabled by Default
+		'defs' => FALSE,					// Convert defines(constants) within text.
+		'constants' => FALSE,				// replace all {e_XXX} constants with their e107 value
+		'parse_sc' => FALSE,			   	// Parse shortcodes - TRUE enables parsing
+		'no_tags' => FALSE                  // remove HTML tags.
+		);
+
+		// Super modifiers adjust default option values
+		// First line of adjustments change default-ON options
+		// Second line changes default-OFF options
+	var	$e_SuperMods = array(
+				'title' =>				//text is part of a title (e.g. news title)
+					array(
+						'nobreak'=>TRUE, 'retain_nl'=>TRUE, 'no_make_clickable'=>TRUE,'emotes_off'=>TRUE,
+						'defs'=>TRUE,'parse_sc'=>TRUE),
+
+				'user_title' =>				//text is user-entered (i.e. untrusted) and part of a title (e.g. forum title)
+					array(
+						'nobreak'=>TRUE, 'retain_nl'=>TRUE, 'no_make_clickable'=>TRUE,'emotes_off'=>TRUE,'no_hook'=>TRUE
+						),
+
+				'summary' =>			// text is part of the summary of a longer item (e.g. content summary)
+					array(
+						// no changes to default-on items
+						'defs'=>TRUE, 'constants'=>TRUE, 'parse_sc'=>TRUE),
+
+				'description' =>	// text is the description of an item (e.g. download, link)
+					array(
+						// no changes to default-on items
+						'defs'=>TRUE, 'constants'=>TRUE, 'parse_sc'=>TRUE),
+
+				'body' =>					// text is 'body' or 'bulk' text (e.g. custom page body, content body)
+					array(
+						// no changes to default-on items
+						'defs'=>TRUE, 'constants'=>TRUE, 'parse_sc'=>TRUE),
+
+				'user_body' =>					// text is user-entered (i.e. untrusted)'body' or 'bulk' text (e.g. custom page body, content body)
+					array(
+						// no changes to default-on items
+						),
+
+				'linktext' =>			// text is the 'content' of a link (A tag, etc)
+					array(
+						'nobreak'=>TRUE, 'retain_nl'=>TRUE, 'no_make_clickable'=>TRUE,'emotes_off'=>TRUE,'no_hook'=>TRUE,
+						'defs'=>TRUE,'parse_sc'=>TRUE),
+
+				'rawtext' =>			// text is used (for admin edit) without fancy conversions or html.
+					array(
+						'nobreak'=>TRUE, 'retain_nl'=>TRUE, 'no_make_clickable'=>TRUE,'emotes_off'=>TRUE,'no_hook'=>TRUE,'no_tags'=>TRUE
+						// leave opt-in options off
+						)
+		);
+
+	function e_parse()
+	{
+		// Preprocess the supermods to be useful default arrays with all values
+		foreach ($this->e_SuperMods as $key=>$val)
+		{
+			$this->e_SuperMods[$key] = array_merge($this->e_optDefault,$this->e_SuperMods[$key]); // precalculate super defaults
+			$this->e_SuperMods[$key]['context']=$key;
+		}
+		foreach ($this->e_optDefault as $key=>$val)
+		{
+			$this->e_modSet[$key] = TRUE;
+		}
+
+	}
+
 	function toDB($data, $nostrip = false, $no_encode = false, $mod = false)
 	{
 		global $pref;
 		if (is_array($data)) {
 			// recursively run toDB (for arrays)
 			foreach ($data as $key => $var) {
-				$ret[$key] = $this -> toDB($var, $nostrip, $no_encode);
+				$ret[$key] = $this -> toDB($var, $nostrip, $no_encode, $mod);
 			}
 		} else {
 			if (MAGIC_QUOTES_GPC == TRUE && $nostrip == false) {
@@ -60,7 +149,7 @@
 			//If user is not allowed to use [php] change to entities
 			if(!check_class($pref['php_bbcode']))
 			{
-				$ret = str_replace(array("[php]", "[/php]"), array("&#91;php&#93;", "&#91;/php&#93;"), $ret);
+				$ret = preg_replace("#\[(php)#i", "&#91;\\1", $ret);
 			}
 
 		}
@@ -68,18 +157,21 @@
 		return $ret;
 	}
 
-	function toForm($text, $single_quotes = FALSE)
+	function toForm($text, $single_quotes = FALSE, $convert_lt_gt = false)
 	{
 		if($text == "") { return ""; }
-		$mode = ($single_quotes ? ENT_QUOTES :ENT_COMPAT);
-		$search = array('&#036;', '&quot;');
-		$replace = array('$', '"');
+		$mode = ($single_quotes ? ENT_QUOTES : ENT_COMPAT);
+		$search = array('&#036;');
+		$replace = array('$');
 		$text = str_replace($search, $replace, $text);
 		if(e_WYSIWYG !== TRUE){
 	   	  	$text = str_replace("&nbsp;"," ",$text); // fix for utf-8 issue with html_entity_decode();
 		}
-	  	$text = html_entity_decode($text, $mode,CHARSET);
-
+		if($convert_lt_gt)
+		{
+			//need to convert < > to entities if this text will be in a textarea, to prevent injection
+			$text = str_replace(array("<", ">"), array("&lt;", "&gt;"), $text);
+		}
 		return $text;
 	}
 
@@ -100,6 +192,7 @@
 		*/
 		global $pref;
 
+		$no_encode = FALSE;
 		if(isset($pref['post_html']) && check_class($pref['post_html'])) {
 			$no_encode = true;
 		}
@@ -130,7 +223,7 @@
 		//If user is not allowed to use [php] change to entities
 		if(!check_class($pref['php_bbcode']))
 		{
-			$text = str_replace(array("[php]", "[/php]"), array("&#91;php&#93;", "&#91;/php&#93;"), $text);
+			$text = preg_replace("#\[(php)#i", "&#91;\\1", $text);
 		}
 
 		return ($modifier ? $this->toHTML($text, true, $extra) : $text);
@@ -147,78 +240,131 @@
 		// End parse {XXX} codes
 	}
 
+
+
 	function htmlwrap($str, $width, $break = "\n", $nobreak = "", $nobr = "pre", $utf = false)
 	{
 		/*
-		* htmlwrap() function - v1.1
+		* Parts of code from  htmlwrap() function - v1.6
 		* Copyright (c) 2004 Brian Huisman AKA GreyWyvern
 		* http://www.greywyvern.com/code/php/htmlwrap_1.1.php.txt
 		*
 		* This program may be distributed under the terms of the GPL
 		*   - http://www.gnu.org/licenses/gpl.txt
+		*
+		* Other mods by steved
 		*/
 
-		$content = preg_split("/([<>])/", $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
-		$nobreak = explode(" ", $nobreak);
-		$nobr = explode(" ", $nobr);
-		$intag = false;
-		$innbk = array();
-		$innbr = array();
-		$drain = "";
-		$utf = ($utf || CHARSET == 'utf-8') ? "u" : "";
-		$lbrks = "/?!%)-}]\\\"':;";
-		if ($break == "\r")
-		{
-			$break = "\n";
-		}
-		while (list(, $value) = each($content))
-		{
-			switch ($value)
-			{
-				case "<": $intag = true; break;
-				case ">": $intag = false; break;
-				default:
-				if ($intag)
+  // Transform protected element lists into arrays
+  $nobreak = explode(" ", strtolower($nobreak));
+
+  // Variable setup
+  $intag = false;
+  $innbk = array();
+  $drain = "";
+
+  // List of characters it is "safe" to insert line-breaks at
+  // It is not necessary to add < and > as they are automatically implied
+  $lbrks = "/?!%)-}]\\\"':;&";
+
+  // Is $str a UTF8 string?
+	$utf8 = ($utf || CHARSET == 'utf-8') ? "u" : "";
+
+
+// Start of the serious stuff - split into HTML tags and text between
+	  $content = preg_split('#(<.*?>)#mis', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+	  foreach($content as $value)
+	  {
+		if ($value[0] == "<")
+		{  // We are within an HTML tag
+          // Create a lowercase copy of this tag's contents
+          $lvalue = strtolower(substr($value,1,-1));
+		  if ($lvalue)
+		  {	// Tag of non-zero length
+			// If the first character is not a / then this is an opening tag
+            if ($lvalue[0] != "/") 
+			{            // Collect the tag name   
+              preg_match("/^(\w*?)(\s|$)/", $lvalue, $t);
+
+              // If this is a protected element, activate the associated protection flag
+              if (in_array($t[1], $nobreak)) array_unshift($innbk, $t[1]);
+            }
+		    else 
+		    {  // Otherwise this is a closing tag
+              // If this is a closing tag for a protected element, unset the flag
+              if (in_array(substr($lvalue, 1), $nobreak)) 
+			  {
+                reset($innbk);
+                while (list($key, $tag) = each($innbk)) 
 				{
-					if ($value{0} != "/")
-					{
-						preg_match('/^(.*?)(\s|$)/'.$utf, $value, $t);
-						if ((!count($innbk) && in_array($t[1], $nobreak)) || in_array($t[1], $innbk)) $innbk[] = $t[1];
-						if ((!count($innbr) && in_array($t[1], $nobr)) || in_array($t[1], $innbr)) $innbr[] = $t[1];
-					} else {
-						if (in_array(substr($value, 1), $innbk)) unset($innbk[count($innbk)]);
-						if (in_array(substr($value, 1), $innbr)) unset($innbr[count($innbr)]);
-					}
-				} else if ($value)
+                  if (substr($lvalue, 1) == $tag) 
+				  {
+                    unset($innbk[$key]);
+                    break;
+                  }
+                }
+                $innbk = array_values($innbk);
+              }
+            }
+		  }
+		  else
+		  {
+		    $value = '';		// Eliminate any empty tags altogether
+		  }
+        // Else if we're outside any tags, and with non-zero length string...
+        } 
+		elseif ($value) 
+		{
+          // If unprotected...
+          if (!count($innbk)) 
+		  {
+            // Use the ACK (006) ASCII symbol to replace all HTML entities temporarily
+            $value = str_replace("\x06", "", $value);
+            preg_match_all("/&([a-z\d]{2,7}|#\d{2,5});/i", $value, $ents);
+            $value = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x06", $value);
+
+            // Enter the line-break loop
+            do 
+			{
+              $store = $value;
+
+              // Find the first stretch of characters over the $width limit
+              if (preg_match("/^(.*?\s)?(\S{".$width."})(?!(".preg_quote($break, "/")."|\s))(.*)$/s".(($utf8) ? "u" : ""), $value, $match)) 
+			  {
+                if (strlen($match[2])) 
 				{
-					if (!count($innbr)) $value = str_replace("\n", "\r", str_replace("\r", "", $value));
-					if (!count($innbk))
-					{
-						do
-						{
-							$store = $value;
-							if (preg_match("/^(.*?\s|^)(([^\s&]|&(\w{2,5}|#\d{2,4});){".$width."})(?!(".preg_quote($break, "/").'|\s))(.*)$/s'.$utf, $value, $match))
-							{
-								for ($x = 0, $ledge = 0; $x < strlen($lbrks); $x++) $ledge = max($ledge, strrpos($match[2], $lbrks{$x}));
-								if (!$ledge) $ledge = strlen($match[2]) - 1;
-								$value = $match[1].substr($match[2], 0, $ledge + 1).$break.substr($match[2], $ledge + 1).$match[6];
-							}
-						}
-						while ($store != $value);
-					}
-					if (!count($innbr)) $value = str_replace("\r", E_NL, $value);
-				}
-			}
-			$drain .= $value;
-		}
-		return $drain;
+                  // Determine the last "safe line-break" character within this match
+                  for ($x = 0, $ledge = 0; $x < strlen($lbrks); $x++) $ledge = max($ledge, strrpos($match[2], $lbrks{$x}));
+                  if (!$ledge) $ledge = strlen($match[2]) - 1;
+
+                  // Insert the modified string
+                  $value = $match[1].substr($match[2], 0, $ledge + 1).$break.substr($match[2], $ledge + 1).$match[4];
+                }
+              }
+            // Loop while overlimit strings are still being found
+            } while ($store != $value);
+
+            // Put captured HTML entities back into the string
+            foreach ($ents[0] as $ent) $value = preg_replace("/\x06/", $ent, $value, 1);
+          }
+        }
+
+        // Send the modified segment down the drain
+        $drain .= $value;
+	  }
+
+	  // Return contents of the drain
+	  return $drain;
 	}
 
+
+
 	function html_truncate ($text, $len = 200, $more = "[more]")
 	{
 		$pos = 0;
 		$curlen = 0;
 		$tmp_pos = 0;
+		$intag = FALSE;
 		while($curlen < $len && $curlen < strlen($text))
 		{
 			switch($text{$pos})
@@ -232,6 +378,7 @@
 				$tmp_pos = $pos-1;
 				$pos++;
 				break;
+				
 				case ">" :
 				if($text{$pos-1} == "/")
 				{
@@ -245,6 +392,7 @@
 				$intag = FALSE;
 				$pos++;
 				break;
+				
 				case "&" :
 				if($text{$pos+1} == "#")
 				{
@@ -276,16 +424,24 @@
 		return $ret;
 	}
 
-	function text_truncate($text, $len = 200, $more = "[more]") {
-		if(strlen($text) <= $len) {
-			return $text;
-		} else { // utf-8 compatible substr()
-            return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,0}'.
-					'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
-					'$1',$text).$more;
-		}
+
+	// Truncate a string to a maximum length $len - append the string $more if it was truncated
+	// Uses current CHARSET - for utf-8, returns $len characters rather than $len bytes
+	function text_truncate($text, $len = 200, $more = "[more]") 
+	{
+	  if (strlen($text) <= $len) return $text; 		// Always valid
+	  if (CHARSET !== 'utf-8') return substr($text,0,$len).$more;	// Non-utf-8 - one byte per character - simple
+  
+	  // Its a utf-8 string here - don't know whether its longer than allowed length yet
+	  preg_match('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,0}'.
+				'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'})(.{0,1}).*#s',$text,$matches);
+
+	  $ret = $matches[1];
+	  if (!empty($matches[2])) $ret .= $more;
+	  return $ret;
 	}
 
+
 	function textclean ($text, $wrap=100)
 	{
 		$text = str_replace ("\n\n\n", "\n\n", $text);
@@ -325,6 +481,7 @@
 		return $this->e_highlighting;
 	}
 
+
 	function toHTML($text, $parseBB = FALSE, $modifiers = "", $postID = "", $wrap=FALSE) {
 		if ($text == '')
 		{
@@ -332,52 +489,133 @@
 		}
 		global $pref, $fromadmin;
 
-		$fromadmin = strpos($modifiers, "fromadmin");
-		//$text = str_replace(array("&#092;&quot;", "&#092;&#039;", "&#092;&#092;"), array("&quot;", "&#039;", "&#092;"), $text);
+		//
+		// SET MODIFIERS
+		//
+
+		// Get modifier strings for toHTML
+		// "super" modifiers set a baseline. Recommend entering in UPPER CASE to highlight
+		// other modifiers override
+		// modifiers SHOULD be delimited with commas (eventually this will be 'MUST')
+		// modifiers MAY have spaces in between as desired
+
+		$opts = $this->e_optDefault;
+		if (strlen($modifiers))
+		{
+			//
+			// Yes, the following code is strangely-written. It is one of the MOST used bits in
+			// all of e107. We "inlined" the assignments to optimize speed through
+			// some careful testing (19 Jan 2007).
+			//
+			// Some alternatives that do NOT speed things up (they make it slower)
+			//  - use of array_intersect, array_walk, preg_replace, intermediate variables, etc etc etc.
+			//
+
+			if (1) // php 4 code
+			{
+				$opts = $this->e_optDefault;
+				$aMods = explode( ',',
+										// convert blanks to comma, then comma-comma (from blank-comma) to single comma
+										str_replace(array(' ', ',,'),	array(',', ',' ),
+											// work with all lower case
+											strtolower($modifiers)
+										)
+				);
+
+				foreach ($aMods as $mod)
+				{
+					if (isset($this->e_SuperMods[$mod]))
+					{
+						  	$opts = $this->e_SuperMods[$mod];
+					}
+				}
+
+				// Find any regular mods
+				foreach ($aMods as $mod)
+				{
+					$opts[$mod] = TRUE;  // Change mods as spec'd
+				}
+			}
+
+			if (0) // php 5 code - not tested, and may not be faster anyway
+			{
+				$aMods = array_flip(
+									explode( ',',
+										// convert blanks to comma, then comma-comma (from blank-comma) to single comma
+										str_replace(array(' ', ',,'),	array(',', ',' ),
+											// work with all lower case
+											strtolower($modifiers)
+										)
+									)
+								 );
+				$opts = array_merge($opts, array_intersect_key($this->e_SuperMods,$aMods)); // merge in any supermods found
+				$opts = array_merge($opts, array_intersect_key($this->modSet, $aMods)); // merge in any other mods found
+			}
+		}
 
-		// support for converting defines(constants) within text. eg. Lan_XXXX - must be the entire text string (i.e. not embedded)
-		if(strpos($modifiers,"defs") !== FALSE && strlen($text) < 25 && defined(trim($text))){
+		$fromadmin = $opts['fromadmin'];
+
+		// Convert defines(constants) within text. eg. Lan_XXXX - must be the entire text string (i.e. not embedded)
+		// The check for '::' is a workaround for a bug in the Zend Optimiser 3.3.0 and PHP 5.2.4 combination - causes crashes if '::' in site name
+		if ($opts['defs'] && (strlen($text) < 25) && ((strpos($text,'::') === FALSE) && defined(trim($text))))
+		{
 			return constant(trim($text));
 		}
 
-		// replace all {e_XXX} constants with their e107 value
-		if(strpos($modifiers, "constants") !== FALSE)
+
+
+
+		if ($opts['no_tags'])
 		{
-			$text = $this->replaceConstants($text);
+			$text = strip_tags($text);
 		}
 
-       if(!$wrap && $pref['main_wordwrap']) $wrap = $pref['main_wordwrap'];
+
+		if(!$wrap && $pref['main_wordwrap']) $wrap = $pref['main_wordwrap'];
         $text = " ".$text;
 
-			// Prepare for line-break compression. Avoid compressing newlines in embedded scripts and CSS
-        if (strpos($modifiers, 'nobreak') === FALSE) {
+
+		// Prepare for line-break compression. Avoid compressing newlines in embedded scripts and CSS
+		if (!$opts['nobreak'])
+		{
             $text = preg_replace("#>\s*[\r]*\n[\r]*#", ">", $text);
             preg_match_all("#<(script|style)[^>]+>.*?</(script|style)>#is", $text, $embeds);
             $text = preg_replace("#<(script|style)[^>]+>.*?</(script|style)>#is", "<|>", $text);
         }
 
+
 			// Convert URL's to clickable links, unless modifiers or prefs override
-        if($pref['make_clickable'] && strpos($modifiers, 'no_make_clickable') === FALSE) {
-            if($pref['link_replace'] && strpos($modifiers, 'no_replace') === FALSE) {
-                $_ext = ($pref['links_new_window'] ? " rel=\"external\"" : "");
-                $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
-                $text = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
-                if(CHARSET != "utf-8" && CHARSET != "UTF-8"){
-                    $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : "\\1\\2&copy;\\3";
-                }else{
-                    $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : "\\1\\2©\\3";
-                }
-                $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>".$email_text."</a>", $text);
-            } else {
-                $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<,]*)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $text);
-                $text = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<,]*)#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $text);
-                $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>-email-</a>", $text);
+        if ($pref['make_clickable'] && !$opts['no_make_clickable'])
+		{
+            if ($pref['link_replace'] && !$opts['no_replace'])
+			{
+              $_ext = ($pref['links_new_window'] ? " rel=\"external\"" : "");
+              $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
+			  $text = preg_replace("#(^|[\n \]])((www|ftp)\.[\w+-]+?\.[\w+\-.]*(?(?=/)(/.+?(?=\s|,\s))|(?=\W)))#is", "\\1<a href=\"http://\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
+              if(CHARSET != "utf-8" && CHARSET != "UTF-8")
+			  {
+                $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : "\\1\\2&copy;\\3";
+              }
+			  else
+			  {
+                $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : "\\1\\2©\\3";
+              }
+              $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>".$email_text."</a>", $text);
+            }
+			else
+			{
+              $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<,]*)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $text);
+			  $text = preg_replace("#(^|[\n \]])((www|ftp)\.[\w+-]+?\.[\w+\-.]*(?(?=/)(/.+?(?=\s|,\s))|(?=\W)))#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $text);
+              $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>".LAN_EMAIL_SUBS."</a>", $text);
             }
         }
 
+
 			// Convert emoticons to graphical icons, unless modifiers override
-        if (strpos($modifiers, 'emotes_off') === FALSE) {
-            if ($pref['smiley_activate'] || strpos($modifiers,'emotes_on') !== FALSE) {
+        if (!$opts['emotes_off'])
+		{
+            if ($pref['smiley_activate'] || $opts['emotes_on'])
+			{
                 if (!is_object($this->e_emote)) {
                     require_once(e_HANDLER.'emote_filter.php');
                     $this->e_emote = new e_emoteFilter;
@@ -386,23 +624,33 @@
             }
         }
 
+
 			// Reduce multiple newlines in all forms to a single newline character, except for embedded scripts and CSS
-        if (strpos($modifiers, 'nobreak') === FALSE) {
+        if (!$opts['nobreak'])
+		{
             $text = preg_replace("#[\r]*\n[\r]*#", E_NL, $text);
             foreach ($embeds[0] as $embed) {
                 $text = preg_replace("#<\|>#", $embed, $text, 1);
             }
         }
 
+
 		// Restore entity form of quotes and such to single characters, except for text destined for tag attributes or JS.
-		if (strpos($modifiers, 'value') === FALSE) { // output not used for attribute values.
+		if (!$opts['value'])
+		{ // output not used for attribute values.
 	       	$text = str_replace($this -> search, $this -> replace, $text);
-        }else{   									// output used for attribute values.
+        }
+		else
+		{   									// output used for attribute values.
             $text = str_replace($this -> replace, $this -> search, $text);
 		}
 
+
+
+
         // Start parse [bb][/bb] codes
-        if ($parseBB === TRUE) {
+        if ($parseBB === TRUE)
+		{
             if (!is_object($this->e_bb)) {
                 require_once(e_HANDLER.'bbcode_handler.php');
                 $this->e_bb = new e_bbcode;
@@ -411,7 +659,14 @@
         }
         // End parse [bb][/bb] codes
 
-				// profanity filter
+
+		// replace all {e_XXX} constants with their e107 value AFTER the bbcodes have been parsed.
+		if ($opts['constants'])
+		{
+		   	$text = $this->replaceConstants($text);
+		}
+
+		// profanity filter
         if ($pref['profanity_filter']) {
             if (!is_object($this->e_pf)) {
                 require_once(e_HANDLER."profanity_filter.php");
@@ -420,48 +675,52 @@
             $text = $this->e_pf->filterProfanities($text);
         }
 
+
 			// Optional short-code conversion
-        if (strpos($modifiers,'parse_sc') !== FALSE)
+        if ($opts['parse_sc'])
         {
             $text = $this->parseTemplate($text, TRUE);
         }
 
+
         //Run any hooked in parsers
-        if(isset($pref['tohtml_hook']) && $pref['tohtml_hook'])
+		if (!$opts['no_hook'] && varset($pref['tohtml_hook']))
         {
-            foreach(explode(",",$pref['tohtml_hook']) as $hook)
+          foreach(explode(",",$pref['tohtml_hook']) as $hook)
+          {
+            if (!is_object($this->e_hook[$hook]))
             {
-                if (strpos($modifiers, 'no_hook') === FALSE)
-                {
-                    if (!is_object($this->e_hook[$hook]))
-                    {
-                        require_once(e_PLUGIN.$hook."/".$hook.".php");
-                        $hook_class = "e_".$hook;
-                        $this->e_hook[$hook] = new $hook_class;
-                    }
-                    $text = $this->e_hook[$hook]->$hook($text);
-                }
+              require_once(e_PLUGIN.$hook."/".$hook.".php");
+              $hook_class = "e_".$hook;
+              $this->e_hook[$hook] = new $hook_class;
             }
+          $text = $this->e_hook[$hook]->$hook($text,$opts['context']);
+          }
         }
 
-        if (strpos($modifiers, 'nobreak') === FALSE) {
+
+        if (!$opts['nobreak'])
+		{
             $text = $this -> textclean($text, $wrap);
         }
 
+
         // Search Highlight
-        if (strpos($modifiers, 'emotes_off') === FALSE) {
-        	if ($this->checkHighlighting())
-        	{
-						$text = $this -> e_highlight($text, $this -> e_query);
-					}
-				}
+        if (!$opts['emotes_off'])
+		{
+          if ($this->checkHighlighting())
+          {
+			$text = $this -> e_highlight($text, $this -> e_query);
+		  }
+		}
+
 
         $nl_replace = "<br />";
-        if (strpos($modifiers, 'nobreak') !== FALSE)
+        if ($opts['nobreak'])
         {
             $nl_replace = '';
         }
-        elseif (strpos($modifiers, 'retain_nl') !== FALSE)
+        elseif ($opts['retain_nl'])
         {
             $nl_replace = "\n";
         }
@@ -470,12 +729,14 @@
 		return trim($text);
 	}
 
+
 	function toAttribute($text) {
 		$text = str_replace("&amp;","&",$text); // URLs posted without HTML access may have an &amp; in them.
-		$text = htmlspecialchars($text); // Xhtml compliance.
-		if (!preg_match('/&#|\'|"|\(|\)|<|>/s', $text)) {
-			$text = $this->replaceConstants($text);
-			return $text;
+		$text = htmlspecialchars($text, ENT_QUOTES, CHARSET); // Xhtml compliance.
+		if (!preg_match('/&#|\'|"|\(|\)|<|>/s', $text)) 
+		{
+		  $text = $this->replaceConstants($text);
+		  return $text;
 		} else {
 			return '';
 		}
@@ -529,7 +790,10 @@
 //   "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc
 //   TRUE = produce truncated URL path, e.g. e107plugins/etc
 //   "" (default) = URL's get relative path e.g. ../e107_plugins/etc
-//                  AND all other e107 constants are replaced
+//
+// $all - if TRUE, then
+//		when $nonrelative is "full" or TRUE, USERID is also replaced...
+//		when $nonrelative is "" (default), ALL other e107 constants are replaced
 //
 // only an ADMIN user can convert {e_ADMIN}
 //
@@ -538,18 +802,46 @@
 		if($nonrelative != "")
 		{
 			global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY, $THEMES_DIRECTORY,$DOWNLOADS_DIRECTORY,$ADMIN_DIRECTORY;
-			$replace_relative = array("",$IMAGES_DIRECTORY,$PLUGINS_DIRECTORY,$FILES_DIRECTORY,$THEMES_DIRECTORY,$DOWNLOADS_DIRECTORY);
-			$replace_absolute = array(SITEURL,SITEURL.$IMAGES_DIRECTORY,SITEURL.$PLUGINS_DIRECTORY,SITEURL.$FILES_DIRECTORY,SITEURL.$THEMES_DIRECTORY,SITEURL.$DOWNLOADS_DIRECTORY);
-			$search = array("{e_BASE}","{e_IMAGE}","{e_PLUGIN}","{e_FILE}","{e_THEME}","{e_DOWNLOAD}");
+			$replace_relative = array("",
+									SITEURL.$IMAGES_DIRECTORY,
+									SITEURL.$THEMES_DIRECTORY,
+									$IMAGES_DIRECTORY,
+									$PLUGINS_DIRECTORY,
+									$FILES_DIRECTORY,
+									$THEMES_DIRECTORY,
+									$DOWNLOADS_DIRECTORY);
+			$replace_absolute = array(SITEURL,
+									SITEURL.$IMAGES_DIRECTORY,
+									SITEURL.$THEMES_DIRECTORY,
+									SITEURL.$IMAGES_DIRECTORY,
+									SITEURL.$PLUGINS_DIRECTORY,
+									SITEURL.$FILES_DIRECTORY,
+									SITEURL.$THEMES_DIRECTORY,
+									SITEURL.$DOWNLOADS_DIRECTORY);
+			$search = array("{e_BASE}","{e_IMAGE_ABS}","{e_THEME_ABS}","{e_IMAGE}","{e_PLUGIN}","{e_FILE}","{e_THEME}","{e_DOWNLOAD}");
 			if (ADMIN) {
 				$replace_relative[] = $ADMIN_DIRECTORY;
 				$replace_absolute[] = SITEURL.$ADMIN_DIRECTORY;
 				$search[] = "{e_ADMIN}";
 			}
+			if ($all) {
+			  if (USER)
+			  {  // Can only replace with valid number for logged in users
+				$replace_relative[] = USERID;
+				$replace_absolute[] = USERID;
+			  }
+			  else
+			  {
+				$replace_relative[] = '';
+				$replace_absolute[] = '';
+			  }
+			  $search[] = "{USERID}";
+			}
 			$replace = ((string)$nonrelative == "full" ) ? $replace_absolute : $replace_relative;
 			return str_replace($search,$replace,$text);
 		}
-		$pattern = ($all ? "#\{([A-Za-z_0-9]*)\}#s" : "#\{(e_[A-Z]*)\}#s");
+//		$pattern = ($all ? "#\{([A-Za-z_0-9]*)\}#s" : "#\{(e_[A-Z]*)\}#s");
+		$pattern = ($all ? "#\{([A-Za-z_0-9]*)\}#s" : "#\{(e_[A-Z]*(?:_ABS){0,1})\}#s");
 	 	$text = preg_replace_callback($pattern, array($this, 'doReplace'), $text);
 		$theme_path = (defined("THEME")) ? constant("THEME") : "";
 		$text = str_replace("{THEME}",$theme_path,$text);
@@ -596,7 +888,7 @@
         	$len = strlen($val);
 			if(substr($url,0,$len) == $val)
 			{
-            	return str_replace($val,$key,$url);
+            	return substr_replace($url,$key,0,$len); // replace the first instance only
 			}
 		}
 
@@ -614,14 +906,16 @@
 		return $text;
 	}
 
-    function toEmail($text,$posted="")
+
+    function toEmail($text,$posted="",$mods="parse_sc, no_make_clickable")
 	{
-		if ($posted === TRUE && MAGIC_QUOTES_GPC) {
+		if ($posted === TRUE && MAGIC_QUOTES_GPC)
+		{
 			$text = stripslashes($text);
 		}
 
-	  	$text = $this->replaceConstants($text,"full");
-    	$text = $this->toHTML($text,TRUE,"parse_sc");
+	  	$text = (strtolower($mods) != "rawtext") ? $this->replaceConstants($text,"full") : $text;
+    	$text = $this->toHTML($text,TRUE,$mods);
         return $text;
 	}
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/emote.php 0.7.11.src/e107_handlers/emote.php
--- 0.7.7.src/e107_handlers/emote.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/emote.php	2007-05-24 16:07:15.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/emote.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.18 $
+|     $Date: 2007/05/24 21:07:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -28,11 +28,12 @@
 		$tp->e_emote = new e_emoteFilter;
 	}
 	
-	foreach($tp->e_emote->emotes as $key => $value)
+	$str = '';
+	foreach($tp->e_emote->emotes as $key => $value)		// filename => text code
 	{
-		$key = str_replace("!", ".", $key);
-		$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
-		$key = e_IMAGE."emotes/" . $pref['emotepack'] . "/" .$key;
+		$key = str_replace("!", ".", $key);					// Usually '.' was replaced by '!' when saving
+		$key = preg_replace("#_(\w{3})$#", ".\\1", $key);	// '_' followed by exactly 3 chars is file extension
+		$key = e_IMAGE."emotes/" . $pref['emotepack'] . "/" .$key;		// Add in the file path
 
 		$value2 = substr($value, 0, strpos($value, " "));
 		$value = ($value2 ? $value2 : $value);
diff -x .svn -ruN 0.7.7.src/e107_handlers/emote_filter.php 0.7.11.src/e107_handlers/emote_filter.php
--- 0.7.7.src/e107_handlers/emote_filter.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/emote_filter.php	2007-05-25 16:47:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/emote_filter.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2007/05/25 21:47:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -36,17 +36,20 @@
 
 		foreach($this->emotes as $key => $value)
 		{
+		  $value = trim($value);
+
+		  if ($value)
+		  {	// Only 'activate' emote if there's a substitution string set
 			$key = preg_replace("#!(\w{3,}?)$#si", ".\\1", $key);
+			// Next two probably to sort out legacy issues - may not be required any more
 			$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
 			$key = str_replace("!", "_", $key);
 
-			$value = trim($value);
-
-			$filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key;
-			$fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
+			  $filename = e_IMAGE."emotes/" . $pref['emotepack'] . "/" . $key;
+			  $fileloc = SITEURLBASE.e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/" . $key;
 
-			if(file_exists($filename))
-			{
+			  if(file_exists($filename))
+			  {
 				if(strstr($value, " "))
 				{
 					$tmp = explode(" ", $value);
@@ -69,7 +72,12 @@
 						$this->replace[] = "\n <img src='".$filename."' alt='' style='vertical-align:middle; border:0' /> ";
 					}
 				}
-			}
+			  }
+		  }
+		  else
+		  {
+			unset($this->emotes[$key]);
+		  }
 		}
 	}
 	 
diff -x .svn -ruN 0.7.7.src/e107_handlers/encrypt_handler.php 0.7.11.src/e107_handlers/encrypt_handler.php
--- 0.7.7.src/e107_handlers/encrypt_handler.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/encrypt_handler.php	2007-09-29 12:48:21.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/encrypt_handler.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2007/09/29 17:48:21 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,12 +21,14 @@
 
 function encode_ip($ip)
 {
+  if (strpos($ip,':') !== FALSE) return $ip;			// IPV6 addresses - return unaltered
 	$ipa = explode('.', $ip);
 	return sprintf('%02x%02x%02x%02x', $ipa[0], $ipa[1], $ipa[2], $ipa[3]);
 }
 
 function decode_ip($encodedIP)
 {
+  if (strpos($encodedIP,':') !== FALSE) return $encodedIP;			// IPV6 addresses - return unaltered
 	$hexip = explode('.', chunk_split($encodedIP, 2, '.'));
 	return hexdec($hexip[0]). '.' . hexdec($hexip[1]) . '.' . hexdec($hexip[2]) . '.' . hexdec($hexip[3]);
 }
diff -x .svn -ruN 0.7.7.src/e107_handlers/equery_secure.php 0.7.11.src/e107_handlers/equery_secure.php
--- 0.7.7.src/e107_handlers/equery_secure.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/equery_secure.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,52 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_handlers/equery_secure.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-	
-if (!defined('e107_INIT')) { exit; }
-
-if (file_exists(e_LANGUAGEDIR.e_LANGUAGE."/lan_equery_secure.php")) {
-	include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_equery_secure.php");
-} else {
-	include_once(e_LANGUAGEDIR."English/lan_equery_secure.php");
-}
-require_once(HEADERF);
-	
-$caption = EQSEC_LAN2;
-$text = "<div style='text-align: center;' >
-	<div class='fcaption'>".EQSEC_LAN1."</div>
-	<br />";
-$text .= "<table style='text-align:center;'>
-	<tr><td><b>".EQSEC_LAN4."</b></td><td> ".($tmp_s_ref != "" ? $tmp_s_ref : EQSEC_LAN3 )."</td></tr>
-	<tr><td><b>".EQSEC_LAN5."</b></td><td> ".e_SELF."</td></tr></table>
-	<br />";
-$text .= "<br />
-	<form action=\"".e_SELF."?".e_QUERY."\" method=\"post\" >
-	<div><input class='button' type='submit' value='".EQSEC_LAN6."' name='equery_secure' id='equery_secure' /></div>
-	</form>
-	<br /><br />
-	 
-	<br />
-	<a href=\"javascript:void(0);\" onclick=\"history.go(-1);\" >".EQSEC_LAN7."</a>
-	 
-	</div>";
-	
-$ns->tablerender($caption, $text);
-	
-require_once(FOOTERF);
-exit;
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/form_handler.php 0.7.11.src/e107_handlers/form_handler.php
--- 0.7.7.src/e107_handlers/form_handler.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/form_handler.php	2007-03-23 16:46:48.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/form_handler.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2007/03/23 21:46:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 	
@@ -30,7 +30,7 @@
 	 
 	function form_text($form_name, $form_size, $form_value, $form_maxlength, $form_class = "tbox", $form_readonly = "", $form_tooltip = "", $form_js = "") {
 		$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
-		$value = ($form_value ? " value='".$form_value."'" : "");
+		$value = (isset($form_value) ? " value='".$form_value."'" : "");
 		$size = ($form_size ? " size='".$form_size."'" : "");
 		$maxlength = ($form_maxlength ? " maxlength='".$form_maxlength."'" : "");
 		$readonly = ($form_readonly ? " readonly='readonly'" : "");
@@ -40,7 +40,7 @@
 	 
 	function form_password($form_name, $form_size, $form_value, $form_maxlength, $form_class = "tbox", $form_readonly = "", $form_tooltip = "", $form_js = "") {
 		$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
-		$value = ($form_value ? " value='".$form_value."'" : "");
+		$value = (isset($form_value) ? " value='".$form_value."'" : "");
 		$size = ($form_size ? " size='".$form_size."'" : "");
 		$maxlength = ($form_maxlength ? " maxlength='".$form_maxlength."'" : "");
 		$readonly = ($form_readonly ? " readonly='readonly'" : "");
diff -x .svn -ruN 0.7.7.src/e107_handlers/forum.php 0.7.11.src/e107_handlers/forum.php
--- 0.7.7.src/e107_handlers/forum.php	2006-10-24 08:35:06.000000000 -0500
+++ 0.7.11.src/e107_handlers/forum.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,593 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_handlers/forum.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/10/24 13:35:06 $
-|     $Author: mrpete $
-+----------------------------------------------------------------------------+
-*/
-if (!defined('e107_INIT')) { exit; }
-
-require_once("../class2.php");
-if (!getperms("5")) {
-	header("location:".e_BASE."index.php");
-	exit;
-}
-require_once("auth.php");
-require_once(e_HANDLER."userclass_class.php");
-$aj = new textparse;
-
-if (e_QUERY) {
-	$qs = explode(".", e_QUERY);
-	$action = $qs[0];
-	$forum_id = $qs[1];
-	$forum_order = $qs[2];
-}
-
-$sql2 = new db;
-
-if (isset($_POST['prune'])) {
-	if (!$_POST['prune_days']) {
-		$message = FORLAN_1;
-	} else {
-
-		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."'>\n
-			<table style='width:85%' class='fborder'>
-			<tr>
-			<td style='width:75%' class='forumheader3'>
-			".FORLAN_106."<br />
-			<span class='smalltext'>".FORLAN_2."</span>
-			</td>
-			<td style='width:25%' class='forumheader2' style='text-align:right'>
-			<input type='radio' name='prune_type' value='delete' /> ".FORLAN_3."<br />
-			<input type='radio' name='prune_type' value='unactivatate' checked="checked" /> ".FORLAN_4."
-			</td>
-			</tr>
-			<tr>
-			<td colspan='2'  style='text-align:center' class='forumheader'>
-			<input class='button' type='submit' name='doprune' value='".FORLAN_5."' />
-			<input class='button' type='submit' name='cancelprune' value='".FORLAN_6."' />
-			<input type='hidden' name='prune_days' value='".$_POST['prune_days']."' />
-			</td>
-			</tr>
-			 
-			</table>
-			</form>
-			</div>";
-		$ns->tablerender(FORLAN_7, $text);
-		require_once("footer.php");
-	}
-}
-
-if (isset($_POST['doprune'])) {
-	if ($_POST['prune_type'] == "delete") {
-		$prunedate = time() - ($_POST['prune_days'] * 86400);
-		if ($sql->db_Select("forum_t", "*", "thread_lastpost < {$prunedate} AND thread_parent=0 AND thread_s!=1")) {
-			while ($row = $sql->db_Fetch()) {
-				extract($row);
-				$sql2->db_Delete("forum_t", "thread_parent = '{$thread_id}' ");
-				// delete replies
-				$sql2->db_Delete("forum_t", "thread_id = '{$thread_id}' ");
-				// delete thread
-			}
-
-			$sql->db_Select("forum", "*", "forum_parent != 0");
-			while ($row = $sql->db_Fetch()) {
-				extract($row);
-				$threads = $sql2->db_Count("forum_t", "(*)", "WHERE thread_forum_id = {$forum_id} AND thread_parent = 0");
-				$replies = $sql2->db_Count("forum_t", "(*)", "WHERE thread_forum_id = {$forum_id} AND thread_parent != 0");
-				$sql2->db_Update("forum", "forum_threads = '{$threads}', forum_replies = '{$replies}' WHERE forum_id = '{$forum_id}'");
-			}
-			$message = FORLAN_8;
-		} else {
-			$message = FORLAN_9;
-		}
-	} else {
-		$prunedate = time() - ($_POST['prune_days'] * 86400);
-		$sql->db_Update("forum_t", "thread_active = 0 WHERE thread_lastpost < {$prunedate} AND thread_parent=0 ");
-		$message = FORLAN_8;
-	}
-}
-
-if (isset($_POST['update_order'])) {
-	extract($_POST);
-	while (list($key, $id) = each($forum_order_)) {
-		$tmp = explode(".", $id);
-		$sql->db_Update("forum", "forum_order = {$tmp[1]} WHERE forum_id = {$tmp[0]}");
-		echo "forum_order = {$tmp[1]} WHERE forum_id = {$tmp[0]}<br />";
-	}
-	$message = FORLAN_73;
-}
-
-
-
-$sql->db_Select("forum", "forum_id, forum_order", "forum_parent=0 ORDER BY forum_order ASC");
-$c = 1;
-while ($row = $sql->db_Fetch()) {
-	extract($row);
-	$sql2->db_Update("forum", "forum_order = '{$c}' WHERE forum_id = '{$forum_id}'");
-	$c++;
-}
-$sql->db_Select("forum", "forum_id, forum_order", "forum_parent != 0 ORDER BY forum_order ASC");
-while ($row = $sql->db_Fetch()) {
-	extract($row);
-	$sql2->db_Update("forum", "forum_order = '{$c}' WHERE forum_id = '{$forum_id}' ");
-	$c++;
-}
-
-if (isset($_POST['updateoptions'])) {
-	$pref['email_notify'] = $_POST['email_notify'];
-	$pref['forum_poll'] = $_POST['forum_poll'];
-	$pref['forum_popular'] = $_POST['forum_popular'];
-	$pref['forum_track'] = $_POST['forum_track'];
-	$pref['forum_eprefix'] = $_POST['forum_eprefix'];
-	$pref['forum_enclose'] = $_POST['forum_enclose'];
-	$pref['forum_title'] = $_POST['forum_title'];
-	$pref['forum_postspage'] = $_POST['forum_postspage'];
-	$pref['forum_levels'] = $_POST['forum_levels'];
-	$pref['image_post'] = $_POST['image_post'];
-	$pref['html_post'] = $_POST['html_post'];
-	$pref['forum_attach'] = $_POST['forum_attach'];
-	save_prefs();
-	$message = FORLAN_10;
-}
-
-If(isset($_POST['submit'])) {
-
-	$c = 0;
-	while ($_POST['mod'][$c]) {
-		$mods .= $_POST['mod'][$c].", ";
-		$c++;
-	}
-	$mods = preg_replace("/, $/", ".", $mods);
-
-	$sql->db_Select("forum", "*", "forum_name='".$_POST['parentforum']."' ");
-	$row = $sql->db_Fetch();
-	$forum_parent = $row['forum_id'];
-	$_POST['forum_name'] = $aj->formtpa($_POST['forum_name'], "admin");
-	$_POST['forum_description'] = $aj->formtpa($_POST['forum_description'], "admin");
-
-	$sql->db_Insert("forum", "0, '".$_POST['forum_name']."', '".$_POST['forum_description']."', '".$forum_parent."', '".time()."', '".$mods."', 0, 0, 0, '".$_POST['forum_class']."', 0 ");
-	unset($forum_name, $forum_description, $forum_parent);
-	$message = FORLAN_11;
-}
-
-If(isset($_POST['update'])) {
-
-	$c = 0;
-	while ($_POST['mod'][$c]) {
-		$mods .= $_POST['mod'][$c].", ";
-		$c++;
-	}
-	$mods = preg_replace("/, $/", ".", $mods);
-	$sql->db_Select("forum", "*", "forum_name='".$_POST['parentforum']."' ");
-	$row = $sql->db_Fetch();
-	$_POST['forum_name'] = $aj->formtpa($_POST['forum_name'], "admin");
-	$_POST['forum_description'] = $aj->formtpa($_POST['forum_description'], "admin");
-	$forum_parent = $row['forum_id'];
-	$sql->db_Update("forum", "forum_name='".$_POST['forum_name']."', forum_description='".$_POST['forum_description']."', forum_parent='".$forum_parent."', forum_moderators='".$mods."', forum_class='".$_POST['forum_class']."' WHERE forum_id='".$_POST['forum_id']."' ");
-	unset($forum_name, $forum_description, $forum_parent, $forum_active);
-	$message = FORLAN_12;
-}
-
-If(isset($_POST['psubmit'])) {
-	$_POST['parent'] = $aj->formtpa($_POST['parent'], "admin");
-	$sql->db_Insert("forum", "0, '".$_POST['parent']."', '', '', '".time()."', '0', '0', '0', '', '".$_POST['parent_class']."', 0 ");
-	unset($parent);
-	$message = FORLAN_13;
-}
-
-If(isset($_POST['pupdate'])) {
-	$_POST['parent'] = $aj->formtpa($_POST['parent'], "admin");
-	$sql->db_Update("forum", "forum_name='".$_POST['parent']."', forum_class='".$_POST['parent_class']."' WHERE forum_id='".$_POST['existing']."' ");
-	unset($parent);
-	$message = FORLAN_14;
-}
-
-If(isset($_POST['pedit'])) {
-	$sql->db_Select("forum", "*", "forum_id='".$_POST['existing']."' ");
-	list($forum_id, $parent, $forum_description, $forum_parent, $forum_datestamp, $forum_moderators, $forum_threads, $forum_replies, $forum_lastpost, $parent_class) = $sql->db_Fetch();
-	$parent = stripslashes($parent);
-}
-
-If(isset($_POST['edit'])) {
-	$sql->db_Select("forum", "*", "forum_id='".$_POST['existing']."' ");
-	list($forum_id, $forum_name, $forum_description, $forum_parent, $forum_datestamp, $forum_moderators, $forum_threads, $forum_replies, $forum_lastpost, $forum_class) = $sql->db_Fetch();
-	$parent = stripslashes($parent);
-}
-
-If(isset($_POST['delete'])) {
-	if ($_POST['confirm']) {
-		$sql->db_Select("forum", "forum_id, forum_parent", "forum_id='".$_POST['existing']."' ");
-		$row = $sql->db_Fetch();
-		extract($row);
-		$tt = ($forum_parent ? "" : "parent");
-		$sql->db_Delete("forum", "forum_id='".$_POST['existing']."' ");
-		$message = FORLAN_107.$tt.FORLAN_108;
-	} else {
-		$message = FORLAN_15;
-	}
-}
-
-
-if (isset($message)) {
-	$ns->tablerender("", "<div style='text-align:center'><b>{$message}</b></div>");
-}
-
-$ns->tablerender("<div style='text-align:center'>".FORLAN_16."</div>", $text);
-
-$text = "<div style='text-align:center'>
-	<form method='post' action='".e_SELF."'>\n
-	<table style='width:85%' class='fborder'>
-	<tr>
-	<td colspan='2' class='forumheader' style='text-align:center'>";
-
-$forum_parent_total = $sql->db_Select("forum", "*", "forum_parent = '0' ");
-if ($forum_parent_total == 0) {
-	$text .= "<span class='defaulttext'>".FORLAN_17."</span>";
-} else {
-	$text .= "<span class='defaulttext'>".FORLAN_18.": </span>
-		<select name='existing' class='tbox'>\n";
-	$c = 0;
-	while (list($forum_id_, $forum_parent_) = $sql->db_Fetch()) {
-		$parents[$c] = $forum_parent_;
-		$parents_id[$c] = $forum_id_;
-		$text .= "<option value='{$forum_id_}'>{$parents[$c]}</option>\n";
-		$c++;
-	}
-	$text .= "</select>
-		<input class='button' type='submit' name='pedit' value='".FORLAN_19."' />
-		<input class='button' type='submit' name='delete' value='".FORLAN_20."' />
-		<input type=\"checkbox\" name=\"confirm\" value=\"1\"><span class=\"smalltext\" /> ".FORLAN_21."</span>
-		";
-}
-$text .= "
-	</td>
-	</tr>
-	<tr>
-	<td style='width:20%' class='forumheader3'><u>".FORLAN_22."</u>:</td>
-	<td style='width:80%' class='forumheader3'>
-	<input class='tbox' type='text' name='parent' size='60' value='{$parent}' maxlength='250' />
-	</td>
-	</tr>
-	 
-	<tr>
-	<td style='width:20%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
-	<td style='width:80%' class='forumheader3'>".r_userclass("parent_class", $parent_class);
-
-$text .= "<tr style='vertical-align:top'>
-	<td colspan='2'  style='text-align:center' class='forumheader'>";
-
-if (isset($_POST['pedit'])) {
-	$text .= "<input class='button' type='submit' name='pupdate' value='".FORLAN_25."' />
-		<input type='hidden' name='existing' value='".$_POST['existing']."' />";
-} else {
-	$text .= "<input class='button' type='submit' name='psubmit' value='".FORLAN_26."' />";
-}
-
-$text .= "</td>
-	</tr>
-	</table>
-	</form>
-	</div>";
-
-$ns->tablerender("Parents", $text);
-
-if ($forum_parent_total == 0) {
-	$text = "<div style='text-align:center'>".FORLAN_27."</div>";
-	$ns->tablerender(FORLAN_28, $text);
-	require_once("footer.php");
-	exit;
-}
-
-
-$forum_total = $sql->db_Select("forum", "*", "forum_parent!='0' ");
-
-$text = "<div style='text-align:center'>
-	<form method='post' action='".e_SELF."'>\n
-	<table style='width:85%' class='fborder'>
-	<tr>
-	<td colspan='2' class='forumheader' style='text-align:center'>";
-
-if ($forum_total == "0") {
-	$text .= "<span class='defaulttext'>".FORLAN_29."</span>";
-} else {
-	$text .= "<span class='defaulttext'>".FORLAN_30.": </span>
-		<select name='existing' class='tbox'>";
-	while (list($forum_id_, $forum_name_) = $sql->db_Fetch()) {
-		$text .= "<option value='{$forum_id_}'>{$forum_name_}</option>";
-	}
-	$text .= "</select>
-		<input class='button' type='submit' name='edit' value='".FORLAN_19."' />
-		<input class='button' type='submit' name='delete' value='".FORLAN_20."' />
-		<input type='checkbox' name='confirm' value='1' /><span class='smalltext'> ".FORLAN_21."</span>
-		";
-}
-
-$text .= "
-	</td>
-	</tr>
-	<tr>
-	<td style='width:20%' class='forumheader3'><u>".FORLAN_22."</u>:</td>
-	<td style='width:80%' class='forumheader3'>
-	<select name='parentforum' class='tbox'>";
-$c = 0;
-
-while ($parents[$c]) {
-	if ($parents_id[$c] == $forum_parent) {
-		$text .= "<option selected>{$parents[$c]}</option>\n";
-	} else {
-		$text .= "<option>{$parents[$c]}</option>\n";
-	}
-	$c++;
-}
-$text .= "</select>
-	</td>
-	</tr>
-	 
-	 
-	 
-	<tr>
-	<td style='width:20%' class='forumheader3'><u>".FORLAN_31."</u>:</td>
-	<td style='width:80%' class='forumheader3'>
-	<input class='tbox' type='text' name='forum_name' size='60' value='{$forum_name}' maxlength='100' />
-	</td>
-	</tr>
-	<tr>
-	 
-	<td style='width:20%' class='forumheader3'><u>".FORLAN_32."</u>: </td>
-	<td style='width:80%' class='forumheader3'>
-	<textarea class='tbox' name='forum_description' cols='50' rows='5'>{$forum_description}</textarea>
-	</td>
-	</tr>
-	 
-	<tr>
-	<td style='width:20%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
-	<td style='width:80%' class='forumheader3'>".r_userclass("forum_class", $forum_class, "on")."
-	</td></tr><tr>
-	 
-	<td style='width:20%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td>
-	<td style='width:80%' class='forumheader3'>";
-$admin_no = $sql->db_Select("user", "*", "user_admin='1' AND user_perms REGEXP('A.') OR user_perms='0' ");
-while ($row = $sql->db_Fetch()) {
-	extract($row);
-	$text .= "<input type='checkbox' name='mod[]' value='{$user_name}'";
-	if (strpos($forum_moderators, $user_name) !== FALSE) {
-		$text .= " checked";
-	}
-	$text .= " /> {$user_name}<br />";
-}
-
-$text .= "</td>
-	</tr>
-	<tr style='vertical-align:top'>
-	<td colspan='2'  style='text-align:center' class='forumheader'>";
-
-
-If(isset($_POST['edit'])) {
-	$text .= "<input class='button' type='submit' name='update' value='".FORLAN_35."' />
-		<input type='hidden' name='forum_id' value='{$forum_id}' />";
-} else {
-	$text .= "<input class='button' type='submit' name='submit' value='".FORLAN_36."' />";
-}
-
-$text .= "</td>
-	</tr>
-	</table>
-	</form>
-	</div>";
-$ns->tablerender("Forums", $text);
-
-
-$text = "<div style='text-align:center'>
-	<table style='width:95%' class='fborder'>
-	<form method='post' action='".e_SELF."'>
-	<tr>
-	<td colspan='2' style='width:70%; text-align:center' class='fcaption'>".FORLAN_28."</td>
-	<td style='width:30%; text-align:center' class='fcaption'>".FORLAN_37."</td>
-	</tr>";
-
-if (!$parent_amount = $sql->db_Select("forum", "*", "forum_parent='0' ORDER BY forum_order ASC")) {
-	$text .= "<tr><td class='forumheader3' style='text-align:center' colspan='3'>".FORLAN_29."</td></tr>";
-} else {
-	$sql2 = new db;
-	$sql3 = new db;
-	while ($row = $sql->db_Fetch()) {
-		extract($row);
-		if ($forum_class == 255) {
-			$text .= "<tr><td colspan='2' class='forumheader'>{$forum_name} (".FORLAN_38.")</td>";
-		}
-		else if($forum_class == 254) {
-			$text .= "<tr><td colspan='2' class='forumheader'>{$forum_name} (".FORLAN_39.")</td>";
-		}
-		else if($forum_class) {
-			$text .= "<tr><td colspan='2' class='forumheader'>{$forum_name} (".FORLAN_40.")</td>";
-		} else {
-			$text .= "<tr><td colspan='2' class='forumheader'>{$forum_name}</td>";
-		}
-
-		$text .= "<td class='forumheader' style='text-align:center'>\n<select name='activate' class='tbox'>\n";
-
-		for($a = 1; $a <= $parent_amount; $a++) {
-			$text .= ($forum_order == $a ? "<option value='{$forum_id}.{$a}' selected>{$a}</option>\n" : "<option value='{$forum_id}.{$a}'>$a</option>\n");
-		}
-
-		$text .= "</select></td></tr>\n";
-
-		$forums = $sql2->db_Select("forum", "*", "forum_parent = '{$forum_id}' ORDER BY forum_order ASC");
-		if (!$forums) {
-			$text .= "<td colspan='4' style='text-align:center' class='forumheader3'>".FORLAN_29."</td>";
-		} else {
-			while ($row = $sql2->db_Fetch()) {
-				extract($row);
-
-				$text .= "<tr><td style='width:5%; text-align:center' class='forumheader2'><img src='".e_IMAGE."forum/new.png' alt='' /></td>\n<td style='width:55%' class='forumheader2'><a href='".e_BASE."forum_viewforum.php?".$forum_id."'>".$forum_name."</a><br /><span class='smallblacktext'>".$forum_description."</span></td>
-					<td colspan='2' class='forumheader3' style='text-align:center'>\n<select name='forum_order_[]' class='tbox'>\n";
-				for($a = 1; $a <= $forums; $a++) {
-					$text .= ($forum_order == $a ? "<option value='{$forum_id}.{$a}' selected>{$a}</option>\n" : "<option value='{$forum_id}.{$a}'>{$a}</option>\n");
-				}
-
-				$text .= "</select>\n</td>\n</tr>";
-			}
-		}
-	}
-}
-
-$text .= "<tr>
-	<td colspan='4' style='text-align:center' class='forumheader'>
-	<input class='button' type='submit' name='update_order' value='".FORLAN_72."' />
-	</td>
-	</tr>
-	 
-	</table></form></div>";
-$ns->tablerender(FORLAN_43, $text);
-
-
-$text = "<div style='text-align:center'>
-	<form method='post' action='".e_SELF."'>\n
-	<table style='width:85%' class='fborder'>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_44."<br />
-	<span class='smalltext'>".FORLAN_45."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>". ($pref['forum_enclose'] ? "<input type='checkbox' name='forum_enclose' value='1' checked />" : "<input type='checkbox' name='forum_enclose' value='1' />")."
-	</td>
-	</tr>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_65."<br />
-	<span class='smalltext'>".FORLAN_46."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>
-	<input class='tbox' type='text' name='forum_title' size='15' value='".$pref['forum_title']."' maxlength='20' />
-	</td>
-	</tr>
-	 
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_47."<br />
-	<span class='smalltext'>".FORLAN_48."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>". ($pref['email_notify'] ? "<input type='checkbox' name='email_notify' value='1' checked />" : "<input type='checkbox' name='email_notify' value='1' />")."
-	</td>
-	</tr>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_68."<br />
-	<span class='smalltext'>".FORLAN_69."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>". ($pref['html_post'] ? "<input type='checkbox' name='html_post' value='1' checked />" : "<input type='checkbox' name='html_post' value='1' />")."
-	</td>
-	</tr>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_49."<br />
-	<span class='smalltext'>".FORLAN_50."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>". ($pref['forum_poll'] ? "<input type='checkbox' name='forum_poll' value='1' checked />" : "<input type='checkbox' name='forum_poll' value='1' />")."
-	</tr>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_70."<br />
-	<span class='smalltext'>".FORLAN_71."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>". ($pref['forum_attach'] ? "<input type='checkbox' name='forum_attach' value='1' checked />" : "<input type='checkbox' name='forum_attach' value='1' />")."
-	</td>
-	</tr>
-	 
-	 
-	 
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_51."<br />
-	<span class='smalltext'>".FORLAN_52."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>". ($pref['forum_track'] ? "<input type='checkbox' name='forum_track' value='1' checked />" : "<input type='checkbox' name='forum_track' value='1' />")."
-	</tr>
-	 
-	 
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_53."<br />
-	<span class='smalltext'>".FORLAN_54."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>
-	<input class='tbox' type='text' name='forum_eprefix' size='15' value='".$pref['forum_eprefix']."' maxlength='20' />
-	</tr>
-	 
-	 
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_55."<br />
-	<span class='smalltext'>".FORLAN_56."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>
-	<input class='tbox' type='text' name='forum_popular' size='3' value='".$pref['forum_popular']."' maxlength='3' />
-	</tr>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_57."<br />
-	<span class='smalltext'>".FORLAN_58."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>
-	<input class='tbox' type='text' name='forum_postspage' size='3' value='".$pref['forum_postspage']."' maxlength='3' />
-	</tr>
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_63."<br />
-	<span class='smalltext'>".FORLAN_64."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>
-	<textarea class='tbox' name='forum_levels' cols='15' rows='5'>".$pref['forum_levels']."</textarea>
-	</td>
-	</tr>
-	 
-	 
-	<tr>
-	<td style='width:75%' class='forumheader3'>
-	".FORLAN_59."<br />
-	<span class='smalltext'>".FORLAN_60."</span>
-	</td>
-	<td style='width:25%' class='forumheader2' style='text-align:center'>
-	<span class='smalltext'>".FORLAN_109."</span> <input class='tbox' type='text' name='prune_days' size='3' value='' maxlength='3' />
-	<input class='button' type='submit' name='prune' value='".FORLAN_110."' />
-	</tr>
-	 
-	 
-	<tr style='vertical-align:top'>
-	<td colspan='2'  style='text-align:center' class='forumheader'>
-	<input class='button' type='submit' name='updateoptions' value='".FORLAN_61."' />
-	</td>
-	</tr>
-	 
-	</table>
-	</form>
-	</div>";
-$ns->tablerender(FORLAN_62, $text);
-
-require_once("footer.php");
-
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/forum_include.php 0.7.11.src/e107_handlers/forum_include.php
--- 0.7.7.src/e107_handlers/forum_include.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/forum_include.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,61 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_handlers/forum_include.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-	
-if (!defined('e107_INIT')) { exit; }
-
-require_once(e_HANDLER.'multilang/pictures.php');
-	
-/**
-* @return string path to and filename of forum icon image
-*
-* @param string $filename  filename of forum image
-* @param string $eMLANG_folder if specified, indicates its a multilanguage image being processed and
-*       gives the subfolder of the image path to the eMLANG_path() function,
-*       default = FALSE
-* @param string $eMLANG_pref  if specified, indicates that $filename may be overridden by the
-*       $pref with $eMLANG_pref as its key if that pref is TRUE, default = FALSE
-*
-* @desc checks for the existence of a forum icon image in the themes forum folder and if it is found
-*  returns the path and filename of that file, otherwise it returns the path and filename of the
-*  default forum icon image in e_IMAGES. The additional $eMLANG args if specfied switch the process
-*  to the sister multi-language function eMLANG_path().
-*
-* @access public
-*/
-function img_path($filename, $eMLANG_folder = FALSE, $eMLANG_pref = FALSE) {
-	global $pref;
-	if ($eMLANG_folder) {
-		if ($eMLANG_pref) {
-			$filename = $pref[$eMLANG_pref] ? $pref[$eMLANG_pref] :
-			 $filename;
-		}
-		$image = eMLANG_path($filename, $eMLANG_folder);
-	} else {
-		$image = file_exists(THEME.'forum/'.$filename) ? THEME.'forum/'.$filename : e_IMAGE.'forum/'.$filename;
-	}
-	return $image;
-}
-	
-if (file_exists(THEME.'forum/forum_icons_template.php')) {
-	require_once(THEME.'forum/forum_icons_template.php');
-} else {
-	require_once(e_BASE.$THEMES_DIRECTORY.'templates/forum_icons_template.php');
-}
-	
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/forum_mod.php 0.7.11.src/e107_handlers/forum_mod.php
--- 0.7.7.src/e107_handlers/forum_mod.php	2005-12-28 08:03:36.000000000 -0600
+++ 0.7.11.src/e107_handlers/forum_mod.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,101 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_handlers/forum_mod.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/28 14:03:36 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-function forum_thread_moderate($p) {
-	global $sql;
-	 
-	foreach($p as $key => $val) {
-		if (preg_match("#(.*?)_(\d+)_x#", $key, $matches)) {
-			$act = $matches[1];
-			$id = $matches[2];
-			 
-			switch($act) {
-				case 'lock' :
-				$sql->db_Update("forum_t", "thread_active='0' WHERE thread_id='".intval($id)."' ");
-				return FORLAN_CLOSE;
-				break;
-				 
-				case 'unlock' :
-				$sql->db_Update("forum_t", "thread_active='1' WHERE thread_id='".intval($id)."' ");
-				return FORLAN_OPEN;
-				break;
-				 
-				case 'stick' :
-				$sql->db_Update("forum_t", "thread_s='1' WHERE thread_id='".intval($id)."' ");
-				return FORLAN_STICK;
-				break;
-				 
-				case 'unstick' :
-				$sql->db_Update("forum_t", "thread_s='0' WHERE thread_id='".intval($id)."' ");
-				return FORLAN_UNSTICK;
-				break;
-				 
-				case 'delete' :
-				return forum_delete_thread($id);
-				break;
-				 
-			}
-		}
-	}
-}
-	
-function forum_delete_thread($thread_id) {
-	global $sql;
-	$sql->db_Select("forum_t", "*", "thread_id='".intval($thread_id)."' ");
-	$row = $sql->db_Fetch();
-	 extract($row);
-	if ($thread_parent) {
-		// is post a reply?
-		$sql->db_Delete("forum_t", "thread_id = '".intval($thread_id)."' ");
-		// delete reply only
-		$sql->db_Update("forum", "forum_replies=forum_replies-1 WHERE forum_id='{$thread_forum_id}'");
-		// dec reply count by 1
-		 
-		$sql->db_Select("forum_t", "*", "thread_id = ".intval($thread_id));
-		$row = $sql->db_Fetch();
-		 extract($row);
-		$replies = $sql->db_Count("forum_t", "(*)", "WHERE thread_parent='".$thread_parent."'");
-		$pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
-		 
-		$pages = 0;
-		if ($replies) {
-			$pages = ((ceil($replies / $pref['forum_postspage']) -1) * $pref['forum_postspage']);
-		}
-		 
-		$url = e_BASE."forum_viewtopic.php?".$forum_id.".".$thread_parent.($pages ? ".$pages" : "");
-		// set return url
-		return FORLAN_26;
-	} else {
-		// post is thread
-		$sql->db_Delete("poll", "poll_datestamp='".intval($thread_id)."'");
-		// delete poll if there is one
-		$count = $sql->db_Delete("forum_t", "thread_parent='".intval($thread_id)."'");
-		// delete replies and grab how many there were
-		$sql->db_Delete("forum_t", "thread_id='".intval($thread_id)."'");
-		// delete the post itself
-		$sql->db_Update("forum", "forum_threads=forum_threads-1, forum_replies = forum_replies - {$count} WHERE forum_id = '{$thread_forum_id}'");
-		// update thread/reply counts
-		$url = e_BASE."forum_viewforum.php?".$forum_id;
-		// set return url
-		return FORLAN_6.($count ? ", ".$count." ".FORLAN_7."." : ".");
-	}
-}
-	
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/input_class.php 0.7.11.src/e107_handlers/input_class.php
--- 0.7.7.src/e107_handlers/input_class.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/input_class.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,78 +0,0 @@
-<?php
-
-/**
-+-------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_handlers/input_class.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
-+-------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-/**
-* User input cleaning class
-*
-* @package e107
-* @version $Revision: 1.10 $
-* @author $Author: sweetas $
-*/
-class einput {
-
-	// new, better function.. docs soon :)
-	function escape($string, $gpc_data = true) {
-		// Stripslashes if needed
-		if ($gpc_data == true && get_magic_quotes_gpc()) {
-			$string = stripslashes($string);
-		}
-		// Replace new lines (quick / dirty fix to issues caused by real_escape)
-		$string = str_replace(array("\r", "\n"), array("--#R--", "--#N--"), $string);
-		// Escape data
-		$string = mysql_real_escape_string($string);
-		// Put back new lines
-		$string = str_replace(array("--#R--", "--#N--"), array("\r", "\n"), $string);
-		return $string;
-	}
-
-	/**
-	 * Escape SQL data to help prevent injections
-	 *
-	 * @param string $string [dirty input data]
-	 * @return string [escaped data]
-	 */
-	function sql_escape_string($string = "") {
-		// Replace new lines (quick / dirty fix to issues caused by real_escape)
-		$string = str_replace(array("\r", "\n"), array("--#R--", "--#N--"), $string);
-		// Escape data
-		$string = mysql_real_escape_string($string);
-		// Put back new lines
-		$string = str_replace(array("--#R--", "--#N--"), array("\r", "\n"), $string);
-		return $string;
-	}
-
-	/**
-	 * Strip slashes from string, for use before escaping data for sql queries - takes into account magic_quotes_gpc setting, i.e. only stips if it's on - or the second arg is true
-	 *
-	 * @param string $string [input string]
-	 * @param bool $ignore_magic_quotes_gpc [overide magic_quotes_gpc setting, i.e. always strip slashes
-	 * @return string
-	 */
-	function strip_input($string = "", $ignore_magic_quotes_gpc = false) {
-		if(get_magic_quotes_gpc() == true || $ignore_magic_quotes_gpc == true) {
-			$string = stripslashes($string);
-		}
-		return $string;
-	}
-}
-
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/language_class.php 0.7.11.src/e107_handlers/language_class.php
--- 0.7.7.src/e107_handlers/language_class.php	2006-09-11 20:53:11.000000000 -0500
+++ 0.7.11.src/e107_handlers/language_class.php	2007-03-30 20:01:46.000000000 -0500
@@ -4,19 +4,15 @@
 |     e107 website system - Language Class.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/language_class.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/09/12 01:53:11 $
+|     $Revision: 1.10 $
+|     $Date: 2007/03/31 01:01:46 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 class language{
 
-// Converts iso to language-name and visa-versa.
-
-	function convert($data){
-
-         $lang = array(
+	var $list = array(
             "aa" => "Afar",
 			"ab" => "Abkhazian",
 			"af" => "Afrikaans",
@@ -39,8 +35,7 @@
 			"cs" => "Czech",
 			"ch" => "Chamorro",
 			"ce" => "Chechen",
-			"cn" => "Chinese-Simp",
-
+			"cn" => "ChineseSimp",
 			"cv" => "Chuvash",
 			"kw" => "Cornish",
 			"co" => "Corsican",
@@ -162,7 +157,7 @@
 	        "ts" => "Tsonga",
 	        "tk" => "Turkmen",
 	        "tr" => "Turkish",
-			"tw" => "Chinese-Trad",
+			"tw" => "ChineseTrad",
 	        "ug" => "Uighur",
 	        "uk" => "Ukrainian",
 	        "ur" => "Urdu",
@@ -174,35 +169,19 @@
 	        "yi" => "Yiddish",
 	        "yo" => "Yoruba",
 	        "za" => "Zhuang",
-	        "zh" => "Chinese",
+           // "zh" => "Chinese",
 	        "zu" => "Zulu"
 		);
 
-		if(strlen($data) > 2)
-		{
-        	$tmp = array_flip($lang);
-			return $tmp[$data];
-		}
-		else
-		{
-			return $lang[$data];
-		}
-	}
-
-
-
-
-   // -------------------------------------------------------------------
-
-	function toNative($lang){
-
-		$name = array(
+		var $names = array(
 			"Arabic" 		=> "العربية",
+			"Bosnian"		=> "Bosanski",
 			"Bulgarian"		=> "Български",
 			"Croatian"		=> "Hrvatski",
+			"ChineseTrad"  	=> "繁体中文",
+			"ChineseSimp"  	=> "简体中文",
 			"Dutch"			=> "Nederlands",
 			"English"		=> "English",
-			"Farsi"			=> "فارسي",
 			"French"		=> "Français",
 			"German"		=> "Deutsch",
 			"Greek"			=> "Ελληνικά",
@@ -211,8 +190,10 @@
 			"Italian"		=> "Italiano",
 			"Japanese"		=> "日本語",
 			"Korean"		=> "한국어",
+			"Lithuanian"	=> "Lietuvių",
 			"Mongolian"		=> "монгол",
 			"Nepali"		=> "नेपाली",
+			"Persian"	   	=> "فارسي",
 		    "Portuguese"	=> "Português",
 			"Polish"		=> "Polski",
 			"Romanian"		=> "Romanesc",
@@ -223,12 +204,30 @@
 			"Slovakian"		=> "Slovensky",
 			"Slovak"		=> "Slovensky",
 			"Swedish"		=> "Svenska",
-			"Thai"			=> " าษาไทย",
+			"Thai"			=> "ภาษาไทย",
 			"Turkish"		=> "Türkçe"
 		);
 
-       return ($name[$lang]) ? $name[$lang] : $lang;
+// ---  Converts iso to language-name and visa-versa. ----------------
+
+	function convert($data){
 
+		if(strlen($data) > 2)
+		{
+        	$tmp = array_flip($this->list);
+			return $tmp[$data];
+		}
+		else
+		{
+			return $this->list[$data];
+		}
+	}
+
+// -------------------------------------------------------------------
+
+	function toNative($lang)
+	{
+		return ($this->names[$lang]) ? $this->names[$lang] : $lang;
 	}
 
 
@@ -236,7 +235,7 @@
 	{
 		global $pref;
 		$codelnk = ($language == $pref['sitelanguage']) ? "www" : $this->convert($language);
-        $urlval = str_replace($_SERVER['HTTP_HOST'],$codelnk.$pref['multilanguage_subdomain'],e_SELF);
+        $urlval = str_replace($_SERVER['HTTP_HOST'],$codelnk.".".e_DOMAIN,e_SELF);
         return $urlval;
 	}
 
@@ -245,4 +244,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/level_handler.php 0.7.11.src/e107_handlers/level_handler.php
--- 0.7.7.src/e107_handlers/level_handler.php	2006-04-28 20:27:03.000000000 -0500
+++ 0.7.11.src/e107_handlers/level_handler.php	2007-02-24 03:38:20.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/level_handler.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/04/29 01:27:03 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.15 $
+|     $Date: 2007/02/24 09:38:20 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 	
@@ -45,8 +45,8 @@
 			$data[0] = IMAGE_rank_admin_image."<br />";
 		}
 	}
-	$data[0] = "<span class='smalltext'>".LAN_195." #".$user_id."<br />";
-	$data['userid'] = "<span class='smalltext'>".LAN_195." #".$user_id."<br />";
+	$data[0] = "<span class='smalltext'>".LAN_195." #".$user_id."</span><br />";
+	$data['userid'] = "<span class='smalltext'>".LAN_195." #".$user_id."</span><br />";
  
 	$level_thresholds = ($pref['forum_thresholds'] ? explode(",", $pref['forum_thresholds']) : array(20, 100, 250, 410, 580, 760, 950, 1150, 1370, 1600));
  
diff -x .svn -ruN 0.7.7.src/e107_handlers/login.php 0.7.11.src/e107_handlers/login.php
--- 0.7.7.src/e107_handlers/login.php	2006-10-28 23:08:13.000000000 -0500
+++ 0.7.11.src/e107_handlers/login.php	2007-01-11 12:35:06.000000000 -0600
@@ -12,19 +12,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/login.php,v $
-|     $Revision: 1.37 $
-|     $Date: 2006/10/29 04:08:13 $
-|     $Author: e107coders $
+|     $Revision: 1.39 $
+|     $Date: 2007/01/11 18:35:06 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-if(is_readable(e_LANGUAGEDIR.e_LANGUAGE."/lan_login.php")){
-	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_login.php");
-}else{
-	@include_once(e_LANGUAGEDIR."English/lan_login.php");
-}
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_login.php");
 
 class userlogin {
 	function userlogin($username, $userpass, $autologin) {
@@ -37,7 +33,18 @@
 		# - scope                                        public
 		*/
 		global $pref, $e_event, $sql, $e107, $tp;
+
+		$username = trim($username);
+		$userpass = trim($userpass);
+		if($username == "" || $userpass == "")
+		{
+			define("LOGINMESSAGE", LAN_27."<br /><br />");
+			return FALSE;
+		}
+
+	 	if(!is_object($sql)){
 		$sql = new db;
+		}
 
 		$fip = $e107->getip();
 		if($sql -> db_Select("banlist", "*", "banlist_ip='{$fip}' ")) {
@@ -62,83 +69,77 @@
 				return FALSE;
 			}
 		}
-		if ($username != "" && $userpass != "") {
-			$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
-			$ouserpass = $userpass;
-			$userpass = md5($ouserpass);
-
-			$username = substr($username, 0, 30);
-
-			// This is only required for upgrades and only for those not using utf-8 to begin with..
-			if(isset($pref['utf-compatmode']) && (CHARSET == "utf-8" || CHARSET == "UTF-8")){
-				$username = utf8_decode($username);
-				$userpass = md5(utf8_decode($ouserpass));
-			}
+		$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
+		$username = substr($username, 0, 30);
+		$ouserpass = $userpass;
+		$userpass = md5($ouserpass);
+
+		// This is only required for upgrades and only for those not using utf-8 to begin with..
+		if(isset($pref['utf-compatmode']) && (CHARSET == "utf-8" || CHARSET == "UTF-8")){
+			$username = utf8_decode($username);
+			$userpass = md5(utf8_decode($ouserpass));
+		}
 
-			if (!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."'")) {
-				define("LOGINMESSAGE", LAN_300."<br /><br />");
-				$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".LAN_LOGIN_14." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username)."'");
+		if (!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."'")) {
+			define("LOGINMESSAGE", LAN_300."<br /><br />");
+			$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".LAN_LOGIN_14." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username)."'");
+			$this -> checkibr($fip);
+			return FALSE;
+		}
+		else if(!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."' AND user_password = '{$userpass}'")) {
+			define("LOGINMESSAGE", LAN_300."<br /><br />");
+			return FALSE;
+		}
+		else if(!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."' AND user_password = '{$userpass}' AND user_ban!=2 ")) {
+			define("LOGINMESSAGE", LAN_302."<br /><br />");
+               	$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".LAN_LOGIN_15." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username)."'");
 				$this -> checkibr($fip);
-				return FALSE;
-			}
-			else if(!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."' AND user_password = '{$userpass}'")) {
-				define("LOGINMESSAGE", LAN_300."<br /><br />");
-				return FALSE;
-			}
-			else if(!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."' AND user_password = '{$userpass}' AND user_ban!=2 ")) {
-				define("LOGINMESSAGE", LAN_302."<br /><br />");
-                	$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".LAN_LOGIN_15." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username)."'");
-					$this -> checkibr($fip);
+			return FALSE;
+		} else {
+			$ret = $e_event->trigger("preuserlogin", $username);
+			if ($ret!='') {
+				define("LOGINMESSAGE", $ret."<br /><br />");
 				return FALSE;
 			} else {
-				$ret = $e_event->trigger("preuserlogin", $username);
-				if ($ret!='') {
-					define("LOGINMESSAGE", $ret."<br /><br />");
-					return FALSE;
-				} else {
-					$lode = $sql -> db_Fetch();
-					$user_id = $lode['user_id'];
-					$user_name = $lode['user_name'];
-					$user_xup = $lode['user_xup'];
-
-					/* restrict more than one person logging in using same us/pw */
-					if($pref['disallowMultiLogin']) {
-						if($sql -> db_Select("online", "online_ip", "online_user_id='".$user_id.".".$user_name."'")) {
-							define("LOGINMESSAGE", LAN_304."<br /><br />");
-							$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '$fip', '$user_id', '".LAN_LOGIN_16." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
-							$this -> checkibr($fip);
-							return FALSE;
-						}
+				$lode = $sql -> db_Fetch();
+				$user_id = $lode['user_id'];
+				$user_name = $lode['user_name'];
+				$user_xup = $lode['user_xup'];
+
+				/* restrict more than one person logging in using same us/pw */
+				if($pref['disallowMultiLogin']) {
+					if($sql -> db_Select("online", "online_ip", "online_user_id='".$user_id.".".$user_name."'")) {
+						define("LOGINMESSAGE", LAN_304."<br /><br />");
+						$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '$fip', '$user_id', '".LAN_LOGIN_16." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
+						$this -> checkibr($fip);
+						return FALSE;
 					}
+				}
 
-					$cookieval = $user_id.".".md5($userpass);
-					if($user_xup) {
-						$this->update_xup($user_id, $user_xup);
-					}
+				$cookieval = $user_id.".".md5($userpass);
+				if($user_xup) {
+					$this->update_xup($user_id, $user_xup);
+				}
 
-					if ($pref['user_tracking'] == "session") {
-						$_SESSION[$pref['cookie_name']] = $cookieval;
-					} else {
-						if ($autologin == 1) {
-							cookie($pref['cookie_name'], $cookieval, (time() + 3600 * 24 * 30));
-						} else {
-							cookie($pref['cookie_name'], $cookieval);
-						}
-					}
-					$edata_li = array("user_id" => $user_id, "user_name" => $username);
-					$e_event->trigger("login", $edata_li);
-					$redir = (e_QUERY ? e_SELF."?".e_QUERY : e_SELF);
-					if (strstr($_SERVER['SERVER_SOFTWARE'], "Apache")) {
-						header("Location: ".$redir);
-						exit;
+				if ($pref['user_tracking'] == "session") {
+					$_SESSION[$pref['cookie_name']] = $cookieval;
+				} else {
+					if ($autologin == 1) {
+						cookie($pref['cookie_name'], $cookieval, (time() + 3600 * 24 * 30));
 					} else {
-						echo "<script type='text/javascript'>document.location.href='{$redir}'</script>\n";
+						cookie($pref['cookie_name'], $cookieval);
 					}
 				}
+				$edata_li = array("user_id" => $user_id, "user_name" => $username);
+				$e_event->trigger("login", $edata_li);
+				$redir = (e_QUERY ? e_SELF."?".e_QUERY : e_SELF);
+				if (strstr($_SERVER['SERVER_SOFTWARE'], "Apache")) {
+					header("Location: ".$redir);
+					exit;
+				} else {
+					echo "<script type='text/javascript'>document.location.href='{$redir}'</script>\n";
+				}
 			}
-		} else {
-			define("LOGINMESSAGE", LAN_27."<br /><br />");
-			return FALSE;
 		}
 	}
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/mail.php 0.7.11.src/e107_handlers/mail.php
--- 0.7.7.src/e107_handlers/mail.php	2006-11-09 03:28:58.000000000 -0600
+++ 0.7.11.src/e107_handlers/mail.php	2007-11-04 14:24:53.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/mail.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/11/09 09:28:58 $
-|     $Author: lisa_ $
+|     $Revision: 1.43 $
+|     $Date: 2007/11/04 20:24:53 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,11 +21,11 @@
 
 	if(is_readable(THEME."email_template.php"))
 	{
-    	require_once(THEME."email_template.php");
+    	require(THEME."email_template.php");
 	}
 	else
 	{
-    	require_once(e_THEME."templates/email_template.php");
+    	require(e_THEME."templates/email_template.php");
 	}
 
     if(isset($EMAIL_HEADER) && isset($EMAIL_FOOTER) && is_object($tp)){
@@ -36,23 +36,25 @@
 Please note that mailed attachments have been found to be corrupted using php 4.3.3
 php 4.3.6 does NOT have this problem.
 */
-// Comment out the line below if you have trouble with some people not receiving emails.
-// e107_ini_set(sendmail_path, "/usr/sbin/sendmail -t -f ".$pref['siteadminemail']);
 
-function sendemail($send_to, $subject, $message, $to_name, $send_from, $from_name, $attachments, $Cc, $Bcc, $returnpath, $returnreceipt,$inline ="") {
-	global $pref,$mailheader_e107id;
+// If $send_from is blank, uses the 'replyto' name and email if set, otherwise site admins details
+function sendemail($send_to, $subject, $message, $to_name, $send_from='', $from_name='', $attachments='', $Cc='', $Bcc='', $returnpath='', $returnreceipt='',$inline ="") 
+{
+	global $pref,$mailheader_e107id,$tp;
 
 	require_once(e_HANDLER."phpmailer/class.phpmailer.php");
 
 	$mail = new PHPMailer();
 
-    if($mailheader_e107id){
+    if($mailheader_e107id)
+	{
 		$mail->AddCustomHeader("X-e107-id: {$mailheader_e107id}");
     }
 
-	if ($pref['mailer']== 'smtp') {
-
-		if(isset($pref['smtp_pop3auth']) && $pref['smtp_pop3auth']){
+	if ($pref['mailer']== 'smtp') 
+	{
+		if(isset($pref['smtp_pop3auth']) && $pref['smtp_pop3auth'])
+		{
 			// http://www.corephp.co.uk/archives/18-POP-before-SMTP-Authentication-for-PHPMailer.html
 			require_once(e_HANDLER."phpmailer/class.pop3.php");
 			$pop = new POP3();
@@ -68,19 +70,27 @@
 			$mail->Password = $pref['smtp_password'];
 			$mail->PluginDir = e_HANDLER."phpmailer/";
 		}
-
-	} elseif ($pref['mailer']== 'sendmail'){
+	} 
+	elseif ($pref['mailer']== 'sendmail')
+	{
 		$mail->Mailer = "sendmail";
 		$mail->Sendmail = ($pref['sendmail']) ? $pref['sendmail'] : "/usr/sbin/sendmail -t -i -r ".$pref['siteadminemail'];
-	} else {
+	} 
+	else 
+	{
         $mail->Mailer = "mail";
 	}
 
 	$to_name = ($to_name) ? $to_name: $send_to;
 
+	if (!trim($send_from))
+	{
+	  $from_name = $tp->toEmail(varsettrue($pref['replyto_name'],$pref['siteadmin']),"","RAWTEXT");
+	  $send_from = $tp->toEmail(varsettrue($pref['replyto_email'],$pref['siteadminemail']),"","RAWTEXT");
+	}
 	$mail->CharSet = CHARSET;
-	$mail->From = ($send_from)? $send_from: $pref['siteadminemail'];
-	$mail->FromName = ($from_name)? $from_name:	$pref['siteadmin'];
+	$mail->From = $send_from;
+	$mail->FromName = $from_name;
 	$mail->Subject = $subject;
 	$mail->SetLanguage("en",e_HANDLER."phpmailer/language/");
 
@@ -96,7 +106,8 @@
 		$Html = preg_replace('%(http|ftp|https)(://\S+)%', '<a href="\1\2">\1\2</a>', $Html);
 		$Html = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', '\\1<a href="http://\\2">\\2</a>', $Html);
 		$Html = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i', '<a href="mailto:\\1">\\1</a>', $Html);
-		$Html = str_replace("\n", "<br>\n", $Html);
+	    $Html = str_replace("\r","\n",$Html);		// Handle alternative newline characters
+		$Html = str_replace("\n", "<br />\n", $Html);
 	}
 	if (strpos($message,"</style>") !== FALSE){
     	$text = strstr($message,"</style>");
@@ -163,7 +174,11 @@
 		}
 	}
 
-	if($pref['mail_bounce_email'] !=''){
+	if (isset($returnpath) && ($returnpath != ""))
+	{  // Passed parameter overrides any system default
+	$mail->Sender = $returnpath;
+	}
+	elseif($pref['mail_bounce_email'] !=''){
 		$mail->Sender = $pref['mail_bounce_email'];
     }
 
@@ -191,4 +206,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/message_handler.php 0.7.11.src/e107_handlers/message_handler.php
--- 0.7.7.src/e107_handlers/message_handler.php	2006-10-25 11:57:47.000000000 -0500
+++ 0.7.11.src/e107_handlers/message_handler.php	2007-01-01 04:02:28.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/message_handler.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/10/25 16:57:47 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2007/01/01 10:02:28 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,7 +24,6 @@
 	if(is_numeric($message))
 	{
     	include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_error.php");
-	}
 	$emessage[1] = "<b>".LAN_ERROR_25."</b>";
 	$emessage[2] = "<b>".LAN_ERROR_26."</b>";
 	$emessage[3] = "<b>".LAN_ERROR_27."</b>";
@@ -44,6 +43,7 @@
 		".chr(36)."HELP_DIRECTORY = \"e107_docs/help/\";  <br />
 		".chr(36)."DOWNLOADS_DIRECTORY =  \"e107_files/downloads/\";\n
 		</div>";
+	}
 
 	if (class_exists('e107table')) {
 		$ns = new e107table;
diff -x .svn -ruN 0.7.7.src/e107_handlers/mysql_class.php 0.7.11.src/e107_handlers/mysql_class.php
--- 0.7.7.src/e107_handlers/mysql_class.php	2006-10-21 06:07:06.000000000 -0500
+++ 0.7.11.src/e107_handlers/mysql_class.php	2007-10-15 05:29:13.000000000 -0500
@@ -12,9 +12,10 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/mysql_class.php,v $
-|     $Revision: 1.60 $
-|     $Date: 2006/10/21 11:07:06 $
-|     $Author: mrpete $
+|     $Revision: 1.83 $
+|     $Date: 2007/10/15 10:29:13 $
+|     $Author: e107coders $
+|
 +----------------------------------------------------------------------------+
 */
 
@@ -23,12 +24,14 @@
 $db_time = 0.0;				// Global total time spent in all db object queries
 $db_mySQLQueryCount = 0;	// Global total number of db object queries (all db's)
 
+$db_ConnectionID = NULL;
+
 /**
 * MySQL Abstraction class
 *
 * @package e107
-* @version $Revision: 1.60 $
-* @author $Author: mrpete $
+* @version $Revision: 1.83 $
+* @author $Author: e107coders $
 */
 class db {
 
@@ -81,8 +84,9 @@
 	*
 	* @access public
 	*/
-	function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb) {
-		global $eTraffic;
+	function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb) 
+	{
+		global $eTraffic, $db_ConnectionID;
 		$eTraffic->BumpWho('db Connect', 1);
 
 		$this->mySQLserver = $mySQLserver;
@@ -96,25 +100,28 @@
 			if (!$this->mySQLaccess = @mysql_pconnect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword)) {
 				return 'e1';
 			} else {
-				if (!@mysql_select_db($this->mySQLdefaultdb)) {
+				if (!@mysql_select_db($this->mySQLdefaultdb,$this->mySQLaccess)) {
 					return 'e2';
 				} else {
 					$this->dbError('dbConnect/SelectDB');
 				}
 			}
 		} else {
+			
 			if (!$this->mySQLaccess = @mysql_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword)) {
 				return 'e1';
 			} else {
-				if (!@mysql_select_db($this->mySQLdefaultdb)) {
+				if (!@mysql_select_db($this->mySQLdefaultdb,$this->mySQLaccess)) {
 					return 'e2';
 				} else {
 					$this->dbError('dbConnect/SelectDB');
 				}
 			}
 		}
+	  if ($db_ConnectionID == NULL) $db_ConnectionID = $this->mySQLaccess;		// Save the connection resource
 	}
 
+
 	/**
 	* @return void
 	* @param unknown $sMarker
@@ -145,10 +152,10 @@
 	function db_Write_log($log_type = '', $log_remark = '', $log_query = '') {
 		global $tp, $e107;
 		$d = time();
-		$uid = (USER === FALSE) ? USERID : '0';
+		$uid = (USER) ? USERID : '0';
 		$ip = $e107->getip();
 		$qry = $tp->toDB($log_query);
-		$this->db_Insert('dblog', "0, '{$log_type}', {$d}, {$uid}, '{$ip}', '{$qry}', '{$log_remark}'", 2);
+		$this->db_Insert('dblog', "0, '{$log_type}', {$d}, {$uid}, '{$ip}', '{$qry}', '{$log_remark}'");
 	}
 
 	/**
@@ -157,6 +164,7 @@
 	* @param unknown $rli
 	* @desc Enter description here...
 	* @access private
+	* This is the 'core' routine which handles much of the interface between other functions and the DB
 	*/
 	function db_Query($query, $rli = NULL, $qry_from = '', $debug = FALSE, $log_type = '', $log_remark = '') {
 		global $db_time,$db_mySQLQueryCount,$queryinfo, $eTraffic;
@@ -173,8 +181,14 @@
 			$this->db_Write_log($log_type, $log_remark, $query);
 		}
 
+    	if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
 		$b = microtime();
-		$sQryRes = is_null($rli) ? @mysql_query($query) : @mysql_query($query, $rli);
+	 	$sQryRes = is_null($rli) ? @mysql_query($query,$this->mySQLaccess) : @mysql_query($query, $rli);
 		$e = microtime();
 
 		$eTraffic->Bump('db_Query', $b, $e);
@@ -191,7 +205,8 @@
 				$this->mySQLcurTable = ''; // clear before next query
 			}
 			if(is_object($db_debug)) {
-				$nFields = $db_debug->Mark_Query($query, $rli, $sQryRes, $aTrace, $mytime, $pTable);
+				$buglink = is_null($rli) ? $this->mySQLaccess : $rli;
+			   	$nFields = $db_debug->Mark_Query($query, $buglink, $sQryRes, $aTrace, $mytime, $pTable);
 			} else {
 				echo "what happened to db_debug??!!<br />";
 			}
@@ -232,7 +247,7 @@
 				$this->dbError('dbQuery');
 				return $this->db_Rows();
 			} else {
-				$this->dbError("db_Select (SELECT $fields FROM ".MPREFIX."{$table} WHERE {$arg})");
+			 	$this->dbError("db_Select (SELECT $fields FROM ".MPREFIX."{$table} WHERE {$arg})");
 				return FALSE;
 			}
 		} elseif ($arg != '' && $mode != 'default') {
@@ -240,15 +255,15 @@
 				$this->dbError('dbQuery');
 				return $this->db_Rows();
 			} else {
-				$this->dbError("db_Select (SELECT {$fields} FROM ".MPREFIX."{$table} {$arg})");
+			  	$this->dbError("db_Select (SELECT {$fields} FROM ".MPREFIX."{$table} {$arg})");
 				return FALSE;
 			}
 		} else {
 			if ($this->mySQLresult = $this->db_Query('SELECT '.$fields.' FROM '.MPREFIX.$table, NULL, 'db_Select', $debug, $log_type, $log_remark)) {
-				$this->dbError('dbQuery');
+			 	$this->dbError('dbQuery');
 				return $this->db_Rows();
 			} else {
-				$this->dbError("db_Select (SELECT {$fields} FROM ".MPREFIX."{$table})");
+			 	$this->dbError("db_Select (SELECT {$fields} FROM ".MPREFIX."{$table})");
 				return FALSE;
 			}
 		}
@@ -271,11 +286,8 @@
 		$this->mySQLcurTable = $table;
 		if(is_array($arg))
 		{
-			foreach($arg as $k => $v)
-			{
-				$keyList .= ($keyList ? ",`{$k}`" : "`{$k}`");
-				$valList .= ($valList ? ",'{$v}'" : "'{$v}'");
-			}
+			$keyList= "`".implode("`,`", array_keys($arg))."`";
+			$valList= "'".implode("','", $arg)."'";
 			$query = "INSERT INTO `".MPREFIX."{$table}` ({$keyList}) VALUES ({$valList})";
 		}
 		else
@@ -283,9 +295,16 @@
 			$query = 'INSERT INTO '.MPREFIX."{$table} VALUES ({$arg})";
 		}
 
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
+
 		if ($result = $this->mySQLresult = $this->db_Query($query, NULL, 'db_Insert', $debug, $log_type, $log_remark )) {
-			$tmp = mysql_insert_id();
-			return $tmp;
+			$tmp = mysql_insert_id($this->mySQLaccess);
+			return ($tmp) ? $tmp : TRUE; // return true even if table doesn't have auto-increment.
 		} else {
 			$this->dbError("db_Insert ($query)");
 			return FALSE;
@@ -313,8 +332,16 @@
 	function db_Update($table, $arg, $debug = FALSE, $log_type = '', $log_remark = '') {
 		$table = $this->db_IsLang($table);
 		$this->mySQLcurTable = $table;
+
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
 		if ($result = $this->mySQLresult = $this->db_Query('UPDATE '.MPREFIX.$table.' SET '.$arg, NULL, 'db_Update', $debug, $log_type, $log_remark)) {
-			$result = mysql_affected_rows();
+			$result = mysql_affected_rows($this->mySQLaccess);
+			if ($result == -1) return FALSE;	// Error return from mysql_affected_rows
 			return $result;
 		} else {
 			$this->dbError("db_Update ($query)");
@@ -334,10 +361,13 @@
 	*
 	* @access public
 	*/
-	function db_Fetch() {
+	function db_Fetch($type = MYSQL_BOTH) {
 		global $eTraffic;
+		if (!(is_int($type))) {
+			$type=MYSQL_BOTH;
+		}
 		$b = microtime();
-		$row = @mysql_fetch_array($this->mySQLresult);
+		$row = @mysql_fetch_array($this->mySQLresult,$type);
 		$eTraffic->Bump('db_Fetch', $b);
 		if ($row) {
 			$this->dbError('db_Fetch');
@@ -345,7 +375,6 @@
 		} else {
 			$this->dbError('db_Fetch');
 			return FALSE;
-
 		}
 	}
 
@@ -400,8 +429,13 @@
 	*/
 	function db_Close() {
 		global $eTraffic;
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
 		$eTraffic->BumpWho('db Close', 1);
-		mysql_close();
+		$this->mySQLaccess = NULL; // correct way to do it when using shared links.
 		$this->dbError('dbClose');
 	}
 
@@ -419,6 +453,14 @@
 	function db_Delete($table, $arg = '', $debug = FALSE, $log_type = '', $log_remark = '') {
 		$table = $this->db_IsLang($table);
 		$this->mySQLcurTable = $table;
+
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
+
 		if (!$arg) {
 			if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.MPREFIX.$table, NULL, 'db_Delete', $debug, $log_type, $log_remark)) {
 				return $result;
@@ -428,7 +470,7 @@
 			}
 		} else {
 			if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.MPREFIX.$table.' WHERE '.$arg, NULL, 'db_Delete', $debug, $log_type, $log_remark)) {
-				$tmp = mysql_affected_rows();
+				$tmp = mysql_affected_rows($this->mySQLaccess);
 				return $tmp;
 			} else {
 				$this->dbError('db_Delete ('.$arg.')');
@@ -444,8 +486,8 @@
 	*/
 	function db_Rows() {
 		$rows = $this->mySQLrows = @mysql_num_rows($this->mySQLresult);
-		return $rows;
 		$this->dbError('db_Rows');
+		return $rows;
 	}
 
 	/**
@@ -480,36 +522,54 @@
 	* @desc Enter description here...
 	* @access private
 	*/
-	function db_Select_gen($query, $debug = FALSE, $log_type = '', $log_remark = '') {
-
+	function db_Select_gen($query, $debug = FALSE, $log_type = '', $log_remark = '')
+	{
 		/*
 		changes by jalist 19/01/05:
 		added string replace on table prefix to tidy up long database queries
 		usage: instead of sending "SELECT * FROM ".MPREFIX."table", do "SELECT * FROM #table"
+		Returns result compatible with mysql_query - may be TRUE for some results, resource ID for others
 		*/
 
 		$this->tabset = FALSE;
-		if(strpos($query,'#') !== FALSE) {
+		if(strpos($query,'`#') !== FALSE)
+		{
+			$query = preg_replace_callback("/\s`#([\w]*?)`\W/", array($this, 'ml_check'), $query);
+		}
+		elseif(strpos($query,'#') !== FALSE)
+	  {
 			$query = preg_replace_callback("/\s#([\w]*?)\W/", array($this, 'ml_check'), $query);
+	  }
+
+		if (($this->mySQLresult = $this->db_Query($query, NULL, 'db_Select_gen', $debug, $log_type, $log_remark)) === TRUE)
+		{	// Successful query which doesn't return a row count
+		  $this->dbError('db_Select_gen');
+		  return TRUE;
+		}
+		elseif ($this->mySQLresult === FALSE)
+		{	// Failed query
+		  $this->dbError('dbQuery ('.$query.')');
+		  return FALSE;
 		}
-		if ($this->mySQLresult = $this->db_Query($query, NULL, 'db_Select_gen', $debug, $log_type, $log_remark)) {
-			$this->dbError('db_Select_gen');
-			return $this->db_Rows();
-		} else {
-			$this->dbError('dbQuery ('.$query.')');
-			return FALSE;
+		else
+		{	// Successful query which does return a row count - get the count and return it
+		  $this->dbError('db_Select_gen');
+		  return $this->db_Rows();
 		}
 	}
 
-	function ml_check($matches) {
+	function ml_check($matches)
+	{
 		$table = $this->db_IsLang($matches[1]);
-		if($this->tabset == false) {
+		if($this->tabset == false)
+		{
 			$this->mySQLcurTable = $table;
 			$this->tabset = true;
 		}
-		return " ".MPREFIX.$table.substr($matches[0],-1);
+		return ' `'.MPREFIX.$table.'`'.substr($matches[0],-1);
 	}
 
+
 	/**
 	* @return unknown
 	* @param unknown $offset
@@ -553,8 +613,14 @@
 		  	return $table;
 		}
 
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
 		if (!$mySQLtablelist) {
-			$tablist = mysql_list_tables($this->mySQLdefaultdb);
+			$tablist = mysql_list_tables($this->mySQLdefaultdb,$this->mySQLaccess);
 			while (list($temp) = mysql_fetch_array($tablist)) {
 				$mySQLtablelist[] = $temp;
 			}
@@ -686,7 +752,13 @@
         $convert = array("PRIMARY"=>"PRI","INDEX"=>"MUL","UNIQUE"=>"UNI");
         $key = ($convert[$key]) ? $convert[$key] : "OFF";
 
-        $result = mysql_query("SHOW COLUMNS FROM ".MPREFIX.$table);
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
+        $result = mysql_query("SHOW COLUMNS FROM ".MPREFIX.$table,$this->mySQLaccess);
         if (mysql_num_rows($result) > 0) {
             $c=0;
    			while ($row = mysql_fetch_assoc($result)) {
@@ -699,7 +771,7 @@
 				}
                 else
 				{
-					if(($key == "") && ($fieldid == $row['Field']))
+					if(($key == "OFF") && ($fieldid == $row['Field']))
 					{
                     	return TRUE;  // key not in use, but field matches.
 					}
@@ -723,11 +795,20 @@
 	 * @param string $data
 	 * @return string
 	 */
-	function escape($data, $strip = true) {
-		if ($strip) {
+	function escape($data, $strip = true)
+	{
+		if ($strip)
+		{
 			$data = strip_if_magic($data);
 		}
-		return mysql_real_escape_string($data);
+
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+        	$this->mySQLaccess = $db_ConnectionID;
+		}
+
+		return mysql_real_escape_string($data,$this->mySQLaccess);
 	}
 }
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/news_class.php 0.7.11.src/e107_handlers/news_class.php
--- 0.7.7.src/e107_handlers/news_class.php	2006-11-22 15:16:14.000000000 -0600
+++ 0.7.11.src/e107_handlers/news_class.php	2007-12-20 14:47:55.000000000 -0600
@@ -12,9 +12,9 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/news_class.php,v $
-| $Revision: 1.75 $
-| $Date: 2006/11/22 21:16:14 $
-| $Author: e107coders $
+| $Revision: 1.77 $
+| $Date: 2007/12/20 20:47:55 $
+| $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
@@ -46,7 +46,7 @@
 				$message = "<strong>".(!mysql_errno() ? LAN_NEWS_46 : LAN_NEWS_5)."</strong>";
 			}
 		} else {
-			if ($sql ->db_Insert('news', "0, '".$news['news_title']."', '".$news['news_body']."', '".$news['news_extended']."', ".intval($news['news_datestamp']).", ".intval($news['news_author']).", '".intval($news['cat_id'])."', '".intval($news['news_allow_comments'])."', '".intval($news['news_start'])."', '".intval($news['news_end'])."', '".$tp->toDB($news['news_class'])."', '".intval($news['news_rendertype'])."', '0' , '".$news['news_summary']."', '".$tp->toDB($news['news_thumbnail'])."', '".intval($news['news_sticky'])."' ")) {
+			if ($news['news_id'] = $sql ->db_Insert('news', "0, '".$news['news_title']."', '".$news['news_body']."', '".$news['news_extended']."', ".intval($news['news_datestamp']).", ".intval($news['news_author']).", '".intval($news['cat_id'])."', '".intval($news['news_allow_comments'])."', '".intval($news['news_start'])."', '".intval($news['news_end'])."', '".$tp->toDB($news['news_class'])."', '".intval($news['news_rendertype'])."', '0' , '".$news['news_summary']."', '".$tp->toDB($news['news_thumbnail'])."', '".intval($news['news_sticky'])."' ")) {
 				$e_event -> trigger('newspost', $news);
 				$message = LAN_NEWS_6;
 				$e107cache -> clear('news.php');
@@ -129,20 +129,8 @@
 			$news['comment_total'] = 0;
 		}
 
-		if (!$param) {
-			if (!defined("IMAGE_nonew_small")){
-				define("IMAGE_nonew_small", (file_exists(THEME."images/nonew_comments.png") ? "<img src='".THEME_ABS."images/nonew_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/nonew_comments.png' alt=''  />"));
-			}
-			if (!defined("IMAGE_new_small"))	{
-				define("IMAGE_new_small", (file_exists(THEME."images/new_comments.png") ? "<img src='".THEME_ABS."images/new_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/new_comments.png' alt=''  /> "));
-			}
-			if (!defined("IMAGE_sticky")){
-				define("IMAGE_sticky", (file_exists(THEME."images/sticky.png") ? "<img src='".THEME_ABS."images/sticky.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/sticky.png' alt='' style='width: 14px; height: 14px; vertical-align: bottom' /> "));
-			}
-
-			$param['image_nonew_small'] = IMAGE_nonew_small;
-			$param['image_new_small'] = IMAGE_new_small;
-			$param['image_sticky'] = IMAGE_sticky;
+		if (!$param) 
+		{
 			$param['caticon'] = ICONSTYLE;
 			$param['commentoffstring'] = COMMENTOFFSTRING;
 			$param['commentlink'] = COMMENTLINK;
@@ -155,6 +143,34 @@
 			$param['caticon'] =  (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
 		}
 
+// Next three images aren't always defined by the caller, even if most of $param is.
+		if (!isset($param['image_nonew_small']))
+		{
+		  if (!defined("IMAGE_nonew_small"))
+		  {
+			define("IMAGE_nonew_small", (file_exists(THEME."images/nonew_comments.png") ? "<img src='".THEME_ABS."images/nonew_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/nonew_comments.png' alt=''  />"));
+		  }
+		  $param['image_nonew_small'] = IMAGE_nonew_small;
+		}
+		
+		if (!isset($param['image_new_small']))
+		{
+		  if (!defined("IMAGE_new_small"))	
+		  {
+			define("IMAGE_new_small", (file_exists(THEME."images/new_comments.png") ? "<img src='".THEME_ABS."images/new_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/new_comments.png' alt=''  /> "));
+		  }
+		  $param['image_new_small'] = IMAGE_new_small;
+		}
+
+		if (!isset($param['image_sticky']))
+		{
+		  if (!defined("IMAGE_sticky"))
+		  {
+			define("IMAGE_sticky", (file_exists(THEME."images/sticky.png") ? "<img src='".THEME_ABS."images/sticky.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/sticky.png' alt='' style='width: 14px; height: 14px; vertical-align: bottom' /> "));
+		  }
+		  $param['image_sticky'] = IMAGE_sticky;
+		}
+
 		cachevars('current_news_item', $news);
 		cachevars('current_news_param', $param);
 
@@ -200,4 +216,4 @@
 	}
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/notify_class.php 0.7.11.src/e107_handlers/notify_class.php
--- 0.7.7.src/e107_handlers/notify_class.php	2006-11-17 14:23:13.000000000 -0600
+++ 0.7.11.src/e107_handlers/notify_class.php	2007-03-22 16:26:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/notify_class.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/11/17 20:23:13 $
-|     $Author: lisa_ $
+|     $Revision: 1.15 $
+|     $Date: 2007/03/22 21:26:27 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -92,7 +92,7 @@
 	global $nt, $e107;
 	$msgtext = NT_LAN_UV_2.$data['user_id']."\n";
 	$msgtext .= NT_LAN_UV_3.$data['user_loginname']."\n";
-	$msgtext .= NT_LAN_UV_2.$e107->getip();
+	$msgtext .= NT_LAN_UV_4.$e107->getip();
 	$nt -> send('userveri', NT_LAN_UV_1, $msgtext);
 }
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/php_compatibility_handler.php 0.7.11.src/e107_handlers/php_compatibility_handler.php
--- 0.7.7.src/e107_handlers/php_compatibility_handler.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/php_compatibility_handler.php	2007-11-15 19:27:53.000000000 -0600
@@ -12,25 +12,30 @@
 	* @param mixed $data
 	* @desc Write a string to a file
 	*/
-	function file_put_contents($filename, $data) {
-		if (($h = @fopen($filename, 'w+')) === false) {
-			return false;
-		}
-		if (($bytes = @fwrite($h, $data)) === false) {
-			return false;
-		}
-		fclose($h);
-		return $bytes;
+	define('FILE_APPEND', 1);
+	function file_put_contents($filename, $data, $flag = false) 
+	{
+      $mode = ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') ? 'a' : 'w';
+	  if (($h = @fopen($filename, $mode)) === false) 
+	  {
+		return false;
+	  }
+      if (is_array($data)) $data = implode($data);
+	  if (($bytes = @fwrite($h, $data)) === false) 
+	  {
+		return false;
+	  }
+	  fclose($h);
+	  return $bytes;
 	}
 }
 
+
+
 if (!function_exists('stripos')) {
-	function stripos($haystack, $needle) {
-		$parts = explode(strtolower($needle), strtolower($haystack), 2);
-		if (count($parts) == 1) {
-			return false;
-		}
-		return strlen($parts[0]);
+ 	function stripos($str,$needle,$offset=0)
+	{
+		return strpos(strtolower($str), strtolower($needle), $offset);
 	}
 }
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/phpmailer/class.phpmailer.php 0.7.11.src/e107_handlers/phpmailer/class.phpmailer.php
--- 0.7.7.src/e107_handlers/phpmailer/class.phpmailer.php	2006-11-09 03:28:58.000000000 -0600
+++ 0.7.11.src/e107_handlers/phpmailer/class.phpmailer.php	2007-12-07 13:59:16.000000000 -0600
@@ -1,1499 +1,1718 @@
 <?php
-////////////////////////////////////////////////////
-// PHPMailer - PHP email class
-//
-// Class for sending email using either
-// sendmail, PHP mail(), or SMTP.  Methods are
-// based upon the standard AspEmail(tm) classes.
-//
-// Copyright (C) 2001 - 2003  Brent R. Matzelle
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
+/*~ class.phpmailer.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.0 rc3                                                      |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
 
 /**
  * PHPMailer - PHP email transport class
  * @package PHPMailer
- * @author Brent R. Matzelle
- * @copyright 2001 - 2003 Brent R. Matzelle
+ * @author Andy Prevost
+ * @copyright 2004 - 2007 Andy Prevost
  */
-class PHPMailer
-{
-    /////////////////////////////////////////////////
-    // PUBLIC VARIABLES
-    /////////////////////////////////////////////////
-
-    /**
-     * Email priority (1 = High, 3 = Normal, 5 = low).
-     * @var int
-     */
-    var $Priority          = 3;
-
-    /**
-     * Sets the CharSet of the message.
-     * @var string
-     */
-    var $CharSet           = "iso-8859-1";
-
-    /**
-     * Sets the Content-type of the message.
-     * @var string
-     */
-    var $ContentType        = "text/plain";
-
-    /**
-     * Sets the Encoding of the message. Options for this are "8bit",
-     * "7bit", "binary", "base64", and "quoted-printable".
-     * @var string
-     */
-    var $Encoding          = "8bit";
-
-    /**
-     * Holds the most recent mailer error message.
-     * @var string
-     */
-    var $ErrorInfo         = "";
-
-    /**
-     * Sets the From email address for the message.
-     * @var string
-     */
-    var $From               = "root@localhost";
-
-    /**
-     * Sets the From name of the message.
-     * @var string
-     */
-    var $FromName           = "Root User";
-
-    /**
-     * Sets the Sender email (Return-Path) of the message.  If not empty,
-     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
-     * @var string
-     */
-    var $Sender            = "";
-
-    /**
-     * Sets the Subject of the message.
-     * @var string
-     */
-    var $Subject           = "";
-
-    /**
-     * Sets the Body of the message.  This can be either an HTML or text body.
-     * If HTML then run IsHTML(true).
-     * @var string
-     */
-    var $Body               = "";
-
-    /**
-     * Sets the text-only body of the message.  This automatically sets the
-     * email to multipart/alternative.  This body can be read by mail
-     * clients that do not have HTML email capability such as mutt. Clients
-     * that can read HTML will view the normal Body.
-     * @var string
-     */
-    var $AltBody           = "";
-
-    /**
-     * Sets word wrapping on the body of the message to a given number of 
-     * characters.
-     * @var int
-     */
-    var $WordWrap          = 0;
-
-    /**
-     * Method to send mail: ("mail", "sendmail", or "smtp").
-     * @var string
-     */
-    var $Mailer            = "mail";
-
-    /**
-     * Sets the path of the sendmail program.
-     * @var string
-     */
-    var $Sendmail          = "/usr/sbin/sendmail";
-    
-    /**
-     * Path to PHPMailer plugins.  This is now only useful if the SMTP class 
-     * is in a different directory than the PHP include path.  
-     * @var string
-     */
-    var $PluginDir         = "";
-
-    /**
-     *  Holds PHPMailer version.
-     *  @var string
-     */
-    var $Version           = "1.73";
-
-    /**
-     * Sets the email address that a reading confirmation will be sent.
-     * @var string
-     */
-    var $ConfirmReadingTo  = "";
-
-    /**
-     *  Sets the hostname to use in Message-Id and Received headers
-     *  and as default HELO string. If empty, the value returned
-     *  by SERVER_NAME is used or 'localhost.localdomain'.
-     *  @var string
-     */
-    var $Hostname          = "";
-
-    /////////////////////////////////////////////////
-    // SMTP VARIABLES
-    /////////////////////////////////////////////////
-
-    /**
-     *  Sets the SMTP hosts.  All hosts must be separated by a
-     *  semicolon.  You can also specify a different port
-     *  for each host by using this format: [hostname:port]
-     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
-     *  Hosts will be tried in order.
-     *  @var string
-     */
-    var $Host        = "localhost";
-
-    /**
-     *  Sets the default SMTP server port.
-     *  @var int
-     */
-    var $Port        = 25;
-
-    /**
-     *  Sets the SMTP HELO of the message (Default is $Hostname).
-     *  @var string
-     */
-    var $Helo        = "";
-
-    /**
-     *  Sets SMTP authentication. Utilizes the Username and Password variables.
-     *  @var bool
-     */
-    var $SMTPAuth     = false;
-
-    /**
-     *  Sets SMTP username.
-     *  @var string
-     */
-    var $Username     = "";
-
-    /**
-     *  Sets SMTP password.
-     *  @var string
-     */
-    var $Password     = "";
-
-    /**
-     *  Sets the SMTP server timeout in seconds. This function will not 
-     *  work with the win32 version.
-     *  @var int
-     */
-    var $Timeout      = 10;
-
-    /**
-     *  Sets SMTP class debugging on or off.
-     *  @var bool
-     */
-    var $SMTPDebug    = false;
-
-    /**
-     * Prevents the SMTP connection from being closed after each mail 
-     * sending.  If this is set to true then to close the connection 
-     * requires an explicit call to SmtpClose(). 
-     * @var bool
-     */
-    var $SMTPKeepAlive = false;
-
-    /**#@+
-     * @access private
-     */
-    var $smtp            = NULL;
-    var $to              = array();
-    var $cc              = array();
-    var $bcc             = array();
-    var $ReplyTo         = array();
-    var $attachment      = array();
-    var $CustomHeader    = array();
-    var $message_type    = "";
-    var $boundary        = array();
-    var $language        = array();
-    var $error_count     = 0;
-    var $LE              = "\n";
-    /**#@-*/
-    
-    /////////////////////////////////////////////////
-    // VARIABLE METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Sets message type to HTML.  
-     * @param bool $bool
-     * @return void
-     */
-    function IsHTML($bool) {
-        if($bool == true)
-            $this->ContentType = "text/html";
-        else
-            $this->ContentType = "text/plain";
-    }
-
-    /**
-     * Sets Mailer to send message using SMTP.
-     * @return void
-     */
-    function IsSMTP() {
-        $this->Mailer = "smtp";
-    }
-
-    /**
-     * Sets Mailer to send message using PHP mail() function.
-     * @return void
-     */
-    function IsMail() {
-        $this->Mailer = "mail";
-    }
-
-    /**
-     * Sets Mailer to send message using the $Sendmail program.
-     * @return void
-     */
-    function IsSendmail() {
-        $this->Mailer = "sendmail";
-    }
-
-    /**
-     * Sets Mailer to send message using the qmail MTA. 
-     * @return void
-     */
-    function IsQmail() {
-        $this->Sendmail = "/var/qmail/bin/sendmail";
-        $this->Mailer = "sendmail";
-    }
-
-
-    /////////////////////////////////////////////////
-    // RECIPIENT METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds a "To" address.  
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddAddress($address, $name = "") {
-        $cur = count($this->to);
-        $this->to[$cur][0] = trim($address);
-        $this->to[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Cc" address. Note: this function works
-     * with the SMTP mailer on win32, not with the "mail"
-     * mailer.  
-     * @param string $address
-     * @param string $name
-     * @return void
-    */
-    function AddCC($address, $name = "") {
-        $cur = count($this->cc);
-        $this->cc[$cur][0] = trim($address);
-        $this->cc[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Bcc" address. Note: this function works
-     * with the SMTP mailer on win32, not with the "mail"
-     * mailer.  
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddBCC($address, $name = "") {
-        $cur = count($this->bcc);
-        $this->bcc[$cur][0] = trim($address);
-        $this->bcc[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Reply-to" address.  
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddReplyTo($address, $name = "") {
-        $cur = count($this->ReplyTo);
-        $this->ReplyTo[$cur][0] = trim($address);
-        $this->ReplyTo[$cur][1] = $name;
-    }
-
-
-    /////////////////////////////////////////////////
-    // MAIL SENDING METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Creates message and assigns Mailer. If the message is
-     * not sent successfully then it returns false.  Use the ErrorInfo
-     * variable to view description of the error.  
-     * @return bool
-     */
-    function Send() {
-        $header = "";
-        $body = "";
-        $result = true;
 
-        if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
-        {
-            $this->SetError($this->Lang("provide_address"));
-            return false;
-        }
+class PHPMailer {
 
-        // Set whether the message is multipart/alternative
-        if(!empty($this->AltBody))
-            $this->ContentType = "multipart/alternative";
-
-        $this->error_count = 0; // reset errors
-        $this->SetMessageType();
-        $header .= $this->CreateHeader();
-        $body = $this->CreateBody();
-
-        if($body == "") { return false; }
-
-        // Choose the mailer
-        switch($this->Mailer)
-        {
-            case "sendmail":
-                $result = $this->SendmailSend($header, $body);
-                break;
-            case "mail":
-                $result = $this->MailSend($header, $body);
-                break;
-            case "smtp":
-                $result = $this->SmtpSend($header, $body);
-                break;
-            default:
-            $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
-                $result = false;
-                break;
+  /////////////////////////////////////////////////
+  // PROPERTIES, PUBLIC
+  /////////////////////////////////////////////////
+
+  /**
+   * Email priority (1 = High, 3 = Normal, 5 = low).
+   * @var int
+   */
+  var $Priority          = 3;
+
+  /**
+   * Sets the CharSet of the message.
+   * @var string
+   */
+  var $CharSet           = 'iso-8859-1';
+
+  /**
+   * Sets the Content-type of the message.
+   * @var string
+   */
+  var $ContentType        = 'text/plain';
+
+  /**
+   * Sets the Encoding of the message. Options for this are "8bit",
+   * "7bit", "binary", "base64", and "quoted-printable".
+   * @var string
+   */
+  var $Encoding          = '8bit';
+
+  /**
+   * Holds the most recent mailer error message.
+   * @var string
+   */
+  var $ErrorInfo         = '';
+
+  /**
+   * Sets the From email address for the message.
+   * @var string
+   */
+  var $From              = 'root@localhost';
+
+  /**
+   * Sets the From name of the message.
+   * @var string
+   */
+  var $FromName          = 'Root User';
+
+  /**
+   * Sets the Sender email (Return-Path) of the message.  If not empty,
+   * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+   * @var string
+   */
+  var $Sender            = '';
+
+  /**
+   * Sets the Subject of the message.
+   * @var string
+   */
+  var $Subject           = '';
+
+  /**
+   * Sets the Body of the message.  This can be either an HTML or text body.
+   * If HTML then run IsHTML(true).
+   * @var string
+   */
+  var $Body              = '';
+
+  /**
+   * Sets the text-only body of the message.  This automatically sets the
+   * email to multipart/alternative.  This body can be read by mail
+   * clients that do not have HTML email capability such as mutt. Clients
+   * that can read HTML will view the normal Body.
+   * @var string
+   */
+  var $AltBody           = '';
+
+  /**
+   * Sets word wrapping on the body of the message to a given number of
+   * characters.
+   * @var int
+   */
+  var $WordWrap          = 0;
+
+  /**
+   * Method to send mail: ("mail", "sendmail", or "smtp").
+   * @var string
+   */
+  var $Mailer            = 'mail';
+
+  /**
+   * Sets the path of the sendmail program.
+   * @var string
+   */
+  var $Sendmail          = '/usr/sbin/sendmail';
+
+  /**
+   * Path to PHPMailer plugins.  This is now only useful if the SMTP class
+   * is in a different directory than the PHP include path.
+   * @var string
+   */
+  var $PluginDir         = '';
+
+  /**
+   * Holds PHPMailer version.
+   * @var string
+   */
+  var $Version           = "2.0.0 rc3";
+
+  /**
+   * Sets the email address that a reading confirmation will be sent.
+   * @var string
+   */
+  var $ConfirmReadingTo  = '';
+
+  /**
+   * Sets the hostname to use in Message-Id and Received headers
+   * and as default HELO string. If empty, the value returned
+   * by SERVER_NAME is used or 'localhost.localdomain'.
+   * @var string
+   */
+  var $Hostname          = '';
+
+  /////////////////////////////////////////////////
+  // PROPERTIES FOR SMTP
+  /////////////////////////////////////////////////
+
+  /**
+   * Sets the SMTP hosts.  All hosts must be separated by a
+   * semicolon.  You can also specify a different port
+   * for each host by using this format: [hostname:port]
+   * (e.g. "smtp1.example.com:25;smtp2.example.com").
+   * Hosts will be tried in order.
+   * @var string
+   */
+  var $Host        = 'localhost';
+
+  /**
+   * Sets the default SMTP server port.
+   * @var int
+   */
+  var $Port        = 25;
+
+  /**
+   * Sets the SMTP HELO of the message (Default is $Hostname).
+   * @var string
+   */
+  var $Helo        = '';
+
+  /**
+   * Sets connection prefix.
+   * Options are "", "ssl" or "tls"
+   * @var string
+   */
+  var $SMTPSecure = "";
+
+  /**
+   * Sets SMTP authentication. Utilizes the Username and Password variables.
+   * @var bool
+   */
+  var $SMTPAuth     = false;
+
+  /**
+   * Sets SMTP username.
+   * @var string
+   */
+  var $Username     = '';
+
+  /**
+   * Sets SMTP password.
+   * @var string
+   */
+  var $Password     = '';
+
+  /**
+   * Sets the SMTP server timeout in seconds. This function will not
+   * work with the win32 version.
+   * @var int
+   */
+  var $Timeout      = 10;
+
+  /**
+   * Sets SMTP class debugging on or off.
+   * @var bool
+   */
+  var $SMTPDebug    = false;
+
+  /**
+   * Prevents the SMTP connection from being closed after each mail
+   * sending.  If this is set to true then to close the connection
+   * requires an explicit call to SmtpClose().
+   * @var bool
+   */
+  var $SMTPKeepAlive = false;
+
+  /**
+   * Provides the ability to have the TO field process individual
+   * emails, instead of sending to entire TO addresses
+   * @var bool
+   */
+  var $SingleTo = false;
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PRIVATE
+  /////////////////////////////////////////////////
+
+  var $smtp            = NULL;
+  var $to              = array();
+  var $cc              = array();
+  var $bcc             = array();
+  var $ReplyTo         = array();
+  var $attachment      = array();
+  var $CustomHeader    = array();
+  var $message_type    = '';
+  var $boundary        = array();
+  var $language        = array();
+  var $error_count     = 0;
+  var $LE              = "\n";
+
+  /////////////////////////////////////////////////
+  // METHODS, VARIABLES
+  /////////////////////////////////////////////////
+
+  /**
+   * Sets message type to HTML.
+   * @param bool $bool
+   * @return void
+   */
+  function IsHTML($bool) {
+    if($bool == true) {
+      $this->ContentType = 'text/html';
+    } else {
+      $this->ContentType = 'text/plain';
+    }
+  }
+
+  /**
+   * Sets Mailer to send message using SMTP.
+   * @return void
+   */
+  function IsSMTP() {
+    $this->Mailer = 'smtp';
+  }
+
+  /**
+   * Sets Mailer to send message using PHP mail() function.
+   * @return void
+   */
+  function IsMail() {
+    $this->Mailer = 'mail';
+  }
+
+  /**
+   * Sets Mailer to send message using the $Sendmail program.
+   * @return void
+   */
+  function IsSendmail() {
+    $this->Mailer = 'sendmail';
+  }
+
+  /**
+   * Sets Mailer to send message using the qmail MTA.
+   * @return void
+   */
+  function IsQmail() {
+    $this->Sendmail = '/var/qmail/bin/sendmail';
+    $this->Mailer = 'sendmail';
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, RECIPIENTS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds a "To" address.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddAddress($address, $name = '') {
+    $cur = count($this->to);
+    $this->to[$cur][0] = trim($address);
+    $this->to[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Cc" address. Note: this function works
+   * with the SMTP mailer on win32, not with the "mail"
+   * mailer.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddCC($address, $name = '') {
+    $cur = count($this->cc);
+    $this->cc[$cur][0] = trim($address);
+    $this->cc[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Bcc" address. Note: this function works
+   * with the SMTP mailer on win32, not with the "mail"
+   * mailer.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddBCC($address, $name = '') {
+    $cur = count($this->bcc);
+    $this->bcc[$cur][0] = trim($address);
+    $this->bcc[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Reply-To" address.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddReplyTo($address, $name = '') {
+    $cur = count($this->ReplyTo);
+    $this->ReplyTo[$cur][0] = trim($address);
+    $this->ReplyTo[$cur][1] = $name;
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, MAIL SENDING
+  /////////////////////////////////////////////////
+
+  /**
+   * Creates message and assigns Mailer. If the message is
+   * not sent successfully then it returns false.  Use the ErrorInfo
+   * variable to view description of the error.
+   * @return bool
+   */
+  function Send() {
+    $header = '';
+    $body = '';
+    $result = true;
+
+    if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
+      $this->SetError($this->Lang('provide_address'));
+      return false;
+    }
+
+    /* Set whether the message is multipart/alternative */
+    if(!empty($this->AltBody)) {
+      $this->ContentType = 'multipart/alternative';
+    }
+
+    $this->error_count = 0; // reset errors
+    $this->SetMessageType();
+    $header .= $this->CreateHeader();
+    $body = $this->CreateBody();
+
+    if($body == '') {
+      return false;
+    }
+
+    /* Choose the mailer */
+    switch($this->Mailer) {
+      case 'sendmail':
+        $result = $this->SendmailSend($header, $body);
+        break;
+      case 'smtp':
+        $result = $this->SmtpSend($header, $body);
+        break;
+      case 'mail':
+        $result = $this->MailSend($header, $body);
+        break;
+      default:
+        $result = $this->MailSend($header, $body);
+        break;
+        //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
+        //$result = false;
+        //break;
+    }
+
+    return $result;
+  }
+
+  /**
+   * Sends mail using the $Sendmail program.
+   * @access private
+   * @return bool
+   */
+  function SendmailSend($header, $body) {
+    if ($this->Sender != '') {
+      $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+    } else {
+      $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
+    }
+
+    if(!@$mail = popen($sendmail, 'w')) {
+      $this->SetError($this->Lang('execute') . $this->Sendmail);
+      return false;
+    }
+
+    fputs($mail, $header);
+    fputs($mail, $body);
+
+    $result = pclose($mail) >> 8 & 0xFF;
+    if($result != 0) {
+      $this->SetError($this->Lang('execute') . $this->Sendmail);
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Sends mail using the PHP mail() function.
+   * @access private
+   * @return bool
+   */
+  function MailSend($header, $body) {
+
+    $to = '';
+    for($i = 0; $i < count($this->to); $i++) {
+      if($i != 0) { $to .= ', '; }
+      $to .= $this->AddrFormat($this->to[$i]);
+    }
+
+    $toArr = split(',', $to);
+
+    if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
+      $old_from = ini_get('sendmail_from');
+      ini_set('sendmail_from', $this->Sender);
+      $params = sprintf("-oi -f %s", $this->Sender);
+      if ($this->SingleTo === true && count($toArr) > 1) {
+        foreach ($toArr as $key => $val) {
+          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
         }
-
-        return $result;
-    }
-    
-    /**
-     * Sends mail using the $Sendmail program.  
-     * @access private
-     * @return bool
-     */
-    function SendmailSend($header, $body) {
-        if ($this->Sender != "")
-            $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
-        else
-            $sendmail = sprintf("%s -oi -t", $this->Sendmail);
-
-        if(!@$mail = popen($sendmail, "w"))
-        {
-            $this->SetError($this->Lang("execute") . $this->Sendmail);
-            return false;
-        }
-
-        fputs($mail, $header);
-        fputs($mail, $body);
-        
-        $result = pclose($mail) >> 8 & 0xFF;
-        if($result != 0)
-        {
-            $this->SetError($this->Lang("execute") . $this->Sendmail);
-            return false;
+      } else {
+        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+      }
+    } else {
+      if ($this->SingleTo === true && count($toArr) > 1) {
+        foreach ($toArr as $key => $val) {
+          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
         }
-
-        return true;
+      } else {
+        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
+      }
     }
 
-    /**
-     * Sends mail using the PHP mail() function.  
-     * @access private
-     * @return bool
-     */
-    function MailSend($header, $body) {
-        $to = "";
-        for($i = 0; $i < count($this->to); $i++)
-        {
-            if($i != 0) { $to .= ", "; }
-            $to .= $this->to[$i][0];
-        }
-
-        if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
-        {
-            $old_from = ini_get("sendmail_from");
-            e107_ini_set("sendmail_from", $this->Sender);
-            $params = sprintf("-oi -f %s", $this->Sender);
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, 
-                        $header, $params);
-        }
-        else
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
-
-        if (isset($old_from))
-            e107_ini_set("sendmail_from", $old_from);
-
-        if(!$rt)
-        {
-            $this->SetError($this->Lang("instantiate"));
-            return false;
-        }
-
-        return true;
+    if (isset($old_from)) {
+      ini_set('sendmail_from', $old_from);
     }
 
-    /**
-     * Sends mail via SMTP using PhpSMTP (Author:
-     * Chris Ryan).  Returns bool.  Returns false if there is a
-     * bad MAIL FROM, RCPT, or DATA input.
-     * @access private
-     * @return bool
-     */
-    function SmtpSend($header, $body) {
-        include_once($this->PluginDir . "class.smtp.php");
-        $error = "";
-        $bad_rcpt = array();
-
-        if(!$this->SmtpConnect())
-            return false;
-
-        $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
-        if(!$this->smtp->Mail($smtp_from))
-        {
-            $error = $this->Lang("from_failed") . $smtp_from;
-            $this->SetError($error);
-            $this->smtp->Reset();
-            return false;
-        }
+    if(!$rt) {
+      $this->SetError($this->Lang('instantiate'));
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Sends mail via SMTP using PhpSMTP (Author:
+   * Chris Ryan).  Returns bool.  Returns false if there is a
+   * bad MAIL FROM, RCPT, or DATA input.
+   * @access private
+   * @return bool
+   */
+  function SmtpSend($header, $body) {
+    include_once($this->PluginDir . 'class.smtp.php');
+    $error = '';
+    $bad_rcpt = array();
+
+    if(!$this->SmtpConnect()) {
+      return false;
+    }
+
+    $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+    if(!$this->smtp->Mail($smtp_from)) {
+      $error = $this->Lang('from_failed') . $smtp_from;
+      $this->SetError($error);
+      $this->smtp->Reset();
+      return false;
+    }
+
+    /* Attempt to send attach all recipients */
+    for($i = 0; $i < count($this->to); $i++) {
+      if(!$this->smtp->Recipient($this->to[$i][0])) {
+        $bad_rcpt[] = $this->to[$i][0];
+      }
+    }
+    for($i = 0; $i < count($this->cc); $i++) {
+      if(!$this->smtp->Recipient($this->cc[$i][0])) {
+        $bad_rcpt[] = $this->cc[$i][0];
+      }
+    }
+    for($i = 0; $i < count($this->bcc); $i++) {
+      if(!$this->smtp->Recipient($this->bcc[$i][0])) {
+        $bad_rcpt[] = $this->bcc[$i][0];
+      }
+    }
 
-        // Attempt to send attach all recipients
-        for($i = 0; $i < count($this->to); $i++)
-        {
-            if(!$this->smtp->Recipient($this->to[$i][0]))
-                $bad_rcpt[] = $this->to[$i][0];
-        }
-        for($i = 0; $i < count($this->cc); $i++)
-        {
-            if(!$this->smtp->Recipient($this->cc[$i][0]))
-                $bad_rcpt[] = $this->cc[$i][0];
-        }
-        for($i = 0; $i < count($this->bcc); $i++)
-        {
-            if(!$this->smtp->Recipient($this->bcc[$i][0]))
-                $bad_rcpt[] = $this->bcc[$i][0];
+    if(count($bad_rcpt) > 0) { // Create error message
+      for($i = 0; $i < count($bad_rcpt); $i++) {
+        if($i != 0) {
+          $error .= ', ';
         }
+        $error .= $bad_rcpt[$i];
+      }
+      $error = $this->Lang('recipients_failed') . $error;
+      $this->SetError($error);
+      $this->smtp->Reset();
+      return false;
+    }
+
+    if(!$this->smtp->Data($header . $body)) {
+      $this->SetError($this->Lang('data_not_accepted'));
+      $this->smtp->Reset();
+      return false;
+    }
+    if($this->SMTPKeepAlive == true) {
+      $this->smtp->Reset();
+    } else {
+      $this->SmtpClose();
+    }
+
+    return true;
+  }
+
+  /**
+   * Initiates a connection to an SMTP server.  Returns false if the
+   * operation failed.
+   * @access private
+   * @return bool
+   */
+  function SmtpConnect() {
+    if($this->smtp == NULL) {
+      $this->smtp = new SMTP();
+    }
+
+    $this->smtp->do_debug = $this->SMTPDebug;
+    $hosts = explode(';', $this->Host);
+    $index = 0;
+    $connection = ($this->smtp->Connected());
+
+    /* Retry while there is no connection */
+    while($index < count($hosts) && $connection == false) {
+      $hostinfo = array();
+      if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
+        $host = $hostinfo[1];
+        $port = $hostinfo[2];
+      } else {
+        $host = $hosts[$index];
+        $port = $this->Port;
+      }
 
-        if(count($bad_rcpt) > 0) // Create error message
-        {
-            for($i = 0; $i < count($bad_rcpt); $i++)
-            {
-                if($i != 0) { $error .= ", "; }
-                $error .= $bad_rcpt[$i];
-            }
-            $error = $this->Lang("recipients_failed") . $error;
-            $this->SetError($error);
-            $this->smtp->Reset();
-            return false;
+      if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
+        if ($this->Helo != '') {
+          $this->smtp->Hello($this->Helo);
+        } else {
+          $this->smtp->Hello($this->ServerHostname());
         }
 
-        if(!$this->smtp->Data($header . $body))
-        {
-            $this->SetError($this->Lang("data_not_accepted"));
-            $this->smtp->Reset();
-            return false;
-        }
-        if($this->SMTPKeepAlive == true)
+        $connection = true;
+        if($this->SMTPAuth) {
+          if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
+            $this->SetError($this->Lang('authenticate'));
             $this->smtp->Reset();
-        else
-            $this->SmtpClose();
-
-        return true;
-    }
-
-    /**
-     * Initiates a connection to an SMTP server.  Returns false if the 
-     * operation failed.
-     * @access private
-     * @return bool
-     */
-    function SmtpConnect() {
-        if($this->smtp == NULL) { $this->smtp = new SMTP(); }
-
-        $this->smtp->do_debug = $this->SMTPDebug;
-        $hosts = explode(";", $this->Host);
-        $index = 0;
-        $connection = ($this->smtp->Connected()); 
-
-        // Retry while there is no connection
-        while($index < count($hosts) && $connection == false)
-        {
-            if(strstr($hosts[$index], ":"))
-                list($host, $port) = explode(":", $hosts[$index]);
-            else
-            {
-                $host = $hosts[$index];
-                $port = $this->Port;
-            }
-
-            if($this->smtp->Connect($host, $port, $this->Timeout))
-            {
-                if ($this->Helo != '')
-                    $this->smtp->Hello($this->Helo);
-                else
-                    $this->smtp->Hello($this->ServerHostname());
-        
-                if($this->SMTPAuth)
-                {
-                    if(!$this->smtp->Authenticate($this->Username, 
-                                                  $this->Password))
-                    {
-                        $this->SetError($this->Lang("authenticate"));
-                        $this->smtp->Reset();
-                        $connection = false;
-                    }
-                }
-                $connection = true;
-            }
-            $index++;
+            $connection = false;
+          }
         }
-        if(!$connection)
-            $this->SetError($this->Lang("connect_host"));
-
-        return $connection;
+      }
+      $index++;
     }
-
-    /**
-     * Closes the active SMTP session if one exists.
-     * @return void
-     */
-    function SmtpClose() {
-        if($this->smtp != NULL)
-        {
-            if($this->smtp->Connected())
-            {
-                $this->smtp->Quit();
-                $this->smtp->Close();
-            }
-        }
+    if(!$connection) {
+      $this->SetError($this->Lang('connect_host'));
     }
 
-    /**
-     * Sets the language for all class error messages.  Returns false 
-     * if it cannot load the language file.  The default language type
-     * is English.
-     * @param string $lang_type Type of language (e.g. Portuguese: "br")
-     * @param string $lang_path Path to the language file directory
-     * @access public
-     * @return bool
-     */
-    function SetLanguage($lang_type, $lang_path = "language/") {
-        if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php'))
-            include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
-        else if(file_exists($lang_path.'phpmailer.lang-en.php'))
-            include($lang_path.'phpmailer.lang-en.php');
-        else
-        {
-            $this->SetError("Could not load language file");
-            return false;
-        }
-        $this->language = $PHPMAILER_LANG;
-    
-        return true;
-    }
-
-    /////////////////////////////////////////////////
-    // MESSAGE CREATION METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Creates recipient headers.  
-     * @access private
-     * @return string
-     */
-    function AddrAppend($type, $addr) {
-        $addr_str = $type . ": ";
-        $addr_str .= $this->AddrFormat($addr[0]);
-        if(count($addr) > 1)
-        {
-            for($i = 1; $i < count($addr); $i++)
-                $addr_str .= ", " . $this->AddrFormat($addr[$i]);
-        }
-        $addr_str .= $this->LE;
+    return $connection;
+  }
 
-        return $addr_str;
+  /**
+   * Closes the active SMTP session if one exists.
+   * @return void
+   */
+  function SmtpClose() {
+    if($this->smtp != NULL) {
+      if($this->smtp->Connected()) {
+        $this->smtp->Quit();
+        $this->smtp->Close();
+      }
     }
-    
-    /**
-     * Formats an address correctly. 
-     * @access private
-     * @return string
-     */
-    function AddrFormat($addr) {
-        if(empty($addr[1]))
-            $formatted = $addr[0];
-        else
-        {
-            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . 
-                         $addr[0] . ">";
-        }
+  }
 
-        return $formatted;
+  /**
+   * Sets the language for all class error messages.  Returns false
+   * if it cannot load the language file.  The default language type
+   * is English.
+   * @param string $lang_type Type of language (e.g. Portuguese: "br")
+   * @param string $lang_path Path to the language file directory
+   * @access public
+   * @return bool
+   */
+  function SetLanguage($lang_type, $lang_path = 'language/') {
+    if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
+      include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
+    } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
+      include($lang_path.'phpmailer.lang-en.php');
+    } else {
+      $this->SetError('Could not load language file');
+      return false;
+    }
+    $this->language = $PHPMAILER_LANG;
+
+    return true;
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, MESSAGE CREATION
+  /////////////////////////////////////////////////
+
+  /**
+   * Creates recipient headers.
+   * @access private
+   * @return string
+   */
+  function AddrAppend($type, $addr) {
+    $addr_str = $type . ': ';
+    $addr_str .= $this->AddrFormat($addr[0]);
+    if(count($addr) > 1) {
+      for($i = 1; $i < count($addr); $i++) {
+        $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
+      }
     }
+    $addr_str .= $this->LE;
 
-    /**
-     * Wraps message for use with mailers that do not
-     * automatically perform wrapping and for quoted-printable.
-     * Original written by philippe.  
-     * @access private
-     * @return string
-     */
-    function WrapText($message, $length, $qp_mode = false) {
-        $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
-
-        $message = $this->FixEOL($message);
-        if (substr($message, -1) == $this->LE)
-            $message = substr($message, 0, -1);
-
-        $line = explode($this->LE, $message);
-        $message = "";
-        for ($i=0 ;$i < count($line); $i++)
-        {
-          $line_part = explode(" ", $line[$i]);
-          $buf = "";
-          for ($e = 0; $e<count($line_part); $e++)
-          {
-              $word = $line_part[$e];
-              if ($qp_mode and (strlen($word) > $length))
-              {
-                $space_left = $length - strlen($buf) - 1;
-                if ($e != 0)
-                {
-                    if ($space_left > 20)
-                    {
-                        $len = $space_left;
-                        if (substr($word, $len - 1, 1) == "=")
-                          $len--;
-                        elseif (substr($word, $len - 2, 1) == "=")
-                          $len -= 2;
-                        $part = substr($word, 0, $len);
-                        $word = substr($word, $len);
-                        $buf .= " " . $part;
-                        $message .= $buf . sprintf("=%s", $this->LE);
-                    }
-                    else
-                    {
-                        $message .= $buf . $soft_break;
-                    }
-                    $buf = "";
-                }
-                while (strlen($word) > 0)
-                {
-                    $len = $length;
-                    if (substr($word, $len - 1, 1) == "=")
-                        $len--;
-                    elseif (substr($word, $len - 2, 1) == "=")
-                        $len -= 2;
-                    $part = substr($word, 0, $len);
-                    $word = substr($word, $len);
-
-                    if (strlen($word) > 0)
-                        $message .= $part . sprintf("=%s", $this->LE);
-                    else
-                        $buf = $part;
-                }
-              }
-              else
-              {
-                $buf_o = $buf;
-                $buf .= ($e == 0) ? $word : (" " . $word); 
-
-                if (strlen($buf) > $length and $buf_o != "")
-                {
-                    $message .= $buf_o . $soft_break;
-                    $buf = $word;
-                }
+    return $addr_str;
+  }
+
+  /**
+   * Formats an address correctly.
+   * @access private
+   * @return string
+   */
+  function AddrFormat($addr) {
+    if(empty($addr[1])) {
+      $formatted = $this->SecureHeader($addr[0]);
+    } else {
+      $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
+    }
+
+    return $formatted;
+  }
+
+  /**
+   * Wraps message for use with mailers that do not
+   * automatically perform wrapping and for quoted-printable.
+   * Original written by philippe.
+   * @access private
+   * @return string
+   */
+  function WrapText($message, $length, $qp_mode = false) {
+    $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+
+    $message = $this->FixEOL($message);
+    if (substr($message, -1) == $this->LE) {
+      $message = substr($message, 0, -1);
+    }
+
+    $line = explode($this->LE, $message);
+    $message = '';
+    for ($i=0 ;$i < count($line); $i++) {
+      $line_part = explode(' ', $line[$i]);
+      $buf = '';
+      for ($e = 0; $e<count($line_part); $e++) {
+        $word = $line_part[$e];
+        if ($qp_mode and (strlen($word) > $length)) {
+          $space_left = $length - strlen($buf) - 1;
+          if ($e != 0) {
+            if ($space_left > 20) {
+              $len = $space_left;
+              if (substr($word, $len - 1, 1) == '=') {
+                $len--;
+              } elseif (substr($word, $len - 2, 1) == '=') {
+                $len -= 2;
               }
+              $part = substr($word, 0, $len);
+              $word = substr($word, $len);
+              $buf .= ' ' . $part;
+              $message .= $buf . sprintf("=%s", $this->LE);
+            } else {
+              $message .= $buf . $soft_break;
+            }
+            $buf = '';
           }
-          $message .= $buf . $this->LE;
-        }
-
-        return $message;
-    }
-    
-    /**
-     * Set the body wrapping.
-     * @access private
-     * @return void
-     */
-    function SetWordWrap() {
-        if($this->WordWrap < 1)
-            return;
-            
-        switch($this->message_type)
-        {
-           case "alt":
-              // fall through
-           case "alt_attachments":
-              $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
-              break;
-           default:
-              $this->Body = $this->WrapText($this->Body, $this->WordWrap);
-              break;
-        }
-    }
-
-    /**
-     * Assembles message header.  
-     * @access private
-     * @return string
-     */
-    function CreateHeader() {
-        $result = "";
-        
-        // Set the boundaries
-        $uniq_id = md5(uniqid(time()));
-        $this->boundary[1] = "b1_" . $uniq_id;
-        $this->boundary[2] = "b2_" . $uniq_id;
-
-        $result .= $this->HeaderLine("Date", $this->RFCDate());
-        if($this->Sender == "")
-            $result .= $this->HeaderLine("Return-Path", trim($this->From));
-        else
-            $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
-        
-        // To be created automatically by mail()
-        if($this->Mailer != "mail")
-        {
-            if(count($this->to) > 0)
-                $result .= $this->AddrAppend("To", $this->to);
-            else if (count($this->cc) == 0)
-                $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
-            if(count($this->cc) > 0)
-                $result .= $this->AddrAppend("Cc", $this->cc);
-        }
-
-        $from = array();
-        $from[0][0] = trim($this->From);
-        $from[0][1] = $this->FromName;
-        $result .= $this->AddrAppend("From", $from); 
-
-        // sendmail and mail() extract Bcc from the header before sending
-        if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0))
-            $result .= $this->AddrAppend("Bcc", $this->bcc);
-
-        if(count($this->ReplyTo) > 0)
-            $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
-
-        // mail() sets the subject itself
-        if($this->Mailer != "mail")
-            $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
-
-        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
-        $result .= $this->HeaderLine("X-Priority", $this->Priority);
-        $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]");
-        
-        if($this->ConfirmReadingTo != "")
-        {
-            $result .= $this->HeaderLine("Disposition-Notification-To", 
-                       "<" . trim($this->ConfirmReadingTo) . ">");
-        }
-
-        // Add custom headers
-        for($index = 0; $index < count($this->CustomHeader); $index++)
-        {
-            $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), 
-                       $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
-        }
-        $result .= $this->HeaderLine("MIME-Version", "1.0");
+          while (strlen($word) > 0) {
+            $len = $length;
+            if (substr($word, $len - 1, 1) == '=') {
+              $len--;
+            } elseif (substr($word, $len - 2, 1) == '=') {
+              $len -= 2;
+            }
+            $part = substr($word, 0, $len);
+            $word = substr($word, $len);
 
-        switch($this->message_type)
-        {
-            case "plain":
-                $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
-                $result .= sprintf("Content-Type: %s; charset=\"%s\"",
-                                    $this->ContentType, $this->CharSet);
-                break;
-            case "attachments":
-                // fall through
-            case "alt_attachments":
-                if($this->InlineImageExists())
-                {
-                    $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 
-                                    "multipart/related", $this->LE, $this->LE, 
-                                    $this->boundary[1], $this->LE);
-                }
-                else
-                {
-                    $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
-                    $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                }
-                break;
-            case "alt":
-                $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
-                $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                break;
+            if (strlen($word) > 0) {
+              $message .= $part . sprintf("=%s", $this->LE);
+            } else {
+              $buf = $part;
+            }
+          }
+        } else {
+          $buf_o = $buf;
+          $buf .= ($e == 0) ? $word : (' ' . $word);
+
+          if (strlen($buf) > $length and $buf_o != '') {
+            $message .= $buf_o . $soft_break;
+            $buf = $word;
+          }
         }
-
-        if($this->Mailer != "mail")
-            $result .= $this->LE.$this->LE;
-
-        return $result;
+      }
+      $message .= $buf . $this->LE;
     }
 
-    /**
-     * Assembles the message body.  Returns an empty string on failure.
-     * @access private
-     * @return string
-     */
-    function CreateBody() {
-        $result = "";
-
-        $this->SetWordWrap();
-
-        switch($this->message_type)
-        {
-            case "alt":
-                $result .= $this->GetBoundary($this->boundary[1], "", 
-                                              "text/plain", "");
-                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-                $result .= $this->GetBoundary($this->boundary[1], "", 
-                                              "text/html", "");
-                
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-    
-                $result .= $this->EndBoundary($this->boundary[1]);
-                break;
-            case "plain":
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                break;
-            case "attachments":
-                $result .= $this->GetBoundary($this->boundary[1], "", "", "");
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE;
-     
-                $result .= $this->AttachAll();
-                break;
-            case "alt_attachments":
-                $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
-                $result .= sprintf("Content-Type: %s;%s" .
-                                   "\tboundary=\"%s\"%s",
-                                   "multipart/alternative", $this->LE, 
-                                   $this->boundary[2], $this->LE.$this->LE);
-    
-                // Create text body
-                $result .= $this->GetBoundary($this->boundary[2], "", 
-                                              "text/plain", "") . $this->LE;
-
-                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-    
-                // Create the HTML body
-                $result .= $this->GetBoundary($this->boundary[2], "", 
-                                              "text/html", "") . $this->LE;
-    
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-
-                $result .= $this->EndBoundary($this->boundary[2]);
-                
-                $result .= $this->AttachAll();
-                break;
-        }
-        if($this->IsError())
-            $result = "";
+    return $message;
+  }
 
-        return $result;
+  /**
+   * Set the body wrapping.
+   * @access private
+   * @return void
+   */
+  function SetWordWrap() {
+    if($this->WordWrap < 1) {
+      return;
+    }
+
+    switch($this->message_type) {
+      case 'alt':
+        /* fall through */
+      case 'alt_attachments':
+        $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
+        break;
+      default:
+        $this->Body = $this->WrapText($this->Body, $this->WordWrap);
+        break;
+    }
+  }
+
+  /**
+   * Assembles message header.
+   * @access private
+   * @return string
+   */
+  function CreateHeader() {
+    $result = '';
+
+    /* Set the boundaries */
+    $uniq_id = md5(uniqid(time()));
+    $this->boundary[1] = 'b1_' . $uniq_id;
+    $this->boundary[2] = 'b2_' . $uniq_id;
+
+    $result .= $this->HeaderLine('Date', $this->RFCDate());
+    if($this->Sender == '') {
+      $result .= $this->HeaderLine('Return-Path', trim($this->From));
+    } else {
+      $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
+    }
+
+    /* To be created automatically by mail() */
+    if($this->Mailer != 'mail') {
+      if(count($this->to) > 0) {
+        $result .= $this->AddrAppend('To', $this->to);
+      } elseif (count($this->cc) == 0) {
+        $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
+      }
+      if(count($this->cc) > 0) {
+        $result .= $this->AddrAppend('Cc', $this->cc);
+      }
     }
 
-    /**
-     * Returns the start of a message boundary.
-     * @access private
-     */
-    function GetBoundary($boundary, $charSet, $contentType, $encoding) {
-        $result = "";
-        if($charSet == "") { $charSet = $this->CharSet; }
-        if($contentType == "") { $contentType = $this->ContentType; }
-        if($encoding == "") { $encoding = $this->Encoding; }
-
-        $result .= $this->TextLine("--" . $boundary);
-        $result .= sprintf("Content-Type: %s; charset = \"%s\"", 
-                            $contentType, $charSet);
-        $result .= $this->LE;
-        $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
+    $from = array();
+    $from[0][0] = trim($this->From);
+    $from[0][1] = $this->FromName;
+    $result .= $this->AddrAppend('From', $from);
+
+    /* sendmail and mail() extract Cc from the header before sending */
+    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
+      $result .= $this->AddrAppend('Cc', $this->cc);
+    }
+
+    /* sendmail and mail() extract Bcc from the header before sending */
+    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
+      $result .= $this->AddrAppend('Bcc', $this->bcc);
+    }
+
+    if(count($this->ReplyTo) > 0) {
+      $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
+    }
+
+    /* mail() sets the subject itself */
+    if($this->Mailer != 'mail') {
+      $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
+    }
+
+    $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+    $result .= $this->HeaderLine('X-Priority', $this->Priority);
+    $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
+
+    if($this->ConfirmReadingTo != '') {
+      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
+    }
+
+    // Add custom headers
+    for($index = 0; $index < count($this->CustomHeader); $index++) {
+      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
+    }
+    $result .= $this->HeaderLine('MIME-Version', '1.0');
+
+    switch($this->message_type) {
+      case 'plain':
+        $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
+        $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
+        break;
+      case 'attachments':
+        /* fall through */
+      case 'alt_attachments':
+        if($this->InlineImageExists()){
+          $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
+        } else {
+          $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
+          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+        }
+        break;
+      case 'alt':
+        $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+        break;
+    }
+
+    if($this->Mailer != 'mail') {
+      $result .= $this->LE.$this->LE;
+    }
+
+    return $result;
+  }
+
+  /**
+   * Assembles the message body.  Returns an empty string on failure.
+   * @access private
+   * @return string
+   */
+  function CreateBody() {
+    $result = '';
+
+    $this->SetWordWrap();
+
+    switch($this->message_type) {
+      case 'alt':
+        $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+        $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->EndBoundary($this->boundary[1]);
+        break;
+      case 'plain':
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        break;
+      case 'attachments':
+        $result .= $this->GetBoundary($this->boundary[1], '', '', '');
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
         $result .= $this->LE;
-       
-        return $result;
-    }
-    
-    /**
-     * Returns the end of a message boundary.
-     * @access private
-     */
-    function EndBoundary($boundary) {
-        return $this->LE . "--" . $boundary . "--" . $this->LE; 
-    }
-    
-    /**
-     * Sets the message type.
-     * @access private
-     * @return void
-     */
-    function SetMessageType() {
-        if(count($this->attachment) < 1 && strlen($this->AltBody) < 1)
-            $this->message_type = "plain";
-        else
-        {
-            if(count($this->attachment) > 0)
-                $this->message_type = "attachments";
-            if(strlen($this->AltBody) > 0 && count($this->attachment) < 1)
-                $this->message_type = "alt";
-            if(strlen($this->AltBody) > 0 && count($this->attachment) > 0)
-                $this->message_type = "alt_attachments";
-        }
+        $result .= $this->AttachAll();
+        break;
+      case 'alt_attachments':
+        $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
+        $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
+        $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
+        $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->EndBoundary($this->boundary[2]);
+        $result .= $this->AttachAll();
+        break;
+    }
+    if($this->IsError()) {
+      $result = '';
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns the start of a message boundary.
+   * @access private
+   */
+  function GetBoundary($boundary, $charSet, $contentType, $encoding) {
+    $result = '';
+    if($charSet == '') {
+      $charSet = $this->CharSet;
+    }
+    if($contentType == '') {
+      $contentType = $this->ContentType;
+    }
+    if($encoding == '') {
+      $encoding = $this->Encoding;
+    }
+    $result .= $this->TextLine('--' . $boundary);
+    $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
+    $result .= $this->LE;
+    $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
+    $result .= $this->LE;
+
+    return $result;
+  }
+
+  /**
+   * Returns the end of a message boundary.
+   * @access private
+   */
+  function EndBoundary($boundary) {
+    return $this->LE . '--' . $boundary . '--' . $this->LE;
+  }
+
+  /**
+   * Sets the message type.
+   * @access private
+   * @return void
+   */
+  function SetMessageType() {
+    if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
+      $this->message_type = 'plain';
+    } else {
+      if(count($this->attachment) > 0) {
+        $this->message_type = 'attachments';
+      }
+      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
+        $this->message_type = 'alt';
+      }
+      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
+        $this->message_type = 'alt_attachments';
+      }
     }
+  }
 
-    /**
-     * Returns a formatted header line.
-     * @access private
-     * @return string
-     */
-    function HeaderLine($name, $value) {
-        return $name . ": " . $value . $this->LE;
-    }
-
-    /**
-     * Returns a formatted mail line.
-     * @access private
-     * @return string
-     */
-    function TextLine($value) {
-        return $value . $this->LE;
-    }
-
-    /////////////////////////////////////////////////
-    // ATTACHMENT METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds an attachment from a path on the filesystem.
-     * Returns false if the file could not be found
-     * or accessed.
-     * @param string $path Path to the attachment.
-     * @param string $name Overrides the attachment name.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return bool
-     */
-    function AddAttachment($path, $name = "", $encoding = "base64", 
-                           $type = "application/octet-stream") {
-        if(!@is_file($path))
-        {
-            $this->SetError($this->Lang("file_access") . $path);
-            return false;
-        }
+  /* Returns a formatted header line.
+   * @access private
+   * @return string
+   */
+  function HeaderLine($name, $value) {
+    return $name . ': ' . $value . $this->LE;
+  }
+
+  /**
+   * Returns a formatted mail line.
+   * @access private
+   * @return string
+   */
+  function TextLine($value) {
+    return $value . $this->LE;
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, ATTACHMENTS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds an attachment from a path on the filesystem.
+   * Returns false if the file could not be found
+   * or accessed.
+   * @param string $path Path to the attachment.
+   * @param string $name Overrides the attachment name.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return bool
+   */
+  function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+    if(!@is_file($path)) {
+      $this->SetError($this->Lang('file_access') . $path);
+      return false;
+    }
+
+    $filename = basename($path);
+    if($name == '') {
+      $name = $filename;
+    }
+
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $path;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $name;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = false; // isStringAttachment
+    $this->attachment[$cur][6] = 'attachment';
+    $this->attachment[$cur][7] = 0;
+
+    return true;
+  }
+
+  /**
+   * Attaches all fs, string, and binary attachments to the message.
+   * Returns an empty string on failure.
+   * @access private
+   * @return string
+   */
+  function AttachAll() {
+    /* Return text of body */
+    $mime = array();
+
+    /* Add all attachments */
+    for($i = 0; $i < count($this->attachment); $i++) {
+      /* Check for string attachment */
+      $bString = $this->attachment[$i][5];
+      if ($bString) {
+        $string = $this->attachment[$i][0];
+      } else {
+        $path = $this->attachment[$i][0];
+      }
 
-        $filename = basename($path);
-        if($name == "")
-            $name = $filename;
-
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $path;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $name;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = false; // isStringAttachment
-        $this->attachment[$cur][6] = "attachment";
-        $this->attachment[$cur][7] = 0;
-
-        return true;
-    }
-
-    /**
-     * Attaches all fs, string, and binary attachments to the message.
-     * Returns an empty string on failure.
-     * @access private
-     * @return string
-     */
-    function AttachAll() {
-        // Return text of body
-        $mime = array();
-
-        // Add all attachments
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            // Check for string attachment
-            $bString = $this->attachment[$i][5];
-            if ($bString)
-                $string = $this->attachment[$i][0];
-            else
-                $path = $this->attachment[$i][0];
-
-            $filename    = $this->attachment[$i][1];
-            $name        = $this->attachment[$i][2];
-            $encoding    = $this->attachment[$i][3];
-            $type        = $this->attachment[$i][4];
-            $disposition = $this->attachment[$i][6];
-            $cid         = $this->attachment[$i][7];
-            
-            $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
-            $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
-            $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
-
-            if($disposition == "inline")
-                $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
-
-            $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", 
-                              $disposition, $name, $this->LE.$this->LE);
-
-            // Encode as string attachment
-            if($bString)
-            {
-                $mime[] = $this->EncodeString($string, $encoding);
-                if($this->IsError()) { return ""; }
-                $mime[] = $this->LE.$this->LE;
-            }
-            else
-            {
-                $mime[] = $this->EncodeFile($path, $encoding);                
-                if($this->IsError()) { return ""; }
-                $mime[] = $this->LE.$this->LE;
-            }
-        }
+      $filename    = $this->attachment[$i][1];
+      $name        = $this->attachment[$i][2];
+      $encoding    = $this->attachment[$i][3];
+      $type        = $this->attachment[$i][4];
+      $disposition = $this->attachment[$i][6];
+      $cid         = $this->attachment[$i][7];
+
+      $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
+      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
+      $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
 
-        $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+      if($disposition == 'inline') {
+        $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
+      }
 
-        return join("", $mime);
-    }
-    
-    /**
-     * Encodes attachment in requested format.  Returns an
-     * empty string on failure.
-     * @access private
-     * @return string
-     */
-    function EncodeFile ($path, $encoding = "base64") {
-        if(!@$fd = fopen($path, "rb"))
-        {
-            $this->SetError($this->Lang("file_open") . $path);
-            return "";
+      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
+
+      /* Encode as string attachment */
+      if($bString) {
+        $mime[] = $this->EncodeString($string, $encoding);
+        if($this->IsError()) {
+          return '';
         }
-        $magic_quotes = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        $file_buffer = fread($fd, filesize($path));
-        $file_buffer = $this->EncodeString($file_buffer, $encoding);
-        fclose($fd);
-        set_magic_quotes_runtime($magic_quotes);
-
-        return $file_buffer;
-    }
-
-    /**
-     * Encodes string to requested format. Returns an
-     * empty string on failure.
-     * @access private
-     * @return string
-     */
-    function EncodeString ($str, $encoding = "base64") {
-        $encoded = "";
-        switch(strtolower($encoding)) {
-          case "base64":
-              // chunk_split is found in PHP >= 3.0.6
-              $encoded = chunk_split(base64_encode($str), 76, $this->LE);
-              break;
-          case "7bit":
-          case "8bit":
-              $encoded = $this->FixEOL($str);
-              if (substr($encoded, -(strlen($this->LE))) != $this->LE)
-                $encoded .= $this->LE;
-              break;
-          case "binary":
-              $encoded = $str;
-              break;
-          case "quoted-printable":
-              $encoded = $this->EncodeQP($str);
-              break;
-          default:
-              $this->SetError($this->Lang("encoding") . $encoding);
-              break;
+        $mime[] = $this->LE.$this->LE;
+      } else {
+        $mime[] = $this->EncodeFile($path, $encoding);
+        if($this->IsError()) {
+          return '';
         }
-        return $encoded;
+        $mime[] = $this->LE.$this->LE;
+      }
     }
 
-    /**
-     * Encode a header string to best of Q, B, quoted or none.  
-     * @access private
-     * @return string
-     */
-    function EncodeHeader ($str, $position = 'text') {
-      $x = 0;
-      
-      switch (strtolower($position)) {
-        case 'phrase':
-          if (!preg_match('/[\200-\377]/', $str)) {
-            // Can't use addslashes as we don't know what value has magic_quotes_sybase.
-            $encoded = addcslashes($str, "\0..\37\177\\\"");
-
-            if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
-              return ($encoded);
-            else
-              return ("\"$encoded\"");
-          }
-          $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
-          break;
-        case 'comment':
-          $x = preg_match_all('/[()"]/', $str, $matches);
-          // Fall-through
-        case 'text':
-        default:
-          $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
-          break;
-      }
-
-      if ($x == 0)
-        return ($str);
-
-      $maxlen = 75 - 7 - strlen($this->CharSet);
-      // Try to select the encoding which should produce the shortest output
-      if (strlen($str)/3 < $x) {
-        $encoding = 'B';
-        $encoded = base64_encode($str);
-        $maxlen -= $maxlen % 4;
-        $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
-      } else {
-        $encoding = 'Q';
-        $encoded = $this->EncodeQ($str, $position);
-        $encoded = $this->WrapText($encoded, $maxlen, true);
-        $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
-      }
-
-      $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
-      $encoded = trim(str_replace("\n", $this->LE, $encoded));
-      
-      return $encoded;
-    }
-    
-    /**
-     * Encode string to quoted-printable.  
-     * @access private
-     * @return string
-     */
-    function EncodeQP ($str) {
+    $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+
+    return join('', $mime);
+  }
+
+  /**
+   * Encodes attachment in requested format.  Returns an
+   * empty string on failure.
+   * @access private
+   * @return string
+   */
+  function EncodeFile ($path, $encoding = 'base64') {
+    if(!@$fd = fopen($path, 'rb')) {
+      $this->SetError($this->Lang('file_open') . $path);
+      return '';
+    }
+    $magic_quotes = get_magic_quotes_runtime();
+    set_magic_quotes_runtime(0);
+    $file_buffer = fread($fd, filesize($path));
+    $file_buffer = $this->EncodeString($file_buffer, $encoding);
+    fclose($fd);
+    set_magic_quotes_runtime($magic_quotes);
+
+    return $file_buffer;
+  }
+
+  /**
+   * Encodes string to requested format. Returns an
+   * empty string on failure.
+   * @access private
+   * @return string
+   */
+  function EncodeString ($str, $encoding = 'base64') {
+    $encoded = '';
+    switch(strtolower($encoding)) {
+      case 'base64':
+        /* chunk_split is found in PHP >= 3.0.6 */
+        $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+        break;
+      case '7bit':
+      case '8bit':
         $encoded = $this->FixEOL($str);
         if (substr($encoded, -(strlen($this->LE))) != $this->LE)
-            $encoded .= $this->LE;
-
-        // Replace every high ascii, control and = characters
-        $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
-                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
-        // Replace every spaces and tabs when it's the last character on a line
-        $encoded = preg_replace("/([\011\040])".$this->LE."/e",
-                  "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
-
-        // Maximum line length of 76 characters before CRLF (74 + space + '=')
-        $encoded = $this->WrapText($encoded, 74, true);
-
-        return $encoded;
-    }
-
-    /**
-     * Encode string to q encoding.  
-     * @access private
-     * @return string
-     */
-    function EncodeQ ($str, $position = "text") {
-        // There should not be any EOL in the string
-        $encoded = preg_replace("[\r\n]", "", $str);
-
-        switch (strtolower($position)) {
-          case "phrase":
-            $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
-            break;
-          case "comment":
-            $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
-          case "text":
-          default:
-            // Replace every high ascii, control =, ? and _ characters
-            $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
-                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
-            break;
+          $encoded .= $this->LE;
+        break;
+      case 'binary':
+        $encoded = $str;
+        break;
+      case 'quoted-printable':
+        $encoded = $this->EncodeQP($str);
+        break;
+      default:
+        $this->SetError($this->Lang('encoding') . $encoding);
+        break;
+    }
+    return $encoded;
+  }
+
+  /**
+   * Encode a header string to best of Q, B, quoted or none.
+   * @access private
+   * @return string
+   */
+  function EncodeHeader ($str, $position = 'text') {
+    $x = 0;
+
+    switch (strtolower($position)) {
+      case 'phrase':
+        if (!preg_match('/[\200-\377]/', $str)) {
+          /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
+          $encoded = addcslashes($str, "\0..\37\177\\\"");
+          if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
+            return ($encoded);
+          } else {
+            return ("\"$encoded\"");
+          }
         }
-        
-        // Replace every spaces to _ (more readable than =20)
-        $encoded = str_replace(" ", "_", $encoded);
-
-        return $encoded;
-    }
-
-    /**
-     * Adds a string or binary attachment (non-filesystem) to the list.
-     * This method can be used to attach ascii or binary data,
-     * such as a BLOB record from a database.
-     * @param string $string String attachment data.
-     * @param string $filename Name of the attachment.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return void
-     */
-    function AddStringAttachment($string, $filename, $encoding = "base64", 
-                                 $type = "application/octet-stream") {
-        // Append to $attachment array
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $string;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $filename;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = true; // isString
-        $this->attachment[$cur][6] = "attachment";
-        $this->attachment[$cur][7] = 0;
-    }
-    
-    /**
-     * Adds an embedded attachment.  This can include images, sounds, and 
-     * just about any other document.  Make sure to set the $type to an 
-     * image type.  For JPEG images use "image/jpeg" and for GIF images 
-     * use "image/gif".
-     * @param string $path Path to the attachment.
-     * @param string $cid Content ID of the attachment.  Use this to identify 
-     *        the Id for accessing the image in an HTML form.
-     * @param string $name Overrides the attachment name.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.  
-     * @return bool
-     */
-    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", 
-                              $type = "application/octet-stream") {
-    
-        if(!@is_file($path))
-        {
-            $this->SetError($this->Lang("file_access") . $path);
-            return false;
+        $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
+        break;
+      case 'comment':
+        $x = preg_match_all('/[()"]/', $str, $matches);
+        /* Fall-through */
+      case 'text':
+      default:
+        $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+        break;
+    }
+
+    if ($x == 0) {
+      return ($str);
+    }
+
+    $maxlen = 75 - 7 - strlen($this->CharSet);
+    /* Try to select the encoding which should produce the shortest output */
+    if (strlen($str)/3 < $x) {
+      $encoding = 'B';
+      $encoded = base64_encode($str);
+      $maxlen -= $maxlen % 4;
+      $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+    } else {
+      $encoding = 'Q';
+      $encoded = $this->EncodeQ($str, $position);
+      $encoded = $this->WrapText($encoded, $maxlen, true);
+      $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
+    }
+
+    $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
+    $encoded = trim(str_replace("\n", $this->LE, $encoded));
+
+    return $encoded;
+  }
+
+  /**
+   * Encode string to quoted-printable.
+   * @access private
+   * @return string
+   */
+  function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
+    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+    $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
+    $eol = "\r\n";
+    $escape = '=';
+    $output = '';
+    while( list(, $line) = each($lines) ) {
+      $linlen = strlen($line);
+      $newline = '';
+      for($i = 0; $i < $linlen; $i++) {
+        $c = substr( $line, $i, 1 );
+        $dec = ord( $c );
+        if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
+          $c = '=2E';
+        }
+        if ( $dec == 32 ) {
+          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
+            $c = '=20';
+          } else if ( $space_conv ) {
+            $c = '=20';
+          }
+        } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
+          $h2 = floor($dec/16);
+          $h1 = floor($dec%16);
+          $c = $escape.$hex[$h2].$hex[$h1];
+        }
+        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
+          $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
+          $newline = '';
+          // check if newline first character will be point or not
+          if ( $dec == 46 ) {
+            $c = '=2E';
+          }
         }
+        $newline .= $c;
+      } // end of for
+      $output .= $newline.$eol;
+    } // end of while
+    return trim($output);
+  }
+
+  /**
+   * Encode string to q encoding.
+   * @access private
+   * @return string
+   */
+  function EncodeQ ($str, $position = 'text') {
+    /* There should not be any EOL in the string */
+    $encoded = preg_replace("[\r\n]", '', $str);
+
+    switch (strtolower($position)) {
+      case 'phrase':
+        $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        break;
+      case 'comment':
+        $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+      case 'text':
+      default:
+        /* Replace every high ascii, control =, ? and _ characters */
+        $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
+              "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        break;
+    }
+
+    /* Replace every spaces to _ (more readable than =20) */
+    $encoded = str_replace(' ', '_', $encoded);
+
+    return $encoded;
+  }
+
+  /**
+   * Adds a string or binary attachment (non-filesystem) to the list.
+   * This method can be used to attach ascii or binary data,
+   * such as a BLOB record from a database.
+   * @param string $string String attachment data.
+   * @param string $filename Name of the attachment.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return void
+   */
+  function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
+    /* Append to $attachment array */
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $string;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $filename;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = true; // isString
+    $this->attachment[$cur][6] = 'attachment';
+    $this->attachment[$cur][7] = 0;
+  }
+
+  /**
+   * Adds an embedded attachment.  This can include images, sounds, and
+   * just about any other document.  Make sure to set the $type to an
+   * image type.  For JPEG images use "image/jpeg" and for GIF images
+   * use "image/gif".
+   * @param string $path Path to the attachment.
+   * @param string $cid Content ID of the attachment.  Use this to identify
+   *        the Id for accessing the image in an HTML form.
+   * @param string $name Overrides the attachment name.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return bool
+   */
+  function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+
+    if(!@is_file($path)) {
+      $this->SetError($this->Lang('file_access') . $path);
+      return false;
+    }
+
+    $filename = basename($path);
+    if($name == '') {
+      $name = $filename;
+    }
+
+    /* Append to $attachment array */
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $path;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $name;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = false;
+    $this->attachment[$cur][6] = 'inline';
+    $this->attachment[$cur][7] = $cid;
+
+    return true;
+  }
+
+  /**
+   * Returns true if an inline attachment is present.
+   * @access private
+   * @return bool
+   */
+  function InlineImageExists() {
+    $result = false;
+    for($i = 0; $i < count($this->attachment); $i++) {
+      if($this->attachment[$i][6] == 'inline') {
+        $result = true;
+        break;
+      }
+    }
 
-        $filename = basename($path);
-        if($name == "")
-            $name = $filename;
-
-        // Append to $attachment array
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $path;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $name;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = false; // isStringAttachment
-        $this->attachment[$cur][6] = "inline";
-        $this->attachment[$cur][7] = $cid;
-    
-        return true;
-    }
-    
-    /**
-     * Returns true if an inline attachment is present.
-     * @access private
-     * @return bool
-     */
-    function InlineImageExists() {
-        $result = false;
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            if($this->attachment[$i][6] == "inline")
-            {
-                $result = true;
-                break;
-            }
-        }
-        
-        return $result;
+    return $result;
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, MESSAGE RESET
+  /////////////////////////////////////////////////
+
+  /**
+   * Clears all recipients assigned in the TO array.  Returns void.
+   * @return void
+   */
+  function ClearAddresses() {
+    $this->to = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the CC array.  Returns void.
+   * @return void
+   */
+  function ClearCCs() {
+    $this->cc = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the BCC array.  Returns void.
+   * @return void
+   */
+  function ClearBCCs() {
+    $this->bcc = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the ReplyTo array.  Returns void.
+   * @return void
+   */
+  function ClearReplyTos() {
+    $this->ReplyTo = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the TO, CC and BCC
+   * array.  Returns void.
+   * @return void
+   */
+  function ClearAllRecipients() {
+    $this->to = array();
+    $this->cc = array();
+    $this->bcc = array();
+  }
+
+  /**
+   * Clears all previously set filesystem, string, and binary
+   * attachments.  Returns void.
+   * @return void
+   */
+  function ClearAttachments() {
+    $this->attachment = array();
+  }
+
+  /**
+   * Clears all custom headers.  Returns void.
+   * @return void
+   */
+  function ClearCustomHeaders() {
+    $this->CustomHeader = array();
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, MISCELLANEOUS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds the error message to the error container.
+   * Returns void.
+   * @access private
+   * @return void
+   */
+  function SetError($msg) {
+    $this->error_count++;
+    $this->ErrorInfo = $msg;
+  }
+
+  /**
+   * Returns the proper RFC 822 formatted date.
+   * @access private
+   * @return string
+   */
+  function RFCDate() {
+    $tz = date('Z');
+    $tzs = ($tz < 0) ? '-' : '+';
+    $tz = abs($tz);
+    $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
+    $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
+
+    return $result;
+  }
+
+  /**
+   * Returns the appropriate server variable.  Should work with both
+   * PHP 4.1.0+ as well as older versions.  Returns an empty string
+   * if nothing is found.
+   * @access private
+   * @return mixed
+   */
+  function ServerVar($varName) {
+    global $HTTP_SERVER_VARS;
+    global $HTTP_ENV_VARS;
+
+    if(!isset($_SERVER)) {
+      $_SERVER = $HTTP_SERVER_VARS;
+      if(!isset($_SERVER['REMOTE_ADDR'])) {
+        $_SERVER = $HTTP_ENV_VARS; // must be Apache
+      }
     }
 
-    /////////////////////////////////////////////////
-    // MESSAGE RESET METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Clears all recipients assigned in the TO array.  Returns void.
-     * @return void
-     */
-    function ClearAddresses() {
-        $this->to = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the CC array.  Returns void.
-     * @return void
-     */
-    function ClearCCs() {
-        $this->cc = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the BCC array.  Returns void.
-     * @return void
-     */
-    function ClearBCCs() {
-        $this->bcc = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the ReplyTo array.  Returns void.
-     * @return void
-     */
-    function ClearReplyTos() {
-        $this->ReplyTo = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the TO, CC and BCC
-     * array.  Returns void.
-     * @return void
-     */
-    function ClearAllRecipients() {
-        $this->to = array();
-        $this->cc = array();
-        $this->bcc = array();
-    }
-
-    /**
-     * Clears all previously set filesystem, string, and binary
-     * attachments.  Returns void.
-     * @return void
-     */
-    function ClearAttachments() {
-        $this->attachment = array();
-    }
-
-    /**
-     * Clears all custom headers.  Returns void.
-     * @return void
-     */
-    function ClearCustomHeaders() {
-        $this->CustomHeader = array();
-    }
-
-
-    /////////////////////////////////////////////////
-    // MISCELLANEOUS METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds the error message to the error container.
-     * Returns void.
-     * @access private
-     * @return void
-     */
-    function SetError($msg) {
-        $this->error_count++;
-        $this->ErrorInfo = $msg;
-    }
-
-    /**
-     * Returns the proper RFC 822 formatted date. 
-     * @access private
-     * @return string
-     */
-    function RFCDate() {
-        $tz = date("Z");
-        $tzs = ($tz < 0) ? "-" : "+";
-        $tz = abs($tz);
-        $tz = ($tz/3600)*100 + ($tz%3600)/60;
-        $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
-
-        return $result;
-    }
-    
-    /**
-     * Returns the appropriate server variable.  Should work with both 
-     * PHP 4.1.0+ as well as older versions.  Returns an empty string 
-     * if nothing is found.
-     * @access private
-     * @return mixed
-     */
-    function ServerVar($varName) {
-        global $HTTP_SERVER_VARS;
-        global $HTTP_ENV_VARS;
-
-        if(!isset($_SERVER))
-        {
-            $_SERVER = $HTTP_SERVER_VARS;
-            if(!isset($_SERVER["REMOTE_ADDR"]))
-                $_SERVER = $HTTP_ENV_VARS; // must be Apache
-        }
-        
-        if(isset($_SERVER[$varName]))
-            return $_SERVER[$varName];
-        else
-            return "";
-    }
-
-    /**
-     * Returns the server hostname or 'localhost.localdomain' if unknown.
-     * @access private
-     * @return string
-     */
-    function ServerHostname() {
-        if ($this->Hostname != "")
-            $result = $this->Hostname;
-        elseif ($this->ServerVar('SERVER_NAME') != "")
-            $result = $this->ServerVar('SERVER_NAME');
-        else
-            $result = "localhost.localdomain";
-
-        return $result;
-    }
-
-    /**
-     * Returns a message in the appropriate language.
-     * @access private
-     * @return string
-     */
-    function Lang($key) {
-        if(count($this->language) < 1)
-            $this->SetLanguage("en"); // set the default language
-    
-        if(isset($this->language[$key]))
-            return $this->language[$key];
-        else
-            return "Language string failed to load: " . $key;
-    }
-    
-    /**
-     * Returns true if an error occurred.
-     * @return bool
-     */
-    function IsError() {
-        return ($this->error_count > 0);
-    }
-
-    /**
-     * Changes every end of line from CR or LF to CRLF.  
-     * @access private
-     * @return string
-     */
-    function FixEOL($str) {
-        $str = str_replace("\r\n", "\n", $str);
-        $str = str_replace("\r", "\n", $str);
-        $str = str_replace("\n", $this->LE, $str);
-        return $str;
-    }
-
-    /**
-     * Adds a custom header. 
-     * @return void
-     */
-    function AddCustomHeader($custom_header) {
-        $this->CustomHeader[] = explode(":", $custom_header, 2);
+    if(isset($_SERVER[$varName])) {
+      return $_SERVER[$varName];
+    } else {
+      return '';
+    }
+  }
+
+  /**
+   * Returns the server hostname or 'localhost.localdomain' if unknown.
+   * @access private
+   * @return string
+   */
+  function ServerHostname() {
+    if ($this->Hostname != '') {
+      $result = $this->Hostname;
+    } elseif ($this->ServerVar('SERVER_NAME') != '') {
+      $result = $this->ServerVar('SERVER_NAME');
+    } else {
+      $result = 'localhost.localdomain';
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns a message in the appropriate language.
+   * @access private
+   * @return string
+   */
+  function Lang($key) {
+    if(count($this->language) < 1) {
+      $this->SetLanguage('en'); // set the default language
+    }
+
+    if(isset($this->language[$key])) {
+      return $this->language[$key];
+    } else {
+      return 'Language string failed to load: ' . $key;
+    }
+  }
+
+  /**
+   * Returns true if an error occurred.
+   * @return bool
+   */
+  function IsError() {
+    return ($this->error_count > 0);
+  }
+
+  /**
+   * Changes every end of line from CR or LF to CRLF.
+   * @access private
+   * @return string
+   */
+  function FixEOL($str) {
+    $str = str_replace("\r\n", "\n", $str);
+    $str = str_replace("\r", "\n", $str);
+    $str = str_replace("\n", $this->LE, $str);
+    return $str;
+  }
+
+  /**
+   * Adds a custom header.
+   * @return void
+   */
+  function AddCustomHeader($custom_header) {
+    $this->CustomHeader[] = explode(':', $custom_header, 2);
+  }
+
+  /**
+   * Evaluates the message and returns modifications for inline images and backgrounds
+   * @access public
+   * @return $message
+   */
+  function MsgHTML($message) {
+    preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
+    if(isset($images[2])) {
+      foreach($images[2] as $i => $url) {
+        $filename  = basename($url);
+        $directory = dirname($url);
+        $cid       = 'cid:' . md5($filename);
+        $fileParts = split("\.", $filename);
+        $ext       = $fileParts[1];
+        $mimeType  = $this->_mime_types($ext);
+        $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
+        $this->AddEmbeddedImage($url, md5($filename), $filename, 'base64', $mimeType);
+      }
     }
+    $this->IsHTML(true);
+    $this->Body = $message;
+    $textMsg = trim(strip_tags($message));
+    if ( !empty($textMsg) && empty($this->AltBody) ) {
+      $this->AltBody = $textMsg;
+    }
+    if ( empty($this->AltBody) ) {
+      $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
+    }
+  }
+
+  /**
+   * Gets the mime type of the embedded or inline image
+   * @access private
+   * @return mime type of ext
+   */
+  function _mime_types($ext = '') {
+    $mimes = array(
+      'hqx'  =>  'application/mac-binhex40',
+      'cpt'   =>  'application/mac-compactpro',
+      'doc'   =>  'application/msword',
+      'bin'   =>  'application/macbinary',
+      'dms'   =>  'application/octet-stream',
+      'lha'   =>  'application/octet-stream',
+      'lzh'   =>  'application/octet-stream',
+      'exe'   =>  'application/octet-stream',
+      'class' =>  'application/octet-stream',
+      'psd'   =>  'application/octet-stream',
+      'so'    =>  'application/octet-stream',
+      'sea'   =>  'application/octet-stream',
+      'dll'   =>  'application/octet-stream',
+      'oda'   =>  'application/oda',
+      'pdf'   =>  'application/pdf',
+      'ai'    =>  'application/postscript',
+      'eps'   =>  'application/postscript',
+      'ps'    =>  'application/postscript',
+      'smi'   =>  'application/smil',
+      'smil'  =>  'application/smil',
+      'mif'   =>  'application/vnd.mif',
+      'xls'   =>  'application/vnd.ms-excel',
+      'ppt'   =>  'application/vnd.ms-powerpoint',
+      'wbxml' =>  'application/vnd.wap.wbxml',
+      'wmlc'  =>  'application/vnd.wap.wmlc',
+      'dcr'   =>  'application/x-director',
+      'dir'   =>  'application/x-director',
+      'dxr'   =>  'application/x-director',
+      'dvi'   =>  'application/x-dvi',
+      'gtar'  =>  'application/x-gtar',
+      'php'   =>  'application/x-httpd-php',
+      'php4'  =>  'application/x-httpd-php',
+      'php3'  =>  'application/x-httpd-php',
+      'phtml' =>  'application/x-httpd-php',
+      'phps'  =>  'application/x-httpd-php-source',
+      'js'    =>  'application/x-javascript',
+      'swf'   =>  'application/x-shockwave-flash',
+      'sit'   =>  'application/x-stuffit',
+      'tar'   =>  'application/x-tar',
+      'tgz'   =>  'application/x-tar',
+      'xhtml' =>  'application/xhtml+xml',
+      'xht'   =>  'application/xhtml+xml',
+      'zip'   =>  'application/zip',
+      'mid'   =>  'audio/midi',
+      'midi'  =>  'audio/midi',
+      'mpga'  =>  'audio/mpeg',
+      'mp2'   =>  'audio/mpeg',
+      'mp3'   =>  'audio/mpeg',
+      'aif'   =>  'audio/x-aiff',
+      'aiff'  =>  'audio/x-aiff',
+      'aifc'  =>  'audio/x-aiff',
+      'ram'   =>  'audio/x-pn-realaudio',
+      'rm'    =>  'audio/x-pn-realaudio',
+      'rpm'   =>  'audio/x-pn-realaudio-plugin',
+      'ra'    =>  'audio/x-realaudio',
+      'rv'    =>  'video/vnd.rn-realvideo',
+      'wav'   =>  'audio/x-wav',
+      'bmp'   =>  'image/bmp',
+      'gif'   =>  'image/gif',
+      'jpeg'  =>  'image/jpeg',
+      'jpg'   =>  'image/jpeg',
+      'jpe'   =>  'image/jpeg',
+      'png'   =>  'image/png',
+      'tiff'  =>  'image/tiff',
+      'tif'   =>  'image/tiff',
+      'css'   =>  'text/css',
+      'html'  =>  'text/html',
+      'htm'   =>  'text/html',
+      'shtml' =>  'text/html',
+      'txt'   =>  'text/plain',
+      'text'  =>  'text/plain',
+      'log'   =>  'text/plain',
+      'rtx'   =>  'text/richtext',
+      'rtf'   =>  'text/rtf',
+      'xml'   =>  'text/xml',
+      'xsl'   =>  'text/xml',
+      'mpeg'  =>  'video/mpeg',
+      'mpg'   =>  'video/mpeg',
+      'mpe'   =>  'video/mpeg',
+      'qt'    =>  'video/quicktime',
+      'mov'   =>  'video/quicktime',
+      'avi'   =>  'video/x-msvideo',
+      'movie' =>  'video/x-sgi-movie',
+      'doc'   =>  'application/msword',
+      'word'  =>  'application/msword',
+      'xl'    =>  'application/excel',
+      'eml'   =>  'message/rfc822'
+    );
+    return ( ! isset($mimes[strtolower($ext)])) ? 'application/x-unknown-content-type' : $mimes[strtolower($ext)];
+  }
+
+  /**
+   * Set (or reset) Class Objects (variables)
+   *
+   * Usage Example:
+   * $page->set('X-Priority', '3');
+   *
+   * @access public
+   * @param string $name Parameter Name
+   * @param mixed $value Parameter Value
+   * NOTE: will not work with arrays, there are no arrays to set/reset
+   */
+  function set ( $name, $value = '' ) {
+    if ( isset($this->$name) ) {
+      $this->$name = $value;
+    } else {
+      $this->SetError('Cannot set or reset variable ' . $name);
+      return false;
+    }
+  }
+
+  /**
+   * Read a file from a supplied filename and return it.
+   *
+   * @access public
+   * @param string $filename Parameter File Name
+   */
+  function getFile($filename) {
+    $return = '';
+    if ($fp = fopen($filename, 'rb')) {
+      while (!feof($fp)) {
+        $return .= fread($fp, 1024);
+      }
+      fclose($fp);
+      return $return;
+    } else {
+      return false;
+    }
+  }
+
+  /**
+   * Strips newlines to prevent header injection.
+   * @access private
+   * @param string $str String
+   * @return string
+   */
+  function SecureHeader($str) {
+    $str = trim($str);
+    $str = str_replace("\r", "", $str);
+    $str = str_replace("\n", "", $str);
+    return $str;
+  }
+
 }
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/phpmailer/class.pop3.php 0.7.11.src/e107_handlers/phpmailer/class.pop3.php
--- 0.7.7.src/e107_handlers/phpmailer/class.pop3.php	2006-08-10 11:11:50.000000000 -0500
+++ 0.7.11.src/e107_handlers/phpmailer/class.pop3.php	2007-12-07 13:59:16.000000000 -0600
@@ -1,224 +1,273 @@
 <?php
-/*
-	POP Before SMTP Authentication Class
-	Version 1.0
-
-	Author: Richard Davey (rich@corephp.co.uk)
-	License: LGPL, see PHPMailer License
-	
-	Specifically for PHPMailer to allow POP before SMTP authentication.
-	Does not yet work with APOP - if you have an APOP account, contact me
-	and we can test changes to this script.
-	
-	This class is based on the structure of the SMTP class by Chris Ryan
-
-	This class is rfc 1939 compliant and implements all the commands
-	required for POP3 connection, authentication and disconnection.
-	
-	@package PHPMailer
-	@author Richard Davey
-*/
+/*~ class.pop3.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.0 rc2                                                      |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
+
+/**
+ * POP Before SMTP Authentication Class
+ * Version 1.0
+ *
+ * Author: Richard Davey (rich@corephp.co.uk)
+ * License: LGPL, see PHPMailer License
+ *
+ * Specifically for PHPMailer to allow POP before SMTP authentication.
+ * Does not yet work with APOP - if you have an APOP account, contact me
+ * and we can test changes to this script.
+ *
+ * This class is based on the structure of the SMTP class by Chris Ryan
+ *
+ * This class is rfc 1939 compliant and implements all the commands
+ * required for POP3 connection, authentication and disconnection.
+ *
+ * @package PHPMailer
+ * @author Richard Davey
+ */
 
 class POP3
 {
-	//	Default POP3 port
-	var $POP3_PORT = 110;
+  /**
+   * Default POP3 port
+   * @var int
+   */
+  var $POP3_PORT = 110;
+
+  /**
+   * Default Timeout
+   * @var int
+   */
+  var $POP3_TIMEOUT = 30;
+
+  /**
+   * POP3 Carriage Return + Line Feed
+   * @var string
+   */
+  var $CRLF = "\r\n";
+
+  /**
+   * Displaying Debug warnings? (0 = now, 1+ = yes)
+   * @var int
+   */
+  var $do_debug = 2;
+
+  /**
+   * POP3 Mail Server
+   * @var string
+   */
+  var $host;
+
+  /**
+   * POP3 Port
+   * @var int
+   */
+  var $port;
+
+  /**
+   * POP3 Timeout Value
+   * @var int
+   */
+  var $tval;
+
+  /**
+   * POP3 Username
+   * @var string
+   */
+  var $username;
+
+  /**
+   * POP3 Password
+   * @var string
+   */
+  var $password;
+
+  /**#@+
+   * @access private
+   */
+  var $pop_conn;
+  var $connected;
+  var $error;     //  Error log array
+  /**#@-*/
+
+  /**
+   * Constructor, sets the initial values
+   *
+   * @return POP3
+   */
+  function POP3 ()
+    {
+      $this->pop_conn = 0;
+      $this->connected = false;
+      $this->error = null;
+    }
+
+  /**
+   * Combination of public events - connect, login, disconnect
+   *
+   * @param string $host
+   * @param integer $port
+   * @param integer $tval
+   * @param string $username
+   * @param string $password
+   */
+  function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0)
+  {
+    $this->host = $host;
+
+    //  If no port value is passed, retrieve it
+    if ($port == false)
+    {
+      $this->port = $this->POP3_PORT;
+    }
+    else
+    {
+      $this->port = $port;
+    }
+
+    //  If no port value is passed, retrieve it
+    if ($tval == false)
+    {
+      $this->tval = $this->POP3_TIMEOUT;
+    }
+    else
+    {
+      $this->tval = $tval;
+    }
 
-	//	Default Timeout
-	var $POP3_TIMEOUT = 30;
+    $this->do_debug = $debug_level;
+    $this->username = $username;
+    $this->password = $password;
 
-	//	Carriage Return + Line Feed
-	var $CRLF = "\r\n";
+    //  Refresh the error log
+      $this->error = null;
 
-	//	Displaying Debug warnings? (0 = now, 1+ = yes)
-	var $do_debug = 2;
-
-	//	Socket connection resource handle
-	var $pop_conn;
-	
-	//	Boolean state of connection
-	var $connected;
-	
-	//	Error log array
-	var $error;
-	
-	//	POP3 Server Connection Required values
-
-	//	Mail Server
-	var $host;
-
-	//	Port
-	var $port;
-	
-	//	Timeout Value
-	var $tval;
-	
-	//	POP3 Username
-	var $username;
-	
-	//	POP3 Password
-	var $password;
-	
-	/**
-	 * Our constructor, sets the initial values
-	 *
-	 * @return POP3
-	 */
-	function POP3 ()
-    {
-    	$this->pop_conn = 0;
-    	$this->connected = false;
-    	$this->error = null;
-    }
-    
-	/**
-	 * Combination of public events - connect, login, disconnect
-	 *
-	 * @param string $host
-	 * @param integer $port
-	 * @param integer $tval
-	 * @param string $username
-	 * @param string $password
-	 */
-	function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0)
-	{
-		$this->host = $host;
-
-		//	If no port value is passed, retrieve it
-		if ($port == false)
-		{
-			$this->port = $this->POP3_PORT;
-		}
-		else
-		{
-			$this->port = $port;
-		}
-		
-		//	If no port value is passed, retrieve it
-		if ($tval == false)
-		{
-			$this->tval = $this->POP3_TIMEOUT;
-		}
-		else
-		{
-			$this->tval = $tval;
-		}
-
-		$this->do_debug = $debug_level;
-		$this->username = $username;
-		$this->password = $password;
-		
-		//	Refresh the error log
-    	$this->error = null;
-
-    	//	Connect
-		$result = $this->Connect($this->host, $this->port, $this->tval);
-		
-		if ($result)
-		{
-			$login_result = $this->Login($this->username, $this->password);
-			
-			if ($login_result)
-			{
-				$this->Disconnect();
-				
-				return true;
-			}
-			
-		}
-		
-		//	We need to disconnect regardless if the login succeeded
-		$this->Disconnect();
-		
-		return false;
-	}
-	
-	/**
-	 * Connect to the POP3 server
-	 *
-	 * @param string $host
-	 * @param integer $port
-	 * @param integer $tval
-	 * @return boolean
-	 */
-	function Connect ($host, $port = false, $tval = 30)
-    {
-		//	Are we already connected?
-		if ($this->connected)
-		{
-			return true;
-		}
-		
-		/*
-			On Windows this will raise a PHP Warning error if the hostname doesn't exist.
-			Rather than supress it with @fsockopen, let's capture it cleanly instead
-		*/
-			
-		set_error_handler(array(&$this, 'catchWarning'));
-		
-		//	Connect to the POP3 server
-		$this->pop_conn = fsockopen($host,		//	POP3 Host
-									$port,		//	Port #
-									$errno,		//	Error Number
-									$errstr,	//	Error Message
-									$tval);		//	Timeout (seconds)
-    	
-		//	Restore the error handler
-		restore_error_handler();
-		
-		//	Does the Error Log now contain anything?
-		if ($this->error && $this->do_debug >= 1)
-		{
-   			$this->displayErrors();
-		}
-										
-		//	Did we connect?
-    	if ($this->pop_conn == false)
-    	{
-    		//	It would appear not...
-    		$this->error = array(
-    			'error' => "Failed to connect to server $host on port $port",
-    			'errno' => $errno,
-    			'errstr' => $errstr
-    		);
-    		
-    		if ($this->do_debug >= 1)
-    		{
-    			$this->displayErrors();
-    		}
-    		
-    		return false;
-    	}
-    	
-    	//	Increase the stream time-out
-
-    	//	Check for PHP 4.3.0 or later
-    	if (version_compare(phpversion(), '4.3.0', 'ge'))
-    	{
-    		stream_set_timeout($this->pop_conn, $tval, 0);
-    	}
-    	else
-    	{
-    		//	Does not work on Windows
-    		if (substr(PHP_OS, 0, 3) !== 'WIN')
-    		{
-    			socket_set_timeout($this->pop_conn, $tval, 0);
-    		}
-    	}
-    	
-		//	Get the POP3 server response
-    	$pop3_response = $this->getResponse();
-    	
-    	//	Check for the +OK
-    	if ($this->checkResponse($pop3_response))
-    	{
-			//	The connection is established and the POP3 server is talking
-			$this->connected = true;
-    		return true;
-    	}
+      //  Connect
+    $result = $this->Connect($this->host, $this->port, $this->tval);
 
+    if ($result)
+    {
+      $login_result = $this->Login($this->username, $this->password);
+
+      if ($login_result)
+      {
+        $this->Disconnect();
+
+        return true;
+      }
+
+    }
+
+    //  We need to disconnect regardless if the login succeeded
+    $this->Disconnect();
+
+    return false;
+  }
+
+  /**
+   * Connect to the POP3 server
+   *
+   * @param string $host
+   * @param integer $port
+   * @param integer $tval
+   * @return boolean
+   */
+  function Connect ($host, $port = false, $tval = 30)
+    {
+    //  Are we already connected?
+    if ($this->connected)
+    {
+      return true;
     }
-    
+
+    /*
+      On Windows this will raise a PHP Warning error if the hostname doesn't exist.
+      Rather than supress it with @fsockopen, let's capture it cleanly instead
+    */
+
+    set_error_handler(array(&$this, 'catchWarning'));
+
+    //  Connect to the POP3 server
+    $this->pop_conn = fsockopen($host,    //  POP3 Host
+                  $port,    //  Port #
+                  $errno,   //  Error Number
+                  $errstr,  //  Error Message
+                  $tval);   //  Timeout (seconds)
+
+    //  Restore the error handler
+    restore_error_handler();
+
+    //  Does the Error Log now contain anything?
+    if ($this->error && $this->do_debug >= 1)
+    {
+        $this->displayErrors();
+    }
+
+    //  Did we connect?
+      if ($this->pop_conn == false)
+      {
+        //  It would appear not...
+        $this->error = array(
+          'error' => "Failed to connect to server $host on port $port",
+          'errno' => $errno,
+          'errstr' => $errstr
+        );
+
+        if ($this->do_debug >= 1)
+        {
+          $this->displayErrors();
+        }
+
+        return false;
+      }
+
+      //  Increase the stream time-out
+
+      //  Check for PHP 4.3.0 or later
+      if (version_compare(phpversion(), '4.3.0', 'ge'))
+      {
+        stream_set_timeout($this->pop_conn, $tval, 0);
+      }
+      else
+      {
+        //  Does not work on Windows
+        if (substr(PHP_OS, 0, 3) !== 'WIN')
+        {
+          socket_set_timeout($this->pop_conn, $tval, 0);
+        }
+      }
+
+    //  Get the POP3 server response
+      $pop3_response = $this->getResponse();
+
+      //  Check for the +OK
+      if ($this->checkResponse($pop3_response))
+      {
+      //  The connection is established and the POP3 server is talking
+      $this->connected = true;
+        return true;
+      }
+
+    }
+
     /**
      * Login to the POP3 server (does not support APOP yet)
      *
@@ -228,71 +277,70 @@
      */
     function Login ($username = '', $password = '')
     {
-    	if ($this->connected == false)
-    	{
-    		$this->error = 'Not connected to POP3 server';
-
-    		if ($this->do_debug >= 1)
-    		{
-    			$this->displayErrors();
-    		}
-    	}
-    	
-    	if (empty($username))
-    	{
-    		$username = $this->username;
-    	}
-    	
-    	if (empty($password))
-    	{
-    		$password = $this->password;
-    	}
-    	
-		$pop_username = "USER $username" . $this->CRLF;
-		$pop_password = "PASS $password" . $this->CRLF;
-    	
-    	//	Send the Username
-    	$this->sendString($pop_username);
-    	$pop3_response = $this->getResponse();
-    	
-    	if ($this->checkResponse($pop3_response))
-    	{
-    		//	Send the Password
-    		$this->sendString($pop_password);
-	    	$pop3_response = $this->getResponse();
-
-	    	if ($this->checkResponse($pop3_response))
-	    	{
-	    		return true;
-	    	}
-	    	else
-	    	{
-	    		return false;
-	    	}
-    	}
-    	else
-    	{
-    		return false;
-    	}
+      if ($this->connected == false)
+      {
+        $this->error = 'Not connected to POP3 server';
+
+        if ($this->do_debug >= 1)
+        {
+          $this->displayErrors();
+        }
+      }
+
+      if (empty($username))
+      {
+        $username = $this->username;
+      }
+
+      if (empty($password))
+      {
+        $password = $this->password;
+      }
+
+    $pop_username = "USER $username" . $this->CRLF;
+    $pop_password = "PASS $password" . $this->CRLF;
+
+      //  Send the Username
+      $this->sendString($pop_username);
+      $pop3_response = $this->getResponse();
+
+      if ($this->checkResponse($pop3_response))
+      {
+        //  Send the Password
+        $this->sendString($pop_password);
+        $pop3_response = $this->getResponse();
+
+        if ($this->checkResponse($pop3_response))
+        {
+          return true;
+        }
+        else
+        {
+          return false;
+        }
+      }
+      else
+      {
+        return false;
+      }
     }
-    
+
     /**
      * Disconnect from the POP3 server
-     *
      */
     function Disconnect ()
     {
-    	$this->sendString('QUIT');
+      $this->sendString('QUIT');
 
-    	fclose($this->pop_conn);
+      fclose($this->pop_conn);
     }
 
     /*
-    	---------------
-    	Private Methods
-    	---------------
+      ---------------
+      Private Methods
+      ---------------
     */
-    
+
     /**
      * Get the socket response back.
      * $size is the maximum number of bytes to retrieve
@@ -302,9 +350,9 @@
      */
     function getResponse ($size = 128)
     {
-    	$pop3_response = fgets($this->pop_conn, $size);
+      $pop3_response = fgets($this->pop_conn, $size);
 
-    	return $pop3_response;
+      return $pop3_response;
     }
 
     /**
@@ -315,12 +363,12 @@
      */
     function sendString ($string)
     {
-    	$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
-    	
-    	return $bytes_sent;
-    	
+      $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
+
+      return $bytes_sent;
+
     }
-    
+
     /**
      * Checks the POP3 server response for +OK or -ERR
      *
@@ -329,61 +377,61 @@
      */
     function checkResponse ($string)
     {
-    	if (substr($string, 0, 3) !== '+OK')
-    	{
-    		$this->error = array(
-    			'error' => "Server reported an error: $string",
-    			'errno' => 0,
-    			'errstr' => ''
-    		);
-
-    		if ($this->do_debug >= 1)
-    		{
-    			$this->displayErrors();
-    		}
-    		
-    		return false;
-    	}
-    	else
-    	{
-    		return true;
-    	}
-    	
+      if (substr($string, 0, 3) !== '+OK')
+      {
+        $this->error = array(
+          'error' => "Server reported an error: $string",
+          'errno' => 0,
+          'errstr' => ''
+        );
+
+        if ($this->do_debug >= 1)
+        {
+          $this->displayErrors();
+        }
+
+        return false;
+      }
+      else
+      {
+        return true;
+      }
+
     }
-    
+
     /**
      * If debug is enabled, display the error message array
      *
      */
     function displayErrors ()
     {
-    	echo '<pre>';
+      echo '<pre>';
+
+      foreach ($this->error as $single_error)
+    {
+        print_r($single_error);
+    }
+
+      echo '</pre>';
+    }
 
-    	foreach ($this->error as $single_error)
-		{
-	    	print_r($single_error);
-		}
-		
-    	echo '</pre>';
-    }
-
-	/**
-	 * Takes over from PHP for the socket warning handler
-	 *
-	 * @param integer $errno
-	 * @param string $errstr
-	 * @param string $errfile
-	 * @param integer $errline
-	 */
-	function catchWarning ($errno, $errstr, $errfile, $errline)
-	{
-		$this->error[] = array(
-			'error' => "Connecting to the POP3 server raised a PHP warning: ",
-			'errno' => $errno,
-			'errstr' => $errstr
-		);
-	}
+  /**
+   * Takes over from PHP for the socket warning handler
+   *
+   * @param integer $errno
+   * @param string $errstr
+   * @param string $errfile
+   * @param integer $errline
+   */
+  function catchWarning ($errno, $errstr, $errfile, $errline)
+  {
+    $this->error[] = array(
+      'error' => "Connecting to the POP3 server raised a PHP warning: ",
+      'errno' => $errno,
+      'errstr' => $errstr
+    );
+  }
 
-//	End of class
+  //  End of class
 }
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/phpmailer/class.smtp.php 0.7.11.src/e107_handlers/phpmailer/class.smtp.php
--- 0.7.7.src/e107_handlers/phpmailer/class.smtp.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_handlers/phpmailer/class.smtp.php	2007-12-07 13:59:16.000000000 -0600
@@ -1,17 +1,28 @@
 <?php
-////////////////////////////////////////////////////
-// SMTP - PHP SMTP class
-//
-// Version 1.02
-//
-// Define an SMTP class that can be used to connect
-// and communicate with any SMTP server. It implements
-// all the SMTP functions defined in RFC821 except TURN.
-//
-// Author: Chris Ryan
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
+/*~ class.smtp.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.0 rc1                                                      |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
 
 /**
  * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
@@ -21,1023 +32,1029 @@
  * @package PHPMailer
  * @author Chris Ryan
  */
+
 class SMTP
 {
-    /**
-     *  SMTP server port
-     *  @var int
-     */
-    var $SMTP_PORT = 25;
-    
-    /**
-     *  SMTP reply line ending
-     *  @var string
-     */
-    var $CRLF = "\r\n";
-    
-    /**
-     *  Sets whether debugging is turned on
-     *  @var bool
-     */
-    var $do_debug;       # the level of debug to perform
-
-    /**#@+
-     * @access private
-     */
-    var $smtp_conn;      # the socket to the server
-    var $error;          # error if any on the last call
-    var $helo_rply;      # the reply the server sent to us for HELO
-    /**#@-*/
-
-    /**
-     * Initialize the class so that the data is in a known state.
-     * @access public
-     * @return void
-     */
-    function SMTP() {
-        $this->smtp_conn = 0;
-        $this->error = null;
-        $this->helo_rply = null;
-
-        $this->do_debug = 0;
-    }
-
-    /*************************************************************
-     *                    CONNECTION FUNCTIONS                  *
-     ***********************************************************/
-
-    /**
-     * Connect to the server specified on the port specified.
-     * If the port is not specified use the default SMTP_PORT.
-     * If tval is specified then a connection will try and be
-     * established with the server for that number of seconds.
-     * If tval is not specified the default is 30 seconds to
-     * try on the connection.
-     *
-     * SMTP CODE SUCCESS: 220
-     * SMTP CODE FAILURE: 421
-     * @access public
-     * @return bool
-     */
-    function Connect($host,$port=0,$tval=30) {
-        # set the error val to null so there is no confusion
-        $this->error = null;
-
-        # make sure we are __not__ connected
-        if($this->connected()) {
-            # ok we are connected! what should we do?
-            # for now we will just give an error saying we
-            # are already connected
-            $this->error =
-                array("error" => "Already connected to a server");
-            return false;
-        }
-
-        if(empty($port)) {
-            $port = $this->SMTP_PORT;
-        }
-
-        #connect to the smtp server
-        $this->smtp_conn = fsockopen($host,    # the host of the server
-                                     $port,    # the port to use
-                                     $errno,   # error number if any
-                                     $errstr,  # error message if any
-                                     $tval);   # give up after ? secs
-        # verify we connected properly
-        if(empty($this->smtp_conn)) {
-            $this->error = array("error" => "Failed to connect to server",
-                                 "errno" => $errno,
-                                 "errstr" => $errstr);
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": $errstr ($errno)" . $this->CRLF;
-            }
-            return false;
-        }
-
-        # sometimes the SMTP server takes a little longer to respond
-        # so we will give it a longer timeout for the first read
-        // Windows still does not have support for this timeout function
-        if(substr(PHP_OS, 0, 3) != "WIN")
-           socket_set_timeout($this->smtp_conn, $tval, 0);
-
-        # get any announcement stuff
-        $announce = $this->get_lines();
-
-        # set the timeout  of any socket functions at 1/10 of a second
-        //if(function_exists("socket_set_timeout"))
-        //   socket_set_timeout($this->smtp_conn, 0, 100000);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
-        }
-
-        return true;
-    }
-
-    /**
-     * Performs SMTP authentication.  Must be run after running the
-     * Hello() method.  Returns true if successfully authenticated.
-     * @access public
-     * @return bool
-     */
-    function Authenticate($username, $password) {
-        // Start authentication
-        fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 334) {
-            $this->error =
-                array("error" => "AUTH not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        // Send encoded username
-        fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 334) {
-            $this->error =
-                array("error" => "Username not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        // Send encoded password
-        fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 235) {
-            $this->error =
-                array("error" => "Password not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Returns true if connected to a server otherwise false
-     * @access private
-     * @return bool
-     */
-    function Connected() {
-        if(!empty($this->smtp_conn)) {
-            $sock_status = socket_get_status($this->smtp_conn);
-            if($sock_status["eof"]) {
-                # hmm this is an odd situation... the socket is
-                # valid but we aren't connected anymore
-                if($this->do_debug >= 1) {
-                    echo "SMTP -> NOTICE:" . $this->CRLF .
-                         "EOF caught while checking if connected";
-                }
-                $this->Close();
-                return false;
-            }
-            return true; # everything looks good
+  /**
+   *  SMTP server port
+   *  @var int
+   */
+  var $SMTP_PORT = 25;
+
+  /**
+   *  SMTP reply line ending
+   *  @var string
+   */
+  var $CRLF = "\r\n";
+
+  /**
+   *  Sets whether debugging is turned on
+   *  @var bool
+   */
+  var $do_debug;       # the level of debug to perform
+
+  /**
+   *  Sets VERP use on/off (default is off)
+   *  @var bool
+   */
+  var $do_verp = false;
+
+  /**#@+
+   * @access private
+   */
+  var $smtp_conn;      # the socket to the server
+  var $error;          # error if any on the last call
+  var $helo_rply;      # the reply the server sent to us for HELO
+  /**#@-*/
+
+  /**
+   * Initialize the class so that the data is in a known state.
+   * @access public
+   * @return void
+   */
+  function SMTP() {
+    $this->smtp_conn = 0;
+    $this->error = null;
+    $this->helo_rply = null;
+
+    $this->do_debug = 0;
+  }
+
+  /*************************************************************
+   *                    CONNECTION FUNCTIONS                  *
+   ***********************************************************/
+
+  /**
+   * Connect to the server specified on the port specified.
+   * If the port is not specified use the default SMTP_PORT.
+   * If tval is specified then a connection will try and be
+   * established with the server for that number of seconds.
+   * If tval is not specified the default is 30 seconds to
+   * try on the connection.
+   *
+   * SMTP CODE SUCCESS: 220
+   * SMTP CODE FAILURE: 421
+   * @access public
+   * @return bool
+   */
+  function Connect($host,$port=0,$tval=30) {
+    # set the error val to null so there is no confusion
+    $this->error = null;
+
+    # make sure we are __not__ connected
+    if($this->connected()) {
+      # ok we are connected! what should we do?
+      # for now we will just give an error saying we
+      # are already connected
+      $this->error = array("error" => "Already connected to a server");
+      return false;
+    }
+
+    if(empty($port)) {
+      $port = $this->SMTP_PORT;
+    }
+
+    #connect to the smtp server
+    $this->smtp_conn = fsockopen($host,    # the host of the server
+                                 $port,    # the port to use
+                                 $errno,   # error number if any
+                                 $errstr,  # error message if any
+                                 $tval);   # give up after ? secs
+    # verify we connected properly
+    if(empty($this->smtp_conn)) {
+      $this->error = array("error" => "Failed to connect to server",
+                           "errno" => $errno,
+                           "errstr" => $errstr);
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": $errstr ($errno)" . $this->CRLF;
+      }
+      return false;
+    }
+
+    # sometimes the SMTP server takes a little longer to respond
+    # so we will give it a longer timeout for the first read
+    // Windows still does not have support for this timeout function
+    if(substr(PHP_OS, 0, 3) != "WIN")
+     socket_set_timeout($this->smtp_conn, $tval, 0);
+
+    # get any announcement stuff
+    $announce = $this->get_lines();
+
+    # set the timeout  of any socket functions at 1/10 of a second
+    //if(function_exists("socket_set_timeout"))
+    //   socket_set_timeout($this->smtp_conn, 0, 100000);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
+    }
+
+    return true;
+  }
+
+  /**
+   * Performs SMTP authentication.  Must be run after running the
+   * Hello() method.  Returns true if successfully authenticated.
+   * @access public
+   * @return bool
+   */
+  function Authenticate($username, $password) {
+    // Start authentication
+    fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "AUTH not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    // Send encoded username
+    fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "Username not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    // Send encoded password
+    fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 235) {
+      $this->error =
+        array("error" => "Password not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Returns true if connected to a server otherwise false
+   * @access private
+   * @return bool
+   */
+  function Connected() {
+    if(!empty($this->smtp_conn)) {
+      $sock_status = socket_get_status($this->smtp_conn);
+      if($sock_status["eof"]) {
+        # hmm this is an odd situation... the socket is
+        # valid but we are not connected anymore
+        if($this->do_debug >= 1) {
+            echo "SMTP -> NOTICE:" . $this->CRLF .
+                 "EOF caught while checking if connected";
         }
+        $this->Close();
         return false;
+      }
+      return true; # everything looks good
     }
+    return false;
+  }
 
-    /**
-     * Closes the socket and cleans up the state of the class.
-     * It is not considered good to use this function without
-     * first trying to use QUIT.
-     * @access public
-     * @return void
-     */
-    function Close() {
-        $this->error = null; # so there is no confusion
-        $this->helo_rply = null;
-        if(!empty($this->smtp_conn)) {
-            # close the connection and cleanup
-            fclose($this->smtp_conn);
-            $this->smtp_conn = 0;
-        }
-    }
-
-
-    /***************************************************************
-     *                        SMTP COMMANDS                       *
-     *************************************************************/
-
-    /**
-     * Issues a data command and sends the msg_data to the server
-     * finializing the mail transaction. $msg_data is the message
-     * that is to be send with the headers. Each header needs to be
-     * on a single line followed by a <CRLF> with the message headers
-     * and the message body being separated by and additional <CRLF>.
-     *
-     * Implements rfc 821: DATA <CRLF>
-     *
-     * SMTP CODE INTERMEDIATE: 354
-     *     [data]
-     *     <CRLF>.<CRLF>
-     *     SMTP CODE SUCCESS: 250
-     *     SMTP CODE FAILURE: 552,554,451,452
-     * SMTP CODE FAILURE: 451,554
-     * SMTP CODE ERROR  : 500,501,503,421
-     * @access public
-     * @return bool
-     */
-    function Data($msg_data) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Data() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"DATA" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 354) {
-            $this->error =
-                array("error" => "DATA command not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        # the server is ready to accept data!
-        # according to rfc 821 we should not send more than 1000
-        # including the CRLF
-        # characters on a single line so we will break the data up
-        # into lines by \r and/or \n then if needed we will break
-        # each of those into smaller lines to fit within the limit.
-        # in addition we will be looking for lines that start with
-        # a period '.' and append and additional period '.' to that
-        # line. NOTE: this does not count towards are limit.
-
-        # normalize the line breaks so we know the explode works
-        $msg_data = str_replace("\r\n","\n",$msg_data);
-        $msg_data = str_replace("\r","\n",$msg_data);
-        $lines = explode("\n",$msg_data);
-
-        # we need to find a good way to determine is headers are
-        # in the msg_data or if it is a straight msg body
-        # currently I'm assuming rfc 822 definitions of msg headers
-        # and if the first field of the first line (':' sperated)
-        # does not contain a space then it _should_ be a header
-        # and we can process all lines before a blank "" line as
-        # headers.
-        $field = substr($lines[0],0,strpos($lines[0],":"));
+  /**
+   * Closes the socket and cleans up the state of the class.
+   * It is not considered good to use this function without
+   * first trying to use QUIT.
+   * @access public
+   * @return void
+   */
+  function Close() {
+    $this->error = null; # so there is no confusion
+    $this->helo_rply = null;
+    if(!empty($this->smtp_conn)) {
+      # close the connection and cleanup
+      fclose($this->smtp_conn);
+      $this->smtp_conn = 0;
+    }
+  }
+
+  /***************************************************************
+   *                        SMTP COMMANDS                       *
+   *************************************************************/
+
+  /**
+   * Issues a data command and sends the msg_data to the server
+   * finializing the mail transaction. $msg_data is the message
+   * that is to be send with the headers. Each header needs to be
+   * on a single line followed by a <CRLF> with the message headers
+   * and the message body being seperated by and additional <CRLF>.
+   *
+   * Implements rfc 821: DATA <CRLF>
+   *
+   * SMTP CODE INTERMEDIATE: 354
+   *     [data]
+   *     <CRLF>.<CRLF>
+   *     SMTP CODE SUCCESS: 250
+   *     SMTP CODE FAILURE: 552,554,451,452
+   * SMTP CODE FAILURE: 451,554
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  function Data($msg_data) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Data() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 354) {
+      $this->error =
+        array("error" => "DATA command not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    # the server is ready to accept data!
+    # according to rfc 821 we should not send more than 1000
+    # including the CRLF
+    # characters on a single line so we will break the data up
+    # into lines by \r and/or \n then if needed we will break
+    # each of those into smaller lines to fit within the limit.
+    # in addition we will be looking for lines that start with
+    # a period '.' and append and additional period '.' to that
+    # line. NOTE: this does not count towards are limit.
+
+    # normalize the line breaks so we know the explode works
+    $msg_data = str_replace("\r\n","\n",$msg_data);
+    $msg_data = str_replace("\r","\n",$msg_data);
+    $lines = explode("\n",$msg_data);
+
+    # we need to find a good way to determine is headers are
+    # in the msg_data or if it is a straight msg body
+    # currently I am assuming rfc 822 definitions of msg headers
+    # and if the first field of the first line (':' sperated)
+    # does not contain a space then it _should_ be a header
+    # and we can process all lines before a blank "" line as
+    # headers.
+    $field = substr($lines[0],0,strpos($lines[0],":"));
+    $in_headers = false;
+    if(!empty($field) && !strstr($field," ")) {
+      $in_headers = true;
+    }
+
+    $max_line_length = 998; # used below; set here for ease in change
+
+    while(list(,$line) = @each($lines)) {
+      $lines_out = null;
+      if($line == "" && $in_headers) {
         $in_headers = false;
-        if(!empty($field) && !strstr($field," ")) {
-            $in_headers = true;
-        }
-
-        $max_line_length = 998; # used below; set here for ease in change
-
-        while(list(,$line) = @each($lines)) {
-            $lines_out = null;
-            if($line == "" && $in_headers) {
-                $in_headers = false;
-            }
-            # ok we need to break this line up into several
-            # smaller lines
-            while(strlen($line) > $max_line_length) {
-                $pos = strrpos(substr($line,0,$max_line_length)," ");
-
-                # Patch to fix DOS attack
-                if(!$pos) {
-                    $pos = $max_line_length - 1;
-                }
-
-                $lines_out[] = substr($line,0,$pos);
-                $line = substr($line,$pos + 1);
-                # if we are processing headers we need to
-                # add a LWSP-char to the front of the new line
-                # rfc 822 on long msg headers
-                if($in_headers) {
-                    $line = "\t" . $line;
-                }
-            }
-            $lines_out[] = $line;
-
-            # now send the lines to the server
-            while(list(,$line_out) = @each($lines_out)) {
-                if(strlen($line_out) > 0)
-                {
-                    if(substr($line_out, 0, 1) == ".") {
-                        $line_out = "." . $line_out;
-                    }
-                }
-                fputs($this->smtp_conn,$line_out . $this->CRLF);
-            }
-        }
-
-        # ok all the message data has been sent so lets get this
-        # over with aleady
-        fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "DATA not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Expand takes the name and asks the server to list all the
-     * people who are members of the _list_. Expand will return
-     * back and array of the result or false if an error occurs.
-     * Each value in the array returned has the format of:
-     *     [ <full-name> <sp> ] <path>
-     * The definition of <path> is defined in rfc 821
-     *
-     * Implements rfc 821: EXPN <SP> <string> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE FAILURE: 550
-     * SMTP CODE ERROR  : 500,501,502,504,421
-     * @access public
-     * @return string array
-     */
-    function Expand($name) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Expand() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "EXPN not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        # parse the reply and place in our array to return to user
-        $entries = explode($this->CRLF,$rply);
-        while(list(,$l) = @each($entries)) {
-            $list[] = substr($l,4);
-        }
-
-        return $list;
-    }
-
-    /**
-     * Sends the HELO command to the smtp server.
-     * This makes sure that we and the server are in
-     * the same known state.
-     *
-     * Implements from rfc 821: HELO <SP> <domain> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500, 501, 504, 421
-     * @access public
-     * @return bool
-     */
-    function Hello($host="") {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Hello() without being connected");
-            return false;
-        }
-
-        # if a hostname for the HELO wasn't specified determine
-        # a suitable one to send
-        if(empty($host)) {
-            # we need to determine some sort of appopiate default
-            # to send to the server
-            $host = "localhost";
-        }
-
-        // Send extended hello first (RFC 2821)
-        if(!$this->SendHello("EHLO", $host))
+      }
+      # ok we need to break this line up into several
+      # smaller lines
+      while(strlen($line) > $max_line_length) {
+        $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+        # Patch to fix DOS attack
+        if(!$pos) {
+          $pos = $max_line_length - 1;
+        }
+
+        $lines_out[] = substr($line,0,$pos);
+        $line = substr($line,$pos + 1);
+        # if we are processing headers we need to
+        # add a LWSP-char to the front of the new line
+        # rfc 822 on long msg headers
+        if($in_headers) {
+          $line = "\t" . $line;
+        }
+      }
+      $lines_out[] = $line;
+
+      # now send the lines to the server
+      while(list(,$line_out) = @each($lines_out)) {
+        if(strlen($line_out) > 0)
         {
-            if(!$this->SendHello("HELO", $host))
-                return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Sends a HELO/EHLO command.
-     * @access private
-     * @return bool
-     */
-    function SendHello($hello, $host) {
-        fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => $hello . " not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        $this->helo_rply = $rply;
-        
-        return true;
-    }
-
-    /**
-     * Gets help information on the keyword specified. If the keyword
-     * is not specified then returns generic help, ussually contianing
-     * A list of keywords that help is available on. This function
-     * returns the results back to the user. It is up to the user to
-     * handle the returned data. If an error occurs then false is
-     * returned with $this->error set appropiately.
-     *
-     * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
-     *
-     * SMTP CODE SUCCESS: 211,214
-     * SMTP CODE ERROR  : 500,501,502,504,421
-     * @access public
-     * @return string
-     */
-    function Help($keyword="") {
-        $this->error = null; # to avoid confusion
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Help() without being connected");
-            return false;
-        }
-
-        $extra = "";
-        if(!empty($keyword)) {
-            $extra = " " . $keyword;
-        }
-
-        fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 211 && $code != 214) {
-            $this->error =
-                array("error" => "HELP not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        return $rply;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command.
-     *
-     * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,421
-     * @access public
-     * @return bool
-     */
-    function Mail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Mail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "MAIL not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Sends the command NOOP to the SMTP server.
-     *
-     * Implements from rfc 821: NOOP <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500, 421
-     * @access public
-     * @return bool
-     */
-    function Noop() {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Noop() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"NOOP" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "NOOP not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Sends the quit command to the server and then closes the socket
-     * if there is no error or the $close_on_error argument is true.
-     *
-     * Implements from rfc 821: QUIT <CRLF>
-     *
-     * SMTP CODE SUCCESS: 221
-     * SMTP CODE ERROR  : 500
-     * @access public
-     * @return bool
-     */
-    function Quit($close_on_error=true) {
-        $this->error = null; # so there is no confusion
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Quit() without being connected");
-            return false;
-        }
-
-        # send the quit command to the server
-        fputs($this->smtp_conn,"quit" . $this->CRLF);
-
-        # get any good-bye messages
-        $byemsg = $this->get_lines();
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
-        }
-
-        $rval = true;
-        $e = null;
-
-        $code = substr($byemsg,0,3);
-        if($code != 221) {
-            # use e as a tmp var cause Close will overwrite $this->error
-            $e = array("error" => "SMTP server rejected quit command",
-                       "smtp_code" => $code,
-                       "smtp_rply" => substr($byemsg,4));
-            $rval = false;
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $e["error"] . ": " .
-                         $byemsg . $this->CRLF;
-            }
-        }
-
-        if(empty($e) || $close_on_error) {
-            $this->Close();
-        }
-
-        return $rval;
-    }
-
-    /**
-     * Sends the command RCPT to the SMTP server with the TO: argument of $to.
-     * Returns true if the recipient was accepted false if it was rejected.
-     *
-     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250,251
-     * SMTP CODE FAILURE: 550,551,552,553,450,451,452
-     * SMTP CODE ERROR  : 500,501,503,421
-     * @access public
-     * @return bool
-     */
-    function Recipient($to) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Recipient() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250 && $code != 251) {
-            $this->error =
-                array("error" => "RCPT not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Sends the RSET command to abort and transaction that is
-     * currently in progress. Returns true if successful false
-     * otherwise.
-     *
-     * Implements rfc 821: RSET <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500,501,504,421
-     * @access public
-     * @return bool
-     */
-    function Reset() {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Reset() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "RSET failed",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in.
-     *
-     * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function Send($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Send() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "SEND not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in and send them an email.
-     *
-     * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function SendAndMail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                "error" => "Called SendAndMail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "SAML not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in or mail it to them if they are not.
-     *
-     * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function SendOrMail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                "error" => "Called SendOrMail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "SOML not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * This is an optional command for SMTP that this class does not
-     * support. This method is here to make the RFC821 Definition
-     * complete for this class and __may__ be implimented in the future
-     *
-     * Implements from rfc 821: TURN <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE FAILURE: 502
-     * SMTP CODE ERROR  : 500, 503
-     * @access public
-     * @return bool
-     */
-    function Turn() {
-        $this->error = array("error" => "This method, TURN, of the SMTP ".
-                                        "is not implemented");
-        if($this->do_debug >= 1) {
-            echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
-        }
-        return false;
-    }
-
-    /**
-     * Verifies that the name is recognized by the server.
-     * Returns false if the name could not be verified otherwise
-     * the response from the server is returned.
-     *
-     * Implements rfc 821: VRFY <SP> <string> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250,251
-     * SMTP CODE FAILURE: 550,551,553
-     * SMTP CODE ERROR  : 500,501,502,421
-     * @access public
-     * @return int
-     */
-    function Verify($name) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Verify() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250 && $code != 251) {
-            $this->error =
-                array("error" => "VRFY failed on name '$name'",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return $rply;
-    }
-
-    /*******************************************************************
-     *                       INTERNAL FUNCTIONS                       *
-     ******************************************************************/
-
-    /**
-     * Read in as many lines as possible
-     * either before eof or socket timeout occurs on the operation.
-     * With SMTP we can tell if we have more lines to read if the
-     * 4th character is '-' symbol. If it is a space then we don't
-     * need to read anything else.
-     * @access private
-     * @return string
-     */
-    function get_lines() {
-        $data = "";
-        while($str = fgets($this->smtp_conn,515)) {
-            if($this->do_debug >= 4) {
-                echo "SMTP -> get_lines(): \$data was \"$data\"" .
-                         $this->CRLF;
-                echo "SMTP -> get_lines(): \$str is \"$str\"" .
-                         $this->CRLF;
-            }
-            $data .= $str;
-            if($this->do_debug >= 4) {
-                echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
-            }
-            # if the 4th character is a space then we are done reading
-            # so just break the loop
-            if(substr($str,3,1) == " ") { break; }
-        }
-        return $data;
+          if(substr($line_out, 0, 1) == ".") {
+            $line_out = "." . $line_out;
+          }
+        }
+        fputs($this->smtp_conn,$line_out . $this->CRLF);
+      }
+    }
+
+    # ok all the message data has been sent so lets get this
+    # over with aleady
+    fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "DATA not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Expand takes the name and asks the server to list all the
+   * people who are members of the _list_. Expand will return
+   * back and array of the result or false if an error occurs.
+   * Each value in the array returned has the format of:
+   *     [ <full-name> <sp> ] <path>
+   * The definition of <path> is defined in rfc 821
+   *
+   * Implements rfc 821: EXPN <SP> <string> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 550
+   * SMTP CODE ERROR  : 500,501,502,504,421
+   * @access public
+   * @return string array
+   */
+  function Expand($name) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Expand() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "EXPN not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    # parse the reply and place in our array to return to user
+    $entries = explode($this->CRLF,$rply);
+    while(list(,$l) = @each($entries)) {
+      $list[] = substr($l,4);
+    }
+
+    return $list;
+  }
+
+  /**
+   * Sends the HELO command to the smtp server.
+   * This makes sure that we and the server are in
+   * the same known state.
+   *
+   * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 501, 504, 421
+   * @access public
+   * @return bool
+   */
+  function Hello($host="") {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Hello() without being connected");
+      return false;
+    }
+
+    # if a hostname for the HELO was not specified determine
+    # a suitable one to send
+    if(empty($host)) {
+      # we need to determine some sort of appopiate default
+      # to send to the server
+      $host = "localhost";
+    }
+
+    // Send extended hello first (RFC 2821)
+    if(!$this->SendHello("EHLO", $host))
+    {
+      if(!$this->SendHello("HELO", $host))
+          return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Sends a HELO/EHLO command.
+   * @access private
+   * @return bool
+   */
+  function SendHello($hello, $host) {
+    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => $hello . " not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    $this->helo_rply = $rply;
+
+    return true;
+  }
+
+  /**
+   * Gets help information on the keyword specified. If the keyword
+   * is not specified then returns generic help, ussually contianing
+   * A list of keywords that help is available on. This function
+   * returns the results back to the user. It is up to the user to
+   * handle the returned data. If an error occurs then false is
+   * returned with $this->error set appropiately.
+   *
+   * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
+   *
+   * SMTP CODE SUCCESS: 211,214
+   * SMTP CODE ERROR  : 500,501,502,504,421
+   * @access public
+   * @return string
+   */
+  function Help($keyword="") {
+    $this->error = null; # to avoid confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Help() without being connected");
+      return false;
+    }
+
+    $extra = "";
+    if(!empty($keyword)) {
+      $extra = " " . $keyword;
+    }
+
+    fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 211 && $code != 214) {
+      $this->error =
+        array("error" => "HELP not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    return $rply;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command.
+   *
+   * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,421
+   * @access public
+   * @return bool
+   */
+  function Mail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Mail() without being connected");
+      return false;
+    }
+
+    $useVerp = ($this->do_verp ? "XVERP" : "");
+    fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "MAIL not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the command NOOP to the SMTP server.
+   *
+   * Implements from rfc 821: NOOP <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 421
+   * @access public
+   * @return bool
+   */
+  function Noop() {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Noop() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"NOOP" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "NOOP not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the quit command to the server and then closes the socket
+   * if there is no error or the $close_on_error argument is true.
+   *
+   * Implements from rfc 821: QUIT <CRLF>
+   *
+   * SMTP CODE SUCCESS: 221
+   * SMTP CODE ERROR  : 500
+   * @access public
+   * @return bool
+   */
+  function Quit($close_on_error=true) {
+    $this->error = null; # so there is no confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Quit() without being connected");
+      return false;
+    }
+
+    # send the quit command to the server
+    fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+    # get any good-bye messages
+    $byemsg = $this->get_lines();
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
+    }
+
+    $rval = true;
+    $e = null;
+
+    $code = substr($byemsg,0,3);
+    if($code != 221) {
+      # use e as a tmp var cause Close will overwrite $this->error
+      $e = array("error" => "SMTP server rejected quit command",
+                 "smtp_code" => $code,
+                 "smtp_rply" => substr($byemsg,4));
+      $rval = false;
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $e["error"] . ": " .
+                 $byemsg . $this->CRLF;
+      }
+    }
+
+    if(empty($e) || $close_on_error) {
+      $this->Close();
+    }
+
+    return $rval;
+  }
+
+  /**
+   * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+   * Returns true if the recipient was accepted false if it was rejected.
+   *
+   * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  function Recipient($to) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Recipient() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "RCPT not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the RSET command to abort and transaction that is
+   * currently in progress. Returns true if successful false
+   * otherwise.
+   *
+   * Implements rfc 821: RSET <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500,501,504,421
+   * @access public
+   * @return bool
+   */
+  function Reset() {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Reset() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "RSET failed",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in.
+   *
+   * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function Send($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Send() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SEND not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in and send them an email.
+   *
+   * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function SendAndMail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendAndMail() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SAML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in or mail it to them if they are not.
+   *
+   * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function SendOrMail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendOrMail() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250) {
+      $this->error =
+        array("error" => "SOML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * This is an optional command for SMTP that this class does not
+   * support. This method is here to make the RFC821 Definition
+   * complete for this class and __may__ be implimented in the future
+   *
+   * Implements from rfc 821: TURN <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 502
+   * SMTP CODE ERROR  : 500, 503
+   * @access public
+   * @return bool
+   */
+  function Turn() {
+    $this->error = array("error" => "This method, TURN, of the SMTP ".
+                                    "is not implemented");
+    if($this->do_debug >= 1) {
+      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
+    }
+    return false;
+  }
+
+  /**
+   * Verifies that the name is recognized by the server.
+   * Returns false if the name could not be verified otherwise
+   * the response from the server is returned.
+   *
+   * Implements rfc 821: VRFY <SP> <string> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,553
+   * SMTP CODE ERROR  : 500,501,502,421
+   * @access public
+   * @return int
+   */
+  function Verify($name) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Verify() without being connected");
+      return false;
+    }
+
+    fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
+
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "VRFY failed on name '$name'",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return $rply;
+  }
+
+  /*******************************************************************
+   *                       INTERNAL FUNCTIONS                       *
+   ******************************************************************/
+
+  /**
+   * Read in as many lines as possible
+   * either before eof or socket timeout occurs on the operation.
+   * With SMTP we can tell if we have more lines to read if the
+   * 4th character is '-' symbol. If it is a space then we don't
+   * need to read anything else.
+   * @access private
+   * @return string
+   */
+  function get_lines() {
+    $data = "";
+    while($str = @fgets($this->smtp_conn,515)) {
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data was \"$data\"" .
+                 $this->CRLF;
+        echo "SMTP -> get_lines(): \$str is \"$str\"" .
+                 $this->CRLF;
+      }
+      $data .= $str;
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
+      }
+      # if the 4th character is a space then we are done reading
+      # so just break the loop
+      if(substr($str,3,1) == " ") { break; }
     }
+    return $data;
+  }
 
 }
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/phpmailer/mailout_process.php 0.7.11.src/e107_handlers/phpmailer/mailout_process.php
--- 0.7.7.src/e107_handlers/phpmailer/mailout_process.php	2006-11-29 16:27:40.000000000 -0600
+++ 0.7.11.src/e107_handlers/phpmailer/mailout_process.php	2007-12-29 14:34:30.000000000 -0600
@@ -11,13 +11,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/phpmailer/mailout_process.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/11/29 22:27:40 $
-|     $Author: e107coders $
+|     $Revision: 1.17 $
+|     $Date: 2007/12/29 20:34:30 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
-if(!getperms("W")){ header("location:".e_BASE."index.php"); }
+if(!getperms("W")){ header("location:".e_BASE."index.php"); exit; }
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_mailout.php");
 
 $HEADER = "";
@@ -86,7 +86,7 @@
 
 	$mail->AddCC = ($_POST['email_cc']);
 	$mail->WordWrap = 50;
-	$mail->Charset = CHARSET;
+	$mail->CharSet = CHARSET;
 	$mail->Subject = $_POST['email_subject'];
 	$mail->IsHTML(TRUE);
 	$mail->SMTPDebug = (e_MENU == "debug") ? TRUE : FALSE;
@@ -114,11 +114,7 @@
 		$mail->Sender = $pref['mail_bounce_email'];
 	}
 
-	$attach = chop($_POST['email_attachment']);
-	if (($temp = strrchr($attach,'/')) !== FALSE)
-	{
-		$attach = substr($attach,$temp + 1);
-	}
+	$attach = trim($_POST['email_attachment']);
 
 	if(is_readable(e_DOWNLOAD.$attach))
 	{
@@ -129,11 +125,16 @@
 		$attach_link = e_FILE.'public/'.$attach;
 	}
 
+	if (($temp = strrchr($attach,'/')) !== FALSE)
+	{	// Just specify filename as attachment - no path
+		$attach = substr($temp,1);
+	}
+
 	if ($attach != "" && !$mail->AddAttachment($attach_link, $attach))
 	{
 		$mss = MAILAN_58."<br />$attach_link";  // problem with attachment.
 		$ns->tablerender("Error", $mss);
-		require_once(e_ADMIN."footer.php");
+//		require_once(e_ADMIN."footer.php");
 		exit;
 	}
 
@@ -202,7 +203,8 @@
 
 	stopwatch();
 
-    while($row = $sql-> db_Fetch()){
+    while($row = $sql-> db_Fetch())
+	{
 
 
 // ---------------------- Mailing Part. -------------------------------------->
@@ -230,6 +232,7 @@
 		}
 
 		$mail->ClearAddresses();
+   		$mail->ClearCustomHeaders();
 
 
 // --------- End of the mailing. --------------------------------------------->
diff -x .svn -ruN 0.7.7.src/e107_handlers/plugin_class.php 0.7.11.src/e107_handlers/plugin_class.php
--- 0.7.7.src/e107_handlers/plugin_class.php	2006-11-07 21:18:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/plugin_class.php	2007-12-03 14:42:50.000000000 -0600
@@ -11,9 +11,10 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/plugin_class.php,v $
-|     $Revision: 1.54 $
-|     $Date: 2006/11/08 03:18:34 $
-|     $Author: e107coders $
+|     $Revision: 1.67 $
+|     $Date: 2007/12/03 20:42:50 $
+|     $Author: e107steved $
+|
 +----------------------------------------------------------------------------+
 */
 
@@ -21,78 +22,215 @@
 
 class e107plugin
 {
-    var	$plugin_addons = array("e_rss", "e_notify", "e_linkgen", "e_list", "e_bb", "e_meta", "e_emailprint", "e_frontpage", "e_latest", "e_status", "e_search", "e_sc", "e_module", "e_comment", "e_sql");
-
+    var	$plugin_addons = array(
+		"e_rss",
+		"e_notify",
+		"e_linkgen",
+		"e_list",
+		"e_bb",
+		"e_meta",
+		"e_emailprint",
+		"e_frontpage",
+		"e_latest",
+		"e_status",
+		"e_search",
+		"e_sc",
+		"e_module",
+		"e_comment",
+		"e_sql",
+		"e_help"
+	);
+
+	// List of all plugin variables which need to be checked - install required if one or more set and non-empty
+	var $all_eplug_install_variables = array(
+		'eplug_link_url',
+		'eplug_link',
+		'eplug_prefs',
+		'eplug_array_pref',		// missing previously
+		'eplug_table_names',
+		'eplug_user_prefs',
+		'eplug_sc',
+		'eplug_userclass',
+		'eplug_module',
+		'eplug_bb',
+		'eplug_latest',
+		'eplug_status'		//,
+//		'eplug_comment_ids',	// Not sure about this one
+//		'eplug_menu_name',		// ...or this one
+//		'eplug_conffile'		// ...or this one
+	);
+
+	// List of all plugin variables involved in an update (not used ATM, but worth 'documenting')
+	var $all_eplug_update_variables = array (
+		'upgrade_alter_tables',
+		'upgrade_add_eplug_sc',
+		'upgrade_remove_eplug_sc',
+		'upgrade_add_eplug_bb',
+		'upgrade_remove_eplug_bb',
+		'upgrade_add_prefs',
+		'upgrade_remove_prefs',
+		'upgrade_add_user_prefs',
+		'upgrade_remove_user_prefs',
+		'upgrade_add_array_pref',
+		'upgrade_remove_array_pref'
+	);
+	
+	// List of all 'editable' DB fields ('plugin_id' is an arbitrary reference which is never edited)
+	var $all_editable_db_fields = array (
+		'plugin_name',				// Name of the plugin - language dependent
+		'plugin_version',			// Version - arbitrary text field
+		'plugin_path',				// Name of the directory off e_PLUGIN - unique
+		'plugin_installflag',		// '0' = not installed, '1' = installed
+		'plugin_addons'				// List of any extras associated with plugin - bbcodes, e_XXX files...
+	);
+	
 	/**
-	 * Returns an array containing details of all plugins in the plugin table - should noramlly use e107plugin::update_plugins_table() first to make sure the table is up to date.
-	 *
+	 * Returns an array containing details of all plugins in the plugin table - should normally use e107plugin::update_plugins_table() first to 
+	 * make sure the table is up to date. (Primarily called from plugin manager to get lists of installed and uninstalled plugins.
 	 * @return array plugin details
 	 */
 	function getall($flag)
 	{
+	  
 		global $sql;
 		if ($sql->db_Select("plugin","*","plugin_installflag = '".intval($flag)."' ORDER BY plugin_path ASC"))
 		{
 			$ret = $sql->db_getList();
  		}
-
-
-
 		return ($ret) ? $ret : FALSE;
 	}
 
+
 	/**
 	 * Check for new plugins, create entry in plugin table and remove deleted plugins
-	 *
 	 */
-	function update_plugins_table() {
-		global $sql, $mySQLprefix, $menu_pref, $tp;
+	function update_plugins_table() 
+	{
+		global $sql, $sql2, $mySQLprefix, $menu_pref, $tp, $pref;
 
 		require_once(e_HANDLER.'file_class.php');
 
 		$fl = new e_file;
 		$pluginList = $fl->get_files(e_PLUGIN, "^plugin\.php$", "standard", 1);
+		$sp = FALSE;
 
-		foreach($pluginList as $p)
+// Read all the plugin DB info into an array to save lots of accesses
+		$pluginDBList = array();
+		if ($sql->db_Select('plugin',"*"))
 		{
-			foreach($defined_vars as $varname) {
-				if (substr($varname, 0, 6) == 'eplug_' || substr($varname, 0, 8) == 'upgrade_') {
-					unset($$varname);
-				}
-			}
-
-		 	include_once("{$p['path']}{$p['fname']}");
-			$plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
-
-			// scan for addons.
-			$eplug_addons = $this->getAddons($plugin_path);
+		  while ($row = $sql->db_Fetch())
+		  {
+		    $pluginDBList[$row['plugin_path']] = $row;
+		    $pluginDBList[$row['plugin_path']]['status'] = 'read';
+//			echo "Found plugin: ".$row['plugin_path']." in DB<br />";
+		  }
+		}
 
-			if($sql->db_Select("plugin", "plugin_id", "plugin_path = '$plugin_path'"))
+		// Get rid of any variables previously defined which may occur in plugin.php
+		foreach($pluginList as $p)
+		{
+		  $defined_vars = array_keys(get_defined_vars());
+		  foreach($defined_vars as $varname) 
+		  {
+			if ((substr($varname, 0, 6) == 'eplug_') || (substr($varname, 0, 8) == 'upgrade_')) 
 			{
-				$sql->db_Update("plugin", "plugin_addons = '{$eplug_addons}' WHERE plugin_path = '$plugin_path'");
+			  unset($$varname);
 			}
+		  }
 
-			if ((!$sql->db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($eplug_folder, true)."'")) && $eplug_name){
-				if (!$eplug_link_url && !$eplug_link && !$eplug_prefs && !$eplug_table_names && !$eplug_user_prefs && !$eplug_sc && !$eplug_userclass && !$eplug_module && !$eplug_bb && !$eplug_latest && !$eplug_status){
-					// new plugin, assign entry in plugin table, install is not necessary so mark it as intalled
-					$sql->db_Insert("plugin", "0, '".$tp -> toDB($eplug_name, true)."', '".$tp -> toDB($eplug_version, true)."', '".$tp -> toDB($eplug_folder, true)."', 1, '$eplug_addons' ");
-				}
-				else
+		  // We have to include here to set the variables, otherwise we only get uninstalled plugins
+		  // Would be nice to eval() the file contents to pick up errors better, but too many path issues
+		  $plug['plug_action'] = 'scan';			// Make sure plugin.php knows what we're up to
+		  include("{$p['path']}{$p['fname']}");
+		  $plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
+
+		  // scan for addons.
+		  $eplug_addons = $this->getAddons($plugin_path);			// Returns comma-separated list
+//		  $eplug_addons = $this->getAddons($plugin_path,'check');		// Checks opening/closing tags on addon files
+
+		  // See whether the plugin needs installation - it does if one or more variables defined
+		  $no_install_needed = 1;
+		  foreach ($this->all_eplug_install_variables as $check_var)
+		  {
+		    if (isset($$check_var) && ($$check_var)) { $no_install_needed = 0; }
+		  }
+
+		  if ($plugin_path == $eplug_folder)
+		  {
+			if(array_key_exists($plugin_path,$pluginDBList))
+			{  // Update the addons needed by the plugin
+		      $pluginDBList[$plugin_path]['status'] = 'exists';
+			  // If plugin not installed, and version number of files changed, update version as well
+			  if (($pluginDBList[$plugin_path]['plugin_installflag'] == 0) && ($pluginDBList[$plugin_path]['plugin_version'] != $eplug_version))
+			  {  // Update stored version
+				$pluginDBList[$plugin_path]['plugin_version'] = $eplug_version;
+				$pluginDBList[$plugin_path]['status'] = 'update';
+			  }
+			  if ($pluginDBList[$plugin_path]['plugin_addons'] != $eplug_addons)
+			  {  // Update stored addons list
+				$pluginDBList[$plugin_path]['plugin_addons'] = $eplug_addons;
+				$pluginDBList[$plugin_path]['status'] = 'update';
+			  }
+			  
+			  if ($pluginDBList[$plugin_path]['plugin_installflag'] == 0)
+			  {  // Plugin not installed - make sure $pref not set
+			    if (isset($pref['plug_installed'][$plugin_path]))
 				{
-					// new plugin, assign entry in plugin table, install is necessary
-					$sql->db_Insert("plugin", "0, '".$tp -> toDB($eplug_name, true)."', '".$tp -> toDB($eplug_version, true)."', '".$tp -> toDB($eplug_folder, true)."', 0, '$eplug_addons' ");
-				}
-			}
-		}
-
-		$sql->db_Select("plugin");
-		while ($row = $sql->db_fetch()) {
-			if (!is_dir(e_PLUGIN.$row['plugin_path'])) {
-				$sql->db_Delete('plugin', "plugin_path = '{$row['plugin_path']}'");
+			      unset($pref['plug_installed'][$plugin_path]);
+//				  echo "Remove: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
+				  $sp = TRUE;
+				}
+			  }
+			  else
+			  {	// Plugin installed - make sure $pref is set
+				if (!isset($pref['plug_installed'][$plugin_path]) || ($pref['plug_installed'][$plugin_path] != $pluginDBList[$plugin_path]['plugin_version']))
+				{	// Update prefs array of installed plugins
+			      $pref['plug_installed'][$plugin_path] = $pluginDBList[$plugin_path]['plugin_version'];
+//				  echo "Add: ".$plugin_path."->".$ep_row['plugin_version']."<br />";
+				  $sp = TRUE;
+				}
+			  }
+			}
+			else
+			{  // New plugin - not in table yet, so add it. If no install needed, mark it as 'installed'
+			  if ($eplug_name)
+			  {
+				// Can just add to DB - shouldn''t matter that its not in our current table
+//				echo "Trying to insert: ".$eplug_folder."<br />";
+				$sql->db_Insert("plugin", "0, '".$tp -> toDB($eplug_name, true)."', '".$tp -> toDB($eplug_version, true)."', '".$tp -> toDB($eplug_folder, true)."', {$no_install_needed}, '{$eplug_addons}' ");
+			  }
+			}
+		  }
+		  else
+		  {  // May be useful that we ignore what will usually be copies/backups of plugins - but don't normally say anything
+//		    echo "Plugin copied to wrong directory. Is in: {$plugin_path} Should be: {$eplug_folder}<br /><br />";
+		  }
+		}
+
+		// Now scan the table, updating the DB where needed
+		foreach ($pluginDBList as $plug_path => $plug_info)
+		{
+		  if ($plug_info['status'] == 'read')
+		  {	// In table, not on server - delete it
+			$sql->db_Delete('plugin', "`plugin_id`='{$plug_info['plugin_id']}'");
+//			echo "Deleted: ".$plug_path."<br />";
+		  }
+		  if ($plug_info['status'] == 'update')
+		  {
+		    $temp = array();
+			foreach ($this->all_editable_db_fields as $p_f)
+			{
+			  $temp[] ="`{$p_f}` = '{$plug_info[$p_f]}'";
 			}
+		    $sql->db_Update('plugin', implode(", ",$temp)."  WHERE `plugin_id`='{$plug_info['plugin_id']}'");
+//			echo "Updated: ".$plug_path."<br />";
+		  }
 		}
+	  if ($sp)  save_prefs();
 	}
 
+
+
 	/**
 	 * Returns deatils of a plugin from the plugin table from it's ID
 	 *
@@ -150,38 +288,66 @@
 		global $sql, $tp;
 		$link_url = $tp -> toDB($link_url, true);
 		$link_name = $tp -> toDB($link_name, true);
-		if ($action == 'add') {
-			$path = str_replace("../", "", $link_url);
+		$path = str_replace("../", "", $link_url);			// This should clean up 'non-standard' links
+		$path = $tp->createConstants($path);				// Add in standard {e_XXXX} directory constants if we can
+		if ($action == 'add') 
+		{
 			$link_t = $sql->db_Count('links');
-			if (!$sql->db_Count('links', '(*)', "link_name = '{$link_name}'")) {
-				return $sql->db_Insert('links', "0, '{$link_name}', '{$path}', '', '', '1', '".($link_t + 1)."', '0', '0', '{$link_class}' ");
-			} else {
-				return FALSE;
+			if (!$sql->db_Count('links', '(*)', "WHERE link_url = '{$path}' OR link_name = '{$link_name}'")) 
+			{
+			  return $sql->db_Insert('links', "0, '{$link_name}', '{$path}', '', '', '1', '".($link_t + 1)."', '0', '0', '{$link_class}' ");
+			} 
+			else 
+			{
+			  return FALSE;
 			}
 		}
-		if ($action == 'remove') {
-			if ($sql->db_Select('links', 'link_order', "link_name = '{$link_name}'")) {
-				$row = $sql->db_Fetch();
-				$sql->db_Update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}");
-				return $sql->db_Delete('links', "link_name = '{$link_name}'");
-			}
+		if ($action == 'remove') 
+		{	// Look up by URL if we can - should be more reliable. Otherwise try looking up by name (as previously)
+		  if (($path && $sql->db_Select('links', 'link_id,link_order', "link_url = '{$path}'")) ||
+					$sql->db_Select('links', 'link_id,link_order', "link_name = '{$link_name}'")) 
+		  {
+			$row = $sql->db_Fetch();
+			$sql->db_Update('links', "link_order = link_order - 1 WHERE link_order > {$row['link_order']}");
+			return $sql->db_Delete('links', "link_id = '{$row['link_id']}'");
+		  }
 		}
 	}
 
 	function manage_prefs($action, $var) {
 		global $pref;
 		if (is_array($var)) {
-			if ($action == 'add') {
-				foreach($var as $k => $v) {
-					$pref[$k] = $v;
-				}
-			}
-			if ($action == 'remove') {
-				foreach($var as $k => $v) {
-					unset($pref[$k]);
+		  switch ($action)
+		  {
+			case 'add' :
+			  foreach($var as $k => $v) 
+			  {
+				$pref[$k] = $v;
+			  }
+			  break;
+			  
+			case 'update' :
+			  foreach($var as $k => $v) 
+			  {	// Only update if $pref doesn't exist
+				if (!isset($pref[$k])) $pref[$k] = $v;
+			  }
+			  break;
+			  
+			case 'remove' :
+			  foreach($var as $k => $v) 
+			  {
+				if (is_numeric($k))
+				{	// Sometimes arrays specified with value being the name of the key to delete
+				  unset($pref[$var[$k]]);
 				}
-			}
-			save_prefs();
+				else
+				{	// This is how the array should be specified - key is the name of the pref
+				  unset($pref[$k]);
+				} 
+			  }
+			  break;
+		  }
+		  save_prefs();
 		}
 	}
 
@@ -236,41 +402,41 @@
 		}
 	}
 
-	function manage_plugin_prefs($action, $prefname, $plugin_folder, $varArray = '') {
+	function manage_plugin_prefs($action, $prefname, $plugin_folder, $varArray = '') 
+	{  // These prefs are 'cumulative' - several plugins may contribute an array element
 		global $pref;
-		if ($prefname == 'plug_sc' || $prefname == 'plug_bb') {
+		if ($prefname == 'plug_sc' || $prefname == 'plug_bb') 
+		{  // Special cases - shortcodes and bbcodes - each plugin may contribute several elements
 			foreach($varArray as $code) {
 				$prefvals[] = "$code:$plugin_folder";
 			}
 		} else {
-			$prefvals[] = $plugin_folder;
+			$prefvals[] = $varArray;
+//			$prefvals[] = $plugin_folder;
 		}
 		$curvals = explode(',', $pref[$prefname]);
 
-		if ($action == 'add') {
+		if ($action == 'add') 
+		{
 			$newvals = array_merge($curvals, $prefvals);
 		}
-		if ($action == 'remove') {
-			foreach($prefvals as $v) {
-				if (($i = array_search($v, $curvals)) !== FALSE) {
-					unset($curvals[$i]);
-				}
+		if ($action == 'remove') 
+		{
+		  foreach($prefvals as $v) 
+		  {
+			if (($i = array_search($v, $curvals)) !== FALSE) 
+			{
+			  unset($curvals[$i]);
 			}
-			// $newvals = explode(',', $curvals);
-			$newvals = $curvals;
+		  }
+		  $newvals = $curvals;
 		}
 		$newvals = array_unique($newvals);
-		if(count($newvals) < 2)
-		{
-			$pref[$prefname] = $newvals[0];
-		}
-		else
-		{
-			$pref[$prefname] = implode(',', $newvals);
-		}
+		$pref[$prefname] = implode(',', $newvals);
+
 		if(substr($pref[$prefname], 0, 1) == ",")
 		{
-			$pref[$prefname] = substr($pref[$prefname], 1);
+		  $pref[$prefname] = substr($pref[$prefname], 1);
 		}
 		save_prefs();
 	}
@@ -357,11 +523,13 @@
 	 *
 	 * @param int $id
 	 */
-	function install_plugin($id) {
+	function install_plugin($id) 
+	{
 		global $sql, $ns, $sysprefs,$mySQLprefix, $tp;
 
 		// install plugin ...
 		$plug = $this->getinfo($id);
+		$plug['plug_action'] = 'install';
 
 		if ($plug['plugin_installflag'] == FALSE) {
 			include_once(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
@@ -393,7 +561,7 @@
 
 			if (is_array($eplug_array_pref)){
 				foreach($eplug_array_pref as $key => $val){
-					$this->manage_plugin_prefs('add', $key, $val);
+					$this->manage_plugin_prefs('add', $key, $eplug_folder, $val);
 				}
 			}
 
@@ -427,6 +595,7 @@
                 $plug_perm['everyone'] = e_UC_PUBLIC;
 				$plug_perm['guest'] = e_UC_GUEST;
 				$plug_perm['member'] = e_UC_MEMBER;
+				$plug_perm['mainadmin'] = e_UC_MAINADMIN;
 				$plug_perm['admin'] = e_UC_ADMIN;
 				$plug_perm['nobody'] = e_UC_NOBODY;
 				$eplug_link_perms = strtolower($eplug_link_perms);
@@ -445,7 +614,10 @@
 			$eplug_addons = $this->getAddons($eplug_folder);
 
 			$sql->db_Update('plugin', "plugin_installflag = 1, plugin_addons = '{$eplug_addons}' WHERE plugin_id = '".intval($id)."'");
-            if($rssmess){ $text .= $rssmess; }
+			$pref['plug_installed'][$plugin_path] = $plug['plugin_version'];
+			save_prefs();
+			
+            if($rssmess) { $text .= $rssmess; }
 			$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
 		} else {
 			$text = EPL_ADLAN_21;
@@ -458,7 +630,8 @@
 
 	function save_addon_prefs(){  // scan the plugin table and create path-array-prefs for each addon.
 		global $sql,$pref;
-        $query = "SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_addons !='' ORDER BY plugin_path ASC";
+//        $query = "SELECT * FROM #plugin WHERE plugin_installflag = 1 AND plugin_addons !='' ORDER BY plugin_path ASC";
+        $query = "SELECT * FROM #plugin WHERE plugin_addons !='' ORDER BY plugin_path ASC";
 
 		// clear all addon prefs before re-creation. 
 		unset($pref['shortcode_list'],$pref['bbcode_list'],$pref['e_sql_list']);
@@ -471,9 +644,12 @@
 		{
 			while($row = $sql-> db_Fetch())
 			{
+			  $is_installed = ($row['plugin_installflag'] == 1 );
                 $tmp = explode(",",$row['plugin_addons']);
 				$path = $row['plugin_path'];
 
+			  if ($is_installed)
+			  {
         		foreach($this->plugin_addons as $val)
 				{
                 	if(in_array($val,$tmp))
@@ -481,6 +657,7 @@
  						$pref[$val."_list"][$path] = $path;
 					}
 				}
+			  }
                 // search for .bb and .sc files.
 				$sc_array = array();
 				$bb_array = array();
@@ -491,22 +668,29 @@
                 	if(substr($adds,-3) == ".sc")
 					{
 						$sc_name = substr($adds, 0,-3);  // remove the .sc
-                    	$sc_array[$sc_name] = "0"; // default userclass.
+						if ($is_installed)
+						{
+                    	  $sc_array[$sc_name] = "0"; // default userclass = e_UC_PUBLIC
+						}
+						else
+						{
+                    	  $sc_array[$sc_name] = e_UC_NOBODY; // register shortcode, but disable it
+						}
 					}
 
-					if(substr($adds,-3) == ".bb")
+					if($is_installed && (substr($adds,-3) == ".bb"))
 					{
 						$bb_name = substr($adds, 0,-3); // remove the .bb
                     	$bb_array[$bb_name] = "0"; // default userclass.
 					}
 
-					if(substr($adds,-4) == "_sql")
+					if($is_installed && (substr($adds,-4) == "_sql"))
 					{
 						$pref['e_sql_list'][$path] = $adds;
 					}
 				}
 
-                // Build Bbcode list
+                // Build Bbcode list (will be empty if plugin not installed)
                 if(count($bb_array) > 0)
 				{
 					ksort($bb_array);
@@ -515,17 +699,18 @@
 				}
 				else
 				{
-                    unset($pref['bbcode_list'][$path]);
+                  if (isset($pref['bbcode_list'][$path])) unset($pref['bbcode_list'][$path]);
 				}
 
-                // Build shortcode list
-				if(count($sc_array) > 0){
-					ksort($sc_array);
-					$pref['shortcode_list'][$path] = $sc_array;
+                // Build shortcode list - do if uninstalled as well
+				if(count($sc_array) > 0)
+				{
+				  ksort($sc_array);
+				  $pref['shortcode_list'][$path] = $sc_array;
                 }
 				else
 				{
-                    unset($pref['shortcode_list'][$path]);
+                  if(isset($pref['shortcode_list'][$path])) unset($pref['shortcode_list'][$path]);
 				}
 
 			}
@@ -537,17 +722,26 @@
 	}
 
     // return a list of available plugin addons for the specified plugin. e_xxx etc.
-	function getAddons($plugin_path,$debug=FALSE){
-        global $fl;
-
-		$p_addons = "";
-		foreach($this->plugin_addons as $e_xxx)
-		{
-			if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php"))
-			{
-				$p_addons[] = $e_xxx;
-			}
+	// $debug = TRUE - prints diagnostics
+	// $debug = 'check' - checks each file found for php tags - prints 'pass' or 'fail'
+	function getAddons($plugin_path,$debug=FALSE)
+	{
+      global $fl;
+	  $p_addons = array();
+	  foreach($this->plugin_addons as $e_xxx)
+	  {
+		if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php"))
+		{
+		  $passfail = '';
+		  if ($debug == 'check')
+		  {
+		    $file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php");
+			if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) $passfail = '<b>fail</b>'; else $passfail = 'pass';
+			echo $plugin_path."/".$e_xxx.".php - ".$passfail."<br />";
+		  }
+		  $p_addons[] = $e_xxx;
 		}
+	  }
 
 		if(!is_object($fl)){
 			require_once(e_HANDLER.'file_class.php');
@@ -587,7 +781,7 @@
 		}
 
 
-		if($debug)
+		if($debug==TRUE)
 		{
 			echo $plugin_path." = ".implode(",",$p_addons)."<br />";
 		}
@@ -595,7 +789,16 @@
 		return implode(",",$p_addons);
 	}
 
-
+	function checkAddon($plugin_path,$e_xxx)
+	{ // Return 0 = OK, 1 = Fail, 2 = inaccessible
+	  if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php"))
+	  {
+		$file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php");
+		if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) return 1;
+		return 0;
+		}
+	  return 2;
+	}
 }
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/preset_class.php 0.7.11.src/e107_handlers/preset_class.php
--- 0.7.7.src/e107_handlers/preset_class.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/preset_class.php	2007-02-07 15:21:20.000000000 -0600
@@ -11,9 +11,9 @@
 |		GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_handlers/preset_class.php,v $
-|		$Revision: 1.6 $
-|		$Date: 2005/12/14 17:37:34 $
-|		$Author: sweetas $
+|		$Revision: 1.7 $
+|		$Date: 2007/02/07 21:21:20 $
+|		$Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -25,28 +25,38 @@
 	var $page;
 	var $id;
 
-	function save_preset(){
+	function save_preset($exclude_fields = '')    // Comma separated list of fields not to save
+	{
 	global $sql,$tp,$ns;
 	$qry = explode(".",e_QUERY);
 	$unique_id = is_array($this->id) ? $this->id : array($this->id);
 	$uid = $qry[1];
 
-		if($_POST && $qry[0] =="savepreset"){
-			foreach($_POST as $key => $value){
-				$value = $tp->toDB($value);
-			if ($sql -> db_Update("preset", "preset_value='$value'  WHERE preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' ")){
-
-			} elseif ($value !="" && !$sql -> db_Select("preset","*","preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' ")){
-				$sql -> db_Insert("preset", "0, '".$unique_id[$uid]."', '$key', '$value' ");
-			}
-
-			if($value == ""){
-				$sql -> db_Delete("preset", "preset_field ='".$key."' ");
-			}
-
-			}
-			$ns -> tablerender(LAN_SAVED, LAN_PRESET_SAVED);
+	if($_POST && $qry[0] =="savepreset")
+	{
+	  $exclude_array = explode(',',$exclude_fields);
+	  foreach($_POST as $key => $value)
+	  {
+	    if (!in_array($key,$exclude_array))
+		{
+		  $value = $tp->toDB($value);
+		  if ($sql -> db_Update("preset", "preset_value='$value'  WHERE preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' "))
+		  {
+
+		  } 
+		  elseif ($value !="" && !$sql -> db_Select("preset","*","preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' "))
+		  {
+			$sql -> db_Insert("preset", "0, '".$unique_id[$uid]."', '$key', '$value' ");
+		  }
+
+		  if($value == "")
+		  {
+			$sql -> db_Delete("preset", "preset_field ='".$key."' ");
+		  }
 		}
+	  }
+	  $ns -> tablerender(LAN_SAVED, LAN_PRESET_SAVED);
+	}
 
 		if ($_POST['delete_preset'] && e_QUERY=="clr_preset"){
 			$del = $_POST['del_id'];
diff -x .svn -ruN 0.7.7.src/e107_handlers/rate_class.php 0.7.11.src/e107_handlers/rate_class.php
--- 0.7.7.src/e107_handlers/rate_class.php	2006-10-28 21:30:31.000000000 -0500
+++ 0.7.11.src/e107_handlers/rate_class.php	2007-01-10 15:30:34.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/rate_class.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/10/29 02:30:31 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2007/01/10 21:30:34 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -162,10 +162,10 @@
 		$sep = chr(1);
 		$voter = USERID.$sep.intval($qs[3]);
 
-		if ($sql->db_Select("rate", "*", "rate_table='$table' AND rate_itemid='$itemid' ")) {
+		if ($sql->db_Select("rate", "*", "rate_table='{$table}' AND rate_itemid='{$itemid}' ")) {
 			$row = $sql->db_Fetch();
 			$rate_voters = $row['rate_voters'].".".$voter.".";
-			$sql->db_Update("rate", "rate_votes=rate_votes+1, rate_rating=rate_rating+'$rate', rate_voters='$rate_voters' WHERE rate_itemid='$itemid' ");
+			$sql->db_Update("rate", "rate_votes=rate_votes+1, rate_rating=rate_rating+'{$rate}', rate_voters='{$rate_voters}' WHERE rate_id='{$row['rate_id']}' ");
 		} else {
 			$sql->db_Insert("rate", " 0, '$table', '$itemid', '$rate', '1', '.".$voter.".' ");
 		}
diff -x .svn -ruN 0.7.7.src/e107_handlers/ren_help.php 0.7.11.src/e107_handlers/ren_help.php
--- 0.7.7.src/e107_handlers/ren_help.php	2006-08-08 22:10:58.000000000 -0500
+++ 0.7.11.src/e107_handlers/ren_help.php	2007-10-26 06:43:57.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/ren_help.php,v $
-|     $Revision: 1.60 $
-|     $Date: 2006/08/09 03:10:58 $
+|     $Revision: 1.64 $
+|     $Date: 2007/10/26 11:43:57 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -65,6 +65,7 @@
 	}
 
     $temp['news'] 		= $BBCODE_TEMPLATE_NEWSPOST;
+	$temp['submitnews']	= $BBCODE_TEMPLATE_SUBMITNEWS; 
 	$temp['extended']	= $BBCODE_TEMPLATE_NEWSPOST;
 	$temp['admin']		= $BBCODE_TEMPLATE_ADMIN;
 	$temp['mailout']	= $BBCODE_TEMPLATE_ADMIN."{BB=shortcode}";
@@ -130,6 +131,7 @@
 	var tdblk = '<td style=\'background-color: #000000; cursor: default; height: 10px; width: 10px;\'><\/td>';
 	var g = 1;
 	var s = 0;
+	var i, j, k;
 
 	function td_render(color) {
 		return '<td style=\'background-color: #' + color + '; height: 10px; width: 10px;\' onmousedown=\"addtext(\'[color=#' + color + '][/color]\')\"><\/td>';
@@ -163,7 +165,7 @@
 			}
 		}
 	}
-	document.write('<table cellspacing=\'1\' cellpadding=\'0\' style=\'cursor: hand; cursor: pointer; background-color: #000; width: 100%; border: 0px\'><tr>');
+	document.write('<table cellspacing=\'1\' cellpadding=\'0\' style=\'cursor: pointer; background-color: #000; width: 100%; border: 0px\'><tr>');
 	document.write(td_render(coloursgrey[0]) + tdblk + rows1 + rows2);
 	document.write('<\/tr><\/table>');
 	//]]>
@@ -282,25 +284,25 @@
 				<option value=''>".LANHELP_43."</option>";
 		foreach($filelist as $file)
 		{
-					if(isset($file['class']))
-					{
-						$ucinfo = "^".$file['class'];
-						$ucname = r_userclass_name($file['class']);
-					}
-					else
-					{
-						$ucinfo = "";
-						$ucname = r_userclass_name(0);
-					}
+			if(isset($file['class']))
+			{
+				$ucinfo = "^".$file['class'];
+				$ucname = r_userclass_name($file['class']);
+			}
+			else
+			{
+				$ucinfo = "";
+				$ucname = r_userclass_name(0);
+			}
 
-					if($file['id'])
-					{
-						$text .= "<option value=\"[file={e_BASE}request.php?".$file['id']."{$cinfo}]".$file['name']."[/file]\">".$file['name']." - $ucname</option>\n";
-											}
-					else
-					{
-						$text .= "<option value=\"[file={e_BASE}request.php?".$file['url']."{$cinfo}]".$file['name']."[/file]\">".$file['name']." - $ucname</option>\n";
-					}
+			if($file['id'])
+			{
+				$text .= "<option value=\"[file={e_BASE}request.php?".$file['id']."{$ucinfo}]".$file['name']."[/file]\">".$file['name']." - {$ucname}</option>\n";
+			}
+			else
+			{
+				$text .= "<option value=\"[file={e_BASE}request.php?".$file['url']."{$ucinfo}]".$file['name']."[/file]\">".$file['name']." - {$ucname}</option>\n";
+			}
 
 		}
 		$text .="</select>";
diff -x .svn -ruN 0.7.7.src/e107_handlers/resize_handler.php 0.7.11.src/e107_handlers/resize_handler.php
--- 0.7.7.src/e107_handlers/resize_handler.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/resize_handler.php	2007-12-20 14:51:12.000000000 -0600
@@ -11,145 +11,216 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/resize_handler.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2007/12/20 20:51:12 $
+|     $Author: e107steved $
+|
+| Mod to give correct return code if source image already smaller than max size
+|
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-/* 07-04-2004 - unknown: removed source/destination file rewriting, this should not break existing code */
-/* 09-04-2004 - unknown: source/destination file should be quoted, otherwise files with spaces can't be handled */
-function resize_image($source_file, $destination_file, $type = "upload", $model = "") {
-	 
+function resize_image($source_file, $destination_file, $type = "upload", $model = "") 
+{
+// $destination_file - 'stdout' sends direct to browser. Otherwise treated as file name	
+//						- if its a file, given '644' permissions
+// $type - "upload"
+//		 - numeric - sets new width of image
+//		 - anything else - default preference for image width used, or failing that, 120 pixels
+//			'avatar' is used
+// $model - if "copy", creates a new file from $destination_file with the prefix 'thumb_'. 
+//					Otherwise overwrites any existing $destination_file
+
+// Returns:  TRUE - essentially, if $destination_file (or a file with a modified name) is valid:
+//						- if resizing done
+//						- source and (ultimate) destination files are the same, and the image was smaller than the limits
+//						- destination was 'stdout', and file output successfully
+//			 FALSE - essentially, if there is not a valid output file available - usually, that resizing failed, or some other error.
+
 	global $pref;
 	 
 	$new_height = 0;
 	$mode = ($pref['resize_method'] ? $pref['resize_method'] : "gd2");
-	if ($type == "upload") {
-		$new_size = ($pref['im_width'] ? $pref['im_width'] : 400);
-	}
-	else if(is_numeric($type)) {
-		$new_size = $type;
-	} else {
-		$new_size = ($pref['im_width'] ? $pref['im_width'] : 120);
-		//avatar
-		$new_height = ($pref['im_height'] ? $pref['im_height'] : 100);
-		//avatar
+	if ($type == "upload") 
+	{
+	  $new_size = varset($pref['im_width'],400);
+	}
+	elseif(is_numeric($type)) 
+	{
+	  $new_size = $type;
+	} 
+	else 
+	{	// Use preferences or failing that hard-coded defaults for new size
+	  $new_size = varset($pref['im_width'], 120);
+	  $new_height = varset($pref['im_height'], 100);
 	}
 	 
-	$im_quality = ($pref['im_quality'] ? $pref['im_quality'] : 99);
+	$im_quality = varset($pref['im_quality'], 99);
 	 
 	$image_stats = getimagesize($source_file);
-	 
-	if ($image_stats[0] <= $type && is_numeric($type)) {
-		return false;
-	}
-	 
-	if ($image_stats == null) {
-		echo "<b>DEBUG</b> image_stats are null<br />";
-		return false;
-	}
-	 
-	if ($image_stats[2] != 1 && $image_stats[2] != 2 && $image_stats[2] != 3 && ($mode == 'gd1' || $mode == 'gd2')) {
-		echo "<b>DEBUG</b> Wrong image type<br />";
-		return FALSE;
-	}
-	$imagewidth = $image_stats[0];
-	$imageheight = $image_stats[1];
-	if ($imagewidth <= $new_size && ($imageheight <= $new_height || $new_height == 0)) {
-		return TRUE;
+	if ($image_stats == null) 
+	{
+//	  echo "<b>DEBUG</b> image_stats are null<br />";
+	  return false;
+	}
+	if (($image_stats[0] == 0) || ($image_stats[1] == 0))
+	{
+	  return FALSE;				// Zero sized image - shouldn't happen
+	}
+	 
+	// Check the image type. '1'=GIF, '2'=jpeg, '3' = PNG
+	if ($image_stats[2] != 1 && $image_stats[2] != 2 && $image_stats[2] != 3 && ($mode == 'gd1' || $mode == 'gd2')) 
+	{
+	  echo "<b>DEBUG</b> Wrong image type<br />";
+	  return FALSE;
+	}
+	
+	$imagewidth = $image_stats[0];		// Width of existing image
+	$imageheight = $image_stats[1];		// Height of existing image
+	if ($imagewidth <= $new_size && ($imageheight <= $new_height || $new_height == 0)) 
+	{  // Nothing to do if image width already smaller than the maximum
+	  // If we were basically ensuring an existing file was within limits, return TRUE
+	  // If we had to create a new file, return FALSE since it wasn't done.
+	  return (($source_file == $destination_file) && ($model != 'copy'));
 	}
+	
 	$ratio = ($imagewidth / $new_size);
 	$new_imageheight = round($imageheight / $ratio);
-	if (($new_height <= $new_imageheight) && $new_height > 0) {
+	if (($new_height <= $new_imageheight) && $new_height > 0) 
+	{
 		$ratio = $new_imageheight / $new_height;
 		$new_imageheight = $new_height;
 		$new_size = round($new_size / $ratio);
 		 
 	}
-	if ($mode == "ImageMagick") {
-		if ($destination_file == "stdout") {
-			/* if destination is stdout, output directly to the browser */
-			$destination_file = "jpg:-";
-			header("Content-type: image/jpeg");
-			passthru ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." '".$destination_file."'");
-		} else {
-			/* otherwise output to file */
-			if ($model == "copy") {
-				$name = substr($destination_file, (strrpos($destination_file, "/")+1));
-				$name2 = "thumb_".$name;
-				$destination_file = str_replace($name, $name2, $destination_file);
-			}
-			exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." '".$destination_file."'");
-			 
-		}
-	}
-	else if($mode == "gd1") {
-		if ($image_stats[2] == 2)
-		$src_img = imagecreatefromjpeg($source_file);
-		else
-			$src_img = imagecreatefrompng($source_file);
-		if (!$src_img) {
-			return FALSE;
-		}
-		$dst_img = imagecreate($new_size, $new_imageheight);
-		imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $new_size, $new_imageheight, $imagewidth, $imageheight);
-		if ($model == "copy") {
+
+	switch ($mode)
+	{
+	  case "ImageMagick" :
+	    if ($destination_file == "stdout") 
+		{		/* if destination is stdout, output directly to the browser */
+//		  $destination_file = "jpg:-";
+		  header("Content-type: image/jpeg");
+		  // Use double quotes instead of single to keep Bill happy
+		  passthru ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." \"jpg:-\"");
+		} 
+		else 
+		{		/* otherwise output to file */
+		  if ($model == "copy") 
+		  {
 			$name = substr($destination_file, (strrpos($destination_file, "/")+1));
 			$name2 = "thumb_".$name;
 			$destination_file = str_replace($name, $name2, $destination_file);
+		  }
+		  // Use double quotes instead of single to keep Bill happy
+//		  exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." '".$destination_file."'");
+		  exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." \"".$destination_file."\"");
+		}
+		break;
+	  case "gd1" :
+		switch ($image_stats[2])
+		{
+		  case IMAGETYPE_PNG : // 3 - PNG
+			$src_img = @imagecreatefrompng($source_file);
+			break;
+		  case IMAGETYPE_GIF : // 1 - GIF
+		    if (!function_exists('imagecreatefromgif')) return FALSE;		// Some versions of GD library don't support GIF
+			$src_img = @imagecreatefromgif($source_file);
+			break;
+		  case IMAGETYPE_JPEG :	// 2 - Jpeg
+		    $src_img = @imagecreatefromjpeg($source_file);
+			break;
+		  default :
+			return FALSE; // Unsupported image type
+		}
+		if (!$src_img) 
+		{
+		  return FALSE;
 		}
-		 
-		if ($destination_file == "stdout") {
-			header("Content-type: image/jpeg");
-			imagejpeg($dst_img, '', $im_quality);
-		} else {
-			imagejpeg($dst_img, $destination_file, $im_quality);
-			imagedestroy($src_img);
-			imagedestroy($dst_img);
-		}
-		 
-	}
-	else if($mode == "gd2") {
-		 
-		if ($image_stats[2] == 2)
-			$src_img = imagecreatefromjpeg($source_file);
-		else
-			$src_img = imagecreatefrompng($source_file);
-		if (!$src_img) {
-			return FALSE;
+		$dst_img = imagecreate($new_size, $new_imageheight);		// Create blank image of correct size as target
+		// Only next line is different between gd1 and gd2
+		imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $new_size, $new_imageheight, $imagewidth, $imageheight);
+		if ($model == "copy") 
+		{
+		  $name = substr($destination_file, (strrpos($destination_file, "/")+1));
+		  $name2 = "thumb_".$name;
+		  $destination_file = str_replace($name, $name2, $destination_file);
+		}
+		 
+		if ($destination_file == "stdout") 
+		{
+		  header("Content-type: image/jpeg");
+		  imagejpeg($dst_img, '', $im_quality);
+		} 
+		else 
+		{
+		  imagejpeg($dst_img, $destination_file, $im_quality);
+		  imagedestroy($src_img);
+		  imagedestroy($dst_img);
+		}
+		break;
+	  case "gd2" :
+		switch ($image_stats[2])
+		{
+		  case IMAGETYPE_PNG : // 3 - PNG
+			$src_img = @imagecreatefrompng($source_file);
+			break;
+		  case IMAGETYPE_GIF : // 1 - GIF
+		    if (!function_exists('imagecreatefromgif')) return FALSE;		// Some versions of GD library don't support GIF
+			$src_img = @imagecreatefromgif($source_file);
+			break;
+		  case IMAGETYPE_JPEG :	// 2 - Jpeg
+		    $src_img = @imagecreatefromjpeg($source_file);
+			break;
+		  default :
+			return FALSE; // Unsupported image type
+		}
+		if (!$src_img) 
+		{
+		  return FALSE;
 		}
 		 
 		$dst_img = imagecreatetruecolor($new_size, $new_imageheight);
+		// Only next line is different between gd1 and gd2
 		imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $new_size, $new_imageheight, $imagewidth, $imageheight);
-		 
-		if ($model == "copy") {
-			$name = substr($destination_file, (strrpos($destination_file, "/")+1));
-			$name2 = "thumb_".$name;
-			$destination_file = str_replace($name, $name2, $destination_file);
+		if ($model == "copy") 
+		{
+		  $name = substr($destination_file, (strrpos($destination_file, "/")+1));
+		  $name2 = "thumb_".$name;
+		  $destination_file = str_replace($name, $name2, $destination_file);
+		}
+		
+		if ($destination_file == "stdout") 
+		{
+		  header("Content-type: image/jpeg");
+		  imagejpeg($dst_img, '', $im_quality);
+		} 
+		else 
+		{
+		  imagejpeg($dst_img, $destination_file, $im_quality);
+		  imagedestroy($src_img);
+		  imagedestroy($dst_img);
 		}
-		if ($destination_file == "stdout") {
-			header("Content-type: image/jpeg");
-			imagejpeg($dst_img, '', $im_quality);
-		} else {
-			imagejpeg($dst_img, $destination_file, $im_quality);
-			imagedestroy($src_img);
-			imagedestroy($dst_img);
-		}
-	}
+		break;
+	}   // End switch($mode)
+
+	if ($destination_file == "stdout") return TRUE;		// Can't do anything more if file sent to stdout - assume success
 	 
 	@chmod($destination_file, 0644);
-	if ($pref['image_owner']) {
-		@chown($destination_file, $pref['image_owner']);
+	if ($pref['image_owner']) 
+	{
+	  @chown($destination_file, $pref['image_owner']);
 	}
 	 
 	$image_stats = getimagesize($destination_file);
-	if ($image_stats == null) {
-		//                @unlink($source_file);
-		return FALSE;
-	} else {
-		return TRUE;
+	if ($image_stats == null) 
+	{  
+	  return FALSE;
+	} 
+	else 
+	{
+	  return TRUE;
 	}
 }
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/search/comments_news.php 0.7.11.src/e107_handlers/search/comments_news.php
--- 0.7.7.src/e107_handlers/search/comments_news.php	2005-12-28 08:47:20.000000000 -0600
+++ 0.7.11.src/e107_handlers/search/comments_news.php	2007-04-24 15:19:55.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/comments_news.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/28 14:47:20 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2007/04/24 20:19:55 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$comments_title = LAN_98;
+$comments_title = LAN_SEARCH_98;
 $comments_type_id = 0;
 $comments_return['news'] = "n.news_title";
 $comments_table['news'] = "LEFT JOIN #news AS n ON c.comment_type=0 AND n.news_id = c.comment_item_id";
diff -x .svn -ruN 0.7.7.src/e107_handlers/search/comments_user.php 0.7.11.src/e107_handlers/search/comments_user.php
--- 0.7.7.src/e107_handlers/search/comments_user.php	2005-12-28 08:47:20.000000000 -0600
+++ 0.7.11.src/e107_handlers/search/comments_user.php	2007-04-24 15:19:55.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/comments_user.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/28 14:47:20 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2007/04/24 20:19:55 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$comments_title = LAN_98;
+$comments_title = LAN_SEARCH_98;
 $comments_type_id = 'profile';
 $comments_return['user'] = "u.user_name";
 $comments_table['user'] = "LEFT JOIN #user AS u ON c.comment_type='profile' AND u.user_id = c.comment_item_id";
diff -x .svn -ruN 0.7.7.src/e107_handlers/search/search_download.php 0.7.11.src/e107_handlers/search/search_download.php
--- 0.7.7.src/e107_handlers/search/search_download.php	2006-11-09 21:16:30.000000000 -0600
+++ 0.7.11.src/e107_handlers/search/search_download.php	2007-04-11 16:22:18.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_download.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/11/10 03:16:30 $
-|     $Author: sweetas $
+|     $Revision: 1.14 $
+|     $Date: 2007/04/11 21:22:18 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -43,7 +43,7 @@
 $return_fields = 'd.download_id, d.download_category, download_category_id, d.download_name, d.download_description, d.download_author, d.download_author_website, d.download_datestamp, d.download_class, c.download_category_name, c.download_category_class';
 $weights = array('1.2', '0.9', '0.6', '0.6', '0.4');
 $no_results = LAN_198;
-$where = "download_active = '1' AND d.download_visible IN (".USERCLASS_LIST.") AND c.download_category_class IN (".USERCLASS_LIST.") AND".$advanced_where;
+$where = "download_active > '0' AND d.download_visible IN (".USERCLASS_LIST.") AND c.download_category_class IN (".USERCLASS_LIST.") AND".$advanced_where;
 $order = array('download_datestamp' => DESC);
 $table = "download AS d LEFT JOIN #download_category AS c ON d.download_category = c.download_category_id";
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/search/search_pages.php 0.7.11.src/e107_handlers/search/search_pages.php
--- 0.7.7.src/e107_handlers/search/search_pages.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/search/search_pages.php	2007-11-04 14:41:31.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_pages.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2007/11/04 20:41:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -31,7 +31,7 @@
 $weights = array('1.2', '0.6');
 $no_results = LAN_198;
 
-$where = "page_class IN (".USERCLASS_LIST.") AND".$advanced_where;
+$where = "page_class IN (".USERCLASS_LIST.") AND `menu_name`='' AND".$advanced_where;
 $order = array('page_datestamp' => DESC);
 $table = "page";
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/search/search_user.php 0.7.11.src/e107_handlers/search/search_user.php
--- 0.7.7.src/e107_handlers/search/search_user.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/search/search_user.php	2007-09-22 14:48:30.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_user.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2007/09/22 19:48:30 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,7 +27,7 @@
 
 // basic
 $return_fields = 'user_id, user_name, user_email, user_signature, user_join';
-$search_fields = array('user_name', 'user_email', 'user_signature');
+$search_fields = array('user_name', 'user_signature');
 $weights = array('1.2', '0.6', '0.6', '0.6', '0.6');
 $no_results = LAN_198;
 $where = $advanced_where;
diff -x .svn -ruN 0.7.7.src/e107_handlers/secure_img_handler.php 0.7.11.src/e107_handlers/secure_img_handler.php
--- 0.7.7.src/e107_handlers/secure_img_handler.php	2006-10-16 17:46:52.000000000 -0500
+++ 0.7.11.src/e107_handlers/secure_img_handler.php	2007-11-05 14:12:22.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/secure_img_handler.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/10/16 22:46:52 $
-|     $Author: e107coders $
+|     $Revision: 1.10 $
+|     $Date: 2007/11/05 20:12:22 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -30,13 +30,18 @@
 	function create_code() {
 		global $pref, $sql, $IMAGES_DIRECTORY, $HANDLERS_DIRECTORY;
 
+/*
 		require_once('e107_class.php');
 		$e107 = new e107(false, false);
 		$e107->set_paths();
 
 		$imgpy = str_replace($HANDLERS_DIRECTORY, "", $e107->file_path);
+*/
+		$imgp = dirname(__FILE__);
+		if (substr($imgp,-1,1) != '/') $imgp .= '/';
+		if (!isset($HANDLERS_DIRECTORY)) require_once($imgp.'../e107_config.php');
+		$imgp = str_replace($HANDLERS_DIRECTORY,$IMAGES_DIRECTORY,$imgp);
 
-		$imgp = $imgpy.$IMAGES_DIRECTORY;
 		mt_srand ((double)microtime() * 1000000);
 		$maxran = 1000000;
 		$rand_num = mt_rand(0, $maxran);
diff -x .svn -ruN 0.7.7.src/e107_handlers/secure_img_render.php 0.7.11.src/e107_handlers/secure_img_render.php
--- 0.7.7.src/e107_handlers/secure_img_render.php	2006-11-20 05:48:44.000000000 -0600
+++ 0.7.11.src/e107_handlers/secure_img_render.php	2007-11-13 07:48:30.000000000 -0600
@@ -11,16 +11,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/secure_img_render.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/11/20 11:48:44 $
-|     $Author: mrpete $
+|     $Revision: 1.19 $
+|     $Date: 2007/11/13 13:48:30 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 while (@ob_end_clean());
-
-function e107_ini_set($var, $value){
-	if (function_exists('ini_set')){
+ob_start();
+function e107_ini_set($var, $value)
+{
+	if (function_exists('ini_set'))
+	{
 		ini_set($var, $value);
 	}
 }
@@ -32,8 +34,10 @@
 e107_ini_set('session.use_only_cookies', 1);
 e107_ini_set('session.use_trans_sid',    0);
 
-while (list($global) = each($GLOBALS)) {
-	if (!preg_match('/^(_SERVER|GLOBALS)$/', $global)) {
+while (list($global) = each($GLOBALS))
+{
+	if (!preg_match('/^(_SERVER|GLOBALS)$/', $global))
+	{
 		unset($$global);
 	}
 }
@@ -46,28 +50,30 @@
 
 $recnum = preg_replace("#\D#","",e_QUERY);
 
-if($recnum == false){
-	exit;
-}
+if($recnum == false){ exit; }
 
 $mySQLserver = "";
 
-@include_once(dirname(__FILE__)."e107_config.php");
-
 $a = 0;
 $p = "";
 
-while(!$mySQLserver && $a < 5){
-	$a ++;
-	$p .= "../";
-	@include_once($p."e107_config.php");
+$ifile = dirname(__FILE__);
+if (substr($ifile,-1,1) != '/') $ifile .= '/';
+@include_once($ifile."e107_config.php");
+
+while(!$mySQLserver && $a < 5)
+{
+  $a ++;
+  $p .= "../";
+  @include_once($ifile.$p.'e107_config.php');		// *** Revised
 }
 
 mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
 mysql_select_db($mySQLdefaultdb);
 
 $result = mysql_query("SELECT tmp_info FROM {$mySQLprefix}tmp WHERE tmp_ip = '{$recnum}'");
-if(!$row = mysql_fetch_array($result)) {
+if(!$row = mysql_fetch_array($result))
+{
 	exit;
 }
 
@@ -75,8 +81,10 @@
 
 $type = "none";
 
-foreach($imgtypes as $t) {
-	if(function_exists("imagecreatefrom".$t)) {
+foreach($imgtypes as $t)
+{
+	if(function_exists("imagecreatefrom".$t))
+	{
 		$type = $t;
 		break;
 	}
@@ -84,7 +92,8 @@
 
 $path = realpath(dirname(__FILE__)."/../")."/".$IMAGES_DIRECTORY;
 
-if(is_readable($path."secure_image_custom.php")) {
+if(is_readable($path."secure_image_custom.php"))
+{
 	require_once($path."secure_image_custom.php");
 	/*   Example secure_image_custom.php file:
 
@@ -94,15 +103,18 @@
 	$secureimg['x']		= "6";
 	$secureimg['y']		= "22";
 	$secureimg['font'] 	= "imagecode.ttf";
-	$secureimg['color'] = array(90,90,90); // red,green,blue
+	$secureimg['color'] = "90,90,90"; // red,green,blue
 
 	*/
 	$bg_file = $secureimg['image'];
-} else {
+}
+else
+{
 	$bg_file = "generic/code_bg";
 }
 
-switch($type) {
+switch($type)
+{
 	case "jpeg":
 		$image = ImageCreateFromJPEG($path.$bg_file.".jpg");
 		break;
@@ -114,22 +126,30 @@
 		break;
 }
 
-if(isset($secureimg['color'])) {
+if(isset($secureimg['color']))
+{
 	$tmp = explode(",",$secureimg['color']);
 	$text_color = ImageColorAllocate($image,$tmp[0],$tmp[1],$tmp[2]);
-} else {
+}
+else
+{
 	$text_color = ImageColorAllocate($image, 90, 90, 90);
 }
 
 header("Content-type: image/{$type}");
 
-if(isset($secureimg['font']) && is_readable($path.$secureimg['font'])){
+if(isset($secureimg['font']) && is_readable($path.$secureimg['font']))
+{
 	imagettftext($image, $secureimg['size'],$secureimg['angle'], $secureimg['x'], $secureimg['y'], $text_color,$path.$secureimg['font'], $code);
-} else {
+}
+else
+{
 	imagestring ($image, 5, 12, 2, $code, $text_color);
 }
 
-switch($type) {
+ob_end_clean();
+switch($type)
+{
 	case "jpeg":
 		imagejpeg($image);
 		break;
@@ -142,4 +162,3 @@
 }
 
 imagedestroy($image);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/shortcode_handler.php 0.7.11.src/e107_handlers/shortcode_handler.php
--- 0.7.7.src/e107_handlers/shortcode_handler.php	2006-11-28 06:37:46.000000000 -0600
+++ 0.7.11.src/e107_handlers/shortcode_handler.php	2007-07-18 15:46:42.000000000 -0500
@@ -12,9 +12,9 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/shortcode_handler.php,v $
-| $Revision: 1.39 $
-| $Date: 2006/11/28 12:37:46 $
-| $Author: mcfly_e107 $
+| $Revision: 1.44 $
+| $Date: 2007/07/18 20:46:42 $
+| $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -25,16 +25,16 @@
 }
 
 class e_shortcode {
-	var $scList;
-	var $parseSCFiles;
-	var $addedCodes;
-	var $registered_codes;
+	var $scList;					// The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
+	var $parseSCFiles;				// True if shortcode file has been parsed
+	var $addedCodes;				// Apparently not used
+	var $registered_codes;			// Shortcodes added by plugins
 
 	function e_shortcode()
 	{
 		global $pref, $register_sc;
 
-		if($pref['shortcode_list'] != '')
+		if(varset($pref['shortcode_list'],'') != '')
 		{
         	foreach($pref['shortcode_list'] as $path=>$namearray)
 			{
@@ -43,7 +43,7 @@
 					$code = strtoupper($code);
 					$this->registered_codes[$code]['type'] = 'plugin';
                 	$this->registered_codes[$code]['path'] = $path;
-                  //  $this->registered_codes[$code]['perms'] = $uclass;
+                    $this->registered_codes[$code]['perms'] = $uclass;			// Add this in
 				}
 			}
 		}
@@ -78,13 +78,13 @@
 
 	function doCode($matches)
 	{
-		global $pref, $e107cache, $menu_pref, $sc_style, $parm;
+		global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
 
 		if(strpos($matches[1], E_NL) !== false)
 		{
 			return $matches[0];
 		}
-		
+
 		if (strpos($matches[1], '='))
 		{
 			list($code, $parm) = explode("=", $matches[1], 2);
@@ -96,9 +96,10 @@
 		}
 		$parm = trim($parm);
 
-		if (E107_DEBUG_LEVEL)
+		if (E107_DBG_BBSC)
 		{
 			global $db_debug;
+			$sql->db_Mark_Time("SC $code");
 			$db_debug->logCode(2, $code, $parm, "");
 		}
 
@@ -108,13 +109,15 @@
 		}
 		else
 		{
+			$sc_perms = e_UC_PUBLIC;			// Default permissions are 'everybody'
 			if ($this->parseSCFiles == TRUE)
 			{
 				if (is_array($this -> registered_codes) && array_key_exists($code, $this->registered_codes))
 				{
 					if($this->registered_codes[$code]['type'] == 'plugin')
 					{
-						$scFile = e_PLUGIN.strtolower($this->registered_codes[$code]['path']).'/'.strtolower($code).'.sc';
+					  if (isset($this->registered_codes[$code]['perms'])) $sc_perms = $this->registered_codes[$code]['perms'];
+					  $scFile = e_PLUGIN.strtolower($this->registered_codes[$code]['path']).'/'.strtolower($code).'.sc';
 					}
 					else
 					{
@@ -125,22 +128,36 @@
 				{
 						$scFile = e_FILE."shortcode/".strtolower($code).".sc";
 				}
-				if (file_exists($scFile)) {
+				if (!check_class($sc_perms))
+				{	// Mainly to pick up e_UC_NOBODY
+				  $shortcode = 'return;';
+				  $this->scList[$code] = 'return;';
+				}
+				elseif (file_exists($scFile)) 
+				{
 					$shortcode = file_get_contents($scFile);
 					$this->scList[$code] = $shortcode;
 				}
 			}
 		}
 
-        if(E107_DBG_SC){
-			echo " sc= ".str_replace(e_FILE."shortcode/","",$scFile)."<br />";
+		if (!isset($shortcode))
+		{
+		  if(E107_DBG_BBSC) trigger_error("shortcode not found:{".$code."}", E_USER_ERROR);
+		  return $matches[0];
+		}
+
+        if(E107_DBG_SC)
+		{
+		  	echo ($scFile) ? "<br />sc_file= ".str_replace(e_FILE."shortcode/","",$scFile)."<br />" : "";
+			echo "<br />sc= <b>$code</b>";
 		}
 
 		if(E107_DBG_BBSC)
 		{
-			trigger_error("starting shortcode {".$code."}", E_USER_ERROR);
+		  trigger_error("starting shortcode {".$code."}", E_USER_ERROR);
 		}
-		$ret = (isset($shortcode) ? eval($shortcode) : "");
+		$ret = eval($shortcode);
 
 		if($ret != '' || is_numeric($ret))
 		{
@@ -156,6 +173,9 @@
 				}
 			}
 		}
+		if (E107_DBG_SC) {
+			$sql->db_Mark_Time("(SC $code Done)");
+		}
 		return $ret;
 	}
 
diff -x .svn -ruN 0.7.7.src/e107_handlers/sitelinks_class.php 0.7.11.src/e107_handlers/sitelinks_class.php
--- 0.7.7.src/e107_handlers/sitelinks_class.php	2006-11-23 21:17:48.000000000 -0600
+++ 0.7.11.src/e107_handlers/sitelinks_class.php	2007-08-17 23:55:21.000000000 -0500
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/sitelinks_class.php,v $
-|     $Revision: 1.107 $
-|     $Date: 2006/11/24 03:17:48 $
+|     $Revision: 1.118 $
+|     $Date: 2007/08/18 04:55:21 $
 |     $Author: e107coders $
 +---------------------------------------------------------------+
 */
@@ -31,352 +31,382 @@
 class sitelinks
 {
 
-	var $eLinkList;
+    var $eLinkList;
 
-	function getlinks($cat=1)
-	{
+    function getlinks($cat=1)
+    {
 
-		global $sql;
-		if ($sql->db_Select('links', '*', "link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC")){
-			while ($row = $sql->db_Fetch())
-			{
-			//	if (substr($row['link_name'], 0, 8) == 'submenu.'){
-			//		$tmp=explode('.', $row['link_name'], 3);
-			 //		$this->eLinkList[$tmp[1]][]=$row;
-				if (isset($row['link_parent']) && $row['link_parent'] != 0){
-					$this->eLinkList['sub_'.$row['link_parent']][]=$row;
-				}else{
-					$this->eLinkList['head_menu'][] = $row;
-				}
-			}
-		}
-
-	}
-
-	function get($cat=1, $style='', $css_class = false)
-	{
-		global $pref, $ns, $e107cache, $linkstyle;
-		$usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
-
-		if ($usecache && !strpos(e_SELF, e_ADMIN) & ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY)))) {
-			return $data;
-		}
-
-		if (LINKDISPLAY == 4) {
-			require_once(e_PLUGIN.'ypslide_menu/ypslide_menu.php');
-			return;
-		}
-
-		$this->getlinks($cat);
-
-		// are these defines used at all ?
-
-		if(!defined('PRELINKTITLE')){
-			define('PRELINKTITLE', '');
-		}
-		if(!defined('PRELINKTITLE')){
-			define('POSTLINKTITLE', '');
-		}
-		// -----------------------------
-
-		// where did link alignment go?
-		if (!defined('LINKALIGN')) { define(LINKALIGN, ''); }
-
-		if(!$style){
-			$style['prelink'] = defined('PRELINK') ? PRELINK : '';
-			$style['postlink'] = defined('POSTLINK') ? POSTLINK : '';
-			$style['linkclass'] = defined('LINKCLASS') ? LINKCLASS : "";
-			$style['linkclass_hilite'] = defined('LINKCLASS_HILITE') ? LINKCLASS_HILITE : "";
-			$style['linkstart_hilite'] = defined('LINKSTART_HILITE') ? LINKSTART_HILITE : "";
-			$style['linkstart'] = defined('LINKSTART') ? LINKSTART : '';
-			$style['linkdisplay'] = defined('LINKDISPLAY') ? LINKDISPLAY : '';
-			$style['linkend'] = defined('LINKEND') ? LINKEND : '';
-			$style['linkseparator'] = defined('LINKSEPARATOR') ? LINKSEPARATOR : '';
-		}
+        global $sql;
+        if ($sql->db_Select('links', '*', "link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC")){
+            while ($row = $sql->db_Fetch())
+            {
+            //  if (substr($row['link_name'], 0, 8) == 'submenu.'){
+            //      $tmp=explode('.', $row['link_name'], 3);
+             //     $this->eLinkList[$tmp[1]][]=$row;
+                if (isset($row['link_parent']) && $row['link_parent'] != 0){
+                    $this->eLinkList['sub_'.$row['link_parent']][]=$row;
+                }else{
+                    $this->eLinkList['head_menu'][] = $row;
+                }
+            }
+        }
+
+    }
+
+    function get($cat=1, $style='', $css_class = false)
+    {
+        global $pref, $ns, $e107cache, $linkstyle;
+        $usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
+
+        if ($usecache && !strpos(e_SELF, e_ADMIN) & ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY)))) {
+            return $data;
+        }
+
+        if (LINKDISPLAY == 4) {
+            require_once(e_PLUGIN.'ypslide_menu/ypslide_menu.php');
+            return;
+        }
+
+        $this->getlinks($cat);
+
+        // are these defines used at all ?
+
+        if(!defined('PRELINKTITLE')){
+            define('PRELINKTITLE', '');
+        }
+        if(!defined('PRELINKTITLE')){
+            define('POSTLINKTITLE', '');
+        }
+        // -----------------------------
+
+        // where did link alignment go?
+        if (!defined('LINKALIGN')) { define(LINKALIGN, ''); }
+
+        if(!$style){
+            $style['prelink'] = defined('PRELINK') ? PRELINK : '';
+            $style['postlink'] = defined('POSTLINK') ? POSTLINK : '';
+            $style['linkclass'] = defined('LINKCLASS') ? LINKCLASS : "";
+            $style['linkclass_hilite'] = defined('LINKCLASS_HILITE') ? LINKCLASS_HILITE : "";
+            $style['linkstart_hilite'] = defined('LINKSTART_HILITE') ? LINKSTART_HILITE : "";
+            $style['linkstart'] = defined('LINKSTART') ? LINKSTART : '';
+            $style['linkdisplay'] = defined('LINKDISPLAY') ? LINKDISPLAY : '';
+            $style['linkend'] = defined('LINKEND') ? LINKEND : '';
+            $style['linkseparator'] = defined('LINKSEPARATOR') ? LINKSEPARATOR : '';
+        }
 
     // Sublink styles.- replacing the tree-menu.
         if(isset($style['sublinkdisplay']) || isset($style['subindent']) || isset($style['sublinkclass']) || isset($style['sublinkstart']) || isset($style['sublinkend']) || isset($style['subpostlink'])){
-			foreach($style as $key=>$val){
-			  	$aSubStyle[$key] = ($style["sub".$key]) ? $style["sub".$key] : $style[$key];
-			}
+            foreach($style as $key=>$val){
+                $aSubStyle[$key] = ($style["sub".$key]) ? $style["sub".$key] : $style[$key];
+            }
         }else{
-				$style['subindent'] = "&nbsp;&nbsp;";
-				$aSubStyle = $style;
-		}
-
-		$text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
-
-		if ($style['linkdisplay'] != 3)	{
-			foreach ($this->eLinkList['head_menu'] as $key => $link){
-				$main_linkid = "sub_".$link['link_id'];
-
-				$link['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !$style['linkmainonly'] && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ?  TRUE : FALSE;
-
-				$render_link[$key] = $this->makeLink($link,'', $style, $css_class);
-
-				if(!defined("LINKSRENDERONLYMAIN") && $style['linkmainonly']!= TRUE)	/* if this is defined in theme.php only main links will be rendered */
-				{
-
-					// if there's a submenu. :
-					if (isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])){
-						$substyle = (strpos(e_SELF, $link['link_url']) !== FALSE || strpos(e_SELF, $link['link_name']) !== FALSE || $link['link_expand'] == FALSE) ? "compact" : "none";   // expanding sub-menus.
-						$render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
-						foreach ($this->eLinkList[$main_linkid] as $sub){
-							$render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
-						}
-						$render_link[$key] .= "\n</div>\n\n";
-					}
-				}
-			}
-			$text .= implode($style['linkseparator'], $render_link);
-			$text .= $style['postlink'];
-			if ($style['linkdisplay'] == 2)	{
-				$text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks', TRUE);
-			}
-		}
-		else
-		{
-			foreach($this->eLinkList['head_menu'] as $link)
-			{
-				if (!count($this->eLinkList['sub_'.$link['link_id']]))
-				{
-					$text .= $this->makeLink($link,'', $style, $css_class);
-				}
-				$text .= $style['postlink'];
-			}
-			$text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks_main', TRUE);
-			foreach(array_keys($this->eLinkList) as $k)
-			{
-				$mnu = $style['prelink'];
-				foreach($this->eLinkList[$k] as $link)
-				{
-					if ($k != 'head_menu')
-					{
-						$mnu .= $this->makeLink($link, TRUE, $style, $css_class);
-					}
-				}
-				$mnu .= $style['postlink'];
-				$text .= $ns->tablerender($k, $mnu, 'sitelinks_sub', TRUE);
-			}
-		}
-		$text .= "\n\n\n<!--- end Site Links -->\n\n\n";
-		if($usecache)
-		{
-			$e107cache->set('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY), $text);
-		}
-	 	return $text;
-	}
-
-	function makeLink($linkInfo, $submenu = FALSE, $style='', $css_class = false)
-	{
-		global $pref,$tp;
-
-		// Start with an empty link
-		$linkstart = $indent = $linkadd = $screentip = $href = $link_append = '';
-
-		// If submenu: Fix Name, Add Indentation.
-		if ($submenu == TRUE) {
-			if(substr($linkInfo['link_name'],0,8) == "submenu."){
-				$tmp = explode('.', $linkInfo['link_name'], 3);
-				$linkInfo['link_name'] = $tmp[2];
-			}
-			$indent = ($style['linkdisplay'] != 3) ? $style['subindent'] : "";
-		}
-
-		$linkInfo['link_url'] = $tp -> replaceConstants($linkInfo['link_url'],TRUE); // replace {e_xxxx}
-
-		if(strpos($linkInfo['link_url'],"{") !== FALSE){
-			$linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage.
-		}
-		// By default links are not highlighted.
-		$linkstart = $style['linkstart'];
-		$linkadd = ($style['linkclass']) ? " class='".$style['linkclass']."'" : "";
-		$linkadd = ($css_class) ? " class='".$css_class."'" : $linkadd;
-
-		// Check for screentip regardless of URL.
-		if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description']){
-			$screentip = " title = \"".$tp->toHTML($linkInfo['link_description'],"","value emotes_off defs no_hook")."\"";
-		}
-
-		// Check if its expandable first. It should override its URL.
-		if (isset($linkInfo['link_expand']) && $linkInfo['link_expand']){
-			$href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
-		} elseif ($linkInfo['link_url']){
-
-			// Only add the e_BASE if it actually has an URL.
-			$linkInfo['link_url'] = (strpos($linkInfo['link_url'], '://') === FALSE && strpos($linkInfo['link_url'], 'mailto:') !== 0 ? e_HTTP.$linkInfo['link_url'] : $linkInfo['link_url']);
-
-			// Only check if its highlighted if it has an URL
-			if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE) {
-				$linkstart = (isset($style['linkstart_hilite'])) ? $style['linkstart_hilite'] : "";
-				$highlighted = TRUE;
-			}
-			if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE) {
-				$linkadd = (isset($style['linkclass_hilite'])) ? " class='".$style['linkclass_hilite']."'" : "";
-				$highlighted = TRUE;
-			}
-
-			if ($linkInfo['link_open'] == 4 || $linkInfo['link_open'] == 5){
-				$dimen = ($linkInfo['link_open'] == 4) ? "600,400" : "800,600";
-				$href = " href=\"javascript:open_window('".$linkInfo['link_url']."',{$dimen})\"";
-			} else {
-				$href = " href='".$linkInfo['link_url']."'";
-			}
-
-			// Open link in a new window.  (equivalent of target='_blank' )
-			$link_append = ($linkInfo['link_open'] == 1) ? " rel='external'" : "";
-		}
-
-		// Remove default images if its a button and add new image at the start.
-		if ($linkInfo['link_button']){
-			$linkstart = preg_replace('/\<img.*\>/si', '', $linkstart);
-			$linkstart .= "<img src='".e_IMAGE_ABS."icons/".$linkInfo['link_button']."' alt='' style='vertical-align:middle' />";
-		}
+                $style['subindent'] = "&nbsp;&nbsp;";
+                $aSubStyle = $style;
+        }
+
+        $text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
+
+        if ($style['linkdisplay'] != 3) {
+            foreach ($this->eLinkList['head_menu'] as $key => $link){
+                $main_linkid = "sub_".$link['link_id'];
+
+                $link['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !$style['linkmainonly'] && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ?  TRUE : FALSE;
+
+                $render_link[$key] = $this->makeLink($link,'', $style, $css_class);
+
+                if(!defined("LINKSRENDERONLYMAIN") && !varset($style['linkmainonly']))  /* if this is defined in theme.php only main links will be rendered */
+                {
+
+                    // if there's a submenu. :
+                    if (isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])){
+                        foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
+                        {
+                            if($this->hilite($val['link_url'],TRUE)== TRUE || $link['link_expand'] == FALSE)
+                            {
+                                $substyle = "compact";
+                                break;
+                            }
+                            else
+                            {
+                                $substyle = "none";
+                            }
+                        }
+                        $render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
+                        foreach ($this->eLinkList[$main_linkid] as $sub){
+                            $render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
+                        }
+                        $render_link[$key] .= "\n</div>\n\n";
+                    }
+                }
+            }
+            $text .= implode($style['linkseparator'], $render_link);
+            $text .= $style['postlink'];
+            if ($style['linkdisplay'] == 2) {
+                $text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks', TRUE);
+            }
+        }
+        else
+        {
+            foreach($this->eLinkList['head_menu'] as $link)
+            {
+                if (!count($this->eLinkList['sub_'.$link['link_id']]))
+                {
+                    $text .= $this->makeLink($link,'', $style, $css_class);
+                }
+                $text .= $style['postlink'];
+            }
+            $text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks_main', TRUE);
+            foreach(array_keys($this->eLinkList) as $k)
+            {
+                $mnu = $style['prelink'];
+                foreach($this->eLinkList[$k] as $link)
+                {
+                    if ($k != 'head_menu')
+                    {
+                        $mnu .= $this->makeLink($link, TRUE, $style, $css_class);
+                    }
+                }
+                $mnu .= $style['postlink'];
+                $text .= $ns->tablerender($k, $mnu, 'sitelinks_sub', TRUE);
+            }
+        }
+        $text .= "\n\n\n<!--- end Site Links -->\n\n\n";
+        if($usecache)
+        {
+            $e107cache->set('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY), $text);
+        }
+        return $text;
+    }
+
+    function makeLink($linkInfo, $submenu = FALSE, $style='', $css_class = false)
+    {
+        global $pref,$tp;
+
+        // Start with an empty link
+        $linkstart = $indent = $linkadd = $screentip = $href = $link_append = '';
+        $highlighted = FALSE;
+
+        // If submenu: Fix Name, Add Indentation.
+        if ($submenu == TRUE) {
+            if(substr($linkInfo['link_name'],0,8) == "submenu."){
+                $tmp = explode('.', $linkInfo['link_name'], 3);
+                $linkInfo['link_name'] = $tmp[2];
+            }
+            $indent = ($style['linkdisplay'] != 3) ? $style['subindent'] : "";
+        }
+
+        // Convert any {e_XXX} to absolute URLs (relative ones sometimes get broken by adding e_HTTP at the front)
+        $linkInfo['link_url'] = $tp -> replaceConstants($linkInfo['link_url'], TRUE, TRUE); // replace {e_xxxx}
+
+        if(strpos($linkInfo['link_url'],"{") !== FALSE){
+            $linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage.
+        }
+        // By default links are not highlighted.
+        $linkstart = $style['linkstart'];
+        $linkadd = ($style['linkclass']) ? " class='".$style['linkclass']."'" : "";
+        $linkadd = ($css_class) ? " class='".$css_class."'" : $linkadd;
+
+        // Check for screentip regardless of URL.
+        if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description']){
+            $screentip = " title = \"".$tp->toHTML($linkInfo['link_description'],"","value, emotes_off, defs, no_hook")."\"";
+        }
+
+        // Check if its expandable first. It should override its URL.
+        if (isset($linkInfo['link_expand']) && $linkInfo['link_expand']){
+            $href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
+        } elseif ($linkInfo['link_url']){
+
+            // Only add the e_BASE if it actually has an URL.
+            $linkInfo['link_url'] = (strpos($linkInfo['link_url'], '://') === FALSE && strpos($linkInfo['link_url'], 'mailto:') !== 0 ? e_HTTP.$linkInfo['link_url'] : $linkInfo['link_url']);
+
+            // Only check if its highlighted if it has an URL
+            if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE) {
+                $linkstart = (isset($style['linkstart_hilite'])) ? $style['linkstart_hilite'] : "";
+                $highlighted = TRUE;
+            }
+            if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE) {
+                $linkadd = (isset($style['linkclass_hilite'])) ? " class='".$style['linkclass_hilite']."'" : "";
+                $highlighted = TRUE;
+            }
+
+            if ($linkInfo['link_open'] == 4 || $linkInfo['link_open'] == 5){
+                $dimen = ($linkInfo['link_open'] == 4) ? "600,400" : "800,600";
+                $href = " href=\"javascript:open_window('".$linkInfo['link_url']."',{$dimen})\"";
+            } else {
+                $href = " href='".$linkInfo['link_url']."'";
+            }
+
+            // Open link in a new window.  (equivalent of target='_blank' )
+            $link_append = ($linkInfo['link_open'] == 1) ? " rel='external'" : "";
+        }
+
+        // Remove default images if its a button and add new image at the start.
+        if ($linkInfo['link_button']){
+            $linkstart = preg_replace('/\<img.*\>/si', '', $linkstart);
+            $linkstart .= "<img src='".e_IMAGE_ABS."icons/".$linkInfo['link_button']."' alt='' style='vertical-align:middle' />";
+        }
 
-		// mobile phone support.
-		$accesskey = (isset($style['accesskey']) && $style['accesskey']==TRUE) ? " accesskey='".$linkInfo['link_order']."' " : "";
+        // mobile phone support.
+        $accesskey = (isset($style['accesskey']) && $style['accesskey']==TRUE) ? " accesskey='".$linkInfo['link_order']."' " : "";
         $accessdigit = (isset($style['accessdigit'],$style['accesskey']) && $style['accessdigit']==TRUE && $style['accesskey']==TRUE) ? $linkInfo['link_order'].". " : "";
 
-		// If its a link.. make a link
-		$_link = "";
-		$_link .= $accessdigit;
-		if (!empty($href) && (($style['hilite_nolink'] && $highlighted)!=TRUE)){
-			$_link .= "<a".$linkadd.$screentip.$href.$link_append.$accesskey.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off defs no_hook")."</a>";
-		// If its not a link, but has a class or screentip do span:
-		}elseif (!empty($linkadd) || !empty($screentip)){
-			$_link .= "<span".$linkadd.$screentip.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off defs no_hook")."</span>";
-			// Else just the name:
-		}else {
-			$_link .= $tp->toHTML($linkInfo['link_name'],"","emotes_off defs no_hook");
-		}
+        // If its a link.. make a link
+        $_link = "";
+        $_link .= $accessdigit;
+        if (!empty($href) && ((varset($style['hilite_nolink']) && $highlighted)!=TRUE)){
+            $_link .= "<a".$linkadd.$screentip.$href.$link_append.$accesskey.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</a>";
+        // If its not a link, but has a class or screentip do span:
+        }elseif (!empty($linkadd) || !empty($screentip)){
+            $_link .= "<span".$linkadd.$screentip.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</span>";
+            // Else just the name:
+        }else {
+            $_link .= $tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook");
+        }
 
-		$_link = $linkstart.$indent.$_link;
+        $_link = $linkstart.$indent.$_link;
 
-		return $_link.$style['linkend']."\n";
-	}
+        return $_link.$style['linkend']."\n";
+    }
 
 
 
 
 
 function hilite($link,$enabled=''){
-	global $PLUGINS_DIRECTORY,$tp,$pref;
+    global $PLUGINS_DIRECTORY,$tp,$pref;
     if(!$enabled){ return FALSE; }
 
-    $link = $tp->replaceConstants($link,TRUE);
-  	$tmp = explode("?",$link);
+    $link = $tp->replaceConstants($link, '', TRUE);
+    $tmp = explode("?",$link);
     $link_qry = (isset($tmp[1])) ? $tmp[1] : "";
     $link_slf = (isset($tmp[0])) ? $tmp[0] : "";
-	$link_pge = basename($link_slf);
-	$link_match = strpos(e_SELF,$tmp[0]);
+    $link_pge = basename($link_slf);
+    $link_match = strpos(e_SELF,$tmp[0]);
 
     if(e_MENU == "debug" && getperms('0'))
-	{
-		echo "<br />link= ".$link;
-		echo "<br />link_q= ".$link_qry;
-		echo "<br />url= ".e_PAGE;
-		echo "<br />url_query= ".e_QUERY."<br />";
+    {
+        echo "<br />link= ".$link;
+        echo "<br />link_q= ".$link_qry;
+        echo "<br />url= ".e_PAGE;
+        echo "<br />url_query= ".e_QUERY."<br />";
 
-	}
+    }
 
 // ----------- highlight overriding - set the link matching in the page itself.
 
-	if(defined("HILITE")){
-		if(strpos($link,HILITE)){
-        	return TRUE;
-		}
-	}
+    if(defined("HILITE")){
+        if(strpos($link,HILITE)){
+            return TRUE;
+        }
+    }
 
 
 // --------------- highlighting for 'HOME'. ----------------
-	global $pref;
- 	list($fp,$fp_q) = explode("?",$pref['frontpage']['all']."?");
-	if(strpos(e_SELF,"/".$pref['frontpage']['all'])!== FALSE && $fp_q == $tmp[1] && $link == e_HTTP."index.php"){
-	  	return TRUE;
-	}
+    global $pref;
+    if (isset($pref['frontpage']['all']))
+    {
+      list($fp,$fp_q) = explode("?",$pref['frontpage']['all']."?");
+      if (strpos(e_SELF,"/".$pref['frontpage']['all'])!== FALSE && $fp_q == $tmp[1] && $link == e_HTTP."index.php")
+      {
+        return TRUE;
+      }
+    }
 
 // --------------- highlighting for plugins. ----------------
-		if(stristr($link, $PLUGINS_DIRECTORY) !== FALSE && stristr($link, "custompages") === FALSE){
+        if(stristr($link, $PLUGINS_DIRECTORY) !== FALSE && stristr($link, "custompages") === FALSE){
 
-			if($link_qry)
-			{  // plugin links with queries
+            if($link_qry)
+            {  // plugin links with queries
                 $subq = explode("?",$link);
-				if(strpos(e_SELF,$subq[0]) && e_QUERY == $subq[1]){
-			   		return TRUE;
-				}else{
-				  	return FALSE;
-				}
-			}
-			else
-			{  // plugin links without queries
-				$link = str_replace("../", "", $link);
-		   		if(stristr(dirname(e_SELF), dirname($link)) !== FALSE){
- 			 		return TRUE;
-				}
-			}
+                if(strpos(e_SELF,$subq[0]) && e_QUERY == $subq[1]){
+                    return TRUE;
+                }else{
+                    return FALSE;
+                }
+            }
+            else
+            {  // plugin links without queries
+                $link = str_replace("../", "", $link);
+                if(stristr(dirname(e_SELF), dirname($link)) !== FALSE){
+                    return TRUE;
+                }
+            }
             return FALSE;
-		}
+        }
 
 // --------------- highlight for news items.----------------
 // eg. news.php, news.php?list.1 or news.php?cat.2 etc
-	if(substr(basename($link),0,8) == "news.php")
-	{
-		if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) {
-
-			$lnk = explode(".",$link_qry); // link queries.
-			$qry = explode(".",e_QUERY); // current page queries.
-
-			if($qry[0] == "item"){
-				return ($qry[2] == $lnk[1]) ? TRUE : FALSE;
-     		}
-
-			if($lnk[0] == $qry[0] && $lnk[1] == $qry[1]){
-            	return TRUE;
-			}
-
-		}
-		elseif (!e_QUERY && e_PAGE == "news.php")
-		{
-
-		   	return TRUE;
-		}
-			return FALSE;
+    if(substr(basename($link),0,8) == "news.php")
+    {
 
-	}
+        if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) {
+
+            $lnk = explode(".",$link_qry); // link queries.
+            $qry = explode(".",e_QUERY); // current page queries.
+
+            if($qry[0] == "item")
+            {
+                return ($qry[2] == $lnk[1]) ? TRUE : FALSE;
+            }
+
+            if($qry[0] == "all" && $lnk[0] == "all")
+            {
+                return TRUE;
+            }
+
+            if($lnk[0] == $qry[0] && $lnk[1] == $qry[1])
+            {
+                return TRUE;
+            }
+
+            if($qry[1] == "list" && $lnk[0] == "list" && $lnk[1] == $qry[2])
+            {
+                return TRUE;
+            }
+
+        }
+        elseif (!e_QUERY && e_PAGE == "news.php")
+        {
+
+            return TRUE;
+        }
+            return FALSE;
+
+    }
 // --------------- highlight for Custom Pages.----------------
 // eg. page.php?1
 
-		if (strpos($link, "page.php?") !== FALSE && strpos(e_SELF,"/page.php")) {
+        if (strpos($link, "page.php?") !== FALSE && strpos(e_SELF,"/page.php")) {
             list($custom,$page) = explode(".",$link_qry);
-			list($q_custom,$q_page) = explode(".",e_QUERY);
-			if($custom == $q_custom){
-            	return TRUE;
-			}else{
-              	return FALSE;
-			}
-		}
+            list($q_custom,$q_page) = explode(".",e_QUERY);
+            if($custom == $q_custom){
+                return TRUE;
+            }else{
+                return FALSE;
+            }
+        }
 
 // --------------- highlight default ----------------
-		if(strpos($link, "?") !== FALSE){
+        if(strpos($link, "?") !== FALSE){
 
-			$thelink = str_replace("../", "", $link);
-			if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$link_qry) !== false)){
-		   		return true;
-			}
-		}
-		if(!preg_match("/all|item|cat|list/", e_QUERY) && (strpos(e_SELF, str_replace("../", "",$link)) !== false)){
-		  	return true;
-		}
-
-   		if((!$link_qry && !e_QUERY) && (strpos(e_SELF,$link) !== FALSE)){
-			return TRUE;
-		}
-
-		if(($link_slf == e_SELF && !link_qry) || (e_QUERY && strpos(e_SELF."?".e_QUERY,$link)!== FALSE) ){
-          	return TRUE;
-		}
+            $thelink = str_replace("../", "", $link);
+            if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$link_qry) !== false)){
+                return true;
+            }
+        }
+        if(!preg_match("/all|item|cat|list/", e_QUERY) && (strpos(e_SELF, str_replace("../", "",$link)) !== false)){
+            return true;
+        }
+
+        if((!$link_qry && !e_QUERY) && (strpos(e_SELF,$link) !== FALSE)){
+            return TRUE;
+        }
+
+        if(($link_slf == e_SELF && !link_qry) || (e_QUERY && strpos(e_SELF."?".e_QUERY,$link)!== FALSE) ){
+            return TRUE;
+        }
 
-	   	return FALSE;
-	}
+        return FALSE;
+    }
 }
 ?>
diff -x .svn -ruN 0.7.7.src/e107_handlers/theme_handler.php 0.7.11.src/e107_handlers/theme_handler.php
--- 0.7.7.src/e107_handlers/theme_handler.php	2006-06-25 13:11:41.000000000 -0500
+++ 0.7.11.src/e107_handlers/theme_handler.php	2007-05-04 15:51:11.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/theme_handler.php,v $
-|     $Revision: 1.31 $
-|     $Date: 2006/06/25 18:11:41 $
-|     $Author: e107coders $
+|     $Revision: 1.35 $
+|     $Date: 2007/05/04 20:51:11 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -97,6 +97,7 @@
 								fclose($fp);
 								$nonadmin = preg_match('/\* Non-Admin(.*?)\*\//', $cssContents) ? true : false;
 								preg_match('/\* info:(.*?)\*\//', $cssContents, $match);
+								$match[1]=varset($match[1],'');
 								$themeArray[$file]['css'][] = array("name" => $file2, "info" => $match[1], "nonadmin" => $nonadmin);
 								if($STYLESHEET)
 								{
@@ -113,19 +114,19 @@
 						$themeContents = fread ($fp, filesize(e_THEME.$file."/theme.php"));
 						fclose($fp);
 						preg_match('/themename(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['name'] = $match[3];
+						$themeArray[$file]['name'] = varset($match[3],'');
 						preg_match('/themeversion(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['version'] = $match[3];
+						$themeArray[$file]['version'] = varset($match[3],'');
 						preg_match('/themeauthor(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['author'] = $match[3];
+						$themeArray[$file]['author'] = varset($match[3],'');
 						preg_match('/themeemail(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['email'] = $match[3];
+						$themeArray[$file]['email'] = varset($match[3],'');
 						preg_match('/themewebsite(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['website'] = $match[3];
+						$themeArray[$file]['website'] = varset($match[3],'');
 						preg_match('/themedate(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['date'] = $match[3];
+						$themeArray[$file]['date'] = varset($match[3],'');
 						preg_match('/themeinfo(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match);
-						$themeArray[$file]['info'] = $match[3];
+						$themeArray[$file]['info'] = varset($match[3],'');
 
 						preg_match('/xhtmlcompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match);
 						$xhtml = strtolower($match[2]);
@@ -183,7 +184,6 @@
 				if($fileType == "zip") {
 					require_once(e_HANDLER."pclzip.lib.php");
 					$archive = new PclZip(e_THEME.$archiveName);
-					$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_THEME));
 					$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0666));
 				} else {
 					require_once(e_HANDLER."pcltar.lib.php");
@@ -192,9 +192,9 @@
 
 				if(!$unarc) {
 					if($fileType == "zip") {
-						$error = "PCLZIP extract error: '".$archive -> errorName(TRUE)."'";
-					} else {
-						$error = "PCLTAR extract error: ".PclErrorString().", code: ".intval(PclErrorCode());
+					$error = TPVLAN_46." '".$archive -> errorName(TRUE)."'";
+				} else {
+					$error = TPVLAN_47.PclErrorString().", ".TPVLAN_48.intval(PclErrorCode());
 					}
 					$ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error);
 					require_once("footer.php");
@@ -306,7 +306,7 @@
 		</td>
 		<td class='forumheader3' style='vertical-align:top'>";
 
-		$itext .= $author ? "<tr><td style='vertical-align:top; width:24%'><b>".TPVLAN_4."</b>:</td><td style='vertical-align:top'>".$author."</td></tr>" : "";
+		$itext = $author ? "<tr><td style='vertical-align:top; width:24%'><b>".TPVLAN_4."</b>:</td><td style='vertical-align:top'>".$author."</td></tr>" : "";
 		$itext .= $website ? "<tr><td style='vertical-align:top; width:24%'><b>".TPVLAN_5."</b>:</td><td style='vertical-align:top'>".$website."</td></tr>" : "";
 		$itext .= $theme['date'] ? "<tr><td style='vertical-align:top; width:24%'><b>".TPVLAN_6."</b>:</td><td style='vertical-align:top'>".$theme['date']."</td></tr>" : "";
 		$itext .= $theme['info'] ? "<tr><td style='vertical-align:top; width:24%'><b>".TPVLAN_7."</b>:</td><td style='vertical-align:top'>".$theme['info']."</td></tr>" : "";
@@ -465,4 +465,5 @@
 		$ns->tablerender(TPVLAN_36, "<br /><div style='text-align:center;'>".TPVLAN_43.".</div><br />");
 	}
 
-}
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php 0.7.11.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php
--- 0.7.7.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2006-10-24 08:39:45.000000000 -0500
+++ 0.7.11.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2007-08-09 14:10:00.000000000 -0500
@@ -9,13 +9,13 @@
 // ------------------------------------------------
 //                                   www.j-cons.com
 // ================================================
-// $Revision: 1.8 $Date: 2004/10/04
+// $Revision: 1.9 $Date: 2004/10/04
 // ================================================
 //
 // $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php,v $
-// $Revision: 1.8 $
-// $Date: 2006/10/24 13:39:45 $
-// $Author: mrpete $
+// $Revision: 1.9 $
+// $Date: 2007/08/09 19:10:00 $
+// $Author: e107steved $
 // +----------------------------------------------------------------------------+
 // Major Re-work by CaMer0n
 
@@ -320,7 +320,7 @@
 	  sort($arr_tinyMCE_image_files);
 	  for($k=0; $k<count($arr_tinyMCE_image_files); $k++){
       $entry = $arr_tinyMCE_image_files[$k][file_name];
-	  $size = getimagesize($tinyMCE_base_url.$imglib.$entry);
+	  $size = getimagesize($_root.$imglib.$entry);
 	  $fsize = filesize($_root.$imglib.$entry);
    ?>
             <option  value="<?php echo $size[0]; ?>|<?php echo $size[1]; ?>|<?php echo filesize_h($fsize,2); ?>|<?php echo $entry?>" <?php echo ($entry == $img)?'selected':''?>><?php echo $entry?></option>
diff -x .svn -ruN 0.7.7.src/e107_handlers/tiny_mce/wysiwyg.php 0.7.11.src/e107_handlers/tiny_mce/wysiwyg.php
--- 0.7.7.src/e107_handlers/tiny_mce/wysiwyg.php	2006-11-23 11:36:29.000000000 -0600
+++ 0.7.11.src/e107_handlers/tiny_mce/wysiwyg.php	2007-04-12 18:35:32.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Tiny MCE controller file.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/wysiwyg.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2006/11/23 17:36:29 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.35 $
+|     $Date: 2007/04/12 23:35:32 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,7 +21,7 @@
 	"English" 	=> "en",
 	"Farsi" 		=> "fa",
 	"French" 	=> "fr",
-	"German"		=> "de", 
+	"German"		=> "de",
 	"Greek" 		=> "el",
 	"Hebrew" 	=> " ",
 	"Hungarian" => "hu",
@@ -54,7 +54,7 @@
 
 $text .= ($pref['smiley_activate']) ? ",emoticons" : "";
 $text .= (ADMIN) ? ",ibrowser" : ",image";
-$text .= ",iespell,zoom,media,forecolor";
+$text .= ",iespell,zoom,media";
 $text .= "'\n"; // end of plugins list.
 
 $text .= ",theme_advanced_buttons1 : 'fontsizeselect,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent, indent,separator, forecolor,cut,copy,paste'";
diff -x .svn -ruN 0.7.7.src/e107_handlers/upload_handler.php 0.7.11.src/e107_handlers/upload_handler.php
--- 0.7.7.src/e107_handlers/upload_handler.php	2006-11-28 17:41:23.000000000 -0600
+++ 0.7.11.src/e107_handlers/upload_handler.php	2007-12-11 15:18:04.000000000 -0600
@@ -12,191 +12,636 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_handlers/upload_handler.php,v $
-|   $Revision: 1.22 $
-|   $Date: 2006/11/28 23:41:23 $
-|   $Author: mcfly_e107 $
+|   $Revision: 1.32 $
+|   $Date: 2007/12/11 21:18:04 $
+|   $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_upload_handler.php");
-@include_once(e_LANGUAGEDIR."English/lan_upload_handler.php");
-function file_upload($uploaddir, $avatar = FALSE, $fileinfo = "", $overwrite = "")
-{
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_upload_handler.php");
 
+//define("UH_DEBUG",TRUE);
+define("UH_DEBUG",FALSE);
+/*
+File upload handler - this is the preferred interface for new code
+-------------------
+function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = array())
+
+Parameters:
+	$uploaddir - target directory (checked that it exists, but path not otherwise changed)
+	$fileinfo - determines any special handling of file name (combines previous $fileinfo and $avatar parameters):
+			FALSE - default option; no processing
+			"attachment+extra_text" - indicates an attachment (related to forum post or PM), and specifies some optional text which is 
+											incorporated into the final file name (the original $fileinfo parameter).
+											$file_name = time()."_".USERID."_".'extra_text'.$name;
+			"prefix+extra_text" - indicates an attachment or file, and specifies some optional text which is prefixed to the file name
+			"unique"		- if the proposed destination file doesn't exist, saved under given name
+							- if the proposed destination file does exist, prepends time() to the file name to make it unique
+			'avatar'		- indicates an avatar is being uploaded (not used - options must be set elsewhere)
+	$options - an array of supplementary options, all of which will be given appropriate defaults if not defined:
+		'filetypes' - name of file containing list of valid file types 
+			   - Always looks in the admin directory
+			   - defaults to e_ADMIN.admin_filetypes.php for admins (if file exists), otherwise e_ADMIN.filetypes.php for users.
+			   - FALSE disables this option (which implies that 'extra_file_types' is used)
+		'file_mask' - comma-separated list of file types which if defined limits the allowed file types to those which are in both this list and the
+						file specified by the 'filetypes' option. Enables restriction to, for example, image files.
+		'extra_file_types' - if is FALSE or undefined, rejects totally unknown file extensions (even if in $options['filetypes'] file).
+							 if TRUE, accepts totally unknown file extensions which are in $options['filetypes'] file.
+							 otherwise specifies a comma-separated list of additional permitted file extensions
+		'final_chmod' - chmod() to be applied to uploaded files (0644 default)  (This routine expects an integer value, so watch formatting/decoding - its normally 
+						specified in octal. Typically use intval($permissions,8) to convert)
+		'max_upload_size' - maximum size of uploaded files in bytes, or as a string with a 'multiplier' letter (e.g. 16M) at the end.
+					- otherwise uses $pref['upload_maxfilesize'] if set
+					- overriding limit of the smaller of 'post_max_size' and 'upload_max_size' if set in php.ini
+					- for DB storage, overriding upper limit of 512000 bytes.
+					(Note: other parts of E107 don't understand strings with a multiplier letter yet)
+		'file_array_name' - the name of the 'input' array - defaults to file_userfile[] - otherwise as set.
+		'max_file_count' - maximum number of files which can be uploaded - default is 'unlimited' if this is zero of not set.
+		'overwrite' - if TRUE, existing file of the same name is overwritten; otherwise returns 'duplicate file' error (default FALSE)
+		'save_to_db' - storage type - if set and TRUE, uploaded files are saved in the database (rhater than as flat files) (default FALSE)
+
+
+Returns FALSE if the upload directory doesn't exist, or various other errors occurred which restrict the amount of meaningful information.
+Returns an array, with one set of entries per uploaded file, regardless of whether saved or discarded (not all fields always present) - $c is array index:
+ 				$uploaded[$c]['name'] - file name - as saved to disc or in database
+				$uploaded[$c]['rawname'] - original file name, prior to any addition of identifiers etc (useful for display purposes)
+				$uploaded[$c]['type'] - mime type (if set - as returned by browser)
+				$uploaded[$c]['size'] - size in bytes (should be zero if error)
+				$uploaded[$c]['error'] - numeric error code (zero = OK)
+				$uploaded[$c]['index'] - if upload successful, the index position from the file_userfile[] array - usually numeric, but may be alphanumeric if coded
+				$uploaded[$c]['message'] - text of displayed message relating to file
+				$uploaded[$c]['line'] - only if an error occurred, has line number (from __LINE__)
+				$uploaded[$c]['file'] - only if an error occurred, has file name (from __FILE__)
+On exit, uploaded files should all have been removed from the temporary directory.
+No messages displayed - its caller's responsibility to handle errors and display info to user (or can use handle_upload_messages() from this module)
+
+
+Details of uploaded files are in $_FILES['file_userfile'] (or other array name as set) on entry.
+
+Elements passed (from PHP) relating to each file:
+	['name']	- the original name
+	['type']	- mime type (if provided - not checked by PHP)	
+	['size']	- file size in bytes
+	['tmp_name'] - temporary file name on server
+	['error']	- error code. 0 = 'good'. 1..4 main others, although up to 8 defined for later PHP versions
+Files stored in server's temporary directory, unless another set
+
+*/
+function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
+{
 	global $pref, $sql, $tp;
+	
+	global $admin_log;
 
-	if (!$uploaddir) {$uploaddir = e_FILE."public/";}
-	if($uploaddir == e_THEME) {$pref['upload_storagetype'] = 1;}
+	if (UH_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Upload Handler test","Process uploads to {$uploaddir}, fileinfo  ".$fileinfo,FALSE,LOG_TO_ROLLING);
+	
 
-	if (is_readable(e_ADMIN.'filetypes.php')) {
-		$a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php'));
-		$a_filetypes = explode(',', $a_filetypes);
-		foreach ($a_filetypes as $ftype) {
-			$allowed_filetypes[] = '.'.trim(str_replace('.', '', $ftype));
-		}
+	$overwrite = varset($options['overwrite'],FALSE);
+	$save_to_db = varset($options['save_to_db'],FALSE);
+
+
+	$uploaddir = realpath($uploaddir);				// Mostly to get rid of the grot that might be passed in from legacy code. Also strips any trailing '/'
+	if (!is_dir($uploaddir))
+	{
+	  if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Invalid directory: ".$uploaddir,FALSE,FALSE);
+	  return FALSE;					// Need a valid directory
 	}
+	if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Destination directory: ".$uploaddir,FALSE,FALSE);
+
+
 
-	if ($pref['upload_storagetype'] == "2" && $avatar == FALSE)
+	$file_mask = varset($options['file_mask'],'');
+	if (isset($options['filetypes']))
 	{
-		extract($_FILES);
-		for($c = 0; $c <= 1; $c++)
-		{
-			if ($file_userfile['tmp_name'][$c])
-			{
-				$fileext1 = substr(strrchr($file_userfile['name'][$c], "."), 1);
-				$fileext2 = substr(strrchr($file_userfile['name'][$c], "."), 0); // in case user has left off the . in allowed_filetypes
-				if (!in_array($fileext1, $allowed_filetypes) && !in_array(strtolower($fileext1), $allowed_filetypes) && !in_array(strtolower($file_userfile['type'][$c]), $allowed_filetypes))
-				{
-					if (!in_array($fileext2, $allowed_filetypes) && !in_array(strtolower($fileext2), $allowed_filetypes) && !in_array(strtolower($file_userfile['type'][$c]), $allowed_filetypes))
-					{
-						require_once(e_HANDLER."message_handler.php");
-						message_handler("MESSAGE", "".LANUPLOAD_1." '".$file_userfile['type'][$c]."' ".LANUPLOAD_2."");
-						return FALSE;
-						require_once(FOOTERF);
-						exit;
-					}
-				}
-				set_magic_quotes_runtime(0);
-				$data = mysql_escape_string(fread(fopen($file_userfile['tmp_name'][$c], "rb"), filesize($file_userfile['tmp_name'][$c])));
-				set_magic_quotes_runtime(get_magic_quotes_gpc());
-				$file_name = preg_replace("/[^a-z0-9._]/", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($file_userfile['name'][$c]))));
-				$sql->db_Insert("rbinary", "0, '".$tp -> toDB($file_name, true)."', '".$tp -> toDB($file_userfile['type'][$c], true)."', '$data' ");
-				$uploaded[$c]['name'] = "Binary ".mysql_insert_id()."/".$file_name;
-				$uploaded[$c]['type'] = $file_userfile['type'][$c];
-				$uploaded[$c]['size'] = $file_userfile['size'][$c];
-			}
-		}
-		return $uploaded;
+	  $allowed_filetypes = get_allowed_filetypes($options['filetypes'], $file_mask);
 	}
-	/*
-	if (ini_get('open_basedir') != ''){
-	require_once(e_HANDLER."message_handler.php");
-	message_handler("MESSAGE", "'open_basedir' restriction is in effect, unable to move uploaded file, deleting ...", __LINE__, __FILE__);
-	return FALSE;
+	elseif (ADMIN && is_readable(e_ADMIN.'admin_filetypes.php'))
+	{
+	  $allowed_filetypes = get_allowed_filetypes('admin_filetypes.php', $file_mask);
+	}
+	else
+	{
+	  $allowed_filetypes = get_allowed_filetypes('filetypes.php', $file_mask);
+	}
+
+	
+	$final_chmod = varset($options['final_chmod'],0644);
+
+
+
+	if (isset($options['file_array_name']))
+	{
+	  $files = $_FILES[$options['file_array_name']];
+	}
+	else
+	{
+	  $files = $_FILES['file_userfile'];
 	}
-	*/
 
-	//	echo "<pre>"; print_r($_FILES); echo "</pre>"; exit;
 
-	$files = $_FILES['file_userfile'];
+	$max_file_count = varset($options['max_file_count'],0);
+
+
 	if (!is_array($files))
 	{
-		return FALSE;
+	  if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","No files uploaded",FALSE,FALSE);
+	  return FALSE;
 	}
 
+
+	$uploaded = array();
+	
+
+	// Work out maximum allowable file size
+	if (UH_DEBUG)
+	{ $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test",
+	  "File size limits - user set: ".$pref['upload_maxfilesize']." Post_max_size: ".ini_get('post_max_size')." upload_max_size: ".ini_get('upload_max_size'),FALSE,FALSE);
+	}
+	$max_upload_size = file_size_decode(ini_get('post_max_size'));
+	$max_upload_size = file_size_decode(ini_get('upload_max_filesize'), $max_upload_size, 'lt');
+	if (isset($options['max_upload_size']))
+	{
+	  $max_upload_size = file_size_decode($options['max_upload_size'], $max_upload_size, 'lt');
+	}
+	else
+	{
+	  if (varset($pref['upload_maxfilesize'],0) > 0) $max_upload_size = file_size_decode($pref['upload_maxfilesize'], $max_upload_size, 'lt');
+	}
+	if ($save_to_db) $max_upload_size = min($max_upload_size, 512000);		// Approx 500k limit for database saves
+	if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Final max upload size: {$max_upload_size}",FALSE,FALSE);
+
+
+
+// That's the basics set up - we can start processing files now
+
+	if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Start individual files: ".count($files['name'])." Max upload: ".$max_upload_size,FALSE,FALSE);
+
+
 	$c = 0;
-	foreach($files['name'] as $key => $name)
+	foreach ($files['name'] as $key => $name)
 	{
+	if (($name != '') || $files['size'][$key])		// Need this check for things like file manager which allow multiple possible uploads
+	{
+	  $name = preg_replace("/[^a-z0-9._-]/", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($name))));
+	  $raw_name = $name;			// Save 'proper' file name - useful for display
 
-		if ($files['size'][$key])
+	  if (!trim($files['type'][$key])) $files['type'][$key] = 'Unknowm mime-type';
+	  
+	  if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Process file {$name}, size ".$files['size'][$key],FALSE,FALSE);
+
+	  if ($max_file_count && ($c > $max_file_count))
+	  {
+	    $first_error = 249;		// 'Too many files uploaded' error
+	  }
+	  else
+	  {
+	    $first_error = $files['error'][$key];				// Start with whatever error PHP gives us for the file
+	  }
+	  
+	  if (!$first_error)
+	  {  // Check file size early on
+	    if ($files['size'][$key] == 0) 
 		{
-			$filesize[] = $files['size'][$key];
-			$name = preg_replace("/[^a-z0-9._-]/", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($name))));
-			if ($avatar == "attachment") {
-				$name = time()."_".USERID."_".$fileinfo.$name;
-			}
+		  $first_error = 4;			// Standard error code for zero size file
+		}
+		elseif ($files['size'][$key] > $max_upload_size) 
+		{
+		  $first_error = 254;
+		}
+	  }
 
-			$destination_file = getcwd()."/".$uploaddir."/".$name;
-			if ($avatar == "unique" && file_exists($destination_file))
-			{
-				$name = time()."_".$name;
-				$destination_file = getcwd()."/".$uploaddir."/".$name;
-			}
-			if (file_exists($destination_file) && !$overwrite)
+	  if (!$first_error)
+	  {
+	    $uploadfile = $files['tmp_name'][$key];		// Name in temporary directory
+	    if (!$uploadfile) $first_error = 253;
+	  }
+
+	  if (!$first_error)
+	  {
+		// Need to support multiple files with the same 'real' name in some cases
+		if (strpos($fileinfo,"attachment") === 0) 
+		{	// For attachments, add in a prefix plus time and date to give a unique file name
+		  $addbit = explode('+',$fileinfo,2);
+		  $name = time()."_".USERID."_".trim($addbit[1]).$name;
+		}
+		elseif (strpos($fileinfo,"prefix") === 0) 
+		{	// For attachments, avatars, photos etc alternatively just add a prefix we've been passed
+		  $addbit = explode('+',$fileinfo,2);
+		  $name = trim($addbit[1]).$name;
+		}
+		
+		$destination_file = $uploaddir."/".$name;
+
+		if ($fileinfo == "unique" && file_exists($destination_file))
+		{	// Modify destination name to make it unique - but only if target file name exists
+		  $name = time()."_".$name;
+		  $destination_file = $uploaddir."/".$name;
+		}
+
+		if (file_exists($destination_file) && !$overwrite)  $first_error = 250;			// Invent our own error number - duplicate file
+	  }
+ 
+	  if (!$first_error)
+	  {
+		$tpos = strrchr($files['name'][$key], ".");		// Require uploaded files to have an extension
+		if ($tpos !== FALSE) 
+		{
+		  $fileext = strtolower($tpos);
+		  $tpos = (($file_status = vet_file($uploadfile, $name, $allowed_filetypes, varset($options['extra_file_types'],FALSE))) === TRUE);
+		}
+		if ($tpos === FALSE)
+		{
+			// File type upload not permitted - error message and abort
+		  $first_error = 251;			// Invent our own error number - file type not permitted
+		}
+	  }
+
+	  
+	  if (!$first_error)
+	  {	// All tests passed - can store it somewhere
+		$uploaded[$c]['name'] = $name;
+		$uploaded[$c]['rawname'] = $raw_name;
+		$uploaded[$c]['type'] = $files['type'][$key];
+		$uploaded[$c]['size'] = 0;
+		$uploaded[$c]['index'] = $key;			// Store the actual index from the file_userfile array
+
+
+		if ($save_to_db)
+		{	// Store binary files in the database if selected. Maximum two files this way
+			// This is really legacy stuff - not seriously changed from the original apart from using the newer file vetting routines
+			if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Save to DB {$c}: ".$uploaded[$c]['name'],FALSE,FALSE);
+			set_magic_quotes_runtime(0);
+			$data = mysql_real_escape_string(fread(fopen($files['tmp_name'][$c], "rb"), filesize($uploadfile)));
+			set_magic_quotes_runtime(get_magic_quotes_gpc());
+			if ($sql->db_Insert("rbinary", "0, '".$tp -> toDB($name, true)."', '".$tp -> toDB($files['type'][$c], true)."', '{$data}' "))
 			{
-				require_once(e_HANDLER."message_handler.php");
-				message_handler("MESSAGE", LANUPLOAD_10, __LINE__, __FILE__); // duplicate file
-				$f_message .= LANUPLOAD_10 . __LINE__ .  __FILE__;
-				$dupe_found = TRUE;
+			  $uploaded[$c]['name'] = "Binary ".mysql_insert_id()."/".$name;
+			  $uploaded[$c]['size'] = $files['size'][$c];
 			}
 			else
 			{
-				$uploadfile = $files['tmp_name'][$key];
-				$fileext1 = substr(strrchr($files['name'][$key], "."), 1);
-				$fileext2 = substr(strrchr($files['name'][$key], "."), 0);
-				if (!in_array($fileext1, $allowed_filetypes) && !in_array(strtolower($fileext1), $allowed_filetypes) && !in_array(strtolower($files['type'][$c]), $allowed_filetypes))
-				{
-					if (!in_array($fileext2, $allowed_filetypes) && !in_array(strtolower($fileext2), $allowed_filetypes) && !in_array(strtolower($files['type'][$c]), $allowed_filetypes))
-					{
-						require_once(e_HANDLER."message_handler.php");
-						message_handler("MESSAGE", LANUPLOAD_1." ".$files['type'][$key]." ".LANUPLOAD_2.".", __LINE__, __FILE__);
-						$f_message .= LANUPLOAD_1." ".$files['type'][$key]." ".LANUPLOAD_2."." . __LINE__ .  __FILE__;
-						return FALSE;
-						require_once(FOOTERF);
-						exit;
-					}
-				}
-
-				$uploaded[$c]['name'] = $name;
-				$uploaded[$c]['type'] = $files['type'][$key];
-				$uploaded[$c]['size'] = 0;
-
-				$method = (OPEN_BASEDIR == FALSE ? "copy" : "move_uploaded_file");
-
-				if (@$method($uploadfile, $destination_file))
-				{
-					@chmod($destination_file, 0644);
-					$_tmp = explode('.', $name);
-					$fext = array_pop($_tmp);
-					$fname = basename($name, '.'.$fext);
-					$tmp = pathinfo($name);
-					$rename = substr($fname, 0, 15).".".time().".".$fext;
-					if (@rename(e_FILE."public/avatars/".$name, e_FILE."public/avatars/".$rename))
-					{
-						$uploaded[$c]['name'] = $rename;
-					}
-
-					if ($method == "copy")
-					{
-						@unlink($uploadfile);
-					}
-
-					if(!$dupe_found)
-					{   // don't display 'success message' when duplicate file found.
-						require_once(e_HANDLER."message_handler.php");
-						message_handler("MESSAGE", "".LANUPLOAD_3." '".$files['name'][$key]."'", __LINE__, __FILE__);
-						$f_message .= "".LANUPLOAD_3." '".$files['name'][$key]."'.<br />";
-					}
-					$uploaded[$c]['size'] = $files['size'][$key];
-
-				}
-				else
-				{
-					$uploaded[$c]['error'] = $files['error'][$key];
-					switch ($files['error'][$key])
-					{
-						case 0:
-						$error = LANUPLOAD_4." [".str_replace("../", "", $uploaddir)."]";
-						break;
-						case 1:
-						$error = LANUPLOAD_5;
-						break;
-						case 2:
-						$error = LANUPLOAD_6;
-						break;
-						case 3:
-						$error = LANUPLOAD_7;
-						break;
-						case 4:
-						$error = LANUPLOAD_8;
-						break;
-						case 5:
-						$error = LANUPLOAD_9;
-						break;
-					}
-					require_once(e_HANDLER."message_handler.php");
-					message_handler("MESSAGE", LANUPLOAD_11." '".$files['name'][$key]."' <br />".LANUPLOAD_12.": ".$error, __LINE__, __FILE__);
-					$f_message .= LANUPLOAD_11." '".$files['name'][$key]."' <br />".LANUPLOAD_12.": ".$error . __LINE__ . __FILE__;
-
-				}
+			  $first_error = 252;		// "Could not save file"
 			}
 		}
-		$c++;
-	}
-	define("F_MESSAGE", "<br />".$f_message);
+		else
+		{  // Store as flat file
+//		  $method = (OPEN_BASEDIR == FALSE ? "copy" : "move_uploaded_file");
+//		  if (@$method($uploadfile, $destination_file))
+		  if (@move_uploaded_file($uploadfile, $destination_file))		// This should work on all hosts
+		  {
+			@chmod($destination_file, $final_chmod);
+			if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Final chmod() file {$destination_file} to {$final_chmod} ",FALSE,FALSE);
+			
+			$uploaded[$c]['size'] = $files['size'][$key];
+			if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Saved file {$c} OK: ".$uploaded[$c]['name'],FALSE,FALSE);
+		  }
+		  else
+		  {
+		  $first_error = 252;			// Error - "couldn't save destination"
+		  }
+		}
+	  }
 
+	  if(!$first_error)
+	  {   // This file succeeded
+		$uploaded[$c]['message'] = LANUPLOAD_3." '".$raw_name."'";
+		$uploaded[$c]['error'] = 0;
+	  }
+	  else
+	  {
+		$uploaded[$c]['error'] = $first_error;
+		$uploaded[$c]['size'] = 0;
+		switch ($first_error)
+		{
+		  case 1:			// Exceeds upload_max_filesize in php.ini
+			$error = LANUPLOAD_5;
+			break;
+		  case 2:			// Exceeds MAX_FILE_SIZE in form
+			$error = LANUPLOAD_6;
+			break;
+		  case 3:			// Partial upload
+			$error = LANUPLOAD_7;
+			break;
+		  case 4:			// No file uploaded
+			$error = LANUPLOAD_8;
+			break;
+		  case 5:			// Undocumented code (zero file size)
+			$error = LANUPLOAD_9;
+			break;
+		  case 6:			// Missing temporary folder
+			$error = LANUPLOAD_13;
+			break;
+		  case 7:			// File write failed
+			$error = LANUPLOAD_14;
+			break;
+		  case 8:			// Upload stopped by extension
+			$error = LANUPLOAD_15;
+			break;
+		  case 249:			// Too many files  (our error code)
+			$error = LANUPLOAD_19;
+			break;
+		  case 250:			// Duplicate File  (our error code)
+			$error = LANUPLOAD_10;
+			break;
+		  case 251:			// File type not allowed (our error code)
+			$error = LANUPLOAD_1." ".$files['type'][$key]." ".LANUPLOAD_2." ({$file_status})";
+			break;
+		  case 252 :			// File uploaded OK, but couldn't save it
+			$error = LANUPLOAD_4." [".str_replace("../", "", $uploaddir)."]";
+			break;
+		  case 253:			// Bad name for uploaded file (our error code)
+			$error = LANUPLOAD_17;
+			break;
+		  case 254:			// file size exceeds allowable limits (our error code)
+			$error = LANUPLOAD_18;
+			break;
+		  default :			// Shouldn't happen - but at least try and make it obvious if it does!
+		    $error = LANUPLOAD_16;
+		}
+		  
+		$uploaded[$c]['message'] = LANUPLOAD_11." '".$name."' <br />".LANUPLOAD_12.": ".$error;
+		$uploaded[$c]['line'] = __LINE__ ;
+		$uploaded[$c]['file'] = __FILE__;
+		if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Main routine error {$first_error} file {$c}: ".$uploaded[$c]['message'],FALSE,FALSE);
+		// If we need to abort on first error, do so here - could check for specific error codes
+	  }
+	  if (is_file($uploadfile)) @unlink($uploadfile);				// Don't leave the file on the server if error (although should be auto-deleted)
+	  $c++;
+	}
+	}
 	return $uploaded;
 }
+
+
+
+/*
+Utility routine to handle the messages returned by process_uploaded_files().
+$upload_array is the list of uploaded files
+$errors_only - if TRUE, no message is shown for a successful upload.
+$use_handler - if TRUE, message_handler is used to display the message.
+
+Returns - a list of all accumulated messages. (Non-destructive call, so can be called several times with different options).
+*/
+function handle_upload_messages(&$upload_array, $errors_only = TRUE, $use_handler = FALSE)
+{
+// Display error messages, accumulate FMESSAGE
+// Write as a separate routine - returns all messages displayed. Option to only display failures.
+	$f_message = '';
+	foreach($upload_array as $k => $r)
+	{
+	  if (!$errors_only || $r['error'])
+	  {
+	    if ($use_handler)
+		{
+		  require_once(e_HANDLER."message_handler.php");
+		  message_handler("MESSAGE",$r['message'], $r['line'], $r['file']);
+		}
+		$f_message[] = $r['message'];
+	  }
+	}
+	return implode("<br />",$f_message);
+}
+
+
+
+
+/*
+====================================================================
+				LEGACY FILE UPLOAD HANDLER
+====================================================================
+This is the 'legacy' interface, which handles various special cases etc.
+It was the only option in E107 0.7.8 and earlier, and is still used in some places in core.
+It also attempts to return in the same way as the original, especially when any errors occur
+
+Parameters for file_upload():
+$uploaddir - target directory for file. Defaults to e_FILE/public
+
+$avatar - sets the 'type' or destination of the file:
+		FALSE 			- its a 'general' file
+		'attachment'	- indicates an attachment (related to forum post or PM)
+		'unique' 		- indicates that file name must be unique - new name given (prefixed with time()_ )
+		'avatar'		- indicates an avatar is being uploaded
+
+$fileinfo			- included within the name of the saved file with attachments - can be an identifier of some sort
+						(Forum adds 'FT{$tid}_' - where $tid is the thread ID.
+
+$overwrite 			- if true, an uploaded file can overwrite an existing file of the same name (not used in 0.7 core)
+
+Preference used:
+	$pref['upload_storagetype'] = 1 for files, 2 for database
+
+On exit, F_MESSAGE is defined with the success/failure message(s) that have been displayed - one file per line
+
+For backward compatibility, returns FALSE if only one file uploaded and an error; otherwise returns an array with per-file error codes as appropriate.
+*/
+
+
+function file_upload($uploaddir, $avatar = FALSE, $fileinfo = "", $overwrite = "")
+{
+	global $admin_log;
+	$options = array('extra_file_types' => TRUE);		// As default, allow any filetype enabled in filetypes.php
+
+
+	if (!$uploaddir) {$uploaddir = e_FILE."public/";}
+
+// Compute storage type - 1 is file, 2 is DB
+	$upload_storagetype = varset($pref['upload_storagetype'],1);
+	if($uploaddir == e_THEME) {$upload_storagetype = 1;}
+	$options['save_to_db'] = ($upload_storagetype == "2" && $avatar == FALSE);
+
+	switch ($avatar)
+	{
+	  case 'attachment' :
+	    $avatar = "attachment+".$fileinfo;
+		break;
+	  case 'avatar' :
+	    $avatar = 'prefix+ap_'.USERID.'_';				// Prefix unique to user
+		$options['overwrite'] = TRUE;			// Allow update of avatar with same file name
+		break;
+	}
+
+	if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Legacy call, directory ".$uploaddir,FALSE,FALSE);
+	
+	$ret = process_uploaded_files(getcwd()."/".$uploaddir, 					// Well, that's the way it was done before
+			$avatar,$options);
+	if ($ret === FALSE) 
+	{
+	  if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Legacy return FALSE",FALSE,FALSE);
+	  return FALSE;
+	}
+
+	if (UH_DEBUG) $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Legacy return with ".count($ret)." files",FALSE,FALSE);
+	$messages = handle_upload_messages($ret, FALSE, TRUE);			// Show all the error and acknowledgment messages
+	define(F_MESSAGE, $messages);
+	
+	if (count($ret) == 1)
+	{
+	  if ($ret[0]['error'] != 0) return FALSE;		// Special case if errors
+	}
+	return $ret;
+}
+
+
+
+
+/*
+====================================================================
+				VETTING AND UTILITY ROUTINES
+====================================================================
+
+// Check uploaded file to try and identify dodgy content.
+// Return TRUE if appears OK.
+// Return a numeric reason code 1..9 if unacceptable
+
+// $filename is the full path+name to the uploaded file on the server
+// $target_name is the intended name of the file once transferred
+// $allowed_filetypes is an array of permitted file extensions, in lower case, no leading '.'
+//		(usually generated from filetypes.php)
+// if $unknown is FALSE, rejects totally unknown file extensions (even if in $allowed_filetypes).
+// if $unknown is TRUE, accepts totally unknown file extensions.
+// otherwise $unknown is a comma-separated list of additional permitted file extensions
+*/
+function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = FALSE)
+{
+// 1. Start by checking against filetypes - that's the easy one!
+  $file_ext = strtolower(substr(strrchr($target_name, "."), 1));
+  if (!in_array($file_ext, $allowed_filetypes))
+  {
+    if (is_bool($unknown)) return 1;	  // Reject out of hand if no possible alternative extensions
+	// Otherwise, it could be in the supplementary list
+	$tmp = explode(',', $unknown);
+	for ($i = 0; $i < count($tmp); $i++) { $tmp[$i] = strtolower(trim(str_replace('.', '', $tmp[$i])));  }
+	if (!in_array($file_ext, $tmp)) return 6;
+  }
+
+
+// 2. For all files, read the first little bit to check for any flags etc
+  $res = fopen($filename, 'rb');
+  $tstr = fread($res,100);
+  fclose($res);
+  if ($tstr === FALSE) return 2;			// If can't read file, not much use carrying on!
+  if (stristr($tstr,'<?php') !== FALSE) return 3;		// Pretty certain exploit
+  if (stristr($tstr,'<?') !== FALSE) return 7;			// Possible exploit - maybe allowable?
+  
+  
+// 3. Now do what we can based on file extension
+  switch ($file_ext)
+  {
+    case 'jpg' :
+	case 'gif' :
+	case 'png' :
+	case 'jpeg' :
+	case 'pjpeg' :
+	case 'bmp' :
+	  $ret = getimagesize($filename);
+	  if (!is_array($ret)) return 4;		// getimagesize didn't like something
+	  if (($ret[0] == 0) || ($ret[1] == 0)) return 5;		// Zero size picture or bad file format
+	  break;
+	  
+	case 'zip' :
+	case 'gzip' :
+	case 'gz' :
+	case 'tar' :
+	case 'bzip' :
+	case 'pdf' :
+	case 'rar' :
+	case '7z' :
+	case 'csv' :
+	  break;			// Just accept these
+
+	case 'php' :
+	case 'htm' :
+	case 'html' :
+	case 'cgi' :
+	case 'pl' :
+	  return 9;			// Never accept these! Whatever the user thinks!
+	  
+	default :
+	  if (is_bool($unknown)) return ($unknown ? TRUE : 8);
+  }
+  return TRUE;			// Accepted here
+}
+
+
+
+// Get array of file types (file extensions) which are permitted - reads a definition file.
+// If $file_mask is a comma-separated list of file types, only those types which are in both the definition file and in $file_mask are added
+function get_allowed_filetypes($def_file = FALSE, $file_mask = '')
+{
+  $ret = array();
+  if ($def_file === FALSE) return $ret;
+  
+  if ($file_mask)
+  {
+    $file_array = explode(',', $file_mask);
+	foreach ($file_array as $k => $f)
+	{
+	  $file_array[$k] = trim($f);
+	}
+  }
+  
+  if ($def_file && is_readable(e_ADMIN.$def_file)) 
+  {
+	$a_filetypes = trim(file_get_contents(e_ADMIN.$def_file));
+	$a_filetypes = explode(',', $a_filetypes);
+  }
+  else
+  { // Its an 'override' array
+	$a_filetypes = explode(',', $def_file);
+  }
+  foreach ($a_filetypes as $ftype) 
+  {
+	$ftype = strtolower(trim(str_replace('.', '', $ftype)));
+	if (!$file_mask || in_array($ftype, $file_array))
+	{
+	  $ret[] = $ftype;
+	}
+  }
+  return $ret;
+}
+
+
+// Parse a file size string (e.g. 16M) and compute the simple numeric value.
+// If $action is empty, return this value.
+// If $source evaluates to zero, return the compare value instead
+// If $action == 'gt', return the larger of this value and $compare
+// If $action == 'lt', return the smaller of this value and $compare
+function file_size_decode($source, $compare = 0, $action = '')
+{
+  $source = trim($source);
+  $mult = 1;
+  $nostrip = FALSE;
+  if (!$source || is_numeric($source))
+  {
+    $val = $source;
+  }
+  else
+  {
+    $val = substr($source,0,-1);
+    switch (substr($source,-1,1))
+    {
+	  case 'T' :  
+	    $val = $val * 1024;
+	  case 'G' :  
+	    $val = $val * 1024;
+	  case 'M' :
+	    $val = $val * 1024;
+	  case 'K' :
+	  case 'k' :
+	    $val = $val * 1024;
+		break;
+	}
+  }
+  if ($val == 0) return $compare;
+  switch ($action)
+  {
+    case 'lt' : return min($val, $compare);
+	case 'gt' : return max($val, $compare);
+	default   : return $val;
+  }
+  return 0;
+}
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_handlers/user_extended_class.php 0.7.11.src/e107_handlers/user_extended_class.php
--- 0.7.7.src/e107_handlers/user_extended_class.php	2006-11-28 23:11:16.000000000 -0600
+++ 0.7.11.src/e107_handlers/user_extended_class.php	2007-10-30 03:11:42.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/user_extended_class.php,v $
-|     $Revision: 1.40 $
-|     $Date: 2006/11/29 05:11:16 $
+|     $Revision: 1.44 $
+|     $Date: 2007/10/30 08:11:42 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -30,11 +30,7 @@
 
 */
 
-if (is_readable(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php")) {
-	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
-} else {
-	@include_once(e_LANGUAGEDIR."English/lan_user_extended.php");
-}
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
 
 class e107_user_extended
 {
@@ -94,6 +90,7 @@
 
 	function user_extended_get_categories($byID = TRUE)
 	{
+	   	$ret = array();
 		global $sql;
 		if($sql->db_Select("user_extended_struct", "*", "user_extended_struct_type = 0 ORDER BY user_extended_struct_order ASC"))
 		{
@@ -113,6 +110,8 @@
 		return $ret;
 	}
 
+
+	// Get the definition of all fields, or those in a specific category, grouped by category ID
 	function user_extended_get_fields($cat = "")
 	{
 		global $sql;
@@ -127,10 +126,11 @@
 		return $ret;
 	}
 
-	function user_extended_get_fieldList()
+	// Get the definition of all fields, or those in a specific category, indexed by field ID
+	function user_extended_get_fieldList($cat = "")
 	{
 		global $sql;
-		$more = ($cat) ? " AND user_extended_struct_parent = ".intval($cat)." " : "";
+		$more = ($cat != '') ? " AND user_extended_struct_parent = ".intval($cat)." " : "";
 		if($sql->db_Select("user_extended_struct", "*", "user_extended_struct_type > 0 {$more} ORDER BY user_extended_struct_order ASC"))
 		{
 			while($row = $sql->db_Fetch())
@@ -286,7 +286,7 @@
 			$choices[$k] = str_replace("[E_COMMA]", ",", $choices[$k]);
 		}
 		$parms = explode("^,^",$struct['user_extended_struct_parms']);
-		$include = preg_replace("/\n/", " ", $tp->toText($parms[0]));
+		$include = preg_replace("/\n/", " ", $tp->toHtml($parms[0]));
 		$regex = $tp->toText($parms[1]);
 		$regexfail = $tp->toText($parms[2]);
 		$fname = "ue[user_".$struct['user_extended_struct_name']."]";
diff -x .svn -ruN 0.7.7.src/e107_handlers/user_select_class.php 0.7.11.src/e107_handlers/user_select_class.php
--- 0.7.7.src/e107_handlers/user_select_class.php	2006-10-24 08:35:06.000000000 -0500
+++ 0.7.11.src/e107_handlers/user_select_class.php	2007-05-28 06:13:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/user_select_class.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/10/24 13:35:06 $
-|     $Author: mrpete $
+|     $Revision: 1.12 $
+|     $Date: 2007/05/28 11:13:08 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,7 +28,7 @@
 
 class user_select {
 
-	function user_list($class, $form_name) {
+	function user_list($class, $form_name='user', $display='user_name', $val = 'user_name') {
 		global $pref, $sql, $tp;
 		if($class === FALSE) { $class = e_UC_MEMBER;}
 		switch ($class)
@@ -40,26 +40,27 @@
 			case e_UC_MEMBER:
 				$where = "1";
 				break;
-				
+
 			case e_UC_NOBODY:
 				return "";
 				break;
-				
+
 			default:
 				$where = "user_class REGEXP '(^|,)(".$tp -> toDB($class, true).")(,|$)'";
 				break;
 		}
-				
-		$text = "<select class='tbox' id='user' name='user' onchange=\"uc_switch('class')\">";
+
+		$text = "<select class='tbox' id='{$form_name}' name='{$form_name}' onchange=\"uc_switch('class')\">";
 		$text .= "<option value=''>".US_LAN_1."</option>";
 		$sql -> db_Select("user", "user_name", $where." ORDER BY user_name");
-		while ($row = $sql -> db_Fetch()) {
-			$text .= "<option value='".$row['user_name']."'>".$row['user_name']."</option>";
+		while ($row = $sql -> db_Fetch())
+		{
+			$text .= "<option value='".$row[$val]."'>".$row[$display]."</option>";
 		}
 		$text .= "</select>";
 		return $text;
 	}
-	
+
 	function class_list($class, $form_name) {
 		global $pref, $sql;
 		$text = "<select class='tbox' id='class' name='class' onchange=\"uc_switch('user')\">";
@@ -82,10 +83,11 @@
 		}
 		return $text;
 	}
-	
-	function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false) {
+
+	function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false) 
+	{
 		global $tp;
-		$text .= "<script type='text/javascript'>
+		$text = "<script type='text/javascript'>
 		<!--
 		function uc_switch(uctype) {
 			document.getElementById(uctype).value = '';
@@ -98,7 +100,7 @@
 
 		if ($type == 'list') {
 			$text .= $this -> user_list($class, 'user');
-		} 
+		}
 		else if ($type == 'popup')
 		{
 			if($form_type == 'textarea')
@@ -109,20 +111,20 @@
 			{
 				$text .= "<input class='tbox' type='text' name='".$form_id."' id='".$form_id."' size='25' maxlength='30' value='".$tp -> post_toForm($user_value)."'>&nbsp;";
 			}
-			$text .= "<img src='".e_IMAGE_ABS."generic/".IMODE."/user_select.png' 
-			style='width: 16px; height: 16px; vertical-align: top' alt='".US_LAN_4."...' 
+			$text .= "<img src='".e_IMAGE_ABS."generic/".IMODE."/user_select.png'
+			style='width: 16px; height: 16px; vertical-align: top' alt='".US_LAN_4."...'
 			title='".US_LAN_4."...' onclick=\"window.open('".e_HANDLER_ABS."user_select_class.php?".$user_form."','user_search', 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=300,height=200,left=100,top=100'); return false;\" />";
 		}
-		
+
 		if ($class !== false) {
 			if (($class < e_UC_NOBODY && USERCLASS) || ADMINPERMS == '0') {
 				$text .= ' '.$this -> class_list($class, 'class');
 			}
 		}
-		
+
 		return $text;
 	}
-	
+
 	function real_name($_id) {
 		global $sql;
 		$sql -> db_Select("user", "user_name", "user_id='".intval($_id)."' ");
@@ -130,7 +132,7 @@
 			return $row['user_name'];
 		}
 	}
-	
+
 	function popup() {
 		global $ns, $tp;
 		list($elementType, $elementID) = explode(".", e_QUERY);
@@ -153,6 +155,15 @@
 			}
 			$job = "parent.opener.document.getElementById('{$elementID}').value = d;";
 		}
+		
+		// send the charset to the browser - overrides spurious server settings with the lan pack settings.
+		header("Content-type: text/html; charset=".CHARSET, true);
+		echo (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='".CHARSET."' "."?".">\n")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
+		echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
+		<head>
+		<title>".SITENAME."</title>\n";
+
+		
 		echo "<link rel=stylesheet href='".THEME_ABS."style.css'>
 		<script language='JavaScript' type='text/javascript'>
 		<!--
@@ -163,6 +174,8 @@
 		}
 		//-->
 		</script>
+		</head>
+		<body>
 		";
 
 		$text = "<form action='".e_SELF."?".e_QUERY."' method='POST'>
@@ -174,7 +187,7 @@
 			</table>
 			</form>
 			";
-	
+
 		if ($_POST['dosrch']) {
 			$userlist = $this -> findusers($_POST['srch']);
 			if($userlist == FALSE)
@@ -199,16 +212,16 @@
 			</select>
 			<input type='button' class='button' value='".US_LAN_1."' onClick='SelectUser()' />
 			</td>
-		 
+
 			</tr>
 			</table>
 			</form>
 			";
 		}
-	
 		$ns -> tablerender(US_LAN_4, $text);
+		echo "\n</body>\n</html>";
 	}
-	
+
 	function findusers($s) {
 		global $sql, $tp;
 		if ($sql->db_Select("user", "*", "user_name LIKE '%".$tp -> toDB($s)."%' ")) {
diff -x .svn -ruN 0.7.7.src/e107_handlers/userclass_class.php 0.7.11.src/e107_handlers/userclass_class.php
--- 0.7.7.src/e107_handlers/userclass_class.php	2006-06-29 01:53:06.000000000 -0500
+++ 0.7.11.src/e107_handlers/userclass_class.php	2007-04-11 16:25:01.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/userclass_class.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/06/29 06:53:06 $
-|     $Author: e107coders $
+|     $Revision: 1.21 $
+|     $Date: 2007/04/11 21:25:01 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -40,7 +40,6 @@
 */
 
 function r_userclass($fieldname, $curval = 0, $mode = "off", $optlist = "") {
-	$sql = new db;
 	global $pref;
 
 	$text = "<select class='tbox' name='{$fieldname}'>\n";
@@ -106,7 +105,6 @@
 
 function r_userclass_radio($fieldname, $curval = '')
 {
-	$sql = new db;
 	($curval == e_UC_PUBLIC) ? $c = " checked" : $c = "";
 	$text = "<input type='radio' name='{$fieldname}' value='".e_UC_PUBLIC."' ".$c." />".UC_LAN_0."<br />";
 	($curval == e_UC_NOBODY) ? $c = " checked" : $c = "";
@@ -128,7 +126,6 @@
 function r_userclass_check($fieldname, $curval = '', $optlist = "")
 {
 	global $pref;
-	$sql = new db;
 	$curArray = explode(",", $curval);
 	$ret = "";
 	$ret .= "<div class='tbox' style='margin-left:0px;margin-right:auto;width:60%;height:58px;overflow:auto'>";
@@ -197,13 +194,13 @@
 
 function get_userclass_list()
 {
-	global $sql;
 	if($classList = getcachedvars('uclass_list'))
 	{
 		return $classList;
 	}
 	else
 	{
+		global $sql;
 		$sql->db_Select('userclass_classes', "*", "ORDER BY userclass_name", "nowhere");
 		$classList = $sql->db_getList();
 		cachevars('uclass_list', $classList);
@@ -212,16 +209,17 @@
 }
 
 function r_userclass_name($id) {
-	$sql = new db;
 	$class_names = getcachedvars('userclass_names');
 	if(!is_array($class_names))
 	{
+		$sql = new db;
 		$class_names[e_UC_PUBLIC] = UC_LAN_0;
 		$class_names[e_UC_GUEST] = UC_LAN_1;
 		$class_names[e_UC_NOBODY] = UC_LAN_2;
 		$class_names[e_UC_MEMBER] = UC_LAN_3;
 		$class_names[e_UC_READONLY] = UC_LAN_4;
 		$class_names[e_UC_ADMIN] = UC_LAN_5;
+		$class_names[e_UC_MAINADMIN] = UC_LAN_6;
 		if ($sql->db_Select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere"))
 		{
 			while($row = $sql->db_Fetch())
diff -x .svn -ruN 0.7.7.src/e107_handlers/xml_class.php 0.7.11.src/e107_handlers/xml_class.php
--- 0.7.7.src/e107_handlers/xml_class.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.11.src/e107_handlers/xml_class.php	2007-01-24 15:21:20.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/xml_class.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2007/01/24 21:21:20 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -189,7 +189,7 @@
        $this->xml_parser = xml_parser_create( "UTF-8" );
   
        xml_parser_set_option( $this->xml_parser, XML_OPTION_CASE_FOLDING, false );
-       xml_set_object( $this->xml_parser, &$this );
+       xml_set_object( $this->xml_parser, $this );
        xml_set_element_handler( $this->xml_parser, "_startElement", "_endElement");
        xml_set_character_data_handler( $this->xml_parser, "_cData" );
       
diff -x .svn -ruN 0.7.7.src/e107_languages/English/English.php 0.7.11.src/e107_languages/English/English.php
--- 0.7.7.src/e107_languages/English/English.php	2006-11-09 12:58:19.000000000 -0600
+++ 0.7.11.src/e107_languages/English/English.php	2007-08-13 14:56:30.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/English.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/11/09 18:58:19 $
-|     $Author: lisa_ $
+|     $Revision: 1.11 $
+|     $Date: 2007/08/13 19:56:30 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 setlocale(LC_ALL, 'en');
@@ -31,9 +31,24 @@
 define("CORE_LAN9", "Core could not restore from automatic backup. Execution halted.");
 define("CORE_LAN10", "Corrupted cookie detected - logged out.");
 
+// Footer
+define("CORE_LAN11", "Render time: ");
+define("CORE_LAN12", " sec, ");
+define("CORE_LAN13", " of that for queries. ");
+define("CORE_LAN14", "");			// Used in 0.8
+define("CORE_LAN15", "DB queries: ");
+define("CORE_LAN16", "Memory Usage: ");
+
+define("CORE_LAN_B", "b");
+define("CORE_LAN_KB", "kb");
+define("CORE_LAN_MB", "Mb");
+define("CORE_LAN_GB", "Gb");
+define("CORE_LAN_TB", "Tb");
+
 
 define("LAN_WARNING", "Warning!");
 define("LAN_ERROR", "Error");
 define("LAN_ANONYMOUS", "Anonymous");
+define("LAN_EMAIL_SUBS", "-email-");
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/article.php 0.7.11.src/e107_languages/English/admin/help/article.php
--- 0.7.7.src/e107_languages/English/admin/help/article.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/article.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,27 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/article.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "From this page you can add single or multi-page articles.<br />
- For a multi-page article separate each page with the text [newpage], i.e. <br /><code>Test1 [newpage] Test2</code><br /> would create a two page article with 'Test1' on page 1 and 'Test2' on page 2.
-<br /><br />
-If your article contains HTML tags that you wish to preserve, enclose the code with [html] [/html]. For example, if you entered the text '&lt;table>&lt;tr>&lt;td>Hello &lt;/td>&lt;/tr>&lt;/table>' in your article, a table would be shown containing the word hello. If you entered '[html]&lt;table>&lt;tr>&lt;td>Hello &lt;/td>&lt;/tr>&lt;/table>[/html]' the code as you entered it would be shown and not the table that the code generates.";
-$ns -> tablerender("Article Help", $text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/banlist.php 0.7.11.src/e107_languages/English/admin/help/banlist.php
--- 0.7.7.src/e107_languages/English/admin/help/banlist.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/help/banlist.php	2007-02-11 04:33:58.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/banlist.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2007/02/11 10:33:58 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,6 +27,8 @@
 Entering the IP address 123.123.123.* will stop anyone in that IP range from visiting your site.<br /><br />
 <b>Banning by email address</b><br />
 Entering the email address foo@bar.com will stop anyone using that email address from registering as a member on your site.<br />
-Entering the email address *@bar.com will stop anyone using that email domain from registering as a member on your site.";
+Entering the email address *@bar.com will stop anyone using that email domain from registering as a member on your site.<br /><br />
+<b>Banning by user name</b><br />
+This is done from the user administration page.";
 $ns -> tablerender($caption, $text);
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/chatbox.php 0.7.11.src/e107_languages/English/admin/help/chatbox.php
--- 0.7.7.src/e107_languages/English/admin/help/chatbox.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/help/chatbox.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,25 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/chatbox.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "Set your chatbox preferences from here.<br />If the replace link box is ticked, any links entered will be replaced by the text you enter in the textbox, this stops long links causing display problems. Wordwrap will auto wrap text that is longer than the length specified here.";
-
-$ns -> tablerender("Chatbox", $text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/content.php 0.7.11.src/e107_languages/English/admin/help/content.php
--- 0.7.7.src/e107_languages/English/admin/help/content.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/content.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,25 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/content.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "You can add a normal page to your site using this feature. A link to the new page will be created in your main site navigation box. For example, if you create a new page with the Link Name 'Test', a link called 'Test' will appear in your links box after submitting the new page.<br />
-If you want your content page to have a caption, enter it in the Page Heading box.";
-$ns -> tablerender("Content Help", $text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/cpage.php 0.7.11.src/e107_languages/English/admin/help/cpage.php
--- 0.7.7.src/e107_languages/English/admin/help/cpage.php	2006-06-29 17:15:28.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/cpage.php	2007-11-06 14:08:19.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/cpage.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/06/29 22:15:28 $
-|     $Author: e107coders $
+|     $Revision: 1.5 $
+|     $Date: 2007/11/06 20:08:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,5 +22,5 @@
 $text = "From this screen you can create custom menus or custom pages with your own content in them.<br /><br />";
 // $text .= "Please see <a href='http://docs.e107.org/Using Custom Pages and Custom Menus'>http://docs.e107.org/Using Custom Pages and Custom Menus</a> for an explanation of all the features.";
 
-$ns -> tablerender(CUSLAN_18, $text);
+$ns -> tablerender('Custom Menus/Pages Help', $text);
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/fileinspector.php 0.7.11.src/e107_languages/English/admin/help/fileinspector.php
--- 0.7.7.src/e107_languages/English/admin/help/fileinspector.php	2006-09-20 09:04:31.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/fileinspector.php	2007-12-07 14:54:59.000000000 -0600
@@ -1,4 +1,4 @@
- <?php
+<?php
 /*
 + ----------------------------------------------------------------------------+
 |     e107 website system
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/fileinspector.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/09/20 14:04:31 $
-|     $Author: e107coders $
+|     $Revision: 1.11 $
+|     $Date: 2007/12/07 20:54:59 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -37,7 +37,7 @@
 <img src='".e_IMAGE."fileinspector/file_unknown.png' alt='".$dir."' style='margin-left: 3px; width: 16px; height: 16px' />&nbsp;Non Core File</div>";
 $ns -> tablerender("File Key", $text);
 
-$text = "The file inspector scans and analyses the files on your sites server. When the inspector encounters
+$text = "The file inspector scans and analyses the files on your sites server. When the inspector encounters 
 an e107 core file, it checks it for file consistency to make sure it isn't corrupted.";
 
 if ($pref['developer']) {
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/forum.php 0.7.11.src/e107_languages/English/admin/help/forum.php
--- 0.7.7.src/e107_languages/English/admin/help/forum.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/forum.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,43 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/forum.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$caption = "Forum Help";
-$text = "<b>General</b><br />
-Use this screen to create or edit your forums<br />
-<br />
-<b>Parents/Forums</b><br />
-A parent is a heading that other forums are displayed under, this makes layout simpler and makes navigating around your forums much simpler for visitors.
-<br /><br />
-<b>Accessibility</b>
-<br />
-You can set your forums to only be accessible to certain visitors. Once you have set the 'class' of the visitors you can tick the 
-class to only allow those visitors access to the forum. You can set parents or individual forums up in this way.
-<br /><br />
-<b>Moderators</b>
-<br />
-Tick the names of the listed administrators to give them moderator status on the forum. The administrator must have forum moderation permissions to be listed here.
-<br /><br />
-<b>Ranks</b>
-<br />
-Set your user ranks from here. If the image fields are filled in, images will be used, to use rank names enter the names and make sure the corresponding rank image field is blank.<br />The threshold is the number of points the user needs to gain before his level changes.";
-$ns -> tablerender($caption, $text);
-unset($text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/link_category.php 0.7.11.src/e107_languages/English/admin/help/link_category.php
--- 0.7.7.src/e107_languages/English/admin/help/link_category.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/link_category.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,24 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/link_category.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "You can separate your links into different categories, this makes navigating the main Links page much easier and improves layout.<br /><br />Any link entered under the Main category will be displayed in your main navigation menu.";
-$ns -> tablerender("Link Category Help", $text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/newsfeed.php 0.7.11.src/e107_languages/English/admin/help/newsfeed.php
--- 0.7.7.src/e107_languages/English/admin/help/newsfeed.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/help/newsfeed.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,25 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/newsfeed.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "You can retrieve and parse other site's backend RSS news feeds and display them on your own site from here.<br />Enter the full path URL to the backend (ie http://e107.org/news.xml). You can add a path to an image if you don't like the default one, or it isn't defined. You can activate and de-activate the backend if the site goes down for instance.<br /><br />To see the headlines on your site, make sure the  headlines_menu is activated from your menus page.";
-
-$ns -> tablerender("Headlines", $text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/help/review.php 0.7.11.src/e107_languages/English/admin/help/review.php
--- 0.7.7.src/e107_languages/English/admin/help/review.php	2006-08-26 21:24:45.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/help/review.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,25 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/review.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/08/27 02:24:45 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "Reviews are similar to articles but they will be listed in their own menu item.<br />
- For a multi-page review separate each page with the text [newpage], i.e. <br /><code>Test1 [newpage] Test2</code><br /> would create a two page review with 'Test1' on page 1 and 'Test2' on page 2.";
-$ns -> tablerender("Review Help", $text);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_admin.php 0.7.11.src/e107_languages/English/admin/lan_admin.php
--- 0.7.7.src/e107_languages/English/admin/lan_admin.php	2006-10-31 15:16:29.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_admin.php	2007-07-03 14:22:15.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_admin.php,v $
-|     $Revision: 1.54 $
-|     $Date: 2006/10/31 21:16:29 $
-|     $Author: e107coders $
+|     $Revision: 1.58 $
+|     $Date: 2007/07/03 19:22:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("ADLAN_0", "News");
@@ -172,6 +172,9 @@
 define("ADLAN_151", "Main");
 define("ADLAN_152", "Enter Code");
 
+define("ADLAN_153", "Administration Area");
+define('ADLAN_154', "Error contacting Sourceforge to check for new version");
+
 define('ADLAN_CL_1', 'Settings');
 define('ADLAN_CL_2', 'Users');
 define('ADLAN_CL_3', 'Content');
@@ -252,6 +255,7 @@
 define("LAN_BAN","Ban");
 define("LAN_RATING", "Rating");
 
+define("LAN_UPLOAD", "Upload");
 define("LAN_UPLOAD_IMAGES","Upload Images");
 define("LAN_UPLOAD_FILES","Upload Files");
 define("LAN_UPLOAD_ADDFILE","Add Another File");
@@ -268,5 +272,7 @@
 define("LAN_BACK","Back");
 
 define("LAN_CREDITS","Credits");
+define("LAN_NEWVERSION","New Version Available");
+
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_banlist.php 0.7.11.src/e107_languages/English/admin/lan_banlist.php
--- 0.7.7.src/e107_languages/English/admin/lan_banlist.php	2006-11-17 20:29:09.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_banlist.php	2007-02-11 04:33:58.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_banlist.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/11/18 02:29:09 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.8 $
+|     $Date: 2007/02/11 10:33:58 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("BANLAN_1", "Ban removed.");
@@ -15,11 +15,11 @@
 define("BANLAN_4", "Remove ban");
 define("BANLAN_5", "Enter IP, email address, or host");
 define("BANLAN_7", "Reason");
-define("BANLAN_8", "Ban User");
-define("BANLAN_9", "Ban users from site");
+define("BANLAN_8", "Ban Address");
+define("BANLAN_9", "Ban users from site by email, IP or host address");
 define("BANLAN_10", "IP / Email / Reason");
 define("BANLAN_11", "Auto-ban: More than 10 failed login attempts");
 define("BANLAN_12", "Note: Reverse DNS is currently disabled, it must be enabled to allow banning by host.  Banning by IP and email will still function normally.");
-
+define("BANLAN_13", "Note: To ban a user by user name, go to the users admin page: ");
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_db.php 0.7.11.src/e107_languages/English/admin/lan_db.php
--- 0.7.7.src/e107_languages/English/admin/lan_db.php	2006-10-31 15:16:29.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_db.php	2007-02-14 15:17:42.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_db.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/10/31 21:16:29 $
-|     $Author: e107coders $
+|     $Revision: 1.7 $
+|     $Date: 2007/02/14 21:17:42 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("DBLAN_1", "Core settings backed up in database.");
@@ -38,8 +38,11 @@
 define("DBLAN_27", "Installed");
 define("DBLAN_28", "Click button to scan plugin directories for changes");
 define("DBLAN_29", "Scan plugin directories");
-
-
+define("DBLAN_30", " (If an addon shows an error, check for characters outside the PHP opening/closing tags)");
+define("DBLAN_31", "Pass");
+define("DBLAN_32", "Error");
+define("DBLAN_33", "Inaccessible");
+define("DBLAN_34", "Not checked");
 
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_db_verify.php 0.7.11.src/e107_languages/English/admin/lan_db_verify.php
--- 0.7.7.src/e107_languages/English/admin/lan_db_verify.php	2005-04-02 12:29:48.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_db_verify.php	2007-05-29 13:53:04.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_db_verify.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/04/02 18:29:48 $
-|     $Author: e107coders $
+|     $Revision: 1.4 $
+|     $Date: 2007/05/29 18:53:04 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("DBLAN_1", "Unable to read the sql datafile<br /><br />Please ensure the file <b>core_sql.php</b> exists in the <b>/admin/sql</b> directory.");
@@ -30,4 +30,5 @@
 define("DBLAN_19", "Attempt to Fix");
 define("DBLAN_20", "Attempting to fix tables");
 define("DBLAN_21", "Fix Selected Items");
+define("DBLAN_22", " is not readable");
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_download.php 0.7.11.src/e107_languages/English/admin/lan_download.php
--- 0.7.7.src/e107_languages/English/admin/lan_download.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/lan_download.php	2007-11-21 16:52:26.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_download.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.20 $
+|     $Date: 2007/11/21 22:52:26 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("DOWLAN_1", "Download added to database.");
@@ -33,7 +33,7 @@
 define("DOWLAN_25", "Submit Download");
 
 define("DOWLAN_27", "Download");
-
+define("DOWLAN_28", "None");
 define("DOWLAN_29", "Downloads Front Page");
 define("DOWLAN_30", "Create Download");
 define("DOWLAN_31", "Categories");
@@ -134,5 +134,14 @@
 define("DOWLAN_151", "Broken-download reporting available to");
 
 define("DOWLAN_152", "Couldn't move file");
-define("DOWLAN_153", "Move file into download folder");   
+define("DOWLAN_153", "Move file into download folder");
+
+define("DOWLAN_154", "if using mirrors, select how they will be displayed");
+define("DOWLAN_155", "Mirror display type:");
+define("DOWLAN_156", "show mirror list, allow user to choose mirror");
+define("DOWLAN_157", "use random mirror - no user choice");
+
+define("DOWLAN_158", "Show sub-sub-categories on main download page");
+define("DOWLAN_159", "Include sub-sub-category counts in subcategory counts");
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_emoticon.php 0.7.11.src/e107_languages/English/admin/lan_emoticon.php
--- 0.7.7.src/e107_languages/English/admin/lan_emoticon.php	2006-06-13 11:16:13.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/lan_emoticon.php	2007-05-29 14:45:31.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_emoticon.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/06/13 16:16:13 $
-|     $Author: lisa_ $
+|     $Revision: 1.11 $
+|     $Date: 2007/05/29 19:45:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("EMOLAN_1", "Emote activation");
@@ -21,7 +21,7 @@
 define("EMOLAN_8", "Status");
 define("EMOLAN_9", "Options");
 define("EMOLAN_10", "Active");
-define("EMOLAN_11", "Activate pack'");
+define("EMOLAN_11", "Activate pack");
 
 define("EMOLAN_12", "Edit / configure this pack");
 define("EMOLAN_13", "Installed packs");
@@ -29,11 +29,19 @@
 define("EMOLAN_14", "Save configuration");
 define("EMOLAN_15", "Edit / configure emotes");
 define("EMOLAN_16", "Emote configuration saved");
-define("EMOLAN_17", "You have an emoticon pack present that contains spaces, which are not allowed !");
+define("EMOLAN_17", "You have an emoticon pack present that contains spaces in the name, which are not allowed !");
 define("EMOLAN_18", "please rename the instances listed below so they no longer contain spaces:");
 define("EMOLAN_19", "Name");
 define("EMOLAN_20", "Location");
 define("EMOLAN_21", "Error");
 //define("EMOLAN_2", "Name");
-
+define("EMOLAN_22", "New emote pak found:");
+define("EMOLAN_23", "New emote xml pak found:");
+define("EMOLAN_24", "New emote php found:");
+define("EMOLAN_25", "Installing new PHP emotes: ");
+define("EMOLAN_26", "Re-scan pack");
+define("EMOLAN_27", "Error occurred processing pack: ");
+define("EMOLAN_28", "Generate XML");
+define("EMOLAN_29", "XML file generated: ");
+define("EMOLAN_30", "Error writing XML file: ");
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_footer.php 0.7.11.src/e107_languages/English/admin/lan_footer.php
--- 0.7.7.src/e107_languages/English/admin/lan_footer.php	2005-11-24 10:29:02.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_footer.php	2006-12-29 11:45:38.000000000 -0600
@@ -4,16 +4,16 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_footer.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/11/24 16:29:02 $
-|     $Author: streaky $
+|     $Revision: 1.4 $
+|     $Date: 2006/12/29 17:45:38 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("FOOTLAN_1", "Site");
 define("FOOTLAN_2", "Head Admin");
 define("FOOTLAN_3", "Version");
 define("FOOTLAN_4", "build");
-define("FOOTLAN_5", "Theme");
+define("FOOTLAN_5", "Admin Theme");
 define("FOOTLAN_6", "by");
 define("FOOTLAN_7", "Info");
 define("FOOTLAN_8", "Install date");
@@ -26,5 +26,6 @@
 define("FOOTLAN_15", "Documentation");
 define("FOOTLAN_16", "Database");
 define("FOOTLAN_17", "Charset");
+define("FOOTLAN_18", "Site Theme");
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_image.php 0.7.11.src/e107_languages/English/admin/lan_image.php
--- 0.7.7.src/e107_languages/English/admin/lan_image.php	2006-11-11 06:53:57.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_image.php	2007-05-06 15:52:32.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_image.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/11/11 12:53:57 $
-|     $Author: mrpete $
+|     $Revision: 1.7 $
+|     $Date: 2007/05/06 20:52:32 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("IMALAN_1", "Enable image posting");
@@ -61,5 +61,9 @@
 define("IMALAN_50", "Total");
 define("IMALAN_51", "Avatar for ");
 
+define("IMALAN_52", "Path to ImageMagick appears to be incorrect");
+define("IMALAN_53", "Path to ImageMagick appears to be correct, but convert file may not be valid");
+define("IMALAN_54", "GD version installed:");
+define('IMALAN_55', 'Not installed');
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_language.php 0.7.11.src/e107_languages/English/admin/lan_language.php
--- 0.7.7.src/e107_languages/English/admin/lan_language.php	2006-10-24 21:31:29.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/lan_language.php	2007-09-20 16:36:45.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_language.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/10/25 02:31:29 $
+|     $Revision: 1.16 $
+|     $Date: 2007/09/20 21:36:45 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -27,9 +27,9 @@
 define("LANG_LAN_15", "Tick to copy data from the default language. (Useful for links, news-categories, etc.)");
 define("LANG_LAN_16", "Multi-language Database Usage");
 define("LANG_LAN_17", "Default Language - No additional tables required.");
-define("LANG_LAN_18", "Use Parked Subdomains to set Language:");
-define("LANG_LAN_19", "e.g. fr.mydomain.com to set the language to French.");
-define("LANG_LAN_20", "Enter the main domain name to enable. e.g. mydomain.com");
+define("LANG_LAN_18", "Use Parked Subdomains with these domains to set site Language:");
+define("LANG_LAN_19", "e.g. The domain fr.mydomain.com would set the language to French.");
+define("LANG_LAN_20", "Enter one domain per line. eg. mydomain.com etc. or leave blank to disable.");
 
 define("LANG_LAN_21", "Language Tools");
 
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_newspost.php 0.7.11.src/e107_languages/English/admin/lan_newspost.php
--- 0.7.7.src/e107_languages/English/admin/lan_newspost.php	2006-11-10 00:54:18.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_newspost.php	2007-10-05 19:17:10.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_newspost.php,v $
-|     $Revision: 1.31 $
-|     $Date: 2006/11/10 06:54:18 $
-|     $Author: lisa_ $
+|     $Revision: 1.32 $
+|     $Date: 2007/10/06 00:17:10 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("NWSLAN_1", "News story deleted.");
@@ -81,8 +81,8 @@
 define("NWSLAN_72", "Only show news item between certain dates");
 define("NWSLAN_73", "Render type");
 define("NWSLAN_74", "Select how and where news item is posted");
-define("NWSLAN_75", "Default - post to front page");
-define("NWSLAN_76", "Title only - post to front page");
+define("NWSLAN_75", "Default - post to news page");
+define("NWSLAN_76", "Title only - post to news page");
 define("NWSLAN_77", "Post to other news menu");
 
 // define("NWSLAN_78", "This option is disabled as file uploading is not enabled on your server");  // deprecated see lan_admin.php
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_plugin.php 0.7.11.src/e107_languages/English/admin/lan_plugin.php
--- 0.7.7.src/e107_languages/English/admin/lan_plugin.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/lan_plugin.php	2007-05-07 08:38:04.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_plugin.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.23 $
+|     $Date: 2007/05/07 13:38:04 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("EPL_ADLAN_0", "Install");
@@ -57,6 +57,10 @@
 define("EPL_ADLAN_43", "Your plugin has been uploaded and unzipped, please scroll down to see your plugin in the list.");
 define("EPL_ADLAN_44", "Auto plugin upload and extraction is disabled as your plugins folder does not have the correct permissions - please CHMOD your e107_plugins folder to 777.");
 define("EPL_ADLAN_45", "Your menu item has been uploaded and unzipped, to activate go to <a href='".e_ADMIN."menus.php'>your menus page</a>.");
+define("EPL_ADLAN_46", "PCLZIP extract error:");
+define("EPL_ADLAN_47", "PCLTAR extract error: ");
+define("EPL_ADLAN_48", "code:");
+define('EPL_ADLAN_49', "Tables not deleted during uninstall process by request");
 
 // define("EPL_CANCEL", "Cancel"); use LAN_CANCEL instead !!
 // define("EPL_EMAIL", "email");
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_prefs.php 0.7.11.src/e107_languages/English/admin/lan_prefs.php
--- 0.7.7.src/e107_languages/English/admin/lan_prefs.php	2006-11-20 06:52:37.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_prefs.php	2007-12-29 13:06:15.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_prefs.php,v $
-|     $Revision: 1.59 $
-|     $Date: 2006/11/20 12:52:37 $
-|     $Author: mrpete $
+|     $Revision: 1.67 $
+|     $Date: 2007/12/29 19:06:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -100,7 +100,7 @@
 define("CUSTSIG_18", "Disallow usernames");
 define("CUSTSIG_19", "usernames containing the following text will be rejected, separate entries by commas");
 
-define("PRFLAN_91", "If someone is attacking your site by multiple requests to your server, his IP will be automatically banned ! Don't replace a correct server config !!!");
+define("PRFLAN_91", "If someone is attacking your site by multiple requests to your server, his IP will be automatically banned ! Best done with server config if possible!!!");
 define("PRFLAN_92", "Secure signup verification -- hide password in email?");
 define("PRFLAN_93", "strftime function page at php.net");
 define("PRFLAN_94", "here");
@@ -163,10 +163,10 @@
 define("PRFLAN_153", "Admin Approval");
 define("PRFLAN_154", "New user verification method <br />If 'Admin Approval' is selected, it is recommended that you enable email notification on user signup <a href='".e_ADMIN."notify.php'>here</a>.");
 
-define("PRFLAN_155", "Display Name available to");
+define("PRFLAN_155", "Display name and login name may be different for");
 define("PRFLAN_156", "Reset ALL Display Names");
-define("PRFLAN_157", "All Display Names have been reset to the Login Name");
-define("PRFLAN_158", "Display Name maximum length");
+define("PRFLAN_157", "All Display Names have been reset to the Username");
+define("PRFLAN_158", "Display Name maximum length (5..30)");
 define("PRFLAN_159", "viewing this page with");
 
 define("PRFLAN_160", "Check remote servers when validating email addresses.");
@@ -179,12 +179,19 @@
 define("PRFLAN_165", "Possible opening for allowing spam, use with caution");
 define("PRFLAN_166", "Show emoticon images on comment form?");
 
-define("PRFLAN_167", "Make entering an email addresses optional"); // subject to change.
+define("PRFLAN_167", "Make entering an email address optional"); // subject to change.
 define("PRFLAN_168", "Site Contact Person(s)");
 define("PRFLAN_169", "If the chosen group contains more than one person, the user will be asked to select a person from the group.");
 
 define("PRFLAN_170", "Use reverse DNS to allow host banning");
 define("PRFLAN_171", "Turning this option on will allow you to ban users by hostname, rather then just IP or email address.  <br />NOTE: This may affect pageload times on some hosts");
+define("PRFLAN_172", "Login Name maximum length (10..100)");
+define("PRFLAN_173", "Check at SourceForge for E107 updates once/day");
+
+define("PRFLAN_174", "Name for responses to emails from site");
+define("PRFLAN_175", "This will appear in the 'From' field of registration and other emails from this site");
+define("PRFLAN_176", "Email address for emails from site");
+define("PRFLAN_177", "Address specified for replies to emails from this site.");
 
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_search.php 0.7.11.src/e107_languages/English/admin/lan_search.php
--- 0.7.7.src/e107_languages/English/admin/lan_search.php	2006-10-31 15:16:29.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_search.php	2007-05-28 06:24:04.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_search.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2006/10/31 21:16:29 $
-|     $Author: e107coders $
+|     $Revision: 1.26 $
+|     $Date: 2007/05/28 11:24:04 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("SEALAN_1", "Search Configuration");
@@ -42,7 +42,7 @@
 define("SEALAN_38", "Radio");
 define("SEALAN_39", "Custom Pages");
 
-define("LAN_98", "News");
+define("LAN_SEARCH_98", "News");		// Renamed to avoid clashes
 define("LAN_197", "Downloads");
 define("LAN_418", "Custom Pages");
 
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_theme.php 0.7.11.src/e107_languages/English/admin/lan_theme.php
--- 0.7.7.src/e107_languages/English/admin/lan_theme.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/lan_theme.php	2007-02-04 15:42:33.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_theme.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.10 $
+|     $Date: 2007/02/04 21:42:33 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("TPVLAN_1", "You are looking at a preview of the <b>'".PREVIEWTHEMENAME."'</b> theme. It has not been set as the main theme for your site, it has been activated to provide a preview of how the theme looks.<br />To set this theme as your site theme, <a href='".e_ADMIN."theme.php'>return to your theme manager</a> and select 'Set As Site Theme'.<br />To preview more themes please <a href='".e_ADMIN."theme.php'>click here</a>");
@@ -59,4 +59,9 @@
 define("TPVLAN_41", "Please select admin layout style to use");
 define("TPVLAN_42", "Save admin options");
 define("TPVLAN_43", "Admin options saved");
+
+define("TPVLAN_46", "PCLZIP extract error:");
+define("TPVLAN_47", "PCLTAR extract error: ");
+define("TPVLAN_48", "code:");
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_upload.php 0.7.11.src/e107_languages/English/admin/lan_upload.php
--- 0.7.7.src/e107_languages/English/admin/lan_upload.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/admin/lan_upload.php	2007-09-22 07:40:20.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_upload.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.7 $
+|     $Date: 2007/09/22 12:40:20 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("UPLLAN_1", "Upload removed from list.");
@@ -36,13 +36,14 @@
 define("UPLLAN_24", "Filetype");
 define("UPLLAN_25", "Uploads Enabled?");
 define("UPLLAN_26", "No public uploads will be permitted if disabled");
+define("UPLLAN_27", "unmoderated public uploads");
 
 define("UPLLAN_29", "Storage type");
 define("UPLLAN_30", "Choose how to store uploaded files, either as normal files on server or as binary info in database<br /><b>Note</b> binary is only suitable for smaller files under approximately 500kb");
 define("UPLLAN_31", "Flatfile");
 define("UPLLAN_32", "Binary");
 define("UPLLAN_33", "Maximum file size");
-define("UPLLAN_34", "Maximum upload size in bytes - leave blank to conform to php.ini setting ( php.ini setting is");
+define("UPLLAN_34", "Maximum upload size in bytes - leave blank to use settings from php.ini");
 define("UPLLAN_35", "Allowed file types");
 define("UPLLAN_36", "Please enter one type per line");
 define("UPLLAN_37", "Permission");
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_users.php 0.7.11.src/e107_languages/English/admin/lan_users.php
--- 0.7.7.src/e107_languages/English/admin/lan_users.php	2006-10-31 15:16:29.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_users.php	2007-09-28 15:50:23.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_users.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2006/10/31 21:16:29 $
-|     $Author: e107coders $
+|     $Revision: 1.32 $
+|     $Date: 2007/09/28 20:50:23 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("USRLAN_1", "Options Saved.");
@@ -70,8 +70,8 @@
 define("USRLAN_62", "Password");
 define("USRLAN_63", "Re-type Password");
 define("USRLAN_64", "Email Address");
-define("USRLAN_65", "That user name cannot be accepted as valid, please choose a different user name");
-define("USRLAN_66", "That user name already exists in the database, please choose a different user name");
+define("USRLAN_65", "That display name cannot be accepted as valid, please choose a different display name");
+define("USRLAN_66", "That display name already exists in the database, please choose a different display name");
 define("USRLAN_67", "The two passwords do not match");
 define("USRLAN_68", "You left required field(s) blank");
 define("USRLAN_69", "That doesn't appear to be a valid email address");
@@ -120,7 +120,7 @@
 define("USRLAN_126", "Allow users to rate users");
 define("USRLAN_127", "Allow comments in user profile");
 
-define("USRLAN_128", "Login name");
+define("USRLAN_128", "Username");
 
 define("USRLAN_130", "Enable online user tracking");
 define("USRLAN_131", "You must enable this option to use online user tracking options, like online.php, forum online info and online menus");
@@ -133,10 +133,35 @@
 define("USRLAN_136", "Multiple users found with IP address of {IP}; IP not banned.");
 define("USRLAN_137", "Users IP address of {IP} banned.");
 
+
+define("USRLAN_138", "Unverified users");
+define("USRLAN_139", "Your account has been activated.\n\nYou can visit {SITEURL} and log into the site using the login information you provided.");
+
+define("USRLAN_140", "Email Re-sent to");
+define("USRLAN_141", "Failed to Re-send email to");
+define("USRLAN_142", "with the following activation link");
+
+define("USRLAN_143", "Check For Bounces");
+define("USRLAN_144", "Resend Confirmation Email to All");
+define("USRLAN_145", "Bounced users");
+define("USRLAN_146", "Member information is available to");
+
+define("USRLAN_147", "Email address is already used by a banned user");
+define("USRLAN_148", "Email address is banned");
+
+define("USRLAN_149", "Delete checked emails");
+define("USRLAN_150", "Delete all emails");
+define("USRLAN_151", "Clear bounce, require Activation");
+define("USRLAN_152", "Clear bounce and Activate");
+define("USRLAN_153", "Delete non-bounce emails");
+define("USRLAN_154", "Clear email for checked");
+define("USRLAN_155", "Total {TOTAL} emails found. {DELCOUNT} deleted through options.<br />{DELUSER} users marked as 'bounced' (out of {FOUND} emails)");
+
 define("LAN_MAINADMIN","Main Admin");
 define("LAN_ADMIN","Admin");
 define("LAN_NOTVERIFIED","Not Verified");
 define("LAN_BANNED","Banned");
+define("LAN_BOUNCED","Bounced");
 
 define("DUSRLAN_1", "ID");
 define("DUSRLAN_2", "Display Name");
@@ -176,17 +201,4 @@
 define("DUSRLAN_36", "Password Change");
 define("DUSRLAN_37", "XUP");
 
-define("USRLAN_138", "Unverified users");
-define("USRLAN_139", "Your account has been activated.\n\nYou can visit {SITEURL} and log into the site using the login information you provided.");
-
-define("USRLAN_140", "Email Re-sent to");
-define("USRLAN_141", "Failed to Re-send email to");
-define("USRLAN_142", "with the following activation link");
-
-define("LAN_BOUNCED","Bounced");
-define("USRLAN_143", "Check For Bounces");
-define("USRLAN_144", "Resend Confirmation Email to All");
-define("USRLAN_145", "Bounced users");
-define("USRLAN_146", "Member information is available to");
-
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/admin/lan_users_extended.php 0.7.11.src/e107_languages/English/admin/lan_users_extended.php
--- 0.7.7.src/e107_languages/English/admin/lan_users_extended.php	2006-11-07 17:46:20.000000000 -0600
+++ 0.7.11.src/e107_languages/English/admin/lan_users_extended.php	2007-04-14 12:24:13.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_users_extended.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/11/07 23:46:20 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.20 $
+|     $Date: 2007/04/14 17:24:13 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("EXTLAN_1", "Name");
@@ -20,7 +20,7 @@
 define("EXTLAN_9", "Extended User Fields");
 
 define("EXTLAN_10", "Field name");
-define("EXTLAN_11", "This is the name of the field as stored in the table, it must be unique from any other");
+define("EXTLAN_11", "This is the name of the field as stored in the table, it must be unique from any other, and must not be used in the main user table");
 define("EXTLAN_12", "Field text");
 define("EXTLAN_13", "This is the displayed name of the field in rendered pages");
 define("EXTLAN_14", "Field Type");
@@ -87,21 +87,26 @@
 define("EXTLAN_72", "has been deactivated");
 define("EXTLAN_73", "was not deactivated!");
 define("EXTLAN_74", "is a reserved field name and can not be used.");
+define("EXTLAN_75", "Error adding field to database.");
+define("EXTLAN_76", "Invalid characters in field name - only A-Z, a-z, 0-9, '_' allowed.");
+define("EXTLAN_77", "Category not deleted - must delete fields in category first: ");
 
 
 //textbox
 define("EXTLAN_HELP_1", "<b><i>Parameters:</i></b><br />size - size of field<br />maxlength - max length of field<br /><br />class - css class of field<br />style - css style string<br /><br />regex - regex validation code<br />regexfail - validation fail text");
 //radio buttons
-define("EXTLAN_HELP_2", "This will be the radio buttons help text");
+define("EXTLAN_HELP_2", "Enter text for options in 'Values' box - one box per option. Add new boxes as needed");
 //dropdown
-define("EXTLAN_HELP_3", "This will be the dropdown help text");
+define("EXTLAN_HELP_3", "Enter text for options in 'Values' box - one box per option. Add new boxes as needed");
 //db field
 define("EXTLAN_HELP_4", "<b><i>Values:</i></b><br />There should be three values given ALWAYS:<br /><ol><li>dbtable</li><li>field containing id</li><li>field containing value</li></ol><br />");
 //textarea
-define("EXTLAN_HELP_5", "This will be the Textarea help text");
+define("EXTLAN_HELP_5", "Define an area for free-format text. (Set the size in the 'Field include text' box as required)");
 //integer
-define("EXTLAN_HELP_6", "This will be the Integer help text");
+define("EXTLAN_HELP_6", "Allow user to enter a numeric value");
 //date
-define("EXTLAN_HELP_7", "This will be the date help text");
+define("EXTLAN_HELP_7", "Require user to enter a date");
+// Language
+define("EXTLAN_HELP_8", "Allow user to select from installed languages");
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_comment.php 0.7.11.src/e107_languages/English/lan_comment.php
--- 0.7.7.src/e107_languages/English/lan_comment.php	2006-07-18 15:57:22.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_comment.php	2007-12-25 06:42:57.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_comment.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/07/18 20:57:22 $
-|     $Author: e107coders $
+|     $Revision: 1.13 $
+|     $Date: 2007/12/25 12:42:57 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -16,7 +16,7 @@
 define("COMLAN_3", "Delete");
 define("COMLAN_4", "Info");
 define("COMLAN_5", "Comments ...");
-define("COMLAN_6", "You must be logged in to post comments on this site - please either log in or if you are not registered click");
+define("COMLAN_6", "You must be logged in to make comments on this site - please log in, or if you are not registered click");
 define("COMLAN_7", "Main site administrator");
 define("COMLAN_8", "Comment");
 define("COMLAN_9", "Submit comment");
@@ -43,17 +43,6 @@
 define("COMLAN_318", "Edit comment");
 define("COMLAN_319", "edited");
 define("COMLAN_320", "Update comment");
-/*
-define("COMLAN_1", "here");
-define("COMLAN_2", "to signup");
-define("COMLAN_3", "Error!");
-define("COMLAN_4", 'Subject');
-define("COMLAN_5", 'Re:');
-define("COMLAN_6", 'Reply to this');
-define("COMLAN_7", 'Rating');
-define("COMLAN_8", 'Comments are locked');
-define("COMLAN_9", 'Unauthorized');
-*/
 define("COMLAN_321", "here");
 define("COMLAN_322", "to signup");
 define("COMLAN_323", "Error!");
@@ -73,5 +62,6 @@
 define("COMLAN_TYPE_6", "bugtrack");
 define("COMLAN_TYPE_7", "ideas");
 define("COMLAN_TYPE_8", "userprofile");
+define("COMLAN_TYPE_PAGE", "Content");		// Reall custom page, but use a 'non-technical' description
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_download.php 0.7.11.src/e107_languages/English/lan_download.php
--- 0.7.7.src/e107_languages/English/lan_download.php	2006-09-20 09:04:31.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_download.php	2007-02-03 08:21:19.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_download.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/09/20 14:04:31 $
-|     $Author: e107coders $
+|     $Revision: 1.16 $
+|     $Date: 2007/02/03 14:21:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Downloads");
@@ -28,7 +28,7 @@
 define("LAN_dl_15", "Thanks for rating");
 define("LAN_dl_16", "download(s) from");
 define("LAN_dl_17", "files");
-define("LAN_dl_18", "Downloads");
+define("LAN_dl_18", "Downloads");			// Page title
 define("LAN_dl_19", "Category");
 define("LAN_dl_20", "Files");
 define("LAN_dl_21", "Size");
@@ -96,5 +96,6 @@
 
 define("LAN_dl_75", "no image available ");
 define("LAN_dl_76", "Go to page");
+define("LAN_dl_77", "Downloads");		// Intentional duplicate - some languages need it to be different. This is for number of townloads
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_email.php 0.7.11.src/e107_languages/English/lan_email.php
--- 0.7.7.src/e107_languages/English/lan_email.php	2006-10-21 06:20:27.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_email.php	2007-04-12 17:51:34.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_email.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/10/21 11:20:27 $
-|     $Author: mrpete $
+|     $Revision: 1.7 $
+|     $Date: 2007/04/12 22:51:34 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined("PAGE_NAME")) { define("PAGE_NAME", "Email"); }
@@ -25,7 +25,7 @@
 define("LAN_EMAIL_12", "Error");
 define("LAN_EMAIL_13", "Email article to a friend");
 define("LAN_EMAIL_14", "Email news_item to a friend");
-define("LAN_EMAIL_15", "Login Name: ");
+define("LAN_EMAIL_15", "Username: ");
 define("LAN_EMAIL_106", "That doesn't appear to be a valid email address");
 define("LAN_EMAIL_185", "Send Article");
 define("LAN_EMAIL_186", "Send News Item");
@@ -34,4 +34,4 @@
 define("LAN_EMAIL_189", "I thought you might be interested in this article from");
 define("LAN_EMAIL_190", "Enter visible code");
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_equery_secure.php 0.7.11.src/e107_languages/English/lan_equery_secure.php
--- 0.7.7.src/e107_languages/English/lan_equery_secure.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_equery_secure.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,19 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system - Language File.
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_equery_secure.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-define("EQSEC_LAN1", "You are being redirected to an admin function, possible database modifications could occur");
-define("EQSEC_LAN2", "Please confirm this action:");
-define("EQSEC_LAN3", "No referrer");
-define("EQSEC_LAN4", "Action from:");
-define("EQSEC_LAN5", "Action to:");
-define("EQSEC_LAN6", "Confirm action");
-define("EQSEC_LAN7", "Or cancel");
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_fpw.php 0.7.11.src/e107_languages/English/lan_fpw.php
--- 0.7.7.src/e107_languages/English/lan_fpw.php	2006-08-26 21:24:44.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_fpw.php	2007-12-12 18:44:06.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_fpw.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/08/27 02:24:44 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.6 $
+|     $Date: 2007/12/13 00:44:06 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Password Reset");
@@ -33,8 +33,8 @@
 define("LAN_FPW5","A request to reset your password for");
 define("LAN_FPW6","An email has been sent to you with a link that will allow you to reset your password.");
 define("LAN_FPW7","This is not a valid link to reset your password.<br />Please contact the site administrator for more details.");
-define("LAN_FPW8","The password for username");
-define("LAN_FPW9","has been successfully changed.<br /><br />The new password is:");
+define("LAN_FPW8","Your password has been changed successfully.");
+define("LAN_FPW9","The new password is:");
 define("LAN_FPW10","Please");
 define("LAN_FPW11","log in now");
 define("LAN_FPW12","and immediately change your password, for security purposes.");
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_installer.php 0.7.11.src/e107_languages/English/lan_installer.php
--- 0.7.7.src/e107_languages/English/lan_installer.php	2006-11-09 16:52:52.000000000 -0600
+++ 0.7.11.src/e107_languages/English/lan_installer.php	2007-04-12 17:58:23.000000000 -0500
@@ -106,7 +106,7 @@
 define("LANINS_072", "Admin Username");
 define("LANINS_073", "This is the name you will use to login into the site. If you wish to use this as your display name also");
 define("LANINS_074", "Admin Display Name");
-define("LANINS_075", "This is the name that you wish your users to see displayed in your profile, forums and other areas. If you wish to use the same as your login name then leave this blank.");
+define("LANINS_075", "This is the name that you wish your users to see displayed in your profile, forums and other areas. If you wish to use the same as your username then leave this blank.");
 define("LANINS_076", "Admin Password");
 define("LANINS_077", "Please type the admin password you wish to use here");
 define("LANINS_078", "Admin Password Confirmation");
@@ -122,3 +122,27 @@
 define("LANINS_085", "The installer could not select database:");
 
 define("LANINS_086", "Admin Username, Admin Password and Admin Email are <b>required</b> fields. Please return to the last page and ensure the information is correctly entered.");
+
+define("LANINS_087", "Misc");
+define("LANINS_088", "Home");
+define("LANINS_089", "Downloads");
+define("LANINS_090", "Members");
+define("LANINS_091", "Submit News");
+define("LANINS_092", "Contact Us");
+define("LANINS_093", "Grants access to private menu items");
+define("LANINS_094", "Example private forum class");
+define("LANINS_095", "Integrity Check");
+
+define("LANINS_096", 'Latest Comments');
+define("LANINS_097", '[more ...]');
+define("LANINS_098", 'Articles');
+define("LANINS_099", 'Articles Front Page ...');
+define("LANINS_100", 'Latest Forum Posts');
+define("LANINS_101", 'Update menu Settings');
+define("LANINS_102", 'Date / Time');
+define("LANINS_103", 'Reviews');
+define("LANINS_104", 'Review Front Page ...');
+
+define("LANINS_105", '');
+define("LANINS_106", '');
+?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_search.php 0.7.11.src/e107_languages/English/lan_search.php
--- 0.7.7.src/e107_languages/English/lan_search.php	2005-09-19 17:09:06.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_search.php	2007-05-18 16:14:38.000000000 -0500
@@ -4,16 +4,14 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_search.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2005/09/19 22:09:06 $
-|     $Author: sweetas $
+|     $Revision: 1.14 $
+|     $Date: 2007/05/18 21:14:38 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 define("PAGE_NAME", "Search");
 
-define("LAN_98", "News");
-define("LAN_99", "Comments");
 define("LAN_140", "Members");
 define("LAN_180", "Search");
 define("LAN_192", "All categories");
@@ -25,11 +23,9 @@
 define("LAN_197", "Downloads");
 define("LAN_198", "No matches found");
 define("LAN_199", "Search For:");
-define("LAN_200", "Categories:");
 
-define("LAN_201", "Please redefine your search query");
 define("LAN_416", "You must be logged in to access this page");
-define("LAN_417", "Search terms must be at least 3 characters.");
+define("LAN_417", "Search terms must be at least --CHARS-- characters.");
 
 define("LAN_418", "Other Pages");
 
@@ -116,4 +112,10 @@
 define("LAN_SEARCH_76", "Posted on page");
 define("LAN_SEARCH_77", "Posted on profile page of");
 
+// Following formerly LAN_nnn - renamed to avoid clashes
+define("LAN_SEARCH_98", "News");
+define("LAN_SEARCH_99", "Comments");
+//define("LAN_SEARCH_200", "Categories:");						// Redundant LAN?
+define("LAN_SEARCH_201", "Please redefine your search query");
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_signup.php 0.7.11.src/e107_languages/English/lan_signup.php
--- 0.7.7.src/e107_languages/English/lan_signup.php	2006-11-16 13:50:45.000000000 -0600
+++ 0.7.11.src/e107_languages/English/lan_signup.php	2007-11-11 15:52:44.000000000 -0600
@@ -4,19 +4,19 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_signup.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2006/11/16 19:50:45 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.29 $
+|     $Date: 2007/11/11 21:52:44 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Register");
 define("LAN_7", "Display Name: ");
 define("LAN_8", "the name that will be displayed on site");
-define("LAN_9", "Login Name: ");
+define("LAN_9", "Username: ");
 define("LAN_10", "the name that you use to login");
 define("LAN_17", "Password: ");
 define("LAN_103", "That username cannot be accepted as valid, please choose a different user name");
-define("LAN_104", "That login name already exists in the database, please choose a different login name");
+define("LAN_104", "That username already exists in the database, please choose a different username");
 define("LAN_105", "The two passwords do not match");
 define("LAN_106", "That doesn't appear to be a valid email address");
 define("LAN_107", "Thank you! You are now a registered member of");
@@ -87,7 +87,7 @@
 define("LAN_SIGNUP_35", "Click here to register using an XUP file");
 define("LAN_SIGNUP_36", "An error has occurred creating your user information, please contact the site admin");
 
-define("LAN_LOGINNAME", "Login Name");
+define("LAN_LOGINNAME", "Username");
 define("LAN_PASSWORD", "Password");
 define("LAN_USERNAME", "Display Name");
 define("LAN_EMAIL_01", "Dear");
@@ -113,7 +113,12 @@
 define("LAN_SIGNUP_51", "Old Password");
 define("LAN_SIGNUP_52", "Incorrect Password");
 define("LAN_SIGNUP_53", "field failed validation test");
-
+define("LAN_SIGNUP_54", "Click here to fill in your details to register");
+define("LAN_SIGNUP_55", "That display name is too long. Please choose another");
+define("LAN_SIGNUP_56", "That display name is too short. Please choose another");
+define("LAN_SIGNUP_57", "That login name is too long. Please choose another");
+define("LAN_SIGNUP_58", "Signup Preview");
+define("LAN_SIGNUP_59","**** If the link doesn't work, please check that part of it has not overflowed onto the next line. ****");
 
 
 ?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_submitnews.php 0.7.11.src/e107_languages/English/lan_submitnews.php
--- 0.7.7.src/e107_languages/English/lan_submitnews.php	2006-07-04 11:33:32.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_submitnews.php	2007-04-12 17:58:23.000000000 -0500
@@ -4,13 +4,13 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_submitnews.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/07/04 16:33:32 $
+|     $Revision: 1.3 $
+|     $Date: 2007/04/12 22:58:23 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Submit News");
-define("LAN_7", "Login Name: ");
+define("LAN_7", "Username: ");
 define("LAN_62", "Subject: ");
 define("LAN_112", "Email Address: ");
 define("LAN_133", "Thank you");
@@ -29,4 +29,4 @@
 define("SUBNEWSLAN_5", "Image File");
 define("SUBNEWSLAN_6", "(jpg, gif or png)");
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_upload.php 0.7.11.src/e107_languages/English/lan_upload.php
--- 0.7.7.src/e107_languages/English/lan_upload.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_upload.php	2007-11-23 15:52:34.000000000 -0600
@@ -4,21 +4,25 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_upload.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2007/11/23 21:52:34 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Upload");
 
-define("LAN_20", "Error");
+define('LAN_UL_001','Invalid email address');
+define('LAN_UL_002', 'You do not have the correct permissions to upload files to this server.');	// LAN_403
+
+define('LAN_UL_020', 'Error');
+define('LAN_UL_021', 'Upload Failure');
+
 define("LAN_61", "Your Name: ");
 define("LAN_112", "Email Address: ");
 define("LAN_144", "Website URL: ");
 define("LAN_402", "You must be a registered member to upload files to this server.");
-define("LAN_403", "You do not have the correct permissions to upload files to this server.");
 define("LAN_404", "Thank you. Your upload will be reviewed by an administrator and posted to the site if appropriate.");
-define("LAN_405", "File exceeds specified maximum size limit - deleted.");
+//define("LAN_405", "File exceeds specified maximum size limit - deleted.");
 define("LAN_406", "Please note");
 define("LAN_407", "Any other filetypes uploaded will be instantly deleted.");
 define("LAN_408", "Underlined");
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_upload_handler.php 0.7.11.src/e107_languages/English/lan_upload_handler.php
--- 0.7.7.src/e107_languages/English/lan_upload_handler.php	2005-06-05 01:58:21.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_upload_handler.php	2007-07-23 15:05:31.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_upload_handler.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/06/05 06:58:21 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2007/07/23 20:05:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("LANUPLOAD_1", "The filetype");
@@ -18,8 +18,16 @@
 define("LANUPLOAD_7", "The uploaded file was only partially uploaded.");
 define("LANUPLOAD_8", "No file was uploaded.");
 define("LANUPLOAD_9", "Uploaded file size 0 bytes");
-define("LANUPLOAD_10", "Upload failed [Duplicate filename] - A file with the same name already exits.");
+define("LANUPLOAD_10", "Upload failed [Duplicate filename] - A file with the same name already exists.");
 define("LANUPLOAD_11", "The file did not upload. Filename: ");
 define("LANUPLOAD_12", "Error");
+define("LANUPLOAD_13", "Missing temporary folder");
+define("LANUPLOAD_14", "File write failed");
+define("LANUPLOAD_15", "Upload not allowed");
+define("LANUPLOAD_16", "Unknown Error");
+define("LANUPLOAD_17", "Invalid name for uploaded file");
+define("LANUPLOAD_18", "The uploaded file exceeds allowable limits.");
+define("LANUPLOAD_19", "Too many files uploaded - excess deleted.");
+
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_user_extended.php 0.7.11.src/e107_languages/English/lan_user_extended.php
--- 0.7.7.src/e107_languages/English/lan_user_extended.php	2006-04-29 01:45:38.000000000 -0500
+++ 0.7.11.src/e107_languages/English/lan_user_extended.php	2007-04-17 14:29:46.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_user_extended.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/04/29 06:45:38 $
-|     $Author: e107coders $
+|     $Revision: 1.11 $
+|     $Date: 2007/04/17 19:29:46 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("UE_LAN_1", "Text Box");
@@ -43,4 +43,6 @@
 define("UE_LAN_COUNTRY", "Country");
 define("UE_LAN_COUNTRY_DESC", "User Country (includes db table)");
 
+define("LAN_UE_FAIL_HOMEPAGE", "Invalid entry for home page setting");
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_languages/English/lan_usersettings.php 0.7.11.src/e107_languages/English/lan_usersettings.php
--- 0.7.7.src/e107_languages/English/lan_usersettings.php	2005-12-29 14:00:56.000000000 -0600
+++ 0.7.11.src/e107_languages/English/lan_usersettings.php	2007-08-16 14:19:51.000000000 -0500
@@ -4,16 +4,16 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_usersettings.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/29 20:00:56 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.16 $
+|     $Date: 2007/08/16 19:19:51 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "User Settings");
 
 define("LAN_7", "Display Name: ");
 define("LAN_8", "the name displayed on site");
-define("LAN_9", "Login Name: ");
+define("LAN_9", "Username: ");
 define("LAN_10", "the name you use to login to the site");
 define("LAN_11", "the name you use to login to the site - this cannot be changed, please contact an administrator if it needs to be changed for security purposes");
 
@@ -89,13 +89,13 @@
 
 // v.616
 define("LAN_CUSTOMTITLE", "Custom Title");
-define("LAN_ICQNUMBER", "ICQ number must contain only numbers");
+//define("LAN_ICQNUMBER", "ICQ number must contain only numbers");
 
 //v.617
 define("LAN_408", "A user with that email address already exists. ");
 define("MAX_AVWIDTH", "Maximum avatar size (wxh) is ");
 define("MAX_AVHEIGHT", " x ");
-define("GIF_RESIZE", "Please resize gif image or convert to different format");
+// define("GIF_RESIZE", "Please resize gif image or convert to different format");
 define("RESIZE_NOT_SUPPORTED", "Resize method not supported by this server. Please resize image or choose another. File has been deleted.");
 
 // v0.7
@@ -106,5 +106,11 @@
 define("LAN_USET_9", "Some of the required fields (marked with a *) are missing from your settings.");
 define("LAN_USET_10","Please update your settings now, in order to proceed.");
 define("LAN_USET_11", "That user name cannot be accepted as valid, please choose a different user name");
+define("LAN_USET_12", "That display name is too short. Please choose another");
+define("LAN_USET_13", "Invalid characters in Username. Please choose another");
+define("LAN_USET_14", "Login name too long. Please choose another");
+define("LAN_USET_15", "Display name too long. Please choose another");
+define("LAN_USET_16", "Tick box to delete existing photo without uploading another");
+define("LAN_USET_17", "Display name already used. Please choose another");
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/alt_auth/alt_auth_login_class.php 0.7.11.src/e107_plugins/alt_auth/alt_auth_login_class.php
--- 0.7.7.src/e107_plugins/alt_auth/alt_auth_login_class.php	2006-08-03 08:46:17.000000000 -0500
+++ 0.7.11.src/e107_plugins/alt_auth/alt_auth_login_class.php	2007-01-11 12:35:06.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/alt_auth/alt_auth_login_class.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/08/03 13:46:17 $
+|     $Revision: 1.5 $
+|     $Date: 2007/01/11 18:35:06 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -39,7 +39,14 @@
 		if($login_result === AUTH_SUCCESS )
 		{
 			$sql = new db;
-			if(!$sql -> db_Select("user","*","user_loginname='{$username}' "))
+			if (MAGIC_QUOTES_GPC == FALSE)
+			{
+				$username = mysql_real_escape_string($username);
+			}
+			$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
+			$username = substr($username, 0, 30);
+			
+			if(!$sql -> db_Select("user", "user_id", "user_loginname='{$username}' "))
 			{
 				// User not found in e107 database - add it now.
 				$qry = "INSERT INTO #user (user_id, user_loginname, user_name, user_join) VALUES ('0','{$username}','{$username}',".time().")";
@@ -52,7 +59,7 @@
 				$qry .= " ,user_{$key}='{$val}' ";
 			}
 			$qry.=" WHERE user_loginname='{$username}' ";
-			$sql -> db_Update("user", $qry);
+			$sql->db_Update("user", $qry);
 		}
 		else
 		{
diff -x .svn -ruN 0.7.7.src/e107_plugins/blogcalendar_menu/archive.php 0.7.11.src/e107_plugins/blogcalendar_menu/archive.php
--- 0.7.7.src/e107_plugins/blogcalendar_menu/archive.php	2006-06-12 04:07:10.000000000 -0500
+++ 0.7.11.src/e107_plugins/blogcalendar_menu/archive.php	2007-12-03 14:38:13.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/archive.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/06/12 09:07:10 $
-|     $Author: lisa_ $
+|     $Revision: 1.6 $
+|     $Date: 2007/12/03 20:38:13 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 | Based on code by: Thomas Bouve (crahan@gmx.net)
 */
@@ -50,18 +50,23 @@
 $cur_year = date("Y");
 $cur_month = date("n");
 $cur_day = date("j");
-if (strstr(e_QUERY, "year")) {
-	$tmp = explode(".", e_QUERY);
-	$req_year = $tmp[1];
-} else {
-	$req_year = $cur_year;
+if (strstr(e_QUERY, "year")) 
+{
+  $tmp = explode(".", e_QUERY);
+  if (is_numeric($tmp[1]))
+  {
+	$req_year = intval($tmp[1]);
+  }
 }
+
+if (!isset($req_year)) $req_year = $cur_year;
+
 	
 	
 // --------------------------------
 // look for the first and last year
 // --------------------------------
-$sql->db_Select_gen("SELECT news_id, news_datestamp from ".MPREFIX."news ORDER BY news_datestamp LIMIT 0,1");
+$sql->db_Select_gen("SELECT news_id, news_datestamp from #news ORDER BY news_datestamp LIMIT 0,1");
 $first_post = $sql->db_Fetch();
 $start_year = date("Y", $first_post['news_datestamp']);
 $end_year = $cur_year;
diff -x .svn -ruN 0.7.7.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php 0.7.11.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php
--- 0.7.7.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php	2005-12-28 10:12:59.000000000 -0600
+++ 0.7.11.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php	2007-12-03 14:38:13.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/blogcalendar_menu.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/28 16:12:59 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2007/12/03 20:38:13 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 | Based on code by: Thomas Bouve (crahan@gmx.net)
 */
@@ -38,8 +38,8 @@
 if (strstr(e_QUERY, "day")) {
 	$tmp = explode(".", e_QUERY);
 	$item = $tmp[1];
-	$req_year = substr($item, 0, 4);
-	$req_month = substr($item, 4, 2);
+	$req_year = intval(substr($item, 0, 4));
+	$req_month = intval(substr($item, 4, 2));
 	// decide on the behaviour here, do we highlight
 	// the day being viewed? or only 'today'?
 	//$req_day = substr($item, 6, 2);
@@ -54,8 +54,8 @@
 else if(strstr(e_QUERY, "month")) {
 	$tmp = explode(".", e_QUERY);
 	$item = $tmp[1];
-	$req_year = substr($item, 0, 4);
-	$req_month = substr($item, 4, 2);
+	$req_year = intval(substr($item, 0, 4));
+	$req_month = intval(substr($item, 4, 2));
 	// if the requested year and month are the current, then add
 	// the current day to the mix so the calendar highlights it
 	if (($req_year == $cur_year) && ($req_month == $cur_month)) {
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/admin_config.php 0.7.11.src/e107_plugins/calendar_menu/admin_config.php
--- 0.7.7.src/e107_plugins/calendar_menu/admin_config.php	2006-11-16 04:24:14.000000000 -0600
+++ 0.7.11.src/e107_plugins/calendar_menu/admin_config.php	2007-12-29 14:34:37.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/admin_config.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/11/16 10:24:14 $
-|     $Author: e107coders $
+|     $Revision: 1.17 $
+|     $Date: 2007/12/29 20:34:37 $
+|     $Author: e107steved $
 |
 | 02.11.06 - Cache clear option added
 | 10.11.06 - Support for updated templates etc
@@ -23,8 +23,10 @@
 $eplug_admin = true;		// Make sure we show admin theme
 require_once("../../class2.php");
 require_once(e_HANDLER."userclass_class.php");
-if (!getperms("P")) {
-	header("location:".e_BASE."index.php");
+if (!getperms("P")) 
+{
+  header("location:".e_BASE."index.php");
+  exit;
 }
 	
 	
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/calendar_menu.php 0.7.11.src/e107_plugins/calendar_menu/calendar_menu.php
--- 0.7.7.src/e107_plugins/calendar_menu/calendar_menu.php	2006-11-24 16:27:18.000000000 -0600
+++ 0.7.11.src/e107_plugins/calendar_menu/calendar_menu.php	2007-11-27 15:41:56.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar_menu.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2006/11/24 22:27:18 $
-|     $Author: e107coders $
+|     $Revision: 1.28 $
+|     $Date: 2007/11/27 21:41:56 $
+|     $Author: e107steved $
 |
 | 22.10.06 steved - Various tidying up, additional options supported
 | 24.10.06 steved - templated, various cleaning up
@@ -56,7 +56,7 @@
 $cal_datearray		= $ecal_class->cal_date;
 $cal_current_month	= $cal_datearray['mon'];
 $cal_current_year	= $cal_datearray['year'];
-$numberdays	= date("t", $ecal_class->cal_date); // number of days in this month
+$numberdays	= date("t", $ecal_class->cal_timedate); // number of days in this month
 
 
 $cal_monthstart		= mktime(0, 0, 0, $cal_current_month, 1, $cal_current_year);			// Time stamp for first day of month
@@ -158,7 +158,7 @@
 foreach($cal_week as $cal_day)
 {
     $cal_text .= $CALENDAR_MENU_HEADER_FRONT;
-	$cal_text .= substr($cal_day, 0, $pref['eventpost_lenday']);
+	$cal_text .= $tp->text_truncate($cal_day, $pref['eventpost_lenday'], '');
     $cal_text .= $CALENDAR_MENU_HEADER_BACK;
 }
 $cal_text .= $CALENDAR_MENU_HEADER_END;  // Close off header row, open first date row
@@ -185,7 +185,7 @@
 $cal_loop = $firstdayoffset;
 
 // Now do the days of the month
-for($cal_c = 1; $cal_c <= 31; $cal_c++)
+for($cal_c = 1; $cal_c <= $numberdays; $cal_c++)
 {   // Four cases to decode:
 	//     	1 - Today, no events
 	//		2 - Some other day, no events (or no icon defined)
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/calendar_shortcodes.php 0.7.11.src/e107_plugins/calendar_menu/calendar_shortcodes.php
--- 0.7.7.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2006-11-16 04:24:14.000000000 -0600
+++ 0.7.11.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2007-09-03 16:06:02.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar_shortcodes.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2006/11/16 10:24:14 $
-|     $Author: e107coders $
+|     $Revision: 1.14 $
+|     $Date: 2007/09/03 21:06:02 $
+|     $Author: e107steved $
 |
 | 10.11.06 - mods for next CVS release
 +----------------------------------------------------------------------------+
@@ -147,7 +147,7 @@
 SC_END
 
 SC_BEGIN SHOWEVENT_HEADING
-	global $SHOWEVENT_HEADING, $ev, $datearray, $c;
+	global $SHOWEVENT_HEADING, $ev, $datearray, $c, $tp;
 	$linkut = mktime(0 , 0 , 0 , $datearray['mon'], $c, $datearray['year']);
 	if(isset($ev['fulltopic']) && $ev['fulltopic'])
 	{  // Used on first day
@@ -155,14 +155,7 @@
 	}
 	else
 	{
-		if (strlen($ev['event_title']) > 10)
-		{
-		  $show_title = substr($ev['event_title'], 0, 10) . "...";
-		}
-		else
-		{
-		  $show_title = $ev['event_title'];
-		}
+	  $show_title = $tp->text_truncate($ev['event_title'], 10, "...");
 	}
 	if($ev['startofevent'])
 	{
@@ -197,10 +190,10 @@
 
 // CALENDAR CALENDAR ------------------------------------------------------------
 SC_BEGIN CALENDAR_CALENDAR_HEADER_DAY
-	global $CALENDAR_CALENDAR_HEADER_DAY, $day, $pref, $week;
+	global $CALENDAR_CALENDAR_HEADER_DAY, $day, $pref, $week, $tp;
 	if(isset($pref['eventpost_lenday']) && $pref['eventpost_lenday'])
 	{
-	  return "<strong>".substr($day,0,$pref['eventpost_lenday'])."</strong>";
+	  return "<strong>".$tp->text_truncate($day,$pref['eventpost_lenday'],'')."</strong>";
 	}
 	else
 	{
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/event.php 0.7.11.src/e107_plugins/calendar_menu/event.php
--- 0.7.7.src/e107_plugins/calendar_menu/event.php	2006-11-16 04:24:14.000000000 -0600
+++ 0.7.11.src/e107_plugins/calendar_menu/event.php	2007-10-29 15:49:54.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/event.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2006/11/16 10:24:14 $
-|     $Author: e107coders $
+|     $Revision: 1.32 $
+|     $Date: 2007/10/29 20:49:54 $
+|     $Author: e107steved $
 |
 | 09.11.06 - Started next batch of mods
 +----------------------------------------------------------------------------+
@@ -146,6 +146,7 @@
     else
     {
         $smarray	= getdate($action);
+		$day 		= $smarray['mday'];
         $month		= $smarray['mon'];
         $year		= $smarray['year'];
     }
@@ -228,7 +229,6 @@
 	
         unset($cal_options);
         unset($cal_attrib);
-        $cal_options['firstDay'] = 0;
         $cal_options['showsTime'] = false;
         $cal_options['showOthers'] = true;
         $cal_options['weekNumbers'] = false;
@@ -564,7 +564,7 @@
     $nextyear	= ($year + 1);
 }
 
-$prop		= mktime(0, 0, 0, $month, 1, $year);		// Sets start date for new event entry
+$prop		= mktime(0, 0, 0, $month, $day, $year);		// Sets start date for new event entry
 $next		= mktime(0, 0, 0, $nextmonth, 1, $nextyear);	// Used by nav buttons
 $nowmonth	= $ecal_class->cal_date['mon'];
 $nowyear	= $ecal_class->cal_date['year'];
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/plugin.php 0.7.11.src/e107_plugins/calendar_menu/plugin.php
--- 0.7.7.src/e107_plugins/calendar_menu/plugin.php	2006-11-16 04:24:15.000000000 -0600
+++ 0.7.11.src/e107_plugins/calendar_menu/plugin.php	2007-04-12 03:45:37.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/plugin.php,v $
-|     $Revision: 1.17 $ - with mods to hopefully trigger upgrade to new version
-|     $Date: 2006/11/16 10:24:15 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $ - with mods to hopefully trigger upgrade to new version
+|     $Date: 2007/04/12 08:45:37 $
+|     $Author: lisa_ $
 |
 | 22.07.06 - Mods for V3.6 upgrade, including log directory
 | 02.08.06 - Support for category icon display added
@@ -56,7 +56,7 @@
 $eplug_caption = EC_LAN_81; // "Configure Event Calendar";
 
 $ecalSQL = new db;
-$ecalSQL->db_Select("plugin", "plugin_version", "plugin_name='Event Calendar' AND plugin_installflag > 0");
+$ecalSQL->db_Select("plugin", "plugin_version", "plugin_path='calendar_menu' AND plugin_installflag > 0");
 list($ecalVer) = $ecalSQL->db_Fetch();
 $ecalVer = preg_replace("/[a-zA-z\s]/", '', $ecalVer);
 
@@ -79,9 +79,9 @@
 "eventpost_timecustom" => "%H%M",
 "eventpost_dateevent"  => 1,
 "eventpost_datenext"   => 1,
-"eventpost_eventdatecustom" => "&A %d %B %Y",
+"eventpost_eventdatecustom" => "%A %d %B %Y",
 "eventpost_nextdatecustom"   => "%d %b",
-"eventpost_mailsubject" => EC_ADLAN_12,
+"eventpost_mailsubject" => EC_ADLAN_A12,
 "eventpost_mailfrom" => EC_ADLAN_A151,
 "eventpost_mailaddress" => EC_ADLAN_A152,
 "eventpost_asubs" => 1,
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/search/search_parser.php 0.7.11.src/e107_plugins/calendar_menu/search/search_parser.php
--- 0.7.7.src/e107_plugins/calendar_menu/search/search_parser.php	2005-08-22 13:38:14.000000000 -0500
+++ 0.7.11.src/e107_plugins/calendar_menu/search/search_parser.php	2007-09-06 02:48:44.000000000 -0500
@@ -11,11 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/search/search_parser.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/08/22 18:38:14 $
-|     $Author: sweetas $
+|     $Revision: 1.2 $
+|     $Date: 2007/09/06 07:48:44 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
+if (!defined('e107_INIT')) { exit; }    
 
 $return_fields = 'event_id, event_start, event_title, event_location, event_details';
 $search_fields = array('event_title', 'event_location', 'event_details');
diff -x .svn -ruN 0.7.7.src/e107_plugins/calendar_menu/subscribe.php 0.7.11.src/e107_plugins/calendar_menu/subscribe.php
--- 0.7.7.src/e107_plugins/calendar_menu/subscribe.php	2006-11-06 16:30:22.000000000 -0600
+++ 0.7.11.src/e107_plugins/calendar_menu/subscribe.php	2007-01-28 05:40:10.000000000 -0600
@@ -11,20 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/subscribe.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/11/06 22:30:22 $
-|     $Author: e107coders $
+|     $Revision: 1.4 $
+|     $Date: 2007/01/28 11:40:10 $
+|     $Author: e107steved $
 |
-| 05.10.06 - Mods started
-| 06.11.06 - Reflect updated shortcodes and template directories
-|
-| Think how to unsubscribe user if he's voluntarily subscribed, and is later forcibly subscribed, or no longer allowed to subscribe
-| (A subscription update, with nothing visibly changed, may well do it)
 +----------------------------------------------------------------------------+
 */
 
 require_once("../../class2.php");
-@include_lan(e_PLUGIN . "calendar_menu/languages/English.php");
+include_lan(e_PLUGIN . "calendar_menu/languages/".e_LANGUAGE.".php");
 
 define("PAGE_NAME", EC_LAN_80);
 require_once(HEADERF);
diff -x .svn -ruN 0.7.7.src/e107_plugins/chatbox_menu/admin_chatbox.php 0.7.11.src/e107_plugins/chatbox_menu/admin_chatbox.php
--- 0.7.7.src/e107_plugins/chatbox_menu/admin_chatbox.php	2006-11-20 06:49:40.000000000 -0600
+++ 0.7.11.src/e107_plugins/chatbox_menu/admin_chatbox.php	2007-01-28 07:51:57.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/admin_chatbox.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/11/20 12:49:40 $
-|     $Author: mrpete $
+|     $Revision: 1.21 $
+|     $Date: 2007/01/28 13:51:57 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -34,7 +34,7 @@
 	$pref['cb_emote'] = $_POST['cb_emote'];
 	$pref['cb_mod'] = $_POST['cb_mod'];
 	save_prefs();
-	$e107cache->clear("chatbox");
+	$e107cache->clear("nq_chatbox");
 	$message = CHBLAN_1;
 }
 
@@ -43,7 +43,7 @@
 	$prunetime = time() - $chatbox_prune;
 
 	$sql->db_Delete("chatbox", "cb_datestamp < '$prunetime' ");
-	$e107cache->clear("chatbox");
+	$e107cache->clear("nq_chatbox");
 	$message = CHBLAN_28;
 }
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/chatbox_menu/chat.php 0.7.11.src/e107_plugins/chatbox_menu/chat.php
--- 0.7.7.src/e107_plugins/chatbox_menu/chat.php	2006-07-04 03:42:17.000000000 -0500
+++ 0.7.11.src/e107_plugins/chatbox_menu/chat.php	2007-04-25 14:35:10.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/chat.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/07/04 08:42:17 $
-|     $Author: e107coders $
+|     $Revision: 1.25 $
+|     $Date: 2007/04/25 19:35:10 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -67,7 +67,7 @@
 		}
 		$sql -> db_Select_gen("DELETE FROM #chatbox WHERE cb_id IN ({$deletelist})");
 	}
-	$e107cache->clear("chatbox");
+	$e107cache->clear("nq_chatbox");
 	$message = CHATBOX_L18;
 }
 
@@ -111,7 +111,7 @@
 {
 	$CHAT_TABLE_DATESTAMP = $obj2->convert_date($row['cb_datestamp'], "long");
 	$CHAT_TABLE_NICK = preg_replace("/[0-9]+\./", "", $row['cb_nick']);
-	$cb_message = $tp->toHTML($row['cb_message']);
+	$cb_message = $tp->toHTML($row['cb_message'], TRUE,'USER_BODY');
 	if($row['cb_blocked'])
 	{
 		$cb_message .= "<br />".CHATBOX_L25;
diff -x .svn -ruN 0.7.7.src/e107_plugins/chatbox_menu/chatbox_menu.php 0.7.11.src/e107_plugins/chatbox_menu/chatbox_menu.php
--- 0.7.7.src/e107_plugins/chatbox_menu/chatbox_menu.php	2006-11-22 20:09:47.000000000 -0600
+++ 0.7.11.src/e107_plugins/chatbox_menu/chatbox_menu.php	2007-04-25 14:35:10.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/chatbox_menu.php,v $
-|     $Revision: 1.73 $
-|     $Date: 2006/11/23 02:09:47 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.78 $
+|     $Date: 2007/04/25 19:35:10 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 global $tp, $e107cache, $e_event, $e107, $pref, $footer_js, $PLUGINS_DIRECTORY;
 
-if($pref['cb_layer'] || isset($_POST['chatbox_ajax']))
+if(($pref['cb_layer']==2) || isset($_POST['chatbox_ajax']))
 {
 	if(isset($_POST['chat_submit']))
 	{
@@ -55,7 +55,7 @@
 		{
 			if((strlen(trim($cmessage)) < 1000) && trim($cmessage) != "")
 			{
-				$cmessage = $tp -> toDB($cmessage, false, true);
+				$cmessage = $tp -> toDB($cmessage);
 				if($sql -> db_Select("chatbox", "*", "cb_message='$cmessage' AND cb_datestamp+84600>".time()))
 				{
 					$emessage = CHATBOX_L17;
@@ -125,7 +125,7 @@
 		$texta =  (e_QUERY ? "\n<form id='chatbox' method='post' action='".e_SELF."?".e_QUERY."'>" : "\n<form id='chatbox' method='post' action='".e_SELF."'>");
 	}
 	$texta .= "<div style='text-align:center; width:100%'>";
-
+	
 	if(($pref['anon_post'] == "1" && USER == FALSE))
 	{
 		$texta .= "\n<input class='tbox chatbox' type='text' id='nick' name='nick' value='' maxlength='50' ".($cb_width ? "style='width: ".$cb_width.";'" : '')." /><br />";
@@ -148,7 +148,7 @@
 
 	if($pref['cb_emote'] && $pref['smiley_activate']){
 		$texta .= "
-		<input class='button' type ='button' style='cursor:hand; cursor:pointer' size='30' value='".CHATBOX_L14."' onclick=\"expandit('emote')\" />
+		<input class='button' type ='button' style='cursor:pointer' size='30' value='".CHATBOX_L14."' onclick=\"expandit('emote')\" />
 		<div style='display:none' id='emote'>".r_emote()."
 		</div>\n";
 	}
@@ -190,13 +190,13 @@
 			}
 			else
 			{
-				$cb_nick = $tp -> toHTML($cb_nick,FALSE,'emotes_off, no_make_clickable');
+				$cb_nick = $tp -> toHTML($cb_nick,FALSE,'USER_TITLE, emotes_off, no_make_clickable');
 				$cb_nick = str_replace("Anonymous", LAN_ANONYMOUS, $cb_nick);
 			}
 
 			$datestamp = $obj2->convert_date($cb['cb_datestamp'], "short");
 			if(!$pref['cb_wordwrap']) { $pref['cb_wordwrap'] = 30; }
-			$emotes_active = $pref['cb_emote'] ? 'emotes_on' : 'emotes_off';
+			$emotes_active = $pref['cb_emote'] ? 'USER_BODY, emotes_on' : 'USER_BODY, emotes_off';
 
 			$cb_message = $tp -> toHTML($cb['cb_message'], FALSE, $emotes_active, $cb_uid, $pref['menu_wordwrap']);
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/clock_menu/clock.js 0.7.11.src/e107_plugins/clock_menu/clock.js
--- 0.7.7.src/e107_plugins/clock_menu/clock.js	2004-10-07 06:09:57.000000000 -0500
+++ 0.7.11.src/e107_plugins/clock_menu/clock.js	2007-07-17 15:28:05.000000000 -0500
@@ -3,7 +3,8 @@
 function tick(e107_datepref,e107_dateformat,e107_datesuff1,e107_datesuff2,e107_datesuff3,e107_datesuff4) {
   if(e107_datepref=='undefined'){e107_datepref = '';}
   var hours, minutes, seconds, ap;
-  var intHours, intMinutes, intSeconds;  var today;
+  var intHours, intMinutes, intSeconds, today;
+  var intDay, intDate, intMonth, intYear, timeString;
   today = new Date();
   intDay = today.getDay();
   intDate = today.getDate();
diff -x .svn -ruN 0.7.7.src/e107_plugins/comment_menu/comment_menu_shortcodes.php 0.7.11.src/e107_plugins/comment_menu/comment_menu_shortcodes.php
--- 0.7.7.src/e107_plugins/comment_menu/comment_menu_shortcodes.php	2006-07-04 12:30:38.000000000 -0500
+++ 0.7.11.src/e107_plugins/comment_menu/comment_menu_shortcodes.php	2007-02-08 16:35:09.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/comment_menu/comment_menu_shortcodes.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/07/04 17:30:38 $
-|     $Author: lisa_ $
+|     $Revision: 1.2 $
+|     $Date: 2007/02/08 22:35:09 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -57,14 +57,15 @@
 SC_END
 
 SC_BEGIN CM_COMMENT
-global $row, $menu_pref;
+global $row, $menu_pref, $pref, $tp;
 $COMMENT = '';
-if($menu_pref['comment_characters']>0){
-	$COMMENT = $row['comment_comment'];
-	if (strlen($COMMENT) > $menu_pref['comment_characters'])
-	{
-		$COMMENT = substr($COMMENT, 0, $menu_pref['comment_characters']).$menu_pref['comment_postfix'];
-	}
+if($menu_pref['comment_characters']>0)
+{
+  $COMMENT = strip_tags($tp->toHTML($row['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", $pref['menu_wordwrap']));
+  if (strlen($COMMENT) > $menu_pref['comment_characters'])
+  {
+	$COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'],'').($row['comment_url'] ? " <a href='".$row['comment_url']."'>" : "").$menu_pref['comment_postfix'].($row['comment_url'] ? "</a>" : "");
+  }
 }
 return $COMMENT;
 SC_END
diff -x .svn -ruN 0.7.7.src/e107_plugins/compliance_menu/compliance_menu.php 0.7.11.src/e107_plugins/compliance_menu/compliance_menu.php
--- 0.7.7.src/e107_plugins/compliance_menu/compliance_menu.php	2006-06-28 14:03:06.000000000 -0500
+++ 0.7.11.src/e107_plugins/compliance_menu/compliance_menu.php	2007-05-31 16:16:59.000000000 -0500
@@ -6,6 +6,6 @@
 	<a href='http://validator.w3.org/check?uri=".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'><img style='border:0' src='".e_PLUGIN."compliance_menu/images/valid-xhtml11.png' alt='Valid XHTML 1.1!' height='31' width='88' /></a><br />
 	<a href='http://jigsaw.w3.org/css-validator/validator?uri=".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'><img style='border:0' src='".e_PLUGIN."compliance_menu/images/vcss.png' alt='Valid CSS!' height='31' width='88' /></a>
 	</div>";
-$caption = (file_exists(THEME."images/compliance_menu.png") ? "<img src='".THEME."images/compliance_menu.png' alt='' /> ".COMPLIANCE_L1 : COMPLIANCE_L1);
+$caption = (file_exists(THEME."images/compliance_menu.png") ? "<img src='".THEME_ABS."images/compliance_menu.png' alt='' /> ".COMPLIANCE_L1 : COMPLIANCE_L1);
 $ns->tablerender($caption, $text, 'compliance');
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/admin_content_config.php 0.7.11.src/e107_plugins/content/admin_content_config.php
--- 0.7.7.src/e107_plugins/content/admin_content_config.php	2006-07-30 08:14:09.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/admin_content_config.php	2007-01-13 17:21:24.000000000 -0600
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/admin_content_config.php,v $
-|		$Revision: 1.63 $
-|		$Date: 2006/07/30 13:14:09 $
+|		$Revision: 1.64 $
+|		$Date: 2007/01/13 23:21:24 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -184,7 +184,7 @@
 }
 
 if(isset($_POST['create_category'])){
-	if($_POST['cat_heading'] && $_POST['parent'] != "none"){
+	if($_POST['cat_heading'] && $_POST['parent1'] != "none"){
 		$adb -> dbCategory("create");
 	}else{
 		$message	= CONTENT_ADMIN_ITEM_LAN_0;
@@ -192,7 +192,7 @@
 }
 
 if(isset($_POST['update_category'])){
-	if($_POST['cat_heading'] && $_POST['parent'] != "none"){
+	if($_POST['cat_heading'] && $_POST['parent1'] != "none"){
 		$adb -> dbCategory("update");
 	}else{
 		$message	= CONTENT_ADMIN_ITEM_LAN_0;
@@ -200,7 +200,7 @@
 }
 
 if(isset($_POST['create_content'])){
-	if($_POST['content_text'] && $_POST['content_heading'] && $_POST['content_author_name'] && $_POST['parent'] != "none"){
+	if($_POST['content_text'] && $_POST['content_heading'] && $_POST['content_author_name'] && $_POST['parent1'] != "none"){
 		//$adb -> dbContentCreate("admin");
 		$adb -> dbContent("create", "");
 	}else{
@@ -209,7 +209,7 @@
 }
 
 if(isset($_POST['update_content'])){
-	if($_POST['content_text'] && $_POST['content_heading'] && $_POST['content_author_name'] && $_POST['content_heading'] && $_POST['parent'] != "none"){
+	if($_POST['content_text'] && $_POST['content_heading'] && $_POST['content_author_name'] && $_POST['content_heading'] && $_POST['parent1'] != "none"){
 		//$adb -> dbContentUpdate("admin");
 		$adb -> dbContent("update", "");
 	}else{
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/content.php 0.7.11.src/e107_plugins/content/content.php
--- 0.7.7.src/e107_plugins/content/content.php	2006-11-07 16:09:43.000000000 -0600
+++ 0.7.11.src/e107_plugins/content/content.php	2007-01-19 23:19:21.000000000 -0600
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content.php,v $
-|		$Revision: 1.109 $
-|		$Date: 2006/11/07 22:09:43 $
-|		$Author: lisa_ $
+|		$Revision: 1.113 $
+|		$Date: 2007/01/20 05:19:21 $
+|		$Author: mrpete $
 +---------------------------------------------------------------+
 */
 
@@ -779,36 +779,36 @@
 			$captionchild		= $content_pref['content_cat_item_caption'];
 
 			$crumbpage = $aa -> getCrumbPage("cat", $array, $qs[1]);
-			if(isset($textparent)){ 
+			if(isset($textparent) && $textparent){ 
 				$textparent = $crumbpage.$textparent;
 			}else{
 				$textchild = $crumbpage.$textchild;
 			}
 			if(isset($content_pref["content_cat_menuorder"]) && $content_pref["content_cat_menuorder"] == "1"){
 				if(isset($content_pref["content_cat_rendertype"]) && $content_pref["content_cat_rendertype"] == "1"){
-					if(isset($textparent)){		$ns -> tablerender($caption, $textparent); }
-					if(isset($textsubparent)){	$ns -> tablerender($captionsubparent, $textsubparent); }
-					if(isset($textchild)){		$ns -> tablerender($captionchild, $textchild); }
+					if(isset($textparent) && $textparent){ $ns -> tablerender($caption, $textparent); }
+					if(isset($textsubparent) && $textsubparent){ $ns -> tablerender($captionsubparent, $textsubparent); }
+					if(isset($textchild) && $textchild){ $ns -> tablerender($captionchild, $textchild); }
 				}else{
-					$ns -> tablerender($caption, (isset($textparent) ? $textparent : "").(isset($textsubparent) ? $textsubparent : "").$textchild);
+					$ns -> tablerender($caption, (isset($textparent) && $textparent ? $textparent : "").(isset($textsubparent) && $textsubparent ? $textsubparent : "").$textchild);
 				}
 				if(isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"]){
 					$aa->ShowNextPrev(FALSE, $from, $number, $contenttotal);
 				}
 			}else{
 				if(isset($content_pref["content_cat_rendertype"]) && $content_pref["content_cat_rendertype"] == "1"){
-					if(isset($textchild)){		$ns -> tablerender($captionchild, $textchild); }
+					if(isset($textchild) && $textchild){ $ns -> tablerender($captionchild, $textchild); }
 					if(isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"]){
 						$aa->ShowNextPrev(FALSE, $from, $number, $contenttotal);
 					}
-					if(isset($textparent)){		$ns -> tablerender($caption, $textparent); }
-					if(isset($textsubparent)){	$ns -> tablerender($captionsubparent, $textsubparent); }
+					if(isset($textparent) && $textparent){ $ns -> tablerender($caption, $textparent); }
+					if(isset($textsubparent) && $textsubparent){ $ns -> tablerender($captionsubparent, $textsubparent); }
 				}else{
-					if(isset($textchild)){		$ns -> tablerender($captionchild, $textchild); }
+					if(isset($textchild) && $textchild){ $ns -> tablerender($captionchild, $textchild); }
 					if(isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"]){
 						$aa->ShowNextPrev(FALSE, $from, $number, $contenttotal);
 					}
-					$ns -> tablerender($caption, (isset($textparent) ? $textparent : "").(isset($textsubparent) ? $textsubparent : ""));
+					$ns -> tablerender($caption, (isset($textparent) && $textparent ? $textparent : "").(isset($textsubparent) && $textsubparent ? $textsubparent : ""));
 				}
 			}
 		}
@@ -816,7 +816,7 @@
 
 		if($mode == "comment"){
 			$textparent = $aa -> getCrumbPage("cat", $array, $mainparent).$textparent;
-			if(isset($textparent)){ $ns -> tablerender($caption, $textparent); }
+			if(isset($textparent) && $textparent){ $ns -> tablerender($caption, $textparent); }
 
 			if($resultitem = $sql -> db_Select($plugintable, "*", $qry )){
 				$row = $sql -> db_Fetch();
@@ -1282,7 +1282,7 @@
 					}
 
 					if($idp==1){
-						$CONTENT_CONTENT_TABLE_SUMMARY = (isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "") : "");
+						$CONTENT_CONTENT_TABLE_SUMMARY = (isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "SUMMARY") : "");
 						$CONTENT_CONTENT_TABLE_SUMMARY = $tp -> replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY);
 					}else{
 						$CONTENT_CONTENT_TABLE_SUMMARY = "";
@@ -1307,13 +1307,13 @@
 				}
 
 			}else{
-				$CONTENT_CONTENT_TABLE_SUMMARY	= (isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "") : "");
+				$CONTENT_CONTENT_TABLE_SUMMARY	= (isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "SUMMARY") : "");
 				$CONTENT_CONTENT_TABLE_SUMMARY	= $tp -> replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY);
 				$lastpage = TRUE;
 			}
 
 			$CONTENT_CONTENT_TABLE_TEXT		= $tp -> replaceConstants($CONTENT_CONTENT_TABLE_TEXT);
-			$CONTENT_CONTENT_TABLE_TEXT		= $tp -> toHTML($CONTENT_CONTENT_TABLE_TEXT, TRUE, "");
+			$CONTENT_CONTENT_TABLE_TEXT		= $tp -> toHTML($CONTENT_CONTENT_TABLE_TEXT, TRUE, "BODY");
 
 			$custom							= $eArrayStorage->ReadArray($row['content_pref']);
 
@@ -1335,11 +1335,10 @@
 			$CONTENT_CONTENT_TABLE_INFO_PRE = FALSE;
 			$CONTENT_CONTENT_TABLE_INFO_POST = FALSE;
 			
-			if ($date!="" || $auth!="" || $ep!="" || $edit!="" || $par!="" || $com!="" || $score!="" || $ref!="" || $sub!="" || $rat!="" || $fil!="") {
+			//if any of these exist, pre/post activate the container table
+			if ($ico!="" || $date!="" || $auth!="" || $ep!="" || $edit!="" || $par!="" || $com!="" || $score!="" || $ref!="" || $sub!="" || $rat!="" || $fil!="") {
 				$CONTENT_CONTENT_TABLE_INFO_PRE = TRUE;
 				$CONTENT_CONTENT_TABLE_INFO_POST = TRUE;
-			}
-			if($CONTENT_CONTENT_TABLE_INFO_PRE || $ico==''){
 				$CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = TRUE;
 				$CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = TRUE;
 			}
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/content_manager.php 0.7.11.src/e107_plugins/content/content_manager.php
--- 0.7.7.src/e107_plugins/content/content_manager.php	2006-09-18 02:40:00.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/content_manager.php	2006-12-07 06:57:01.000000000 -0600
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_manager.php,v $
-|		$Revision: 1.23 $
-|		$Date: 2006/09/18 07:40:00 $
-|		$Author: lisa_ $
+|		$Revision: 1.24 $
+|		$Date: 2006/12/07 12:57:01 $
+|		$Author: mrpete $
 +---------------------------------------------------------------+
 */
 
@@ -65,20 +65,10 @@
 
 //these have to be set for the tinymce wysiwyg
 $e_wysiwyg	= "content_text";
-//if(check_class($pref['post_html']) && $pref['wysiwyg'] && $e_wysiwyg == TRUE){
-if($pref['wysiwyg'] && $e_wysiwyg == TRUE){
-	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
-	define("e_WYSIWYG",TRUE);
-	$tiny = wysiwyg($e_wysiwyg);
-}else{
-	define("e_WYSIWYG",FALSE);
-}
 
 //include js
 function headerjs(){
-	global $tiny;
 	echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
-	echo $tiny;
 }
 // ##### DB ---------------------------------------------------------------------------------------
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/content_shortcodes.php 0.7.11.src/e107_plugins/content/content_shortcodes.php
--- 0.7.7.src/e107_plugins/content/content_shortcodes.php	2006-11-11 22:15:30.000000000 -0600
+++ 0.7.11.src/e107_plugins/content/content_shortcodes.php	2007-01-07 09:24:49.000000000 -0600
@@ -378,7 +378,8 @@
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_HEADING
 global $CONTENT_CAT_LIST_TABLE_HEADING, $tp, $row, $totalparent, $tp;
-return ($totalparent > 0 ? "<a href='".e_SELF."?cat.".$row['content_id'].".view'>".$tp -> toHTML($row['content_heading'], TRUE, "")."</a>" : $tp -> toHTML($row['content_heading'], TRUE, "") );
+//return ($totalparent > 0 ? "<a href='".e_SELF."?cat.".$row['content_id'].".view'>".$tp -> toHTML($row['content_heading'], TRUE, "")."</a>" : $tp -> toHTML($row['content_heading'], TRUE, "") );
+return "<a href='".e_SELF."?cat.".$row['content_id'].".view'>".$tp -> toHTML($row['content_heading'], TRUE, "")."</a>";
 SC_END
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_SUMMARY
@@ -394,7 +395,7 @@
 		$CONTENT_CAT_LIST_TABLE_TEXT = $tp->toHTML($row['content_text'], TRUE, "constants");
 	}else{
 		$rowtext = preg_replace("/\[newpage.*?]/si", " ", $row['content_text']);
-		$rowtext = $tp->toHTML($rowtext, TRUE, "nobreak constants");
+		$rowtext = $tp->toHTML($rowtext, TRUE, "nobreak, constants");
 		
 		$rowtext = strip_tags($rowtext);
 		$words = explode(" ", $rowtext);
@@ -477,7 +478,8 @@
 
 SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_HEADING
 global $CONTENT_CAT_LISTSUB_TABLE_HEADING, $tp, $row, $totalsubcat, $tp;
-return ($totalsubcat > 0 ? "<a href='".e_SELF."?cat.".$row['content_id']."'>".$tp -> toHTML($row['content_heading'], TRUE, "")."</a>" : $tp -> toHTML($row['content_heading'], TRUE, "") );
+//return ($totalsubcat > 0 ? "<a href='".e_SELF."?cat.".$row['content_id']."'>".$tp -> toHTML($row['content_heading'], TRUE, "")."</a>" : $tp -> toHTML($row['content_heading'], TRUE, "") );
+return "<a href='".e_SELF."?cat.".$row['content_id']."'>".$tp -> toHTML($row['content_heading'], TRUE, "")."</a>";
 SC_END
 
 SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_AMOUNT
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/content_submit.php 0.7.11.src/e107_plugins/content/content_submit.php
--- 0.7.7.src/e107_plugins/content/content_submit.php	2006-07-28 09:07:14.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/content_submit.php	2006-12-07 06:57:01.000000000 -0600
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_submit.php,v $
-|		$Revision: 1.24 $
-|		$Date: 2006/07/28 14:07:14 $
-|		$Author: lisa_ $
+|		$Revision: 1.25 $
+|		$Date: 2006/12/07 12:57:01 $
+|		$Author: mrpete $
 +---------------------------------------------------------------+
 */
 
@@ -39,20 +39,6 @@
 
 //these have to be set for the tinymce wysiwyg
 $e_wysiwyg	= "content_text";
-if(check_class($pref['post_html']) && $pref['wysiwyg'] && $e_wysiwyg == TRUE){
-	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
-	define("e_WYSIWYG",TRUE);
-	$tiny = wysiwyg($e_wysiwyg);
-}else{
-	define("e_WYSIWYG",FALSE);
-}
-
-//include js
-function headerjs(){
-	global $tiny;
-	echo $tiny;
-}
-
 global $tp;
 
 $lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content.php';
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/e_notify.php 0.7.11.src/e107_plugins/content/e_notify.php
--- 0.7.7.src/e107_plugins/content/e_notify.php	2006-06-07 08:37:21.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/e_notify.php	2007-09-06 02:23:37.000000000 -0500
@@ -11,11 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/e_notify.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/06/07 13:37:21 $
-|     $Author: lisa_ $
+|     $Revision: 1.2 $
+|     $Date: 2007/09/06 07:23:37 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
+if (!defined('e107_INIT')) { exit; }   
 
 $lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php";
 include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content.php");
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/e_status.php 0.7.11.src/e107_plugins/content/e_status.php
--- 0.7.7.src/e107_plugins/content/e_status.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.11.src/e107_plugins/content/e_status.php	2007-03-01 03:49:09.000000000 -0600
@@ -1,12 +1,15 @@
 <?php
 if (!defined('e107_INIT')) { exit; }
 
+$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php';
+include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_admin.php');
+
 $sql2 = new db;
 $total = $sql -> db_Count("pcontent", "(*)", "WHERE LEFT(content_parent,1) != '0' AND content_refer != 'sa'");
 if($total == 0){
-$text .= "<div style='padding-bottom: 2px;'><img src='".e_PLUGIN."content/images/content_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> Content: ".$total."</div>";
+$text .= "<div style='padding-bottom: 2px;'><img src='".e_PLUGIN."content/images/content_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ".CONTENT_STATUS_LAN_1." ".$total."</div>";
 }else{
-$text .= "<div style='padding-bottom: 2px;'><a style='cursor: pointer; cursor: hand' onclick=\"expandit('content');\"><img src='".e_PLUGIN."content/images/content_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> Content: ".$total."</a></div>";
+$text .= "<div style='padding-bottom: 2px;'><a style='cursor: pointer; cursor: hand' onclick=\"expandit('content');\"><img src='".e_PLUGIN."content/images/content_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ".CONTENT_STATUS_LAN_1." ".$total."</a></div>";
 }
 $maincat = $sql -> db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1) = '0' ORDER BY content_heading");
 $text .= "<div id='content' style='display: none;'>";
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/handlers/content_class.php 0.7.11.src/e107_plugins/content/handlers/content_class.php
--- 0.7.7.src/e107_plugins/content/handlers/content_class.php	2006-10-23 10:55:19.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/handlers/content_class.php	2007-03-01 03:34:49.000000000 -0600
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_class.php,v $
-|		$Revision: 1.107 $
-|		$Date: 2006/10/23 15:55:19 $
+|		$Revision: 1.111 $
+|		$Date: 2007/03/01 09:34:49 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -172,7 +172,7 @@
 			$content_pref['content_list_summary_char'] = "100";				//how many summary characters
 			$content_pref['content_list_summary_post'] = "[...]";			//use a postfix for too long summary
 			$content_pref['content_list_text_char'] = "60";					//how many text words
-			$content_pref['content_list_text_post'] = "[read more]";		//use a postfix for too long text
+			$content_pref['content_list_text_post'] = CONTENT_LAN_16;		//use a postfix for too long text
 			$content_pref['content_list_text_link'] = "1";					//show link to content item on postfix
 			$content_pref['content_list_authoremail_nonmember'] = "0";		//show email non member author
 			$content_pref['content_list_peicon_all'] = "0";					//override printemail icons
@@ -197,7 +197,7 @@
 			$content_pref['content_catall_comment'] = "1";					//show amount of comments
 			$content_pref['content_catall_amount'] = "0";					//show amount of items
 			$content_pref['content_catall_text_char'] = "65";				//define amount of words of text to display
-			$content_pref['content_catall_text_post'] = "[read more]";		//define postfix is text is too long
+			$content_pref['content_catall_text_post'] = CONTENT_LAN_16;		//define postfix is text is too long
 			$content_pref['content_catall_text_link'] = "1";				//define if link to category should be added on postfix
 			$content_pref['content_catall_caption'] = CONTENT_LAN_25;		//caption for all categories page
 			//sections of content category in 'view category' page
@@ -228,7 +228,7 @@
 			$content_pref['content_cat_menuorder'] = "1";					//order of parent and child items
 			$content_pref['content_cat_rendertype'] = "2";					//render method of the menus
 			$content_pref['content_cat_text_char'] = "65";					//define amount of words of text to display
-			$content_pref['content_cat_text_post'] = "[read more]";			//define postfix is text is too long
+			$content_pref['content_cat_text_post'] = CONTENT_LAN_16;			//define postfix is text is too long
 			$content_pref['content_cat_text_link'] = "1";					//define if link to category should be added on postfix
 			$content_pref['content_cat_authoremail_nonmember'] = "0";		//define if the email of a non-member will be displayed
 			$content_pref['content_cat_peicon_all'] = "0";					//override printemail icons
@@ -445,8 +445,6 @@
 
 			if(!is_object($sql)){ $sql = new db; }
 
-//echo "update content pref : ".$id."<br />";
-
 			//insert default preferences into core
 			if($id == "0"){
 				$num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' ");
@@ -456,34 +454,53 @@
 					$row = $sql -> db_Fetch();
 				}
 
+				//prepare custom tags: use the posted value
+				$cp = $_POST['content_custom_preset_key'];
+
 			//insert category preferences into plugintable
 			}else{
-				$sql -> db_Select($plugintable, "content_pref", "content_id='".intval($id)."' ");
+				//first get the existing prefs and parent
+				$sql -> db_Select($plugintable, "content_pref, content_parent", "content_id='".intval($id)."' ");
 				$row = $sql -> db_Fetch();
 				$current = $eArrayStorage->ReadArray($row['content_pref']);
-				foreach($current as $k => $v){
-					if(isset($qs[0]) && $qs[0] == 'option' ){
+				$currentparent = $row['content_parent'];
+
+				//if we are updating options
+				if(isset($qs[0]) && $qs[0] == 'option' ){
+					//only use the manager prefs from the existing set
+					foreach($current as $k => $v){
 						if( strpos($k, "content_manager_") === 0 || strpos($k, "content_restrict_") === 0 ){
 							$content_pref[$k] = $tp->toDB($v);
 						}
-					}elseif(isset($qs[0]) && ($qs[0] == 'manager' || $qs[0] == 'restrict')){
-						if( strpos($k, "content_") === 0 ){
-							$content_pref[$k] = $tp->toDB($v);
-						}
 					}
+
+					//prepare custom tags: use the posted values
+					$cp = $_POST['content_custom_preset_key'];
+
+				//if we are updating manager
+				}elseif(isset($qs[0]) && ($qs[0] == 'manager' || $qs[0] == 'restrict')){
+					//if this is a top level category we need to keep all existing options
+					if($currentparent=='0'){
+						$content_pref = $current;
+					}
+
+					//prepare custom tags: use the existing content_pref values
+					$cp = $content_pref['content_custom_preset_key'];
 				}
 			}
 
-			//create array of custom preset tags
-			foreach($_POST['content_custom_preset_key'] as $ck => $cv){
+			//parse custom tags and covert them in $_POST values ($cp is derived above)
+			$string = array();
+			foreach($cp as $ck => $cv){
 				if(!empty($cv)){
 					$string[] = $cv;
 				}
 			}
-			$_POST['content_custom_preset_key'] = $string;
-
-			//echo "<pre>"; print_r($_POST); echo "</pre>";
+			if(is_array($string) && !empty($string[0])){
+				$_POST['content_custom_preset_key'] = $string;
+			}
 
+			//convert all $_POST to $content_pref for storage, and renew the existing stored prefs
 			foreach($_POST as $k => $v){
 				if(strpos($k, "content_") === 0){
 					$content_pref[$k] = $tp->toDB($v);
@@ -492,8 +509,11 @@
 
 			//create new array of preferences
 			$tmp = $eArrayStorage->WriteArray($content_pref);
+
+			//update core table
 			if($id == "0"){
 				$sql -> db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '$plugintable' ");
+			//update plugin table
 			}else{
 				$sql -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($id)."' ");
 			}
@@ -501,6 +521,7 @@
 			return $content_pref;
 		}
 
+
 		function CONTENTREGEXP($var){
 			return "(^|,)(".str_replace(",", "|", $var).")(,|$)";
 		}
@@ -681,8 +702,8 @@
 			global $plugintable, $sql;
 			$qry = "
 			SELECT c.*, p.*
-			FROM pcontent as c
-			LEFT JOIN pcontent as p ON p.content_id = c.content_parent
+			FROM #pcontent as c
+			LEFT JOIN #pcontent as p ON p.content_id = c.content_parent
 			WHERE c.content_id = '".intval($id)."' ";
 			$sql -> db_Select_gen($qry);
 			$row2 = $sql -> db_Fetch();
@@ -839,100 +860,92 @@
 
 
 
-		//admin
-		function ShowOptionCat($currentparent=""){
+		//$mode : managecontent, createcontent, category
+		function ShowOption($currentparent="", $mode=''){
 			global $qs, $sql, $rs, $plugintable, $tp, $content_pref, $stylespacer;
-			$string = "";
 
-			if($currentparent == "submit"){
+			if( ($mode=='managecontent' || $mode=='createcontent') && $currentparent == "submit"){
 				$mainparent		= $this -> getMainParent( intval($qs[2]) );
 				$catarray		= $this -> getCategoryTree("", intval($mainparent), FALSE);
 			}else{
-				$catarray		= $this -> getCategoryTree("", "", FALSE);
+				$catarray = $this -> getCategoryTree("", "", FALSE);
 			}
 			$array = array_keys($catarray);
 
+			$string = "";
 			foreach($array as $catid){
 				$category_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_parent", "content_id='".intval($catid)."' ");
 				$row = $sql -> db_Fetch();
 
 				$pre = "";
-				if($row['content_parent'] == "0"){		//main parent level
-				}else{									//sub level
+				//sub level
+				if($row['content_parent'] != "0"){
 					for($b=0;$b<(count($catarray[$catid])/2)-1;$b++){
 						$pre .= "&nbsp;&nbsp;";
 					}
 				}
-				$emptystring = "----------------";
-
-				if($qs[0] == "cat"){
+				if($row['content_parent'] == 0){
+					$name	= $row['content_heading'];
+					$js		= "style='font-weight:bold;'";
+				}else{
+					$js		= "";
+					$name	= $pre.$row['content_heading'];
+				}
 
-					$js			= "";
-					$catstring	= "";
-					$name		= $pre.$row['content_heading'];
-					$selectjs	= "if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }";
-					$label		= $catid;
-					if($row['content_parent'] == 0){
-						$name	= $row['content_heading'];
-						$js		= "style='font-weight:bold;'";
+				if($mode=='managecontent'){
+					$checkid	= ($currentparent ? $currentparent : "");
+					if($qs[0] == 'content' && ($qs[1]=='create' || $qs[1]=='submit') ){
+						$value		= e_SELF."?content.".$qs[1].".".$catid;
+					}else{
+						$value		= e_SELF."?content.".$catid;
+					}
+				}elseif($mode=='createcontent'){
+					if($qs[1] == "create" || $qs[1] == "submit"){
+						$checkid	= (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "");
+						$value		= $catid;
+					}else{
+						$checkid	= ($currentparent ? $currentparent : "");
+						$value		= $qs[2].".".$catid;
 					}
+				}elseif($mode=='category'){
 					if($qs[1] == "create"){
 						$checkid	= (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "");
 						$value		= e_SELF."?cat.create.".$catid;
-						$sel		= ($catid == $checkid ? "1" : "0");
 					}elseif($qs[1] == "edit"){
 						$checkid	= ($currentparent ? $currentparent : "");
 						$value		= e_SELF."?cat.edit.".$qs[2].".".$catid;
-						$sel		= ($catid == $checkid ? "1" : "0");
-					}
-
-				//manage items
-				}elseif($qs[0] == "" || $qs[0] == "content"){
-
-					$catstring	= "";
-					$js			= "";
-					$label		= $catid;
-					$selectjs	= "if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }";
-					$name		= $pre.$row['content_heading'];
-					if($row['content_parent'] == 0){
-						$name	= $row['content_heading'];
-						$js		= "style='font-weight:bold;'";
-					}
-					if($qs[1] == "create" || $qs[1] == "submit"){
-						$checkid	= (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "");
-						$value		= e_SELF."?content.".$qs[1].".".$catid;
-						$sel		= ($catid == $checkid ? "1" : "0");
-					}else{
-						$checkid	= ($currentparent ? $currentparent : "");
-						$sel		= ($catid == $checkid ? "1" : "0");
-						if($qs[1] == "" || is_numeric($qs[1])){
-							$value	= e_SELF."?content.".$catid;
-						}else{
-							$value	= e_SELF."?content.".$qs[1].".".$qs[2].".".$catid;
-						}
 					}
 				}
-				$string	.= $rs -> form_option($name, $sel, $value, ($label ? "label='".$label."'" : "label='none'")." ".$js ).$catstring;
+				$sel = ($catid == $checkid ? "1" : "0");
+				$string	.= $rs -> form_option($name, $sel, $value, $js);
 			}
-			$selectjs	= " onchange=\" document.getElementById('parent').value=this.options[this.selectedIndex].label; ".$selectjs." \"";
-			$text		= $rs -> form_select_open("parent1", $selectjs);
 
-			if(!isset($qs[0])){
-				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none", "label='none'");
-			}elseif( $qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2]) ){
-				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none", "label='none'");
-			}elseif( $qs[0] == "content" && ($qs[1] == "create" || $qs[1] == "submit") ){
-				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none", "label='none'");
-			}elseif( $qs[0] == "content" && is_numeric($qs[1]) ){
-				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none", "label='none'");
-			}elseif($qs[0] == "cat" && $qs[1] == "create"){
-				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29."&nbsp;&nbsp;", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.create", "label='0' style='font-weight:bold;'");
-			}else{
-				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29."&nbsp;&nbsp;", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.edit.".$qs[2].".0", "label='0' style='font-weight:bold;'");
+			if($mode=='managecontent'){
+				$selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; } \"";
+				$text  = $rs -> form_select_open("parent1", $selectjs);
+				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none");
+				$text .= $string;
+				$text .= $rs -> form_select_close();
+
+			}elseif($mode=='createcontent'){
+				$redirecturl = e_SELF."?content.".$qs[1].".";
+				$selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location='".$redirecturl."'+this.options[this.selectedIndex].value; } \"";
+				$text  = $rs -> form_select_open("parent1", $selectjs);
+				$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_28, "0", "none");
+				$text .= $string;
+				$text .= $rs -> form_select_close();
+
+			}elseif($mode=='category'){
+				$selectjs = " onchange=\" if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; } \"";
+				$text = $rs -> form_select_open("parent1", $selectjs);
+				if($qs[1] == "create"){
+					$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29."&nbsp;&nbsp;", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.create", "style='font-weight:bold;'");
+				}else{
+					$text .= $rs -> form_option(CONTENT_ADMIN_MAIN_LAN_29."&nbsp;&nbsp;", (isset($qs[2]) ? "0" : "1"), e_SELF."?cat.edit.".$qs[2].".0", "style='font-weight:bold;'");
+				}
+				$text .= $string;
+				$text .= $rs -> form_select_close();
 			}
-			$text .= $string;
-			$text .= $rs -> form_select_close();
-
 			return $text;
 		}
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/handlers/content_db_class.php 0.7.11.src/e107_plugins/content/handlers/content_db_class.php
--- 0.7.7.src/e107_plugins/content/handlers/content_db_class.php	2006-08-02 16:38:31.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/handlers/content_db_class.php	2007-01-14 08:24:41.000000000 -0600
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_db_class.php,v $
-|		$Revision: 1.50 $
-|		$Date: 2006/08/02 21:38:31 $
+|		$Revision: 1.56 $
+|		$Date: 2007/01/14 14:24:41 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -32,7 +32,7 @@
 	if($_POST['uploadtype']){
 		$pref['upload_storagetype'] = "1";
 		require_once(e_HANDLER."upload_handler.php");
-		$mainparent		= $aa -> getMainParent(intval($_POST['parent']));
+		$mainparent		= $aa -> getMainParent(intval($_POST['parent1']));
 		$content_pref	= $aa -> getContentPref($mainparent);
 
 		if($_POST['content_id']){
@@ -121,9 +121,22 @@
 			}
 			
 			$_POST['content_text']			= $tp -> toDB($_POST['content_text']);
-			$_POST['parent']				= ($_POST['parent'] ? intval($_POST['parent']) : "0");
 			$_POST['content_class']			= ($_POST['content_class'] ? intval($_POST['content_class']) : "0");
 			$_POST['content_meta']			= $tp -> toDB($_POST['content_meta']);
+			//content create
+			if( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='create' || $qs[1]=='submit') && isset($qs[2]) && is_numeric($qs[2]) ){
+				$parent = intval($_POST['parent1']);
+
+			//content edit
+			}elseif( isset($qs[0]) && $qs[0]=='content' && isset($qs[1]) && ($qs[1]=='edit' || $qs[1]=='sa') && isset($qs[2]) && is_numeric($qs[2]) ){
+				if( isset($_POST['parent1']) && strpos($_POST['parent1'], ".") ){
+					$tmp = explode(".", $_POST['parent1']);
+					$parent = $tmp[1];
+				}else{
+					$parent = $_POST['parent1'];
+				}
+			}
+			$_POST['parent'] = $parent;
 
 			if(USER){
 				if($_POST['content_author_id']){
@@ -217,7 +230,9 @@
 			if($_POST['update_datestamp']){
 				$starttime = time();
 			}else{
-				if($_POST['ne_day'] != "none" && $_POST['ne_month'] != "none" && $_POST['ne_year'] != "none" && $_POST['ne_day'] != "0" && $_POST['ne_month'] != "0" && $_POST['ne_year'] != "0"){
+				if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none" 
+				&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none" 
+				&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
 					$newstarttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
 				}else{
 					$newstarttime = time();
@@ -233,7 +248,9 @@
 				}
 			}
 
-			if($_POST['end_day'] != "none" && $_POST['end_month'] != "none" && $_POST['end_year'] != "none" && $_POST['end_day'] != "0" && $_POST['end_month'] != "0" && $_POST['end_year'] != "0"){
+			if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none" 
+				&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none" 
+				&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
 				$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
 			}else{
 				$endtime = "0";
@@ -318,7 +335,7 @@
 
 		//function dbCategoryUpdate($mode){
 		function dbCategory($mode){
-			global $pref, $sql, $ns, $rs, $aa, $tp, $plugintable, $e107cache, $content_cat_icon_path_large, $content_cat_icon_path_small;
+			global $pref, $sql, $ns, $qs, $rs, $aa, $tp, $plugintable, $e107cache, $content_cat_icon_path_large, $content_cat_icon_path_small;
 
 			$_POST['cat_heading']		= $tp -> toDB($_POST['cat_heading']);
 			$_POST['cat_subheading']	= $tp -> toDB($_POST['cat_subheading']);
@@ -326,15 +343,52 @@
 				$_POST['cat_text']		= $tp->createConstants($_POST['cat_text']); // convert e107_images/ to {e_IMAGE} etc.
 			}
 			$_POST['cat_text']			= $tp -> toDB($_POST['cat_text']);
-			$_POST['parent']			= ($_POST['parent'] == "0" || $_POST['parent']==$_POST['cat_id'] ? "0" : "0.".intval($_POST['parent']));
 			$_POST['cat_class']			= ($_POST['cat_class'] ? intval($_POST['cat_class']) : "0");
 
-			if($_POST['ne_day'] != "none" && $_POST['ne_month'] != "none" && $_POST['ne_year'] != "none"){
+			//category create
+			if( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='create' ){
+				if( isset($qs[2]) && is_numeric($qs[2]) ){
+					$parent = "0.".intval($qs[2]);
+				}else{
+					$parent = 0;
+				}
+
+			//category edit
+			}elseif( isset($qs[0]) && $qs[0]=='cat' && isset($qs[1]) && $qs[1]=='edit' ){
+				if( isset($qs[2]) && is_numeric($qs[2]) ){
+
+					if( isset($qs[3]) && is_numeric($qs[3]) ){
+						if(intval($qs[3]) == 0){
+							$parent = 0;
+						}elseif( $qs[2] == $qs[3] ){
+							$parent = 0;
+						}else{
+							$parent = "0.".intval($qs[3]);
+						}
+					}else{
+						if($qs[2]==$_POST['cat_id']){
+							$parent = intval($_POST['parent_id']);
+							$parent = ($parent!=0 ? "0.".$parent : 0);
+						}else{
+						}
+					}
+				}else{
+					$parent = 0;
+				}
+			}
+			$_POST['parent'] = $parent;
+
+			if( isset($_POST['ne_day']) && $_POST['ne_day']!='' && $_POST['ne_day']!='0' && $_POST['ne_day'] != "none" 
+				&& isset($_POST['ne_month']) && $_POST['ne_month']!='' && $_POST['ne_month']!='0' && $_POST['ne_month'] != "none" 
+				&& isset($_POST['ne_year']) && $_POST['ne_year']!='' && $_POST['ne_year']!='0' && $_POST['ne_year'] != "none" ){
 				$starttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
 			}else{
 				$starttime = time();
 			}
-			if($_POST['end_day'] != "none" && $_POST['end_month'] != "none" && $_POST['end_year'] != "none"){
+
+			if( isset($_POST['end_day']) && $_POST['end_day']!='' && $_POST['end_day']!='0' && $_POST['end_day'] != "none" 
+				&& isset($_POST['end_month']) && $_POST['end_month']!='' && $_POST['end_month']!='0' && $_POST['end_month'] != "none" 
+				&& isset($_POST['end_year']) && $_POST['end_year']!='' && $_POST['end_year']!='0' && $_POST['end_year'] != "none" ){
 				$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
 			}else{
 				$endtime = "0";
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/handlers/content_form_class.php 0.7.11.src/e107_plugins/content/handlers/content_form_class.php
--- 0.7.7.src/e107_plugins/content/handlers/content_form_class.php	2006-11-21 13:26:18.000000000 -0600
+++ 0.7.11.src/e107_plugins/content/handlers/content_form_class.php	2007-05-29 15:14:10.000000000 -0500
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_form_class.php,v $
-|		$Revision: 1.123 $
-|		$Date: 2006/11/21 19:26:18 $
+|		$Revision: 1.127 $
+|		$Date: 2007/05/29 20:14:10 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -57,7 +57,7 @@
 class contentform{
 
 		function ContentItemPreview(){
-				global $ns, $sql, $aa, $qs, $tp, $mainparent;
+				global $ns, $sql, $aa, $qs, $tp, $mainparent, $months;
 
 				$TRPRE = "<tr>";
 				$TRPOST = "</tr>";
@@ -91,8 +91,9 @@
 					{CONTENT_CONTENT_PREVIEW_PAGENAMES}
 				</table>\n";
 
-				$_POST['parent'] = intval($_POST['parent']);
-				$mainparent						= $aa -> getMainParent( $_POST['parent'] );
+				$tmp = explode(".",$_POST['parent1']);
+				$_POST['parent1'] = $tmp[1];
+				$mainparent						= $aa -> getMainParent( $_POST['parent1'] );
 				$content_pref					= $aa -> getContentPref($mainparent);
 				$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
 				$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
@@ -108,7 +109,7 @@
 				$content_tmppath_file			= $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
 				$content_tmppath_image			= $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
 
-				if($sql -> db_Select("pcontent", "content_heading", " content_id='".$_POST['parent']."' ")){
+				if($sql -> db_Select("pcontent", "content_heading", " content_id='".$_POST['parent1']."' ")){
 					$row = $sql -> db_Fetch();
 					$PARENT = $row['content_heading'];
 				}
@@ -127,7 +128,7 @@
 				}
 				$content_text = $tp->post_toHTML($content_text,TRUE);
 
-				$CONTENT_CONTENT_PREVIEW_CATEGORY = ($_POST['parent'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_57.$TDPOST.$TDPRE2.$PARENT.$TDPOST.$TRPOST : "");
+				$CONTENT_CONTENT_PREVIEW_CATEGORY = ($_POST['parent1'] ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_57.$TDPOST.$TDPRE2.$PARENT.$TDPOST.$TRPOST : "");
 				$CONTENT_CONTENT_PREVIEW_HEADING = ($content_heading ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_11.$TDPOST.$TDPRE2.$content_heading.$TDPOST.$TRPOST : "");
 				$CONTENT_CONTENT_PREVIEW_SUBHEADING = ($content_subheading ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_16.$TDPOST.$TDPRE2.$content_subheading.$TDPOST.$TRPOST : "");
 				$CONTENT_CONTENT_PREVIEW_SUMMARY = ($content_summary ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_17.$TDPOST.$TDPRE2.$content_summary.$TDPOST.$TRPOST : "");
@@ -233,7 +234,7 @@
 							<tr><td class='fcaption' colspan='2'>".CONTENT_ADMIN_MAIN_LAN_2."</td></tr>";
 
 							$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_27;
-							$TOPIC_FIELD = $aa -> ShowOptionCat().$rs->form_hidden("parent", "");
+							$TOPIC_FIELD = $aa -> ShowOption('',"managecontent");
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 							$text .= "</table></form></div>";
 							$caption = CONTENT_ADMIN_MAIN_LAN_2;
@@ -478,7 +479,7 @@
 						//re-prepare the posted fields for the form (after preview)
 						if( isset($_POST['preview_content']) || isset($message) ){
 
-								$row['content_parent']				= $_POST['parent'];
+								$row['content_parent']				= $_POST['parent1'];
 								$row['content_heading']				= $tp -> post_toForm($_POST['content_heading']);
 								$row['content_subheading']			= $tp -> post_toForm($_POST['content_subheading']);
 								$row['content_summary']				= $tp -> post_toForm($_POST['content_summary']);
@@ -537,9 +538,9 @@
 						$hidden = "";
 						if($mode == "contentmanager"){
 							if($qs[1] == "edit"){
-								$hidden .= $rs -> form_hidden("parent", $row['content_parent']);
+								$hidden .= $rs -> form_hidden("parent1", $row['content_parent']);
 							}else{
-								$hidden .= $rs -> form_hidden("parent", intval($qs[2]));
+								$hidden .= $rs -> form_hidden("parent1", intval($qs[2]));
 							}
 						}else{
 							if($mode == "submit"){
@@ -549,7 +550,7 @@
 							}
 							//category parent
 							$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_27;
-							$TOPIC_FIELD = $aa -> ShowOptionCat($parent).$rs->form_hidden("parent", "");
+							$TOPIC_FIELD = $aa -> ShowOption($parent, "createcontent");
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 							//$text .= $TOPIC_ROW_SPACER;
 						}
@@ -723,7 +724,6 @@
 								if(!is_writable($content_tmppath_image)){
 									$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_image." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
 								}
-								$js = "onclick=\"document.getElementById('parent').value = document.getElementById('parent1').options[document.getElementById('parent1').selectedIndex].label;\" ";
 								$TOPIC_FIELD .= "<br />
 								<input class='tbox' type='file' name='file_userfile[]'  size='36' /> 
 									".$rs -> form_select_open("uploadtype")."
@@ -734,7 +734,7 @@
 								<input type='hidden' name='tmppathicon' value='".$content_tmppath_icon."' />
 								<input type='hidden' name='tmppathfile' value='".$content_tmppath_file."' />
 								<input type='hidden' name='tmppathimage' value='".$content_tmppath_image."' />
-								<input class='button' type='submit' name='uploadfile' value='".CONTENT_ADMIN_ITEM_LAN_104."' $js />";
+								<input class='button' type='submit' name='uploadfile' value='".CONTENT_ADMIN_ITEM_LAN_104."' />";
 							}
 							$TOPIC_FIELD .= "<br />";
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
@@ -749,7 +749,7 @@
 							$TOPIC_FIELD = "
 								".$rs -> form_text("content_icon", 60, $row['content_icon'], 100)."
 								".$rs -> form_button("button", '', CONTENT_ADMIN_ITEM_LAN_105, "onclick=\"expandit('divicon')\"")."
-								<div id='divicon' style='{head}; display:none'>";
+								<div id='divicon' style='display:none;'>";
 								if(empty($iconlist)){
 									$TOPIC_FIELD .= CONTENT_ADMIN_ITEM_LAN_121;
 								}else{
@@ -792,7 +792,7 @@
 								<div style='padding:2px;'>
 								".$num." ".$rs -> form_text("content_files".$i."", 60, $attachments[$i], 100)."
 								".$rs -> form_button("button", '', CONTENT_ADMIN_ITEM_LAN_105, "onclick=\"expandit('divfile".$i."')\"")."
-								<div id='divfile".$i."' style='{head}; display:none'>";
+								<div id='divfile".$i."' style='display:none;'>";
 								if(empty($filelist)){
 									$TOPIC_FIELD .= CONTENT_ADMIN_ITEM_LAN_122;
 								}else{
@@ -830,7 +830,7 @@
 								<div style='padding:2px;'>
 								".$num." ".$rs -> form_text("content_images".$i."", 60, $imagesarray[$i], 100)."
 								".$rs -> form_button("button", '', CONTENT_ADMIN_ITEM_LAN_105, "onclick=\"expandit('divimage".$i."')\"")."
-								<div id='divimage".$i."' style='{head}; display:none'>";
+								<div id='divimage".$i."' style='display:none;'>";
 								if(empty($imagelist)){
 									$TOPIC_FIELD .= CONTENT_ADMIN_ITEM_LAN_123;
 								}else{
@@ -1050,20 +1050,18 @@
 						$text .= $TOPIC_ROW_SPACER."
 						<tr>
 							<td colspan='2' style='text-align:center' class='forumheader'>".($hidden ? $hidden : "");
-							
-							$js = "onclick=\"document.getElementById('parent').value = document.getElementById('parent1').options[document.getElementById('parent1').selectedIndex].label;\" ";
 							if($qs[1] == "edit" || $qs[1] == "sa" || isset($_POST['editp']) ){
 								if($qs[1] == "sa"){
 								$text .= $rs -> form_hidden("content_refer", $row['content_refer']);
 								}
 								$text .= $rs -> form_hidden("content_datestamp", $row['content_datestamp']);
-								$text .= $rs -> form_button("submit", "preview_content", (isset($_POST['preview_content']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26), $js);
-								$text .= $rs -> form_button("submit", "update_content", ($qs[1] == "sa" ? CONTENT_ADMIN_ITEM_LAN_43 : CONTENT_ADMIN_ITEM_LAN_45), $js );
+								$text .= $rs -> form_button("submit", "preview_content", (isset($_POST['preview_content']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
+								$text .= $rs -> form_button("submit", "update_content", ($qs[1] == "sa" ? CONTENT_ADMIN_ITEM_LAN_43 : CONTENT_ADMIN_ITEM_LAN_45));
 								$text .= $rs -> form_hidden("content_id", $qs[2]);
 								$text .= $rs -> form_checkbox("update_datestamp", 1, 0)." ".CONTENT_ADMIN_ITEM_LAN_42;
 							}else{
-								$text .= $rs -> form_button("submit", "preview_content", (isset($_POST['preview_content']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26), $js);
-								$text .= $rs -> form_button("submit", "create_content", CONTENT_ADMIN_ITEM_LAN_44, $js);								
+								$text .= $rs -> form_button("submit", "preview_content", (isset($_POST['preview_content']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
+								$text .= $rs -> form_button("submit", "create_content", CONTENT_ADMIN_ITEM_LAN_44);								
 							}
 							$text .= "
 							</td>
@@ -1147,8 +1145,7 @@
 				//category parent
 				global $TOPIC_TOPIC, $TOPIC_FIELD, $TOPIC_ROW_NOEXPAND;
 				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_27;
-				$parent = (is_numeric($qs[1]) ? $qs[1] : "");
-				$TOPIC_FIELD = $aa -> ShowOptionCat($parent).$rs->form_hidden("parent", "");
+				$TOPIC_FIELD = $aa -> ShowOption( (is_numeric($qs[1]) ? $qs[1] : ""), "managecontent" );
 				$text = "<div style='text-align:center'><table style='".ADMIN_WIDTH."' class='fborder'>
 				<tr><td class='fcaption' colspan='2'>".CONTENT_ADMIN_MAIN_LAN_2."</td></tr>";
 				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -1733,7 +1730,7 @@
 			<div style='text-align:center'>
 			".$rs -> form_open("post", $formurl, "dataform", "", "enctype='multipart/form-data'")."
 			<table class='fborder' style='".ADMIN_WIDTH."'>";
-			
+
 			//category parent
 			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_27;
 			if($qs[1] == "create"){
@@ -1745,7 +1742,7 @@
 					$parent	= ( strpos($row['content_parent'], ".") ? substr($row['content_parent'],2) : "");
 				}
 			}
-			$TOPIC_FIELD = $aa -> ShowOptionCat($parent).$rs->form_hidden("parent", "");
+			$TOPIC_FIELD = $aa -> ShowOption($parent, "category");
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			$text .= $TOPIC_ROW_SPACER;
 
@@ -1886,7 +1883,7 @@
 				$TOPIC_FIELD = "
 					".$rs -> form_text("cat_icon", 60, $row['content_icon'], 100)."
 					".$rs -> form_button("button", '', CONTENT_ADMIN_CAT_LAN_8, "onclick=\"expandit('divcaticon')\"")."
-					<div id='divcaticon' style='{head}; display:none'>";
+					<div id='divcaticon' style='display:none;'>";
 					foreach($iconlist as $icon){
 						$TOPIC_FIELD .= "<a href=\"javascript:insertext('".$icon['fname']."','cat_icon','divcaticon')\"><img src='".$icon['path'].$icon['fname']."' style='border:0' alt='' /></a> ";
 					}
@@ -1943,15 +1940,13 @@
 			<tr>
 				<td class='forumheader' style='text-align:center' colspan='2'>".$hidden;
 				if($qs[1] == "edit" && is_numeric($qs[2]) ){
-					$js = "onclick=\"document.getElementById('parent').value = document.getElementById('parent1').options[document.getElementById('parent1').selectedIndex].label;\" ";
-					$text .= $rs -> form_button("submit", "preview_category", (isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26), $js);
-					$text .= $rs -> form_button("submit", "update_category", CONTENT_ADMIN_CAT_LAN_7, $js).$rs -> form_button("submit", "category_clear", CONTENT_ADMIN_CAT_LAN_21).$rs -> form_hidden("cat_id", $qs[2]).$rs -> form_hidden("id", $qs[2]).$rs -> form_hidden("menuheading", $menuheading);
+					$text .= $rs -> form_button("submit", "preview_category", (isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
+					$text .= $rs -> form_button("submit", "update_category", CONTENT_ADMIN_CAT_LAN_7).$rs -> form_button("submit", "category_clear", CONTENT_ADMIN_CAT_LAN_21).$rs -> form_hidden("parent_id", $parent).$rs -> form_hidden("cat_id", $qs[2]).$rs -> form_hidden("id", $qs[2]).$rs -> form_hidden("menuheading", $menuheading);
 					
 					$caption = CONTENT_ADMIN_CAT_LAN_1;
 				}else{
-					$js = "onclick=\"document.getElementById('parent').value = document.getElementById('parent1').options[document.getElementById('parent1').selectedIndex].label;\" ";
-					$text .= $rs -> form_button("submit", "preview_category", (isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26), $js);
-					$text .= $rs -> form_button("submit", "create_category", CONTENT_ADMIN_CAT_LAN_6, $js);
+					$text .= $rs -> form_button("submit", "preview_category", (isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26));
+					$text .= $rs -> form_button("submit", "create_category", CONTENT_ADMIN_CAT_LAN_6);
 					$caption = CONTENT_ADMIN_CAT_LAN_0;
 				}
 				$text .= "
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/handlers/content_preset.php 0.7.11.src/e107_plugins/content/handlers/content_preset.php
--- 0.7.7.src/e107_plugins/content/handlers/content_preset.php	2006-07-21 04:48:54.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/handlers/content_preset.php	2007-06-12 17:50:49.000000000 -0500
@@ -115,6 +115,7 @@
 <html>\n
 <head>\n
 <title>".CONTENT_PRESET_LAN_7."</title>\n
+<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />\n
 <script type='text/javascript' src='../../../e107_files/e107.js'></script>
 ".$js."
 <style type='text/css'>\n
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/languages/English/lan_content.php 0.7.11.src/e107_plugins/content/languages/English/lan_content.php
--- 0.7.7.src/e107_plugins/content/languages/English/lan_content.php	2006-11-09 12:58:19.000000000 -0600
+++ 0.7.11.src/e107_plugins/content/languages/English/lan_content.php	2006-11-30 10:10:50.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/languages/English/lan_content.php,v $
-|     $Revision: 1.74 $
-|     $Date: 2006/11/09 18:58:19 $
+|     $Revision: 1.75 $
+|     $Date: 2006/11/30 16:10:50 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -112,7 +112,7 @@
 define("CONTENT_LAN_13", "list");
 define("CONTENT_LAN_14", "-- categories --");
 define("CONTENT_LAN_15", "no authors yet");
-define("CONTENT_LAN_16", "");
+define("CONTENT_LAN_16", "[read more]");
 define("CONTENT_LAN_17", "");
 define("CONTENT_LAN_18", "search by keyword");
 define("CONTENT_LAN_19", "search");
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/languages/English/lan_content_admin.php 0.7.11.src/e107_plugins/content/languages/English/lan_content_admin.php
--- 0.7.7.src/e107_plugins/content/languages/English/lan_content_admin.php	2006-10-11 16:21:43.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/languages/English/lan_content_admin.php	2007-03-25 03:37:55.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/languages/English/lan_content_admin.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/10/11 21:21:43 $
+|     $Revision: 1.22 $
+|     $Date: 2007/03/25 08:37:55 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -19,6 +19,7 @@
 define("CONTENT_PLUGIN_LAN_6", "Content Management Plugin table structure updated");
 
 define("CONTENT_LATEST_LAN_1", "Submitted Content Items:");
+define("CONTENT_STATUS_LAN_1", "Content Items:");
 
 define("CONTENT_ADMIN_CAT_LAN_0", "create content category");
 define("CONTENT_ADMIN_CAT_LAN_1", "edit content category");
@@ -331,7 +332,7 @@
 
 
 
-define("CONTENT_ADMIN_SUBMIT_LAN_0", "no content categories allow user submission at this point");
+define("CONTENT_ADMIN_SUBMIT_LAN_0", "you do not have enough permission or user submission is not enabled");
 define("CONTENT_ADMIN_SUBMIT_LAN_1", "content submit types");
 define("CONTENT_ADMIN_SUBMIT_LAN_2", "Thank you, your content item has been submitted.");
 define("CONTENT_ADMIN_SUBMIT_LAN_3", "Thank you, your content item has been submitted and will be reviewed by a site administrator in due course.");
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/search/search_parser.php 0.7.11.src/e107_plugins/content/search/search_parser.php
--- 0.7.7.src/e107_plugins/content/search/search_parser.php	2006-09-18 03:57:42.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/search/search_parser.php	2007-01-17 08:05:41.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/search/search_parser.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/09/18 08:57:42 $
+|     $Revision: 1.4 $
+|     $Date: 2007/01/17 14:05:41 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -58,19 +58,19 @@
 	if($row['content_parent'] == '0'){
 		$qry = "
 		SELECT c.content_heading
-		FROM pcontent as c
+		FROM #pcontent as c
 		WHERE c.content_id = '".$row['content_id']."' ";
 	}elseif(strpos($row['content_parent'], "0.") !== FALSE){
 		$tmp = explode(".", $row['content_parent']);
 		$qry = "
 		SELECT c.content_heading
-		FROM pcontent as c
+		FROM #pcontent as c
 		WHERE c.content_id = '".intval($tmp[1])."' ";
 	}else{
 		$qry = "
 		SELECT c.*, p.*
-		FROM pcontent as c
-		LEFT JOIN pcontent as p ON p.content_id = c.content_parent
+		FROM #pcontent as c
+		LEFT JOIN #pcontent as p ON p.content_id = c.content_parent
 		WHERE c.content_id = '".$row['content_id']."' ";
 	}
 	
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/templates/content_type_template.php 0.7.11.src/e107_plugins/content/templates/content_type_template.php
--- 0.7.7.src/e107_plugins/content/templates/content_type_template.php	2006-08-08 02:09:35.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/templates/content_type_template.php	2007-06-12 17:47:50.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/content_type_template.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/08/08 07:09:35 $
+|     $Revision: 1.11 $
+|     $Date: 2007/06/12 22:47:50 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -41,7 +41,7 @@
 	<tr>
 		<td class='forumheader3' style='width:5%; white-space:nowrap; padding-bottom:5px;' rowspan='2'>{CONTENT_TYPE_TABLE_ICON}</td>
 		<td class='fcaption'>{CONTENT_TYPE_TABLE_HEADING}{CONTENT_TYPE_TABLE_LINK}</td>
-		<td class='forumheader' style='width:5%; white-space:nowrap; text-align:right;'>{CONTENT_TYPE_TABLE_TOTAL} {CONTENT_TYPE_TABLE_TOTAL_LAN}</td>
+		<td class='forumheader' style='width:5%; white-space:nowrap; text-align:right;'>{CONTENT_TYPE_TABLE_TOTAL}</td>
 	</tr>
 	<tr><td class='forumheader2' colspan='2'>{CONTENT_TYPE_TABLE_SUBHEADING}<br /></td></tr>\n";
 }
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/templates/default/content_content_template.php 0.7.11.src/e107_plugins/content/templates/default/content_content_template.php
--- 0.7.7.src/e107_plugins/content/templates/default/content_content_template.php	2006-06-05 06:27:57.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/templates/default/content_content_template.php	2007-01-04 07:10:14.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_content_template.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2006/06/05 11:27:57 $
+|     $Revision: 1.26 $
+|     $Date: 2007/01/04 13:10:14 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -83,17 +83,23 @@
 $sc_style['CONTENT_CONTENT_TABLE_NEXT_PAGE']['pre'] = "<div style='float:right;'>";
 $sc_style['CONTENT_CONTENT_TABLE_NEXT_PAGE']['post'] = "</div></div>";
 
+$sc_style['CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA']['pre'] = "<td style='vertical-align:top;'>";
+$sc_style['CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA']['post'] = "";
+$sc_style['CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA']['pre'] = "";
+$sc_style['CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA']['post'] = "</td>";
+
+
 $CONTENT_CONTENT_TABLE = "<table class='fborder' cellpadding='0' cellspacing='0' style='width:100%;'><tr><td>
 <div style='clear:both;'>
 
 	{CONTENT_CONTENT_TABLE_INFO_PRE}
 		{CONTENT_CONTENT_TABLE_ICON}
-		<td style='vertical-align:top;'>
-		{CONTENT_CONTENT_TABLE_SUBHEADING}
-		{CONTENT_CONTENT_TABLE_DATE} {CONTENT_CONTENT_TABLE_AUTHORDETAILS} {CONTENT_CONTENT_TABLE_EPICONS} {CONTENT_CONTENT_TABLE_EDITICON} {CONTENT_CONTENT_TABLE_PARENT} {CONTENT_CONTENT_TABLE_COMMENT} {CONTENT_CONTENT_TABLE_SCORE} {CONTENT_CONTENT_TABLE_REFER}
-		{CONTENT_CONTENT_TABLE_RATING}
-		{CONTENT_CONTENT_TABLE_FILE}
-		</td>
+		{CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA}
+			{CONTENT_CONTENT_TABLE_SUBHEADING}
+			{CONTENT_CONTENT_TABLE_DATE} {CONTENT_CONTENT_TABLE_AUTHORDETAILS} {CONTENT_CONTENT_TABLE_EPICONS} {CONTENT_CONTENT_TABLE_EDITICON} {CONTENT_CONTENT_TABLE_PARENT} {CONTENT_CONTENT_TABLE_COMMENT} {CONTENT_CONTENT_TABLE_SCORE} {CONTENT_CONTENT_TABLE_REFER}
+			{CONTENT_CONTENT_TABLE_RATING}
+			{CONTENT_CONTENT_TABLE_FILE}
+		{CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA}
 	{CONTENT_CONTENT_TABLE_INFO_POST}
 	<div style='clear:both;'><br /></div>
 	<table class='fborder' cellpadding='0' cellspacing='0' style='width:100%;'><tr><td class='forumheader3'>
diff -x .svn -ruN 0.7.7.src/e107_plugins/content/templates/default/content_recent_template.php 0.7.11.src/e107_plugins/content/templates/default/content_recent_template.php
--- 0.7.7.src/e107_plugins/content/templates/default/content_recent_template.php	2006-05-31 16:29:59.000000000 -0500
+++ 0.7.11.src/e107_plugins/content/templates/default/content_recent_template.php	2007-03-01 03:40:10.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_recent_template.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2006/05/31 21:29:59 $
+|     $Revision: 1.21 $
+|     $Date: 2007/03/01 09:40:10 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -31,7 +31,7 @@
 $sc_style['CONTENT_RECENT_TABLE_PARENT']['pre'] = CONTENT_LAN_9." ";
 $sc_style['CONTENT_RECENT_TABLE_PARENT']['post'] = "";
 
-$sc_style['CONTENT_RECENT_TABLE_REFER']['pre'] = " (".CONTENT_LAN_44;
+$sc_style['CONTENT_RECENT_TABLE_REFER']['pre'] = " (".CONTENT_LAN_44." ";
 $sc_style['CONTENT_RECENT_TABLE_REFER']['post'] = ")";
 
 $sc_style['CONTENT_RECENT_TABLE_AUTHORDETAILS']['pre'] = CONTENT_LAN_11." ";
diff -x .svn -ruN 0.7.7.src/e107_plugins/featurebox/admin_config.php 0.7.11.src/e107_plugins/featurebox/admin_config.php
--- 0.7.7.src/e107_plugins/featurebox/admin_config.php	2005-06-14 22:04:40.000000000 -0500
+++ 0.7.11.src/e107_plugins/featurebox/admin_config.php	2007-08-28 14:13:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/featurebox/admin_config.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/06/15 03:04:40 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.4 $
+|     $Date: 2007/08/28 19:13:44 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -80,7 +80,7 @@
 }
 
 
-if($headline_total = $sql->db_Select("featurebox "))
+if($headline_total = $sql->db_Select("featurebox"))
 {
 	$nfArray = $sql -> db_getList();
 
@@ -149,7 +149,7 @@
 <tr>
 <td style='width:50%' class='forumheader3'>".FBLAN_09."</td>
 <td style='width:50%; text-align: left;' class='forumheader3'>
-".r_userclass("fb_class", $fb_class, "public, guests, nobody, member, admin, classes")."
+".r_userclass("fb_class", $fb_class,'off', "public, guests, nobody, member, admin, classes")."
 </td>
 </tr>
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/featurebox/featurebox.php 0.7.11.src/e107_plugins/featurebox/featurebox.php
--- 0.7.7.src/e107_plugins/featurebox/featurebox.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/featurebox/featurebox.php	2007-01-19 23:19:44.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/featurebox/featurebox.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2007/01/20 05:19:44 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -50,8 +50,8 @@
 }
 
 $fbcc = $fb_title;
-$fb_title = $tp -> toHTML($fb_title, TRUE);
-$fb_text = $tp -> toHTML($fb_text, TRUE);
+$fb_title = $tp -> toHTML($fb_title, TRUE,'title');
+$fb_text = $tp -> toHTML($fb_text, TRUE,'body');
 if(!$fb_rendertype)
 {
 	$ns -> tablerender($fb_title, $fb_text, 'featurebox');
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/e_latest.php 0.7.11.src/e107_plugins/forum/e_latest.php
--- 0.7.7.src/e107_plugins/forum/e_latest.php	2006-10-25 12:05:15.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/e_latest.php	2007-02-11 14:09:07.000000000 -0600
@@ -12,4 +12,4 @@
 }
 
 $text .= '</div>';
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/e_linkgen.php 0.7.11.src/e107_plugins/forum/e_linkgen.php
--- 0.7.7.src/e107_plugins/forum/e_linkgen.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/e_linkgen.php	2007-11-05 14:52:22.000000000 -0600
@@ -1,4 +1,4 @@
-<?
+<?php
 /*
 + ----------------------------------------------------------------------------+
 |     e107 website system
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/e_linkgen.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2007/11/05 20:52:22 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,11 +27,10 @@
 	$sublink_type['forum']['title'] = FORLAN_155; // "News Categories";
 	$sublink_type['forum']['table'] = "forum";
 	$sublink_type['forum']['query'] = "forum_parent !='0' ORDER BY forum_order ASC";
-    $sublink_type['forum']['url'] = $PLUGINS_DIRECTORY."forum/forum_viewforum.php?#";
+    $sublink_type['forum']['url'] = "{e_PLUGIN}forum/forum_viewforum.php?#";
 	$sublink_type['forum']['fieldid'] = "forum_id";
 	$sublink_type['forum']['fieldname'] = "forum_name";
 	$sublink_type['forum']['fielddiz'] = "forum_description";
 
 
-?>
-
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum.php 0.7.11.src/e107_plugins/forum/forum.php
--- 0.7.7.src/e107_plugins/forum/forum.php	2006-11-07 10:19:10.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum.php	2007-09-23 05:18:31.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum.php,v $
-|     $Revision: 1.39 $
-|     $Date: 2006/11/07 16:19:10 $
-|     $Author: lisa_ $
+|     $Revision: 1.40 $
+|     $Date: 2007/09/23 10:18:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if(!defined("e107_INIT")) {
@@ -140,7 +140,7 @@
 	$total_new_threads = $sql->db_Count('forum_t', '(*)', "WHERE thread_datestamp>'".USERLV."' ");
 	if (USERVIEWED != "")
 	{
-		$tmp = explode("..", USERVIEWED);
+		$tmp = explode(".", USERVIEWED);		// List of numbers, separated by single period
 		$total_read_threads = count($tmp);
 	}
 	else
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_admin.php 0.7.11.src/e107_plugins/forum/forum_admin.php
--- 0.7.7.src/e107_plugins/forum/forum_admin.php	2006-11-14 19:06:16.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_admin.php	2007-11-11 17:45:33.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_admin.php,v $
-|     $Revision: 1.44 $
-|     $Date: 2006/11/15 01:06:16 $
+|     $Revision: 1.48 $
+|     $Date: 2007/11/11 23:45:33 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -93,6 +93,8 @@
 			$msg .= FORLAN_168.": $fid <br />";
 		}
 	}
+	$for->update_subparent_lp('all');
+
 	if(isset($_POST['userpostcounts']))
 	{
 		$list = $for->get_user_counts();
@@ -986,7 +988,22 @@
 
 	function show_prefs()
 	{
-		global $pref, $ns;
+		global $pref, $ns, $sql;
+
+		if($sql->db_Count('plugin','(*)', "where plugin_path = 'poll' AND plugin_installflag = 1"))
+		{
+			$poll_installed = true;
+		}
+		else
+		{
+			$poll_installed = false;
+			if($pref['forum_poll'] == 1)
+			{
+				$pref['forum_poll'] = 0;
+				save_prefs();
+			}
+		}
+
 		$text = "<div style='text-align:center'>
 		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
 		<table style='".ADMIN_WIDTH."' class='fborder'>
@@ -1012,8 +1029,16 @@
 		</tr>
 
 		<tr>
-		<td style='width:75%' class='forumheader3'>".FORLAN_49."<br /><span class='smalltext'>".FORLAN_50."</span></td>
-		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_poll'] ? "<input type='checkbox' name='forum_poll' value='1' checked='checked' />" : "<input type='checkbox' name='forum_poll' value='1' />")."</td>
+		<td style='width:75%' class='forumheader3'>".FORLAN_49."<br /><span class='smalltext'>".FORLAN_50."</span></td>";
+		if($poll_installed)
+		{
+			$text .= "<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_poll'] ? "<input type='checkbox' name='forum_poll' value='1' checked='checked' />" : "<input type='checkbox' name='forum_poll' value='1' />")."</td>";
+		}
+		else
+		{
+			$text .= "<td style='width:25%;text-align:center' class='forumheader3' >".FORLAN_66."</td>";
+		}
+		$text .= "
 		</tr>
 
 		<tr>
@@ -1223,8 +1248,8 @@
 
 		<tr>
 		<td style='text-align:center' class='forumheader3'>".FORLAN_2."<br />
-		".FORLAN_89." <input type='radio' name='prune_type' value='".FORLAN_3."' />&nbsp;&nbsp;&nbsp;
-		".FORLAN_90." <input type='radio' name='prune_type' value='".FORLAN_111."' checked='checked' />
+		".FORLAN_89." <input type='radio' name='prune_type' value='delete' />&nbsp;&nbsp;&nbsp;
+		".FORLAN_90." <input type='radio' name='prune_type' value='make_inactive' checked='checked' />
 		</td>
 		</tr>
 
@@ -1295,9 +1320,12 @@
 
 		for($a = 0; $a <= 9; $a++)
 		{
+			$low_val = ($a == 0 ? '0' : (int)$rank_thresholds[$a-1]+1);
+			$high_val = ($a == 9 ? '&#8734' : "<input class='tbox' type='text' name='rank_thresholds[]' size='10' value='".$rank_thresholds[$a]."' maxlength='5' />");
+
 			$text .= "<tr>
 			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_names[]' size='30' value='".($rank_names[$a] ? $rank_names[$a] : "")."' maxlength='30' /></td>
-			<td class='forumheader3' style='width:20%; text-align:center'><input class='tbox' type='text' name='rank_thresholds[]' size='10' value='".$rank_thresholds[$a]."' maxlength='5' /></td>
+			<td class='forumheader3' style='width:20%; text-align:center'>{$low_val} - {$high_val}</td>
 			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_images[]' size='30' value='".($rank_images[$a] ? $rank_images[$a] : "")."' maxlength='30' /></td>
 			</tr>";
 		}
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_class.php 0.7.11.src/e107_plugins/forum/forum_class.php
--- 0.7.7.src/e107_plugins/forum/forum_class.php	2006-11-15 06:57:18.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_class.php	2007-11-11 17:45:33.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_class.php,v $
-|     $Revision: 1.65 $
-|     $Date: 2006/11/15 12:57:18 $
+|     $Revision: 1.71 $
+|     $Date: 2007/11/11 23:45:33 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -53,7 +53,7 @@
 			list($uid, $uname) = explode(".", $thread_info['thread_user'], 2);
 			if ($thread_info)
 			{
-				if($thread_user['user_name'] != "")
+				if($thread_info['user_name'] != "")
 				{
 					$thread_lastuser = $uid.".".$thread_info['user_name'];
 				}
@@ -62,7 +62,7 @@
 					$tmp = explode(chr(1), $thread_info['thread_user']);
 					$thread_lastuser = $tmp[0];
 				}
-				$sql->db_Update('forum_t', "thread_lastpost = ".intval($thread_info['thread_datestamp']).", thread_lastuser = '".$tp -> toDB($thread_lastuser, true)."' WHERE thread_id = ".intval($id));
+				$sql->db_Update('forum_t', "thread_lastpost = ".intval($thread_info['thread_datestamp']).", thread_lastuser = '".$tp -> toDB($thread_lastuser, true)."' WHERE thread_id = ".$id);
 			}
 			return $thread_info;
 		}
@@ -97,7 +97,7 @@
 						}
 					}
 				}
-				if ($sql->db_Select("forum_t", "*", "thread_forum_id='$id' ORDER BY thread_datestamp DESC LIMIT 0,1"))
+				if ($sql->db_Select("forum_t", "*", "thread_forum_id={$id} ORDER BY thread_datestamp DESC LIMIT 0,1"))
 				{
 					$row = $sql->db_Fetch();
 					$tmp = explode(chr(1), $row['thread_user']);
@@ -110,36 +110,70 @@
 		}
 	}
 
-	function forum_markasread($forum_id) {
+	function update_subparent_lp($id)
+	{
 		global $sql;
-		if ($forum_id != 'all') {
-			$forum_id = intval($forum_id);
-			$extra = " AND thread_forum_id='$forum_id' ";
+		if($id == 'all')
+		{
+			if($sql->db_Select('forum', 'DISTINCT(forum_sub)', 'forum_sub > 0'))
+			{
+				while($row = $sql->db_Fetch())
+				{
+					$sublist[] = $row;
+				}
+			}
+			foreach($sublist as $sub)
+			{
+				$this->update_subparent_lp($sub['forum_sub']);
+			}
 		}
-		$qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} ";
-		if ($sql->db_Select('forum_t', 'thread_id', $qry)) {
-			while ($row = $sql->db_Fetch()) {
-				$u_new .= ".".$row['thread_id'].".";
+		else 
+		{
+			$id = (int)$id;
+			if($sql->db_Select('forum', 'forum_lastpost_user, forum_lastpost_info', "forum_id = {$id} OR forum_sub = {$id} ORDER BY forum_lastpost_info DESC LIMIT 1"))
+			{
+				$row = $sql->db_Fetch();
+				$sql->db_Update('forum', "forum_lastpost_user = '".$row['forum_lastpost_user']."', forum_lastpost_info ='".$row['forum_lastpost_info']."' WHERE forum_id = {$id}");
 			}
-			$u_new .= USERVIEWED;
-			$sql->db_Update("user", "user_viewed='$u_new' WHERE user_id='".USERID."' ");
-			header("location:".e_SELF);
-			exit;
 		}
 	}
+	
+	function forum_markasread($forum_id) 
+	{
+	  global $sql;
+	  if ($forum_id != 'all') 
+	  {
+		$forum_id = intval($forum_id);
+		$extra = " AND thread_forum_id={$forum_id}";
+	  }
+	  $qry = "thread_lastpost > ".USERLV." AND thread_parent = 0 {$extra} ";
+	  if ($sql->db_Select('forum_t', 'thread_id', $qry)) 
+	  {
+		while ($row = $sql->db_Fetch()) 
+		{
+		  $u_new .= $row['thread_id'].".";
+		}
+		$u_new .= USERVIEWED;
+		$t = array_unique(explode('.',$u_new));		// Filter duplicates
+		$u_new = implode('.',$t);
+		$sql->db_Update("user", "user_viewed='{$u_new}' WHERE user_id=".USERID);
+		header("location:".e_SELF);
+		exit;
+	  }
+	}
 
 	function thread_markasread($thread_id)
 	{
 		global $sql;
 		$thread_id = intval($thread_id);
-		$u_new = USERVIEWED.".$thread_id";
-		return $sql->db_Update("user", "user_viewed='$u_new' WHERE user_id='".USERID."' ");
+		$u_new = USERVIEWED.".".$thread_id;
+		return $sql->db_Update("user", "user_viewed='$u_new' WHERE user_id=".USERID);
 	}
 
 	function forum_getparents()
 	{
 		global $sql;
-		if ($sql->db_Select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC"))
+		if ($sql->db_Select('forum', '*', "forum_parent=0 ORDER BY forum_order ASC"))
 		{
 			while ($row = $sql->db_Fetch()) {
 				$ret[] = $row;
@@ -230,6 +264,7 @@
 
 	function forum_newflag_list()
 	{
+	  if (!USER) return FALSE;		// Can't determine new threads for non-logged in users
 		global $sql;
 		$viewed = "";
 		if(USERVIEWED)
@@ -247,7 +282,7 @@
 		$_newqry = 	"
 		SELECT DISTINCT ff.forum_sub, ft.thread_forum_id FROM #forum_t AS ft
 		LEFT JOIN #forum AS ff ON ft.thread_forum_id = ff.forum_id
-		WHERE thread_parent = 0 AND thread_lastpost > '".USERLV."' {$viewed}
+		WHERE thread_parent = 0 AND thread_lastpost > ".USERLV." {$viewed}
 		";
 		if($sql->db_Select_gen($_newqry))
 		{
@@ -285,14 +320,14 @@
 		$thread_id = intval($thread_id);
 		global $sql;
 		$tmp = str_replace("-".$thread_id."-", "", USERREALM);
-		return $sql->db_Update("user", "user_realm='$tmp' WHERE user_id='".USERID."' ");
+		return $sql->db_Update("user", "user_realm='$tmp' WHERE user_id=".USERID);
 	}
 
 	function track($thread_id, $from)
 	{
 		$thread_id = intval($thread_id);
 		global $sql;
-		return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id='".USERID."' ");
+		return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id=".USERID);
 	}
 
 	function forum_get($forum_id)
@@ -400,7 +435,7 @@
 	function forum_get_topic_count($forum_id)
 	{
 		global $sql;
-		return $sql->db_Count("forum_t", "(*)", " WHERE thread_forum_id='".intval($forum_id)."' AND thread_parent='0' ");
+		return $sql->db_Count("forum_t", "(*)", " WHERE thread_forum_id=".intval($forum_id)." AND thread_parent=0 ");
 	}
 
 	function thread_getnext($thread_id, $forum_id, $from = 0, $limit = 100)
@@ -590,9 +625,9 @@
 
 	function thread_incview($thread_id)
 	{
-		$thread_id = intval($thread_id);
+		$thread_id = (int)$thread_id;
 		global $sql;
-		return $sql->db_Update("forum_t", "thread_views=thread_views+1 WHERE thread_id='$thread_id' ");
+		return $sql->db_Update("forum_t", "thread_views=thread_views+1 WHERE thread_id=".$thread_id);
 	}
 
 
@@ -647,10 +682,10 @@
 	function _forum_lp_update($lp_type, $lp_user, $lp_info, $lp_forum_id, $lp_forum_sub)
 	{
 		global $sql;
-		$sql->db_Update('forum', "{$lp_type}={$lp_type}+1, forum_lastpost_user='{$lp_user}', forum_lastpost_info = '{$lp_info}' WHERE forum_id='".intval($lp_forum_id)."' ");
+		$sql->db_Update('forum', "{$lp_type}={$lp_type}+1, forum_lastpost_user='{$lp_user}', forum_lastpost_info = '{$lp_info}' WHERE forum_id=".(int)$lp_forum_id);
 		if($lp_forum_sub)
 		{
-			$sql->db_Update('forum', "forum_lastpost_user = '{$lp_user}', forum_lastpost_info = '{$lp_info}' WHERE forum_id='".intval($lp_forum_sub)."' ");
+			$sql->db_Update('forum', "forum_lastpost_user = '{$lp_user}', forum_lastpost_info = '{$lp_info}' WHERE forum_id=".(int)$lp_forum_sub);
 		}
 	}
 
@@ -661,7 +696,7 @@
 		$forum_sub = intval($forum_sub);
 		$ip = $e107->getip();
 		//Check for duplicate post
-		if ($sql->db_Count('forum_t', '(*)', "WHERE thread_thread='$thread_thread' and thread_datestamp > ".($post_time - 180)))
+		if ($sql->db_Count('forum_t', '(*)', "WHERE thread_thread=".$thread_thread." and thread_datestamp > ".($post_time - 180)))
 		{
 			return -1;
 		}
@@ -687,7 +722,7 @@
 		if (USER)
 		{
 			$new_userviewed = USERVIEWED.".".($thread_parent ? intval($thread_parent) : $newthread_id);
-			$sql->db_Update('user', "user_forums=user_forums+1, user_viewed='{$new_userviewed}' WHERE user_id='".USERID."' ");
+			$sql->db_Update('user', "user_forums=user_forums+1, user_viewed='{$new_userviewed}' WHERE user_id=".USERID);
 		}
 
 		//If post is a reply
@@ -699,7 +734,7 @@
 			$this->_forum_lp_update("forum_replies", $post_user, $forum_lp_info, $thread_forum_id, $forum_sub);
 
 			// Update head post with last post info and increment reply count
-			$sql->db_Update('forum_t', "thread_lastpost={$post_time}, thread_lastuser='{$post_user}', thread_total_replies=thread_total_replies+1 WHERE thread_id = ".intval($thread_parent));
+			$sql->db_Update('forum_t', "thread_lastpost={$post_time}, thread_lastuser='{$post_user}', thread_total_replies=thread_total_replies+1 WHERE thread_id = ".(int)$thread_parent);
 
 			$parent_thread = $this->thread_get_postinfo($thread_parent);
 			global $PLUGINS_DIRECTORY;
@@ -711,26 +746,29 @@
 			{
 				$pref['forum_eprefix'] = "[forum]";
 			}
-			//   Send email to orinator of flagged
-			if ($parent_thread[0]['thread_active'] == 99 && $parent_thread[0]['user_id'] != USERID)
+			//   Send email to originator if 'notify' set
+			$email_addy = '';
+			if ($pref['email_notify'] && $parent_thread[0]['thread_active'] == 99 && $parent_thread[0]['user_id'] != USERID)
 			{
 				$gen = new convert;
 				$email_name = $parent_thread[0]['user_name'];
+				$email_addy = $parent_thread[0]['user_email'];
 				$message = LAN_384.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$email_post."<br /><br />". LAN_383."<br /><br />".$mail_link;
 				include_once(e_HANDLER."mail.php");
-				sendemail($parent_thread[0]['user_email'], $pref['forum_eprefix']." '".$thread_name."', ".LAN_381.SITENAME, $message);
+				sendemail($email_addy, $pref['forum_eprefix']." '".$thread_name."', ".LAN_381.SITENAME, $message, $email_name);
 			}
 
-			//   Send email to all users tracking thread
-			if ($sql->db_Select("user", "*", "user_realm REGEXP('-".intval($thread_parent)."-') "))
+
+			//   Send email to all users tracking thread - except the one that's just posted
+			if ($pref['forum_track'] && $sql->db_Select("user", "user_id, user_email, user_name", "user_realm REGEXP('-".intval($thread_parent)."-') "))
 			{
 				include_once(e_HANDLER.'mail.php');
 				$message = LAN_385.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$email_post."<br /><br />". LAN_383."<br /><br />".$mail_link;
 				while ($row = $sql->db_Fetch())
-				{
-					if ($row['user_email'])
+				{	// Don't sent to self, nor to originator of thread if they've got 'notify' set
+					if ($row['user_email'] && ($row['user_email'] != $email_addy) && ($row['user_id'] != USERID))	// (May be wrong, but this could be faster than filtering current user in the query)
 					{
-						sendemail($row['user_email'], $pref['forum_eprefix']." '".$thread_name."', ".LAN_381.SITENAME, $message);
+						sendemail($row['user_email'], $pref['forum_eprefix']." '".$thread_name."', ".LAN_381.SITENAME, $message, $row['user_name']);
 					}
 				}
 			}
@@ -792,11 +830,11 @@
 				foreach($threadList as $thread)
 				{
 					//Delete all replies
-					$reply_count += $sql->db_Delete("forum_t", "thread_parent='".intval($thread['thread_id'])."'");
+					$reply_count += $sql->db_Delete("forum_t", "thread_parent=".$thread['thread_id']);
 					//Delete thread
-					$thread_count += $sql->db_Delete("forum_t", "thread_id = '".intval($thread['thread_id'])."'");
+					$thread_count += $sql->db_Delete("forum_t", "thread_id = ".$thread['thread_id']);
 					//Delete poll if there is one
-					$sql->db_Delete("poll", "poll_datestamp='".intval($thread['thread_id'])."");
+					$sql->db_Delete("poll", "poll_datestamp=".$thread['thread_id']);
 				}
 				foreach($forumArray as $fid)
 				{
@@ -810,7 +848,7 @@
 				return FORLAN_9;
 			}
 		}
-		else
+		if($type == 'make_inactive')
 		{
 			$pruned = $sql->db_Update("forum_t", "thread_active=0 WHERE thread_lastpost < $prunedate AND thread_parent=0 AND thread_forum_id IN ({$forumList})");
 			return FORLAN_8." ".$pruned." ".FORLAN_91;
@@ -833,7 +871,7 @@
 		$forumID = intval($forumID);
 		$threads = $sql->db_Count("forum_t", "(*)", "WHERE thread_forum_id=$forumID AND thread_parent = 0");
 		$replies = $sql->db_Count("forum_t", "(*)", "WHERE thread_forum_id=$forumID AND thread_parent != 0");
-		$sql->db_Update("forum", "forum_threads='$threads', forum_replies='$replies' WHERE forum_id='$forumID'");
+		$sql->db_Update("forum", "forum_threads='$threads', forum_replies='$replies' WHERE forum_id=".$forumID);
 		if($recalc_threads == true)
 		{
 			$sql->db_Select("forum_t", "thread_parent, count(*) as replies", "thread_forum_id = $forumID GROUP BY thread_parent");
@@ -842,7 +880,7 @@
 			{
 				$tid = $t['thread_parent'];
 				$replies = intval($t['replies']);
-				$sql->db_Update("forum_t", "thread_total_replies='$replies' WHERE thread_id='$tid'");
+				$sql->db_Update("forum_t", "thread_total_replies='$replies' WHERE thread_id=".$tid);
 			}
 		}
 	}
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_conf.php 0.7.11.src/e107_plugins/forum/forum_conf.php
--- 0.7.7.src/e107_plugins/forum/forum_conf.php	2006-04-26 06:38:30.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/forum_conf.php	2007-09-26 14:28:41.000000000 -0500
@@ -11,9 +11,9 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_conf.php,v $
-| $Revision: 1.9 $
-| $Date: 2006/04/26 11:38:30 $
-| $Author: mcfly_e107 $
+| $Revision: 1.11 $
+| $Date: 2007/09/26 19:28:41 $
+| $Author: e107steved $
 +---------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -58,7 +58,7 @@
 	$thread_name = str_replace("[poll] ", "", $thread_name);
 	$sql->db_Update("forum_t", "thread_name='$thread_name' WHERE thread_id='$thread_id' ");
 	$message = FORLAN_5;
-	$url = e_PLUGIN."forum/forum_viewtopic.php?".$forum_id.".".$thread_id;
+	$url = e_PLUGIN."forum/forum_viewtopic.php?".$thread_id;
 }
 	
 if (isset($_POST['move']))
@@ -123,7 +123,7 @@
 		</form>
 		</div>";
 	$ns->tablerender(FORLAN_16, $text);
-	require_once("footer.php");
+	require_once(FOOTERF);
 	exit;
 }
 	
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_mod.php 0.7.11.src/e107_plugins/forum/forum_mod.php
--- 0.7.7.src/e107_plugins/forum/forum_mod.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_mod.php	2007-11-11 17:45:34.000000000 -0600
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_mod.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.13 $
+|     $Date: 2007/11/11 23:45:34 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 @include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php';
 @include_once e_PLUGIN.'forum/languages/English/lan_forum_admin.php';
-	
+
 function forum_thread_moderate($p)
 {
 	global $sql;
@@ -29,82 +29,103 @@
 		{
 			$act = $matches[1];
 			$id = intval($matches[2]);
-			 
+
 			switch($act)
 			{
 				case 'lock' :
-				$sql->db_Update("forum_t", "thread_active='0' WHERE thread_id='$id' ");
+				$sql->db_Update("forum_t", "thread_active=0 WHERE thread_id={$id}");
 				return FORLAN_CLOSE;
 				break;
-				 
+
 				case 'unlock' :
-				$sql->db_Update("forum_t", "thread_active='1' WHERE thread_id='$id' ");
+				$sql->db_Update("forum_t", "thread_active=1 WHERE thread_id={$id}");
 				return FORLAN_OPEN;
 				break;
-				 
+
 				case 'stick' :
-				$sql->db_Update("forum_t", "thread_s='1' WHERE thread_id='$id' ");
+				$sql->db_Update("forum_t", "thread_s=1 WHERE thread_id={$id}");
 				return FORLAN_STICK;
 				break;
-				 
+
 				case 'unstick' :
-				$sql->db_Update("forum_t", "thread_s='0' WHERE thread_id='$id' ");
+				$sql->db_Update("forum_t", "thread_s=0 WHERE thread_id={$id}");
 				return FORLAN_UNSTICK;
 				break;
-				 
+
 				case 'delete' :
 				return forum_delete_thread($id);
 				break;
-				 
+
 			}
 		}
 	}
 }
-	
+
 function forum_delete_thread($thread_id)
 {
 	global $sql;
-	@require_once(e_PLUGIN.'forum/forum_class.php');
+	$thread_id = (int)$thread_id;
+	require_once(e_PLUGIN.'forum/forum_class.php');
 	$f =& new e107forum;
-	$sql->db_Select("forum_t", "*", "thread_id='".intval($thread_id)."' ");
-	$row = $sql->db_Fetch();
-	 
-	if ($row['thread_parent'])
+	$qry = "
+	SELECT t.thread_forum_id, t.thread_parent, t.thread_user, f.forum_sub
+	FROM #forum_t AS t
+	LEFT JOIN #forum AS f ON t.thread_forum_id = f.forum_id
+	WHERE t.thread_id = ".$thread_id;
+//	$sql->db_Select("forum_t", "*", "thread_id=".(int)$thread_id);
+
+	if($sql->db_Select_gen($qry))
 	{
-		// post is a reply?
-		$sql->db_Delete("forum_t", "thread_id='".intval($thread_id)."' ");
-		// dec forum reply count by 1
-		$sql->db_Update("forum", "forum_replies=forum_replies-1 WHERE forum_id='".$row['thread_forum_id']."'");
-		// dec thread reply count by 1
-		$sql->db_Update("forum_t", "thread_total_replies=thread_total_replies-1 WHERE thread_id='".$row['thread_parent']."'");
-		// dec user forum post count by 1
-		$tmp = explode(".", $row['thread_user']);
-		$uid = intval($tmp[0]);
-		if($uid > 0)
+		$ret = "";
+		$row = $sql->db_Fetch();
+		if ($row['thread_parent'])
+		{
+			// post is a reply?
+			$sql->db_Delete("forum_t", "thread_id=".$thread_id);
+			// dec forum reply count by 1
+			$sql->db_Update("forum", "forum_replies=forum_replies-1 WHERE forum_id={$row['thread_forum_id']} AND forum_replies>0");
+			// dec thread reply count by 1
+			$sql->db_Update("forum_t", "thread_total_replies=thread_total_replies-1 WHERE thread_id={$row['thread_parent']} AND thread_total_replies>0");
+			// dec user forum post count by 1
+			$tmp = explode(".", $row['thread_user']);
+			$uid = intval($tmp[0]);
+			if($uid > 0)
+			{
+				$sql->db_Update("user", "user_forums=user_forums-1 WHERE user_id='".$uid."' AND user_forums>0");
+			}
+			// update lastpost info
+			$f->update_lastpost('thread', $row['thread_parent']);
+			$f->update_lastpost('forum', $row['thread_forum_id']);
+			$ret = FORLAN_154;
+		}
+		else
+		{
+			// post is thread
+			// delete poll if there is one
+			$sql->db_Delete("poll", "poll_datestamp=".$thread_id);
+			//decrement user post counts
+			forum_userpost_count("WHERE thread_id = ".$thread_id." OR thread_parent = ".$thread_id, "dec");
+			// delete replies and grab how many there were
+			$count = $sql->db_Delete("forum_t", "thread_parent=".$thread_id);
+			// delete the post itself
+			$sql->db_Delete("forum_t", "thread_id=".$thread_id);
+			// update thread/reply counts
+			$sql->db_Update("forum", "forum_threads = CAST(GREATEST(CAST(forum_threads AS SIGNED) - 1, 0) AS UNSIGNED), forum_threads = CAST(GREATEST(CAST(forum_replies AS SIGNED) - {$count}, 0) AS UNSIGNED) WHERE forum_id=".$row['thread_forum_id']);
+
+			// update lastpost info
+			$f->update_lastpost('forum', $row['thread_forum_id']);
+			$ret = FORLAN_6.($count ? ", ".$count." ".FORLAN_7."." : ".");
+		}
+
+		//If parent forum is a sub, we must update lastpost info of it's parent
+		if($row['forum_sub'])
 		{
-			$sql->db_Update("user", "user_forums=user_forums-1 WHERE user_id='".$uid."'");
+			//Update just the parent itself, if it's a container it will empty everything
+			$f->update_lastpost('forum', $row['forum_sub']);
+			//Update the parent with last post of either itself or it's subs
+			$f->update_subparent_lp($row['forum_sub']);
 		}
-		// update lastpost info
-		$f->update_lastpost('thread', $row['thread_parent']);
-		$f->update_lastpost('forum', $row['thread_forum_id']);
-		return FORLAN_154;
-	}
-	else
-	{
-		// post is thread
-		// delete poll if there is one
-		$sql->db_Delete("poll", "poll_datestamp='".intval($thread_id)."'");
-		//decrement user post counts
-		forum_userpost_count("WHERE thread_id = '".intval($thread_id)."' OR thread_parent = '".intval($thread_id)."'", "dec");
-		// delete replies and grab how many there were
-		$count = $sql->db_Delete("forum_t", "thread_parent='".intval($thread_id)."'");
-		// delete the post itself
-		$sql->db_Delete("forum_t", "thread_id='".intval($thread_id)."'");
-		// update thread/reply counts
-		$sql->db_Update("forum", "forum_threads=forum_threads-1, forum_replies=forum_replies-$count WHERE forum_id='".$row['thread_forum_id']."'");
-		// update lastpost info
-		$f->update_lastpost('forum', $row['thread_forum_id']);
-		return FORLAN_6.($count ? ", ".$count." ".FORLAN_7."." : ".");
+		return $ret;
 	}
 }
 
@@ -113,7 +134,7 @@
 	global $sql;
 
 	$qry = "
-	SELECT thread_user, count(thread_user) AS cnt FROM #forum_t 
+	SELECT thread_user, count(thread_user) AS cnt FROM #forum_t
 	{$where}
 	GROUP BY thread_user
 	";
@@ -129,14 +150,13 @@
 			{
 				if("set" == $type)
 				{
-					$sql->db_Update("user", "user_forums={$u['cnt']} WHERE user_id='".$uid."'");
+					$sql->db_Update("user", "user_forums={$u['cnt']} WHERE user_id=".$uid);
 				}
 				else
-				{
-					$sql->db_Update("user", "user_forums=user_forums-{$u['cnt']} WHERE user_id='".$uid."'");
+				{	// user_forums is unsigned, so underflow will give a very big number
+					$sql->db_Update("user", "user_forums = CAST(GREATEST(CAST(user_forums AS SIGNED) - {$u['cnt']}, 0) AS UNSIGNED) WHERE user_id=".$uid);
 				}
 			}
 		}
 	}
 }
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_post.php 0.7.11.src/e107_plugins/forum/forum_post.php
--- 0.7.7.src/e107_plugins/forum/forum_post.php	2006-11-27 07:37:26.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_post.php	2007-12-19 14:12:36.000000000 -0600
@@ -11,14 +11,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_post.php,v $
-|     $Revision: 1.70 $
-|     $Date: 2006/11/27 13:37:26 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.86 $
+|     $Date: 2007/12/19 20:12:36 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../../class2.php");
-$WYSIWYG = $pref['wysiwyg'];
 $e_wysiwyg = "post";
 $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php';
 include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_post.php');
@@ -45,7 +44,14 @@
 {
 	// reply to thread
 	$thread_info = $forum->thread_get($id, 'last', 11);
-	$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
+	if (!is_array($thread_info) || !count($thread_info))
+	{
+	  $forum_info = FALSE;		// Someone fed us a dud forum id - should exist if replying
+	}
+	else
+	{
+	  $forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
+	}
 }
 elseif ($action == 'nt')
 {
@@ -62,7 +68,7 @@
 	}
 }
 
-if (!check_class($forum_info['forum_postclass']) || !check_class($forum_info['parent_postclass'])) {
+if (($forum_info === FALSE) || !check_class($forum_info['forum_postclass']) || !check_class($forum_info['parent_postclass'])) {
 	require_once(HEADERF);
 	$ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
 	require_once(FOOTERF);
@@ -335,10 +341,7 @@
 		$newvals['thread_edit_datestamp'] = time();
 		$newvals['thread_thread'] = $_POST['post'];
 		$newvals['thread_name'] = $_POST['subject'];
-		if(isset($_POST['email_notify']))
-		{
-			$newvals['thread_active'] = '99';
-		}
+		$newvals['thread_active'] = (isset($_POST['email_notify'])) ? '99' : '1';	// Always set in case it's changed
 		if (isset($_POST['threadtype']) && MODERATOR)
 		{
 			$newvals['thread_s'] = $_POST['threadtype'];
@@ -429,29 +432,39 @@
 // -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 //Load forumpost template
 
-if (!$FORUMPOST) {
-	if (is_readable(THEME."forum_post_template.php")) {
-		include_once(THEME."forum_post_template.php");
-	}
+if (!$FORUMPOST)
+{
+  if (is_readable(THEME."forum_post_template.php"))
+  {
+    include_once(THEME."forum_post_template.php");
+  }
+  else
+  {
+  include_once(e_PLUGIN."forum/templates/forum_post_template.php");
+  }
 }
-include_once(e_PLUGIN."forum/templates/forum_post_template.php");
-
 /* check post access (bugtracker #1424) */
 
-if($action == "rp" && !$sql -> db_Select("forum_t", "*", "thread_id='$id'"))
+if($action == "rp" && !$sql -> db_Select("forum_t", "*", "thread_id='{$id}'"))
 {
 	$ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
 	 require_once(FOOTERF);
 	exit;
 }
-else if($action == "nt" && !$sact && !$sql -> db_Select("forum", "*", "forum_id='$id'"))
+elseif($action == "nt")
 {
-	 $ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
-	 require_once(FOOTERF);
+  if (!$sact && !$sql -> db_Select("forum", "*", "forum_id='{$id}'"))
+  {
+	$ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
+	require_once(FOOTERF);
 	exit;
+  }
 }
 else
 {
+  // DB access should pass - after all, the thread should exist
+	$sql->db_Select_gen("SELECT t.*, p.forum_postclass FROM #forum_t AS t 
+	LEFT JOIN #forum AS p ON t.thread_forum_id=p.forum_id WHERE thread_id='{$id}'");
 	$fpr = $sql -> db_Fetch();
 	if(!check_class($fpr['forum_postclass']))
 	{
@@ -566,7 +579,7 @@
 
 function process_upload()
 {
-	global $pref, $forum_info, $thread_info;
+	global $pref, $forum_info, $thread_info, $admin_log;
 
 	if(isset($thread_info['head']['thread_id']))
 	{
@@ -577,13 +590,16 @@
 		$tid = 0;
 	}
 
-	if (isset($_FILES['file_userfile']['error']) && $_FILES['file_userfile']['error'] != 4)
+	if (isset($_FILES['file_userfile']['error']))
 	{
 		require_once(e_HANDLER."upload_handler.php");
 		if ($uploaded = file_upload('/'.e_FILE."public/", "attachment", "FT{$tid}_"))
 		{
 			foreach($uploaded as $upload)
 			{
+			  if ($upload['error'] == 0)
+			  {
+				$fpath = "{e_FILE}public/";
 				if(strstr($upload['type'], "image"))
 				{
 					if(isset($pref['forum_maxwidth']) && $pref['forum_maxwidth'] > 0)
@@ -592,12 +608,11 @@
 						$orig_file = $upload['name'];
 						$p = strrpos($orig_file,'.');
 						$new_file = substr($orig_file, 0 , $p)."_".substr($orig_file, $p);
-						$fpath = e_FILE."public/";
-						if(resize_image($fpath.$orig_file, $fpath.$new_file, $pref['forum_maxwidth']))
+						if(resize_image(e_FILE.'public/'.$orig_file, e_FILE.'public/'.$new_file, $pref['forum_maxwidth']))
 						{
 							if($pref['forum_linkimg'])
 							{
-								$parms = image_getsize($fpath.$new_file);
+								$parms = image_getsize(e_FILE.'public/'.$new_file);
 								$_POST['post'] .= "[br][link=".$fpath.$orig_file."][img{$parms}]".$fpath.$new_file."[/img][/link][br]";
 								//show resized, link to fullsize
 							}
@@ -605,31 +620,33 @@
 							{
 								@unlink($fpath.$orig_file);
 								//show resized
-								$parms = image_getsize($fpath.$new_file);
+								$parms = image_getsize(e_FILE.'public/'.$new_file);
 								$_POST['post'] .= "[br][img{$parms}]".$fpath.$new_file."[/img][br]";
 							}
 						}
 						else
-						{
-							//resize failed, show original
-							$parms = image_getsize(e_FILE."public/".$upload['name']);
-							$_POST['post'] .= "[br][img{$parms}]".e_FILE."public/".$upload['name']."[/img]";
+						{	//resize failed, show original
+							$parms = image_getsize(e_FILE.'public/'.$upload['name']);
+							$_POST['post'] .= "[br][img{$parms}]".$fpath.$upload['name']."[/img]";
 						}
 					}
 					else
-					{
-						$parms = image_getsize(e_FILE."public/".$upload['name']);
+					{	//resizing disabled, show original
+						$parms = image_getsize(e_FILE.'public/'.$upload['name']);
 						//resizing disabled, show original
-						$_POST['post'] .= "[br]<div class='spacer'>[img{$parms}]".e_FILE."public/".$upload['name']."[/img]</div>\n";
+						$_POST['post'] .= "[br]<div class='spacer'>[img{$parms}]".$fpath.$upload['name']."[/img]</div>\n";
 					}
 				}
 				else
 				{
 					//upload was not an image, link to file
-					//echo "<pre>"; print_r($upload); echo "</pre>";
-					$_POST['post'] .= "[br][file=".e_FILE."public/".$upload['name']."]".$upload['name']."[/file]";
+					$_POST['post'] .= "[br][file=".$fpath.$upload['name']."]".(isset($upload['rawname']) ? $upload['rawname'] : $upload['name'])."[/file]";
 				}
-
+			  }
+			  else
+			  {  // Error in uploaded file
+			    echo "Error in uploaded file: ".(isset($upload['rawname']) ? $upload['rawname'] : $upload['name'])."<br />";
+			  }
 			}
 		}
 	}
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_post_shortcodes.php 0.7.11.src/e107_plugins/forum/forum_post_shortcodes.php
--- 0.7.7.src/e107_plugins/forum/forum_post_shortcodes.php	2006-11-09 10:55:31.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_post_shortcodes.php	2007-09-22 13:08:31.000000000 -0500
@@ -17,6 +17,11 @@
 return $txt;
 SC_END
 
+
+SC_BEGIN LATESTPOSTSCOUNT
+  return;			// Null return as placeholder
+SC_END
+
 SC_BEGIN THREADTOPIC
 global $thread_info, $action, $gen, $tp, $post_info, $forum_shortcodes, $THREADTOPIC_REPLY;
 $post_info = $thread_info['head'];
@@ -117,7 +122,7 @@
 
 SC_BEGIN EMAILNOTIFY
 global $pref, $thread_info, $action;
-if ($pref['email_notify'] && $action == "nt")
+if ($pref['email_notify'] && $action == "nt" && USER)
 {
 	if(isset($_POST['fpreview']))
 	{
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_shortcodes.php 0.7.11.src/e107_plugins/forum/forum_shortcodes.php
--- 0.7.7.src/e107_plugins/forum/forum_shortcodes.php	2006-11-17 06:55:40.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_shortcodes.php	2007-10-27 15:19:27.000000000 -0500
@@ -22,7 +22,7 @@
 SC_BEGIN POST
 global $post_info, $tp, $iphost;
 $ret = "";
-$ret = $tp->toHTML($post_info["thread_thread"], TRUE, "", 'class:'.$post_info["user_class"]);
+$ret = $tp->toHTML($post_info["thread_thread"], TRUE, "USER_BODY", 'class:'.$post_info["user_class"]);
 if (ADMIN && $iphost) {
 $ret .= "<br />".$iphost;
 }
@@ -30,8 +30,9 @@
 SC_END
 	
 SC_BEGIN PRIVMESSAGE
-global $post_info, $tp;
-if($post_info['user_id'] > 0){
+global $pref, $post_info, $tp;
+if(isset($pref['plug_installed']['pm']) && ($post_info['user_id'] > 0))
+{
 	return $tp->parseTemplate("{SENDPM={$post_info['user_id']}}");
 }
 SC_END
@@ -82,12 +83,12 @@
 SC_END
 	
 SC_BEGIN EMAILIMG
-global $post_info, $tp;
-if($post_info['user_id'])
+global $post_info;
+if(USER && $post_info['user_id'] && !$post_info['user_hideemail'])
 {
-	return (!$post_info['user_hideemail'] ? $tp->parseTemplate("{EMAILTO={$post_info['user_email']}}") : "");
+	return "<a href='mailto:{$post_info['user_email']}'>".IMAGE_email."</a>";
 }
-return "";
+return '';
 SC_END
 	
 SC_BEGIN EMAILITEM
@@ -251,5 +252,10 @@
 return $pollstr;
 SC_END
 
+SC_BEGIN NEWFLAG
+// Defined in case an indicator is required
+return '';
+SC_END
+
 */
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_stats.php 0.7.11.src/e107_plugins/forum/forum_stats.php
--- 0.7.7.src/e107_plugins/forum/forum_stats.php	2006-10-26 08:10:01.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/forum_stats.php	2007-02-27 14:26:07.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_stats.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2006/10/26 13:10:01 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.15 $
+|     $Date: 2007/02/27 20:26:07 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -33,7 +33,14 @@
 $total_posts = $sql -> db_Count("forum_t");
 $total_topics = $sql -> db_Count("forum_t", "(*)", "WHERE thread_parent=0");
 $total_replies = $sql -> db_Count("forum_t", "(*)", "WHERE thread_parent!=0");
-$total_views = $sql->db_Count("SELECT sum(thread_views) FROM ".MPREFIX."forum_t", "generic");
+$total_views = 0;
+$query = "SELECT sum(thread_views) AS total FROM #forum_t ";		// Try this way - original way didn't work for some users
+if ($sql -> db_Select_gen($query))
+//if($sql->db_Select("forum_t", "sum(thread_views) AS total", '', 'nowhere'))
+{
+  $row = $sql->db_Fetch();
+  $total_views = $row['total'];
+}
 
 $firstpost = $sql -> db_Select("forum_t", "thread_datestamp", "thread_datestamp > 0 ORDER BY thread_datestamp ASC LIMIT 0,1");
 $fp = $sql -> db_Fetch();
@@ -44,9 +51,14 @@
 $open_days = floor((time()-$open_ds) / 86400);
 $postsperday = ($open_days < 1 ? $total_posts : round($total_posts / $open_days));
 
-$query = "SHOW TABLE STATUS FROM $mySQLdefaultdb";
+
+//$query = "SHOW TABLE STATUS FROM {$mySQLdefaultdb}";		// Original line - doesn't like DB names with a '-' - enclose in backticks
+//$query = "SHOW TABLE STATUS FROM `{$sql->mySQLdefaultdb}` LIKE '".MPREFIX."forum_t"."' ";	// This selects the one table we want (but didn't always work)
+$query = "SHOW TABLE STATUS FROM `{$mySQLdefaultdb}`";		// Original line with backticks added
 $sql -> db_Select_gen($query);
 $array = $sql -> db_getList();
+//$table = $sql -> db_Fetch();
+//echo $query."<br />Elements: ".count($array)."<br />";
 foreach($array as $table)
 {
 	if($table['Name'] == MPREFIX."forum_t")
@@ -134,15 +146,15 @@
 <tr>
 <td class='forumheader3'>
 	<table style='width: 100%;'>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_2.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$open_date</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_3.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$open_since</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_4.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$total_posts</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_5.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$total_topics</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_6.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$total_replies</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_7.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$total_views</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_24.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$postsperday</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_8.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$db_size</td></tr>
-	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_9.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>$avg_row_len</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_2.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$open_date}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_3.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$open_since}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_4.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_posts}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_5.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_topics}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_6.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_replies}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_7.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$total_views}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_24.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$postsperday}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_8.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$db_size}</td></tr>
+	<tr><td style='width: 50%; text-align: right;'><b>".FSLAN_9.":</b>&nbsp;&nbsp;</td><td style='width: 50%;'>{$avg_row_len}</td></tr>
 
 	</tr>
 	</table>
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_uploads.php 0.7.11.src/e107_plugins/forum/forum_uploads.php
--- 0.7.7.src/e107_plugins/forum/forum_uploads.php	2006-10-21 06:22:30.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/forum_uploads.php	2007-01-17 14:47:24.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_uploads.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/10/21 11:22:30 $
-|     $Author: mrpete $
+|     $Revision: 1.4 $
+|     $Date: 2007/01/17 20:47:24 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -119,3 +119,4 @@
 $ns->tablerender(FRMUP_1, $txt);
 include_once(FOOTERF);
 
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/forum_viewforum.php 0.7.11.src/e107_plugins/forum/forum_viewforum.php
--- 0.7.7.src/e107_plugins/forum/forum_viewforum.php	2006-11-11 23:47:19.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/forum_viewforum.php	2007-09-26 14:35:53.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_viewforum.php,v $
-|     $Revision: 1.61 $
-|     $Date: 2006/11/12 05:47:19 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.66 $
+|     $Date: 2007/09/26 19:35:53 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,8 +28,7 @@
 
 if (!e_QUERY)
 {
-	header("Location:".e_PLUGIN."/forum/forum.php");
-	exit;
+	js_location(e_PLUGIN."forum/forum.php");
 }
 else
 {
@@ -121,7 +120,7 @@
 	if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== FALSE || strpos($FORUM_VIEW_END, 'THREADPAGES') !== FALSE)
 	{
 		$parms = "{$topics},{$view},{$thread_from},".e_SELF.'?'.$forum_id.'.[FROM],off';
-		$THREADPAGES = LAN_316." ".$tp->parseTemplate("{NEXTPREV={$parms}}");
+		$THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
 	}
 }
 
@@ -155,23 +154,23 @@
 $ICONKEY = "
 	<table style='width:100%'>
 	<tr>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_new_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_79."</td>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_nonew_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_80."</td>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_sticky_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_sticky_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_202."</td>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_announce_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_announce_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_396."</td>
 	</tr>
 	<tr>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_new_popular_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_new_popular_small."</td>
 	<td style='width:2%' class='smallblacktext'>".LAN_79." ".LAN_395."</td>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_nonew_popular_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_nonew_popular_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_80." ".LAN_395."</td>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_stickyclosed_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_stickyclosed_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_203."</td>
-	<td style='vertical-align:center; text-align:center; width:2%'>".IMAGE_closed_small."</td>
+	<td style='vertical-align:middle; text-align:center; width:2%'>".IMAGE_closed_small."</td>
 	<td style='width:10%' class='smallblacktext'>".LAN_81."</td>
 	</tr>
 	</table>";
@@ -300,7 +299,7 @@
 
 function parse_thread($thread_info)
 {
-	global $forum, $tp, $FORUM_VIEW_FORUM, $gen, $pref, $forum_id, $menu_pref;
+	global $forum, $tp, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $pref, $forum_id, $menu_pref;
 	$text = "";
 	$VIEWS = $thread_info['thread_views'];
 	$REPLIES = $thread_info['thread_total_replies'];
@@ -327,11 +326,6 @@
 		}
 		$LASTPOST .= "<br />".$lastpost_datestamp;
 	}
-	else
-	{
-		$REPLIES = LAN_317;
-		$LASTPOST = " - ";
-	}
 
 	$newflag = FALSE;
 	if (USER)
@@ -344,8 +338,9 @@
 
 	$THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
 	$ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
-	if ($REPLIES >= $pref['forum_popular'] && $REPLIES != "None") {
-		$ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
+	if ($REPLIES >= $pref['forum_popular']) 
+	{
+	  $ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
 	}
 
 	$THREADTYPE = '';
@@ -463,6 +458,12 @@
 		return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM_ANNOUNCE));
 	}
 
+	if (!$REPLIES)
+	{
+		$REPLIES = LAN_317;		// 'None' 
+		$LASTPOST = " - ";
+	}
+
 	return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM));
 }
 
@@ -487,10 +488,10 @@
 		$tmp = explode(".", $subInfo['forum_lastpost_info']);
 		$lp_thread = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?{$tmp[1]}.last'>".IMAGE_post2."</a>";
 		$lp_date = $gen->convert_date($tmp[0], 'forum');
-		$tmp = explode(".", $subInfo['forum_lastpost_user']);
+		$tmp = explode(".", $subInfo['forum_lastpost_user'],2);
 		if($subInfo['user_name'])
 		{
-			$lp_name = "<a href='".e_BASE."user.php?{$tmp[0]}'>{$subInfo['user_name']}</a>";
+			$lp_name = "<a href='".e_BASE."user.php?id.{$tmp[0]}'>{$subInfo['user_name']}</a>";
 		}
 		else
 		{
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/languages/English/lan_forum.php 0.7.11.src/e107_plugins/forum/languages/English/lan_forum.php
--- 0.7.7.src/e107_plugins/forum/languages/English/lan_forum.php	2005-05-22 09:30:21.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/languages/English/lan_forum.php	2007-11-24 09:10:42.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/05/22 14:30:21 $
-|     $Author: stevedunstan $
+|     $Revision: 1.8 $
+|     $Date: 2007/11/24 15:10:42 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("e_PAGETITLE", "Forum");
@@ -60,7 +60,7 @@
 	
 define("LAN_403", "No posts yet");
 define("LAN_404", "posts");
-define("LAN_405", "Read Only");
+define("LAN_405", "Restricted Access");
 	
 define("LAN_406", "This forum is restricted to administrators only");
 define("LAN_407", "This forum is restricted to members only");
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/languages/English/lan_forum_admin.php 0.7.11.src/e107_plugins/forum/languages/English/lan_forum_admin.php
--- 0.7.7.src/e107_plugins/forum/languages/English/lan_forum_admin.php	2006-11-14 19:06:17.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/languages/English/lan_forum_admin.php	2007-03-03 22:04:39.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_admin.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2006/11/15 01:06:17 $
+|     $Revision: 1.23 $
+|     $Date: 2007/03/04 04:04:39 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -74,6 +74,7 @@
 define("FORLAN_63", "Ranks");
 define("FORLAN_64", "Enter your levels here, if left blank generic stars will be used to denote level. Separate levels with comma. Maximum of 10 levels, lowest first.");
 define("FORLAN_65", "Forum Title");
+define("FORLAN_66", "Poll plugin not installed");
 
 define("FORLAN_70", "Enable file / image attachments");
 define("FORLAN_71", "Allow users to upload file or image with their forum post,");
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/languages/English/lan_forum_post.php 0.7.11.src/e107_plugins/forum/languages/English/lan_forum_post.php
--- 0.7.7.src/e107_plugins/forum/languages/English/lan_forum_post.php	2006-08-26 21:24:45.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/languages/English/lan_forum_post.php	2007-08-11 10:10:57.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_post.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/08/27 02:24:45 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.12 $
+|     $Date: 2007/08/11 15:10:57 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Forum");
@@ -76,7 +76,7 @@
 define("LAN_393", "<b>Please note</b><br />Allowed file types:");
 define("LAN_394", "Any other file types uploaded will be instantly deleted.");
 define("LAN_395", "Maximum file size");
-define("LAN_396", "bytes");
+define("LAN_396", " bytes");
 define("LAN_397", "This thread is locked.");
 define("LAN_398", "This forum is read only");
 define("LAN_399", "You are not authorized to post to this forum.");
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/languages/English/lan_newforumposts_menu.php 0.7.11.src/e107_plugins/forum/languages/English/lan_newforumposts_menu.php
--- 0.7.7.src/e107_plugins/forum/languages/English/lan_newforumposts_menu.php	2005-11-14 14:43:58.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/languages/English/lan_newforumposts_menu.php	2007-05-27 14:25:00.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_newforumposts_menu.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/11/14 20:43:58 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2007/05/27 19:25:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 	
@@ -28,5 +28,7 @@
 define("NFP_9", "Update menu Settings");
 define("NFP_10", "New Forum Posts Menu Configuration");
 define("NFP_11", "Posted by");
+define("NFP_12", "Maximum age of displayed posts");
+define("NFP_13", "Use zero on a quiet site; setting a value in days will reduce database time on a busy site");
 	
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/newforumposts_menu.php 0.7.11.src/e107_plugins/forum/newforumposts_menu.php
--- 0.7.7.src/e107_plugins/forum/newforumposts_menu.php	2006-08-26 21:24:45.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/newforumposts_menu.php	2007-10-08 16:02:52.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/newforumposts_menu.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/08/27 02:24:45 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.21 $
+|     $Date: 2007/10/08 21:02:52 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -30,16 +30,20 @@
 	include_once(e_PLUGIN."forum/languages/English/lan_newforumposts_menu.php");
 }
 
+$max_age = varset($menu_pref['newforumposts_maxage'],0);
+$max_age = $max_age == 0 ? '' : "(t.thread_datestamp > ".intval(time()-$max_age*86400).") AND ";
 $query2 = "
-SELECT tp.thread_name AS parent_name, t.thread_datestamp , t.thread_thread, t.thread_name, t.thread_id, t.thread_user, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class FROM #forum_t AS t
+SELECT tp.thread_name AS parent_name, 
+t.thread_datestamp , t.thread_thread, t.thread_name, t.thread_id, t.thread_user, 
+f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class FROM #forum_t AS t 
 LEFT JOIN #user AS u ON t.thread_user = u.user_id
 LEFT JOIN #forum_t AS tp ON t.thread_parent = tp.thread_id
-LEFT JOIN #forum AS f ON (f.forum_id = t.thread_forum_id
-AND f.forum_class IN (".USERCLASS_LIST."))
+LEFT JOIN #forum AS f ON (f.forum_id = t.thread_forum_id AND f.forum_class IN (".USERCLASS_LIST."))
 LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
-WHERE fp.forum_class IN (".USERCLASS_LIST.")
+WHERE {$max_age} fp.forum_class IN (".USERCLASS_LIST.")
 ORDER BY t.thread_datestamp DESC LIMIT 0, ".$menu_pref['newforumposts_display'];
 
+
 $results = $sql->db_Select_gen($query2);
 
 if(!$results)
@@ -78,18 +82,15 @@
 
 		$fi['thread_thread'] = strip_tags($tp->toHTML($fi['thread_thread'], TRUE, "emotes_off, no_make_clickable", "", $pref['menu_wordwrap']));
 
-		if (strlen($fi['thread_thread']) > $menu_pref['newforumposts_characters'])
-		{
-			$fi['thread_thread'] = substr($fi['thread_thread'], 0, $menu_pref['newforumposts_characters']).$menu_pref['newforumposts_postfix'];
-		}
+		$fi['thread_thread'] = $tp->text_truncate($fi['thread_thread'], $menu_pref['newforumposts_characters'], $menu_pref['newforumposts_postfix']);
 
 		if ($menu_pref['newforumposts_title'])
 		{
-			$text .= "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' /> <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".$topic."</a><br />".$fi['thread_thread']."<br />".NFP_11." ".$poster."<br />".$datestamp."<br/><br />";
+			$text .= "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' /> <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".$topic."</a><br />".$fi['thread_thread']."<br />".NFP_11." ".$poster."<br />".$datestamp."<br/><br />";
 		}
 		else
 		{
-			$text .= "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' /> <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".NFP_11." ".$poster."</a><br />".$fi['thread_thread']."<br />".$datestamp."<br/><br />";
+			$text .= "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' /> <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".NFP_11." ".$poster."</a><br />".$fi['thread_thread']."<br />".$datestamp."<br/><br />";
 		}
 	}
 }
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/newforumposts_menu_config.php 0.7.11.src/e107_plugins/forum/newforumposts_menu_config.php
--- 0.7.7.src/e107_plugins/forum/newforumposts_menu_config.php	2005-09-04 22:23:13.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/newforumposts_menu_config.php	2007-05-27 14:25:00.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/newforumposts_menu_config.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/09/05 03:23:13 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.2 $
+|     $Date: 2007/05/27 19:25:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
@@ -40,44 +40,58 @@
 	$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' ");
 	$ns->tablerender("", "<div style=\"text-align:center\"><b>".NFP_3."</b></div>");
 }
-	
+
+$menu_pref['newforumposts_maxage'] = varset($menu_pref['newforumposts_maxage'],0);
+
 $text = "<div style='text-align:center'>
 	<form method=\"post\" action=\"".e_SELF."?".e_QUERY."\" name=\"menu_conf_form\">
-	<table style=\"width:85%\" class=\"fborder\">
-	 
+	<table style='width:85%' class=\"fborder\">
+	<colgroup>
+	  <col style='width:40%;' />
+	  <col style='width:60%;' />
+	</colgroup>
 	<tr>
-	<td style=\"width:40%\" class='forumheader3'>".NFP_4.": </td>
-	<td style=\"width:60%\" class='forumheader3'>
+	<td class='forumheader3'>".NFP_4.": </td>
+	<td class='forumheader3'>
 	<input class=\"tbox\" type=\"text\" name=\"newforumposts_caption\" size=\"20\" value=\"".$menu_pref['newforumposts_caption']."\" maxlength=\"100\" />
 	</td>
 	</tr>
 	 
 	<tr>
-	<td style=\"width:40%\" class='forumheader3'>".NFP_5.":
+	<td class='forumheader3'>".NFP_5.":
 	</td>
-	<td style=\"width:60%\" class='forumheader3'>
+	<td class='forumheader3'>
 	<input class=\"tbox\" type=\"text\" name=\"newforumposts_display\" size=\"20\" value=\"".$menu_pref['newforumposts_display']."\" maxlength=\"2\" />
 	</td>
 	</tr>
 	 
 	<tr>
-	<td style=\"width:40%\" class='forumheader3'>".NFP_6.": </td>
-	<td style=\"width:60%\" class='forumheader3'>
+	<td class='forumheader3'>".NFP_12.":
+	</td>
+	<td class='forumheader3'>
+	<input class=\"tbox\" type=\"text\" name='newforumposts_maxage' size='20' value='".$menu_pref['newforumposts_maxage']."' maxlength='3' /><br />
+	<span class='smalltext'><em>".NFP_13."</em></span>
+	</td>
+	</tr>
+	 
+	<tr>
+	<td class='forumheader3'>".NFP_6.": </td>
+	<td class='forumheader3'>
 	<input class=\"tbox\" type=\"text\" name=\"newforumposts_characters\" size=\"20\" value=\"".$menu_pref['newforumposts_characters']."\" maxlength=\"4\" />
 	</td>
 	</tr>
 	 
 	<tr>
-	<td style=\"width:40%\" class='forumheader3'>".NFP_7.":
+	<td class='forumheader3'>".NFP_7.":
 	</td>
-	<td style=\"width:60%\" class='forumheader3'>
+	<td class='forumheader3'>
 	<input class=\"tbox\" type=\"text\" name=\"newforumposts_postfix\" size=\"30\" value=\"".$menu_pref['newforumposts_postfix']."\" maxlength=\"200\" />
 	</td>
 	</tr>
 	 
 	<tr>
-	<td style=\"width:40%\" class='forumheader3'>".NFP_8.":</td>
-	<td style=\"width:60%\" class='forumheader3'>
+	<td class='forumheader3'>".NFP_8.":</td>
+	<td class='forumheader3'>
 	<input type=\"checkbox\" name=\"newforumposts_title\" value=\"1\" ";
 if ($menu_pref['newforumposts_title']) {
 	$text .= " checked ";
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/templates/forum_icons_template.php 0.7.11.src/e107_plugins/forum/templates/forum_icons_template.php
--- 0.7.7.src/e107_plugins/forum/templates/forum_icons_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/templates/forum_icons_template.php	2007-03-04 10:59:25.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_icons_template.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2007/03/04 16:59:25 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 	
@@ -33,7 +33,7 @@
 define("IMAGE_nonew_popular_small", "<img src='".img_path('nonew_popular_small.png')."' alt='".FORLAN_14."' title='".FORLAN_14."' style='border:0' />");
 define("IMAGE_sticky", "<img src='".img_path('sticky.png')."' alt='".FORLAN_15."' title='".FORLAN_15."' style='border:0' />");
 define("IMAGE_stickyclosed", "<img src='".img_path('sticky_closed.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
-define("IMAGE_sticky_small", "<img src='".img_path('sticky_small.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
+define("IMAGE_sticky_small", "<img src='".img_path('sticky_small.png')."' alt='".FORLAN_15."' title='".FORLAN_15."' style='border:0' />");
 define("IMAGE_stickyclosed_small", "<img src='".img_path('sticky_closed_small.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
 define("IMAGE_announce", "<img src='".img_path('announce.png')."' alt='".FORLAN_17."' title='".FORLAN_17."' style='border:0' />");
 define("IMAGE_announce_small", "<img src='".img_path('announce_small.png')."' alt='".FORLAN_17."' title='".FORLAN_17."' style='border:0' />");
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/templates/forum_posted_template.php 0.7.11.src/e107_plugins/forum/templates/forum_posted_template.php
--- 0.7.7.src/e107_plugins/forum/templates/forum_posted_template.php	2006-07-16 16:57:03.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/templates/forum_posted_template.php	2006-12-24 07:53:52.000000000 -0600
@@ -21,8 +21,8 @@
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_413."<br />
 <span class='defaulttext'><a class='forumlink' href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id."'>".LAN_414."</a><br />
 <a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
@@ -33,8 +33,8 @@
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_324."<br />
 ".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
@@ -47,8 +47,8 @@
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_415."<br />
 ".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/templates/forum_viewforum_template.php 0.7.11.src/e107_plugins/forum/templates/forum_viewforum_template.php
--- 0.7.7.src/e107_plugins/forum/templates/forum_viewforum_template.php	2006-08-09 08:46:16.000000000 -0500
+++ 0.7.11.src/e107_plugins/forum/templates/forum_viewforum_template.php	2006-12-24 07:53:52.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_viewforum_template.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/08/09 13:46:16 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.18 $
+|     $Date: 2006/12/24 13:53:52 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -91,10 +91,10 @@
 
 		</td>
 
-		<td style='vertical-align:center; text-align:center; width:20%' class='forumheader3'>{POSTER}<br />{THREADDATE}</td>
-		<td style='vertical-align:center; text-align:center; width:5%' class='forumheader3'>{REPLIES}</td>
-		<td style='vertical-align:center; text-align:center; width:5%' class='forumheader3'>{VIEWS}</td>
-		<td style='vertical-align:center; text-align:center; width:20%' class='forumheader3'>{LASTPOST}</td>
+		<td style='vertical-align:middle; text-align:center; width:20%' class='forumheader3'>{POSTER}<br />{THREADDATE}</td>
+		<td style='vertical-align:middle; text-align:center; width:5%' class='forumheader3'>{REPLIES}</td>
+		<td style='vertical-align:middle; text-align:center; width:5%' class='forumheader3'>{VIEWS}</td>
+		<td style='vertical-align:middle; text-align:center; width:20%' class='forumheader3'>{LASTPOST}</td>
 		</tr>";
 }
 
@@ -113,10 +113,10 @@
 
 		</td>
 
-		<td style='vertical-align:center; text-align:center; width:20%' class='forumheader3'>{POSTER}<br />{THREADDATE}</td>
-		<td style='vertical-align:center; text-align:center; width:5%' class='forumheader3'>{REPLIES}</td>
-		<td style='vertical-align:center; text-align:center; width:5%' class='forumheader3'>{VIEWS}</td>
-		<td style='vertical-align:center; text-align:center; width:20%' class='forumheader3'>{LASTPOST}</td>
+		<td style='vertical-align:middle; text-align:center; width:20%' class='forumheader3'>{POSTER}<br />{THREADDATE}</td>
+		<td style='vertical-align:middle; text-align:center; width:5%' class='forumheader3'>{REPLIES}</td>
+		<td style='vertical-align:middle; text-align:center; width:5%' class='forumheader3'>{VIEWS}</td>
+		<td style='vertical-align:middle; text-align:center; width:20%' class='forumheader3'>{LASTPOST}</td>
 		</tr>";
 }
 
@@ -135,10 +135,10 @@
 
 		</td>
 
-		<td style='vertical-align:center; text-align:center; width:20%' class='forumheader3'>{POSTER}<br />{THREADDATE}</td>
-		<td style='vertical-align:center; text-align:center; width:5%' class='forumheader3'>{REPLIES}</td>
-		<td style='vertical-align:center; text-align:center; width:5%' class='forumheader3'>{VIEWS}</td>
-		<td style='vertical-align:center; text-align:center; width:20%' class='forumheader3'>{LASTPOST}</td>
+		<td style='vertical-align:middle; text-align:center; width:20%' class='forumheader3'>{POSTER}<br />{THREADDATE}</td>
+		<td style='vertical-align:middle; text-align:center; width:5%' class='forumheader3'>{REPLIES}</td>
+		<td style='vertical-align:middle; text-align:center; width:5%' class='forumheader3'>{VIEWS}</td>
+		<td style='vertical-align:middle; text-align:center; width:20%' class='forumheader3'>{LASTPOST}</td>
 		</tr>";
 }
 
@@ -165,8 +165,8 @@
 		<div class='spacer'>
 		<table class='fborder' style='".USER_WIDTH."'>
 		<tr>
-		<td style='vertical-align:center; width:50%' class='forumheader3'><span class='smalltext'>{MODERATORS}</span></td>
-		<td style='vertical-align:center; width:50%' class='forumheader3'><span class='smalltext'>{BROWSERS}</span></td>
+		<td style='vertical-align:middle; width:50%' class='forumheader3'><span class='smalltext'>{MODERATORS}</span></td>
+		<td style='vertical-align:middle; width:50%' class='forumheader3'><span class='smalltext'>{BROWSERS}</span></td>
 		</tr>
 		</table>
 		</div>
@@ -174,8 +174,8 @@
 		<div class='spacer'>
 		<table class='fborder' style='".USER_WIDTH."'>
 		<tr>
-		<td style='vertical-align:center; width:50%' class='forumheader3'>{ICONKEY}</td>
-		<td style='vertical-align:center; text-align:center; width:50%' class='forumheader3'><span class='smallblacktext'>{PERMS}</span><br /><br />{SEARCH}
+		<td style='vertical-align:middle; width:50%' class='forumheader3'>{ICONKEY}</td>
+		<td style='vertical-align:middle; text-align:center; width:50%' class='forumheader3'><span class='smallblacktext'>{PERMS}</span><br /><br />{SEARCH}
 		</td>
 		</tr>
 		</table>
diff -x .svn -ruN 0.7.7.src/e107_plugins/forum/templates/forum_viewtopic_template.php 0.7.11.src/e107_plugins/forum/templates/forum_viewtopic_template.php
--- 0.7.7.src/e107_plugins/forum/templates/forum_viewtopic_template.php	2006-11-09 12:19:47.000000000 -0600
+++ 0.7.11.src/e107_plugins/forum/templates/forum_viewtopic_template.php	2006-12-16 08:07:06.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_viewtopic_template.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2006/11/09 18:19:47 $
+|     $Revision: 1.27 $
+|     $Date: 2006/12/16 14:07:06 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -30,7 +30,8 @@
 $sc_style['ANON_IP']['pre'] = "<br /><div class='smalltext'>";
 $sc_style['ANON_IP']['post'] = "</div>";
 
-$location_tpl = (array_key_exists('user_location', $currentUser) ? "{USER_EXTENDED=location.text}: {USER_EXTENDED=location.value}" : "");
+$sc_style['USER_EXTENDED']['location.text_value']['mid'] = ": ";
+$sc_style['USER_EXTENDED']['location.text_value']['post'] = "<br />";
 
 $FORUMSTART = "<a id='top'></a><div style='text-align:center'>
 	<div class='spacer'>
@@ -118,7 +119,7 @@
 	{LEVEL=pic}
 	{LEVEL=userid}
 	{JOINED}
-	{$location_tpl}<br />
+	{USER_EXTENDED=location.text_value}
 	{POSTS}
 	</div>
 	</td>
@@ -204,7 +205,7 @@
 	{LEVEL=pic}
 	{LEVEL=userid}
 	{JOINED}
-	{$location_tpl}<br />
+	{USER_EXTENDED=location.text_value}
 	{POSTS}
 	</div>
 	</td>
diff -x .svn -ruN 0.7.7.src/e107_plugins/gsitemap/admin_config.php 0.7.11.src/e107_plugins/gsitemap/admin_config.php
--- 0.7.7.src/e107_plugins/gsitemap/admin_config.php	2006-11-07 08:59:18.000000000 -0600
+++ 0.7.11.src/e107_plugins/gsitemap/admin_config.php	2007-06-14 14:22:06.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/gsitemap/admin_config.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/11/07 14:59:18 $
-|     $Author: lisa_ $
+|     $Revision: 1.15 $
+|     $Date: 2007/06/14 19:22:06 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -254,7 +254,7 @@
 		<tr>
 		<td class='forumheader3'>".GSLAN_31."</td>
 		<td class='forumheader3'>";
-		$text .= r_userclass("gsitemap_active", $editArray['gsitemap_active'], "nobody,public,guest,member,admin,classes,language");
+		$text .= r_userclass("gsitemap_active", $editArray['gsitemap_active'],'off', "nobody,public,guest,member,admin,classes,language");
 		$text .="
 		</td>
 		</tr>
diff -x .svn -ruN 0.7.7.src/e107_plugins/integrity_check/admin_integrity_check.php 0.7.11.src/e107_plugins/integrity_check/admin_integrity_check.php
--- 0.7.7.src/e107_plugins/integrity_check/admin_integrity_check.php	2006-10-24 08:43:34.000000000 -0500
+++ 0.7.11.src/e107_plugins/integrity_check/admin_integrity_check.php	2007-01-18 15:04:47.000000000 -0600
@@ -505,17 +505,16 @@
 		</tr></table></form></div>";
 }
 $text .= "<br /><br /><br /><a href='".e_SELF."?header'>".Integ_26."</a><br />";
-	
+$text .= "<script LANGUAGE=\"JavaScript\" type=\"text/javascript\">
+<!--
+function hex_strReplace(a, b, c){
+return a.split(b).join(c);
+}
+// -->
+</script>";	
 
 $ns->tablerender(Integ_13, $text);
 	
 require_once(e_ADMIN.'footer.php');
 ?>
 
-<script LANGUAGE="JavaScript" type="text/javascript">
-<!--
-function hex_strReplace(a, b, c){
-return a.split(b).join(c);
-}
-// -->
-</script>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/links_page/e_list.php 0.7.11.src/e107_plugins/links_page/e_list.php
--- 0.7.7.src/e107_plugins/links_page/e_list.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.11.src/e107_plugins/links_page/e_list.php	2007-11-11 06:55:20.000000000 -0600
@@ -33,7 +33,7 @@
 
 			$rowheading	= $this -> parse_heading($row['link_name'], $mode);
 			$ICON		= $bullet;
-			$HEADING	= "<a href='".$row['link_url']."' target='_blank' title='".$row['link_name']."'>".$rowheading."</a>";
+			$HEADING	= "<a href='".$row['link_url']."' rel='external' title='".$row['link_name']."'>".$rowheading."</a>";
 			$AUTHOR		= "";
 			$CATEGORY	= ($arr[4] ? "<a href='".e_PLUGIN."links_page/links.php?cat.".$row['link_category_id']."'>".$row['link_category_name']."</a>" : "");
 			$DATE		= ($arr[5] ? ($row['link_datestamp'] > 0 ? $this -> getListDate($row['link_datestamp'], $mode) : "") : "");
diff -x .svn -ruN 0.7.7.src/e107_plugins/links_page/languages/English.php 0.7.11.src/e107_plugins/links_page/languages/English.php
--- 0.7.7.src/e107_plugins/links_page/languages/English.php	2006-10-28 15:22:18.000000000 -0500
+++ 0.7.11.src/e107_plugins/links_page/languages/English.php	2006-12-29 06:58:02.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/languages/English.php,v $
-|     $Revision: 1.28 $
-|     $Date: 2006/10/28 20:22:18 $
-|     $Author: lisa_ $
+|     $Revision: 1.29 $
+|     $Date: 2006/12/29 12:58:02 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 // if(!defined("PAGE_NAME")){define("PAGE_NAME", "Links");}  <--
@@ -311,6 +311,7 @@
 define("LAN_LINKS_47", "link navigator...");
 define("LAN_LINKS_48", "-- view category --");
 define("LAN_LINKS_49", "");
+define("LAN_LINKS_50", "You do not have permission to submit links at present");
 
 define("LAN_ADMIN_HELP_0", "linkspage help area");
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/links_page/link_class.php 0.7.11.src/e107_plugins/links_page/link_class.php
--- 0.7.7.src/e107_plugins/links_page/link_class.php	2006-11-29 18:24:42.000000000 -0600
+++ 0.7.11.src/e107_plugins/links_page/link_class.php	2007-09-28 16:20:58.000000000 -0500
@@ -11,9 +11,9 @@
 |    GNU    General Public  License (http://gnu.org).
 |
 |    $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/link_class.php,v $
-|    $Revision: 1.39 $
-|    $Date: 2006/11/30 00:24:42 $
-|    $Author: e107coders $
+|    $Revision: 1.43 $
+|    $Date: 2007/09/28 21:20:58 $
+|    $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -209,9 +209,7 @@
 
     function parse_link_append($rowl){
 
-        global $tp;
-
-        global $linkspage_pref, $rowl;
+        global $tp, $linkspage_pref;
         if($linkspage_pref['link_open_all'] && $linkspage_pref['link_open_all'] == "5"){
             $link_open_type = $rowl['link_open'];
         }else{
@@ -288,7 +286,7 @@
             ".$rs -> form_option(LAN_LINKS_8, ($checko == "a" ? "1" : "0"), $baseurl."?".($qry ? $qry."." : "")."ordera", "")."
             ".$rs -> form_option(LAN_LINKS_9, ($checko == "d" ? "1" : "0"), $baseurl."?".($qry ? $qry."." : "")."orderd", "")."
             ".$rs -> form_select_close()."
-            ".$rs -> form_button("button", "submit", LCLAN_ITEM_36, "style='width:25px;' onclick=\"document.location=link_order.options[link_order.selectedIndex].value+link_sort.options[link_sort.selectedIndex].value;\"", "", "")."
+            ".$rs -> form_button("button", "submit", LCLAN_ITEM_36, " onclick=\"document.location=link_order.options[link_order.selectedIndex].value+link_sort.options[link_sort.selectedIndex].value;\"", "", "")."
         ".$rs -> form_close();
 
         return $sotext;
@@ -702,15 +700,21 @@
         $ns->tablerender(LCLAN_ITEM_24, $text);
     }
 
-    function show_links() {
+    function show_links() 
+	{
         global $sql, $qs, $rs, $ns, $tp, $from;
         $number = "20";
+		$LINK_CAT_NAME = '';			// May be appropriate to add a shortcode later
 
-        if($qs[2] == "all"){
+        if($qs[2] == "all")
+		{	// Show all categories
             $caption = LCLAN_ITEM_38;
             $qry = " link_id != '' ORDER BY link_category ASC, link_order ASC";
-        }else{
-            if ($sql->db_Select("links_page_cat", "link_category_name", "link_category_id='".intval($qs[2])."' " )) {
+        }
+		else
+		{	// Show single category
+            if ($sql->db_Select("links_page_cat", "link_category_name", "link_category_id='".intval($qs[2])."' " )) 
+			{
                 $row = $sql->db_Fetch();
                 $caption = LCLAN_ITEM_2." ".$row['link_category_name'];
             }
@@ -718,9 +722,12 @@
         }
 
         $link_total = $sql->db_Select("links_page", "*", " ".$qry." ");
-        if (!$sql->db_Select("links_page", "*", " ".$qry." LIMIT ".intval($from).",".intval($number)." ")) {
-            js_location(e_SELF."?link");
-        }else{
+        if (!$sql->db_Select("links_page", "*", " ".$qry." LIMIT ".intval($from).",".intval($number)." ")) 
+		{
+          js_location(e_SELF."?link");
+        }
+		else
+		{	// Display the individual links
             $text = $rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "myform_{$row['link_id']}", "", "");
             $text .= "<div style='text-align:center'>
             <table class='fborder' style='".ADMIN_WIDTH."'>
@@ -731,16 +738,24 @@
             <td class='fcaption' style='width:10%'>".LCLAN_ITEM_28."</td>
             <td class='fcaption' style='width:10%'>".LCLAN_ITEM_29."</td>
             </tr>";
-            while ($row = $sql->db_Fetch()) {
+            while ($row = $sql->db_Fetch()) 
+			{
                 $linkid = $row['link_id'];
                 $img = "";
-                if ($row['link_button']) {
-                    if (strpos($row['link_button'], "http://") !== FALSE) {
+                if ($row['link_button']) 
+				{
+                    if (strpos($row['link_button'], "http://") !== FALSE) 
+					{
                         $img = "<img style='border:0;' src='".$row['link_button']."' alt='".$LINK_CAT_NAME."' />";
-                    } else {
-                        if(strstr($row['link_button'], "/")){
+                    } 
+					else 
+					{
+                        if(strstr($row['link_button'], "/"))
+						{
                             $img = "<img style='border:0;' src='".e_BASE.$row['link_button']."' alt='".$LINK_CAT_NAME."' />";
-                        }else{
+                        }
+						else
+						{
                             $img = "<img style='border:0' src='".e_PLUGIN."links_page/link_images/".$row['link_button']."' alt='".$LINK_CAT_NAME."' />";
                         }
                     }
@@ -1425,4 +1440,4 @@
 
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/links_page/link_menu.php 0.7.11.src/e107_plugins/links_page/link_menu.php
--- 0.7.7.src/e107_plugins/links_page/link_menu.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.11.src/e107_plugins/links_page/link_menu.php	2007-05-28 11:52:42.000000000 -0500
@@ -11,7 +11,7 @@
 $lan_file = e_PLUGIN."links_page/languages/".e_LANGUAGE.".php";
 include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."links_page/languages/English.php");
 
-$bullet = "<img src='".THEME."images/bullet2.gif' alt='' style='border:0;' />";
+$bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='' style='border:0;' />";
 global $linkspage_pref;
 $linkspage_pref = $lc -> getLinksPagePref();
 
@@ -136,7 +136,7 @@
 		$text .= "<br />".$cap."<br />";
 		while($row = $sql -> db_Fetch()){
 			
-			$append = $lc -> parse_link_append($row['link_open'], $row['link_id']);
+			$append = $lc -> parse_link_append($row);
 
 			$heading = $append.$tp->toHTML($row['link_name'],TRUE,"")."</a>";
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/links_page/link_shortcodes.php 0.7.11.src/e107_plugins/links_page/link_shortcodes.php
--- 0.7.7.src/e107_plugins/links_page/link_shortcodes.php	2006-11-19 23:25:40.000000000 -0600
+++ 0.7.11.src/e107_plugins/links_page/link_shortcodes.php	2007-05-28 11:52:42.000000000 -0500
@@ -163,7 +163,7 @@
 
 SC_BEGIN LINK_MAIN_DESC
 global $LINK_MAIN_DESC, $rowl, $linkspage_pref, $tp;
-return (isset($linkspage_pref['link_cat_desc']) && $linkspage_pref['link_cat_desc'] ? $tp->toHTML($rowl['link_category_description'], TRUE) : "");
+return (isset($linkspage_pref['link_cat_desc']) && $linkspage_pref['link_cat_desc'] ? $tp->toHTML($rowl['link_category_description'], TRUE,'description') : "");
 SC_END
 
 SC_BEGIN LINK_MAIN_NUMBER
@@ -186,7 +186,7 @@
 			$LINK_MAIN_ICON = "<img src='".e_BASE.$rowl['link_category_icon']."' alt='' style='border:0; vertical-align:middle' />";
 			} else {
 				if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty']){
-				$LINK_MAIN_ICON = "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+				$LINK_MAIN_ICON = "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
 				}
 			}
 		}else{
@@ -194,13 +194,13 @@
 			$LINK_MAIN_ICON = "<img src='".e_PLUGIN."links_page/cat_images/".$rowl['link_category_icon']."' alt='' style='border:0; vertical-align:middle' />";
 			} else {
 				if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty']){
-				$LINK_MAIN_ICON = "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+				$LINK_MAIN_ICON = "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
 				}
 			}
 		}
 	} else {
 		if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty']){
-		$LINK_MAIN_ICON = "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+		$LINK_MAIN_ICON = "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
 		}
 	}
 	if($rowl['total_links'] && $LINK_MAIN_ICON){
@@ -274,7 +274,7 @@
 
 SC_BEGIN BUTTON_COLUMN
 global $linkbutton_count,$linkspage_pref;
-return ($linkbutton_count >0 && $linkspage_pref['link_icon']) ? 2 : 1;
+return ($linkspage_pref['link_icon']) ? 2 : 1;
 SC_END
 
 SC_BEGIN LINK_APPEND
@@ -308,7 +308,7 @@
 
 SC_BEGIN LINK_DESC
 global $LINK_DESC, $linkspage_pref, $tp, $rowl;
-return (isset($linkspage_pref['link_desc']) && $linkspage_pref['link_desc'] ? $tp->toHTML($rowl['link_description'], TRUE) : "");
+return (isset($linkspage_pref['link_desc']) && $linkspage_pref['link_desc'] ? $tp->toHTML($rowl['link_description'], TRUE,'BODY') : "");
 SC_END
 
 SC_BEGIN LINK_RATING
diff -x .svn -ruN 0.7.7.src/e107_plugins/links_page/links.php 0.7.11.src/e107_plugins/links_page/links.php
--- 0.7.7.src/e107_plugins/links_page/links.php	2006-10-28 04:29:29.000000000 -0500
+++ 0.7.11.src/e107_plugins/links_page/links.php	2007-09-26 15:05:58.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/links.php,v $
-|     $Revision: 1.42 $
-|     $Date: 2006/10/28 09:29:29 $
-|     $Author: lisa_ $
+|     $Revision: 1.46 $
+|     $Date: 2007/09/26 20:05:58 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once('../../class2.php');
@@ -165,9 +165,17 @@
 	displayLinkComment();
 }
 //submit link
-if (isset($qs[0]) && $qs[0] == "submit" && check_class($linkspage_pref['link_submit_class'])) {
+if (isset($qs[0]) && $qs[0] == "submit")
+{
+  if (check_class($linkspage_pref['link_submit_class'])) 
+  {
 	echo displayNavigator('');
 	displayLinkSubmit();
+  }
+  else
+  {
+	$lc->show_message(LAN_LINKS_50);
+  }
 }
 
 
@@ -259,31 +267,38 @@
 	}
 }
 
-function displayPersonalManager(){
+function displayPersonalManager()
+{
 	global $qs, $sql, $sql2, $lc, $link_shortcodes, $cobj, $row, $from, $tp, $ns, $linkspage_pref;
 	global $LINK_TABLE_MANAGE_START, $LINK_TABLE_MANAGE, $LINK_TABLE_MANAGE_END;
 
-	if(!(isset($linkspage_pref['link_manager']) && $linkspage_pref['link_manager'])){
-		js_location(e_SELF);
+	if(!(isset($linkspage_pref['link_manager']) && $linkspage_pref['link_manager']))
+	{
+	  js_location(e_SELF);
 	}
 	//delete link
-	if(isset($linkspage_pref['link_directdelete']) && $linkspage_pref['link_directdelete']){
-		if(isset($_POST['delete'])){
-			$tmp = array_pop(array_flip($_POST['delete']));
-			list($delete, $del_id) = explode("_", $tmp);
-		}
-		if (isset($delete) && $delete == 'main') {
-			$sql->db_Select("links_page", "link_order", "link_id='".intval($del_id)."'");
-			$row = $sql->db_Fetch();
-			$sql2 = new db;
-			$sql->db_Select("links_page", "link_id", "link_order>'".$row['link_order']."' && link_category='".intval($id)."'");
-			while ($row = $sql->db_Fetch()) {
-				$sql2->db_Update("links_page", "link_order=link_order-1 WHERE link_id='".$row['link_id']."'");
-			}
-			if ($sql->db_Delete("links_page", "link_id='".intval($del_id)."'")) {
-				$lc->show_message(LCLAN_ADMIN_10." #".$del_id." ".LCLAN_ADMIN_11);
-			}
+	if(isset($linkspage_pref['link_directdelete']) && $linkspage_pref['link_directdelete'])
+	{
+	  if(isset($_POST['delete']))
+	  {
+		$tmp = array_pop(array_flip($_POST['delete']));
+		list($delete, $del_id) = explode("_", $tmp);
+	  }
+	  if (isset($delete) && $delete == 'main') 
+	  {
+		$sql->db_Select("links_page", "link_category, link_order", "link_id='".intval($del_id)."'");		// Get the position of target in the order
+		$row = $sql->db_Fetch();
+		if (!is_object($sql2)){ $sql2 = new db; }
+		$sql->db_Select("links_page", "link_id", "link_order>'".$row['link_order']."' && link_category='".intval($row['link_category'])."'");
+		while ($row = $sql->db_Fetch()) 
+		{
+		  $sql2->db_Update("links_page", "link_order=link_order-1 WHERE link_id='".$row['link_id']."'");
+		}
+		if ($sql->db_Delete("links_page", "link_id='".intval($del_id)."'")) 
+		{
+		  $lc->show_message(LCLAN_ADMIN_10." #".$del_id." ".LCLAN_ADMIN_11);
 		}
+	  }
 	}
 	//upload link icon
 	if(isset($_POST['uploadlinkicon'])){
@@ -327,11 +342,12 @@
 		js_location(e_SELF);
 	}else{
 		$qry = "
-		SELECT l.*, lc.*
+		SELECT l.*, lc.*, COUNT(c.comment_id) AS link_comment
 		FROM #links_page AS l
 		LEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category
+		LEFT JOIN #comments as c ON c.comment_item_id=l.link_id AND comment_type='links_page'
 		WHERE l.link_id = '".intval($qs[1])."' AND lc.link_category_class REGEXP '".e_CLASS_REGEXP."' AND l.link_class REGEXP '".e_CLASS_REGEXP."'
-		";
+		GROUP BY l.link_id";
 		$link_comment_table_string = "";
 		if(!$linkcomment = $sql -> db_Select_gen($qry)){
 			js_location(e_SELF);
diff -x .svn -ruN 0.7.7.src/e107_plugins/linkwords/admin_config.php 0.7.11.src/e107_plugins/linkwords/admin_config.php
--- 0.7.7.src/e107_plugins/linkwords/admin_config.php	2005-04-06 16:41:31.000000000 -0500
+++ 0.7.11.src/e107_plugins/linkwords/admin_config.php	2007-07-23 16:02:23.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/admin_config.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/04/06 21:41:31 $
-|     $Author: stevedunstan $
+|     $Revision: 1.7 $
+|     $Date: 2007/07/23 21:02:23 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -25,6 +25,19 @@
 @include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
 @include_once(e_PLUGIN."linkwords/languages/English.php");
 
+$lw_context_areas = array(
+			'title' => LWLAN_33,
+			'summary' => LWLAN_34,
+			'body' => LWLAN_35,
+			'description' => LWLAN_36,
+			'user_title' => LWLAN_40,
+			'user_body'  => LWLAN_41
+			// Don't do the next three - linkwords are meaningless on them
+//			'olddefault' => LWLAN_37,
+//			'linktext' => LWLAN_38,
+//			'rawtext' => LWLAN_39'
+		);
+		
 $deltest = array_flip($_POST);
 
 if(isset($deltest[LWLAN_17]))
@@ -40,8 +53,43 @@
 
 if(e_QUERY)
 {
-	list($action, $id) = explode(".", e_QUERY);
+  $lw_qs = explode(".", e_QUERY);
+  if (!isset($lw_qs[0])) $lw_qs[0] = 'words';
+  if (!isset($lw_qs[1])) $lw_qs[1] = -1;
+  $action = $lw_qs[0];
+  $id = $lw_qs[1];
 }
+if (!isset($action)) $action = 'words';
+
+if (isset($_POST['saveopts_linkword']))
+{  // Save options page
+  // Array of context flags
+	$pref['lw_context_visibility'] = array(			
+			'olddefault' => FALSE,
+			'title' => FALSE,
+			'summary' => FALSE,
+			'body' => FALSE,
+			'description' => FALSE,
+			'linktext' => FALSE,
+			'rawtext' => FALSE
+			);
+  foreach ($_POST['lw_visibility_area'] as $can_see)
+  {
+    if (key_exists($can_see,$lw_context_areas))
+	{
+	  $pref['lw_context_visibility'][$can_see] = TRUE;
+	}
+  }
+  // Text area for 'exclude' pages - use same method as for menus
+  $pagelist = explode("\r\n", $_POST['linkword_omit_pages']);
+  for ($i = 0 ; $i < count($pagelist) ; $i++) 
+  {
+	$pagelist[$i] = trim($pagelist[$i]);
+  }
+  $pref['lw_page_visibility'] = '2-'.implode("|", $pagelist);		// '2' for 'hide on specified pages'
+  save_prefs();
+}
+
 
 if (isset($_POST['submit_linkword']))
 {
@@ -53,8 +101,8 @@
 	{
 		$word = $tp -> toDB($_POST['linkword_word']);
 		$link = $tp -> toDB($_POST['linkword_link']);
-		$active = $_POST['linkword_active'];
-		$sql -> db_Insert("linkwords", "0, $active, '$word', '$link' ");
+		$active = intval($_POST['linkword_active']);
+		$sql -> db_Insert("linkwords", "0, {$active}, '{$word}', '{$link}' ");
 		$message = LWLAN_2;
 	}
 }
@@ -77,75 +125,34 @@
 }
 
 
-if (isset($message)) {
-	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
-}
-
-
-
-$text = "<div class='center'>\n";
-if(!$sql -> db_Select("linkwords"))
-{
-	$text .= LWLAN_4;
-}
-else
+if (isset($message)) 
 {
-	$text = "
-	<table style='".ADMIN_WIDTH."' class='fborder'>
-	<tr>
-	<td class='forumheader' style='width: 20%;'>".LWLAN_5."</td>
-	<td class='forumheader' style='width: 40%;'>".LWLAN_6."</td>
-	<td class='forumheader' style='width: 10%; text-align: center;'>".LWLAN_7."</td>
-	<td class='forumheader' style='width: 30%; text-align: center;'>".LWLAN_8."</td>
-	</tr>\n";
-
-	while($row = $sql -> db_Fetch())
-	{
-		extract($row);
-		$text .= "
-		
-		<form action='".e_SELF."' method='post' id='myform_$linkword_id'  onsubmit=\"return jsconfirm('".LWLAN_18." [ID: $linkword_id ]')\">
-		<tr>
-		<td class='forumheader' style='width: 20%;'>$linkword_word</td>
-		<td class='forumheader' style='width: 40%;'>$linkword_link</td>
-		<td class='forumheader' style='width: 10%; text-align: center;'>".(!$linkword_active ? LWLAN_12 : LWLAN_13)."</td>
-		<td class='forumheader' style='width: 30%; text-align: center;'>
-		<input class='button' type='button' onclick=\"document.location='".e_SELF."?edit.$linkword_id'\" value='Edit' id='edit_$linkword_id' name='edit_linkword_id' />
-		<input class='button' type='submit'  value='Delete' id='delete_$linkword_id' name='delete_$linkword_id' />
-		</td>
-		</tr>
-		</form>\n";
-	}
-	$text .= "</table>";
+	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
 
-$text .= "</div>";
-$ns -> tablerender(LWLAN_11, $text);
 
 
 if($action == "edit")
 {
-
-	if($sql -> db_Select("linkwords", "*", "linkword_id=".$id))
-	{
-		$row = $sql -> db_Fetch();
-		extract($row);
-		define("EDIT", TRUE);
-	}
+  if($sql -> db_Select("linkwords", "*", "linkword_id=".$id))
+  {
+	$row = $sql -> db_Fetch();
+	extract($row);
+	define("LW_EDIT", TRUE);
+  }
 }
 else
 {
-	unset($linkword_word, $linkword_link, $linkword_active);
+  unset($linkword_word, $linkword_link, $linkword_active);
 }
 
 
 
-
-
-
+if (($action == 'words') || ($action == 'edit'))
+{
 $text = "
 <div class='center'>
-<form method='post' action='".e_SELF."'>
+<form method='post' action='".e_SELF."?words'>
 <table style='".ADMIN_WIDTH."' class='fborder'>
 
 <tr>
@@ -158,7 +165,7 @@
 <tr>
 <td style='width:50%' class='forumheader3'>".LWLAN_6."</td>
 <td style='width:50%' class='forumheader3'>
-<input class='tbox' type='text' name='linkword_link' size='40' value='".$linkword_link."' maxlength='150' />
+<input class='tbox' type='text' name='linkword_link' size='60' value='".$linkword_link."' maxlength='150' />
 </td>
 </tr>
 
@@ -172,14 +179,127 @@
 
 <tr>
 <td colspan='2' style='text-align:center' class='forumheader'>".
-(defined("EDIT") ? "<input class='button' type='submit' name='update_linkword' value='".LWLAN_15."' /><input type='hidden' name='id' value='$id' />" : "<input class='button' type='submit' name='submit_linkword' value='".LWLAN_14."' />")."
+(defined("LW_EDIT") ? "<input class='button' type='submit' name='update_linkword' value='".LWLAN_15."' /><input type='hidden' name='id' value='$id' />" : "<input class='button' type='submit' name='submit_linkword' value='".LWLAN_14."' />")."
+</td>
+</tr>
+</table>
+</form>
+</div>\n";
+
+$ns -> tablerender(LWLAN_31, $text);
+}
+
+
+// Now display existing linkwords
+if (($action == 'words') || ($action == 'edit'))
+{
+  $text = "<div class='center'>\n";
+  if(!$sql -> db_Select("linkwords"))
+  {
+	$text .= LWLAN_4;
+  }
+  else
+  {
+	$text = "
+	<table style='".ADMIN_WIDTH."' class='fborder'>
+	<tr>
+	<td class='forumheader' style='width: 20%;'>".LWLAN_5."</td>
+	<td class='forumheader' style='width: 40%;'>".LWLAN_6."</td>
+	<td class='forumheader' style='width: 10%; text-align: center;'>".LWLAN_7."</td>
+	<td class='forumheader' style='width: 30%; text-align: center;'>".LWLAN_8."</td>
+	</tr>\n";
+
+	while($row = $sql -> db_Fetch())
+	{
+		extract($row);
+		$text .= "
+		
+		<form action='".e_SELF."' method='post' id='myform_$linkword_id'  onsubmit=\"return jsconfirm('".LWLAN_18." [ID: $linkword_id ]')\">
+		<tr>
+		<td class='forumheader' style='width: 20%;'>$linkword_word</td>
+		<td class='forumheader' style='width: 40%;'>$linkword_link</td>
+		<td class='forumheader' style='width: 10%; text-align: center;'>".(!$linkword_active ? LWLAN_12 : LWLAN_13)."</td>
+		<td class='forumheader' style='width: 30%; text-align: center;'>
+		<input class='button' type='button' onclick=\"document.location='".e_SELF."?edit.$linkword_id'\" value='".LWLAN_16."' id='edit_$linkword_id' name='edit_linkword_id' />
+		<input class='button' type='submit'  value='".LWLAN_17."' id='delete_$linkword_id' name='delete_$linkword_id' />
+		</td>
+		</tr>
+		</form>\n";
+	}
+	$text .= "</table>";
+  }
+
+  $text .= "</div>";
+  $ns -> tablerender(LWLAN_11, $text);
+}
+
+
+
+if ($action=='options')
+{
+  $menu_pages = substr($pref['lw_page_visibility'],2);    // Knock off the 'show/hide' flag
+  $menu_pages = str_replace("|", "\n", $menu_pages);
+  $text = "
+  <div class='center'>
+  <form method='post' action='".e_SELF."?options'>
+  <table style='".ADMIN_WIDTH."' class='fborder'>
+	<colgroup>
+	<col style='width: 30%; vertical-align:top;' />
+	<col style='width: 40%; vertical-align:top;' />
+	<col style='width: 30%; vertical-align:top;' />
+	</colgroup>
+  <tr>
+  <td class='forumheader3'>".LWLAN_26."</td>
+  <td class='forumheader3'>";
+  foreach ($lw_context_areas as $lw_key=>$lw_desc)
+  {
+    $checked = $pref['lw_context_visibility'][$lw_key] ? 'checked=checked' : '';
+	$text .= "<input type='checkbox' name='lw_visibility_area[]' value={$lw_key} {$checked} />{$lw_desc}<br />";
+  }
+  $text .= "</td>
+  <td class='forumheader3'>".LWLAN_27."
+  </tr>
+
+  <tr>
+  <td class='forumheader3'>".LWLAN_28."</td>
+  <td class='forumheader3'><textarea rows='5' cols='60' class='tbox' name='linkword_omit_pages' >".$menu_pages."</textarea>
+  </td>
+  <td class='forumheader3'>".LWLAN_29."
+  </tr>
+
+<tr>
+<td colspan='3' style='text-align:center' class='forumheader'>
+<input class='button' type='submit' name='saveopts_linkword' value='".LWLAN_30."' />
 </td>
 </tr>
 </table>
 </form>
 </div>\n";
 
-$ns -> tablerender($caption, $text);
+$ns -> tablerender(LWLAN_32, $text);
+}
+
+
+
+function admin_config_adminmenu()
+{
+  if (e_QUERY) 
+  {
+	$tmp = explode(".", e_QUERY);
+	$action = $tmp[0];
+  }
+  if (!isset($action) || ($action == ""))
+  {
+	$action = "words";
+  }
+  $var['words']['text'] = LWLAN_24;
+  $var['words']['link'] = "admin_config.php";
+	
+  $var['options']['text'] = LWLAN_25;
+  $var['options']['link'] ="admin_config.php?options";
+	
+  show_admin_menu(LWLAN_23, $action, $var);
+}
 
 	
 require_once(e_ADMIN."footer.php");
diff -x .svn -ruN 0.7.7.src/e107_plugins/linkwords/languages/English.php 0.7.11.src/e107_plugins/linkwords/languages/English.php
--- 0.7.7.src/e107_plugins/linkwords/languages/English.php	2005-04-06 16:41:49.000000000 -0500
+++ 0.7.11.src/e107_plugins/linkwords/languages/English.php	2007-07-23 16:02:23.000000000 -0500
@@ -1,10 +1,27 @@
 <?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/languages/English.php,v $
+|     $Revision: 1.5 $
+|     $Date: 2007/07/23 21:02:23 $
+|     $Author: e107steved $
++----------------------------------------------------------------------------+
+*/
 	
 define("LWLAN_1", "Field(s) left blank.");
 define("LWLAN_2", "Link word saved.");
 define("LWLAN_3", "Link word updated.");
 define("LWLAN_4", "No link words defined yet.");
-define("LWLAN_5", "Word");
+define("LWLAN_5", "Words");
 define("LWLAN_6", "Link");
 define("LWLAN_7", "Active?");
 define("LWLAN_8", "Options");
@@ -20,8 +37,28 @@
 define("LWLAN_18", "Are you sure you want to delete this linkword?");
 define("LWLAN_19", "Linkword deleted.");
 define("LWLAN_20", "Unable to find that linkword entry.");
-define("LWLAN_21","Word to autolink");
-define("LWLAN_22","Activate?");
+define("LWLAN_21", "Word to autolink (or comma-separated list of words)");
+define("LWLAN_22", "Activate?");
+define("LWLAN_23", "Linkwords Administration");
+define("LWLAN_24", "Manage Words");
+define("LWLAN_25", "Options");
+define("LWLAN_26", "Areas in which to enable linkwords");
+define("LWLAN_27", "This is the 'context' of the displayed text");
+define("LWLAN_28", "Pages on which to disable linkwords");
+define("LWLAN_29", "Same format as menu visibility control. One match per line. Specify a partial or complete URL. End with '!' for exact match of the end part of the link");
+define("LWLAN_30", "Save options");
+define("LWLAN_31", "Add/edit linkword");
+define("LWLAN_32", "Linkword Options");
+define("LWLAN_33", 'Title areas');
+define("LWLAN_34", 'Item summaries');
+define("LWLAN_35", 'Body text');
+define("LWLAN_36", 'Descriptions (links etc)');
+define("LWLAN_37", 'Legacy areas');
+define("LWLAN_38", 'Clickable links');
+define("LWLAN_39", 'Unprocessed text');
+define("LWLAN_40", 'User-entered titles (e.g. forum)');
+define("LWLAN_41", 'User-entered body text (e.g. forum)');
+
 
 define("LWLANINS_1", "Linkwords");
 define("LWLANINS_2", "This plugin will link specified words with a defined link");
diff -x .svn -ruN 0.7.7.src/e107_plugins/linkwords/linkwords.php 0.7.11.src/e107_plugins/linkwords/linkwords.php
--- 0.7.7.src/e107_plugins/linkwords/linkwords.php	2006-11-09 18:44:24.000000000 -0600
+++ 0.7.11.src/e107_plugins/linkwords/linkwords.php	2007-04-18 16:08:40.000000000 -0500
@@ -11,60 +11,145 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/linkwords.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/11/10 00:44:24 $
-|     $Author: mrpete $
+|     $Revision: 1.14 $
+|     $Date: 2007/04/18 21:08:40 $
+|     $Author: e107steved $
+|
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+
 class e_linkwords
 {
-	var $linkwords = array();
-	var $linkhold  = array();  // Placeholders in case url's contain linkwords
-	var $linkurls = array();
-
+	var $lw_enabled = FALSE;		// Default to disabled to start
+	var $word_list = array();		// List of link words/phrases
+	var $link_list = array();		// Corresponding list of links to apply
+	var $tip_list  = array();
+	var $area_opts = array();		// Process flags for the various contexts
+	var $block_list = array();		// Array of 'blocked' pages
+	
 	function e_linkwords()
 	{
+	  global $pref;
 		/* constructor */
-		$sql = new db;
-		if($sql -> db_Select("linkwords", "*", "linkword_active=0"))
+	// See whether they should be active on this page - if not, no point doing anything!
+	  if ((strpos(e_SELF, ADMINDIR) !== FALSE) || (strpos(e_PAGE, "admin_") !== FALSE)) return;   // No linkwords on admin directories
+
+// Now see if disabled on specific pages
+	  $check_url = e_SELF.(e_QUERY ? "?".e_QUERY : '');
+	  $this->block_list = explode("|",substr($pref['lw_page_visibility'],2));    // Knock off the 'show/hide' flag
+	  foreach ($this->block_list as $p)
+	  {
+		if ($p=trim($p))
 		{
-			$linkWords = $sql -> db_getList();
-			$placeprefix="|*#!|"; // A highly unusual string
-			$iPlace = 1;
-			foreach($linkWords as $words)
-			{
-				$word = $words['linkword_word'];
-				$this -> linkwords[] = $word;
-				$this -> linkurls[] = " <a href='".$words['linkword_link']."' rel='external'>$word</a>";
-				$this -> linkhold[] = $placeprefix.$iPlace++.$placeprefix;
-				$word2 = substr_replace($word, strtoupper($word[0]), 0, 1);
-				$this -> linkwords[] = $word2;
-				$this -> linkhold[] = $placeprefix.$iPlace++.$placeprefix;
-				$this -> linkurls[] = " <a href='".$words['linkword_link']."' rel='external'>$word2</a>";
+		  if(substr($p, -1) == '!')
+		  {
+			$p = substr($p, 0, -1);
+			if(substr($check_url, strlen($p)*-1) == $p) return;
+		  }
+		  else 
+		  {
+			if(strpos($check_url, $p) !== FALSE) return;
+		  }
+		}
+	  }
 
+	  // Will probably need linkwords on this page - so get the info
+	  $this->lw_enabled = TRUE;
+	  $link_sql = new db;
+	  if($link_sql -> db_Select("linkwords", "*", "linkword_active=0"))
+	  {
+		  while ($row = $link_sql->db_Fetch())
+		  {
+		    $lw = trim(strtolower($row['linkword_word']));
+			if (strpos($lw,','))
+			{  // Several words to same link
+			  $lwlist = explode(',',$lw);
+			  foreach ($lwlist as $lw)
+			  {
+		        $this->word_list[] = trim($lw);
+			    $this->link_list[] = $row['linkword_link'];
+			  }
 			}
-		}
+			else
+			{
+		      $this->word_list[] = $lw;
+			  $this->link_list[] = $row['linkword_link'];
+			}
+		  }
+	  }
+	  $this->area_opts = $pref['lw_context_visibility'];
 	}
 
-	function linkwords($text)
+
+	function linkwords($text,$area = 'olddefault')
 	{
-		$content = preg_split('#(<.*>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
-		$ptext = "";
-		foreach($content as $cont)
-		{
-			if (strstr($cont, "<"))
+	  if (!$this->lw_enabled || !array_key_exists($area,$this->area_opts) || !$this->area_opts[$area]) return $text;		// No linkwords in disabled areas
+
+
+// Split up by HTML tags and process the odd bits here
+	  $ptext = "";
+	  $lflag = FALSE;
+
+	  $content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+	  foreach($content as $cont)
+	  {
+		if (strpos($cont, "<") !== FALSE)
+		{  // Its some HTML
+			$ptext .= $cont;
+			if (strpos($cont,"<a") !== FALSE) $lflag = TRUE;
+			if (strpos($cont,"</a") !== FALSE) $lflag = FALSE;
+		} 
+		else 
+		{  // Its the text in between
+		  if ($lflag)
+		  {  // Its probably within a link - leave unchanged
+		    $ptext .= $cont;
+		  }
+		  else
+		  {
+			if (trim($cont))
+			{  // Some non-white space - worth word matching
+			  $ptext .= $this->linksproc($cont,0,count($this->word_list));
+			}
+			else
 			{
-				$ptext .= $cont;
-			} else {
-				$cont2=str_replace($this -> linkwords, $this -> linkhold, $cont);
-				$cont2=str_replace($this -> linkhold, $this -> linkurls, $cont2);
-				$ptext .= $cont2;
+			  $ptext .= $cont;
 			}
+		  }
+		}
+	  }
+	  return $ptext;
+	}
+	
+	function linksproc($text,$first,$limit)
+	{  // This function is called recursively - it splits the text up into blocks - some containing a particular linkword
+	  while (($first < $limit) && (stripos($text,$this->word_list[$first]) === FALSE))   { $first++; };
+	  if ($first == $limit) return $text;		// Return if no linkword found
+	  
+	  // There's at least one occurrence of the linkword in the text
+	  $ret = '';
+	  $lw = $this->word_list[$first];
+	  // This splits the text into blocks, some of which will precisely contain a linkword
+	  $split_line = preg_split('#\b('.$lw.')\b#i', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+	  foreach ($split_line AS $sl)
+	  {
+	    if (strcasecmp($sl,$lw) == 0)
+		{  // Do linkword replace
+		  $ret .= " <a href='".$this->link_list[$first]."' rel='external'>{$sl}</a>";
+		}
+		elseif (trim($sl))
+		{  // Something worthwhile left - look for more linkwords in it
+		  $ret .= $this->linksproc($sl,$first+1,$limit);
+		}
+		else
+		{
+		  $ret .= $sl;   // Probably just some white space
 		}
-		return $ptext;
+	  }
+	  return $ret;
 	}
 }
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/linkwords/plugin.php 0.7.11.src/e107_plugins/linkwords/plugin.php
--- 0.7.7.src/e107_plugins/linkwords/plugin.php	2006-08-25 10:37:54.000000000 -0500
+++ 0.7.11.src/e107_plugins/linkwords/plugin.php	2007-07-28 11:48:01.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/plugin.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/08/25 15:37:54 $
-|     $Author: e107coders $
+|     $Revision: 1.6 $
+|     $Date: 2007/07/28 16:48:01 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,7 +24,7 @@
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "LWLANINS_1";
-$eplug_version = "1.0";
+$eplug_version = "1.1";
 $eplug_author = "jalist";
 $eplug_url = "http://e107.org";
 $eplug_email = "jalist@e107.org";
@@ -52,6 +52,20 @@
 $eplug_array_pref = array(
 	'tohtml_hook' => 'linkwords'
 	);
+$eplug_prefs = array(
+	'lw_page_visibility'=>'',
+	'lw_context_visibility'=>array(			
+			'olddefault' => FALSE,
+			'title' => FALSE,
+			'summary' => TRUE,
+			'body' => TRUE,
+			'description' => TRUE,
+			'user_title' => FALSE,
+			'user_body'  => TRUE,
+			'linktext' => FALSE,
+			'rawtext' => FALSE
+			)
+	);
 
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
@@ -83,7 +97,18 @@
 
 // upgrading ... //
 
-$upgrade_add_prefs = "";
+$upgrade_add_prefs = array(
+	'lw_page_visibility'=>'', 
+	'lw_context_visibility'=>array(			
+			'olddefault' => FALSE,
+			'title' => FALSE,
+			'summary' => TRUE,
+			'body' => TRUE,
+			'description' => TRUE,
+			'linktext' => FALSE,
+			'rawtext' => FALSE
+			)
+);
 
 $upgrade_remove_prefs = "";
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/list_new/admin_list_config.php 0.7.11.src/e107_plugins/list_new/admin_list_config.php
--- 0.7.7.src/e107_plugins/list_new/admin_list_config.php	2006-10-28 04:02:43.000000000 -0500
+++ 0.7.11.src/e107_plugins/list_new/admin_list_config.php	2007-03-23 15:26:12.000000000 -0500
@@ -11,8 +11,8 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/admin_list_config.php,v $
-|		$Revision: 1.7 $
-|		$Date: 2006/10/28 09:02:43 $
+|		$Revision: 1.8 $
+|		$Date: 2007/03/23 20:26:12 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -381,7 +381,7 @@
 	global $rc, $list_pref, $rs, $tp, $sections, $TOPIC_ROW, $TOPIC_ROW_SPACER, $TOPIC_TABLE_END;
 
 	if($type == "recent_page"){
-		$display = "display:;";
+		$display = "";
 	}else{
 		$display = "display:none;";
 	}
@@ -547,4 +547,4 @@
 
 require_once(e_ADMIN."footer.php");
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/list_new/languages/English.php 0.7.11.src/e107_plugins/list_new/languages/English.php
--- 0.7.7.src/e107_plugins/list_new/languages/English.php	2006-10-28 04:02:43.000000000 -0500
+++ 0.7.11.src/e107_plugins/list_new/languages/English.php	2007-04-02 15:31:33.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/languages/English.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/10/28 09:02:43 $
-|     $Author: lisa_ $
+|     $Revision: 1.18 $
+|     $Date: 2007/04/02 20:31:33 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -38,10 +38,10 @@
 define("LIST_ADMIN_10", "closed");
 define("LIST_ADMIN_11", "update");
 define("LIST_ADMIN_12", "choose");
-define("LIST_ADMIN_13", "Welcome on the Recent page of ".SITENAME." ! This page shows for the most common sections of this site a list with the most recent additions in these sections.");
+define("LIST_ADMIN_13", "Welcome to the Recent page of ".SITENAME." ! This page shows, for the most common sections of this site, a list of the most recent additions in these sections.");
 define("LIST_ADMIN_14", "recent additions");
 define("LIST_ADMIN_15", "new since your last visit");
-define("LIST_ADMIN_16", "Welcome on the New page of ".SITENAME." ! This page shows for the most common sections of this site a list with the additions in these sections since your last visit.");
+define("LIST_ADMIN_16", "Welcome to the New page of ".SITENAME." ! This page shows, for the most common sections of this site, a list of the additions in these sections since your last visit.");
 
 define("LIST_ADMIN_SECT_1", "sections");
 define("LIST_ADMIN_SECT_2", "choose which sections to show");
@@ -148,7 +148,7 @@
 define("LIST_MENU_3", "on");
 define("LIST_MENU_4", "in");
 define("LIST_MENU_5", "days");
-define("LIST_MENU_6", "view content for how may days?");
+define("LIST_MENU_6", "view content for how many days?");
 define("LIST_MENU_7", "");
 define("LIST_MENU_8", "");
 define("LIST_MENU_9", "");
diff -x .svn -ruN 0.7.7.src/e107_plugins/list_new/list_class.php 0.7.11.src/e107_plugins/list_new/list_class.php
--- 0.7.7.src/e107_plugins/list_new/list_class.php	2006-10-28 04:02:43.000000000 -0500
+++ 0.7.11.src/e107_plugins/list_new/list_class.php	2007-09-16 12:27:03.000000000 -0500
@@ -11,9 +11,9 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_class.php,v $
-|		$Revision: 1.13 $
-|		$Date: 2006/10/28 09:02:43 $
-|		$Author: lisa_ $
+|		$Revision: 1.17 $
+|		$Date: 2007/09/16 17:27:03 $
+|		$Author: e107steved $
 +---------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -47,7 +47,7 @@
 		global $sql,$eArrayStorage;
 
 		//check preferences from database
-		$sql = new db;
+		if (!is_object($sql)){ $sql = new db; }  
 		$num_rows = $sql -> db_Select("core", "*", "e107_name='list' ");
 		$row = $sql -> db_Fetch();
 
@@ -118,10 +118,12 @@
 	//content needs this to split each main parent into separate sections
 	function getContentSections($mode)
 	{
-		global $sql, $sections, $titles, $content_types, $content_name;
+		global $sql, $sections, $titles, $content_types, $content_name, $pref;
 
-		if(!$content_install = $sql -> db_Select("plugin", "plugin_id", "plugin_path = 'content' AND plugin_installflag = '1' ")){
-			return;
+//		if(!$content_install = $sql -> db_Select("plugin", "plugin_id", "plugin_path = 'content' AND plugin_installflag = '1' "))
+		if (!$content_install = isset($pref['plug_installed']['content']))		
+		{
+		  return;
 		}
 		$datequery = " AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") ";
 
@@ -138,7 +140,7 @@
 					$titles[] = $content_name." : ".$row['content_heading'];
 				}
 			}
-		}		
+		}
 		$content_types = array_unique($content_types);
 
 		return;
@@ -146,7 +148,7 @@
 
 	function getSections()
 	{
-		global $sql, $sections, $titles;
+		global $sql, $sections, $titles, $pref;
 
 		$this -> getDefaultSections();
 
@@ -160,7 +162,8 @@
 			$tmp = array_reverse($tmp);
 			$icon['fname'] = $tmp[1];
 
-			if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$icon['fname']."' AND plugin_installflag = '1' "))
+//			if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$icon['fname']."' AND plugin_installflag = '1' "))
+			if ($plugin_installed = isset($pref['plug_installed'][$icon['fname']]))
 			{
 				if($icon['fname'] == "content")
 				{
@@ -178,7 +181,7 @@
 
 	function getDefaultPrefs()
 	{
-		global $sql, $sections, $titles, $defaultarray, $content_types, $tp;
+		global $sql, $sections, $titles, $defaultarray, $content_types, $tp, $pref;
 
 		//section preferences
 		for($i=0;$i<count($sections);$i++)
@@ -187,7 +190,8 @@
 			{
 				if(!in_array($sections[$i], $content_types))
 				{
-					if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($sections[$i], true)."' AND plugin_installflag = '1' "))
+//					if($plugin_installed = $sql -> db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($sections[$i], true)."' AND plugin_installflag = '1' "))
+					if ($plugin_installed = isset($pref['plug_installed'][$tp -> toDB($sections[$i], true)]))
 					{
 						$list_pref["$sections[$i]_recent_menu_caption"]	= $sections[$i];
 						$list_pref["$sections[$i]_recent_page_caption"]	= $sections[$i];
@@ -247,7 +251,7 @@
 			$list_pref["$sections[$i]_new_page_order"]			= ($i+1);
 			$list_pref["$sections[$i]_new_page_icon"]			= "1";
 		}
-		
+
 		//new menu preferences
 		$list_pref['new_menu_caption']				= LIST_ADMIN_15;
 		$list_pref['new_menu_icon_use']				= "1";
@@ -343,7 +347,7 @@
 		$menutext = "";
 		$start = "";
 		$end = "";
-		
+
 		$LIST_ICON = "";
 		$LIST_DATE = "";
 		$LIST_HEADING = "";
@@ -356,29 +360,29 @@
 
 		if(is_array($LIST_DATA)){			//if it is an array, data exists and data is not empty
 			for($i=0;$i<count($LIST_DATA[$mode]);$i++)
-			{				
+			{
 				$LIST_ICON		= $LIST_DATA[$mode][$i][0];
 				$LIST_HEADING	= $LIST_DATA[$mode][$i][1];
 				$LIST_AUTHOR	= $LIST_DATA[$mode][$i][2];
 				$LIST_CATEGORY	= $LIST_DATA[$mode][$i][3];
 				$LIST_DATE		= $LIST_DATA[$mode][$i][4];
 				$LIST_INFO		= $LIST_DATA[$mode][$i][5];
-				
+
 				if($mode == "recent_menu"){
 					global $sc_style;
-					$LIST_AUTHOR	= ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");					
-					$LIST_CATEGORY	= ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");					
+					$LIST_AUTHOR	= ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");
+					$LIST_CATEGORY	= ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");
 					$menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT);
-				
+
 				}elseif($mode == "new_menu"){
 					global $sc_style;
-					$LIST_AUTHOR	= ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");					
-					$LIST_CATEGORY	= ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");					
+					$LIST_AUTHOR	= ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");
+					$LIST_CATEGORY	= ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");
 					$menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW);
-				
+
 				}elseif($mode == "recent_page"){
 					$menutext .= $tp -> parseTemplate($LIST_PAGE_RECENT, FALSE, $list_shortcodes);
-				
+
 				}elseif($mode == "new_page"){
 					$menutext .= $tp -> parseTemplate($LIST_PAGE_NEW, FALSE, $list_shortcodes);
 				}
@@ -415,13 +419,13 @@
 					$start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_START);
 					$end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_END);
 				}
-			
+
 			}elseif($mode == "new_menu"){
 				if($list_pref[$mode."_showempty"] || $menutext){
 					$start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW_START);
 					$end = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW_END);
 				}
-			
+
 			}elseif($mode == "recent_page"){
 				if($list_pref[$mode."_showempty"] || $menutext){
 					$start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_PAGE_RECENT_START);
@@ -475,7 +479,7 @@
 		{
 			if(file_exists(THEME."images/bullet2.gif"))
 			{
-				$default_bullet = "<img src='".THEME."images/bullet2.gif' alt='' />";
+				$default_bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='' />";
 			}
 		}
 
@@ -497,7 +501,7 @@
 
 	function parse_heading($heading, $mode){
 		global $list_pref;
-		
+
 		if($list_pref[$mode."_char_heading"] && strlen($heading) > $list_pref[$mode."_char_heading"]){
 			$heading = substr($heading, 0, $list_pref[$mode."_char_heading"]).$list_pref[$mode."_char_postfix"];
 		}
@@ -506,7 +510,7 @@
 
 	function getListDate($datestamp, $mode){
 		global $list_pref;
-		
+
 		$datestamp += TIMEOFFSET;
 
 		$todayarray = getdate();
diff -x .svn -ruN 0.7.7.src/e107_plugins/list_new/list_recent_menu.php 0.7.11.src/e107_plugins/list_new/list_recent_menu.php
--- 0.7.7.src/e107_plugins/list_new/list_recent_menu.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/list_new/list_recent_menu.php	2007-08-08 14:34:51.000000000 -0500
@@ -11,17 +11,17 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_recent_menu.php,v $
-|		$Revision: 1.6 $
-|		$Date: 2005/12/14 19:28:44 $
-|		$Author: sweetas $
+|		$Revision: 1.7 $
+|		$Date: 2007/08/08 19:34:51 $
+|		$Author: e107steved $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-if(!$sql -> db_Select("plugin", "*", "plugin_path = 'list_new' AND plugin_installflag = '1' ")){
-	return;
-}
+if (!isset($pref['plug_installed']['list_new'])) return;
+
+
 
 global $sysprefs, $tp, $eArrayStorage;
 $listplugindir = e_PLUGIN."list_new/";
@@ -42,10 +42,13 @@
 
 //display the sections
 $text = "";
-for($i=0;$i<count($arr);$i++){
-	if($arr[$i][1] == "1"){
+for($i=0;$i<count($arr);$i++)
+{
+	if($arr[$i][1] == "1")
+	{
 		$sectiontext = $rc -> show_section_list($arr[$i], $mode);
-		if($sectiontext != ""){
+		if($sectiontext != "")
+		{
 			$text .= $sectiontext;
 		}
 	}
diff -x .svn -ruN 0.7.7.src/e107_plugins/list_new/section/list_download.php 0.7.11.src/e107_plugins/list_new/section/list_download.php
--- 0.7.7.src/e107_plugins/list_new/section/list_download.php	2006-02-17 17:23:43.000000000 -0600
+++ 0.7.11.src/e107_plugins/list_new/section/list_download.php	2007-05-03 15:09:13.000000000 -0500
@@ -14,25 +14,32 @@
 
 	$bullet = $this -> getBullet($arr[6], $mode);
 
-	$mp = MPREFIX;
-	$qry = "SELECT download_id, download_name, download_author, download_datestamp, {$mp}download_category.download_category_id, {$mp}download_category.download_category_name, {$mp}download_category.download_category_class FROM {$mp}download LEFT JOIN {$mp}download_category ON {$mp}download.download_category={$mp}download_category.download_category_id WHERE download_category_class REGEXP '".e_CLASS_REGEXP."' AND download_class REGEXP '".e_CLASS_REGEXP."' AND {$mp}download.download_active != '0' ".$qry." ORDER BY download_datestamp DESC LIMIT 0,".intval($arr[7])." ";
+	$qry = "SELECT d.download_id, d.download_name, d.download_author, d.download_datestamp, 
+	   dc.download_category_id, dc.download_category_name, dc.download_category_class 
+	   FROM #download AS d
+	   LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id
+	   WHERE dc.download_category_class REGEXP '".e_CLASS_REGEXP."' AND d.download_class REGEXP '".e_CLASS_REGEXP."' AND d.download_active != '0' ".$qry." 
+	   ORDER BY download_datestamp DESC LIMIT 0,".intval($arr[7])." ";
 
 	$downloads = $sql -> db_Select_gen($qry);
-	if($downloads == 0) {
-		$LIST_DATA = LIST_DOWNLOAD_2;
-	}else{
-		while($row = $sql -> db_Fetch()){
+	if($downloads == 0) 
+	{
+	  $LIST_DATA = LIST_DOWNLOAD_2;
+	}
+	else
+	{
+	  while($row = $sql -> db_Fetch())
+	  {
 
-			$rowheading	= $this -> parse_heading($row['download_name'], $mode);
-			$ICON		= $bullet;
-			$HEADING	= "<a href='".e_BASE."download.php?view.".$row['download_id']."' title='".$row['download_name']."'>".$rowheading."</a>";
-			$AUTHOR		= ($arr[3] ? $row['download_author'] : "");
-			//$AUTHOR	= ($arr[3] ? (USERID ? "<a href='".e_BASE."user.php?id.".$row['download_author_id']."'>".$row['download_author']."</a>" : $row['download_author']) : "");
-			$CATEGORY	= ($arr[4] ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$row['download_category_name']."</a>" : "");
-			$DATE		= ($arr[5] ? $this -> getListDate($row['download_datestamp'], $mode) : "");
-			$INFO		= "";
-			$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
-		}
+		$rowheading	= $this -> parse_heading($row['download_name'], $mode);
+		$ICON		= $bullet;
+		$HEADING	= "<a href='".e_BASE."download.php?view.".$row['download_id']."' title='".$row['download_name']."'>".$rowheading."</a>";
+		$AUTHOR		= ($arr[3] ? $row['download_author'] : "");
+		$CATEGORY	= ($arr[4] ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$row['download_category_name']."</a>" : "");
+		$DATE		= ($arr[5] ? $this -> getListDate($row['download_datestamp'], $mode) : "");
+		$INFO		= "";
+		$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
+	  }
 	}
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/list_new/section/list_members.php 0.7.11.src/e107_plugins/list_new/section/list_members.php
--- 0.7.7.src/e107_plugins/list_new/section/list_members.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.11.src/e107_plugins/list_new/section/list_members.php	2007-01-31 11:08:38.000000000 -0600
@@ -7,15 +7,15 @@
 	
 	if($mode == "new_page" || $mode == "new_menu" ){
 		$lvisit = $this -> getlvisit();
-		$qry = "user_join>".$lvisit." AND user_ban='0' AND ";
+		$qry = "user_join>".$lvisit." AND ";
 	}else{
 		$qry = " ";
 	}
-	$qry .= " (user_class = '' || user_class REGEXP '".e_CLASS_REGEXP."') ORDER BY user_join DESC LIMIT 0,".intval($arr[7]);
+	$qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0,".intval($arr[7]);
 
 	$bullet = $this -> getBullet($arr[6], $mode);
 
-	if(!$sql -> db_Select("user", "*", $qry)){ 
+	if(!$sql -> db_Select("user", "user_id,user_name,user_join", $qry)){ 
 		$LIST_DATA = LIST_MEMBER_2;
 	}else{
 		while($row = $sql -> db_Fetch()){
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/consolidate.php 0.7.11.src/e107_plugins/log/consolidate.php
--- 0.7.7.src/e107_plugins/log/consolidate.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.11.src/e107_plugins/log/consolidate.php	2007-02-10 09:54:31.000000000 -0600
@@ -10,32 +10,39 @@
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
+|     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/consolidate.php,v $
+|     $Revision: 1.17 $
+|     $Date: 2007/02/10 15:54:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 /* first thing to do is check if the log file is out of date ... */
-
-//require_once("../../class2.php");
-
 $pathtologs = e_PLUGIN."log/logs/";
 $date = date("z.Y", time());
-$date2 = date("Y-m-j", (time() -86400));
-$date3 = date("Y-m");
-$day = date("z", time());
-$year = date("Y", time());
-
-$pfileprev = "logp_".($day-1).".".$year.".php";
-$pfile = "logp_".$date.".php";
-$ifileprev = "logi_".($day-1).".".$year.".php";
+$yesterday = date("z.Y",(time() - 86400));		// This makes sure year wraps round OK
+$date2 = date("Y-m-j", (time() -86400));		// Yesterday's date for the database summary	
+$date3 = date("Y-m");							// Current month's date for monthly summary
+
+$pfileprev = "logp_".$yesterday.".php";		// Yesterday's log file
+$pfile = "logp_".$date.".php";				// Today's log file
+$ifileprev = "logi_".$yesterday.".php";
 $ifile = "logi_".$date.".php";
 
-if(file_exists($pathtologs.$pfile)) {
+if(file_exists($pathtologs.$pfile)) 
+{
 	/* log file is up to date, no consolidation required */
 	return;
-}else if(!file_exists($pathtologs.$pfileprev)) {
-	/* no logfile found at all - create - this will only ever happen once ... */
+}
+else if(!file_exists($pathtologs.$pfileprev)) 
+{  // See if any older log files
+  if (($retvalue = check_for_old_files($pathtologs)) === FALSE)
+  { 	/* no logfile found at all - create - this will only ever happen once ... */
 	createLog("blank");
 	return FALSE;
+  }
+  // ... if we've got files
+  list($pfileprev,$ifileprev,$date2,$tstamp) = explode('|',$retvalue);
 }
 
 
@@ -47,7 +54,7 @@
 	$infoArray = array();
 	while($row = $sql -> db_Fetch())
 	{
-		$$row[1] = unserialize($row[2]);
+		$$row[1] = unserialize($row[2]);	// $row[1] is the stats type - save in a variable
 		if($row[1] == "statUnique") $statUnique = $row[2];
 		if($row[1] == "statTotal") $statTotal = $row[2];
 	}
@@ -207,14 +214,16 @@
 	fclose($handle);
 }
 
-/* and finally, we need to create a new logfiles for today ... */
+/* and finally, we need to create new logfiles for today ... */
 createLog();
 /* done! */
 
 
-function createLog($mode="default") {
-	global $pathtologs, $statTotal, $statUnique, $pageArray, $pfile, $ifile;
-	if(!is_writable($pathtologs)) {
+function createLog($mode="default") 
+{
+	global $pathtologs, $statTotal, $statUnique, $pfile, $ifile;
+	if(!is_writable($pathtologs)) 
+	{
 		echo "Log directory is not writable - please CHMOD ".e_PLUGIN."log/logs to 777";
 		return FALSE;
 	}
@@ -233,18 +242,6 @@
 	$varStart."osInfo = array();\n".
 	$varStart."pageInfo = array(\n";
 
-	if($mode == "default") {
-		reset($pageArray);
-		$loop = FALSE;
-		foreach($pageArray as $key => $info) {
-			if($loop) {
-				$data .= ",\n";
-			}
-			$data .= $quote.$key.$quote." => array('url' => '".$info['url']."', 'ttl' => 0, 'unq' => 0, 'ttlv' => ".$info['ttlv'].", 'unqv' => ".$info['unqv'].")";
-			$loop = TRUE;
-		}
-	}
-
 	$data .= "\n);\n\n?".  chr(62);
 
 	if(!touch($pathtologs.$pfile)) {
@@ -269,16 +266,60 @@
 	//	return FALSE;
 	}
 
-	if ($handle = fopen($pathtologs.$pfile, 'w')) { 
+	if ($handle = fopen($pathtologs.$pfile, 'w')) 
+	{ 
 		fwrite($handle, $data);
 	}
 	fclose($handle);
 
-	if ($handle = fopen($pathtologs.$ifile, 'w')) { 
-		fwrite($handle, "");
+
+$data = "<?php
+
+/* e107 website system: Log info file: ".date("z:Y", time())." */
+
+";
+$data .= '$domainInfo'." = array();\n\n";
+$data .= '$screenInfo'." = array();\n\n";
+$data .= '$browserInfo'." = array();\n\n";
+$data .= '$osInfo'." = array();\n\n";
+$data .= '$refInfo'." = array();\n\n";
+$data .= '$searchInfo'." = array();\n\n";
+$data .= '$visitInfo'." = array();\n\n";
+$data .= "?>";
+
+	if ($handle = fopen($pathtologs.$ifile, 'w')) 
+	{ 
+		fwrite($handle, $data);
 	}
 	fclose($handle);
 	return;
 }
 
+// Called if both today's and yesterday's log files missing, to see
+// if there are any older files we could process. Return FALSE if nothing
+// Otherwise return a string of relevant information
+function check_for_old_files($pathtologs)
+{
+  $no_files = TRUE;
+  if ($dir_handle = opendir($pathtologs))
+  {
+    while (false !== ($file = readdir($dir_handle))) 
+	{
+	// Do match on #^logp_(\d{1,3})\.php$#i
+	  if (preg_match('#^logp_(\d{1,3}\.\d{4})\.php$#i',$file,$match) == 1)
+	  {  // got a matching file
+	    $yesterday = $match[1];						// Day of year - zero is 1st Jan
+		$pfileprev = "logp_".$yesterday.".php";		// Yesterday's log file
+		$ifileprev = "logi_".$yesterday.".php";
+		list($day,$year) = explode('.',$yesterday);
+		$tstamp = mktime(0,0,0,1,1,$year) + ($day*86400);
+		$date2 = date("Y-m-j", $tstamp);		// Yesterday's date for the database summary	
+		$temp = array($pfileprev,$ifileprev,$date2,$tstamp);
+		return implode('|',$temp);
+	  }
+	}
+  }
+  return FALSE;
+}
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/e_meta.php 0.7.11.src/e107_plugins/log/e_meta.php
--- 0.7.7.src/e107_plugins/log/e_meta.php	2006-07-09 14:40:43.000000000 -0500
+++ 0.7.11.src/e107_plugins/log/e_meta.php	2007-08-14 14:26:55.000000000 -0500
@@ -6,9 +6,9 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/e_meta.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/07/09 19:40:43 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2007/08/14 19:26:55 $
+|     $Author: e107steved $
 +-----------------------------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -22,11 +22,18 @@
 	else
 	{
 		require_once(e_PLUGIN."log/consolidate.php");
+		$err_flag = '';
+		if (defined("ERR_PAGE_ACTIVE"))
+		{	// We've got an error - set a flag to log it
+		  $err_flag = "&err_direct=".ERR_PAGE_ACTIVE;
+		  if (is_numeric(e_QUERY)) $err_flag .= '/'.substr(e_QUERY,0,10);		// This should pick up the error code - and limit numeric length to upset the malicious
+		  $err_flag .= "&err_referer=".$_SERVER['HTTP_REFERER'];
+		}
 		echo "<script type='text/javascript'>\n";
 		echo "<!--\n";
-		echo "document.write( '<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '\">' );\n";
+		echo "document.write( '<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '{$err_flag}\">' );\n";
 		echo "// -->\n";
-		echo "</script>";
+		echo "</script>\n\n";
 	}
 }
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/languages/English.php 0.7.11.src/e107_plugins/log/languages/English.php
--- 0.7.7.src/e107_plugins/log/languages/English.php	2006-06-22 14:49:58.000000000 -0500
+++ 0.7.11.src/e107_plugins/log/languages/English.php	2007-08-14 14:26:55.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/languages/English.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/06/22 19:49:58 $
-|     $Author: e107coders $
+|     $Revision: 1.9 $
+|     $Date: 2007/08/14 19:26:55 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -60,5 +60,15 @@
 define("ADSTAT_L39", "remove this entry");
 define("ADSTAT_L40", "days");
 define("ADSTAT_L41", "Error");
+define("ADSTAT_L42", "No monthly stats yet.");
+
+define("ADSTAT_L43", "Today's page errors");
+define("ADSTAT_L44", "All-time page errors");
+define("ADSTAT_L45", "Stats deleted for: ");
+define("ADSTAT_L46", "Note: any stats for today will not be deleted");
+define("ADSTAT_L47", "No stats found for: ");
+define("ADSTAT_L48", "");
+define("ADSTAT_L49", "");
+define("ADSTAT_L50", "");
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/languages/admin/English.php 0.7.11.src/e107_plugins/log/languages/admin/English.php
--- 0.7.7.src/e107_plugins/log/languages/admin/English.php	2006-10-21 06:24:08.000000000 -0500
+++ 0.7.11.src/e107_plugins/log/languages/admin/English.php	2007-05-30 15:48:59.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/languages/admin/English.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/10/21 11:24:08 $
-|     $Author: mrpete $
+|     $Revision: 1.13 $
+|     $Date: 2007/05/30 20:48:59 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 	
@@ -45,17 +45,14 @@
 define("ADSTAT_L24", "Go to update script");
 define("ADSTAT_L25", "Selected stats reset");
 define("ADSTAT_L26", "Remove page entries");
-define("ADSTAT_L27", "if your stats have incorrect pages, you can remove them here");
+define("ADSTAT_L27", "If your stats have incorrect pages, you can remove them here");
 define("ADSTAT_L28", "Open page");
-
-
 define("ADSTAT_L29", "Page Name");
 define("ADSTAT_L30", "Check to remove");
 define("ADSTAT_L31", "Remove selected pages");
 define("ADSTAT_L32", "Page Tidy");
-//define("ADSTAT_L10", "Referrers");
-//define("ADSTAT_L10", "Referrers");
-
+define("ADSTAT_L33", "Configure Statistics Logging");
+define("ADSTAT_L34", "Site Stats");
 
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/log.php 0.7.11.src/e107_plugins/log/log.php
--- 0.7.7.src/e107_plugins/log/log.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/log/log.php	2007-11-11 06:11:03.000000000 -0600
@@ -10,21 +10,66 @@
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
+| File locking, modified getip() 18.01.07
+|
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/log.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.27 $
+|     $Date: 2007/11/11 12:11:03 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
+// File called with:
+// e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '\">' );\n";
+// referer= ref
+// color= colord
+// eself= eself 
+// res= res
+// err_direct - optional error flag
+// err_referer - referrer if came via error page
 define("log_INIT", TRUE);
+
+
 $colour = strip_tags((isset($_REQUEST['color']) ? $_REQUEST['color'] : ''));
 $res = strip_tags((isset($_REQUEST['res']) ? $_REQUEST['res'] : ''));
 $self = strip_tags((isset($_REQUEST['eself']) ? $_REQUEST['eself'] : ''));
 $ref = addslashes(strip_tags((isset($_REQUEST['referer']) ? $_REQUEST['referer'] : '')));
 $date = date("z.Y", time());
+$logPfile = "logs/logp_".$date.".php";
+
+
+// vet resolution and colour depth some more - avoid dud values
+if ($res && preg_match("#.*?((\d+)\w+?(\d+))#", $res, $match))
+{
+  $res = $match[2].'x'.$match[3];
+}
+else
+{
+  $res = '??';			// Can't decode resolution
+}
+
+if ($colour && preg_match("#.*?(\d+)#",$colour,$match))
+{
+  $colour = intval($match[1]);
+}
+else
+{
+  $colour='??';
+}
+
+
+if ($err_code = strip_tags((isset($_REQUEST['err_direct']) ? $_REQUEST['err_direct'] : '')))
+{
+  $ref = addslashes(strip_tags(isset($_REQUEST['err_referer']) ? $_REQUEST['err_referer'] : ''));
+  $log_string = $err_code.",".$self.",".$ref;
+// Uncomment the next two lines to create a separate CSV format log of invalid accesses - error code, entered URL, referrer
+//  $logname = "logs/errpages.csv";
+//  $logfp = fopen($logname, 'a+'); fwrite($logfp, $log_string."\n\r"); fclose($logfp);
+  $err_code .= ':';
+}
 
-if(strstr($ref, "admin")) {
+if(strstr($ref, "admin")) 
+{
 	$ref = FALSE;
 }
 
@@ -32,15 +77,15 @@
 $agent = $_SERVER['HTTP_USER_AGENT'];
 $ip = getip();
 
-$oldref = $ref; // backup for search string being stripped of for referer
-if($ref && !strstr($ref, $_SERVER['HTTP_HOST'])) {
-	if(preg_match("#http://(.*?)($|/)#is", $ref, $match)) {
-		$ref = $match[0];
-	}
+$oldref = $ref; // backup for search string being stripped off for referer
+if($ref && !strstr($ref, $_SERVER['HTTP_HOST'])) 
+{
+  if(preg_match("#http://(.*?)($|/)#is", $ref, $match)) 
+  {
+	$ref = $match[0];
+  }
 }
 
-$infodata = time().chr(1).$ip.chr(1).$agent.chr(1).$colour.chr(1).$res.chr(1).$self.chr(1).$ref."\n";
-
 $pageDisallow = "cache|file|eself|admin";
 $tagRemove = "(\\\)|(\s)|(\')|(\")|(eself)|(&nbsp;)|(\.php)|(\.html)";
 $tagRemove2 = "(\\\)|(\s)|(\')|(\")|(eself)|(&nbsp;)";
@@ -51,39 +96,61 @@
 $PN = $pageName;
 $pageName = preg_replace("/".$tagRemove."/si", "", $pageName);
 if($pageName == "") $pageName = "index";
-if(preg_match("/".$pageDisallow."/i", $pageName)) return;
 
+$pageName = $err_code.$pageName;			// Add the error code at the beginning, so its treated uniquely
 
-$logPfile = "logs/logp_".$date.".php";
-require_once($logPfile);
+if(preg_match("/".$pageDisallow."/i", $pageName)) return;
 
-$flag = FALSE;
-if(array_key_exists($pageName, $pageInfo)) {
-	$pageInfo[$pageName]['ttl'] ++;
-} else {
-	$url = preg_replace("/".$tagRemove2."/si", "", $self);
-	if(preg_match("/".$pageDisallow."/i", $url)) return;
-	$pageInfo[$pageName] = array('url' => $url, 'ttl' => 1, 'unq' => 1);
-	$flag = TRUE;
+
+$p_handle = fopen($logPfile, 'r+');
+if($p_handle && flock( $p_handle, LOCK_EX ) ) 
+{
+  $log_file_contents = '';
+  while (!feof($p_handle))
+  {  // Assemble a string of data
+    $log_file_contents.= fgets($p_handle,1000);
+  }
+  $log_file_contents = str_replace(array('<'.'?php','?'.'>'),'',$log_file_contents);
+  if (eval($log_file_contents) === FALSE) echo "error in log file contents<br /><br /><br /><br />";
+}
+else
+{
+  echo "Couldn't log data<br /><br /><br /><br />";
+  exit;
 }
 
-if(!strstr($ipAddresses, $ip)) {
-	/* unique visit */
-	if(!$flag) {
-		$pageInfo[$pageName]['unq'] ++;
-	}
-	$siteUnique ++;
-	$ipAddresses .= $ip.".";
-	require_once("loginfo.php");
+
+$flag = FALSE;
+if(array_key_exists($pageName, $pageInfo)) 
+{  // Existing page - just increment stats
+  $pageInfo[$pageName]['ttl'] ++;
+}
+else 
+{  // First access of page
+  $url = preg_replace("/".$tagRemove2."/si", "", $self);
+  if(preg_match("/".$pageDisallow."/i", $url)) return;
+  $pageInfo[$pageName] = array('url' => $url, 'ttl' => 1, 'unq' => 1);
+  $flag = TRUE;
+}
+
+if(!strstr($ipAddresses, $ip)) 
+{	/* unique visit */
+  if(!$flag) 
+  {
+	$pageInfo[$pageName]['unq'] ++;
+  }
+  $siteUnique ++;
+  $ipAddresses .= $ip.".";		// IP address is stored as hex string
+  require_once("loginfo.php");
 }
 
 $siteTotal ++;
 $info_data = var_export($pageInfo, true);
-$date_stamp = date("z:Y", time());
+//$date_stamp = date("z:Y", time());			// Same as '$date' variable
 
 $data = "<?php
 
-/* e107 website system: Log file: {$date_stamp} */
+/* e107 website system: Log file: {$date} */
 
 \$ipAddresses = '{$ipAddresses}';
 \$siteTotal = '{$siteTotal}';
@@ -93,30 +160,51 @@
 
 ?>";
 
-if ($handle = fopen($logPfile, 'w')) {
-	fwrite($handle, $data);
+if ($p_handle)
+{
+  ftruncate( $p_handle, 0 );
+  fseek( $p_handle, 0 );
+  fwrite($p_handle, $data);
+  fclose($p_handle);
 }
-fclose($handle);
 
-function getip($mode=TRUE) {
-	if (getenv('HTTP_X_FORWARDED_FOR')) {
-		$ip = $_SERVER['REMOTE_ADDR'];
-		if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)) {
-			$ip2 = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10..*/', '/^224..*/', '/^240..*/');
-			$ip = preg_replace($ip2, $ip, $ip3[1]);
-		}
-	} else {
-		$ip = $_SERVER['REMOTE_ADDR'];
-	}
-	if ($ip == "") {
-		$ip = "x.x.x.x";
-	}
-	if($mode) {
-		$ipa = explode(".", $ip);
-		return sprintf('%02x%02x%02x%02x', $ipa[0], $ipa[1], $ipa[2], $ipa[3]);
-	} else {
-		return $ip;
+
+
+function getip($mode=TRUE) 
+{
+  if (getenv('HTTP_X_FORWARDED_FOR')) 
+  {
+	$ip = $_SERVER['REMOTE_ADDR'];
+	if (preg_match("#^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})#", getenv('HTTP_X_FORWARDED_FOR'), $ip3)) 
+	{  
+      $ip2 = array('#^0\..*#', 
+			   '#^127\..*#', 							// Local loopbacks
+			   '#^192\.168\..*#', 						// RFC1918 - Private Network
+			   '#^172\.(?:1[6789]|2\d|3[01])\..*#', 	// RFC1918 - Private network
+			   '#^10\..*#', 							// RFC1918 - Private Network
+			   '#^169\.254\..*#', 						// RFC3330 - Link-local, auto-DHCP 
+			   '#^2(?:2[456789]|[345][0-9])\..*#'		// Single check for Class D and Class E
+			   );
+	  $ip = preg_replace($ip2, $ip, $ip3[1]);
 	}
+  }
+  else 
+  {
+	$ip = $_SERVER['REMOTE_ADDR'];
+  }
+  if ($ip == "") 
+  {
+	$ip = "x.x.x.x";
+  }
+  if($mode) 
+  {
+	$ipa = explode(".", $ip);
+	return sprintf('%02x%02x%02x%02x', $ipa[0], $ipa[1], $ipa[2], $ipa[3]);
+  }
+  else 
+  {
+	return $ip;
+  }
 }
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/loginfo.php 0.7.11.src/e107_plugins/log/loginfo.php
--- 0.7.7.src/e107_plugins/log/loginfo.php	2006-11-09 16:03:18.000000000 -0600
+++ 0.7.11.src/e107_plugins/log/loginfo.php	2007-02-10 09:54:31.000000000 -0600
@@ -11,26 +11,48 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/loginfo.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/11/09 22:03:18 $
-|     $Author: mrpete $
+|     $Revision: 1.17 $
+|     $Date: 2007/02/10 15:54:31 $
+|     $Author: e107steved $
+|
+| File locking added
+|
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('log_INIT')) { exit; }
 
 $logIfile = "logs/logi_{$date}.php";
-require_once($logIfile);
+$i_handle = fopen($logIfile, 'r+');
+if($i_handle && flock( $i_handle, LOCK_EX ) ) 
+{
+  $log_file_contents = '';
+  while (!feof($i_handle))
+  {  // Assemble a string of data
+    $log_file_contents.= fgets($i_handle,1000);
+  }
+  $log_file_contents = str_replace(array('<'.'?php','?'.'>'),'',$log_file_contents);
+  if (eval($log_file_contents) === FALSE) echo "error in log file contents<br /><br /><br /><br />";
+}
+else
+{
+  echo "Couldn't log data<br /><br /><br /><br />";
+  exit;
+}
 
 $browser = getBrowser($agent);
 $os = getOs($agent);
 
-if($screenstats && $screenstats != "@") {
-	if(array_key_exists($screenstats, $screenInfo)) {
-		$screenInfo[$screenstats] ++;
-	} else {
-		$screenInfo[$screenstats] = 1;
-	}
+if($screenstats && $screenstats != "@") 
+{
+  if(array_key_exists($screenstats, $screenInfo)) 
+  {
+	$screenInfo[$screenstats] ++;
+  } 
+  else 
+  {
+	$screenInfo[$screenstats] = 1;
+  }
 }
 
 if(array_key_exists($browser, $browserInfo)) {
@@ -109,13 +131,17 @@
 $data .= '$visitInfo = '.var_export($visitInfo, true).";\n\n";
 $data .= '?>';
 
-if ($handle = fopen($logIfile, 'w')) {
-	fwrite($handle, $data);
+
+if ($i_handle)
+{
+  ftruncate($i_handle, 0);
+  fseek( $i_handle, 0 );
+  fwrite($i_handle, $data);
+  fclose($i_handle);
 }
-fclose($handle);
+
 
 function getBrowser($agent) {
-	
 	//
 	// All "root" browsers must come at the end of the list, unfortunately.
 	// Otherwise, browsers based on them will never be seen.
@@ -198,6 +224,7 @@
 
 function getOs($agent) {
 	$os = array(
+		"windowsvista" => array('name' => 'Windows Vista', 'rule' => 'wi(n|ndows)[ \-]?nt[ /]?6\.0'),
 		"windows2003" => array('name' => 'Windows 2003', 'rule' => 'wi(n|ndows)[ \-]?(2003|nt[ /]?5\.2)'),
 		"windowsxp"   => array('name' => 'Windows XP',   'rule' => 'Windows XP'),
 		"windowsxp2"  => array('name' => 'Windows XP',   'rule' => 'wi(n|ndows)[ \-]?nt[ /]?5\.1'),
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/plugin.php 0.7.11.src/e107_plugins/log/plugin.php
--- 0.7.7.src/e107_plugins/log/plugin.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/log/plugin.php	2007-05-30 15:48:59.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/plugin.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2007/05/30 20:48:59 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -45,11 +45,22 @@
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/stats_32.png";
 $eplug_icon_small = $eplug_folder."/images/stats_16.png";
-$eplug_caption = "Configure Statitics Logging";
+$eplug_caption = ADSTAT_L33;
 	
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefTable = "menu_pref";
-$eplug_prefs = array("statActivate" => 0, "statUserclass" => "", "statClass" => 0, "statBrowser" => 1, "statOs" => 1, "statScreen" => 1, "statDomain" => 1, "statRefer" => 1, "statQuery" => 1, "statRecent" => 1);
+$eplug_prefs = array(
+		"statActivate" => 0, 
+		"statUserclass" => "", 
+		"statClass" => 0, 
+		"statBrowser" => 1, 
+		"statOs" => 1, 
+		"statScreen" => 1, 
+		"statDomain" => 1, 
+		"statRefer" => 1, 
+		"statQuery" => 1, 
+		"statRecent" => 1
+		);
 	
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array("logstats");
@@ -67,7 +78,7 @@
 	
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = TRUE;
-$eplug_link_name = "Site Stats";
+$eplug_link_name = ADSTAT_L34;
 $eplug_link_url = e_PLUGIN."log/stats.php?1";
 	
 	
diff -x .svn -ruN 0.7.7.src/e107_plugins/log/stats.php 0.7.11.src/e107_plugins/log/stats.php
--- 0.7.7.src/e107_plugins/log/stats.php	2006-02-20 19:19:33.000000000 -0600
+++ 0.7.11.src/e107_plugins/log/stats.php	2007-08-14 14:26:55.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/stats.php,v $
-|     $Revision: 1.37 $
-|     $Date: 2006/02/21 01:19:33 $
-|     $Author: sweetas $
+|     $Revision: 1.40 $
+|     $Date: 2007/08/14 19:26:55 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -48,18 +48,17 @@
 	exit;
 }
 
-if(strstr(e_QUERY, ".")) {
-	list($action, $order) = explode(".", e_QUERY);
-} else {
-	$action = e_QUERY;
-	$order = FALSE;
-}
 
-$action = intval($action);
+$qs = explode('.', e_QUERY, 3);
+$action = varset($qs[0],1);
+$sec_action = varset($qs[1],FALSE);
+$order = varset($qs[2],0);
+
 $toremove = $order;
 $order = intval($order);
 
-if($stat -> error) {
+if($stat -> error) 
+{
 	$ns->tablerender(ADSTAT_L6, $stat -> error);
 	require_once(FOOTERF);
 	exit;
@@ -133,10 +132,10 @@
 $country["com"] = "Commercial Users";
 $country["edu"] = "Education";
 $country["gov"] = "Government";
-$country["int"] = "Oganization established by an International Treaty";
+$country["int"] = "Organisation established by an International Treaty";
 $country["mil"] = "Military";
 $country["net"] = "Network";
-$country["org"] = "Organization";
+$country["org"] = "Organisation";
 $country["ad"] = "Andorra";
 $country["ae"] = "United Arab Emirates";
 $country["af"] = "Afghanistan";
@@ -381,6 +380,7 @@
 $country["zr"] = "Zaire";
 $country["zw"] = "Zimbabwe";
 
+
 /* stats displayed will depend on the query string. For example, ?1.2.4 will render today's stats, all time stats and browser stats */
 /*
 1: today's stats
@@ -393,90 +393,134 @@
 8: search engine strings
 */
 
-switch($action) {
+$text = '';
+if ((ADMIN == TRUE) && ($sec_action == "rem"))
+{
+  $toremove = rawurldecode($toremove);
+  if ($stat -> remove_entry($toremove))
+  {
+    $text .= "<div style='text-align: center; font-weight: bold'>".ADSTAT_L45.$toremove."<br />".ADSTAT_L46."</div>";
+  }
+  else
+  {
+    $text .= "<div style='text-align: center; font-weight: bold'>".ADSTAT_L47.$toremove."</div>";
+  }
+}
+
+$action = intval($action);
+
+switch($action) 
+{
 	case 1:
-	$text = $stat -> renderTodaysVisits();
+	$text .= $stat -> renderTodaysVisits(FALSE);
 	break;
 	case 2:
-	$text = $stat -> renderAlltimeVisits();
+	$text .= $stat -> renderAlltimeVisits(FALSE);
+	break;
+	case 12:
+	  if (ADMIN == TRUE)
+		$text .= $stat -> renderTodaysVisits(TRUE);
+	break;
+	case 13:
+	  if (ADMIN == TRUE)
+		$text .= $stat -> renderAlltimeVisits(TRUE);
 	break;
 	case 3:
 	if($pref['statBrowser']) {
-		$text = $stat -> renderBrowsers();
+		$text .= $stat -> renderBrowsers();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 4:
 	if($pref['statOs']) {
-		$text = $stat -> renderOses();
+		$text .= $stat -> renderOses();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 5:
 	if($pref['statDomain']) {
-		$text = $stat -> renderDomains();
+		$text .= $stat -> renderDomains();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 6:
 	if($pref['statScreen']) {
-		$text = $stat -> renderScreens();
+		$text .= $stat -> renderScreens();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 7:
 	if($pref['statRefer']) {
-		$text = $stat -> renderRefers();
+		$text .= $stat -> renderRefers();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 8:
 	if($pref['statQuery']) {
-		$text = $stat -> renderQueries();
+		$text .= $stat -> renderQueries();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 9:
 	if($pref['statRecent']) {
-		$text = $stat -> recentVisitors();
+		$text .= $stat -> recentVisitors();
 	} else {
-		$text = ADSTAT_L7;
+		$text .= ADSTAT_L7;
 	}
 	break;
 	case 10:
-	$text = $stat -> renderDaily();
+	$text .= $stat -> renderDaily();
 	break;
 	case 11:
-	$text = $stat -> renderMonthly();
-	break;
-	case "rem":
-	$stat -> remove_entry($toremove);
+	$text .= $stat -> renderMonthly();
 	break;
+	default :
+	  $text .= $stat -> renderTodaysVisits(FALSE);
 }
 
 
-/* render links */
+
+/* render links 
+ 1 - Todays visits
+ 2 - All-time
+ 3 - Browser stats
+ 4 - OS Stats
+ 5 - Domain Stats
+ 6 - Screen resolution
+ 7 - Referral stats
+ 8 - Search strings
+ 9 - Recent visitors
+10 - Daily Stats
+11 - Monthly stats
+12 - Today's error page visits
+13 - All-time error page visits
+*/
+
 $path = e_PLUGIN."log/stats.php";
 $links = "
 <div style='text-align: center;'>".
-(e_QUERY != 1 ? "<a href='$path?1'>".ADSTAT_L8."</a>" : "<b>".ADSTAT_L8."</b>")." | ".
-(e_QUERY != 2 ? "<a href='$path?2'>".ADSTAT_L9."</a>" : "<b>".ADSTAT_L9."</b>")." | ".
-(e_QUERY != 10 ? "<a href='$path?10'>".ADSTAT_L10."</a>" : "<b>".ADSTAT_L10."</b>")." | ".
-(e_QUERY != 11 ? "<a href='$path?11'>".ADSTAT_L11."</a>" : "<b>".ADSTAT_L11."</b>")." | ".
-(e_QUERY != 3 && $pref['statBrowser'] ? "<a href='$path?3'>".ADSTAT_L12."</a> | " : ($pref['statBrowser'] ? "<b>".ADSTAT_L12."</b> | " : "")).
-(e_QUERY != 4 && $pref['statOs'] ? "<a href='$path?4'>".ADSTAT_L13."</a> | " : ($pref['statOs'] ? "<b>".ADSTAT_L13."</b> | " : "")).
-(e_QUERY != 5 && $pref['statDomain'] ? "<a href='$path?5'>".ADSTAT_L14."</a> | " : ($pref['statDomain'] ? "<b>".ADSTAT_L14."</b> | " : "")).
-(e_QUERY != 6 && $pref['statScreen'] ? "<a href='$path?6'>".ADSTAT_L15."</a> | " : ($pref['statScreen'] ? "<b>".ADSTAT_L15."</b> | " : "")).
-(e_QUERY != 7 && $pref['statRefer'] ? "<a href='$path?7'>".ADSTAT_L16."</a> | " : ($pref['statRefer'] ? "<b>".ADSTAT_L16."</b> | " : "")).
-(e_QUERY != 8 && $pref['statQuery'] ? "<a href='$path?8'>".ADSTAT_L17."</a> | " : ($pref['statQuery'] ? "<b>".ADSTAT_L17."</b> | " : "")).
-(e_QUERY != 9 && $pref['statRecent'] ? "<a href='$path?9'>".ADSTAT_L18."</a>" : ($pref['statRecent'] ? "<b>".ADSTAT_L18."</b>" : "")).
-"</div><br /><br />";
+($action != 1 ? "<a href='{$path}?1'>".ADSTAT_L8."</a>" : "<b>".ADSTAT_L8."</b>")." | ".
+($action != 2 ? "<a href='{$path}?2'>".ADSTAT_L9."</a>" : "<b>".ADSTAT_L9."</b>")." | ".
+($action != 10 ? "<a href='{$path}?10'>".ADSTAT_L10."</a>" : "<b>".ADSTAT_L10."</b>")." | ".
+($action != 11 ? "<a href='{$path}?11'>".ADSTAT_L11."</a>" : "<b>".ADSTAT_L11."</b>")." | ".
+($action != 3 && $pref['statBrowser'] ? "<a href='{$path}?3'>".ADSTAT_L12."</a> | " : ($pref['statBrowser'] ? "<b>".ADSTAT_L12."</b> | " : "")).
+($action != 4 && $pref['statOs'] ? "<a href='{$path}?4'>".ADSTAT_L13."</a> | " : ($pref['statOs'] ? "<b>".ADSTAT_L13."</b> | " : "")).
+($action != 5 && $pref['statDomain'] ? "<a href='{$path}?5'>".ADSTAT_L14."</a> | " : ($pref['statDomain'] ? "<b>".ADSTAT_L14."</b> | " : "")).
+($action != 6 && $pref['statScreen'] ? "<a href='{$path}?6'>".ADSTAT_L15."</a> | " : ($pref['statScreen'] ? "<b>".ADSTAT_L15."</b> | " : "")).
+($action != 7 && $pref['statRefer'] ? "<a href='{$path}?7'>".ADSTAT_L16."</a> | " : ($pref['statRefer'] ? "<b>".ADSTAT_L16."</b> | " : "")).
+($action != 8 && $pref['statQuery'] ? "<a href='{$path}?8'>".ADSTAT_L17."</a> | " : ($pref['statQuery'] ? "<b>".ADSTAT_L17."</b> | " : "")).
+($action != 9 && $pref['statRecent'] ? "<a href='{$path}?9'>".ADSTAT_L18."</a> | " : ($pref['statRecent'] ? "<b>".ADSTAT_L18."</b> | " : ""));
+if (ADMIN == TRUE)
+$links .= 
+($action != 12 ? "<a href='{$path}?12'>".ADSTAT_L43."</a>" : "<b>".ADSTAT_L43."</b>")." | ".
+($action != 13 ? "<a href='{$path}?13'>".ADSTAT_L44."</a>" : "<b>".ADSTAT_L44."</b>");
+$links .= "</div><br /><br />";
 
 
 
@@ -501,7 +545,8 @@
 	var $filesiteTotal;
 	var $filesiteUnique;
 
-	function siteStats() {
+	function siteStats() 
+	{
 		/* constructor */
 		global $sql;
 
@@ -560,7 +605,8 @@
 		/* end constructor */
 	}
 
-	function arraySort($array, $column, $order = SORT_DESC){
+	function arraySort($array, $column, $order = SORT_DESC)
+	{
 		/* sorts multi-dimentional array based on which field is passed */
 		$i=0;
 		foreach($array as $info) {
@@ -574,74 +620,131 @@
 	
 	/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 
-	function renderTodaysVisits() {
+	function renderTodaysVisits($do_errors = FALSE) 
+	{
 		/* renders information for today only */
-		$totalArray = $this -> arraySort($this -> fileInfo, "ttl");
 
-		foreach($totalArray as $key => $info) {
+		$do_errors = $do_errors && ADMIN && getperms("P");
+
+		// Now run through and keep either the non-error pages, or the error pages, according to $do_errors
+		$totalArray = array();
+		$totalv = 0;
+		$totalu = 0;
+		foreach ($this -> fileInfo as $k => $v)
+		{
+		  $found = (strpos($k,'error/') === 0);
+		  if ($do_errors XOR !$found) 
+		  {
+		    $totalArray[$k] = $v;
+			$total += $v['ttlv'];
+		  }
+		}
+		$totalArray = $this -> arraySort($totalArray, "ttl");
+
+		foreach($totalArray as $key => $info) 
+		{
 			$totalv += $info['ttl'];
 			$totalu += $info['unq'];
 		}
 
 		$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
-		foreach($totalArray as $key => $info) {
-			if($info['ttl']){
+		foreach($totalArray as $key => $info) 
+		{
+			if($info['ttl'])
+			{
 				$percentage = round(($info['ttl']/$totalv) * 100, 2);
 				$text .= "<tr>\n<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a>
 				</td>\n<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['ttl']." [".$info['unq']."]")."</td>\n<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>\n</tr>\n";
 			}
 		}
-		$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>$totalv [$totalu]</td><td class='forumheader'></td></tr></table>";
+		$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>{$totalv} [{$totalu}]</td><td class='forumheader'></td></tr></table>";
 		return $text;
 	}
 
 	/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 
-	function renderAlltimeVisits() {
+	function renderAlltimeVisits($do_errors = FALSE) 
+	{
 		/* renders information for alltime, total and unique */
 
-		global $sql;
+		global $sql, $action;
 
 		$sql -> db_Select("logstats", "*", "log_id='pageTotal' ");
 		$row = $sql -> db_Fetch();
 		$pageTotal = unserialize($row['log_data']);
+		$total = 0;
 
-		foreach($this -> fileInfo as $url => $tmpcon) {
+		$can_delete = ADMIN && getperms("P");
+		$do_errors = $do_errors && $can_delete;
+		
+		foreach($this -> fileInfo as $url => $tmpcon) 
+		{
 			$pageTotal[$url]['url'] = $tmpcon['url'];
 			$pageTotal[$url]['ttlv'] += $tmpcon['ttl'];
 			$pageTotal[$url]['unqv'] += $tmpcon['unq'];
 		}
 
-		$totalArray = $this -> arraySort($pageTotal, "ttlv");
-
-		foreach($totalArray as $key => $info) {
-			$total += $info['ttlv'];
-		}
-		$text .= "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L23."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
-		foreach($totalArray as $key => $info) {
-			if($info['ttlv']){
+		// Now run through and keep either the non-error pages, or the error pages, according to $do_errors
+		$totalArray = array();
+		foreach ($pageTotal as $k => $v)
+		{
+		  $found = (strpos($k,'error/') === 0);
+		  if ($do_errors XOR !$found) 
+		  {
+		    $totalArray[$k] = $v;
+			$total += $v['ttlv'];
+		  }
+		}
+
+		$totalArray = $this -> arraySort($totalArray, "ttlv");
+
+		$text .= "<table class='fborder' style='width: 100%;'>\n
+			<colgroup>
+			  <col style='width: 20%;' />
+			  <col style='width: 60%;' />
+			  <col style='width: 10%;' />
+			  <col style='width: 10%;' />
+			</colgroup>
+			<tr>\n<td class='fcaption' >".ADSTAT_L19."</td>\n
+			<td class='fcaption' colspan='2'>".ADSTAT_L23."</td>\n<td class='fcaption' text-align: center;'>%</td>\n</tr>\n";
+		foreach($totalArray as $key => $info) 
+		{
+			if($info['ttlv'])
+			{
 				$percentage = round(($info['ttlv']/$total) * 100, 2);
 				$text .= "<tr>
-				<td class='forumheader3' style='width: 20%;'>
-				".(ADMIN && getperms("P") ? "<a href='".e_SELF."?rem.".$key."'><img src='".e_PLUGIN."log/images/remove.png' alt='".ADSTAT_L39."' title='".ADSTAT_L39."' style='vertical-align: middle; border: 0;' /></a> " : "")."
+				<td class='forumheader3' >
+				".($can_delete ? "<a href='".e_SELF."?{$action}.rem.".rawurlencode($key)."'><img src='".e_PLUGIN."log/images/remove.png' alt='".ADSTAT_L39."' title='".ADSTAT_L39."' style='vertical-align: middle; border: 0;' /></a> " : "")."
 				<img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a>
 				";
 				$text .= "</td>
-				<td class='forumheader3' style='width: 70%;'>".$this->bar($percentage, $info['ttlv'])."</td>
-				<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
+				<td class='forumheader3' >".$this->bar($percentage, $info['ttlv'])."</td>
+				<td class='forumheader3' style='text-align: center;'>".$percentage."%</td>
 				</tr>\n";
 			}
 		}
 		$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>";
 
-		$uniqueArray = $this -> arraySort($this -> dbPageInfo, "unqv");
-		foreach($uniqueArray as $key => $info) {
-			$totalv += $info['unqv'];
+
+		$uniqueArray = array();
+		$totalv = 0;
+		foreach ($this -> dbPageInfo as $k => $v)
+		{
+		  $found = (strpos($k,'error/') === 0);
+		  if ($do_errors XOR !$found) 
+		  {
+		    $uniqueArray[$k] = $v;
+			$totalv += $v['unqv'];
+		  }
 		}
+		$uniqueArray = $this -> arraySort($uniqueArray, "unqv");
+
 		$text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>Page</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L24."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
-		foreach($uniqueArray as $key => $info) {
-			if($info['ttlv']){
-				$percentage = round(($info['unqv']/$total) * 100, 2);
+		foreach($uniqueArray as $key => $info) 
+		{
+			if($info['ttlv'])
+			{
+				$percentage = round(($info['unqv']/$totalv) * 100, 2);
 				$text .= "<tr>
 				<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a></td>
 				<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['unqv'])."</td>
@@ -1110,7 +1213,7 @@
 		global $sql;
 
 		if(!$entries = $sql -> db_Select("logstats", "*", "log_id REGEXP('^[[:digit:]]+\-[[:digit:]]+$') ORDER BY CONCAT(LEFT(log_id,4), RIGHT(log_id,2)) DESC")) {
-			return "No monthly stats yet.";
+			return ADSTAT_L42;
 		}
 
 		$array = $sql -> db_getList();
@@ -1195,15 +1298,20 @@
 		<td style='width:10%; text-align:center' class='forumheader3'>".$val;
 	}
 
-	function remove_entry($toremove) {
-		global $sql;
-		$sql -> db_Select("logstats", "*", "log_id='pageTotal'");
+	function remove_entry($toremove) 
+	{	// Note - only removes info from the database - not from the current page file
+	  global $sql;
+	  if ($sql -> db_Select("logstats", "*", "log_id='pageTotal'"))
+	  {
 		$row = $sql -> db_Fetch();
 		$dbPageInfo = unserialize($row[2]);
 		unset($dbPageInfo[$toremove]);
 		$dbPageDone = serialize($dbPageInfo);
-		$sql -> db_Update("logstats", "log_data='$dbPageDone' WHERE log_id='pageTotal' ");
-		$this -> renderAlltimeVisits();
+		$sql -> db_Update("logstats", "log_data='{$dbPageDone}' WHERE log_id='pageTotal' ");
+//		$this -> renderAlltimeVisits();
+		return TRUE;
+	  }
+	  return FALSE;
 	}
 }
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/login_menu/login_menu.php 0.7.11.src/e107_plugins/login_menu/login_menu.php
--- 0.7.7.src/e107_plugins/login_menu/login_menu.php	2006-11-28 19:48:21.000000000 -0600
+++ 0.7.11.src/e107_plugins/login_menu/login_menu.php	2007-05-27 13:57:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu.php,v $
-|     $Revision: 1.49 $
-|     $Date: 2006/11/29 01:48:21 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.53 $
+|     $Date: 2007/05/27 18:57:44 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -72,8 +72,8 @@
 
     $text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes);
 
-	if (!$sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' "))
-	{
+	if ($sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' "))
+	{	// User now logged in - delete 'guest' record (tough if several users on same IP)
 		$sql->db_Delete('online', "`online_ip` = '{$ip}' AND `online_user_id` = '0' ");
 	}
 
@@ -95,11 +95,11 @@
 
 		// ------------ Comments Stats -----------
 
-		if (varset($menu_pref['login_menu']['new_comments'], false, true) == true)
+		if (varsettrue($menu_pref['login_menu']['new_comments'], false) == true)
 		{
 			$new_comments = 0;
 			$new_comments = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
-
+			$new_total += $new_comments;
 			if (!$new_comments)
 			{
 				$new_comments = LOGIN_MENU_L26;
@@ -109,7 +109,7 @@
 
 		// ------------ Chatbox Stats -----------
 
-		if (isset($menu_pref['login_menu']) && $menu_pref['login_menu']['new_chatbox'] == true) {
+		if (isset($menu_pref['login_menu']['new_chatbox']) && $menu_pref['login_menu']['new_chatbox'] == true) {
 			$display_chats = TRUE;
 
 			if(in_array('chatbox_menu',$eMenuActive)){
@@ -129,7 +129,7 @@
 
 		// ------------ Forum Stats -----------
 
-		if (isset($menu_pref['login_menu']) && $menu_pref['login_menu']['new_forum'] == true) {
+		if (isset($menu_pref['login_menu']['new_forum']) && $menu_pref['login_menu']['new_forum'] == true) {
 			$qry = "
 			SELECT  count(*) as count FROM #forum_t  as t
 			LEFT JOIN #forum as f
@@ -150,7 +150,7 @@
 
 		// ------------ Member Stats -----------
 
-		if (isset($menu_pref['login_menu']) && $menu_pref['login_menu']['new_members'] == true) {
+		if (isset($menu_pref['login_menu']['new_members']) && $menu_pref['login_menu']['new_members'] == true) {
 			$new_users = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time);
 			$new_total += $new_users;
 			if (!$new_users) {
diff -x .svn -ruN 0.7.7.src/e107_plugins/login_menu/login_menu_shortcodes.php 0.7.11.src/e107_plugins/login_menu/login_menu_shortcodes.php
--- 0.7.7.src/e107_plugins/login_menu/login_menu_shortcodes.php	2006-11-18 16:40:54.000000000 -0600
+++ 0.7.11.src/e107_plugins/login_menu/login_menu_shortcodes.php	2007-03-25 04:22:17.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu_shortcodes.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/18 22:40:54 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.11 $
+|     $Date: 2007/03/25 09:22:17 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -68,22 +68,22 @@
 
 SC_BEGIN LM_FPW_LINK
 global $pref;
-if ($pref['user_reg'])
+if (!$pref['auth_method'] || $pref['auth_method'] == 'e107')
 {
-	if (!$pref['auth_method'] || $pref['auth_method'] == 'e107')
-	{
-		return "<a class='login_menu_link fpw' href='".e_BASE."fpw.php' title=\"".LOGIN_MENU_L4."\">".LOGIN_MENU_L4."</a>";
-	}
+	return "<a class='login_menu_link fpw' href='".e_BASE."fpw.php' title=\"".LOGIN_MENU_L4."\">".LOGIN_MENU_L4."</a>";
 }
 return "";
 SC_END
 
 SC_BEGIN LM_RESEND_LINK
 global $pref;
-if(isset($pref['user_reg_veri']) && $pref['user_reg_veri'] == 1){
-	if (!$pref['auth_method'] || $pref['auth_method'] == 'e107' )
-	{
-		return "<a class='login_menu_link resend' href='".e_SIGNUP."?resend' title=\"".LOGIN_MENU_L40."\">".LOGIN_MENU_L40."</a>";
+if ($pref['user_reg'])
+{
+	if(isset($pref['user_reg_veri']) && $pref['user_reg_veri'] == 1){
+		if (!$pref['auth_method'] || $pref['auth_method'] == 'e107' )
+		{
+			return "<a class='login_menu_link resend' href='".e_SIGNUP."?resend' title=\"".LOGIN_MENU_L40."\">".LOGIN_MENU_L40."</a>";
+		}
 	}
 }
 return "";
diff -x .svn -ruN 0.7.7.src/e107_plugins/newforumposts_main/newforumposts_main.php 0.7.11.src/e107_plugins/newforumposts_main/newforumposts_main.php
--- 0.7.7.src/e107_plugins/newforumposts_main/newforumposts_main.php	2006-11-06 21:26:54.000000000 -0600
+++ 0.7.11.src/e107_plugins/newforumposts_main/newforumposts_main.php	2007-12-22 13:18:30.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newforumposts_main/newforumposts_main.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2006/11/07 03:26:54 $
-|     $Author: e107coders $
+|     $Revision: 1.26 $
+|     $Date: 2007/12/22 19:18:30 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -75,7 +75,14 @@
 	$gen = new convert;
 }
 
-$ICON = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
+if (file_exists(THEME."forum/new_small.png")) 
+{
+  $ICON = "<img src='".THEME."forum/new_small.png' alt='' />";
+}
+else
+{
+  $ICON = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
+}
 $TOTAL_TOPICS = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent='0' ");
 $TOTAL_REPLIES = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent!='0' ");
 $sql->db_Select_gen("SELECT sum(thread_views) FROM ".MPREFIX."forum_t");
diff -x .svn -ruN 0.7.7.src/e107_plugins/newsfeed/newsfeed_functions.php 0.7.11.src/e107_plugins/newsfeed/newsfeed_functions.php
--- 0.7.7.src/e107_plugins/newsfeed/newsfeed_functions.php	2006-11-13 04:43:48.000000000 -0600
+++ 0.7.11.src/e107_plugins/newsfeed/newsfeed_functions.php	2007-02-07 17:27:32.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/newsfeed_functions.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/11/13 10:43:48 $
+|     $Revision: 1.18 $
+|     $Date: 2007/02/07 23:27:32 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -169,7 +169,7 @@
 				{
 					$item = $item_total[$i];
 					$FEEDITEMLINK = "<a href='".$item['link']."' rel='external'>".$tp -> toHTML($item['title'], TRUE)."</a>\n";
-					$feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", $item['description']);
+					$feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", strip_tags($item['description']));
 					$FEEDITEMTEXT = $tp->text_truncate($feeditemtext, $truncate, $truncate_string);
 
 					$FEEDITEMCREATOR = $tp -> toHTML($item['author'], TRUE);
diff -x .svn -ruN 0.7.7.src/e107_plugins/newsfeed/newsfeed_menu.php 0.7.11.src/e107_plugins/newsfeed/newsfeed_menu.php
--- 0.7.7.src/e107_plugins/newsfeed/newsfeed_menu.php	2006-04-14 09:09:53.000000000 -0500
+++ 0.7.11.src/e107_plugins/newsfeed/newsfeed_menu.php	2007-08-22 17:50:31.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/newsfeed_menu.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/04/14 14:09:53 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2007/08/22 22:50:31 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -22,6 +22,6 @@
 $info = newsfeed_info('all', 'menu');
 if($info['text'])
 {
-	$ns->tablerender($info['title'], $info['text']);
+    $ns->tablerender($info['title'], $info['text'],'newsfeed_menu');
 }
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_plugins/newsletter/admin_config.php 0.7.11.src/e107_plugins/newsletter/admin_config.php
--- 0.7.7.src/e107_plugins/newsletter/admin_config.php	2006-11-04 12:28:51.000000000 -0600
+++ 0.7.11.src/e107_plugins/newsletter/admin_config.php	2007-01-27 11:47:06.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsletter/admin_config.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/11/04 18:28:51 $
-|     $Author: e107coders $
+|     $Revision: 1.11 $
+|     $Date: 2007/01/27 17:47:06 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -368,7 +368,7 @@
 		if ($pref['mailer'] == "smtp")
 		{
 			$mail->Mailer = "smtp";
-			$mail->SMTPKeepAlive = TRUE;
+			$mail->SMTPKeepAlive = (isset($pref['smtp_keepalive']) && $pref['smtp_keepalive']==1) ? TRUE : FALSE;
 			$mail->SMTPAuth = TRUE;
 			$mail->Username = $pref['smtp_username'];
 			$mail->Password = $pref['smtp_password'];
@@ -380,7 +380,7 @@
 		}
 
 		$mail->WordWrap = 50;
-		$mail->Charset = CHARSET;
+		$mail->CharSet = CHARSET;
 		$mail->Subject = $newsletterParentInfo['newsletter_title'] . ": ".$newsletterInfo['newsletter_title'];
 		$mail->IsHTML(true);
 
@@ -401,12 +401,12 @@
 		$mail_style .= "<div style='width:90%; padding-top:10px'>";
 		$mail_style .= "<div class='fcaption'><b>$message_subject<br />[ ".NLLAN_12." ".$newsletterInfo['newsletter_issue']." ]</b></div><br /><br />";
 		$mail_style .= "<div class='forumheader3'>";
-		$message_body = $mail_style.$newsletter_header."<hr />".$message_body."<br><br><hr />".$newsletter_footer."<br></div></div>";
+		$message_body = $mail_style.$newsletter_header."<hr />".$message_body."<br /><br /><hr />".$newsletter_footer."<br /></div></div>";
 
-		$message_body = str_replace("\n", "<br>", $message_body);
+		$message_body = str_replace("\n", "<br />", $message_body);
 
-		$mail->Body = $tp->toHTML($message_body, TRUE);
-		$mail->AltBody = strip_tags(str_replace("<br>", "\n", $message_body));
+		$mail->Body = $tp->toHTML($message_body, TRUE,'no_replace, emotes_off');
+		$mail->AltBody = strip_tags(str_replace("<br />", "\n", $message_body));
 
 		$sent_counter = 0;
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/online_extended_menu/languages/English.php 0.7.11.src/e107_plugins/online_extended_menu/languages/English.php
--- 0.7.7.src/e107_plugins/online_extended_menu/languages/English.php	2005-10-05 17:44:37.000000000 -0500
+++ 0.7.11.src/e107_plugins/online_extended_menu/languages/English.php	2006-12-23 12:37:52.000000000 -0600
@@ -11,12 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/online_extended_menu/languages/English.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/10/05 22:44:37 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/12/23 18:37:52 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-	
+
 define("ONLINE_EL1", "Guests: ");
 define("ONLINE_EL2", "Members: ");
 define("ONLINE_EL3", "On this page: ");
@@ -24,10 +24,10 @@
 define("ONLINE_EL5", "Members");
 define("ONLINE_EL6", "Newest member");
 define("ONLINE_EL7", "viewing");
-	
+
 define("ONLINE_EL8", "most ever online: ");
 define("ONLINE_EL9", "on");
 
-define("TRACKING_MESSAGE", "Online user tracking is currently disabled, please enable it <a href='".e_ADMIN."users.php?options'>here</a></span><br />");
+define("ONLINE_TRACKING_MESSAGE", "Online user tracking is currently disabled, please enable it [link=".e_ADMIN."users.php?options]here[/link][br]");
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_plugins/online_extended_menu/online_extended_menu.php 0.7.11.src/e107_plugins/online_extended_menu/online_extended_menu.php
--- 0.7.7.src/e107_plugins/online_extended_menu/online_extended_menu.php	2006-10-22 17:36:03.000000000 -0500
+++ 0.7.11.src/e107_plugins/online_extended_menu/online_extended_menu.php	2007-10-07 00:40:50.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/online_extended_menu/online_extended_menu.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/10/22 22:36:03 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2007/10/07 05:40:50 $
+|     $Author: streaky $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -48,7 +48,7 @@
 				$pinfo = "comment.php";
 				$online_location_page = "comment.php";
 			}
-			$text .= "<img src='".e_IMAGE."admin_images/users_16.png' alt='' style='vertical-align:middle' /> <a href='".e_BASE."user.php?id.$oid'>$oname</a> ".ONLINE_EL7;
+			$text .= "<img src='".e_IMAGE_ABS."admin_images/users_16.png' alt='' style='vertical-align:middle' /> <a href='".e_BASE."user.php?id.$oid'>$oname</a> ".ONLINE_EL7;
 			(!strstr($pinfo, $ADMIN_DIRECTORY) ? $text .= " <a href='{$pinfo}'>$online_location_page</a><br />" : $text .= " $online_location_page<br />");
 		}
 	}
@@ -69,17 +69,16 @@
 
 	$text .= "<br />".ONLINE_EL8." ".($menu_pref['most_members_online'] + $menu_pref['most_guests_online'])."<br />(".ONLINE_EL2.$menu_pref['most_members_online'].", ".ONLINE_EL1.$menu_pref['most_guests_online'].") ".ONLINE_EL9." ".$datestamp."<br />";
 
- 	$total_members = $sql->db_Count("user","(*)","where user_ban='0'"); // greatly optimizes the query below.
+ 	$total_members = $sql->db_Count("user","(*)","where user_ban = 0");
 	if ($total_members > 1) {
-
-		$newest_member = $sql->db_Select("user", "user_id, user_name", "user_id > ".($total_members-2)." AND user_ban='0' ORDER BY user_join DESC LIMIT 1");
-
+		$newest_member = $sql->db_Select("user", "user_id, user_name", "user_ban = 0 ORDER BY user_join DESC LIMIT 1");
 		$row = $sql->db_Fetch();
 		extract($row);
 		$text .= "<br />".ONLINE_EL5.": ".$total_members."<br />".ONLINE_EL6.": <a href='".e_BASE."user.php?id.".$user_id."'>".$user_name."</a>";
 	}
-} else {
-	$text = TRACKING_MESSAGE;
+} elseif(ADMIN) {
+	global $tp;
+	$text = $tp->toHtml(ONLINE_TRACKING_MESSAGE,TRUE);
 }
 
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/online_menu/languages/English.php 0.7.11.src/e107_plugins/online_menu/languages/English.php
--- 0.7.7.src/e107_plugins/online_menu/languages/English.php	2006-11-16 13:50:45.000000000 -0600
+++ 0.7.11.src/e107_plugins/online_menu/languages/English.php	2006-12-09 00:43:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/online_menu/languages/English.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/11/16 19:50:45 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.6 $
+|     $Date: 2006/12/09 06:43:48 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,5 +23,5 @@
 define("ONLINE_L4", "Online");
 define("ONLINE_L5", "Members");
 define("ONLINE_L6", "Newest");
-define("TRACKING_MESSAGE", "Online user tracking is currently disabled, please enable it <a href='".e_ADMIN."users.php?options'>here</a><br />");
-?>
\ No newline at end of file
+define("TRACKING_MESSAGE", "Online user tracking is currently disabled, please enable it [link=".e_ADMIN."users.php?options]here[/link][br]");   
+?>
diff -x .svn -ruN 0.7.7.src/e107_plugins/online_menu/online_menu.php 0.7.11.src/e107_plugins/online_menu/online_menu.php
--- 0.7.7.src/e107_plugins/online_menu/online_menu.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_plugins/online_menu/online_menu.php	2007-05-28 11:52:42.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/online_menu/online_menu.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.15 $
+|     $Date: 2007/05/28 16:52:42 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$caption = (file_exists(THEME."images/online_menu.png") ? "<img src='".THEME."images/online_menu.png' alt='' /> ".ONLINE_L4 : ONLINE_L4);
+$caption = (file_exists(THEME."images/online_menu.png") ? "<img src='".THEME_ABS."images/online_menu.png' alt='' /> ".ONLINE_L4 : ONLINE_L4);
 
 if(!defined("e_TRACKING_DISABLED") && (isset($pref['track_online']) && $pref['track_online'])) {
 	$text = ONLINE_L1.GUESTS_ONLINE."<br />";
@@ -27,7 +27,7 @@
 	$text .= ONLINE_L2.MEMBERS_ONLINE.(MEMBERS_ONLINE ? ", ": "").MEMBER_LIST."<br />";
 	//}
 	$text .= ONLINE_L3.ON_PAGE;
-	
+
 	global $e107cache;
 	$members_totals = $e107cache->retrieve("online_menu_totals", 120);
 	if($members_totals == false) {
@@ -39,10 +39,11 @@
 		$e107cache->set("online_menu_totals", $members_totals);
 	}
 	$text .= $members_totals;
-	
+
 } else {
 	if(ADMIN) {
-		$text = TRACKING_MESSAGE;
+		global $tp;  
+		$text = $tp->toHtml(TRACKING_MESSAGE,TRUE);
 	} else {
 		return;
 	}
@@ -50,4 +51,4 @@
 
 $ns->tablerender($caption, $text, 'online');
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_plugins/other_news_menu/other_news2_menu.php 0.7.11.src/e107_plugins/other_news_menu/other_news2_menu.php
--- 0.7.7.src/e107_plugins/other_news_menu/other_news2_menu.php	2006-11-23 08:53:38.000000000 -0600
+++ 0.7.11.src/e107_plugins/other_news_menu/other_news2_menu.php	2007-09-09 01:45:04.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/other_news_menu/other_news2_menu.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/23 14:53:38 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.12 $
+|     $Date: 2007/09/09 06:45:04 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -89,6 +89,7 @@
 
 $style = OTHERNEWS2_CELL;
 $nbr_cols = OTHERNEWS2_COLS;
+$GLOBALS['NEWS_CSSMODE'] = "othernews2";  
 
 $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 LEFT JOIN #user AS u ON n.news_author = u.user_id
diff -x .svn -ruN 0.7.7.src/e107_plugins/other_news_menu/other_news_menu.php 0.7.11.src/e107_plugins/other_news_menu/other_news_menu.php
--- 0.7.7.src/e107_plugins/other_news_menu/other_news_menu.php	2006-11-23 08:53:38.000000000 -0600
+++ 0.7.11.src/e107_plugins/other_news_menu/other_news_menu.php	2007-09-09 01:45:04.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/other_news_menu/other_news_menu.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/11/23 14:53:38 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.19 $
+|     $Date: 2007/09/09 06:45:04 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -30,7 +30,7 @@
 
 require_once(e_HANDLER."news_class.php");
 unset($text);
-global $OTHERNEWS_STYLE;
+global $OTHERNEWS_STYLE,$news_cssmode;
 $ix = new news;
 
 if(!$OTHERNEWS_STYLE)
@@ -85,20 +85,23 @@
 
 $style = OTHERNEWS_CELL;
 $nbr_cols = OTHERNEWS_COLS;
-
+$GLOBALS['NEWS_CSSMODE'] = "othernews";
 
 $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 LEFT JOIN #user AS u ON n.news_author = u.user_id
 LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type=2  ORDER BY n.news_datestamp DESC LIMIT 0,".OTHERNEWS_LIMIT;
 
-if ($sql->db_Select_gen($query)){
+if ($sql->db_Select_gen($query))
+{
 	$text = "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS_SPACING."'>";
 	$t = 0;
 	$wid = floor(100/$nbr_cols);
-	while ($row = $sql->db_Fetch()) {
+
+	while ($row = $sql->db_Fetch())
+	{
 		$text .= ($t % $nbr_cols == 0) ? "<tr>" : "";
-		$text .= "\n<td style='$style ; width:$wid%;'>\n";
+		$text .= "\n<td class='othernews_cell' style='$style ; width:$wid%;'>\n";
 		$text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS_STYLE, $param);
 
 		$text .= "\n</td>\n";
@@ -112,11 +115,11 @@
 	}
 
 
-	while ($t % $nbr_cols != 0){
+	while ($t % $nbr_cols != 0)
+	{
 		$text .= "<td style='width:$wid'>&nbsp;</td>\n";
 		$text .= (($t+1) % nbr_cols == 0) ? "</tr>" : "";
 		$t++;
-
 	}
 	$text .= "</table>";
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/pdf/e107pdf.php 0.7.11.src/e107_plugins/pdf/e107pdf.php
--- 0.7.7.src/e107_plugins/pdf/e107pdf.php	2006-11-24 16:28:14.000000000 -0600
+++ 0.7.11.src/e107_plugins/pdf/e107pdf.php	2007-09-26 14:10:48.000000000 -0500
@@ -1,8 +1,13 @@
 <?php
 
+//define ('PDF_DEBUG', TRUE);
+define ('PDF_DEBUG', FALSE);
+
 //extend fpdf class from package with custom functions
 class e107PDF extends UFPDF{
 
+	var $temp_counter = 2;			// Used for debug
+	
 	//variables of html parser
 	var $B;
 	var $I;
@@ -223,32 +228,51 @@
 		return $tbl_couleur;
 	}
 
-	function WriteHTML($html,$scale){
+	function WriteHTML($html,$scale)
+	{
+	  global $tp, $pdfpref;
+	  global $admin_log;
 
-		$search		= array("\n", "<br />", "<hr />", '&raquo;', '&ordm;', '&middot', '&trade;', '&copy;', '&euro;', '&#091;', '&amp;#091;', '&nbsp;', 'â€˜', 'â€™', ' />', '&#40;', '&#41;', '&#123;', '&#125;', '&#91;', '&#93;');
-		$replace	= array(" ", "<br>", "<hr>", '»', 'º', '·', '™', '©', '', '[', '[', ' ', "'", "'", '>', '(', ')', '{', '}', '[',']' );
+		$search		= array("\n", "<br />", "<hr />", '&raquo;', '&ordm;', '&middot', '&trade;', '&copy;', '&euro;', '&#091;', '&amp;#091;', '&nbsp;', 'â€˜', 'â€™', ' />', '&#40;', '&#41;', '&#123;', '&#125;', '&#91;', '&#93;', '&#092;', '&#92;');
+		$replace	= array(" ", "<br>", "<hr>", '»', 'º', '·', '™', '©', '', '[', '[', ' ', "'", "'", '>', '(', ')', '{', '}', '[',']', '\\\\', '\\\\' );
 		//replace carriage returns by spaces, and some html variants
 		$html=str_replace($search, $replace, $html);
 		$a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); //explodes the string
 
+	if (PDF_DEBUG) 
+	{
+	  $admin_log->e_log_event(10,'split_vars',"DEBUG","PDF Trace","Write text: : ".$tp->toHTML('[code]'.$html.'[/code]',TRUE),FALSE,LOG_TO_ROLLING);
+	  $acc = array();
+	  foreach ($a as $ef) { $acc[] = strlen($ef); }
+	  $admin_log->e_log_event(10,'no_vars',"DEBUG","PDF Trace","Lengths:: ".implode(',',$acc),FALSE,LOG_TO_ROLLING);
+	}
 		foreach($a as $i=>$e)
 		{
+		  if ($this->temp_counter == 0)
+		  {
+//	if (PDF_DEBUG) $admin_log->e_log_event(10,'no_vars',"DEBUG","PDF Trace","Process chunk {$i}: ".$e,FALSE,LOG_TO_ROLLING);
+		  }
 			if($i%2==0)
 			{
-				//Text
+				//Text between tags
 				if($this->HREF){
 					$this->PutLink($this->HREF,$e);
 					$this->HREF='';
-				}elseif($this->IMG){
+				}elseif(0 && $this->IMG){		// This bit shouldn't happen now
 					//correct url
 					if(is_readable($this->SRC)){
-						$file = $this->SRC;
+						$file = trim($this->SRC);
 						$pos=strrpos($file,'.');
 						$type=substr($file,$pos+1);
 						$type=strtolower($type);
 						//for now only jpg, jpeg and png are supported
-						if($type=='jpg' || $type=='jpeg' || $type=='png'){
-
+						if($type=='jpg' || $type=='jpeg' || $type=='png')
+						{
+						  if ((strpos($file,'http') !== 0) && (strpos($file,'www.') !== 0))
+						  {  // Its a local file - possibly don't need to do anything at all!
+						    $url = $tp->replaceConstants($file);
+						  }
+/*							Old path-related stuff confused things
 							$url = str_replace("../", "", $this->SRC);
 							$imgsearch = array(e_IMAGE, e_THEME, e_PLUGIN, e_FILE, e_HANDLER);
 							//e_BASE and e_ADMIN are not taken into account !
@@ -258,8 +282,8 @@
 								if ($l !== false) {
 									$url = SITEURL.$url;
 								}
-							}
-							$this->Ln(2);
+							}  */
+							$this->Ln();		// Newline with 'default' height to avoid overlaying text
 							$this->PutImage($url,$scale);
 							$this->Ln(2);
 							$this->SetX($this->lMargin);
@@ -278,19 +302,25 @@
 					$this->Cell(0,5,$e,0,1,'R');
 				}elseif($this->ALIGN == 'left'){
 					$this->Cell(0,5,$e,0,1,'L');
-				}elseif($this->BLOCKQUOTE == 'BLOCKQUOTE'){
+				}
+				elseif($this->BLOCKQUOTE == 'BLOCKQUOTE')
+				{
 					$this->SetFont('Courier','',11);
 					$this->SetStyle('B',true);
 					$this->SetStyle('I',true);
 					$this->Cell(0,5,$e,1,1,'L');
 					$this->SetStyle('B',false);
 					$this->SetStyle('I',false);
-					if ($this->issetcolor==true) {
+					if ($this->issetcolor==true) 
+					{
 						$this->SetTextColor(0);
 						$this->issetcolor=false;
 					}
 					$this->SetFont($pdfpref['pdf_font_family'],'',$pdfpref['pdf_font_size']);
-				}else{
+				}
+				else
+				{
+				  //	if (PDF_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","PDF Trace","Write block {$i}: ".$e,FALSE,LOG_TO_ROLLING);
 					$this->Write(5,stripslashes($this->txtentities($e)));
 				}
 			}
@@ -315,11 +345,16 @@
 		}
 	}
 
-	function OpenTag($tag,$attr,$scale){
+	function OpenTag($tag,$attr,$scale)
+	{
+	  global $tp;
+	  global $admin_log;
+	  
 		$tag = strtoupper($tag);
 		//Opening tag
 
-		switch($tag){
+		switch($tag)
+		{
 			case 'STRONG':
 				$this->SetStyle('B',true);
 				break;
@@ -370,10 +405,36 @@
 				}
 				break;
 			case 'IMG':
+				if (PDF_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","PDF Trace","Image tag found: ".$attr['SRC'],FALSE,LOG_TO_ROLLING);
 				$this->IMG=true;
 				$this->SRC=$attr['SRC'];
 				$this->WIDTH=$attr['WIDTH'];
 				$this->HEIGHT=$attr['HEIGHT'];
+				// Its a 'closed' tag - so need to process it immediately
+				
+				if(is_readable($this->SRC))
+				{
+				  $file = trim($this->SRC);
+				  $pos=strrpos($file,'.');
+				  $type=substr($file,$pos+1);
+				  $type=strtolower($type);
+					//for now only jpg, jpeg and png are supported
+				  if($type=='jpg' || $type=='jpeg' || $type=='png')
+				  {
+					if ((strpos($file,'http') !== 0) && (strpos($file,'www.') !== 0))
+					{  // Its a local file - possibly don't need to do anything at all!
+					  $url = $tp->replaceConstants($file);
+					}
+					$this->Ln();		// Newline with 'default' height to avoid overlaying text
+					$this->PutImage($url,$scale);
+					$this->Ln(2);
+					$this->SetX($this->lMargin);
+				  }
+				}
+				$this->IMG='';		// Clear the parameters - stops further image-related processing
+				$this->SRC='';
+				$this->WIDTH='';
+				$this->HEIGHT='';
 				break;
 			case 'TR':
 				break;
@@ -571,9 +632,13 @@
 	//(c)2004/03/12 by St@neCold
 	function PutImage($url,$scale)
 	{
+	  global $admin_log;
+	if (PDF_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","PDF Trace","Process image {$url}, scale ".$scale,FALSE,LOG_TO_ROLLING);
+	
 		if($scale<0) $scale=0;
 		//$scale<=0: put NO image inside the pdf!
-		if($scale>0){
+		if($scale>0)
+		{
 			$xsflag=0;
 			$ysflag=0;
 			$yhflag=0;
@@ -582,17 +647,25 @@
 			//get image info
 			$oposy=$this->GetY();
 			$iminfo=@getimagesize($url);
-			if($iminfo){
+			if($iminfo)
+			{
+				// Width and height of current drawing page
+				$pw = $this->w - $this->lMargin - $this->rMargin;
+				$ph = $this->h - $this->tMargin - $this->bMargin;
+				
 				$iw=$scale * $this->px2mm($iminfo[0]);
 				$ih=$scale * $this->px2mm($iminfo[1]);
-				$iw = ($iw)?$iw:1;
-				$ih = ($ih)?$ih:1;
-				$nw=$iw;
-				$nh=$ih;
+				$iw = ($iw)?$iw:1;		// Initial width
+				$ih = ($ih)?$ih:1;		// Initial height
+				$nw=$iw;				// New width
+				$nh=$ih;				// New height
 				//resizing in x-direction
 				$xsflag=0;
-				if($iw>150)	{
-					$xscale=150 / $iw;
+//				if($iw>150)			// Dimensions in mm - so width of portrait A4
+				if($iw>$pw)			// Dimensions in mm - so width of portrait A4
+				{
+//					$xscale=150 / $iw;
+					$xscale=$pw / $iw;
 					$yscale=$xscale;
 					$nw=$xscale * $iw;
 					$nh=$xscale * $ih;
@@ -600,8 +673,11 @@
 				}
 				//now eventually resizing in y-direction
 				$ysflag=0;
-				if(($oposy+$nh)>250){
-					$yscale=(250-$oposy)/$ih;
+//				if(($oposy+$nh)>250)	// See if will fit vertically on current page
+				if(($oposy+$nh)>$ph)	// See if will fit vertically on current page
+				{
+//					$yscale=(250-$oposy)/$ih;
+					$yscale=($ph-$oposy)/$ih;
 					$nw=$yscale * $iw;
 					$nh=$yscale * $ih;
 					$ysflag=1;
@@ -610,7 +686,8 @@
 				//remark: without(!) the global factor $scale!
 				//that's hard -> on the next page please...
 				$yhflag=0;
-				if($yscale<0.33 and ($xsflag==1 or $ysflag==1))	{
+				if($yscale<0.33 and ($xsflag==1 or $ysflag==1))	
+				{
 					$nw=$xscale * $iw;
 					$nh=$xscale * $ih;
 					$ysflag==0;
@@ -621,7 +698,12 @@
 				$oposy=$this->GetY();
 				$this->Image($url, $this->GetX(), $this->GetY(), $nw, $nh);
 				$this->SetY($oposy+$nh);
+//	if (PDF_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","PDF Trace","Original Y={$oposy}, Initial height={$ih}, new height={$nh}. Set Y = ".($oposy+$nh)." after image output",FALSE,LOG_TO_ROLLING);
+	if (PDF_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","PDF Trace","Page width: {$pw}, Height: {$ph}, Image new width={$nw}, new height={$nh}. Set Y = ".($oposy+$nh)." after image output",FALSE,LOG_TO_ROLLING);
+/*
+Original Y=76.166666666667, Initial height=119.23888888889, new height=101.4. Set Y = 177.56666666667 after image output */
 				//if($yhflag==0 and $ysflag==1) $this->AddPage();
+				if ($this->temp_counter > 0) $this->temp_counter--;
 			}
 		}
 	}
diff -x .svn -ruN 0.7.7.src/e107_plugins/pdf/font/makefont/makefont.php 0.7.11.src/e107_plugins/pdf/font/makefont/makefont.php
--- 0.7.7.src/e107_plugins/pdf/font/makefont/makefont.php	2006-11-09 03:28:58.000000000 -0600
+++ 0.7.11.src/e107_plugins/pdf/font/makefont/makefont.php	2007-09-26 14:07:51.000000000 -0500
@@ -163,7 +163,7 @@
 	if(isset($fm['FontBBox']))
 		$fbb=$fm['FontBBox'];
 	else
-		$fbb=array(0,$des-100,1000,$asc+100);
+		$fbb=array(0,$desc-100,1000,$asc+100);
 	$fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
 	//ItalicAngle
 	$ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
diff -x .svn -ruN 0.7.7.src/e107_plugins/pdf/fpdf.php 0.7.11.src/e107_plugins/pdf/fpdf.php
--- 0.7.7.src/e107_plugins/pdf/fpdf.php	2006-01-13 04:49:03.000000000 -0600
+++ 0.7.11.src/e107_plugins/pdf/fpdf.php	2007-09-26 15:27:22.000000000 -0500
@@ -478,7 +478,7 @@
 		$this->Error('Could not include font definition file');
 	$i=count($this->fonts)+1;
 	$this->fonts[$fontkey]=array('i'=>$i,'type'=>$type,'name'=>$name,'desc'=>$desc,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'enc'=>$enc,'file'=>$file);
-	if($diff)
+	if(isset($diff) && $diff)
 	{
 		//Search existing encodings
 		$d=0;
diff -x .svn -ruN 0.7.7.src/e107_plugins/pdf/ufpdf.php 0.7.11.src/e107_plugins/pdf/ufpdf.php
--- 0.7.7.src/e107_plugins/pdf/ufpdf.php	2006-01-11 10:47:37.000000000 -0600
+++ 0.7.11.src/e107_plugins/pdf/ufpdf.php	2007-08-10 14:21:29.000000000 -0500
@@ -257,10 +257,10 @@
   return sprintf('%.2f %.2f %.2f %.2f re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
 }
 
-function _textstring($s)
+function _textstring($s, $bom = true)
 {
   //Convert to UTF-16BE
-  $s = $this->utf8_to_utf16be($s);
+  $s = $this->utf8_to_utf16be($s, $bom);
   //Escape necessary characters
   $trans = array(')' => '\\)', '(' => '\\(', '\\' => '\\\\');
   return '('.strtr($s, $trans).')';
@@ -276,20 +276,21 @@
 	//return strtr($s, $trans);
 }
 
+
 function _putinfo()
-{
-	$this->_out('/Producer '.$this->_textstring('UFPDF '. UFPDF_VERSION));
+{  // If present, all these fields need to be saved without BOM
+	$this->_out('/Producer '.$this->_textstring('UFPDF '. UFPDF_VERSION, FALSE));
 	if(!empty($this->title))
-		$this->_out('/Title '.$this->_textstring($this->title));
+		$this->_out('/Title '.$this->_textstring($this->title, FALSE));
 	if(!empty($this->subject))
-		$this->_out('/Subject '.$this->_textstring($this->subject));
+		$this->_out('/Subject '.$this->_textstring($this->subject, FALSE));
 	if(!empty($this->author))
-		$this->_out('/Author '.$this->_textstring($this->author));
+		$this->_out('/Author '.$this->_textstring($this->author, FALSE));
 	if(!empty($this->keywords))
-		$this->_out('/Keywords '.$this->_textstring($this->keywords));
+		$this->_out('/Keywords '.$this->_textstring($this->keywords, FALSE));
 	if(!empty($this->creator))
-		$this->_out('/Creator '.$this->_textstring($this->creator));
-	$this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis')));
+		$this->_out('/Creator '.$this->_textstring($this->creator, FALSE));
+	$this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis'), FALSE));
 }
 
 // UTF-8 to UTF-16BE conversion.
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/languages/English.php 0.7.11.src/e107_plugins/pm/languages/English.php
--- 0.7.7.src/e107_plugins/pm/languages/English.php	2006-10-30 08:01:47.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/languages/English.php	2007-08-02 15:41:22.000000000 -0500
@@ -64,6 +64,8 @@
 define('LAN_PM_61', "No subject");
 define('LAN_PM_62', "File: [{FILENAME}] exceeds size limit - not attached");
 define('LAN_PM_63', "class:");
+define('LAN_PM_64', 'ERROR: You are not permitted to block messages from site administrators');
+define('LAN_PM_65', 'ERROR: Nothing to send');
 
 define("LAN_PM_100", "New PM from ");
 define("LAN_PM_101", "You have received a new Private Message from ");
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/languages/admin/English.php 0.7.11.src/e107_plugins/pm/languages/admin/English.php
--- 0.7.7.src/e107_plugins/pm/languages/admin/English.php	2006-11-19 16:52:16.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/languages/admin/English.php	2007-02-04 09:36:54.000000000 -0600
@@ -38,8 +38,8 @@
 define('ADLAN_PM_36', "Userclass");
 define('ADLAN_PM_37', "Count limits");
 define('ADLAN_PM_38', "Size limits (in KB)");
-define('ADLAN_PM_39', "Inbox :");
-define('ADLAN_PM_40', "Outbox :");
+define('ADLAN_PM_39', "Inbox: ");
+define('ADLAN_PM_40', "Outbox: ");
 define('ADLAN_PM_41', "There are currently no limits set.");
 define('ADLAN_PM_42', "Update Limits");
 define('ADLAN_PM_43', "Add New Limit");
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/pm.php 0.7.11.src/e107_plugins/pm/pm.php
--- 0.7.7.src/e107_plugins/pm/pm.php	2006-10-30 08:01:47.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/pm.php	2007-09-22 12:41:29.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/10/30 14:01:47 $
-|     $Author: e107coders $
+|     $Revision: 1.26 $
+|     $Date: 2007/09/22 17:41:29 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,11 +27,14 @@
 define("ATTACHMENT_ICON", "<img src='".e_PLUGIN."pm/images/attach.png' alt='' />");
 
 $qs = explode(".", e_QUERY);
-$action = $qs[0];
-if($action == "") { $action = 'inbox'; }
+$action = varset($qs[0],'inbox');
+if (!$action) $action = 'inbox';
+
+$pm_proc_id = intval(varset($qs[1],0));
+
 $pm_prefs = $sysprefs->getArray("pm_prefs");
 
-if(!check_class($pm_prefs['pm_class']))
+if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class']))
 {
 	require_once(HEADERF);
 	$ns->tablerender(LAN_PM, LAN_PM_12);
@@ -85,7 +88,7 @@
 	}
 	if('del' == $action)
 	{
-		$message = $pm->del(intval($qs[1]));
+		$message = $pm->del($pm_proc_id);
 	}
 	if($qs[2] != "")
 	{
@@ -102,24 +105,25 @@
 			$action = "outbox";
 		}
 	}
+	$pm_proc_id = 0;
 	unset($qs);
 }
 
 if('block' == $action)
 {
-	$message = $pm->block_add(intval($qs[1]));
+	$message = $pm->block_add($pm_proc_id);
 	$action = 'inbox';
 }
 
 if('unblock' == $action)
 {
-	$message = $pm->block_del(intval($qs[1]));
+	$message = $pm->block_del($pm_proc_id);
 	$action = 'inbox';
 }
 
 if("get" == $action)
 {
-	$pm->send_file(intval($qs[1]), intval($qs[2]));
+	$pm->send_file($pm_proc_id, intval($qs[2]));
 	exit;
 }
 
@@ -138,12 +142,12 @@
 
 if("send" == $action)
 {
-	$ns->tablerender(LAN_PM, show_send(intval($qs[1])));
+	$ns->tablerender(LAN_PM, show_send($pm_proc_id));
 }
 
 if("reply" == $action)
 {
-	$pmid = intval($qs[1]);
+	$pmid = $pm_proc_id;
 	if($pm_info = $pm->pm_get($pmid))
 	{
 		if($pm_info['pm_to'] != USERID)
@@ -163,17 +167,17 @@
 
 if("inbox" == $action)
 {
-	$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox(intval($qs[1])), "PM");
+	$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), "PM");
 }
 
 if("outbox" == $action)
 {
-	$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox(intval($qs[1])), "PM");
+	$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), "PM");
 }
 
 if("show" == $action)
 {
-	show_pm(intval($qs[1]));
+	show_pm($pm_proc_id);
 }
 
 require_once(FOOTERF);
@@ -181,7 +185,7 @@
 
 function show_send($to_uid)
 {
-	global $tp, $pm_info;
+	global $tp, $pm_info, $pm_prefs;
 	$pm_outbox = pm_getInfo('outbox');
 	if($to_uid)
 	{
@@ -279,19 +283,20 @@
 		exit;
 	}
 	if($pm_info['pm_read'] == 0 && $pm_info['pm_to'] == USERID)
-	{
+	{	// Inbox
 		$now = time();
 		$pm_info['pm_read'] = $now;
 		$pm->pm_mark_read($pmid, $pm_info);
 	}
 	$txt .= $tp->parseTemplate($PM_SHOW, true, $pm_shortcodes);
 	$ns -> tablerender(LAN_PM, $txt);
-	if($pm_info['pm_from'] == USERID) {
-		$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox(intval($qs[1])), "PM");
+	if($pm_info['pm_from'] == USERID) 
+	{	// Show Outbox
+		$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), "PM");
 	} 
 	else
-	{
-		$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox(intval($qs[1])), "PM");
+	{	// Show Inbox
+		$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), "PM");
 	}
 }
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/pm_class.php 0.7.11.src/e107_plugins/pm/pm_class.php
--- 0.7.7.src/e107_plugins/pm/pm_class.php	2006-11-09 03:28:58.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/pm_class.php	2007-08-02 15:41:22.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_class.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/11/09 09:28:58 $
-|     $Author: lisa_ $
+|     $Revision: 1.21 $
+|     $Date: 2007/08/02 20:41:22 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -56,6 +56,8 @@
 		return FALSE;
 	}
 
+
+	// Send a PM
 	function add($vars)
 	{
 		global $pm_prefs, $tp, $sql;
@@ -68,7 +70,7 @@
 		{
 			foreach($vars['uploaded'] as $u)
 			{
-				if(!isset($u['error']))
+				if (!isset($u['error']) || !$u['error'])
 				{
 					$pmsize += $u['size'];
 					$a_list[] = $u['name'];
@@ -78,8 +80,14 @@
 		}
 		$pmsize += strlen($vars['pm_message']);
 
-		$pm_subject = $tp->toDB($vars['pm_subject']);
-		$pm_message = $tp->toDB($vars['pm_message']);
+		$pm_subject = trim($tp->toDB($vars['pm_subject']));
+		$pm_message = trim($tp->toDB($vars['pm_message']));
+		
+		if (!$pm_subject && !$pm_message && !$attachlist)
+		{  // Error - no subject, no message body and no uploaded files
+		  return LAN_PM_65;
+		}
+		
 		$sendtime = time();
 		if(isset($vars['to_userclass']) || isset($vars['to_array']))
 		{
@@ -188,7 +196,7 @@
 		$txt = LAN_PM_101.SITENAME."\n\n";
 		$txt .= LAN_PM_102.USERNAME."\n";
 		$txt .= LAN_PM_103.$pminfo['pm_subject']."\n";
-		if($attch_count > 0)
+		if($attach_count > 0)
 		{
 			$txt .= LAN_PM_104.$attach_count."\n";
 		}
@@ -226,9 +234,14 @@
 	function block_add($from, $to = USERID)
 	{
 		global $sql, $tp;
-		if($sql->db_Select("user", "user_name", "user_id = '".intval($from)."'"))
+		if($sql->db_Select("user", "user_name, user_perms", "user_id = '".intval($from)."'"))
 		{
-			$uinfo = $sql->db_Fetch();
+		  $uinfo = $sql->db_Fetch();
+		  if (($uinfo['user_perms'] == '0') || ($uinfo['user_perms'] == '0.'))
+		  {  // Don't allow block of main admin
+		    return LAN_PM_64;
+		  }
+		  
 			if(!$sql->db_Count("private_msg_block", "(*)", "WHERE pm_block_from = '".intval($from)."' AND pm_block_to = '".$tp -> toDB($to)."'"))
 			{
 				if($sql->db_Insert("private_msg_block", "0, '".intval($from)."', '".$tp -> toDB($to)."', '".time()."', '0'"))
@@ -283,8 +296,8 @@
 	function pm_getuid($var)
 	{
 		global $sql, $tp;
-
-		if($sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$sql -> escape(trim($var), TRUE)."'"))
+		$var = trim($var);
+		if($sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$tp->toDB($var)."' LIMIT 1"))
 		{
 			$row = $sql->db_Fetch();
 			return $row;
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/pm_conf.php 0.7.11.src/e107_plugins/pm/pm_conf.php
--- 0.7.7.src/e107_plugins/pm/pm_conf.php	2006-11-04 12:33:58.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/pm_conf.php	2007-02-04 09:36:54.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_conf.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/11/04 18:33:58 $
-|     $Author: e107coders $
+|     $Revision: 1.8 $
+|     $Date: 2007/02/04 15:36:54 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 $retrieve_prefs[] = 'pm_prefs';
@@ -273,7 +273,7 @@
 			</td>
 			<td class='forumheader3'>
 			".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='inbox_size[{$row['limit_id']}]' value='{$row['inbox_size']}' /> 
-			".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='outbox_size[{$row['limit_id']}]' value='{$row['outbox_size']}' /> 
+			".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='outbox_size[{$row['limit_id']}]' value='{$row['outbox_size']}' /> 
 			</td>
 			</tr>
 			";
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/pm_func.php 0.7.11.src/e107_plugins/pm/pm_func.php
--- 0.7.7.src/e107_plugins/pm/pm_func.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/pm_func.php	2007-08-08 14:34:52.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_func.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2007/08/08 19:34:52 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -45,11 +45,15 @@
 			{
 				$pm_info['inbox']['new'] = $new;
 			}
+			else
+			{
+				$pm_info['inbox']['new'] = 0;
+			}
 		}
 	}
 	if(!isset($pm_info[$which]['limit']))
 	{
-		if($pref['pm_limits'] > 0)
+		if(varset($pref['pm_limits'],0) > 0)
 		{
 			if($pref['pm_limits'] == 1)
 			{
@@ -65,7 +69,7 @@
 				$pm_info['inbox']['limit'] =  $row['inbox_limit'];
 				$pm_info['outbox']['limit'] =  $row['outbox_limit'];
 			}
-			$pm_info['inbox']['limit_val'] = ($pref['pm_limits'] == 1 ? $pm_info['inbox']['total'] : $pm_info['inbox']['size']);
+			$pm_info['inbox']['limit_val'] = ($pref['pm_limits'] == 1 ? varset($pm_info['inbox']['total'],'') : varset($pm_info['inbox']['size'],''));
 			if(!$pm_info['inbox']['limit'] || !$pm_info['inbox']['limit_val'])
 			{
 				$pm_info['inbox']['filled'] = 0;
@@ -74,7 +78,7 @@
 			{
 				$pm_info['inbox']['filled'] = number_format($pm_info['inbox']['limit_val']/$pm_info['inbox']['limit'] * 100, 2);
 			}
-			$pm_info['outbox']['limit_val'] = ($pref['pm_limits'] == 1 ? $pm_info['outbox']['total'] : $pm_info['outbox']['size']);
+			$pm_info['outbox']['limit_val'] = ($pref['pm_limits'] == 1 ? varset($pm_info['outbox']['total'],'') : varset($pm_info['outbox']['size'],''));
 			if(!$pm_info['outbox']['limit'] || !$pm_info['outbox']['limit_val'])
 			{
 				$pm_info['outbox']['filled'] = 0;
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/pm_shortcodes.php 0.7.11.src/e107_plugins/pm/pm_shortcodes.php
--- 0.7.7.src/e107_plugins/pm/pm_shortcodes.php	2006-11-16 10:55:10.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/pm_shortcodes.php	2007-09-22 12:41:29.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_shortcodes.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/11/16 16:55:10 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.20 $
+|     $Date: 2007/09/22 17:41:29 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -52,13 +52,15 @@
 {
 	$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
 	require_once(e_HANDLER."userclass_class.php");
-	$args = (ADMIN ? "admin, classes" : "matchclass");
+	$args = (ADMIN ? "admin, classes" : "classes, matchclass");
 	if(check_class($pm_prefs['sendall_class']))
 	{
 		$args = "member, ".$args;
 	}
 	$ret .= r_userclass("pm_userclass", "", "off", $args);
+	if (strpos($ret,'option') === FALSE)  $ret = '';
 }
+
 return $ret;
 SC_END
 
@@ -238,7 +240,7 @@
 
 SC_BEGIN PM_SUBJECT
 global $pm_info, $tp;
-$ret = $tp->toHTML($pm_info['pm_subject'], true, 'no_make_clickable');
+$ret = $tp->toHTML($pm_info['pm_subject'], true, 'no_make_clickable,no_hook');
 if('link' == $parm)
 {
 	$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$pm_info['pm_id']}'>".$ret."</a>";
@@ -294,7 +296,14 @@
 
 SC_BEGIN PM_DELETE
 global $pm_info;
-$extra = $parm != "" ? ".{$parm}" : "";
+if($parm != "")
+{ 
+  $extra = '.'.$parm;
+}
+else
+{
+  $extra = '.'.($pm_info['pm_from'] == USERID ? 'outbox' : 'inbox');
+}
 return "<a href='".e_PLUGIN_ABS."pm/pm.php?del.{$pm_info['pm_id']}{$extra}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' style='width: 16px; height: 16px; border: 0px' /></a>";
 SC_END
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/private_msg_menu.php 0.7.11.src/e107_plugins/pm/private_msg_menu.php
--- 0.7.7.src/e107_plugins/pm/private_msg_menu.php	2006-11-15 14:48:46.000000000 -0600
+++ 0.7.11.src/e107_plugins/pm/private_msg_menu.php	2007-05-28 06:18:11.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/private_msg_menu.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/15 20:48:46 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.12 $
+|     $Date: 2007/05/28 11:18:11 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -44,7 +44,7 @@
 $sc_style['NEWPM_ANIMATE']['post'] = "</a>";
 
 
-if(!defined($pm_menu_template))
+if(!isset($pm_menu_template))
 {
 	$pm_menu_template = "
 	<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".PM_INBOX_ICON."</a>
diff -x .svn -ruN 0.7.7.src/e107_plugins/pm/sendpm.sc 0.7.11.src/e107_plugins/pm/sendpm.sc
--- 0.7.7.src/e107_plugins/pm/sendpm.sc	2005-10-11 09:53:29.000000000 -0500
+++ 0.7.11.src/e107_plugins/pm/sendpm.sc	2007-05-28 11:52:42.000000000 -0500
@@ -6,7 +6,7 @@
 {
 	if(file_exists(THEME."forum/pm.png"))
 	{
-		$img = "<img src='".THEME."forum/pm.png' alt='".LAN_PM."' title='".LAN_PM."' style='border:0' />";
+		$img = "<img src='".THEME_ABS."forum/pm.png' alt='".LAN_PM."' title='".LAN_PM."' style='border:0' />";
 	}
 	else
 	{
diff -x .svn -ruN 0.7.7.src/e107_plugins/poll/admin_config.php 0.7.11.src/e107_plugins/poll/admin_config.php
--- 0.7.7.src/e107_plugins/poll/admin_config.php	2006-11-11 22:14:44.000000000 -0600
+++ 0.7.11.src/e107_plugins/poll/admin_config.php	2007-11-01 17:46:14.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/admin_config.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/11/12 04:14:44 $
-|     $Author: mrpete $
+|     $Revision: 1.18 $
+|     $Date: 2007/11/01 22:46:14 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 if (!is_object($tp)) $tp = new e_parse;
-if (!getperms("U")) {
+if (!getperms("P")) {
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -107,13 +107,16 @@
 
 		$_POST['multipleChoice'] = $poll_allow_multiple;
 		$_POST['showResults'] = $poll_result_type;
-		$_POST['pollUserclass'] = $poll_vote_userclass;
+		// Can't have everyone voting if tracking method is user ID
+		$_POST['pollUserclass'] = (($poll_vote_userclass == e_UC_PUBLIC) && $poll_storage_method == 2) ? e_UC_MEMBER : $poll_vote_userclass;
 		$_POST['storageMethod'] = $poll_storage_method;
 	}
 }
 
 if (isset($_POST['preview']))
 {
+	// Can't have everyone voting if tracking method is user ID
+	if (($_POST['pollUserclass'] == e_UC_PUBLIC) && ($_POST['storageMethod'] == 2)) $_POST['pollUserclass'] = e_UC_MEMBER;
 	$poll->render_poll($_POST, "preview");
 }
 
@@ -125,27 +128,38 @@
 $text = "<div style='text-align:center'><div style='padding : 1px; ".ADMIN_WIDTH."; height : 200px; overflow : auto; margin-left: auto; margin-right: auto;'>
 	<form action='".e_SELF."' method='post' id='del_poll'>";
 
-if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) {
+if ($poll_total = $sql->db_Select("polls", "*", "1 ORDER BY poll_type")) 
+{  // Display existing polls
 	$text .= "<table class='fborder' style='width:99%'>
 		<tr>
-		<td style='width:5%' class='fcaption'>ID
+		<td style='width:5%' class='fcaption' style='white-space:nowrap'>".POLL_ADLAN07."
 		<input type='hidden' name='del_poll_confirm' id='del_poll_confirm' value='1' />
 		</td>
 		<td style='width:75%' class='fcaption'>".POLLAN_3."</td>
 		<td style='width:20%' class='fcaption'>".POLLAN_4."</td>
 		</tr>";
-	while ($row = $sql->db_Fetch()) {
-		extract($row);
+	while ($row = $sql->db_Fetch())
+	{
+		if($row['poll_type'] == 1)
+		{
+			$id_text = POLL_ADLAN05.$row['poll_id'];
+		}
+		else
+		{
+			$id_text = POLL_ADLAN06.$row['poll_datestamp'];
+		}
 		$text .= "<tr>
-			<td style='width:5%' class='forumheader3'>$poll_id</td>
-			<td style='width:75%' class='forumheader3'>".$tp -> toHTML($poll_title, TRUE,"no_hook emotes_off defs")."</td>
-			<td style='width:20%; text-align:center' class='forumheader3'><div>". $rs->form_button("button", "main_edit_{$poll_id}", POLLAN_5, "onclick=\"document.location='".e_SELF."?edit.$poll_id'\""). $rs->form_button("submit", "main_delete_{$poll_id}", POLLAN_6, "onclick=\"confirm_($poll_id)\"")."
+			<td  style='white-space:nowrap' class='forumheader3'>{$id_text}</td>
+			<td style='width:75%' class='forumheader3'>".$tp -> toHTML($row['poll_title'], TRUE, "no_hook, emotes_off, defs")."</td>
+			<td style='width:20%; text-align:center' class='forumheader3'><div>". $rs->form_button("button", "main_edit_{$row['poll_id']}", POLLAN_5, "onclick=\"document.location='".e_SELF."?edit.{$row['poll_id']}'\""). $rs->form_button("submit", "main_delete_{$row['poll_id']}", POLLAN_6, "onclick=\"confirm_({$row['poll_id']})\"")."
 			</div></td>
 			</tr>";
 	}
 	$text .= "</table>";
-} else {
-	$text .= "<div style='text-align:center'>".POLLAN_7."</div>";
+} 
+else 
+{  // No polls to display
+  $text .= "<div style='text-align:center'>".POLLAN_7."</div>";
 }
 $text .= "</form></div></div>";
 $ns->tablerender(POLLAN_1, $text);
@@ -156,17 +170,22 @@
 
 $ns->tablerender(POLLAN_2, $text);
 require_once(e_ADMIN."footer.php");
-function headerjs() {
+
+
+function headerjs() 
+{
 	global $tp;
 	$headerjs = "<script type=\"text/javascript\">
-		function confirm_(poll_id){
-		var x=confirm(\"Delete this poll? [ID: \" + poll_id + \"]\");
-		if (x){
-		document.getElementById('del_poll').action='".e_SELF."?delete.' + poll_id;
-		document.getElementById('del_poll').submit();
-		}
-		}
-		</script>";
+function confirm_(poll_id)
+{
+  var x=confirm(\"Delete this poll? [ID: \" + poll_id + \"]\");
+  if (x)
+  {
+	document.getElementById('del_poll').action='".e_SELF."?delete.' + poll_id;
+	document.getElementById('del_poll').submit();
+  }
+}
+</script>";
 	return $headerjs;
 }
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/poll/languages/English.php 0.7.11.src/e107_plugins/poll/languages/English.php
--- 0.7.7.src/e107_plugins/poll/languages/English.php	2006-11-12 16:09:09.000000000 -0600
+++ 0.7.11.src/e107_plugins/poll/languages/English.php	2007-11-08 14:40:37.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/languages/English.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/11/12 22:09:09 $
-|     $Author: lisa_ $
+|     $Revision: 1.14 $
+|     $Date: 2007/11/08 20:40:37 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,6 +22,10 @@
 define("POLL_ADLAN03", "Configure polls");
 define("POLL_ADLAN04", "The poll plugin has been successfully installed. To add polls, click on the Polls icon in the plugin section of your admin front page, and remember to activate the menu item from your menus page.");
 
+define("POLL_ADLAN05", "Main Poll: ");
+define("POLL_ADLAN06", "Forum Thread: ");
+define("POLL_ADLAN07", "Type");
+
 define("POLLAN_MENU_CAPTION", "Poll");
 
 define("POLLAN_1", "Existing polls");
@@ -66,7 +70,7 @@
 define("POLLAN_40", "Click here to see results");
 define("POLLAN_41", "This poll is restricted to members only");
 define("POLLAN_42", "This poll is restricted to administrators only");
-define("POLLAN_43", "You do not have the permission to vote in this poll");
+define("POLLAN_43", "You do not have the required permissions to vote in this poll");
 define("POLLAN_44", "Delete this poll?");
 define("POLLAN_45", "Poll successfully updated");
 define("POLLAN_46", "Field(s) left blank");
diff -x .svn -ruN 0.7.7.src/e107_plugins/poll/oldpolls.php 0.7.11.src/e107_plugins/poll/oldpolls.php
--- 0.7.7.src/e107_plugins/poll/oldpolls.php	2006-11-04 12:33:58.000000000 -0600
+++ 0.7.11.src/e107_plugins/poll/oldpolls.php	2007-03-03 13:41:17.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/oldpolls.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/11/04 18:33:58 $
-|     $Author: e107coders $
+|     $Revision: 1.14 $
+|     $Date: 2007/03/03 19:41:17 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -30,7 +30,7 @@
 
 if(e_QUERY)
 {
-	$query = "SELECT p.*, u.user_name FROM #polls AS p
+	$query = "SELECT p.*, u.user_id, u.user_name FROM #polls AS p
 	LEFT JOIN #user AS u ON p.poll_admin_id = u.user_id
 	WHERE p.poll_type=1 AND p.poll_id=".intval(e_QUERY);
 
@@ -58,8 +58,8 @@
 		$text = "<table style='".USER_WIDTH."'>
 		<tr>
 		<td colspan='2' class='mediumtext' style='text-align:center'>
-		<b>".$tp -> toHTML($poll_title)."</b>
-		<div class='smalltext'>".POLLAN_35." <a href='".e_BASE."user.php?id.$user_id'>".$user_name."</a>.<br /> ".POLLAN_37." ".$start_datestamp." ".POLLAN_38." ".$end_datestamp.".<br />".POLLAN_26.": $voteTotal</div>
+		<b>".$tp -> toHTML($poll_title,TRUE,'TITLE')."</b>
+		<div class='smalltext'>".POLLAN_35." <a href='".e_BASE."user.php?id.{$user_id}'>".$user_name."</a>.<br /> ".POLLAN_37." ".$start_datestamp." ".POLLAN_38." ".$end_datestamp.".<br />".POLLAN_26.": {$voteTotal}</div>
 		<br />
 
 		</td>
@@ -137,10 +137,12 @@
 	$from = $gen->convert_date($poll_datestamp, "short");
 	$to = $gen->convert_date($poll_end_datestamp, "short");
 
+	$poll_title = $tp->e_bb->parseBBCodes($poll_title, 0,TRUE,TRUE);		// Strip bbcodes
+	
 	$text .= "<tr>
-	<td class='forumheader3' style='width: 55%;'><a href='".e_SELF."?$poll_id'>$poll_title</a></td>
-	<td class='forumheader3' style='width: 15%;'><a href='".e_BASE."user.php?id.$poll_admin_id'>$user_name</a></td>
-	<td class='forumheader3' style='width: 30%;'>$from ".POLLAN_38." $to</td>
+	<td class='forumheader3' style='width: 55%;'><a href='".e_SELF."?{$poll_id}'>{$poll_title}</a></td>
+	<td class='forumheader3' style='width: 15%;'><a href='".e_BASE."user.php?id.{$poll_admin_id}'>{$user_name}</a></td>
+	<td class='forumheader3' style='width: 30%;'>{$from} ".POLLAN_38." {$to}</td>
 	</tr>\n";
 }
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/poll/poll_class.php 0.7.11.src/e107_plugins/poll/poll_class.php
--- 0.7.7.src/e107_plugins/poll/poll_class.php	2006-11-11 08:35:59.000000000 -0600
+++ 0.7.11.src/e107_plugins/poll/poll_class.php	2007-11-01 17:47:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/poll_class.php,v $
-|     $Revision: 1.48 $
-|     $Date: 2006/11/11 14:35:59 $
-|     $Author: mrpete $
+|     $Revision: 1.55 $
+|     $Date: 2007/11/01 22:47:27 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -67,7 +67,7 @@
 
 		if(POLLACTION == "edit")
 		{
-			$sql -> db_Update("polls", "poll_title='$poll_title', poll_options='$poll_options', poll_type=$mode, poll_comment='".$tp -> toDB($poll_comment)."', poll_allow_multiple=".intval($multipleChoice).", poll_result_type=".intval($showResults).", poll_vote_userclass=".intval($pollUserclass).", poll_storage_method=".intval($storageMethod)." WHERE poll_id=".intval(POLLID));
+			$sql -> db_Update("polls", "poll_title='$poll_title', poll_options='$poll_options', poll_comment='".$tp -> toDB($poll_comment)."', poll_allow_multiple=".intval($multipleChoice).", poll_result_type=".intval($showResults).", poll_vote_userclass=".intval($pollUserclass).", poll_storage_method=".intval($storageMethod)." WHERE poll_id=".intval(POLLID));
 
 			/* update poll results - bugtracker #1124 .... */
 			$sql -> db_Select("polls", "poll_votes", "poll_id='".intval(POLLID)."' ");
@@ -240,9 +240,9 @@
 			$POLLMODE = $this->pollmode;
 		}
 
-		$barl = (file_exists(THEME."images/barl.png") ? THEME."images/barl.png" : e_PLUGIN."poll/images/barl.png");
-		$barr = (file_exists(THEME."images/barr.png") ? THEME."images/barr.png" : e_PLUGIN."poll/images/barr.png");
-		$bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_PLUGIN."poll/images/bar.png");
+		$barl = (file_exists(THEME."images/barl.png") ? THEME_ABS."images/barl.png" : e_PLUGIN."poll/images/barl.png");
+		$barr = (file_exists(THEME."images/barr.png") ? THEME_ABS."images/barr.png" : e_PLUGIN."poll/images/barr.png");
+		$bar = (file_exists(THEME."images/bar.png") ? THEME_ABS."images/bar.png" : e_PLUGIN."poll/images/bar.png");
 
 		if($type == "preview")
 		{
@@ -286,9 +286,17 @@
 
 		if(count($voteArray))
 		{
-			foreach($voteArray as $votes){
-				$percentage[] = round(($votes/$voteTotal) * 100, 2);
+		  foreach($voteArray as $votes)
+		  {
+		    if ($voteTotal > 0)
+			{
+			  $percentage[] = round(($votes/$voteTotal) * 100, 2);
+			}
+			else
+			{
+			  $percentage[] = 0;
 			}
+		  }
 		}
 		/* get template */
 		if (file_exists(THEME."poll_template.php"))
@@ -311,7 +319,7 @@
 
 		$comment_total = $sql->db_Select("comments", "*", "comment_item_id='".intval($pollArray['poll_id'])."' AND comment_type=4");
 
-		$QUESTION = $tp -> toHTML($pollArray['poll_title'], TRUE,"emotes_off defs");
+		$QUESTION = $tp -> toHTML($pollArray['poll_title'], TRUE,"emotes_off, defs");
 		$VOTE_TOTAL = POLLAN_31.": ".$voteTotal;
 		$COMMENTS = ($pollArray['poll_comment'] ? " <a href='".e_BASE."comment.php?comment.poll.".$pollArray['poll_id']."'>".POLLAN_27.": ".$comment_total."</a>" : "");
 		$OLDPOLLS = ($type == "menu" ? "<a href='".e_PLUGIN."poll/oldpolls.php'>".POLLAN_28."</a>" : "");
@@ -399,7 +407,7 @@
 		}
 
 		if(!defined("POLLRENDERED")) define("POLLRENDERED", TRUE);
-		$caption = (file_exists(THEME."images/poll_menu.png") ? "<img src='".THEME."images/poll_menu.png' alt='' /> ".POLLAN_MENU_CAPTION : POLLAN_MENU_CAPTION);
+		$caption = (file_exists(THEME."images/poll_menu.png") ? "<img src='".THEME_ABS."images/poll_menu.png' alt='' /> ".POLLAN_MENU_CAPTION : POLLAN_MENU_CAPTION);
 		if($type == "preview")
 		{
 			$caption = POLLAN_23;
@@ -533,14 +541,14 @@
 
 		<tr>
 		<td style='width:30%' class='forumheader3'>".POLLAN_15."</td>
-		<td class='forumheader3'>".r_userclass("pollUserclass", $_POST['pollUserclass'], "admin")."</td>
+		<td class='forumheader3'>".r_userclass("pollUserclass", $_POST['pollUserclass'], 'off', "public,member,admin,classes,matchclass")."</td>
 		</tr>
 
 		<tr>
 		<td style='width:30%' class='forumheader3'>".POLLAN_16."</td>
 		<td class='forumheader3'>
 		<input type='radio' name='storageMethod' value='0'".(!$_POST['storageMethod'] ? " checked='checked'" : "")." /> ".POLLAN_17."<br />
-		<input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] == 1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br />
+		<input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] ==1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br />
 		<input type='radio' name='storageMethod' value='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19."
 		</tr>
 
diff -x .svn -ruN 0.7.7.src/e107_plugins/rss_menu/e_meta.php 0.7.11.src/e107_plugins/rss_menu/e_meta.php
--- 0.7.7.src/e107_plugins/rss_menu/e_meta.php	2006-11-07 23:43:14.000000000 -0600
+++ 0.7.11.src/e107_plugins/rss_menu/e_meta.php	2007-12-06 14:23:05.000000000 -0600
@@ -11,26 +11,26 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/e_meta.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/11/08 05:43:14 $
-|     $Author: e107coders $
+|     $Revision: 1.7 $
+|     $Date: 2007/12/06 20:23:05 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 global $tp,$PLUGINS_DIRECTORY;
 
-if(isset($pref['rss_feeds']) && $pref['rss_feeds'])
-{
-	if($sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 ORDER BY rss_name")){
+	if($sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 ORDER BY rss_name"))
+	{
    		while($row=$sql->db_Fetch()){
 	  		//wildcard topic_id's should not be listed
 	   		if(strpos($row['rss_url'], "*")===FALSE){
 		  		$url = SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".$tp->toHTML($row['rss_url'], TRUE, 'constants, no_hook, emotes_off').".2";
+				$url .= ($row['rss_topicid']) ? ".".$row['rss_topicid'] : "";
 		  		$name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off');
 		   		echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)." ".htmlspecialchars($name, ENT_QUOTES, CHARSET)."' href='".$url."' />\n";
 			}
 		}
 	}
-}
-?>
+
+?>
\ No newline at end of file
Binary files 0.7.7.src/e107_plugins/rss_menu/images/rss1.png and 0.7.11.src/e107_plugins/rss_menu/images/rss1.png differ
Binary files 0.7.7.src/e107_plugins/rss_menu/images/rss2.png and 0.7.11.src/e107_plugins/rss_menu/images/rss2.png differ
Binary files 0.7.7.src/e107_plugins/rss_menu/images/rss3.png and 0.7.11.src/e107_plugins/rss_menu/images/rss3.png differ
Binary files 0.7.7.src/e107_plugins/rss_menu/images/rss4.png and 0.7.11.src/e107_plugins/rss_menu/images/rss4.png differ
diff -x .svn -ruN 0.7.7.src/e107_plugins/rss_menu/rss.php 0.7.11.src/e107_plugins/rss_menu/rss.php
--- 0.7.7.src/e107_plugins/rss_menu/rss.php	2006-11-08 00:51:13.000000000 -0600
+++ 0.7.11.src/e107_plugins/rss_menu/rss.php	2007-05-30 14:25:13.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/rss.php,v $
-|     $Revision: 1.57 $
-|     $Date: 2006/11/08 06:51:13 $
-|     $Author: e107coders $
+|     $Revision: 1.58 $
+|     $Date: 2007/05/30 19:25:13 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -433,7 +433,10 @@
 				<lastBuildDate>".date("r",($time + $this -> offset))."</lastBuildDate>
 				<docs>http://backend.userland.com/rss</docs>
 				<generator>e107 (http://e107.org)</generator>
-				<ttl>60</ttl>
+				<ttl>60</ttl>";
+				if (trim(SITEBUTTON))
+				{
+				echo "
 				<image>
 				<title>".$tp->toRss($rss_title)."</title>
 				<url>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</url>
@@ -441,7 +444,9 @@
 				<width>88</width>
 				<height>31</height>
 				<description>".$tp->toRss($pref['sitedescription'])."</description>
-				</image>
+				</image>";
+				}
+				echo "
 				<textInput>
 				<title>Search</title>
 				<description>Search ".$tp->toRss($pref['sitename'])."</description>
diff -x .svn -ruN 0.7.7.src/e107_plugins/rss_menu/rss_shortcodes.php 0.7.11.src/e107_plugins/rss_menu/rss_shortcodes.php
--- 0.7.7.src/e107_plugins/rss_menu/rss_shortcodes.php	2006-06-20 15:13:10.000000000 -0500
+++ 0.7.11.src/e107_plugins/rss_menu/rss_shortcodes.php	2007-11-27 15:47:14.000000000 -0600
@@ -1,4 +1,7 @@
 <?php
+// $Id: rss_shortcodes.php,v 1.6 2007/11/27 21:47:14 e107steved Exp $
+if (!defined('e107_INIT')) { exit; }   
+
 include_once(e_HANDLER.'shortcode_handler.php');
 $rss_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
 /*
@@ -28,10 +31,10 @@
 $url4 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
 
 $text = "
-<a href='".$url1."'><img src='".e_PLUGIN."rss_menu/images/rss1.png' alt='rss1' /></a>
-<a href='".$url2."'><img src='".e_PLUGIN."rss_menu/images/rss2.png' alt='rss1' /></a>
-<a href='".$url3."'><img src='".e_PLUGIN."rss_menu/images/rss3.png' alt='rss1' /></a>
-<a href='".$url4."'><img src='".e_PLUGIN."rss_menu/images/rss4.png' alt='rss1' /></a>
+<a href='".$url1."'><img src='".e_PLUGIN."rss_menu/images/rss1.png' alt='RSS 0.92' /></a>
+<a href='".$url2."'><img src='".e_PLUGIN."rss_menu/images/rss2.png' alt='RSS 2.0' /></a>
+<a href='".$url3."'><img src='".e_PLUGIN."rss_menu/images/rss3.png' alt='RDF' /></a>
+<a href='".$url4."'><img src='".e_PLUGIN."rss_menu/images/rss4.png' alt='ATOM' /></a>
 ";
 return $text;
 SC_END
@@ -124,8 +127,8 @@
 $vals = array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23);
 $text = "<select class='tbox' name='rss_class'>";
 foreach($vals as $key=>$val){
-	$sel = ($row['rss_class'] == $key) ? "selected='selected'" : "";
-	$text .= "<option value='$key'>$val</option>\n";
+	$sel = ($row['rss_class'] == $key) ? " selected='selected'" : "";
+	$text .= "<option value='{$key}'{$sel}>$val</option>\n";
 }
 $text .= "</select>";
 return $text;
diff -x .svn -ruN 0.7.7.src/e107_plugins/trackback/admin_config.php 0.7.11.src/e107_plugins/trackback/admin_config.php
--- 0.7.7.src/e107_plugins/trackback/admin_config.php	2006-10-24 08:44:55.000000000 -0500
+++ 0.7.11.src/e107_plugins/trackback/admin_config.php	2007-12-26 08:20:00.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/admin_config.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/10/24 13:44:55 $
-|     $Author: mrpete $
+|     $Revision: 1.4 $
+|     $Date: 2007/12/26 14:20:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -27,11 +27,16 @@
 	
 require_once(e_ADMIN."auth.php");
 	
-if (isset($_POST['updatesettings'])) {
+if (isset($_POST['updatesettings'])) 
+{
+  if ($pref['trackbackEnabled'] != $_POST['trackbackEnabled'])
+  {
 	$pref['trackbackEnabled'] = $_POST['trackbackEnabled'];
-	$pref['trackbackString'] = $tp->toDB($_POST['trackbackString']);
-	save_prefs();
-	$message = TRACKBACK_L4;
+	$e107cache->clear("news.php");
+  }
+  $pref['trackbackString'] = $tp->toDB($_POST['trackbackString']);
+  save_prefs();
+  $message = TRACKBACK_L4;
 }
 
 	
diff -x .svn -ruN 0.7.7.src/e107_plugins/trackback/e_meta.php 0.7.11.src/e107_plugins/trackback/e_meta.php
--- 0.7.7.src/e107_plugins/trackback/e_meta.php	2006-07-09 14:40:43.000000000 -0500
+++ 0.7.11.src/e107_plugins/trackback/e_meta.php	2007-07-12 08:00:07.000000000 -0500
@@ -6,16 +6,15 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/e_meta.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/07/09 19:40:43 $
-|     $Author: e107coders $
+|     $Revision: 1.3 $
+|     $Date: 2007/07/12 13:00:07 $
+|     $Author: sweetas $
 +-----------------------------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 if(isset($pref['trackbackEnabled'])){
-	echo "<link rel='pingback' href='".SITEURLBASE.e_PLUGIN_ABS."trackback/xmlrpc.php' />";
+	echo "<link rel='pingback' href='".SITEURLBASE.e_PLUGIN_ABS."trackback/trackback.php' />";
 }
 
-?>
-
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/trackback/modtrackback.php 0.7.11.src/e107_plugins/trackback/modtrackback.php
--- 0.7.7.src/e107_plugins/trackback/modtrackback.php	2006-06-26 03:26:44.000000000 -0500
+++ 0.7.11.src/e107_plugins/trackback/modtrackback.php	2007-12-07 14:38:21.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/modtrackback.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/06/26 08:26:44 $
-|     $Author: asperon $
+|     $Revision: 1.3 $
+|     $Date: 2007/12/07 20:38:21 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -33,6 +33,7 @@
 		}
 	}
 	$ns->tablerender("", "<div style='text-align:center'><b>".TRACKBACK_L15."</b></div>");
+	$e107cache->clear("news.php");
 }
 	
 $text = "<div style='text-align:center'>
diff -x .svn -ruN 0.7.7.src/e107_plugins/trackback/trackbackClass.php 0.7.11.src/e107_plugins/trackback/trackbackClass.php
--- 0.7.7.src/e107_plugins/trackback/trackbackClass.php	2006-04-05 07:19:18.000000000 -0500
+++ 0.7.11.src/e107_plugins/trackback/trackbackClass.php	2007-12-10 16:39:36.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/trackbackClass.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/04/05 12:19:18 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.13 $
+|     $Date: 2007/12/10 22:39:36 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -101,7 +101,7 @@
 
 	function respondTrackback ()
 	{
-		global $sql, $pref, $tp;
+		global $sql, $pref, $tp, $e107cache;
 		$errorMessage = "";
 		if(!$pref['trackbackEnabled'])
 		{
@@ -152,10 +152,14 @@
 
 		if(!$errorMessage)
 		{
-			if(!$sql -> db_Insert("trackback", "0, $pid, '$title', '$excerpt', '$permLink', '$blog_name' "))
-			{
-				$errorMessage = "Unable to enter your trackback information into the database -> 0, $pid, '$title', '$excerpt', '$permLink', '$blog_name'";
-			}
+		  if(!$sql -> db_Insert("trackback", "0, {$pid}, '{$title}', '{$excerpt}', '{$permLink}', '{$blog_name}' "))
+		  {
+			$errorMessage = "Unable to enter your trackback information into the database -> 0, {$pid}, '{$title}', '{$excerpt}', '{$permLink}', '{$blog_name}'";
+		  }
+		  else
+		  {
+			$e107cache->clear("comment.php?news.{$pid}");
+		  }
 		}
 
 		if($errorMessage)
@@ -174,4 +178,5 @@
 			echo "</response>";
 		}
 	}
-}
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_plugins/tree_menu/tree_menu.php 0.7.11.src/e107_plugins/tree_menu/tree_menu.php
--- 0.7.7.src/e107_plugins/tree_menu/tree_menu.php	2006-11-25 09:39:55.000000000 -0600
+++ 0.7.11.src/e107_plugins/tree_menu/tree_menu.php	2007-05-31 16:17:00.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/tree_menu/tree_menu.php,v $
-|     $Revision: 1.26 $
-|     $Date: 2006/11/25 15:39:55 $
-|     $Author: lisa_ $
+|     $Revision: 1.28 $
+|     $Date: 2007/05/31 21:17:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -94,8 +94,8 @@
 
 		$url = "javascript:void(0);";
 		$spanName = $id;
-		$image = ($image ? "<img src='".e_IMAGE."icons/".$image."' alt='' style='vertical-align:middle;' />" : "&raquo;");
-		$plink = "<div".($menu_pref['tm_class2'] ? " class='{$menu_pref['tm_class2']}'" : "")." style='width:100%; cursor: pointer;' onclick='expandit(\"span_".$spanName."\");updatecook(\"".$spanName."\");'>".$image.setLink($name, $url, $openMethod, $description)."</div>\n";
+		$image = ($image ? "<img src='".e_IMAGE_ABS."icons/".$image."' alt='' style='vertical-align:middle;' />" : "&raquo;");
+		$plink = "<div".($menu_pref['tm_class2'] ? " class='{$menu_pref['tm_class2']}'" : "")." style='width:100%; cursor: pointer;' onclick='expandit(\"span_".$spanName."\");updatecook(\"".$spanName."\");'>".$image." ".setLink($name, $url, $openMethod, $description)."</div>\n";
 		$text .= ($menu_pref['tm_spacer'] ? "<div class='spacer'>\n".$plink."\n</div>\n" : $plink);
 	} else {
 		// no sublinks found ...
@@ -103,8 +103,8 @@
 		{
 			$linkName = $url;
 			$spanName = "";
-			$image = ($image ? "<img src='".e_IMAGE."icons/".$image."' alt='' style='vertical-align:middle;' />" : "&middot;");
-			$plink = "<div".($menu_pref['tm_class1'] ? " class='{$menu_pref['tm_class1']}'" : "")." style='width:100%; cursor: pointer;'>".$image.setLink($name, $url, $openMethod, $description)."</div>";
+			$image = ($image ? "<img src='".e_IMAGE_ABS."icons/".$image."' alt='' style='vertical-align:middle;' />" : "&middot;");
+			$plink = "<div".($menu_pref['tm_class1'] ? " class='{$menu_pref['tm_class1']}'" : "")." style='width:100%; cursor: pointer;'>".$image." ".setLink($name, $url, $openMethod, $description)."</div>";
 			$text .= ($menu_pref['tm_spacer'] ? "<div class='spacer'>\n".$plink."\n</div>\n" : $plink);
 		}
 	}
@@ -115,10 +115,10 @@
 		$text .= "\n<span style=\"display:none\" id=\"span_".$spanName."\">\n";
 		foreach($sublink as $link) {
 			extract($link);
-			$image = ($image ? "<img src='".e_IMAGE."icons/".$image."' alt='' style='vertical-align:middle' />  " : "&middot; ");
+			$image = ($image ? "<img src='".e_IMAGE_ABS."icons/".$image."' alt='' style='vertical-align:middle' />  " : "&middot; ");
 			$spanName = $parent_name;
 
-			$plink = $image.setLink($name, $url, $openMethod, $description)."<br />\n";
+			$plink = $image." ".setLink($name, $url, $openMethod, $description)."<br />\n";
 			$text .=($menu_pref['tm_class3'] ? "<span".($menu_pref['tm_class3'] ? " class='{$menu_pref['tm_class3']}'" : "").">".$plink."</span>\n\n" : $plink);
 		}
 		$text .= "</span>\n";
diff -x .svn -ruN 0.7.7.src/e107_plugins/userlanguage_menu/userlanguage_menu.php 0.7.11.src/e107_plugins/userlanguage_menu/userlanguage_menu.php
--- 0.7.7.src/e107_plugins/userlanguage_menu/userlanguage_menu.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_plugins/userlanguage_menu/userlanguage_menu.php	2007-08-31 21:25:11.000000000 -0500
@@ -11,36 +11,52 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/userlanguage_menu/userlanguage_menu.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2007/09/01 02:25:11 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+require_once(e_HANDLER."language_class.php");
+$slng = new language;
 require_once(e_HANDLER."file_class.php");
 	$fl = new e_file;
 	$lanlist = $fl->get_dirs(e_LANGUAGEDIR);
 	sort($lanlist);
 
-	$action = (e_QUERY && !$_GET['elan']) ? e_SELF."?".e_QUERY : e_SELF;
-	$text = "<form method='post' action='".$action."'>
-		<div style='text-align:center'>
-		<select name='sitelanguage' class='tbox' >";
-	foreach($lanlist as $langval)
+	if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'])
 	{
-		$selected ="";
-		if($langval == USERLAN || ($langval == $pref['sitelanguage'] && USERLAN == ""))
+        	$text = "<div style='text-align:center'><select class='tbox' name='lang_select' style='width:95%' onchange=\"location.href=this.options[selectedIndex].value\">";
+			foreach($lanlist as $lng)
+			{
+				$selected = ($lng  == USERLAN || ($lng == $pref['sitelanguage'] && USERLAN == "")) ? "selected='selected'" : "";
+                $urlval = $slng->subdomainUrl($lng);
+				$text .= "<option value='".$urlval."' $selected>$lng</option>\n";
+			}
+			$text .= "</select></div>";
+	}
+	else
+	{
+		$action = (e_QUERY && !$_GET['elan']) ? e_SELF."?".e_QUERY : e_SELF;
+		$text = "<form method='post' action='".$action."'>
+			<div style='text-align:center'>
+			<select name='sitelanguage' class='tbox' >";
+		foreach($lanlist as $langval)
 		{
-			$selected = "selected='selected'";
+			$selected ="";
+			if($langval == USERLAN || ($langval == $pref['sitelanguage'] && USERLAN == ""))
+			{
+				$selected = "selected='selected'";
+			}
+			$text .= "<option value='".$langval."' $selected>".$langval."</option>\n ";
 		}
-		$text .= "<option value='".$langval."' $selected>".$langval."</option>\n ";
-	}
 
-	$text .= "</select>";
-	$text .= "<br /><br /><input class='button' type='submit' name='setlanguage' value='".UTHEME_MENU_L1."' />";
-	$text .= "</div></form>	";
+		$text .= "</select>";
+		$text .= "<br /><br /><input class='button' type='submit' name='setlanguage' value='".UTHEME_MENU_L1."' />";
+		$text .= "</div></form>";
+	}
 
 $ns->tablerender(UTHEME_MENU_L2, $text, 'user_lan');
 
diff -x .svn -ruN 0.7.7.src/e107_themes/crahan/languages/English.php 0.7.11.src/e107_themes/crahan/languages/English.php
--- 0.7.7.src/e107_themes/crahan/languages/English.php	2005-03-21 05:49:22.000000000 -0600
+++ 0.7.11.src/e107_themes/crahan/languages/English.php	2007-03-03 13:59:09.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/crahan/languages/English.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/03/21 11:49:22 $
-|     $Author: stevedunstan $
+|     $Revision: 1.3 $
+|     $Date: 2007/03/03 19:59:09 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,5 +24,4 @@
 define("LAN_THEME_5", "Trackbacks: ");
 define("LAN_THEME_6", "Comment by");
 
-
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/e107v4a/forum_template.php 0.7.11.src/e107_themes/e107v4a/forum_template.php
--- 0.7.7.src/e107_themes/e107v4a/forum_template.php	2006-11-09 12:19:47.000000000 -0600
+++ 0.7.11.src/e107_themes/e107v4a/forum_template.php	2007-07-27 14:08:32.000000000 -0500
@@ -11,17 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/e107v4a/forum_template.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/11/09 18:19:47 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.18 $
+|     $Date: 2007/07/27 19:08:32 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+$sc_style['LASTEDIT']['pre'] = "<br /><br /><span class='smallblacktext'>[ ".LAN_29." ";
+$sc_style['LASTEDIT']['post'] = " ]</span>";
+
 $sc_style['ANON_IP']['pre'] = "<br /><span class='smalltext'>";
 $sc_style['ANON_IP']['post'] = "</span>";
-$location_tpl = (array_key_exists('user_location', $currentUser) ? "{USER_EXTENDED=location.text}: {USER_EXTENDED=location.value}" : "");
+
+$sc_style['USER_EXTENDED']['location.text_value']['mid'] = ": ";
+$sc_style['USER_EXTENDED']['location.text_value']['post'] = "<br />";
 
 $FORUMSTART = "
 <table style='width:100%' class='nforumholder' cellpadding='0' cellspacing='0'>
@@ -70,8 +75,8 @@
 </td>
 </tr>
 <tr>
-<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<div class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{$location_tpl}<br />\n{POSTS}\n</div>\n</td>
-<td class='nforumthread' style='vertical-align:top'>{POLL}\n{POST}\n{SIGNATURE}\n</td>
+<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<div class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{USER_EXTENDED=location.text_value}\n{POSTS}\n</div>\n</td>
+<td class='nforumthread' style='vertical-align:top'>{POLL}\n{POST}\n{LASTEDIT}\n{SIGNATURE}\n</td>
 </tr>
 <tr>
 <td class='nforumthread2'>\n<span class='smallblacktext'>\n{TOP}\n</span>\n</td>
@@ -102,8 +107,8 @@
 </td>
 </tr>
 <tr>
-<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{$location_tpl}<br />\n{POSTS}\n</span>\n</td>
-<td class='nforumthread' style='vertical-align:top'>\n{POST}\n{SIGNATURE}\n</td>
+<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{USER_EXTENDED=location.text_value}\n{POSTS}\n</span>\n</td>
+<td class='nforumthread' style='vertical-align:top'>\n{POST}\n{LASTEDIT}\n{SIGNATURE}\n</td>
 </tr>
 <tr>
 <td class='nforumthread2'>\n<span class='smallblacktext'>\n{TOP}\n</span>\n</td>
@@ -210,8 +215,8 @@
 </td>
 
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'><b>{POSTER}</b><br />{THREADDATE}</span></td>
-<td style='vertical-align:center; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{REPLIES}</span></td>
-<td style='vertical-align:center; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{VIEWS}</span></td>
+<td style='vertical-align:middle; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{REPLIES}</span></td>
+<td style='vertical-align:middle; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{VIEWS}</span></td>
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'>{LASTPOST}</span></td>
 </tr>";
 
@@ -235,13 +240,13 @@
 <div class='spacer'>
 <table style='width:100%' class='nforumholder' cellpadding='0' cellspacing='0'>
 <tr>
-<td style='vertical-align:center; width:50%' class='nforumview3'><span class='smalltext'>{MODERATORS}</span></td>
-<td style='text-align:right; vertical-align:center; width:50%' class='nforumview3'><span class='smalltext'>{BROWSERS}</span></td>
+<td style='vertical-align:middle; width:50%' class='nforumview3'><span class='smalltext'>{MODERATORS}</span></td>
+<td style='text-align:right; vertical-align:middle; width:50%' class='nforumview3'><span class='smalltext'>{BROWSERS}</span></td>
 </tr>
 
 <tr>
-<td style='vertical-align:center; width:50%' class='nforumview4'>{ICONKEY}</td>
-<td style='vertical-align:center; text-align:center; width:50%' class='nforumview4'>{PERMS}<br /><br />{SEARCH}
+<td style='vertical-align:middle; width:50%' class='nforumview4'>{ICONKEY}</td>
+<td style='vertical-align:middle; text-align:center; width:50%' class='nforumview4'>{PERMS}<br /><br />{SEARCH}
 </td>
 </tr>
 </table>
diff -x .svn -ruN 0.7.7.src/e107_themes/e107v4a/languages/English.php 0.7.11.src/e107_themes/e107v4a/languages/English.php
--- 0.7.7.src/e107_themes/e107v4a/languages/English.php	2005-03-21 04:50:01.000000000 -0600
+++ 0.7.11.src/e107_themes/e107v4a/languages/English.php	2007-03-03 13:59:15.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/e107v4a/languages/English.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/03/21 10:50:01 $
-|     $Author: stevedunstan $
+|     $Revision: 1.6 $
+|     $Date: 2007/03/03 19:59:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,4 +24,4 @@
 define("LAN_THEME_5", "on");
 define("LAN_THEME_6", "e107.v4 theme by <a href='http://e107.org' rel='external'>jalist</a>");
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/e107v4a/theme.php 0.7.11.src/e107_themes/e107v4a/theme.php
--- 0.7.7.src/e107_themes/e107v4a/theme.php	2006-07-04 14:09:52.000000000 -0500
+++ 0.7.11.src/e107_themes/e107v4a/theme.php	2007-03-18 06:20:29.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/e107v4a/theme.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/07/04 19:09:52 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2007/03/18 11:20:29 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -85,7 +85,7 @@
 
 {SITEDISCLAIMER}
 <br />
-{THEMEDISCLAIMER}
+{THEME_DISCLAIMER}
 </td>
 </tr>
 </table>
diff -x .svn -ruN 0.7.7.src/e107_themes/human_condition/languages/English.php 0.7.11.src/e107_themes/human_condition/languages/English.php
--- 0.7.7.src/e107_themes/human_condition/languages/English.php	2005-03-21 05:13:49.000000000 -0600
+++ 0.7.11.src/e107_themes/human_condition/languages/English.php	2007-03-03 13:59:20.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/human_condition/languages/English.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/03/21 11:13:49 $
-|     $Author: stevedunstan $
+|     $Revision: 1.2 $
+|     $Date: 2007/03/03 19:59:20 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -25,4 +25,4 @@
 define("LAN_THEME_6", "Comment by");
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/interfectus/languages/English.php 0.7.11.src/e107_themes/interfectus/languages/English.php
--- 0.7.7.src/e107_themes/interfectus/languages/English.php	2005-03-21 05:27:11.000000000 -0600
+++ 0.7.11.src/e107_themes/interfectus/languages/English.php	2007-03-03 13:59:26.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/interfectus/languages/English.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/03/21 11:27:11 $
-|     $Author: stevedunstan $
+|     $Revision: 1.2 $
+|     $Date: 2007/03/03 19:59:26 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,4 +23,4 @@
 define("LAN_THEME_4", "Read the rest ...");
 define("LAN_THEME_5", "Trackbacks: ");
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/interfectus/theme.php 0.7.11.src/e107_themes/interfectus/theme.php
--- 0.7.7.src/e107_themes/interfectus/theme.php	2005-12-29 20:18:44.000000000 -0600
+++ 0.7.11.src/e107_themes/interfectus/theme.php	2007-03-18 06:20:30.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/interfectus/theme.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/12/30 02:18:44 $
-|     $Author: streaky $
+|     $Revision: 1.11 $
+|     $Date: 2007/03/18 11:20:30 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -118,7 +118,7 @@
 </tr>
 </table>
 
-<div class='smalltext' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}</div>
+<div class='smalltext' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}</div>
 
 ";
 
diff -x .svn -ruN 0.7.7.src/e107_themes/jayya/admin_template.php 0.7.11.src/e107_themes/jayya/admin_template.php
--- 0.7.7.src/e107_themes/jayya/admin_template.php	2006-11-14 12:45:22.000000000 -0600
+++ 0.7.11.src/e107_themes/jayya/admin_template.php	2007-08-15 19:00:26.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/admin_template.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/11/14 18:45:22 $
-|     $Author: sweetas $
+|     $Revision: 1.21 $
+|     $Date: 2007/08/16 00:00:26 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -61,51 +61,61 @@
 </table>";
 
 if (ADMIN) {
-	$ADMIN_HEADER .= "{ADMIN_ALT_NAV}";
+    $ADMIN_HEADER .= "{ADMIN_ALT_NAV}";
 } else {
-	if (file_exists(THEME.'admin_nav.js')) {
-		$ADMIN_HEADER .= "<script type='text/javascript' src='".THEME."admin_nav.js'></script>";
-	} else {
-		$ADMIN_HEADER .= "<script type='text/javascript' src='".e_FILE."admin_nav.js'></script>";
-	}
-
-	$ADMIN_HEADER .= "<div style='width: 100%'><table style='width:100%; border-collapse: collapse; border-spacing: 0px;'>
-	<tr><td>
-	<div class='menuBar' style='width:100%;'>
-	&nbsp;
-	</div>
-	</td>
-	</tr>
-	</table></div>";
+    if (file_exists(THEME.'admin_nav.js')) {
+        $ADMIN_HEADER .= "<script type='text/javascript' src='".THEME."admin_nav.js'></script>";
+    } else {
+        $ADMIN_HEADER .= "<script type='text/javascript' src='".e_FILE."admin_nav.js'></script>";
+    }
+
+    $ADMIN_HEADER .= "<div style='width: 100%'><table style='width:100%; border-collapse: collapse; border-spacing: 0px;'>
+    <tr><td>
+    <div class='menuBar' style='width:100%;'>
+    &nbsp;
+    </div>
+    </td>
+    </tr>
+    </table></div>";
 }
 
 $ADMIN_HEADER .= "<table class='main_section'>
-<tr>
-<td class='left_menu'>
-<table style='width:100%; border-collapse: collapse; border-spacing: 0px;'>
-<tr>
-<td>
-{SETSTYLE=leftmenu}
-{ADMIN_LANG}
-{ADMIN_PWORD}
-{ADMIN_MSG}
-{ADMIN_PLUGINS}";
-
-if (!ADMIN) {
-	$style='leftmenu';
-	$ADMIN_HEADER .= $ns -> tablerender('Welcome', '', '', TRUE);
-	$style='default';
-}
-
-if ($prehelp!='') {
-	$ADMIN_HEADER .= $prehelp;
-} else {
-	$ADMIN_HEADER .= "{ADMIN_SITEINFO}";
+<tr>";
+if(ADMIN)
+{
+    $ADMIN_HEADER .= "
+    <td class='left_menu'>
+    <table style='width:100%; border-collapse: collapse; border-spacing: 0px;'>
+    <tr>
+    <td>
+    {SETSTYLE=leftmenu}
+    {ADMIN_LANG}
+    {ADMIN_PWORD}
+    {ADMIN_MSG}
+    {ADMIN_PLUGINS}";
+
+ /* if (!ADMIN)
+    {
+        $style='leftmenu';
+        $ADMIN_HEADER .= $ns -> tablerender('Welcome', '', '', TRUE);
+        $style='default';
+    }*/
+
+    if ($prehelp!='')
+    {
+        $ADMIN_HEADER .= $prehelp;
+    }
+    else
+    {
+        $ADMIN_HEADER .= "{ADMIN_UPDATE} {ADMIN_SITEINFO}";
+    }
+
+
+    $ADMIN_HEADER .= "<br />
+    </td></tr></table>
+    </td>";
 }
-
-$ADMIN_HEADER .= "<br />
-</td></tr></table>
-</td>
+$ADMIN_HEADER .= "
 <td class='default_menu'>
 {SETSTYLE=default}
 ";
@@ -114,16 +124,16 @@
 </td>";
 
 if ($pre_admin_menu || $preright) {
-	$ADMIN_FOOTER .= "<td class='right_menu'>
-	<table style='width:100%; border-collapse: collapse; border-spacing: 0px;'>
-	<tr>
-	<td>
-	{SETSTYLE=rightmenu}
-	{ADMIN_MENU}
-	".$preright."
-	<br />
-	</td></tr></table>
-	</td>";
+    $ADMIN_FOOTER .= "<td class='right_menu'>
+    <table style='width:100%; border-collapse: collapse; border-spacing: 0px;'>
+    <tr>
+    <td>
+    {SETSTYLE=rightmenu}
+    {ADMIN_MENU}
+    ".$preright."
+    <br />
+    </td></tr></table>
+    </td>";
 }
 
 $ADMIN_FOOTER .= "</tr>
@@ -170,4 +180,4 @@
 
 $SUB_BUTTONS_END = "</td></tr></table>";
 
-?>
\ No newline at end of file
+?>
Binary files 0.7.7.src/e107_themes/jayya/forum/closed.png and 0.7.11.src/e107_themes/jayya/forum/closed.png differ
diff -x .svn -ruN 0.7.7.src/e107_themes/jayya/forum/forum_icons_template.php 0.7.11.src/e107_themes/jayya/forum/forum_icons_template.php
--- 0.7.7.src/e107_themes/jayya/forum/forum_icons_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/jayya/forum/forum_icons_template.php	2007-06-06 14:31:50.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/forum/forum_icons_template.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2007/06/06 19:31:50 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 	
@@ -34,7 +34,7 @@
 define("IMAGE_sticky", "<img src='".img_path('sticky.png')."' alt='".FORLAN_15."' title='".FORLAN_15."' style='border:0' />");
 define("IMAGE_stickyclosed", "<img src='".img_path('sticky_closed.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
 define("IMAGE_sticky_small", "<img src='".img_path('sticky.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
-define("IMAGE_stickyclosed_small", "<img src='".img_path('stickyclosed.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
+define("IMAGE_stickyclosed_small", "<img src='".img_path('sticky_closed.png')."' alt='".FORLAN_16."' title='".FORLAN_16."' style='border:0' />");
 define("IMAGE_announce", "<img src='".img_path('announce.png')."' alt='".FORLAN_17."' title='".FORLAN_17."' style='border:0' />");
 define("IMAGE_announce_small", "<img src='".img_path('announce.png')."' alt='".FORLAN_17."' title='".FORLAN_17."' style='border:0' />");
 define("IMAGE_closed_small", "<img src='".img_path('closed_small.png')."' alt='".FORLAN_18."' title='".FORLAN_18."' style='border:0' />");
diff -x .svn -ruN 0.7.7.src/e107_themes/jayya/languages/English.php 0.7.11.src/e107_themes/jayya/languages/English.php
--- 0.7.7.src/e107_themes/jayya/languages/English.php	2006-10-12 08:46:33.000000000 -0500
+++ 0.7.11.src/e107_themes/jayya/languages/English.php	2007-03-03 13:59:31.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/languages/English.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/10/12 13:46:33 $
-|     $Author: lisa_ $
+|     $Revision: 1.4 $
+|     $Date: 2007/03/03 19:59:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,5 +24,4 @@
 define("LAN_THEME_5", "Posted by ");
 define("LAN_THEME_6", "on ");
 
-
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/jayya/theme.php 0.7.11.src/e107_themes/jayya/theme.php
--- 0.7.7.src/e107_themes/jayya/theme.php	2006-11-14 12:45:22.000000000 -0600
+++ 0.7.11.src/e107_themes/jayya/theme.php	2007-06-04 14:42:37.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/theme.php,v $
-|     $Revision: 1.55 $
-|     $Date: 2006/11/14 18:45:22 $
-|     $Author: sweetas $
+|     $Revision: 1.57 $
+|     $Date: 2007/06/04 19:42:37 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -71,11 +71,11 @@
 </div>
 
 <table class='main_section'>
-<tr style='display: none'>
-<td style='width: 170px'></td>
-<td style='width: auto'></td>
-<td style='width: 170px'></td>
-</tr>
+<colgroup>
+<col style='width: 170px' />
+<col style='width: auto' />
+<col style='width: 170px' />
+</colgroup>
 
 <tr>
 <td class='left_menu'>
@@ -213,7 +213,7 @@
 
 // chatbox post style
 $CHATBOXSTYLE = "
-<img src='".e_IMAGE."admin_images/chatbox_16.png' alt='' style='width: 16px; height: 16px; vertical-align: bottom' />
+<img src='".e_IMAGE_ABS."admin_images/chatbox_16.png' alt='' style='width: 16px; height: 16px; vertical-align: bottom' />
 <b>{USERNAME}</b><br />{TIMEDATE}<br />{MESSAGE}<br /><br />";
 
 
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/download_template.php 0.7.11.src/e107_themes/khatru/download_template.php
--- 0.7.7.src/e107_themes/khatru/download_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/khatru/download_template.php	2006-12-01 21:37:12.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/download_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/12/02 03:37:12 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -45,7 +45,7 @@
 $DOWNLOAD_CAT_CHILD_TABLE .= "
 <tr>
 <td class='forumheader3' style='width: 5%;'>{DOWNLOAD_CAT_SUB_ICON}</td>
-<td class='forumheader3' style='width: 75%;'>{DOWNLOAD_CAT_SUB_NAME_LINKED}</td>
+<td class='forumheader3' style='width: 75%;'>{DOWNLOAD_CAT_SUB_NAME}</td>
 <td class='forumheader3' style='width: 20%; text-align: center; vertical-align: middle;'>{DOWNLOAD_CAT_SUB_COUNT} ({DOWNLOAD_CAT_SUB_SIZE})<br /><span class='smalltext'>".LAN_dl_6." {DOWNLOAD_CAT_SUB_DOWNLOADED}</span></td>
 </tr>
 ";
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/forum_post_template.php 0.7.11.src/e107_themes/khatru/forum_post_template.php
--- 0.7.7.src/e107_themes/khatru/forum_post_template.php	2006-10-24 08:36:10.000000000 -0500
+++ 0.7.11.src/e107_themes/khatru/forum_post_template.php	2007-02-20 13:10:41.000000000 -0600
@@ -11,38 +11,54 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_post_template.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/10/24 13:36:10 $
-|     $Author: mrpete $
+|     $Revision: 1.7 $
+|     $Date: 2007/02/20 19:10:41 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 // the user box and subject box are not always displayed, therefore we need to define them /in case/ they are, if not they'll be ignored.
 
+if(!isset($userbox))
+{
 $userbox = "<tr>
 <td class='forumheader2' style='width:20%'>".LAN_61."</td>
 <td class='forumheader2' style='width:80%'>
 <input class='tbox' type='text' name='anonname' size='71' value='".$anonname."' maxlength='20' />
 </td>
 </tr>";
+}
 
+
+if(!isset($subjectbox))
+{
 $subjectbox = "<tr>
 <td class='forumheader2' style='width:20%'>".LAN_62."</td>
 <td class='forumheader2' style='width:80%'>
 <input class='tbox' type='text' name='subject' size='71' value='".$subject."' maxlength='100' />
 </td>
 </tr>";
+}
+
+
 
 // the poll is optional, be careful when changing the values here, only change if you know what you're doing ...
+if(!isset($poll_form))
+{
+	if(is_readable(e_PLUGIN."poll/poll_class.php")) {
+		require_once(e_PLUGIN."poll/poll_class.php");
+		$pollo = new poll;
+		$poll_form = $pollo -> renderPollForm("forum");
+	}
+}
 
-require_once(e_PLUGIN."poll/poll_class.php");
-$pollo = new poll;
-$poll = $pollo -> renderPollForm("forum");
 
 // finally, file attach is optional, again only change this if you know what you're doing ...
-
+if(!isset($fileattach))
+{
 $fileattach = "<tr><td colspan='2' class='nforumcaption2'>".($pref['image_post'] ? LAN_390 : LAN_416)."</td></tr>
 <tr><td style='width:20%' class='forumheader3'>".LAN_392."</td>
 <td style='width:80%' class='forumheader3'>".LAN_393." | ".$allowed_filetypes." |<br />".LAN_394."<br />".LAN_395.": ".($pref['upload_maxfilesize'] ? $pref['upload_maxfilesize'].LAN_396 : ini_get('upload_max_filesize'))."
@@ -56,11 +72,13 @@
 </tr>
 </td>
 </tr>";
-
+}
 
 // ------------
 
 
+if(!isset($FORUMPOST))
+{
 $FORUMPOST = "
 {FORMSTART}
 ".BOXOPEN."{BACKLINK}".BOXMAIN."
@@ -84,31 +102,152 @@
 {FORMEND}
 </div>
 {FORUMJUMP}".BOXCLOSE;
+}
+
 
 
-$FORUMTHREADPOSTED = 
+if(!isset($FORUMPOST_REPLY))
+{
+$FORUMPOST_REPLY = "
+<div style='text-align:center'>
+<div class='spacer'>
+{FORMSTART}
+<table style='".USER_WIDTH."' class='fborder'>
+<tr>
+<td colspan='2' class='fcaption'>{BACKLINK}
+</td>
+</tr>
+{USERBOX}
+{SUBJECTBOX}
+<tr>
+<td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
+<td class='forumheader2' style='width:80%'>
+{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
+</td>
+</tr>
+
+{POLL}
+
+{FILEATTACH}
+
+<tr style='vertical-align:top'>
+<td colspan='2' class='forumheader' style='text-align:center'>
+{BUTTONS}
+</td>
+</tr>
+</table>
+{FORMEND}
+
+<table style='".USER_WIDTH."'>
+<tr>
+<td>
+{FORUMJUMP}
+</td>
+</tr>
+</table>
+</div></div>
+<div style='text-align:center'>
+{THREADTOPIC}
+{LATESTPOSTS}
+</div>
+";
+}
+
+
+if(!isset($LATESTPOSTS_START))
+{
+$LATESTPOSTS_START = "
+<table style='".USER_WIDTH."' class='fborder'>
+<tr>
+<td colspan='2' class='fcaption' style='vertical-align:top'>".
+LAN_101."{LATESTPOSTSCOUNT}".LAN_102."
+</td>
+</tr>";
+}
+
+if(!isset($LATESTPOSTS_POST))
+{
+$LATESTPOSTS_POST = "
+<tr>
+<td class='forumheader3' style='width:20%;vertical-align:top'><b>{POSTER}</b></td>
+<td class='forumheader3' style='width:80%'>
+	<div class='smallblacktext' style='text-align:right'>".IMAGE_post2." ".LAN_322."{THREADDATESTAMP}</div>
+	{POST}
+</td>
+</tr>
+";
+}
+
+if(!isset($LATESTPOSTS_END))
+{
+$LATESTPOSTS_END = "
+</table>
+";
+}
+
+if(!isset($THREADTOPIC_REPLY))
+{
+$THREADTOPIC_REPLY = "
+<table style='".USER_WIDTH."' class='fborder'>
+<tr>
+	<td colspan='2' class='fcaption' style='vertical-align:top'>".LAN_100."</td>
+</tr>
+<tr>
+	<td class='forumheader3' style='width:20%;vertical-align:top'><b>{POSTER}</b></td>
+	<td class='forumheader3' style='width:80%'>
+		<div class='smallblacktext' style='text-align:right'>".IMAGE_post2." ".LAN_322."{THREADDATESTAMP}</div>{POST}
+	</td>
+</tr>
+</table>
+";
+}
+
+
+if (!isset($FORUMTHREADPOSTED))
+{$FORUMTHREADPOSTED = 
 BOXOPEN.LAN_133.BOXMAIN."
 <table style='width:100%'>
 <tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_324."<br />
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id."'>".LAN_325."</a><br />
 <a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
 </td></tr></table>".BOXCLOSE;
+}
 
 
+if (!isset($FORUMREPLYPOSTED))
+{
 $FORUMREPLYPOSTED = 
 BOXOPEN.LAN_133.BOXMAIN."
 <table style='width:100%'>
 <tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_324."<br />
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
 <a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
 </td></tr></table>".BOXCLOSE;
+}
+
+
+$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' {SITENAME_HREF}>{SITENAME}</a>";
+$FORUM_CRUMB['sitename']['sep'] = " :: ";
+
+$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' {FORUMS_HREF}>{FORUMS_TITLE}</a>";
+$FORUM_CRUMB['forums']['sep'] = " :: ";
+
+$FORUM_CRUMB['parent']['value'] = "{PARENT_TITLE}";
+$FORUM_CRUMB['parent']['sep'] = " :: ";
+
+$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' {SUBPARENT_HREF}>{SUBPARENT_TITLE}</a>";
+$FORUM_CRUMB['subparent']['sep'] = " :: ";
+
+$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' {FORUM_HREF}>{FORUM_TITLE}</a>";
+$FORUM_CRUMB['forum']['sep'] = " :: ";
 
+$FORUM_CRUMB['thread']['value'] = "{THREAD_TITLE}";
 
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/forum_posted_template.php 0.7.11.src/e107_themes/khatru/forum_posted_template.php
--- 0.7.7.src/e107_themes/khatru/forum_posted_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/khatru/forum_posted_template.php	2006-12-24 07:51:15.000000000 -0600
@@ -1,58 +1,64 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_posted_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_posted_template.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2006/12/24 13:51:15 $
+|     $Author: mrpete $
++----------------------------------------------------------------------------+
+*/
+
 if (!defined('e107_INIT')) { exit; }
 
-$FORUMPOLLPOSTED =
-BOXOPEN.LAN_133.BOXMAIN."
-<table style='width:100%' class='fborder'>
-<tr>
-<td style='text-align:right; vertical-align:center; width:20%'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%'>
-<br /><b>".LAN_413."</b><br />
-<span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id."'>".LAN_414."</a><br />
-<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
-</td></tr></table>".BOXCLOSE;
-
-$FORUMTHREADPOSTED = 
-BOXOPEN.LAN_133.BOXMAIN."
-<table style='width:100%' class='fborder'>
-<tr>
-<td style='text-align:right; vertical-align:center; width:20%'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%'>
-<br /><b>".LAN_324."</b><br />
-".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
-<span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
-<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
-</td></tr></table>".BOXCLOSE;
-
-
-$FORUMREPLYPOSTED = 
-BOXOPEN.LAN_133.BOXMAIN."
-<table style='width:100%' class='fborder'>
-<tr>
-<td style='text-align:right; vertical-align:center; width:20%'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%'>
-<br /><b>".LAN_415."</b><br />
-".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
-<span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
-<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
-</td></tr></table>".BOXCLOSE;
-
+$FORUMPOLLPOSTED =
+BOXOPEN.LAN_133.BOXMAIN."
+<table style='width:100%' class='fborder'>
+<tr>
+<td style='text-align:right; vertical-align:middle; width:20%'>".IMAGE_e."&nbsp;</td>
+
+<td style='vertical-align:middle; width:80%'>
+
+<br /><b>".LAN_413."</b><br />
+<span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id."'>".LAN_414."</a><br />
+<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
+</td></tr></table>".BOXCLOSE;
+
+$FORUMTHREADPOSTED = 
+BOXOPEN.LAN_133.BOXMAIN."
+<table style='width:100%' class='fborder'>
+<tr>
+<td style='text-align:right; vertical-align:middle; width:20%'>".IMAGE_e."&nbsp;</td>
+
+<td style='vertical-align:middle; width:80%'>
+
+<br /><b>".LAN_324."</b><br />
+".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
+<span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
+<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
+</td></tr></table>".BOXCLOSE;
+
+
+$FORUMREPLYPOSTED = 
+BOXOPEN.LAN_133.BOXMAIN."
+<table style='width:100%' class='fborder'>
+<tr>
+<td style='text-align:right; vertical-align:middle; width:20%'>".IMAGE_e."&nbsp;</td>
+
+<td style='vertical-align:middle; width:80%'>
+
+<br /><b>".LAN_415."</b><br />
+".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
+<span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
+<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
+</td></tr></table>".BOXCLOSE;
+
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/forum_viewforum_template.php 0.7.11.src/e107_themes/khatru/forum_viewforum_template.php
--- 0.7.7.src/e107_themes/khatru/forum_viewforum_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/khatru/forum_viewforum_template.php	2007-11-07 17:01:49.000000000 -0600
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_viewforum_template.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2007/11/07 23:01:49 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$icon = (file_exists(THEME."forum/e.png") ? THEME."forum/e.png" : e_PLUGIN."forum/images/lite/e.png");
+$icon = (file_exists(THEME."forum/e.png") ? THEME_ABS."forum/e.png" : e_PLUGIN."forum/images/lite/e.png");
 
 
 
@@ -28,6 +28,7 @@
 BOXOPEN."{BREADCRUMB}".BOXMAIN."
 
 <table style='width:100%'>
+{SUBFORUMS}
 <tr>
 <td style='width:80%'><div class='newheadline'><img src='".$icon."' style='vertical-align:middle' /> <b>{FORUMTITLE} Forum</b></div>{THREADPAGES}</td>
 <td style='width:20%; text-align:right; vertical-align:bottom;'>
@@ -65,8 +66,8 @@
 </td>
 
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'><b>{POSTER}</b><br />{THREADDATE}</span></td>
-<td style='vertical-align:center; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{REPLIES}</span></td>
-<td style='vertical-align:center; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{VIEWS}</span></td>
+<td style='vertical-align:middle; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{REPLIES}</span></td>
+<td style='vertical-align:middle; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{VIEWS}</span></td>
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'>{LASTPOST}</span></td>
 </tr>";
 
@@ -87,12 +88,12 @@
 
 <table style='width:100%' cellpadding=0 cellspacing=0>
 <tr>
-<td style='vertical-align:center; width:50%'><span class='smalltext'>{MODERATORS}</span></td>
-<td style='text-align:right; vertical-align:center; width:50%'><span class='smalltext'>{BROWSERS}</span></td>
+<td style='vertical-align:middle; width:50%'><span class='smalltext'>{MODERATORS}</span></td>
+<td style='text-align:right; vertical-align:middle; width:50%'><span class='smalltext'>{BROWSERS}</span></td>
 </tr>
 <tr>
-<td style='vertical-align:center; width:50%'>{ICONKEY}</td>
-<td style='vertical-align:center; text-align:center; width:50%'>{PERMS}<br /><br />{SEARCH}
+<td style='vertical-align:middle; width:50%'>{ICONKEY}</td>
+<td style='vertical-align:middle; text-align:center; width:50%'>{PERMS}<br /><br />{SEARCH}
 </td>
 </tr>
 </table>
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/forum_viewtopic_template.php 0.7.11.src/e107_themes/khatru/forum_viewtopic_template.php
--- 0.7.7.src/e107_themes/khatru/forum_viewtopic_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/khatru/forum_viewtopic_template.php	2007-07-27 14:08:32.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_viewtopic_template.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2007/07/27 19:08:32 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,6 +22,9 @@
 $icon = (file_exists(THEME."forum/e.png") ? THEME."forum/e.png" : e_PLUGIN."forum/images/lite/e.png");
 
 
+$sc_style['LASTEDIT']['pre'] = "<br /><br /><span class='smallblacktext'>[ ".LAN_29." ";
+$sc_style['LASTEDIT']['post'] = " ]</span>";
+
 $FORUMSTART =
 BOXOPEN."{BACKLINK}".BOXMAIN."
 
@@ -99,7 +102,7 @@
 </tr>	
 <tr>
 <td class='nforumreply2' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{POSTS}\n</span>\n</td>
-<td class='nforumreply2' style='vertical-align:top'>{POLL}\n{POST}\n{SIGNATURE}\n</td>
+<td class='nforumreply2' style='vertical-align:top'>{POLL}\n{POST}\n{LASTEDIT}\n{SIGNATURE}\n</td>
 </tr>		
 <tr>
 <td class='nforumreplycaption'>\n<span class='smallblacktext'>\n{TOP}\n</span>\n</td>
@@ -132,7 +135,7 @@
 </tr>	
 <tr>
 <td class='nforumreply2' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{POSTS}\n</span>\n</td>
-<td class='nforumreply2' style='vertical-align:top'>{POST}\n{SIGNATURE}</td>
+<td class='nforumreply2' style='vertical-align:top'>{POST}\n{LASTEDIT}\n{SIGNATURE}</td>
 </tr>		
 <tr>
 <td class='nforumreplycaption'>\n<span class='smallblacktext'>\n{TOP}\n</span>\n</td>
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/languages/English.php 0.7.11.src/e107_themes/khatru/languages/English.php
--- 0.7.7.src/e107_themes/khatru/languages/English.php	2005-09-13 02:25:04.000000000 -0500
+++ 0.7.11.src/e107_themes/khatru/languages/English.php	2007-03-03 13:59:37.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/languages/English.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/09/13 07:25:04 $
-|     $Author: stevedunstan $
+|     $Revision: 1.2 $
+|     $Date: 2007/03/03 19:59:37 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,4 +24,4 @@
 define("LAN_THEME_5", "Trackbacks: ");
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/khatru/theme.php 0.7.11.src/e107_themes/khatru/theme.php
--- 0.7.7.src/e107_themes/khatru/theme.php	2006-01-14 19:15:01.000000000 -0600
+++ 0.7.11.src/e107_themes/khatru/theme.php	2007-06-04 14:42:37.000000000 -0500
@@ -119,7 +119,7 @@
 		</div>
 	</div>
 	<div id='footer'>
-		{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}
+		{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}
 		<br />
 		<a href='http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=86'><img alt='e107 recommends Firefox' title='e107 recommends Firefox' src=' http://sfx-images.mozilla.org/affiliates/Buttons/125x50/takebacktheweb_125x50.png' style='border: 0;' /></a>
 	</div>
@@ -193,7 +193,7 @@
 
 $CHATBOXSTYLE = "
 <br />
-<img src='".THEME."images/bullet.png' alt=''  />
+<img src='".THEME_ABS."images/bullet.png' alt=''  />
 <span class='chatb'>{USERNAME}</span>
 <div class='smalltext'>
 {TIMEDATE}<br />
diff -x .svn -ruN 0.7.7.src/e107_themes/kubrick/languages/English.php 0.7.11.src/e107_themes/kubrick/languages/English.php
--- 0.7.7.src/e107_themes/kubrick/languages/English.php	2005-08-29 11:22:56.000000000 -0500
+++ 0.7.11.src/e107_themes/kubrick/languages/English.php	2007-03-03 13:59:43.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/kubrick/languages/English.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/08/29 16:22:56 $
-|     $Author: streaky $
+|     $Revision: 1.4 $
+|     $Date: 2007/03/03 19:59:43 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,4 +24,4 @@
 define("LAN_THEME_5", "Trackbacks: ");
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/kubrick/theme.php 0.7.11.src/e107_themes/kubrick/theme.php
--- 0.7.7.src/e107_themes/kubrick/theme.php	2006-01-26 20:30:59.000000000 -0600
+++ 0.7.11.src/e107_themes/kubrick/theme.php	2007-06-04 14:42:37.000000000 -0500
@@ -10,9 +10,9 @@
 |	Released under the terms and conditions of the
 |	GNU General Public License (http://gnu.org).
 |
-|   $Revision: 1.20 $
-|   $Date: 2006/01/27 02:30:59 $
-|   $Author: qnome $
+|   $Revision: 1.22 $
+|   $Date: 2007/06/04 19:42:37 $
+|   $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
@@ -64,7 +64,7 @@
 <hr />
 <div id='footer'>
 <p>
-{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}
+{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}
 </p>
 </div>
 </div>
@@ -84,7 +84,7 @@
 <hr />
 <div id='footer'>
 <p>
-{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}
+{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}
 </p>
 </div>
 </div>
@@ -140,7 +140,7 @@
 
 
 $CHATBOXSTYLE = "
-<img src='".e_IMAGE."admin_images/chatbox_16.png' alt='' style='vertical-align: middle;' />
+<img src='".e_IMAGE_ABS."admin_images/chatbox_16.png' alt='' style='vertical-align: middle;' />
 <b>{USERNAME}</b>
 <div class='smalltext'>
 {MESSAGE}
diff -x .svn -ruN 0.7.7.src/e107_themes/kubrick/ul.sc 0.7.11.src/e107_themes/kubrick/ul.sc
--- 0.7.7.src/e107_themes/kubrick/ul.sc	2006-01-17 22:16:13.000000000 -0600
+++ 0.7.11.src/e107_themes/kubrick/ul.sc	2007-11-20 15:23:33.000000000 -0600
@@ -1,33 +1,43 @@
-global $sql, $page, $link_class;
-$sql -> db_Select('links', '*', "link_category = 1 and link_name NOT REGEXP('submenu') and link_name NOT REGEXP('child') and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
-$ulmenu = "<ul id='navigation'>";
-$r="1";
-while($row = $sql -> db_Fetch()){
-	if(!$link_class || check_class($link_class) || ($link_class==254 && USER)){
-		if($r <= "8"){
-			extract($row);
-			$ltest = (e_QUERY ? e_PAGE."?".e_QUERY : e_PAGE);
-			$rtest=substr(strrchr($link_url, "/"), 1);
-			if(!preg_match("#(http:|mailto:|ftp:)#",$link_url)){ $link_url = e_BASE.$link_url; }
-			if($ltest == $link_url || $rtest == e_PAGE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
-			switch ($link_open) { 
-				case 1:
-					$link_append = " onclick=\"window.open('$link_url'); return false;\"";
-					break; 
-				case 2:
-				   $link_append = " target=\"_parent\"";
-					break;
-				case 3:
-				   $link_append = " target=\"_top\"";
-					break;
-				default:
-				   unset($link_append);
-			}
-			$ulmenu .= "<li class='nav".$r."$ulclass'><a".($link_description ? " title = '$link_description' " : "")." href='".$link_url."'".$link_append.">".($r !="0" ? "".LINKSTART."" : "" )."$link_name</a></li>";
-		}
-		$r++;
-	}
-}
-$ulmenu .= "</ul>";
-return $ulmenu;
-
+global $sql, $link_class, $page,$tp;
+
+$sql -> db_Select('links', '*', "link_category = 1 and link_parent =0 and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
+//$ulmenu = PRELINK."<ul>";					// Leaf
+$ulmenu = "<ul id='navigation'>";			// Kubrick
+$r='1';		// Needs to be a character - used for access key
+while (($row = $sql -> db_Fetch()) && ($r <= "8"))
+{
+  extract($row);
+  $link_url = $tp->replaceConstants($link_url,TRUE);
+// Check if current page is one of the links - Test from kubrick is better
+  $ltest = (e_QUERY ? e_PAGE."?".e_QUERY : e_PAGE);
+  $rtest=substr(strrchr($link_url, "/"), 1);
+  if (strpos($link_url, '://') === FALSE) { $link_url = e_BASE.$link_url; }
+  if($ltest == $link_url || $rtest == e_PAGE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
+
+  $link_append = '';
+  switch ($link_open) 
+  {
+    case 0:		// Open in same window
+	  break;
+	case 1:		// Simple open in new window
+	  $link_append = " rel='external'";
+	  break;
+	case 4:		// 600 x 400 window
+	  $link_append = " onclick=\"javascript:open_window('{$link_url}',600,400); return false;\"";
+	  break;
+	case 5:		// 800 x 600 window
+	  $link_append = " onclick=\"javascript:open_window('{$link_url}',800,600); return false;\"";
+	  break;
+  }
+   $lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
+  $ulmenu .= "<li class='nav".$r."$ulclass'><a title='".varsettrue($link_description,'add a text description to this link')."' ";
+//  if ($ulclass) $ulmenu .= " class='$ulclass' ";		// Not for kubrick
+  $ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART.$lname."</a></li>";		// For Kubrick
+//  $ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART."$lname".LINKEND."</a></li>";		// For leaf
+
+
+  $r++;
+}
+//$ulmenu .= "</ul>\n".POSTLINK;		// Leaf
+$ulmenu .= "</ul>";						// Kubrick
+return $ulmenu;
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/forum_post_template.php 0.7.11.src/e107_themes/lamb/forum_post_template.php
--- 0.7.7.src/e107_themes/lamb/forum_post_template.php	2006-10-24 08:45:10.000000000 -0500
+++ 0.7.11.src/e107_themes/lamb/forum_post_template.php	2007-02-24 03:41:00.000000000 -0600
@@ -11,38 +11,52 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/forum_post_template.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/10/24 13:45:10 $
-|     $Author: mrpete $
+|     $Revision: 1.15 $
+|     $Date: 2007/02/24 09:41:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 // the user box and subject box are not always displayed, therefore we need to define them /in case/ they are, if not they'll be ignored.
 
+if(!isset($userbox))
+{
 $userbox = "<tr>
 <td class='forumheader2' style='width:20%'>".LAN_61."</td>
 <td class='forumheader2' style='width:80%'>
 <input class='tbox' type='text' name='anonname' size='71' value='".$anonname."' maxlength='20' />
 </td>
 </tr>";
+}
 
+if(!isset($subjectbox))
+{
 $subjectbox = "<tr>
 <td class='forumheader2' style='width:20%'>".LAN_62."</td>
 <td class='forumheader2' style='width:80%'>
 <input class='tbox' type='text' name='subject' size='71' value='".$subject."' maxlength='100' />
 </td>
 </tr>";
+}
+
 
 // the poll is optional, be careful when changing the values here, only change if you know what you're doing ...
+if(!isset($poll_form))
+{
+	if(is_readable(e_PLUGIN."poll/poll_class.php")) {
+		require_once(e_PLUGIN."poll/poll_class.php");
+		$pollo = new poll;
+		$poll_form = $pollo -> renderPollForm("forum");
+	}
+}
 
-require_once(e_PLUGIN."poll/poll_class.php");
-$pollo = new poll;
-$poll = $pollo -> renderPollForm("forum");
 
 // finally, file attach is optional, again only change this if you know what you're doing ...
-
+if(!isset($fileattach))
+{
 $fileattach = "<tr><td colspan='2' class='nforumcaption2'>".($pref['image_post'] ? LAN_390 : LAN_416)."</td></tr>
 <tr><td style='width:20%' class='forumheader3'>".LAN_392."</td>
 <td style='width:80%' class='forumheader3'>".LAN_393." | ".$allowed_filetypes." |<br />".LAN_394."<br />".LAN_395.": ".($pref['upload_maxfilesize'] ? $pref['upload_maxfilesize'].LAN_396 : ini_get('upload_max_filesize'))."
@@ -56,10 +70,12 @@
 </tr>
 </td>
 </tr>";
-
+}
 
 // ------------
 
+if (!isset($FORUMPOST))
+{
 $FORUMPOST = "
 <div style='text-align:center'>
 {FORMSTART}
@@ -89,14 +105,113 @@
 </div>
 {FORUMJUMP}
 ";
+}
+
+
+if(!isset($FORUMPOST_REPLY))
+{
+$FORUMPOST_REPLY = "
+<div style='text-align:center'>
+<div class='spacer'>
+{FORMSTART}
+<table style='".USER_WIDTH."' class='fborder'>
+<tr>
+<td colspan='2' class='nforumcaption'>{BACKLINK}
+</td>
+</tr>
+{USERBOX}
+{SUBJECTBOX}
+<tr>
+<td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
+<td class='forumheader2' style='width:80%'>
+{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
+</td>
+</tr>
+
+{POLL}
+
+{FILEATTACH}
+
+<tr style='vertical-align:top'>
+<td colspan='2' class='forumheader' style='text-align:center'>
+{BUTTONS}
+</td>
+</tr>
+</table>
+{FORMEND}
+
+<table style='".USER_WIDTH."'>
+<tr>
+<td>
+{FORUMJUMP}
+</td>
+</tr>
+</table>
+</div></div>
+<div style='text-align:center'>
+{THREADTOPIC}
+{LATESTPOSTS}
+</div>
+";
+}
+
+// From here copied in from default templates
+if(!$LATESTPOSTS_START)
+{
+$LATESTPOSTS_START = "
+<table style='".USER_WIDTH."' class='fborder'>
+<tr>
+<td colspan='2' class='nforumcaption' style='vertical-align:top'>".
+LAN_101."{LATESTPOSTSCOUNT}".LAN_102."
+</td>
+</tr>";
+}
+
+if(!$LATESTPOSTS_POST)
+{
+$LATESTPOSTS_POST = "
+<tr>
+<td class='forumheader3' style='width:20%;vertical-align:top'><b>{POSTER}</b></td>
+<td class='forumheader3' style='width:80%'>
+	<div class='smallblacktext' style='text-align:right'>".IMAGE_post2." ".LAN_322."{THREADDATESTAMP}</div>
+	{POST}
+</td>
+</tr>
+";
+}
+
+if(!$LATESTPOSTS_END)
+{
+$LATESTPOSTS_END = "
+</table>
+";
+}
+
+if(!$THREADTOPIC_REPLY)
+{
+$THREADTOPIC_REPLY = "
+<table style='".USER_WIDTH."' class='fborder'>
+<tr>
+	<td colspan='2' class='nforumcaption' style='vertical-align:top'>".LAN_100."</td>
+</tr>
+<tr>
+	<td class='forumheader3' style='width:20%;vertical-align:top'><b>{POSTER}</b></td>
+	<td class='forumheader3' style='width:80%'>
+		<div class='smallblacktext' style='text-align:right'>".IMAGE_post2." ".LAN_322."{THREADDATESTAMP}</div>{POST}
+	</td>
+</tr>
+</table>
+";
+}
+
 
 $FORUMTHREADPOSTED = "
 <table style='width:100%' class='fborder'>
 <tr>
 <td class='nforumcaption2' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_324."<br />
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id."'>".LAN_325."</a><br />
 <a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
@@ -108,13 +223,30 @@
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_324."<br />
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
 <a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
 </td></tr></table>";
 
 
+$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' {SITENAME_HREF}>{SITENAME}</a>";
+$FORUM_CRUMB['sitename']['sep'] = " :: ";
+
+$FORUM_CRUMB['forums']['value'] = "<a class='forumlink' {FORUMS_HREF}>{FORUMS_TITLE}</a>";
+$FORUM_CRUMB['forums']['sep'] = " :: ";
+
+$FORUM_CRUMB['parent']['value'] = "{PARENT_TITLE}";
+$FORUM_CRUMB['parent']['sep'] = " :: ";
+
+$FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' {SUBPARENT_HREF}>{SUBPARENT_TITLE}</a>";
+$FORUM_CRUMB['subparent']['sep'] = " :: ";
+
+$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' {FORUM_HREF}>{FORUM_TITLE}</a>";
+$FORUM_CRUMB['forum']['sep'] = " :: ";
+
+$FORUM_CRUMB['thread']['value'] = "{THREAD_TITLE}";
+
 
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/forum_posted_template.php 0.7.11.src/e107_themes/lamb/forum_posted_template.php
--- 0.7.7.src/e107_themes/lamb/forum_posted_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/lamb/forum_posted_template.php	2006-12-24 07:55:37.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/forum_posted_template.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/12/24 13:55:37 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,8 +24,8 @@
 <tr>
 <td class='nforumcaption2' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_413."<br />
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_id."'>".LAN_414."</a><br />
 <a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".LAN_326."</a></span><br /><br />
@@ -36,8 +36,8 @@
 <tr>
 <td class='nforumcaption2' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_324."<br />
 ".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
@@ -50,8 +50,8 @@
 <tr>
 <td class='nforumcaption2' colspan='2'>".LAN_133."</td>
 </tr><tr>
-<td style='text-align:right; vertical-align:center; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
-<td style='vertical-align:center; width:80%' class='forumheader2'>
+<td style='text-align:right; vertical-align:middle; width:20%' class='forumheader2'>".IMAGE_e."&nbsp;</td>
+<td style='vertical-align:middle; width:80%' class='forumheader2'>
 <br />".LAN_415."<br />
 ".(defined("F_MESSAGE") ? F_MESSAGE."<br />" : "")."
 <span class='defaulttext'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last'>".LAN_325."</a><br />
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/forum_template.php 0.7.11.src/e107_themes/lamb/forum_template.php
--- 0.7.7.src/e107_themes/lamb/forum_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/lamb/forum_template.php	2007-05-16 15:24:33.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/forum_template.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2007/05/16 20:24:33 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -29,22 +29,27 @@
 
 $FORUM_MAIN_END = "</table></div>\n<div class='spacer'>\n<table style='width:100%' class='nforumholder' cellspacing='1'>\n<tr>\n<td colspan='2' style='width:60%' class='nforumcaption2'>{INFOTITLE}</td>\n</tr>\n<tr>\n<td rowspan='4' style='width:5%; text-align:center' class='nforumthread'>{LOGO}</td>\n<td style='width:auto' class='nforumthread'>{USERINFO}</td>\n</tr>\n<tr>\n<td style='width:95%' class='nforumthread'>{INFO}</td>\n</tr><tr>\n<td style='width:95%' class='nforumthread'>{FORUMINFO}</td>\n</tr>\n<tr>\n<td style='width:95%' class='nforumthread'>{USERLIST}<br />{STATLINK}</td>\n</tr>\n</table>\n</div>\n<div class='spacer'>\n<table class='fborder' style='width:100%'>\n<tr>\n<td class='nforumthread' style='text-align:center; width:33%'>{ICONKEY}</td>\n<td style='text-align:center; width:33%' class='nforumthread'>{SEARCH}</td>\n<td style='width:33%; text-align:center; vertical-align:middle' class='nforumthread'><span class='smallblacktext'>{PERMS}</span>\n</td>\n</tr>\n</table>\n</div>\n</div>";
 
- if(!$FORUM_NEWPOSTS_START){
+ if(!isset($FORUM_NEWPOSTS_START))
+ {
          $FORUM_NEWPOSTS_START = "<div style='text-align:center'>\n<div class='spacer'>\n<table style='width:95%' class='fborder'>\n<tr>\n<td style='width:3%' class='fcaption'>&nbsp;</td>\n<td style='width:60%' class='fcaption'>{NEWTHREADTITLE}</td>\n<td style='width:27%; text-align:center' class='fcaption'>{POSTEDTITLE}</td>\n</tr>";
  }
 
- if(!$FORUM_NEWPOSTS_MAIN){
-         $FORUM_NEWPOSTS_MAIN .= "<tr>\n<td style='width:3%' class='forumheader3'>{NEWIMAGE}</td>\n<td style='width:60%' class='forumheader3'>{NEWSPOSTNAME}</td>\n<td style='width:27%; text-align:center' class='forumheader3'>{STARTERTITLE}</td>\n</tr>";
+ if(!isset($FORUM_NEWPOSTS_MAIN))
+ {
+         $FORUM_NEWPOSTS_MAIN = "<tr>\n<td style='width:3%' class='forumheader3'>{NEWIMAGE}</td>\n<td style='width:60%' class='forumheader3'>{NEWSPOSTNAME}</td>\n<td style='width:27%; text-align:center' class='forumheader3'>{STARTERTITLE}</td>\n</tr>";
  }
 
- if(!$FORUM_NEWPOSTS_END){
-         $FORUM_NEWPOSTS_END .= "</table></div></div>";
+ if(!isset($FORUM_NEWPOSTS_END))
+ {
+         $FORUM_NEWPOSTS_END = "</table></div></div>";
  }
 
- if(!$FORUM_TRACK_START){
+ if(!isset($FORUM_TRACK_START))
+ {
          $FORUM_TRACK_START = "<div style='text-align:center'>\n<div class='spacer'>\n<table style='width:95%' class='fborder'>\n<tr>\n<td colspan='3' style='width:60%' class='fcaption'>{TRACKTITLE}</td>\n</tr>\n";
 
- if(!$FORUM_TRACK_MAIN){
+ if(!isset($FORUM_TRACK_MAIN))
+ {
          $FORUM_TRACK_MAIN = "<tr>
          <td style='text-align:center; vertical-align:middle; width:6%'  class='forumheader3'>{NEWIMAGE}</td>
                          <td style='vertical-align:middle; text-align:left; width:70%'  class='forumheader3'><span class='mediumtext'>{TRACKPOSTNAME}</span></td>
@@ -53,7 +58,8 @@
                  }
          }
 
- if(!$FORUM_TRACK_END){
+ if(!isset($FORUM_TRACK_END))
+ {
          $FORUM_TRACK_END = "</table>\n</div>\n</div>";
  }
 
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/forum_viewforum_template.php 0.7.11.src/e107_themes/lamb/forum_viewforum_template.php
--- 0.7.7.src/e107_themes/lamb/forum_viewforum_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/lamb/forum_viewforum_template.php	2006-12-24 07:55:37.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/forum_viewforum_template.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/12/24 13:55:37 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -62,8 +62,8 @@
 </td>
 
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'><b>{POSTER}</b><br />{THREADDATE}</span></td>
-<td style='vertical-align:center; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{REPLIES}</span></td>
-<td style='vertical-align:center; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{VIEWS}</span></td>
+<td style='vertical-align:middle; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{REPLIES}</span></td>
+<td style='vertical-align:middle; text-align:center; width:5%' class='nforumview2'><span class='smalltext'>{VIEWS}</span></td>
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'>{LASTPOST}</span></td>
 </tr>";
 
@@ -84,13 +84,13 @@
 <div class='spacer'>
 <table style='width:100%' class='nforumholder' cellpadding=0 cellspacing=0>
 <tr>
-<td style='vertical-align:center; width:50%' class='nforumview3'><span class='smalltext'>{MODERATORS}</span></td>
-<td style='text-align:right; vertical-align:center; width:50%' class='nforumview3'><span class='smalltext'>{BROWSERS}</span></td>
+<td style='vertical-align:middle; width:50%' class='nforumview3'><span class='smalltext'>{MODERATORS}</span></td>
+<td style='text-align:right; vertical-align:middle; width:50%' class='nforumview3'><span class='smalltext'>{BROWSERS}</span></td>
 </tr>
 
 <tr>
-<td style='vertical-align:center; width:50%' class='nforumview4'>{ICONKEY}</td>
-<td style='vertical-align:center; text-align:center; width:50%' class='nforumview4'>{PERMS}<br /><br />{SEARCH}
+<td style='vertical-align:middle; width:50%' class='nforumview4'>{ICONKEY}</td>
+<td style='vertical-align:middle; text-align:center; width:50%' class='nforumview4'>{PERMS}<br /><br />{SEARCH}
 </td>
 </tr>
 </table>
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/forum_viewtopic_template.php 0.7.11.src/e107_themes/lamb/forum_viewtopic_template.php
--- 0.7.7.src/e107_themes/lamb/forum_viewtopic_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.11.src/e107_themes/lamb/forum_viewtopic_template.php	2007-07-27 14:08:33.000000000 -0500
@@ -11,14 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/forum_viewtopic_template.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.14 $
+|     $Date: 2007/07/27 19:08:33 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+$sc_style['LASTEDIT']['pre'] = "<br /><br /><span class='smallblacktext'>[ ".LAN_29." ";
+$sc_style['LASTEDIT']['post'] = " ]</span>";
+
 $icon = (file_exists(THEME."forum/e.png") ? THEME."forum/e.png" : e_PLUGIN."forum/images/lite/e.png");
 
 $FORUMSTART = "
@@ -68,7 +71,7 @@
 </tr>	
 <tr>
 <td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{POSTS}\n</span>\n</td>
-<td class='nforumthread' style='vertical-align:top'>{POLL}\n{POST}\n{SIGNATURE}\n</td>
+<td class='nforumthread' style='vertical-align:top'>{POLL}\n{POST}\n{LASTEDIT}\n{SIGNATURE}\n</td>
 </tr>		
 <tr>
 <td class='nforumthread2'>\n<span class='smallblacktext'>\n{TOP}\n</span>\n</td>
@@ -125,7 +128,7 @@
 </tr>	
 <tr>
 <td class='nforumreply' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{POSTS}\n</span>\n</td>
-<td class='nforumreply' style='vertical-align:top'>{POST}\n{SIGNATURE}</td>
+<td class='nforumreply' style='vertical-align:top'>{POST}\n{LASTEDIT}\n{SIGNATURE}</td>
 </tr>		
 <tr>
 <td class='nforumreply2'>\n<span class='smallblacktext'>\n{TOP}\n</span>\n</td>
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/languages/English.php 0.7.11.src/e107_themes/lamb/languages/English.php
--- 0.7.7.src/e107_themes/lamb/languages/English.php	2005-09-12 18:50:17.000000000 -0500
+++ 0.7.11.src/e107_themes/lamb/languages/English.php	2007-03-03 13:59:49.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/languages/English.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/09/12 23:50:17 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.4 $
+|     $Date: 2007/03/03 19:59:49 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,4 +24,4 @@
 define("LAN_THEME_5", "Trackbacks: ");
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/lamb/theme.php 0.7.11.src/e107_themes/lamb/theme.php
--- 0.7.7.src/e107_themes/lamb/theme.php	2006-04-18 02:38:02.000000000 -0500
+++ 0.7.11.src/e107_themes/lamb/theme.php	2007-06-04 14:42:37.000000000 -0500
@@ -37,7 +37,7 @@
 $layout = "_default";
 
 $HEADER = "<div id='header'>
-<img src='".THEME."images/logo.png' style='width: 168px; height: 80px; display: block' alt='' />
+<img src='".THEME_ABS."images/logo.png' style='width: 168px; height: 80px; display: block' alt='' />
 </div>
 <div id='banner'>
 {BANNER}
@@ -71,7 +71,7 @@
 <div id='footer'>
 <div class='columnwrap'>
 <div style='text-align: center;' class='smalltext'>
-{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}
+{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}
 <br />
 <img src='".e_IMAGE_ABS."generic/php-small-trans-light.gif' alt='' /> <img src='".e_IMAGE_ABS."button.png' alt='' /> 
 <img src='".e_IMAGE_ABS."generic/poweredbymysql-88.png' alt=''  /> &nbsp;&nbsp;&nbsp;&nbsp;
@@ -99,7 +99,7 @@
 on
 {NEWSDATE}
 <br />
-<img src='".e_IMAGE."admin_images/userclass_16.png' alt='' style='vertical-align: middle;' />
+<img src='".e_IMAGE_ABS."admin_images/userclass_16.png' alt='' style='vertical-align: middle;' />
 {NEWSCOMMENTS}{TRACKBACK}
 </div>
 <br />";
diff -x .svn -ruN 0.7.7.src/e107_themes/leaf/languages/English.php 0.7.11.src/e107_themes/leaf/languages/English.php
--- 0.7.7.src/e107_themes/leaf/languages/English.php	2006-11-29 00:17:57.000000000 -0600
+++ 0.7.11.src/e107_themes/leaf/languages/English.php	2007-03-03 13:59:56.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/leaf/languages/English.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/11/29 06:17:57 $
-|     $Author: e107coders $
+|     $Revision: 1.3 $
+|     $Date: 2007/03/03 19:59:56 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,4 +27,4 @@
 
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/leaf/theme.php 0.7.11.src/e107_themes/leaf/theme.php
--- 0.7.7.src/e107_themes/leaf/theme.php	2006-11-29 00:17:57.000000000 -0600
+++ 0.7.11.src/e107_themes/leaf/theme.php	2007-05-28 11:52:49.000000000 -0500
@@ -11,9 +11,9 @@
 |	GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/leaf/theme.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/11/29 06:17:57 $
-|     $Author: e107coders $
+|     $Revision: 1.19 $
+|     $Date: 2007/05/28 16:52:49 $
+|     $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
@@ -61,16 +61,16 @@
 // [header function]
 function theme_head() {
 	global $logo, $colorstyle;
-	return "<link rel='alternate stylesheet' type='text/css' href='".THEME."style.css' title='Small' />
-	<link rel='alternate stylesheet' type='text/css' href='".THEME."fontstyles/medium.css' title='Medium' />
-	<link rel='alternate stylesheet' type='text/css' href='".THEME."fontstyles/large.css' title='Large' />
+	return "<link rel='alternate stylesheet' type='text/css' href='".THEME_ABS."style.css' title='Small' />
+	<link rel='alternate stylesheet' type='text/css' href='".THEME_ABS."fontstyles/medium.css' title='Medium' />
+	<link rel='alternate stylesheet' type='text/css' href='".THEME_ABS."fontstyles/large.css' title='Large' />
 	<style type='text/css'>
 	#header{
 		position: relative;
 		width: 700px;
 		height: 151px;
 		margin: auto;
-		background: url(".THEME."images/01_header0".$logo.".jpg) no-repeat;
+		background: url(".THEME_ABS."images/01_header0".$logo.".jpg) no-repeat;
 	}
 	/* Sidbar menu content styles */
 	.loginform, .searchform, .chatboxform, .onlineform{
@@ -256,4 +256,4 @@
 // [chatboxstyle]
 $CHATBOXSTYLE = "";
 
-?>
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/leaf/ul.sc 0.7.11.src/e107_themes/leaf/ul.sc
--- 0.7.7.src/e107_themes/leaf/ul.sc	2006-07-10 00:07:29.000000000 -0500
+++ 0.7.11.src/e107_themes/leaf/ul.sc	2007-11-20 15:23:33.000000000 -0600
@@ -1,34 +1,43 @@
 global $sql, $link_class, $page,$tp;
 
 $sql -> db_Select('links', '*', "link_category = 1 and link_parent =0 and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
-$ulmenu = PRELINK."<ul>";
-$r="1";
-while($row = $sql -> db_Fetch()){
-		if($r <= "8"){
-			extract($row);
-			$link_url = $tp->replaceConstants($link_url,TRUE);
-			if(!preg_match("#(http:|mailto:|ftp:|https:)#",$link_url)){
-				$link_url = e_HTTP.$link_url;
-			}
-			if(strpos($link_url, e_PAGE) !== FALSE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
-			switch ($link_open) {
-				case 1:
-					$link_append = " onclick=\"window.open('$link_url'); return false;\"";
-					break;
-				case 2:
-				   $link_append = " target=\"_parent\"";
-					break;
-				case 3:
-				   $link_append = " target=\"_top\"";
-					break;
-				default:
-				unset($link_append);
-			}
- 			$lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
-			$ulmenu .= "<li class='nav".$r."$ulclass'><a class='$ulclass' ".($link_description ? " title = '$link_description' " : "title = 'add a text description to this link' ")." href='".$link_url."' accesskey='".$r."' ".$link_append.">".LINKSTART."$lname".LINKEND."</a></li>";
-		}
-		$r++;
+$ulmenu = PRELINK."<ul>";					// Leaf
+//$ulmenu = "<ul id='navigation'>";			// Kubrick
+$r='1';		// Needs to be a character - used for access key
+while (($row = $sql -> db_Fetch()) && ($r <= "8"))
+{
+  extract($row);
+  $link_url = $tp->replaceConstants($link_url,TRUE);
+// Check if current page is one of the links - Test from kubrick is better
+  $ltest = (e_QUERY ? e_PAGE."?".e_QUERY : e_PAGE);
+  $rtest=substr(strrchr($link_url, "/"), 1);
+  if (strpos($link_url, '://') === FALSE) { $link_url = e_BASE.$link_url; }
+  if($ltest == $link_url || $rtest == e_PAGE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
 
+  $link_append = '';
+  switch ($link_open) 
+  {
+    case 0:		// Open in same window
+	  break;
+	case 1:		// Simple open in new window
+	  $link_append = " rel='external'";
+	  break;
+	case 4:		// 600 x 400 window
+	  $link_append = " onclick=\"javascript:open_window('{$link_url}',600,400); return false;\"";
+	  break;
+	case 5:		// 800 x 600 window
+	  $link_append = " onclick=\"javascript:open_window('{$link_url}',800,600); return false;\"";
+	  break;
+  }
+   $lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
+  $ulmenu .= "<li class='nav".$r."$ulclass'><a title='".varsettrue($link_description,'add a text description to this link')."' ";
+  if ($ulclass) $ulmenu .= " class='$ulclass' ";		// Not for kubrick
+//  $ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART.$lname."</a></li>";		// For Kubrick
+  $ulmenu .= " href='{$link_url}'".$link_append." accesskey='".$r."' >".LINKSTART."$lname".LINKEND."</a></li>";		// For leaf
+
+
+  $r++;
 }
-$ulmenu .= "</ul>\n".POSTLINK;
+$ulmenu .= "</ul>\n".POSTLINK;		// Leaf
+//$ulmenu .= "</ul>";						// Kubrick
 return $ulmenu;
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/newsroom/languages/English.php 0.7.11.src/e107_themes/newsroom/languages/English.php
--- 0.7.7.src/e107_themes/newsroom/languages/English.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.11.src/e107_themes/newsroom/languages/English.php	2006-12-02 18:43:05.000000000 -0600
@@ -0,0 +1,24 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_themes/newsroom/languages/English.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/12/03 00:43:05 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
+
+define("LAN_THEME_1", "Comments");
+define("LAN_THEME_2", "Comments off");
+define("LAN_THEME_3", "FULL STORY");
+define("LAN_THEME_4", "Posted on");
+?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/newsroom/theme.php 0.7.11.src/e107_themes/newsroom/theme.php
--- 0.7.7.src/e107_themes/newsroom/theme.php	2006-10-25 20:53:20.000000000 -0500
+++ 0.7.11.src/e107_themes/newsroom/theme.php	2006-12-24 07:54:59.000000000 -0600
@@ -2,6 +2,7 @@
 
 if (!defined('e107_INIT')) { exit; }
 
+include_lan(THEME."languages/".e_LANGUAGE.".php");
 $themename = "newsroom";
 $themeversion = "1.02";
 $themeauthor = "CaMer0n";
@@ -181,14 +182,14 @@
 	</table>
 	<table style='width:100%;border:0px' cellpadding='0' cellspacing='0' >
 	<tr>
-	<td style='padding:3px'>Posted on
+	<td style='padding:3px'>".LAN_THEME_4."
 	{NEWSDATE}
 	 |
 	{EMAILICON}
 	{PRINTICON}
 	{PDFICON}
-	{ADMINOPTIONS}
-
+	{ADMINOPTIONS}<br />	
+	{NEWSCOMMENTS}
 	</td>
 	</tr>
 	</table><br /></div>
@@ -214,7 +215,7 @@
 
 $NEWSCAT = "\n\n\n\n<!-- News Category -->\n\n\n\n
 	<div style='padding:2px;padding-bottom:12px'>
-	<div class='leftcap' style='vertical-align:center'>
+	<div class='leftcap' style='vertical-align:middle'>
 	{NEWSCATICON}
 	&nbsp;<span style='vertical-align:top;margin-top:3px'>
 	{NEWSCATEGORY}
@@ -265,10 +266,10 @@
 
 // [News]
 define("ICONSTYLE", "float: left; border:0");
-define("COMMENTLINK", "Comments");
-define("COMMENTOFFSTRING", "Comments Off");
+define("COMMENTLINK", LAN_THEME_1.": ");
+define("COMMENTOFFSTRING", LAN_THEME_2);
 define("PRE_EXTENDEDSTRING", "<span style='font-size:13px'> ");
-define("EXTENDEDSTRING", "<br /><br /><b>FULL STORY</b>");
+define("EXTENDEDSTRING", "<br /><br /><b>".LAN_THEME_3."</b>");
 define("POST_EXTENDEDSTRING", "</span><br />");
 define("ICONMAIL", "iconmail.png"); // Usable since e107v615
 define("ICONPRINT", "iconprint.png"); // Usable since e107v615
diff -x .svn -ruN 0.7.7.src/e107_themes/reline/theme.php 0.7.11.src/e107_themes/reline/theme.php
--- 0.7.7.src/e107_themes/reline/theme.php	2006-11-21 13:30:27.000000000 -0600
+++ 0.7.11.src/e107_themes/reline/theme.php	2007-06-04 14:42:37.000000000 -0500
@@ -11,9 +11,9 @@
 |	GNU General Public License (http://gnu.org).
 |
 |	$Source: /cvsroot/e107/e107_0.7/e107_themes/reline/theme.php,v $
-|	$Revision: 1.18 $
-|	$Date: 2006/11/21 19:30:27 $
-|	$Author: lisa_ $
+|	$Revision: 1.19 $
+|	$Date: 2007/06/04 19:42:37 $
+|	$Author: e107steved $
 |
 +----------------------------------------------------------------------------+
 |	Photo Credits
@@ -120,7 +120,7 @@
 $HEADER = "<table class='container'>
 <tr>
 <td>
-<img class='advanced_image' src='".e_IMAGE."advanced.png' alt='' />
+<img class='advanced_image' src='".e_IMAGE_ABS."advanced.png' alt='' />
 </td>
 
 <td class='top_section'>
@@ -357,7 +357,7 @@
 
 
 // Chatbox post style
-$CHATBOXSTYLE = "<br /><img src='".e_IMAGE."admin_images/chatbox_16.png' alt='' style='width: 16px; height: 16px; vertical-align: bottom' />
+$CHATBOXSTYLE = "<br /><img src='".e_IMAGE_ABS."admin_images/chatbox_16.png' alt='' style='width: 16px; height: 16px; vertical-align: bottom' />
 <b>{USERNAME}</b><br />{TIMEDATE}<br />{MESSAGE}<br />";
 
 
diff -x .svn -ruN 0.7.7.src/e107_themes/sebes/theme.php 0.7.11.src/e107_themes/sebes/theme.php
--- 0.7.7.src/e107_themes/sebes/theme.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.11.src/e107_themes/sebes/theme.php	2007-03-18 06:20:30.000000000 -0500
@@ -75,7 +75,7 @@
 </table>
 </div>
 
-<div class='smalltext' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}</div>
+<div class='smalltext' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}</div>
 
 ";
 
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/admin_template.php 0.7.11.src/e107_themes/templates/admin_template.php
--- 0.7.7.src/e107_themes/templates/admin_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.11.src/e107_themes/templates/admin_template.php	2006-12-19 08:20:09.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/admin_template.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
+|     $Revision: 1.15 $
+|     $Date: 2006/12/19 14:20:09 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -46,6 +46,7 @@
 <td style='width:17%; vertical-align:top'>
 {ADMIN_MENU}
 {ADMIN_PRESET}
+{ADMIN_UPDATE}
 {ADMIN_SITEINFO}
 {ADMIN_DOCS}
 </td>
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/banner_template.php 0.7.11.src/e107_themes/templates/banner_template.php
--- 0.7.7.src/e107_themes/templates/banner_template.php	2006-07-16 14:56:47.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/banner_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -1,10 +1,12 @@
 <?php
+// $Id: banner_template.php,v 1.6 2007/12/06 21:36:02 e107steved Exp $
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:98%"); }
 
 // ##### LOGIN TABLE -------------------------------------------------------------------------------
-if(!$BANNER_LOGIN_TABLE){
+if(!isset($BANNER_LOGIN_TABLE))
+{
 		$BANNER_LOGIN_TABLE = "
 		<div style='align:center'>\n
 		<form method='post' action='".e_SELF."'>\n
@@ -29,7 +31,8 @@
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### BANNER TABLE -----------------------------------------------------------------------------
-if(!$BANNER_TABLE_START){
+if(!isset($BANNER_TABLE_START))
+{
 		$BANNER_TABLE_START = "
 		<table class='fborder' style='".USER_WIDTH."; border:1px solid #000' border='1'>
 		<tr><td colspan='7' style='text-align:center' class='fcaption'>".BANNERLAN_21."</td></tr>
@@ -43,7 +46,8 @@
 			<td class='forumheader' style='text-align:center'>".BANNERLAN_28."</td>
 		</tr>";
 }
-if(!$BANNER_TABLE){
+if(!isset($BANNER_TABLE))
+{
 		$BANNER_TABLE = "
 		<tr>
 			<td class='forumheader3' style='text-align:center'>{BANNER_TABLE_CLIENTNAME}</td>
@@ -71,21 +75,25 @@
 		</tr>
 		<tr><td colspan='7'>&nbsp;</td></tr>";
 }
-if(!$BANNER_TABLE_END){
+if(!isset($BANNER_TABLE_END))
+{
 		$BANNER_TABLE_END = "
 		</table>";
 }
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### BANNER MENU -----------------------------------------------------------------------------
-if(!isset($BANNER_MENU_START)){
-	$BANNER_MENU_START = "<div style='text-align:center;'>";
-}
-if(!isset($BANNER_MENU)){
-	$BANNER_MENU = "{BANNER}<br /><br />";
-}
-if(!isset($BANNER_MENU_END)){
-	$BANNER_MENU_END = "</div>";
+if(!isset($BANNER_MENU_START))
+{
+  $BANNER_MENU_START = "<div style='text-align:center;'>";
+}
+if(!isset($BANNER_MENU))
+{
+  $BANNER_MENU = "{BANNER}<br /><br />";
+}
+if(!isset($BANNER_MENU_END))
+{
+  $BANNER_MENU_END = "</div>";
 }
 // ##### ------------------------------------------------------------------------------------------
 
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/bbcode_template.php 0.7.11.src/e107_themes/templates/bbcode_template.php
--- 0.7.7.src/e107_themes/templates/bbcode_template.php	2006-07-20 15:44:49.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/bbcode_template.php	2007-10-26 06:44:01.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/bbcode_template.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/07/20 20:44:49 $
+|     $Revision: 1.12 $
+|     $Date: 2007/10/26 11:44:01 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -32,6 +32,11 @@
 // $sc_style['BB_HELP']['pre'] = "<div style='text-align:center'>";
 // $sc_style['BB_HELP']['post'] = "</div>";
 
+$BBCODE_TEMPLATE_SUBMITNEWS = "
+	{BB_HELP}<br />
+    {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}{BB=right}
+	{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=flash}
+";
 
 
 // --------   Admin Templates ----------------------
@@ -57,7 +62,7 @@
 $BBCODE_TEMPLATE_CPAGE = "
 	{BB_HELP}<br />
 	{BB=newpage}
-	{BB=links}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}{BB=right}
+	{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=center}{BB=left}{BB=right}
 	{BB=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
 	{BB_PREIMAGEDIR=".e_IMAGE."custom/}
 	{BB=preimage}{BB=prefile}{BB=flash}
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/contact_template.php 0.7.11.src/e107_themes/templates/contact_template.php
--- 0.7.7.src/e107_themes/templates/contact_template.php	2006-11-09 13:57:47.000000000 -0600
+++ 0.7.11.src/e107_themes/templates/contact_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -1,10 +1,11 @@
 <?php
-// $Id: contact_template.php,v 1.7 2006/11/09 19:57:47 e107coders Exp $
+// $Id: contact_template.php,v 1.9 2007/12/06 21:36:02 e107steved Exp $
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
 
-if(!$CONTACT_INFO){
+if(!isset($CONTACT_INFO))
+{
   $CONTACT_INFO = "
 	<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
 	<tr>
@@ -21,9 +22,6 @@
 $sc_style['CONTACT_PERSON']['pre'] = "<tr><td>".LANCONTACT_14."<br />   ";
 $sc_style['CONTACT_PERSON']['post'] = "</td></tr>";
 
-$sc_style['CONTACT_IMAGECODE']['pre'] = "<tr><td>".LANCONTACT_14."</td><td>";
-$sc_style['CONTACT_IMAGECODE']['post'] = "</td>";
-
 $sc_style['CONTACT_IMAGECODE']['pre'] = "<tr><td>".LANCONTACT_16."<br />";
 $sc_style['CONTACT_IMAGECODE']['post'] = "";
 
@@ -31,7 +29,8 @@
 $sc_style['CONTACT_IMAGECODE_INPUT']['post'] = "</td></tr>";
 
 
-if(!$CONTACT_FORM){
+if(!isset($CONTACT_FORM))
+{
   $CONTACT_FORM = "
 	<form action='".e_SELF."' method='post' id='contactForm' >
 	<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/download_template.php 0.7.11.src/e107_themes/templates/download_template.php
--- 0.7.7.src/e107_themes/templates/download_template.php	2006-07-16 14:56:47.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/download_template.php	2007-09-20 06:08:14.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/download_template.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/07/16 19:56:47 $
+|     $Revision: 1.18 $
+|     $Date: 2007/09/20 11:08:14 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -24,7 +24,8 @@
 define("DL_IMAGESTYLE","border:0px");
 
 // ##### CAT TABLE --------------------------------------------------------------------------------
-if(!$DOWNLOAD_CAT_TABLE_START){
+if(!isset($DOWNLOAD_CAT_TABLE_START))
+{
                 $DOWNLOAD_CAT_TABLE_START = "
                 <div style='text-align:center'>
                 <table class='fborder' style='".USER_WIDTH."'>\n
@@ -33,12 +34,12 @@
                 <td style='width:60%; text-align:center' class='fcaption'>".LAN_dl_19."</td>
                 <td style='width:10%; text-align:center' class='fcaption'>".LAN_dl_20."</td>
                 <td style='width:17%; text-align:center' class='fcaption'>".LAN_dl_21."</td>
-                <td style='width:10%; text-align:center' class='fcaption'>".LAN_dl_18."</td>
+                <td style='width:10%; text-align:center' class='fcaption'>".LAN_dl_77."</td>
                 </tr>";
 }
-if(!$DOWNLOAD_CAT_PARENT_TABLE){
-
-                $DOWNLOAD_CAT_PARENT_TABLE .= "
+if(!isset($DOWNLOAD_CAT_PARENT_TABLE))
+{
+                $DOWNLOAD_CAT_PARENT_TABLE = "
                 <tr>
                 <td colspan='5' class='forumheader' style='text-align:left; font-weight:bold;'>
                         {DOWNLOAD_CAT_MAIN_ICON} {DOWNLOAD_CAT_MAIN_NAME}
@@ -46,9 +47,9 @@
                 </tr>";
 }
 
-if(!$DOWNLOAD_CAT_CHILD_TABLE){
-
-                $DOWNLOAD_CAT_CHILD_TABLE .= "
+if(!isset($DOWNLOAD_CAT_CHILD_TABLE))
+{
+                $DOWNLOAD_CAT_CHILD_TABLE = "
                 <tr>
                 <td class='forumheader3'>
                         {DOWNLOAD_CAT_SUB_ICON}
@@ -74,10 +75,9 @@
 
 }
 
-if(!$DOWNLOAD_CAT_SUBSUB_TABLE)
+if(!isset($DOWNLOAD_CAT_SUBSUB_TABLE))
 {
-
-	$DOWNLOAD_CAT_SUBSUB_TABLE .= "
+	$DOWNLOAD_CAT_SUBSUB_TABLE = "
 	<tr>
 	<td class='forumheader3'>
 		&nbsp;
@@ -113,7 +113,8 @@
 	</tr>";
 }
 
-if(!$DOWNLOAD_CAT_TABLE_END){
+if(!isset($DOWNLOAD_CAT_TABLE_END))
+{
                 $DOWNLOAD_CAT_TABLE_END = "
                 <tr><td class='forumheader3' colspan='5' style='text-align:right;'>{DOWNLOAD_CAT_NEWDOWNLOAD_TEXT}</td></tr>
                 <tr><td class='forumheader3' colspan='5' style='text-align:right;'>{DOWNLOAD_CAT_SEARCH}</td></tr>
@@ -125,8 +126,8 @@
 
 
 // ##### LIST TABLE -------------------------------------------------------------------------------
-if(!$DOWNLOAD_LIST_TABLE_START){
-
+if(!isset($DOWNLOAD_LIST_TABLE_START))
+{
                 $DOWNLOAD_LIST_TABLE_START = "
                 <div style='text-align:center'>
                 <form method='post' action='".e_SELF."?".e_QUERY."'>
@@ -145,7 +146,7 @@
                         <span class='defaulttext'>".LAN_dl_38."</span>
                         <select name='order' class='tbox'>".
                         ($order == "download_datestamp" ? "<option value='download_datestamp' selected='selected'>".LAN_dl_22."</option>" : "<option value='download_datestamp'>".LAN_dl_22."</option>").
-                        ($order == "download_requested" ? "<option value='download_requested' selected='selected'>".LAN_dl_18."</option>" : "<option value='download_requested'>".LAN_dl_18."</option>").
+                        ($order == "download_requested" ? "<option value='download_requested' selected='selected'>".LAN_dl_18."</option>" : "<option value='download_requested'>".LAN_dl_77."</option>").
                         ($order == "download_name" ? "<option value='download_name' selected='selected'>".LAN_dl_23."</option>" : "<option value='download_name'>".LAN_dl_23."</option>").
                         ($order == "download_author" ? "<option value='download_author' selected='selected'>".LAN_dl_24."</option>" : "<option value='download_author'>".LAN_dl_24."</option>")."
                         </select>
@@ -171,8 +172,9 @@
 
 }
 
-if(!$DOWNLOAD_LIST_TABLE){
-		$DOWNLOAD_LIST_TABLE .= "
+if(!isset($DOWNLOAD_LIST_TABLE))
+{
+		$DOWNLOAD_LIST_TABLE = "
 		<tr>
 		<td class='forumheader3' style='text-align:left;'>
 		{DOWNLOAD_LIST_NEWICON} {DOWNLOAD_LIST_NAME}
@@ -198,7 +200,8 @@
 		</tr>";
 }
 
-if(!$DOWNLOAD_LIST_TABLE_END){
+if(!isset($DOWNLOAD_LIST_TABLE_END))
+{
 		$DOWNLOAD_LIST_TABLE_END = "
 		<tr><td class='forumheader3' colspan='7' style='text-align:right;'>{DOWNLOAD_LIST_TOTAL_AMOUNT} {DOWNLOAD_LIST_TOTAL_FILES}</td></tr>
 		</table>
@@ -213,6 +216,8 @@
 $DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
 $DL_VIEW_CAPTION = "{DOWNLOAD_VIEW_CAPTION}";
 
+if(!isset($DL_VIEW_NEXTPREV))
+{
 		$DL_VIEW_NEXTPREV = "
 		<div style='text-align:center'>
 			<table style='".USER_WIDTH."'>
@@ -223,6 +228,7 @@
 			</tr>
 			</table>
 		</div>\n";
+}
 
 // Only renders the following rows when data is present.
 $sc_style['DOWNLOAD_VIEW_AUTHOR_LAN']['pre'] = "<tr><td style='width:20%' class='forumheader3'>";
@@ -243,8 +249,9 @@
 $sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE']['pre'] = "<td style='width:80%' class='forumheader3'>";
 $sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE']['post'] = "</td></tr>";
 
-if(!$DOWNLOAD_VIEW_TABLE){
-		$DOWNLOAD_VIEW_TABLE .= "
+if(!isset($DOWNLOAD_VIEW_TABLE))
+{
+		$DOWNLOAD_VIEW_TABLE = "
         <div style='text-align:center'>
 		<table class='fborder' style='".USER_WIDTH."'>\n
 		<tr>
@@ -309,7 +316,7 @@
 
 // ##### MIRROR LIST -------------------------------------------------------------------------------
 
-if(!$DOWNLOAD_MIRROR_START)
+if(!isset($DOWNLOAD_MIRROR_START))
 {
 	$DOWNLOAD_MIRROR_START = "
 	<div style='text-align:center'>
@@ -326,7 +333,7 @@
 	";
 }
 
-if(!$DOWNLOAD_MIRROR)
+if(!isset($DOWNLOAD_MIRROR))
 {
 	$DOWNLOAD_MIRROR = "
 	<tr>
@@ -338,7 +345,7 @@
 	";
 }
 
-if(!$DOWNLOAD_MIRROR_END)
+if(!isset($DOWNLOAD_MIRROR_END))
 {
 	$DOWNLOAD_MIRROR_END = "
 	</table>
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/email_template.php 0.7.11.src/e107_themes/templates/email_template.php
--- 0.7.7.src/e107_themes/templates/email_template.php	2006-07-12 03:15:58.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/email_template.php	2007-11-11 15:52:49.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/email_template.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/07/12 08:15:58 $
-|     $Author: e107coders $
+|     $Revision: 1.10 $
+|     $Date: 2007/11/11 21:52:49 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -59,6 +59,8 @@
 <br />
 {ACTIVATION_LINK}<br />
 <br />
+".LAN_SIGNUP_59."<br />
+<br />
 ".LAN_SIGNUP_18."...<br />
 <br />
 ".LAN_LOGINNAME.": <b> {LOGINNAME} </b><br />
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/footer_default.php 0.7.11.src/e107_themes/templates/footer_default.php
--- 0.7.7.src/e107_themes/templates/footer_default.php	2006-11-21 23:15:47.000000000 -0600
+++ 0.7.11.src/e107_themes/templates/footer_default.php	2007-08-13 14:56:35.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     ???Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,12 +11,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/footer_default.php,v $
-|     $Revision: 1.46 $
-|     $Date: 2006/11/22 05:15:47 $
-|     $Author: mrpete $
+|     $Revision: 1.53 $
+|     $Date: 2007/08/13 19:56:35 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
+$In_e107_Footer = TRUE;	// For registered shutdown function
 
 global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $CUSTOMFOOTER, $FOOTER, $e107;
 
@@ -25,8 +26,9 @@
 //
 // The following items have been carefully designed so page processing will finish properly
 // Please DO NOT re-order these items without asking first! You WILL break something ;)
+// These letters match the USER footer (that's why there may be B.1,B.2)
 //
-// A Ensure sql and traffic objects exist 
+// A Ensure sql and traffic objects exist
 // [Next few ONLY if a regular page; not done for popups]
 // B Send the footer templated data
 // C Dump any/all traffic and debug information
@@ -37,7 +39,7 @@
 // G Browser-Server time sync script (must be the last one generated/sent)
 // H Final HTML (/body, /html)
 // I collect and send buffered page, along with needed headers
-// 
+//
 
 //
 // A Ensure sql and traffic objects exist
@@ -61,7 +63,7 @@
 	// B Send footer template
 	//
 	parseheader(($ph ? $cust_footer : $FOOTER));
-	
+
 	//
 	// C Dump all debug and traffic information
 	//
@@ -71,53 +73,25 @@
 	$db_time    = number_format($db_time,4);
 	$rinfo = '';
 
-	if($pref['displayrendertime']){ $rinfo .= "Render time: {$rendertime} second(s); {$db_time} of that for queries. "; }
-	if($pref['displaysql']){ $rinfo .= "DB queries: ".$sql -> db_QueryCount().". "; }
-	if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= "Memory Usage: ".$e107->get_memory_usage(); }
+	if($pref['displayrendertime']){ $rinfo .= CORE_LAN11.$rendertime.CORE_LAN12.$db_time.CORE_LAN13; }
+	if($pref['displaysql']){ $rinfo .= CORE_LAN15.$sql -> db_QueryCount().". "; }
+	if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= CORE_LAN16.$e107->get_memory_usage(); }
 	if(isset($pref['displaycacheinfo']) && $pref['displaycacheinfo']){ $rinfo .= $cachestring."."; }
 	echo ($rinfo ? "\n<div style='text-align:center' class='smalltext'>{$rinfo}</div>\n" : "");
 
 
 	if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) {
-		global $db_debug,$ns;
+		global $db_debug;
 		echo "\n<!-- DEBUG -->\n";
-		if (!isset($ns)) {
-			echo "Why did ns go away?<br/>";
-			$ns = new e107table;
-		}
-
-		$tmp = $eTraffic->Display();
-		if (strlen($tmp)) {
-			$ns->tablerender('Traffic Counters', $tmp);
-		}
-		$tmp = $db_debug->Show_Performance();
-		if (strlen($tmp)) {
-			$ns->tablerender('Time Analysis', $tmp);
-		}
-		$tmp = $db_debug->Show_SQL_Details();
-		if (strlen($tmp)) {
-			$ns->tablerender('SQL Analysis', $tmp);
-		}
-		$tmp = $db_debug->Show_SC_BB();
-		if (strlen($tmp)) {
-			$ns->tablerender('Shortcodes / BBCode',$tmp);
-		}
-		$tmp = $db_debug->Show_PATH();
-		if (strlen($tmp)) {
-			$ns->tablerender('Paths', $tmp);
-		}
-		$tmp = $db_debug->Show_DEPRECATED();
-		if (strlen($tmp)) {
-			$ns->tablerender('Deprecated Function Usage', $tmp);
-		}
+		$db_debug->Show_All();
 	}
-	
+
 	/*
 	changes by jalist 24/01/2005:
 	show sql queries
 	usage: add ?showsql to query string, must be admin
 	*/
-	
+
 	if(ADMIN && isset($queryinfo) && is_array($queryinfo))
 	{
 		$c=1;
@@ -133,6 +107,8 @@
 		echo "</table>";
 	}
 
+} // End of regular-page footer (the above NOT done for popups)
+
 //
 // D Close DB connection. We're done talking to underlying MySQL
 //
@@ -148,8 +124,6 @@
 		global $ns;
 		$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
 	}
-	
-} // End of regular-page footer (the above NOT done for popups)
 
 if ($pref['developer']) {
 	global $oblev_at_start,$oblev_before_start;
@@ -184,7 +158,8 @@
 //
 // E Last themed footer code, usually JS
 //
-if (function_exists('theme_foot')) {
+if (function_exists('theme_foot'))
+{
 	echo theme_foot();
 }
 
@@ -234,14 +209,14 @@
 header("Cache-Control: must-revalidate");
 header("ETag: {$etag}");
 
-$pref['compression_level'] == 6;
-if(strstr($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") || strstr($_SERVER['HTTP_USER_AGENT'], "Mozilla")) {
+$pref['compression_level'] = 6;
+if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip")) {
 	$browser_support = true;
 }
 if(ini_get("zlib.output_compression") == false && function_exists("gzencode")) {
 	$server_support = true;
 }
-if($pref['compress_output'] == true && $server_support == true && $browser_support == true) {
+if(varset($pref['compress_output'],false) && $server_support == true && $browser_support == true) {
 	$level = intval($pref['compression_level']);
 	$page = gzencode($page, $level);
 	header("Content-Encoding: gzip", true);
@@ -252,4 +227,6 @@
 	echo $page;
 }
 
+unset($In_e107_Footer);
+$e107_Clean_Exit=TRUE;	// For registered shutdown function -- let it know all is well!
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/fpw_template.php 0.7.11.src/e107_themes/templates/fpw_template.php
--- 0.7.7.src/e107_themes/templates/fpw_template.php	2006-07-16 14:56:47.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/fpw_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -1,11 +1,13 @@
 <?php
+// $Id: fpw_template.php,v 1.5 2007/12/06 21:36:02 e107steved Exp $
 
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:70%"); }
 
 // ##### FPW TABLE -----------------------------------------------------------------------------
-if(!$FPW_TABLE){
+if(!isset($FPW_TABLE))
+{
 		$FPW_TABLE = "
 		<div style='text-align:center'>
 		<form method='post' action='".e_SELF."'>
@@ -52,7 +54,8 @@
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### FPW HEADER TABLE -------------------------------------------------------------------------
-if(!$FPW_TABLE_HEADER){
+if(!isset($FPW_TABLE_HEADER))
+{
 		$FPW_TABLE_HEADER = "
 		<div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
 			<div style='width:70%;margin-left:auto;margin-right:auto;text-align:center;'><br />
@@ -62,8 +65,9 @@
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### FPW FOOTER TABLE -------------------------------------------------------------------------
-if(!$FPW_TABLE_FOOTER){
-		$FPW_TABLE_FOOTER = "</div></div>";
+if(!isset($FPW_TABLE_FOOTER))
+{
+  $FPW_TABLE_FOOTER = "</div></div>";
 }
 // ##### ------------------------------------------------------------------------------------------
 
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/header_default.php 0.7.11.src/e107_themes/templates/header_default.php
--- 0.7.7.src/e107_themes/templates/header_default.php	2006-11-08 10:32:06.000000000 -0600
+++ 0.7.11.src/e107_themes/templates/header_default.php	2007-11-23 14:48:09.000000000 -0600
@@ -6,9 +6,9 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/header_default.php,v $
-|     $Revision: 1.99 $
-|     $Date: 2006/11/08 16:32:06 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.110 $
+|     $Date: 2007/11/23 20:48:09 $
+|     $Author: e107steved $
 +-----------------------------------------------------------------------------------------------+
 */
 
@@ -71,10 +71,14 @@
 //
 
 // send the charset to the browser - overrides spurious server settings with the lan pack settings.
-header("Content-type: text/html; charset=".CHARSET, true);
+// Would like to set the MIME type appropriately - but it broke other things
+//if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) 
+//  header("Content-type: application/xhtml+xml; charset=".CHARSET, true);
+//else
+  header("Content-type: text/html; charset=".CHARSET, true);
 
 
-echo (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='".CHARSET."' "."?".">")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
+echo (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='".CHARSET."' "."?".">\n")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
 
 //
 // C: Send start of HTML
@@ -90,7 +94,7 @@
 echo "<!-- *JS* -->\n";
 
 // Wysiwyg JS support on or off.
-if (isset($WYSIWYG) && $WYSIWYG == TRUE && check_class($pref['post_html']) && isset($e_wysiwyg) && $e_wysiwyg != "") {
+if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") {
 	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
 	define("e_WYSIWYG",TRUE);
 	echo wysiwyg($e_wysiwyg);
@@ -99,16 +103,27 @@
 }
 
 if (isset($theme_js_php) && $theme_js_php) {
-	echo "<link rel='stylesheet' href='".THEME_ABS."theme-js.php' type='text/css />";
+	echo "<link rel='stylesheet' href='".THEME_ABS."theme-js.php' type='text/css' />";
 } else {
 	echo "<script type='text/javascript' src='".e_FILE_ABS."e107.js'></script>\n";
 	if (file_exists(THEME.'theme.js')) { echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n"; }
-	if (filesize(e_FILE.'user.js')) { echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n"; }
+	if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js')) { echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n"; }
 }
 
 if (isset($eplug_js) && $eplug_js) {
 	echo "\n<!-- eplug_js -->\n";
-	echo "<script type='text/javascript' src='{$eplug_js}'></script>\n";
+	if(is_array($eplug_js))
+	{
+    	foreach($eplug_js as $kjs)
+		{
+        	echo "<script type='text/javascript' src='{$kjs}'></script>\n";
+		}
+	}
+	else
+	{
+		echo "<script type='text/javascript' src='{$eplug_js}'></script>\n";
+	}
+
 }
 
 if((isset($pref['enable_png_image_fix']) && $pref['enable_png_image_fix'] == true) || (isset($sleight) && $sleight == true)) {
@@ -124,7 +139,18 @@
 
 if (isset($eplug_css) && $eplug_css) {
 	echo "\n<!-- eplug_css -->\n";
-	echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
+    if(is_array($eplug_css))
+	{
+      foreach($eplug_css as $kcss)
+	  {	// Allow inline style definition - but only if $eplug_css is an array (maybe require an array later)
+        if ('<style' == substr($kcss,0,6)) echo $kcss; else echo "<link rel='stylesheet' href='{$kcss}' type='text/css' />\n";
+	  }
+	}
+	else
+	{
+		echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
+	}
+
 }
 
 echo "<!-- Theme css -->\n";
@@ -170,11 +196,11 @@
 }
 
 //
-// DEPRECATED!!! This is used in log/stats.php to generate some css. We'll clean this up in a future release.
+// DEPRECATED!!! This is used in log/stats.php to generate some css. Its gone in 0.8 - requirement removed
 //
-
 if(function_exists('core_head')){ echo core_head(); }
 
+
 //
 // F: Send Meta Tags and Icon links
 //
@@ -188,16 +214,18 @@
 echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
 
 // --- Load plugin Meta files and eplug_ before others --------
-foreach($pref['e_meta_list'] as $val)
+if (is_array($pref['e_meta_list']))
 {
-	if(is_readable(e_PLUGIN.$val."/e_meta.php"))
+	foreach($pref['e_meta_list'] as $val)
 	{
-		echo "<!-- $val meta -->\n";
-		require_once(e_PLUGIN.$val."/e_meta.php");
+		if(is_readable(e_PLUGIN.$val."/e_meta.php"))
+		{
+			echo "<!-- $val meta -->\n";
+			require_once(e_PLUGIN.$val."/e_meta.php");
+		}
 	}
 }
 
-
 $diz_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_description'][e_LANGUAGE]) ? $pref['meta_description'][e_LANGUAGE]." " : "";
 $key_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_keywords'][e_LANGUAGE]) ? $pref['meta_keywords'][e_LANGUAGE]."," : "";
 
@@ -277,16 +305,16 @@
 //
 // I: Calculate JS onload() functions for the BODY tag
 //
-
-$fader_onload='';
-if(in_array('fader_menu', $eMenuActive))
-{
-	$fader_onload = 'changecontent(); ';
-}
-
-$links_onload = 'externalLinks();';
-$theme_onload = (defined('THEME_ONLOAD') ? THEME_ONLOAD : '');
-$body_onload = ($fader_onload != '' || $links_onload != '' || $theme_onload != '' ? " onload='".$fader_onload.$links_onload.$theme_onload."'" : "");
+// Fader menu
+global $eMenuActive;
+if(in_array('fader_menu', $eMenuActive)) $js_body_onload[] = 'changecontent(); ';
+
+// External links handling
+$js_body_onload[] = 'externalLinks();';
+
+// Theme JS
+if (defined('THEME_ONLOAD')) $js_body_onload[] = THEME_ONLOAD;
+if (count($js_body_onload)) $body_onload = " onload=\"".implode(" ",$js_body_onload)."\"";
 
 //
 // J: Send end of <head> and start of <body>
@@ -361,9 +389,10 @@
 	if (e_PAGE == 'news.php' && isset($NEWSHEADER)) {
 		parseheader($NEWSHEADER);
 	} else {
+		$full_query = e_SELF."?".e_QUERY."!";
 		foreach ($custompage as $key_extract => $cust_extract) {
 			foreach ($cust_extract as $key => $kpage) {
-				if ($kpage && strstr(e_SELF, $kpage) || strstr(e_SELF."?".e_QUERY,$kpage)) {
+				if ($kpage && (strstr(e_SELF, $kpage) || strstr($full_query,$kpage))) {
 					$ph = TRUE;
 					if ($key_extract=='no_array') {
 						$cust_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER;
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/login_template.php 0.7.11.src/e107_themes/templates/login_template.php
--- 0.7.7.src/e107_themes/templates/login_template.php	2006-08-08 01:45:48.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/login_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -1,24 +1,27 @@
 <?php
+// $Id: login_template.php,v 1.8 2007/12/06 21:36:02 e107steved Exp $
 
 if (!defined('e107_INIT')) { exit; }
 
 // ##### LOGIN HEADER TABLE -----------------------------------------------------------------------
-if(!$LOGIN_TABLE_HEADER){
+if(!isset($LOGIN_TABLE_HEADER))
+{
 	$LOGIN_TABLE_HEADER .= "
 	<div style='width:100%;text-align:center; margin-left: auto;margin-right: auto'><br />
 		<div style='text-align:center;width:70%;margin-left: auto;margin-right: auto'>
-			".(file_exists(THEME."images/login_logo.png") ? "<img src='".THEME."images/login_logo.png' alt='' />\n" : "<img src='".e_IMAGE."logo.png' alt='' />\n" );
+			".(file_exists(THEME."images/login_logo.png") ? "<img src='".THEME_ABS."images/login_logo.png' alt='' />\n" : "<img src='".e_IMAGE."logo.png' alt='' />\n" );
 }
 
 // ##### LOGIN TABLE -----------------------------------------------------------------------------
-if(!$LOGIN_TABLE){
+if(!isset($LOGIN_TABLE))
+{
 		$LOGIN_TABLE = "";
 		if($LOGIN_TABLE_LOGINMESSAGE != ""){
 				$LOGIN_TABLE .= "<div style='text-align:center'>{LOGIN_TABLE_LOGINMESSAGE}</div>";
 		}
 		$LOGIN_TABLE .= "
 		<div style='text-align:center'>
-		".$rs -> form_open("post", e_SELF)."<table class='fborder' style='width:60%' >\n<tr>\n<td class='forumheader' style='text-align:center;' colspan='3'>".LAN_LOGIN_4."</td>\n</tr>\n<tr>\n<td class='forumheader3' width='40%'>".LAN_LOGIN_1."</td>\n<td class='forumheader3' width='40%'>{LOGIN_TABLE_USERNAME}</td>\n<td class='forumheader3' width='20%' rowspan='".($LOGIN_TABLE_SECIMG_SECIMG ? 3 : 2)."' style='vertical-align: middle; margin-left: auto; margin-right: auto; text-align: center;'>".(file_exists(THEME."images/password.png") ? "<img src='".THEME."images/password.png' alt='' />\n" : "<img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' />\n" )."</td>\n</tr>\n<tr>\n<td class='forumheader3'>".LAN_LOGIN_2."</td>\n<td class='forumheader3'>{LOGIN_TABLE_PASSWORD}</td>\n</tr>\n";
+		".$rs -> form_open("post", e_SELF)."<table class='fborder' style='width:60%' >\n<tr>\n<td class='forumheader' style='text-align:center;' colspan='3'>".LAN_LOGIN_4."</td>\n</tr>\n<tr>\n<td class='forumheader3' width='40%'>".LAN_LOGIN_1."</td>\n<td class='forumheader3' width='40%'>{LOGIN_TABLE_USERNAME}</td>\n<td class='forumheader3' width='20%' rowspan='".($LOGIN_TABLE_SECIMG_SECIMG ? 3 : 2)."' style='vertical-align: middle; margin-left: auto; margin-right: auto; text-align: center;'>".(file_exists(THEME."images/password.png") ? "<img src='".THEME_ABS."images/password.png' alt='' />\n" : "<img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' />\n" )."</td>\n</tr>\n<tr>\n<td class='forumheader3'>".LAN_LOGIN_2."</td>\n<td class='forumheader3'>{LOGIN_TABLE_PASSWORD}</td>\n</tr>\n";
 	if($LOGIN_TABLE_SECIMG_SECIMG){
 		$LOGIN_TABLE .= "<tr><td class='forumheader3'>{LOGIN_TABLE_SECIMG_LAN}</td>\n<td class='forumheader3'>{LOGIN_TABLE_SECIMG_HIDDEN} {LOGIN_TABLE_SECIMG_SECIMG} {LOGIN_TABLE_SECIMG_TEXTBOC}</td>\n</tr>\n";
 	}
@@ -29,7 +32,8 @@
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### LOGIN TABLE FOOTER -----------------------------------------------------------------------
-if(!$LOGIN_TABLE_FOOTER){
+if(!isset($LOGIN_TABLE_FOOTER))
+{
 			$LOGIN_TABLE_FOOTER = "
 			<div style='width:70%;margin-right:auto;margin-left:auto'>
 				<div style='text-align:center'><br />
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/online_template.php 0.7.11.src/e107_themes/templates/online_template.php
--- 0.7.7.src/e107_themes/templates/online_template.php	2006-07-16 14:56:47.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/online_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -1,10 +1,12 @@
 <?php
+// $Id: online_template.php,v 1.4 2007/12/06 21:36:02 e107steved Exp $
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:96%"); }
 
 // ##### ONLINE TABLE -----------------------------------------------------------------------------
-if(!$ONLINE_TABLE_START){
+if(!isset($ONLINE_TABLE_START))
+{
 		$ONLINE_TABLE_START = "
 		<div style='text-align:center'>
 		<table class='fborder' style='".USER_WIDTH."'>
@@ -14,7 +16,8 @@
 			<td class='forumheader' style='width:50%'>".ONLINE_EL11."</td>
 		</tr>";
 }
-if(!$ONLINE_TABLE){
+if(!isset($ONLINE_TABLE))
+{
 		$ONLINE_TABLE = "
 		<tr>
 			<td class='forumheader3' style='width:3%;text-align:center'>{ONLINE_TABLE_ICON}</td>
@@ -22,7 +25,8 @@
 			<td class='forumheader3' style='width:50%'>{ONLINE_TABLE_LOCATION}<br /></td>
 		</tr>";
 }
-if(!$ONLINE_TABLE_END){
+if(!isset($ONLINE_TABLE_END))
+{
 		$ONLINE_TABLE_END = "
 		</table>
 		</div>
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/signup_template.php 0.7.11.src/e107_themes/templates/signup_template.php
--- 0.7.7.src/e107_themes/templates/signup_template.php	2006-11-16 13:50:45.000000000 -0600
+++ 0.7.11.src/e107_themes/templates/signup_template.php	2007-12-03 15:03:14.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/signup_template.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/11/16 19:50:45 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.13 $
+|     $Date: 2007/12/03 21:03:14 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -43,8 +43,11 @@
 </tr>
 ";
 
+$sc_style['SIGNUP_IS_MANDATORY']['pre'] = "<span style='font-size:15px; color:red'>";
+$sc_style['SIGNUP_IS_MANDATORY']['post'] = "</span>";
 
-if(!defined($USERCLASS_SUBSCRIBE_START))
+
+if(!isset($USERCLASS_SUBSCRIBE_START))
 {
 $USERCLASS_SUBSCRIBE_START = "
 <tr>
@@ -55,7 +58,7 @@
 ";
 }
 
-if(!defined($USERCLASS_SUBSCRIBE_ROW))
+if(!isset($USERCLASS_SUBSCRIBE_ROW))
 {
 $USERCLASS_SUBSCRIBE_ROW = "
 <tr>
@@ -69,7 +72,7 @@
 ";
 }
 
-if(!defined($USERCLASS_SUBSCRIBE_END))
+if(!isset($USERCLASS_SUBSCRIBE_END))
 {
 $USERCLASS_SUBSCRIBE_END = "
 </table>
@@ -80,13 +83,13 @@
 
 
 
-if(!defined($SIGNUP_PASSWORD_LEN))
+if(!isset($SIGNUP_PASSWORD_LEN))
 {
 $SIGNUP_PASSWORD_LEN = "<span class='smalltext'> (".LAN_SIGNUP_1." {$pref['signup_pass_len']} ".LAN_SIGNUP_2.")</span>";
 }
 
 
-if(!defined($SIGNUP_EXTENDED_USER_FIELDS))
+if(!isset($SIGNUP_EXTENDED_USER_FIELDS))
 {
 	$SIGNUP_EXTENDED_USER_FIELDS	= "
 <tr>
@@ -101,7 +104,7 @@
 ";
 }
 
-if(!defined($EXTENDED_USER_FIELD_REQUIRED))
+if(!isset($EXTENDED_USER_FIELD_REQUIRED))
 {
 	$EXTENDED_USER_FIELD_REQUIRED	= "<span style='text-align:right;font-size:15px; color:red'> *</span>";
 }
@@ -151,7 +154,7 @@
 ";
 
 
-if(!defined($COPPA_TEMPLATE))
+if(!isset($COPPA_TEMPLATE))
 {
 $COPPA_TEMPLATE = LAN_109." <a href='http://www.cdt.org/legislation/105th/privacy/coppa.html'>".LAN_SIGNUP_14."</a>. ".LAN_SIGNUP_15." <a href='mailto:".SITEADMINEMAIL."'>".LAN_SIGNUP_14."</a> ".LAN_SIGNUP_16."
 <br />
@@ -162,26 +165,27 @@
 ";
 }
 
-if(!defined($COPPA_FAIL))
+if(!isset($COPPA_FAIL))
 {
 $COPPA_FAIL = "<div style='text-align:center'>".LAN_SIGNUP_9."</div>";
 }
 
-if(!defined($SIGNUP_TEXT))
+if(!isset($SIGNUP_TEXT))
 {
 $SIGNUP_TEXT =
 LAN_309." <b>".LAN_SIGNUP_29."</b><br /><br />".LAN_SIGNUP_30."<br />
 ";
 }
 
-if(!defined($SIGNUP_XUP_FORM))
+if(!isset($SIGNUP_XUP_FORM))
 {
 $SIGNUP_XUP_FORM = "
+	<div id='xup' style='display:none' >
+
 	<div style='padding:10px;text-align:center'>
-	<input class='button' type ='button' style='cursor:hand' size='30' value=\"".LAN_SIGNUP_35."\" onclick=\"expandit('xup','default')\" />
+	<input class='button' type ='button' style='cursor:pointer' size='30' value=\"".LAN_SIGNUP_54."\" onclick=\"expandit('default');expandit('xup')\" />
 	</div>
 
-	<div id='xup' style='display:none' >
 	<table style='".USER_WIDTH."'>
 	<tr>
 	<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_31."
@@ -229,7 +233,16 @@
 ";
 }
 
-if(!defined($SIGNUP_BEGIN))
+if (!isset($SIGNUP_XUP_BUTTON))
+{
+$SIGNUP_XUP_BUTTON = "	<div style='padding:10px;text-align:center'>
+	<input class='button' type ='button' style='cursor:pointer' size='30' value=\"".LAN_SIGNUP_35."\" onclick=\"expandit('default');expandit('xup')\" />
+	</div>
+";
+}
+
+
+if(!isset($SIGNUP_BEGIN))
 {
 $SIGNUP_BEGIN = "
 {SIGNUP_FORM_OPEN}
@@ -239,11 +252,12 @@
 ".LAN_400."<br /><br /></div>";
 }
 
-if(!defined($SIGNUP_BODY))
+if(!isset($SIGNUP_BODY))
 {
 $SIGNUP_BODY = "
 {SIGNUP_XUP}
 <div id='default'>
+{SIGNUP_XUP_ACTION}
 <table class='fborder' style='".USER_WIDTH."'>
 {SIGNUP_DISPLAYNAME}
 <tr>
@@ -268,14 +282,14 @@
 </tr>
 
 <tr>
-<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_112."<span style='font-size:15px; color:red'> *</span></td>
+<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_112."{SIGNUP_IS_MANDATORY=email}</td>
 <td class='forumheader3' style='width:70%'>
 {SIGNUP_EMAIL}
 </td>
 </tr>
 
 <tr>
-<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_39."<span style='font-size:15px; color:red'> *</span></td>
+<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_39."{SIGNUP_IS_MANDATORY=email}</td>
 <td class='forumheader3' style='width:70%'>
 {SIGNUP_EMAIL_CONFIRM}
 </td>
@@ -305,7 +319,20 @@
 ";
 }
 
-if(!defined($SIGNUP_END))
+
+if(!isset($SIGNUP_EXTENDED_CAT))
+{
+	$SIGNUP_EXTENDED_CAT	= "
+<tr>
+	<td colspan='2' class='forumheader'>
+		{EXTENDED_CAT_TEXT}
+	</td>	
+</tr>
+";
+}
+
+
+if(!isset($SIGNUP_END))
 {
 $SIGNUP_END = "
 ";
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/sitedown_template.php 0.7.11.src/e107_themes/templates/sitedown_template.php
--- 0.7.7.src/e107_themes/templates/sitedown_template.php	2006-06-29 23:16:39.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/sitedown_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -11,21 +11,25 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/sitedown_template.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/06/30 04:16:39 $
-|     $Author: e107coders $
+|     $Revision: 1.6 $
+|     $Date: 2007/12/06 21:36:02 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // ##### SITEDOWN TABLE -----------------------------------------------------------------
-if(!$SITEDOWN_TABLE){
+if(!isset($SITEDOWN_TABLE))
+{
 	$SITEDOWN_TABLE = (defined("STANDARDS_MODE") ? "" : "<?xml version='1.0' encoding='".CHARSET."' "."?".">")."<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
 	";
 	$SITEDOWN_TABLE .= "
     <html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
 	<head>
+		<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
+		<meta http-equiv='content-style-type' content='text/css' />\n
+		<link rel='stylesheet' href='".THEME_ABS."style.css' type='text/css' media='all' />
 		<title>{SITEDOWN_TABLE_PAGENAME}</title>
 	</head>
 	<body>
@@ -40,4 +44,4 @@
 }
 // ##### ------------------------------------------------------------------------------------------
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/user_template.php 0.7.11.src/e107_themes/templates/user_template.php
--- 0.7.7.src/e107_themes/templates/user_template.php	2006-08-03 19:19:07.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/user_template.php	2007-09-20 16:35:52.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/user_template.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/08/04 00:19:07 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.17 $
+|     $Date: 2007/09/20 21:35:52 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
-global $user_shortcodes, $pref;
+global $user_shortcodes, $pref, $user;
 //Set this to TRUE if you would like any extended user field that is empty to NOT be shown on the profile page
 define("HIDE_EMPTY_FIELDS", FALSE);
 
@@ -36,8 +36,8 @@
 	</tr>
 	";
 
-$EXTENDED_END = "";
-//		$datestamp = $gen->convert_date($user_join, "forum");
+$EXTENDED_CATEGORY_END = "";
+
 
 $USER_SHORT_TEMPLATE_START = "
 	<div style='text-align:center'>".LAN_138." {TOTAL_USERS}
@@ -105,16 +105,11 @@
 $sc_style['USER_SENDPM']['pre'] = "<tr><td colspan='2' style='width:100%' class='forumheader3'><span style='float:left'>";
 $sc_style['USER_SENDPM']['post'] = "</span><span style='float:right;'>".LAN_425."</span></td></tr>";
 
-if($tp->parseTemplate("{USER_SENDPM}", FALSE, $user_shortcodes))
-{
-	$sendpm = "{USER_SENDPM}";
-}
-else
-{
-	$sendpm = "";
-}
+// Determine which other bits are installed; let photo span those rows (can't do signature - will vary with user)
+$span = 4;
+if ($tp->parseTemplate("{USER_SENDPM}", FALSE, $user_shortcodes)) $span++;
+$span = " rowspan='".$span."' ";
 
-$span = " rowspan='".($sendpm ? "5" : "4")."' ";
 $sc_style['USER_PICTURE']['pre']="<td {$span} class='forumheader3' style='width:20%; vertical-align:middle; text-align:center'>";
 $sc_style['USER_PICTURE']['post']="</td>";
 
@@ -125,7 +120,7 @@
 	<td colspan='2' class='fcaption' style='text-align:center'>".LAN_142." {USER_ID} : {USER_NAME}{USER_LOGINNAME}</td>
 </tr>
 <tr>
-	$user_picture
+	{$user_picture}
 	<td {$main_colspan} class='forumheader3' style='width:100%'>
 		<span style='float:left'>{USER_REALNAME_ICON} ".LAN_308."</span>
 		<span style='float:right; text-align:right'>{USER_REALNAME}</span>
@@ -152,7 +147,7 @@
 		<span style='float:right; text-align:right'>{USER_LASTVISIT}<br />{USER_LASTVISIT_LAPSE}</span>
 	</td>
 </tr>
-{$sendpm}
+{USER_SENDPM}
 {USER_RATING}
 {USER_SIGNATURE}
 {USER_EXTENDED_ALL}
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/userposts_template.php 0.7.11.src/e107_themes/templates/userposts_template.php
--- 0.7.7.src/e107_themes/templates/userposts_template.php	2006-07-16 14:56:47.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/userposts_template.php	2007-12-06 15:36:02.000000000 -0600
@@ -11,25 +11,28 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/userposts_template.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/07/16 19:56:47 $
-|     $Author: e107coders $
+|     $Revision: 1.7 $
+|     $Date: 2007/12/06 21:36:02 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
-if(!isset($USERPOSTS_NP_TABLE)){
-	$USERPOSTS_NP_TABLE = "<div class='nextprev'>{USERPOSTS_NEXTPREV}</div>";
+if(!isset($USERPOSTS_NP_TABLE))
+{
+  $USERPOSTS_NP_TABLE = "<div class='nextprev'>{USERPOSTS_NEXTPREV}</div>";
 }
 
 // ##### USERPOSTS_COMMENTS TABLE -----------------------------------------------------------------
-if(!$USERPOSTS_COMMENTS_TABLE_START){
+if(!isset($USERPOSTS_COMMENTS_TABLE_START))
+{
 	$USERPOSTS_COMMENTS_TABLE_START = "
 	<div style='text-align:center'>
 	<table class='fborder' style='".USER_WIDTH."'>\n";
 }
-if(!$USERPOSTS_COMMENTS_TABLE){
+if(!isset($USERPOSTS_COMMENTS_TABLE))
+{
 	$USERPOSTS_COMMENTS_TABLE = "
 	<tr>
 	<td class='fcaption'>
@@ -44,7 +47,8 @@
 	</tr>
 	";
 }
-if(!$USERPOSTS_COMMENTS_TABLE_END){
+if(!isset($USERPOSTS_COMMENTS_TABLE_END))
+{
 	 $USERPOSTS_COMMENTS_TABLE_END = "
 	</table>
 	</div>";
@@ -52,13 +56,15 @@
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### USERPOSTS FORUM TABLE --------------------------------------------------------------------
-if(!$USERPOSTS_FORUM_TABLE_START){
+if(!isset($USERPOSTS_FORUM_TABLE_START))
+{
 	$USERPOSTS_FORUM_TABLE_START = "
 	<div style='text-align:center'>
 	<form method='post' action='".e_SELF."?".e_QUERY."'>
 	<table class='fborder' style='".USER_WIDTH."'>";
 }
-if(!$USERPOSTS_FORUM_TABLE){
+if(!isset($USERPOSTS_FORUM_TABLE))
+{
 	$USERPOSTS_FORUM_TABLE .= "
 	<tr>
 	<td class='fcaption'>
@@ -74,7 +80,8 @@
 	</tr>
 	";
 }
-if(!$USERPOSTS_FORUM_TABLE_END){
+if(!isset($USERPOSTS_FORUM_TABLE_END))
+{
 	$USERPOSTS_FORUM_TABLE_END = "
 	<tr>
 	<td class='forumheader' style='text-align:right'>
diff -x .svn -ruN 0.7.7.src/e107_themes/templates/usersettings_template.php 0.7.11.src/e107_themes/templates/usersettings_template.php
--- 0.7.7.src/e107_themes/templates/usersettings_template.php	2006-10-18 11:34:48.000000000 -0500
+++ 0.7.11.src/e107_themes/templates/usersettings_template.php	2007-08-12 16:40:31.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/usersettings_template.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/10/18 16:34:48 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2007/08/12 21:40:31 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -71,9 +71,9 @@
 
 <tr>
 <td style='width:40%; vertical-align:top' class='forumheader3'>".LAN_414."<br /><span class='smalltext'>".LAN_426."</span></td>
-<td style='width:60%' class='forumheader2'>
+<td style='width:60%' class='forumheader2'><span class='smalltext'>
 ";
-$sc_style['PHOTO_UPLOAD']['post'] = "</td></tr>";
+$sc_style['PHOTO_UPLOAD']['post'] = "</span></td></tr>";
 
 
 $sc_style['XUP']['pre'] = "
@@ -135,7 +135,7 @@
 	{PASSWORD2}
 
 	<tr>
-	<td style='width:40%' class='forumheader3'>".LAN_112."</td>
+	<td style='width:40%' class='forumheader3'>".LAN_112.req(!$pref['disable_emailcheck'])."</td>
 	<td style='width:60%' class='forumheader2'>
 	{EMAIL}
 	</td>
diff -x .svn -ruN 0.7.7.src/e107_themes/vekna_blue/theme.php 0.7.11.src/e107_themes/vekna_blue/theme.php
--- 0.7.7.src/e107_themes/vekna_blue/theme.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.11.src/e107_themes/vekna_blue/theme.php	2007-11-23 14:50:09.000000000 -0600
@@ -33,8 +33,9 @@
 
 define("THEME_DISCLAIMER", "<br /><i>".LAN_THEME_1."</i>");
 
-function theme_head() {
-	return "<link rel='stylesheet' href='".THEME_ABS."nav_menu.css' />\n";
+function theme_head() 
+{
+  return "<link rel='stylesheet' href='".THEME_ABS."nav_menu.css' type='text/css' />\n";
 }
 
 // [layout]
@@ -76,7 +77,7 @@
 </td>
 </tr>
 <tr>
-<td class='infobar' colspan='2' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}</td>
+<td class='infobar' colspan='2' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}</td>
 </tr>
 </table>
 ";
@@ -104,7 +105,7 @@
 </td>
 </tr>
 <tr>
-<td class='infobar' colspan='2' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEMEDISCLAIMER}</td>
+<td class='infobar' colspan='2' style='text-align: center;'>{SITEDISCLAIMER}<br />{THEME_DISCLAIMER}</td>
 </tr>
 </table>
 ";
diff -x .svn -ruN 0.7.7.src/email.php 0.7.11.src/email.php
--- 0.7.7.src/email.php	2006-11-11 22:10:22.000000000 -0600
+++ 0.7.11.src/email.php	2007-01-07 09:24:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/email.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2006/11/12 04:10:22 $
-|     $Author: mrpete $
+|     $Revision: 1.21 $
+|     $Date: 2007/01/07 15:24:48 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -46,7 +46,7 @@
 
 $emailurl = ($source == "referer") ? $_SERVER['HTTP_REFERER'] : SITEURL;
 
-$comments = $tp->post_toHTML($_POST['comment'], TRUE, 'retain_nl emotes_off no_make_clickable');
+$comments = $tp->post_toHTML($_POST['comment'], TRUE, 'retain_nl, emotes_off, no_make_clickable');
 $author = $tp->post_toHTML($_POST['author_name'],FALSE,"emotes_off, no_make_clickable");
 $email_send = check_email($_POST['email_send']);
 
diff -x .svn -ruN 0.7.7.src/error.php 0.7.11.src/error.php
--- 0.7.7.src/error.php	2006-06-02 08:59:40.000000000 -0500
+++ 0.7.11.src/error.php	2007-10-05 00:46:44.000000000 -0500
@@ -11,16 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/error.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/06/02 13:59:40 $
-|     $Author: lisa_ $
+|     $Revision: 1.15 $
+|     $Date: 2007/10/05 05:46:44 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
+
+define("ERR_PAGE_ACTIVE",'error');
+
 require_once("class2.php");
 
 if(!e_QUERY || (e_QUERY != 401 && e_QUERY != 403 && e_QUERY != 404 && e_QUERY != 500))
 {
-	echo "<script type='text/javascript'>document.location.href='index.php'</script>\n";
+	echo "<script type='text/javascript'>document.location.href='{$base_path}index.php'</script>\n";
 	header("location: ".e_HTTP."index.php");
 	exit;
 }
@@ -29,20 +32,19 @@
 
 $errFrom = $_SERVER['HTTP_REFERER'];
 $errTo = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
+$base_path = e_HTTP;
 
 switch(e_QUERY) {
 	case 401:
 	header("HTTP/1.1 401 Unauthorized");
 	$text = "<div class='installe'><img src='".e_IMAGE_ABS."icons/icon3.png' alt='Error Icon'> ".LAN_ERROR_1."</div><br /><div class='installh'>".LAN_ERROR_2."</div><br /><div class='smalltext'>".LAN_ERROR_3."</div>
-		<br /><div class='installh'>".LAN_ERROR_2."<a href='index.php'>".LAN_ERROR_20."</a></div>";
+		<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>";
 	break;
 	case 403:
 	header("HTTP/1.1 403 Forbidden");
 	$text = "<div class='installe'><img src='".e_IMAGE_ABS."icons/icon3.png' alt='Error Icon'> ".LAN_ERROR_4."</div><br /><div class='installh'>".LAN_ERROR_5."</div><br /><div class='smalltext'>".LAN_ERROR_6."</div>
-		<br /><div class='installh'>".LAN_ERROR_2."<a href='index.php'>".LAN_ERROR_20."</a></div>";
+		<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>";
 	break;
-	default:
-
 
 	case 404:
 	header("HTTP/1.1 404 Not Found");
@@ -50,21 +52,23 @@
 
 	if (strlen($errFrom)) $text .= LAN_ERROR_9." ( <a href='{$errFrom}' rel='external'>{$errFrom}</a> ) -- ".LAN_ERROR_19."<br />";
 
-	$base_path = e_HTTP;
 
 	$text .= "<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a><br />";
 	$text .= "<a href='{$base_path}search.php'>".LAN_ERROR_22."</a></p>";
-
 	break;
 
 
 	case 500:
 	header("HTTP/1.1 500 Internal Server Error");
 	$text = "<div class='installe'><img src='".e_IMAGE_ABS."icons/icon3.png' alt='Error Icon'> ".LAN_ERROR_10."</div><br /><div class='installh'>".LAN_ERROR_11."</div><br /><div class='smalltext'>".LAN_ERROR_12."</div>
-		<br /><div class='installh'>".LAN_ERROR_2."<a href='index.php'>".LAN_ERROR_20."</a></div>";
+		<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>";
 	break;
 	$text = "<div class='installe'>".LAN_ERROR_13." (".$_SERVER['QUERY_STRING'].")</div><br /><div class='installh'>".LAN_ERROR_14."</div><br /><div class='smalltext'>".LAN_ERROR_15."</div>
-		<br /><div class='installh'>".LAN_ERROR_2."<a href='index.php'>".LAN_ERROR_20."</a></div>";
+		<br /><div class='installh'>".LAN_ERROR_2."<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a></div>";
+
+	default:
+	$text = LAN_ERROR_34." e_QUERY = '".e_QUERY."'<br /><a href='{$base_path}index.php'>".LAN_ERROR_20."</a>";
+	break;
 }
 
 $ns->tablerender(PAGE_NAME, $text);
diff -x .svn -ruN 0.7.7.src/fpw.php 0.7.11.src/fpw.php
--- 0.7.7.src/fpw.php	2006-11-07 15:19:17.000000000 -0600
+++ 0.7.11.src/fpw.php	2007-12-12 18:44:06.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/fpw.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/11/07 21:19:17 $
-|     $Author: lisa_ $
+|     $Revision: 1.23 $
+|     $Date: 2007/12/13 00:44:06 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -81,7 +81,12 @@
 		cookie($pref['cookie_name'], "", (time()-2592000));
 		$_SESSION[$pref['cookie_name']] = "";
 
-		$txt = LAN_FPW8." {$username} ".LAN_FPW9." {$newpw}<br /><br />".LAN_FPW10." <a href='".e_BASE."index.php'>".LAN_FPW11."</a> ".LAN_FPW12;
+		$txt = "<div>".LAN_FPW8."<br /><br />
+		<table style='width:70%'>
+		<tr><td>".LAN_218."</td><td style='font-weight:bold'>{$username}</td></tr>
+		<tr><td>".LAN_FPW9."</td><td style='font-weight:bold'>{$newpw}</td></tr>
+		</table>
+		<br /><br />".LAN_FPW10." <a href='".e_LOGIN."'>".LAN_FPW11."</a> ".LAN_FPW12."</div>";
 		fpw_error($txt);
 
 	} else {
@@ -101,7 +106,7 @@
 
 	$clean_email = check_email($tp -> toDB($_POST['email']));
 	$clean_username = $tp -> toDB($_POST['username']);
-	$query = "user_email='{$clean_email}' ";
+ 	$query = "user_email='{$clean_email}' ";
 	// Allow admins to remove 'username' from fpw_template.php if they wish.
 	$query .= (isset($_POST['username'])) ? " AND user_loginname='{$clean_username}'" : "";
 
@@ -134,6 +139,7 @@
 		//Set timestamp two days ahead so it doesn't get auto-deleted
 		$sql->db_Insert("tmp", "'pwreset',{$deltime},'{$user_name}{$fpw_sep}{$rcode}'");
 
+
 		if (sendemail($_POST['email'], "".LAN_09."".SITENAME, $message)) {
 			$text = "<div style='text-align:center'>".LAN_FPW6."</div>";
 		} else {
diff -x .svn -ruN 0.7.7.src/gsitemap.php 0.7.11.src/gsitemap.php
--- 0.7.7.src/gsitemap.php	2006-11-07 08:59:18.000000000 -0600
+++ 0.7.11.src/gsitemap.php	2007-12-24 10:21:16.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/gsitemap.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/07 14:59:18 $
-|     $Author: lisa_ $
+|     $Revision: 1.11 $
+|     $Date: 2007/12/24 16:21:16 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -30,7 +30,7 @@
 	foreach($nfArray as $nfa)
 	{
 		$url = (substr($nfa['gsitemap_url'],0,4)== "http")? $nfa['gsitemap_url'] : SITEURL.$tp->replaceConstants($nfa['gsitemap_url'],TRUE);
-		$text .= "<li>".$tp->toHTML($nfa['gsitemap_cat'],"","defs").": <a href='".$url."'>".$tp->toHTML($nfa['gsitemap_name'],"","defs")."</a><br />\n";
+		$text .= "<li>".$tp->toHTML($nfa['gsitemap_cat'],"","defs").": <a href='".$url."'>".$tp->toHTML($nfa['gsitemap_name'],"","defs")."</a></li>\n";
 	}
 	$text .= "</ul></div>";
 
diff -x .svn -ruN 0.7.7.src/install.php 0.7.11.src/install.php
--- 0.7.7.src/install.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.11.src/install.php	2007-03-05 15:13:17.000000000 -0600
@@ -0,0 +1,1966 @@
+<?php
+/*
++----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     ©Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/install_.php,v $
+|     $Revision: 1.61 $
+|     $Date: 2007/03/05 21:13:17 $
+|     $Author: e107steved $
++----------------------------------------------------------------------------+
+*/
+
+/* Default Options and Paths for Installer */
+$MySQLPrefix	     = 'e107_';
+
+$ADMIN_DIRECTORY     = "e107_admin/";
+$FILES_DIRECTORY     = "e107_files/";
+$IMAGES_DIRECTORY    = "e107_images/";
+$THEMES_DIRECTORY    = "e107_themes/";
+$PLUGINS_DIRECTORY   = "e107_plugins/";
+$HANDLERS_DIRECTORY  = "e107_handlers/";
+$LANGUAGES_DIRECTORY = "e107_languages/";
+$HELP_DIRECTORY      = "e107_docs/help/";
+$DOWNLOADS_DIRECTORY = "e107_files/downloads/";
+
+/* End configurable variables */
+
+if(isset($_GET['object'])) {
+	get_object($_GET['object']);
+	die();
+}
+
+define("e107_INIT", TRUE);
+define("e_UC_ADMIN", 254);
+
+error_reporting(E_ALL);
+
+function e107_ini_set($var, $value){
+	if (function_exists('ini_set')){
+		ini_set($var, $value);
+	}
+}
+
+// setup some php options
+e107_ini_set('magic_quotes_runtime',     0);
+e107_ini_set('magic_quotes_sybase',      0);
+e107_ini_set('arg_separator.output',     '&amp;');
+e107_ini_set('session.use_only_cookies', 1);
+e107_ini_set('session.use_trans_sid',    0);
+
+
+if(!function_exists("file_get_contents")) {
+	die("e107 requires PHP 4.3 or greater to work correctly.");
+}
+
+//  Ensure that '.' is the first part of the include path
+$inc_path = explode(PATH_SEPARATOR, ini_get('include_path'));
+if($inc_path[0] != ".") {
+	array_unshift($inc_path, ".");
+	$inc_path = implode(PATH_SEPARATOR, $inc_path);
+	e107_ini_set("include_path", $inc_path);
+}
+unset($inc_path);
+
+if(!function_exists("mysql_connect")) {
+	die("e107 requires PHP to be installed or compiled with the MySQL extension to work correctly, please see the MySQL manual for more information.");
+}
+
+# Check for the realpath(). Some hosts (I'm looking at you, Awardspace) are totally dumb and
+# they think that disabling realpath() will somehow (I'm assuming) help improve their pathetic
+# local security. Fact is, it just prevents apps from doing their proper local inclusion security
+# checks. So, we refuse to work with these people.
+$functions_ok = true;
+$disabled_functions = ini_get('disable_functions');
+if (trim($disabled_functions) != '') {
+	$disabled_functions = explode( ',', $disabled_functions );
+	foreach ($disabled_functions as $function) {
+		if(trim($function) == "realpath") {
+			$functions_ok = false;
+		}
+	}
+}
+if($functions_ok == true && function_exists("realpath") == false) {
+	$functions_ok = false;
+}
+if($functions_ok == false) {
+	die("e107 requires the realpath() function to be enabled and your host appears to have disabled it. This function is required for some <b>important</b> security checks and <b>There is NO workaround</b>. Please contact your host for more information.");
+}
+
+if(!function_exists("print_a")) {
+	function print_a($var) {
+		return '<pre>'.htmlentities(print_r($var, true), null, "UTF-8").'</pre>';
+	}
+}
+
+header("Content-type: text/html; charset=utf-8");
+
+$installer_folder_name = 'e107_install';
+
+include_once("./{$HANDLERS_DIRECTORY}e107_class.php");
+
+$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY');
+$e107 = new e107($e107_paths, realpath(dirname(__FILE__)));
+unset($e107_paths);
+
+$e107->e107_dirs['INSTALLER'] = "{$installer_folder_name}/";
+
+$e_install = new e_install();
+$e_forms = new e_forms();
+
+$e_install->template->SetTag("installer_css_http", $_SERVER['PHP_SELF']."?object=stylesheet");
+$e_install->template->SetTag("installer_folder_http", e_HTTP.$installer_folder_name."/");
+$e_install->template->SetTag("files_dir_http", e_FILE_ABS);
+
+if(!isset($_POST['stage'])) {
+	$_POST['stage'] = 1;
+}
+$_POST['stage'] = intval($_POST['stage']);
+
+switch ($_POST['stage']) {
+	case 1:
+		$e_install->stage_1();
+		break;
+	case 2:
+		$e_install->stage_2();
+		break;
+	case 3:
+		$e_install->stage_3();
+		break;
+	case 4:
+		$e_install->stage_4();
+		break;
+	case 5:
+		$e_install->stage_5();
+		break;
+	case 6:
+		$e_install->stage_6();
+		break;
+	case 7:
+		$e_install->stage_7();
+		break;
+	default:
+		$e_install->raise_error("Install stage information from client makes no sense to me.");
+}
+
+if($_SERVER['QUERY_STRING'] == "debug"){
+	$e_install->template->SetTag("debug_info", print_a($e_install));
+} else {
+	$e_install->template->SetTag("debug_info", (count($e_install->debug_info) ? print_a($e_install->debug_info)."Backtrace:<br />".print_a($e_install) : ""));
+}
+
+echo $e_install->template->ParseTemplate(template_data(), TEMPLATE_TYPE_DATA);
+
+
+
+class e_install {
+
+	var $required_php = "4.3";
+
+	var $paths;
+	var $template;
+	var $debug_info;
+	var $e107;
+	var $previous_steps;
+	var $stage;
+	var $post_data;
+
+	function e_install() {
+		$this->template = new SimpleTemplate();
+		while (@ob_end_clean());
+		global $e107;
+		$this->e107 = $e107;
+		if(isset($_POST['previous_steps'])) {
+			$this->previous_steps = unserialize(base64_decode($_POST['previous_steps']));
+			unset($_POST['previous_steps']);
+		} else {
+			$this->previous_steps = array();
+		}
+		$this->post_data = $_POST;
+	}
+
+	function raise_error($details){
+		$this->debug_info[] = array (
+		'info' => array (
+		'details' => $details,
+		'backtrace' => debug_backtrace()
+		)
+		);
+	}
+
+	function stage_1(){
+		global $e_forms;
+		$this->stage = 1;
+		$this->get_lan_file();
+		$this->template->SetTag("installation_heading", LANINS_001);
+		$this->template->SetTag("stage_pre", LANINS_002);
+		$this->template->SetTag("stage_num", LANINS_003);
+		$this->template->SetTag("stage_title", LANINS_004);
+		$e_forms->start_form("language_select", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+		$e_forms->add_select_item("language", $this->get_languages(), "English");
+		$this->finish_form();
+		$e_forms->add_button("submit", LANINS_006);
+		$this->template->SetTag("stage_content", "<div style='text-align: center;'><label for='language'>".LANINS_005."</label>\n<br /><br /><br />\n".$e_forms->return_form()."</div>");
+	}
+
+	function stage_2(){
+		global $e_forms;
+		$this->stage = 2;
+		$this->previous_steps['language'] = $_POST['language'];
+		$this->get_lan_file();
+		$this->template->SetTag("installation_heading", LANINS_001);
+		$this->template->SetTag("stage_pre", LANINS_002);
+		$this->template->SetTag("stage_num", LANINS_021);
+		$this->template->SetTag("stage_title", LANINS_022);
+		$page_info = nl2br(LANINS_023);
+		$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+		$output = "
+			<br /><br />
+			<div style='width: 100%; padding-left: auto; padding-right: auto;'>
+			  <table cellspacing='0'>
+			    <tr>
+			      <td style='border-top: 1px solid #999;' class='row-border'><label for='server'>".LANINS_024."</label></td>
+			      <td style='border-top: 1px solid #999;' class='row-border'><input class='tbox' type='text' id='server' name='server' size='40' value='localhost' maxlength='100' /></td>
+				  <td style='width: 40%; border-top: 1px solid #999;' class='row-border'>".LANINS_030."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='name'>".LANINS_025."</label></td>
+			      <td class='row-border'><input class='tbox' type='text' name='name' id='name' size='40' value='' maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_031."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='password'>".LANINS_026."</label></td>
+			      <td class='row-border'><input class='tbox' type='password' name='password' size='40' id='password' value='' maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_032."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='db'>".LANINS_027."</label></td>
+			      <td class='row-border'><input type='text' name='db' size='20' id='db' value='' maxlength='100' />
+			      <label class='defaulttext'><input type='checkbox' name='createdb' value='1' />".LANINS_028."</label></td>
+				  <td class='row-border'>".LANINS_033."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='prefix'>".LANINS_029."</label></td>
+			      <td class='row-border'><input type='text' name='prefix' size='20' id='prefix' value='e107_'  maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_034."</td>
+			    </tr>
+			  </table>
+			</div>
+			<br /><br />\n";
+		$e_forms->add_plain_html($output);
+		$this->finish_form();
+		$e_forms->add_button("submit", LANINS_035);
+		$this->template->SetTag("stage_content", $page_info.$e_forms->return_form());
+	}
+
+	function stage_3(){
+		global $e_forms;
+		$this->stage = 3;
+		$this->get_lan_file();
+		$this->template->SetTag("installation_heading", LANINS_001);
+		$this->template->SetTag("stage_pre", LANINS_002);
+		$this->template->SetTag("stage_num", LANINS_036);
+		$this->previous_steps['mysql']['server'] = $_POST['server'];
+		$this->previous_steps['mysql']['user'] = $_POST['name'];
+		$this->previous_steps['mysql']['password'] = $_POST['password'];
+		$this->previous_steps['mysql']['db'] = $_POST['db'];
+		$this->previous_steps['mysql']['createdb'] = (isset($_POST['createdb']) && $_POST['createdb'] == true ? true : false);
+		$this->previous_steps['mysql']['prefix'] = $_POST['prefix'];
+		if($this->previous_steps['mysql']['server'] == "" || $this->previous_steps['mysql']['user'] == "" | $this->previous_steps['mysql']['db'] == "") {
+			$this->stage = 3;
+			$this->template->SetTag("stage_num", LANINS_021);
+			$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+			$head = LANINS_039."<br /><br />\n";
+			$output = "
+			<br /><br />
+			<div style='width: 100%; padding-left: auto; padding-right: auto;'>
+			  <table cellspacing='0'>
+			    <tr>
+			      <td style='border-top: 1px solid #999;' class='row-border'><label for='server'>".LANINS_024."</label></td>
+			      <td style='border-top: 1px solid #999;' class='row-border'><input class='tbox' type='text' id='server' name='server' size='40' value='{$this->previous_steps['mysql']['server']}' maxlength='100' /></td>
+				  <td style='width: 40%; border-top: 1px solid #999;' class='row-border'>".LANINS_030."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='name'>".LANINS_025."</label></td>
+			      <td class='row-border'><input class='tbox' type='text' name='name' id='name' size='40' value='{$this->previous_steps['mysql']['user']}' maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_031."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='password'>".LANINS_026."</label></td>
+			      <td class='row-border'><input class='tbox' type='password' name='password' id='password' size='40' value='{$this->previous_steps['mysql']['password']}' maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_032."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='db'>".LANINS_027."</label></td>
+			      <td class='row-border'><input type='text' name='db' id='db' size='20' value='{$this->previous_steps['mysql']['db']}' maxlength='100' />
+			        <label class='defaulttext'><input type='checkbox' name='createdb'".($this->previous_steps['mysql']['createdb'] == 1 ? " checked='checked'" : "")." value='1' />".LANINS_028."</label></td>
+				  <td class='row-border'>".LANINS_033."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='prefix'>".LANINS_029."</label></td>
+			      <td class='row-border'><input type='text' name='prefix' id='prefix' size='20' value='{$this->previous_steps['mysql']['prefix']}'  maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_034."</td>
+			    </tr>
+			  </table>
+			</div>
+			<br /><br />\n";
+			$e_forms->add_plain_html($output);
+			$e_forms->add_button("submit", LANINS_035);
+			$this->template->SetTag("stage_title", LANINS_040);
+		} else {
+			$success = true;
+			$this->template->SetTag("stage_title", LANINS_037.($this->previous_steps['mysql']['createdb'] == 1 ? LANINS_038 : ""));
+			if (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password'])) {
+				$success = false;
+				$page_content = LANINS_041.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
+			} else {
+				$page_content = LANINS_042;
+				if($this->previous_steps['mysql']['createdb'] == 1) {
+					if (!mysql_query("CREATE DATABASE ".$this->previous_steps['mysql']['db'])) {
+						$success = false;
+						$page_content .= "<br /><br />".LANINS_043.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
+					} else {
+						$page_content .= "<br /><br />".LANINS_044;
+					}
+				}
+			}
+			if($success){
+				$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+				$page_content .= "<br /><br />".LANINS_045."<br /><br />";
+				$e_forms->add_button("submit", LANINS_035);
+			}
+			$head = $page_content;
+		}
+		$this->finish_form();
+		$this->template->SetTag("stage_content", $head.$e_forms->return_form());
+	}
+
+	function stage_4(){
+		global $e_forms;
+		$this->stage = 4;
+		$this->get_lan_file();
+		$this->template->SetTag("installation_heading", LANINS_001);
+		$this->template->SetTag("stage_pre", LANINS_002);
+		$this->template->SetTag("stage_num", LANINS_007);
+		$this->template->SetTag("stage_title", LANINS_008);
+		$not_writable = $this->check_writable_perms();
+		$version_fail = false;
+		$perms_errors = "";
+		if(count($not_writable)) {
+			$perms_pass = false;
+			foreach ($not_writable as $file) {
+				$perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n";
+			}
+			$perms_notes = LANINS_018;
+		} else {
+			$perms_pass = true;
+			$perms_errors = "&nbsp;";
+			$perms_notes = LANINS_017;
+		}
+		if(!function_exists("mysql_connect")) {
+			$version_fail = true;
+			$mysql_note = LANINS_011;
+			$mysql_help = LANINS_012;
+		} elseif (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password'])) {
+			$mysql_note = LANINS_011;
+			$mysql_help = LANINS_013;
+		} else {
+			$mysql_note = mysql_get_server_info();
+			$mysql_help = LANINS_017;
+		}
+		if(!function_exists("utf8_encode")) {
+			$xml_installed = false;
+		} else {
+			$xml_installed = true;
+		}
+
+		$php_version = phpversion();
+		if(version_compare($php_version, $this->required_php, ">=")) {
+			$php_help = LANINS_017;
+		} else {
+			$php_help = LANINS_019;
+		}
+		$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+		if(!$perms_pass) {
+			$e_forms->add_button("retest_perms", LANINS_009);
+			$this->stage = 3; // make the installer jump back a step
+		} elseif ($perms_pass && !$version_fail && $xml_installed) {
+			$e_forms->add_button("continue_install", LANINS_020);
+		}
+		$output = "
+			<table style='width: 100%; margin-left: auto; margin-right: auto;'>
+			  <tr>
+			    <td style='width: 20%;'>".LANINS_014."</td>
+			    <td style='width: 40%;'>{$perms_errors}</td>
+			    <td style='width: 40%;'>{$perms_notes}</td>
+			  </tr>
+			  <tr>
+			    <td>".LANINS_015."</td>
+			    <td>{$php_version}</td>
+			    <td>{$php_help}</td>
+			  </tr>
+			  <tr>
+			    <td>".LANINS_016."</td>
+			    <td>{$mysql_note}</td>
+			    <td>{$mysql_help}</td>
+			  </tr>
+			  <tr>
+			    <td>".LANINS_050."</td>
+			    <td>".($xml_installed ? LANINS_051 : LANINS_052)."</td>
+			    <td>".($xml_installed ? LANINS_017 : LANINS_053."<a href='http://php.net/manual/en/ref.xml.php' target='_blank'>php.net</a>".LANINS_054)."</td>
+			  </tr>
+			</table>\n<br /><br />\n\n";
+		$this->finish_form();
+		$this->template->SetTag("stage_content", $output.$e_forms->return_form());
+	}
+
+
+
+	function stage_5(){
+		global $e_forms;
+		$this->stage = 5;
+		$this->get_lan_file();
+		$this->template->SetTag("installation_heading", LANINS_001);
+		$this->template->SetTag("stage_pre", LANINS_002);
+		$this->template->SetTag("stage_num", LANINS_046);
+		$this->template->SetTag("stage_title", LANINS_047);
+		$e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+		$output = "
+			<div style='width: 100%; padding-left: auto; padding-right: auto;'>
+			  <table cellspacing='0'>
+			    <tr>
+			      <td class='row-border'><label for='u_name'>".LANINS_072."</label></td>
+			      <td class='row-border'><input class='tbox' type='text' name='u_name' id='u_name' size='30' value='".(isset($this->previous_steps['admin']['user']) ? $this->previous_steps['admin']['user'] : "")."' maxlength='60' /></td>
+				  <td class='row-border'>".LANINS_073."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='d_name'>".LANINS_074."</label></td>
+			      <td class='row-border'><input class='tbox' type='text' name='d_name' id='d_name' size='30' value='".(isset($this->previous_steps['admin']['display']) ? $this->previous_steps['admin']['display'] : "")."' maxlength='60' /></td>
+				  <td class='row-border'>".LANINS_075."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='pass1'>".LANINS_076."</label></td>
+			      <td class='row-border'><input type='password' name='pass1' size='30' id='pass1' value='' maxlength='60' /></td>
+				  <td class='row-border'>".LANINS_077."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='pass2'>".LANINS_078."</label></td>
+			      <td class='row-border'><input type='password' name='pass2' size='30' id='pass2' value='' maxlength='60' /></td>
+				  <td class='row-border'>".LANINS_079."</td>
+			    </tr>
+			    <tr>
+			      <td class='row-border'><label for='email'>".LANINS_080."</label></td>
+			      <td class='row-border'><input type='text' name='email' size='30' id='email' value='".(isset($this->previous_steps['admin']['email']) ? $this->previous_steps['admin']['email'] : LANINS_082)."' maxlength='100' /></td>
+				  <td class='row-border'>".LANINS_081."</td>
+			    </tr>
+			  </table>
+			</div>
+			<br /><br />\n";
+		$e_forms->add_plain_html($output);
+		$this->finish_form();
+		$e_forms->add_button("submit", LANINS_035);
+		$this->template->SetTag("stage_content", $e_forms->return_form());
+	}
+
+	function stage_6(){
+		global $e_forms;
+		$this->get_lan_file();
+		$this->stage = 6;
+
+		$_POST['u_name'] = str_replace(array("'", '"'), "", $_POST['u_name']);
+		$_POST['d_name'] = str_replace(array("'", '"'), "", $_POST['d_name']);
+
+		$this->previous_steps['admin']['user'] = $_POST['u_name'];
+		if ($_POST['d_name'] == "") {
+			$this->previous_steps['admin']['display'] = $_POST['u_name'];
+		} else {
+			$this->previous_steps['admin']['display'] = $_POST['d_name'];
+		}
+		$this->previous_steps['admin']['email'] = $_POST['email'];
+		$this->previous_steps['admin']['password'] = $_POST['pass1'];
+
+		if(trim($_POST['u_name']) == "" || trim($_POST['email']) == "" || trim($_POST['pass1']) == "") {
+			$this->template->SetTag("installation_heading", LANINS_001);
+			$this->template->SetTag("stage_num", LANINS_046);
+			$this->template->SetTag("stage_pre", LANINS_002);
+			$this->template->SetTag("stage_title", LANINS_047);
+			$e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+			$page = LANINS_086."<br />".($_SERVER['QUERY_STRING'] == "debug" ? print_a($_POST, true) : "")."<br />";
+
+			$this->finish_form(5);
+			$e_forms->add_button("submit", LANINS_048);
+		} elseif($_POST['pass1'] != $_POST['pass2']) {
+			$this->template->SetTag("installation_heading", LANINS_001);
+			$this->template->SetTag("stage_num", LANINS_046);
+			$this->template->SetTag("stage_pre", LANINS_002);
+			$this->template->SetTag("stage_title", LANINS_047);
+			$e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+			$page = LANINS_049."<br />".($_SERVER['QUERY_STRING'] == "debug" ? print_a($_POST, true) : "")."<br />";
+
+			$this->finish_form(5);
+			$e_forms->add_button("submit", LANINS_048);
+		} else {
+
+			$this->template->SetTag("installation_heading", LANINS_001);
+			$this->template->SetTag("stage_pre", LANINS_002);
+			$this->template->SetTag("stage_num", LANINS_056);
+			$this->template->SetTag("stage_title", LANINS_055);
+
+			$e_forms->start_form("confirmation", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
+			$page = nl2br(LANINS_057);
+			$this->finish_form();
+			$e_forms->add_button("submit", LANINS_035);
+		}
+
+		$this->template->SetTag("stage_content", $page.$e_forms->return_form());
+	}
+
+	function stage_7(){
+		global $e_forms;
+		$this->get_lan_file();
+
+		$this->stage = 7;
+
+		$this->template->SetTag("installation_heading", LANINS_001);
+		$this->template->SetTag("stage_pre", LANINS_002);
+		$this->template->SetTag("stage_num", LANINS_058);
+		$this->template->SetTag("stage_title", LANINS_071);
+
+		$config_file = "<?php
+
+/*
++----------------------------------------------------+
+|   e107 website system
+|   e107_config.php
+|
+|   ©Steve Dunstan 2001-2002
+|   http://e107.org
+|   jalist@e107.org
+|
+|   Released under the terms and conditions of the
+|   GNU General Public License (http://gnu.org).
++----------------------------------------------------+
+This file has been generated by the installation script.
+*/
+
+\$mySQLserver    = '{$this->previous_steps['mysql']['server']}';
+\$mySQLuser      = '{$this->previous_steps['mysql']['user']}';
+\$mySQLpassword  = '{$this->previous_steps['mysql']['password']}';
+\$mySQLdefaultdb = '{$this->previous_steps['mysql']['db']}';
+\$mySQLprefix    = '{$this->previous_steps['mysql']['prefix']}';
+
+\$ADMIN_DIRECTORY     = \"{$this->e107->e107_dirs['ADMIN_DIRECTORY']}\";
+\$FILES_DIRECTORY     = \"{$this->e107->e107_dirs['FILES_DIRECTORY']}\";
+\$IMAGES_DIRECTORY    = \"{$this->e107->e107_dirs['IMAGES_DIRECTORY']}\";
+\$THEMES_DIRECTORY    = \"{$this->e107->e107_dirs['THEMES_DIRECTORY']}\";
+\$PLUGINS_DIRECTORY   = \"{$this->e107->e107_dirs['PLUGINS_DIRECTORY']}\";
+\$HANDLERS_DIRECTORY  = \"{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}\";
+\$LANGUAGES_DIRECTORY = \"{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}\";
+\$HELP_DIRECTORY      = \"{$this->e107->e107_dirs['HELP_DIRECTORY']}\";
+\$DOWNLOADS_DIRECTORY = \"{$this->e107->e107_dirs['DOWNLOADS_DIRECTORY']}\";
+
+?>";
+
+		$config_result = $this->write_config($config_file);
+		$e_forms->start_form("confirmation", "index.php");
+		if ($config_result) {
+			$page = $config_result."<br />";
+		} else {
+			$errors = $this->create_tables();
+			if ($errors == true) {
+				$page = $errors."<br />";
+			} else {
+				$page = nl2br(LANINS_069)."<br />";
+				$e_forms->add_button("submit", LANINS_035);
+			}
+		}
+		$this->finish_form();
+		$this->template->SetTag("stage_content", $page.$e_forms->return_form());
+	}
+
+	function get_lan_file(){
+		if(!isset($this->previous_steps['language'])) {
+			$this->previous_steps['language'] = "English";
+		}
+		$this->lan_file = "{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$this->previous_steps['language']}/lan_installer.php";
+		if(is_readable($this->lan_file)){
+			include($this->lan_file);
+		} elseif(is_readable("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php")) {
+			include("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php");
+		} else {
+			$this->raise_error("Fatal: Could not get valid language file for installation.");
+		}
+	}
+
+	function get_languages() {
+		$handle = opendir("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}");
+		while ($file = readdir($handle)) {
+			if ($file != "." && $file != ".." && $file != "/" && $file != "CVS") {
+				if(file_exists("./{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$file}/lan_installer.php")){
+					$lanlist[] = $file;
+				}
+			}
+		}
+		closedir($handle);
+		return $lanlist;
+	}
+
+	function finish_form($force_stage = false) {
+		global $e_forms;
+		if($this->previous_steps) {
+			$e_forms->add_hidden_data("previous_steps", base64_encode(serialize($this->previous_steps)));
+		}
+		$e_forms->add_hidden_data("stage", ($force_stage ? $force_stage : ($this->stage + 1)));
+	}
+
+	function check_writable_perms(){
+		$bad_files = array();
+		$data = 'e107_config.php|{$FILES_DIRECTORY}cache/|{$FILES_DIRECTORY}public/|{$FILES_DIRECTORY}public/avatars/|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
+		foreach ($this->e107->e107_dirs as $dir_name => $value) {
+			$find[] = "{\${$dir_name}}";
+			$replace[] = "./$value";
+		}
+		$data = str_replace($find, $replace, $data);
+		$files = explode("|", trim($data));
+		foreach ($files as $file) {
+			if(!is_writable($file)) {
+				$bad_files[] = str_replace("./", "", $file);
+			}
+		}
+		return $bad_files;
+	}
+
+	function create_tables() {
+
+		$link = mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']);
+		if(!$link) {
+			return nl2br(LANINS_084."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
+		}
+
+		$db_selected = mysql_select_db($this->previous_steps['mysql']['db'], $link);
+		if(!$db_selected) {
+			return nl2br(LANINS_085." '{$this->previous_steps['mysql']['db']}'\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
+		}
+
+		$filename = "{$this->e107->e107_dirs['ADMIN_DIRECTORY']}sql/core_sql.php";
+		$fd = fopen ($filename, "r");
+		$sql_data = fread($fd, filesize($filename));
+		fclose ($fd);
+
+		if (!$sql_data) {
+			return nl2br(LANINS_060)."<br /><br />";
+		}
+
+		preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
+
+		foreach ($result[0] as $sql_table) {
+			preg_match("/CREATE TABLE\s(.*?)\s\(/si", $sql_table, $match);
+			$tablename = $match[1];
+			preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
+			$sql_table = preg_replace("/create table\s/si", "CREATE TABLE {$this->previous_steps['mysql']['prefix']}", $sql_table);
+			if (!mysql_query($sql_table, $link)) {
+				return nl2br(LANINS_061."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
+			}
+		}
+
+		$datestamp = time();
+
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}news VALUES (0, '".LANINS_063."', '".LANINS_062."', '', '{$datestamp}', '0', '1', 1, 0, 0, 0, 0, '0', '', 'welcome.png', 0) ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}news_category VALUES (0, '".LANINS_087."', 'icon26.png') ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_088."', 'index.php', '', '', 1, 1, 0, 0, 0) ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_089."', 'download.php', '', '', 1, 2, 0, 0, 0) ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_090."', 'user.php', '', '', 1, 3, 0, 0, 0) ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_091."', 'submitnews.php', '', '', 1, 4, 0, 0, 0) ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_092."', 'contact.php', '', '', 1, 5, 0, 0, 0) ");
+
+		$udirs = "admin/|plugins/|temp";
+		$e_SELF = $_SERVER['PHP_SELF'];
+		$e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/");
+
+		$pref_language = isset($this->previous_steps['language']) ? $this->previous_steps['language'] : "English";
+
+		if (file_exists($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php")) {
+			include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php");
+		} else {
+			include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY']."English/lan_prefs.php");
+		}
+
+		$site_admin_user = $this->previous_steps['admin']['display'];
+		$site_admin_email = $this->previous_steps['admin']['email'];
+
+		require_once("{$this->e107->e107_dirs['FILES_DIRECTORY']}def_e107_prefs.php");
+
+		include_once("{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}arraystorage_class.php");
+
+		$tmp = ArrayData::WriteArray($pref);
+
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('SitePrefs', '{$tmp}')");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('SitePrefs_Backup', '{$tmp}')");
+
+		$emote = 'a:60:{i:0;a:1:{s:2:"&|";s:7:"cry.png";}i:1;a:1:{s:3:"&-|";s:7:"cry.png";}i:2;a:1:{s:3:"&o|";s:7:"cry.png";}i:3;a:1:{s:3:":((";s:7:"cry.png";}i:4;a:1:{s:3:"~:(";s:7:"mad.png";}i:5;a:1:{s:4:"~:o(";s:7:"mad.png";}i:6;a:1:{s:4:"~:-(";s:7:"mad.png";}i:7;a:1:{s:2:":)";s:9:"smile.png";}i:8;a:1:{s:3:":o)";s:9:"smile.png";}i:9;a:1:{s:3:":-)";s:9:"smile.png";}i:10;a:1:{s:2:":(";s:9:"frown.png";}i:11;a:1:{s:3:":o(";s:9:"frown.png";}i:12;a:1:{s:3:":-(";s:9:"frown.png";}i:13;a:1:{s:2:":D";s:8:"grin.png";}i:14;a:1:{s:3:":oD";s:8:"grin.png";}i:15;a:1:{s:3:":-D";s:8:"grin.png";}i:16;a:1:{s:2:":?";s:12:"confused.png";}i:17;a:1:{s:3:":o?";s:12:"confused.png";}i:18;a:1:{s:3:":-?";s:12:"confused.png";}i:19;a:1:{s:3:"%-6";s:11:"special.png";}i:20;a:1:{s:2:"x)";s:8:"dead.png";}i:21;a:1:{s:3:"xo)";s:8:"dead.png";}i:22;a:1:{s:3:"x-)";s:8:"dead.png";}i:23;a:1:{s:2:"x(";s:8:"dead.png";}i:24;a:1:{s:3:"xo(";s:8:"dead.png";}i:25;a:1:{s:3:"x-(";s:8:"dead.png";}i:26;a:1:{s:2:":@";s:7:"gah.png";}i:27;a:1:{s:3:":o@";s:7:"gah.png";}i:28;a:1:{s:3:":-@";s:7:"gah.png";}i:29;a:1:{s:2:":!";s:8:"idea.png";}i:30;a:1:{s:3:":o!";s:8:"idea.png";}i:31;a:1:{s:3:":-!";s:8:"idea.png";}i:32;a:1:{s:2:":|";s:11:"neutral.png";}i:33;a:1:{s:3:":o|";s:11:"neutral.png";}i:34;a:1:{s:3:":-|";s:11:"neutral.png";}i:35;a:1:{s:2:"?!";s:12:"question.png";}i:36;a:1:{s:2:"B)";s:12:"rolleyes.png";}i:37;a:1:{s:3:"Bo)";s:12:"rolleyes.png";}i:38;a:1:{s:3:"B-)";s:12:"rolleyes.png";}i:39;a:1:{s:2:"8)";s:10:"shades.png";}i:40;a:1:{s:3:"8o)";s:10:"shades.png";}i:41;a:1:{s:3:"8-)";s:10:"shades.png";}i:42;a:1:{s:2:":O";s:12:"suprised.png";}i:43;a:1:{s:3:":oO";s:12:"suprised.png";}i:44;a:1:{s:3:":-O";s:12:"suprised.png";}i:45;a:1:{s:2:":p";s:10:"tongue.png";}i:46;a:1:{s:3:":op";s:10:"tongue.png";}i:47;a:1:{s:3:":-p";s:10:"tongue.png";}i:48;a:1:{s:2:":P";s:10:"tongue.png";}i:49;a:1:{s:3:":oP";s:10:"tongue.png";}i:50;a:1:{s:3:":-P";s:10:"tongue.png";}i:51;a:1:{s:2:";)";s:8:"wink.png";}i:52;a:1:{s:3:";o)";s:8:"wink.png";}i:53;a:1:{s:3:";-)";s:8:"wink.png";}i:54;a:1:{s:4:"!ill";s:7:"ill.png";}i:55;a:1:{s:7:"!amazed";s:10:"amazed.png";}i:56;a:1:{s:4:"!cry";s:7:"cry.png";}i:57;a:1:{s:6:"!dodge";s:9:"dodge.png";}i:58;a:1:{s:6:"!alien";s:9:"alien.png";}i:59;a:1:{s:6:"!heart";s:9:"heart.png";}}';
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('emote', '{$emote}') ");
+
+		// Set up the menu prefs so they can be 'lanned'
+		$new_block = Array ( 
+				'comment_caption' 		=> LANINS_096,		// 'Latest Comments'
+				'comment_display' 		=> '10',
+				'comment_characters' 	=> '50',
+				'comment_postfix' 		=> LANINS_097,		// '[more ...]'
+				'comment_title' 		=> 0,
+				'article_caption' 		=> LANINS_098,		// 'Articles'
+				'articles_display' 		=> '10',
+				'articles_mainlink' 	=> LANINS_099,		// 'Articles Front Page ...'
+				'newforumposts_caption' => LANINS_100,		// 'Latest Forum Posts'
+				'newforumposts_display' => '10',
+				'forum_no_characters' 	=> '20',
+				'forum_postfix' 		=> LANINS_097,		// '[more ...]'
+				'update_menu' 			=> LANINS_101,		// 'Update menu Settings'
+				'forum_show_topics' 	=> '1',
+				'newforumposts_characters' => '50',
+				'newforumposts_postfix' => LANINS_097,		// '[more ...]'
+				'newforumposts_title' 	=> 0,
+				'clock_caption' 		=> LANINS_102,		// 'Date / Time'
+				'reviews_caption'		=> LANINS_103,		// 'Reviews'
+				'reviews_display'		=> '10',
+				'reviews_parents'		=> '1',
+				'reviews_mainlink'		=> LANINS_104,		// 'Review Front Page ...'
+				'articles_parents' 		=> '1' 
+				);
+
+		$menu_conf = serialize($new_block);
+//		$menu_conf = 'a:23:{s:15:"comment_caption";s:15:"Latest Comments";s:15:"comment_display";s:2:"10";s:18:"comment_characters";s:2:"50";s:15:"comment_postfix";s:12:"[ more ... ]";s:13:"comment_title";i:0;s:15:"article_caption";s:8:"Articles";s:16:"articles_display";s:2:"10";s:17:"articles_mainlink";s:23:"Articles Front Page ...";s:21:"newforumposts_caption";s:18:"Latest Forum Posts";s:21:"newforumposts_display";s:2:"10";s:19:"forum_no_characters";s:2:"20";s:13:"forum_postfix";s:10:"[more ...]";s:11:"update_menu";s:20:"Update menu Settings";s:17:"forum_show_topics";s:1:"1";s:24:"newforumposts_characters";s:2:"50";s:21:"newforumposts_postfix";s:10:"[more ...]";s:19:"newforumposts_title";i:0;s:13:"clock_caption";s:11:"Date / Time";s:15:"reviews_caption";s:7:"Reviews";s:15:"reviews_display";s:2:"10";s:15:"reviews_parents";s:1:"1";s:16:"reviews_mainlink";s:21:"Review Front Page ...";s:16:"articles_parents";s:1:"1";}';
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('menu_pref', '{$menu_conf}') ");
+
+		preg_match("/^(.*?)($|-)/", mysql_get_server_info(), $mysql_version);
+		if (version_compare($mysql_version[1], '4.0.1', '<')) {
+			$search_prefs = 'a:12:{s:11:\"user_select\";s:1:\"1\";s:9:\"time_secs\";s:2:\"60\";s:13:\"time_restrict\";s:1:\"0\";s:8:\"selector\";s:1:\"2\";s:9:\"relevance\";s:1:\"0\";s:13:\"plug_handlers\";N;s:10:\"mysql_sort\";b:0;s:11:\"multisearch\";s:1:\"1\";s:6:\"google\";s:1:\"0\";s:13:\"core_handlers\";a:5:{s:4:\"news\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"1\";}s:8:\"comments\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"2\";}s:5:\"users\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"3\";}s:9:\"downloads\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"4\";}s:5:\"pages\";a:6:{s:5:\"class\";s:1:\"0\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"order\";s:1:\"5\";}}s:17:\"comments_handlers\";a:2:{s:4:\"news\";a:3:{s:2:\"id\";i:0;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}s:8:\"download\";a:3:{s:2:\"id\";i:2;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}}s:9:\"php_limit\";s:0:\"\";}';
+		} else {
+			$search_prefs = 'a:12:{s:11:\"user_select\";s:1:\"1\";s:9:\"time_secs\";s:2:\"60\";s:13:\"time_restrict\";s:1:\"0\";s:8:\"selector\";s:1:\"2\";s:9:\"relevance\";s:1:\"0\";s:13:\"plug_handlers\";N;s:10:\"mysql_sort\";b:1;s:11:\"multisearch\";s:1:\"1\";s:6:\"google\";s:1:\"0\";s:13:\"core_handlers\";a:5:{s:4:\"news\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"1\";}s:8:\"comments\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"2\";}s:5:\"users\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"3\";}s:9:\"downloads\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"4\";}s:5:\"pages\";a:6:{s:5:\"class\";s:1:\"0\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"order\";s:1:\"5\";}}s:17:\"comments_handlers\";a:2:{s:4:\"news\";a:3:{s:2:\"id\";i:0;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}s:8:\"download\";a:3:{s:2:\"id\";i:2;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}}s:9:\"php_limit\";s:0:\"\";}';
+		}
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('search_prefs', '{$search_prefs}') ");
+
+		$notify_prefs = mysql_escape_string("array ('event' => array ('usersup' => array ('type' => 'off', 'class' => '254', 'email' => '',),'userveri' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'login' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'logout' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'flood' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'subnews' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'newspost' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'newsupd' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'newsdel' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), ), )");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('notify_prefs', '{$notify_prefs}') ");
+
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}banner VALUES (0, 'e107', 'e107login', 'e107password', 'banner1.png', 'http://e107.org', 0, 0, 0, 0, 0, 0, '', 'campaign_one') ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}banner VALUES (0, 'e107', 'e107login', 'e107password', 'banner2.png', 'http://e107.org', 0, 0, 0, 0, 0, 0, '', 'campaign_one') ");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}banner VALUES (0, 'e107', 'e107login', 'e107password', 'banner3.png', 'http://e107.org', 0, 0, 0, 0, 0, 0, '', 'campaign_one') ");
+
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (1, 'login_menu', 1, 1, '0', '', 'login_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (3, 'online_menu', 0, 0, '0', '', 'online_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (4, 'blogcalendar_menu', 0, 0, '0', '', 'blogcalendar_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (5, 'tree_menu', 0, 0, '0', '', 'tree_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (6, 'search_menu', 0, 0, '0', '', 'search_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (7, 'compliance_menu', 0, 0, '0', '', 'compliance_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (8, 'userlanguage_menu', 0, 0, '0', '', 'userlanguage_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (9, 'powered_by_menu', 2, 2, '0', '', 'powered_by_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (10, 'counter_menu', 0, 0, '0', '', 'counter_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (11, 'usertheme_menu', 0, 0, '0', '', 'usertheme_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (12, 'banner_menu', 0, 0, '0', '', 'banner_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (13, 'online_extended_menu', 2, 1, '0', '', 'online_extended_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (14, 'clock_menu', 0, 0, '0', '', 'clock_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (15, 'sitebutton_menu', 0, 0, '0', '', 'sitebutton_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (16, 'comment_menu', 0, 0, '0', '', 'comment_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (17, 'lastseen_menu', 0, 0, '0', '', 'lastseen/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (18, 'other_news_menu', 0, 0, '0', '', 'other_news_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (19, 'other_news2_menu', 0, 0, '0', '', 'other_news_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (20, 'admin_menu', 0, 0, '0', '', 'admin_menu/')");
+//		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (21, 'rss_menu', 5, 1, '0', '', 'rss_menu/')");
+		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (22, 'PCMag', 3, 1, '0', '', '1')");
+
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}userclass_classes VALUES (1, 'PRIVATEMENU', '".LANINS_093."',".e_UC_ADMIN.")");
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}userclass_classes VALUES (2, 'PRIVATEFORUM1', '".LANINS_094."',".e_UC_ADMIN.")");
+//		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}plugin VALUES (0, '".LANINS_095."', '0.03', 'Integrity Check', 1, '') ");
+
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}generic VALUES (0, 'wmessage', 1145848343, 1, '', 0, '[center]<img src=&#039;{e_IMAGE}splash.jpg&#039; style=&#039;width: 412px; height: 275px&#039; alt=&#039;&#039; />[/center]')");
+
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}page VALUES (1, '', '[img]{e_IMAGE}pcmag.png[/img] ', 0, 1145843485, 0, 0, '', '', '', 'PCMag')");
+
+		// Create the admin user
+		$ip = $_SERVER['REMOTE_ADDR'];
+		$userp = "1, '{$this->previous_steps['admin']['display']}', '{$this->previous_steps['admin']['user']}', '', '".md5($this->previous_steps['admin']['password'])."', '', '{$this->previous_steps['admin']['email']}', '', '', '', 0, ".time().", 0, 0, 0, 0, 0, 0, '{$ip}', 0, '', '', '', 0, 1, '', '', '0', '', ".time().", ''";
+		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}user VALUES ({$userp})" );
+		mysql_close();
+
+		return false;
+	}
+
+	function write_config($data) {
+		$fp = @fopen("e107_config.php", "w");
+		if (!@fwrite($fp, $data)) {
+			@fclose ($fp);
+			return nl2br(LANINS_070);
+		}
+		@fclose ($fp);
+		return false;
+	}
+}
+
+class e_forms {
+
+	var $form;
+	var $opened;
+
+	function start_form($id, $action, $method = "post" ) {
+		$this->form = "\n<form method='{$method}' id='{$id}' action='{$action}'>\n";
+		$this->opened = true;
+	}
+
+	function add_select_item($id, $labels, $selected) {
+		$this->form .= "
+		<select name='{$id}' id='{$id}'>\n";
+		foreach ($labels as $label) {
+			$this->form .= "<option".($label == $selected ? " selected='selected'" : "").">{$label}</option>\n";
+		}
+		$this->form .= "</select>\n";
+	}
+
+	function add_button($id, $title, $align = "right", $type = "submit") {
+		$this->form .= "<div style='text-align: {$align}; z-index: 10;'><input type='{$type}' id='{$id}' value='{$title}' /></div>\n";
+	}
+
+	function add_hidden_data($id, $data) {
+		$this->form .= "<input type='hidden' name='{$id}' value='{$data}' />\n";
+	}
+
+	function add_plain_html($html_data) {
+		$this->form .= $html_data;
+	}
+
+	function return_form() {
+		if($this->opened == true) {
+			$this->form .= "</form>\n";
+		}
+		$this->opened = false;
+		return $this->form;
+	}
+}
+
+class SimpleTemplate {
+
+	var $Tags = array();
+	var $open_tag = "{";
+	var $close_tag = "}";
+
+	function SimpleTemplate() {
+		define("TEMPLATE_TYPE_FILE", 0);
+		define("TEMPLATE_TYPE_DATA", 1);
+	}
+
+	function SetTag($TagName, $Data) {
+		$this->Tags[$TagName] = array(	'Tag'  => $TagName,
+		'Data' => $Data
+		);
+	}
+
+	function RemoveTag($TagName) {
+		unset($this->Tags[$TagName]);
+	}
+
+	function ClearTags() {
+		$this->Tags = array();
+	}
+
+	function ParseTemplate($Template, $template_type = TEMPLATE_TYPE_FILE) {
+		if($template_type == TEMPLATE_TYPE_DATA) {
+			$TemplateData = $Template;
+		} else {
+			$TemplateData = file_get_contents($Template);
+		}
+		foreach ($this->Tags as $Tag) {
+			$TemplateData = str_replace($this->open_tag.$Tag['Tag'].$this->close_tag, $Tag['Data'], $TemplateData);
+		}
+		return $TemplateData;
+	}
+}
+
+function template_data() {
+	$data = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
+<html xmlns=\"http://www.w3.org/1999/xhtml\">
+<head>
+<title>{installation_heading}</title>
+<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />
+<meta http-equiv=\"content-style-type\" content=\"text/css\" />
+<link rel=\"stylesheet\" href=\"{installer_css_http}\" type=\"text/css\" />
+</head>
+<body>
+<!-- Installer theme is a ripped version of 'Leaf' by Que, based on the nucleus cms theme by Ivan Fong aka Stanch. -->
+<div id=\"header\">
+  <h1>{installation_heading}</h1>
+</div>
+<div id=\"wrapper\">
+  <div id=\"container\">
+    <div id=\"content\">
+      <div class=\"contentbody\">
+        <h3>{stage_pre}{stage_num} - {stage_title}</h3>
+		<br />
+        <p>{stage_content}</p>
+		{debug_info}
+      </div>
+    </div>
+  </div>
+  <div class=\"clearing\">&nbsp;</div>
+</div>
+<div id=\"footer\">&nbsp;</div>
+
+</body>
+</html>";
+	return $data;
+}
+
+function get_object($name) {
+	switch ($name) {
+		case "stylesheet";
+		header("Content-type: text/css");
+		echo "#container{
+	float:left;
+	margin-right : -230px;
+	width : 670px;
+}
+#content{
+margin: 15px 0px 0px -15px;
+}
+#footer{
+	background : url({$_SERVER['PHP_SELF']}?object=01_footer.jpg) top no-repeat;
+	margin : auto;
+	padding : 20px 0 0 0;
+	width : 700px;
+}
+#header h1{
+	font-size : 20px;
+	left : 18px;
+	line-height : 20px;
+	margin : 0;
+	position : absolute;
+	top : 17px;
+}
+#header{
+	background : url({$_SERVER['PHP_SELF']}?object=01_header01.jpg) no-repeat;
+	height : 151px;
+	margin : auto;
+	position : relative;
+	width : 700px;
+}
+#wrapper{
+	background : white url({$_SERVER['PHP_SELF']}?object=01_bodybg.jpg) repeat-y;
+	margin : auto;
+	text-align:left;
+	width : 700px;
+}
+.clearing{
+	clear : both;
+	height : 0;
+}
+.contentbody{
+	margin : 0px;
+	padding : 0 5px 20px 43px;
+}
+a:hover, a:active{
+	color : black;
+}
+a:link, a:visited{
+	color : #23598C;
+	text-decoration : none;
+}
+h1 {
+	color : #23598C;
+}
+body{
+	background : #123454 url(images/01_bg.gif) top repeat-x;
+	color : #4C4C4C;
+	font-family : Trebuchet MS, \"Lucida Sans Unicode\", Arial, Lucida Sans, Tahoma, Sans-Serif;
+	font-size : 13px;
+	padding : 20px 0 20px 0;
+	text-align : center;
+}
+h3{
+	color : #3E565F;
+	font-size : 16px;
+	margin : 0 0 8px 0;
+}
+img{
+	border : none;
+}
+
+.logoimage {
+	padding-left: 600px;
+	padding-top: 65px;
+}
+
+td {
+	vertical-align: top;
+}
+
+.row-border {
+	border-bottom: 1px solid #999;
+	padding: 6px 3px 6px 3px;
+}";
+		break;
+
+		/* The following data is base64 encoded to preserve binary state in ASCII file */
+
+		case "01_footer.jpg":
+			header("Content-type: image/jpeg");
+			echo trim(base64_decode("
+/9j/4AAQSkZJRgABAgEASABIAAD/4QPgRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
+AAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAUAAAAcgEyAAIAAAAUAAAAhodp
+AAQAAAABAAAAnAAAAMgAAABIAAAAAQAAAEgAAAABQWRvYmUgUGhvdG9zaG9wIDcuMAAyMDA1OjAy
+OjI2IDA0OjE2OjUyAAAAAAOgAQADAAAAAf//AACgAgAEAAAAAQAAArygAwAEAAAAAQAAAA0AAAAA
+AAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABFgEbAAUAAAABAAABHgEoAAMAAAABAAIAAAIBAAQA
+AAABAAABJgICAAQAAAABAAACsgAAAAAAAABIAAAAAQAAAEgAAAAB/9j/4AAQSkZJRgABAgEASABI
+AAD/7QAMQWRvYmVfQ00AAv/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwP
+FRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQO
+Dg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEI
+AAIAgAMBIgACEQEDEQH/3QAEAAj/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEF
+AQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMi
+cYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj
+80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcG
+BTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiPBUtHwMyRi4XKCkkNTFWNzNPElBhaisoMHJjXC0kST
+VKMXZEVVNnRl4vKzhMPTdePzRpSkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2JzdHV2d3h5ent8f/
+2gAMAwEAAhEDEQA/ANro3/I+D/y9/R6v5v6H0W/zf/B/6P8A4NXP/rhXgiSkO5WDZ97/APrhS/8A
+rhXgiSSn3v8A+uFL/wCuFeCJJKfe/wD64Uv/AK4V4Ikkp97/APrhS/8ArhXgiSSn3v8A+uFL/wCu
+FeCJJKfe/wD64Uv/AK4V4Ikkp97/APrhQM7+g5P/AIoP5qzn+q5eFpJBRf/Z/+0ImFBob3Rvc2hv
+cCAzLjAAOEJJTQQlAAAAAAAQAAAAAAAAAAAAAAAAAAAAADhCSU0D7QAAAAAAEABIAAAAAQABAEgA
+AAABAAE4QklNBCYAAAAAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAAAHg4QklNBBkAAAAA
+AAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJTScQAAAAAAAKAAEA
+AAAAAAAAAThCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQChmZoABgAAAAAAAQAy
+AAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAAcAAA////////////
+/////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////
+////////////////A+gAAAAA/////////////////////////////wPoAAA4QklNBAAAAAAAAAIA
+ADhCSU0EAgAAAAAAAgAAOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAAAAAABAAA
+AAA4QklNBBoAAAAAA0kAAAAGAAAAAAAAAAAAAAANAAACvAAAAAoAVQBuAHQAaQB0AGwAZQBkAC0A
+NAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACvAAAAA0AAAAAAAAAAAAAAAAAAAAA
+AQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAAB
+AAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9u
+ZwAAAA0AAAAAUmdodGxvbmcAAAK8AAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGlj
+ZQAAABIAAAAHc2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVt
+AAAADEVTbGljZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5
+cGUAAAAASW1nIAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAA
+AAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAANAAAAAFJnaHRsb25nAAACvAAAAAN1cmxU
+RVhUAAAAAQAAAAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RF
+WFQAAAABAAAAAAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJ
+aG9yekFsaWduZW51bQAAAA9FU2xpY2VIb3J6QWxpZ24AAAAHZGVmYXVsdAAAAAl2ZXJ0QWxpZ25l
+bnVtAAAAD0VTbGljZVZlcnRBbGlnbgAAAAdkZWZhdWx0AAAAC2JnQ29sb3JUeXBlZW51bQAAABFF
+U2xpY2VCR0NvbG9yVHlwZQAAAABOb25lAAAACXRvcE91dHNldGxvbmcAAAAAAAAACmxlZnRPdXRz
+ZXRsb25nAAAAAAAAAAxib3R0b21PdXRzZXRsb25nAAAAAAAAAAtyaWdodE91dHNldGxvbmcAAAAA
+ADhCSU0EEQAAAAAAAQEAOEJJTQQUAAAAAAAEAAAAAzhCSU0EDAAAAAACzgAAAAEAAACAAAAAAgAA
+AYAAAAMAAAACsgAYAAH/2P/gABBKRklGAAECAQBIAEgAAP/tAAxBZG9iZV9DTQAC/+4ADkFkb2Jl
+AGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwM
+DAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEM
+DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAAgCAAwEiAAIRAQMRAf/dAAQACP/EAT8A
+AAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoL
+EAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT
+8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2
+xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFC
+I8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE
+1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMRAD8A2ujf8j4P/L39Hq/m
+/ofRb/N/8H/o/wDg1c/+uFeCJKQ7lYNn3v8A+uFL/wCuFeCJJKfe/wD64Uv/AK4V4Ikkp97/APrh
+S/8ArhXgiSSn3v8A+uFL/wCuFeCJJKfe/wD64Uv/AK4V4Ikkp97/APrhS/8ArhXgiSSn3v8A+uFA
+zv6Dk/8Aig/mrOf6rl4WkkFF/9k4QklNBCEAAAAAAFUAAAABAQAAAA8AQQBkAG8AYgBlACAAUABo
+AG8AdABvAHMAaABvAHAAAAATAEEAZABvAGIAZQAgAFAAaABvAHQAbwBzAGgAbwBwACAANwAuADAA
+AAABADhCSU0EBgAAAAAABwAIAAAAAQEA/+ESSGh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8A
+PD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPD9h
+ZG9iZS14YXAtZmlsdGVycyBlc2M9IkNSIj8+Cjx4OnhhcG1ldGEgeG1sbnM6eD0nYWRvYmU6bnM6
+bWV0YS8nIHg6eGFwdGs9J1hNUCB0b29sa2l0IDIuOC4yLTMzLCBmcmFtZXdvcmsgMS41Jz4KPHJk
+ZjpSREYgeG1sbnM6cmRmPSdodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgt
+bnMjJyB4bWxuczppWD0naHR0cDovL25zLmFkb2JlLmNvbS9pWC8xLjAvJz4KCiA8cmRmOkRlc2Ny
+aXB0aW9uIGFib3V0PSd1dWlkOjM4ZWY1NGQ0LTg3ZjAtMTFkOS1hMDM2LWFlYWQ3YjZlYzZhMycK
+ICB4bWxuczp4YXBNTT0naHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyc+CiAgPHhhcE1N
+OkRvY3VtZW50SUQ+YWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjM4ZWY1NGQyLTg3ZjAtMTFkOS1hMDM2
+LWFlYWQ3YjZlYzZhMzwveGFwTU06RG9jdW1lbnRJRD4KIDwvcmRmOkRlc2NyaXB0aW9uPgoKPC9y
+ZGY6UkRGPgo8L3g6eGFwbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9J3cnPz7/7gAOQWRvYmUAZEAAAAAB/9sAhAABAQEB
+AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAgICAgICAgICAgIDAwMDAwMD
+AwMDAQEBAQEBAQEBAQECAgECAgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD
+AwMDAwMDAwMDAwP/wAARCAANArwDAREAAhEBAxEB/90ABABY/8QBogAAAAYCAwEAAAAAAAAAAAAA
+BwgGBQQJAwoCAQALAQAABgMBAQEAAAAAAAAAAAAGBQQDBwIIAQkACgsQAAIBAwQBAwMCAwMDAgYJ
+dQECAwQRBRIGIQcTIgAIMRRBMiMVCVFCFmEkMxdScYEYYpElQ6Gx8CY0cgoZwdE1J+FTNoLxkqJE
+VHNFRjdHYyhVVlcassLS4vJkg3SThGWjs8PT4yk4ZvN1Kjk6SElKWFlaZ2hpanZ3eHl6hYaHiImK
+lJWWl5iZmqSlpqeoqaq0tba3uLm6xMXGx8jJytTV1tfY2drk5ebn6Onq9PX29/j5+hEAAgEDAgQE
+AwUEBAQGBgVtAQIDEQQhEgUxBgAiE0FRBzJhFHEIQoEjkRVSoWIWMwmxJMHRQ3LwF+GCNCWSUxhj
+RPGisiY1GVQ2RWQnCnODk0Z0wtLi8lVldVY3hIWjs8PT4/MpGpSktMTU5PSVpbXF1eX1KEdXZjh2
+hpamtsbW5vZnd4eXp7fH1+f3SFhoeIiYqLjI2Oj4OUlZaXmJmam5ydnp+So6SlpqeoqaqrrK2ur6
+/9oADAMBAAIRAxEAPwA6v/CWPvHYuU+M/wAjvitDkUpO3tsd9v8AIjGYOqqKKOfeGyN59dbH6+rP
+7s0b1SV1fVbQyPW0kuS0RsIo8lRBQTKdMie4tjOl/a34WsDR6K+jKzHP2hsetD1HvIV5C9jdWOr/
+ABhZNdPUFQuPsK5+0dbXeM3aKRWpqrVBNCzRSwzK0csUkZKyRuj2ZGVxYggEEe45qPz6HoJHTx/f
+Sm/46J/tz73+fVtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
+69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
+z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
+6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
+Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
+69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
+z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
+6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
+Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
+69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
+z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
+6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
+Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
+69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
+z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
+6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
+Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
+69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR64Sb1pgjfup9P6/X
+/b+/fn1rUekJmt34TC0uQ3/vHN4/aewNjU1Vundu8s9UQ4/b2DxOAiGSrKnIZKrlgpoI0RF1eouq
+vqCkC3u0cck0iRRIWdjQAZJPoOqO6Rq0srBY1FSTwAHz6+XX/s1Gxv8Ah03/AGef+Dbg/wBGn/Dh
+v+za/wB3/DS/3r/uJ/syP+mL+D+D7j7L+8H93/2NHl8X3PGrTz7yE/dc39Wf3ZUeP9L4dfLV4emv
+2V6gv94xf1h/edD4H1XiU86eJqp9tOv/0Ncz4+/7ML/pi2d/sqf+mD/T197L/cX/AEEDdh7N+7+3
+k+8/gX9ySNweL7Lyfc+P9r7bX5f2tXvJvdP3d9LJ+8vD+l89dNP56sfZ8+HWOW3/AF31MX7v8T6q
+uNFdX5Uz9vy49bYdAP8AhYh/D6D7Nsr9r9lS/bfxFf5X/wDEPB4I/D9//GX/AIv9747eX7r/ACnX
+fyevV7jB/wDW51Ghbj5C4p/h6kZP9cHSMClP+Xf/AC5/b1Jt/wALGv8AVVP/ACR/Kt/6+e6U9uvV
+/wBlx/n6t/zED0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9fPfqe3Xq/wCy4/z9e/5iB6D/ALN/83Xr
+f8LGv9VU/wDJH8q3/r579T269X/Zcf5+vf8AMQPQf9m/+br1v+FjX+qqf+SP5Vv/AF89+p7der/s
+uP8AP17/AJiB6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1Pbr1f9lx/n69/zED0H/Zv/m69b/hY1/qq
+n/kj+Vb/ANfPfqe3Xq/7Lj/P17/mIHoP+zf/ADdet/wsa/1VT/yR/Kt/6+e/U9uvV/2XH+fr3/MQ
+PQf9m/8Am69b/hY1/qqn/kj+Vb/189+p7der/suP8/Xv+Ygeg/7N/wDN163/AAsa/wBVU/8AJH8q
+3/r579T269X/AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+qqf8Akj+Vb/189+p7der/ALLj/P17/mIH
+oP8As3/zdet/wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69/wAxA9B/2b/5uvW/4WNf6qp/5I/lW/8A
+Xz36nt16v+y4/wA/Xv8AmIHoP+zf/N163/Cxr/VVP/JH8q3/AK+e/U9uvV/2XH+fr3/MQPQf9m/+
+br1v+FjX+qqf+SP5Vv8A189+p7der/suP8/Xv+Ygeg/7N/8AN163/Cxr/VVP/JH8q3/r579T269X
+/Zcf5+vf8xA9B/2b/wCbr1v+FjX+qqf+SP5Vv/Xz36nt16v+y4/z9e/5iB6D/s3/AM3Xrf8ACxr/
+AFVT/wAkfyrf+vnv1Pbr1f8AZcf5+vf8xA9B/wBm/wDm69b/AIWNf6qp/wCSP5Vv/Xz36nt16v8A
+suP8/Xv+Ygeg/wCzf/N163/Cxr/VVP8AyR/Kt/6+e/U9uvV/2XH+fr3/ADED0H/Zv/m69b/hY1/q
+qn/kj+Vb/wBfPfqe3Xq/7Lj/AD9e/wCYgeg/7N/83Xrf8LGv9VU/8kfyrf8Ar579T269X/Zcf5+v
+f8xA9B/2b/5uvW/4WNf6qp/5I/lW/wDXz36nt16v+y4/z9e/5iB6D/s3/wA3Xrf8LGv9VU/8kfyr
+f+vnv1Pbr1f9lx/n69/zED0H/Zv/AJuvW/4WNf6qp/5I/lW/9fPfqe3Xq/7Lj/P17/mIHoP+zf8A
+zdet/wALGv8AVVP/ACR/Kt/6+e/U9uvV/wBlx/n69/zED0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9
+fPfqe3Xq/wCy4/z9e/5iB6D/ALN/83Xrf8LGv9VU/wDJH8q3/r579T269X/Zcf5+vf8AMQPQf9m/
++br1v+FjX+qqf+SP5Vv/AF89+p7der/suP8AP17/AJiB6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1P
+br1f9lx/n69/zED0H/Zv/m69b/hY1/qqn/kj+Vb/ANfPfqe3Xq/7Lj/P17/mIHoP+zf/ADdet/ws
+a/1VT/yR/Kt/6+e/U9uvV/2XH+fr3/MQPQf9m/8Am69b/hY1/qqn/kj+Vb/189+p7der/suP8/Xv
++Ygeg/7N/wDN163/AAsa/wBVU/8AJH8q3/r579T269X/AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+q
+qf8Akj+Vb/189+p7der/ALLj/P17/mIHoP8As3/zdet/wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69
+/wAxA9B/2b/5uvW/4WNf6qp/5I/lW/8AXz36nt16v+y4/wA/Xv8AmIHoP+zf/N163/Cxr/VVP/JH
+8q3/AK+e/U9uvV/2XH+fr3/MQPQf9m/+br1v+FjX+qqf+SP5Vv8A189+p7der/suP8/Xv+Ygeg/7
+N/8AN163/Cxr/VVP/JH8q3/r579T269X/Zcf5+vf8xA9B/2b/wCbr1v+FjX+qqf+SP5Vv/Xz36nt
+16v+y4/z9e/5iB6D/s3/AM3Xrf8ACxr/AFVT/wAkfyrf+vnv1Pbr1f8AZcf5+vf8xA9B/wBm/wDm
+69b/AIWNf6qp/wCSP5Vv/Xz36nt16v8AsuP8/Xv+Ygeg/wCzf/N163/Cxr/VVP8AyR/Kt/6+e/U9
+uvV/2XH+fr3/ADED0H/Zv/m69b/hY1/qqn/kj+Vb/wBfPfqe3Xq/7Lj/AD9e/wCYgeg/7N/83Xrf
+8LGv9VU/8kfyrf8Ar579T269X/Zcf5+vf8xA9B/2b/5uvW/4WNf6qp/5I/lW/wDXz36nt16v+y4/
+z9e/5iB6D/s3/wA3Xrf8LGv9VU/8kfyrf+vnv1Pbr1f9lx/n69/zED0H/Zv/AJuvW/4WNf6qp/5I
+/lW/9fPfqe3Xq/7Lj/P17/mIHoP+zf8Azdet/wALGv8AVVP/ACR/Kt/6+e/U9uvV/wBlx/n69/zE
+D0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9fPfqe3Xq/wCy4/z9e/5iB6D/ALN/83Xrf8LGv9VU/wDJ
+H8q3/r579T269X/Zcf5+vf8AMQPQf9m/+br1v+FjX+qqf+SP5Vv/AF89+p7der/suP8AP17/AJiB
+6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1Pbr1f9lx/n69/zED0H/Zv/m69b/hY1/qqn/kj+Vb/ANfP
+fqe3Xq/7Lj/P17/mIHoP+zf/ADdet/wsa/1VT/yR/Kt/6+e/U9uvV/2XH+fr3/MQPQf9m/8Am69b
+/hY1/qqn/kj+Vb/189+p7der/suP8/Xv+Ygeg/7N/wDN163/AAsa/wBVU/8AJH8q3/r579T269X/
+AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+qqf8Akj+Vb/189+p7der/ALLj/P17/mIHoP8As3/zdet/
+wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69/wAxA9B/2b/5uvW/4WNf6qp/5I/lW/8AXz36nt16v+y4
+/wA/Xv8AmIHoP+zf/N163/Cxr/VVP/JH8q3/AK+e/U9uvV/2XH+fr3/MQPQf9m/+br1v+FjX+qqf
++SP5Vv8A189+p7der/suP8/Xv+Ygeg/7N/8AN163/Cxr/VVP/JH8q3/r579T269X/Zcf5+vf8xA9
+B/2b/wCbr1v+FjX+qqf+SP5Vv/Xz36nt16v+y4/z9e/5iB6D/s3/AM3Xrf8ACxr/AFVT/wAkfyrf
++vnv1Pbr1f8AZcf5+vf8xA9B/wBm/wDm69b/AIWNf6qp/wCSP5Vv/Xz36nt16v8AsuP8/Xv+Ygeg
+/wCzf/N163/Cxr/VVP8AyR/Kt/6+e/U9uvV/2XH+fr3/ADED0H/Zv/m69b/hY1/qqn/kj+Vb/wBf
+Pfqe3Xq/7Lj/AD9e/wCYgeg/7N/83Xrf8LGv9VU/8kfyrf8Ar579T269X/Zcf5+vf8xA9B/2b/5u
+vW/4WNf6qp/5I/lW/wDXz36nt16v+y4/z9e/5iB6D/s3/wA3Xrf8LGv9VU/8kfyrf+vnv1Pbr1f9
+lx/n69/zED0H/Zv/AJuvW/4WNf6qp/5I/lW/9fPfqe3Xq/7Lj/P17/mIHoP+zf8Azdet/wALGv8A
+VVP/ACR/Kt/6+e/U9uvV/wBlx/n69/zED0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9fPfqe3Xq/wCy
+4/z9e/5iB6D/ALN/83Xrf8LGv9VU/wDJH8q3/r579T269X/Zcf5+vf8AMQPQf9m/+br1v+FjX+qq
+f+SP5Vv/AF89+p7der/suP8AP17/AJiB6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1Pbr1f9lx/n69/
+zED0H/Zv/m69b/hY1/qqn/kj+Vb/ANfPfqe3Xq/7Lj/P17/mIHoP+zf/ADdet/wsa/1VT/yR/Kt/
+6+e/U9uvV/2XH+fr3/MQPQf9m/8Am69b/hY1/qqn/kj+Vb/189+p7der/suP8/Xv+Ygeg/7N/wDN
+163/AAsa/wBVU/8AJH8q3/r579T269X/AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+qqf8Akj+Vb/18
+9+p7der/ALLj/P17/mIHoP8As3/zdet/wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69/wAxA9B/2b/5
+uvW/4WM/6qp/5I/lW/8AR/v3/MOvV/2XH+fr3/MQfQf9m/VYX8z7/oIK/wBF+L/4cdPeP+hH9z7/
+APuevSo6i1/fUP2n+lT/AGU9jsj7j+JeH+G/3r9flv8AZ86/Yj5e/qZ9T/upKfVeWrVq/wBr4meH
+HT+fQf37+t/04/e2v6Xz06dP+28PH2avy6oK/b8f+0e5A7dPy6BWdXz6/9k=
+"));
+		break;
+		case "01_bodybg.jpg":
+			header("Content-type: image/jpeg");
+			echo trim(base64_decode("
+/9j/4AAQSkZJRgABAgEASABIAAD/4QOnRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
+AAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAUAAAAcgEyAAIAAAAUAAAAhodp
+AAQAAAABAAAAnAAAAMgAAABIAAAAAQAAAEgAAAABQWRvYmUgUGhvdG9zaG9wIDcuMAAyMDA1OjAy
+OjI2IDA0OjE2OjIwAAAAAAOgAQADAAAAAf//AACgAgAEAAAAAQAAArygAwAEAAAAAQAAAAEAAAAA
+AAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABFgEbAAUAAAABAAABHgEoAAMAAAABAAIAAAIBAAQA
+AAABAAABJgICAAQAAAABAAACeQAAAAAAAABIAAAAAQAAAEgAAAAB/9j/4AAQSkZJRgABAgEASABI
+AAD/7QAMQWRvYmVfQ00AAv/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwP
+FRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQO
+Dg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEI
+AAEAgAMBIgACEQEDEQH/3QAEAAj/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEF
+AQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMi
+cYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj
+80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcG
+BTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiPBUtHwMyRi4XKCkkNTFWNzNPElBhaisoMHJjXC0kST
+VKMXZEVVNnRl4vKzhMPTdePzRpSkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2JzdHV2d3h5ent8f/
+2gAMAwEAAhEDEQA/APRug/8AIfTv/CtP/ntivr5VSRO5QNg/VSS+VUkEv1UkvlVJJT9VJL5VSSU/
+VSS+VUklP1UkvlVJJT9VJL5VSSU/VSp9Y/5Izv8Awvb/ANQ5fMKSQ3Udn//Z/+0IYFBob3Rvc2hv
+cCAzLjAAOEJJTQQlAAAAAAAQAAAAAAAAAAAAAAAAAAAAADhCSU0D7QAAAAAAEABIAAAAAQABAEgA
+AAABAAE4QklNBCYAAAAAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAAAHg4QklNBBkAAAAA
+AAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJTScQAAAAAAAKAAEA
+AAAAAAAAAThCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQChmZoABgAAAAAAAQAy
+AAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAAcAAA////////////
+/////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////
+////////////////A+gAAAAA/////////////////////////////wPoAAA4QklNBAAAAAAAAAIA
+ADhCSU0EAgAAAAAAAgAAOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAAAAAABAAA
+AAA4QklNBBoAAAAAA0kAAAAGAAAAAAAAAAAAAAABAAACvAAAAAoAVQBuAHQAaQB0AGwAZQBkAC0A
+MwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACvAAAAAEAAAAAAAAAAAAAAAAAAAAA
+AQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAAB
+AAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9u
+ZwAAAAEAAAAAUmdodGxvbmcAAAK8AAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGlj
+ZQAAABIAAAAHc2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVt
+AAAADEVTbGljZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5
+cGUAAAAASW1nIAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAA
+AAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAABAAAAAFJnaHRsb25nAAACvAAAAAN1cmxU
+RVhUAAAAAQAAAAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RF
+WFQAAAABAAAAAAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJ
+aG9yekFsaWduZW51bQAAAA9FU2xpY2VIb3J6QWxpZ24AAAAHZGVmYXVsdAAAAAl2ZXJ0QWxpZ25l
+bnVtAAAAD0VTbGljZVZlcnRBbGlnbgAAAAdkZWZhdWx0AAAAC2JnQ29sb3JUeXBlZW51bQAAABFF
+U2xpY2VCR0NvbG9yVHlwZQAAAABOb25lAAAACXRvcE91dHNldGxvbmcAAAAAAAAACmxlZnRPdXRz
+ZXRsb25nAAAAAAAAAAxib3R0b21PdXRzZXRsb25nAAAAAAAAAAtyaWdodE91dHNldGxvbmcAAAAA
+ADhCSU0EEQAAAAAAAQEAOEJJTQQUAAAAAAAEAAAAAzhCSU0EDAAAAAAClQAAAAEAAACAAAAAAQAA
+AYAAAAGAAAACeQAYAAH/2P/gABBKRklGAAECAQBIAEgAAP/tAAxBZG9iZV9DTQAC/+4ADkFkb2Jl
+AGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwM
+DAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEM
+DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAAQCAAwEiAAIRAQMRAf/dAAQACP/EAT8A
+AAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoL
+EAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT
+8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2
+xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFC
+I8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE
+1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMRAD8A9G6D/wAh9O/8K0/+
+e2K+vlVJE7lA2D9VJL5VSQS/VSS+VUklP1UkvlVJJT9VJL5VSSU/VSS+VUklP1UkvlVJJT9VKn1j
+/kjO/wDC9v8A1Dl8wpJDdR2f/9kAOEJJTQQhAAAAAABVAAAAAQEAAAAPAEEAZABvAGIAZQAgAFAA
+aABvAHQAbwBzAGgAbwBwAAAAEwBBAGQAbwBiAGUAIABQAGgAbwB0AG8AcwBoAG8AcAAgADcALgAw
+AAAAAQA4QklNBAYAAAAAAAcACAAAAAEBAP/hEkhodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAv
+ADw/eHBhY2tldCBiZWdpbj0n77u/JyBpZD0nVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkJz8+Cjw/
+YWRvYmUteGFwLWZpbHRlcnMgZXNjPSJDUiI/Pgo8eDp4YXBtZXRhIHhtbG5zOng9J2Fkb2JlOm5z
+Om1ldGEvJyB4OnhhcHRrPSdYTVAgdG9vbGtpdCAyLjguMi0zMywgZnJhbWV3b3JrIDEuNSc+Cjxy
+ZGY6UkRGIHhtbG5zOnJkZj0naHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4
+LW5zIycgeG1sbnM6aVg9J2h0dHA6Ly9ucy5hZG9iZS5jb20vaVgvMS4wLyc+CgogPHJkZjpEZXNj
+cmlwdGlvbiBhYm91dD0ndXVpZDozOGVmNTRkMC04N2YwLTExZDktYTAzNi1hZWFkN2I2ZWM2YTMn
+CiAgeG1sbnM6eGFwTU09J2h0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8nPgogIDx4YXBN
+TTpEb2N1bWVudElEPmFkb2JlOmRvY2lkOnBob3Rvc2hvcDo2ZTEwMWQwMy04N2VlLTExZDktYTAz
+Ni1hZWFkN2I2ZWM2YTM8L3hhcE1NOkRvY3VtZW50SUQ+CiA8L3JkZjpEZXNjcmlwdGlvbj4KCjwv
+cmRmOlJERj4KPC94OnhhcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSd3Jz8+/+4ADkFkb2JlAGRAAAAAAf/bAIQAAQEB
+AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAgICAgICAgICAwMDAwMD
+AwMDAwEBAQEBAQEBAQEBAgIBAgIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD
+AwMDAwMDAwMDAwMD/8AAEQgAAQK8AwERAAIRAQMRAf/dAAQAWP/EAaIAAAAGAgMBAAAAAAAAAAAA
+AAcIBgUECQMKAgEACwEAAAYDAQEBAAAAAAAAAAAABgUEAwcCCAEJAAoLEAACAQMEAQMDAgMDAwIG
+CXUBAgMEEQUSBiEHEyIACDEUQTIjFQlRQhZhJDMXUnGBGGKRJUOhsfAmNHIKGcHRNSfhUzaC8ZKi
+RFRzRUY3R2MoVVZXGrLC0uLyZIN0k4Rlo7PD0+MpOGbzdSo5OkhJSlhZWmdoaWp2d3h5eoWGh4iJ
+ipSVlpeYmZqkpaanqKmqtLW2t7i5usTFxsfIycrU1dbX2Nna5OXm5+jp6vT19vf4+foRAAIBAwIE
+BAMFBAQEBgYFbQECAxEEIRIFMQYAIhNBUQcyYRRxCEKBI5EVUqFiFjMJsSTB0UNy8BfhgjQlklMY
+Y0TxorImNRlUNkVkJwpzg5NGdMLS4vJVZXVWN4SFo7PD0+PzKRqUpLTE1OT0laW1xdXl9ShHV2Y4
+doaWprbG1ub2Z3eHl6e3x9fn90hYaHiImKi4yNjo+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq
++v/aAAwDAQACEQMRAD8As/8A+EtP/btzt3/xfbf/AP8AA+fHz2OPcD/kuRf80F/4/J0CeRv+SNN/
+z0H/AI5H1tO4X/gPF/wX2B/Xoarw6fPfut9e9+691737r3Xvfuvde9+691737r3Xvfuvde9+6917
+37r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfu
+vde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691
+737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvf
+uvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+69
+1737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xv
+fuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691wk/Q3+t7917oNMz/AMXvDf8Aa4xf/uZD
+715fn1T8Q+3r5of/AHcT/wDmbn/5+73OP/Okf9QH/WHqGv8Ancf+o/8A6zdf/9k="));
+		break;
+
+		case "01_header01.jpg":
+			header("Content-type: image/jpeg");
+			echo trim(base64_decode("
+/9j/4AAQSkZJRgABAgEASABIAAD/4QhMRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
+AAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodp
+AAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMiBXaW5kb3dz
+ADIwMDU6MDY6MTYgMTc6Mzc6MzkAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAACvKADAAQAAAAB
+AAAAlwAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEA
+AgAAAgEABAAAAAEAAAEuAgIABAAAAAEAAAcWAAAAAAAAAEgAAAABAAAASAAAAAH/2P/gABBKRklG
+AAECAABIAEgAAP/tAAxBZG9iZV9DTQAC/+4ADkFkb2JlAGSAAAAAAf/bAIQADAgICAkIDAkJDBEL
+CgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsN
+Dg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM
+DAwM/8AAEQgAIwCgAwEiAAIRAQMRAf/dAAQACv/EAT8AAAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYH
+CAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoLEAABBAEDAgQCBQcGCAUDDDMBAAIRAwQh
+EjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXi
+ZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2xtbm9jdHV2d3h5ent8fX5/cRAAICAQIE
+BAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFCI8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKy
+gwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dX
+Z3eHl6e3x//aAAwDAQACEQMRAD8A7boHQOhO6F05zunYrnOxaXOc6mskk1sc5znOYXOc5x3Oc5X/
+APm90H/ytxP+2K//ACCxOmdevxumYdDK63Nrx6WgkukxXXzAVn/nLlf6Gr/Od/5FQnm8QkQZHQkb
+SQKdL/m90H/ytxP+2K//ACCX/N7oP/lbif8AbFf/AJBZv/ObL/0NX+c7/wAioH605c6UVf5zv/Ip
+DmsR2kfskokB1f8Am90H/wArcT/tiv8A8gl/ze6D/wCVuJ/2xX/5BZQ+tGaeKKv853/kU/8AznzB
+zRV/nO/8il96xfvH7Cix/IOp/wA3ug/+VuJ/2xX/AOQS/wCb3Qf/ACtxP+2K/wDyCyv+dOZ2oqP9
+p3/kUv8AnRmd6Kh/ad/5FH7zj/eP2FHFH+QdX/m90H/ytxP+2K//ACCX/N7oP/lbif8AbFf/AJBZ
+X/OnL/0NX+c7/wAil/zpy/8AQVf5zv8AyKP3iHc/YVccf5B1f+b3Qf8AytxP+2K//IJf83ug/wDl
+bif9sV/+QWV/zpy/9BV/nO/8il/zpzP9BV/nO/8AIoHmcY/SP2FPFH+QdX/m90H/AMrcT/tiv/yC
+X/N7oP8A5W4n/bFf/kFlf86Mv/QVf5zv/Ipf86Mz/QVf5zv/ACKX3nH3P2FXFF1f+b3Qf/K3E/7Y
+r/8AIJf83ug/+VuJ/wBsV/8AkFlf86cz/QVf5zv/ACKX/OjM70Vf5zv/ACKB5rGP0j9klcUXV/5v
+dB/8rcT/ALYr/wDIJf8AN7oP/lbif9sV/wDkFlf86Mz/AEFX+c7/AMipj6zZZ/wNX+c7/wAigebx
+DeR+ySRRdL/m90H/AMrcT/tiv/yCodf6B0JvQuoub07Fa5uLcWltNYIIre5rmuazc1zXDc1zVD/n
+Ll9qav8AOd/5FV+p9dyMjpmZQ+qsNsx7mktJkTVZxISjzuEyAEjZIG0lGn//0L9FsY9DR2pq/wDP
+daJ6p7qgLXBlbewrqH/gdaXqErKyRPHPUfNL81tt19+nKgLZKpusM8pvU80YgALSdW+cgAQCo+uD
+3kqn6rRymOQe2gThEDog2W76x+SXrKj6x8UvWTqRTe9YJesFQ9bzT+sjSqb3rJesFRFpPCffHP3B
+NpVN31uw1S9Ydz8gqXqnjgeCXqeaVKpu+v4aJesqPqFSFpHJTZBNN31CSq+dnHDpZYdDZY2rcQXB
+m4Pe659dZbZb6ba/5qt7N/8ApFAZBQ8gsyKwxxLdrg5rhBhwBb9E/Sbte5qUfmjxj0WOKv3Uir3W
+yfrF0nGrY7GuvuvMgtsdv+0H+TjM2sw9v5lmP6NNbP6RXetK28WYtpHD6LDHxqeVztHTGU5dmQGs
+ZY8Bvq/Sgf8AAsd+f/Lu+h/wq0m2AVuYNGiqxoHkKrAFPmjhOTGcQF2OLhFR/R4Ukh//0Yu3e2N0
+bK+Nv+jr8VE7/wCX8ti8uSWXP+clt8x3R0fTjvn87/oqLt/8v/orzNJSQ+jG+l+/+V/0Uvf/ACv+
+ivNEk77FPpfv/lf9FL3/AMr/AKK80SR+xT6X7/5X/RUhv/lf9FeZJIFIfT/ft/P+WxQ9/wDL/wCi
+vM0kB9FPpnv/AJf/AEUhv8/ntXmaSR+iC+ne/wDlf9FL3/yv+ivMUk37FPp3v/lf9FL3/wAr/orz
+FJI7dFPpvv8A5X/RTt3SZ3Rss52x/N2eC8xSTsfzR23Cer//2f/tDnhQaG90b3Nob3AgMy4wADhC
+SU0EBAAAAAAABxwCAAACAAIAOEJJTQQlAAAAAAAQRgzyiSa4VtqwnAGhsKeQdzhCSU0D7QAAAAAA
+EABIAAAAAQACAEgAAAABAAI4QklNBCYAAAAAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAA
+AHg4QklNBBkAAAAAAAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJ
+TScQAAAAAAAKAAEAAAAAAAAAAThCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQCh
+mZoABgAAAAAAAQAyAAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAA
+cAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAA
+AAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAA4
+QklNBAAAAAAAAAIAAThCSU0EAgAAAAAABAAAAAA4QklNBDAAAAAAAAIBAThCSU0ELQAAAAAABgAB
+AAAABDhCSU0ECAAAAAAAEAAAAAEAAAJAAAACQAAAAAA4QklNBB4AAAAAAAQAAAAAOEJJTQQaAAAA
+AANLAAAABgAAAAAAAAAAAAAAlwAAArwAAAALADAAMQBfAGgAZQBhAGQAZQByADAAMQAAAAEAAAAA
+AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACvAAAAJcAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAA
+AAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAABAAAAAAAAUmN0
+MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9uZwAAAJcAAAAA
+UmdodGxvbmcAAAK8AAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGljZQAAABIAAAAH
+c2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVtAAAADEVTbGlj
+ZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5cGUAAAAASW1n
+IAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAAAAAAAABMZWZ0
+bG9uZwAAAAAAAAAAQnRvbWxvbmcAAACXAAAAAFJnaHRsb25nAAACvAAAAAN1cmxURVhUAAAAAQAA
+AAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RFWFQAAAABAAAA
+AAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJaG9yekFsaWdu
+ZW51bQAAAA9FU2xpY2VIb3J6QWxpZ24AAAAHZGVmYXVsdAAAAAl2ZXJ0QWxpZ25lbnVtAAAAD0VT
+bGljZVZlcnRBbGlnbgAAAAdkZWZhdWx0AAAAC2JnQ29sb3JUeXBlZW51bQAAABFFU2xpY2VCR0Nv
+bG9yVHlwZQAAAABOb25lAAAACXRvcE91dHNldGxvbmcAAAAAAAAACmxlZnRPdXRzZXRsb25nAAAA
+AAAAAAxib3R0b21PdXRzZXRsb25nAAAAAAAAAAtyaWdodE91dHNldGxvbmcAAAAAADhCSU0EKAAA
+AAAADAAAAAE/8AAAAAAAADhCSU0EEQAAAAAAAQEAOEJJTQQUAAAAAAAEAAAABDhCSU0EDAAAAAAH
+MgAAAAEAAACgAAAAIwAAAeAAAEGgAAAHFgAYAAH/2P/gABBKRklGAAECAABIAEgAAP/tAAxBZG9i
+ZV9DTQAC/+4ADkFkb2JlAGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEM
+DAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQR
+DAwMDAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAIwCgAwEiAAIR
+AQMRAf/dAAQACv/EAT8AAAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAA
+AAAAAQACAwQFBgcICQoLEAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIj
+JBVSwWIzNHKC0UMHJZJT8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU
+5PSltcXV5fVWZnaGlqa2xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITES
+BEFRYXEiEwUygZEUobFCI8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi
+8rOEw9N14/NGlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMR
+AD8A7boHQOhO6F05zunYrnOxaXOc6mskk1sc5znOYXOc5x3Oc5X/APm90H/ytxP+2K//ACCxOmde
+vxumYdDK63Nrx6WgkukxXXzAVn/nLlf6Gr/Od/5FQnm8QkQZHQkbSQKdL/m90H/ytxP+2K//ACCX
+/N7oP/lbif8AbFf/AJBZv/ObL/0NX+c7/wAioH605c6UVf5zv/IpDmsR2kfskokB1f8Am90H/wAr
+cT/tiv8A8gl/ze6D/wCVuJ/2xX/5BZQ+tGaeKKv853/kU/8AznzBzRV/nO/8il96xfvH7Cix/IOp
+/wA3ug/+VuJ/2xX/AOQS/wCb3Qf/ACtxP+2K/wDyCyv+dOZ2oqP9p3/kUv8AnRmd6Kh/ad/5FH7z
+j/eP2FHFH+QdX/m90H/ytxP+2K//ACCX/N7oP/lbif8AbFf/AJBZX/OnL/0NX+c7/wAil/zpy/8A
+QVf5zv8AyKP3iHc/YVccf5B1f+b3Qf8AytxP+2K//IJf83ug/wDlbif9sV/+QWV/zpy/9BV/nO/8
+il/zpzP9BV/nO/8AIoHmcY/SP2FPFH+QdX/m90H/AMrcT/tiv/yCX/N7oP8A5W4n/bFf/kFlf86M
+v/QVf5zv/Ipf86Mz/QVf5zv/ACKX3nH3P2FXFF1f+b3Qf/K3E/7Yr/8AIJf83ug/+VuJ/wBsV/8A
+kFlf86cz/QVf5zv/ACKX/OjM70Vf5zv/ACKB5rGP0j9klcUXV/5vdB/8rcT/ALYr/wDIJf8AN7oP
+/lbif9sV/wDkFlf86Mz/AEFX+c7/AMipj6zZZ/wNX+c7/wAigebxDeR+ySRRdL/m90H/AMrcT/ti
+v/yCodf6B0JvQuoub07Fa5uLcWltNYIIre5rmuazc1zXDc1zVD/nLl9qav8AOd/5FV+p9dyMjpmZ
+Q+qsNsx7mktJkTVZxISjzuEyAEjZIG0lGn//0L9FsY9DR2pq/wDPdaJ6p7qgLXBlbewrqH/gdaXq
+ErKyRPHPUfNL81tt19+nKgLZKpusM8pvU80YgALSdW+cgAQCo+uD3kqn6rRymOQe2gThEDog2W76
+x+SXrKj6x8UvWTqRTe9YJesFQ9bzT+sjSqb3rJesFRFpPCffHP3BNpVN31uw1S9Ydz8gqXqnjgeC
+XqeaVKpu+v4aJesqPqFSFpHJTZBNN31CSq+dnHDpZYdDZY2rcQXBm4Pe659dZbZb6ba/5qt7N/8A
+pFAZBQ8gsyKwxxLdrg5rhBhwBb9E/Sbte5qUfmjxj0WOKv3Uir3WyfrF0nGrY7GuvuvMgtsdv+0H
++TjM2sw9v5lmP6NNbP6RXetK28WYtpHD6LDHxqeVztHTGU5dmQGsZY8Bvq/Sgf8AAsd+f/Lu+h/w
+q0m2AVuYNGiqxoHkKrAFPmjhOTGcQF2OLhFR/R4Ukh//0Yu3e2N0bK+Nv+jr8VE7/wCX8ti8uSWX
+P+clt8x3R0fTjvn87/oqLt/8v/orzNJSQ+jG+l+/+V/0Uvf/ACv+ivNEk77FPpfv/lf9FL3/AMr/
+AKK80SR+xT6X7/5X/RUhv/lf9FeZJIFIfT/ft/P+WxQ9/wDL/wCivM0kB9FPpnv/AJf/AEUhv8/n
+tXmaSR+iC+ne/wDlf9FL3/yv+ivMUk37FPp3v/lf9FL3/wAr/orzFJI7dFPpvv8A5X/RTt3SZ3Rs
+s52x/N2eC8xSTsfzR23Cer//2ThCSU0EIQAAAAAAVQAAAAEBAAAADwBBAGQAbwBiAGUAIABQAGgA
+bwB0AG8AcwBoAG8AcAAAABMAQQBkAG8AYgBlACAAUABoAG8AdABvAHMAaABvAHAAIABDAFMAMgAA
+AAEAOEJJTQ+gAAAAAAD4bWFuaUlSRlIAAADsOEJJTUFuRHMAAADMAAAAEAAAAAEAAAAAAABudWxs
+AAAAAwAAAABBRlN0bG9uZwAAAAAAAAAARnJJblZsTHMAAAABT2JqYwAAAAEAAAAAAABudWxsAAAA
+AQAAAABGcklEbG9uZ14Sb90AAAAARlN0c1ZsTHMAAAABT2JqYwAAAAEAAAAAAABudWxsAAAABAAA
+AABGc0lEbG9uZwAAAAAAAAAAQUZybWxvbmcAAAAAAAAAAEZzRnJWbExzAAAAAWxvbmdeEm/dAAAA
+AExDbnRsb25nAAAAAAAAOEJJTVJvbGwAAAAIAAAAAAAAAAA4QklND6EAAAAAABxtZnJpAAAAAgAA
+ABAAAAABAAAAAAAAAAEAAAAAOEJJTQQGAAAAAAAHAAIAAAABAQD/4TpqaHR0cDovL25zLmFkb2Jl
+LmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pO
+VGN6a2M5ZCI/Pgo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSIz
+LjEuMS0xMTEiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkv
+MDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0i
+IgogICAgICAgICAgICB4bWxuczp4YXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21t
+LyIKICAgICAgICAgICAgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9z
+VHlwZS9SZXNvdXJjZVJlZiMiPgogICAgICAgICA8eGFwTU06RG9jdW1lbnRJRD51dWlkOkM2M0I1
+Q0Q1ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC94YXBNTTpEb2N1bWVudElEPgogICAgICAgICA8
+eGFwTU06SW5zdGFuY2VJRD51dWlkOkM3M0I1Q0Q1ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC94
+YXBNTTpJbnN0YW5jZUlEPgogICAgICAgICA8eGFwTU06RGVyaXZlZEZyb20gcmRmOnBhcnNlVHlw
+ZT0iUmVzb3VyY2UiPgogICAgICAgICAgICA8c3RSZWY6aW5zdGFuY2VJRD51dWlkOkM0M0I1Q0Q1
+ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC9zdFJlZjppbnN0YW5jZUlEPgogICAgICAgICAgICA8
+c3RSZWY6ZG9jdW1lbnRJRD51dWlkOkMzM0I1Q0Q1ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC9z
+dFJlZjpkb2N1bWVudElEPgogICAgICAgICA8L3hhcE1NOkRlcml2ZWRGcm9tPgogICAgICA8L3Jk
+ZjpEZXNjcmlwdGlvbj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAg
+ICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAg
+ICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpY
+UmVzb2x1dGlvbj43MjAwMDAvMTAwMDA8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZm
+OllSZXNvbHV0aW9uPjcyMDAwMC8xMDAwMDwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRp
+ZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6
+TmF0aXZlRGlnZXN0PjI1NiwyNTcsMjU4LDI1OSwyNjIsMjc0LDI3NywyODQsNTMwLDUzMSwyODIs
+MjgzLDI5NiwzMDEsMzE4LDMxOSw1MjksNTMyLDMwNiwyNzAsMjcxLDI3MiwzMDUsMzE1LDMzNDMy
+Ozk4M0M1QkM5MkRENEI4NzZEMjQyOTczQzUyQTEzOUJGPC90aWZmOk5hdGl2ZURpZ2VzdD4KICAg
+ICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIi
+CiAgICAgICAgICAgIHhtbG5zOnhhcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAg
+ICAgICAgIDx4YXA6TW9kaWZ5RGF0ZT4yMDA1LTA2LTE2VDE3OjM3OjM5KzAxOjAwPC94YXA6TW9k
+aWZ5RGF0ZT4KICAgICAgICAgPHhhcDpDcmVhdG9yVG9vbD5BZG9iZSBQaG90b3Nob3AgQ1MyIFdp
+bmRvd3M8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVEYXRlPjIwMDUtMDYt
+MTZUMTc6Mzc6MzkrMDE6MDA8L3hhcDpDcmVhdGVEYXRlPgogICAgICAgICA8eGFwOk1ldGFkYXRh
+RGF0ZT4yMDA1LTA2LTE2VDE3OjM3OjM5KzAxOjAwPC94YXA6TWV0YWRhdGFEYXRlPgogICAgICA8
+L3JkZjpEZXNjcmlwdGlvbj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAg
+ICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAg
+ICAgICA8ZXhpZjpDb2xvclNwYWNlPi0xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlm
+OlBpeGVsWERpbWVuc2lvbj43MDA8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhp
+ZjpQaXhlbFlEaW1lbnNpb24+MTUxPC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgICAgPGV4
+aWY6TmF0aXZlRGlnZXN0PjM2ODY0LDQwOTYwLDQwOTYxLDM3MTIxLDM3MTIyLDQwOTYyLDQwOTYz
+LDM3NTEwLDQwOTY0LDM2ODY3LDM2ODY4LDMzNDM0LDMzNDM3LDM0ODUwLDM0ODUyLDM0ODU1LDM0
+ODU2LDM3Mzc3LDM3Mzc4LDM3Mzc5LDM3MzgwLDM3MzgxLDM3MzgyLDM3MzgzLDM3Mzg0LDM3Mzg1
+LDM3Mzg2LDM3Mzk2LDQxNDgzLDQxNDg0LDQxNDg2LDQxNDg3LDQxNDg4LDQxNDkyLDQxNDkzLDQx
+NDk1LDQxNzI4LDQxNzI5LDQxNzMwLDQxOTg1LDQxOTg2LDQxOTg3LDQxOTg4LDQxOTg5LDQxOTkw
+LDQxOTkxLDQxOTkyLDQxOTkzLDQxOTk0LDQxOTk1LDQxOTk2LDQyMDE2LDAsMiw0LDUsNiw3LDgs
+OSwxMCwxMSwxMiwxMywxNCwxNSwxNiwxNywxOCwyMCwyMiwyMywyNCwyNSwyNiwyNywyOCwzMDs1
+N0U1QjRCMDVFNjY5RjYzNjY4NTJCNjgxNzMyRTY3NzwvZXhpZjpOYXRpdmVEaWdlc3Q+CiAgICAg
+IDwvcmRmOkRlc2NyaXB0aW9uPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgog
+ICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgog
+ICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL2pwZWc8L2RjOmZvcm1hdD4KICAgICAgPC9yZGY6RGVz
+Y3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAg
+IHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyI+CiAg
+ICAgICAgIDxwaG90b3Nob3A6Q29sb3JNb2RlPjM8L3Bob3Rvc2hvcDpDb2xvck1vZGU+CiAgICAg
+ICAgIDxwaG90b3Nob3A6SGlzdG9yeS8+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3Jk
+ZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
+ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3
+Ij8+/+4ADkFkb2JlAGSAAAAAAf/bAIQACAYGBgYGCAYGCAwIBwgMDgoICAoOEA0NDg0NEBEMDAwM
+DAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAEJCAgJCgkLCQkLDgsNCw4RDg4ODhERDAwM
+DAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAlwK8AwEiAAIRAQMR
+Af/dAAQALP/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AhnkbyNe+dr2aKKYWljaB
+WvLxl58edeCIlV5u/Fv2s6sv5G+TSADe6oxHVhJbgE+IBt835GqP8G3pGxbVJAx7kC3tyAc6rHGK
+ZbkyS4iAapqxwjwgkXbyz/lRfkz/AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhkPE
+n3lnwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8Als1X/kbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP+
+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZPnV/THhm9MeGPiT7yvBHuDyj/AJUX5M/5bNV/
+5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/5bNV/5G23/AGT5v+VF
++TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP8Als1X/kbbf9k+b/lRfkz/AJbNV/5G
+23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/AJG23/ZPm/5UX5M/5bNV/wCRtt/2T51f0x4Z
+vTHhj4k+8rwR7g8o/wCVF+TP+WzVf+Rtt/2T5v8AlRfkz/ls1X/kbbf9k+dX9MeGb0x4Y+JPvK8E
+e4PKP+VF+TP+WzVf+Rtt/wBk+b/lRfkz/ls1X/kbbf8AZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/
+AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/5bNV/wCRtt/2
+T5v+VF+TP+WzVf8Akbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP8AlRfkz/ls1X/kbbf9k+b/AJUX5M/5
+bNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/kbbf8AZPm/5UX5M/5bNV/5G23/AGT5
+1f0x4ZvTHhj4k+8rwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8Als1X/kbbf9k+dX9MeGb0x4Y+
+JPvK8Ee4PKP+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZPnV/THhm9MeGPiT7yvBHuDyj/
+AJUX5M/5bNV/5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/5bNV/5
+G23/AGT5v+VF+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP8Als1X/kbbf9k+b/lR
+fkz/AJbNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/AJG23/ZPm/5UX5M/5bNV/wCR
+tt/2T51f0x4ZvTHhj4k+8rwR7g8o/wCVF+TP+WzVf+Rtt/2T5v8AlRfkz/ls1X/kbbf9k+dX9MeG
+b0x4Y+JPvK8Ee4PKP+VF+TP+WzVf+Rtt/wBk+b/lRfkz/ls1X/kbbf8AZPnV/THhm9MeGPiT7yvB
+HuDyj/lRfkz/AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/
+5bNV/wCRtt/2T5v+VF+TP+WzVf8Akbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP8AlRfkz/ls1X/kbbf9
+k+b/AJUX5M/5bNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/kbbf8AZPm/5UX5M/5b
+NV/5G23/AGT51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8Als1X/kbbf9k+
+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZPnV/THhm9MeGP
+iT7yvBHuDyj/AJUX5M/5bNV/5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/
+5UX5M/5bNV/5G23/AGT5v+VF+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP8Als1X
+/kbbf9k+b/lRfkz/AJbNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/AJG23/ZPm/5U
+X5M/5bNV/wCRtt/2T51f0x4ZvTHhj4k+8rwR7g8o/wCVF+TP+WzVf+Rtt/2T5v8AlRfkz/ls1X/k
+bbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP+WzVf+Rtt/wBk+b/lRfkz/ls1X/kbbf8AZPnV/THh
+m9MeGPiT7yvBHuDyj/lRfkz/AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhj4k+8rw
+R7g8o/5UX5M/5bNV/wCRtt/2T5v+VF+TP+WzVf8Akbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP8AlRfk
+z/ls1X/kbbf9k+b/AJUX5M/5bNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/kbbf8A
+ZPm/5UX5M/5bNV/5G23/AGT51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8A
+ls1X/kbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZP
+nV/THhm9MeGPiT7yvBHuDyj/AJUX5M/5bNV/5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj
+4k+8rwR7g8o/5UX5M/5bNV/5G23/AGT5v+VF+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP
++VF+TP8Als1X/kbbf9k+V/yozyZ/y2ar/wAjbf8A7J86x6Y8MoximPiT7yvBHuDxHzB+R1mtk8/l
+a+uJLyJS31O99NvVpvxjliWERt/rK/L/ACM4rRq8aHlWnGm9fCme0GTjKhG3xD8TnmLgn/K3fT4j
+h/iXjwptT6/SlMmMkuGW/Kt2BhHijtzvZ//Qkv5Gf8oZef8AbVl/6h7fOrx9BnKPyM/5Qy8/7asv
+/UPb51ePoMnk+uXvY4/oHuX5s2bIMnZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2b
+FXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs
+2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFX
+Zs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZj0zZj0xVCyf3qf6w/XnmL/wArB/4M3/Y/
+np2T+9T/AFh+vPMX/lYP/Bm/7H8nH6Ze4fewl9Ufefuf/9GS/kb/AMobef8AbVl/6h7fOrx9BnKP
+yN/5Q28/7asv/UPb51ePoMlk+uXvYw+ke5fmzZsiydmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZs
+VdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmz
+ZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVd
+mzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmPTNmPTFULJ/ep/rD9eeYv
+/Kv/APgzf9j+enZP71P9YfrzzH/5V/8A8Gb/ALH8nH6Z+4fewl9Ufefuf//SMPyuu7qy/L28mtJP
+SlOsuvKitsbeCuzBhksXXdfoKXtP+ecX/NGQz8uSB+XV0O7a0wH0WsLfqGSVWAUVzU9q5csdSRCc
+4ihsCQGED6I+5H/p7zD/AMtx/wCRcP8A1Tzfp7zD/wAt3/JOH/mjABkGN9TwzBGfU/6rP/TFNpj+
+nfMP/Ld/yTh/6p5X6f8AMA/4/wD/AJJRf80YXczm5ZIZ8/8Aqs/9MVtMD5g8wf8ALcf+RcX/ADRl
+f4g8w/8ALb/yTi/5owByzcsP5jN/qk/9MVtH/wCIPMP/AC2/8k4v+aM3+IPMP/Lb/wAk4v8AmjAH
+LNyw/mM3+qT/ANMVso//ABB5h/5bf+ScX/NGb/EHmH/lt/5Jxf8ANGF/PL5Y/mM/+qS/0xW0f/iD
+zD/y2/8AJOL/AJozHzB5h/5bf+ScX/NGF5bGlqe+EZ83+qz/ANMUElHt5j8xA7Xu3/GOL/mjGnzJ
+5j/5bv8AknF/zRhazb7Zq5cM2T+fL/TFrMpd6Y/4k8x/8t3/ACTi/wCaMv8AxJ5j/wCW7/knD/zR
+hbyzcsPj5f58vmUcUu8pl/iTzH/y3f8AJKL/AKp5v8SeY/8Alu/5Jxf9U8LeW2X16YPHy/z5fMrc
+u8pj/iPzH/y3f8k4v+qeX/iPzHSv17/knF/1Twuocep+nIHU5BynL5lkOLvKNHmTzGf+P3/klF/z
+Rm/xH5j/AOW7/klF/wBU8BUFa5hsdhj+Zy/z5fMpqXeUd/iLzJ2vv+SUX/VPMfMXmMf8f3/JKL/m
+jAJIrTNyWuI1OX+fL5ld+8/NG/4j8x/8t3/JKL/qnm/xH5j/AOW7/klF/wBU8AFhTYdMZzrkxny/
+zpfMsSZd5TL/ABH5j/5bv+SUX/VPN/iPzH/y3f8AJKL/AJowt5ZXMfPD4+X+fL5ljxS7ymf+JPMf
+/Ld/ySi/5ozf4k8xf8t3/JOL/mjC34z7Y4IO+5x8fJ/Pl80ccu8o/wDxL5j7XxP/ADyi/wCaMseY
+vMp631P+eUX/AFTwCKDpmx8fL/Pl8yjjl3lMP8ReY/8Alv8A+SUP/VPN/iHzJ/y3/wDJKH/qnhfy
+AyvUHYY+Nm/ny+ZXin3lMf8AEPmP/lv/AOSUP/VPN/iHzF3v/wDklD/1TwtMhOVywjJl/wBUl8yn
+il3n5pkfMfmL/lu/5JQ/9U8r/EfmP/lu/wCSUX/NGF1c1aZMZMn8+XzK8cu8/NMf8R+Y/wDlu/5J
+xf8AVPN/iTzH/wAt3/JOL/qnhbyzcsPiZP50vmV45d5TL/EnmP8A5bv+ScX/AFTzf4k8x/8ALd/y
+Ti/6p4W8s3LB4uT+fL5rxS7ymX+I/Mf/AC3f8kov+aMx8yeYh/x/f8kov+aMLeWWCo7VPicHi5f5
+8vmV45d5TJfMXmU7/XqD/jFD/wBU8v8AxF5jHW//AOSUP/VPCwuTlVweLk/ny+ZXil3lMv8AEfmL
+/luP/IqH/qnm/wAR+Y/+W7/klF/zRhdyyuWROeY/jl8ykSl3lMv8SeY/+W7/AJJRf80ZX+JPMf8A
+y3f8k4v+qeF1cuuR/MZek5fMpuXeUxHmPzH/AMt3/JOL/qnl/wCI/Mfe+/5Jxf8ANGFtc1cRnzH+
+OXzK8Uu8pl/iPzH/AMt3/JOL/mjN/iPzF/y3f8kov+aMLeWblkvGy/z5fMo4pd5TL/EfmP8A5bv+
+ScX/ADRm/wAR+Y/+W7/knF/zRhbyzcsPi5f58vmV4pd5TL/EfmP/AJbv+ScX/NGb/EfmP/lu/wCS
+cX/NGFvLNyx8bL/Pl8yvFLvKY/4k8x9r7/knF/zRmHmTzH/y3f8AJOL/AKp4Xcs1cHi5f58vmU8R
+7ymP+JPMf/Ld/wAk4v8AmjMfMnmL/lu/5JRf80YXVrmr7YDly/6pL5leM95TH/EnmP8A5bf+ScX/
+ADRm/wASeY/+W7/knF/1TwtLAZviboKD3yEs+Uf5SX+mKeM95TL/ABJ5j/5bv+ScX/NGV/iXzH2v
+Sf8AnlF/zRgARgbnc5ZKjIfmM/Scv9MV4z3lHjzF5lPW+p/zyi/6p44+YvMY63//ACSh/wCqeFvq
+HttlVxGbPe+Sf+mK3LvKY/4k8x/8t3/JKH/qnm/xJ5i/5bj/AMiov+qeFtcvc5Z4+X/VJf6Yrcu8
+pj/iTzH/AMt3/JOL/qnm/wAR+Y/+W7/klF/1TwBscsHscTqcvScvmUji7yjx5i8yf8tv/JOL/mjF
+P8QeYu99t/xji/5owvDDLBGUy1OfpkkP84tg96Yfp/zDX/e7b/jHF/zRl/p/zB/y2/8AJOL/AJow
+vrmrlX5rUf6rP/TFkmH6f8wf8tv/ACTi/wCaM36f8wf8tv8AyTi/5owvrmrj+Zz/AOqz/wBMVTD9
+P+YP+W3/AJJxf80Zv8QeYP8Alt/5Jxf80YX1yuVdhucH5rP/AKrP/TFUefMHmEf8fv8AyTi/5oyx
+r/mJv+P3b/jHF/zRgEL3brjq4fzec8sk/wDTFCO/T3mH/lu/5JRf80Zv075h/wCW4/8AIuH/AKp4
+Brmrj+a1H+qz/wBMUJlY6zrUuqWUNxdepFJKquvCMVBPiqA5xf8A8q//AODN/wBj+db04/7mNP8A
++M6frzkn/lX/APwZf+x/Nhhy5T2fqJmcjIGNGzY9UerGR3j7z9z/AP/TW/Lw0/Lyb/ttyf8AUFHh
++G2GR/8AL/b8u5v+23J/1Bx4eK2wzVdq/wCM/wCaP0tcPpj7lXkM3LE+Qzcs19MlTlm5YnyzcsaV
+U5ZuWJ8s3LGlVOWblifLNywqqcs3LE+WUWxpVzPTGNICNsTLeOVXLYxDUSv5ZqjE65dclbFfyy69
+sT5ZYJ+eAlICquPAodsYG9svllRkS2CIVKjNyGJ8hjTIMFFkrcsrn9+IGUeNMazknYfwyQh3sTIK
+xl7d8Yzj5YnRjuWAy6J33ywRrkGsytv1PDfHDke1MbyUdBm9Q5IRLEkrwg774+qjbbEC5OblhEEU
+r818coyDsMR5ZVclwhaVvUPyyi2JcsuuGlX1GaoxlcrliqpUZuWMqc1ThCaX1zcsZmrhtFL+WVyx
+lc1cbVU5ZuWJ1zcsiSmlTlmrifLNyyNrSpyGblifLNywFVSozVGJ1zVyFMlXkM3IYlXNywgIVSwz
+chiXLNyyQCFXkM3IYlyzcsKqvLNyGJVy+WKqnLNyxLlm5Yqq8s3LES/0nLAY9TQYCQFXlx/YMscm
+9hlAKvTLLgdN8iSTyQqKoG/68xcDpiBcnNyrkOHfdkArGQnKrvviZbbbbxyg+Gk0q1HhmDDEueVy
+xpVYv3yuY7dcS5Zq4eELasJNsrmOmJVzVxoLat6lPc44S0wPXNXBKAKRIoj1QSfwxwl364F5ZXOh
+yo4wy4yjfUqNs3LxwKjE+2E2p+Zkt7tdI0aA6trUnwpZwbhD/NO/2Y1X9r/jXIRw5Jy4MceIlmJ2
+yRQW67DFBRRtkXu08+eVUj1DzDDFqenTAPcGxWj2hP7JWi+pGv8Avz4v+MmHGn6pZapbi5sZlmjP
+h1Hsy9VOHPos+EjxAKPUbxZE0j+WbliXKuauViDC1WuauJVzVyQACLRemn/czp//ABnT9ecn/wDK
+v/8Agy/9j+dV0w/7mtO/4zp+vOV/+Ve/8GX/ALH82OH/AIztT/Wj/uoIP8PvP3P/1H+Qdvy6n/7b
+cn/UHHhwrbDCbyJt+XE//bcf/qDjw0DbDNZ2p/jJ9w/S1w+iPuVuWbliXLNyzAZKvLNyxHnljkeg
+yJICq3LK5Yzie5pm+Ae+DiHRNL+den4ZdT3xPn4bZXLHiWlWuMJI743njGfJRsnkiVALiT3yq4ly
+yuRy4RPUtRVuWavviXI98wO+HhQr9KY8HEg22+XypkCCWYpV5ZuWIlvDGl9vbEQSZK7PjC2JFvfG
+8snGADAyKtXNyOJcs3LJ0xVa++bliPLNywgIVuWbliPPNzwqrcs3LEeeVz98VV+Wbl74hyJ7ZfxH
+rQY2FVuWVzxPYd65sFrSpyxwrscSBy+YG2RJPRkB3qtTm54iXp0yuZwgFSVbllcsS5ZuWSpiq8s3
+LEeWblgKq3LNyxLlm5YKSq8s3LEuWVyxVW5Zq4lyzcsgVVa5uWJcsrliAqtyzcsR5ZfLJUqryzcs
+S5ZuWFCryzcsR5ZueKVblm5YhzJ6b5YBP2j9GAkIVedem+WATux+jGggdMxkAyO5VVFB0GYuBgcy
+E5uWERWlYuTlcsS5ZuWGkqtc1cS5ZuWRKVXl75q4lyzcsCqtc1cS5Zq4qq1zcsS5ZuWSCFWubliQ
+bKrh2VV5ZuXviY5N0298cFA365EkKuBLe2JXd5Z6dbvd3sywwRiryOaAf1P+TivLOd69Ol35xe21
+RGutPsoo3itOVI+bBSXZOjn4v2slp8Jz5eC6HM+5MY8RpPILrXvO0noaMH0rRSaSalIKTzL3+rp+
+yp/n/wCG/YzonlnQdE8q23o6ZAFkenrXDfFLIR3kkO7f8Q/ycjmn+YdOe2H1ZljRAAU6Up2ply+Z
+O0P/AATf0ze4tPDFHhxiu89S3gAbB6A+oJIpWShU9Qc5/rXleziuW1Ty3cLYXpJMkKH9zJ3oyDZf
+9j/wOBJNZll+3KT7V2+7E/0n/lZYcYIIkLB5g8kq1jrxMostViNpeDbf7D+6N74dBwe+c813zTYS
+j6jDGt7c148wfhiNdzzHVv8AIXJF5bu5prORJW5ei/BSetKVzS67QwxDxMRoXRj3X3FhIVuyHllh
+sQD5fLNbVMUdpRrrenf8Z0/XnL//ACr3/gy/9j+dM0hq67pv/GdP15zP/wAq9/4Mv/Y/mfh/4z9T
+/Wj/ALqKn+H3n7n/1b8jmn5bz/8Abcf/AKg48MFLECgwB5G/8lndnw1s0/6RoRhgrbDNT2tKQ1JA
+HQMMf0R9y4Kx6mmWEXvvjDIBjTKTmu4Znmz2V6quUZPDA/PK5ZIYiiwr8z45XLEeXvlVyYxravyy
+uWI1y+WSEEWqF8Yz9uvvjC2M5ZZGIYSKpXNXEuWblllMFXllhsR5ZfPbEqiA1O+Vz7jpiHP3yufv
+ka702rF65XLEuROb4j2w7MVXlm5YnRvGmXTxONhV3LNz98oKPnjqAdseMK1yr75Y5HtT55uXhmLE
+4OMq2Q3jlhfE4wuBjTJj6j1VVCjL5KMQLk5XLDw960rmQ9srnU74jyzcsNJVuWbniPLNyxpVbnlc
+sS5ZuWEBCryzcsS5ZuWSVV5ZuWJcs3LAtKvLNyxLlm5ZFVXlm5YlyzcsU0q8s3I4lyzcsBWlXlm5
+YlyzcsFWqryzcsRqc1cNLStyzcsSrlchiqtzyueJAk9B9OOCjvvgJQu5FugrjgpP2jlA5RemDcqq
+9M3MDEC5yuWERVWMhOVXEuWblkqSq8s3LEuWblihV5ZuWJcs3LAUqvLNyxOublkUqoIrvl96Ylzr
+juXvkTaQAv28cvvtifOvTtjuYyJkQyEQvG25yq++UKn2GOAAyHifFPC4KxPgMeFCjxOVyyq48RKK
+Cpt0yiKjfrjK5fLGyig7fIBqUXqeb9QNP90Rf8RTJ/XIfNEJPNl+fGCOn3Jmd2Yb1P8AmH7wyhGi
+lEkcsD+pESjDuO/zxyao/wBmX4W8exw0ubXrthNdWvXbN6bHJmqzavFbxmWaQIg6k/w8cjt3r1/q
+zG3tuVvanYkH43H+Uf2V/wAlcBX9pLPqJjYkxoF4g9BUZINJ0jdfhyu5SNcla0nSQOJ49N8nPlo8
+YbkH/fv/ABqM2n6WEiZ2AAVSSTsBtjPL5pHc/wDGX/jUZi9oRAwAf0gwyfT8WQcwOhx4auBOWPVx
+mkmNmuPNM9GNde0z/jOn685z/wCVe/8ABl/7H86FojV1/TP+YhP15z3/AMq9/wCDL/2P5lYT/rfq
+f60f91FnIbx95+5//9avJZp+Ws5/7Xj/APUHHgkOaDfAnk7b8s7j/tuP/wBQceKhthmv7SAOpPuD
+VD6Y+5V5ZuWJcjm5HMOmSryzcsS5ZuRxpCryzcsS55uRxVV5ZuWJ/Ee2XxbxwWFbLHEy2WVA6muV
+sOmTiWEi7lXL+LwzVpm5e+EyQ2Ae5pl08TjeWblkTJV9FHbLqPDE65uWCyVVOWblidcwJw0hUrjg
+ab98TBA3JzGUD3wbnkyEVUttjS9O+INITjeWSEO9BVzJ4Y0uTiXLNyydBVTlmrifLNywqqVzVxPl
+m5YqqVzVxPlm5YqqVzVxPlm5Yqqcs3LEq5q4VVeWbliVc1cKFXlmriVcvlgKVSuauJ8s3LAqpXNX
+E+WbljSqlc1cT5ZuWAgpVK5q4nyOUWwiKFXllcsTFT02x4AHXc4EWuBJ6fjjgAOu5xtcrmBgolVW
+ub1AMQLk5VcRAdU0qmQnK5Yz5ZvbJbJpfXNXGjNjstLq5q43NXBaaXVzVxhJ65VThRSpyzcsT5Zu
+RyJVU5ZuWJcvfLBPbIqqcswemMC+JxwoOmRMlXgufYY8NQUHXxxLlm5ZAi+i2Vb1DjvUrgctm5Y8
+IXiKJ55fLA3OnzyxIfHHgTxIjlm5YH5nN6h8ceAp4giA2FWr6NHqDLdQsYb2Mfu5V2rTscGiQ+Ob
+1DvvjDjxzE4HhI6p4wx9LqaNvq2ppwlGwmp8Le5xlzbVFRuD0OHtxDFdR+nMvIePcH2wnltLixqU
+Pq2/h3GbrTa+OQCGWoy7/wCE/qZCYKRppvq3rPx60yTW8Ntp8QluSFFKhe5wvN9DbAeipe4k+woF
+T9AxaDS57thPqjVB3FuDUf7M/tZkZtRjwjc2TyA5pMgObct7f60fRsx6NoDvJ+z9Ff7xvf7OG1la
+RWUIhiqd6szGpJPUnHIFjUIgCqNgBl8s0+fUZMx9WwHIDk1SkSq1y1eh9sR5ZfLMcjZiE20B6+Yd
+M/5iE/XkD/8AKvf+DL/2P5NfL7U8xaWT0+sxj7zT+OQv/wAq7/4Mv/Y/mXhj/gOoHnH/AHUWRP0+
+8/c//9dvk7/yV95/22z/ANQ0OPFCBXGeT/8AyV95/wBtz/sWhywdhmu7S/xg+5qj9MfcuI8Mogj3
+yq5q5hXXVk4Bj7ZfHxOauavvgMvNVwCjLrjKjMWAyNrSpXKDYnz2xpcYRZQaXscbyxOuauTAYFUr
+mridc1caQqVzVxOuUWHjkhFVWubliJkxvInJiC0rlwM3qHtiFc1clwhKqXJyuRxOuauNKqVzVxOu
+auGlVK5VTjK5q4qqVzVxOuVXFVSpy64nXNXFV9cuuJVy64qqVzVxOuVXFVTlm5YnXNXJIVOWblid
+c1cVVOWblidc1cFKqcs3LGZsdglUrmrjR08c21cBkvCurlVOZQT7Y8Ko3yPGmltGPtjwoG/U5eVy
+AwcRKOFcMxNMTMmNDg4pEQqlq9MbWvtjOQzcgcU0F+XXEw2bkMO60FSuauJFxlc8aW1blm5Ylyyu
+XhjS2rcs3LEOVM3LDSLVuWauIgsdsdTxODZbX8vDLoT7Y2oGblkTaLXgAe+XXGcq5VcFd6FSubkM
+TrmrjwhVSuauJ1zVwcKqlc3LE65q4KVUrm5YnXNXJBVTlm5YnXNXCqpXNXE65q5EhVTlmridc3LI
+0lattbxyGVIlWQ9WAFcVLYnXNXJLS+uauMrmrhpC+uXXGVyi3bHhVMtBYf4h0sf8vUP/ACcXIf8A
++Vc/8GX/ALH8lfl818xaV/zFQ/8AJxcin/lW/wDwZP8AsfzMxD/A8484/wC6ik/w+8/c/wD/0E/K
+Rp+V14aV/wBzfQf8w0OJiY0/u2+45wfNms7Ur8ybvkGGP6I+57x6x/323/AnL9Y/77b/AIE5wbNm
+B6fNm949Y/77b/gTm9dv99t/wJzg+bEcPmr3czt2jb/gTjfXfvG//AnOFZsmOGmBe5md6/3bf8Cc
+r1m/kb/gTnDc2WDh82D3P1m/kb/gTm9Zv5G/4E5wzNh9KHufrN/I3/AnKM7f77f/AIE5w3Nk48C7
+PcDM/wDI3/AnK9Zv5G/4E5xDNk9le3es38jf8Cc3rN/I3/AnOI5sOyXt3rN/I3/AnN6zfyN/wJzi
+ObHZXt3rN/I3/AnN6zfyN/wJziObHZXt3rN/I3/AnN6zfyN/wJziObHZD271m/kb/gTm9Zv99t9x
+ziObBsuz271W7o33HN6x/kb7jnEc2Oyvb/Wb+Rv+BOV6zfyN/wACc4jmw7K9u9Zv5G/4E5vWb+Rv
++BOcRzY7Je3es38jf8Cc3rN/I33HOI5sdkPbvVb+RvuOX6zfyN9xziGbDsr271m/kb7jm9Y/yN9x
+ziObHZXt3rN/I33HL9Y/yN9xziGbHZXuHrH+RvuOX6zf77b/AIE5w7NkTTJ7iJmI+wwHyOOE1P2G
+P+xOcMzZA8KHuvrt/vtv+BOYzsB/duf9ic4Vmwenqr3P6xJ/vt6f6p/pjDO/++2/4E5w/NkvSnd7
+f6zV2Rv+BOb1mr9hv+BOcQzYfSh7f6zfyN/wJzes38jf8Cc4hmw7K9v9Zv5G/wCBOb1m/kb/AIE5
+xDNjsr271m/kb7jl+s38jf8AAnOIZsdkPbvWb+RvuOb1m/3233HOI5sTXRXt4kPdW+444TeCN9xz
+h2bImuqvc/WP8jf8Ccr1m/kb/gTnDc2D0q9z9Zv99t/wJzesf5G/4E5wzNkTwrs9z9Y/yN/wJzes
+38jf8Cc4ZmxFea7PcvWP8jf8Cc3rN/I3/AnOG5slsuz3P1j/ACN/wJyvWb+Rv+BOcNzY+ldnuXrH
++Rv+BOb1j/I3/AnOG5sfSh7l6zfyN/wJzes38jf8Cc4bmx9KvcvWP8jf8Cc3rH+Rv+BOcNzY+lXu
+XrH+Rv8AgTm9Zv8Afbf8Cc4bmwGk7PcvWb+Rv+BOV6x/kb7jnDs2Q9Pml7l6zfyN9xzesf5G/wCB
+OcNzZIcKC9y9Y/yN/wACc3rN/I33HOG5sl6V2e5Gdu0bf8Ccb6p7o33HOH5sJrokU+gvLjlvMelD
+iR/pUPUH/fi5F/8AyrX/AIMn/Y/nJc2ZOL/FM/vj/uoplVx95+5//9k="));
+		break;
+		case "01_hdot.gif":
+			header("Content-type: image/gif");
+			echo trim(base64_decode("
+R0lGODlhAwABAJEAAAAAAP///1xcXP///yH5BAEAAAMALAAAAAADAAEAAAIC1FYAOw=="));
+		break;
+	}
+}
+?>
diff -x .svn -ruN 0.7.7.src/login.php 0.7.11.src/login.php
--- 0.7.7.src/login.php	2006-11-28 12:01:46.000000000 -0600
+++ 0.7.11.src/login.php	2007-03-05 15:35:01.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/login.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/28 18:01:46 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.12 $
+|     $Date: 2007/03/05 21:35:01 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -56,18 +56,18 @@
 			require_once(e_BASE.$THEMES_DIRECTORY."templates/login_template.php");
 		}
 	}
-	$text = preg_replace("/\{(.*?)\}/e", '$\1', $LOGIN_TABLE);
-
-	echo preg_replace("/\{(.*?)\}/e", '$\1', $LOGIN_TABLE_HEADER);
+	$text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE);
+	echo preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_HEADER);
 
 	$login_message = LAN_LOGIN_3." | ".SITENAME;
 	$ns->tablerender($login_message, $text, 'login_page');
 
+	$LOGIN_TABLE_FOOTER_USERREG = '&nbsp;';		// In case no registration system enabled
 	if ($pref['user_reg'])
 	{
 		$LOGIN_TABLE_FOOTER_USERREG = "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>";
 	}
-	echo preg_replace("/\{(.*?)\}/e", '$\1', $LOGIN_TABLE_FOOTER);
+		echo preg_replace("/\{([^ ]*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_FOOTER);
 
 }
 else
diff -x .svn -ruN 0.7.7.src/news.php 0.7.11.src/news.php
--- 0.7.7.src/news.php	2006-11-11 22:10:29.000000000 -0600
+++ 0.7.11.src/news.php	2007-12-11 14:37:01.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/news.php,v $
-|     $Revision: 1.111 $
-|     $Date: 2006/11/12 04:10:29 $
-|     $Author: mrpete $
+|     $Revision: 1.125 $
+|     $Date: 2007/12/11 20:37:01 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -21,87 +21,123 @@
 require_once(e_HANDLER."comment_class.php");
 $cobj = new comment;
 
-if (isset($NEWSHEADER)) {
-	require_once(HEADERF);
-	require_once(FOOTERF);
-	exit;
+if (isset($NEWSHEADER)) 
+{
+  require_once(HEADERF);
+  require_once(FOOTERF);
+  exit;
 }
+
 $cacheString = 'news.php_'.e_QUERY;
 $action = '';
-if (!defined("ITEMVIEW")){
-	if ($pref['newsposts']==""){
-		define("ITEMVIEW", 15);
-	} else {
-		define("ITEMVIEW", $pref['newsposts']);
-	}
+$sub_action = '';
+$order = "news_datestamp";
+$newsfrom = 0;
+
+if (!defined("ITEMVIEW"))
+{
+  define("ITEMVIEW", varset($pref['newsposts'],15));
 }
 
-if (e_QUERY) {
-	$tmp = explode(".", e_QUERY);
-	$action = $tmp[0];
-	$sub_action = $tmp[1];
-	$id = $tmp[2];
+if (e_QUERY) 
+{
+  $tmp = explode(".", e_QUERY);
+  $action = $tmp[0];						// At least one parameter here
+  $sub_action = varset($tmp[1],'');			// Usually a numeric category, but don't presume yet
+  $id = varset($tmp[2],'');					// ID of specific news item where required
+  $newsfrom = intval(varset($tmp[2],0));	// Item number for first item on multi-page lists
 }
 
-$from = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
-if (isset($tmp[1]) && $tmp[1] == 'list') {
-	$action = 'list';
-	$from = intval($tmp[0]);
-	$sub_action = intval($tmp[2]);
+//$newsfrom = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
+
+// Usually the first query parameter is the action.
+// For any of the 'list' modes (inc month, day), the action being second is a legacy situation
+// .... which can hopefully go sometime
+if (is_numeric($action) && isset($tmp[1]) && (($tmp[1] == 'list') || ($tmp[1] == 'month') || ($tmp[1] == 'day')))
+{
+	$action = $tmp[1];
+	$sub_action = varset($tmp[0],'');
 }
-if ($action == 'all' || $action == 'cat') {
-	$from = intval($tmp[2]);
-	$sub_action = intval($tmp[1]);
+
+
+
+if ($action == 'all' || $action == 'cat') 
+{
+  $sub_action = intval(varset($tmp[1],0));
 }
 
+/*
+Variables Used:
+	$action - the basic display format/filter
+	$sub_action - category number or news item number
+	$newsfrom - first item number in list (default 0) - derived from nextprev
+	$order - sets the listing order for 'list' format
+*/
+
+
 $ix = new news;
 $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
-if ($action == 'cat' || $action == 'all'){
 
-	// --> Cache
-	if($tmp = checkCache($cacheString)){
+//------------------------------------------------------
+//		DISPLAY NEWS IN 'CATEGORY' FORMAT HERE
+//------------------------------------------------------
+// Just title and a few other details
+if ($action == 'cat' || $action == 'all')
+{	// --> Cache
+	if($tmp = checkCache($cacheString))
+	{
 		require_once(HEADERF);
 		renderCache($tmp, TRUE);
 	}
 	// <-- Cache
 
-	$qs = explode(".", e_QUERY);
 
-	$category = intval($qs[1]);
-	if ($action == 'cat' && $category != 0)	{
+	$category = intval($sub_action);
+	if ($action == 'cat' && $category != 0)	
+	{
 		$gen = new convert;
 		$sql->db_Select("news_category", "*", "category_id='$category'");
 		$row = $sql->db_Fetch();
 		extract($row);  // still required for the table-render.  :(
 	}
-	if ($action == 'all'){
-		if(!defined("NEWSALL_LIMIT")){ define("NEWSALL_LIMIT",10); }
+	if ($action == 'all')
+	{
+		if(!defined("NEWSALL_LIMIT")) { define("NEWSALL_LIMIT",10); }
 		// show archive of all news items using list-style template.
-		$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."'");
+		$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
 		$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
-		AND (n.news_end=0 || n.news_end>".time().")  ORDER BY n.news_sticky DESC,n.news_datestamp DESC LIMIT ".intval($from).",".NEWSALL_LIMIT;
+		AND (n.news_end=0 || n.news_end>".time().")  
+		ORDER BY n.news_sticky DESC, n.news_datestamp DESC 
+		LIMIT ".intval($newsfrom).",".NEWSALL_LIMIT;
 		$category_name = "All";
 	}
-	elseif ($action == 'cat'){
+	elseif ($action == 'cat')
+	{
 		// show archive of all news items in a particular category using list-style template.
 		$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_category=".intval($sub_action));
-		if(!defined("NEWSLIST_LIMIT")){ define("NEWSLIST_LIMIT",10); }
+		if(!defined("NEWSLIST_LIMIT")) { define("NEWSLIST_LIMIT",10); }
 		$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_category=".intval($sub_action)." ORDER BY n.news_datestamp DESC LIMIT ".intval($from).",".NEWSLIST_LIMIT;
+		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") 
+		AND n.news_category=".intval($sub_action)." 
+		ORDER BY n.news_datestamp DESC 
+		LIMIT ".intval($newsfrom).",".NEWSLIST_LIMIT;
 	}
 
-	if($category_name){
-		define("e_PAGETITLE", $category_name);
+	if($category_name)
+	{
+		define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
 	}
 
 	require_once(HEADERF);
 
-	if(!$NEWSLISTSTYLE){
+	if(!$NEWSLISTSTYLE)
+	{
 		$NEWSLISTSTYLE = "
 		<div style='padding:3px;width:100%'>
 		<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
@@ -109,7 +145,7 @@
 		<td style='vertical-align:top;padding:3px;width:20px'>
 		{NEWSCATICON}
 		</td><td style='text-align:left;padding:3px'>
-		{NEWSTITLELINK}
+		{NEWSTITLELINK=extend}
 		<br />
 		{NEWSSUMMARY}
 		<span class='smalltext'>
@@ -130,17 +166,22 @@
 	$newsList = $sql->db_getList();
 	foreach($newsList as $row)
 	{
-		$text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
+	  $text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
 	}
 
 	$amount = ($action == "all") ? NEWSALL_LIMIT : NEWSLIST_LIMIT;
 
 	$icon = ($row['category_icon']) ? "<img src='".e_IMAGE."icons/".$row['category_icon']."' alt='' />" : "";
-	$parms = $news_total.",".$amount.",".$from.",".e_SELF.'?'.$action.".".$sub_action.".[FROM]";
+	$parms = $news_total.",".$amount.",".$newsfrom.",".e_SELF.'?'.$action.".".$category.".[FROM]";
 	$text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
 
-    if(!$NEWSLISTTITLE){
-		$NEWSLISTTITLE = LAN_NEWS_82." '{$category_name}'";
+    if(!$NEWSLISTTITLE)
+	{
+		$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"TITLE")."'";
+	}
+	else
+	{
+    	$NEWSLISTTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,"TITLE"),$NEWSLISTTITLE);
 	}
 
 	ob_start();
@@ -151,27 +192,50 @@
 	exit;
 }
 
-if ($action == "extend") {
 
-	// --> Cache
-	if($tmp = checkCache($cacheString)){
-		require_once(HEADERF);
-		renderCache($tmp, TRUE);
+
+//------------------------------------------------------
+//		DISPLAY SINGLE ITEM IN EXTENDED FORMAT HERE
+//------------------------------------------------------
+if ($action == "extend") 
+{	// --> Cache
+	if($tmp = checkCache($cacheString))
+	{
+	  require_once(HEADERF);
+	  renderCache($tmp, TRUE);
 	}
 	// <-- Cache
 
-	$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
+	if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) 
+	{
+	  $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id=".intval($sub_action);
+		LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id
+		WHERE n.news_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."' 
+		AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") 
+		GROUP by n.news_id";
+	}
+	else
+	{
+	  $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
+		LEFT JOIN #user AS u ON n.news_author = u.user_id
+		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
+		WHERE n.news_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."' 
+		AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") ";
+	}
 	$sql->db_Select_gen($query);
 	$news = $sql->db_Fetch();
 
-	if($news['news_title']){
-		if($pref['meta_news_summary'] && $news['news_title']){
-        	define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
-		}
-		define("e_PAGETITLE",$news['news_title']);
+	if($news['news_title'])
+	{
+	  if($pref['meta_news_summary'] && $news['news_title'])
+	  {
+       	define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
+	  }
+	  define("e_PAGETITLE",$news['news_title']);
 	}
 
 	require_once(HEADERF);
@@ -184,97 +248,123 @@
 	exit;
 }
 
-if (empty($order)){
-	$order = "news_datestamp";
+
+//------------------------------------------------------
+//			DISPLAY NEWS IN LIST FORMAT HERE
+//------------------------------------------------------
+// Show title, author, first part of news item...
+if (empty($order))
+{
+  $order = "news_datestamp";
 }
 $order = $tp -> toDB($order, true);
 
-$interval = 10;
-if ($action == "list"){
+$interval = $pref['newsposts'];
+
+switch ($action)
+{
+  case "list" :
 	$sub_action = intval($sub_action);
-	$news_total = $sql->db_Count("news", "(*)", "WHERE news_category=$sub_action AND news_class REGEXP '".e_CLASS_REGEXP."' AND news_render_type<2");
-	$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
+	$news_total = $sql->db_Count("news", "(*)", "WHERE news_category={$sub_action} AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
+//	$query = "SELECT  SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
+	$query = "SELECT  n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
-		AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2
-		AND n.news_category={$sub_action} ORDER BY n.news_sticky DESC,".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
-}
-elseif($action == "item")
-{
+		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") 
+		AND n.news_category={$sub_action} 
+		ORDER BY n.news_sticky DESC,".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
+	break;
+
+
+  case "item" :
 	$sub_action = intval($sub_action);
-	$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
+	$news_total = 1;
+	if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) 
+	{
+	  $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id={$sub_action}";
-}
-elseif(strstr(e_QUERY, "month"))
-{
-	$tmp = explode(".", e_QUERY);
-	$item = $tp -> toDB($tmp[1]);
-	$year = substr($item, 0, 4);
-	$month = substr($item, 4);
-	$startdate = mktime(0, 0, 0, $month, 1, $year);
-	$lastday = date("t", $startdate);
-	$enddate = mktime(23, 59, 59, $month, $lastday, $year);
-	$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
+		LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id
+		WHERE n.news_id={$sub_action} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
+		GROUP by n.news_id";
+	}
+	else
+	{ 
+	  $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2 AND n.news_datestamp > $startdate AND n.news_datestamp < $enddate ORDER BY ".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
-}
-elseif(strstr(e_QUERY, "day"))
-{
-	$tmp = explode(".", e_QUERY);
-	$item = $tp -> toDB($tmp[1]);
+		WHERE n.news_id={$sub_action} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")";
+	}
+	break;
+
+  case "month" :
+  case "day" :
+	$item = $tp -> toDB($sub_action).'20000101';
 	$year = substr($item, 0, 4);
-	$month = substr($item, 4, 2);
-	$day = substr($item, 6, 2);
+	$month = substr($item, 4,2);
+	if ($action == 'day')
+	{
+	  $day = substr($item, 6, 2);
+	  $lastday = $day;
+	}
+	else
+	{	// A month's worth
+	  $day = 1;
+	  $lastday = date("t", $startdate);
+	}
 	$startdate = mktime(0, 0, 0, $month, $day, $year);
-	$lastday = date("t", $startdate);
-	$enddate = mktime(23, 59, 59, $month, $day, $year);
+	$enddate = mktime(23, 59, 59, $month, $lastday, $year);
 	$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2 AND n.news_datestamp > $startdate AND n.news_datestamp < $enddate ORDER BY ".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
-}
-else
-{
+		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") 
+		AND n.news_render_type<2 AND n.news_datestamp > {$startdate} AND n.news_datestamp < {$enddate} 
+		ORDER BY ".$order." DESC LIMIT ".intval($newsfrom).",".ITEMVIEW;
+
+	$news_total = $sql->db_Count("news", "(*)", "WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") 
+		AND n.news_render_type<2 AND n.news_datestamp > {$startdate} AND n.news_datestamp < {$enddate}");
+	break;
+
+  default :
+    $action = '';
 	$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_render_type<2" );
 
 	if(!isset($pref['newsposts_archive']))
 	{
 		$pref['newsposts_archive'] = 0;
 	}
-	$interval = $pref['newsposts']-$pref['newsposts_archive'];
+	$interval = $pref['newsposts']-$pref['newsposts_archive'];		// Number of 'full' posts to show
 
 	// Get number of news item to show
-	if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
+	if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) 
+	{
 		$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, COUNT(*) AS tbcount FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 		LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
-		AND NOT (n.news_class REGEXP ".$nobody_regexp.")
-		AND n.news_start < ".time()."
-		AND (n.news_end=0 || n.news_end>".time().")
+		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
 		AND n.news_render_type<2
 		GROUP by n.news_id
-		ORDER BY news_sticky DESC, ".$order." DESC LIMIT ".intval($from).",".$pref['newsposts'];
+		ORDER BY news_sticky DESC, ".$order." DESC LIMIT ".intval($newsfrom).",".$pref['newsposts'];
 	}
 	else
 	{
 		$query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 		LEFT JOIN #user AS u ON n.news_author = u.user_id
 		LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
-		AND NOT (n.news_class REGEXP ".$nobody_regexp.")
-		AND n.news_start < ".time()."
-		AND (n.news_end=0 || n.news_end>".time().")
+		WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.")
+		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")
 		AND n.news_render_type<2
-		ORDER BY n.news_sticky DESC, ".$order." DESC LIMIT ".intval($from).",".$pref['newsposts'];
+		ORDER BY n.news_sticky DESC, ".$order." DESC LIMIT ".intval($newsfrom).",".$pref['newsposts'];
 	}
-	// #### END ---------------------------------------------------------------------------------------------------
-}
+}	// END - switch($action)
+
 
 if($tmp_cache = checkCache($cacheString)) // normal news front-page - with cache.
 {
@@ -300,7 +390,7 @@
 			if($newsarchive = checkCache('newsarchive')){
 				$tmp_cache = $tmp_cache.$newsarchive;
 			}else{
-				newsarchive($newsAr);
+				show_newsarchive($newsAr,$interval);
 			}
 		}
 	}
@@ -308,22 +398,25 @@
 }
 
 
-if (!$sql->db_Select_gen($query)) {
-	require_once(HEADERF);
-	echo "<br /><br /><div style='text-align:center'><b>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</b></div><br /><br />";
-	require_once(FOOTERF);
-	exit;
-} else {
-	$newsAr = $sql -> db_getList();
-}
+//if (!($news_total = $sql->db_Select_gen($query))) 
+if (!$sql->db_Select_gen($query))
+{  // No news items
+  require_once(HEADERF);
+  echo "<br /><br /><div style='text-align:center'><b>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</b></div><br /><br />";
+  require_once(FOOTERF);
+  exit;
+} 
 
+$newsAr = $sql -> db_getList();
 
-$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $newsAr[1]['category_name'];
+
+$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"TITLE");
 
 if($action != "" && !is_numeric($action))
 {
-    if($action == "item" && $pref['meta_news_summary'] && $newsAr[1]['news_title']){
-		define("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
+    if($action == "item" && $pref['meta_news_summary'] && $newsAr[1]['news_title'])
+	{
+	  define("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
 	}
 	define("e_PAGETITLE", $p_title);
 }
@@ -340,18 +433,14 @@
 	}
 }
 
-
-/*
-changes by jalist 03/02/2005:
-news page templating
-
-*/
-if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php")) {
+if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php")) 
+{
 	// theme specific template required ...
 	require_once(THEME."news_template.php");
 
-	if($ALTERNATECLASS1){
-		return TRUE;
+	if($ALTERNATECLASS1)
+	{
+	  return TRUE;
 	}
 
 	$newscolumns = (isset($NEWSCOLUMNS) ? $NEWSCOLUMNS : 1);
@@ -380,15 +469,16 @@
 	$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT);
 
 	require_once(HEADERF);
-	echo $text;
-	setNewsCache($cacheString, $text);
-
-} else {
-	/*
-	changes by jalist 22/01/2005:
-	added ability to add a new date header to news posts, turn on and off from news->prefs
-	*/
-
+	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
+    $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
+    $text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
+//    $text=''.$text.'<center>'.$nextprev.'</center>';
+   
+    echo $text;
+    setNewsCache($cacheString, $text);
+} 
+else 
+{
 	ob_start();
 
 	$newpostday = 0;
@@ -408,21 +498,23 @@
 		$news = $newsAr[$i];
 		//        render new date header if pref selected ...
 		$thispostday = strftime("%j", $news['news_datestamp']);
-		if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader'])) {
-			echo "<div class='".DATEHEADERCLASS."'>".strftime("%A %d %B %Y", $news['news_datestamp'])."</div>";
+		if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader'])) 
+		{
+		  echo "<div class='".DATEHEADERCLASS."'>".strftime("%A %d %B %Y", $news['news_datestamp'])."</div>";
 		}
 		$newpostday = $thispostday;
 		$news['category_id'] = $news['news_category'];
-		if ($action == "item") {
-			unset($news['news_render_type']);
+		if ($action == "item") 
+		{
+		  unset($news['news_render_type']);
 		}
 
 		$ix->render_newsitem($news);
 		$i++;
 	}
-	$parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
+	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
 	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
-	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
+ 	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
 
 	$cache_data = ob_get_clean();
 	require_once(HEADERF);
@@ -432,15 +524,17 @@
 
 // ##### --------------------------------------------------------------------------------------------------------------
 
-function newsarchive($newsAr){
-	global $ns, $gen, $interval, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2;
+function show_newsarchive($newsAr, $i = 1)
+{
+	global $ns, $gen, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2;
 
 	// do not show the news archive on the news.php?item.X page (but only on the news mainpage)
 	require_once(e_FILE.'shortcode/batch/news_archives.php');
 
+	$textnewsarchive = '';
 	ob_start();
-	
-	$i = $interval + 1;
+
+	$i++;			// First entry to show
 	while(isset($newsAr[$i]))
 	{
 		$news2 = $newsAr[$i];
@@ -476,8 +570,8 @@
 					</tr>
 					</table>
 					</div>";
-
 		}
+
 		$textnewsarchive .= $tp->parseTemplate($NEWSARCHIVE, FALSE, $news_archive_shortcodes);
 		$i++;
 	}
@@ -488,8 +582,9 @@
 }
 
 // #### new: news archive ---------------------------------------------------------------------------------------------
-if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
-	newsarchive($newsAr);
+if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) 
+{
+  show_newsarchive($newsAr,$interval);
 }
 // #### END -----------------------------------------------------------------------------------------------------------
 
@@ -497,7 +592,7 @@
 	if (is_numeric($action)){
 		$action = "";
 	}
- //	$parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
+ //	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
  //	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
  //	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
 }
@@ -557,7 +652,7 @@
 	global $pref,$tp,$sql,$CUSTOMFOOTER, $FOOTER,$cust_footer,$ph;
 	global $db_debug,$ns,$eTraffic,$eTimingStart, $error_handler, $db_time, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb,$e107;
 	echo $cache;
-	if ($nfp && $pref['nfp_display'] == 2) {
+	if (isset($nfp) && isset($pref['nfp_display']) && $pref['nfp_display'] == 2) {
 		require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
 	}
 	render_newscats();
diff -x .svn -ruN 0.7.7.src/online.php 0.7.11.src/online.php
--- 0.7.7.src/online.php	2006-10-20 15:57:15.000000000 -0500
+++ 0.7.11.src/online.php	2007-10-08 15:15:23.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/online.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/10/20 20:57:15 $
-|     $Author: mrpete $
+|     $Revision: 1.16 $
+|     $Date: 2007/10/08 20:15:23 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -25,7 +25,7 @@
 	$class_check = TRUE;
 	list($oid, $oname) = explode(".", $uinfo, 2);
 	$sql2 = new db;
-	$sql2->db_Select("user", "user_id", "user_admin > '0' ");
+	$sql2->db_Select("user", "user_id", "user_admin > 0 ");
 	$row_2 = $sql2->db_Fetch();
 	$online_location = $pinfo;
 	$online_location_page = substr(strrchr($online_location, "/"), 1);
@@ -161,7 +161,7 @@
 		$tmp = explode(".", $tmp[1]);
 		if ($tmp[1] == "news") {
 			$id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
-			$sql->db_Select("news", "news_title, news_class", "news_id='".intval($id)."'");
+			$sql->db_Select("news", "news_title, news_class", "news_id=".intval($id));
 			list($news['news_title'], $news['news_class']) = $sql->db_Fetch();
 			$online_location_page = ($tmp[0] == "reply" ? COMMENT.": ".ONLINE_EL12." > ".$news['news_title'] : COMMENT.": ".$news['news_title']);
 			$online_location = "comment.php?comment.news.$id";
@@ -171,7 +171,7 @@
 			}
 		} elseif($tmp[1] == "poll") {
 			$id = ($tmp[0] == "reply" ? $tmp[3] : $tmp[2]);
-			$sql->db_Select("poll", "poll_title", "poll_id='".intval($id)."'");
+			$sql->db_Select("poll", "poll_title", "poll_id=".intval($id));
 			list($poll['poll_title']) = $sql->db_Fetch();
 			$online_location_page = POLLCOMMENT.": ".$poll['poll_title'];
 			$online_location = "comment.php?comment.poll.$id";
@@ -192,8 +192,8 @@
 			$qry = "
 			SELECT t.thread_name, f.forum_name, f.forum_class from #forum_t AS t
 			LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-			WHERE t.thread_id = '".intval($tmp[0])."'
-			";
+			WHERE t.thread_id = ".intval($tmp[0])
+			;
 			$sql->db_Select_gen($qry);
 			$forum = $sql->db_Fetch();
 			$online_location_page = ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum['thread_name']."->".ONLINE_EL15.": ".$t_page;
@@ -203,7 +203,7 @@
 				$online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\"";
 			}
 		} elseif(strstr($online_location, "_viewforum")) {
-			$sql->db_Select("forum", "forum_name, forum_class", "forum_id='".intval($tmp[0])."' ");
+			$sql->db_Select("forum", "forum_name, forum_class", "forum_id=".intval($tmp[0]));
 			list($forum['forum_name'], $forum['forum_class']) = $sql->db_Fetch();
 			$online_location_page = ONLINE_EL13." .:. ".$forum['forum_name'];
 			$online_location = str_replace("php.", "php?", $online_location);
@@ -212,9 +212,9 @@
 				$online_location_page = ONLINE_EL13.": \"".CLASSRESTRICTED."\"";
 			}
 		} elseif(strstr($online_location, "_post")) {
-			$sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_forum_id='".intval($tmp[0])."' AND thread_parent='0'");
+			$sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_forum_id=".intval($tmp[0])." AND thread_parent=0");
 			list($forum_t['thread_name'], $forum_t['thread_forum_id']) = $sql->db_Fetch();
-			$sql->db_Select("forum", "forum_name", "forum_id='".$forum_t['thread_forum_id']."'");
+			$sql->db_Select("forum", "forum_name", "forum_id=".$forum_t['thread_forum_id']);
 			list($forum['forum_name']) = $sql->db_Fetch();
 			$online_location_page = ONLINE_EL12.": ".ONLINE_EL13." .:. ".$forum['forum_name']."->".ONLINE_EL14." .:. ".$forum_t['thread_name'];
 			$online_location = e_PLUGIN."forum/forum_viewtopic.php?$tmp[0].$tmp[1]";
@@ -224,8 +224,8 @@
 		$class_check = FALSE;
 		$online_location_page = ADMINAREA;
 	}
-	$pm_installed = ($pref['pm_title'] ? TRUE : FALSE);
-	$ONLINE_TABLE_ICON = ($pm_installed && $oid != USERID ? $tp->parseTemplate("{pm_menu.sendpm={$oid}}") : "<img src='".e_PLUGIN."online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />");
+
+	$ONLINE_TABLE_ICON = (varsettrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "<img src='".e_PLUGIN."online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />");
 	 
 	$ONLINE_TABLE_USERNAME = "<a href='".e_BASE."user.php?id.$oid'>$oname</a>";
 	$ONLINE_TABLE_LOCATION = ($class_check ? "<a href='$online_location'>$online_location_page</a>" : $online_location_page);
@@ -263,13 +263,13 @@
 	
 $total_members = $sql->db_Count("user");
 	
-if ($total_members > 1) {
-	$newest_member = $sql->db_Select("user", "user_id, user_name", "user_ban='0' ORDER BY user_join DESC LIMIT 0,1");
+if ($total_members > 1)
+{
+	$newest_member = $sql->db_Select("user", "user_id, user_name", "user_ban=0 ORDER BY user_join DESC LIMIT 0,1");
 	$row = $sql->db_Fetch();
-	 extract($row);
 	 
 	$ONLINE_TABLE_MEMBERS_TOTAL = "<br />".ONLINE_EL5.": ".$total_members;
-	$ONLINE_TABLE_MEMBERS_NEWEST = "<br />".ONLINE_EL6.": ".(USER ? "<a href='".e_BASE."user.php?id.".$user_id."'>".$user_name."</a>" : $user_name);
+	$ONLINE_TABLE_MEMBERS_NEWEST = "<br />".ONLINE_EL6.": ".(USER ? "<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a>" : $row['user_name']);
 }
 	
 $textstart = preg_replace("/\{(.*?)\}/e", '$\1', $ONLINE_TABLE_START);
@@ -279,4 +279,3 @@
 $ns->tablerender(ONLINE_EL4, $text);
 	
 require_once(FOOTERF);
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/page.php 0.7.11.src/page.php
--- 0.7.7.src/page.php	2006-11-11 22:10:36.000000000 -0600
+++ 0.7.11.src/page.php	2007-12-19 15:38:22.000000000 -0600
@@ -11,18 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/page.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2006/11/12 04:10:36 $ - mods to make password protected pages work
-|     $Author: mrpete $
+|     $Revision: 1.47 $
+|     $Date: 2007/12/19 21:38:22 $
+|     $Author: mcfly_e107 $
+|
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
 $page = new pageClass();
-if(isset($_POST['enterpw']))
-{
-	$page -> setPageCookie();
-}
 
 if(!e_QUERY)
 {
@@ -39,11 +36,10 @@
 {
 
 	$cacheString = 'page_'.$page->pageID;
-  $cachePageTitle = 'page-t_'.$page->pageID;
+	$cachePageTitle = 'page-t_'.$page->pageID;
 
 	if($cacheData = $e107cache->retrieve($cacheString))
 	{
-
 		list($pagetitle,$comment_flag) = explode("^",$e107cache->retrieve($cachePageTitle));
 		define("e_PAGETITLE", $pagetitle);
 		require_once(HEADERF);
@@ -52,24 +48,32 @@
 	}
 	else
 	{
-
 		$tmp = $page -> showPage();
 		define("e_PAGETITLE", $tmp['title']);
 		require_once(HEADERF);
-		if ($tmp['err'])		// Need to display error block after header defined
+		if ($tmp['err'])        // Need to display error block after header defined
 		{
-			$ns -> tablerender($tmp['title'], $tmp['text']);
+			$ns -> tablerender($tmp['title'], $tmp['text'],"cpage");
 			require_once(FOOTERF);
 			exit;
 		}
-		ob_start();
-		$ns -> tablerender($tmp['title'], $tmp['text']);
-		$cache_data = ob_get_flush();
-		$e107cache->set($cacheString, $cache_data);
-		$e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']);
-		$comment_flag = $tmp['comment_flag'];
+		if ($tmp['cachecontrol'] == TRUE)
+		{
+			ob_start();
+			$ns -> tablerender($tmp['title'], $tmp['text']);
+			$cache_data = ob_get_flush();
+			$e107cache->set($cacheString, $cache_data);
+			$e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']);
+			$comment_flag = $tmp['comment_flag'];
+		}
+		else
+		{
+			$ns -> tablerender($tmp['title'], $tmp['text'],"cpage");
+			$comment_flag = $tmp['comment_flag'];
+		}
 	}
 
+	$page -> title = $tmp['title'];
 	if($com = $page -> pageComment($comment_flag))
 	{
 		echo $com['comment'].$com['comment_form'];
@@ -83,15 +87,15 @@
 class pageClass
 {
 
-	var $bullet;																/* bullet image */
-	var $pageText;														/* main text of selected page, not parsed */
-	var $multipageFlag;												/* flag - true if multiple page page, false if not */
-	var $pageTitles;														/* array containing page titles */
-	var $pageID;															/* id number of page to be displayed */
-	var $pageSelected;												/* selected page of multiple page page */
-	var $pageToRender;												/* parsed page to be sent to screen */
-	var $debug;															/* temp debug flag */
-	var $title;																/* title of page, it if has one (as defined in [newpage=title] tag */
+	var $bullet;                        /* bullet image */
+	var $pageText;                      /* main text of selected page, not parsed */
+	var $multipageFlag;                 /* flag - true if multiple page page, false if not */
+	var $pageTitles;                    /* array containing page titles */
+	var $pageID;                        /* id number of page to be displayed */
+	var $pageSelected;                  /* selected page of multiple page page */
+	var $pageToRender;                  /* parsed page to be sent to screen */
+	var $debug;                         /* temp debug flag */
+	var $title;                         /* title of page, it if has one (as defined in [newpage=title] tag */
 
 
 	function pageClass($debug=FALSE)
@@ -101,18 +105,19 @@
 		$tmp = explode(".", e_QUERY);
 		$this -> pageID = intval($tmp[0]);
 		$this -> pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
+		$this -> pageTitles = array();
 		if(defined("BULLET"))
 		{
-        	$this -> bullet = "<img src='".THEME."images/".BULLET."' alt='' style='vertical-align: middle;' />";
+			$this -> bullet = "<img src='".THEME."images/".BULLET."' alt='' style='vertical-align: middle;' />";
 		}
 		elseif(file_exists(THEME."images/bullet2.gif"))
 		{
-        	$this -> bullet = "<img src='".THEME."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
+			$this -> bullet = "<img src='".THEME."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
 
 		}
 		else
 		{
-        	$this -> bullet = "";
+			$this -> bullet = "";
 		}
 
 		$this -> debug = $debug;
@@ -128,7 +133,7 @@
 	{
 		global $pref, $sql, $ns;
 
-		if(!$pref['listPages'])
+		if(!isset($pref['listPages']) || !$pref['listPages'])
 		{
 			message_handler("MESSAGE", LAN_PAGE_1);
 		}
@@ -161,7 +166,7 @@
 
 		if(!$sql -> db_Select_gen($query) && !$_GET['elan'])
 		{
-			$ret['title'] = LAN_PAGE_12;			// ***** CHANGED
+			$ret['title'] = LAN_PAGE_12;            // ***** CHANGED
 			$ret['text'] = LAN_PAGE_3;
 			$ret['comment_flag'] = '';
 			$ret['err'] = TRUE;
@@ -172,7 +177,7 @@
 
 		$this -> pageText = $page_text;
 
-		$this -> pageCheckPerms($page_class, $page_password);
+		$this -> pageCheckPerms($page_class, $page_password, $page_title);
 
 		if($this -> debug)
 		{
@@ -183,14 +188,17 @@
 
 		$gen = new convert;
 
+		$text = '';    // Notice removal
+		$ptitle = "";
+
 		if($page_author)
 		{
-			$text = "<div class='smalltext' style='text-align:right'>".$user_name.", ".$gen->convert_date($page_datestamp, "long")."</div><br />";
+			$text .= "<div class='smalltext cpage_author' style='text-align:right'>".$user_name.", ".$gen->convert_date($page_datestamp, "long")."</div><br />";
 		}
 
 		if($this -> title)
 		{
-			$text .= "<b>".$this -> title."</b><br /><br />";
+			$ptitle = "<div class='cpage_title'>".$this -> title."</div>";
 		}
 
 		$text .= $this -> pageToRender;
@@ -198,9 +206,10 @@
 		$text .= $this -> pageRating($page_rating_flag);
 
 		$ret['title'] = $page_title;
-		$ret['text'] = $text;
+		$ret['text'] = $ptitle."<div class='cpage_body'>".$text."</div>";
 		$ret['comment_flag'] = $page_comment_flag;
 		$ret['err'] = FALSE;
+		$ret['cachecontrol'] = (isset($page_password) && !$page_password);      // Don't cache password protected pages
 
 		return $ret;
 	}
@@ -208,6 +217,8 @@
 	function parsePage()
 	{
 		global $tp;
+		$this -> pageTitles = array();      // Notice removal
+
 		if(preg_match_all("/\[newpage.*?\]/si", $this -> pageText, $pt))
 		{
 			$pages = preg_split("/\[newpage.*?\]/si", $this -> pageText, -1, PREG_SPLIT_NO_EMPTY);
@@ -215,7 +226,7 @@
 		}
 		else
 		{
-			$this -> pageToRender = $tp -> toHTML($this -> pageText, TRUE, 'parse_sc, constants');
+			$this -> pageToRender = $tp -> toHTML($this -> pageText, TRUE, 'BODY');
 			return;
 		}
 
@@ -251,11 +262,11 @@
 		foreach($this -> pageTitles as $title)
 		{
 			$titlep = preg_replace("/\[newpage=(.*?)\]/", "\\1", $title);
-			$this -> pageTitles[$count] = ($titlep == "[newpage]" ? LAN_PAGE_13." ".($count+1)."&nbsp;" : $tp -> toHTML($titlep, TRUE, 'parse_sc, constants,emotes_off,no_make_clickable'));
+			$this -> pageTitles[$count] = ($titlep == "[newpage]" ? LAN_PAGE_13." ".($count+1)."&nbsp;" : $tp -> toHTML($titlep, TRUE, 'TITLE'));
 			$count++;
 		}
 
-		$this -> pageToRender = $tp -> toHTML($pages[$this -> pageSelected], TRUE, 'parse_sc, constants');
+		$this -> pageToRender = $tp -> toHTML($pages[$this -> pageSelected], TRUE, 'BODY');
 		$this -> title = (substr($this -> pageTitles[$this -> pageSelected], -1) == ";" ? "" : $this -> pageTitles[$this -> pageSelected]);
 
 		if($this -> debug)
@@ -273,18 +284,31 @@
 
 	function pageIndex()
 	{
-		$itext = "<br /><br />";
-		$count = 0;
-		foreach($this -> pageTitles as $title)
+		global $tp,$pref;
+		$itext = '';
+		if(isset($pref['old_np']) && $pref['old_np'])
 		{
-			$itext .= $this -> bullet." ".($count == $this -> pageSelected ? $title : "<a href='".e_SELF."?".$this -> pageID.".".$count."'>".$title."</a>")."<br />\n";
-			$count++;
+			$count = 0;
+			foreach($this -> pageTitles as $title)
+			{
+				if (!$count) { $itext = "<br /><br />"; }
+				$itext .= $this -> bullet." ".($count == $this -> pageSelected ? $title : "<a href='".e_SELF."?".$this -> pageID.".".$count."'>".$title."</a>")."<br />\n";
+				$count++;
+			}
+		}
+		else
+		{
+			$titles = implode("|",$this -> pageTitles);
+			$total_items = count($this -> pageTitles);
+			$parms = $total_items.",1,".$this -> pageSelected.",".e_SELF."?".$this -> pageID.".[FROM],,$titles";
+			$itext = ($total_items) ? "<div class='nextprev nextprev_custom'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>" : "";
 		}
 		return $itext;
 	}
 
 	function pageRating($page_rating_flag)
 	{
+		$rate_text = '';      // Notice removal
 		if($page_rating_flag)
 		{
 			require_once(e_HANDLER."rate_class.php");
@@ -339,17 +363,20 @@
 				$e107cache->clear("comment.page.".$this -> pageID);
 				$e107cache->clear($cacheString);
 			}
-
-			return $cobj->compose_comment("page", "comment", $this -> pageID, $width="", $subject="", $showrate=FALSE, $return=TRUE);
+			return $cobj->compose_comment("page", "comment", $this -> pageID, 0, $this -> title);
 		}
 	}
 
-	function pageCheckPerms($page_class, $page_password)
+	function pageCheckPerms($page_class, $page_password, $page_title="&nbsp;")
 	{
-		global $ns, $tp, $HEADER, $FOOTER, $sql;     // $tp added
+		global $ns, $tp, $pref, $HEADER, $FOOTER, $sql;     // $tp added - also $pref - used by footer
+
 
 		if (!check_class($page_class))
 		{
+			define("e_PAGETITLE", $page_title);
+			// HEADERF requires that $tp is defined - hence declared as global above.
+			require_once(HEADERF);      // Do header now in case wrong password was entered
 			message_handler("MESSAGE", LAN_PAGE_6);
 			require_once(FOOTERF); exit;
 		}
@@ -359,7 +386,7 @@
 			return TRUE;
 		}
 
-		if($_POST['submit_page_pw'])
+		if(isset($_POST['page_pw']))
 		{
 			if($_POST['page_pw'] == $page_password)
 			{
@@ -370,15 +397,21 @@
 		{
 			$cookiename = "e107page_".$this -> pageID;
 
-			if($_COOKIE[$cookiename] == md5($page_password.USERID))
+			if(isset($_COOKIE[$cookiename]) && ($_COOKIE[$cookiename] == md5($page_password.USERID)))
 			{
 				return TRUE;
 			}
+			// Invalid/empty password here
 		}
 
-		if ($_POST['submit_page_pw'])
+		define("e_PAGETITLE", $page_title);
+		// HEADERF requires that $tp is defined - hence declared as global above.
+		require_once(HEADERF);      // Do header now in case wrong password was entered
+
+		// Need to prompt for password here
+		if (isset($_POST['page_pw']))
 		{
-			message_handler("MESSAGE", LAN_PAGE_7);
+			message_handler("MESSAGE", LAN_PAGE_7);     // Invalid password
 		}
 
 		$pw_entry_text = "
@@ -402,9 +435,7 @@
 		";
 		// Mustn't return to higher level code here
 
-		// HEADERF requires that $tp is defined - hence declared as global above.
-		require_once(HEADERF);
-		$ns->tablerender("&nbsp;", $pw_entry_text);		// HEADERF also clears $text - hence different variable
+		$ns->tablerender($page_title, $pw_entry_text,"cpage_pw");       // HEADERF also clears $text - hence different variable
 		require_once(FOOTERF);
 		exit;
 	}
@@ -419,5 +450,3 @@
 		exit;
 	}
 }
-
-?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/print.php 0.7.11.src/print.php
--- 0.7.7.src/print.php	2006-11-18 12:42:12.000000000 -0600
+++ 0.7.11.src/print.php	2007-02-13 16:25:16.000000000 -0600
@@ -11,15 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/print.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/11/18 18:42:12 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.15 $
+|     $Date: 2007/02/13 22:25:16 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
 $HEADER="";
 $FOOTER="";
-require_once(HEADERF);
+$CUSTOMHEADER = "";
+$CUSTOMFOOTER = "";
+
 
 $qs = explode(".", e_QUERY);
 if ($qs[0] == "") {
@@ -30,13 +32,15 @@
 $parms = intval($qs[1]);
 unset($qs);
 
+
 if(strpos($source,'plugin:') !== FALSE)
 {
 	$plugin = substr($source,7);
 	if(file_exists(e_PLUGIN.$plugin."/e_emailprint.php"))
 	{
 		include_once(e_PLUGIN.$plugin."/e_emailprint.php");
-		$text = print_item($parms);
+		$print_text = print_item($parms);
+//		define("e_PAGETITLE", $plugin);
 	}
 	else
 	{
@@ -48,8 +52,9 @@
 {
 	$con = new convert;
 	$sql->db_Select("news", "*", "news_id='{$parms}'");
-	$row = $sql->db_Fetch(); 
+	$row = $sql->db_Fetch();
 	extract($row);
+	define("e_PAGETITLE", $news_title);
 	$news_body = $tp->toHTML($news_body, TRUE);
 	$news_extended = $tp->toHTML($news_extended, TRUE);
 	if ($news_author == 0)
@@ -65,38 +70,43 @@
 		list($a_id, $a_name) = $sql->db_Fetch();
 	}
 	$news_datestamp = $con->convert_date($news_datestamp, "long");
-	$text = "<font style=\"font-size: 11px; color: black; font-family: tahoma, verdana, arial, helvetica; text-decoration: none\">
+	$print_text = "<span style=\"font-size: 13px; color: black; font-family: tahoma, verdana, arial, helvetica; text-decoration: none\">
 	<b>".LAN_PRINT_135.": ".$news_title."</b>
 	<br />
-	(".LAN_PRINT_86." ".$category_name.")
+	(".LAN_PRINT_86." ".$tp->toHTML($category_name,FALSE,"defs").")
 	<br />
 	".LAN_PRINT_94." ".$a_name."<br />
 	".$news_datestamp."
 	<br /><br />".
 	$news_body;
 
-	if ($news_extended != ""){ $text .= "<br /><br />".$news_extended; }
-	if ($news_source != ""){ $text .= "<br /><br />".$news_source; }
-	if ($news_url != ""){ $text .= "<br />".$news_url; }
-	 
-	$text .= "<br /><br /></font><hr />".
+	if ($news_extended != ""){ $print_text .= "<br /><br />".$news_extended; }
+	if ($news_source != ""){ $print_text .= "<br /><br />".$news_source; }
+	if ($news_url != ""){ $print_text .= "<br />".$news_url; }
+
+	$print_text .= "<br /><br /></span><hr />".
 	LAN_PRINT_303.SITENAME."
 	<br />
-	( http://".$_SERVER[HTTP_HOST].e_HTTP."comment.php?comment.news.".$news_id." )
+	( http://".$_SERVER['HTTP_HOST'].e_HTTP."news.php?extend.".$news_id." )
 	";
 }
 
+
 if(defined("TEXTDIRECTION") && TEXTDIRECTION == "rtl"){
 	$align = 'right';
 }else{
 	$align = 'left';
 }
 
+// Header down here to give us a chance to set a page title
+require_once(HEADERF);
+
 echo "
+<div style='background-color:white'>
 <div style='text-align:".$align."'>".$tp->parseTemplate("{LOGO}", TRUE)."</div><hr /><br />
-<div style='text-align:".$align."'>".$text."</div><br /><br />
-<div style='text-align:".$align."'><form action=''><input type='button' value='".LAN_PRINT_307."' onClick='window.print()' /></form></div>";
+<div style='text-align:".$align."'>".$print_text."</div><br /><br />
+<form action=''><div style='text-align:center'><input type='button' value='".LAN_PRINT_307."' onclick='window.print()' /></div></form></div>";
 
 require_once(FOOTERF);
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/rate.php 0.7.11.src/rate.php
--- 0.7.7.src/rate.php	2005-12-24 16:53:38.000000000 -0600
+++ 0.7.11.src/rate.php	2007-01-10 15:30:34.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/rate.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/24 22:53:38 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2007/01/10 21:30:34 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -41,7 +41,7 @@
 	{
 		$rate_voters = $row['rate_voters'].".".USERID.".";
 		$new_rating = $row['rate_rating']+$rate;
-		$sql -> db_Update("rate", "rate_votes=rate_votes+1, rate_rating='{$new_rating}', rate_voters='{$rate_voters}' WHERE rate_itemid='{$itemid}' ");
+		$sql -> db_Update("rate", "rate_votes=rate_votes+1, rate_rating='{$new_rating}', rate_voters='{$rate_voters}' WHERE rate_id='{$row['rate_id']}' ");
 	}
 	else
 	{
diff -x .svn -ruN 0.7.7.src/request.php 0.7.11.src/request.php
--- 0.7.7.src/request.php	2006-11-09 03:28:58.000000000 -0600
+++ 0.7.11.src/request.php	2007-10-28 17:19:22.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/request.php,v $
-|     $Revision: 1.40 $
-|     $Date: 2006/11/09 09:28:58 $
-|     $Author: lisa_ $
+|     $Revision: 1.43 $
+|     $Date: 2007/10/28 22:19:22 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -45,11 +45,12 @@
 	list($action, $download_id, $mirror_id) = explode(".", e_QUERY);
 	$download_id = intval($download_id);
 	$mirror_id = intval($mirror_id);
-	$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_id WHERE d.download_id = {$download_id}";
+	$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$download_id}";
 	if ($sql->db_Select_gen($qry)) {
 		$row = $sql->db_Fetch();
 		extract($row);
-		if (check_class($download_category_class) && check_class($download_class)) {
+		if (check_class($download_category_class) && check_class($download_class)) 
+		{
 			if($pref['download_limits'] && $download_active == 1) {
 				check_download_limits();
 			}
@@ -62,7 +63,7 @@
 					$address = $tmp[1];
 					$requests = $tmp[2];
 					if($tmp[0] == $mirror_id) {
-						$gaddress = $address;
+						$gaddress = trim($address);
 						$requests ++;
 					}
 					$mstr .= $mid.",".$address.",".$requests.chr(1);
@@ -73,6 +74,8 @@
 			header("Location: {$gaddress}");
 			exit();
 		}
+		header("Location: ".e_BASE."download.php?error.{$download_id}.1");
+		exit;
 	}
 }
 
@@ -134,11 +137,12 @@
 						$mid = $tmp[0];
 						$address = $tmp[1];
 						$requests = $tmp[2];
-						if($tmp[0] == $mirror_id) {
-							$gaddress = $address;
-							$requests ++;
+						if($tmp[0] == $mirror_id) 
+						{
+						  $gaddress = trim($address);
+						  $requests ++;
 						}
-						$mstr .= "{$mid}, {$address}, {$requests}".chr(1);
+					  $mstr .= $mid.",".$address.",".$requests.chr(1);
 					}
 				}
 				$sql -> db_Update("download", "download_requested = download_requested + 1, download_mirror = '{$mstr}' WHERE download_id = '".intval($download_id)."'");
@@ -180,22 +184,29 @@
 					exit();
 				}
 			}
-		} else {
-			// Download Access Denied.
-			if((!strpos($pref['download_denied'],".php") &&
+		} 
+		else 
+		{	// Download Access Denied.
+		  if((!strpos($pref['download_denied'],".php") &&
 			!strpos($pref['download_denied'],".htm") &&
 			!strpos($pref['download_denied'],".html") &&
 			!strpos($pref['download_denied'],".shtml") ||
 			(strpos($pref['download_denied'],"signup.php") && USER == TRUE)
-			)){
-				require_once(HEADERF);
+			))
+		  {
+			header("Location: ".e_BASE."download.php?error.{$id}.1");
+			exit;
+/*				require_once(HEADERF);
 				$denied_message = ($pref['download_denied'] && !strpos($pref['download_denied'],"signup.php")) ? $tp->toHTML($pref['download_denied'],"","defs") : LAN_dl_63;
 				$ns -> tablerender(LAN_dl_61, $denied_message);
-				require_once(FOOTERF);
-				exit();
-			}else{
-				header("Location: ".trim($pref['download_denied']));
-			}
+				require_once(FOOTERF);  
+				exit();  */
+		  }
+		  else
+		  {
+			header("Location: ".trim($pref['download_denied']));
+			exit;
+		  }
 		}
 	}
 	else if(strstr(e_QUERY, "pub_"))
@@ -292,7 +303,7 @@
 	if(!strstr($path, $path_downloads) && !strstr($path,$path_public)) {
         if(E107_DEBUG_LEVEL > 0 && ADMIN){
 			echo "Failed to Download <b>".$file."</b><br />";
-			echo "The file-path <b>".$path."<b> didn't match with either <b>$path_downloads</b> or <b>$path_public</b><br />";
+			echo "The file-path <b>".$path."<b> didn't match with either <b>{$path_downloads}</b> or <b>{$path_public}</b><br />";
 			exit();
         }else{
 			header("location: {$e107->base_path}");
@@ -351,28 +362,33 @@
 		}
 	}
 }
-function check_download_limits() {
+function check_download_limits() 
+{
 	global $pref, $sql, $ns, $HEADER, $e107, $tp;
 	// Check download count limits
 	$qry = "SELECT gen_intdata, gen_chardata, (gen_intdata/gen_chardata) as count_perday FROM #generic WHERE gen_type = 'download_limit' AND gen_datestamp IN (".USERCLASS_LIST.") AND (gen_chardata >= 0 AND gen_intdata >= 0) ORDER BY count_perday DESC";
-	if($sql->db_Select_gen($qry)) {
+	if($sql->db_Select_gen($qry)) 
+	{
 		$limits = $sql->db_Fetch();
 		$cutoff = time() - (86400 * $limits['gen_chardata']);
-		if(USER) {
+		if(USER) 
+		{
 			$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID;
 		} else {
 			$ip = $e107->getip();
 			$where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'";
 		}
 		$qry = "SELECT COUNT(d.download_id) as count FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid";
-		if($sql->db_Select_gen($qry)) {
+		if($sql->db_Select_gen($qry)) 
+		{
 			$row=$sql->db_Fetch();
-			if($row['count'] >= $limits['gen_intdata']) {
+			if($row['count'] >= $limits['gen_intdata']) 
+			{
 				// Exceeded download count limit
-
-				require_once(HEADERF);
+			  header("Location: ".e_BASE."download.php?error.{$cutoff}.2");
+/*				require_once(HEADERF);
 				$ns->tablerender(LAN_dl_61, LAN_dl_62);
-				require(FOOTERF);
+				require(FOOTERF);  */
 				exit();
 			}
 		}
@@ -391,11 +407,12 @@
 		$qry = "SELECT SUM(d.download_filesize) as total_bw FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid";
 		if($sql->db_Select_gen($qry)) {
 			$row=$sql->db_Fetch();
-			if($row['total_bw'] / 1024 > $limit['gen_user_id']) {
-				//Exceed bandwith limit
-				require(HEADERF);
+			if($row['total_bw'] / 1024 > $limit['gen_user_id']) 
+			{	//Exceed bandwith limit
+			  header("Location: ".e_BASE."download.php?error.{$cutoff}.2");
+/*				require(HEADERF);
 				$ns->tablerender(LAN_dl_61, LAN_dl_62);
-				require(FOOTERF);
+				require(FOOTERF); */
 				exit();
 			}
 		}
diff -x .svn -ruN 0.7.7.src/search.php 0.7.11.src/search.php
--- 0.7.7.src/search.php	2006-11-09 14:48:27.000000000 -0600
+++ 0.7.11.src/search.php	2007-07-03 14:25:37.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/search.php,v $
-|     $Revision: 1.55 $
-|     $Date: 2006/11/09 20:48:27 $
-|     $Author: sweetas $
+|     $Revision: 1.60 $
+|     $Date: 2007/07/03 19:25:37 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -60,13 +60,13 @@
 
 //core search routines
 
-if ($search_info['news'] = search_info('news', 'core', false, array('sfile' => e_HANDLER.'search/search_news.php', 'qtype' => LAN_98, 'refpage' => 'news.php', 'advanced' => e_HANDLER.'search/advanced_news.php', 'id' => 'news'))) {
+if ($search_info['news'] = search_info('news', 'core', false, array('sfile' => e_HANDLER.'search/search_news.php', 'qtype' => LAN_SEARCH_98, 'refpage' => 'news.php', 'advanced' => e_HANDLER.'search/advanced_news.php', 'id' => 'news'))) {
    //	$search_id++;
 } else {
 	unset($search_info['news']);
 }
 
-if ($search_info['comments'] = search_info('comments', 'core', false, array('sfile' => e_HANDLER.'search/search_comment.php', 'qtype' => LAN_99, 'refpage' => 'comment.php', 'advanced' => e_HANDLER.'search/advanced_comment.php', 'id' => 'comment'))) {
+if ($search_info['comments'] = search_info('comments', 'core', false, array('sfile' => e_HANDLER.'search/search_comment.php', 'qtype' => LAN_SEARCH_99, 'refpage' => 'comment.php', 'advanced' => e_HANDLER.'search/advanced_comment.php', 'id' => 'comment'))) {
    //	$search_id++;
 } else {
 	unset($search_info['comments']);
@@ -166,15 +166,18 @@
 
 	if (isset($_GET['r']) && !is_numeric($_GET['r'])) {
 		$perform_search = false;
-		$SEARCH_MESSAGE = LAN_201;
+		$SEARCH_MESSAGE = LAN_SEARCH_201;
 		$result_flag = 0;
 	} else if (strlen($full_query) == 0) {
 		$perform_search = false;
-		$SEARCH_MESSAGE = LAN_201;
-	} else if (strlen($full_query) < 3) {
+		$SEARCH_MESSAGE = LAN_SEARCH_201;
+	} 
+	elseif (strlen($full_query) < ($char_count = ($search_prefs['mysql_sort'] ? 4 : 3))) 
+	{
 		$perform_search = false;
-		$SEARCH_MESSAGE = LAN_417;
-	} else if ($search_prefs['time_restrict']) {
+		$SEARCH_MESSAGE = str_replace('--CHARS--', $char_count, LAN_417);
+	} 
+	elseif ($search_prefs['time_restrict']) {
 		$time = time() - $search_prefs['time_secs'];
 		$query_check = $tp -> toDB($full_query);
 		$ip = getip();
@@ -199,16 +202,25 @@
 // forward user if searching in google
 $search_count = count($search_info);
 $google_id = $search_count + 1;
-if ($search_prefs['selector'] == 1) {
-	if ($perform_search && isset($_GET['t'][$google_id]) && $_GET['t'][$google_id]) {
+if ($perform_search)
+{
+  if ($search_prefs['selector'] == 1) 
+  {  // Care needed - with alpha strings on search of single area $_GET['t'][$google_id] returns a character on page > 1
+	if (isset($_GET['t'][$google_id]) && ($_GET['t']==$google_id) && $_GET['t'][$google_id]) 
+	{
+//	echo "We think google should be used using checkboxes<br />";
 		header("location:http://www.google.com/search?q=".stripslashes(str_replace(" ", "+", $query)));
 		exit;
 	}
-} else {
-	if ($perform_search && isset($_GET['t']) && $_GET['t'] == $google_id) {
+  } 
+  else 
+  { 
+	if (isset($_GET['t']) && $_GET['t'] == $google_id) 
+	{
 		header("location:http://www.google.com/search?q=".stripslashes(str_replace(" ", "+", $query)));
 		exit;
 	}
+  }
 }
 
 // determine areas being searched
@@ -333,7 +345,7 @@
 
 foreach ($search_info as $key => $value) {
 	if (!isset($search_info[$key]['advanced'])) {
-		$js_adv .= " && abid != ".$key;
+		$js_adv .= " && abid != '".$key."'";
 	}
 }
 
@@ -344,7 +356,7 @@
 }
 
 if (check_class($search_prefs['google'])) {
-	$js_adv .= " && abid != ".$google_id;
+	$js_adv .= " && abid != '".$google_id."'";
 }
 
 if ($perform_search) {
@@ -453,6 +465,7 @@
 				$search_chars = $search_info[$key]['chars'];
 				$search_res = $search_info[$key]['results'];
 				@require_once($search_info[$key]['sfile']);
+				$_GET['q'] = rawurlencode($_GET['q']);
 				$parms = $results.",".$search_res.",".$_GET['r'].",".e_SELF."?q=".$_GET['q']."&t=".$key."&r=[FROM]";
 				$core_parms = array('r' => '', 'q' => '', 't' => '', 's' => '');
 				foreach ($_GET as $pparm_key => $pparm_value) {
diff -x .svn -ruN 0.7.7.src/signup.php 0.7.11.src/signup.php
--- 0.7.7.src/signup.php	2006-11-14 08:55:56.000000000 -0600
+++ 0.7.11.src/signup.php	2007-10-11 14:46:05.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/signup.php,v $
-|     $Revision: 1.102 $
-|     $Date: 2006/11/14 14:55:56 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.114 $
+|     $Date: 2007/10/11 19:46:05 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -57,7 +57,6 @@
     	$new_email = FALSE;
 	}
 
-
 	if($_POST['submit_resend'])
 	{
 		if($_POST['resend_email'] && !$new_email && $sql->db_Select_gen("SELECT * FROM #user WHERE user_ban=0 AND user_sess='' AND (user_loginname= \"".$tp->toDB($_POST['resend_email'])."\" OR user_name = \"".$tp->toDB($_POST['resend_email'])."\" OR user_email = \"".$clean_email."\" ) "))
@@ -84,6 +83,7 @@
 			}
 		}
 
+
 		if($sql->db_Select("user", "*", "(user_loginname = \"".$tp->toDB($_POST['resend_email'])."\" OR user_name = \"".$tp->toDB($_POST['resend_email'])."\" OR user_email = \"".$clean_email."\" ) AND user_ban=2 AND user_sess !='' LIMIT 1"))
 		{
 			$row = $sql -> db_Fetch();
@@ -98,8 +98,8 @@
         	$mailheader_e107id = $nid;
 			require_once(e_HANDLER."mail.php");
 
-
-/*            echo "Sending to: ".$row['user_email'];
+/*
+            echo "Sending to: ".$row['user_email'];
             require_once(FOOTERF);
             exit;
 */
@@ -117,6 +117,9 @@
                 exit;
             }
          }
+
+		require_once(e_HANDLER."message_handler.php");
+		message_handler("ALERT",LAN_106); // email not valid.
 		exit;
 	}
 	elseif(!$_POST['submit_resend'])
@@ -174,7 +177,7 @@
 	$text = " ";
 	$password1 = "";
 	$password2 = "";
-	$email = "";
+	$email = "";				// Used in shortcodes
 	$loginname = "";
 	$realname = "";
 	$user_timezone = "";
@@ -322,15 +325,16 @@
 
 if (isset($_POST['register']))
 {
+  $_POST['xupexist'] = trim(varset($_POST['xupexist'],''));
 	$e107cache->clear("online_menu_totals");
 	$error_message = "";
 	require_once(e_HANDLER."message_handler.php");
-	if ($signup_imagecode && !isset($_POST['xupexist']))
+	if (isset($_POST['rand_num']) && $signup_imagecode && !$_POST['xupexist'] )
 	{
 		if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
 		{
-			$error_message .= LAN_SIGNUP_3."\\n";
-			$error = TRUE;
+		  $error_message .= LAN_SIGNUP_3."\\n";
+		  $error = TRUE;
 		}
 	}
 
@@ -372,29 +376,43 @@
 	if($_POST['password1xup']) $_POST['password1'] = $_POST['password1xup'];
 	if($_POST['password2xup']) $_POST['password2'] = $_POST['password2xup'];
 
-	if (strstr($_POST['loginname'], "#") || strstr($_POST['loginname'], "=") || strstr($_POST['loginname'], "\\") || strstr($_POST['loginname'], "'") || strstr($_POST['loginname'], '"'))
+//	Strip most invalid characters now
+	$temp_name = trim(preg_replace('/&nbsp;|\#|\=|\$/', "", strip_tags($_POST['loginname'])));
+	if ($temp_name != $_POST['loginname'])
 	{
 		$error_message .= LAN_409."\\n";
 		$error = TRUE;
 	}
+	$_POST['loginname'] = $temp_name;
 
-	$_POST['loginname'] = trim(preg_replace("/&nbsp;|\#|\=/", "", $_POST['loginname']));
-	if ($_POST['loginname'] == "Anonymous")
+	if (strcasecmp($_POST['loginname'],"Anonymous") == 0)
 	{
 		$error_message .= LAN_103."\\n";
 		$error = TRUE;
 	}
 
+
 	// Use LoginName for DisplayName if restricted   **** MOVED FORWARD ****
 	if (!check_class($pref['displayname_class']))
 	{
 		$_POST['name'] = $_POST['loginname'];
 	}
 
+
+	// Impose a minimum length on display name
+	$_POST['name'] = trim($_POST['name']);
+	if (strlen($_POST['name']) < 2)
+	{
+	  $error_message .= LAN_SIGNUP_56."\\n";
+	  $error = TRUE;
+	}
+
+global $db_debug;
 	// Check for disallowed names.
-	if(isset($pref['signup_disallow_text']))
+	if(varsettrue($pref['signup_disallow_text']))
 	{
 		$tmp = explode(",", $pref['signup_disallow_text']);
+		if (E107_DEBUG_LEVEL) $db_debug->log('disallowed ('.count($tmp).'), like "'.$tmp[0].'"');
 		foreach($tmp as $disallow)
 		{
 			if( strstr($_POST['name'], $disallow) || strstr($_POST['loginname'], $disallow) ){
@@ -405,9 +423,23 @@
 	}
 
 	// Check if form maxlength has been bypassed
-	if ( strlen($_POST['name']) > 30 || strlen($_POST['loginname']) > 30)
+	if ( strlen($_POST['name']) > 30 || strlen($_POST['loginname']) > 100)
 	{
-		exit;
+	  exit;
+	}
+
+	// Check if display name exceeds maximum allowed length
+	if (strlen($_POST['name']) > varset($pref['displayname_maxlength'],15))
+	{
+	  $error_message .= LAN_SIGNUP_55."\\n";
+	  $error = TRUE;
+	}
+
+	// Check if login name exceeds maximum allowed length
+	if (strlen($_POST['loginname']) > varset($pref['loginname_maxlength'],30))
+	{
+	  $error_message .= LAN_SIGNUP_57."\\n";
+	  $error = TRUE;
 	}
 
 	// Display Name exists.
@@ -442,14 +474,22 @@
 		$password2 = "";
 	}
 
+
 	// Email address confirmation.
+	$email_address_OK = TRUE;
 	if ($_POST['email'] != $_POST['email_confirm'])
 	{
 		$error_message .= LAN_SIGNUP_38."\\n";
 		$error = TRUE;
 		$email = "";
 		$email_confirm = "";
+	  $email_address_OK = FALSE;
 	}
+	
+	// Always validate an email address if entered. If its blank, that's OK if checking disabled
+	$_POST['email'] = $tp->toDB(trim(varset($_POST['email'],'')));
+	$do_email_validate = !varset($pref['disable_emailcheck'],FALSE) || ($_POST['email'] !='');
+
 
 	// Password length check.
 	if (trim(strlen($_POST['password1'])) < $pref['signup_pass_len'])
@@ -467,8 +507,8 @@
 		$error = TRUE;
 	}
 
-	// ========== Verify Custom Signup options if selected ========================
 
+	// ========== Verify Custom Signup options if selected ========================
 	$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122, LAN_SIGNUP_28);
 	$signup_option_names = array("realname", "signature", "image", "timezone", "class");
 
@@ -481,19 +521,74 @@
 		}
 	}
 
-	// Check for Duplicate Email address.
-	if ($sql->db_Select("user", "user_email, user_ban, user_sess", "user_email='".$tp -> toDB($_POST['email'])."' "))
+
+	//--------------------------------------
+	// Email address checks
+	//--------------------------------------
+	// Email syntax validation.
+	if ($do_email_validate && (!$_POST['email'] || !check_email($_POST['email'])))
 	{
-        $chk = $sql -> db_Fetch();
-		if($chk['user_ban']== 2 && $chk['user_sess']){
-		// duplicate because unactivated
-			$error = TRUE;
-        	header("Location: ".e_BASE."signup.php?resend");
-			exit;
-		}else{
-			$error_message .= LAN_408."\\n";
-			$error = TRUE;
-		}
+	  $error_message .= LAN_106."\\n";
+	  $error = TRUE;
+	  $email_address_OK = FALSE;
+	}
+
+	// Check Email against banlist.
+	$wc = $tp -> toDB("*".trim(substr($_POST['email'], strpos($_POST['email'], "@"))));
+	if ($do_email_validate && $sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."' OR banlist_ip='{$wc}'"))
+	{
+	  $email_address_OK = FALSE;
+	  $brow = $sql -> db_Fetch();
+	  $error = TRUE;
+	  if($brow['banlist_reason'])
+	  {
+		$repl = array("\n","\r","<br />");
+		$error_message = str_replace($repl,"\\n",$tp->toHTML($brow['banlist_reason'],"","nobreak, defs"))."\\n";
+		$email = "";
+	  }
+	  else
+	  {
+		exit;
+	  }
+	}
+
+	// Check email address on remote server (if enabled) - but only if previous checks passed.
+	if ($do_email_validate && $email_address_OK && varsettrue($pref['signup_remote_emailcheck']) && $error != TRUE)
+	{
+	  require_once(e_HANDLER."mail_validation_class.php");
+	  list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL);
+	  $validator = new email_validation_class;
+	  $validator->localuser= $adminuser;
+	  $validator->localhost= $adminhost;
+	  $validator->timeout=3;
+		//	$validator->debug=1;
+		//	$validator->html_debug=1;
+	  if($validator->ValidateEmailBox(trim($_POST['email'])) != 1)
+	  {
+		$email_address_OK = FALSE;
+		$error_message .= LAN_106."\\n";
+		$error = TRUE;
+		$email = "";
+		$email_confirm = "";
+	  }
+	}
+
+	// Check for Duplicate Email address - but only if previous checks passed.
+	if ($do_email_validate && $email_address_OK && $sql->db_Select("user", "user_email, user_ban, user_sess", "user_email='".$_POST['email']."' "))
+	{
+      $chk = $sql -> db_Fetch();
+	  if($chk['user_ban']== 2 && $chk['user_sess'])
+	  {  // duplicate because unactivated
+		$error = TRUE;
+        header("Location: ".e_BASE."signup.php?resend");
+		exit;
+	  }
+	  else
+	  {
+	  $email_address_OK = FALSE;
+		$error_message .= LAN_408."\\n";
+		$error = TRUE;
+	  }
 	}
 
 	// Extended Field validation
@@ -503,7 +598,6 @@
 	{
 		if(isset($_POST['ue']['user_'.$ext['user_extended_struct_name']]))
 		{
-
 			$newval = trim($_POST['ue']['user_'.$ext['user_extended_struct_name']]);
 			if($ext['user_extended_struct_required'] == 1 && $newval == "" )
 			{
@@ -519,7 +613,7 @@
 			{
 				$regexfail = $ext['user_extended_struct_name']." ".LAN_SIGNUP_53;
 			}
-	
+
 			if(defined($regexfail)) {$regexfail = constant($regexfail);}
 
 			if($regex != "" && $newval != "")
@@ -533,56 +627,10 @@
 		}
 	}
 
-	// Email syntax validation.
-	if (!check_email($_POST['email']))
-	{
-		message_handler("P_ALERT", LAN_106);
-		$error_message .= LAN_106."\\n";
-		$error = TRUE;
-	}
-
-	// Check Email against banlist.
-	$wc = $tp -> toDB("*".trim(substr($_POST['email'], strpos($_POST['email'], "@"))));
-	if ($sql->db_Select("banlist", "*", "banlist_ip='".$tp -> toDB($_POST['email'])."' OR banlist_ip='{$wc}'"))
-	{
-		$brow = $sql -> db_Fetch();
-		$error = TRUE;
-		if($brow['banlist_reason'])
-		{
-			$repl = array("\n","\r","<br />");
-			$error_message = str_replace($repl,"\\n",$tp->toHTML($brow['banlist_reason'],"","nobreak defs"))."\\n";
-			$email = "";
-		}
-		else
-		{
-			exit;
-		}
-	}
-
-	// Check email address on remote server (if enabled).
-	if (varsettrue($pref['signup_remote_emailcheck']) && $error != TRUE)
-	{
-		require_once(e_HANDLER."mail_validation_class.php");
-		list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL);
-		$validator = new email_validation_class;
-		$validator->localuser= $adminuser;
-		$validator->localhost= $adminhost;
-		$validator->timeout=3;
-		//	$validator->debug=1;
-		//	$validator->html_debug=1;
-		if($validator->ValidateEmailBox(trim($_POST['email'])) != 1)
-		{
-			$error_message .= LAN_106."\\n";
-			$error = TRUE;
-			$email = "";
-			$email_confirm = "";
-		}
-
-	}
 
 	if($error_message)
 	{
-		message_handler("P_ALERT", $error_message);
+	  message_handler("P_ALERT", $error_message);
 	}
 
 	// ========== End of verification.. ====================================================
@@ -596,8 +644,9 @@
 			exit;
 		}
 
-		if ($sql->db_Select("user", "*", "user_email='".$tp -> toDB($_POST['email'])."' AND user_ban='1'")) {
-			exit;
+		if ($_POST['email'] && $sql->db_Select("user", "*", "user_email='".$_POST['email']."' AND user_ban='1'")) 
+		{
+		  exit;
 		}
 
 		$username = $tp -> toDB(strip_tags($_POST['name']));
@@ -615,7 +664,7 @@
 		}
 
 		$u_key = md5(uniqid(rand(), 1));
-		$nid = $sql->db_Insert("user", "0, '{$username}', '{$loginname}', '', '".md5($_POST['password1'])."', '{$u_key}', '".$tp -> toDB($_POST['email'])."', '".$tp -> toDB($_POST['signature'])."', '".$tp -> toDB($_POST['image'])."', '".$tp -> toDB($_POST['timezone'])."', '".$tp -> toDB($_POST['hideemail'])."', '".$time."', '0', '".$time."', '0', '0', '0', '0', '".$ip."', '2', '0', '', '', '0', '0', '".$tp -> toDB($_POST['realname'])."', '', '', '', '0', '".$tp -> toDB($_POST['xupexist'])."' ");
+		$nid = $sql->db_Insert("user", "0, '{$username}', '{$loginname}', '', '".md5($_POST['password1'])."', '{$u_key}', '".$_POST['email']."', '".$tp -> toDB($_POST['signature'])."', '".$tp -> toDB($_POST['image'])."', '".$tp -> toDB($_POST['timezone'])."', '".$tp -> toDB($_POST['hideemail'])."', '".$time."', '0', '".$time."', '0', '0', '0', '0', '".$ip."', '2', '0', '', '', '0', '0', '".$tp -> toDB($_POST['realname'])."', '', '', '', '0', '".$tp -> toDB($_POST['xupexist'])."' ");
 		if(!$nid)
 		{
 			require_once(HEADERF);
@@ -623,6 +672,7 @@
 			require_once(FOOTERF);
 		}
 
+
 		if ($pref['user_reg_veri'])
 		{
 			// ==== Update Userclass =======>
@@ -645,7 +695,7 @@
 
 			// ========== Send Email =========>
 
-			if ($pref['user_reg_veri'] != 2)
+			if (($pref['user_reg_veri'] != 2) && $_POST['email'])		// Don't send if email address blank - means that its not compulsory
 			{
                 $eml = render_email();
 				$mailheader_e107id = $eml['userid'];
@@ -659,6 +709,7 @@
 			}
 
             $_POST['ip'] = $ip;
+			$_POST['user_id'] = $nid;
 			$e_event->trigger("usersup", $_POST);  // send everything in the template, including extended fields.
 
 			require_once(HEADERF);
@@ -715,6 +766,7 @@
 
 			// ==========================================================
             $_POST['ip'] = $ip;
+			$_POST['user_id'] = $nid;
 			$e_event->trigger("usersup", $_POST);  // send everything in the template, including extended fields.
 
 			if($pref['signup_text_after'])
@@ -748,11 +800,11 @@
 	$website = "http://";
 }
 
-if (strpos(LAN_109, "stage") === FALSE)
+if ($qs == 'stage1' && $pref['use_coppa'] == 1)
 {
-	if (isset($_POST['newver']))
+	if(isset($_POST['newver']))
 	{
-		if (!$_POST['coppa'])
+		if(!varsettrue($_POST['coppa']))
 		{
 			$text = $tp->parseTemplate($COPPA_FAIL);
 			$ns->tablerender(LAN_110, $text);
@@ -760,6 +812,11 @@
 			exit;
 		}
 	}
+	else
+	{
+  		header('Location: '.e_BASE.'signup.php');
+		exit;
+	}
 }
 
 require_once(e_HANDLER."form_handler.php");
@@ -892,7 +949,7 @@
 	$HEAD .= "<html xmlns='http://www.w3.org/1999/xhtml' >\n";
 	$HEAD .= "<head><meta http-equiv='content-type' content='text/html; charset=utf-8' />\n";
 	$HEAD .= ($SIGNUPEMAIL_USETHEME == 1) ? "<link rel=\"stylesheet\" href=\"".SITEURL.THEME."style.css\" type=\"text/css\" />\n" : "";
-    $HEAD .= ($preview) ? "<title>Signup Preview</title>\n" : "";
+    $HEAD .= ($preview) ? "<title>".LAN_SIGNUP_58."</title>\n" : "";
 	if($SIGNUPEMAIL_USETHEME == 2)
 	{
 		$CSS = file_get_contents(THEME."style.css");
@@ -918,4 +975,3 @@
 
 	return $ret;
 }
-?>
diff -x .svn -ruN 0.7.7.src/subcontent.php 0.7.11.src/subcontent.php
--- 0.7.7.src/subcontent.php	2005-12-21 15:55:20.000000000 -0600
+++ 0.7.11.src/subcontent.php	2007-12-27 19:16:55.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/subcontent.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/12/21 21:55:20 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2007/12/28 01:16:55 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -21,8 +21,9 @@
 //redirection to new content management plugin if it is installed
 if ($sql -> db_Select("plugin", "*", "plugin_path = 'content' AND plugin_installflag = '1' ")){ 
 	header("location:".e_PLUGIN."content/content_submit.php");
+	exit;
 } else {
 	header("location:".e_BASE."index.php");
+	exit;
 }
-	
 ?>
\ No newline at end of file
diff -x .svn -ruN 0.7.7.src/submitnews.php 0.7.11.src/submitnews.php
--- 0.7.7.src/submitnews.php	2006-08-08 23:07:01.000000000 -0500
+++ 0.7.11.src/submitnews.php	2007-10-26 06:43:57.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/submitnews.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/08/09 04:07:01 $
+|     $Revision: 1.20 $
+|     $Date: 2007/10/26 11:43:57 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -127,15 +127,14 @@
 {
     $text .= "<tr>\n<td style='width:20%' class='forumheader3'>" . LAN_7 . "</td>\n<td style='width:80%' class='forumheader3'>\n<input class='tbox' type='text' name='author_name' size='60' value='$author_name' maxlength='100' />\n</td>\n</tr>\n<tr>\n<td style='width:20%' class='forumheader3'>" . LAN_112 . "</td>\n<td style='width:80%' class='forumheader3'>\n<input class='tbox' type='text' name='author_email' size='60' value='$author_email' maxlength='100' />\n</td>\n</tr>";
 }
-$news_aj = new textparse();
-// Added by Barry
+
 if (!empty($pref['news_subheader']))
 {
     $text .= " <tr>
-	<td colspan='2' class='forumheader3'>" . $news_aj->tpa($pref['news_subheader']) . "</td>
+	<td colspan='2' class='forumheader3'>" . $tp->toHTML($pref['news_subheader'], TRUE,'TITLE') . "</td>
 	</tr>";
 }
-// end barry
+
 $text .= " <tr>
 	<td style='width:20%' class='forumheader3'>" . NWSLAN_6 . ": </td>
 	<td style='width:80%' class='forumheader3'>";
@@ -146,10 +145,11 @@
 else
 {
     $text .= "
-		<select name='cat_id' class='tbox'>";
+	<select name='cat_id' class='tbox'>";
     while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
     {
-        $text .= ($_POST['cat_id'] == $cat_id ? "<option value='$cat_id' selected>" . $cat_name . "</option>" : "<option value='$cat_id'>" . $cat_name . "</option>");
+		$sel = ($_POST['cat_id'] == $cat_id) ? "selected='selected'" : "";
+        $text .= "<option value='$cat_id' $sel>" . $tp->toHTML($cat_name,FALSE,"defs") . "</option>";
     }
     $text .= "</select>";
 }
@@ -165,15 +165,24 @@
     require_once(e_HANDLER . "tiny_mce/wysiwyg.php");
     echo wysiwyg("item");
 }
+else
+{
+	require_once(e_HANDLER."ren_help.php");
+}
 
-$insertjs = (!$pref['subnews_htmlarea'])?"rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'" : "rows='25' ";
+$insertjs = (!$pref['subnews_htmlarea']) ? "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'" : "rows='25' ";
 $text .= "
 
 	<tr>
 	<td style='width:20%' class='forumheader3'>" . LAN_135 . "</td>
 	<td style='width:80%' class='forumheader3'>
-	<textarea class='tbox' id='item' name='item'  cols='80'  style='width:95%' $insertjs></textarea>
-	</td>
+	<textarea class='tbox' id='item' name='item'  cols='80'  style='max-width:95%' $insertjs></textarea><br />";
+
+if (!$pref['subnews_htmlarea'])
+{
+  $text .= display_help("helpb","submitnews");
+}
+$text .= "	</td>
 	</tr>\n";
 if ($pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS)
 {
@@ -217,4 +226,4 @@
     return $script;
 }
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/top.php 0.7.11.src/top.php
--- 0.7.7.src/top.php	2006-08-03 20:26:35.000000000 -0500
+++ 0.7.11.src/top.php	2007-04-04 20:46:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/top.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/08/04 01:26:35 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.12 $
+|     $Date: 2007/04/05 01:46:40 $
+|     $Author: streaky $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -110,7 +110,7 @@
 		 
 		$ns->tablerender(LAN_7, $text, "nfp");
 		require_once(e_HANDLER."np_class.php");
-		$ftotal = $sql->db_Select("forum_t", "*", "thread_parent='0'");
+		$ftotal = $sql->db_Count("forum_t", "(*)", "WHERE thread_parent = 0");
 		$ix = new nextprev("top.php", $from, $view, $ftotal, "", "active.forum.".$view."");
 	}
 }
diff -x .svn -ruN 0.7.7.src/upload.php 0.7.11.src/upload.php
--- 0.7.7.src/upload.php	2006-10-22 17:57:54.000000000 -0500
+++ 0.7.11.src/upload.php	2007-11-23 15:52:34.000000000 -0600
@@ -11,79 +11,150 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/upload.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/10/22 22:57:54 $
-|     $Author: e107coders $
+|     $Revision: 1.17 $
+|     $Date: 2007/11/23 21:52:34 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
 
-if (!$pref['upload_enabled'] || $pref['upload_class'] == 255) {
-	header("location: ".e_BASE."index.php");
-	exit;
+if (!$pref['upload_enabled'] || $pref['upload_class'] == 255) 
+{
+  header("location: ".e_BASE."index.php");
+  exit;
 }
 
 require_once(HEADERF);
 
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
 
-if (!check_class($pref['upload_class'])) {
-	$text = "<div style='text-align:center'>".LAN_403."</div>";
-	$ns->tablerender(LAN_20, $text);
-	require_once(FOOTERF);
-	exit;
-}
-
-if (isset($_POST['upload'])) {
-	if (($_POST['file_email'] || USER == TRUE) && $_POST['file_name'] && $_POST['file_description']) {
-
-		require_once(e_HANDLER."upload_handler.php");
-		$uploaded = file_upload(e_FILE."public/", "unique");
-
-		$file = $uploaded[0]['name'];
-		$filetype = $uploaded[0]['type'];
-		$filesize = $uploaded[0]['size'];
-		$image = $uploaded[1]['name'];
-		$imagetype = $uploaded[1]['type'];
+if (!check_class($pref['upload_class'])) 
+{
+  $text = "<div style='text-align:center'>".LAN_UL_002."</div>";
+  $ns->tablerender(LAN_UL_020, $text);
+  require_once(FOOTERF);
+  exit;
+}
 
-		if (!$pref['upload_maxfilesize']) {
-			$pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576;
-		}
 
+$message = '';
+$postemail ='';
+if (isset($_POST['upload'])) 
+{
+  if (($_POST['file_email'] || USER == TRUE) && $_POST['file_name'] && $_POST['file_description']) 
+  {
+	require_once(e_HANDLER."upload_handler.php");
+//	$uploaded = file_upload(e_FILE."public/", "unique");
+	$uploaded = process_uploaded_files(e_FILE."public/", "unique", array('max_file_count' => 2));
+
+// First, see what errors the upload handler picked up
+	if ($uploaded === FALSE)
+	{
+	  $message = LAN_UL_021.'<br />';
+	}
+	
+// Now see if we have a code file
+	if (count($uploaded) > 0)
+	{
+	  if ($uploaded[0]['error'] == 0)
+	  {
+	  $file = $uploaded[0]['name'];
+	  $filesize = $uploaded[0]['size'];
+	  }
+	  else
+	  {
+	    $message .= $uploaded[0]['message'].'<br />';
+	  }
+	}
+	
+// Now see if we have an image file
+	if (count($uploaded) > 1)
+	{
+	  if ($uploaded[1]['error'] == 0)
+	  {
+		$image = $uploaded[1]['name'];
+	  }
+	  else
+	  {
+	    $message .= $uploaded[1]['message'].'<br />';
+	  }
+	}
 
-		if ($filesize > $pref['upload_maxfilesize']) {
-			$message = LAN_405;
-		} else {
-			if (is_array($uploaded)) {
-				$poster = (USER ? USERID.".".USERNAME : "0".$_POST['file_poster']);
-				$_POST['file_email'] = ($_POST['file_email'] ? $_POST['file_email'] : USEREMAIL);
-				$_POST['file_description'] = $tp->toDB($_POST['file_description']);
-				$file_time = time();
-				$sql->db_Insert("upload", "0, '".$tp -> toDB($poster)."', '".$tp -> toDB(check_email($_POST['file_email']))."', '".$tp -> toDB($_POST['file_website'])."', '".$file_time."', '".$tp -> toDB($_POST['file_name'])."', '".$tp -> toDB($_POST['file_version'])."', '".$file."', '".$image."', '".$tp -> toDB($_POST['file_description'])."', '".$tp -> toDB($_POST['file_demo'])."', '".$filesize."', 0, '".$tp -> toDB($_POST['download_category'])."'");
-                $edata_fu = array("upload_user" => $poster, "upload_email" => $_POST['file_email'], "upload_name" => $tp -> toDB($_POST['file_name']),"upload_file" => $file, "upload_version" => $_POST['file_version'], "upload_description" => $tp -> toDB($_POST['file_description']), "upload_size" => $filesize, "upload_category" => $tp -> toDB($_POST['download_category']), "upload_website" => $tp -> toDB($_POST['file_website']), "upload_image" => $image, "upload_demo" => $tp -> toDB($_POST['file_demo']), "upload_time" => $file_time);
-				$e_event->trigger("fileupload", $edata_fu);
-				$message .= "<br />".LAN_404;
-			}
-		}
+// The upload handler checks max file size
 
-	} else {
-		require_once(e_HANDLER."message_handler.php");
-		message_handler("ALERT", 5);
+// $message non-null here indicates an error - delete the files to keep things tidy
+	if ($message)
+	{
+	  @unlink($file);
+	  @unlink($image);
 	}
+	else
+	{
+	  if (USER)
+	  {
+		$qry = "SELECT user_hideemail FROM #user WHERE user_id=".USERID;
+		if(!$sql->db_Select_gen($qry))
+		{
+		  echo "Fatal database error!";
+		  exit;
+		}
+	    $poster = USERID.".".USERNAME;
+		$row = $sql->db_Fetch();
+		if ($row['user_hideemail'])
+		{
+		  $postemail = '-witheld-';
+		}
+		else
+		{
+		  $postemail = USEREMAIL;
+		}
+	  }
+	  else
+	  {
+	    $poster = "0".$tp -> toDB($_POST['file_poster']);
+		$postemail = $tp->toDB($_POST['file_email']);
+	  }
+	  if (($postemail != '-witheld-') && !check_email($postemail))
+	  {
+	    $message = LAN_UL_001."<br />";
+	  }
+	  else
+	  {
+		if ($postemail == '-witheld-') $postemail = '';
+		$_POST['file_description'] = $tp->toDB($_POST['file_description']);
+		$file_time = time();
+		$sql->db_Insert("upload", "0, '".$poster."', '".$postemail."', '".$tp -> toDB($_POST['file_website'])."', '".$file_time."', '".$tp -> toDB($_POST['file_name'])."', '".$tp -> toDB($_POST['file_version'])."', '".$file."', '".$image."', '".$tp -> toDB($_POST['file_description'])."', '".$tp -> toDB($_POST['file_demo'])."', '".$filesize."', 0, '".$tp -> toDB($_POST['download_category'])."'");
+		$edata_fu = array("upload_user" => $poster, "upload_email" => $postemail, "upload_name" => $tp -> toDB($_POST['file_name']),"upload_file" => $file, "upload_version" => $_POST['file_version'], "upload_description" => $tp -> toDB($_POST['file_description']), "upload_size" => $filesize, "upload_category" => $tp -> toDB($_POST['download_category']), "upload_website" => $tp -> toDB($_POST['file_website']), "upload_image" => $image, "upload_demo" => $tp -> toDB($_POST['file_demo']), "upload_time" => $file_time);
+		$e_event->trigger("fileupload", $edata_fu);
+		$message .= "<br />".LAN_404;
+	  }
+	} 
+  }
+  else 
+  {	// Error - missing data
+	require_once(e_HANDLER."message_handler.php");
+	message_handler("ALERT", 5);
+  }
+}
+
+if ($message)
+{
+  $ns->tablerender("", "<div style=\"text-align:center\"><b>".$message."</b></div>");
+  require_once(FOOTERF);
+  exit;
 }
 
-if (isset($message)) {
-	$ns->tablerender("", "<div style=\"text-align:center\"><b>".$message."</b></div>");
-	require_once(FOOTERF);
-	exit;
-}
 
 $text = "<div style='text-align:center'>
 	<form enctype='multipart/form-data' method='post' action='".e_SELF."'>
 	<table style='".USER_WIDTH."' class='fborder'>
+	<colspan>
+	<col style='width:30%' />
+	<col style='width:70%' />
+	</colspan>
 	<tr>
-	<td style='width:20%' class='forumheader3'>".DOWLAN_11.":</td>
-	<td style='width:80%' class='forumheader3'>";
+	<td class='forumheader3'>".DOWLAN_11.":</td>
+	<td class='forumheader3'>";
 
 	require_once(e_FILE."shortcode/batch/download_shortcodes.php");
 	$dlparm = (isset($download_category)) ? $download_category : "";
@@ -99,13 +170,15 @@
 
 $text .= "<b>".LAN_406."</b><br />".LAN_419.":";
 
-if (is_readable(e_ADMIN.'filetypes.php')) {
-	$a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php'));
-	$a_filetypes = explode(',', $a_filetypes);
-	foreach ($a_filetypes as $ftype) {
-		$sa_filetypes[] = '.'.trim(str_replace('.', '', $ftype));
-	}
-	$allowed_filetypes = implode(' | ', $sa_filetypes);
+if (is_readable(e_ADMIN.'filetypes.php')) 
+{
+  $a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php'));
+  $a_filetypes = explode(',', $a_filetypes);
+  foreach ($a_filetypes as $ftype) 
+  {
+	$sa_filetypes[] = '.'.trim(str_replace('.', '', $ftype));
+  }
+  $allowed_filetypes = implode(' | ', $sa_filetypes);
 }
 
 $text .= " ".$allowed_filetypes."<br />".LAN_407."<br />
@@ -114,53 +187,54 @@
 $text .= "<span style='text-decoration:underline'>".LAN_408."</span> ".LAN_420."</td>
 	</tr>";
 
-if (!USER) {
-	$text .= "<tr>
-		<td style='width:30%' class='forumheader3'>".LAN_61."</td>
-		<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_poster' type='text' size='50' maxlength='100' /></td>
-		</tr>
-
-		<tr>
-		<td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_112."</span></td>
-		<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_email' type='text' size='50' maxlength='100' value='".USEREMAIL."' /></td>
-		</tr>";
+if (!USER) 
+{	// Prompt for name, email
+  $text .= "<tr>
+	<td class='forumheader3'>".LAN_61."</td>
+	<td class='forumheader3'><input class='tbox' style='width:90%' name='file_poster' type='text' size='50' maxlength='100' value='{$poster}' /></td>
+	</tr>
+
+	<tr>
+	<td class='forumheader3'><span style='text-decoration:underline'>".LAN_112."</span></td>
+	<td class='forumheader3'><input class='tbox' style='width:90%' name='file_email' type='text' size='50' maxlength='100' value='".$postemail."' /></td>
+	</tr>";
 }
 
 $text .= "
 	<tr>
-	<td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_409."</span></td>
-	<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%'  name='file_name' type='text' size='50' maxlength='100' /></td>
+	<td class='forumheader3'><span style='text-decoration:underline'>".LAN_409."</span></td>
+	<td class='forumheader3'><input class='tbox' style='width:90%'  name='file_name' type='text' size='50' maxlength='100' /></td>
 	</tr>
 
 	<tr>
-	<td style='width:30%' class='forumheader3'>".LAN_410."</td>
-	<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_version' type='text' size='10' maxlength='10' /></td>
+	<td class='forumheader3'>".LAN_410."</td>
+	<td class='forumheader3'><input class='tbox' style='width:90%' name='file_version' type='text' size='10' maxlength='10' /></td>
 	</tr>
 
 
 	<tr>
-	<td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_411."</span></td>
-	<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%'  name='file_userfile[]' type='file' size='47' /></td>
+	<td class='forumheader3'><span style='text-decoration:underline'>".LAN_411."</span></td>
+	<td class='forumheader3'><input class='tbox' style='width:90%'  name='file_userfile[]' type='file' size='47' /></td>
 	</tr>
 
 	<tr>
-	<td style='width:30%' class='forumheader3'>".LAN_412."</td>
-	<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_userfile[]' type='file' size='47' /></td>
+	<td class='forumheader3'>".LAN_412."</td>
+	<td class='forumheader3'><input class='tbox' style='width:90%' name='file_userfile[]' type='file' size='47' /></td>
 	</tr>
 
 	<tr>
-	<td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_413."</span></td>
-	<td style='width:70%' class='forumheader3'><textarea class='tbox' style='width:90%' name='file_description' cols='59' rows='6'></textarea></td>
+	<td class='forumheader3'><span style='text-decoration:underline'>".LAN_413."</span></td>
+	<td class='forumheader3'><textarea class='tbox' style='width:90%' name='file_description' cols='59' rows='6'></textarea></td>
 	</tr>
 
 	<tr>
-	<td style='width:30%' class='forumheader3'>".LAN_144."</td>
-	<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_website' type='text' size='50' maxlength='100' value='".(defined(USERURL) ? USERURL : "")."' /></td>
+	<td class='forumheader3'>".LAN_144."</td>
+	<td class='forumheader3'><input class='tbox' style='width:90%' name='file_website' type='text' size='50' maxlength='100' value='".(defined(USERURL) ? USERURL : "")."' /></td>
 	</tr>
 
 	<tr>
-	<td style='width:30%' class='forumheader3'>".LAN_414."<br /><span class='smalltext'>".LAN_415."</span></td>
-	<td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_demo' type='text' size='50' maxlength='100' /></td>
+	<td class='forumheader3'>".LAN_414."<br /><span class='smalltext'>".LAN_415."</span></td>
+	<td class='forumheader3'><input class='tbox' style='width:90%' name='file_demo' type='text' size='50' maxlength='100' /></td>
 	</tr>
 
 	<tr>
diff -x .svn -ruN 0.7.7.src/user.php 0.7.11.src/user.php
--- 0.7.7.src/user.php	2006-11-07 14:16:40.000000000 -0600
+++ 0.7.11.src/user.php	2007-12-19 14:34:28.000000000 -0600
@@ -11,12 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/user.php,v $
-|     $Revision: 1.41 $
-|     $Date: 2006/11/07 20:16:40 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.45 $
+|     $Date: 2007/12/19 20:34:28 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
+
+// Next bit is to fool PM plugin into doing things
+global $user;
+$user['user_id'] = USERID;
+
 require_once(e_FILE."shortcode/batch/user_shortcodes.php");
 require_once(e_HANDLER."form_handler.php");
 
@@ -52,7 +57,8 @@
 require_once(HEADERF);
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
-if (!check_class(varset($pref['memberlist_access'], 253)) && !$self_page)
+$full_perms = getperms("0") || check_class(varset($pref['memberlist_access'], 253));		// Controls display of info from other users
+if (!$full_perms && !$self_page)
 {
 	$ns->tablerender(LAN_20, "<div style='text-align:center'>".USERLAN_2."</div>");
 	require_once(FOOTERF);
@@ -157,6 +163,7 @@
 	$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_START, TRUE, $user_shortcodes);
 	foreach ($userList as $row)
 	{
+		$loop_uid = $row['user_id'];
 		$text .= renderuser($row, "short");
 	}
 	$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes);
diff -x .svn -ruN 0.7.7.src/userposts.php 0.7.11.src/userposts.php
--- 0.7.7.src/userposts.php	2006-06-22 14:13:41.000000000 -0500
+++ 0.7.11.src/userposts.php	2007-10-28 10:01:35.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/userposts.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2006/06/22 19:13:41 $
-|     $Author: lisa_ $
+|     $Revision: 1.28 $
+|     $Date: 2007/10/28 15:01:35 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -21,20 +21,24 @@
 $cobj = new comment;
 require_once(HEADERF);
 
-if (!USER) {
-	header("location:".e_BASE."index.php");
-	exit;
-}
 
 $_POST['f_query'] = trim($_POST['f_query']);
 
+$action = 'exit';
 if (e_QUERY)
 {
-	list($from, $action, $id) = explode(".", e_QUERY);
-	$id = intval($id);
-	$from = intval($from);
+  $tmp = explode(".", e_QUERY);
+  $from = intval($tmp[0]);			// Always defined
+  $action = varset($tmp[1],'exit');
+  if (!isset($tmp[2])) $action = 'exit';
+  $id = intval(varset($tmp[2],0));
+  if ($id <= 0) $action = 'exit';
+  if (($id != USERID) && !check_class(varset($pref['memberlist_access'], 253))) $action = 'exit';
+  unset($tmp);
 }
-else
+
+
+if ($action == 'exit')
 {
 	header("location:".e_BASE."index.php");
 	exit;
@@ -51,7 +55,7 @@
 	{
 		$sql->db_Select("user", "user_name", "user_id=".$id);
 		$row = $sql->db_Fetch();
-		extract($row);
+		$user_name = $row['user_name'];
 		$user_id = $id.".".$user_name."";
 	}
 	else
@@ -76,7 +80,7 @@
 	if(is_numeric($id))
 	{
 		$ccaption = UP_LAN_1.$user_name;
-		$sql->db_Select("user", "user_comments", "user_id=".$id."");
+		$sql->db_Select("user", "user_comments", "user_id=".$id);
 		list($user_comments) = $sql->db_Fetch();
 		$ctotal = $user_comments;
 		$data = $cobj->getCommentData($amount='10', $from, "comment_author = '".$user_id."'");
@@ -118,7 +122,7 @@
 	if(is_numeric($id))
 	{
 		$user_id = intval($id);
-		$sql->db_Select("user", "user_name", "user_id=".$id."");
+		$sql->db_Select("user", "user_name", "user_id=".$id);
 		$row = $sql->db_Fetch();
 		$fcaption = UP_LAN_0." ".$row['user_name'];
 	}
@@ -147,10 +151,10 @@
 		$fcaption = UP_LAN_12." ".$row['user_name'];
 	}
 	$qry = "
-	SELECT f.*, ft.* FROM #forum_t AS ft
+	SELECT ft.*, f.* FROM #forum_t AS ft
 	LEFT JOIN #forum AS f ON ft.thread_forum_id = f.forum_id
 	LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
-	WHERE ft.thread_user LIKE '{$user_id}.%'
+	WHERE SUBSTRING_INDEX(ft.thread_user,'.',1) = {$user_id}
 	AND f.forum_class IN (".USERCLASS_LIST.")
 	AND fp.forum_class IN (".USERCLASS_LIST.")
 	{$s_info}
@@ -161,7 +165,7 @@
 	SELECT COUNT(*) AS count FROM #forum_t AS ft
 	LEFT JOIN #forum AS f ON ft.thread_forum_id = f.forum_id
 	LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
-	WHERE ft.thread_user LIKE '{$user_id}.%'
+	WHERE SUBSTRING_INDEX(ft.thread_user,'.',1) = {$user_id}
 	AND f.forum_class IN (".USERCLASS_LIST.")
 	AND fp.forum_class IN (".USERCLASS_LIST.")
 	{$s_info}
@@ -243,8 +247,7 @@
 		}
 		else
 		{
-			$tmp = $thread_parent;
-			$sql2->db_Select("forum_t", "thread_name", "thread_id = '".intval($thread_parent)."' ");
+			$sql2->db_Select("forum_t", "thread_name", "thread_id = ".intval($thread_parent));
 			list($thread_name) = $sql2->db_Fetch();
 			$cachevar[$thread_parent] = $thread_name;
 		}
@@ -252,14 +255,14 @@
 	}
 	else
 	{
-		$tmp = $thread_id;
 		$USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_2.": ";
 	}
 
+	$tmp = $thread_id;
 	$thread_thread = $tp->toHTML($thread_thread, TRUE, "", $id);
 
 	$USERPOSTS_FORUM_ICON = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
-	$USERPOSTS_FORUM_TOPIC_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$tmp."'>";
+	$USERPOSTS_FORUM_TOPIC_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$tmp.".post'>";
 	$USERPOSTS_FORUM_TOPIC = $thread_name;
 	$USERPOSTS_FORUM_NAME_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>";
 	$USERPOSTS_FORUM_NAME = $forum_name;
@@ -269,4 +272,4 @@
 	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE));
 }
 
-?>
\ No newline at end of file
+?>
diff -x .svn -ruN 0.7.7.src/usersettings.php 0.7.11.src/usersettings.php
--- 0.7.7.src/usersettings.php	2006-11-28 23:11:16.000000000 -0600
+++ 0.7.11.src/usersettings.php	2007-12-21 14:43:39.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/usersettings.php,v $
-|     $Revision: 1.80 $
-|     $Date: 2006/11/29 05:11:16 $
-|     $Author: e107coders $
+|     $Revision: 1.98 $
+|     $Date: 2007/12/21 20:43:39 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,6 +22,10 @@
 require_once(e_HANDLER."user_extended_class.php");
 $ue = new e107_user_extended;
 
+//define("US_DEBUG",TRUE);
+define("US_DEBUG",FALSE);
+
+
 if (isset($_POST['sub_news']))
 {
     header("location:".e_BASE."submitnews.php");
@@ -73,11 +77,35 @@
 require_once(e_HANDLER."calendar/calendar_class.php");
 $cal = new DHTML_Calendar(true);
 $_uid = is_numeric(e_QUERY) ? intval(e_QUERY) : "";
+$sesschange = '';						// Notice removal
+$photo_to_delete = '';
+$avatar_to_delete = '';
 
 require_once(HEADERF);
 
-// Save Form Data  --------------------------------------->
 
+// Given an array of user data, return a comma separated string which includes public, admin, member classes etc as appropriate.
+function addCommonClasses($udata)
+{
+  $tmp = array();
+  if ($udata['user_class'] != "") $tmp = explode(",", $udata['user_class']);
+  $tmp[] = e_UC_MEMBER;
+  $tmp[] = e_UC_READONLY;
+  $tmp[] = e_UC_PUBLIC;
+  if($udata['user_admin'] == 1)
+  {
+	$tmp[] = e_UC_ADMIN;
+  }
+  if (strpos($udata['user_perms'],'0') === 0)
+  {
+	$tmp[] = e_UC_MAINADMIN;
+  }
+  return implode(",", $tmp);
+}
+
+
+// Save user settings (whether or not changed)
+//---------------------------------------------
 $error = "";
 
 if (isset($_POST['updatesettings']))
@@ -94,18 +122,18 @@
 	}
 
 	if ($_uid && ADMIN)
-	{
-		$inp = $_uid;
-		$remflag = TRUE;
+	{	// Admin logged in and editing another user's settings - so editing a different ID
+	  $inp = $_uid;
+	  $remflag = TRUE;
 	}
 	else
-	{
-		$inp = USERID;
+	{	// Current user logged in - use their ID
+	  $inp = USERID;
 	}
-	$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyways, so why allow them? (XSS Fix)
 
-	// check prefs for required fields =================================.
 
+	// Check external avatar
+	$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyway, so why allow them? (XSS Fix)
 	if ($_POST['image'] && $size = getimagesize($_POST['image'])) {
 		$avwidth = $size[0];
 		$avheight = $size[1];
@@ -130,15 +158,32 @@
 	$signup_option_names = array("realname", "signature", "image", "timezone", "class");
 
 	foreach($signup_option_names as $key => $value)
-	{
+	{  // Check required signup fields
 		if ($pref['signup_option_'.$value] == 2 && !$_POST[$value] && !$_uid)
 		{
 			$error .= LAN_SIGNUP_6.$signup_option_title[$key].LAN_SIGNUP_7."\\n";
 		}
     }
 
-	// ====================================================================
 
+// Login Name checks
+	if (isset($_POST['loginname']))
+	{  // Only check if its been edited
+	  $temp_name = trim(preg_replace('/&nbsp;|\#|\=|\$/', "", strip_tags($_POST['loginname'])));
+	  if ($temp_name != $_POST['loginname'])
+	  {
+		$error .= LAN_USET_13."\\n";
+	  }
+	  // Check if login name exceeds maximum allowed length
+	  if (strlen($temp_name) > varset($pref['loginname_maxlength'],30))
+	  {
+	    $error .= LAN_USET_14."\\n";
+	}
+	  $_POST['loginname'] = $temp_name;
+	}
+
+
+// Password checks
 	$pwreset = "";
 	if ($_POST['password1'] != $_POST['password2']) {
 		$error .= LAN_105."\\n";
@@ -167,6 +212,7 @@
 		$password2 = "";
 	}
 
+
 	if (isset($pref['disable_emailcheck']) && $pref['disable_emailcheck']==1)
 	{
 	} else {
@@ -176,12 +222,36 @@
 		}
 	}
 
-	if ($sql->db_Select("user", "user_name, user_email", "user_email='".$tp -> toDB($_POST['email'])."' AND user_id !=".USERID."' ")) {
+	// Check for duplicate of email address
+	if ($sql->db_Select("user", "user_name, user_email", "user_email='".$tp -> toDB($_POST['email'])."' AND user_id !='".intval($inp)."' "))
+	{
 	  	$error .= LAN_408."\\n";
 	}
 
-//	$username = strip_tags($_POST['username']);
 
+// Display name checks
+	if (isset($_POST['username']))
+	{
+	  // Impose a minimum length on display name
+	  $username = trim(strip_tags($_POST['username']));
+	  if (strlen($username) < 2)
+	  {
+		$error .= LAN_USET_12."\\n";
+	  }
+	  if (strlen($username) > varset($pref['displayname_maxlength'],15))
+	  {
+		$error .= LAN_USET_15."\\n";
+	  }
+
+	// Display Name exists.
+	  if ($sql->db_Count("user", "(*)", "WHERE `user_name`='".$username."' AND `user_id` != '".intval($inp)."' "))
+	  {
+		$error .= LAN_USET_17;
+	  }
+	}
+
+
+// Uploaded avatar and/or photo
 	$user_sess = "";
 	if ($file_userfile['error'] != 4)
 	{
@@ -190,31 +260,65 @@
 
 		if ($uploaded = file_upload(e_FILE."public/avatars/", "avatar"))
 		{
-			if ($uploaded[0]['name'] && $pref['avatar_upload'])
-			{
-				// avatar uploaded
-				$_POST['image'] = "-upload-".$uploaded[0]['name'];
-				if (!resize_image(e_FILE."public/avatars/".$uploaded[0]['name'], e_FILE."public/avatars/".$uploaded[0]['name'], "avatar"))
+		  foreach ($uploaded as $upload)
+		  {	// Needs the latest upload handler (with legacy and 'future' interfaces) to work
+			if ($upload['name'] && ($upload['index'] == 'avatar') && $pref['avatar_upload'])
+			{
+				// avatar uploaded - give it a reference which identifies it as server-stored
+				$_POST['image'] = "-upload-".$upload['name'];
+				if ($_POST['image'] != $currentUser['user_image'])
+				{
+				  $avatar_to_delete = str_replace("-upload-", "", $currentUser['user_image']);
+//				  echo "Avatar change; deleting {$avatar_to_delete}<br />";
+				}
+				if (!resize_image(e_FILE."public/avatars/".$upload['name'], e_FILE."public/avatars/".$upload['name'], "avatar"))
 				{
 					unset($message);
 					$error .= RESIZE_NOT_SUPPORTED."\\n";
-					@unlink(e_FILE."public/avatars/".$uploaded[0]['name']);
+					@unlink(e_FILE."public/avatars/".$upload['name']);
+					$_POST['image'] = '';
 				}
 			}
-			if ($uploaded[1]['name'] || (!$pref['avatar_upload'] && $uploaded[0]['name']))
+
+			if ($upload['name'] && ($upload['index'] == 'photo') && $pref['photo_upload'] )
 			{
 				// photograph uploaded
-				$user_sess = ($pref['avatar_upload'] ? $uploaded[1]['name'] : $uploaded[0]['name']);
-				resize_image(e_FILE."public/avatars/".$user_sess, e_FILE."public/avatars/".$user_sess, 180);
+				$user_sess = $upload['name'];
+				if (!resize_image(e_FILE."public/avatars/".$user_sess, e_FILE."public/avatars/".$user_sess, 180))
+				{
+					unset($message);
+					$error .= RESIZE_NOT_SUPPORTED."\\n";
+					@unlink(e_FILE."public/avatars/".$user_sess);
+					$user_sess = '';
+				}
 			}
+		  }
 		}
 	}
 
-	if ($user_sess != "")
+// See if user just wants to delete existing photo
+	if (isset($_POST['user_delete_photo']))
 	{
-		$sesschange = "user_sess = '".$tp->toDB($user_sess)."', ";
+	  $photo_to_delete = $currentUser['user_sess'];
+	  $sesschange = "user_sess = '', ";
+//	  echo "Just delete old photo: {$photo_to_delete}<br />";
+	}
+	elseif ($user_sess != "")
+	{	// Update DB with photo
+	  $sesschange = "user_sess = '".$tp->toDB($user_sess)."', ";
+	  if ($currentUser['user_sess'] == $tp->toDB($user_sess))
+	  {
+		$sesschange = '';			// Same photo - do nothing
+//		echo "Photo not changed<br />";
+	  }
+	  else
+	  {
+		$photo_to_delete = $currentUser['user_sess'];
+//		echo "New photo: {$user_sess} Delete old photo: {$photo_to_delete}<br />";
+	  }
 	}
 
+
     // Validate Extended User Fields.
 	if($_POST['ue'])
 	{
@@ -256,136 +360,177 @@
     }
 
 
+// All validated here
+// ------------------
 
+// $inp - UID of user whose data is being changed (may not be the currently logged in user)
 	if (!$error)
 	{
-		unset($_POST['password1']);
-		unset($_POST['password2']);
+	  unset($_POST['password1']);
+	  unset($_POST['password2']);
+	  
+	  
+      $_POST['user_id'] = intval($inp);
+
 
-		$ret = $e_event->trigger("preuserset", $_POST);
-		if(trim($_POST['user_xup']) != "")
+	  $ret = $e_event->trigger("preuserset", $_POST);
+
+	  if(trim($_POST['user_xup']) != "")
+	  {
+		if($sql->db_Select('user', 'user_xup', "user_id = '".intval($inp)."'"))
 		{
-			if($sql->db_Select('user', 'user_xup', "user_id = '".intval($inp)."'"))
-			{
-				$row = $sql->db_Fetch();
-				$update_xup = ($row['user_xup'] != $_POST['user_xup']) ? TRUE : FALSE;
-			}
+		  $row = $sql->db_Fetch();
+		  $update_xup = ($row['user_xup'] != $_POST['user_xup']) ? TRUE : FALSE;
 		}
+	  }
+
+	  if ($ret == '')
+	  {
+		$udata = get_user_data($inp);				// Get all the user data, including any extended fields
+		$peer = ($inp == USERID ? false : true);
+		$udata['user_classlist'] = addCommonClasses($udata);
 
-		if ($ret == '')
+		$loginname = strip_tags($_POST['loginname']);
+		if (!$loginname)
 		{
-			$udata = get_user_data($inp);
-			$peer = ($inp == USERID ? false : true);
-			$loginname = strip_tags($_POST['loginname']);
+//		  $sql->db_Select("user", "user_loginname", "user_id='".intval($inp)."'");
+//		  $row = $sql -> db_Fetch();
+		  $loginname = $udata['user_loginname'];
+		}
+		else
+		{
+		  if(!check_class($pref['displayname_class'], $udata['user_classlist'], $peer))
+		  {
+			$new_username = "user_name = '{$loginname}', ";
+			$username = $loginname;
+		  }
+		}
 
-			if (!$loginname)
-			{
-				$sql->db_Select("user", "user_loginname", "user_id='".intval($inp)."'");
-				$row = $sql -> db_Fetch();
-				$loginname = $row['user_loginname'];
-			}
-			else
-			{
-				if(!check_class($pref['displayname_class'], $udata['user_class'], $peer))
-				{
-					$new_username = "user_name = '{$loginname}', ";
-				}
-			}
+//			if (isset($_POST['username']) && check_class($pref['displayname_class']))
+		if (isset($_POST['username']) && check_class($pref['displayname_class'], $udata['user_classlist'], $peer))
+		{	// Allow change of display name if in right class
+		  $username = strip_tags($_POST['username']);
+		  $username = $tp->toDB(substr($username, 0, $pref['displayname_maxlength']));
+		  $new_username = "user_name = '{$username}', ";
+		}
 
-			if (isset($_POST['username']) && check_class($pref['displayname_class']))
-			{
-				$username = strip_tags($_POST['username']);
-				$username = $tp->toDB(substr($username, 0, $pref['displayname_maxlength']));
-				$new_username = "user_name = '{$username}', ";
-			}
 
+		$_POST['signature'] = $tp->toDB($_POST['signature']);
+		$_POST['realname'] = $tp->toDB($_POST['realname']);
 
-			$_POST['signature'] = $tp->toDB($_POST['signature']);
-			$_POST['realname'] = $tp->toDB($_POST['realname']);
+		$new_customtitle = "";
+		if(isset($_POST['customtitle']) && ($pref['forum_user_customtitle'] || ADMIN))
+		{
+		  $new_customtitle = ", user_customtitle = '".$tp->toDB($_POST['customtitle'])."' ";
+		}
 
-			$new_customtitle = "";
 
-			if(isset($_POST['customtitle']) && ($pref['forum_user_customtitle'] || ADMIN))
-			{
-				$new_customtitle = ", user_customtitle = '".$tp->toDB($_POST['customtitle'])."' ";
-			}
+		// Extended fields - handle any hidden fields
+		if($ue_fields)
+		{
+		  $hidden_fields = implode("^", array_keys($_POST['hide']));
+		  if($hidden_fields != "")
+		  {
+			$hidden_fields = "^".$hidden_fields."^";
+		  }
+		  $ue_fields .= ", user_hidden_fields = '".$hidden_fields."'";
+		}
 
 
-			if($ue_fields)
-			{
-				$hidden_fields = implode("^", array_keys($_POST['hide']));
-				if($hidden_fields != "")
-				{
-					$hidden_fields = "^".$hidden_fields."^";
-				}
-				$ue_fields .= ", user_hidden_fields = '".$hidden_fields."'";
-			}
+		// We can update the basic user record now
+		$sql->db_Update("user", "{$new_username} {$pwreset} {$sesschange} user_email='".$tp -> toDB($_POST['email'])."', user_signature='".$_POST['signature']."', user_image='".$tp -> toDB($_POST['image'])."', user_timezone='".$tp -> toDB($_POST['timezone'])."', user_hideemail='".intval($tp -> toDB($_POST['hideemail']))."', user_login='".$_POST['realname']."' {$new_customtitle}, user_xup='".$tp -> toDB($_POST['user_xup'])."' WHERE user_id='".intval($inp)."' ");
+		if ($photo_to_delete)
+		{	// Photo may be a flat file, or in the database
+		  delete_file($photo_to_delete);
+		}
+		if ($avatar_to_delete)
+		{	// Avatar may be a flat file, or in the database
+		  delete_file($avatar_to_delete);
+		}
 
-			$sql->db_Update("user", "{$new_username} {$pwreset} {$sesschange} user_email='".$tp -> toDB($_POST['email'])."', user_signature='".$_POST['signature']."', user_image='".$tp -> toDB($_POST['image'])."', user_timezone='".$tp -> toDB($_POST['timezone'])."', user_hideemail='".$tp -> toDB($_POST['hideemail'])."', user_login='".$_POST['realname']."' {$new_customtitle}, user_xup='".$tp -> toDB($_POST['user_xup'])."' WHERE user_id='".intval($inp)."' ");
-			// If user has changed display name, update the record in the online table
-			if(isset($username) && ($username != USERNAME) && !$_uid)
-			{
-				$sql->db_Update("online", "online_user_id = '".USERID.".".$username."' WHERE online_user_id = '".USERID.".".USERNAME."'");
-			}
 
-			if(ADMIN && getperms("4"))
-			{
-				$sql -> db_Update("user", "user_loginname='".$tp -> toDB($loginname)."' WHERE user_id='".intval($inp)."' ");
-			}
+		// If user has changed display name, update the record in the online table
+		if(isset($username) && ($username != USERNAME) && !$_uid)
+		{
+		  $sql->db_Update("online", "online_user_id = '".USERID.".".$username."' WHERE online_user_id = '".USERID.".".USERNAME."'");
+		}
 
-			if($ue_fields)
-			{
-				$sql->db_Select_gen("INSERT INTO #user_extended (user_extended_id, user_hidden_fields) values ('".intval($inp)."', '')");
-				$sql->db_Update("user_extended", $ue_fields." WHERE user_extended_id = '".intval($inp)."'");
-			}
 
-			// Update Userclass =======
-			if (!$_uid && $sql->db_Select("userclass_classes", "*", "userclass_editclass IN (".USERCLASS_LIST.")"))
-			{
-				$ucList = $sql->db_getList();
-				if ($sql->db_Select("user", "user_class", "user_id = '".intval($inp)."'"))
-				{
-					$row = $sql->db_Fetch();
-					$cur_classes = explode(",", $row['user_class']);
-					$newclist = array_flip($cur_classes);
-					foreach($ucList as $c)
-					{
-						$cid = $c['userclass_id'];
-						if(!in_array($cid, $_POST['class']))
-						{
-							unset($newclist[$cid]);
-						}
-						else
-						{
-							$newclist[$cid] = 1;
-						}
-					}
-					$newclist = array_keys($newclist);
-					$nid = implode(',', array_diff($newclist, array('')));
-					$sql->db_Update("user", "user_class='".$nid."' WHERE user_id='".intval($inp)."'");
-				}
-			}
+		// Only admins can update login name
+		if(ADMIN && getperms("4"))
+		{
+		  $sql -> db_Update("user", "user_loginname='".$tp -> toDB($loginname)."' WHERE user_id='".intval($inp)."' ");
+		}
+
+
+		// Save extended field values
+		if($ue_fields)
+		{
+// ***** Next line creates a record which presumably should be there anyway, so could generate an error
+		  $sql->db_Select_gen("INSERT INTO #user_extended (user_extended_id, user_hidden_fields) values ('".intval($inp)."', '')");
+		  $sql->db_Update("user_extended", $ue_fields." WHERE user_extended_id = '".intval($inp)."'");
+		}
+
 
-			if($update_xup == TRUE)
+		// Update Userclass - only if its the user changing their own data (admins can do it another way)
+//		if (!$_uid && $sql->db_Select("userclass_classes", "*", "userclass_editclass IN (".USERCLASS_LIST.")"))
+		if (!$_uid && $sql->db_Select("userclass_classes", "userclass_id", "userclass_editclass IN (".USERCLASS_LIST.")"))
+		{
+		  $ucList = $sql->db_getList();			// List of classes which this user can edit
+		  if (US_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Usersettings test","Read editable list. Current user classes: ".$udata['user_class'],FALSE,LOG_TO_ROLLING);
+//		  if ($sql->db_Select("user", "user_class", "user_id = '".intval($inp)."'"))
+//		  {
+//			$row = $sql->db_Fetch();
+//			$cur_classes = explode(",", $row['user_class']);
+			$cur_classes = explode(",", $udata['user_class']);			// Current class membership
+			$newclist = array_flip($cur_classes);						// Array keys are now the class IDs
+
+			// Update class list - we must take care to only change those classes a user can edit themselves 
+			foreach ($ucList as $c)
+			{
+			  $cid = $c['userclass_id'];
+			  if(!in_array($cid, $_POST['class']))
+			  {
+				unset($newclist[$cid]);
+			  }
+			  else
+			  {
+				$newclist[$cid] = 1;
+			  }
+			}
+			$newclist = array_keys($newclist);
+			$nid = implode(',', array_diff($newclist, array('')));
+			if ($nid != $udata['user_class'])
 			{
-				require_once(e_HANDLER."login.php");
-				userlogin::update_xup($inp, $_POST['user_xup']);
+			  if (US_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Usersettings test","Write back classes; new list: ".$nid,FALSE,LOG_TO_ROLLING);
+			  $sql->db_Update("user", "user_class='".$nid."' WHERE user_id=".intval($inp));
 			}
+//		  }
+		}
+
 
-			$e_event->trigger("postuserset", $_POST);
+		if($update_xup == TRUE)
+		{
+		  require_once(e_HANDLER."login.php");
+		  userlogin::update_xup($inp, $_POST['user_xup']);
+		}
 
-			// =======================
+		$e_event->trigger("postuserset", $_POST);
 
-			if(e_QUERY == "update") {
-            	header("Location: index.php");
-			}
-			$message = "<div style='text-align:center'>".LAN_150."</div>";
-			$caption = LAN_151;
-		} else {
-			$message = "<div style='text-align:center'>".$ret."</div>";
-			$caption = LAN_151;
+
+		if(e_QUERY == "update") 
+		{
+          header("Location: index.php");
 		}
-		unset($_POST);
+		$message = "<div style='text-align:center'>".LAN_150."</div>";
+		$caption = LAN_151;
+	  } 
+	  else 
+	  {	// Invalid data
+		$message = "<div style='text-align:center'>".$ret."</div>";
+		$caption = LAN_151;
+	  }
+	  unset($_POST);
 	}
 }
 
@@ -395,7 +540,8 @@
 	message_handler("P_ALERT", $error);
 	$adref = $_POST['adminreturn'];
 }
-// -------------------
+
+// --- User data has been update here if appropriate ---
 
 if(isset($message))
 {
@@ -415,15 +561,7 @@
 
 $sql->db_Select_gen($qry);
 $curVal=$sql->db_Fetch();
-$tmp = ($curVal['user_class'] != "" ? explode(",", $curVal['user_class']) : "");
-$tmp[] = e_UC_MEMBER;
-$tmp[] = e_UC_READONLY;
-$tmp[] = e_UC_PUBLIC;
-if($curVal['user_admin'] == 1)
-{
-	$tmp[] = e_UC_ADMIN;
-}
-$curVal['userclass_list'] = implode(",", $tmp);
+$curVal['userclass_list'] = addCommonClasses($curVal);
 
 if($_POST)
 {     // Fix for all the values being lost when an error occurred.
@@ -447,11 +585,11 @@
 	$text .= "<div class='fborder' style='text-align:center'><br />".str_replace("*","<span style='color:red'>*</span>",LAN_USET_9)."<br />".LAN_USET_10."<br /><br /></div>";
 }
 
-$text .= $tp->parseTemplate($USERSETTINGS_EDIT, FALSE, $usersettings_shortcodes);
+$text .= $tp->parseTemplate($USERSETTINGS_EDIT, TRUE, $usersettings_shortcodes);
 $text .= "<div>";
 
 $text .= "
-	<input type='hidden' name='_uid' value='$_uid' />
+	<input type='hidden' name='_uid' value='{$uuid}' />
 	</div>
 	</form>
 	";
@@ -473,7 +611,27 @@
 	}
 	return $ret;
 }
-//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
+//---------------------------------------------------------------------------------
+
+// Delete a file from the public directories. Return TRUE on success, FALSE on failure.
+// Also deletes from database if appropriate.
+function delete_file($fname, $dir = 'avatars/')
+{
+  global $sql;
+  if (!$fname) return FALSE;
+  
+  if (preg_match("#Binary (.*?)/#", $fname, $match)) 
+  {
+	return $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
+  }
+  elseif (file_exists(e_FILE."public/".$dir.$fname)) 
+  {
+	unlink(e_FILE."public/".$dir.$fname);
+	return TRUE;
+  }
+  return FALSE;
+}
+
 
 function headerjs() {
 	global $cal;
