diff -ruN 0.7.5/article.php 0.7.7/article.php
--- 0.7.5/article.php	2005-06-26 20:45:02.000000000 -0500
+++ 0.7.7/article.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,12 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/article.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/06/27 01:45:02 $
-|     $Author: streaky $
+|     $Revision: 1.5 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
-// This file is now depracated and remains in core for backward compatibilty reasons.
+// This file is now deprecated and remains in core for backward compatibility reasons.
 	
 $tmp = explode(".", $_SERVER['QUERY_STRING']);
 $action = $tmp[0];
diff -ruN 0.7.5/banner.php 0.7.7/banner.php
--- 0.7.5/banner.php	2005-12-24 16:53:38.000000000 -0600
+++ 0.7.7/banner.php	2006-06-02 08:59:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/banner.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/12/24 22:53:38 $
-|     $Author: sweetas $
+|     $Revision: 1.14 $
+|     $Date: 2006/06/02 13:59:40 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -39,7 +39,7 @@
 	$clean_password = $tp -> toDB($_POST['clientpassword']);
 	
 	if (!$sql->db_Select("banner", "*", "`banner_clientlogin` = '{$clean_login}' AND `banner_clientpassword` = '{$clean_password}'")) {
-		$ns->tablerender(LAN_38, "<br /><div style='text-align:center'>".LAN_20."</div><br />");
+		$ns->tablerender(BANNERLAN_38, "<br /><div style='text-align:center'>".BANNERLAN_20."</div><br />");
 		require_once(FOOTERF);
 		exit;
 	}
@@ -48,29 +48,29 @@
 	$banner_total = $sql->db_Select("banner", "*", "`banner_clientname` = '{$row['banner_clientname']}'");
 	 
 	if (!$banner_total) {
-		$ns->tablerender(LAN_38, "<br /><div style='text-align:center'>".LAN_29."</div><br />");
+		$ns->tablerender(BANNERLAN_38, "<br /><div style='text-align:center'>".BANNERLAN_29."</div><br />");
 		require_once(FOOTERF);
 		exit;
 	} else {
 		while ($row = $sql->db_Fetch()) {
 			 
-			$start_date = ($row['banner_startdate'] ? strftime("%d %B %Y", $row['banner_startdate']) : LAN_31);
-			$end_date = ($row['banner_enddate'] ? strftime("%d %B %Y", $row['banner_enddate']) : LAN_31);
+			$start_date = ($row['banner_startdate'] ? strftime("%d %B %Y", $row['banner_startdate']) : BANNERLAN_31);
+			$end_date = ($row['banner_enddate'] ? strftime("%d %B %Y", $row['banner_enddate']) : BANNERLAN_31);
 			 
 			$BANNER_TABLE_CLICKPERCENTAGE = ($row['banner_clicks'] && $row['banner_impressions'] ? round(($row['banner_clicks'] / $row['banner_impressions']) * 100)."%" : "-");
-			$BANNER_TABLE_IMPRESSIONS_LEFT = ($row['banner_impurchased'] ? $row['banner_impurchased'] - $row['banner_impressions'] : LAN_30);
-			$BANNER_TABLE_IMPRESSIONS_PURCHASED = ($row['banner_impurchased'] ? $row['banner_impurchased'] : LAN_30);
+			$BANNER_TABLE_IMPRESSIONS_LEFT = ($row['banner_impurchased'] ? $row['banner_impurchased'] - $row['banner_impressions'] : BANNERLAN_30);
+			$BANNER_TABLE_IMPRESSIONS_PURCHASED = ($row['banner_impurchased'] ? $row['banner_impurchased'] : BANNERLAN_30);
 			$BANNER_TABLE_CLIENTNAME = $row['banner_clientname'];
 			$BANNER_TABLE_BANNER_ID = $row['banner_id'];
 			$BANNER_TABLE_BANNER_CLICKS = $row['banner_clicks'];
 			$BANNER_TABLE_BANNER_IMPRESSIONS = $row['banner_impressions'];
-			$BANNER_TABLE_ACTIVE = LAN_36.($row['banner_active'] != "255" ? LAN_32 : "<b>".LAN_33."</b>");
-			$BANNER_TABLE_STARTDATE = LAN_37." ".$start_date;
-			$BANNER_TABLE_ENDDATE = LAN_34." ".$end_date;
+			$BANNER_TABLE_ACTIVE = BANNERLAN_36.($row['banner_active'] != "255" ? BANNERLAN_32 : "<b>".BANNERLAN_33."</b>");
+			$BANNER_TABLE_STARTDATE = BANNERLAN_37." ".$start_date;
+			$BANNER_TABLE_ENDDATE = BANNERLAN_34." ".$end_date;
 			
 			if ($row['banner_ip']) {
 				$tmp = explode("^", $row['banner_ip']);
-				$BANNER_TABLE_IP_LAN = LAN_35.": ".(count($tmp)-1);
+				$BANNER_TABLE_IP_LAN = BANNERLAN_35.": ".(count($tmp)-1);
 				for($a = 0; $a <= (count($tmp)-2); $a++) {
 					$BANNER_TABLE_IP .= $tmp[$a]."<br />";
 				}
@@ -107,7 +107,7 @@
 	
 $BANNER_LOGIN_TABLE_LOGIN = $rs->form_text("clientlogin", 30, $id, 20, "tbox");
 $BANNER_LOGIN_TABLE_PASSW = $rs->form_password("clientpassword", 30, "", 20, "tbox");
-$BANNER_LOGIN_TABLE_SUBMIT = $rs->form_button("submit", "clientsubmit", LAN_18);
+$BANNER_LOGIN_TABLE_SUBMIT = $rs->form_button("submit", "clientsubmit", BANNERLAN_18);
 	
 if (!$BANNER_LOGIN_TABLE) {
 	if (file_exists(THEME."banner_template.php")) {
@@ -117,7 +117,7 @@
 	}
 }
 $text = preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_LOGIN_TABLE);
-$ns->tablerender(LAN_19, $text);
+$ns->tablerender(BANNERLAN_19, $text);
 	
 	
 require_once(FOOTERF);
diff -ruN 0.7.5/class2.php 0.7.7/class2.php
--- 0.7.5/class2.php	2006-05-15 08:32:20.000000000 -0500
+++ 0.7.7/class2.php	2006-11-24 21:38:19.000000000 -0600
@@ -11,16 +11,51 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/class2.php,v $
-|     $Revision: 1.281 $
-|     $Date: 2006/05/15 13:32:20 $
+|     $Revision: 1.322 $
+|     $Date: 2006/11/25 03:38:19 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
-// Find out if register globals is enabled and destroy them if so
-
+//
+// *** Code sequence for startup ***
+// IMPORTANT: These items are in a carefully constructed order. DO NOT REARRANGE
+// without checking with experienced devs! Various subtle things WILL break.
+//
+// A Get the current CPU time so we know how long all of this takes
+// B Remove output buffering so we are in control of text sent to user
+// C Remove registered globals (SECURITY for all following code)
+// D Setup PHP error handling (now we can see php errors ;))
+// E Setup other PHP essentials
+// F Grab e107_config to get directory paths
+// G Retrieve Query from URI (i.e. what are the request parameters?!)
+// H Initialize debug handling (NOTE: A-G cannot use debug tools!)
+// I: Sanity check to ensure e107_config is ok
+// J: MYSQL setup (NOTE: A-I cannot use database!)
+// K: Compatibility mode
+// L: Retrieve core prefs
+// M: Subdomain and language selection
+// N: Other misc setups (NOTE: Put most 'random' things here that don't require user session or theme
+// O: Start user session
+// P: Load theme
+// Q: Other setups
+
+//
+// A: Honest global beginning point for processing time
+//
+$eTimingStart = microtime();					// preserve these when destroying globals in step C
+$oblev_before_start = ob_get_level();
+
+//
+// B: Remove all output buffering
+//
 while (@ob_end_clean());  // destroy all ouput buffering
 ob_start();             // start our own.
+$oblev_at_start = ob_get_level(); 	// preserve when destroying globals in step C
 
+//
+// C: Find out if register globals is enabled and destroy them if so
+// (DO NOT use the value of any variables before this point! They could have been set by the user)
+//
 $register_globals = true;
 if(function_exists('ini_get')) {
 	$register_globals = ini_get('register_globals');
@@ -29,13 +64,43 @@
 // Destroy! (if we need to)
 if($register_globals == true){
 	while (list($global) = each($GLOBALS)) {
-		if (!preg_match('/^(_POST|_GET|_COOKIE|_SERVER|_FILES|GLOBALS|HTTP.*|_REQUEST|retrieve_prefs|eplug_admin)$/', $global)) {
+		if (!preg_match('/^(_POST|_GET|_COOKIE|_SERVER|_FILES|GLOBALS|HTTP.*|_REQUEST|retrieve_prefs|eplug_admin|eTimingStart)|oblev_.*$/', $global)) {
 			unset($$global);
 		}
 	}
 	unset($global);
 }
 
+
+if(($pos = strpos($_SERVER['PHP_SELF'], ".php/")) !== false) // redirect bad URLs to the correct one.
+{
+	$new_url = substr($_SERVER['PHP_SELF'], 0, $pos+4);
+	$new_loc = ($_SERVER['QUERY_STRING']) ? $new_url."?".$_SERVER['QUERY_STRING'] : $new_url;
+	Header("Location: ".$new_loc);
+}
+// If url contains a .php in it, PHP_SELF is set wrong (imho), affecting all paths.  We need to 'fix' it if it does.
+$_SERVER['PHP_SELF'] = (($pos = strpos($_SERVER['PHP_SELF'], ".php")) !== false ? substr($_SERVER['PHP_SELF'], 0, $pos+4) : $_SERVER['PHP_SELF']);
+
+//
+// D: Setup PHP error handling
+//    (Now we can see PHP errors)
+//
+$error_handler = new error_handler();
+set_error_handler(array(&$error_handler, "handle_error"));
+
+//
+// E: Setup other essential PHP parameters
+//
+define("e107_INIT", TRUE);
+
+// 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(isset($retrieve_prefs) && is_array($retrieve_prefs)) {
 	foreach ($retrieve_prefs as $key => $pref_name) {
 		 $retrieve_prefs[$key] = preg_replace("/\W/", '', $pref_name);
@@ -44,40 +109,31 @@
 	unset($retrieve_prefs);
 }
 
-// setup error handling first of all.
-$error_handler = new error_handler();
-set_error_handler(array(&$error_handler, "handle_error"));
-
-// Honest global beginning point for processing time
-$eTimingStart = microtime();
-$start_ob_level = ob_get_level();
-
-define("e107_INIT", TRUE);
-
-// setup some php options
-ini_set('magic_quotes_runtime',     0);
-ini_set('magic_quotes_sybase',      0);
-ini_set('arg_separator.output',     '&amp;');
-ini_set('session.use_only_cookies', 1);
-ini_set('session.use_trans_sid',    0);
+define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE : FALSE));
+$srvtmp = explode(".",$_SERVER['HTTP_HOST']);
+define("e_SUBDOMAIN", (count($srvtmp)>2 && $srvtmp[2] ? $srvtmp[0] : FALSE)); // needs to be available to e107_config.
 
 //  Ensure thet '.' 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);
-	ini_set("include_path", $inc_path);
+	e107_ini_set("include_path", $inc_path);
 }
 unset($inc_path);
 
-// Grab e107_config, get directory paths, and create the $e107 object
+//
+// F: Grab e107_config, get directory paths and create $e107 object
+//
 @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");
 }
 
+//
 // clever stuff that figures out where the paths are on the fly.. no more need fo hard-coded e_HTTP :)
+//
 e107_require_once(realpath(dirname(__FILE__).'/'.$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__)));
@@ -91,24 +147,46 @@
 	}
 }
 
+//
+// G: Retrieve Query data from URI
+//    (Until this point, we have no idea what the user wants to do)
+//
 if (preg_match("#\[(.*?)](.*)#", $_SERVER['QUERY_STRING'], $matches)) {
 	define("e_MENU", $matches[1]);
-	define("e_QUERY", $matches[2]);
-	parse_str(e_MENU, $_emenu);
-	if(isset($_emenu['lan']))
+	$e_QUERY = $matches[2];
+
+	if(strlen(e_MENU) == 2) // language code ie. [fr]
 	{
-		$_GET['elan'] = $_emenu['lan'];
+        require_once(e_HANDLER."language_class.php");
+		$lng = new language;
+		define("e_LANCODE",TRUE);
+		$_GET['elan'] = $lng->convert(e_MENU);
 	}
-} else {
+
+}else {
 	define("e_MENU", "");
-	define("e_QUERY", $_SERVER['QUERY_STRING']);
+	$e_QUERY = $_SERVER['QUERY_STRING'];
+  	define("e_LANCODE", "");
 }
-$e_QUERY = e_QUERY;
+
+//
+// Start the parser; use it to grab the full query string
+//
+
+e107_require_once(e_HANDLER.'e_parse_class.php');
+$tp = new e_parse;
+
+//define("e_QUERY", $matches[2]);
+//define("e_QUERY", $_SERVER['QUERY_STRING']);
+$e_QUERY = $tp->post_toForm($e_QUERY);
+define("e_QUERY", $e_QUERY);
+//$e_QUERY = e_QUERY;
 
 define("e_TBQS", $_SERVER['QUERY_STRING']);
 $_SERVER['QUERY_STRING'] = e_QUERY;
 
 define("e_UC_PUBLIC", 0);
+define("e_UC_MAINADMIN", 250);
 define("e_UC_READONLY", 251);
 define("e_UC_GUEST", 252);
 define("e_UC_MEMBER", 253);
@@ -116,24 +194,30 @@
 define("e_UC_NOBODY", 255);
 define("ADMINDIR", $ADMIN_DIRECTORY);
 
+//
+// H: Initialize debug handling
+// (NO E107 DEBUG CONSTANTS OR CODE ARE AVAILABLE BEFORE THIS POINT)
 // All debug objects and constants are defined in the debug handler
-if (strpos(e_MENU, 'debug') !== FALSE || isset($_COOKIE['e107_debug_level'])) {
+// i.e. from here on you can use E107_DEBUG_LEVEL or any
+// E107_DBG_* constant for debug testing.
+//
 	require_once(e_HANDLER.'debug_handler.php');
-	$db_debug = new e107_db_debug;
-} else {
-	define('E107_DEBUG_LEVEL',0);
-}
 
-if(isset($db_debug) && is_object($db_debug)) {
+if(E107_DEBUG_LEVEL && isset($db_debug) && is_object($db_debug)) {
 	$db_debug->Mark_Time('Start: Init ErrHandler');
 }
 
-// e107_config.php upgrade check
+//
+// I: Sanity check on e107_config.php
+//     e107_config.php upgrade check
 if (!$ADMIN_DIRECTORY && !$DOWNLOADS_DIRECTORY) {
 	message_handler("CRITICAL_ERROR", 8, ": generic, ", "e107_config.php");
 	exit;
 }
 
+//
+// J: MYSQL INITIALIZATION
+//
 @require_once(e_HANDLER.'traffic_class.php');
 $eTraffic=new e107_traffic; // We start traffic counting ASAP
 $eTraffic->Calibrate($eTraffic);
@@ -141,9 +225,6 @@
 define("MPREFIX", $mySQLprefix);
 
 e107_require_once(e_HANDLER."mysql_class.php");
-e107_require_once(e_HANDLER.'e_parse_class.php');
-
-$tp = new e_parse;
 
 $sql =& new db;
 $sql2 =& new db;
@@ -166,22 +247,26 @@
 	exit;
 }
 
-/* New compatabilty mode.
-At a later date add a check to load e107 compat mode by $pref
+//
+// K: Load compatability mode.
+//
+/* At a later date add a check to load e107 compat mode by $pref
 PHP Compatabilty should *always* be on. */
 e107_require_once(e_HANDLER."php_compatibility_handler.php");
 e107_require_once(e_HANDLER."e107_Compat_handler.php");
 $aj = new textparse; // required for backwards compatibility with 0.6 plugins.
 
+//
+// L: Extract core prefs from the database
+//
+$sql->db_Mark_Time('Start: Extract Core Prefs');
 e107_require_once(e_HANDLER."pref_class.php");
 $sysprefs = new prefs;
 
-// Extract core prefs from the database
 e107_require_once(e_HANDLER.'cache_handler.php');
 e107_require_once(e_HANDLER.'arraystorage_class.php');
 $eArrayStorage = new ArrayData();
 
-$sql->db_Mark_Time('Start: Extracting Core Prefs');
 $PrefCache = ecache::retrieve('SitePrefs', 24 * 60, true);
 if(!$PrefCache){
 	// No cache of the prefs array, going for the db copy..
@@ -190,7 +275,7 @@
 	$PrefData = $sysprefs->get('SitePrefs');
 	$pref = $eArrayStorage->ReadArray($PrefData);
 	if(!$pref){
-		$admin_log->log_event("Core Prefs Error", "Core is attempting to restore prefs from automatic backup.", E_LOG_WARNING);
+		$admin_log->log_event("CORE_LAN8", "CORE_LAN7", E_LOG_WARNING); // Core prefs error, core is attempting to
 		// Try for the automatic backup..
 		$PrefData = $sysprefs->get('SitePrefs_Backup');
 		$pref = $eArrayStorage->ReadArray($PrefData);
@@ -202,7 +287,7 @@
 				message_handler("CRITICAL_ERROR", 3, __LINE__, __FILE__);
 				// No old system, so point in the direction of resetcore :(
 				message_handler("CRITICAL_ERROR", 4, __LINE__, __FILE__);
-				$admin_log->log_event("Core Prefs Error", "Core could not restore from automatic backup. Execution halted.", E_LOG_FATAL);
+				$admin_log->log_event("CORE_LAN8", "CORE_LAN9", E_LOG_FATAL); // Core could not restore from automatic backup. Execution halted.
 				exit;
 			} else {
 				// old prefs found, remove old system, and update core with new system
@@ -229,6 +314,9 @@
 	ecache::set('SitePrefs', $PrefCache);
 } else {
 	// cache of core prefs was found, so grab all the useful core rows we need
+	if(!isset($sysprefs->DefaultIgnoreRows)){
+    	$sysprefs->DefaultIgnoreRows = "";
+	}
 	$sysprefs->DefaultIgnoreRows .= '|SitePrefs';
 	$sysprefs->prefVals['core']['SitePrefs'] = $PrefCache;
 	if(isset($retrieve_prefs))
@@ -245,9 +333,28 @@
 
 $sql->db_Mark_Time('(Extracting Core Prefs Done)');
 
+
+//
+// M: Subdomain and Language Selection
+//
 define("SITEURLBASE", ($pref['ssl_enabled'] == '1' ? "https://" : "http://").$_SERVER['HTTP_HOST']);
 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'];
+		}
+		elseif($eln = $lng->convert(e_SUBDOMAIN))
+		{
+          	$GLOBALS['elan'] = $eln;
+		}
+}
+
+
 // if a cookie name pref isn't set, make one :)
 if (!$pref['cookie_name']) {
 	$pref['cookie_name'] = "e107cookie";
@@ -258,36 +365,66 @@
 	session_start();
 }
 
-define("e_SELF", ($pref['ssl_enabled'] == '1' ? "https://".$_SERVER['HTTP_HOST'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']) : "http://".$_SERVER['HTTP_HOST'].($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME'])));
-
+define("e_SELF", ($pref['ssl_enabled'] == '1' ? "https://".$_SERVER['HTTP_HOST'] : "http://".$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']));
 
-// if the option to force users to use a particular url for the site is enabled, redirect users there
+// if the option to force users to use a particular url for the site is enabled, redirect users there as needed
+// Now matches RFC 2616 (sec 3.2): case insensitive, https/:443 and http/:80 are equivalent.
+// And, this is robust against hack attacks. Malignant users can put **anything** in HTTP_HOST!
 if($pref['redirectsiteurl'] && $pref['siteurl']) {
-	$siteurl = SITEURLBASE."/";
-	if (strpos($pref['siteurl'], $siteurl) === FALSE && strpos(e_SELF, ADMINDIR) === FALSE) {
-		$location = str_replace($siteurl, $pref['siteurl'], e_SELF).(e_QUERY ? "?".e_QUERY : "");
+	// Find domain and port from user and from pref
+	list($urlbase,$urlport) = explode(':',$_SERVER['HTTP_HOST'].':');
+	if (!$urlport) { $urlport = $_SERVER['SERVER_PORT']; }
+	if (!$urlport) { $urlport = 80; }
+	$aPrefURL = explode('/',$pref['siteurl'],4);
+	if (count($aPrefURL) > 2) { // we can do this -- there's at least http[s]://dom.ain/whatever
+		$PrefRoot = $aPrefURL[2];
+		list($PrefSiteBase,$PrefSitePort) = explode(':',$PrefRoot.':');
+		if (!$PrefSitePort) {
+			$PrefSitePort = ( $aPrefURL[0] == "https:" ) ? 443 : 80;	// no port so set port based on 'scheme'
+		}
+
+		// Redirect only if
+		// -- ports do not match (http <==> https)
+		// -- base domain does not match (case-insensitive)
+		// -- NOT admin area
+		if (($urlport != $PrefSitePort || stripos($PrefSiteBase, $urlbase) === FALSE) && strpos(e_SELF, ADMINDIR) === FALSE) 		{
+			$aeSELF = explode('/',e_SELF,4);
+			$aeSELF[0] = $aPrefURL[0];	// Swap in correct type of query (http, https)
+			$aeSELF[1] = '';						// Defensive code: ensure http:// not http:/<garbage>/
+			$aeSELF[2] = $aPrefURL[2];  // Swap in correct domain and possibly port
+			$location = implode('/',$aeSELF).(e_QUERY ? "?".e_QUERY : "");
+
 		header("Location: {$location}", true, 301); // send 301 header, not 302
 		exit();
 	}
 }
+}
 
 $page = substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);
 define("e_PAGE", $page);
 
 // sort out the users language selection
-if (isset($_POST['setlanguage']) || isset($_GET['elan'])) {
-	if($_GET['elan']){  // query support, for language selection splash pages. etc
-	$_POST['sitelanguage'] = $_GET['elan'];
+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'];
+	}
+	if($GLOBALS['elan'] && !isset($_POST['sitelanguage']))
+	{
+   		$_POST['sitelanguage'] = $GLOBALS['elan'];
 	}
+
 	$sql->mySQLlanguage = $_POST['sitelanguage'];
+    $sql2->mySQLlanguage = $_POST['sitelanguage'];
+
 	if ($pref['user_tracking'] == "session") {
 		$_SESSION['e107language_'.$pref['cookie_name']] = $_POST['sitelanguage'];
 	} else {
 		setcookie('e107language_'.$pref['cookie_name'], $_POST['sitelanguage'], time() + 86400, "/");
 		$_COOKIE['e107language_'.$pref['cookie_name']] = $_POST['sitelanguage'];
 		if (strpos(e_SELF, ADMINDIR) === FALSE) {
-			$locat = (!$_GET['elan'] && e_QUERY) ? e_SELF."?".e_QUERY : e_SELF;
-			header("Location:".$locat);
+			$locat = ((!$_GET['elan'] && e_QUERY) || (e_QUERY && e_LANCODE)) ? e_SELF."?".e_QUERY : e_SELF;
+		  		header("Location:".$locat);
 		}
 	}
 }
@@ -299,9 +436,11 @@
 	if ($pref['user_tracking'] == "session") {
 		$user_language=(array_key_exists('e107language_'.$pref['cookie_name'], $_SESSION) ? $_SESSION['e107language_'.$pref['cookie_name']] : "");
 		$sql->mySQLlanguage=($user_language) ? $user_language : "";
+		$sql2->mySQLlanguage = $sql->mySQLlanguage;
 	} else {
-		$user_language=$_COOKIE['e107language_'.$pref['cookie_name']];
+		$user_language= (isset($_COOKIE['e107language_'.$pref['cookie_name']])) ? $_COOKIE['e107language_'.$pref['cookie_name']] : "";
 		$sql->mySQLlanguage=($user_language) ? $user_language : "";
+		$sql2->mySQLlanguage = $sql->mySQLlanguage;
 	}
 
 
@@ -322,27 +461,35 @@
 
 define("e_LANLIST",(isset($tmplan) ? $tmplan : ""));
 
-
-$sql->db_Mark_Time('(Start: Pref/multilang done)');
-
 $language=(isset($_COOKIE['e107language_'.$pref['cookie_name']]) ? $_COOKIE['e107language_'.$pref['cookie_name']] : ($pref['sitelanguage'] ? $pref['sitelanguage'] : "English"));
-define("e_LAN", $language);
+$language = preg_replace("#\W#", "", $language);
 define("USERLAN", ($user_language && (strpos(e_SELF, $PLUGINS_DIRECTORY) !== FALSE || (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE && file_exists(e_LANGUAGEDIR.$user_language."/lan_".e_PAGE)) || (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE && file_exists(e_LANGUAGEDIR.$user_language."/admin/lan_".e_PAGE)) || file_exists(dirname($_SERVER['SCRIPT_FILENAME'])."/languages/".$user_language."/lan_".e_PAGE)    || (    (strpos(e_SELF, $ADMIN_DIRECTORY) == FALSE) && (strpos(e_SELF, $PLUGINS_DIRECTORY) == FALSE) && file_exists(e_LANGUAGEDIR.$user_language."/".$user_language.".php")  )   ) ? $user_language : FALSE));
 define("e_LANGUAGE", (!USERLAN || !defined("USERLAN") ? $language : USERLAN));
 
 e107_include(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE.".php");
 e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE."_custom.php");
 
-define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE : FALSE));
+if($pref['sitelanguage'] != e_LANGUAGE && isset($pref['multilanguage']) && $pref['multilanguage'] && !$pref['multilanguage_subdomain']){
+	list($clc) = explode("_",CORE_LC);
+	define("e_LAN", strtolower($clc));
+	define("e_LANQRY", "[".e_LAN."]");
+	unset($clc);
+}else{
+    define("e_LAN", FALSE);
+	define("e_LANQRY", FALSE);
+}
+$sql->db_Mark_Time('(Start: Pref/multilang done)');
 
-// online user tracking class
+//
+// N: misc setups: online user tracking, cache
+//
+$sql -> db_Mark_Time('Start: Misc resources. Online user tracking, cache');
 $e_online = new e_online();
 
 // cache class
 $e107cache = new ecache;
 
 
-
 if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2) {
 	$threshold=(time() - ($pref['del_unv'] * 60));
 	$sql->db_Delete("user", "user_ban = 2 AND user_join < '{$threshold}' ");
@@ -358,9 +505,23 @@
 	e107_require_once(e_HANDLER.'notify_class.php');
 }
 
+//
+// O: Start user session
+//
 $sql -> db_Mark_Time('Start: Init session');
 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("SITEBUTTON", $pref['sitebutton']);
+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"));
+
+// legacy module.php file loading.
 if (isset($pref['modules']) && $pref['modules']) {
 	$mods=explode(",", $pref['modules']);
 	foreach ($mods as $mod) {
@@ -370,6 +531,21 @@
 	}
 }
 
+// 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){
+		if (is_readable(e_PLUGIN."{$mod}/e_module.php")) {
+			require_once(e_PLUGIN."{$mod}/e_module.php");
+ 		}
+	}
+}
+
+//
+// P: THEME LOADING
+//
+
+$sql->db_Mark_Time('Start: Load Theme');
+
 //###########  Module redefinable functions ###############
 if (!function_exists('checkvalidtheme')) {
 	function checkvalidtheme($theme_check) {
@@ -416,7 +592,12 @@
 	}
 }
 
-//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
+//
+// Q: ALL OTHER SETUP CODE
+//
+$sql->db_Mark_Time('Start: Misc Setup');
+
+//------------------------------------------------------------------------------------------------------------------------------------//
 if (!class_exists('e107_table')) {
 	class e107table {
 		function tablerender($caption, $text, $mode = "default", $return = false) {
@@ -474,15 +655,6 @@
 
 $sql->db_Delete("tmp", "tmp_time < '".(time() - 300)."' AND tmp_ip!='data' AND tmp_ip!='submitted_link'");
 
-// 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("SITEBUTTON", $pref['sitebutton']);
-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"));
 
 
 if ($pref['maintainance_flag'] && ADMIN == FALSE && strpos(e_SELF, "admin.php") === FALSE && strpos(e_SELF, "sitedown.php") === FALSE) {
@@ -566,7 +738,17 @@
 $sql->db_Mark_Time('(Start: Find/Load Theme)');
 
 if(!defined("THEME")){
-	if ((strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || strpos(e_SELF, "admin") !== FALSE || (isset($eplug_admin) && $eplug_admin == TRUE)) && $pref['admintheme']) {
+	// any plugin file starting with 'admin_' is assumed to use admin theme
+	// any plugin file in a folder called admin/ is assumed to use admin theme.
+	// any file that specifies $eplug_admin = TRUE;
+	// this test: (strpos(e_SELF,'/'.$PLUGINS_DIRECTORY) !== FALSE && strpos(e_PAGE,"admin_") === 0)
+	// alternate test: match ANY file starting with 'admin_'...
+	//   strpos(e_PAGE, "admin_") === 0
+	//
+	// here we TEST the theme (see below for deciding what theme to USE)
+	//
+
+	if((strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || (strpos(e_SELF,'/'.$PLUGINS_DIRECTORY) !== FALSE && (strpos(e_PAGE,"admin_") === 0 || strpos(str_replace($e107->base_path, "", e_SELF), "admin/") !== FALSE)) || (isset($eplug_admin) && $eplug_admin == TRUE)) && $pref['admintheme']) {
 
 		if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') !== FALSE) {
 			checkvalidtheme($pref['sitetheme']);
@@ -586,7 +768,12 @@
 	}
 }
 
-if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || strpos(e_SELF, "admin") !== FALSE || (isset($eplug_admin) && $eplug_admin == TRUE))) {
+
+
+// --------------------------------------------------------------
+
+	// here we USE the theme
+	if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || (strpos(e_SELF,'/'.$PLUGINS_DIRECTORY) !== FALSE && strpos(e_PAGE,"admin_") === 0) || (isset($eplug_admin) && $eplug_admin == TRUE))) {
 	if (file_exists(THEME.'admin_theme.php')) {
 		require_once(THEME.'admin_theme.php');
 	} else {
@@ -596,14 +783,18 @@
 	require_once(THEME."theme.php");
 }
 
+$exclude_lan = array("lan_signup.php");  // required for multi-language.
+
 if (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || strpos(e_SELF, "admin.php") !== FALSE) {
 	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".e_PAGE);
 	e107_include_once(e_LANGUAGEDIR."English/admin/lan_".e_PAGE);
-} else if (strpos(e_SELF, $PLUGINS_DIRECTORY) === FALSE) {
+} else if (!in_array("lan_".e_PAGE,$exclude_lan) && strpos(e_SELF, $PLUGINS_DIRECTORY) === FALSE) {
 	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
 	e107_include_once(e_LANGUAGEDIR."English/lan_".e_PAGE);
 }
 
+
+
 if(!defined("IMODE")) define("IMODE", "lite");
 
 if ($pref['anon_post'] ? define("ANON", TRUE) : define("ANON", FALSE));
@@ -613,6 +804,8 @@
 if ($pref['antiflood1'] == 1) {
 	define('FLOODPROTECT', TRUE);
 	define('FLOODTIMEOUT', $pref['antiflood_timeout']);
+}else{
+	define('FLOODPROTECT', FALSE);
 }
 
 $layout = isset($layout) ? $layout : '_default';
@@ -644,6 +837,10 @@
 	require_once(e_HANDLER."date_handler.php");
 }
 
+
+
+
+
 //@require_once(e_HANDLER."IPB_int.php");
 //@require_once(e_HANDLER."debug_handler.php");
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
@@ -688,6 +885,11 @@
 
 	if (preg_match("/^([0-9]+)$/", $var) && !$peer)
 	{
+		if ($var == e_UC_MAINADMIN && getperms('0'))
+		{
+        	return TRUE;
+		}
+
 		if ($var == e_UC_MEMBER && USER == TRUE)
 		{
 			return TRUE;
@@ -932,7 +1134,7 @@
 					}
 					$sql->db_Update("online", $query);
 				} else {
-					$sql->db_Insert("online", " '".time()."', '0', '{$udata}', '{$ip}', '{$page}', 1");
+					$sql->db_Insert("online", " '".time()."', '0', '{$udata}', '{$ip}', '{$page}', 1, 0");
 				}
 			} else {
 				//Current page request is from a visitor
@@ -951,7 +1153,7 @@
 					}
 					$sql->db_Update("online", $query);
 				} else {
-					$sql->db_Insert("online", " '".time()."', 'null', '0', '{$ip}', '{$page}', 1");
+					$sql->db_Insert("online", " '".time()."', 'null', '0', '{$ip}', '{$page}', 1, 0");
 				}
 			}
 
@@ -964,7 +1166,7 @@
 				exit;
 			}
 			if ($row['online_pagecount'] >= $online_warncount && $row['online_ip'] != "127.0.0.1") {
-				echo "<div style='text-align:center; font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><b>Warning!</b><br /><br />The flood protection on this site has been activated and you are warned that if you carry on requesting pages you could be banned.<br /></div>";
+				echo "<div style='text-align:center; font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><b>".LAN_WARNING."</b><br /><br />".CORE_LAN6."<br /></div>";
 				exit;
 			}
 
@@ -1061,7 +1263,7 @@
 			define("ADMIN", FALSE);
 			define("USER", FALSE);
 			define("USERCLASS", "");
-			define("LOGINMESSAGE", "Corrupted cookie detected - logged out.<br /><br />");
+			define("LOGINMESSAGE",CORE_LAN10."<br /><br />");
 			return (FALSE);
 		}
 
@@ -1107,7 +1309,7 @@
 				save_prefs("user");
 			}
 
-			define("USERTHEME", ($user_pref['sitetheme'] && file_exists(e_THEME.$user_pref['sitetheme']."/theme.php") ? $user_pref['sitetheme'] : FALSE));
+			define("USERTHEME", (isset($user_pref['sitetheme']) && file_exists(e_THEME.$user_pref['sitetheme']."/theme.php") ? $user_pref['sitetheme'] : FALSE));
 			global $ADMIN_DIRECTORY, $PLUGINS_DIRECTORY;
 			if ($result['user_admin']) {
 				define("ADMIN", TRUE);
@@ -1141,6 +1343,42 @@
 	setcookie($name, $value, $expire, $path, $domain, $secure);
 }
 
+//
+// Use these to combine isset() and use of the set value. or defined and use of a constant
+// i.e. to fix  if($pref['foo']) ==> if ( varset($pref['foo']) ) will use the pref, or ''.
+// Can set 2nd param to any other default value you like (e.g. false, 0, or whatever)
+// $testvalue adds additional test of the value (not just isset())
+// Examples:
+// $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);
+//
+function varset(&$val,$default='',$testvalue=false) {
+	if (isset($val)) {
+		return (!$testvalue || $val) ? $val : $default;
+	}
+	return $default;
+}
+function defset($str,$default='',$testvalue=false) {
+	if (defined($str)) {
+		return (!$testvalue || constant($str)) ? constant($str) : $default;
+	}
+	return $default;
+}
+
+//
+// These variants are like the above, but only return the value if both set AND 'true'
+//
+function varsettrue(&$val,$default='') {
+	if (isset($val) && $val) return $val;
+	return $default;
+}
+function defsettrue($str,$default='') {
+	if (defined($str) && constant($str)) return constant($str);
+	return $default;
+}
+
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 function message_handler($mode, $message, $line = 0, $file = "") {
 	e107_require_once(e_HANDLER."message_handler.php");
@@ -1308,7 +1546,7 @@
 			break;
 			case E_USER_ERROR:
 			if ($this->debug == true) {
-				$error['short'] = "Internal Error Message: {$message}, Line {$line} of {$file}<br />\n";
+				$error['short'] = "&nbsp;&nbsp;&nbsp;&nbsp;Internal Error Message: {$message}, Line {$line} of {$file}<br />\n";
 				$trace = debug_backtrace();
 				$backtrace[0] = (isset($trace[1]) ? $trace[1] : "");
 				$backtrace[1] = (isset($trace[2]) ? $trace[2] : "");
@@ -1325,7 +1563,7 @@
 		$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}')\" /></t>\n\t</tr>\n";
+			$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; }
 		}
@@ -1364,4 +1602,11 @@
 
 $sql->db_Mark_Time('(After class2)');
 
-?>
\ No newline at end of file
+
+function e107_ini_set($var, $value){
+	if (function_exists('ini_set')){
+		ini_set($var, $value);
+	}
+}
+
+?>
diff -ruN 0.7.5/comment.php 0.7.7/comment.php
--- 0.7.5/comment.php	2006-01-09 06:43:02.000000000 -0600
+++ 0.7.7/comment.php	2006-10-12 08:44:28.000000000 -0500
@@ -11,14 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/comment.php,v $
-|     $Revision: 1.47 $
-|     $Date: 2006/01/09 12:43:02 $
-|     $Author: sweetas $
+|     $Revision: 1.52 $
+|     $Date: 2006/10/12 13:44:28 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
 require_once(e_HANDLER."news_class.php");
 require_once(e_HANDLER."comment_class.php");
+define("PAGE_NAME", COMLAN_99);
 
 if (!e_QUERY) {
 	header("location:".e_BASE."index.php");
@@ -41,7 +42,7 @@
 		header("location: ".e_BASE."index.php");
 		exit;
 	}
-	
+
 	if($table == "poll") {
 		if (!$sql->db_Select("polls", "poll_title", "`poll_id` = {$id} AND `poll_comment` = 1")) {
 			header("location: ".e_BASE."index.php");
@@ -96,21 +97,12 @@
 			$cobj->enter_comment($clean_authorname, $clean_comment, $table, $nid, $pid, $clean_subject);
 			$e107cache->clear("comment.php?{$table}.{$id}");
 		}
+		//plugin e_comment.php files
 		$plugin_redir = false;
-		$handle = opendir(e_PLUGIN);
-		while (false !== ($file = readdir($handle))) {
-			if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)) {
-				$plugin_handle = opendir(e_PLUGIN.$file."/");
-				while (false !== ($file2 = readdir($plugin_handle))) {
-					if ($file2 == "e_comment.php") {
-						require_once(e_PLUGIN.$file."/".$file2);
-						if ($table == $e_plug_table) {
-							$plugin_redir = TRUE;
-							break 2;
-						}
-					}
-				}
-			}
+		$e_comment = $cobj->get_e_comment();
+		if ($table == $e_comment[$table]['eplug_comment_ids']){
+			$plugin_redir = TRUE;
+			$reply_location = str_replace("{NID}", $nid, $e_comment[$table]['reply_location']);
 		}
 
 		if ($plugin_redir)
@@ -165,7 +157,7 @@
 			} else {
 				list($news['news_title']) = $sql->db_Fetch();
 				$subject = $news['news_title'];
-				$title = LAN_100;
+				$title = COMLAN_100;
 			}
 		} elseif ($table == "poll") {
 			if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' ")) {
@@ -174,7 +166,7 @@
 			} else {
 				list($poll['poll_title']) = $sql->db_Fetch();
 				$subject = $poll['poll_title'];
-				$title = LAN_101;
+				$title = COMLAN_101;
 			}
 		} elseif ($table == "content") {
 			$sql->db_Select("content", "content_heading", "content_id='{$nid}'");
@@ -189,17 +181,17 @@
 		list($content['content_type']) = $sql->db_Fetch();
 		if ($content['content_type'] == "0") {
 			$content_type = "article";
-			$title = LAN_103;
+			$title = COMLAN_103;
 		} elseif ($content['content_type'] == "3") {
 			$content_type = "review";
-			$title = LAN_104;
+			$title = COMLAN_104;
 		} elseif ($content['content_type'] == "1") {
 			$content_type = "content";
-			$title = LAN_105;
+			$title = COMLAN_105;
 		}
 	}
 
-	define('e_PAGETITLE', $title." / ".LAN_99." / ".LAN_102.$subject."");
+	define('e_PAGETITLE', $title." / ".COMLAN_99." / ".COMLAN_102.$subject."");
 	require_once(HEADERF);
 } else {
 
@@ -219,18 +211,18 @@
 			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 
-				LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id 
-				WHERE n.news_class IN (".USERCLASS_LIST.") 
-				AND n.news_id={$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 n.news_id={$id}
 				AND n.news_allow_comments=0
 				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 IN (".USERCLASS_LIST.") 
-				AND n.news_id={$id} 
+				LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
+				WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
+				AND n.news_id={$id}
 				AND n.news_allow_comments=0";
 			}
 
@@ -240,11 +232,11 @@
 			} else {
 				$news = $sql->db_Fetch();
 				$subject = $tp->toForm($news['news_title']);
-				define("e_PAGETITLE", LAN_100." / ".LAN_99." / {$subject}");
+				define("e_PAGETITLE", COMLAN_100." / ".COMLAN_99." / {$subject}");
 				require_once(HEADERF);
 				ob_start();
 				$ix = new news;
-				$ix->render_newsitem($news, "default");
+				$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;
 			}
@@ -257,7 +249,7 @@
 				$row = $sql->db_Fetch();
 				$comments_poll = $row['poll_comment'];
 				$subject = $row['poll_title'];
-				define("e_PAGETITLE", LAN_101." / ".LAN_99." / ".$subject."");
+				define("e_PAGETITLE", COMLAN_101." / ".COMLAN_99." / ".$subject."");
 				require_once(HEADERF);
 				require(e_PLUGIN."poll/poll_menu.php");
 				$field = $row['poll_id'];
@@ -312,7 +304,7 @@
 
 		if($TRACKBACK_RENDER_METHOD)
 		{
-			$ns->tablerender("<a name='track'></a>".LAN_315, $text);
+			$ns->tablerender("<a name='track'></a>".COMLAN_315, $text);
 		}
 		else
 		{
@@ -321,10 +313,10 @@
 	}
 	else
 	{
-		echo "<a name='track'></a>".LAN_316;
+		echo "<a name='track'></a>".COMLAN_316;
 	}
 	if (ADMIN && getperms("B")) {
-		echo "<div style='text-align:right'><a href='".e_PLUGIN."trackback/modtrackback.php?".$id."'>".LAN_317."</a></div><br />";
+		echo "<div style='text-align:right'><a href='".e_PLUGIN."trackback/modtrackback.php?".$id."'>".COMLAN_317."</a></div><br />";
 	}
 }
 
diff -ruN 0.7.5/contact.php 0.7.7/contact.php
--- 0.7.5/contact.php	2006-05-01 18:58:46.000000000 -0500
+++ 0.7.7/contact.php	2006-11-09 13:57:47.000000000 -0600
@@ -11,18 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/contact.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/05/01 23:58:46 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2006/11/09 19:57:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
-require_once(HEADERF);
 
-if(!isset($pref['contact_emailcopy']) || !$pref['contact_emailcopy'])
-{
-	$CONTACT_EMAIL_COPY = " ";
-}
+    // security image may be disabled by removing the appropriate shortcodes from the template.
+	require_once(e_HANDLER."secure_img_handler.php");
+	$sec_img = new secure_image;
+
+
+require_once(HEADERF);
 
 if (!$CONTACT_FORM) {
 	if (file_exists(THEME."contact_template.php")) {
@@ -36,23 +37,34 @@
 
 	$error = "";
 
-	$sender_name = $tp->post_toHTML($_POST['author_name']);
+	$sender_name = $tp->toEmail($_POST['author_name'],TRUE);
 	$sender = check_email($_POST['email_send']);
-	$subject = $tp->post_toHTML($_POST['subject']);
-	$body = $tp->post_toHTML($_POST['body']);
+	$subject = $tp->toEmail($_POST['subject'],TRUE);
+	$body = $tp->toEmail($_POST['body'],TRUE);
+
+// Check Image-Code
+    if (isset($_POST['rand_num']) && !$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
+	{
+		$error .= LANCONTACT_15."\\n";
+	}
 
 // Check message body.
-	if(strlen($_POST['body']) < 15)
+	if(strlen(trim($_POST['body'])) < 15)
 	{
 		$error .= LANCONTACT_12."\\n";
     }
 
 // Check subject line.
-	if(strlen($_POST['subject']) < 2)
+	if(strlen(trim($_POST['subject'])) < 2)
 	{
 		$error .= LANCONTACT_13."\\n";
     }
 
+	if(!strpos(trim($_POST['email_send']),"@"))
+	{
+		$error .= LANCONTACT_11."\\n";
+    }
+
 
 // Check email address on remote server (if enabled).
 	if ($pref['signup_remote_emailcheck'] && $error == "")
@@ -78,31 +90,71 @@
 		$body .= "\n\nIP:\t".USERIP."\n";
 		$body .= "User:\t#".USERID." ".USERNAME."\n";
 
+		if(!$_POST['contact_person'] && isset($pref['sitecontacts'])) // only 1 person, so contact_person not posted.
+		{
+    		if($pref['sitecontacts'] == e_UC_MAINADMIN)
+			{
+        		$query = "user_perms = '0' OR user_perms = '0.' ";
+			}
+			elseif($pref['sitecontacts'] == e_UC_ADMIN)
+			{
+				$query = "user_admin = 1 ";
+			}
+			else
+			{
+        		$query = $pref['sitecontacts'] . " IN (user_class) ";
+			}
+		}
+		else
+		{
+      		$query = "user_id = ".$_POST['contact_person'];
+		}
+
+    	if($sql -> db_Select("user", "user_name,user_email",$query." LIMIT 1"))
+		{
+    		$row = $sql -> db_Fetch();
+    		$send_to = $row['user_email'];
+			$send_to_name = $row['user_name'];
+		}
+    	else
+		{
+		    $send_to = SITEADMINEMAIL;
+			$send_to_name = ADMIN;
+		}
+
     	require_once(e_HANDLER."mail.php");
- 		$message =  (sendemail(SITEADMINEMAIL,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10;
+ 		$message =  (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10;
     	if(isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $_POST['email_copy'] == 1){
 			sendemail($sender,"[".SITENAME."] ".$subject, $body,ADMIN,$sender,$sender_name);
     	}
     	$ns -> tablerender('', $message);
 		require_once(FOOTERF);
 		exit;
-    } else {
+    }
+	else
+	{
 		require_once(e_HANDLER."message_handler.php");
-		message_handler("ALERT", $error);
+		message_handler("P_ALERT", $error);
 	}
 
 }
 
-if(SITECONTACTINFO && $CONTACT_INFO){
+if(SITECONTACTINFO && $CONTACT_INFO)
+{
 	$text = $tp->toHTML($CONTACT_INFO,"","parse_sc");
-	$ns -> tablerender(LANCONTACT_01, $text);
+	$ns -> tablerender(LANCONTACT_01, $text,"contact");
 }
 
-$text = $CONTACT_FORM;
+if(isset($pref['sitecontacts']) && $pref['sitecontacts'] != 255)
+{
+	require_once(e_FILE."shortcode/batch/contact_shortcodes.php");
+	$text = $tp->parseTemplate($CONTACT_FORM, TRUE, $contact_shortcodes);
 
-if(trim($text) != ""){
-	$ns -> tablerender(LANCONTACT_02, $text);
+	if(trim($text) != "")
+	{
+		$ns -> tablerender(LANCONTACT_02, $text, "contact");
+	}
 }
 require_once(FOOTERF);
 exit;
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/download.php 0.7.7/download.php
--- 0.7.5/download.php	2006-05-14 19:30:31.000000000 -0500
+++ 0.7.7/download.php	2006-11-11 22:10:15.000000000 -0600
@@ -11,22 +11,33 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/download.php,v $
-|     $Revision: 1.62 $
-|     $Date: 2006/05/15 00:30:31 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.77 $ - with modifications
+|     $Date: 2006/11/12 04:10:15 $
+|     $Author: mrpete $
+|
+| 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->toJS($pref['agree_text']);
+$agreetext = $tp->toHTML($pref['agree_text'],TRUE,"parse_sc");
 $cobj = new comment;
 global $tp;
 
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:100%"); }
+
+// To prevent display of sub-categories on the main display, un-comment the following line
+//$pref['download_subsub'] = '0';
+
+
 /* define images */
-define("IMAGE_DOWNLOAD", (file_exists(THEME."generic/download.png") ? THEME."generic/download.png" : e_IMAGE."generic/".IMODE."/download.png"));
-define("IMAGE_NEW", (file_exists(THEME."generic/new.png") ? THEME."generic/new.png" : e_IMAGE."generic/".IMODE."/new.png"));
+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 */
 
@@ -35,6 +46,14 @@
 	require_once(HEADERF);
 	// no qs - render categories ...
 
+	if($cacheData = $e107cache->retrieve("download_cat",720)) // expires every 12 hours.
+	{
+		echo $cacheData;
+		require_once(FOOTERF);
+		exit;
+	}
+
+
 	if (!$DOWNLOAD_CAT_PARENT_TABLE)
 	{
 		if (is_readable(THEME."templates/download_template.php"))
@@ -80,12 +99,18 @@
 			$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']]);
+			  }
 			}
 		}
 	}
@@ -105,25 +130,36 @@
 	$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;
 
+
+	ob_start();
+
 	if($DOWNLOAD_CAT_TABLE_RENDERPLAIN) {
 		echo $text;
 	} else {
 		$ns->tablerender(LAN_dl_18.$type, $text);
 	}
+
+	$cache_data = ob_get_flush();
+	$e107cache->set("download_cat", $cache_data);
+
 	require_once(FOOTERF);
 	exit;
 }
 
 
+// Got a query string from now on
 $tmp = explode(".", e_QUERY);
-if (is_numeric($tmp[0])) {
+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 {
+}
+ else
+{
 	$action = preg_replace("#\W#", "", $tp -> toDB($tmp[0]));
 	$id = intval($tmp[1]);
 }
@@ -173,13 +209,27 @@
 
 	$total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
 
-	/*
-	if (!$total_downloads) {
-		require_once(HEADERF);
-		require_once(FOOTERF);
-		exit;
+// 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;
 	}
-	*/
+
+	require_once(HEADERF);
 
 	/* SHOW SUBCATS ... */
 
@@ -199,48 +249,48 @@
 		";
 		$sql->db_Select_gen($qry);
 		$scArray = $sql -> db_getList();
-		if (!$DOWNLOAD_CAT_PARENT_TABLE) {
-			if (file_exists(THEME."download_template.php"))	{
+		if (!$DOWNLOAD_CAT_PARENT_TABLE)
+		{
+			if (file_exists(THEME."download_template.php"))
+			{
 				require_once(THEME."download_template.php");
-			} else {
+			}
+			else
+			{
 				require_once(e_BASE.$THEMES_DIRECTORY."templates/download_template.php");
 			}
 		}
 		if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:1px solid blue");}
-		foreach($scArray as $row)	{
+		foreach($scArray as $row)
+		{
 			$download_cat_table_string .= parse_download_cat_child_table($row, FALSE);
 		}
-		require_once(HEADERF);
 		if(strstr($row['parent_icon'], chr(1)))	{
 			list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $row['parent_icon']);
 		}
-		$DOWNLOAD_CAT_MAIN_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float-left' />" : "&nbsp;");
+		$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($row['parent_name']);
 		$download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
 		$DOWNLOAD_CAT_NEWDOWNLOAD_TEXT = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' /> ".LAN_dl_36;
 		$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;
-		if($DOWNLOAD_CAT_TABLE_RENDERPLAIN) {
+		if($DOWNLOAD_CAT_TABLE_RENDERPLAIN)
+		{
 			echo $text;
-		} else {
-			$ns->tablerender(LAN_dl_18.$type, $text);
 		}
-		require_once(FOOTERF);
-		exit;
-	}
-
-	$sql->db_Select("download_category", "*", "download_category_id='{$id}'");
-	$row = $sql->db_Fetch();
-	extract($row);
+		else
+		{
+			$ns->tablerender($type, $text);
+		}
+		$text = "";		// If other files, show in a separate block
+		$type = "";   	// Cancel title once displayed
+	}  // End of subcategory display
 
+// Now display individual downloads
 	$core_total = $sql->db_Count("download WHERE download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.")");
-	$type = $download_category_name;
-
-	$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
-	define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
+	if (!check_class($download_category_class))
+	{
 
-	require_once(HEADERF);
-	if (!check_class($download_category_class)) {
 		$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
 		require_once(FOOTERF);
 		exit;
@@ -250,9 +300,9 @@
 	{
 		list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
 	}
-	$DOWNLOAD_CATEGORY_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float-left' />" : "&nbsp;");
+	$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);
+	$DOWNLOAD_CATEGORY = $tp->toHTML($download_category_name,FALSE,"emotes_off, no_make_clickable");
 	$DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE);
 
 	if (!$DOWNLOAD_LIST_TABLE) {
@@ -300,215 +350,104 @@
 
 	require_once(FOOTERF);
 	exit;
-}
+}    // end of action=="list"
 
 
-//  -------------------------------------------------------------------------------------------------------------------------------------------------------------------
+//  ---------------- View Mode ---------------------------------------------------------------------------------------------------------------------------------------------------
 
 if ($action == "view") {
 
-	require_once(e_HANDLER."rate_class.php");
 	$gen = new convert;
-	$rater = new rater;
-	$sql2 = new db;
+
 	$highlight_search = FALSE;
 	if (isset($_POST['highlight_search'])) {
 		$highlight_search = TRUE;
 	}
 
-	$sql = new db;
-	if (!$sql->db_Select("download", "*", "download_id = {$id} AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.")")) {
-		require_once(HEADERF);
-		require_once(FOOTERF);
-		exit;
-	}
+    $query = "
+		SELECT d.*, dc.* FROM #download AS d
+		LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id
+		WHERE d.download_id = {$id} AND d.download_active > 0
+		AND d.download_visible IN (".USERCLASS_LIST.")
+		AND dc.download_category_class IN (".USERCLASS_LIST.")
+		LIMIT 1";
 
-    if (!$DOWNLOAD_VIEW_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");
-		}
-	}
-    if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
-
-	$gen = new convert;
-	$row = $sql->db_Fetch();
-	extract($row);
-	$comments_enabled = $row['download_comment'];
-	$subject = $download_name;
-	$sql2->db_Select("download_category", "*", "download_category_id='".intval($download_category)."' ");
-	$row = $sql2->db_Fetch();
-	extract($row);
-	$type = $download_category_name;
-	$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
-	define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name." / ".$download_name);
-
-	require_once(HEADERF);
-	if (!check_class($download_category_class)) {
+	if(!$sql -> db_Select_gen($query)){
+		require_once(HEADERF);
 		$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
 		require_once(FOOTERF);
 		exit;
 	}
 
-    $DOWNLOAD_ADMIN_EDIT = (ADMIN && getperms('6')) ? "<a href='".e_ADMIN."download.php?create.edit.$download_id' title='edit'><img src='".e_IMAGE."generic/lite/edit.png' alt='' style='padding:0px;border:0px' /></a>" : "";
-
-
-	$DOWNLOAD_REPORT_LINK = "<a href='".e_SELF."?report.{$download_id}'>".LAN_dl_45."</a>";
-	$DOWNLOAD_CATEGORY = $download_category_name;
-	$DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE);
-
-	$DOWNLOAD_VIEW_NAME = $download_name;
-
-	$DOWNLOAD_VIEW_NAME_LINKED = "<a href='".e_BASE."request.php?".$download_id."' title='".LAN_dl_46."'>{$download_name}</a>";
-
-	$DOWNLOAD_VIEW_AUTHOR_LAN = LAN_dl_24;
-	$DOWNLOAD_VIEW_AUTHOR = ($download_author ? $download_author : "&nbsp;");
-
-	if ($download_author_email) {
-		$DOWNLOAD_VIEW_AUTHOREMAIL_LAN = LAN_dl_30;
-		$DOWNLOAD_VIEW_AUTHOREMAIL = $tp -> toHTML($download_author_email, TRUE);
-	}
-
-	if ($download_author_website) {
-		$DOWNLOAD_VIEW_AUTHORWEBSITE_LAN = LAN_dl_31;
-		$DOWNLOAD_VIEW_AUTHORWEBSITE = $tp -> toHTML($download_author_website, TRUE);
-	}
-
-	$DOWNLOAD_VIEW_DESCRIPTION_LAN = LAN_dl_7;
-	$DOWNLOAD_VIEW_DESCRIPTION = $tp->toHTML(($download_description ? $download_description : "&nbsp;"), TRUE);
+	$dl = $sql -> db_Fetch();
 
-	$DOWNLOAD_VIEW_DATE_LAN = LAN_dl_22;
-	$DOWNLOAD_VIEW_DATE_SHORT = $gen->convert_date($download_datestamp, "short");
-	$DOWNLOAD_VIEW_DATE_LONG = $gen->convert_date($download_datestamp, "long");
-
-	$DOWNLOAD_VIEW_IMAGE_LAN = LAN_dl_11;
-
-
-	if ($download_thumb) {
-		$DOWNLOAD_VIEW_IMAGE = ($download_image ? "<a href='".e_BASE."request.php?download.".$download_id."'><img src='".e_FILE."downloadthumbs/".$download_thumb."' alt='' style='".DL_IMAGESTYLE."' /></a>" : "<img src='".e_FILE."downloadthumbs/".$download_thumb."' alt='' style='".DL_IMAGESTYLE."' />");
-	}
-	else if($download_image) {
-		$DOWNLOAD_VIEW_IMAGE = "<a href='".e_BASE."request.php?download.".$download_id."'>".LAN_dl_40."</a>";
-	}
+	if (!isset($DOWNLOAD_VIEW_TABLE) && is_readable(THEME."download_template.php"))
+	{
+		include_once(THEME."download_template.php");
+ 	}
 	else
 	{
-		$DOWNLOAD_VIEW_IMAGE = LAN_dl_75;
+        include_once(e_THEME."templates/download_template.php");
 	}
 
-	$DOWNLOAD_VIEW_IMAGEFULL = ($download_image) ? "<img src='".e_FILE."downloadimages/{$download_image}' alt='' style='".DL_IMAGESTYLE."' />" : "";
-
-	if ($pref['agree_flag'] == 1) {
-		$dnld_link = "<a href='request.php?{$download_id}' onclick= \"return confirm('{$agreetext}');\">";
-	} else {
-		$dnld_link = "<a href='request.php?{$download_id}'>";
-	}
-    $DOWNLOAD_VIEW_ID = $download_id;
-	$DOWNLOAD_VIEW_FILESIZE_LAN = LAN_dl_10;
-	$DOWNLOAD_VIEW_FILESIZE = parsesize($download_filesize);
-	$DOWNLOAD_VIEW_REQUESTED_LAN = LAN_dl_18;
-	$DOWNLOAD_VIEW_REQUESTED = $download_requested;
-	$DOWNLOAD_VIEW_LINK_LAN = LAN_dl_32;
-
-	if($download_mirror)
-	{
-		if($download_mirror_type)
-		{
-			$DOWNLOAD_VIEW_LINK = "<a href='".e_SELF."?mirror.{$download_id}'>".LAN_dl_66."</a>";
-		}
-		else
-		{
-			$DOWNLOAD_VIEW_LINK = $dnld_link." <img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
-		}
-	}
-	else
+	if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
+    if(!isset($DL_VIEW_PAGETITLE))
 	{
-		$DOWNLOAD_VIEW_LINK = $dnld_link." <img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
+    	$DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
 	}
 
+    $DL_TITLE = $tp->parseTemplate($DL_VIEW_PAGETITLE, TRUE, $download_shortcodes);
 
-	$DOWNLOAD_VIEW_RATING_LAN = LAN_dl_12;
-	$DOWNLOAD_VIEW_RATING = "
-		<table style='width:100%'>
-		<tr>
-		<td style='width:50%'>";
-
-	if ($ratearray = $rater->getrating("download", $download_id)) {
-		for($c = 1; $c <= $ratearray[1]; $c++) {
-			$DOWNLOAD_VIEW_RATING .= "<img src='".e_IMAGE."rate/".IMODE."/star.png' alt=''>";
-		}
-		if ($ratearray[2]) {
-			$DOWNLOAD_VIEW_RATING .= "<img src='".e_IMAGE."rate/".IMODE."/".$ratearray[2].".png'  alt=''>";
-		}
-		if ($ratearray[2] == "") {
-			$ratearray[2] = 0;
-		}
-		$DOWNLOAD_VIEW_RATING .= "&nbsp;".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]."&nbsp;";
-		$DOWNLOAD_VIEW_RATING .= ($ratearray[0] == 1 ? LAN_dl_43 : LAN_dl_44);
-	} else {
-		$DOWNLOAD_VIEW_RATING .= LAN_dl_13;
-	}
-	$DOWNLOAD_VIEW_RATING .= "</td><td style='width:50%; text-align:right'>";
-
-	if (!$rater->checkrated("download", $download_id) && USER) {
-		$DOWNLOAD_VIEW_RATING .= $rater->rateselect("&nbsp;&nbsp;&nbsp;&nbsp; <b>".LAN_dl_14, "download", $download_id)."</b>";
-	}
-	else if(!USER) {
-		$DOWNLOAD_VIEW_RATING .= "&nbsp;";
-	} else {
-		$DOWNLOAD_VIEW_RATING .= LAN_dl_15;
-	}
-	$DOWNLOAD_VIEW_RATING .= "</td></tr></table>";
+	define("e_PAGETITLE", $DL_TITLE);
 
-	$download_view_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_VIEW_TABLE_START);
-	$download_view_table_string = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_VIEW_TABLE);
-	$download_view_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_VIEW_TABLE_END);
-	$text .= $download_view_table_start.$download_view_table_string.$download_view_table_end;
+	require_once(HEADERF);
+	$DL_TEMPLATE = $DOWNLOAD_VIEW_TABLE_START.$DOWNLOAD_VIEW_TABLE.$DOWNLOAD_VIEW_TABLE_END;
+	$text = $tp->parseTemplate($DL_TEMPLATE, TRUE, $download_shortcodes);
 
-	$dl_id = intval($download_id);
-	if ($sql->db_Select("download", "*", "download_category='".intval($download_category_id)."' AND download_id < {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC")) {
-		$row = $sql->db_Fetch();
-		 extract($row);
-		$prev = "<a href='".e_SELF."?view.{$download_id}'>&lt;&lt; ".LAN_dl_33." [{$download_name}]</a>\n";
-	} else {
-		$prev = "&nbsp;";
-	}
-	if ($sql->db_Select("download", "*", "download_category='".intval($download_category_id)."' AND download_id > {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC")) {
-		$row = $sql->db_Fetch();
-		 extract($row);
-		$next = "<a href='".e_SELF."?view.{$download_id}'>[{$download_name}] ".LAN_dl_34." &gt;&gt;</a>\n";
-	} else {
-		$next = "&nbsp;";
+	if(!isset($DL_VIEW_CAPTION))
+	{
+		$DL_VIEW_CAPTION = "{DOWNLOAD_VIEW_CAPTION}";
 	}
 
-	if ($prev || $next) {
-		$text .= "
+	if(!isset($DL_VIEW_NEXTPREV))
+	{
+    	$DL_VIEW_NEXTPREV = "
 		<div style='text-align:center'>
-			<table style='width:95%'>
+			<table style='".USER_WIDTH."'>
 			<tr>
-			<td style='width:40%;'>{$prev}</td>
-			<td style='width:20%; text-align: center;'><a href='".e_SELF."?list.{$download_category}'>".LAN_dl_35."</a></td>
-			<td style='width:40%; text-align: right;'>{$next}</td>
+			<td style='width:40%;'>{DOWNLOAD_VIEW_PREV}</td>
+			<td style='width:20%; text-align: center;'>{DOWNLOAD_BACK_TO_LIST}</td>
+			<td style='width:40%; text-align: right;'>{DOWNLOAD_VIEW_NEXT}</td>
 			</tr>
 			</table>
 			</div>
 			";
-	}
+    }
+		// ------- Next/Prev -----------
+    $text .= $tp->parseTemplate($DL_VIEW_NEXTPREV,TRUE,$download_shortcodes);
+	$caption = $tp->parseTemplate($DL_VIEW_CAPTION,TRUE,$download_shortcodes);
 
 	if($DOWNLOAD_VIEW_TABLE_RENDERPLAIN) {
 		echo $text;
 	} else {
-		$ns->tablerender($type, $text);
+
+		$ns->tablerender($caption, $text);
 	}
+
 	unset($text);
-	if ($comments_enabled) {
-		$cobj->compose_comment("download", "comment", $id, $width, $subject, $showrate=FALSE);
+
+	if ($dl['download_comment']) {
+		$cobj->compose_comment("download", "comment", $id, $width,$dl['download_name'], $showrate=FALSE);
 	}
 
 	require_once(FOOTERF);
+	exit;
+
 }
 
-if ($action == "report") {
+//  ---------------- Report Broken Link Mode ---------------------------------------------------------------------------------------------------------------------------------------------------
+
+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);
@@ -523,7 +462,7 @@
 		$download_name = $tp -> toDB($download_name);
 		$user = USER ? USERNAME : LAN_dl_52;
 
-		if ($pref['download_email']) {
+		if ($pref['download_email']) {    // this needs to be moved into the NOTIFY, with an event.
 			require_once(e_HANDLER."mail.php");
 			$subject = LAN_dl_60." ".SITENAME;
 			$report = LAN_dl_58." ".SITENAME.":\n".(substr(SITEURL, -1) == "/" ? SITEURL : SITEURL."/")."download.php?view.".$download_id."\n
@@ -544,7 +483,7 @@
 		require_once(HEADERF);
 
 		$text = "<form action='".e_SELF."?report.{$download_id}' method='post'>
-		<table style='width:100%'>
+		<table style='".USER_WIDTH."'>
 			<tr>
 			<td  style='width:50%' >
 			".LAN_dl_32.": ".$download_name."<br />
@@ -564,7 +503,7 @@
 			</tr>
 			<tr>
 			<td colspan='2' style='text-align:center;'><br />
-			<input class='button' type='submit' name='report_download' value='".LAN_dl_56."' />
+			<input class='button' type='submit' name='report_download' value=\"".LAN_dl_45."\" />
 			</td>
 			</tr>
 			</table>";
@@ -574,6 +513,9 @@
 	exit;
 }
 
+//  ---------------- Mirror Mode ---------------------------------------------------------------------------------------------------------------------------------------------------
+
+
 if($action == "mirror")
 {
 	require_once(HEADERF);
@@ -695,8 +637,8 @@
 		{
 			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);
+		$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";
 	}
@@ -726,17 +668,18 @@
 
 	if(!$row['d_count'] && !$row['d_subcount'])
 	{
-		$download_icon = "<img src='".e_IMAGE."icons/{$download_category_icon_empty}' alt='' style='float-left' />";
+		$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_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_NAME = ($row['d_count'] ? "<a href='".e_SELF."?list.".$row['download_category_id']."'>".$tp->toHTML($row['download_category_name'])."</a>" : $tp->toHTML($row['download_category_name']));
-	$DOWNLOAD_CAT_SUB_NAME_LINKED = "<a href='".e_SELF."?list.".$row['download_category_id']."'>".$tp->toHTML($row['download_category_name'])."</a>";
+	$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']));
@@ -745,9 +688,8 @@
 	// check for subsub cats ...
 	if($subList != FALSE)
 	{
-		foreach($subList 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)
 			{
@@ -756,11 +698,11 @@
 
 			if(!$row['d_count'] && !$row['d_subcount'])
 			{
-				$sub_download_icon = "<img src='".e_IMAGE."icons/{$sub_download_category_icon_empty}' alt='' style='float-left' />";
+				$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' />";
+				$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;");
@@ -770,12 +712,12 @@
 			$DOWNLOAD_CAT_SUBSUB_DOWNLOADED = intval($subrow['d_requests']);
 
 			if(USER && $subrow['d_last'] > USERLV)	{
-				$new = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
+				$subsub_new = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
 			}else {
-				$new = "";
+				$subsub_new = "";
 			}
-			$DOWNLOAD_CAT_SUBSUB_NEW_ICON = $new;
-			$DOWNLOAD_CAT_SUBSUB_NAME = $new.($subrow['d_count'] ? "<a href='".e_SELF."?list.".$subrow['download_category_id']."'>".$tp->toHTML($subrow['download_category_name'])."</a>" : $tp->toHTML($subrow['download_category_name']));
+			$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);
 		}
 	}
@@ -794,4 +736,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/admin.php 0.7.7/e107_admin/admin.php
--- 0.7.5/e107_admin/admin.php	2006-02-17 17:35:38.000000000 -0600
+++ 0.7.7/e107_admin/admin.php	2006-11-16 04:41:46.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/admin.php,v $
-|     $Revision: 1.31 $
-|     $Date: 2006/02/17 23:35:38 $
-|     $Author: lisa_ $
+|     $Revision: 1.36 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -21,29 +21,62 @@
 require_once('auth.php');
 require_once(e_HANDLER.'admin_handler.php');
 
+// --- check for htmlarea.
 if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea')) {
 	$text = ADLAN_ERR_2."<br /><br />
 	<div style='text-align:center'>".$HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/</div>";
 	$ns -> tablerender(ADLAN_ERR_1, $text);
 }
 
+// check for old modules.
+if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons"){
+
+	$mods=explode(",", $pref['modules']);
+	$thef = "e_module.php";
+	foreach ($mods as $mod)
+	{
+		if (is_readable(e_PLUGIN."{$mod}/module.php"))
+		{
+			$mod_found[] = e_PLUGIN."{$mod}/module.php";
+		}
+	}
+
+	if($mod_found)
+	{
+    	$text = ADLAN_ERR_5." <b>".$thef."</b>:<br /><br /><ul>";
+		foreach($mod_found as $val){
+			$text .= "<li>".str_replace("../","",$val)."</li>\n";
+		}
+		$text .="</ul><br />
+		<form method='post' action='".e_ADMIN."db.php' id='upd'>
+		<a href='#' onclick=\"document.getElementById('upd').submit()\">".ADLAN_ERR_6."</a>
+		<input type='hidden' name='plugin_scan' value='1' />
+		</form>";
+		$ns -> tablerender(ADLAN_ERR_4,$text);
+	}
+}
+
+// check for file-types;
 if (is_readable(e_ADMIN.'filetypes.php')) {
-	$a_types = trim(file_get_contents(e_ADMIN.'filetypes.php'));
+	$a_types = strtolower(trim(file_get_contents(e_ADMIN.'filetypes.php')));
 } else {
 	$a_types = 'zip, gz, jpg, png, gif';
 }
+
 $a_types = explode(',', $a_types);
 foreach ($a_types as $f_type) {
 	$allowed_types[] = '.'.trim(str_replace('.', '', $f_type));
 }
+
+// avatar check.
 $public = array(e_FILE.'public', e_FILE.'public/avatars');
 foreach ($public as $dir) {
 	if (is_dir($dir)) {
 		if ($dh = opendir($dir)) {
 			while (($file = readdir($dh)) !== false) {
-				if (is_dir($dir."/".$file) == FALSE && $file != '.' && $file != '..' && $file != '/' && $file != 'CVS' && $file != 'avatars' && $file != 'Thumbs.db') {
+				if (is_dir($dir."/".$file) == FALSE && $file != '.' && $file != '..' && $file != '/' && $file != 'CVS' && $file != 'avatars' && $file != 'Thumbs.db' && $file !=".htaccess" && $file !="php.ini") {
 					$fext = substr(strrchr($file, "."), 0);
-					if (!in_array($fext, $allowed_types)) {
+					if (!in_array(strtolower($fext), $allowed_types) ) {
 						if ($file == 'index.html' || $file == "null.txt") {
 							if (filesize($dir.'/'.$file)) {
 								$potential[] = str_replace('../', '', $dir).'/'.$file;
@@ -127,7 +160,7 @@
 	define("ADLINK_COLS",5);
 }
 function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE) {
-	global $td;
+	global $td,$tp;
 	$text = '';
 	if (getperms($perms)) {
 		if ($mode == 'adminb') {
@@ -145,15 +178,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." ".$title."</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>".$title."</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>".$title."</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++;
 		}
@@ -230,4 +263,4 @@
 
 require_once("footer.php");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/admin_log.php 0.7.7/e107_admin/admin_log.php
--- 0.7.5/e107_admin/admin_log.php	2006-04-13 10:07:10.000000000 -0500
+++ 0.7.7/e107_admin/admin_log.php	2006-10-25 16:13:28.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/admin_log.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/04/13 15:07:10 $
+|     $Revision: 1.8 $
+|     $Date: 2006/10/25 21:13:28 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -39,16 +39,14 @@
 	$text .= "<div style='text-align:center'><br />".$tp->parseTemplate("{NEXTPREV={$parms}}")."<br /><br /></div>";
 $text .= "<div id='admin_log'><table>\n";
 
-//
-
 $text .= "
   <tr>
     <td class='fcaption'>&nbsp;</td>
-    <td class='fcaption' style='font-weight: bold;'>Date</td>
-    <td class='fcaption' style='font-weight: bold;'>Title</td>
-    <td class='fcaption' style='font-weight: bold;'>Description</td>
-    <td class='fcaption' style='font-weight: bold;'>User IP</td>
-    <td class='fcaption' style='font-weight: bold;'>User ID</td>
+    <td class='fcaption' style='font-weight: bold;'>".LAN_ADMINLOG_1."</td>
+    <td class='fcaption' style='font-weight: bold;'>".LAN_ADMINLOG_2."</td>
+    <td class='fcaption' style='font-weight: bold;'>".LAN_ADMINLOG_3."</td>
+    <td class='fcaption' style='font-weight: bold;'>".LAN_ADMINLOG_4."</td>
+    <td class='fcaption' style='font-weight: bold;'>".LAN_ADMINLOG_5."</td>
   </tr>\n";
 
 while ($row = $sql -> db_Fetch()) {
@@ -57,8 +55,8 @@
 	$text .= "  <tr>\n";
 	$text .= "    <td style='width: 16px;'>{$image}</td>\n";
 	$text .= "    <td>{$datestamp}</td>\n";
-	$text .= "    <td>{$row['dblog_query']}</td>\n";
-	$text .= "    <td>{$row['dblog_remarks']}</td>\n";
+	$text .= "    <td>".$tp->toHtml($row['dblog_title'],FALSE,"defs")."</td>\n";
+	$text .= "    <td>".$tp->toHtml($row['dblog_remarks'],FALSE,"defs")."</td>\n";
 	$text .= "    <td>{$row['dblog_ip']}</td>\n";
 	$text .= ($row['user_name']) ? "    <td><a href='".e_BASE."user.php?id.{$row['dblog_user_id']}'>{$row['user_name']}</a></td>\n" : "    <td>{$row['dblog_user_id']}</td>\n";
 	$text .= "  </tr>\n";
@@ -68,25 +66,28 @@
 
 	$text .= "<div style='text-align:center'><br />".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
 
-$ns->tablerender("Admin Log", $text);
+$ns->tablerender(LAN_ADMINLOG_0, $text);
 require_once("footer.php");
 
 function get_log_img($log_type) {
 	switch ($log_type) {
 		case E_LOG_INFORMATIVE:
-			return "<img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='Informative Icon' title='Informative Message' />";
+			return "<img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='".LAN_ADMINLOG_6."' title='".LAN_ADMINLOG_7."' />";
 		break;
 		case E_LOG_NOTICE:
-			return "<img src='".e_IMAGE_ABS."admin_images/notice_16.png' alt='Notice Icon' title='Notice Message' />";
+			return "<img src='".e_IMAGE_ABS."admin_images/notice_16.png' alt='".LAN_ADMINLOG_8."' title='".LAN_ADMINLOG_9."' />";
 		break;
 		case E_LOG_WARNING:
-			return "<img src='".e_IMAGE_ABS."admin_images/blocked_16.png' alt='Warning Icon' title='Warning Message' />";
+			return "<img src='".e_IMAGE_ABS."admin_images/blocked.png' alt='".LAN_ADMINLOG_10."' title='".LAN_ADMINLOG_11."' style='width:16p;height:16px'  />";
 		break;
 		case E_LOG_FATAL:
-			return "<img src='".e_IMAGE_ABS."admin_images/nopreview_16.png' alt='Fatal Icon' title='Fatal Error Message' />";
+			return "<img src='".e_IMAGE_ABS."admin_images/nopreview.png' alt='".LAN_ADMINLOG_12."' title='".LAN_ADMINLOG_13."' />";
 		break;
+		case E_LOG_PLUGIN;
+			return "<img src='".e_IMAGE_ABS."admin_images/plugins_16.png' alt='".LAN_ADMINLOG_6."' title='".LAN_ADMINLOG_6."' />";
+        break;
 	}
-		return $log_type;
+	return $log_type;
 }
 
 function headerjs() {
@@ -106,4 +107,4 @@
 <?php
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/administrator.php 0.7.7/e107_admin/administrator.php
--- 0.7.5/e107_admin/administrator.php	2006-02-16 13:23:06.000000000 -0600
+++ 0.7.7/e107_admin/administrator.php	2006-11-10 09:59:14.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/administrator.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2006/02/16 19:23:06 $
-|     $Author: whoisrich $
+|     $Revision: 1.33 $
+|     $Date: 2006/11/10 15:59:14 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -84,7 +84,7 @@
 	$sql->db_Select("user", "*", "user_id= ".$delid[0]);
 	$row = $sql->db_Fetch();
 
-	if ($row['user_perms'] == "0")
+	if ($row['user_id'] == 1)
 	{
 		$text = "<div style='text-align:center'>".$row['user_name']." ".ADMSLAN_6."
 		<br /><br />
@@ -125,7 +125,7 @@
 
 		$text .= "<tr>
 		<td style='width:5%' class='forumheader3'>".$row['user_id']."</td>
-		<td style='width:20%' class='forumheader3'>".$row['user_name']."</td>
+		<td style='width:20%' class='forumheader3'><a href='".e_BASE."user.php?id.".$row['user_id']."'>".$row['user_name']."</a></td>
 		<td style='width:65%' class='forumheader3'>";
 
 		$permtxt = "";
@@ -181,43 +181,43 @@
 	<td style='width:25%;vertical-align:top' class='forumheader3'>".ADMSLAN_18.": <br /></td>
 	<td style='width:75%' class='forumheader3'>";
 
-	$text .= checkb("1", $a_perms).ADMSLAN_19."<br />";
-	$text .= checkb("2", $a_perms).ADMSLAN_20."<br />";
-	$text .= checkb("3", $a_perms).ADMSLAN_21."<br />";
-	$text .= checkb("4", $a_perms).ADMSLAN_22."<br />"; // Moderate users/bans etc
-	$text .= checkb("5", $a_perms).ADMSLAN_23."<br />"; // create/edit custom pages/menus
-	$text .= checkb("Q", $a_perms).ADMSLAN_24."<br />"; // Manage download categories
-	$text .= checkb("6", $a_perms).ADMSLAN_25."<br />"; // Upload /manage files
-	$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 />";
-	$text .= checkb("8", $a_perms).ADMSLAN_27."<br />";
-	$text .= checkb("C", $a_perms).ADMSLAN_64."<br />"; // Clear Cache - Previously moderate chatbox
-	$text .= checkb("9", $a_perms).ADMSLAN_28."<br />";
-	$text .= checkb("W", $a_perms).ADMSLAN_65."<br /><br />";
-
-	$text .= checkb("D", $a_perms).ADMSLAN_29."<br />";
-	$text .= checkb("E", $a_perms).ADMSLAN_30."<br />";
-	$text .= checkb("F", $a_perms).ADMSLAN_31."<br />";
-	$text .= checkb("G", $a_perms).ADMSLAN_32."<br />";
-	$text .= checkb("S", $a_perms).ADMSLAN_33."<br />";
-	$text .= checkb("T", $a_perms).ADMSLAN_34."<br />";
-	$text .= checkb("V", $a_perms).ADMSLAN_35."<br />"; // Configure public file uploads
-	$text .= checkb("X", $a_perms).ADMSLAN_66."<br />";
-//	$text .= checkb("A", $a_perms).ADMSLAN_36."<br />"; // Moderate forums - NOW PLUGIN
-	$text .= checkb("B", $a_perms).ADMSLAN_37."<br />";
-	$text .= checkb("H", $a_perms).ADMSLAN_39."<br />";
-	$text .= checkb("I", $a_perms).ADMSLAN_40."<br />";
-//	$text .= checkb("J", $a_perms).ADMSLAN_41."<br />"; // Post articles   - NOW PLUGIN
-//	$text .= checkb("K", $a_perms).ADMSLAN_42."<br />"; // Post reviews    - NOW PLUGIN
-	$text .= checkb("L", $a_perms).ADMSLAN_43."<br />";
-	$text .= checkb("R", $a_perms).ADMSLAN_44."<br />";
-	$text .= checkb("U", $a_perms).ADMSLAN_45."<br />";
-	$text .= checkb("M", $a_perms).ADMSLAN_46."<br />";
-	$text .= checkb("N", $a_perms).ADMSLAN_47."<br /><br />";
+	$text .= checkb("1", $a_perms).ADMSLAN_19."<br />";			// Alter site preferences
+	$text .= checkb("2", $a_perms).ADMSLAN_20."<br />";			// Alter Menus
+	$text .= checkb("3", $a_perms).ADMSLAN_21."<br />";			// Modify administrator permissions
+	$text .= checkb("4", $a_perms).ADMSLAN_22."<br />";			// Moderate users/bans etc
+	$text .= checkb("5", $a_perms).ADMSLAN_23."<br />";			// create/edit custom pages/menus
+	$text .= checkb("Q", $a_perms).ADMSLAN_24."<br />";			// Manage download categories
+	$text .= checkb("6", $a_perms).ADMSLAN_25."<br />";			// Upload /manage files
+	$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("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
+
+	$text .= checkb("D", $a_perms).ADMSLAN_29."<br />";			// Manage banners
+	$text .= checkb("E", $a_perms).ADMSLAN_30."<br />";			// Configure news feed headlines
+	$text .= checkb("F", $a_perms).ADMSLAN_31."<br />";			// Configure emoticons
+	$text .= checkb("G", $a_perms).ADMSLAN_32."<br />";			// Configure front page content
+	$text .= checkb("S", $a_perms).ADMSLAN_33."<br />";			// Configure log/stats
+	$text .= checkb("T", $a_perms).ADMSLAN_34."<br />";			// Configure meta tags
+	$text .= checkb("V", $a_perms).ADMSLAN_35."<br />";			// Configure public file uploads
+	$text .= checkb("X", $a_perms).ADMSLAN_66."<br />";			// Configure Search
+	$text .= checkb("A", $a_perms).ADMSLAN_36."<br />";			// Configure Image Settings (Previously Moderate forums - NOW PLUGIN)
+	$text .= checkb("B", $a_perms).ADMSLAN_37."<br />";			// Moderate comments
+	$text .= checkb("H", $a_perms).ADMSLAN_39."<br />";			// Post news
+	$text .= checkb("I", $a_perms).ADMSLAN_40."<br />";			// Post links
+//	$text .= checkb("J", $a_perms).ADMSLAN_41."<br />";					// Post articles   - NOW PLUGIN
+//	$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("M", $a_perms).ADMSLAN_46."<br />";			// Welcome message
+	$text .= checkb("N", $a_perms).ADMSLAN_47."<br /><br />";	// Moderate submitted news
 
 	$text .= "<br /><div class='fcaption'>".ADLAN_CL_7."</div><br />";
-	$text .= checkb("Z", $a_perms).ADMSLAN_62."<br /><br />";
+	$text .= checkb("Z", $a_perms).ADMSLAN_62."<br /><br />";	// Plugin Manager
 
 	$sql->db_Select("plugin", "*", "plugin_installflag='1'");
 	while ($row = $sql->db_Fetch())
@@ -308,12 +308,12 @@
     	$pt["1"] = ADMSLAN_19;
 		$pt["2"] = ADMSLAN_20;
 		$pt["3"] = ADMSLAN_21;
-		$pt["4"] = ADMSLAN_22;// Moderate users/bans etc
-		$pt["5"] = ADMSLAN_23;// create/edit custom pages/menus
-		$pt["Q"] = ADMSLAN_24;// Manage download categories
-		$pt["6"] = ADMSLAN_25; //Upload /manage files
-		$pt["Y"] = ADMSLAN_67;// file inspector
-		$pt["O"] = ADMSLAN_68;// notify
+		$pt["4"] = ADMSLAN_22;	// Moderate users/bans etc
+		$pt["5"] = ADMSLAN_23;	// create/edit custom pages/menus
+		$pt["Q"] = ADMSLAN_24;	// Manage download categories
+		$pt["6"] = ADMSLAN_25;	// Upload /manage files
+		$pt["Y"] = ADMSLAN_67;	// file inspector
+		$pt["O"] = ADMSLAN_68;	// notify
 		$pt["7"] = ADMSLAN_26;
 		$pt["8"] = ADMSLAN_27;
 		$pt["C"] = ADMSLAN_64;
@@ -327,6 +327,7 @@
 		$pt["T"] = ADMSLAN_34;
 		$pt["V"] = ADMSLAN_35;
 		$pt["X"] = ADMSLAN_66;
+		$pt["A"] = ADMSLAN_36;	// Configure Image Settings
 		$pt["B"] = ADMSLAN_37;
 		$pt["H"] = ADMSLAN_39;
 		$pt["I"] = ADMSLAN_40;
@@ -336,6 +337,7 @@
 		$pt["M"] = ADMSLAN_46;
 		$pt["N"] = ADMSLAN_47;
 		$pt["Z"] = ADMSLAN_62;
+		
 
   //		foreach($lanlist as $lan){
   //      	$pt[$lan] = $lan;
@@ -372,4 +374,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/auth.php 0.7.7/e107_admin/auth.php
--- 0.7.5/e107_admin/auth.php	2006-02-02 00:37:52.000000000 -0600
+++ 0.7.7/e107_admin/auth.php	2006-11-24 23:34:28.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/auth.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/02/02 06:37:52 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.14 $
+|     $Date: 2006/11/25 05:34:28 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -55,13 +55,13 @@
 			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['tracktype'] == "session") {
+			if ($pref['user_tracking'] == "session") {
 				$_SESSION[$pref['cookie_name']] = $cookieval;
 			} else {
 				cookie($pref['cookie_name'], $cookieval, (time()+3600 * 24 * 30));
@@ -69,10 +69,10 @@
 			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();
@@ -80,11 +80,11 @@
 		exit;
 	}
 }
-	
+
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 class auth
 {
-	 
+
 	function authform()
 	{
 		/*
@@ -94,9 +94,9 @@
 		# - 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'>
@@ -117,7 +117,7 @@
 			<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>
+			"<br /><input class='tbox' type='text' name='code_verify' size='15' maxlength='20' /></td>
 			</tr>
 			";
 		}
@@ -125,18 +125,18 @@
 		$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)
 	{
 		/*
@@ -170,6 +170,6 @@
 		return array("authfail");
 	}
 }
-	
+
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/banlist.php 0.7.7/e107_admin/banlist.php
--- 0.7.5/e107_admin/banlist.php	2006-04-07 10:24:12.000000000 -0500
+++ 0.7.7/e107_admin/banlist.php	2006-11-17 21:09:40.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.17 $
-|     $Date: 2006/04/07 15:24:12 $
-|     $Author: sweetas $
+|     $Revision: 1.19 $
+|     $Date: 2006/11/18 03:09:40 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -64,13 +64,16 @@
 	}
 }
 
+$text = "";
 
-$text = "<div style='text-align:center'>
+
+
+$text .= "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>
 
 	<tr>
-	<td style='width:30%' class='forumheader3'>".BANLAN_5.": </td>
+	<td style='width:30%' class='forumheader3'>".BANLAN_5.": {$rdns_warn}</td>
 	<td style='width:70%' class='forumheader3'>
 	<input class='tbox' type='text' name='ban_ip' size='40' value='".$banlist_ip."' maxlength='200' />
 	</td>
@@ -93,6 +96,11 @@
 	</form>
 	</div>";
 
+if(!varsettrue($pref['enable_rdns']))
+{
+	$text .= "<div style='text-align:center'><br />".BANLAN_12."</div>";
+}
+
 $ns->tablerender(BANLAN_9, $text);
 
 if ($action != "edit") {
@@ -120,4 +128,4 @@
 }
 
 require_once("footer.php");
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/banner.php 0.7.7/e107_admin/banner.php
--- 0.7.5/e107_admin/banner.php	2005-12-05 13:28:57.000000000 -0600
+++ 0.7.7/e107_admin/banner.php	2006-10-24 08:34:38.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.26 $
-|     $Date: 2005/12/05 19:28:57 $
-|     $Author: sweetas $
+|     $Revision: 1.28 $
+|     $Date: 2006/10/24 13:34:38 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -42,16 +42,16 @@
 $images = $fl->get_files(e_IMAGE."banners/","",$reject);
 
 if (isset($_POST['update_menu'])) {
-	foreach($_POST as $k => $v) {
-		if (strpos($k, "banner_") === 0) {
-			$menu_pref[$k] = $v;
-		}
-	}
+
+	$menu_pref['banner_caption']	= $tp->toDB($_POST['banner_caption']);
+	$menu_pref['banner_amount']		= intval($_POST['banner_amount']);
+	$menu_pref['banner_rendertype']	= intval($_POST['banner_rendertype']);
 
 	if (isset($_POST['catid'])) {
 		$array_cat = explode("-", $_POST['catid']);
+		$cat='';
 		for($i = 0; $i < count($array_cat); $i++) {
-			$cat .= $array_cat[$i]."|";
+			$cat .= $tp->toDB($array_cat[$i])."|";
 		}
 		$cat = substr($cat, 0, -1);
 		$menu_pref['banner_campaign'] = $cat;
@@ -107,7 +107,7 @@
 		<form method='post' action='".e_SELF."'>
 		<input class='button' type='submit' name='cancel' value='".LAN_CANCEL."' />
 		<input class='button' type='submit' name='confirm' value='".LAN_CONFDELETE."' />
-		<input type='hidden' name='id' value='".$sub_action."'>
+		<input type='hidden' name='id' value='".$sub_action."' />
 		</form>
 		</div>";
 	$ns->tablerender(BNRLAN_5, $text);
@@ -509,7 +509,7 @@
 
 	$text .= "</select><br /><br />
 	<input class='button' type='button' value='".BANNER_MENU_L9."' onclick='removeMe();' />
-	<input type='hidden' name='catid' id='catid' value='".$catidvalues."'>
+	<input type='hidden' name='catid' id='catid' value='".$catidvalues."' />
 	</td>
 	</tr>
 	</table>
@@ -518,6 +518,13 @@
 	</tr>
 
 	<tr>
+	<td style='width:40%' class='forumheader3'>".BANNER_MENU_L19."</td>
+	<td style='width:60%' class='forumheader3'>
+	<input class='tbox' type='text' name='banner_amount' size='10' value='".$menu_pref['banner_amount']."' maxlength='2' />
+	</td>
+	</tr>
+
+	<tr>
 	<td style='width:40%' class='forumheader3'>".BANNER_MENU_L10."</td>
 	<td style='width:60%' class='forumheader3'>
 	<select class='tbox' id='banner_rendertype' name='banner_rendertype' size='1'>
diff -ruN 0.7.5/e107_admin/core_image.php 0.7.7/e107_admin/core_image.php
--- 0.7.5/e107_admin/core_image.php	2006-05-22 20:34:32.000000000 -0500
+++ 0.7.7/e107_admin/core_image.php	2006-11-29 20:17:51.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -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.38 $
-|     $Date: 2006/05/23 01:34:32 $
+|     $Revision: 1.43 $
+|     $Date: 2006/11/30 02:17:51 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -24,12 +24,12 @@
   array (
     'includes' => 
     array (
-      'beginner.php' => '6237124ca4871bfa632a791408bc7669',
-      'cascade.php' => '049e8b646b776c045a0a7df1270c33a3',
-      'categories.php' => '47e63f51c6308780137f0e6219e6f807',
-      'classis.php' => '3773377b0928c8034df8ab3b9eca4a30',
-      'combo.php' => '9596e05f1431e5e04726eeb5e36576ba',
-      'compact.php' => 'bf551b1b617f93bc9aa037d634621230',
+      'beginner.php' => '399d299a1ad1dece1776fa3e477fdd31',
+      'cascade.php' => 'f02f4e7c20f7590a19681f0324307800',
+      'categories.php' => 'a99113a6cabb51bc0bcded28892a0957',
+      'classis.php' => '5648c4272072a1f3bbf2665329d480bd',
+      'combo.php' => '416828015462d3e305c002a3798ad76e',
+      'compact.php' => '2c5c2b4d66971f1b0aaa0ac8e81097e7',
     ),
     'sql' => 
     array (
@@ -37,22 +37,22 @@
       array (
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       ),
-      'core_pg.php' => 'c1c8245091973146cc9ac83195d0ec71',
-      'core_sql.php' => '6dd3714984b97a699be4aeee5ac8504c',
+      'core_pg.php' => 'af38d186d0a03cde899b4e0939b6ee6c',
+      'core_sql.php' => 'cc00538c4f8b87a107ac6d2dacbaf9b2',
       'extended_country.php' => '0ef441f85dc0628bbf00c91e1163f114',
     ),
     'ad_links.php' => 'd4d181f5337ba8bc939828d9068c8d43',
-    'admin.php' => '7d7187d98e61a3d4e16628905d6d43cb',
+    'admin.php' => '3300cf551a1fa5ecc473e2f355c97ea7',
     'admin_classis.php' => 'ed861d18477db9ce0bc3620a69443723',
     'admin_combo.php' => '8958300a2a42fd2aa68977d566c1edb9',
     'admin_etalkers.php' => '9d684ef56c54bbf919e3346927cf4509',
-    'admin_log.php' => 'd9cc442f94fbf239ec8d9c937b710f9a',
+    'admin_log.php' => '38c702ad61600d3c48851ee1dc868dfd',
     'adminb.php' => '1e31b2ad3907c7cba29dca04342cee1d',
-    'administrator.php' => 'dd5eac7dd3802ff4cf78cc4aa9480603',
+    'administrator.php' => 'bd8de4773ebe49ab0884ba3d1c19568c',
     'article.php' => '7b21dc8ef4bc68ceb9ecf4d1c519a645',
-    'auth.php' => 'bb6e624d16f5f25a206f144d40b10aeb',
-    'banlist.php' => '32450e4bece5aa5c4bb991fdb305d45b',
-    'banner.php' => '1dfcb396a17492639dc7583ee89eedec',
+    'auth.php' => '6bdf6b7895598b70c76e219069b930c6',
+    'banlist.php' => 'f858a52c69ad86e1ed66127434a12915',
+    'banner.php' => '3913e712c16227a49c5333b7f0e64489',
     'cache.php' => '62fc17d1f4c6db977c66642c5a76127a',
     'cascade.php' => '3d70a650778f09e6c85efd91b6ab5e4a',
     'categories.php' => 'cbbed37d26ab602700d46a0cb1955205',
@@ -61,52 +61,52 @@
     'comment.php' => '96f04e71003de6b6a6ea3a0f2ede285d',
     'compact.php' => '20bccea2ef81cc86a86782fa4841e45f',
     'content.php' => 'bf2239404990afed185913002429e682',
-    'core_image.php' => '9100de711965cbeaecc5d17057de50ea',
-    'cpage.php' => 'b7a5d16b5ae822cd5284b3ff2398a50b',
-    'credits.php' => '26dc083bbb07e43cedd10d6dbe201120',
-    'db.php' => '3eb086e293e4edceca7bf3e14cb34d1f',
-    'db_verify.php' => 'fd792b49b728528d06f33873ca785738',
+    'core_image.php' => 'e989fac71ee65a3db9047565d6f34b48',
+    'cpage.php' => '57ab65c7fa55e1dcfc5f3a9a94bc2528',
+    'credits.php' => '322fe1169cd992db88624e84d7f51288',
+    'db.php' => 'a48795e26302b874c1fe397689f01d9f',
+    'db_verify.php' => 'e14434e165ac07b4cb630809dd4b3150',
     'docs.php' => 'e5ebdd8fd30362636cfe1a3878b3fb18',
-    'download.php' => 'af89cfebf921ec772a01b3c1182bf2c0',
+    'download.php' => '636316389ea0a9dd8d6dc7b9d2044c81',
     'e107_update.php' => 'c23624862e7dc50fab29aa1890c7872a',
-    'emoticon.php' => 'b3b5fd7aea2941dc0992ad0013ec2587',
+    'emoticon.php' => '4139a4c00680ed7b94bb2848bb9c7cec',
     'fileinspector.php' => '7430c97538e5d63ced422b4d552344ae',
-    'filemanager.php' => 'f8e0f4d49bc2ed01a30f752e79b930ce',
+    'filemanager.php' => 'af7dfc6ef908953d0208cd18ba5d444d',
     'filetypes_.php' => 'f951037335e993337792606cc1475cec',
-    'fla.php' => '65bb3e10db912f98e9ecde7252de9756',
-    'footer.php' => '6315a3f911ed578e9de1c521a31e9a1f',
-    'frontpage.php' => '2b080220f002cf77ef8d8a717fe951dd',
-    'header.php' => '6bc4f8f900e948de9c918649577d3e25',
-    'image.php' => '42d8b58fb59f4cd78a890c1b2cf7a1df',
+    'fla.php' => 'c44c289dcdbe2bcf53305103275ce899',
+    'footer.php' => '0cc1b838f19770de51917dd614b7b246',
+    'frontpage.php' => '78acc7a2d9f879636291a2b45d06c80a',
+    'header.php' => 'a61922daac7e562e86251bd9a67877f3',
+    'image.php' => 'fc510663610cbf4b53eec2f9948999b6',
     'index.php' => 'e4e143ee2d34d4ce1f17b3f043cc6cd6',
-    'lancheck.php' => '6b61ffa464ee583279bbb841d3e30ebb',
-    'language.php' => 'a25cdaae23382219ea831c0c3986d1b3',
-    'links.php' => '2d56e5d43c8a53efc82a214686f80b68',
-    'mailout.php' => '04141d87eb6cc737a2bf095e12187e45',
-    'menus.php' => '342cd18b9665a439d0640a9e7ba19097',
-    'message.php' => 'c3478de0e58f133518e8fde41ce2b9ea',
-    'meta.php' => '68623037bf4a497856ff8dc01ac50899',
+    'lancheck.php' => '8b8fea89e7d9a0dc3d1931971a9b4939',
+    'language.php' => '67569d7ab4a4e25984c19353a143e31c',
+    'links.php' => '39c7ab07f379c047fe20f0415735b474',
+    'mailout.php' => '9779b609afed1f62c16bf7694f1a68e5',
+    'menus.php' => '1abba8d34311ca3795d37d4526a41042',
+    'message.php' => 'a598b5e493298500d81b815f1455280b',
+    'meta.php' => '346305add7d4a15981103cd42ae02d15',
     'modcomment.php' => 'b8787d8ebce9cc813ccaa416ec3a923c',
-    'newspost.php' => '977d40aeedee43a6b4e28f1838f4769f',
-    'notify.php' => '2740b52482cb339158292d86c1ba1dd6',
+    'newspost.php' => '6aba9db62369e328f78f623644ea04a8',
+    'notify.php' => 'a988fd7416b4595e72975b22ccc6362b',
     'phpinfo.php' => '994ea857810fe5f47ac8612f570aadb1',
-    'plugin.php' => '3925332ccc72475659a884217a4359d0',
-    'prefs.php' => '30ba46f22edb990162a4169a670c07e9',
+    'plugin.php' => '3714121cbb762b83f29f28a9fa1d094f',
+    'prefs.php' => 'e9ac6b838ef5368d1861481e629c8c08',
     'review.php' => '1919d31943803a66cb2d12828bd92db2',
-    'search.php' => '16097d7d63ce23ad21b49f7fec4e2ad8',
+    'search.php' => 'b1239e5af6795205648d8965ec3a1ec9',
     'theme.php' => 'b05f7265501a3e1c5e7c47cb3f891831',
-    'ugflag.php' => 'f2de9adf44d02735f7364e2378339c0c',
-    'update_routines.php' => '890e402b1b1c984711b2648927969ef3',
+    'ugflag.php' => 'b3b47767137dd7ea5e3726150507e158',
+    'update_routines.php' => '16e3369df255bb5d6f76e8288830e3e1',
     'updateadmin.php' => '770fff43134883ea4d502498b28d70d2',
     'upload.php' => '69b274043c816b5a8c7241c20de0b9fb',
     'userclass.php' => 'b7fd96c785b6f3eead88fd5acd5760ad',
-    'userclass2.php' => '2c68fec8db220660cf7445598fe1aa61',
-    'userinfo.php' => '09131e3ed623691c945592272373d32e',
-    'users.php' => 'cca45a222221196f8ce026674acdfb45',
-    'users_extended.php' => '6225314b33cbe6b59cb6dc44ff9e54d2',
+    'userclass2.php' => 'f0a95f4feecabe0d801b4a7f64c89ec0',
+    'userinfo.php' => 'fcbb4c620a0a9ed430588ee7539fb2d7',
+    'users.php' => '97cf741f0e67b3be9a55232c4a189932',
+    'users_extended.php' => 'c0cc2efb094dbb76b7e73fd31aedd06a',
     'users_extended_predefined.php' => 'a1bd4adc6a6c1996e304b467aed9d2c0',
-    'ver.php' => '1a340fdf81a2eb3e874ac82783fefbc0',
-    'wmessage.php' => 'dc0fa304048a63bee8f8ca2c2321c527',
+    'ver.php' => '50bdc51a07a780bad3c7b109feeb22b1',
+    'wmessage.php' => '17afb0f8ef07cfd675cd92e9f7e606a3',
   ),
   $coredir['docs'] => 
   array (
@@ -114,31 +114,31 @@
     array (
       'English' => 
       array (
-        'Administrators' => 'fde3f611512ac789609c80fc8a6f3609',
-        'BBCode' => '33451916e62615ddeefb30103f570831',
-        'Banlist' => '83a4c139037713c03d0999e28335c852',
-        'Banners' => 'a1c096485e789b14c720b7c73b4ea7a2',
-        'Cache' => 'bb3356ca038bd2a43b73d4543799f4d1',
-        'Chatbox' => '5fa17c49db4bfef93729d2dac1fcc162',
-        'Classes' => 'ea8b68f265aef007a9636443b7da3dc5',
-        'Downloads' => '37399eb226ad7d1d729f68f65efc7b00',
+        'Administrators' => '2d001305d3842ccda086c69d8480b7b5',
+        'BBCode' => '5fa5841472b4f5ef147cdc3dfcf64583',
+        'Banlist' => 'c26dea7d5c19e89270b6a4c66f7c5367',
+        'Banners' => '07ec3ec7746666e5c8dc62d126e69cdf',
+        'Cache' => 'd277d62ce899f0c85b5f9ab2721e2359',
+        'Chatbox' => 'ee6779c1a022095e1384da1696a62a90',
+        'Classes' => 'ee095eb315ad639cbda7e961f9ace940',
+        'Downloads' => '8da67c083574a267ea6a82fe75f27329',
         'Emoticons' => '14a0d74aea591e0f8d82577aff8fe979',
         'Errors' => '46381d88a2326ff760562fea385b2fd0',
-        'Forums' => '1619602477ff749e4c4521cfcb274b83',
-        'Front_Page' => '8cb962ed7c3ddb0d955c8d03ed1ce906',
-        'Help!' => 'dc507cff0acafbbf3abd7f2424dd6b72',
+        'Forums' => '5976f081c2e1822a1261975cba4fcadf',
+        'Front_Page' => 'f3f5ee030265c5892c022771b5f218e5',
+        'Help!' => 'ad2abff800199fb22078a9d5b825b9d7',
         'Links' => '320eb08defa1360070a4f0c062e5fc84',
-        'Maintainance' => 'cc818c06e047bba0e2c2349e954cfaf0',
-        'Menus' => '44a53801c18ad52aa9e50c3b4fbfe241',
-        'News' => 'e5ec6c8137c00916343f8f4f5084bfe7',
-        'Preferences' => '518d50601fb29ed7fe20ff5ce73d69f2',
-        'Uploads' => '72e3f738393c8ba76caa195a9f9021a3',
-        'Users' => 'd64be592aae221b66ca4d33b69056e7f',
-        'Welcome_Message' => 'a3a7b26428d35d5ebb520e16ac6204da',
+        'Maintainance' => 'f248eeafde7e99293b77d662304bfb52',
+        'Menus' => '7344815f36b8aa616047ec8152ad54fa',
+        'News' => '6eadf4f45748cad4f37e67fea04e05db',
+        'Preferences' => '9b3d173843f5ac04b8cac472a8e213f2',
+        'Uploads' => '1a979ee608d8dd812dd2752ba8d9f48a',
+        'Users' => 'd62e15078e8d9d7ab8da7ec654cdef43',
+        'Welcome_Message' => 'd3a3a4dfd02ec7258dd91364be7d6aa8',
       ),
     ),
-    'README.html' => 'd9e0015e610c7aca3ba875848b4cf579',
-    'README_UPGRADE.html' => '6164eaaec5a09bdcc5d6f6b0aeeb8f34',
+    'README.html' => '0f900f790eb4081e213fef89b92a5125',
+    'README_UPGRADE.html' => 'bd278a384e14d6306fc557a0560231fe',
     'gpl.txt' => 'e19d8295ecad01988af40b5a943bd55f',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
     'style.css' => '2e3b2c9e4bff6d8de091af58589faa1c',
@@ -147,33 +147,33 @@
   array (
     'bbcode' => 
     array (
-      'b.bb' => '9870aab6f8b8922c56189733cf5c5db2',
+      'b.bb' => '467bfb5e80f460fcebcdc2e6a3a8d38b',
       'blockquote.bb' => '2cfbbd3ab3fe2872d1a9873223d21522',
       'br.bb' => 'cb8d211703f0459735baa8dfbebb4bb4',
       'center.bb' => '5a1957946e3d8898a0b3d86650771809',
-      'code.bb' => '7b3dbff57f7ecbfab1bd09cc2d84ba7e',
+      'code.bb' => 'fbc07a20865e76438614cb49d4f50b4b',
       'color.bb' => '98b9d0ddcc76d2ee37af0f36eab8b1c3',
       'email.bb' => '123a8b604a28524320639ba1e09bef35',
-      'file.bb' => '65a8c1e8c17d7aef91015c37cd90f4cb',
-      'flash.bb' => 'ab7ef959e8a613a62df6328da41ebcfe',
+      'file.bb' => '37ef44e5f420205d6c4f4519e69e7a32',
+      'flash.bb' => 'd008adf0a77ce5b3398e908765247646',
       'hide.bb' => 'cf30f78c78855565b0bf868a01142fb8',
       'html.bb' => '9938499c3ef8c80a2598b9c3aed7e371',
-      'i.bb' => 'd97c389b4fe7ce7ba06ee77802835c8c',
+      'i.bb' => 'ec842cfda8a6f33d53f8232763b56719',
       'img.bb' => '55dbceb76b1d0f3ac070c0122ed7ee10',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'justify.bb' => '016500f910beb0f820dd58c4915f2489',
       'left.bb' => '990ddba32b14bea648745cc373035bde',
-      'link.bb' => 'ded6e905c2f5d9a12707d3bfa63d1d82',
+      'link.bb' => '0682a13d56650ba5ca6859e9da761e6b',
       'list.bb' => 'a2b5f8075b9752bb5b60c3862c5d96ca',
       'php.bb' => '18bfe745513afb3bb7ec4d69f0683d95',
-      'quote.bb' => '52a975031f0f5ac67d91ced1dfc192d7',
+      'quote.bb' => '12bfbba32661e309a33972e388b0e912',
       'right.bb' => '9bd60ca738b30f35742a0049c5efc191',
       'size.bb' => 'bd62172ecb7083b85b534c2e45e79d48',
       'spoiler.bb' => '5929f20a04438093df87b7246e843bf0',
       'stream.bb' => '9661057e8db23c681e3ec2340ff3a4fa',
       'textarea.bb' => '51f2669f52dfec3ed57f38402fcc7652',
       'time.bb' => '3d83b0dfa9b139004bb19ee34b142b44',
-      'u.bb' => '4d95b259d881604959e49e8312e7cffc',
+      'u.bb' => '7f8703e65a5f24bd9d2edd5fc0dfef48',
       'url.bb' => 'ded6e905c2f5d9a12707d3bfa63d1d82',
     ),
     'cache' => 
@@ -203,9 +203,11 @@
     ),
     'import' => 
     array (
+      'import_mapper.php' => '78a98bfedbe66b043e8562bcd6449125',
+      'import_readme.txt' => 'a76f8a52208d648e1c9e3afe71929755',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'mambo.php' => 'bbcff57b96ca83045d9f4afa982a6ff4',
-      'phpbb2.php' => 'fb21b07e4ccd1367ea54bce6c3ff8bc0',
+      'phpbb2.php' => '80bdbe33731a881d122d68003096c4ad',
       'phpnuke.php' => '732653b3f39cf02364be2dcb0f065f3a',
     ),
     'misc' => 
@@ -224,33 +226,36 @@
     'resetcore' => 
     array (
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'resetcore.php' => '3620244184ad7481003ef67a75eba448',
+      'resetcore.php' => '8a69dad2ea719f5f8a85160b049d34eb',
       'style.css' => 'e294495db6f91c4514c4f40d7b09fcd5',
     ),
     'shortcode' => 
     array (
       'batch' => 
       array (
-        'comment_shortcodes.php' => 'cc7624b4c3b2977521e1fae7f0fc4ee1',
-        'download_shortcodes.php' => '3170adde2a2069b2faa952524bc4782b',
+        'bbcode_shortcodes.php' => 'ea6a74e0a309ad82b29f3fa467e77c39',
+        'comment_shortcodes.php' => 'd443298b9ca99525f12817f6a3234706',
+        'contact_shortcodes.php' => 'd593f9dadff312c61eb27e32457d7f95',
+        'download_shortcodes.php' => '7ab132b79c308f5d010743e135dedce3',
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         'news_archives.php' => '1115fe90b0de9f170fce31c94680dabf',
-        'news_shortcodes.php' => 'cec6080c6fc21e77e46c8594449fd07d',
-        'signup_shortcodes.php' => '141ec3d3923cc08278e68ca0063670a6',
-        'user_shortcodes.php' => '3447bb463cba8c7bb160b1908dc3dd0f',
-        'usersettings_shortcodes.php' => '6a042a12f899061754a15c6bb6653391',
+        'news_shortcodes.php' => '6db3c049835db41b7fdace7e6c494d81',
+        'signup_shortcodes.php' => '8726a38b93ea99fc74355f6188723c8f',
+        'sitedown_shortcodes.php' => '3ae9199cbae645d23869d517a5f6cef4',
+        'user_shortcodes.php' => '7f8fb9882adb3bcffdbd41435e62f154',
+        'usersettings_shortcodes.php' => '0ba56f47a83cdbbdf3a5c72475ec100c',
       ),
-      'admin_alt_nav.sc' => '92450638fbe0a78485c0eda214b3f0ef',
-      'admin_credits.sc' => '221cefb6ab4f24171b7af36f372355e3',
+      'admin_alt_nav.sc' => '412e8fb7acac7746ea48b17854decfc4',
+      'admin_credits.sc' => '0eb1784fcb76e13c8addd81d9a741074',
       'admin_docs.sc' => 'b010b7ac7618fa669c8777754a8337c6',
       'admin_help.sc' => '1ad9d6f1c5af06e7ce2d0e1744b02cd4',
       'admin_icon.sc' => 'e479849c3b09aae88aae3532b0550a92',
-      'admin_lang.sc' => 'a0ef4c6337a329ead6566985c68562ac',
-      'admin_latest.sc' => 'a0d7c50805d91d4caf60a068510b8473',
-      'admin_log.sc' => 'fe7bf0efa38817a58f6ef678a8df82e8',
+      'admin_lang.sc' => 'f5bf42455eb337119639528aa7fea705',
+      'admin_latest.sc' => '96a92eb5000eb6e8f120b70734239968',
+      'admin_log.sc' => 'ad42fe098b732d8985cd44b11a3402d5',
       'admin_logged.sc' => 'dec16fb0a9f5485db6ca1b4955753c2e',
       'admin_logo.sc' => 'ff7174ceae0a5e01bfd0bc7a343c16a4',
-      'admin_menu.sc' => '9847249c8cfdc0fb93654d98577b620e',
+      'admin_menu.sc' => '33785fcda56c60c219a4cc30f6018f5b',
       'admin_msg.sc' => '1906530f20e337964878fd144b1047c5',
       'admin_nav.sc' => 'c22be64cb31ee333f0510f6dd8778363',
       'admin_plugins.sc' => 'cdf52aad6688cde7741d695a62be944d',
@@ -258,46 +263,51 @@
       'admin_pword.sc' => 'abbe3f9d2709e86cfb37b378f2b3d13f',
       'admin_sel_lan.sc' => '6c2dbc4e17bdcc5f5260664ddb8c3280',
       'admin_siteinfo.sc' => '63bfd9a632b66f9368337983dd921537',
-      'admin_status.sc' => 'bba261fea5a35f2b3424c039fe61dcb1',
+      'admin_status.sc' => 'ee77ec3ec0d56adfdc8681900a85bfc6',
       'admin_userlan.sc' => 'cbaf3dda959b6a36f6b3f4cf0a6f7536',
       'banner.sc' => '4a23a473eb15c7afbedbd4816f3922ea',
       'breadcrumb.sc' => '0591ee7dc26ded7ac9a359dea4b8fdf6',
-      'custom.sc' => '0b871533c2a2661851dbefedd959c65b',
+      'custom.sc' => 'eae664abbaed381856936600574839a7',
       'e_image.sc' => '3819fdf5b9dfc7b189fb4073d33ae0d5',
       'email.sc' => 'a864fe0d78a0c9641b36d65688c63b10',
       'email_item.sc' => 'a23b3abbb722bbf5bc58be9d23906583',
       'emailto.sc' => '05843b1a7c7feb8f4985a55ac01ba9f3',
-      'extended.sc' => '8fdffc090d07e85ceb203542ecbb0d32',
-      'extended_icon.sc' => '38a6eddf073fd8228996b4f6e7e9f80c',
-      'extended_text.sc' => '8bd2b2168a8f92aa2548e75c849ffac2',
-      'extended_value.sc' => 'cf2e9f0820126d3f68c39adcfd45c0e8',
-      'imageselector.sc' => '392d0d1c1896ec3a765001b49bf37413',
+      'extended.sc' => '868d45e725d7565a1d9c5b743aba0967',
+      'extended_icon.sc' => 'db16dbaa0dfa2f8fc944ba87c15a09d1',
+      'extended_text.sc' => '5a1426815f88bb2239912638af30beb0',
+      'extended_value.sc' => '1b720e5d3155c6d4a1464fc1e9cac5f1',
+      'imageselector.sc' => '31d9db59fdc34235656d40a275e63c26',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
+      'languagelinks.sc' => '46f5c006e1b1f5e5b941a6330711bf77',
       'linkstyle.sc' => '5ed64d972bc892a798f80179878f1266',
       'logo.sc' => '9fb4b737a74ac8d1168fa29fe88766ac',
-      'menu.sc' => 'd46421312f79314a9cffd805f065b481',
+      'menu.sc' => '44ea3e93ac49feeda0632a76773e2829',
       'news_alt.sc' => '25596ffed2cf4bed831b80397c77e295',
       'news_categories.sc' => 'c520fdee0b041b3622c93ca85f63f6fb',
       'news_category.sc' => '25596ffed2cf4bed831b80397c77e295',
-      'newsfile.sc' => '3b553625cd46e5c576afa21cab8df3fb',
+      'newsfile.sc' => 'afe0363c51236eacdf1a5434d17533a3',
       'newsimage.sc' => '75738371cff6146174ea00971730a0da',
-      'nextprev.sc' => 'f027223abe8a007e0f5acc6305e1da36',
+      'nextprev.sc' => 'c1c872831b48abb3c34d531e8ccdf2da',
       'picture.sc' => '0f4d00920f1ddbac7293549862b3c0da',
       'plugin.sc' => '3b827418651f2a8f070d1cf80fe2405f',
-      'print_item.sc' => 'a532b0cea88aff710a3bdcea2cdb322e',
+      'print_item.sc' => '8ca4f150e4758249c346dd0edd5623f3',
       'profile.sc' => 'ea7fc4eca12f39e19a735d2014fe341f',
-      'search.sc' => '26d923db11c015b4a0fc6a2d6c0bdee4',
+      'search.sc' => '12a174161a186e9a936fc10c946f0517',
       'setstyle.sc' => '88ec920b668233bd21ba95e2cdd607e7',
       'sitecontactinfo.sc' => '5467f65cd62b910389014b5fb8b33fe5',
-      'sitedisclaimer.sc' => '9497e1719f019c9af67fdfac1be16cfc',
-      'sitelinks.sc' => '0c7f62270ac7b4135d6720a6b74cee7e',
-      'sitelinks_alt.sc' => '2fc00cad9b7e50da3d6726647b9a6ae7',
-      'sitename.sc' => '49193510fce1805716ef34478b82daf2',
+      'sitedescription.sc' => 'c617f50a35752e7cb8de2d15f7e6b614',
+      'sitedisclaimer.sc' => 'cd111b6abc576ca1ab70c103f3f2a49b',
+      'sitelinks.sc' => '754259e3bdab4efc147d92b50efdf262',
+      'sitelinks_alt.sc' => '24ee01a0e4b5181620320b936a63245e',
+      'sitename.sc' => 'a62bd1e1600931a2585f16b611fd0c6b',
       'sitetag.sc' => '338e16589e67c9fe45613e3c6dbb9b0d',
-      'user_avatar.sc' => '09de355193d7629064e8fcaa005ccb18',
-      'wmessage.sc' => '80b94dafe7e2bc0d82a6df7aacb9c1f7',
+      'stylesheet.sc' => '40a390253676a08790cbadcd434619b3',
+      'uploadfile.sc' => '85ea5b2a10cde7c2267a40c359694aed',
+      'user_avatar.sc' => '1501550f2414900d47edee2621b2e624',
+      'user_extended.sc' => '8fdffc090d07e85ceb203542ecbb0d32',
+      'wmessage.sc' => 'b6bf7054c5f9ece93c13f2f1bfd13a31',
     ),
-    'def_e107_prefs.php' => '714c00e30a0c950e6c9b40b17b101763',
+    'def_e107_prefs.php' => '0886a4b7774f246f31aa027d4b8eb18b',
     'e107.css' => 'e5cfa4047831f19def7df032ef8bc830',
     'e107.js' => '2089336ebd5204061afce9be3094ad73',
     'e_ajax.js' => 'b583773e72852158e27af8a9bba7c97f',
@@ -318,7 +328,7 @@
     array (
       'language' => 
       array (
-        'English.js' => '686fdfb3c6dd89119b0fc100fea0af18',
+        'English.js' => '3eae52209f3587e2339a010280e22150',
       ),
       'cal.gif' => 'c1e5255bd358fcd5a0779a0cc310a2fe',
       'calendar-setup.js' => 'bcdf616f6ebfe8fdb0235d389fb1d238',
@@ -338,10 +348,11 @@
       array (
         'phpmailer.lang-en.php' => 'dca429b3dfc000a241f32ed11d3a6aca',
       ),
-      'class.phpmailer.php' => '19387562d781c1e3e71d15be61ec1b10',
-      'class.smtp.php' => 'ddffdc4ffea47a74423038a97d065e5c',
+      'class.phpmailer.php' => 'cf32be10ca659080ad4550acd26c102e',
+      'class.pop3.php' => '5a96ba537abceb27300abeef11041302',
+      'class.smtp.php' => 'dcae7f76c4549f804401195e06e2cb3a',
       'e107.htaccess' => '507de3fb6f951cafa6b1a346d232604f',
-      'mailout_process.php' => '2bb26be6aae543eabdc7a629e9da7d31',
+      'mailout_process.php' => '51fae3c946ebe47c33b298c36ef6f545',
     ),
     'search' => 
     array (
@@ -355,8 +366,8 @@
       'comments_page.php' => '6e5a89313087d403e30cfeb8ddf4da78',
       'comments_user.php' => 'caa387a56d6f1b35610e80061e18cc1c',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'search_comment.php' => '259c054fc6bbf455d99ebbf4071b0ff0',
-      'search_download.php' => '43c029be2f9b66ee064411ad75404881',
+      'search_comment.php' => 'd6969967014e8c14e613bad64a091253',
+      'search_download.php' => 'ba62e1be41cdd3457cfc2be8de146d01',
       'search_event.php' => '17c68ea4f5728e87e7009b96b978006c',
       'search_news.php' => 'bc0321e07ae69c925ac83a72ae67c136',
       'search_pages.php' => '57521d1569a214c3ccb99406561a229f',
@@ -381,8 +392,8 @@
             'spacer.gif' => '12bf9e19374920de3146a64775f46a5e',
           ),
           'contextmenu.css' => '93ad8b3e8a5e1a48bf6ed727ca0384e2',
-          'editor_plugin.js' => '31b3fae1bca58466a18997c52b9336e8',
-          'editor_plugin_src.js' => 'e25b5fbabe59cfba09cfa09b45c20d4a',
+          'editor_plugin.js' => 'f4df4d4889b61ecd067ea2d6977420ca',
+          'editor_plugin_src.js' => '7772eef735b088e4a6fdfdf707e33e65',
         ),
         'emoticons' => 
         array (
@@ -392,36 +403,12 @@
           ),
           'langs' => 
           array (
-            'en.js' => '8df9c4f5e9083acb89cf152c8ba44f9d',
+            'en.js' => '25334d4a3d329cc805a54c3f815ff26a',
           ),
           'editor_plugin.js' => 'ede01e828a3698e2e00a9dbd503e7d95',
           'emoticons.php' => '31f361fda0b760ad25d72a9cf8bed070',
           'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         ),
-        'flash' => 
-        array (
-          'css' => 
-          array (
-            'content.css' => '9ae9f08d9748dc78ed6e0b33cd11e458',
-            'flash.css' => '5ad8611160baa5f2198abb88baae38c9',
-          ),
-          'images' => 
-          array (
-            'flash.gif' => '709d9df69d8c2030e56321046d76ab8b',
-          ),
-          'jscripts' => 
-          array (
-            'flash.js' => '6b51cb8bf256f6ebc86e3a325475209b',
-          ),
-          'langs' => 
-          array (
-            'en.js' => '52de748671eb0182b112111dbaa35e88',
-          ),
-          'editor_plugin.js' => 'd9a86e84d6de9a92c07caa14c32fa436',
-          'editor_plugin_src.js' => '9f6d08f5269ffb3d107bbb382d1080ae',
-          'flash.css' => '439d26d52ddf50dd5ac7d5fcb29a6e7d',
-          'flash.htm' => 'c67139b142800773e99457bd880978e9',
-        ),
         'ibrowser' => 
         array (
           'images' => 
@@ -434,9 +421,9 @@
           array (
             'en.js' => '5bc48956a398ac86f36edb041a898a85',
           ),
-          'config.php' => '0af08bfd60ce374b94e0080043183359',
-          'editor_plugin.js' => 'c24c653b8ab5efed78a30e95e68ed0b1',
-          'ibrowser.php' => 'eb13818738cf7ab604a8d9a8b6af92d0',
+          'config.php' => '4e178e32efb96453c26523ded26f6ee7',
+          'editor_plugin.js' => 'e16d63db65af69d1db26ff64b706a0d9',
+          'ibrowser.php' => '1865b7afd71373cfff0cb986b632ee35',
         ),
         'iespell' => 
         array (
@@ -448,8 +435,37 @@
           array (
             'en.js' => 'b262530d5b63841b50ab5b67f94883aa',
           ),
-          'editor_plugin.js' => 'c2db1286b602688099f0636540380d1a',
-          'editor_plugin_src.js' => '16989007849b42b9ad531319af9851c2',
+          'editor_plugin.js' => 'fae3a5e1abb9e78c55eb4dab42d8dfd1',
+          'editor_plugin_src.js' => '24caf83859f447628508cd99c907352c',
+        ),
+        'media' => 
+        array (
+          'css' => 
+          array (
+            'content.css' => 'f665ed43e62a4ab7c0661d00fa4f0fdb',
+            'media.css' => 'af181e09ae05dd73b0d32c0caa87d1a4',
+          ),
+          'images' => 
+          array (
+            'flash.gif' => '709d9df69d8c2030e56321046d76ab8b',
+            'media.gif' => '0541d5bf542ee730346a5f4641416356',
+            'quicktime.gif' => '4a4709a92bb1ef6bc1621019c92a83b8',
+            'realmedia.gif' => '51de6342ba5327787eba762116d20130',
+            'shockwave.gif' => 'acad15b370f34deb12355bea4b89c2e1',
+            'windowsmedia.gif' => '825f4eca28a633397050f9a6cca9358f',
+          ),
+          'jscripts' => 
+          array (
+            'embed.js' => '2288f2d23b707283921aaeff2dfeb005',
+            'media.js' => 'ff44b627774307f3ae807e6c27d66a06',
+          ),
+          'langs' => 
+          array (
+            'en.js' => 'de38190b0b16ff997c6f7a2e09818f3c',
+          ),
+          'editor_plugin.js' => '6c1cbbc18a0f3a07757ee1a3969d55f8',
+          'editor_plugin_src.js' => '9603968370efb4b25ae25d701db8ffd1',
+          'media.htm' => 'd3fce5ed41db220e12ebfebd143e1f47',
         ),
         'table' => 
         array (
@@ -461,7 +477,7 @@
           ),
           'images' => 
           array (
-            'buttons.gif' => 'bc01f6be1e91618347cc0edd0157aa4a',
+            'buttons.gif' => '7e50c576bb169b5dd93d9e28da67bb14',
             'table.gif' => '476b000e94b74dac818f1ce03681ace5',
             'table_cell_props.gif' => '6912d92a00e3e81a9baba3e251b7f0c0',
             'table_delete.gif' => '060899ca004398671369f92ef6a88a90',
@@ -478,25 +494,25 @@
           'jscripts' => 
           array (
             'cell.js' => 'df27f8a9de847dcc4b433960c72f99fa',
-            'merge_cells.js' => '78f470baf2d2278b3535e5389abda244',
+            'merge_cells.js' => 'f75d50d1dea59b83bd7f091fe53be6d3',
             'row.js' => '5564b689e370fc84c47b192de29e472b',
-            'table.js' => '8e634e43a5315955de1267f713bde296',
+            'table.js' => '260a2bfaa8e3a3313fb14904f6daf7ea',
           ),
           'langs' => 
           array (
             'en.js' => 'efb577fa33557c4f819d45f8be16ff20',
           ),
           'cell.htm' => '19a425a22f5dc25f42e755ad38d3ba98',
-          'editor_plugin.js' => '508bce2b3685ef444dbdef1d9658deb5',
-          'editor_plugin_src.js' => '05ca57116f9c0df3d69b662e146fd684',
-          'merge_cells.htm' => 'c6a7f1792af1b08d564c5242d74e1795',
+          'editor_plugin.js' => '21d04eeb64cf88af767f0641f1c360ee',
+          'editor_plugin_src.js' => 'aeac85b281a5aff98f76157bbbbfb3f0',
+          'merge_cells.htm' => '9470fcdf7575a48d499fdde3f20d8d5e',
           'row.htm' => '7c8c219909be04d09bad3bfeb048c560',
-          'table.htm' => '9d81653d8894c1321c893cb058b439e2',
+          'table.htm' => 'ec13d5c3ebb1e460e4a99de394664dc0',
         ),
         'zoom' => 
         array (
-          'editor_plugin.js' => '971affe783655dec2cf61d0468d2ecc2',
-          'editor_plugin_src.js' => '1008f77b8fba86700e32752014e16762',
+          'editor_plugin.js' => 'b4029d6df8bb33172ea5c44a9ba409ac',
+          'editor_plugin_src.js' => '5a3aef8ef6b914daefb467674be73989',
         ),
       ),
       'themes' => 
@@ -506,8 +522,8 @@
           'css' => 
           array (
             'editor_content.css' => '4950d1774a92d46045b57911d41706ef',
-            'editor_popup.css' => '706af4224c448720974a4b2bd01b120c',
-            'editor_ui.css' => '2aaa14fd106feb476280952cd15ab136',
+            'editor_popup.css' => 'e2c24b08b5fdb21ca55da439aa30564a',
+            'editor_ui.css' => '5d74992a65ac983a065f7c3d3012779e',
           ),
           'images' => 
           array (
@@ -521,7 +537,7 @@
             ),
             'anchor.gif' => '9997d8cbba012a0a8295ff92bced1207',
             'anchor_symbol.gif' => '5cb42865ce70a58d420786854fed4ae1',
-            'backcolor.gif' => 'a1f0a58d7fa6ebc1376d1e03bf292658',
+            'backcolor.gif' => '9d4f0c287ef6a09ff25595c366920f61',
             'bold.gif' => 'd4eac7372d4d546db5110407596720dd',
             'bold_de_se.gif' => 'fa8d362da3c15cab263bc7eb2d192dd1',
             'bold_es.gif' => 'eedfd6c0dc13c5db5054bd893ac92ca0',
@@ -530,7 +546,7 @@
             'browse.gif' => '2babc35c383abee1260e021dd87fd7a5',
             'bullist.gif' => 'f360470402affab13062de5ffbfb7f74',
             'button_menu.gif' => 'ed293e6a817f44328f74c0853c628e69',
-            'buttons.gif' => '9322ed07f90ab662d0748b01d6e20bb4',
+            'buttons.gif' => '23c32309ebbca60a52fd064860788620',
             'cancel_button_bg.gif' => '57b808096854d5eeb5785effcd10c468',
             'center.gif' => '652af6256deb0eeb781b0793ee4142f2',
             'charmap.gif' => '3c3625a993caca8262dd93d61ff1a747',
@@ -542,7 +558,7 @@
             'custom_1.gif' => 'bd1f96d299847c47fd535b1b54d3a2df',
             'cut.gif' => '4e3e44cccf150856322ba78ccf2533e7',
             'ecode.gif' => 'd78d5418d4c6883c837fdbeb7b824bb4',
-            'forecolor.gif' => '1703ceb1f02e9af817794fe8334f6612',
+            'forecolor.gif' => '160b10bd5949887d251eb5b96291b799',
             'full.gif' => '009750822e228e10f51e746ddf8d1fec',
             'help.gif' => 'e244d2c9d8f1d1910c7145699f767a9c',
             'hr.gif' => '8d92cb73437c32a0327323b538ad2214',
@@ -598,11 +614,11 @@
             'color_picker.js' => '9dcf13f6303af0db5d3fb280fa526f62',
             'image.js' => 'bf79747eacc011f3902a1804b49d6265',
             'link.js' => '3df42cdbae98782ae9a9bffaeba7ab53',
-            'source_editor.js' => '987562f807c2354b120270e17447e664',
+            'source_editor.js' => 'f2419d8fb2804a46ed626e6a8b953539',
           ),
           'langs' => 
           array (
-            'en.js' => 'dd60763dcdafcb1acd494e3950cd5432',
+            'en.js' => 'd954dbe69d706823e7ce2acc99ca16c6',
           ),
           'about.htm' => 'fc2c574502ccf3e53fd00f52d9aa3869',
           'anchor.htm' => '15ace71eb4c333034944ef7cfb1646d2',
@@ -610,68 +626,69 @@
           'color_picker.htm' => 'c00bae115f05a96d5a561dd46cfb9fa4',
           'editor_content.css' => '99f256c087e16872937f6cf9e4ea0c32',
           'editor_popup.css' => 'a2bbb5f95ba2d3422c1666222170d700',
-          'editor_template.js' => 'ebbea930e24ec9723baf85a8a7a5054e',
-          'editor_template_src.js' => '3df83a6c451003dc2b521561b5f196e3',
+          'editor_template.js' => '34f49851a46c0c3f5f90929fb5a1260e',
+          'editor_template_src.js' => 'cd30e9a71b4422f62e370538a3b24dc4',
           'editor_ui.css' => '62632779c868eddf46f3a8e121083d31',
           'image.htm' => '4a2a0fe9cc33b4997f718b58af1be6ca',
           'link.htm' => '8f96d1fee5e848c10bd1c73faf0b38a6',
-          'source_editor.htm' => '43153d53a3e9dbbafa5399d6ea3a2e73',
+          'source_editor.htm' => '7b533802f9534af465bb276a2c318f35',
         ),
       ),
       'utils' => 
       array (
-        'editable_selects.js' => '18b1487fce99cb47592b36535de0b128',
-        'form_utils.js' => 'aadc996ce4f61a4ec7701804f1be9f7b',
-        'mclayer.js' => 'ca81f7eaf3af6e32c30972ef1652a43d',
-        'mctabs.js' => '832f2fed0885cc138f0b831660dd2c31',
-        'validate.js' => 'e600c6db5c42e1b6b17e74531f723563',
+        'editable_selects.js' => 'fafc283bd5b48b6cd188cf12856aac88',
+        'form_utils.js' => '74cf73cde95e530009a570facd900874',
+        'mclayer.js' => '1c7d5ff736bf571af7b1407758db937e',
+        'mctabs.js' => '70249b9a54761a08db2006afb99079a1',
+        'validate.js' => '50799f6a9ebc837f3d0345c4a42367bd',
       ),
       'blank.htm' => '72406c871a9be7972922686221a885a2',
       'filelist.php' => '63d5fa62565bc100d3345de82ab36985',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'tiny_mce.js' => '9292f09840dcff32a8837f560b589852',
+      'tiny_mce.js' => 'ae9f1a863b1d3686cf0c6ab0994acf2b',
       'tiny_mce_gzip.php' => '846511eed428312feca1f0e5fec6cd91',
-      'tiny_mce_popup.js' => '069e50a15c68f124213f42533c0ffeef',
-      'tiny_mce_src.js' => '020a68120e9d7c52022509069e845ce1',
-      'wysiwyg.php' => '37206fc679904a99834a4f1e96bb7037',
+      'tiny_mce_popup.js' => '0a5ce4187f9d2f58e36302d7d40bf3d2',
+      'tiny_mce_src.js' => '1a99b9dcd773d76df1fee42e072cb1a4',
+      'wysiwyg.php' => '3cc70beacb90d7c9ea9dcfea7288a8be',
     ),
     'admin_handler.php' => '2d593943e40bf02d5d46cf6b6af6b7e7',
-    'admin_log_class.php' => '0b7760f435d2d36f19b49ef6206392c7',
+    'admin_log_class.php' => 'a19c073089c6149a755e253133594d65',
     'arraystorage_class.php' => '4862b38926c8f68029c95d31990435a4',
     'avatar_handler.php' => '54c9f790d9f17e30f52b8011633d486c',
-    'bbcode_handler.php' => '01a5fba10173320244f8e9a7157e6da4',
-    'cache_handler.php' => '8902d17948517fcdbf3a9448dcf39671',
-    'comment_class.php' => '3c40e81e233bacf0a37ca959477321f1',
+    'bbcode_handler.php' => '4871033a545a98c465e3b0aa6e911374',
+    'cache_handler.php' => 'e9b35486958d34ecf84afb69bed7fe16',
+    'comment_class.php' => 'e525ee48e0f89300368bf201aed95783',
     'date_handler.php' => '900262e3d47034c444cf3da1abc9371d',
-    'db_debug_class.php' => 'be1091d952dd6900d9559eca53f0be82',
-    'debug_handler.php' => '19da1125a99430468c50b0907734436a',
-    'e107_Compat_handler.php' => '7e4acf26b5cb655f3fb04231873fd06a',
-    'e107_class.php' => '77749a7f5cff807d7f1b8694baeefd69',
-    'e_parse_class.php' => '278017576cc7ea2553fa2b547413e168',
-    'emailprint_class.php' => 'e2893f34c93b8defd9a579e0c25decb4',
+    'db_debug_class.php' => 'a1ac847f296f4701473806f80d5f7d23',
+    'debug_handler.php' => 'fe93f06640b293a65a068d800c22daf6',
+    'e107_Compat_handler.php' => 'e76211b3178e4a9724933ecfe85ba8ea',
+    'e107_class.php' => '4ce6554308d42363e08c45c5b711df27',
+    'e_parse_class.php' => '39060ea3a2092ca529710b0fc4d69037',
+    'emailprint_class.php' => 'c7de0da4205693ddb952e9723a7fc226',
     'emote.php' => 'b5d34cd652e828769f49b855b090c96f',
     'emote_filter.php' => 'fedbb8c9daf1acd5f6dbbb9914b05dc4',
     'encrypt_handler.php' => '7a6f592c0900d68fcf5cbf7b0eb1e364',
     'equery_secure.php' => '00121b097ba978d5330349abbd350737',
     'event_class.php' => 'd14906b7576984e7d9467c097e285b65',
-    'file_class.php' => 'f768aa1cedfd0054e52f920a5ca70dd8',
+    'file_class.php' => 'f193a200c2717c932e3dd1ae7d378fcb',
     'form_handler.php' => '67deba10eb6acf65d941b760deec6134',
-    'forum.php' => '9dc7f57079e136ed26e246aa64af3f88',
+    'forum.php' => 'da5c0d4378b7288610945979d269a79c',
     'forum_include.php' => '8b562f8ba508cc3572c84b443c4e7a6c',
     'forum_mod.php' => 'fd1adbf1660996aeb4f51384506e0045',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
     'input_class.php' => 'f819fe76d1fa518f430410aa4e6c803e',
+    'language_class.php' => '93fe59f6606cafbf4dddb8546fdd3a9b',
     'level_handler.php' => 'a231a4e63fcf4f498f9bfd7411250faf',
-    'login.php' => '225de0ff7490fead67e2cc4fc31ec4d9',
+    'login.php' => 'cc67e51d6ea138cb66b9ada17adebaac',
     'magpie_rss.php' => '1297fc8132b5ec0a2c04436b38ec6aee',
-    'mail.php' => '3fd990110951114a7826ac1309699e0c',
+    'mail.php' => '407db4ce0e57e22b7db8252af7f3085d',
     'mail_validation_class.php' => '75e722bf8c6975349ec402682323314e',
-    'message_handler.php' => '67b1e7f4268d4f42ff1da633f1320b16',
-    'mysql_class.php' => 'fa81c70b14be9457782ec05a6c5cba85',
-    'news_class.php' => '51b6210595dee0636b6a31a905517474',
-    'notify_class.php' => '6d5325aaaa5082db544fdb58b156760b',
-    'np_class.php' => '30a61bcbf3a29dfb7782b4424a6e322e',
-    'override_class.php' => '2acb8a492cebbd9c1f746c5a16876c09',
+    'message_handler.php' => '176ebf4b88fb8267f143d28714bda42b',
+    'mysql_class.php' => '4dc9c8b12ad9395b93c2452197c64259',
+    'news_class.php' => 'c8c699da336670173562ede6f0f6a27c',
+    'notify_class.php' => '2b2908df0eb85e94686bfed263389e77',
+    'np_class.php' => '68a8edcf50703e47e19f165c1a108a45',
+    'override_class.php' => 'a1f7451103a7fb47f3e541c31cf32343',
     'parser_functions.php' => '81daef0e484ee070d440e4ebc9bc8095',
     'parser_handler.php' => '650775595b663683a426c61dba6215cc',
     'pclerror.lib.php' => '7b1498a7efb4524dd899c954526c3ca2',
@@ -679,31 +696,31 @@
     'pcltrace.lib.php' => 'eb165fe908cc30c85975b7d35614990b',
     'pclzip.lib.php' => '1b0212a9a1e09b781172c8f6964296c2',
     'php_compatibility_handler.php' => 'f77929f2cd211a855516e3e72873ee99',
-    'plugin_class.php' => 'f22e9ab9197a661dac698b9318d51095',
-    'pop3_class.php' => '03797a300bb98806c88023e1addde7e4',
-    'popup_handler.php' => '5f424554d5a7b8e3a22aa855d7438377',
-    'pref_class.php' => '1ff1af54f958073ee2c845d63c252a35',
+    'plugin_class.php' => 'd05c2666377d3c51de5c79119a56edc8',
+    'pop3_class.php' => '3164abd686583e15f96901ab722cd272',
+    'popup_handler.php' => '8915aa18adc4e69df003becaf508003d',
+    'pref_class.php' => '4d2d63ee3f969ee742d6b989863b11e7',
     'preset_class.php' => '5a4df9b9b87aa3862dda2afd44165acd',
-    'profanity_filter.php' => '2e9e8c2da7647655d8939ce6c095d68d',
-    'rate_class.php' => 'd7f52533cd2e092485f0a3bd67e0ab1c',
-    'ren_help.php' => '6560d54f7d55221ee7b74c2b6be8c7ce',
+    'profanity_filter.php' => 'd41dc2dcd84a33f37f3ea1200fef3814',
+    'rate_class.php' => '21ab83661e35eeb568386dc907a9726c',
+    'ren_help.php' => '75ebce4f529d186cede57846d7f63693',
     'resize_handler.php' => '44e5777433fa18d97e80a4c16552f785',
     'search_class.php' => 'fe9c65c10349512b91164b8b67e724be',
-    'secure_img_handler.php' => 'bd451cb8fba72e5a0af19cbf9fd24e2b',
-    'secure_img_render.php' => '9d4946a4d3c452fab164a1f9718dd1b8',
-    'session_handler.php' => '5fd69cbf9cfb7c31aa9fdc7333978226',
-    'shortcode_handler.php' => '6a2ec1c1178db0b4fc05d361733b05fc',
-    'sitelinks_class.php' => 'e9be0fc4a02e45c7d77055a7697e3ca1',
+    'secure_img_handler.php' => '18e7e3827ad38b79c3ff46b67e6627e1',
+    'secure_img_render.php' => 'e772c2042868b1d9ecafbee3b4eab4ef',
+    'session_handler.php' => '54f987aa4f0f2a31c646d9e0f81cd061',
+    'shortcode_handler.php' => '845f8b0fdfe8b6d273d8e02f3cf8efd5',
+    'sitelinks_class.php' => '64e7edf9541a0256066b9b636e550c18',
     'smtp.php' => '71008c80b0a5e12faef990c0560f8226',
-    'theme_handler.php' => '34e6dd76fc681d084a72689bb39d309d',
-    'traffic_class.php' => '0cd2cc326571109cc20424f448e3d288',
+    'theme_handler.php' => 'b38c4812a67c22705a15a263c66f3c92',
+    'traffic_class.php' => 'd9939fec7c60e3c8b95111dca22ce918',
     'traffic_class_display.php' => '4583aae09eb49619d1b302160c27b721',
-    'upload_handler.php' => 'fb16ce561219c18a33ae9853019c4f3b',
-    'user_extended_class.php' => 'a7676df9454fd4e16efaccf1703ac266',
+    'upload_handler.php' => '8720ea79c13c327e5c1c019daf077d4c',
+    'user_extended_class.php' => '893014f71353a16c7eadaed563ac5dc7',
     'user_func.php' => 'bb871abafb6c91109c809afa9514afcc',
-    'user_select_class.php' => 'df05137d06087acf9f3c52e9fc4825e4',
-    'userclass_class.php' => '4e4d8711dbd6aea0d3d0e015aa594485',
-    'usersession_class.php' => 'd1e15b80de1174f77e3783ba7b15e199',
+    'user_select_class.php' => '5f08187de31a562d5ea8ad88e1f6a3b2',
+    'userclass_class.php' => '141c0e6732238a2c8d2dbfee515fb376',
+    'usersession_class.php' => 'dcd6889bc9e8a11cba08fdd13f629615',
     'xml_class.php' => '2625ffa68fd7516ddf64eea40e47f218',
   ),
   $coredir['images'] => 
@@ -848,6 +865,10 @@
       'banner2.png' => '1f7e31b2d7608c12d2f77612780846b7',
       'banner3.png' => 'e0d62559bab3b6634281900187fa548b',
     ),
+    'custom' => 
+    array (
+      'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
+    ),
     'emotes' => 
     array (
       'default' => 
@@ -946,6 +967,8 @@
         'bold.png' => '3e23e2d8c5a4a2e7c1b750a5df9b03b8',
         'center.png' => '742d4eafd59c556ca747f6ae69aa04f8',
         'code.png' => '30583ffe0299705ee851a87dd7b8abe5',
+        'emotes.png' => '64e692b505df9624ed2318c406eb5346',
+        'flash.png' => '7a671f203fe9b582477ec0b1ebabdbc9',
         'fontcol.png' => 'd2175741c2e7e09aaaa134146636df67',
         'fontsize.png' => '89110496b363b669e3e8dffb630b9279',
         'image.png' => '1db77a12868512a36f836b986e6bb648',
@@ -957,6 +980,7 @@
         'prefile.png' => 'ab42c617455c9f05d5ea8534d607e4f9',
         'preimage.png' => '101b73c1584a2d14c4c313a15a66242e',
         'right.png' => '885e764546e87d2fd526b977aed84d1e',
+        'shortcode.png' => '2c296e414c6e833bdcab2e3dda798061',
         'template.png' => '54281aba1f70c00dc1c947fd053fddfe',
         'underline.png' => '09d08b8f890c4ebba77ecb9f25f20705',
       ),
@@ -1013,9 +1037,9 @@
       'php-small-trans-light.gif' => 'f3cffe6d2a1a2fdd32c4d694e9cc989c',
       'poweredbymysql-88.png' => '850c2974bb9ff8fc41fb9cfdf244ce52',
       'valid-xhtml11.png' => '875ce84f7794284f50cafc7aab8b5a77',
-      'valid-xhtml11_small.png' => '2b4e0a3d4b5b15b6f19593f4b42009d6',
+      'valid-xhtml11_small.png' => '142b92a420fc7162912da3f96fdaa654',
       'vcss.png' => '780ad30f6a83c9dde3464ba9a4aeb664',
-      'vcss_small.png' => '9f5feb6ca5b6bdb71f62082f9e73b402',
+      'vcss_small.png' => 'ac93bad1a0a152c69bc0317b41b2ec63',
     ),
     'icons' => 
     array (
@@ -1162,42 +1186,41 @@
         'help' => 
         array (
           'administrator.php' => 'bfc3305d4af30024ef36e2c3cac685d5',
-          'article.php' => 'f57a8593995381d72c45460c51abbd7a',
+          'article.php' => '3c7df3956134df9dfc86a4a67b73d78b',
           'banlist.php' => '589e0268a08606ff935ee928292602c7',
           'cache.php' => 'f889aa4a1889a3112699c899eb655744',
           'chatbox.php' => 'd5aede1254e7e48e3e8733f18f6ec0ce',
-          'content.php' => '5369ed6e0df6e1ed980baf910ef1dd2f',
-          'cpage.php' => 'b6f8e28fac199323b49ee54fbf1d498c',
+          'content.php' => 'dcf60ff22635488c42b4a99243bdf9f2',
+          'cpage.php' => '66e658a3daca00f9fe6d9bb1e5016eef',
           'custommenu.php' => 'bc2d5fff1395d8495a45b80da77b7665',
-          'db.php' => '62ea0c3c0479239c5864c14585f53d3d',
+          'db.php' => '56210313eb216b42cedde3f548461f70',
           'download.php' => 'dcfce12aec25465d48762456414ca9db',
           'emoticon.php' => '44293ed224e20f90dc81554c1064842a',
-          'fileinspector.php' => '9e11d8f26df9aa83c4cc7b593f2c6dfb',
-          'filemanager.php' => '1a677bd67c7fdfe43c6e01484cd75948',
-          'forum.php' => 'cfa0ce294f2307d51bedd70fa4a95d4b',
+          'fileinspector.php' => 'b2ad72e245b79f582ee54c9ed1b7319b',
+          'filemanager.php' => '62e147fa032aa065b11a139d3d53a241',
+          'forum.php' => '161249fcb72351dee1b5b56fda1a15be',
           'frontpage.php' => '44e0a1156408e6ccffed96f35a516d04',
           'image.php' => '11a6e5190f22d4c3586b440a15203fdb',
           'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
           'language.php' => '514346599719d0abc2f0a947945c77c8',
-          'link_category.php' => '8dfe128ba96dae4ee995a3fbc983a471',
+          'link_category.php' => '5352ce360022a7fc0882fb77603405cb',
           'links.php' => 'c9c06673b3d7089ac9a729e1601b82c4',
           'list_menu_conf.php' => '88bd581ba21987493206e430885cd3f0',
-          'log.php' => '03b4b2167cd5afd8e33d4ae90785baef',
           'mailout.php' => '5050871042ba40b90e0dac92c29dab0b',
           'menus.php' => '9b2d9d2e0610b55965d9b49ecd7a91c1',
-          'menus2.php' => '95d400a59300f67d7cef129ac7848c9e',
+          'menus2.php' => '2249f7d8b325af8945ed1a5a3e9721e2',
           'meta.php' => '6c85ff99c2707a2d6e73ac990971ba83',
-          'news_category.php' => 'c5c0ec9243677fe2560442c790ccd02a',
+          'news_category.php' => '0c0bfcbb20aea2de7508c5cc3c4826f9',
           'newsfeed.php' => '93f7ef1481d3fc59ecde4d40ad6b6c84',
-          'newspost.php' => '5c6cd5442e85aa008b07061196e7016d',
+          'newspost.php' => '13fda1563ee88b65ebd855113ec7caef',
           'notify.php' => '96e76c0244bf06754516ced2bbb6a760',
           'phpinfo.php' => '201f61e8c6ba0619083a30143af56625',
           'poll.php' => '3adef894abf1c1920a311899071ff8ee',
           'prefs.php' => '4cc47a077677b93cdede1ca55e3b354f',
-          'review.php' => 'f62a000ee5131770aeadb06435bbd4ad',
-          'search.php' => 'd2666c12e2b614aafa75bb7204a0d7f9',
+          'review.php' => '6997e7c8d919246f698837c0ba3693b3',
+          'search.php' => 'e9b596e5e8855fe87e8905cf0dc9a6bd',
           'theme.php' => '7ac282adfbb1f04fc10a6aa07c11e7bf',
-          'ugflag.php' => '672cc1bd9a2885d7f9a7264be39a98aa',
+          'ugflag.php' => '3c686a412439317be96965a4f31bb720',
           'updateadmin.php' => '60b51ca80381001703f4af931236cbc2',
           'upload.php' => '38d7510182a2e393cd1a09b924c95df1',
           'userclass2.php' => 'b1e5e797e72b5015dd9a7b39ad7dff22',
@@ -1205,91 +1228,89 @@
           'users_extended.php' => 'b73f20ff4c7d9f9b9eae883b300b2426',
           'wmessage.php' => '5aa5f420a6b29adad555ef7e55bd932f',
         ),
-        'lan_admin.php' => '9114e7b3d0a5e1bd3f1a8ce992012f2f',
-        'lan_administrator.php' => '5b75cb110a03a18ef9de4265822ff74b',
-        'lan_banlist.php' => '28d4e417164fa6682e8d3387529e36ec',
-        'lan_banner.php' => '5b2ce99d9e2e962e1462caa4221494e1',
+        'lan_admin.php' => 'ae4bbdef3610765b59d67e2858707177',
+        'lan_admin_log.php' => '0f9dacdf93cb2d6a4145487de304cb87',
+        'lan_administrator.php' => '83b1eaead32e6c500d42a74c40b059a5',
+        'lan_banlist.php' => '4b00aa5ed58a9f78ad1cbefb74dedb33',
+        'lan_banner.php' => '11d2439138f74b116de4697e066f7ca5',
         'lan_cache.php' => '0926abdc99274d71157280c9d58749e0',
         'lan_cpage.php' => 'c95be0bafa672c32d75394f94bb3af02',
-        'lan_credits.php' => '9d83ac814225653e5862d0d0704f5031',
-        'lan_db.php' => 'c59d72c49322151b7fd120b38e4cae95',
+        'lan_credits.php' => 'aae0c491eb54b8c529013691755044a1',
+        'lan_db.php' => 'c68b85a8b0c9817d3b996a5eac953b7f',
         'lan_db_verify.php' => '6c6067d3b23c7c0d9f36cb17867dc80a',
         'lan_docs.php' => '9df02b4a6fafef4e9be2962bfeaed509',
-        'lan_download.php' => '01350f04931b9b086dbaae7c9cd7e9ae',
-        'lan_e107_update.php' => 'a200e7fa82b8607a76b450d33f4fce9c',
-        'lan_emoticon.php' => 'c9bd141a932946c2d640ec3e1aede17d',
-        'lan_fileinspector.php' => 'c3021f79a6c58ec46c5f6507af414653',
+        'lan_download.php' => '5b3e7f94055a824fbdecd45bdd67afe6',
+        'lan_e107_update.php' => '46f96e33e39b17c2ba54ef3011082041',
+        'lan_emoticon.php' => '58e2c1f2752eff0f4ec7e1e0c126e3b8',
+        'lan_fileinspector.php' => '70c6b39a6d29f3c77df604e2293d43b5',
         'lan_filemanager.php' => '8955a0b3b7730d3f008957108525ccb8',
         'lan_fla.php' => 'a987a7502238c9f1dae9555d944ebd38',
         'lan_footer.php' => '74880a9ba3fbe4524bc2f0987e936ab6',
         'lan_frontpage.php' => '37ec01b89e67032f33498cb43e44bdc9',
-        'lan_header.php' => 'a2458aaf0d0b6cf536ba27fc226999ca',
-        'lan_image.php' => '067185121bc4bb95b722d5bf1d30c323',
-        'lan_lancheck.php' => 'fa9bf2e3ddf8ef45303ef25aec77f6a5',
-        'lan_language.php' => '28ed38b445feecbae0d60069484d2b2f',
-        'lan_links.php' => '0be35590679473745983fb5bd0b95155',
-        'lan_mailout.php' => '232441e06abc08339a291da5eaa4fac4',
+        'lan_header.php' => '2a339d027e92c0d53501986fcfd71a0f',
+        'lan_image.php' => '573f928e8753db0df958df0cbdedc07c',
+        'lan_lancheck.php' => '7615ba9c34ea6b3b5867d27e834acb54',
+        'lan_language.php' => 'fdc99671777e203514aae7f52939d561',
+        'lan_links.php' => '07972ca8826ee35f36ef825ff793a991',
+        'lan_mailout.php' => 'bf59b50787dae47c9db0603ba86e169d',
         'lan_menus.php' => 'aff6368b11b30bea0515de7cbad89dde',
         'lan_message.php' => 'bcfd03068e0ee9d76eb1a3df969bb544',
-        'lan_meta.php' => '4c728ceb9da11d2d978996864fd2dcae',
+        'lan_meta.php' => '31801b3e9c137a3b22d58e5d80d291c8',
         'lan_modcomment.php' => '7f8738c7c0b3ab882f4b9c330136b6b3',
-        'lan_newspost.php' => 'a1b7c0f9b245ad636cfe55e27f39c93e',
-        'lan_notify.php' => '5b7d241419a114a1c4c6b521c8ddb6a6',
-        'lan_plugin.php' => '722997f6a14965debe3dd45b232d40d4',
-        'lan_prefs.php' => '8d1d6dbd9a9b082407bd7bd852dff467',
-        'lan_review.php' => '36820722f27e35f1fe10edf238a13d93',
-        'lan_search.php' => '1d7b01d67674e832a8e9dcea6354f070',
-        'lan_theme.php' => 'a3c60a804c469c6ff4b4cb7d3019d981',
+        'lan_newspost.php' => '0868c7b3d37352144cf2d424d97e8670',
+        'lan_notify.php' => '65a1a5a108c74ba8b2db5592c06a1ecd',
+        'lan_plugin.php' => '29ced1cfb16745f64bbbce037b8d74ba',
+        'lan_prefs.php' => '08bc01aee9d766842262e2a158c31010',
+        'lan_search.php' => '039a04acb5ab8b3ef5b617e1c1fcf7bc',
+        'lan_theme.php' => '20dab981133d2106e89afe3f14169166',
         'lan_ugflag.php' => '29f0ad8c752be1bf98cc067534994711',
-        'lan_updateadmin.php' => '90de3118181658a108f2eac6cfbb2653',
-        'lan_upload.php' => '577fb53d82b6e29ac3e2bff5b55c5c09',
+        'lan_updateadmin.php' => 'ae3d2be7d92db3c4dd11f1e73fafeb7b',
+        'lan_upload.php' => '5a01a0c1676c4b21551ce427866edfe7',
         'lan_userclass.php' => '3eedcbd961e57434d6c64f9321fddb59',
         'lan_userclass2.php' => 'e475c31e99b4867d9517705b584f5a44',
-        'lan_userinfo.php' => '552f616f3a00b66bc9d84aebdbe9f67e',
-        'lan_users.php' => '7050bec07b31ac1ff5381f0797e7e29d',
-        'lan_users_extended.php' => '0fe22677f5bad397e4ddba55bfd33e45',
+        'lan_userinfo.php' => '241d3c717696a30d97152aec8f5fcdf2',
+        'lan_users.php' => 'cc6c5b0856d4fb77f6c9cd1f31005e8c',
+        'lan_users_extended.php' => '9ae08fd0f346cf0319dc935c992f1036',
         'lan_wmessage.php' => '27b96105500cdfa56bc27e391a0c2f3b',
       ),
-      'English.php' => '6b371cd4820cff8bd7bfb10ee1c108f3',
-      'lan_banner.php' => 'f368fb53095c72c2add3e25381461f42',
-      'lan_comment.php' => '727a9fdff69ceace66d83b6e1a5afb62',
-      'lan_contact.php' => '379a67e389bbf65da7010949fec363bb',
+      'English.php' => '92d7499a17a92e1c3259e5ed3dc61444',
+      'lan_banner.php' => '92308af6029553992ebc4a46e97d4e1d',
+      'lan_comment.php' => '19332dfe1a3261c78e7e67dfdf984017',
+      'lan_contact.php' => 'f6ec02eb9a5effc567f8483071105e66',
       'lan_date.php' => 'af33dd14b696babe19fd09e386c200c5',
-      'lan_download.php' => '0acfd66fa377474e976ccf10d9c22aaa',
-      'lan_email.php' => '9fabaac260391fdaf100a0ede907afbc',
-      'lan_equery_secure.php' => '100577fabcdfa3adbe3db5b88eef2baf',
-      'lan_error.php' => '63da78f2e07d86d31497622ec33dcd69',
-      'lan_fpw.php' => '45fc83d63ffeb54941951293bdf949ac',
-      'lan_installer.php' => 'b5538528ec8e52c5094083adc12137d5',
-      'lan_links.php' => '6d9d4ecbac849a6143e31290fe3fb9e3',
+      'lan_download.php' => 'a66ac115b0016fda2c45091353e59890',
+      'lan_email.php' => '797f6f5e516475e8202fc171997ebdf1',
+      'lan_equery_secure.php' => '90ce9b58fa3ee0bc424dc9eab0a9b92e',
+      'lan_error.php' => 'e63c154a52b72318443b0044d48ef9dd',
+      'lan_fpw.php' => '85470fb3dad6d9f765fe366f49e045eb',
+      'lan_installer.php' => '81560fd3264c885295b060968a6d0570',
+      'lan_links.php' => 'c309a9bc93d06a914bdc735efc9190cb',
       'lan_login.php' => '3bf7ecb7c00be86b54c83370fab6f8c6',
-      'lan_mail_handler.php' => '0626917dd76f86f168c4f3651d86fc73',
+      'lan_mail_handler.php' => '001b336311279c058df01c2ae04aa87d',
       'lan_membersonly.php' => '102bba47b482668bb433a5a607767bae',
-      'lan_news.php' => '12d36bb089b37e5391299f1bcd1a1d37',
+      'lan_news.php' => 'c3d990cb42ba5d40c6eaf915f6122448',
       'lan_newspost.php' => '03cca3bd4c3553accde4fe1b2bb9856a',
       'lan_notify.php' => 'f930fc0c3afd1516e3b63f63f6f51e16',
       'lan_np.php' => '3d6c87e7ffeaa79de1ba06da0175f367',
       'lan_online.php' => 'cf15db263203fc5cca674ac1e03923bd',
-      'lan_page.php' => '70979edfe7a243daed3a9c08e22bb6c8',
-      'lan_parser_functions.php' => 'dde30f3b797b4ccb08bfe30a5a8514a2',
+      'lan_page.php' => '3c9c8e02259f7833670d198d02ab0a94',
+      'lan_parser_functions.php' => '54fe2858faa02517a93c293ce176571e',
       'lan_prefs.php' => '0520bc45182553a3f44b88c51b5377f7',
-      'lan_print.php' => 'dd0d99919bf9bc77f3a3f5079e9451f5',
+      'lan_print.php' => '8a3e985622e8dfcc82487b0165c2bf3a',
       'lan_rate.php' => '02191b8a77011476d4e3e554387c01d5',
-      'lan_ren_help.php' => '500673591ea1c30f523a557d538ee0fd',
-      'lan_request.php' => '023a40948ec32b3359e9a5bae2b04f71',
+      'lan_ren_help.php' => '1ca40febf5f376f3dd7190f46cd26f02',
       'lan_search.php' => '01bed4f43957214885351de0d18e0e5c',
-      'lan_signup.php' => '7e1c2115398db73db3656e2b97b466a1',
-      'lan_sitedown.php' => '8c2fc61c6fa1e8e9f0316c780df45639',
-      'lan_sitelinks.php' => '08f8cb9f24cff0e44b778fcf3c80986f',
-      'lan_subcontent.php' => '8307d6e57a66ad7df8a57777c1fdcb36',
-      'lan_submitnews.php' => 'dad73b4f3761044cf03a236386b343fa',
+      'lan_signup.php' => 'bba7802c9f6fa2a5d6c3a179e7b88fec',
+      'lan_sitedown.php' => '65c55fc812ceff72c4aba3f56dbaf4cc',
+      'lan_sitelinks.php' => 'ca292ed1c514df28d693b3e8cdc6baec',
+      'lan_submitnews.php' => 'ca6c4a8e2828f6317e56a8e4bff34d2a',
       'lan_top.php' => 'eaf2c17d7c6e40e4e660e9a6dea851a1',
       'lan_upload.php' => '52254da910f370cf89a14c080516e7fb',
       'lan_upload_handler.php' => 'f61e83d33b48733bbf58c4189103b0bc',
-      'lan_user.php' => '59b116f5a1184efb7cbcd962bb1b1f2c',
+      'lan_user.php' => '992526de41f3848bcbcfb1134449522d',
       'lan_user_extended.php' => '890b9ce3e1cebdc59d098a3465f7d151',
       'lan_user_select.php' => '5632220cb249c60e812c3592f086039c',
-      'lan_userclass.php' => '878d0e56e32c03a7ffbd923dd0efe591',
+      'lan_userclass.php' => 'be226be048b076da4873e6d23b9b6b77',
       'lan_userposts.php' => '976fa5108d96acf116bbd177d9b0f38a',
       'lan_usersettings.php' => '76e37338a24462d18e3d405d70351913',
     ),
@@ -1299,7 +1320,7 @@
   array (
     'admin_menu' => 
     array (
-      'admin_menu.php' => '6a22c61a493644b9288a9db4c702c447',
+      'admin_menu.php' => '12f13f429b068399d2aad7270c07a5c9',
     ),
     'alt_auth' => 
     array (
@@ -1311,30 +1332,34 @@
       array (
         'English' => 
         array (
-          'lan_alt_auth_conf.php' => '8f2bff2df6eb9c8fc46f1c181f4baecb',
-          'lan_ldap_auth.php' => '8553f2510a8f44e048e75b0caad969f6',
+          'lan_alt_auth_conf.php' => '012604e8400b5dfce4a4d95086152ac2',
+          'lan_ldap_auth.php' => '1fec91ecfe7419204ef65af051a249bd',
+          'lan_otherdb_auth.php' => '11309b4fe52763d7d28f94df64001016',
         ),
       ),
-      'alt_auth_conf.php' => 'ed72f592d53b7fcbea3beb28a284cfbe',
-      'alt_auth_login_class.php' => 'd9d25ea7809bd6dca736e56088eb0655',
+      'alt_auth_adminmenu.php' => '3dddfee80a662a804a06d833ad9d2670',
+      'alt_auth_conf.php' => '1aedac47a6220c61425f89a96fc766b0',
+      'alt_auth_login_class.php' => '0d10f8eab79b15e28effa341aa6b6cea',
       'alt_auth_readme.txt' => '75b056df0169fa9a03bb31633d7fcbdb',
-      'alt_login_class.php' => '4b0323c7f6c566b76b50d9748a77d568',
-      'ldap_auth.php' => 'b169f366bcc3984996b13c4d309a8807',
-      'ldap_conf.php' => 'ac204d3f754c57f88c6cc75d4081dbc4',
-      'plugin.php' => '6a30244d4c83044092a65d43d285219d',
+      'alt_login_class.php' => '343de18d3ab651476e092c72d484ae41',
+      'ldap_auth.php' => '4d740c0d4ba51a7a8437df5fd6de3b85',
+      'ldap_conf.php' => '32f0718c8d2a6aa7f8d7b378ac0f371a',
+      'otherdb_auth.php' => '868524702a10c3046d7822b463f82477',
+      'otherdb_conf.php' => '7871556c81544d7373f2adb7e49414f5',
+      'plugin.php' => '918fb0e07512efb82b6cecb01c566ba3',
     ),
     'alt_news' => 
     array (
-      'alt_news.php' => 'c32d87e2229fdf2c5f473d970abd2c8a',
+      'alt_news.php' => '67c4b14229bbb94f1ded6214e89216f1',
     ),
     'banner_menu' => 
     array (
       'languages' => 
       array (
-        'English.php' => 'db2fd1a909893d6476bfeaf2324003f8',
+        'English.php' => '34df03d8f502238bd6f3c8102f1fc399',
       ),
-      'banner_menu.php' => '325dda23599d1b5f4ddade2c46729e29',
-      'config.php' => '0ddb8ce25fa975b2c3f7eed157e1b52a',
+      'banner_menu.php' => 'ba985aea9cf61edb441b9f2e73ad45cf',
+      'config.php' => '91398fb8db5e565e0659790796de8860',
     ),
     'blogcalendar_menu' => 
     array (
@@ -1342,12 +1367,12 @@
       array (
         'English.php' => 'bc4d844c9b0b8bb553913eb462542620',
       ),
-      'archive.php' => '620cc5c929bbf23b3c7ade778fedc187',
+      'archive.php' => '8fbd24eafa2349e682fffcbcdfbddbc1',
       'blogcalendar_menu.php' => '512b4589bee3e51d54dffa57dd2347a0',
       'calendar.php' => '4c05e65f098d38d7ed84783a479d999e',
       'config.php' => '8bf4ecf1ebf7b0a2628081ebdee358bb',
       'functions.php' => 'f2cf77b89db87b5ac5d2a3935fd4ac59',
-      'styles.php' => '4bf2fa9fb79e56287fff569b7c31863c',
+      'styles.php' => '44147a6b0a19c0228b6639ece5d79733',
     ),
     'calendar_menu' => 
     array (
@@ -1386,28 +1411,35 @@
       ),
       'languages' => 
       array (
-        'English.php' => '3747bacde1503ef43529d8cf9d8370f4',
+        'English.php' => '158355ab3a26f8c709126af50bbd4000',
         'English_search.php' => 'fc1f68851e4c41b94e1bf1fcf9c25e10',
       ),
+      'log' => 
+      array (
+        'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
+      ),
       'search' => 
       array (
         'search_parser.php' => '05b18b0087a2816766543bce7da0b5b1',
       ),
-      'admin_config.php' => '092621473e4b8a45ce06615b3d94e554',
-      'calendar.php' => 'd97c7ede21d006635979a6cd9a328c2d',
-      'calendar_menu.crc.gz' => '90580c372c43234e82c73fe1687611d4',
-      'calendar_menu.php' => 'cd9f210de6b276083be87d604f9c2bb6',
-      'calendar_shortcodes.php' => '4f8f68728525f242a092d8fc86a2443f',
-      'calendar_sql.php' => 'fa11dd0f013775a997f8707aa6d45e87',
-      'calendar_template.php' => 'ddbbcd09d6440c66574b0a27a2a2ea60',
-      'config.php' => '401d559f53265f4b1778701b8e9dd512',
-      'e_list.php' => '78ce81c90bb8ba76439742d32f15ab89',
+      'admin_config.php' => '1c338819605771130c4becf79f05cf06',
+      'calendar.php' => 'cd96dede903591eb4e609ae9b1aea129',
+      'calendar_menu.php' => '1cef409ba6b91f87b2c7361b9f3f5d7e',
+      'calendar_shortcodes.php' => '902d42e033e1d4ea3d1424be96f249d7',
+      'calendar_sql.php' => '39899457df794d8b56c58d3b1c8db88e',
+      'calendar_template.php' => 'd852ceef7f6c8c10c5b10db571e16ccb',
+      'e_list.php' => 'bc86836aabe7f01b4285d512a3079e9e',
+      'e_notify.php' => '4c206cee17bed1c6b02f66fe202252f5',
+      'e_rss.php' => '077b415bf70aaae7b8de3d55a5912632',
       'e_search.php' => 'a1681c6fed9972dd140b72b3ebfbd3c8',
-      'event.php' => '8b359632c9f4efaacfa5f4cb3e77e11a',
-      'plugin.php' => '81812c4090fc5db132f65344c5972305',
-      'readme.rtf' => '47f6de1137030fe2efde782133ab725f',
-      'subs_menu.php' => '678ea436a9d23447ca6b76e9ecd8ae00',
-      'subscribe.php' => '6cab22ea5d89164d89c0a9b9052daae2',
+      'ecal_class.php' => '8aca3973a9722d4e29aabcf54b488c99',
+      'event.php' => '5edb018949600600fe3769e6507f4704',
+      'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
+      'next_event_menu.php' => '6d1819f703dc045efa0fd1a4041e6545',
+      'plugin.php' => '7e5ed3e5d637ff6239c0e7ed8ec84e35',
+      'readme.pdf' => 'bde9420355a7306b71df8c5143575347',
+      'subs_menu.php' => '816619639ab421ff3229f6536bb33416',
+      'subscribe.php' => 'a7e9baffa5250f183edcc3449a0b0bfa',
     ),
     'chatbox_menu' => 
     array (
@@ -1421,7 +1453,7 @@
       array (
         'English' => 
         array (
-          'English.php' => '20c22f46f54d574566ca5b7e02809b5b',
+          'English.php' => 'f7161fde06c16b7a4c08311f6d6c1f98',
           'English_config.php' => '9adc5ef167b75da9ea343a3f0b1e07a7',
           'lan_chatbox_search.php' => 'cfe3e4e7191917199b79c85ae8b9f018',
         ),
@@ -1431,16 +1463,17 @@
         'search_advanced.php' => 'b7a8eab8e5969256ab578277c92d3c47',
         'search_parser.php' => 'c576ea7d07ce91c106c3bae38912237c',
       ),
-      'admin_chatbox.php' => 'd1ba373a0b5e884bbdd46db7690ea54d',
-      'chat.php' => 'fffbc7b9c603acd334ba5c34e50e44c3',
+      'admin_chatbox.php' => '75780140254afd39349fe286a5c72669',
+      'chat.php' => '860bf5dbfc5f861df1f74f0c944e6957',
       'chat_template.php' => 'cf97b7663cd4177f9c7ac299318ef8e5',
-      'chatbox_menu.php' => '66faf713ac200d01ba8397ef9f0dc9da',
+      'chatbox_menu.php' => '350f84c6d36f7ba4b8ac6e7edf3d3280',
       'chatbox_sql.php' => 'aeb0d501ff23212e304f7f9a83d6926d',
       'e_list.php' => '11fde3fe8b58bec52bc6220053498509',
       'e_notify.php' => '379fbef832829bc4e9188b9fed62f31f',
+      'e_rss.php' => 'e48224955d484055c9c662f430d529ae',
       'e_search.php' => '172e48694433f84b0f8d43ffb880e881',
       'e_status.php' => 'd5fbab54f8fcb5ec5eaa42c1b328cf6a',
-      'plugin.php' => 'ecfb4e0f38b4c6db5a73214ae4f83f1f',
+      'plugin.php' => 'e5cdb4f2a42dc00b08d06b33dea455ed',
     ),
     'clock_menu' => 
     array (
@@ -1448,7 +1481,7 @@
       array (
         'admin' => 
         array (
-          'English.php' => '20d51f72c8ec0b6e93c567cd9d10c126',
+          'English.php' => 'bb111f81956918d1a7e7875a032e521f',
         ),
         'English.php' => 'a6414a6871116b964cc12d77d72b2748',
       ),
@@ -1460,10 +1493,12 @@
     array (
       'languages' => 
       array (
-        'English.php' => 'a43ede27d8ec0e05536c240d3416bfc3',
+        'English.php' => '10c5f9fd588de9eaa9bf96b42b11b535',
       ),
-      'comment_menu.php' => '337fd74d3bc93f8d18c614124ed58ac6',
-      'config.php' => '6e3c630d6ed02fdef574240c60a6da38',
+      'comment_menu.php' => 'd3991926641aecf015f1acd6a3baeda6',
+      'comment_menu_shortcodes.php' => '4c212b7efffa496ec8b5280528d46259',
+      'comment_menu_template.php' => '17f0cb0b44f43d0cf62770f2b7cb4526',
+      'config.php' => 'd8e5bd9258392c98d02009d552401aa4',
     ),
     'compliance_menu' => 
     array (
@@ -1476,18 +1511,18 @@
       array (
         'English.php' => 'fa122fc7d21d653f3bea9f1a790cb173',
       ),
-      'compliance_menu.php' => '9e54deeb24e38ca243c298bb3249563b',
+      'compliance_menu.php' => '4d0b73ff1df3ee7003286d61ad443478',
     ),
     'content' => 
     array (
       'handlers' => 
       array (
-        'content_class.php' => '6496925bf94c71a30b5a4be0226733ed',
-        'content_convert_class.php' => 'ed330381ff2075bb93ef57ae9504ce64',
-        'content_db_class.php' => 'a4ce3f5843d957eac2492f2080ff3efd',
-        'content_defines.php' => 'ed3202f3e12291f5c9d04445496670f0',
-        'content_form_class.php' => '113d385383c4d9078409ae1913b4d0d7',
-        'content_preset.php' => 'f98e2a3c015ed9481518c6dd4b93b826',
+        'content_class.php' => '596da39e8137e9a92c93425abc2623c4',
+        'content_convert_class.php' => '2e05d94418f8960eaac431741ce402a1',
+        'content_db_class.php' => '1029aa4c0652a3d846592b4494c8e7a4',
+        'content_defines.php' => '784711a6c68dc17c7752fb084400229c',
+        'content_form_class.php' => '64e3e202792d28b837e2a86fc953fde6',
+        'content_preset.php' => 'd3bccd4ed8b20426222fadbeb6063cba',
       ),
       'images' => 
       array (
@@ -1552,10 +1587,11 @@
         'manager_48.png' => '3fd9a284f7d0d446ab430ccd4ef550dd',
         'ok_16.png' => '2a65610ea93831bfb0ad07e77fd2e488',
         'personal.png' => 'd1e39d963741e12edb0ed6261d72ace4',
-        'redo.png' => 'df3dd61d416b00c26d3cbcdf02e862b4',
         'score.png' => 'c368fe32f78a4ce09298b0c94f5fa89e',
         'score_empty.png' => '9cd759fdab39278d2fa4242c15d88871',
         'score_end.png' => 'e075b96122cb84dd7bb9d0ce8c789e84',
+        'submit_16.png' => '90ec380e9ae114719e11f1332a89eefb',
+        'submit_32.png' => 'df3dd61d416b00c26d3cbcdf02e862b4',
         'view_remove.png' => '084a9efcb11ca37426fbdae4fbeb0875',
         'warning_16.png' => '10b4bdba8f5f7d7598822219123e7792',
         'window_new.png' => '2bbce24fe15c0144cd225856ee0a990f',
@@ -1564,11 +1600,11 @@
       array (
         'English' => 
         array (
-          'lan_content.php' => '8e6a7ed4b2cc0bb4da88a04bcf5859ce',
-          'lan_content_admin.php' => '35ada311323c900996c72fdda7a37ce1',
+          'lan_content.php' => '45d9ccc1d7a7d16b0332d5a0049bb836',
+          'lan_content_admin.php' => '856dfef2e8887b83040ccbb5b33f088a',
           'lan_content_frontpage.php' => '1593838cd7ec925d50576a815bd3c9ee',
-          'lan_content_help.php' => '54ede5c5383dfce958f82f1bf57a16ab',
-          'lan_content_search.php' => '2e8fda0d060eaa6e1d5bd76361978935',
+          'lan_content_help.php' => 'd7cea6d1b8db2650fce4962ddfcd295d',
+          'lan_content_search.php' => '2b479bcefdb3b45f19c93ea5ae6bd221',
         ),
       ),
       'menus' => 
@@ -1579,47 +1615,51 @@
       array (
         'search_advanced.php' => 'c6c6ae35cd1020d27a861ac693347560',
         'search_comments.php' => '34b14edbe1d2e8fbac541dc03262b21d',
-        'search_parser.php' => 'a11c4d73227f733c320333da4b0a49f2',
+        'search_parser.php' => '279e6a587720b6686f7f71d847f54f35',
       ),
       'templates' => 
       array (
         'default' => 
         array (
-          'content_archive_template.php' => 'cd9ffa256885c44e9b9f9b744ab1b359',
-          'content_author_template.php' => 'ca52482a2cce64b649978112f6313847',
-          'content_cat_template.php' => 'bcd0114c7f3d36d207d4b4b83ee72b10',
-          'content_content_template.php' => 'd601c1371ff816e49f649410f041b4b2',
-          'content_content_template_bigtext.php' => 'cabac0439d0456b36c5c870fdd441c25',
-          'content_content_template_blackonwhite.php' => '06be15b768d287529b040915a0ffd489',
-          'content_content_template_whiteonblack.php' => 'fc89c26d0a7004f096240d3284f3ad43',
-          'content_recent_template.php' => '56343e014f6ccba20e30781004507766',
-          'content_score_template.php' => 'c17825d54f57b868b7f80fe25ed268e5',
-          'content_search_template.php' => '07c629ee2b5d37c9508fd8c1d6c6ca6c',
-          'content_searchresult_template.php' => '12dc90cd6c1b8e44056a5a61831c2b39',
-          'content_top_template.php' => '25870f37db1b2a68a1683c17d8a4fed2',
-        ),
-        'content_manager_template.php' => 'd9b35da970607141a38d18fd7fe3acd3',
-        'content_submit_type_template.php' => 'fab837ae4c5b4f082b35493a09130800',
-        'content_type_template.php' => 'cd9c8ef95bba36acdc326724926d2d76',
+          'content_archive_template.php' => '62bb9c57b8d97b412d589cac9bf201e1',
+          'content_author_template.php' => '2f6f195b33d930334ae20cc60b8ebbcd',
+          'content_cat_template.php' => '5470141c7a45562e154813450ce2c5c6',
+          'content_content_template.php' => 'bc29f18104b597287e028b812651461c',
+          '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_score_template.php' => '4272ddd2bfeb3698a88876411eab716c',
+          'content_search_template.php' => '30e7bf5ba4a25ab6f1eca9b522e75597',
+          'content_searchresult_template.php' => 'ea466f98d73a18d1e727fb3b4708a678',
+          'content_top_template.php' => '662e5228f88cb2486ca305da0828e617',
+        ),
+        'content_manager_template.php' => '6ab7ef97e7f4312f64766097aa9f0fc1',
+        'content_submit_type_template.php' => '7b02354f168c4584ddd25ae8cca95977',
+        'content_type_template.php' => '09a3aaa479ecd0a50055998fc18b7110',
       ),
-      'admin_content_config.php' => '78b5e01b64f2dab4608737931d035c45',
+      'admin_content_config.php' => 'eadd444a88a1942065596ec5d710abde',
       'content.js' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'content.php' => 'a98d9c363fdb48ad0c31be4480082863',
-      'content_manager.php' => '24750433a9d5223d9d4cde2725a2a210',
-      'content_shortcodes.php' => 'add55e11663117ff37ce30c0513929b7',
+      'content.php' => 'f714bcd07b21c334ecbc143c6361d17e',
+      'content_manager.php' => '2ca76d9420ea8c40d91fa410f099e19b',
+      'content_shortcodes.php' => '6eec7325d2ccaabafa89f0f76ac91a78',
       'content_sql.php' => '2632a603dd04ed62bbb3f011d3c5de41',
-      'content_submit.php' => '7e44ceadb92a89b648467c7f77febcd7',
-      'content_update.php' => 'd9045747f69c528e6c5f7fd0cc4e8fa4',
-      'content_update_check.php' => '1719e04046a4fc4c7adbae301d61ec42',
-      'e_comment.php' => 'd4da90b94c8ed7f471b6223b872328f3',
-      'e_emailprint.php' => '4ba168a80c544e6af9114782fafa11cc',
+      'content_submit.php' => '00b3c60d1ef87219af86ab253dc732d4',
+      'content_update.php' => '3820d50a8de13fe523bc58e949229e67',
+      'content_update_check.php' => '83b6aa48eb79b70555f5d2d578baa07d',
+      'e_comment.php' => 'e5a8abcc72deaf2fe9c0a8b5eb4887ea',
+      'e_emailprint.php' => '48572a480656347a64798b024168a7f1',
       'e_frontpage.php' => '4fee2ac77b9c66c1d5b760b95e6ea255',
-      'e_latest.php' => '9e3bf7aa8789693352a9a0644b21a2a7',
-      'e_list.php' => '5154b5a3b1df0b3fc234b92b79ade4e3',
+      'e_latest.php' => 'a2ddba2f8b0e67309960926086a0c985',
+      'e_list.php' => '07f0e1369439b9927ac11d48b6deeb06',
+      'e_meta.php' => 'cbb645eebdedb216511c413fe64991a8',
+      'e_notify.php' => '71dceb8ed800b8aa97dbc7a79628a8a5',
+      'e_rss.php' => '76954b881d598f26ecaebb4422f87696',
       'e_search.php' => 'd86c2f562c466bd7200974bd16f07c45',
       'e_status.php' => 'e327fef8f0ea1ad19fe9579b4f2ebe91',
-      'help.php' => '0469e11aa5659088da95fbf0c5b5a3cd',
-      'plugin.php' => '6c59934808bd3f955fb45146f57a2111',
+      'help.php' => '950985bb6c445147d901bb4fb00b0f1d',
+      'plugin.php' => 'cfb9004ff38e24cb87370ceb9017867f',
     ),
     'counter_menu' => 
     array (
@@ -1646,8 +1686,9 @@
         'default.php' => '4ae642d4bfc6b53350d75197182330f7',
       ),
       'admin_config.php' => '61506bca5d21856190eb627f4b603975',
+      'e_rss.php' => 'e3b277cca6f5262dcee948434aacfc5e',
       'featurebox.php' => '196e5d4286ac7b19cfa34e66ec382979',
-      'plugin.php' => '7b085870cccdaacc812417ec724702e9',
+      'plugin.php' => '39f2a1375fe640e6cda8347ff7ab8de3',
     ),
     'forum' => 
     array (
@@ -1655,6 +1696,11 @@
       array (
         'dark' => 
         array (
+          'English_admin.png' => '5fed0ae458f2100bfed0ffc655d1c1ce',
+          'English_main_admin.png' => '1b3ec206bc4a6daabc970c231e148f16',
+          'English_moderator.png' => '99b9bbef0e3440071ff394422819ea69',
+          'English_newthread.png' => '64283f117398e1709a6aca23eba96c5c',
+          'English_reply.png' => '6a07036cf75d4acf1e4126371998baf8',
           'admin.png' => '5fed0ae458f2100bfed0ffc655d1c1ce',
           'admin_block.png' => '53b924444c2bb9e082d47429244a375a',
           'admin_delete.png' => '21c3e43917c10a029527d768ba059951',
@@ -1702,6 +1748,11 @@
         ),
         'lite' => 
         array (
+          'English_admin.png' => '5fed0ae458f2100bfed0ffc655d1c1ce',
+          'English_main_admin.png' => '1b3ec206bc4a6daabc970c231e148f16',
+          'English_moderator.png' => '99b9bbef0e3440071ff394422819ea69',
+          'English_newthread.png' => 'eb68d1b9677fca9c32c556e050e4f20c',
+          'English_reply.png' => '58e4791eb2d8b5712b859639a0eb5320',
           'admin.png' => '5fed0ae458f2100bfed0ffc655d1c1ce',
           'admin_block.png' => 'e861b2014ffa66b391e3e4152278ec78',
           'admin_delete.png' => 'a8aca6d9512cdf1f18f98a324fc63fb1',
@@ -1759,58 +1810,59 @@
         'English' => 
         array (
           'lan_forum.php' => '8496b78042381e1eb0e55919386b1261',
-          'lan_forum_admin.php' => '4ed4ef8c58138b60b616be5b8c4f74b1',
-          'lan_forum_conf.php' => '32ba5f6f5d5dd8d658cd6fdc056866bc',
+          'lan_forum_admin.php' => '796328f81eb77d6c218ad978e83911b9',
+          'lan_forum_conf.php' => '44f0d7ca6da7d71004e1acd9c1f04f70',
           'lan_forum_frontpage.php' => '5ac941c384cf10a76b6ab040f7ee7986',
-          'lan_forum_post.php' => 'fa12b450ef72c74fd3c4ac2c199911dd',
+          'lan_forum_post.php' => 'd92f497d14b273b09d3f6e1c3dffea21',
           'lan_forum_search.php' => 'dd1263ff01cf0b71991de16756677f68',
           'lan_forum_stats.php' => 'ecccb2b57c568336e5b1accfa29ad08b',
           'lan_forum_uploads.php' => '840b741edd3f2d8fcc340b29804689b5',
           'lan_forum_viewforum.php' => '7b44a441080e2b1a40b8c37944d9a719',
-          'lan_forum_viewtopic.php' => 'b883f51cb8f12e35a9e5970c3a85a2fb',
+          'lan_forum_viewtopic.php' => '867fb663d2d3cff381f01f08db23de98',
           'lan_newforumposts_menu.php' => 'affcfab7c6a7dfa7ba9fd1c134075919',
         ),
       ),
       'search' => 
       array (
         'search_advanced.php' => '32a26ccc8c2be60abca8ba2930ba329e',
-        'search_parser.php' => 'd0a93b2530bff2c6781bd4470885e25c',
+        'search_parser.php' => '3419fe985c2b08959c127b6484a487fe',
       ),
       'templates' => 
       array (
         'forum_icons_template.php' => 'ac7e8c8f02f32719f64cd5bde7ec5f20',
-        'forum_post_template.php' => 'ef65e1bc28d9b933b7f9c97726e13cb9',
-        'forum_posted_template.php' => '264f6e6349fbb05cb71016567311f97c',
-        'forum_preview_template.php' => 'd9eb3ca7d65cdd7aa65e06c6c864a461',
-        'forum_template.php' => 'b7be294e90f39ec2a81e2a437a618167',
-        'forum_viewforum_template.php' => '573605ee268d3232997043e282d66173',
-        'forum_viewtopic_template.php' => '41304790b9455e03034be5bc2efbc68b',
+        'forum_post_template.php' => 'f1017fb9b9ae6c73691d27b4da2d8cd3',
+        'forum_posted_template.php' => 'eea66e0ed7f2d2a51c5e01a07cb871aa',
+        'forum_preview_template.php' => '11b636f1bcccded162fcf42880df5b5d',
+        'forum_template.php' => '725a50b55d6e76a9844821992601aa67',
+        'forum_viewforum_template.php' => '004aacb79877ac05b538d320c8294b85',
+        'forum_viewtopic_template.php' => '57b91f8b3ad09f48010d4d4958623f26',
       ),
-      'e_emailprint.php' => '55d52fe06f711815e068124974a1bc88',
+      'e_emailprint.php' => '8a41fe10faf7c2293a65bd66e598dd82',
       'e_frontpage.php' => 'c939394e051b055ccbc963d17b1a1d46',
-      'e_latest.php' => '159be5c83e5b0707bb96682ddaa3c766',
+      'e_latest.php' => 'ba485c38b9ab90c0f572a2397b49c9f5',
       'e_linkgen.php' => 'e0cdc0183ce0cf9adbbec54271c55766',
       'e_list.php' => '523f01012192923c6901b7c088101ec0',
+      'e_rss.php' => '2d0f0839621d9d4539895e2047a76476',
       'e_search.php' => '663a93cb1f0d05351ecbb85a3bf721d4',
       'e_status.php' => 'e707e64a960612d443e16906faaf0e22',
-      'forum.php' => 'dacf83d1d260d91a331f2770fc71f1e9',
-      'forum_admin.php' => '612f96376fcfdeed0ee72da4b7f85a04',
-      'forum_class.php' => '9e8df8c2e6973bfdedec78cb36c1c0ea',
+      'forum.php' => '35a1744e058ca88ee47e966088ac1923',
+      'forum_admin.php' => '741d27d12226bc98e4576697f4b97efc',
+      'forum_class.php' => 'cec775f3d1561a4262c76c438c02de69',
       'forum_conf.php' => 'a4a4e140bda4b3d7cd73abd03170dc5b',
       'forum_mod.php' => 'bc6667cba8050bd3a2c015dea9bcd730',
-      'forum_post.php' => '1233f70ad65e99cd86b125e969ba2f76',
-      'forum_post_shortcodes.php' => 'e7c237cf147aab58a54749ac00a27feb',
-      'forum_shortcodes.php' => 'd0505d0b22fd35160ec836904ac76818',
+      'forum_post.php' => 'd651a56661feb695867f8b914e2ed5d0',
+      'forum_post_shortcodes.php' => '1b976852110cac3652082c43777e3dc3',
+      'forum_shortcodes.php' => '06545816dec1484394144caeffb71a39',
       'forum_sql.php' => '3355b8219c200d8d669ce08e59053465',
-      'forum_stats.php' => '1f70aa406da53b7c3e0214878d8dd846',
+      'forum_stats.php' => '9906e300c4764aa55e54d745ff3bc471',
       'forum_test.php' => 'ed668e3268952cb268b3f4aca0d2e37a',
       'forum_update.php' => '8e1fed1bae66e84eb3ad0235a60f0c69',
       'forum_update_check.php' => '95b6355554098357b5648807c4e95705',
-      'forum_uploads.php' => '2dfce0029f51c1197e55cd18cb53dad4',
-      'forum_viewforum.php' => '73f11856662490d121c779d610892583',
-      'forum_viewtopic.php' => '7ac96c6a5ac29de83e173488e8ae08e6',
+      'forum_uploads.php' => '3ae344a843771d9ee6e578a1ddd84f8c',
+      'forum_viewforum.php' => '53b717a8e1515fde643c25b89ae92e25',
+      'forum_viewtopic.php' => 'ab460e959ba4523374375e92abebb874',
       'index.php' => '1d225ecdb6dfb425fcdd39501ed196c7',
-      'newforumposts_menu.php' => '6e2dc06b647f2e235cd36a27662a63b4',
+      'newforumposts_menu.php' => '294da398e0ec6c0114c8d41e203cd411',
       'newforumposts_menu_config.php' => '8c7c855777e097fe6b8d92f9ef4e527b',
       'plugin.php' => '871a97116e50c74039db5f2e3c96d040',
     ),
@@ -1825,8 +1877,9 @@
       array (
         'gsitemap_English.php' => '350d69eb976b596ee599530d5e6bff1c',
       ),
-      'admin_config.php' => 'cf875690da2b4097df1705ddba81b5a5',
-      'plugin.php' => 'eff600c64547e834e39581ed332532c5',
+      'admin_config.php' => '4a582593a83c6353f6b2c49371623301',
+      'gsitemap_sql.php' => '81a34608c8cdd19c51fece5a25109159',
+      'plugin.php' => 'c88f725348400384ef5721432e9ad169',
     ),
     'integrity_check' => 
     array (
@@ -1838,9 +1891,9 @@
       ),
       'languages' => 
       array (
-        'English.php' => '4d5d13333a677d089aee630b8011b2d5',
+        'English.php' => 'd78c5a1f0cd1dafde8fe3bf33083db1e',
       ),
-      'admin_integrity_check.php' => '9b7d3100fff1fd1bd6103be11311a7b2',
+      'admin_integrity_check.php' => '0336e89bd0664a6e4ad9ff2c1ba9c236',
       'plugin.php' => 'b32f26e2fc819c93a60a0c53692888fa',
     ),
     'lastseen' => 
@@ -1866,7 +1919,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => '7062f642f1078e1f5719f60d9eb96198',
+        'English.php' => '2ccba0ca70987d6c5bfece279e25957f',
       ),
       'link_images' => 
       array (
@@ -1878,23 +1931,24 @@
         'search_comments.php' => '6d3c5c4d9d15e0c0adf77b859a4c054b',
         'search_parser.php' => 'ff43c05ffddd9ce508c98e913f90e167',
       ),
-      'admin_linkspage_config.php' => '7cd921cba30519a67dae69b0d1445268',
-      'e_comment.php' => '2bcc48c36166376c34cbe480227d68ac',
+      'admin_linkspage_config.php' => '5576e1a0eee8984ad5909d901e481b30',
+      'e_comment.php' => '13b0aa38e21d08a535276a7526cedde2',
       'e_frontpage.php' => '0a352c2a0b559b9d930943f1928f9d45',
       'e_latest.php' => '6ab452dd2d2d46749d5149c5fd1905fc',
       'e_list.php' => '9a49a4d6a015fb3fff2cda7a4ef788c1',
       'e_notify.php' => 'eab13b015f9b5fa679fef28f63d72dde',
+      'e_rss.php' => 'd213cc9cc0d5eeed3442b861e565961e',
       'e_search.php' => '7a7416dde4bc42481cf92431f4832b65',
-      'e_status.php' => 'c4a657008b1d7ea49d0edef4440563d2',
+      'e_status.php' => 'e1b28e610e6f89277440430a2f8747d8',
       'help.php' => 'a8495b50a8243ebbb3e37c8bcb169184',
-      'link_class.php' => '1a189cbaa50e47fe673e9b864eb82e72',
-      'link_defines.php' => '9253c337c31cdda4f08ec1bb67d714f3',
+      'link_class.php' => '54cdcb1762817c504b6d81ed7924ad96',
+      'link_defines.php' => '1c9c8a4d29cac5f35e2164805bb3eca6',
       'link_menu.php' => '20fd34d3e851223a174d56533dbb83a6',
-      'link_shortcodes.php' => 'c8a987b6a8349e27a021fb93acedc011',
-      'links.php' => 'f3f6daa320bdf1c03e08193e1964ac27',
+      'link_shortcodes.php' => '614948aa511415a9d151b16a0518c4ba',
+      'links.php' => '10d1f4b2e4ac07ad1a17c60ad5cee6a0',
       'links_page_sql.php' => 'ebe16a35037a69b93eaa929782ca66ba',
-      'links_template.php' => '8e668d23fab2e8c43d345d070523e272',
-      'plugin.php' => 'a6c6193e6a6bfe418b8357b34512a3f0',
+      'links_template.php' => 'b578512e4b94cd623ee3cfcf5d0be178',
+      'plugin.php' => 'b05df4d36293f4c2e2b949b3006cc712',
     ),
     'linkwords' => 
     array (
@@ -1908,9 +1962,9 @@
         'English.php' => 'ad0d4babe14fbc9317ba40e34833bd58',
       ),
       'admin_config.php' => '84e9d47d8301b15c0ea3e88c2d7b68dd',
-      'linkwords.php' => 'b17b3da7a73b2f57bdb8217b3e5de345',
+      'linkwords.php' => '6dbac4b16a1acaef98748f838f2fbf2e',
       'linkwords_sql.php' => '33f4d40e8da9aa758c512d4847f6d5d7',
-      'plugin.php' => 'b3aa51d59731aa11501a94e3eef99802',
+      'plugin.php' => 'cda5616cc5cdb77a82392fe4d34d3ab4',
     ),
     'list_new' => 
     array (
@@ -1935,18 +1989,18 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'c1fce345e4a870b8ad30e51c80ec2492',
+        'English.php' => '3f559f59bef22144d80b09ea599732ba',
       ),
       'section' => 
       array (
-        'list_comment.php' => '0fcb53e6d7cc7c42ac8aab846bcb0814',
+        'list_comment.php' => '5efa984e2682a3fd37cffc87d8e8f94c',
         'list_download.php' => 'd0c7e07e3fe2372c7a8eda1562793b67',
         'list_members.php' => 'e49b1b7cfad6246287a43e59f803cef3',
         'list_news.php' => '7faa1d6728ff1e692aa834ac4027c4e0',
       ),
-      'admin_list_config.php' => '9ec04080feb5ef1b47029bfb5b808704',
-      'list.php' => 'be28ee51d07fc0ce251bcf1790977c7b',
-      'list_class.php' => '4997e3eb0a75772dff50dd5b34edf071',
+      'admin_list_config.php' => '6a0ec89c7fc52da5ba7cfe7ba647d530',
+      'list.php' => '40e2923674835fe1c404219d164e7a92',
+      'list_class.php' => 'd114b0dc8172a77aea197a0d42084fa8',
       'list_new_menu.php' => 'b130b1aeb94b0c494dc77f6c58c7a19c',
       'list_recent_menu.php' => '83c2f61863857d3ce02539a668e98083',
       'list_shortcodes.php' => '1c4972d09e83f1945c6652126bba6248',
@@ -2044,21 +2098,22 @@
       array (
         'admin' => 
         array (
-          'English.php' => '21b9aaa282c9772189048a034ce8e42c',
+          'English.php' => 'a60ef592a7abd135da04b6cc482c992b',
         ),
-        'English.php' => 'dc746d72b5cd2dde3243ad4b2b3d9caf',
+        'English.php' => '583eaac1a83c65da8e8d697ea4dd8058',
       ),
       'logs' => 
       array (
         'null.txt' => 'd41d8cd98f00b204e9800998ecf8427e',
       ),
-      'admin_config.php' => '9b46de4271f0940015f4b82495104f98',
+      'admin_config.php' => '67f5b9dd7f192b2dc8ca820a348f9ba7',
       'consolidate.php' => '1a17455630a62ef78d2c14778845df31',
+      'e_meta.php' => '70eae996ff1b54a3ddc1cea0a737320b',
       'log.php' => '5ae5383b4abb6273e4d2b45850559d52',
       'log_sql.php' => '6593acd37950a8e486b0fc1490cf1750',
       'log_update.php' => '619bea78d9c76a1ec0cd4c44eeda36c5',
       'log_update_check.php' => 'f4e7f5fb3767e4c19adae8cb5e41e62c',
-      'loginfo.php' => '3b1282535cd35e446a9db66a3da29a7b',
+      'loginfo.php' => '68c8cc11daadec40bfbae1f4b9ece53a',
       'plugin.php' => 'b078f64e2aab381fb9f99a109dd96262',
       'stats.php' => 'd4d9200b6df966437eb88aefc8a8e3c3',
     ),
@@ -2066,12 +2121,12 @@
     array (
       'languages' => 
       array (
-        'English.php' => '8b3ce8f9ef0baac0b4d81d834bcc83d5',
+        'English.php' => '3be9768e81217f108c055cff9f15c8d5',
       ),
-      'config.php' => 'bdced7d579c121752bda7b68b49022a2',
-      'login_menu.php' => '1ec377498712d3c2b2da767e215dba4e',
-      'login_menu_shortcodes.php' => '1cf659be681675e4d139405b59de2b7b',
-      'login_menu_template.php' => '56bf9dfd36aa2da76027776e7125ab64',
+      'config.php' => '5f0c8229c96c4d4cf5a806bfc8d1a1c4',
+      'login_menu.php' => '5617c07086b77c79d5c1e6548928536f',
+      'login_menu_shortcodes.php' => '4232d61c5e9f401c023de6888cbe4d99',
+      'login_menu_template.php' => '88e210369bd4f7ba640e0008b274d782',
     ),
     'newforumposts_main' => 
     array (
@@ -2086,7 +2141,8 @@
         'English.php' => 'cbabc36202b6ab51003f0b859fb14598',
       ),
       'admin_config.php' => '965609648b5052dad40742d8c76b8bf9',
-      'newforumposts_main.php' => '7e3931f2c26d033a621d2d7ad770eb69',
+      'newforumposts.sc' => '92de176e2d3503f91b9389d053d34348',
+      'newforumposts_main.php' => '53e0ce09459853547bd35154e74f25e8',
       'plugin.php' => '81caf517e35d6fdb13bf56fb6ab5395e',
     ),
     'newsfeed' => 
@@ -2098,21 +2154,21 @@
       ),
       'languages' => 
       array (
-        'English.php' => '9bd834a3fad91903509381a6c85e12cc',
+        'English.php' => 'a166d6243430b0933b783255023239f8',
         'English_frontpage.php' => '6bdb1ac20906e1242f6aacc5981325ff',
       ),
       'templates' => 
       array (
-        'newsfeed_menu_template.php' => 'd8ce31013be1888f7967c071b38eb115',
-        'newsfeed_template.php' => '98c73f35ef45e68f9498fd8554dd1147',
+        'newsfeed_menu_template.php' => 'a26b82efdcad76104273e02e268bcbe2',
+        'newsfeed_template.php' => '5a1b8f38599596ff798b4df30873720f',
       ),
-      'admin_config.php' => '599f4a9b2a97d27b9a3b70a29a73d6b6',
+      'admin_config.php' => '67d91a9c29acd1f52b4f12d36b3099e1',
       'e_frontpage.php' => '2a8967b05bef4a2eb6b771ca44e6bf01',
       'help.php' => '7942458e34eb69cdad92cc7d9454f626',
-      'newsfeed.php' => '6c6a2bb8c8988381928da7a4d891b649',
-      'newsfeed_functions.php' => '0057350da7e9bba58dff2ea9843d0287',
+      'newsfeed.php' => 'b822c0fa9ace6409cef05d73eeae3ff5',
+      'newsfeed_functions.php' => 'a06e7301f737550e69d18c85dc1a3153',
       'newsfeed_menu.php' => '4ab274b2b3dde37f3807457aaeead9d9',
-      'plugin.php' => 'a69fc82ac1c09ad35a0d121b01c05d3c',
+      'plugin.php' => '9518316c3bbd37326a4c1383ae1d550d',
     ),
     'newsletter' => 
     array (
@@ -2123,11 +2179,11 @@
       ),
       'languages' => 
       array (
-        'English.php' => '1671d084b90252937805e6b94e6b1e37',
+        'English.php' => '5fe08735f2bf070770827d051fcd69cd',
       ),
-      'admin_config.php' => '5136a3cfa9a048e04c0478d00c46a6e1',
+      'admin_config.php' => 'c6e4733cffed8bac3cbc27115476404e',
       'newsletter_menu.php' => 'f8b8ab30443dea6a8dbb2e27c17799d6',
-      'plugin.php' => 'fd9c93fff602ce118c68e4a0b675975e',
+      'plugin.php' => '5c491459a08ab61854fb5a8f56230f66',
     ),
     'online_extended_menu' => 
     array (
@@ -2139,13 +2195,13 @@
       array (
         'English.php' => '80ef79863e369f62df51b9659551a432',
       ),
-      'online_extended_menu.php' => '20780f809d85d39c90e0f6dd8cc8925d',
+      'online_extended_menu.php' => '16d72e57d0cae0206e0a079638f23d83',
     ),
     'online_menu' => 
     array (
       'languages' => 
       array (
-        'English.php' => '6761e97b84c471b871020a3416e9d689',
+        'English.php' => 'e7753b75880a1b606b6f525d736893cb',
       ),
       'online_menu.php' => 'ba0b67252034c72c5a002aef708082bc',
     ),
@@ -2153,10 +2209,10 @@
     array (
       'languages' => 
       array (
-        'English.php' => '5890f4b7958d49715dae9e89c59b16bc',
+        'English.php' => 'b04593965071e6f5bd46286fadcec456',
       ),
-      'other_news2_menu.php' => '36297a52eaca7eee6dc5b8607fe5f218',
-      'other_news_menu.php' => '176fe1d7556fa0075ecad2aeefc96ddb',
+      'other_news2_menu.php' => '23ffe78f7e74092c6505bec603c04ec0',
+      'other_news_menu.php' => '43943c839fbd809ae19b75ca7b296451',
     ),
     'pdf' => 
     array (
@@ -2184,7 +2240,7 @@
           'iso-8859-9.map' => '4d8ddb1b69f39e44b88addd04269e684',
           'koi8-r.map' => 'ed1be11b650e23bcf0804524d0299e73',
           'koi8-u.map' => 'd445ee6c5ec5f2edd31fdc48724dd168',
-          'makefont.php' => 'fbb9fa5ebf6a81a45bb79549c742aa7b',
+          'makefont.php' => '412c5335ef10e2fed8038a8ac5798971',
         ),
         'courier.php' => '16234bee90ef280e42cb167d1ba2c60e',
         'helvetica.php' => '3dbdc93d4d688b45bfc6f4e49c45116e',
@@ -2205,15 +2261,15 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'dfc41b4931191121f06c8909e8e3af53',
+        'English.php' => 'cdc4aab2e1c8caf5ddf209e32946c623',
       ),
       'admin_pdf_config.php' => 'ab75370cbef1f9e7d32448717071eb82',
-      'e107pdf.php' => '020697c91fa842a1c72323985623181f',
+      'e107pdf.php' => '2911ada133d8c7b104f553e8232361e1',
       'fpdf.css' => '35c07d5049ac6e55b8ab473c6dc38bf0',
       'fpdf.php' => '47653b1a92f6a51cec644abc9b267bdc',
       'pdf.php' => '9c05a56fbb296b60cddcfc68ec1ae2c3',
-      'pdf.sc' => 'feb9fda2bb21ee8b72d6b5fd045ab356',
-      'plugin.php' => '7a758641685eaf8de5fd14e3385e6f64',
+      'pdf.sc' => 'cd179b47d126ac55eb48cdbdbd4c1a19',
+      'plugin.php' => 'd5aba62f42496d21e3ec8d48ded5b3ba',
       'ufpdf.php' => 'fe9444d6d9c0553bd06fc1904b0df484',
     ),
     'pm' => 
@@ -2241,24 +2297,24 @@
       array (
         'admin' => 
         array (
-          'English.php' => '1b7b30cf6f6f37cd486080d443968681',
+          'English.php' => '8c6ed48f14ef1bf19bc22f97b48494db',
         ),
-        'English.php' => '30316cc6623a23e9d8924df12a3fadc9',
+        'English.php' => 'ac6ca2e308d6d15e11b4d322298bf3c9',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'plugin.php' => '420c66e5b14350e4266d4b3bc3134351',
-      'pm.php' => '191c8d269bb74b874edd10328e66022f',
-      'pm_class.php' => 'd74691f6a8f4bd3c8ecde30f101dba34',
-      'pm_conf.php' => '13912c612cdc884e63b8250af55afba5',
+      'plugin.php' => 'c89f4e634476ef16447a5375f39ce495',
+      'pm.php' => 'a5aa043661c8230e93b8cb4effcc8007',
+      'pm_class.php' => 'df040f82c02af492432c132c0887a9f5',
+      'pm_conf.php' => '4219da868fbcd4ea43ecb050eec83fac',
       'pm_default.php' => '0213fb9bcfe60d37041f44136727649b',
       'pm_func.php' => '4b9c0a299c8995c1e6f6aab4071d2e17',
       'pm_notes.txt' => 'df26332907da1f35c4731d8893aea23e',
-      'pm_shortcodes.php' => 'c1860111454f0f7b20cfe1f924dae6d8',
+      'pm_shortcodes.php' => '944e2f2957ae880e49684f724cad8ab1',
       'pm_sql.php' => '4608486c1027c6485dc32674fd536dc5',
-      'pm_template.php' => '028c374fb710251ec1c89fd330e8a7ca',
+      'pm_template.php' => 'cc1bdd12537404e75f9bd6dca8022292',
       'pm_update.php' => 'e66fc6610e273471a212471e07598710',
-      'pm_update_check.php' => '2526f786f725ebfe8cdb56cf1131f6ab',
-      'private_msg_menu.php' => '0c578297b1fba71b7df890736106f948',
+      'pm_update_check.php' => 'a5b341b5373844cdfc1f961fb3d3151f',
+      'private_msg_menu.php' => 'ae1b1a633de92742b1d8460a6fa5d9fb',
       'sendpm.sc' => '8e2ef687982946d62df06bf6e9bdbc24',
     ),
     'poll' => 
@@ -2273,7 +2329,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => '4a4c71f7d7f191a4a3dca3cf30760e71',
+        'English.php' => '36b348fdefe092023ee513a4b1e6aaae',
       ),
       'search' => 
       array (
@@ -2283,10 +2339,11 @@
       array (
         'poll_template.php' => '0c83f7e4984e9a0b8bbc196262cc650f',
       ),
-      'admin_config.php' => 'e6a30e94dc6599fd613d8d735f40cdb3',
-      'oldpolls.php' => '6ab0c3a5db0d610871d817961ccf912c',
-      'plugin.php' => '7ac72ca7cbdd5a98c0c24c82d619e2d9',
-      'poll_class.php' => 'be869a1960ca9cad5e9714f4b6a8811f',
+      'admin_config.php' => 'ba8fbd550cb0e34cdf445d117f5c93cc',
+      'oldpolls.php' => 'ae016f0aa026a6a9de8af8d24de53ff9',
+      'plugin.php' => '6dff875dd04ce5d602f4b64b7732610e',
+      'poll.php' => 'b51353ac9b1d4f9664b954d528644547',
+      'poll_class.php' => 'd5e58aa6c9ab5b63d51ab7b36fdf52f0',
       'poll_menu.php' => 'b2e1d5b8d5e8cacf51e2724446b663c1',
       'poll_sql.php' => 'ffe53748dbd1504f7c4204027814064a',
     ),
@@ -2294,7 +2351,7 @@
     array (
       'languages' => 
       array (
-        'English.php' => '7621008ce0b6bc9caec82f57210e2a3a',
+        'English.php' => '4e4018bc11471818ca7256c722e28c13',
       ),
       'powered_by_menu.php' => '030115b6ab06ef38b31510aec2b11ee3',
     ),
@@ -2302,21 +2359,25 @@
     array (
       'images' => 
       array (
-        'rss1.png' => '5fa63dbd2d0cac4472af83b4b186cb09',
-        'rss2.png' => '73f3385736d36114861d65455af1214b',
-        'rss3.png' => '07b629221a68764c1360d393a710c7aa',
+        'rss1.png' => 'c25701747091968c0f31dfc76f2cefbd',
+        'rss2.png' => '9382a50cb221e9e6b829df2a7f52d461',
+        'rss3.png' => '0a9bb4cb46a75b34db034ce6f2b763e6',
+        'rss4.png' => '9f9b20c3cdd5cee6072eda153278bef7',
         'rss_16.png' => '276d6e7671548aea71f2c64b026d731f',
         'rss_32.png' => '22602a166d61764a13184506dd75ea6c',
       ),
       'languages' => 
       array (
-        'English.php' => 'ebd34b4c6be6dd405786c595b158a18b',
+        'English.php' => '90ba4c3b30c128eac2a16d0007416c89',
       ),
-      'admin_prefs.php' => 'afd5b10a0c926ed474ee1bd8bf0f4e10',
-      'plugin.php' => '1f1ed2696ae847765888cc70d3614c6e',
-      'rss.php' => '4846b455c7851adfa620dc05ae97ca4f',
-      'rss_menu.php' => 'c39c5e0a4d9e1420782fe9650a23d3a3',
-      'rss_meta.php' => '7205d95791b223ce785e95b0fda76c5a',
+      'admin_prefs.php' => '511047205732e1f3a5098052e3a2eb4e',
+      'e_meta.php' => 'cec75314cf27f19abc2ee1cbaa15c99a',
+      'plugin.php' => '46b1e37c9d18e6872083425afb3115fa',
+      'rss.php' => 'd2da7783fcbfe777929b54f93bf16a73',
+      'rss_menu.php' => '1be0ce84109cbbbcdadf68cc93fb5c20',
+      'rss_shortcodes.php' => '5f78ac16412442bb16f729c6e71c582a',
+      'rss_sql.php' => 'efee18037cab9fbf35cdf81f97efc2a3',
+      'rss_template.php' => '023614657d162b0f155fbe50e6e3dce2',
     ),
     'search_menu' => 
     array (
@@ -2350,9 +2411,10 @@
       array (
         'English.php' => 'e482c4c1b04b71a713e8aa21cb4b047c',
       ),
-      'admin_config.php' => 'b020a0ddacd2841fb6a8e889268e7f57',
-      'modtrackback.php' => 'ee7b186252eab10501c7335b2498bdb8',
-      'plugin.php' => '1308c99c366c05e641fc1a262a72d9fb',
+      'admin_config.php' => 'd1222ea1494b8b8c06247e72fb5d2f9f',
+      'e_meta.php' => 'dee500df70205a00f524a0b0720205c9',
+      'modtrackback.php' => '97d65e889ac0682d106186d4c989e6ca',
+      'plugin.php' => 'faaf0e70297414b7f61db1a8f030a02c',
       'trackback.php' => '68d35830a04bc5283cf0ab718b3ee2f2',
       'trackbackClass.php' => '40cf1ea472926781f7ce51d0a9653f6e',
     ),
@@ -2363,7 +2425,7 @@
         'English.php' => 'be4478e772ee1e1189a57284891582d8',
       ),
       'config.php' => 'a78276d858ff5dcaf1980939ea0d9578',
-      'tree_menu.php' => '37933c884c7c6bef71e016e58080cfb4',
+      'tree_menu.php' => '81ddba9d61a54caa9c8b74d80ae1f439',
     ),
     'userlanguage_menu' => 
     array (
@@ -2401,7 +2463,7 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'b841409838526ba769866861bf236100',
-      'style.css' => 'ff3671e52046bb41ae4a7587f86bce09',
+      'style.css' => 'ea3af6647ce3d7ed62c5a973b8a2a7bb',
       'theme.php' => '9f63c8aa0ff3f0e6ab07c89a8bb7bd08',
     ),
     'e107v4a' => 
@@ -2445,12 +2507,12 @@
       array (
         'English.php' => '267a4652945d08b0a14d421c47d7cdf8',
       ),
-      'forum_template.php' => 'b8dcce313578bd6e6758197dc6ee3afe',
+      'forum_template.php' => '5236c9308b808d1c0c96aa4b8647ccec',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newsfeed_template.php' => 'bf35ae0a44194fb397c9816bd81c7522',
       'preview.jpg' => '1f1e5815a674ceb1eaa562caa0e23607',
-      'style.css' => 'e9eb572ab4b66385ec2159cbac077106',
-      'theme.php' => '3ed1133c8d03685d339b5309fd827a1d',
+      'style.css' => '31dbd50ef3ff04150146f4b618c18385',
+      'theme.php' => '533543688af3450cd14bdc170466c960',
     ),
     'human_condition' => 
     array (
@@ -2472,7 +2534,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newforumpost.php' => '6a9cd60b76c00cd41384f21ce1265860',
       'preview.jpg' => '37766edab6519ba0d82d89d0fad9b9df',
-      'style.css' => '121792fc537bb506c2052971de1e1dde',
+      'style.css' => '98b43a380766349d489c4bdc3ea69eff',
       'theme.php' => 'e7f8584099975bafbd28c2f8683de37b',
     ),
     'interfectus' => 
@@ -2516,7 +2578,7 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'a4b48f473468c22cb5f03054eda08794',
-      'style.css' => 'a774157a11015d800fc0d09aaa83d71b',
+      'style.css' => 'bb2e6303ad7fed8a1119fd08b7bd11e8',
       'theme.php' => '1f15d7afdfee8ca33bd2667085cee2bc',
     ),
     'jayya' => 
@@ -2594,16 +2656,16 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'd2768e8d07f3502047dd7f8cd8009384',
+        'English.php' => '6d5c404d3f5949d55660c3ba47ad338c',
       ),
-      'admin_template.php' => 'd6f29a8b467c95c18c01db69c1be9867',
-      'canvas.css' => 'fd4de0683d26b402b9489e3040a6c882',
+      'admin_template.php' => 'a894a1c9e20bb7b895e1151854a1083e',
+      'canvas.css' => 'acdfee6441e3dc292657ca469b669df4',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => 'ac9d2df99166eb5ce87c16bb146bc413',
-      'pepper.css' => 'eb6efc98f6d354d1a9bd2b0fbc716f90',
+      'pepper.css' => 'bcd1ac74e7cacb3ace1396355f238cc8',
       'preview.jpg' => '1d775846dbe1b7ea66065fc0eac72eaa',
-      'style.css' => 'a9fbf9295f9c6b07b7ea7032a00d9ccd',
-      'theme.php' => 'a31293384ae5f8d18f15297765c6aaf9',
+      'style.css' => 'c406d47937f253e08d655b1d1008a6c2',
+      'theme.php' => '82d43fe4ce914385611be80b3bc37bc9',
     ),
     'khatru' => 
     array (
@@ -2639,7 +2701,7 @@
         'English.php' => '66e19fa68eda6e34636ff907c328bb9e',
       ),
       'download_template.php' => 'a9742a3e65ac83e279cabee1e1e50fb6',
-      'forum_post_template.php' => '078471273797b4364959b37090ee2069',
+      'forum_post_template.php' => 'fef4832dd26316448ef939cb2eb35931',
       'forum_posted_template.php' => '66bb8c27404c12d7e784745685f1f398',
       'forum_preview_template.php' => '4455c6b5e0991211db66dad466274bc0',
       'forum_template.php' => '93227cac477be310f0e5a1f6b4a310e5',
@@ -2650,7 +2712,7 @@
       'news_template.php' => '0f5b689c4ad3d212934707f44b959b11',
       'poll_template.php' => 'c01388206c3cf373ff04e01c38485d99',
       'preview.png' => 'b164565b63d086a6a5a28fd76097487c',
-      'style.css' => 'b4a0c07b62ba5061e77027d8032c7416',
+      'style.css' => 'be699284eb74ccbd6543eac6f60754ea',
       'theme.php' => '91a9e9dd2439516210c1f0b29437a9ed',
     ),
     'kubrick' => 
@@ -2674,7 +2736,7 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'cb94c52db72d1ba8bd4d1e08ee41cbfb',
-      'style.css' => '19b6b359a7c17e65ca52ad8264f63edb',
+      'style.css' => '0f93072e98199ac87d3d2957cda402b9',
       'theme.js' => '092a48b0a95fcb44c48236c40948eb13',
       'theme.php' => '449b35c64b081ab7061a97daec5ae1c0',
       'ul.sc' => '94dc33c24a82bbe2c357d4ac165d8c09',
@@ -2712,9 +2774,9 @@
       ),
       'alt_style.css' => 'e9ee5679b9218c1c7d89c98c2f95b701',
       'alt_theme.php' => '09fc4de57c31e85eac390e643d401ed7',
-      'chat_template.php' => 'd22d28f3cae0b4e1acfad78faedcbee6',
+      'chat_template.php' => '8a57696d7ecb512823073c64768c8ed7',
       'download_template.php' => 'b6e968dc3f6d17d161b0105b67ae2903',
-      'forum_post_template.php' => 'f0cf45b5dab2047d6029595c7716d947',
+      'forum_post_template.php' => 'f1a897cbd307b7f0324a501f6664540d',
       'forum_posted_template.php' => '56a97c40620ae669bca178f30ffdd044',
       'forum_preview_template.php' => '2391640ab5380b18ac17e54a99feb29f',
       'forum_template.php' => '8c5f8a4dedc4829aca2c4f418ac49ceb',
@@ -2724,7 +2786,7 @@
       'newforumpost.php' => '7ec9f0bb87045e10862dc2b7dcc9757d',
       'news_template.php' => '0f5b689c4ad3d212934707f44b959b11',
       'preview.jpg' => '184658c1d2222cd0137cc445fcc785ea',
-      'style.css' => '5699a694768747a25995d68f93a8157d',
+      'style.css' => '475d1badb0a770d6da07c350ffd6dcb7',
       'theme.php' => '6ca169bb182d7ef950c2b27ed88d28d2',
     ),
     'leaf' => 
@@ -2771,16 +2833,16 @@
       ),
       'languages' => 
       array (
-        'English.php' => 'cd1846d0d0b607f6f908465b475a7a9a',
+        'English.php' => 'b89b3b5688c29ffe9ad8ec70ce414db8',
       ),
       'bluehigh.ttf' => 'd3003ad3a5de2a785fbb898c89cf40ff',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'links.sc' => '1c6e88dbdfd1b502dfd20ee3fc6ca7f9',
+      'links.sc' => 'a3f5d8fa1e9e14c1b6cc27b06c7754fc',
       'preview.png' => '804c22db1f71223d10e6f7b8b85f69a9',
-      'style.css' => 'cc5e05f85f73792b85870dd61150b1a5',
+      'style.css' => 'e7392ac143d7daa82882e906b5413c31',
       'theme.js' => '16285b5ba2631979457e5e2ec1cf10af',
-      'theme.php' => '28419a3fb6ab106102bd2a72edbd5439',
-      'ul.sc' => '8bc8330e914dbecdf87b56b536352ee3',
+      'theme.php' => '9c7ebc86ae47a457591fdd86337cb11e',
+      'ul.sc' => '7614f31e4b096439bea1cd7c9f9ee0e9',
     ),
     'newsroom' => 
     array (
@@ -2793,8 +2855,8 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'de22b398f66e271fdd908ac31f25e7e4',
-      'style.css' => '6811dfefba548ec3903bb2bd6c90778d',
-      'theme.php' => 'f26d6691460bf9433e872ab0ffeb5b9c',
+      'style.css' => 'bd8715343b586a898a6e4e7875e2f6b6',
+      'theme.php' => '5ee241f2ee0f5f852512101261bcad84',
     ),
     'reline' => 
     array (
@@ -2835,8 +2897,8 @@
       'full_width.css' => 'f806f549c1200131c4c043db72408da7',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => '30da9e1ef04e5f1fef38ae3d23e0f3c4',
-      'style.css' => '579694fcaedd33d0025b75b286fe6214',
-      'theme.php' => '53cd5a558dd6329626b444ead97ec950',
+      'style.css' => 'aa2df8aa8519c802f10e3eddfd95aed3',
+      'theme.php' => '67949514e7139dcbf5dbb9b29d221940',
     ),
     'sebes' => 
     array (
@@ -2862,33 +2924,32 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'a9e7139c84a52e4b164c460a6428b317',
-      'style.css' => '2e1a7f9d7c205613b11b958055561330',
+      'style.css' => '2520113be12170cc926299ac4ece598d',
       'theme.php' => '9e888e822f698fbb187bd602ec3ca7c4',
     ),
     'templates' => 
     array (
       'admin_template.php' => '57aec9f3ef5be669eb7fd47b3635a1b1',
-      'banner_template.php' => 'ba1f7c11ae670d425f8e85075a8b6c02',
-      'comment_template.php' => '8259e0cce978fee71fe713761f9d1bde',
-      'contact_template.php' => '6906f85088051878a4cdd364065aedd6',
-      'content_template.php' => '4234fe2ce5e65e85d0597efc6ee68d5d',
-      'download_template.php' => 'da4896dcdf43994dd2b12ac91626ec45',
-      'email_template.php' => 'e1ca940e806770678e04b8d08466e988',
-      'footer_default.php' => '281f48b459b0513d552a7799bb1b4a88',
-      'fpw_template.php' => '75ed285375dea3c636bc63dc9a1d8c81',
-      'header_default.php' => '2e6913df824b6d6254bac8adbea58ff7',
+      'banner_template.php' => '5c52f8c726bf4d8e2f843703c2bb24d4',
+      'bbcode_template.php' => 'fe842867e0501311a9edd6363560fdaf',
+      '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',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'links_template.php' => '21d8747bb5c1d6d590a9ad0b0d26e576',
-      'login_template.php' => 'd77e3346f448b156b7ac9e7c0e8b68ac',
+      'login_template.php' => '8952e4916524b95a3b3f75979e85a58c',
       'membersonly_template.php' => '14635660ab8f2daed92f4260ed0f3fa1',
-      'online_template.php' => 'c883eb20ba65527ecebb94dd78e5d1c1',
-      'search_template.php' => '90fae4ad55e7adf7f711720f4ff7018e',
-      'signup_template.php' => 'ff1efc6462f9164ea681c8db870a3894',
-      'sitedown_template.php' => '39204ec2e30b0f9cb4bba9e2de59979c',
+      'online_template.php' => '0b98cb57967fb6a4d0015a8feb2ecd1c',
+      'search_template.php' => '100782de2e0ac37b7286bc2a1f65a2c2',
+      'signup_template.php' => '2ba1f894bbba7b332cace51b8dc6e31a',
+      'sitedown_template.php' => '85de9cb71af3df0f6e3ef44386d67d6e',
       'trackback_template.php' => 'fd54d8c26c75f9d380e8ec90860b0107',
-      'user_template.php' => 'a74d87c3805ff751e40c00021c6ece3c',
-      'userposts_template.php' => '4491e3bfb4a8e9765f3c320d70b3da02',
-      'usersettings_template.php' => '0c3205a1e9a7e862268208e8125b4da0',
+      'user_template.php' => '40a17b45d7aad1c613fadec6453d75a4',
+      'userposts_template.php' => '6f9724081a0be3c5f974d16c92860c9d',
+      'usersettings_template.php' => '20d0f1ac95d0abe28ada5a98e987b70d',
     ),
     'vekna_blue' => 
     array (
@@ -2915,50 +2976,50 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => '74b91306b957f69bc390ed612df76ac9',
       'preview.jpg' => 'fbb8bde5f9eb4f8efc39f85234959823',
-      'style.css' => '56807dc5973245b8b74394a299102782',
+      'style.css' => 'b11955766d34da3f5ee12aa7ca734655',
       'theme.php' => '4e523e4af469271fbfbe5527b8ea859a',
     ),
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
-  'article.php' => '1029f6125156dd497347ea0329424268',
+  'article.php' => 'ee3b7df97cb467d35263bedf589abf98',
   'backend.php' => '312552577f67c7965a76bda84b949a64',
-  'banner.php' => 'c00bf28d2ef3cfba73d62943c219db1b',
-  'class2.php' => 'f010ee203191a137b3e00be3723e703b',
-  'comment.php' => 'fc3814165cd3585ff8124e6fdd2ca6ac',
-  'contact.php' => 'da837e88412728160dd7a3a200d15537',
+  'banner.php' => '6328a170fd3ee6f75ebdd2472f3fb397',
+  'class2.php' => '37696f5a30279e2ad8322862c788b067',
+  'comment.php' => 'b75934b785dd22089fa9d0b2723916a9',
+  'contact.php' => '77d372dad7c0a662b5dd837f8ce32228',
   'content.php' => '10e6c1a9e2180598f8edd8f49022f26b',
-  'download.php' => '412ae71843a6c85cc73e071af4a294eb',
+  'download.php' => '7be94c51d2d19953966d02c3f5e266de',
   'e107.htaccess' => 'c5e1ad68b41f947be285926c0f81d914',
   'e107_config.php' => 'd41d8cd98f00b204e9800998ecf8427e',
-  'email.php' => '1c0f6fe04644feee6b5d05ae3a21d48d',
-  'error.php' => 'f7601a38e787fd4d0e9fc1745bb7679a',
+  'email.php' => 'c786469d105283c6735a62172bb63865',
+  'error.php' => 'fe3ca6cc7b5947e43aead577a23128fe',
   'favicon.ico' => '5fceb78b9124ddae4027396d7cfcd328',
   'forum.php' => '3c10184d52685d7c9a6906a967b7e3d8',
   'forum_viewforum.php' => '4b9fcc3a820ed2f93b4dc707c3ebe3b4',
   'forum_viewtopic.php' => '5fea10d40850fd6f72cfbec7a328e120',
-  'fpw.php' => '56888864af1bdaf8924816dd0f950ef5',
-  'gsitemap.php' => '719d56aad6cb84cbf5ef7b0ead26bc3b',
-  'index.php' => 'b2b096b72f691ceb3f1cb2695412e80f',
+  'fpw.php' => 'd599b553d2bdd87520615addfb55b573',
+  'gsitemap.php' => '4ebcfff3b23717454bb6b3538dd54565',
+  'index.php' => '960de1b196ffa6e7887fe99ae65fa682',
   'links.php' => 'bed206fc2abe8f1307ef4db3b7fee63e',
-  'login.php' => '3549f70df334efc247f46891a403880f',
+  'login.php' => '6dbfe3d33ddd132cc85f5cb52b692f8c',
   'membersonly.php' => '0903a2ef48312a12ce81b2fa17fe0233',
-  'news.php' => '6b760eaca32527bd614e2bd400f2fe8c',
-  'online.php' => 'f3c435f4ffaf0a9367f45984c3fffb2e',
-  'page.php' => '98decc62c003045f74f9e208530d1328',
-  'print.php' => '25dd15b6c5931e305fcd19879459ce59',
+  'news.php' => '39b13f3be2acd01f8f28fb1cbfcbfaf8',
+  'online.php' => '947d1170bdc6cf524541d901f238f1a9',
+  'page.php' => '75881aa5f0a3b478bd65feb353863af7',
+  'print.php' => 'c115f1f57a0f6c691e5ce0e5b2d5b27a',
   'rate.php' => '19160ac5ab1600124219c2b61c9c4a12',
-  'request.php' => '94ee65454ddbf5d4844cfbe780a3f018',
-  'robots.txt' => '718c9c13913590073dd5cddefd161c0b',
-  'search.php' => '8e1a1ef208e260faa7b05d25fdd2d1b1',
-  'signup.php' => 'fdb66a6e88c2b80b96f56960855ef728',
-  'sitedown.php' => 'f38e86b03a6df3eefba443a2859e6ea3',
+  'request.php' => '1cf6897842a4c804e33373e03c6b0ada',
+  'robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
+  'search.php' => '44bd9ed61fafe34b64a5d109ef2ec9d7',
+  'signup.php' => '6cfcc3d5d9fd54add87a960cac1d2032',
+  'sitedown.php' => '7a2d95fb0976ce5ab287a403b118acfa',
   'subcontent.php' => '468072ef82e179b6ed5ff20a4eb36225',
-  'submitnews.php' => 'c087e3248c7a8f1da0db2477b821f1ce',
-  'top.php' => 'd10339ac845228c32a4a9017d5824de1',
-  'upload.php' => 'd9227038c27c3660b7e1f8e66c47c110',
-  'user.php' => 'aebe739c119cef9373e61ad7bdc8cbee',
-  'userposts.php' => 'c53a31db1cb416cea52bda83454b06bd',
-  'usersettings.php' => '6fb4bb566738d8197986a4548b74e2c6',
+  'submitnews.php' => '090f7107c0f8c8636a84516a3cdfcfad',
+  'top.php' => '26cae358e9c9a83bfa686832231a2718',
+  'upload.php' => 'd7e5209dcd6f7964f0a6655e1f5ef8a5',
+  'user.php' => 'bcbc7a76b14c83784949613b6bf61b3d',
+  'userposts.php' => 'ffdb5e83f7f061ce19a376e5529c4a9d',
+  'usersettings.php' => '44aea0d3fb8906c41c84a31ed5054c6d',
 );
 
 $deprecated_image = array (
@@ -3713,12 +3774,16 @@
         array (
           'css' => 
           array (
+            'content.css' => '9ae9f08d9748dc78ed6e0b33cd11e458',
+            'flash.css' => '5ad8611160baa5f2198abb88baae38c9',
           ),
           'images' => 
           array (
+            'flash.gif' => '709d9df69d8c2030e56321046d76ab8b',
           ),
           'jscripts' => 
           array (
+            'flash.js' => '6b51cb8bf256f6ebc86e3a325475209b',
           ),
           'langs' => 
           array (
@@ -3726,6 +3791,7 @@
             'cy.js' => '5dcfd2755cddfcbe6351d4dbe6c6ac85',
             'da.js' => 'f2b72ffa4f64243f1c1d8e531ccd74b1',
             'de.js' => '5d238f5f9a261564e09a002cb5c93ff1',
+            'en.js' => '52de748671eb0182b112111dbaa35e88',
             'es.js' => 'ec24f744a0c500a651db47fe579994be',
             'fa.js' => '14a0820203eea7f22856a2c8174f9636',
             'fr.js' => 'e489db910121ca476419966302177706',
@@ -3743,6 +3809,10 @@
             'sv.js' => '0dd9da08e68b78ce0832b75ddf7b0d7f',
             'zh_cn.js' => 'c5e6a82179266880d79b4626f965b108',
           ),
+          'editor_plugin.js' => 'd9a86e84d6de9a92c07caa14c32fa436',
+          'editor_plugin_src.js' => '9f6d08f5269ffb3d107bbb382d1080ae',
+          'flash.css' => '439d26d52ddf50dd5ac7d5fcb29a6e7d',
+          'flash.htm' => 'c67139b142800773e99457bd880978e9',
         ),
         'ibrowser' => 
         array (
@@ -3789,6 +3859,21 @@
             'zh_cn.js' => 'fcfa956bf3fa2efc6ce5cb980399f4f8',
           ),
         ),
+        'media' => 
+        array (
+          'css' => 
+          array (
+          ),
+          'images' => 
+          array (
+          ),
+          'jscripts' => 
+          array (
+          ),
+          'langs' => 
+          array (
+          ),
+        ),
         'table' => 
         array (
           'css' => 
@@ -3832,6 +3917,9 @@
             'zh_cn.js' => '5e66efd3b2631d9d8a4b6d465df4444a',
           ),
         ),
+        'zoom' => 
+        array (
+        ),
       ),
       'themes' => 
       array (
@@ -3908,6 +3996,9 @@
     array (
       'e107.jpg' => '01982e7527b5dfab3b8634a0ab0bd75c',
     ),
+    'custom' => 
+    array (
+    ),
     'download_icons' => 
     array (
       'admin.png' => 'a7376ea540f3ca4f721909bd0e6ae71b',
@@ -4246,6 +4337,7 @@
       array (
         'help' => 
         array (
+          'log.php' => '553fd4414b98f4aa5f0f6e1f8f7b0ad6',
         ),
         'lan_admin.php.bak' => 'c8bd5eb16d7834de1975b2ac3cd301e3',
         'lan_article.php' => '78d8dba28058eb99e32fc670fed68f34',
@@ -4260,6 +4352,7 @@
         'lan_news_category.php' => '5337d8c36701776b22c27182a258e690',
         'lan_newsfeed.php' => 'bba9d1991b304ee031ac8f4339aa6a61',
         'lan_poll.php' => '9bedcde5926715eede2f03afcff20a67',
+        'lan_review.php' => '36820722f27e35f1fe10edf238a13d93',
         'lan_submenusgen.php' => '40af0cbb4906703d1fc5d29d7f2790e4',
         'lan_submitnews.php' => '595ca7b58df223022b3f7bd44e8238f4',
         'lan_theme_prev.php' => '003c8edea2f4b757347a231cd61868ba',
@@ -4274,8 +4367,10 @@
       'lan_forum_viewtopic.php' => 'dc93aa81babfe0ee610d559d70f8681a',
       'lan_install.php' => '6182909e4053d2da395298e4ca73323a',
       'lan_oldpolls.php' => '64379ca9ff42aaf1873b93bc41627fa7',
+      'lan_request.php' => '023a40948ec32b3359e9a5bae2b04f71',
       'lan_sitemap.php' => '7d926f3eb3c81ed747a6682d4a9048a5',
       'lan_stats.php' => 'f9058e0cd84a315f694618e2edf94d94',
+      'lan_subcontent.php' => '8307d6e57a66ad7df8a57777c1fdcb36',
     ),
     'Finnish' => 
     array (
@@ -4323,6 +4418,9 @@
       ),
       'languages' => 
       array (
+        'English' => 
+        array (
+        ),
         'ldap_auth_English.php' => '8553f2510a8f44e048e75b0caad969f6',
       ),
     ),
@@ -4369,9 +4467,15 @@
       'languages' => 
       array (
       ),
+      'log' => 
+      array (
+      ),
       'search' => 
       array (
       ),
+      'calendar_menu.crc.gz' => '90580c372c43234e82c73fe1687611d4',
+      'config.php' => '401d559f53265f4b1778701b8e9dd512',
+      'readme.rtf' => '47f6de1137030fe2efde782133ab725f',
     ),
     'chatbox_menu' => 
     array (
@@ -4447,6 +4551,7 @@
           array (
           ),
         ),
+        'redo.png' => 'df3dd61d416b00c26d3cbcdf02e862b4',
       ),
       'languages' => 
       array (
@@ -4536,6 +4641,9 @@
       'images' => 
       array (
       ),
+      'languages' => 
+      array (
+      ),
     ),
     'headlines_menu' => 
     array (
@@ -4833,6 +4941,7 @@
       'languages' => 
       array (
       ),
+      'rss_meta.php' => '7205d95791b223ce785e95b0fda76c5a',
     ),
     'search_menu' => 
     array (
@@ -5454,6 +5563,15 @@
       'style.css' => '62365fd9c2b8b1b18485f69f1503818d',
       'theme.php' => '0c1cdae9b4143f3ea1a0855231fe4b84',
     ),
+    'reline' => 
+    array (
+      'images' => 
+      array (
+      ),
+      'languages' => 
+      array (
+      ),
+    ),
     'sebes' => 
     array (
       'images' => 
@@ -5520,9 +5638,11 @@
     ),
     'templates' => 
     array (
+      'content_template.php' => '4234fe2ce5e65e85d0597efc6ee68d5d',
       'forum_template.php' => '7c4aa61097a7cf0ea4a5f3d2089a5b9d',
       'forum_viewforum_template.php' => '7a2c7fc3c28a3df76661ec297119daab',
       'forum_viewtopic_template.php' => 'fb3516a937155a9e86eaa9a080905646',
+      'links_template.php' => '21d8747bb5c1d6d590a9ad0b0d26e576',
     ),
     'vekna_blue' => 
     array (
@@ -5576,11 +5696,12 @@
   'CHANGES.txt' => '20499ea696da01da57ff542cb8cc90ce',
   'Copy of class2.php' => '4bc75d69d5486bb439f681467ccb9256',
   'Copy of forum_post.php' => '0063a6cdd546d5f90374bbb3ae342a2a',
+  'README.txt' => 'f4ae5aa39099819a240951d0694fe105',
   'ReadMe_English_iso-8859-1.txt' => 'a15c32416143ecdebb10fab747a9065a',
   'chat.php' => 'f99ca9a68e350852ff12b6f201ff46e4',
   'e107_6171_readme.txt' => '7f411eaafccc974f91447c8efd9992d4',
   'forum_post.php' => 'b4537a7296252a0d8c010824b698259b',
-  'install.php' => '0cb8fbb6bb85461a4cd0a0b966b4eefa',
+  'install.php' => 'f6c6c7a5151ead93de10528d3a38092d',
   'oldpolls.php' => '2758e56550195c508819c6062b950bc3',
   'readme.txt' => 'ff257006036939e779d287cdfee3b4b3',
   'sitemap.php' => 'd72fdc265a68f5a3b8a5d4b51d776f84',
diff -ruN 0.7.5/e107_admin/cpage.php 0.7.7/e107_admin/cpage.php
--- 0.7.5/e107_admin/cpage.php	2006-05-16 10:55:05.000000000 -0500
+++ 0.7.7/e107_admin/cpage.php	2006-11-08 14:47:43.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/cpage.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2006/05/16 15:55:05 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.36 $
+|     $Date: 2006/11/08 20:47:43 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -26,7 +26,7 @@
 $page = new page;
 
 require_once("auth.php");
-require_once(e_HANDLER."ren_help.php");
+// require_once(e_HANDLER."ren_help.php");
 require_once(e_HANDLER."userclass_class.php");
 $custpage_lang = ($sql->mySQLlanguage) ? $sql->mySQLlanguage : $pref['sitelanguage'];
 
@@ -44,6 +44,15 @@
 	$page -> submitPage();
 }
 
+if(isset($_POST['uploadfiles']))
+{
+
+	$page -> uploadPage();
+	$id = $_POST['pe_id'];
+	$sub_action = ($_POST['pe_id']) ? "edit" : "";
+	$page -> createPage($_POST['mode']);
+}
+
 if(isset($_POST['submitMenu']))
 {
 	$page -> submitPage("", TRUE);
@@ -66,7 +75,7 @@
 		$page -> delete_page($pid);
 	}
 }
-		
+
 if (isset($_POST['saveOptions'])) {
 	$page -> saveSettings();
 }
@@ -127,7 +136,7 @@
 				</td>
 				</tr>";
 			}
-		
+
 			$text .= "
 			</table>
 			</form>";
@@ -144,6 +153,14 @@
 		$this -> createPage(TRUE);
 	}
 
+	function uploadPage()
+	{
+		global $pref;
+		$pref['upload_storagetype'] = "1";
+		require_once(e_HANDLER."upload_handler.php");
+		$uploaded = file_upload(e_IMAGE."custom/");
+	}
+
 	function createPage($mode=FALSE)
 	{
 		/* mode: FALSE == page, mode: TRUE == menu */
@@ -164,7 +181,7 @@
 				$data                         = $tp -> toFORM($row['page_text']);
 				$edit                         = TRUE;
 			}
-			
+
 			if ($sql -> db_Select("links", "*", "link_url='page.php?".$id."'"))
 			{
 				$row = $sql -> db_Fetch();
@@ -173,15 +190,15 @@
 		}
 
 		$text = "<div style='text-align:center'>
-		<form method='post' action='".e_SELF."' id='dataform'>
+		<form method='post' action='".e_SELF."' id='dataform' enctype='multipart/form-data'>
 		<table style='".ADMIN_WIDTH."' class='fborder'>";
 
 		if($mode)
 		{
 			$text .= "<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_7."</td>
-			<td style='width:70%' class='forumheader3'>";
-			
+			<td style='width:25%' class='forumheader3'>".CUSLAN_7."</td>
+			<td style='width:75%' class='forumheader3'>";
+
 			if($edit)
 			{
 				$text .= $page_theme;
@@ -190,86 +207,87 @@
 			{
 				$text .= "<input class='tbox' type='text' name='menu_name' size='30' value='".$menu_name."' maxlength='50' />";
 			}
-			
+
 			$text .= "</td>
 			</tr>";
 		}
 
 		$text .= "<tr>
-		<td style='width:30%' class='forumheader3'>".CUSLAN_8."</td>
-		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='page_title' size='50' value='".$page_title."' maxlength='250' /></td>
-		</tr>
-		
-		</td>
+		<td style='width:25%' class='forumheader3'>".CUSLAN_8."</td>
+		<td style='width:75%' class='forumheader3'><input class='tbox' type='text' name='page_title' size='50' value='".$page_title."' maxlength='250' /></td>
 		</tr>
-		
+
 		<tr>
-		<td style='width:30%' class='forumheader3'>".CUSLAN_9."</td>
-		<td style='width:70%' class='forumheader3'>";
+		<td style='width:25%' class='forumheader3'>".CUSLAN_9."</td>
+		<td style='width:75%' class='forumheader3'>";
 
-		$insertjs = (!$pref['wysiwyg'])?"rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'":
-		"rows='25' style='width:100%' ";
+		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);
-		$text .= "<textarea class='tbox' id='data' name='data' cols='80'  style='width:95%' $insertjs>".(strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data))."</textarea>";
+		$text .= "<textarea class='tbox' id='data' name='data' cols='80'   $insertjs>".(strstr($data, "[img]http") ? $data : str_replace("[img]../", "[img]", $data))."</textarea>";
 
-		if (!$pref['wysiwyg']) {
-			$text .= "<input id='helpb' class='helpbox' type='text' name='helpb' size='100' style='width:95%'/>
-			<br />".display_help("helpb");
-		}
+		$text .= "<br />".display_help('',"cpage")."</td>
+		</tr>
 
-		$text .= "</td>
+		<tr>
+			<td style='width:25%' class='forumheader3'>".LAN_UPLOAD_IMAGES."</td>
+			<td style='width:75%;' class='forumheader3'>".$tp->parseTemplate("{UPLOADFILE=".e_IMAGE."custom/}")."</td>
 		</tr>";
-	
+
 		if(!$mode)
 		{
-			$text .= "<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_10."</td>
-			<td style='width:70%;' class='forumheader3'>
+			$text .= "
+
+
+			<tr>
+			<td style='width:25%' class='forumheader3'>".CUSLAN_10."</td>
+			<td style='width:75%;' class='forumheader3'>
 			<input type='radio' name='page_rating_flag' value='1'".($page_rating_flag ? " checked='checked'" : "")." /> ".CUSLAN_38."&nbsp;&nbsp;
 			<input type='radio' name='page_rating_flag' value='0'".($page_rating_flag ? "" : " checked='checked'")." /> ".CUSLAN_39."
 			</td>
 			</tr>
 
 			<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_13."</td>
-			<td style='width:70%;' class='forumheader3'>
+			<td style='width:25%' class='forumheader3'>".CUSLAN_13."</td>
+			<td style='width:75%;' class='forumheader3'>
 			<input type='radio' name='page_comment_flag' value='1'".($page_comment_flag ? " checked='checked'" : "")." /> ".CUSLAN_38."&nbsp;&nbsp;
 			<input type='radio' name='page_comment_flag' value='0'".($page_comment_flag ? "" : " checked='checked'")." /> ".CUSLAN_39."
 			</td>
 			</tr>
 
 			<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_41."</td>
-			<td style='width:70%;' class='forumheader3'>
+			<td style='width:25%' class='forumheader3'>".CUSLAN_41."</td>
+			<td style='width:75%;' class='forumheader3'>
 			<input type='radio' name='page_display_authordate_flag' value='1'".($page_display_authordate_flag ? " checked='checked'" : "")." /> ".CUSLAN_38."&nbsp;&nbsp;
 			<input type='radio' name='page_display_authordate_flag' value='0'".($page_display_authordate_flag ? "" : " checked='checked'")." /> ".CUSLAN_39."
 			</td>
 			</tr>
 
 			<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_14."<br /><span class='smalltext'>".CUSLAN_15."</span></td>
-			<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='page_password' size='20' value='".$page_password."' maxlength='50' /></td>
+			<td style='width:25%' class='forumheader3'>".CUSLAN_14."<br /><span class='smalltext'>".CUSLAN_15."</span></td>
+			<td style='width:75%' class='forumheader3'><input class='tbox' type='text' name='page_password' size='20' value='".$page_password."' maxlength='50' /></td>
 			</tr>
 
 			<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_16."<br /><span class='smalltext'>".CUSLAN_17."</span></td>
-			<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='page_link' size='60' value='".$page_link."' maxlength='50' /></td>
+			<td style='width:25%' class='forumheader3'>".CUSLAN_16."<br /><span class='smalltext'>".CUSLAN_17."</span></td>
+			<td style='width:75%' class='forumheader3'><input class='tbox' type='text' name='page_link' size='60' value='".$page_link."' maxlength='50' /></td>
 			</tr>
 
 			<tr>
-			<td style='width:30%' class='forumheader3'>".CUSLAN_18."</td>
-			<td style='width:70%' class='forumheader3'>".r_userclass("page_class", $page_class)."</td>
+			<td style='width:25%' class='forumheader3'>".CUSLAN_18."</td>
+			<td style='width:75%' class='forumheader3'>".r_userclass("page_class", $page_class)."</td>
 			</tr>";
 		}
 
 		$text .= "<tr>
-		<td colspan='2' style='text-align:center' class='forumheader'>". 
+		<td colspan='2' style='text-align:center' class='forumheader'>".
 
-		(!$mode ? 
-		($edit  ? "<input class='button' type='submit' name='updatePage' value='".CUSLAN_19."' /><input type='hidden' name='pe_id' value='$id' />" : "<input class='button' type='submit' name='submitPage' value='".CUSLAN_20."' />") : 
+		(!$mode ?
+		($edit  ? "<input class='button' type='submit' name='updatePage' value='".CUSLAN_19."' /><input type='hidden' name='pe_id' value='$id' />" : "<input class='button' type='submit' name='submitPage' value='".CUSLAN_20."' />") :
 		($edit  ? "<input class='button' type='submit' name='updateMenu' value='".CUSLAN_21."' /><input type='hidden' name='pe_id' value='$id' />" : "<input class='button' type='submit' name='submitMenu' value='".CUSLAN_22."' />"))
 
-		."</td>
+		."<input type='hidden' name='mode' value='$mode' />
+		</td>
 		</tr>
 
 		</table>
@@ -294,7 +312,7 @@
 			$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'");
 			$e107cache->clear("page_{$mode}");
 			$e107cache->clear("page-t_{$mode}");
-			
+
 			if ($_POST['page_link'])
 			{
 				if ($sql -> db_Select("links", "link_id", "link_url='page.php?".$mode."' && link_name!='".$tp -> toDB($_POST['page_link'])."'"))
@@ -393,6 +411,7 @@
 		$ns->tablerender("Options", $text);
 	}
 
+
 	function saveSettings()
 	{
 		global $pref;
@@ -420,6 +439,7 @@
 		$var['options']['text'] = LAN_OPTIONS;
 		$var['options']['link'] = e_SELF."?options";
 
+
 		show_admin_menu(CUSLAN_33, $action, $var);
 	}
 }
@@ -430,4 +450,4 @@
 	$page -> show_options($action);
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/credits.php 0.7.7/e107_admin/credits.php
--- 0.7.5/e107_admin/credits.php	2006-04-18 03:37:54.000000000 -0500
+++ 0.7.7/e107_admin/credits.php	2006-10-28 20:00:20.000000000 -0500
@@ -11,105 +11,105 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/credits.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/04/18 08:37:54 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2006/10/29 01:00:20 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
+
 require_once("../class2.php");
 $e_sub_cat = 'credits';
 include(e_ADMIN.'ver.php');
 
 
-
 $creditsArray = array(
 	array(	"name" => "MagpieRSS",
 				"url" => "http://magpierss.sourceforge.net/",
-				"description" => "MagpieRSS provides an XML-based (expat) RSS parser in PHP.",
+				"description" => CRELAN_10,
 				"version" => "0.71.1",
-				"licence" => "GPL, permission granted"
+				"licence" => "GPL, ".CRELAN_8
 			),
 	array(	"name" => "PCLZip",
 				"url" => "http://www.phpconcept.net/pclzip/",
-				"description" => "PclZip library offers compression and extraction functions for Zip formatted archives (WinZip, PKZIP).",
+				"description" => CRELAN_11,
 				"version" => "2.3",
 				"licence" => "GPL"
 			),
 	array(	"name" => "PCLTar",
 				"url" => "http://www.phpconcept.net/pcltar/",
-				"description" => "PclTar offer the ability to archive a list of files or directories with or without compression. The archives created by PclTar are readeable by most of gzip/tar applications and by the Windows WinZip application.",
+				"description" => CRELAN_12,
 				"version" => "1.3",
 				"licence" => "GPL"
 			),
 	array(	"name" => "TinyMCE",
 				"url" => "http://tinymce.moxiecode.com/",
-				"description" => "TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.",
-				"version" => "2.01",
+				"description" => CRELAN_13,
+				"version" => "2.08",
 				"licence" => "GPL"
 			),
 	array(	"name" => "Nuvolo Icons",
 				"url" => "http://www.icon-king.com",
-				"description" => "Icons used in e107",
+				"description" => CRELAN_14,
 				"version" => "1.0",
 				"licence" => "GPL"
 			),
 	array(	"name" => "PHPMailer",
 				"url" => "http://phpmailer.sourceforge.net/",
-				"description" => "Full featured email transfer class for PHP",
+				"description" => CRELAN_15,
 				"version" => "1.72",
 				"licence" => "GPL"
 			),
 	array(	"name" => "Brainjar DHTML Menu",
 				"url" => "http://www.brainjar.com/dhtml/menubar/",
-				"description" => "Menu system used in Jayya theme",
+				"description" => CRELAN_16,
 				"version" => "0.1",
-				"licence" => "GPL, permission granted"
+				"licence" => "GPL, ".CRELAN_8
 			),
 	array(	"name" => "DHTML / JavaScript Calendar",
 				"url" => "http://www.dynarch.com/projects/",
-				"description" => "Popup calendar widget",
+				"description" => CRELAN_17,
 				"version" => "1.0",
 				"licence" => "GPL"
 			),
 	array(	"name" => "FPDF",
 				"url" => "http://www.fpdf.org/",
-				"description" => "PDF support",
+				"description" => CRELAN_18,
 				"version" => "1.53",
 				"licence" => "Freeware"
 			),
 	array(	"name" => "UFPDF",
 				"url" => "http://www.acko.net/node/56",
-				"description" => "UTF-8 PDF support",
+				"description" => CRELAN_19,
 				"version" => "0.1",
 				"licence" => "GPL"
 			),
 	);
 
 $contentA = array(
-	"<h3>e107 v0.7 was brought to you by ...</h3>",
-	"<h1>Carl Cedergren</h1>[ asperon ]<br /><br /><br />",
-	"<h1>Cameron Hanly</h1>[ CaMer0n ]<br /><br /><br />Always a pressure..err..pleasure!",
-	"<h1>Steve Dunstan</h1>[ jalist ]<br /><br /><br />\"MTVhNjMyZDgxN2QwM2Q3ZTI<br />5ODM2NDU3YWI0ZjM1NGILJT<br />yarrrrrr! wtf matey!\"",
-	"<h1>Eric Vanderfeesten</h1> [ lisa ]<br /><br /><br />",
-	"<h1>Thom Michelbrink</h1>[ McFly ]<br /><br /><br />",
-	"<h1>William Moffett</h1>[ que ]<br /><br /><br />",
-	"<h1>Martin Nicholls</h1>[ streaky ]<br /><br /><br />",
-	"<h1>James Currie</h1>[ SweetAs ]<br /><br /><br />\"Wot? No tea?? 0_0\"",
-	"<h1>Pete Holzmann</h1>[ MrPete ]<br /><br /><br />"
+	"<h3>".CRELAN_6."<\/h3>",
+	"<h1>Carl Cedergren<\/h1>[ asperon ]<br /><br /><br />".CRELAN_20,
+	"<h1>Cameron Hanly<\/h1>[ CaMer0n ]<br /><br /><br />".CRELAN_21,
+	"<h1>Steve Dunstan<\/h1>[ jalist ]<br /><br /><br />".CRELAN_22,
+	"<h1>Eric Vanderfeesten<\/h1> [ lisa ]<br /><br /><br />".CRELAN_23,
+	"<h1>Thom Michelbrink<\/h1>[ McFly ]<br /><br /><br />".CRELAN_24,
+	"<h1>William Moffett<\/h1>[ que ]<br /><br /><br />".CRELAN_25,
+	"<h1>Martin Nicholls<\/h1>[ streaky ]<br /><br /><br />".CRELAN_26,
+	"<h1>James Currie<\/h1>[ SweetAs ]<br /><br /><br />".CRELAN_27,
+	"<h1>Pete Holzmann<\/h1>[ MrPete ]<br /><br /><br />".CRELAN_28
 );
 
-echo "<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
+echo "<?xml version='1.0' encoding='".CHARSET."' ?><!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>e107 Credits</title>
-<meta http-equiv='content-type' content='text/html; charset=utf-8' />
+<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' />
 </head>
 <body style='padding: 0; margin: 0; background-color: #e8e8e8; color: #8E8E8E'>
 
-<img src='".e_IMAGE."generic/cred.png' alt='' />
-<div class='smalltext' style='position: absolute; top: 120px; left: 118px;'><b>version ".$e107info['e107_version'].", build ".($e107info['e107_build'] ? $e107info['e107_build'] : "zero")."</b><br />&copy; 2002-2006, all rights reserved</div>
+<div><img src='".e_IMAGE."generic/cred.png' alt='' />
+<div class='smalltext' style='position: absolute; top: 120px; left: 118px;'><b>".CRELAN_7." ".$e107info['e107_version'].", build ".($e107info['e107_build'] ? $e107info['e107_build'] : "zero")."</b><br />&copy; 2002-2006, ".CRELAN_3."</div>
 
 ";
 
@@ -126,8 +126,6 @@
 var fcontent=new Array();
 ";
 
-
-
 if(e_QUERY && e_QUERY == "stps")
 {
 	$count=1;
@@ -135,7 +133,7 @@
 	foreach($creditsArray as $credits)
 	{
 		extract($credits);
-		$fadejs .= "fcontent[$count] = '<br /><br /><h1>$name</h1>version $version<br /><br />$description<br /><br />[ <a href=\"$url\" rel=\"external\">$url</a> ]';
+		$fadejs .= "fcontent[$count] = '<br /><br /><h1>$name<\/h1>".CRELAN_7." $version<br /><br />$description<br /><br />[ <a href=\"$url\" rel=\"external\">$url<\/a> ]<br /><br />".CRELAN_9." - $licence';
 		";
 		$count++;
 	}
@@ -151,8 +149,6 @@
 	}
 }
 
-
-
 $fadejs .= <<<TEXT
 begintag='';
 closetag='';
@@ -163,7 +159,6 @@
 var fwidth='95%';
 var fheight='220px;'
 
-
 ///No need to edit below this line/////////////////
 
 var ie4=document.all&&!document.getElementById;
@@ -171,7 +166,6 @@
 var faderdelay=0;
 var index=0;
 
-
 /*Rafael Raposo edited function*/
 //function to change content
 function changecontent(){
@@ -233,32 +227,31 @@
 }
 
 if (ie4||DOM2)
-  document.write('<div id="fscroller" style="text-align: center; width:'+fwidth+';height:'+fheight+'"></div>');
+  document.write('<div id="fscroller" style="text-align: center; width:'+fwidth+';height:'+fheight+'"><\/div>');
 
 if (window.addEventListener)
 window.addEventListener("load", changecontent, false)
 else if (window.attachEvent)
 window.attachEvent("onload", changecontent)
 else if (document.getElementById)
-window.onload=changecontent
+window.onload=changecontent;
+//-->
 </script>
-<ilayer id="fscrollerns" width=&{fwidth}; height=&{fheight};><layer id="fscrollerns_sub" width=&{fwidth}; height=&{fheight}; left=0 top=0></layer></ilayer>
 
 TEXT;
 
-
-
 echo $fadejs;
 
-
 echo "
 <div style='text-align: center; margin-left: auto; margin-right: auto;'>
-<form>".
-(e_QUERY && e_QUERY == "stps" ? "<input class='tbox' type='button' onclick=\"self.parent.location='".e_ADMIN."credits.php'\" value='Show e107 Dev Team'>" : "<input class='tbox' type='button' onclick=\"self.parent.location='".e_ADMIN."credits.php?stps'\" value='Show third party scripts'>")."
+<form method='get' action=''><div>".
+(e_QUERY && e_QUERY == "stps" ? "<input class='tbox' type='button' onclick=\"self.parent.location='".e_ADMIN."credits.php'\" value='".CRELAN_4."' />" : "<input class='tbox' type='button' onclick=\"self.parent.location='".e_ADMIN."credits.php?stps'\" value='".CRELAN_5."' />")."</div>
 </form>
 </div>
+
+</div>
+</body>
+</html>
 ";
 
 ?>
-
-
diff -ruN 0.7.5/e107_admin/db.php 0.7.7/e107_admin/db.php
--- 0.7.5/e107_admin/db.php	2005-11-23 07:25:10.000000000 -0600
+++ 0.7.7/e107_admin/db.php	2006-10-14 10:53:46.000000000 -0500
@@ -11,13 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/db.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2005/11/23 13:25:10 $
-|     $Author: sweetas $
+|     $Revision: 1.21 $
+|     $Date: 2006/10/14 15:53:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../class2.php");
+if (!getperms('0')) {
+	header('location:'.e_BASE.'index.php');
+	exit;
+}
 $e_sub_cat = 'database';
 
 if (isset($_POST['db_update'])) {
@@ -31,17 +35,51 @@
 }
 
 require_once("auth.php");
+
+
+
+if(isset($_POST['delpref']) || (isset($_POST['delpref_checked']) && isset($_POST['delpref2']))  )
+{
+	del_pref_val();
+}
+
+
+if(isset($_POST['pref_editor']) || isset($_POST['delpref']) || isset($_POST['delpref_checked']))
+{
+	pref_editor();
+	require_once("footer.php");
+	exit;
+}
+
+
 if (isset($_POST['optimize_sql'])) {
 	optimizesql($mySQLdefaultdb);
 	require_once("footer.php");
 	exit;
 }
 
+
 if (isset($_POST['backup_core'])) {
 	backup_core();
 	message_handler("MESSAGE", DBLAN_1);
 }
 
+if(isset($_POST['delplug']))
+{
+	delete_plugin_entry();
+
+}
+
+if (isset($_POST['plugin_scan']) || e_QUERY == "plugin" || $_POST['delplug']) {
+	plugin_viewscan();
+	require_once("footer.php");
+	exit;
+}
+
+
+
+
+
 
 
 $text = "<div style='text-align:center'>
@@ -52,7 +90,7 @@
 	<td style='width:70%' class='forumheader3'>".DBLAN_15."</td>
 	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='db_update' value='".DBLAN_16."' /></td>
 	</tr>
-	
+
 	<tr>
 	<td style='width:70%' class='forumheader3'>".DBLAN_4."</td>
 	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='verify_sql' value='".DBLAN_5."' /></td>
@@ -64,6 +102,16 @@
 	</tr>
 
 	<tr>
+	<td style='width:70%' class='forumheader3'>".DBLAN_28."</td>
+	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='plugin_scan' value=\"".DBLAN_29."\" /></td>
+	</tr>
+
+	<tr>
+	<td style='width:70%' class='forumheader3'>".DBLAN_19."</td>
+	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='pref_editor' value='".DBLAN_20."' /></td>
+	</tr>
+
+	<tr>
 	<td style='width:70%' class='forumheader3'>".DBLAN_8."</td>
 	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='backup_core' value='".DBLAN_9."' />
 	<input type='hidden' name='sqltext' value='$sqltext' />
@@ -105,6 +153,129 @@
 
 }
 
+function plugin_viewscan()
+{
+		global $sql, $pref, $ns, $tp;
+		require_once(e_HANDLER."plugin_class.php");
+		$ep = new e107plugin;
+		$ep->update_plugins_table(); // scan for e_xxx changes and save to plugin table.
+		$ep->save_addon_prefs();  // generate global e_xxx_list prefs from plugin table.
+
+		$ns -> tablerender(DBLAN_22, "<div style='text-align:center'>".DBLAN_23."<br /><br /><a href='".e_SELF."'>".DBLAN_13."</a></div>");
+
+		$text = "<form method='post' action='".e_ADMIN."db.php' id='plug_edit'>
+				<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_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()){
+			$text .= "<tr>
+				<td class='forumheader3'>".$tp->toHtml($row['plugin_name'],FALSE,"defs")."</td>
+                <td class='forumheader3'>".$row['plugin_path']."</td>
+				<td class='forumheader3'>".str_replace(",","<br />",$row['plugin_addons'])."</td>
+				<td class='forumheader3' style='text-align:center'>";
+            if($previous == $row['plugin_path'])
+			{
+				$delid 	= $row['plugin_id'];
+				$delname = $row['plugin_name'];
+				$text .= "<input class='button' type='submit' title='".LAN_DELETE."' value='Delete Duplicate' name='delplug[$delid]' onclick=\"return jsconfirm('".LAN_CONFIRMDEL." ID:$delid [$delname]')\" />\n";
+			}
+			else
+			{
+            	$text .= ($row['plugin_installflag'] == 1) ? DBLAN_27 : " "; // "Installed and not installed";
+			}
+			$text .= "</td>
+			</tr>";
+			$previous = $row['plugin_path'];
+		}
+        $text .= "</table></div></form>";
+        $ns -> tablerender(ADLAN_CL_7, $text);
+
+}
+
+
+function pref_editor()
+{
+		global $pref,$ns,$tp;
+		ksort($pref);
+
+		$text = "<form method='post' action='".e_ADMIN."db.php' id='pref_edit'>
+				<div style='text-align:center'>
+				<table class='fborder' style='".ADMIN_WIDTH."'>
+                <tr>
+					<td class='fcaption'>".LAN_DELETE."</td>
+					<td class='fcaption'>".DBLAN_17."</td>
+					<td class='fcaption'>".DBLAN_18."</td>
+					<td class='fcaption'>".LAN_OPTIONS."</td>
+				</tr>";
+
+         foreach($pref as $key=>$val)
+		{
+			$ptext = (is_array($val)) ? "<pre>".print_r($val,TRUE)."</pre>" : htmlspecialchars($val);
+            $ptext = $tp -> textclean($ptext, 80);
+
+			$text .= "
+				<tr>
+				<td class='forumheader3' style='width:40px;text-align:center'><input type='checkbox' name='delpref2[$key]' value='1' /></td>
+				<td class='forumheader3'>".$key."</td>
+                <td class='forumheader3' style='width:50%'>".$ptext."</td>
+				<td class='forumheader3' style='width:20px;text-align:center'>
+					<input type='image' title='".LAN_DELETE."' src='".ADMIN_DELETE_ICON_PATH."' name='delpref[$key]' onclick=\"return jsconfirm('".LAN_CONFIRMDEL." [$key]')\" />
+       			</td>
+			</tr>";
+		}
+        $text .= "<tr><td class='forumheader' colspan='4' style='text-align:center'>
+			<input class='button' type='submit' title='".LAN_DELETE."' value=\"".DBLAN_21."\" name='delpref_checked' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\" />
+			</tr>
+		</table></div></form>";
+        $text .= "<div style='text-align:center'><br /><a href='".e_SELF."'>".DBLAN_13."</a></div>\n";
+        $ns -> tablerender(DBLAN_20, $text);
+
+		return $text;
+
+}
+
+
+
+function del_pref_val(){
+	global $pref,$ns,$e107cache;
+	$del = array_keys($_POST['delpref']);
+	$delpref = $del[0];
+
+	if($delpref)
+	{
+   		unset($pref[$delpref]);
+    	$deleted_list .= "<li>".$delpref."</li>";
+	}
+	if($_POST['delpref2']){
+
+    	foreach($_POST['delpref2'] as $k=>$v)
+		{
+            $deleted_list .= "<li>".$k."</li>";
+			unset($pref[$k]);
+		}
+	}
+
+	$message = "<div><br /><ul>".$deleted_list."</ul></div>
+	<div style='text-align:center'><br /><a href='".e_SELF."'>".DBLAN_13."</a></div>";
+ 	save_prefs();
+	$e107cache->clear();
+    $ns -> tablerender(LAN_DELETED,$message);
+
+}
+
+function delete_plugin_entry()
+{
+	global $sql,$ns;
+	$del = array_keys($_POST['delplug']);
+	$message = ($sql -> db_Delete("plugin", "plugin_id='".intval($del[0])."' LIMIT 1")) ? LAN_DELETED : LAN_DELETED_FAILED;
+    $caption = ($message == LAN_DELETED) ? LAN_DELETED : LAN_ERROR;
+    $ns -> tablerender($caption,$message);
+}
+
 require_once("footer.php");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/db_verify.php 0.7.7/e107_admin/db_verify.php
--- 0.7.5/e107_admin/db_verify.php	2005-08-23 04:36:30.000000000 -0500
+++ 0.7.7/e107_admin/db_verify.php	2006-10-28 20:00:20.000000000 -0500
@@ -11,61 +11,49 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/db_verify.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2005/08/23 09:36:30 $
-|     $Author: sweetas $
+|     $Revision: 1.23 $
+|     $Date: 2006/10/29 01:00:20 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
 $e_sub_cat = 'database';
 require_once("auth.php");
 
+
 $filename = "sql/core_sql.php";
-@$fd = fopen ($filename, "r");
+$fd = fopen ($filename, "r");
 $sql_data = @fread($fd, filesize($filename));
-@fclose ($fd);
+fclose ($fd);
 
 if (!$sql_data) {
 	echo DBLAN_1."<br /><br />";
 	exit;
 }
 
-$tables["core"] = $sql_data;
+ $tables["core"] = $sql_data;
 
 if (!getperms("0")) {
 	header("location:".e_BASE."index.php");
 	exit;
 }
 
-//Get installed plugins
-if($sql->db_Select("plugin","plugin_path","plugin_installflag = '1'")){
-	while($row = $sql->db_Fetch()){
-		$pluginList[] = $row['plugin_path'];
-	}
-}
-
 //Get any plugin _sql.php files
-$handle = opendir(e_PLUGIN);
-$c = 1;
-while (false !== ($file = readdir($handle))) {
-	if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file) && in_array($file, $pluginList))
-	{
-		$plugin_handle = opendir(e_PLUGIN.$file."/");
-		while (false !== ($file2 = readdir($plugin_handle)))
-		{
-			if (preg_match("/(.*?)_sql.php/", $file2, $matches))
-			{
-				$filename = e_PLUGIN.$file."/".$file2;
-				@$fd = fopen ($filename, "r");
-				$sql_data = @fread($fd, filesize($filename));
-				@fclose ($fd);
-				$tables[$matches[1]] = $sql_data;
-			}
+
+    foreach($pref['e_sql_list'] as $path => $file)
+    {
+        $filename = e_PLUGIN.$path."/".$file.".php";
+		if(is_readable($filename)){
+        	$fd = fopen($filename, "r");
+        	$sql_data = fread($fd, filesize($filename));
+        	fclose ($fd);
+			$id = str_replace("_sql","",$file);
+        	$tables[$id] = $sql_data;
+		}else{
+        	echo $filename." is not readable<br />";
 		}
-		closedir($plugin_handle);
-	}
-}
-closedir($handle);
+    }
+
 
 
 function read_tables($tab) {
@@ -135,7 +123,7 @@
 	$table_list = "";
 	read_tables($what);
 
-	$text = "<form method='POST' action='".e_SELF."' id='checktab'>
+	$text = "<form method='post' action='".e_SELF."' id='checktab'>
 		<div style='text-align:center'>
 		<table style='".ADMIN_WIDTH."' class='fborder'>
 		<tr>
@@ -145,7 +133,7 @@
 		<td class='fcaption' style='text-align:center'>".DBLAN_7."</td>
 		</tr>";
 	foreach(array_keys($table_list) as $k) {
-		$text .= "<tr>";
+
 		$prefix = MPREFIX;
 		$current_tab = get_current($k, $prefix);
 		unset($fields);
@@ -256,9 +244,9 @@
 // -------------------- Table Fixing ------------------------------
 
 if(isset($_POST['do_fix'])){
-	$text = "<div><table class='fborder' style='width:100%'>";
+	$text = "<div><table class='fborder' style='".ADMIN_WIDTH."'>";
 	foreach( $_POST['fix_active'] as $key=>$val){
-		
+
 		if (MAGIC_QUOTES_GPC == TRUE) {
 			$table = stripslashes($_POST['fix_table'][$key][0]);
 			$newval = stripslashes($_POST['fix_newval'][$key][0]);
@@ -270,7 +258,8 @@
 			$mode = $_POST['fix_mode'][$key][0];
 			$after = $_POST['fix_after'][$key][0];
 		}
-		
+
+
 		$field= $key;
 
 		if($mode == "alter"){
@@ -286,7 +275,11 @@
 		}
 
 		if($mode == "index"){
-			$query = "ALTER TABLE `".MPREFIX.$table."` ADD INDEX (`$field`) ";
+			$query = "ALTER TABLE `".MPREFIX.$table."` ADD INDEX `$field` (`$newval`)";
+		}
+
+		if($mode == "indexdrop"){
+			$query = "ALTER TABLE `".MPREFIX.$table."` DROP INDEX `$field`";
 		}
 
 		if($mode == "create"){
@@ -302,7 +295,7 @@
 	}
 		$text .= "</table></div>";
 		$text .="<div style='text-align:center'><br />
-				<form method='POST' action='db.php'>
+				<form method='post' action='db.php'>
 				<input class='button' type='submit' name='back' value='".DBLAN_17."' />
 				</form>
 				</div>";
@@ -313,16 +306,16 @@
 
 
 // ---------------------- Main Form and Submit. ------------------------
-if (!$_POST) {
+if (!$_POST['db_verify'] && !$_POST['do_fix']) {
 	$text = "
-		<form method='POST' action='".e_SELF."'>
+		<form method='post' action='".e_SELF."'>
 		<table border=0 align='center'>
 		<tr><td>".DBLAN_14."<br /><br />";
 	foreach(array_keys($tables) as $x) {
-		$text .= "<input type='checkbox' name='table_".$x."'>".$x."<br />";
+		$text .= "<input type='checkbox' name='table_".$x."' />".$x."<br />";
 	}
 	$text .= "
-		<br /><input class='button' type='submit' value='".DBLAN_15."'>
+		<br /><input class='button' name='db_verify' type='submit' value='".DBLAN_15."' />
 		</td></tr></table></form>";
 	$ns->tablerender(DBLAN_16, $text);
 } else {
@@ -331,7 +324,7 @@
 			$xx = $match[1];
 			$str = "<br />
 				<div style='text-align:center'>
-				<form method='POST' action='db.php'>
+				<form method='post' action='db.php'>
 				<input class='button' type='submit' name='back' value='".DBLAN_17."' />
 				</form>
 				</div>";
@@ -347,7 +340,7 @@
 
 	if(stristr($field, "KEY ") !== FALSE){
 		$field = chop(str_replace("KEY ","",$field));
-		$mode = "index";
+		$mode = ($mode == "drop") ? "indexdrop" : "index";
 		$search = array("(",")");
 		$newvalue = str_replace($search,"",$newvalue);
 	}
@@ -358,9 +351,9 @@
 
 	$text .= "<input type='checkbox'  name=\"fix_active[$field][]\" value='1' /> ".DBLAN_19."\n"; // 'attempt to fix'
 	$text .= "<input type='hidden' name=\"fix_newval[$field][]\" value=\"$newvalue\" />\n";
-	$text .= "<input type='hidden'  name=\"fix_table[$field][]\" value=\"$table\" / >\n";
-	$text .= "<input type='hidden'  name=\"fix_mode[$field][]\" value=\"$mode\" / >\n";
-	$text .= ($after) ? "<input type='hidden'  name=\"fix_after[$field][]\" value=\"$after\" / >\n" : "";
+	$text .= "<input type='hidden'  name=\"fix_table[$field][]\" value=\"$table\" />\n";
+	$text .= "<input type='hidden'  name=\"fix_mode[$field][]\" value=\"$mode\" />\n";
+	$text .= ($after) ? "<input type='hidden'  name=\"fix_after[$field][]\" value=\"$after\" />\n" : "";
 
 	return $text;
 }
@@ -406,4 +399,4 @@
 
 
 require_once(e_ADMIN."footer.php");
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/download.php 0.7.7/e107_admin/download.php
--- 0.7.5/e107_admin/download.php	2006-05-13 20:01:31.000000000 -0500
+++ 0.7.7/e107_admin/download.php	2006-10-26 18:36:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/download.php,v $
-|     $Revision: 1.79 $
-|     $Date: 2006/05/14 01:01:31 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.93 $
+|     $Date: 2006/10/26 23:36:27 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -82,6 +82,14 @@
 		sort($file_array);
 }
 
+if($public_array = $fl->get_files(e_FILE."public/")){
+	foreach($public_array as $key=>$val){
+    	$file_array[] = str_replace(e_FILE."public/","",$val);
+	}
+}
+
+
+
 if ($sql->db_Select("rbinary")){
 	while ($row = $sql->db_Fetch())	{
 		extract($row);
@@ -89,16 +97,19 @@
 	}
 }
 
-$reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
 
-if($image_array = $fl->get_files(e_FILE."downloadimages/", "",$reject,1)){
+
+if($image_array = $fl->get_files(e_FILE."downloadimages/", ".gif|.jpg|.png|.GIF|.JPG|.PNG","standard",2)){
 	sort($image_array);
 }
 
-if($thumb_array = $fl->get_files(e_FILE."downloadthumbs/", "",$reject,1)){
+if($thumb_array = $fl->get_files(e_FILE."downloadthumbs/", ".gif|.jpg|.png|.GIF|.JPG|.PNG","standard",2)){
 	sort($thumb_array);
 }
 
+if(isset($_POST)){
+	$e107cache->clear("download_cat");
+}
 
 if (isset($_POST['add_category'])) {
 	$download->create_category($sub_action, $id);
@@ -130,6 +141,7 @@
 	$pref['download_email'] = $_POST['download_email'];
 	$pref['agree_text'] = $tp->toDB($_POST['agree_text']);
 	$pref['download_denied'] = $tp->toDB($_POST['download_denied']);
+	$pref['download_reportbroken'] = $_POST['download_reportbroken'];
 	save_prefs();
 	$message = DOWLAN_65;
 }
@@ -218,10 +230,11 @@
 
 if ($delete == 'main') {
 
-	$result = admin_update($sql->db_Delete("download", "download_id='$del_id' "), 'delete', DOWLAN_35." #".$del_id." ".DOWLAN_36);
+	$result = admin_update($sql->db_Delete("download", "download_id='$del_id' "), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
 	if($result)
 	{
 		admin_purge_related("download", $del_id);
+		$e_event->trigger("dldelete", $del_id);
 	}
 	unset($sub_action, $id);
 }
@@ -265,7 +278,7 @@
 		<td class='forumheader3' style='width:30%;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_60);
+		$order_options = array("download_id"=>"Id No.","download_datestamp"=>LAN_DATE,"download_requested"=>ADLAN_24,"download_name"=>DOWLAN_59,"download_author"=>DOWLAN_15);
 		foreach($order_options as $value=>$label){
 			$select = ($pref['download_order'] == $value) ? "selected='selected'" : "";
 			$text .= "<option value='$value' $select >$label</option>\n";
@@ -284,6 +297,11 @@
 		</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>
+		</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>
 		</tr>
@@ -293,6 +311,8 @@
 		<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>
 		</tr>
 
+
+
 		<tr><td style='width:70%' class='forumheader3'>
 		".DOWLAN_101."
 		</td>
@@ -592,8 +612,16 @@
 
 	}
 
+
+// ---------------------------------------------------------------------------
+
+
 	function create_download($sub_action, $id) {
-		global $cal,$tp, $sql, $rs, $ns, $file_array, $image_array, $thumb_array,$pst;
+
+
+		global $cal,$tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array,$pst;
+		require_once(e_FILE."shortcode/batch/download_shortcodes.php");
+
 		$download_status[0] = DOWLAN_122;
 		$download_status[1] = DOWLAN_123;
 		$download_status[2] = DOWLAN_124;
@@ -634,17 +662,17 @@
 		if ($sub_action == "dlm" && !$_POST['submit']) {
 			if ($sql->db_Select("upload", "*", "upload_id='$id' ")) {
 				$row = $sql->db_Fetch();
-				extract($row);
-				$download_category = $upload_category;
-				$download_name = $upload_name.($upload_version ? " v" . $upload_version : "");
-				$download_url = $upload_file;
-				$download_author_email = $upload_email;
-				$download_author_website = $upload_website;
-				$download_description = $upload_description;
-				$download_image = $upload_ss;
-				$download_filesize = $upload_filesize;
-				$image_array[] = $upload_ss;
-				$download_author = substr($upload_poster, (strpos($upload_poster, ".")+1));
+
+				$download_category = $row['upload_category'];
+				$download_name = $row['upload_name'].($row['upload_version'] ? " v" . $row['upload_version'] : "");
+				$download_url = $row['upload_file'];
+				$download_author_email = $row['upload_email'];
+				$download_author_website = $row['upload_website'];
+				$download_description = $row['upload_description'];
+				$download_image = $row['upload_ss'];
+				$download_filesize = $row['upload_filesize'];
+				$image_array[] = array("path" => "", "fname" => $row['upload_ss']);
+				$download_author = substr($row['upload_poster'], (strpos($row['upload_poster'], ".")+1));
 			}
 		}
 
@@ -657,18 +685,9 @@
 			<td style='width:20%' class='forumheader3'>".DOWLAN_11."</td>
 			<td style='width:80%' class='forumheader3'>";
 
-		$sql->db_Select("download_category", "*", "download_category_parent !=0");
-		$text .= "<select name='download_category' class='tbox'>\n";
-		while ($row = $sql->db_Fetch()) {
-			extract($row);
-			if ($download_category_id == $download_category) {
-				$text .= "<option value='$download_category_id' selected='selected'>".$download_category_name."</option>\n";
-			} else {
-				$text .= "<option value='$download_category_id'>".$download_category_name."</option>\n";
-			}
-		}
-		$text .= "</select>
-			</td>
+        $text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$download_category}}",true,$download_shortcodes);
+
+		$text .= "</td>
 			</tr>
 
 			<tr>
@@ -683,7 +702,7 @@
 			<td style='width:80%' class='forumheader3'><div style='padding-bottom:5px'>".DOWLAN_131."&nbsp;&nbsp;
 
 		   <select name='download_url' class='tbox'>
-			<option></option>
+			<option value=''>&nbsp;</option>
 			";
 
 		$counter = 0;
@@ -732,7 +751,7 @@
 
 		if(!$sql -> db_Select("download_mirror"))
 		{
-			$text .= DOWLAN_144."</tr></tr>";
+			$text .= DOWLAN_144."</tr>";
 		}
 		else
 		{
@@ -749,7 +768,7 @@
 				$opt = ($count==1) ? "id='mirror'" : "";
 				$text .="<span $opt>
 				<select name='download_mirror_name[]' class='tbox'>
-					<option></option>";
+					<option value=''>&nbsp;</option>";
 
 				foreach($mirrorList as $mirror)	{
 					extract($mirror);
@@ -810,16 +829,25 @@
 			<td style='width:20%' class='forumheader3'>".DOWLAN_19.":</td>
 			<td style='width:80%' class='forumheader3'>
 			<select name='download_image' class='tbox'>
-			<option value=''></option>";
+			<option value=''>&nbsp;</option>";
 
-			foreach($image_array as $img){
+			foreach($image_array as $img)
+			{
 				$fpath = str_replace(e_FILE."downloadimages/","",$img['path'].$img['fname']);
             	$sel = ($download_image == $fpath) ? " selected='selected'" : "";
             	$text .= "<option value='".$fpath."' $sel>".$fpath."</option>\n";
 			}
 
 		$text .= "
-			</select>
+			</select>";
+
+			if($sub_action == "dlm" && $download_image)
+			{
+            	$text .= "
+				<input type='hidden' name='move_image' value='1' />\n";
+			}
+
+		$text .= "
 			</td>
 			</tr>
 
@@ -827,7 +855,7 @@
 			<td style='width:20%' class='forumheader3'>".DOWLAN_20.":</td>
 			<td style='width:80%' class='forumheader3'>
 			<select name='download_thumb' class='tbox'>
-			<option></option>
+			<option value=''>&nbsp;</option>
 			";
 
 			foreach($thumb_array as $thm){
@@ -915,13 +943,42 @@
 			";
 
 		if ($sub_action == "dlm") {
-			$text .= "<tr>
+			$text .= "
+
+			<tr>
+				<td style='width:30%' class='forumheader3'>".DOWLAN_153.":<br /></td>
+				<td style='width:70%' class='forumheader3'>
+				<select name='move_file' class='tbox'>
+				<option value=''>".LAN_NO."</option>
+				";
+
+            	$dl_dirlist = $fl->get_dirs(e_DOWNLOAD);
+               	if($dl_dirlist){
+					sort($dl_dirlist);
+					$text .= "<option value='".e_DOWNLOAD."'>/</option>\n";
+					foreach($dl_dirlist as $dirs)
+					{
+        				$text .= "\t\t\t\t<option value='". e_DOWNLOAD.$dirs."/'>".$dirs."/</option>\n";
+					}
+				}
+				else
+				{
+                	$text .= "\t\t\t\t<option value='".e_DOWNLOAD."'>".LAN_YES."</option>\n";
+				}
+
+			$text .= "</select>
+				</td>
+			</tr>
+
+
+			<tr>
 				<td style='width:30%' class='forumheader3'>".DOWLAN_103.":<br /></td>
 				<td style='width:70%' class='forumheader3'>
 				<input type='checkbox' name='remove_upload' value='1' />
 				<input type='hidden' name='remove_id' value='$id' />
-				</td></tr>
-				";
+				</td>
+			</tr>
+            ";
 		}
 
 		$text .= "
@@ -943,11 +1000,20 @@
 		$ns->tablerender(ADLAN_24, $text);
 	}
 
+
+// -----------------------------------------------------------------------------
+
+
 	function show_message($message) {
 		global $ns;
 		$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 	}
 
+
+// -----------------------------------------------------------------------------
+
+
+
 	function submit_download($sub_action, $id) {
 		global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
 
@@ -993,6 +1059,45 @@
 			}
 		}
 
+		//  ----   Move Images and Files ------------
+
+		if($_POST['move_image'])
+		{
+			if($_POST['download_thumb'])
+			{
+				$oldname = e_FILE."public/".$_POST['download_thumb'];
+				$newname = e_FILE."downloadthumbs/".$_POST['download_thumb'];
+				if(!$this -> move_file($oldname,$newname))
+				{
+            		return;
+				}
+			}
+			if($_POST['download_image'])
+			{
+				$oldname = e_FILE."public/".$_POST['download_image'];
+				$newname = e_FILE."downloadimages/".$_POST['download_image'];
+				if(!$this -> move_file($oldname,$newname))
+				{
+            		return;
+				}
+			}
+		}
+
+        if($_POST['move_file'] && $_POST['download_url'])
+		{
+        	$oldname = e_FILE."public/".$_POST['download_url'];
+			$newname = $_POST['move_file'].$_POST['download_url'];
+			if(!$this -> move_file($oldname,$newname))
+			{
+            	return;
+			}
+            $durl = str_replace(e_DOWNLOAD,"",$newname);
+		}
+
+
+       // ------------------------------------------
+
+
 		$_POST['download_description'] = $tp->toDB($_POST['download_description']);
 		$_POST['download_name'] = $tp->toDB($_POST['download_name']);
 		$_POST['download_author'] = $tp->toDB($_POST['download_author']);
@@ -1021,9 +1126,11 @@
 
 		if ($id)
 		{
-			admin_update($sql->db_Update("download", "download_name='".$_POST['download_name']."', download_url='".$durl."', download_author='".$_POST['download_author']."', download_author_email='".$_POST['download_author_email']."', download_author_website='".$_POST['download_author_website']."', download_description='".$_POST['download_description']."', download_filesize='".$filesize."', download_category='".intval($_POST['download_category'])."', download_active='".intval($_POST['download_active'])."', download_datestamp='".intval($_POST['download_datestamp'])."', download_thumb='".$_POST['download_thumb']."', download_image='".$_POST['download_image']."', download_comment='".intval($_POST['download_comment'])."', download_class = '{$_POST['download_class']}', download_mirror='$mirrorStr', download_mirror_type='".intval($_POST['download_mirror_type'])."' , download_visible='".$_POST['download_visible']."' WHERE download_id=".intval($id)), 'update', DOWLAN_2);
+			admin_update($sql->db_Update("download", "download_name='".$_POST['download_name']."', download_url='".$durl."', download_author='".$_POST['download_author']."', download_author_email='".$_POST['download_author_email']."', download_author_website='".$_POST['download_author_website']."', download_description='".$_POST['download_description']."', download_filesize='".$filesize."', download_category='".intval($_POST['download_category'])."', download_active='".intval($_POST['download_active'])."', download_datestamp='".intval($_POST['download_datestamp'])."', download_thumb='".$_POST['download_thumb']."', download_image='".$_POST['download_image']."', download_comment='".intval($_POST['download_comment'])."', download_class = '{$_POST['download_class']}', download_mirror='$mirrorStr', download_mirror_type='".intval($_POST['download_mirror_type'])."' , download_visible='".$_POST['download_visible']."' WHERE download_id=".intval($id)), 'update', DOWLAN_2." (<a href='".e_BASE."download.php?view.".$id."'>".$_POST['download_name']."</a>)");
+            $dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] );
+			$e_event->trigger("dlupdate", $dlinfo);
 		} else {
-			if (admin_update($download_id = $sql->db_Insert("download", "0, '".$_POST['download_name']."', '".$durl."', '".$_POST['download_author']."', '".$_POST['download_author_email']."', '".$_POST['download_author_website']."', '".$_POST['download_description']."', '".$filesize."', '0', '".intval($_POST['download_category'])."', '".intval($_POST['download_active'])."', '".intval($_POST['download_datestamp'])."', '".$_POST['download_thumb']."', '".$_POST['download_image']."', '".intval($_POST['download_comment'])."', '{$_POST['download_class']}', '$mirrorStr', '".intval($_POST['download_mirror_type'])."', '".$_POST['download_visible']."' "), 'insert', DOWLAN_1)) {
+			if (admin_update($download_id = $sql->db_Insert("download", "0, '".$_POST['download_name']."', '".$durl."', '".$_POST['download_author']."', '".$_POST['download_author_email']."', '".$_POST['download_author_website']."', '".$_POST['download_description']."', '".$filesize."', '0', '".intval($_POST['download_category'])."', '".intval($_POST['download_active'])."', '".intval($_POST['download_datestamp'])."', '".$_POST['download_thumb']."', '".$_POST['download_image']."', '".intval($_POST['download_comment'])."', '{$_POST['download_class']}', '$mirrorStr', '".intval($_POST['download_mirror_type'])."', '".$_POST['download_visible']."' "), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)")) {
 				$dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] );
 				$e_event->trigger("dlpost", $dlinfo);
 
@@ -1037,6 +1144,9 @@
 		}
 	}
 
+
+// -----------------------------------------------------------------------------
+
 	function show_categories($sub_action, $id)
 	{
 		global $sql, $rs, $ns, $tp, $pst;
@@ -1046,7 +1156,7 @@
 		}
 		$text = $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
 		$text .= "<div style='padding : 1px; ".ADMIN_WIDTH."; height : 200px; overflow : auto; margin-left: auto; margin-right: auto;'>";
-		
+
 		$qry = "
 		SELECT dc.*, COUNT(d.download_id) AS filecount FROM #download_category AS dc
 		LEFT JOIN #download AS d ON d.download_category = dc.download_category_id
@@ -1081,7 +1191,7 @@
 				}
 
 				$text .= "<tr>
-					<td style='width:5%; text-align:center' class='forumheader'>".($parent['download_category_icon'] ? "<img src='".e_IMAGE."icons/{$main['download_category_icon']}' style='vertical-align:middle; border:0' alt='' />" : "&nbsp;")."</td>
+					<td style='width:5%; text-align:center' class='forumheader'>".($parent['download_category_icon'] ? "<img src='".e_IMAGE."icons/{$parent['download_category_icon']}' style='vertical-align:middle; border:0' alt='' />" : "&nbsp;")."</td>
 					<td colspan='2' style='width:70%' class='forumheader'><b>{$parent['download_category_name']}</b></td>
 					<td class='forumheader3'>
 					 <input class='tbox' type='text' name='catorder[{$parent['download_category_id']}]' value='{$parent['download_category_order']}' size='3' />
@@ -1104,7 +1214,7 @@
 				{
 					foreach($cat_array[$parent['download_category_id']] as $main)
 					{
-						
+
 						if(strstr($main['download_category_icon'], chr(1)))
 						{
 							list($main['download_category_icon'], $main['download_category_icon_empty']) = explode(chr(1), $main['download_category_icon']);
@@ -1131,7 +1241,7 @@
 						{
 							foreach($cat_array[$main['download_category_id']] as $sub)
 							{
-						
+
 								if(strstr($sub['download_category_icon'], chr(1)))
 								{
 									list($sub['download_category_icon'], $sub['download_category_icon_empty']) = explode(chr(1), $sub['download_category_icon']);
@@ -1215,7 +1325,7 @@
 				<option>".DOWLAN_40."</option>
 				</select>\n";
 		} else {
-			$text .= "
+            $text .= "
 				<select name='download_category_parent' class='tbox'>
 				<option>".DOWLAN_40."</option>";
 
@@ -1386,8 +1496,8 @@
 
 		if($sub_action == "edit" && !defined("SUBMITTED"))
 		{
-			$sql -> db_Select("download_mirror", "*", "mirror_id=".$id);
-			$row = $sql -> db_Fetch();
+			$sql -> db_Select("download_mirror", "*", "mirror_id='".intval($id)."' ");
+			$mirror = $sql -> db_Fetch();
 			extract($mirror);
 			$edit = TRUE;
 		}
@@ -1397,8 +1507,6 @@
 			$edit = FALSE;
 		}
 
-
-
 		$text = "<div style='text-align:center'>
 		<form method='post' action='".e_SELF."?".e_QUERY."' id='dataform'>\n
 		<table style='".ADMIN_WIDTH."' class='fborder'>
@@ -1485,7 +1593,46 @@
 		}
 	}
 
-}
+ // ---------------------------------------------------------------------------
+
+    function move_file($oldname,$newname)
+	{
+		global $ns;
+		if(file_exists($newname))
+		{
+        	return TRUE;
+		}
+
+		if(!file_exists($oldname) || is_dir($oldname))
+		{
+			$ns -> tablerender(LAN_ERROR,DOWLAN_68 . " : ".$oldname);
+        	return FALSE;
+		}
+
+		$directory = dirname($newname);
+		if(is_writable($directory))
+		{
+			if(!rename($oldname,$newname))
+			{
+				$ns -> tablerender(LAN_ERROR,DOWLAN_152." ".$oldname ." -> ".$newname);
+				return FALSE;
+			}
+			else
+			{
+				return TRUE;
+			}
+		}
+		else
+		{
+            $ns -> tablerender(LAN_ERROR,$directory ." ".LAN_NOTWRITABLE);
+			return FALSE;
+		}
+	}
+
+// -------------------------------------------------------------------------
+
+
+} // end class.
 
 
 function download_adminmenu($parms) {
@@ -1497,4 +1644,5 @@
 
 
 
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/emoticon.php 0.7.7/e107_admin/emoticon.php
--- 0.7.5/e107_admin/emoticon.php	2006-01-13 08:38:41.000000000 -0600
+++ 0.7.7/e107_admin/emoticon.php	2006-11-28 02:43:02.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/emoticon.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2006/01/13 14:38:41 $
-|     $Author: sweetas $
+|     $Revision: 1.35 $
+|     $Date: 2006/11/28 08:43:02 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -64,8 +64,11 @@
 	}
 }
 
-$emote -> installCheck();
-$emote -> listPacks();
+$check = TRUE;
+$check = $emote -> installCheck();
+if($check!==FALSE){
+	$emote -> listPacks();
+}
 
 class emotec
 {
@@ -133,12 +136,12 @@
 
 			foreach($emoteArray as $emote)
 			{
-				$text .= "<img src='".$emote['path']."/".$emote['fname']."' alt='' /> ";
+				$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>
+			<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>
 			";
 		}
@@ -191,14 +194,14 @@
 			<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>
 			</tr>
-			";	
+			";
 		}
 
 		$text .= "
 		<tr>
 		<td style='text-align: center;' colspan='3' class='forumheader'><input class='button' type='submit' name='sub_conf' value='".EMOLAN_14."' /></td>
 		</tr>
-		
+
 		</table>
 		<input type='hidden' name='packID' value='$packID' />
 		</form>";
@@ -234,6 +237,24 @@
 		global $sql, $fl;
 		foreach($this -> packArray as $value)
 		{
+			if(strpos($value,' ')!==FALSE){
+				global $ns;
+				$msg = "
+				<div style='text-align:center;'><b>".EMOLAN_17."<br />".EMOLAN_18."</b><br /><br />
+					<table class='fborder'>
+					<tr>
+						<td class='fcaption'>".EMOLAN_19."</td>
+						<td class='fcaption'>".EMOLAN_20."</td>
+					</tr>
+					<tr>
+						<td class='forumheader3'>".$value."</td>
+						<td class='forumheader3'>".e_IMAGE."emotes/</td>
+					</tr>
+					</table>
+				</div>";
+				$ns->tablerender(EMOLAN_21, $msg);
+				return FALSE;
+			}
 			if(!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' "))
 			{
 				$fileArray = $fl -> get_files(e_IMAGE."emotes/".$value);
@@ -281,8 +302,8 @@
 				{
 					$filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
 
-					$handle = fopen ($filename, "r"); 
-					$contents = fread ($handle, filesize ($filename)); 
+					$handle = fopen ($filename, "r");
+					$contents = fread ($handle, filesize ($filename));
 					fclose ($handle);
 
 					preg_match_all("#\<emoticon file=\"(.*?)\"\>(.*?)\<\/emoticon\>#si", $contents, $match);
@@ -321,7 +342,7 @@
 					echo "<div style='text-align: center;'><b>New emote php found: '</b> ".$value."'</div>";
 				}
 				/* end ----------------------------------------------------------------------------------------------------------------------------------------- */
-				
+
 			}
 		}
 	}
@@ -329,4 +350,4 @@
 
 require_once("footer.php");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/filemanager.php 0.7.7/e107_admin/filemanager.php
--- 0.7.5/e107_admin/filemanager.php	2006-02-14 21:06:43.000000000 -0600
+++ 0.7.7/e107_admin/filemanager.php	2006-11-15 09:55:40.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/filemanager.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/02/15 03:06:43 $
-|     $Author: e107coders $
+|     $Revision: 1.21 $
+|     $Date: 2006/11/15 15:55:40 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -108,7 +108,7 @@
 	$ns->tablerender("", "<div style=\"text-align:center\"><b>".$message."</b></div>");
 }
 
-if (strpos(e_QUERY, ".")) {
+if (strpos(e_QUERY, ".") && !is_dir(realpath(e_BASE.$path))){
 	echo "<iframe style=\"width:100%\" src=\"".e_BASE.e_QUERY."\" height=\"300\" scrolling=\"yes\"></iframe><br /><br />";
 	if (!strpos(e_QUERY, "/")) {
 		$path = "";
@@ -219,7 +219,7 @@
 	} else {
 		$pathup = e_SELF."?".substr($path, 0, strrpos(substr($path, 0, -1), "/"))."/";
 	}
-	$text .= "<tr><td colspan=\"5\" class=\"forumheader3\"><a href=\"".$pathup."\"><img src=\"".$imagedir."updir.png\" alt=\"".FMLAN_30."\" style=\"border:0\" /> </a>
+	$text .= "<tr><td colspan=\"5\" class=\"forumheader3\"><a href=\"".$pathup."\"><img src=\"".$imagedir."updir.png\" alt=\"".FMLAN_30."\" style=\"border:0\" /></a> 
 		<a href=\"filemanager.php\"><img src=\"".$imagedir."home.png\" alt=\"".FMLAN_16."\" style=\"border:0\" /></a>
 		</td>
 		</tr>";
diff -ruN 0.7.5/e107_admin/fla.php 0.7.7/e107_admin/fla.php
--- 0.7.5/e107_admin/fla.php	2006-03-03 17:36:47.000000000 -0600
+++ 0.7.7/e107_admin/fla.php	2006-10-29 21:58:29.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/fla.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/03/03 23:36:47 $
+|     $Revision: 1.12 $
+|     $Date: 2006/10/30 03:58:29 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -110,7 +110,7 @@
 		$host = $e107->get_host_name(getenv($gen_ip));
 		$text .= "<tr>
 		<td style='width: 20%;' class='forumheader3'>".$gen->convert_date($gen_datestamp, "forum")."</td>
-		<td style='width: 50%;' class='forumheader3'>".str_replace(":::", "<br />", htmlentities($gen_chardata))."</td>
+		<td style='width: 50%;' class='forumheader3'>".str_replace(":::", "<br />", htmlentities($gen_chardata, ENT_QUOTES, CHARSET))."</td>
 		<td style='width: 20%;' class='forumheader'>".$fa['gen_ip']."<br />{$host}</td>
 		<td style='width: 10%; text-align: left;' class='forumheader3'>
 		<input type='checkbox' name='fladelete[]' value='$gen_id' /> ".LAN_DELETE."<br />
@@ -154,4 +154,4 @@
 
 require_once("footer.php");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/footer.php 0.7.7/e107_admin/footer.php
--- 0.7.5/e107_admin/footer.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/footer.php	2006-10-14 08:01:41.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/footer.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.22 $
+|     $Date: 2006/10/14 13:01:41 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-global $ADMIN_FOOTER;
+global $ADMIN_FOOTER, $footer_js, $sql;
 
 if (ADMIN == TRUE) {
 	if ($pref['cachestatus']) {
@@ -54,20 +54,46 @@
 
 if($error_handler->debug == true) {
 	echo "
-	<br /><br />
+	<br /><br />";
+
+	echo "
 	<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);
+	}
 }
 
-if (function_exists('theme_foot')) {
+if (function_exists('theme_foot'))
+{
 	echo theme_foot();
 }
 
+if(isset($footer_js) && is_array($footer_js))
+{
+	$footer_js = array_unique($footer_js);
+	foreach($footer_js as $fname)
+	{
+		echo "<script type='text/javascript' src='{$fname}'></script>\n";
+		$js_included[] = $fname;
+	}
+}
+
 echo "</body></html>";
 
 $sql->db_Close();
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/frontpage.php 0.7.7/e107_admin/frontpage.php
--- 0.7.5/e107_admin/frontpage.php	2006-04-22 14:30:47.000000000 -0500
+++ 0.7.7/e107_admin/frontpage.php	2006-07-07 22:57:35.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/frontpage.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2006/04/22 19:30:47 $
+|     $Revision: 1.23 $
+|     $Date: 2006/07/08 03:57:35 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -30,7 +30,7 @@
 
 $front_page['news'] = array('page' => 'news.php', 'title' => ADLAN_0);
 $front_page['download'] = array('page' => 'download.php', 'title' => ADLAN_24);
-$front_page['wmessage'] = array('page' => 'index.php', 'title' => ADLAN_28);   
+$front_page['wmessage'] = array('page' => 'index.php', 'title' => ADLAN_28);
 
 if ($sql -> db_Select("page", "*", "page_theme=''")) {
 	$front_page['custom']['title'] = 'Custom Page';
@@ -39,18 +39,17 @@
 	}
 }
 
-if ($sql -> db_Select("plugin", "plugin_path", "plugin_installflag = '1'")) {
-	while ($row = $sql -> db_Fetch()) {
-		$frontpage_plugs[] = $row['plugin_path'];
-	}
-}
 
-foreach ($frontpage_plugs as $plugin_id) {
-	if (is_readable(e_PLUGIN.$plugin_id.'/e_frontpage.php')) {
-		require_once(e_PLUGIN.$plugin_id.'/e_frontpage.php');
+foreach($pref['e_frontpage_list'] as $val)
+{
+	if (is_readable(e_PLUGIN.$val."/e_frontpage.php"))
+	{
+		require_once(e_PLUGIN.$val."/e_frontpage.php");
 	}
 }
 
+
+
 if (isset($_POST['edit'])) {
 	$_POST['type'] = (isset($_POST['edit']['all'])) ? 'all_users' : 'user_class';
 	$_POST['class'] = key($_POST['edit']);
diff -ruN 0.7.5/e107_admin/header.php 0.7.7/e107_admin/header.php
--- 0.7.5/e107_admin/header.php	2006-05-13 13:18:43.000000000 -0500
+++ 0.7.7/e107_admin/header.php	2006-07-07 21:23:46.000000000 -0500
@@ -12,13 +12,15 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_admin/header.php,v $
-|   $Revision: 1.52 $
-|   $Date: 2006/05/13 18:18:43 $
-|   $Author: mcfly_e107 $
+|   $Revision: 1.56 $
+|   $Date: 2006/07/08 02:23:46 $
+|   $Author: e107coders $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+define("ADMIN_AREA",TRUE);
+define("USER_AREA",FALSE);
 
 // send the charset to the browser - overides spurious server settings with the lan pack settings.
 header("Content-type: text/html; charset=".CHARSET, true);
@@ -88,6 +90,14 @@
 	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";
+}
+
+
 if (function_exists('theme_head')) {
    	echo theme_head();
 }
@@ -110,8 +120,11 @@
 echo "<script type='text/javascript'>
 <!--
 function savepreset(ps,pid){
-	document.getElementById(ps).action='".e_SELF."?savepreset.'+pid;
-	document.getElementById(ps).submit();
+	if(confirm('".$tp->toJS(LAN_PRESET_CONFIRMSAVE)."'))
+	{
+		document.getElementById(ps).action='".e_SELF."?savepreset.'+pid;
+   		document.getElementById(ps).submit();
+	}
 }
 //-->
 </script>\n";
@@ -129,6 +142,17 @@
 }else{
 	define("e_WYSIWYG",FALSE);
 }
+// load plugin header-data.
+foreach($pref['e_meta_list'] as $val)
+{
+	if(is_readable(e_PLUGIN.$val."/e_meta.php"))
+	{
+		require_once(e_PLUGIN.$val."/e_meta.php");
+	}
+}
+
+
+
 echo "</head>
 <body>\n";
 
@@ -298,7 +322,7 @@
 	{
 		$msg .= LAN_RATING." ".LAN_DELETED."<br />";
 	}
-	
+
 	if($msg)
 	{
 		$ns->tablerender(LAN_DELETE, $msg);
diff -ruN 0.7.5/e107_admin/image.php 0.7.7/e107_admin/image.php
--- 0.7.5/e107_admin/image.php	2006-04-17 08:23:41.000000000 -0500
+++ 0.7.7/e107_admin/image.php	2006-11-11 06:36:48.000000000 -0600
@@ -11,13 +11,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/image.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/04/17 13:23:41 $
-|     $Author: sweetas $
+|     $Revision: 1.15 $
+|     $Date: 2006/11/11 12:36:48 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-if (!getperms("5")) {
+if (!getperms("A")) {
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -38,7 +38,7 @@
 if (isset($_POST['deleteall'])) {
 	$handle = opendir(e_FILE."public/avatars/");
 	while ($file = readdir($handle)) {
-		if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') { 
+		if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') {
 			$dirlist[] = $file;
 		}
 	}
@@ -53,15 +53,34 @@
 	$message = $count." ".IMALAN_26;
 }
 
+if (isset($_POST['avdelete'])) {
+	require_once(e_HANDLER."avatar_handler.php");
+	foreach($_POST['avdelete'] as $key => $val)
+	{
+		$key = $tp->toDB($key); // We only need the key
+		if ($sql->db_Select("user", "*", "user_id='$key'")) {
+			$row = $sql->db_Fetch();
+			extract($row);
+			$avname=avatar($user_image);
+			if (strpos($avname,"http://")===FALSE) 
+			{ // Internal file, so unlink it
+				@unlink($avname);
+			}
+			$sql->db_Update("user","user_image='' WHERE user_id='$key'");
+			$message = IMALAN_51.$user_name." ".IMALAN_28;
+		}
+	}
+	$_POST['check_avatar_sizes'] = TRUE;	// Force size recheck after doing one or more deletes
+}
 
 if (isset($_POST['update_options'])) {
 	$pref['image_post'] = $_POST['image_post'];
 	$pref['resize_method'] = $_POST['resize_method'];
-	$pref['im_path'] = $_POST['im_path'];
+	$pref['im_path'] = $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'];
-	
+
 	save_prefs();
 	$message = IMALAN_9;
 }
@@ -75,7 +94,7 @@
 
 	$handle = opendir(e_FILE."public/avatars/");
 	while ($file = readdir($handle)) {
-		if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db' && !is_dir($file)) { 
+		if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db' && !is_dir($file)) {
 			$dirlist[] = $file;
 		}
 	}
@@ -107,7 +126,7 @@
 				<td class='fcaption'>$image_name</td>
 				</tr>
 				<tr>
-				<td class='forumheader3'><img src='".e_FILE."public/avatars/".$image_name."' alt='' /></a><br />
+				<td class='forumheader3'><img src='".e_FILE."public/avatars/".$image_name."' alt='' /><br />
 				<input type='hidden' name='filename' value='".$image_name."' />
 				<input class='button' type='submit' name='delete' value='".LAN_DELETE."' />
 				</td>
@@ -139,6 +158,123 @@
 	$ns->tablerender(IMALAN_18, $text);
 }
 
+if (isset($_POST['check_avatar_sizes'])) {
+	//
+	// Set up to track what we've done
+	//
+	$iUserCount  = 0;
+	$iAVinternal = 0;
+	$iAVexternal = 0;
+	$iAVnotfound = 0;
+	$iAVtoobig   = 0;
+	require_once(e_HANDLER."avatar_handler.php");
+	$text = "<div style='text-align:center'>\n";
+	$text .= "<div class='spacer'>
+		<form method='post' action='".e_SELF."'>
+		<table style='".ADMIN_WIDTH."' class='fborder'>
+		<tr>
+		<td class='forumheader3'>".$pref['im_width']."</td>
+		<td class='forumheader3'>".IMALAN_38."</td>
+		</tr>
+		<tr>
+		<td class='forumheader3'>".$pref['im_height']."</td>
+		<td class='forumheader3'>".IMALAN_39."</td>
+		</tr>";
+	
+	//
+	// Loop through avatar field for every user
+	//
+	$iUserCount = $sql->db_Count("user");
+	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) 
+			{
+				$iAVexternal++;
+				$bAVext=TRUE;
+			} else {
+				$iAVinternal++;
+				$bAVext=FALSE;
+			}
+			$image_stats = getimagesize($avname);
+			$sBadImage="";
+			if (!$image_stats)
+			{
+				$iAVnotfound++;
+				// allow delete
+				$sBadImage=IMALAN_42;
+			} else {
+				$imageWidth = $image_stats[0];
+				$imageHeight = $image_stats[1];
+				if ( ($imageHeight > $pref['im_height']) || ($imageWidth>$pref['im_width']) )
+				{ // Too tall or too wide
+					$iAVtoobig++;
+					if ($imageWidth > $pref['im_width']) {
+						$sBadImage = IMALAN_40." ($imageWidth)";
+					}
+					if ($imageHeight > $pref['im_height']) {
+						if (strlen($sBadImage))
+						{
+							$sBadImage .= ", ";
+						}
+						$sBadImage .= IMALAN_41." ($imageHeight)";
+					}
+				}
+			}
+	
+	// 
+	// If not found or too big, allow delete
+	//
+			if (strlen($sBadImage))
+			{
+				$sBadImage .=" [".$avname."]"; // Show all files that have a problem
+				$text .= "
+				<tr>
+				<td class='forumheader3'>
+				<input class='button' type='submit' name='avdelete[$user_id]' value='".($bAVext ? IMALAN_44 : IMALAN_43)."' />
+				</td>
+				<td class='forumheader3'>".IMALAN_51."<a href='".e_BASE."user.php?id.".$user_id."'>".$user_name."</a> ".$sBadImage."</td>
+				</tr>";
+			}
+		}
+	}
+	//
+	// Done, so show stats
+	//
+	$text .= "
+		<tr>
+		<td class='forumheader3'>".$iAVnotfound."</td>
+		<td class='forumheader3'>".IMALAN_45."</td>
+		</tr>
+		<tr>
+		<td class='forumheader3'>".$iAVtoobig."</td>
+		<td class='forumheader3'>".IMALAN_46."</td>
+		</tr>
+		<tr>
+		<td class='forumheader3'>".$iAVinternal."</td>
+		<td class='forumheader3'>".IMALAN_47."</td>
+		</tr>
+		<tr>
+		<td class='forumheader3'>".$iAVexternal."</td>
+		<td class='forumheader3'>".IMALAN_48."</td>
+		</tr>
+		<tr>
+		<td class='forumheader3'>".($iAVexternal+$iAVinternal)." (".(int)(100.0*(($iAVexternal+$iAVinternal)/$iUserCount)).'%, '.$iUserCount." ".IMALAN_50.")</td>
+		<td class='forumheader3'>".IMALAN_49."</td>
+		</tr>
+		</table>
+		</form>
+		</div>";
+
+	$text .= "</div>";
+
+	$ns->tablerender(IMALAN_37, $text);
+}
 
 
 $text = "<div style='text-align:center'>
@@ -202,7 +338,7 @@
 	<tr>
 	<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' />
+	<input class='tbox' type='text' name='im_path' size='40' value=\"".$pref['im_path']."\" maxlength='200' />
 	</td></tr>
 
 	<tr>
@@ -212,7 +348,7 @@
 	<td style='width:25%;text-align:center' class='forumheader3' >".($pref['enable_png_image_fix'] ? "<input type='checkbox' name='enable_png_image_fix' value='1' checked='checked' />" : "<input type='checkbox' name='enable_png_image_fix' value='1' />")."
 	</td>
 	</tr>
-	
+
 	<tr>
 	<td style='width:75%' class='forumheader3'>".IMALAN_16."</td>
 	<td style='width:25%;text-align:center' class='forumheader3'  >
@@ -220,12 +356,18 @@
 	</td></tr>
 
 	<tr>
+	<td style='width:75%' class='forumheader3'>".IMALAN_36."</td>
+	<td style='width:25%;text-align:center' class='forumheader3'  >
+	<input class='button' type='submit' name='check_avatar_sizes' value='".IMALAN_17."' />
+	</td></tr>
+
+	<tr>
 	<td colspan='2' style='text-align:center' class='forumheader'>
 	<input class='button' type='submit' name='update_options' value='".IMALAN_8."' />
 	</td>
 	</tr>
-	
-	
+
+
 
 
 	</table></form></div>";
@@ -240,4 +382,4 @@
 $pref['im_path'] = $_POST['im_path'];
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/includes/beginner.php 0.7.7/e107_admin/includes/beginner.php
--- 0.7.5/e107_admin/includes/beginner.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/includes/beginner.php	2006-11-16 04:41:46.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.10 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -54,6 +54,7 @@
 		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);
 		}
@@ -72,4 +73,4 @@
 
 $ns->tablerender(ADLAN_CL_7, $text);
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/includes/cascade.php 0.7.7/e107_admin/includes/cascade.php
--- 0.7.5/e107_admin/includes/cascade.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/includes/cascade.php	2006-11-16 04:41:46.000000000 -0600
@@ -11,34 +11,35 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/cascade.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 $text = "<div style='text-align:center'>
 	<table class='fborder' style='".ADMIN_WIDTH."'>";
-	
+
 while (list($key, $funcinfo) = each($newarray)) {
 	$text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'adminb');
 }
-	
+
 $text .= "<tr>
 	<td class='fcaption' colspan='5'>
 	".ADLAN_CL_7."
 	</td>
 	</tr>";
-	
+
 $text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'adminb');
-	
+
 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_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);
 		}
@@ -50,9 +51,9 @@
 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'], 'adminb');
 }
-	
+
 $text .= "</table></div>";
-	
+
 $ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/includes/categories.php 0.7.7/e107_admin/includes/categories.php
--- 0.7.5/e107_admin/includes/categories.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/includes/categories.php	2006-11-16 04:41:46.000000000 -0600
@@ -11,17 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/categories.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 $text = "<div style='text-align:center'>
 	<table class='fborder' style='".ADMIN_WIDTH."'>";
-	
+
 foreach ($admin_cat['id'] as $cat_key => $cat_id) {
 	$text_check = FALSE;
 	$text_cat = "<tr><td class='fcaption' colspan='2'>".$admin_cat['title'][$cat_key]."</td></tr>
@@ -49,6 +49,7 @@
 				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_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');
@@ -72,11 +73,11 @@
 		$text .= $text_cat;
 	}
 }
-	
+
 $text .= "</table></div>";
-	
+
 $ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
-	
+
 echo admin_info();
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/includes/classis.php 0.7.7/e107_admin/includes/classis.php
--- 0.7.5/e107_admin/includes/classis.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/includes/classis.php	2006-11-16 04:41:46.000000000 -0600
@@ -11,37 +11,38 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/classis.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 $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[6], "classis");
 }
-	
+
 $text .= render_clean();
-	
+
 $text .= "</table></div>";
-	
+
 $ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
-	
+
 $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");
-	
+
 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);
 		}
@@ -53,11 +54,11 @@
 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();
-	
+
 $text .= "</table></div>";
-	
+
 $ns->tablerender(ADLAN_CL_7, $text);
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/includes/combo.php 0.7.7/e107_admin/includes/combo.php
--- 0.7.5/e107_admin/includes/combo.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/includes/combo.php	2006-11-16 04:41:46.000000000 -0600
@@ -11,41 +11,42 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/combo.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 $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');
 }
-	
+
 while ($td <= 5) {
 	$text_cat .= "<td class='td' style='width:20%;' ></td>";
 	$td++;
 }
 $td = 1;
-	
+
 $text .= "</tr></table></div>";
-	
+
 $ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
-	
+
 $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");
-	
+
 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);
 		}
@@ -57,13 +58,13 @@
 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();
-	
+
 $text .= "</table></div>";
-	
+
 $ns->tablerender(ADLAN_CL_7, $text);
-	
+
 echo admin_info();
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/includes/compact.php 0.7.7/e107_admin/includes/compact.php
--- 0.7.5/e107_admin/includes/compact.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_admin/includes/compact.php	2006-11-16 04:41:46.000000000 -0600
@@ -11,17 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/compact.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/16 10:41:46 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 $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');
 }
@@ -32,22 +32,23 @@
 	$td++;
 }
 $td = 1;
-	
+
 $text .= "</tr></table></div>";
-	
+
 $ns->tablerender(ADLAN_47." ".ADMINNAME, $text);
 
 
 $text = "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."'>";
-	
+
 $text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default');
-	
+
 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_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);
 		}
@@ -59,12 +60,12 @@
 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'], 'default');
 }
-	
+
 $text .= "</tr>
 	</table></div>";
-	
+
 $ns->tablerender(ADLAN_CL_7, $text);
-	
+
 echo admin_info();
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/lancheck.php 0.7.7/e107_admin/lancheck.php
--- 0.7.5/e107_admin/lancheck.php	2005-08-23 04:36:30.000000000 -0500
+++ 0.7.7/e107_admin/lancheck.php	2006-11-22 17:20:14.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,10 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/lancheck.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/08/23 09:36:30 $
-|     $Author: sweetas $
+|     $Revision: 1.24 $
+|     $Date: 2006/11/22 23:20:14 $
+|     $Author: e107coders $
+|	  With code from Izydor and Lolo.
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -21,207 +22,659 @@
 	header("location:".e_BASE."index.php");
 	 exit;
 }
-$e_sub_cat = 'language';
-require_once("auth.php");
+	$e_sub_cat = 'language';
+	require_once("auth.php");
 
-			
-function show_comparison($language, $filename)
+	$qry = explode("|",e_QUERY);
+	$f = $qry[0];
+	$lan = $qry[1];
+	$mode = $qry[2];
+
+// Write the language file.
+if(isset($_POST['submit']))
 {
-	global $LANGUAGES_DIRECTORY;
-	$English = get_lan_phrases("English");
-	$check = get_lan_phrases($language);
-	 
-	$keys = array_keys($English[$filename]);
-	natsort($keys);
-	$ret .= "<table class='fborder' style='".ADMIN_WIDTH."'>
-		<tr>
-		<td class='fcaption' style='text-align:center;'>".LAN_CHECK_7."</td>
-		<td class='fcaption' style='text-align:center;'>{$LANGUAGES_DIRECTORY}<br />English/{$filename}</td>
-		<td class='fcaption' style='text-align:center;'>{$LANGUAGES_DIRECTORY}<br />{$language}/{$filename}</td>
-		</tr>";
-	foreach($keys as $k) {
-		$ret .= "<tr>
-			<td class='forumheader3'>{$k}</td>
-			<td class='forumheader3'>\"{$English[$filename][$k]}\"</td>
-			";
-		if (isset($check[$filename][$k])) {
-			$ret .= "<td class='forumheader3'>\"{$check[$filename][$k]}\"</td>";
-		} else {
-			$ret .= "<td class='forumheader'>".LAN_CHECK_5."</td>";
+
+	unset($input);
+	$kom_start = chr(47)."*";
+	$kom_end = "*".chr(47);
+
+    if($_POST['root'])
+	{
+    	$writeit = $_POST['root'];
+	}
+
+	$old_kom = "";
+	$in_kom=0;
+	$data = file($writeit);
+	foreach($data as $line)
+	{
+
+    	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;}
+    }
+
+
+	$message = "<div style='text-align:left'><br />";
+	$input .= chr(60)."?php\n";
+	if ($old_kom == "")
+	{
+		// create CVS compatible description.
+		$diz = chr(47)."*\n";
+		$diz .= "+---------------------------------------------------------------+\n";
+		$diz .= "|        e107 website system ".$lan." Language File\n";
+		$diz .= "|        Released under the terms and conditions of the\n";
+		$diz .= "|        GNU General Public License (http://gnu.org).\n";
+		$diz .= "|\n";
+		$diz .= "|        ".chr(36)."Source: $writeit ".chr(36)."\n";
+		$diz .= "|        ".chr(36)."Revision: 1.0 ".chr(36)."\n";
+		$diz .= "|        ".chr(36)."Date: ".date("Y/m/d H:i:s")." ".chr(36)."\n";
+		$diz .= "|        ".chr(36)."Author: ".USERNAME." ".chr(36)."\n";
+		$diz .= "+---------------------------------------------------------------+\n";
+		$diz .= "*".chr(47)."\n\n";
+	}
+	else
+	{
+		$diz = $old_kom;
+	}
+
+	$input .= $diz;
+	$message .= str_replace("\n","<br />",$diz);
+
+	for ($i=0; $i<count($_POST['newlang']); $i++)
+	{
+		$notdef_start = "";
+		$notdef_end = "\n";
+		$deflang = (MAGIC_QUOTES_GPC === TRUE) ? stripslashes($_POST['newlang'][$i]) : $_POST['newlang'][$i];
+		$func = "define";
+		$quote = chr(34);
+
+		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";
+		}
+    	else
+		{
+      		$defvar = $_POST['newdef'][$i];
+    	}
+
+		if($_POST['newdef'][$i] == "LC_ALL" && isset($_POST['root']))
+		{
+			$message .= $notdef_start.'setlocale('.htmlentities($defvar).','.$deflang.');<br />'.$notdef_end;
+			$input .= $notdef_start."setlocale(".$defvar.",".$deflang.");".$notdef_end;
 		}
-		$ret .= "</tr>";
+		else
+		{
+			$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;
+        }
 	}
-	$ret .= "</table>";
-	return $ret;
+
+	$message .="<br />";
+	$message .="</div>";
+	$input .= "\n\n?>";
+
+	// Write to file.
+	$fp = @fopen($writeit,"w");
+	if(!@fwrite($fp, $input))
+	{
+    	$caption = LAN_ERROR;
+    	$message = LAN_CHECK_17;
+  	}
+	else
+	{
+    	$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 />";
+	$message .= "<br /><br /><input class='button' type='submit' name='language_sel' value=\"".LAN_BACK."\" />
+			<input type='hidden' name='language' value='$lan' /></div></form>";
+
+
+	$ns -> tablerender($caption, $message);
+	require_once(e_ADMIN."footer.php");
+	exit;
 }
-	
-	
-function get_lan_phrases($lang)
-{
-	$ret = array();
-	// Read English lan_ files
-	$base_dir = e_LANGUAGEDIR.$lang;
-	if ($r = opendir($base_dir))
+
+// ============================================================================
+
+// Edit the Language File.
+
+if($f != ""){
+
+	if (!$mode)
 	{
-		while ($file = readdir($r))
+    	$dir1 =  e_BASE.$LANGUAGES_DIRECTORY."English/";
+    	$f1=$f;
+    	$dir2 =  e_BASE.$LANGUAGES_DIRECTORY.$lan."/";
+    	$f2=$f;
+	}
+	else
+	{
+ 		$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)."/";
+  	}
+
+ 	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"
+	);
+
+$core_themes = array("crahan","e107v4a","human_condition","interfectus","jayya",
+	"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/"));
+
+	$plug_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr>
+	<td class='fcaption'>".LAN_PLUGIN."</td>
+	<td class='fcaption'>".LAN_CHECK_16."</td>
+	<td class='fcaption'>".$_POST['language']."</td>
+	<td class='fcaption'>".LAN_OPTIONS."</tr>";
+
+	foreach($core_plugins as $plugs)
+	{
+		if(is_readable(e_PLUGIN.$plugs))
 		{
-			$fname = $base_dir."/".$file;
-			if (strpos($file, "lan_") === 0 && is_file($fname))
-			{
-				$data = file($fname);
-				foreach($data as $line)
-				{
-					if (preg_match("#\"(.*?)\".*?\"(.*)\"#", $line, $matches)) {
-						$ret[$file][$matches[1]] = htmlentities($matches[2]);
-					}
-				}
-			}
+			$plug_text .= check_lanfiles('P',$plugs,"English",$_POST['language']);
 		}
-		closedir($r);
 	}
-	// Read $lang/admin lan_ files
-	$base_dir = e_LANGUAGEDIR.$lang."/admin";
-	if ($r = opendir($base_dir))
+	$plug_text .= "</table>";
+	$ns -> tablerender(ADLAN_CL_7,$plug_text);
+
+    $theme_text = "<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr>
+	<td class='fcaption'>Theme</td>
+	<td class='fcaption'>".LAN_CHECK_16."</td>
+	<td class='fcaption'>".$_POST['language']."</td>
+	<td class='fcaption'>".LAN_OPTIONS."</tr>";
+	foreach($core_themes as $them)
 	{
-		while ($file = readdir($r))
+		if(is_readable(e_THEME.$them))
 		{
-			$fname = $base_dir."/".$file;
-			if (strpos($file, "lan_") === 0 && is_file($fname))
-			{
-				$data = file($fname);
-				foreach($data as $line)
-				{
-					if (preg_match("#\"(.*?)\".*?\"(.*)\"#", $line, $matches))
-					{
-						$ret["admin/".$file][$matches[1]] = $matches[2];
-					}
-				}
-			}
+			$theme_text .= check_lanfiles('T',$them,"English",$_POST['language']);
 		}
-		closedir($r);
 	}
-	return $ret;
+	$theme_text .= "</table>";
+
+	$ns -> tablerender("Themes",$theme_text);
+	require_once(e_ADMIN."footer.php");
+	exit;
 }
-	
-function check_core_lanfiles($checklan) {
-	 
-	$English = get_lan_phrases("English");
-	$check = get_lan_phrases($checklan);
-	 
-	$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>";
+
+
+function check_core_lanfiles($checklan,$subdir=''){
+	global $lanfiles,$_POST;
+
+	$English = get_comp_lan_phrases(e_LANGUAGEDIR."English/".$subdir,$checklan);
+	$check = get_comp_lan_phrases(e_LANGUAGEDIR.$checklan."/".$subdir,$checklan);
+
+	$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr>
+	<td class='fcaption'>".LAN_CHECK_16."</td>
+	<td class='fcaption'>".$_POST['language']." File</td>
+	<td class='fcaption'>".LAN_OPTIONS."</tr>";
+
 	$keys = array_keys($English);
-	sort($keys);
-	foreach($keys as $k) {
-		$lnk = "<a href='?{$checklan}.{$k}'>{$k}</a>";
-		if (array_key_exists($k, $check)) {
-			$text .= "<tr><td class='forumheader3'>{$lnk}</td>";
-			$subkeys = array_keys($English[$k]);
-			sort($subkeys);
-			$er = "";
-			foreach($subkeys as $sk) {
-				if (!array_key_exists($sk, $check[$k])) {
-					$er .= ($er) ? "<br />" :
-					 "";
-					$er .= $sk." ".LAN_CHECK_5;
-				}
-			}
-			if ($er) {
-				$text .= "<td class='forumheader3'><div class='smalltext'>{$er}</div></td></tr>";
-			} else {
-				$text .= "<td class='forumheader3'><div class='smalltext'>".LAN_CHECK_6."</div></td></tr>";
-			}
-		} else {
-			$text .= "<tr><td class='forumheader3'>{$lnk}</td><td class='forumheader'>".LAN_CHECK_4."</td></tr>";
+
+ 	sort($keys);
+
+	foreach($keys as $k)
+	{
+		if($k != "bom")
+		{
+    		$lnk = $k;
+			$k_check = str_replace("English",$checklan,$k);
+    		if(array_key_exists($k,$check))
+			{
+	 			$text .= "<tr><td class='forumheader3' style='width:45%'>{$lnk}</td>";
+      			$subkeys = array_keys($English[$k]);
+
+      	   		$er="";
+                $utf_error = "";
+
+				$bomkey = str_replace(".php","",$k_check);
+       			$bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
+
+      			foreach($subkeys as $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]);
+					}
+
+					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;
+        			}
+      			}
+
+				$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: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>";
 		}
-	}
+  	}
 	$text .= "</table>";
-	 
-	return $text;
+
+ 	return $text;
 }
-	
-function show_languages()
-{
-	if ($r = opendir(e_LANGUAGEDIR))
+
+
+function get_lan_file_phrases($dir1,$dir2,$file1,$file2){
+
+	$ret = array();
+	$fname = $dir1.$file1;
+	$type='orig';
+
+	if(is_file($fname))
 	{
-		while ($file = readdir($r))
+    	$data = file($fname);
+    	$ret=$ret + fill_phrases_array($data,$type);
+		if(substr($data[0],0,5) != "<?php")
 		{
-			$fname = e_LANGUAGEDIR.$file;
-			if (is_dir($fname) && $file != "English" && $file != "CVS" && $file != "." && $file != "..")
-			{
-				$languages[] = $file;
-			}
+			$key = str_replace(".php","",$fname);
+			$ret['bom'][$key] = $fname;
 		}
-		$text .= "
-			<form name='lancheck' method='POST'>
-			<table class='fborder' style='".ADMIN_WIDTH."'>
-			<tr>
-			<td class='fcaption'>".LAN_CHECK_1."</td></tr>
-			<tr><td class='forumheader3'>";
-		foreach($languages as $lang)
+	}
+
+	$fname = $dir2.$file2;
+	$type='tran';
+
+	if(is_file($fname))
+	{
+    	$data = file($fname);
+    	$ret=$ret + fill_phrases_array($data,$type);
+		if(substr($data[0],0,5) != "<?php")
 		{
-			$text .= "<input type='radio' name='language' value='{$lang}' /> {$lang}<br />";
+			$key = str_replace(".php","",$fname);
+			$ret['bom'][$key] = $fname;
 		}
-		$text .= "</td></tr>
-			<tr><td class='forumheader' style='text-align:center;'><input type='submit' name='check_lang' value='".LAN_CHECK_2."' class='button' />
-			</td></tr>
-			</table></form>";
-		return $text;
 	}
+	return $ret;
 }
 
-function find_plugins($path)
+
+function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
 {
-	static $plugin_list;
-	if($path == "")
+    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']))
+			{
+                $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.
+				}
+
+				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']);
+
+            }
+    }
+
+    return $ret;
+
+}
+
+// for plugins and themes - checkes what kind of language files directory structure we have
+function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan){
+	global $ns,$sql;
+
+    $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);
+
+	$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 = "";
+
+				$bomkey = str_replace(".php","",$k_check);
+       			$bom_error = ($check['bom'][$bomkey]) ? "<i>".LAN_CHECK_15."</i><br />" : ""; // illegal chars
+
+        		foreach($subkeys as $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;
+          			}
+        		}
+
+				$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;
+}
+
+function edit_lanfiles($dir1,$dir2,$f1,$f2){
+  global $ns,$sql,$lan;
+
+/*    echo "<br />dir1 = $dir1";
+    echo "<br />file1 = $f1";
+
+    echo "<br />dir2 = $dir2";
+    echo "<br />file2 = $f2";*/
+
+    if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file.
 	{
-		$path = e_PLUGIN;
-	}
-	if(substr($path,-1) == '/') {
-		$path = substr($path, 0, -1);
+        $f2 = $lan.".php";
+        $root_file = e_LANGUAGEDIR.$lan."/".$lan.".php";
+    }
+	else
+	{
+        $root_file = $dir2.$f2;
 	}
-	if($handle = opendir($path))
+
+    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";
+    }
+
+
+	$writable = (is_writable($dir2)) ? TRUE : FALSE;
+	$trans = get_lan_file_phrases($dir1,$dir2,$f1,$f2);
+	$keys = array_keys($trans);
+	sort($keys);
+
+	$text = "<div style='text-align:center'>
+	<form method='post' action='".e_SELF."?".e_QUERY."' id='transform'>
+	<table style='".ADMIN_WIDTH."' class='fborder'>";
+
+	$subkeys = array_keys($trans['orig']);
+	foreach($subkeys as $sk)
 	{
-		while (false !== ($file = readdir($handle)))
+    	$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 .= 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]." <> ".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)
+	{
+		$text .="<tr style='vertical-align:top'>
+		<td colspan='3' style='text-align:center' class='forumheader'>
+		<input class='button' type='submit' name='submit' value=\"".LAN_SAVE." ".str_replace($dir2,"",$root_file)." \" />";
+
+		if($root_file)
 		{
-			if($file == "English.php")
+    		$text .= "<input type='hidden' name='root' value='".$root_file."' />";
+		}
+
+		$text .= "</td></tr>";
+    }
+
+	$text .= "
+	</table>
+	</form>
+	</div>";
+
+	$text .= "<form method='post' action='".e_SELF."' id='select_lang'>
+			<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>";
+
+
+	$caption = LAN_CHECK_3." <b>".$dir2.$f2."</b> -> <b>".$lan."</b>";
+	$ns -> tablerender($caption, $text);
+	require_once(e_ADMIN."footer.php");
+	exit;
+
+}
+
+function fill_phrases_array($data,$type) {
+
+	$retloc = array();
+
+	foreach($data as $line){
+        //echo "line--> ".$line."<br />";
+		if (strpos($line,"define(") !== FALSE && strpos($line,");") === FALSE)
+		{
+			$indef=1;
+			$bigline="";
+			// echo "big1 -->".$line."<br />";
+		}
+        if ($indef)
+		{
+			$bigline.=str_replace("\n","",$line);
+			// echo "big2 -->".$line."<br />";
+		}
+        if (strpos($line,"define(") === FALSE && strpos($line,");") !== FALSE)
+		{
+			$indef=0;
+			$we_have_bigline=1;
+			// echo "big3 -->".$line."<br />";
+		}
+
+		if(strpos($line,"setlocale(") !== FALSE)
+		{
+			$indef=1;
+			$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 ($we_have_bigline)
 			{
-				$plugin_list['file'][] = $path;
+				$we_have_bigline=0;
+				$line=$bigline;
+				// echo "big -->".$line."<br />";
 			}
-			if(is_dir($path."/".$file) && $file !== "." && $file !== ".." && $file !== "CVS")
+			$ndef = "";
+			//echo "_ndefline -->".$line."<br />";
+			if (strpos($line,"defined(") !== FALSE )
 			{
-				if($file == "English")
-				{
-					$plugin_list['dir'][] = $path;
-				}
-				else
-				{
-						$xx = find_plugins($path."/".$file);
-				}
+            	$ndef = "ndef++";
+            	$line = substr($line,strpos($line,"define("));
 			}
-		}
-		return $plugin_list;
+
+			if(strpos($line,"setlocale(") !== FALSE)
+			{
+				$pos = substr(strstr($line,","),1);
+				$rep = array(");","\n",'""');
+				$val = str_replace($rep,"",$pos);
+				$retloc[$type]['LC_ALL']= $val;
+				$retloc['orig']['LC_ALL']= "'en'";
+			}
+			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];
+            	}
+			}
+         }
+      }
+
+      return $retloc;
+    }
+
+
+function is_utf8($string) {
+   // From http://w3.org/International/questions/qa-forms-utf-8.html
+	if(strtolower(CHARSET) != "utf-8" || $string == "")
+	{
+		return TRUE;
 	}
-	return FALSE;
-}
 
-if (e_QUERY)
-{
-	$qs = explode(".", rawurldecode(e_QUERY), 2);
-	$text = show_comparison($qs[0], $qs[1]);
-	$ns->tablerender(LAN_CHECK_3.": {$qs[0]}", $text);
-	require_once("footer.php");
-	exit;
+    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);
+
 }
-	
-if ($_POST['check_lang'])
-{
-	$text = check_core_lanfiles($_POST['language']);
-	$ns->tablerender(LAN_CHECK_3.": ".$_POST['language'], $text);
-	require_once("footer.php");
-	exit;
+
+
+function lancheck_adminmenu() {
+
+	include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_language.php");
+
+	global $action,$pref;
+	if ($action == "") {
+		$action = "tools";
+	}
+
+	if($action == "modify"){
+    	$action = "db";
+	}
+	$var['main']['text'] = LAN_PREFS;
+	$var['main']['link'] = e_ADMIN."language.php";
+
+	if(isset($pref['multilanguage']) && $pref['multilanguage']){
+		$var['db']['text'] = LANG_LAN_03;
+		$var['db']['link'] = e_ADMIN."language.php?db";
+	}
+
+	$var['tools']['text'] = ADLAN_CL_6;
+	$var['tools']['link'] = e_ADMIN."language.php?tools";
+
+
+	show_admin_menu(ADLAN_132, $action, $var);
 }
-	
-$ns->tablerender("", show_languages());
-require_once("footer.php");
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_admin/language.php 0.7.7/e107_admin/language.php
--- 0.7.5/e107_admin/language.php	2006-04-17 09:52:38.000000000 -0500
+++ 0.7.7/e107_admin/language.php	2006-11-06 04:46:23.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/language.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2006/04/17 14:52:38 $
+|     $Revision: 1.37 $
+|     $Date: 2006/11/06 10:46:23 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -33,11 +33,24 @@
 $lanlist = explode(",",e_LANLIST);
 $message = "";
 
+if (e_QUERY) {
+	$tmp = explode('.', e_QUERY);
+	$action = $tmp[0];
+	$sub_action = $tmp[1];
+	$id = $tmp[2];
+	unset($tmp);
+}
 
-if (isset($_POST['submit_prefs']) ) {
+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['sitelanguage'] = $_POST['sitelanguage'];
+	$pref['sitelanguage'] = $_POST['mainsitelanguage'];
 
 	save_prefs();
 	$ns->tablerender(LAN_SAVED, "<div style='text-align:center'>".LAN_SETSAVED."</div>");
@@ -100,67 +113,33 @@
 	}
 
 
-// ------------- render form ---------------------------------------------------
 
-if(isset($pref['multilanguage']) && $pref['multilanguage']){
-	$caption = LANG_LAN_16; // language
-	$text = MLAD_LAN_4."<br /><br />";
+unset($text);
 
 
-	// Choose Language to Edit:
-	$text = "<div style='text-align:center'>
-	<div style='".ADMIN_WIDTH."; height:150px; overflow:auto; 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 (!e_QUERY || $action == 'main' && !$_POST['language'] && !$_POST['edit_existing']) {
+	multilang_prefs();
+}
 
-		$text .= (!$installed)? "<div style='text-align:center'><i>".LANG_LAN_05."</i></div>" :
-	 	"";
-		$text .= "</td><td class='forumheader3' style='width:10%;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";
-		} else {
-			$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 ($action == 'db') {
+	multilang_db();
+}
 
+if($action == "tools"){
+	show_tools();
 }
 
-	$text .= "</table></div></div>";
 
-	$ns->tablerender($caption, $text);
-}
 
-if (!$_POST['language'] && !$_POST['edit_existing']) {
-	multilang_prefs();
-}
-unset($text);
+
 
 // Grab Language configuration. ---
 if ($_POST['edit_existing']) {
-	$text = $rs->form_open("post", e_SELF);
-	$text .= "<div style='text-align:center'>";
-	$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>\n";
+
+	$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;
@@ -175,9 +154,10 @@
 		}
 	}
 
-	$text .= "<tr><td class='forumheader3' colspan='2'>&nbsp;";
-	$text .= "<input type='hidden' name='language' value='".$_POST['lang_choices']."' />";
-	$text .= "</td></tr>";
+	$text .= "
+	<tr><td class='forumheader3' colspan='2'>&nbsp;
+	<input type='hidden' name='language' value='".$_POST['lang_choices']."' />
+	</td></tr>";
 
 	// ===========================================================================
 
@@ -220,12 +200,12 @@
 
 	$text .= "<tr>
 
-		<td style='width:40%' class='forumheader3'>".LANG_LAN_14.": </td>
-		<td style='width:60%; text-align:center' class='forumheader3'>";
+		<td style='width:80%' class='forumheader3'>".LANG_LAN_14.": </td>
+		<td style='width:20%; text-align:center' class='forumheader3'>";
 
 
 	$text .= "
-		<select name='sitelanguage' class='tbox'>\n";
+		<select name='mainsitelanguage' class='tbox'>\n";
 		$sellan = preg_replace("/lan_*.php/i", "", $pref['sitelanguage']);
 		foreach($lanlist as $lan){
 			$sel =  ($lan == $sellan) ? "selected='selected'" : "";
@@ -238,14 +218,24 @@
 
 	$text .= "
 		<tr>
-		<td style='width:40%' class='forumheader3'>".LANG_LAN_12.": </td>
-		<td style='width:60%;text-align:center' class='forumheader3'>";
+		<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'>";
@@ -348,7 +338,128 @@
 	return $tabs;
 }
 
+
+// ------------- render form ---------------------------------------------------
+function multilang_db(){
+	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>";
+		}
+
+		$text .= "</table></div></div>";
+
+		$ns->tablerender($caption, $text);
+	}
+}
+
+
+// ----------------------------------------------------------------------------
+
+function show_tools()
+{
+	global $ns;
+
+	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>";
+
+	$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";
+	}
+
+	$lcnt = explode(",",e_LANLIST);
+    if(count($lcnt) > 1)
+	{
+		$var['tools']['text'] = ADLAN_CL_6;
+		$var['tools']['link'] = e_SELF."?tools";
+    }
+
+	show_admin_menu(ADLAN_132, $action, $var);
+}
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/links.php 0.7.7/e107_admin/links.php
--- 0.7.5/e107_admin/links.php	2006-03-21 19:58:18.000000000 -0600
+++ 0.7.7/e107_admin/links.php	2006-11-11 20:24:21.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/links.php,v $
-|     $Revision: 1.55 $
-|     $Date: 2006/03/22 01:58:18 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.66 $
+|     $Date: 2006/11/12 02:24:21 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -76,7 +76,7 @@
 	while($row = $sql-> db_Fetch()){
 		$subcat = $row[($sublink['fieldid'])];
 		$name = $row[($sublink['fieldname'])];
-		$subname = "submenu.$link_name.$name";
+		$subname = $name;  // eliminate old embedded hierarchy from names. (e.g. 'submenu.TopName.name')
 		$suburl = str_replace("#",$subcat,$sublink['url']);
 		$subicon = ($sublink['fieldicon']) ? $row[($sublink['fieldicon'])] : $link_button;
 		$subdiz = ($sublink['fielddiz']) ? $row[($sublink['fielddiz'])] : $link_description;
@@ -128,6 +128,7 @@
 	$pref['linkpage_screentip'] = $_POST['linkpage_screentip'];
 	$pref['sitelinks_expandsub'] = $_POST['sitelinks_expandsub'];
 	save_prefs();
+	$e107cache->clear("sitelinks");
 	$linkpost->show_message(LCLAN_1);
 }
 
@@ -176,11 +177,12 @@
 class links
 {
 	var $link_total;
-	
+	var $aIdOptPrep, $aIdOptData, $aIdOptTest;
+
 	function getLinks()
 	{
 		global $sql;
-		if($this->link_total = $sql->db_Select("links", "*", "ORDER BY link_order, link_id ASC", "nowhere"))
+		if($this->link_total = $sql->db_Select("links", "*", "ORDER BY link_category,link_order, link_id ASC", "nowhere"))
 		{
 			while($row = $sql->db_Fetch())
 			{
@@ -193,10 +195,25 @@
 
 	function linkName($text)
 	{
-		if(substr($text, 0, 8) == "submenu.")
+		// This function is ONLY needed for link databases that have been upgraded from
+		// before 0.7+ -- all new link collections make use of link_parent instead
+		// of hierarchy embedded in the link_name. (Unfortunately, the upgraded
+		// data still includes embedded coding.)
+
+		if(substr($text, 0, 8) == "submenu.") // for backwards compatibility only.
 		{
 			$tmp = explode(".",$text);
-			return $tmp[2];
+			switch (count($tmp)) {
+			case 3: // submenu.parent.node
+				$tmp = $tmp[2]; break;
+			case 5: // submenu.parent.midlev.child.node
+				$tmp = $tmp[4]; break;
+			case 2: // submenu.parent (invalid?)
+			default:
+				$parentLen = strlen($tmp[1]);
+				$tmp = substr($text,8+$parentLen+1); // Skip submenu.parent.
+			}
+			return $tmp;
 		}
 		else
 		{
@@ -204,14 +221,27 @@
 		}
 	}
 
-	function dropdown($curval="", $id=0, $indent=0)
-	{
-		global $linkArray;
+	function dropdown($curval="", $lid=0, $indent=0)
+	{   // Drop-down list using on the parent_id. :)
+		global $linkArray,$id,$sub_action;
+
 		if(0 == $indent) {$ret = "<option value=''>".LINKLAN_3."</option>\n";}
-		foreach($linkArray[$id] as $l)
+		foreach($linkArray[$lid] as $l)
 		{
 			$s = ($l['link_id'] == $curval ? " selected='selected' " : "" );
-			$ret .= "<option value='{$l['link_id']}|".$this->linkName($l['link_name'])."' {$s}>".str_pad("", $indent*36, "&nbsp;").$this->linkName($l['link_name'])."</option>\n";
+			$thename = $this->linkName($l['link_name']);
+			 // prevent making self the parent.
+			if ($l['link_id'] == $id) { $thename = "(".$thename.")"; }
+			if($sub_action == "sub")
+			{
+				$thelink = ($l['link_id'] != $lid) ? $l['link_id'] : $l['link_parent'] ;
+            }
+			else
+			{
+            	$thelink = ($l['link_id'] != $id) ? $l['link_id'] : $l['link_parent'] ;
+			}
+			$ret .= "<option value='".$thelink."' {$s}>".str_pad("", $indent*36, "&nbsp;").$thename." </option>\n";
+
 			if(array_key_exists($l['link_id'], $linkArray))
 			{
 				$ret .= $this->dropdown($curval, $l['link_id'], $indent+1);
@@ -219,7 +249,7 @@
 		}
 		return $ret;
 	}
-			
+
 
 	function existing($id=0, $level=0)
 	{
@@ -242,19 +272,29 @@
 		global $sql, $rs, $ns, $tp, $linkArray;
 		if (count($linkArray))
 		{
+
+			$this->prepIdOpts(); // Prepare the options list for all links
 			$text = $rs->form_open("post", e_SELF, "myform_{$link_id}", "", "");
 			$text .= "<div style='text-align:center'>
 				<table class='fborder' style='".ADMIN_WIDTH."'>
+				<colgroup>
+      		<col width=\"5%\" />
+      		<col width=\"60%\" />
+      		<col width=\"15%\" />
+      		<col width=\"10%\" />
+      		<col width=\"5%\" />
+      		<col width=\"5%\" />
+				</colgroup>
 				<tr>
-				<td class='fcaption' style='width:5%'>".LCLAN_89."</td>
-				<td class='fcaption' style='width:60%'>".LCLAN_90."</td>
-				<td class='fcaption' style='width:15%'>".LAN_OPTIONS."</td>
-				<td class='fcaption' style='width:10%'>".LCLAN_95."</td>
-				<td class='fcaption' style='width:5%'>".LCLAN_91."</td>
-				<td class='fcaption' style='width:5%'>".LAN_ORDER."</td>
+				<td class='fcaption'>".LCLAN_89."</td>
+				<td class='fcaption'>".LCLAN_15."</td>
+				<td class='fcaption'>".LAN_OPTIONS."</td>
+				<td class='fcaption'>".LCLAN_95."</td>
+				<td class='fcaption'>".LCLAN_91."</td>
+				<td class='fcaption'>".LAN_ORDER."</td>
 				</tr>";
 				$text .= $this->existing(0);
-				
+
 			$text .= "<tr>
 				<td class='forumheader' colspan='6' style='text-align:center'><input class='button' type='submit' name='update' value='".LAN_UPDATE."' /></td>
 				</tr>";
@@ -266,17 +306,37 @@
 		$ns->tablerender(LCLAN_8, $text);
 	}
 
+	function prepIdOpts() {
+		for($a = 1; $a <= $this->link_total; $a++) {
+			$sTxt = "".$a;
+			$this->aIdOptData[] = array('val'=>'|||.'.$a, 'txt'=>$sTxt);	// Later, ||| becomes Id
+			$this->aIdOptTest[] = $sTxt;
+		}
+		$this->aIdOptPrep = $this->prepOpts($this->aIdOptData);
+	}
+
 	function display_row($row2, $indent = FALSE) {
-		global $sql, $rs, $ns, $tp, $linkArray;
+		global $sql, $rs, $ns, $tp, $linkArray,$previous_cat;
 		extract($row2);
-		if(strpos($link_name, "submenu.") !== FALSE || $link_parent !=0){
-			if(substr($link_name,0,8) == "submenu."){
-				$tmp = explode(".",$link_name);
-				$sublinkname = $tmp[2];
-			}else{
-			$sublinkname = $link_name;
-			}
-			$link_name = $sublinkname;
+
+		//
+		if($link_category > 1 && $link_category != $previous_cat)
+		{
+        	$text .= "
+				<tr>
+					<td class='fcaption'>".LCLAN_89."</td>
+					<td class='fcaption'>".LCLAN_15." (".LCLAN_12.": ".$link_category.")</td>
+					<td class='fcaption'>".LAN_OPTIONS."</td>
+					<td class='fcaption'>".LCLAN_95."</td>
+					<td class='fcaption'>".LCLAN_91."</td>
+					<td class='fcaption'>".LAN_ORDER."</td>
+				</tr>";
+			$previous_cat = $link_category;
+		}
+
+		if(strpos($link_name, "submenu.") !== FALSE || $link_parent !=0) // 'submenu' for upgrade compatibility only.
+		{
+			$link_name = $this->linkName( $link_name );
 		}
 
 		if ($indent) {
@@ -285,10 +345,10 @@
 			$subindent = "<td".$subspacer.">".$subimage."</td>";
 		}
 
-				$text .= "<tr><td class='forumheader3' style='width:5%; text-align: center; vertical-align: middle' 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 style='width:60%' class='forumheader3' title='".$link_description."'>
+				$text .= "</td><td class='forumheader3' title='".$link_description."'>
 				<table cellspacing='0' cellpadding='0' border='0' style='width: 100%'>
 				<tr>
 				".$subindent."
@@ -296,22 +356,19 @@
 				</tr>
 				</table>
 				</td>";
-				$text .= "<td style='width:15%; text-align:center; white-space: nowrap' class='forumheader3'>";
+				$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='width:10%; text-align:center' class='forumheader3'>".r_userclass("link_class[".$link_id."]", $link_class, "off", "public,guest,nobody,member,admin,classes")."</td>";
-				$text .= "<td style='width:5%; text-align:center; white-space: nowrap' class='forumheader3'>";
+				$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='width:5%; text-align:center' class='forumheader3'>";
+				$text .= "<td style='text-align:center' class='forumheader3'>";
 				$text .= "<select name='link_order[]' class='tbox'>\n";
-				for($a = 1; $a <= $this->link_total; $a++) {
-					$selected = ($link_order == $a) ? "selected='selected'" : "";
-					$text .= "<option value='".$link_id.".".$a."' $selected>".$a."</option>\n";
-				}
+				$text .= $this->genOpts( $this->aIdOptPrep, $this->aIdOptTest, $link_order, $link_id );
 				$text .= "</select>";
 				$text .= "</td>";
 				$text .= "</tr>";
@@ -320,13 +377,16 @@
 
 	}
 
+
 	function show_message($message) {
 		global $ns;
 		$ns->tablerender(LAN_UPDATE, "<div style='text-align:center'><b>".$message."</b></div>");
 	}
 
+
+
 	function create_link($sub_action, $id) {
-		global $sql, $rs, $ns, $pst;
+		global $sql, $rs, $ns, $pst,$tp;
 		$preset = $pst->read_preset("admin_links");
 		extract($preset);
 
@@ -344,18 +404,16 @@
 			$link_parent = $id;
 		}
 
-		if(strpos($link_name, "submenu.") !== FALSE){
-			$tmp = explode(".",$link_name);
-			$link_name = $tmp[2];
+		if(strpos($link_name, "submenu.") !== FALSE){  // 'submenu' for upgrade compatibility only.
+			$link_name = $this->linkName( $link_name );
 		}
 
-		$handle = opendir(e_IMAGE."icons");
-		while ($file = readdir($handle)) {
-			if ($file != "." && $file != ".." && $file != "/" && $file != "CVS") {
-				$iconlist[] = $file;
-			}
-		}
-		closedir($handle);
+        require_once(e_HANDLER."file_class.php");
+        $fl = new e_file;
+
+        if($iconlist = $fl->get_files(e_IMAGE."icons/", ".jpg|.gif|.png|.JPG|.GIF|.PNG")){
+        	sort($iconlist);
+        }
 
 		$text = "<div style='text-align:center'>
 			<form method='post' action='".e_SELF."' id='linkform'>
@@ -379,8 +437,13 @@
 			<tr>
 			<td style='width:30%' class='forumheader3'>".LCLAN_16.": </td>
 			<td style='width:70%' class='forumheader3'>
-			<input class='tbox' type='text' name='link_url' size='60' value='$link_url' maxlength='200' />
-			</td>
+			<input class='tbox' type='text' name='link_url' size='60' value='".$tp->replaceConstants($link_url,TRUE)."' maxlength='200' />";
+            if(e_MENU == "debug")
+			{
+				$text .= $link_url;
+			}
+			$text .= "
+            </td>
 			</tr>
 
 			<tr>
@@ -398,8 +461,10 @@
 					<input class='button' type ='button' style='cursor:hand' size='30' value='".LCLAN_39."' onclick='expandit(this)' />
 			<div id='linkicn' style='display:none;{head}'>";
 
-		while (list($key, $icon) = each($iconlist)) {
-			$text .= "<a href=\"javascript:insertext('$icon','link_button','linkicn')\"><img src='".e_IMAGE."icons/".$icon."' style='border:0' alt='' /></a> ";
+		foreach($iconlist as $icon)
+		{
+			$filepath = str_replace(e_IMAGE."icons/","",$icon['path'].$icon['fname']);
+			$text .= "<a href=\"javascript:insertext('".$filepath."','link_button','linkicn')\"><img src='".$icon['path'].$icon['fname']."' style='border:0' alt='' /></a> ";
 		}
 
 		// 1 = _blank
@@ -445,7 +510,8 @@
 			<tr style='vertical-align:top'>
 			<td colspan='2' style='text-align:center' class='forumheader'>";
 		if ($id && $sub_action == "edit") {
-			$text .= "<input class='button' type='submit' name='add_link' value='".LCLAN_27."' />\n<input type='hidden' name='link_id' value='$link_id'>";
+			$text .= "<input class='button' type='submit' name='add_link' value='".LCLAN_27."' />\n
+						<input type='hidden' name='link_id' value='$link_id' />";
 		} else {
 			$text .= "<input class='button' type='submit' name='add_link' value='".LCLAN_28."' />";
 		}
@@ -457,38 +523,27 @@
 		$ns->tablerender(LCLAN_29, $text);
 	}
 
+
 	function submit_link($sub_action, $id) {
 		global $sql, $e107cache, $tp;
 		if(!is_object($tp)) {
 			$tp=new e_parse;
 		}
-		$_POST['link_name'] = $tp->toDB($_POST['link_name']);
-		if($_POST['link_parent']){
-			$tmp = explode("|",$_POST['link_parent']);
-			$link_name = $tp->toDB(("submenu.".$tmp[1].".".$_POST['link_name']));
-			$parent_id = intval($tmp[0]);
-		}else{
-			$parent_id = 0;
-			$link_name = $_POST['link_name'];
-		}
-		$link_url = $tp->toDB($_POST['link_url']);
+
+		$parent_id = ($_POST['link_parent']) ? intval($_POST['link_parent']) : 0;
+
+		$link_name = $tp->toDB($_POST['link_name']);
+		$link_url = $tp->createConstants($_POST['link_url']);
+		$link_url = str_replace("&","&amp;",$link_url); // xhtml compliant links.
+
 		$link_description = $tp->toDB($_POST['link_description']);
 		$link_button = $tp->toDB($_POST['link_button']);
 
 		$link_t = $sql->db_Count("links", "(*)");
 		if ($id) {
 			$sql->db_Update("links", "link_parent='$parent_id', link_name='$link_name', link_url='$link_url', link_description='$link_description', link_button= '$link_button', link_category='".$_POST['linkrender']."', link_open='".$_POST['linkopentype']."', link_class='".$_POST['link_class']."' WHERE link_id='$id'");
-			//rename all sublinks
-			if($sql->db_Select("links", "*", "link_parent='{$id}'"))
-			{
-				$childList = $sql->db_getList();
-				foreach($childList as $c)
-				{
-					$old = explode(".", $c['link_name'], 3);
-					$newname = "submenu.".$_POST['link_name'].".".$old[2];
-					$sql->db_Update("links", "link_name = '{$newname}' WHERE link_id = '{$c['link_id']}'");
-				}
-			}
+			//rename all sublinks to eliminate old embedded 'submenu' etc hierarchy.
+		    // this is for upgrade compatibility only. Current hierarchy uses link_parent.
 
 			$e107cache->clear("sitelinks");
 			$this->show_message(LCLAN_3);
@@ -651,6 +706,65 @@
 
 }
 
+function prepOpts($aData)
+{
+//
+// Prepare an array that can rapidly (no looping)
+// generate an HTML option string, with one item possibly selected.
+// prepOpts returns a prepared array containing the possible values in this form:
+//
+// <option value="xxxxx"
+// >text for first</option><option value="yyyy"
+// >text for next</option>
+//
+// $aData is an array containing value/text pairs:
+// each entry is array( 'val'=>value, 'txt'=>text )
+//
+
+$i=0;
+	foreach($aData as $aVal)
+	{
+		$sVal = $aVal['val'];
+		$sTxt = $aVal['txt'];
+		$sOut="";
+
+		if ($i) $sOut = '>'.$sTxtPrev.'</option>';
+		$sOut .= '<option value="'.$sVal.'"';
+
+		$aPrep[$i++] = $sOut;
+		$sTxtPrev = $sTxt;
+	}
+	if ($i) {  // terminate final option
+		$aPrep[$i] = '>'.$sTxtPrev.'</option>';
+	}
+
+	return $aPrep;
+}
+
+function genOpts($aPrep, $aTest,$sSelected, $sId)
+{
+//
+// Generate an HTML option string, with one item possibly selected.
+// aGen is a prepared array containing the possible values in this form.
+// if sSelected matches an aTest entry, that entry is selected.
+// aTest can be any array that matches one-for-one with the options
+//
+// if $sId is nonblank, a global search/replace is done to change all "|||" to $sId.
+
+  $iKey = array_search( $sSelected, $aTest);
+  if ($iKey !== FALSE) {
+  	$aNew = $aPrep;
+  	$aNew[$iKey] .= " selected='selected'";
+  	$sOut = implode($aNew);
+  }
+  else {
+		$sOut = implode($aPrep);
+	}
+	if (strlen($sId)) $sOut = str_replace("|||",$sId,$sOut);
+	return $sOut;
+}
+
+
 }
 
 function links_adminmenu() {
@@ -673,4 +787,4 @@
 	show_admin_menu(LCLAN_68, $action, $var);
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/mailout.php 0.7.7/e107_admin/mailout.php
--- 0.7.5/e107_admin/mailout.php	2006-05-12 17:50:40.000000000 -0500
+++ 0.7.7/e107_admin/mailout.php	2006-11-29 16:27:40.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/mailout.php,v $
-|     $Revision: 1.52 $
-|     $Date: 2006/05/12 22:50:40 $
+|     $Revision: 1.59 $
+|     $Date: 2006/11/29 22:27:40 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -34,16 +34,17 @@
 require_once(e_HANDLER."userclass_class.php");
 
 if (isset($_POST['testemail'])) {
-    if(SITEADMINEMAIL == ""){
+    if(trim($_POST['testaddress']) == ""){
 		$message = MAILAN_19;
 	}else{
 		$mailheader_e107id = USERID;
 		require_once(e_HANDLER."mail.php");
 		$add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).")" : " (PHP)";
-		if (!sendemail(SITEADMINEMAIL, PRFLAN_66." ".SITENAME.$add, PRFLAN_67)) {
+		$sendto = trim($_POST['testaddress']);
+		if (!sendemail($sendto, PRFLAN_66." ".SITENAME.$add, PRFLAN_67,USERNAME)) {
 			$message = ($pref['mailer'] == "smtp")  ? PRFLAN_75 : PRFLAN_68;
 		} else {
-			$message = PRFLAN_69;
+			$message = PRFLAN_69. "(".$sendto.")";
 		}
 	}
 }
@@ -134,11 +135,14 @@
 	}
 	ob_end_flush();
 
+	$debug = (e_MENU == "debug") ? "?[debug]" : "";
+
 	$text = "<div style='text-align:center'>
-		<form method='post' action='".e_HANDLER."phpmailer/mailout_process.php' name='mailform' onsubmit=\"open('', 'popup','width=230,height=170,resizable=1,scrollbars=0');this.target = 'popup';return true;\" >
+		<form method='post' action='".e_HANDLER."phpmailer/mailout_process.php".$debug."' name='mailform' onsubmit=\"open('', 'popup','width=230,height=170,resizable=1,scrollbars=0');this.target = 'popup';return true;\" >
 		<div>";
 
-    foreach($_POST as $key=>$val){
+    foreach($_POST as $key=>$val)
+	{
 		$text .= "<input type='hidden' name='".$key."' value='".stripslashes($tp->post_toForm($val))."' />\n";
     }
 
@@ -146,8 +150,8 @@
 
 	$text .= "<div>$c ".MAILAN_24."</div>";
 
-	$text .= "<div><br /><input class='button' type='submit' name='send_mails' value='Proceed' />
-	<input class='button' type='submit' name='cancel_emails' value='Cancel' />
+	$text .= "<div><br /><input class='button' type='submit' name='send_mails' value='".MAILAN_37."' />
+	<input class='button' type='submit' name='cancel_emails' value='".MAILAN_38."' />
 	</div>";
 	$text .= "</form><br /><br /></div>";
 
@@ -232,7 +236,7 @@
 	</div>";
 
 
- 	$ns->tablerender("Emailing ($c) ", $text);
+ 	$ns->tablerender(MAILAN_39." ($c) ", $text);
 	require_once(e_ADMIN."footer.php");
 	exit;
 }
@@ -248,6 +252,9 @@
 	$pref['smtp_server'] = $tp->toDB($_POST['smtp_server']);
 	$pref['smtp_username'] = $tp->toDB($_POST['smtp_username']);
 	$pref['smtp_password'] = $tp->toDB($_POST['smtp_password']);
+	$pref['smtp_keepalive'] = $_POST['smtp_keepalive'];
+	$pref['smtp_pop3auth'] = $_POST['smtp_pop3auth'];
+
 	$pref['mail_pause'] = $_POST['mail_pause'];
 	$pref['mail_pausetime'] = $_POST['mail_pausetime'];
 	$pref['mail_bounce_email'] = $_POST['mail_bounce_email'];
@@ -298,13 +305,13 @@
 	$text = "";
 
 	if(strpos($_SERVER['SERVER_SOFTWARE'],"mod_gzip") && !is_readable(e_HANDLER."phpmailer/.htaccess")){
-		$warning = "You need to rename <b>e107.htaccess</b> to <b>.htaccess</b> in ".$HANDLERS_DIRECTORY."phpmailer/ before sending mail from this page.";
-		$ns -> tablerender("Warning", $warning);
+		$warning = MAILAN_40." ".$HANDLERS_DIRECTORY."phpmailer/ ".MAILAN_41;
+		$ns -> tablerender(MAILAN_42, $warning);
 	}
 
-
+	$debug = (e_MENU == "debug") ? "?[debug]" : "";
 	$text .= "<div style='".ADMIN_WIDTH." text-align:center'>
-	<form method='post' action='".e_SELF."' id='mailout_form'>
+	<form method='post' action='".e_SELF.$debug."' id='mailout_form'>
 	<table class='fborder' style='".ADMIN_WIDTH."'  cellpadding='0' cellspacing='0'>
 	<tr>
 	<td style='width:30%' class='forumheader3'>".MAILAN_01.": </td>
@@ -333,11 +340,11 @@
 	// User Search Field.
 
 
-		$u_array = array("user_name"=>"Username","user_login"=>"User Login","user_email"=>"User Email");
+		$u_array = array("user_name"=>MAILAN_43,"user_login"=>MAILAN_44,"user_email"=>MAILAN_45);
 
 		$text .= "
 		<tr>
-			<td style='width:35%' class='forumheader3'>User-Match
+			<td style='width:35%' class='forumheader3'>".MAILAN_46."
 			<select name='user_search_name' class='tbox'>
 			<option value=''>&nbsp;</option>";
 
@@ -346,7 +353,7 @@
 			}
 
 	$text .= "
-		</select> contains </td>
+		</select> ".MAILAN_47." </td>
 		<td style='width:65%' class='forumheader3'>
 		<input type='text' name='user_search_value' class='tbox' style='width:80%' value='' />
 		</td></tr>
@@ -356,7 +363,7 @@
 
 		$text .= "
 		<tr>
-			<td class='forumheader3'>User-Match
+			<td class='forumheader3'>".MAILAN_46."
 			<select name='extended_1_name' class='tbox'>
 			<option value=''>&nbsp;</option>";
 			$sql -> db_Select("user_extended_struct");
@@ -365,7 +372,7 @@
 			}
 
 		$text .= "
-		</select> equals </td>
+		</select> ".MAILAN_48." </td>
 		<td  class='forumheader3'>
 		<input type='text' name='extended_1_value' class='tbox' style='width:80%' value='' />
 		</td></tr>
@@ -377,7 +384,7 @@
 
 		$text .= "
 		<tr>
-			<td class='forumheader3'>User-Match
+			<td class='forumheader3'>".MAILAN_46."
 			<select name='extended_2_name' class='tbox'>
 			<option value=''>&nbsp;</option>";
 			$sql -> db_Select("user_extended_struct");
@@ -386,7 +393,7 @@
 			}
 
 		$text .= "
-		</select> equals </td>
+		</select> ".MAILAN_48." </td>
 		<td  class='forumheader3'>
 		<input type='text' name='extended_2_value' class='tbox' style='width:80%' value='' />
 		</td></tr>
@@ -458,29 +465,36 @@
 
 	<tr>
 	<td colspan='2'  class='forumheader3'>
-	<textarea rows='10' cols='20' id='email_body' name='email_body'  class='tbox' style='width:100%;height:200px' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>
-	$email_body
-	</textarea>
+	<textarea rows='10' cols='20' id='email_body' name='email_body'  class='tbox' style='width:100%;height:200px' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$email_body."</textarea>
 	</td>
 	</tr>";
 
 	$text .="
 	<tr>
 	<td style='width:100%' class='forumheader3' colspan='2'>
-	<div style='width:100%;text-align:center;vertical-align: middle;' >".display_help("helpb")
-	."<span style='vertical-align: super;margin-left:5%;margin-bottom:auto;margin-top:auto'>";
-	if($pref['wysiwyg']) {
-		$text .="<input type='button' class='button' name='usrname' value=\"".MAILAN_16."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'{USERNAME}')\" />
-		<input type='button' class='button' name='usrlink' value=\"".MAILAN_17."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'{SIGNUP_LINK}')\" />
-		<input type='button' class='button' name='usrid' value=\"".MAILAN_18."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'{USERID}')\" />";
-	} else {
- 		$text .="<input type='button' class='button' name='usrname' value=\"".MAILAN_16."\" onclick=\"addtext('{USERNAME}')\" />
- 		<input type='button' class='button' name='usrlink' value=\"".MAILAN_17."\" onclick=\"addtext('{SIGNUP_LINK}')\" />
- 		<input type='button' class='button' name='usrid' value=\"".MAILAN_18."\" onclick=\"addtext('{USERID}')\" />";
-	}
+	<div style='width:100%;text-align:center;vertical-align: middle;' >";
+
+    global $eplug_bb;
+
+    $eplug_bb[] = array(
+			"name"		=> 'shortcode',
+			"onclick"	=> 'expandit',
+			"onclick_var" => "sc_selector",
+			"icon"		=> e_IMAGE."generic/bbcode/shortcode.png",
+			"helptext"	=> MAILAN_11,
+			"function"	=> "sc_Select",
+			"function_var"	=> "sc_selector"
+	);
 
+	$text .= display_help("helpb",'mailout');
 
- 	$text .="</span>
+	if(e_WYSIWYG) {
+		$text .="<span style='vertical-align: super;margin-left:5%;margin-bottom:auto;margin-top:auto'><input type='button' class='button' name='usrname' value=\"".MAILAN_16."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERNAME|')\" />
+		<input type='button' class='button' name='usrlink' value=\"".MAILAN_17."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|SIGNUP_LINK|')\" />
+		<input type='button' class='button' name='usrid' value=\"".MAILAN_18."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERID|')\" /></span>";
+	}
+
+ 	$text .="
 	</div></td>
 	</tr>";
 
@@ -515,8 +529,9 @@
 	<div id='mail' style='text-align:center;'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>
 	<tr>
-	<td style='width:40%' class='forumheader3'><span title='".PRFLAN_64."' style='cursor:help'>".PRFLAN_63."</span><br /></td>
-	<td style='width:60%; text-align:right' class='forumheader3'><input class='button' type='submit' name='testemail' value=\"".PRFLAN_65." ".SITEADMINEMAIL."\" />
+	<td style='width:30%' class='forumheader3'><span title='".PRFLAN_64."' style='cursor:help'>".PRFLAN_63."</span><br /></td>
+	<td style='width:70%; text-align:right' class='forumheader3'><input class='button' type='submit' name='testemail' value=\"".PRFLAN_65."\" />
+	<input name='testaddress' class='tbox' type='text' value=\"".SITEADMINEMAIL."\" />
 	</td>
 	</tr>
 
@@ -530,7 +545,11 @@
 		$text .= "<option value='$opt' $sel>$opt</option>\n";
 	}
 	$text .="</select><br />";
+
+
 // SMTP. -------------->
+
+
 	$smtpdisp = ($pref['mailer'] != "smtp") ? "display:none;" : "";
 	$text .= "<div id='smtp' style='$smtpdisp text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'>";
 	$text .= "	<tr>
@@ -554,9 +573,29 @@
 	</td>
 	</tr>
 
+	<tr>
+	<td colspan='2' style='text-align:right' >".MAILAN_57.":&nbsp;
+	";
+	$checked = (isset($pref['smtp_keepalive']) && $pref['smtp_keepalive']==1) ? "checked='checked'" : "";
+	$text .= "<input type='checkbox' name='smtp_keepalive' value='1' {$checked} />
+	</td>
+	</tr>
+
+	<tr>
+	<td colspan='2' style='text-align:right' >".MAILAN_67.":&nbsp;
+	";
+	$checked = (isset($pref['smtp_pop3auth']) && $pref['smtp_pop3auth']==1) ? "checked='checked'" : "";
+	$text .= "<input type='checkbox' name='smtp_pop3auth' value='1' {$checked} />
+	</td>
+	</tr>
+
+
+
 	</table></div>";
 
 // Sendmail. -------------->
+
+
 	$senddisp = ($pref['mailer'] != "sendmail") ? "display:none;" : "";
 	$text .= "<div id='sendmail' style='$senddisp text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'>";
 	$text .= "
@@ -588,8 +627,8 @@
 	</tr>\n
 
 	<tr>
-	<td style='width:40%;vertical-align:top' class='forumheader3'>".MAILAN_31."</td>
-	<td style='width:60%; text-align:right' class='forumheader3'>
+	<td style='vertical-align:top' class='forumheader3'>".MAILAN_31."</td>
+	<td style=' text-align:right' class='forumheader3'>
 		".MAILAN_32.": <input class='tbox' size='40' type='text' name='mail_bounce_email' value=\"".$pref['mail_bounce_email']."\" /><br />
 		".MAILAN_33." (POP3):  <input class='tbox' size='40' type='text' name='mail_bounce_pop3' value=\"".$pref['mail_bounce_pop3']."\" /><br />
 		".MAILAN_34.":  <input class='tbox' size='40' type='text' name='mail_bounce_user' value=\"".$pref['mail_bounce_user']."\" /><br />
@@ -649,10 +688,10 @@
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 
 			<tr>
-			<td style='width:5%; text-align: center;' class='fcaption'>Id</td>
-			<td style='width:10%' class='fcaption'>Author</td>
-			<td style='width:40%' class='fcaption'>Subject</td>
-			<td style='width:20%; text-align: center;' class='fcaption'>Lastmod</td>
+			<td style='width:5%; text-align: center;' class='fcaption'>".MAILAN_49."</td>
+			<td style='width:10%' class='fcaption'>".MAILAN_50."</td>
+			<td style='width:40%' class='fcaption'>".MAILAN_51."</td>
+			<td style='width:20%; text-align: center;' class='fcaption'>".MAILAN_52."</td>
 			<td style='width:5%; text-align: center;' class='fcaption'>".LAN_OPTIONS."</td>
 			</tr>
 			";
@@ -693,8 +732,8 @@
 	$text .= "<select style='width:80%' class='tbox' name='$name' >
 		<option value='all'>".MAILAN_12."</option>
 		<option value='unverified'>".MAILAN_13."</option>
-		<option value='admin'>Admins</option>
-		<option value='self'>Self</option>";
+		<option value='admin'>".MAILAN_53."</option>
+		<option value='self'>".MAILAN_54."</option>";
 	$query = "SELECT uc.*, count(u.user_id) AS members
 			FROM #userclass_classes AS uc
 			LEFT JOIN #user AS u ON u.user_class REGEXP concat('(^|,)',uc.userclass_id,'(,|$)')
@@ -704,7 +743,7 @@
 	$sql->db_Select_gen($query);
 	while ($row = $sql->db_Fetch()) {
 		$public = ($row['userclass_editclass'] == 0)? "(".MAILAN_10.")" : "";
-		$text .= "<option value='{$row['userclass_id']}' >Userclass - {$row['userclass_name']}  $public [{$row['members']}]</option>";
+		$text .= "<option value='{$row['userclass_id']}' >".MAILAN_55." - {$row['userclass_name']}  $public [{$row['members']}]</option>";
 	}
 	$text .= " </select>";
 
@@ -717,7 +756,7 @@
 	if($action == "edit"){
     	$action = "post";
 	}
-    $var['post']['text'] = "Send Mail";
+    $var['post']['text'] = MAILAN_56;
 	$var['post']['link'] = e_SELF;
 	$var['post']['perm'] = "W";
     $var['list']['text'] = LAN_SAVED;
@@ -732,7 +771,34 @@
 }
 
 
+function sc_Select($container='sc_selector') {
+	$text ="
+<!-- Start of Shortcode selector -->
+	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$container}'>
+	<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}')\">
+	<option value=''> -- </option>\n";
+
+	$sc = array(
+		"|USERNAME|" => MAILAN_16,
+        "|SIGNUP_LINK|" => MAILAN_17,
+        "|USERID|" => MAILAN_18
+	);
+
+	foreach($sc as $key=>$val){
+		$text .= "<option value='".$key."'>".$val."</option>\n";
+	}
+	$text .="
+	</select></td></tr>	\n </table></div>
+	</div>
+\n<!-- End of SC selector -->
+
+";
 
+	return $text;
+}
 
 
 
@@ -779,4 +845,4 @@
 
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/menus.php 0.7.7/e107_admin/menus.php
--- 0.7.5/e107_admin/menus.php	2006-04-28 19:16:22.000000000 -0500
+++ 0.7.7/e107_admin/menus.php	2006-09-30 15:08:57.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/menus.php,v $
-|     $Revision: 1.46 $
-|     $Date: 2006/04/29 00:16:22 $
-|     $Author: sweetas $
+|     $Revision: 1.48 $
+|     $Date: 2006/09/30 20:08:57 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -151,7 +151,7 @@
 	<td>
 	<input type='hidden' name='menuAct[$menu_id]' value='sv.$menu_id' />
 	".MENLAN_4." ".
-	r_userclass('menu_class', $menu_class, "off", "public,member,guest,admin,classes,nobody")."
+	r_userclass('menu_class', $menu_class, "off", "public,member,guest,admin,main,classes,nobody")."
 	</td>
 	</tr>
 	<tr><td><br />";
@@ -391,7 +391,7 @@
 	for ($c = 0; $c < count($tmp); $c++) {
 		if (preg_match("/[\{|\}]/", $tmp[$c])) {
 			if ($check) {
-				if (strstr($tmp[$c], "MENU")) {
+				if (strstr($tmp[$c], "{MENU=")) {
 					$str[] = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $tmp[$c]);
 				}
 			} else {
diff -ruN 0.7.5/e107_admin/message.php 0.7.7/e107_admin/message.php
--- 0.7.5/e107_admin/message.php	2005-12-24 19:26:59.000000000 -0600
+++ 0.7.7/e107_admin/message.php	2006-10-24 08:34:38.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/message.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/25 01:26:59 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/10/24 13:34:38 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -70,6 +70,7 @@
 		{
 			case "Broken Download":
 				$link = "<a href='".e_BASE."download.php?view.$gen_intdata' rel='external' title='".MESSLAN_11."'>$gen_ip</a>";
+                $link .= " [<a href='".e_ADMIN."download.php?create.edit.".$gen_intdata."'>".LAN_EDIT."</a>]";
 			break;
 			case "Dev Team Message":
 				$link = "";
@@ -81,7 +82,7 @@
 <td style='width: 100%;' class='forumheader3'><b>".MESSLAN_8."</b>: $gen_type<br />
 <b>".MESSLAN_9."</b>: ".$gen->convert_date($gen_datestamp, 'long')."<br />
 <b>".MESSLAN_10."</b>: $user<br />
-<b>".MESSLAN_13."</b>: $link".
+<b>".MESSLAN_13."</b>: $link ";
 ($gen_chardata ? "<br /><b>".MESSLAN_12."</b>: $gen_chardata" : "")."<br /><input class='button' type='submit' name='delete_message' value='".MESSLAN_2." $gen_id' />
 </td>\n</tr>\n";
 	}
@@ -89,7 +90,7 @@
 $text .= "
 <tr>
 <td><br /><input class='button' type='submit' name='delete_all' value='".MESSLAN_4."' />
-<input type='checkbox' name='deleteconfirm' value='1'> ".MESSLAN_5."
+<input type='checkbox' name='deleteconfirm' value='1' /> ".MESSLAN_5."
 </td>
 </tr>
 
@@ -101,7 +102,7 @@
 	$text = MESSLAN_7;
 }
 $ns->tablerender(MESSLAN_1, $text);
-	
+
 require_once("footer.php");
 
 
@@ -144,7 +145,7 @@
 	$text .= "</div></div>".$rs->form_close();
 	$ns->tablerender(BANLAN_3, $text);
 }
-	
+
 if ($action == "edit") {
 	$sql2->db_Select("banlist", "*", "banlist_ip='$sub_action'");
 	$row = $sql2->db_Fetch();
@@ -158,33 +159,33 @@
 $text = "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>
-	 
+
 	<tr>
 	<td style='width:30%' class='forumheader3'>".BANLAN_5.": </td>
 	<td style='width:70%' class='forumheader3'>
 	<input class='tbox' type='text' name='ban_ip' size='40' value='".$banlist_ip."' maxlength='200' />
 	</td>
 	</tr>
-	 
+
 	<tr>
 	<td style='width:20%' class='forumheader3'>".BANLAN_7.": </td>
 	<td style='width:80%' class='forumheader3'>
 	<textarea class='tbox' name='ban_reason' cols='50' rows='4'>$banlist_reason</textarea>
 	</td>
 	</tr>
-	 
+
 	<tr style='vertical-align:top'>
-	<td colspan='2' style='text-align:center' class='forumheader'>".  
+	<td colspan='2' style='text-align:center' class='forumheader'>".
 ($action == "edit" ? "<input type='hidden' name='old_ip' value='$banlist_ip' /><input class='button' type='submit' name='update_ban' value='".BANLAN_13."' />" : "<input class='button' type='submit' name='add_ban' value='".BANLAN_8."' />")."
-	 
+
 	</td>
 	</tr>
 	</table>
 	</form>
 	</div>";
-	
+
 $ns->tablerender(BANLAN_9, $text);
-	
+
 require_once("footer.php");
 */
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_admin/meta.php 0.7.7/e107_admin/meta.php
--- 0.7.5/e107_admin/meta.php	2006-01-19 18:50:31.000000000 -0600
+++ 0.7.7/e107_admin/meta.php	2006-06-06 23:08:33.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.16 $
-|     $Date: 2006/01/20 00:50:31 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.17 $
+|     $Date: 2006/06/07 04:08:33 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -35,18 +35,22 @@
 		$meta_diz[$lan] = $pref['meta_description'][$lan];
 		$meta_keywords[$lan] = $pref['meta_keywords'][$lan];
 		$meta_copyright[$lan] = $pref['meta_copyright'][$lan];
+		$meta_author[$lan] = $pref['meta_author'][$lan];
 	}
 
 	$meta_tag[$current_lang] = strip_if_magic(chop($_POST['meta']));
 	$meta_diz[$current_lang] = strip_if_magic(chop($_POST['meta_description']));
 	$meta_keywords[$current_lang] = strip_if_magic(chop($_POST['meta_keywords']));
 	$meta_copyright[$current_lang] = strip_if_magic(chop($_POST['meta_copyright']));
-	
+	$meta_author[$current_lang] = strip_if_magic(chop($_POST['meta_author']));
 
+    $pref['meta_news_summary'] = $_POST['meta_news_summary'];
 	$pref['meta_tag'] = $meta_tag;
 	$pref['meta_description'] = $meta_diz;
 	$pref['meta_keywords'] = $meta_keywords;
 	$pref['meta_copyright'] = $meta_copyright;
+	$pref['meta_author'] = $meta_author;
+
    /*
     if($pref['meta_tag'][$current_lang] == ""){
         unset($meta_tag[$current_lang]);
@@ -64,6 +68,7 @@
 $meta_diz = $pref['meta_description'];
 $meta_keywords = $pref['meta_keywords'];
 $meta_copyright = $pref['meta_copyright'];
+$meta_author = $pref['meta_author'];
 
 $text = "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."' id='dataform'>
@@ -91,6 +96,13 @@
 	</tr>
 
 	<tr>
+	<td style='width:25%' class='forumheader3'>".METLAN_13."</td>
+    <td style='width:75%' class='forumheader3'>
+	<input class='tbox' style='width:90%' size='70' type='text' name='meta_author' value=\"".$meta_author[$current_lang]."\" />
+	</td>
+	</tr>
+
+	<tr>
 	<td style='width:25%' class='forumheader3'>".METLAN_2.":
 	<span class='smalltext'><br /><br />eg.
 	&lt;meta name='author' content='your name' /&gt; </span>
@@ -102,6 +114,15 @@
 $text .= "</td>
 </tr>
 
+	<tr>
+	<td style='width:25%' class='forumheader3'>".METLAN_12."</td>
+    <td class='forumheader3' style='text-align:left;width:75%' >";
+    $checked = ($pref['meta_news_summary']) ? "checked='checked'" : "";
+	$text .= "
+	<input type='checkbox' name='meta_news_summary' value='1' {$checked} />
+	</td>
+	</tr>
+
 <tr><td colspan='2' style='text-align:center' class='forumheader'>
 
 <input class='button' type='submit' name='metasubmit' value='".METLAN_3."' />
diff -ruN 0.7.5/e107_admin/newspost.php 0.7.7/e107_admin/newspost.php
--- 0.7.5/e107_admin/newspost.php	2006-05-13 19:28:40.000000000 -0500
+++ 0.7.7/e107_admin/newspost.php	2006-11-12 12:48:14.000000000 -0600
@@ -11,8 +11,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_admin/newspost.php,v $
-|   $Revision: 1.123 $
-|   $Date: 2006/05/14 00:28:40 $
+|   $Revision: 1.138 $
+|   $Date: 2006/11/12 18:48:14 $
 |   $Author: e107coders $
 +---------------------------------------------------------------+
 
@@ -56,7 +56,7 @@
 $rs = new form;
 $ix = new news;
 
-$deltest = array_flip($_POST);
+
 if (e_QUERY) {
 	list($action, $sub_action, $id, $from) = explode(".", e_QUERY);
 	$id = intval($id);
@@ -74,11 +74,6 @@
 	$_POST['news_class'] = implode(",", array_keys($_POST['news_userclass']));
 }
 
-if (preg_match("#(.*?)_delete_(\d+)#", $deltest[$tp->toJS(LAN_DELETE)], $matches))
-{
-	$delete = $matches[1];
-	$del_id = $matches[2];
-}
 
 if(isset($_POST['delete']))
 {
@@ -95,6 +90,8 @@
 		{
 			$newspost->show_message(NWSLAN_31." #".$del_id." ".NWSLAN_32);
 			$e107cache->clear("news.php");
+			$e107cache->clear("othernews");
+			$e107cache->clear("othernews2");
 
 			admin_purge_related("news", $del_id);
 		}
@@ -115,6 +112,8 @@
 	{
 		$newspost->show_message(NWSLAN_34." #".$del_id." ".NWSLAN_32);
 		$e107cache->clear("news.php");
+		$e107cache->clear("othernews");
+		$e107cache->clear("othernews2");
 		unset($delete, $del_id);
 	}
 }
@@ -151,6 +150,8 @@
 if (isset($_POST['submit_news'])) {
 
 	$newspost->submit_item($sub_action, $id);
+	$e107cache->clear("othernews");
+	$e107cache->clear("othernews2");
 	$action = "main";
 	unset($sub_action, $id);
 }
@@ -180,12 +181,15 @@
 		$sql->db_Update("news_category", "category_name='".$_POST['category_name']."', category_icon='".$category_button."' WHERE category_id='".$_POST['category_id']."'");
 		$newspost->show_message(NWSLAN_36);
 	}
+	$e107cache->clear("news.php");
+	$e107cache->clear("othernews");
+	$e107cache->clear("othernews2");
 }
 
 if (isset($_POST['save_prefs'])) {
 	$pref['newsposts'] = $_POST['newsposts'];
 
-	// ##### ADDED FOR NEWSARCHIVE --------------------------------------------------------------------
+	// ##### ADDED FOR NEWS ARCHIVE --------------------------------------------------------------------
 	$pref['newsposts_archive'] = $_POST['newsposts_archive'];
 	$pref['newsposts_archive_title'] = $tp->toDB($_POST['newsposts_archive_title']);
 	// ##### END --------------------------------------------------------------------------------------
@@ -197,7 +201,7 @@
 	$pref['subnews_class'] = $_POST['subnews_class'];
 	$pref['subnews_htmlarea'] = $_POST['subnews_htmlarea'];
 	$pref['subnews_hide_news'] = $_POST['subnews_hide_news'];
-	$pref['news_subheader'] = $_POST['news_subheader'];
+	$pref['news_subheader'] = $tp->toDB($_POST['news_subheader']);
 	/*
 	changes by jalist 22/01/2005:
 	added pref to render new date header
@@ -207,6 +211,8 @@
 
 	save_prefs();
 	$e107cache->clear("news.php");
+	$e107cache->clear("othernews");
+	$e107cache->clear("othernews2");
 	$newspost->show_message(NWSLAN_119);
 }
 
@@ -228,7 +234,7 @@
 			$_POST['news_class'] = $news_class;
 			$_POST['news_summary'] = $news_summary;
 			$_POST['news_sticky'] = $news_sticky;
-			$_POST['news_datestamp'] = $news_datestamp;
+			$_POST['news_datestamp'] = ($_POST['news_datestamp']) ? $_POST['news_datestamp'] : $news_datestamp;
 
 			$_POST['cat_id'] = $news_category;
 			$_POST['news_start'] = $news_start;
@@ -302,12 +308,12 @@
 
 				$text .= "<tr>
 				<td style='width:5%' class='forumheader3'>$news_id</td>
-				<td style='width:55%' class='forumheader3'><a href='".e_BASE."comment.php?comment.news.$news_id'>".($news_title ? $tp->toHTML($news_title,"","no_make_clickable") : "[".NWSLAN_42."]")."</a></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."generic/sticky.png") ? THEME."generic/sticky.png" : e_IMAGE."generic/".IMODE."/sticky.png");
+					$sicon = (file_exists(THEME."images/sticky.png") ? THEME."images/sticky.png" : e_IMAGE."generic/".IMODE."/sticky.png");
 					$text .= " <img src='".$sicon."' alt='' />";
 				}
 				$text .= "
@@ -326,22 +332,13 @@
 
 		$newsposts = $sql->db_Count("news");
 
-		$text .= "<div style='text-align:center; ".ADMIN_WIDTH."; margin-left: auto; margin-right: auto'>";
-		if ($newsposts > $amount && !$_POST['searchquery']) {
-			$a = $newsposts/$amount;
-			$r = explode(".", $a);
-			if ($r[1] != 0 ? $pages = ($r[0]+1) : $pages = $r[0]);
-			if ($pages) {
-				$current = ($from/$amount)+1;
-				$text .= "<br />".NWSLAN_62." ";
-				for($a = 1; $a <= $pages; $a++) {
-					$text .= ($current == $a ? " <b>[$a]</b>" : " [<a href='".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.news_datestamp.desc.").(($a-1) * $amount)."'>$a</a>] ");
-				}
-				$text .= "<br />";
-			}
+		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}}");
+
 		}
 
-		$text .= "</div><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>";
 
 
 
@@ -391,12 +388,12 @@
 				if (e_WYSIWYG)
 				{
 					$_POST['data'] .= "<br /><b>".NWSLAN_49." ".$submitnews_name."</b>";
-					$_POST['data'] .= ($submitnews_file)? "<br /><br /><img src='".e_IMAGE."newspost_images/$submitnews_file' style='float:right; margin-left:5px;margin-right:5px;margin-top:5px;margin-bottom:5px; border:1px solid' />":	"";
+					$_POST['data'] .= ($submitnews_file)? "<br /><br /><img src='{e_IMAGE}newspost_images/".$submitnews_file."' style='float:right; margin-left:5px;margin-right:5px;margin-top:5px;margin-bottom:5px; border:1px solid' />":	"";
 				}
 				else
 				{
 					$_POST['data'] .= "\n[[b]".NWSLAN_49." ".$submitnews_name."[/b]]";
-					$_POST['data'] .= ($submitnews_file)?"\n\n[img]{E_IMAGE}newspost_images/".$submitnews_file."[/img]": "";
+					$_POST['data'] .= ($submitnews_file)?"\n\n[img]{e_IMAGE}newspost_images/".$submitnews_file."[/img]": "";
 				}
 				$_POST['cat_id'] = $submitnews_category;
 			}
@@ -409,7 +406,7 @@
 				$post_author_id = substr($upload_poster, 0, strpos($upload_poster, "."));
 				$post_author_name = substr($upload_poster, (strpos($upload_poster, ".")+1));
 				$upload_file = "pub_" . (preg_match("#Binary\s(.*?)\/#", $upload_file, $match) ? $match[1] : $upload_file);
-				$_POST['news_title'] = NWSLAN_66.": ".$upload_name;
+				$_POST['news_title'] = LAN_UPLOAD.": ".$upload_name;
 				$_POST['data'] = $upload_description."\n[b]".NWSLAN_49." <a href='user.php?id.".$post_author_id."'>".$post_author_name."</a>[/b]\n\n[file=request.php?".$upload_file."]".$upload_name."[/file]\n";
 			}
 		}
@@ -458,12 +455,7 @@
 		$_POST['data'] = $tp->toForm($_POST['data']);
 		$text .= "<textarea class='tbox' id='data' name='data'  cols='80'  style='width:100%' $insertjs>".(strstr($tp->post_toForm($_POST['data']), "[img]http") ? $_POST['data'] : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['data'])))."</textarea>
 		";
-
-		//Main news body textarea
-		if (!e_WYSIWYG) {
-			$text .= "<input id='helpb' class='helpbox' type='text' name='helpb' size='100' style='width:95%'/>
-			<br />". display_help("helpb", 'news');
-		} // end of htmlarea check.
+        $text .= display_help("helpb", 'news');
 
 		//Extended news form textarea
 		if(e_WYSIWYG){ $ff_expand = "tinyMCE.execCommand('mceResetDesignMode')";  } // Fixes Firefox issue with hidden wysiwyg textarea.
@@ -475,11 +467,8 @@
 		<td style='width:80%' class='forumheader3'>
 		<a style='cursor: pointer; cursor: hand' 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>";
-		if (!e_WYSIWYG) {
-			$text .="<br />". display_help("helpb", 'news');
-		}
-		$text .= "
+		<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')."
 		</div>
 		</td>
 		</tr>
@@ -492,17 +481,17 @@
 
 		if (!FILE_UPLOADS)
 		{
-			$text .= "<b>".NWSLAN_78."</b>";
+			$text .= "<b>".LAN_UPLOAD_SERVEROFF."</b>";
 		}
 		else
 		{
 			if (!is_writable(e_FILE."downloads"))
 			{
-				$text .= "<b>".NWSLAN_70."</b><br /><br />";
+				$text .= LAN_UPLOAD_777."<b>".str_replace("../","",e_FILE."downloads/")."</b><br /><br />";
 			}
 			if (!is_writable(e_IMAGE."newspost_images"))
 			{
-				$text .= "<b>".NWSLAN_71."</b><br /><br />";
+				$text .= LAN_UPLOAD_777."<b>".str_replace("../","",e_IMAGE."newspost_images/")."</b><br /><br />";
 			}
 
 			$up_name = array(LAN_NEWS_24,NWSLAN_67,LAN_NEWS_22,NWSLAN_68);
@@ -533,7 +522,7 @@
 		</tr>
 
 		<tr>
-		<td class='forumheader3'>".LAN_NEWS_47.":</td>
+		<td class='forumheader3'>".NWSLAN_67.":</td>
 		<td class='forumheader3'>
 		<a style='cursor: pointer' onclick='expandit(this);'>".LAN_NEWS_23."</a>
 		<div style='display: none'><br />";
@@ -559,7 +548,7 @@
 		<a style='cursor: pointer; cursor: hand' onclick='expandit(this);'>".NWSLAN_18."</a>
 		<div style='display: none;'>
 
-		". ($_POST['news_allow_comments'] ? "<input name='news_allow_comments' type='radio' value='0' />".NWSLAN_16."&nbsp;&nbsp;<input name='news_allow_comments' type='radio' value='1' checked='checked' />".NWSLAN_17 : "<input name='news_allow_comments' type='radio' value='0' checked='checked' />".NWSLAN_16."&nbsp;&nbsp;<input name='news_allow_comments' type='radio' value='1' />".NWSLAN_17)."
+		". ($_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)."
 		</div>
 		</td>
 		</tr>
@@ -633,7 +622,7 @@
 		<div style='display: none;'>";
 		$update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : "";
 
-		$_update_datestamp = ($_POST['news_datestamp'] > 0) ? date("d/m/Y H:i:s", $_POST['news_datestamp']) : "";
+		$_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;
@@ -768,7 +757,7 @@
 
 
 		$_PR['news_body'] = $tp->post_toHTML($_PR['data'],FALSE);
-		$_PR['news_title'] = $tp->post_toHTML($_PR['news_title']);
+		$_PR['news_title'] = $tp->post_toHTML($_PR['news_title'],FALSE,"emotes_off, no_make_clickable");
 		$_PR['news_summary'] = $tp->post_toHTML($_PR['news_summary']);
 		$_PR['news_extended'] = $tp->post_toHTML($_PR['news_extended']);
 		$_PR['news_file'] = $_POST['news_file'];
@@ -801,8 +790,6 @@
 			$_POST['news_end'] = 0;
 		}
 
-		$_POST['update_datestamp'] = 0;
-
 		if(preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['news_datestamp'], $matches))
 		{
 			$_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
@@ -977,7 +964,7 @@
 
 
 
-		// ##### ADDED FOR NEWSARCHIVE --------------------------------------------------------------------
+		// ##### ADDED FOR NEWS ARCHIVE --------------------------------------------------------------------
 		// the possible archive values are from "0" to "< $pref['newsposts']"
 		// this should really be made as an onchange event on the selectbox for $pref['newsposts'] ...
 		$text .= "
@@ -1052,7 +1039,7 @@
 		<tr>
 		<td class='forumheader3' style='width:60%'><span class='defaulttext'>".NWSLAN_120."</span><br /></td>
 		<td class='forumheader3' style='width:40%'>
-		<textarea name='news_subheader' style='width:95%;' rows='6' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' class='tbox'>".stripcslashes($pref['news_subheader'])." </textarea><br />" . ren_help(2) . "
+		<textarea name='news_subheader' style='width:95%;' rows='6' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' class='tbox'>".stripcslashes($pref['news_subheader'])." </textarea><br />" . display_help('helpb', 2) . "
 		</td>
 		</tr>
 
@@ -1086,8 +1073,8 @@
 				$text .= "<tr>
 				<td style='width:5%; text-align:center; vertical-align:top' class='forumheader3'>$submitnews_id</td>
 				<td style='width:70%' class='forumheader3'>";
-				$text .= ($submitnews_auth == 0)? "<b>".$tp->toHTML($submitnews_title)."</b>": $tp->toHTML($submitnews_title);
-				$text .= " [ ".NWSLAN_104." $submitnews_name on ".date("D dS M y, g:ia", $submitnews_datestamp)."]<br />".$tp->toHTML($submitnews_item)."</td>
+				$text .= ($submitnews_auth == 0)? "<b>".$tp->toHTML($submitnews_title,FALSE,"emotes_off, no_make_clickable")."</b>": $tp->toHTML($submitnews_title,FALSE,"emotes_off, no_make_clickable");
+				$text .= " [ ".NWSLAN_104." ".$submitnews_name." ".NWSLAN_108." ".date("D dS M y, g:ia", $submitnews_datestamp)."]<br />".$tp->toHTML($submitnews_item)."</td>
 				<td style='width:25%; text-align:right; vertical-align:top' class='forumheader3'>";
 				$buttext = ($submitnews_auth == 0)? NWSLAN_58 :	NWSLAN_103;
 				$text .= $rs->form_open("post", e_SELF."?sn", "myform__{$submitnews_id}", "", "", " onsubmit=\"return jsconfirm('".$tp->toJS(NWSLAN_38." [ID: $submitnews_id ]")."')\"   ")
@@ -1102,7 +1089,7 @@
 			$text .= "<div style='text-align:center'>".NWSLAN_59."</div>";
 		}
 		$text .= "</div>";
-		$ns->tablerender(NWSLAN_60, $text);
+		$ns->tablerender(NWSLAN_47, $text);
 
 	}
 
@@ -1115,4 +1102,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/notify.php 0.7.7/e107_admin/notify.php
--- 0.7.5/e107_admin/notify.php	2005-12-21 11:17:22.000000000 -0600
+++ 0.7.7/e107_admin/notify.php	2006-09-16 13:18:04.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/notify.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/12/21 17:17:22 $
-|     $Author: sweetas $
+|     $Revision: 1.13 $
+|     $Date: 2006/09/16 18:18:04 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -35,42 +35,40 @@
 $nc -> config();
 
 class notify_config {
-	
+
 	var $notify_prefs;
-	
+
 	function notify_config() {
-		global $sysprefs, $eArrayStorage, $tp, $sql;
+		global $sysprefs, $eArrayStorage, $tp, $sql,$pref;
 		$this -> notify_prefs = $sysprefs -> get('notify_prefs');
 		$this -> notify_prefs = $eArrayStorage -> ReadArray($this -> notify_prefs);
-		
-		$handle = opendir(e_PLUGIN);
-		while (false !== ($file = readdir($handle))) {
-			if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)) {
-				$plugin_handle = opendir(e_PLUGIN.$file."/");
-				while (false !== ($file2 = readdir($plugin_handle))) {
-					if ($file2 == "e_notify.php") {
-						if ($sql -> db_Select("plugin", "plugin_path", "plugin_path='".$file."' AND plugin_installflag='1'")) {
-							if (!isset($this -> notify_prefs['plugins'][$file])) {
-								$this -> notify_prefs['plugins'][$file] = TRUE;
-								require_once(e_PLUGIN.$file.'/e_notify.php');
-								foreach ($config_events as $event_id => $event_text) {
-									$this -> notify_prefs['event'][$event_id] = array('type' => 'off', 'class' => '254', 'email' => '');
-								}
-								$recalibrate = true;
-							}
+
+		// load every e_notify.php file.
+        foreach($pref['e_notify_list'] as $val)
+		{
+				if (!isset($this -> notify_prefs['plugins'][$val]))
+				{
+					$this -> notify_prefs['plugins'][$val] = TRUE;
+					if (is_readable(e_PLUGIN.$val."/e_notify.php"))
+					{
+						require_once(e_PLUGIN.$val.'/e_notify.php');
+						foreach ($config_events as $event_id => $event_text)
+				   		{
+							$this -> notify_prefs['event'][$event_id] = array('type' => 'off', 'class' => '254', 'email' => '');
 						}
+						$recalibrate = true;
 					}
 				}
-			}
 		}
-		
+
+
 		if ($recalibrate) {
 			$s_prefs = $tp -> toDB($this -> notify_prefs);
 			$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
 			$sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
 		}
 	}
-	
+
 	function config() {
 		global $ns, $rs;
 
@@ -80,39 +78,48 @@
 		<tr>
 		<td class='fcaption' colspan='2'>".NT_LAN_2.":</td>
 		</tr>";
-		
+
 		$text .= "<tr>
 		<td colspan='2' class='forumheader'>".NU_LAN_1."</td>
 		</tr>";
-		
-		$text .= $this -> render_event('usersup', NU_LAN_2);		
+
+		$text .= $this -> render_event('usersup', NU_LAN_2);
 		$text .= $this -> render_event('userveri', NU_LAN_3);
 		$text .= $this -> render_event('login', NU_LAN_4);
 		$text .= $this -> render_event('logout', NU_LAN_5);
-		
+
 		$text .= "<tr>
 		<td colspan='2' class='forumheader'>".NS_LAN_1."</td>
 		</tr>";
-		
+
 		$text .= $this -> render_event('flood', NS_LAN_2);
 
-		
+
 		$text .= "<tr>
 		<td colspan='2' class='forumheader'>".NN_LAN_1."</td>
 		</tr>";
-		
+
 		$text .= $this -> render_event('subnews', NN_LAN_2);
 		$text .= $this -> render_event('newspost', NN_LAN_3);
 		$text .= $this -> render_event('newsupd', NN_LAN_4);
 		$text .= $this -> render_event('newsdel', NN_LAN_5);
-		
+
+		$text .= "<tr>
+		<td colspan='2' class='forumheader'>".NF_LAN_1."</td>
+		</tr>";
+
+		$text .= $this -> render_event('fileupload', NF_LAN_2);
+
 		foreach ($this -> notify_prefs['plugins'] as $plugin_id => $plugin_settings) {
-			require(e_PLUGIN.$plugin_id.'/e_notify.php');
-			$text .= "<tr>
-			<td colspan='2' class='forumheader'>".$config_category."</td>
-			</tr>";
-			foreach ($config_events as $event_id => $event_text) {
-				$text .= $this -> render_event($event_id, $event_text);
+            if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
+			{
+				require(e_PLUGIN.$plugin_id.'/e_notify.php');
+				$text .= "<tr>
+				<td colspan='2' class='forumheader'>".$config_category."</td>
+				</tr>";
+				foreach ($config_events as $event_id => $event_text) {
+					$text .= $this -> render_event($event_id, $event_text);
+				}
 			}
 		}
 
@@ -125,7 +132,7 @@
 
 		$ns -> tablerender(NT_LAN_1, $text);
 	}
-	
+
 	function render_event($id, $description) {
 		global $rs, $tp;
 		$text .= "<tr>
@@ -133,17 +140,17 @@
 		".$description.":
 		</td>
 		<td class='forumheader3' style='width: 70%; white-space: nowrap'>
-		<input type='radio' name='event[".$id."][type]' value='off' ".(($this -> notify_prefs['event'][$id]['type'] == 'off' || !$this -> notify_prefs['event'][$id]['type']) ? " checked='checked'" : "")." /> ".NT_LAN_3." 
-		<input type='radio' name='event[".$id."][type]' value='main' ".($this -> notify_prefs['event'][$id]['type'] == 'main' ? " checked='checked'" : "")." /> ".NT_LAN_4." 
-		<input type='radio' name='event[".$id."][type]' value='class' ".($this -> notify_prefs['event'][$id]['type'] == 'class' ? " checked='checked'" : "")." /> ".NT_LAN_5.": 
-		".r_userclass('event['.$id.'][class]', $this -> notify_prefs['event'][$id]['class'], 'off', 'member,admin,classes')." 
-		<input type='radio' name='event[".$id."][type]' value='email' ".($this -> notify_prefs['event'][$id]['type'] == 'email' ? " checked='checked'" : "")." /> ".NT_LAN_6.": 
+		<input type='radio' name='event[".$id."][type]' value='off' ".(($this -> notify_prefs['event'][$id]['type'] == 'off' || !$this -> notify_prefs['event'][$id]['type']) ? " checked='checked'" : "")." /> ".NT_LAN_3."
+		<input type='radio' name='event[".$id."][type]' value='main' ".($this -> notify_prefs['event'][$id]['type'] == 'main' ? " checked='checked'" : "")." /> ".NT_LAN_4."
+		<input type='radio' name='event[".$id."][type]' value='class' ".($this -> notify_prefs['event'][$id]['type'] == 'class' ? " checked='checked'" : "")." /> ".NT_LAN_5.":
+		".r_userclass('event['.$id.'][class]', $this -> notify_prefs['event'][$id]['class'], 'off', 'member,admin,classes')."
+		<input type='radio' name='event[".$id."][type]' value='email' ".($this -> notify_prefs['event'][$id]['type'] == 'email' ? " checked='checked'" : "")." /> ".NT_LAN_6.":
 		".$rs -> form_text('event['.$id.'][email]', 17, $tp -> toForm($this -> notify_prefs['event'][$id]['email']))."
 		</td>
 		</tr>";
 		return $text;
 	}
-	
+
 	function update() {
 		global $sql, $pref, $tp, $eArrayStorage;
 		foreach ($_POST['event'] as $key => $value) {
@@ -151,7 +158,7 @@
 				$active = TRUE;
 			}
 		}
-		
+
 		$s_prefs = $tp -> toDB($this -> notify_prefs);
 		$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
 		$sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
@@ -162,7 +169,7 @@
 		}
 		save_prefs();
 	}
-	
+
 	function update_event($id) {
 		$this -> notify_prefs['event'][$id]['type'] = $_POST['event'][$id]['type'];
 		$this -> notify_prefs['event'][$id]['class'] = $_POST['event'][$id]['class'];
@@ -177,4 +184,4 @@
 
 require_once('footer.php');
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/plugin.php 0.7.7/e107_admin/plugin.php
--- 0.7.5/e107_admin/plugin.php	2006-03-16 09:58:14.000000000 -0600
+++ 0.7.7/e107_admin/plugin.php	2006-11-11 22:03:44.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/plugin.php,v $
-|     $Revision: 1.59 $
-|     $Date: 2006/03/16 15:58:14 $
-|     $Author: lisa_ $
+|     $Revision: 1.68 $
+|     $Date: 2006/11/12 04:03:44 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -132,12 +132,6 @@
 			$text .= call_user_func($func);
 		}
 
-		if(is_array($eplug_rss)) {
-			foreach($eplug_rss as $key=>$values) {
-				$text .= ($sql -> db_Update("plugin", "plugin_rss = '' WHERE plugin_id='{$id}'")) ? EPL_ADLAN_47 .". ($key)<br />" : EPL_ADLAN_49 .". ($key)<br />";
-			}
-		}
-		
 		if($_POST['delete_tables'])
 		{
 			if (is_array($eplug_table_names))
@@ -180,6 +174,8 @@
 			$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
 		}
 
+
+
 		if (is_array($eplug_array_pref))
 		{
 			foreach($eplug_array_pref as $key => $val)
@@ -233,7 +229,7 @@
 		$plugin -> manage_notify('remove', $eplug_folder);
 
 		$sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$id}' ");
-		
+
 		if($_POST['delete_files'])
 		{
 			include_once(e_HANDLER."file_class.php");
@@ -245,13 +241,15 @@
 		{
 			$text .= '<br />'.EPL_ADLAN_31.' <b>'.e_PLUGIN.$eplug_folder.'</b> '.EPL_ADLAN_32;
 		}
-		$ns->tablerender(EPL_ADLAN_1.' '.$eplug_name, $text);
+		$ns->tablerender(EPL_ADLAN_1.' '.$tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable"), $text);
 		$text = "";
+		$plugin -> save_addon_prefs();
 	}
 }
 
 if ($action == 'install') {
 	$plugin->install_plugin(intval($id));
+	$plugin ->save_addon_prefs();
 }
 
 if ($action == 'upgrade') {
@@ -351,12 +349,15 @@
 	}
 
 	$plugin -> manage_search('upgrade', $eplug_folder);
-
 	$plugin -> manage_notify('upgrade', $eplug_folder);
 
-	$text .= '<br />'.$eplug_upgrade_done;
-	$sql->db_Update('plugin', "plugin_version ='{$eplug_version}' WHERE plugin_id='$id' ");
+    $eplug_addons = $plugin -> getAddons($eplug_folder);
+
+	$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' ");
 	$ns->tablerender(EPL_ADLAN_34, $text);
+
+	$plugin -> save_addon_prefs();
 }
 
 
@@ -429,7 +430,7 @@
 
 		$plugin_icon = $eplug_icon ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px;vertical-align: bottom; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
 		if ($eplug_conffile && $plug['plugin_installflag'] == TRUE) {
-			$conf_title = EPL_CONFIGURE.' '.$eplug_name;
+			$conf_title = LAN_CONFIGURE.' '.$tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable");
 			$plugin_icon = "<a title='{$conf_title}' href='".e_PLUGIN.$eplug_folder.'/'.$eplug_conffile."' >".$plugin_icon.'</a>';
 		}
 
@@ -439,7 +440,7 @@
 		<table style='width:100%'><tr><td style='text-align:left;width:40px;vertical-align:top'>
 		".$plugin_icon."
 		</td><td>
-		$img <b>{$plug['plugin_name']}</b><br />".EPL_ADLAN_11." {$plug['plugin_version']}
+		$img <b>".$tp->toHTML($plug['plugin_name'],FALSE,"defs,emotes_off, no_make_clickable")."</b><br />".EPL_ADLAN_11." {$plug['plugin_version']}
 		<br />";
 
 		$text .="</td>
@@ -512,7 +513,7 @@
 	global $plugin, $tp, $id, $ns;
 	$id = intval($id);
 	$plug = $plugin->getinfo($id);
-	
+
 	if ($plug['plugin_installflag'] == TRUE )
 	{
 		include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
@@ -522,8 +523,8 @@
 	{
 		$del_text = "
 		<select class='tbox' name='delete_files'>
-		<option value='0'>".EPL_ADLAN_51."</option>
-		<option value='1'>".EPL_ADLAN_52."</option>
+		<option value='0'>".LAN_NO."</option>
+		<option value='1'>".LAN_YES."</option>
 		</select>
 		";
 	}
@@ -534,16 +535,16 @@
 		<input type='hidden' name='delete_files' value='0' />
 		";
 	}
-	
+
 	$text = "
 	<form action='".e_SELF."?".e_QUERY."' method='post'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>
 	<tr>
-		<td colspan='2' class='forumheader'>".EPL_ADLAN_54." $eplug_name </td>
+		<td colspan='2' class='forumheader'>".EPL_ADLAN_54." ".$tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable")."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3'>".EPL_ADLAN_55."</td>
-		<td class='forumheader3'>".EPL_ADLAN_52."</td>
+		<td class='forumheader3'>".LAN_YES."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>
@@ -551,8 +552,8 @@
 		</td>
 		<td class='forumheader3'>
 			<select class='tbox' name='delete_tables'>
-			<option value='1'>".EPL_ADLAN_52."</option>
-			<option value='0'>".EPL_ADLAN_51."</option>
+			<option value='1'>".LAN_YES."</option>
+			<option value='0'>".LAN_NO."</option>
 			</select>
 		</td>
 	</tr>
@@ -561,14 +562,14 @@
 		<td class='forumheader3'>{$del_text}</td>
 	</tr>
 	<tr>
-		<td colspan='2' class='forumheader' style='text-align:center'><input class='button' type='submit' name='uninstall_confirm' value='".EPL_ADLAN_61."' />&nbsp;&nbsp;<input class='button' type='submit' name='uninstall_cancel' value='".EPL_ADLAN_62."' onclick=\"location.href='".e_SELF."'; return false;\"/></td>
+		<td colspan='2' class='forumheader' style='text-align:center'><input class='button' type='submit' name='uninstall_confirm' value=\"".EPL_ADLAN_3."\" />&nbsp;&nbsp;<input class='button' type='submit' name='uninstall_cancel' value='".EPL_ADLAN_62."' onclick=\"location.href='".e_SELF."'; return false;\"/></td>
 	</tr>
 	</table>
 	</form>
 	";
-	$ns->tablerender(EPL_ADLAN_63." {$eplug_name}", $text);
+	$ns->tablerender(EPL_ADLAN_63." ".$tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable"), $text);
 	require_once(e_ADMIN."footer.php");
 	exit;
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/prefs.php 0.7.7/e107_admin/prefs.php
--- 0.7.5/e107_admin/prefs.php	2006-05-01 18:58:46.000000000 -0500
+++ 0.7.7/e107_admin/prefs.php	2006-11-17 20:29:09.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/prefs.php,v $
-|     $Revision: 1.89 $
-|     $Date: 2006/05/01 23:58:46 $
+|     $Revision: 1.96 $
+|     $Date: 2006/11/18 02:29:09 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -82,7 +82,7 @@
 if ($authlist) {
 	$auth_dropdown .= "<select class='tbox' name='auth_method'>\n";
 	foreach($authlist as $a) {
-		$s = ($pref['auth_method'] == $a ? " selected='selected'>" : "");
+		$s = ($pref['auth_method'] == $a ? " selected='selected' " : "");
 		$auth_dropdown .= "<option {$s}>".$a."</option>\n";
 	}
 	$auth_dropdown .= "</select>\n";
@@ -167,36 +167,36 @@
 	$text .= "
 		</td>
 	</tr>
-	<tr>
 
+	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_5."</td>
 	<td style='width:50%; text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitetag' cols='59' rows='3'>".$pref['sitetag']."</textarea>
 	</td>
 	</tr>
-	<tr>
 
+	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_6."</td>
 	<td style='width:50%; text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitedescription' cols='59' rows='6'>".$pref['sitedescription']."</textarea>
 	</td>
 	</tr>
-	<tr>
 
+	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_7."</td>
 	<td style='width:50%; text-align:right' class='forumheader3'>
 	<input class='tbox' type='text' name='siteadmin' size='50' value='".SITEADMIN."' maxlength='100' />
 	</td>
 	</tr>
-	<tr>
 
+	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_8."</td>
 	<td style='width:50%; text-align:right' class='forumheader3'>
 	<input class='tbox' type='text' name='siteadminemail' size='50' value='".SITEADMINEMAIL."' maxlength='100' />
 	</td>
 	</tr>
-	<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'>
 	<textarea class='tbox' name='sitecontactinfo' cols='59' rows='6'>".$pref['sitecontactinfo']."</textarea>
@@ -204,6 +204,12 @@
 	</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>
+	</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'>
 	<input type='radio' name='contact_emailcopy' value='1'".($pref['contact_emailcopy'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
@@ -211,6 +217,7 @@
 	</td>
 	</tr>
 
+	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_9."</td>
 	<td style='width:50%; text-align:right' class='forumheader3'>
 	<textarea class='tbox' name='sitedisclaimer' cols='59' rows='6'>".$pref['sitedisclaimer']."</textarea>
@@ -420,6 +427,14 @@
 	</tr>
 
 	<tr>
+	<td style='width:50%' class='forumheader3'>".PRFLAN_167."<br /></td>
+	<td class='forumheader3' style='width:50%;text-align:right' >
+	<input type='radio' name='disable_emailcheck' value='1'".($pref['disable_emailcheck'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
+	<input type='radio' name='disable_emailcheck' value='0'".(!$pref['disable_emailcheck'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
+	</td>
+	</tr>
+
+	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_32."<br /><span class='smalltext'>".PRFLAN_33."</span></td>
 	<td style='width:50%; text-align:right' class='forumheader3'>
 	<input type='radio' name='anon_post' value='1'".($pref['anon_post'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
@@ -537,12 +552,15 @@
 
 if(!isset($pref['post_html']))
 {
-	$pref['post_html'] = '254';
+	$pref['post_html'] = '250';
 	save_prefs();
 }
 
 $text .= "<div id='textpost' style='display:none; text-align:center'>
 	<table style='width:100%' class='fborder'>
+	<tr>
+	<td class='fcaption' style='text-align:left;' colspan='2'>".PRFLAN_101."</td>
+	</tr>
 
 	<tr>
 	<td class='forumheader3' style='width:50%;'>".PRFLAN_127.":  <div class='smalltext'>".PRFLAN_128."</div></td>
@@ -599,7 +617,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, classes')."
+	".r_userclass('post_html',$pref['post_html'],'off','nobody, public, member, admin, main, classes')."
 	</td>
 	</tr>\n
 
@@ -807,6 +825,13 @@
 	$text .="</select></td>
 	</tr>
 
+	<tr>
+	<td style='width:50%' class='forumheader3'>".PRFLAN_170."<br /><span class='smalltext'>".PRFLAN_171."</span></td>
+	<td style='width:50%; text-align:right' class='forumheader3'>
+	<input type='radio' name='enable_rdns' value='1'".(varsettrue($pref['enable_rdns']) ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
+	<input type='radio' name='enable_rdns' value='0'".(!varsettrue($pref['enable_rdns']) ? " checked='checked'" : "")." /> ".PRFLAN_113."
+	</td>
+	</tr>
 
 	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_139.":</td>
@@ -814,7 +839,8 @@
 	<input type='radio' name='adminpwordchange' value='1'".($pref['adminpwordchange'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
 	<input type='radio' name='adminpwordchange' value='0'".(!$pref['adminpwordchange'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
 	</td>
-	</tr>";
+	</tr>
+	";
 
 $text .= pref_submit();
 
@@ -858,6 +884,13 @@
 	</td>
 	</tr>
 
+	<tr>
+	<td style='width:50%' class='forumheader3'>".PRFLAN_166.": </td>
+	<td style='width:50%; text-align:right' class='forumheader3'>
+	<input type='radio' name='comments_emoticons' value='1'".($pref['comments_emoticons'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
+	<input type='radio' name='comments_emoticons' value='0'".(!$pref['comments_emoticons'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
+	</td>
+	</tr>
 	";
 
 $text .= pref_submit();
diff -ruN 0.7.5/e107_admin/search.php 0.7.7/e107_admin/search.php
--- 0.7.5/e107_admin/search.php	2006-01-16 09:06:30.000000000 -0600
+++ 0.7.7/e107_admin/search.php	2006-07-07 23:49:00.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/search.php,v $
-|     $Revision: 1.33 $
-|     $Date: 2006/01/16 15:06:30 $
-|     $Author: sweetas $
+|     $Revision: 1.35 $
+|     $Date: 2006/07/08 04:49:00 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -43,24 +43,25 @@
 	$mysql_supported = true;
 }
 
-$handle = opendir(e_PLUGIN);
-while (false !== ($file = readdir($handle))) {
-	if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)) {
-		if ($sql -> db_Select("plugin", "plugin_path", "plugin_path='".$file."' AND plugin_installflag='1'")) {
-			if (is_readable(e_PLUGIN.$file."/e_search.php") && !isset($search_prefs['plug_handlers'][$file])) {
-				$search_prefs['plug_handlers'][$file] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10);
-				$save_search = TRUE;
-			}
-			if (is_readable(e_PLUGIN.$file.'/search/search_comments.php') && !isset($search_prefs['comments_handlers'][$file])) {
-				include_once(e_PLUGIN.$file.'/search/search_comments.php');
-				$search_prefs['comments_handlers'][$file] = array('id' => $comments_type_id, 'class' => '0', 'dir' => $file);
-				unset($comments_type_id);
-				$save_search = TRUE;
-			}
-		}
+foreach($pref['e_search_list'] as $file)
+{
+
+	if (is_readable(e_PLUGIN.$file."/e_search.php") && !isset($search_prefs['plug_handlers'][$file]))
+	{
+		$search_prefs['plug_handlers'][$file] = array('class' => 0, 'pre_title' => 1, 'pre_title_alt' => '', 'chars' => 150, 'results' => 10);
+		$save_search = TRUE;
+	}
+	if (is_readable(e_PLUGIN.$file.'/search/search_comments.php') && !isset($search_prefs['comments_handlers'][$file]))
+	{
+		include_once(e_PLUGIN.$file.'/search/search_comments.php');
+		$search_prefs['comments_handlers'][$file] = array('id' => $comments_type_id, 'class' => '0', 'dir' => $file);
+		unset($comments_type_id);
+		$save_search = TRUE;
 	}
+
 }
-closedir($handle);
+
+
 
 if (!isset($search_prefs['boundary'])) {
 	$search_prefs['boundary'] = 1;
@@ -86,7 +87,7 @@
 	foreach ($search_prefs['comments_handlers'] as $key => $value) {
 		$search_prefs['comments_handlers'][$key]['class'] = $_POST['comments_handlers'][$key]['class'];
 	}
-	
+
 	$search_prefs['google'] = $_POST['google'];
 
 	$tmp = addslashes(serialize($search_prefs));
@@ -145,18 +146,18 @@
 if ($query[0] == 'settings') {
 	$text = "<form method='post' action='".e_SELF."?settings'><div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>";
-	
+
 	$text .= "<tr>
 	<td class='fcaption' colspan='2'>".SEALAN_20."</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_15.": </td>
 	<td style='width:50%' class='forumheader3'>
 	".r_userclass("search_restrict", $pref['search_restrict'], "off", "public,guest,nobody,member,admin,classes")."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_30."</td>
 	<td style='width:50%;' colspan='2' class='forumheader3'>
@@ -164,7 +165,7 @@
 	<input type='radio' name='search_highlight' value='0'".(!$pref['search_highlight'] ? " checked='checked'" : "")." /> ".SEALAN_17."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_10."</td>
 	<td style='width:50%;' colspan='2' class='forumheader3'>
@@ -172,7 +173,7 @@
 	<input type='radio' name='relevance' value='0'".(!$search_prefs['relevance'] ? " checked='checked'" : "")." /> ".SEALAN_17."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_11."</td>
 	<td style='width:50%;' colspan='2' class='forumheader3'>
@@ -180,7 +181,7 @@
 	<input type='radio' name='user_select' value='0'".(!$search_prefs['user_select'] ? " checked='checked'" : "")." /> ".SEALAN_17."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_19."</td>
 	<td style='width:50%;' colspan='2' class='forumheader3'>
@@ -188,7 +189,7 @@
 	<input type='radio' name='multisearch' value='0'".(!$search_prefs['multisearch'] ? " checked='checked'" : "")." /> ".SEALAN_17."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_35."</td>
 	<td style='width:50%;' colspan='2' class='forumheader3'>
@@ -197,7 +198,7 @@
 	<input type='radio' name='selector' value='0'".($search_prefs['selector'] == '0' ? " checked='checked'" : "")." /> ".SEALAN_38."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_12."</td>
 	<td style='width:50%' colspan='2' class='forumheader3'>
@@ -205,16 +206,16 @@
 	<input type='radio' name='time_restrict' value='1'".($search_prefs['time_restrict'] ? " checked='checked'" : "")." />
 	".SEALAN_13." ".$rs -> form_text("time_secs", 3, $tp -> toForm($search_prefs['time_secs']), 3)." ".SEALAN_14."</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td class='forumheader3' style='width:50%'>".SEALAN_3."<br />".SEALAN_49."</td>
 	<td colspan='2' class='forumheader3' style='width:50%'>
 	".$rs -> form_radio('search_sort', 'mysql', ($search_prefs['mysql_sort'] == TRUE ? 1 : 0), 'MySql', ($mysql_supported ? "" : "disabled='true'"))."MySql<br />
-	".$rs -> form_radio('search_sort', 'php', ($search_prefs['mysql_sort'] == TRUE ? 0 : 1)).SEALAN_31." 
-	".$rs -> form_text("php_limit", 5, $tp -> toForm($search_prefs['php_limit']), 5)." ".SEALAN_32." 
+	".$rs -> form_radio('search_sort', 'php', ($search_prefs['mysql_sort'] == TRUE ? 0 : 1)).SEALAN_31."
+	".$rs -> form_text("php_limit", 5, $tp -> toForm($search_prefs['php_limit']), 5)." ".SEALAN_32."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_47."<br />".SEALAN_48."</td>
 	<td style='width:50%;' colspan='2' class='forumheader3'>
@@ -222,11 +223,11 @@
 	<input type='radio' name='boundary' value='0'".(!$search_prefs['boundary'] ? " checked='checked'" : "")." /> ".SEALAN_17."
 	</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td colspan='2' style='text-align:center' class='forumheader'>".$rs -> form_button("submit", "update_prefs", LAN_UPDATE)."</td>
 	</tr>";
-	
+
 	$text .= "</table>
 	</div></form>";
 
@@ -238,15 +239,15 @@
 		$handlers = $search_prefs['plug_handlers'];
 		$handler_type = 'plug_handlers';
 	}
-	
+
 	$text = "<form method='post' action='".e_SELF."?main.".$query[1].".".$query[2]."'>
 	<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>";
-	
+
 	$text .= "<tr>
 	<td class='fcaption' colspan='2'>".SEALAN_43.": ".$handlers[$query[2]]."</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td style='width:50%' class='forumheader3'>".SEALAN_44.":</td>
 	<td style='width:50%' class='forumheader3'>";
@@ -271,7 +272,7 @@
 	$text .= "<tr>
 	<td colspan='2' style='text-align:center' class='forumheader'>".$rs -> form_button("submit", "update_handler", LAN_UPDATE)."</td>
 	</tr>";
-	
+
 	$text .= "</table>
 	</div>
 	</form>";
@@ -280,18 +281,18 @@
 
 	$text = "<form method='post' action='".e_SELF."'><div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>";
-	
+
 	$text .= "<tr>
 	<td class='fcaption' colspan='4'>".SEALAN_21."</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td class='forumheader'>".SEALAN_24."</td>
 	<td class='forumheader'>".SEALAN_25."</td>
 	<td class='forumheader'>".LAN_ORDER."</td>
 	<td class='forumheader'>".LAN_EDIT."</td>
 	</tr>";
-	
+
 	foreach($search_handlers as $key => $value) {
 		$text .= "<tr>
 		<td style='width:55%; white-space:nowrap' class='forumheader3'>".$value."</td>
@@ -310,9 +311,11 @@
 		</td>
 		</tr>";
 	}
-	
+
 	foreach ($search_prefs['plug_handlers'] as $plug_dir => $active) {
-		require_once(e_PLUGIN.$plug_dir."/e_search.php");
+		if(is_readable(e_PLUGIN.$plug_dir."/e_search.php")){
+			require_once(e_PLUGIN.$plug_dir."/e_search.php");
+		}
 		$text .= "<tr>
 		<td style='width:55%; white-space:nowrap' class='forumheader3'>".$search_info[0]['qtype']."</td>
 		<td style='width:25%' class='forumheader3'>";
@@ -331,7 +334,7 @@
 		</td>
 		</tr>";
 	}
-	
+
 	$text .= "<tr>
 	<td style='white-space:nowrap' class='forumheader3'>Google</td>
 	<td colspan='3' class='forumheader3'>";
@@ -339,29 +342,31 @@
 	$text .= r_userclass("google", $search_prefs['google'], "off", "public,guest,nobody,member,admin,classes");
 	$text .= "</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td colspan='4' style='text-align:center' class='forumheader'>".$rs -> form_button("submit", "update_main", LAN_UPDATE)."</td>
 	</tr>";
-	
+
 	$text .= "</table>
 	</div><br />";
-	
+
 	$text .= "<div style='text-align:center'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>";
-	
+
 	$text .= "<tr>
 	<td class='fcaption' colspan='2'>".SEALAN_18."</td>
 	</tr>";
-	
+
 	$text .= "<tr>
 	<td class='forumheader'>".SEALAN_24."</td>
 	<td class='forumheader'>".SEALAN_25."</td>
 	</tr>";
-	
+
 	foreach ($search_prefs['comments_handlers'] as $key => $value) {
 		$path = ($value['dir'] == 'core') ? e_HANDLER.'search/comments_'.$key.'.php' : e_PLUGIN.$value['dir'].'/search/search_comments.php';
-		require_once($path);
+		if(is_readable($path)){
+			require_once($path);
+		}
 		$text .= "<tr>
 		<td style='width:55%; white-space:nowrap' class='forumheader3'>".$comments_title."</td>
 		<td style='width:45%' class='forumheader3'>";
@@ -370,11 +375,11 @@
 		</tr>";
 		unset($comments_title);
 	}
-	
+
 	$text .= "<tr>
 	<td colspan='2' style='text-align:center' class='forumheader'>".$rs -> form_button("submit", "update_main", LAN_UPDATE)."</td>
 	</tr>";
-	
+
 	$text .= "</table>
 	</div>
 	</form>";
@@ -392,7 +397,7 @@
 	} else if ($query[0] == 'settings') {
 		$action = "settings";
 	}
-	
+
 	$var['main']['text'] = SEALAN_41;
 	$var['main']['link'] = e_SELF;
 
diff -ruN 0.7.5/e107_admin/sql/core_pg.php 0.7.7/e107_admin/sql/core_pg.php
--- 0.7.5/e107_admin/sql/core_pg.php	2005-12-24 19:33:05.000000000 -0600
+++ 0.7.7/e107_admin/sql/core_pg.php	2006-10-19 16:17:06.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/sql/core_pg.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/25 01:33:05 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/19 21:17:06 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 header("location:../index.php");
@@ -244,6 +244,8 @@
   online_ip varchar(15) DEFAULT '' NOT NULL,
   online_location varchar(100) DEFAULT '' NOT NULL,
   online_pagecount tinyint(3) int2 DEFAULT '0' NOT NULL,
+  online_active int4 DEFAULT '0' NOT NULL,
+  
 );
 
 CREATE TABLE plugin (
diff -ruN 0.7.5/e107_admin/sql/core_sql.php 0.7.7/e107_admin/sql/core_sql.php
--- 0.7.5/e107_admin/sql/core_sql.php	2006-04-16 03:35:10.000000000 -0500
+++ 0.7.7/e107_admin/sql/core_sql.php	2006-11-27 02:48:57.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/sql/core_sql.php,v $
-|     $Revision: 1.46 $
-|     $Date: 2006/04/16 08:35:10 $
+|     $Revision: 1.53 $
+|     $Date: 2006/11/27 08:48:57 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -109,8 +109,8 @@
   dblog_datestamp int(10) unsigned NOT NULL default '0',
   dblog_user_id int(10) unsigned NOT NULL default '0',
   dblog_ip varchar(80) NOT NULL default '',
-  dblog_query text NOT NULL,
-  dblog_remarks varchar(255) NOT NULL default '',
+  dblog_title varchar(255) NOT NULL default '',
+  dblog_remarks text NOT NULL,
   PRIMARY KEY  (dblog_id)
 ) TYPE=MyISAM;
 # --------------------------------------------------------
@@ -308,7 +308,8 @@
   online_user_id varchar(100) NOT NULL default '',
   online_ip varchar(15) NOT NULL default '',
   online_location varchar(100) NOT NULL default '',
-  online_pagecount tinyint(3) unsigned NOT NULL default '0'
+  online_pagecount tinyint(3) unsigned NOT NULL default '0',
+  online_active int(10) unsigned NOT NULL default '0'
 ) TYPE=MyISAM;
 # --------------------------------------------------------
 
@@ -342,8 +343,9 @@
   plugin_version varchar(10) NOT NULL default '',
   plugin_path varchar(100) NOT NULL default '',
   plugin_installflag tinyint(1) unsigned NOT NULL default '0',
-  plugin_rss varchar(255) NOT NULL default '',
-  PRIMARY KEY  (plugin_id)
+  plugin_addons text NOT NULL,
+  PRIMARY KEY  (plugin_id),
+  UNIQUE KEY plugin_path (plugin_path)
 ) TYPE=MyISAM;
 
 # --------------------------------------------------------
@@ -430,7 +432,8 @@
 CREATE TABLE tmp (
   tmp_ip varchar(20) NOT NULL default '',
   tmp_time int(10) unsigned NOT NULL default '0',
-  tmp_info text NOT NULL
+  tmp_info text NOT NULL,
+  KEY tmp_ip (tmp_ip)
 ) TYPE=MyISAM;
 # --------------------------------------------------------
 
@@ -453,7 +456,8 @@
   upload_filesize int(10) unsigned NOT NULL default '0',
   upload_active tinyint(3) unsigned NOT NULL default '0',
   upload_category tinyint(3) unsigned NOT NULL default '0',
-  PRIMARY KEY  (upload_id)
+  PRIMARY KEY  (upload_id),
+  KEY upload_active (upload_active)
 ) TYPE=MyISAM;
 
 # --------------------------------------------------------
@@ -472,7 +476,7 @@
   user_email varchar(100) NOT NULL default '',
   user_signature text NOT NULL,
   user_image varchar(100) NOT NULL default '',
-  user_timezone char(3) NOT NULL default '',
+  user_timezone varchar(3) NOT NULL default '',
   user_hideemail tinyint(3) unsigned NOT NULL default '0',
   user_join int(10) unsigned NOT NULL default '0',
   user_lastvisit int(10) unsigned NOT NULL default '0',
@@ -559,6 +563,7 @@
   gen_ip varchar(80) NOT NULL default '',
   gen_intdata int(10) unsigned NOT NULL default '0',
   gen_chardata text NOT NULL,
-  PRIMARY KEY  (gen_id)
+  PRIMARY KEY  (gen_id),
+  KEY gen_type (gen_type)
 ) TYPE=MyISAM;
-# --------------------------------------------------------
\ No newline at end of file
+# --------------------------------------------------------
diff -ruN 0.7.5/e107_admin/ugflag.php 0.7.7/e107_admin/ugflag.php
--- 0.7.5/e107_admin/ugflag.php	2005-12-24 19:26:59.000000000 -0600
+++ 0.7.7/e107_admin/ugflag.php	2006-07-07 21:21:51.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ugflag.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/25 01:26:59 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/07/08 02:21:51 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -21,7 +21,7 @@
 	header("location:".e_BASE."index.php");
 	 exit;
 }
-$e_sub_cat = 'maintain';
+
 require_once(e_HANDLER."ren_help.php");
 
 if (isset($_POST['updatesettings'])) {
@@ -60,14 +60,8 @@
 	<tr>
 	<td style='width:30%' class='forumheader3'>".UGFLAN_5."<br /><span class='smalltext'>".UGFLAN_6."</span></td>
 	<td style='width:70%' class='forumheader3'>
-	<textarea id='maintainance_text' class='tbox' name='maintainance_text' cols='59' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$pref['maintainance_text']."</textarea>
-	</td>
-	</tr>
-
-	<tr style='vertical-align:top'>
-	<td colspan='2'  style='text-align:center' class='forumheader3'>
-	".display_help("",2)."
-	</td>
+	<textarea id='maintainance_text' class='tbox' name='maintainance_text' cols='63' style='max-width:80%' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$pref['maintainance_text']."</textarea>
+	<br />".display_help("","maintenance")."  </td>
 	</tr>
 
 
diff -ruN 0.7.5/e107_admin/update_routines.php 0.7.7/e107_admin/update_routines.php
--- 0.7.5/e107_admin/update_routines.php	2006-04-08 19:51:16.000000000 -0500
+++ 0.7.7/e107_admin/update_routines.php	2006-11-17 12:17:38.000000000 -0600
@@ -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.178 $
-|     $Date: 2006/04/09 00:51:16 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.192 $
+|     $Date: 2006/11/17 18:17:38 $
+|     $Author: sweetas $
 +----------------------------------------------------------------------------+
 */
 
@@ -71,6 +71,7 @@
 }
 
 // $dbupdate["701_to_702"] = LAN_UPDATE_8." .7.1 ".LAN_UPDATE_9." .7.2";
+$dbupdate["70x_to_706"] = LAN_UPDATE_8." .70x ".LAN_UPDATE_9." .706";
 $dbupdate["617_to_700"] = LAN_UPDATE_8." .617 ".LAN_UPDATE_9." .7";
 $dbupdate["616_to_617"] = LAN_UPDATE_8." .616 ".LAN_UPDATE_9." .617";
 $dbupdate["615_to_616"] = LAN_UPDATE_8." .615 ".LAN_UPDATE_9." .616";
@@ -100,7 +101,7 @@
 
 	if ($update_needed === TRUE) {
 		$txt = "<div style='text-align:center;'>".ADLAN_120;
-		$txt .= "<br /><form method='POST' action='".e_ADMIN."e107_update.php'>
+		$txt .= "<br /><form method='post' action='".e_ADMIN."e107_update.php'>
 		<input class='button' type='submit' value='".LAN_UPDATE."' />
 		</form></div>";
 		$ns->tablerender(LAN_UPDATE, $txt);
@@ -116,6 +117,110 @@
 }
 */
 
+function update_70x_to_706($type='') {
+	global $sql,$ns;
+
+	if ($type == "do")
+	{
+		//rename plugin_rss field
+		if($sql->db_Field("plugin",5) == "plugin_rss")
+		{
+			mysql_query("ALTER TABLE `".MPREFIX."plugin` CHANGE `plugin_rss` `plugin_addons` TEXT NOT NULL;");
+			catch_error();
+		}
+
+		if(!$sql->db_Field("plugin",5))  // not plugin_rss so just add the new one.
+		{
+        	mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_addons` TEXT NOT NULL ;");
+			catch_error();
+		}
+
+		if($sql->db_Field("dblog",5) == "dblog_query")
+		{
+			mysql_query("ALTER TABLE `".MPREFIX."dblog` CHANGE `dblog_query` `dblog_title` VARCHAR( 255 ) NOT NULL DEFAULT '';");
+			catch_error();
+			mysql_query("ALTER TABLE `".MPREFIX."dblog` CHANGE `dblog_remarks` `dblog_remarks` TEXT NOT NULL;");
+			catch_error();
+		}
+
+		if(!$sql->db_Field("plugin","plugin_path","UNIQUE"))
+		{
+            if(!mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD UNIQUE (`plugin_path`);"))
+			{
+				$mes = "<div style='text-align:center'>".LAN_UPDATE_12." : <a href='".e_ADMIN."db.php?plugin'>".ADLAN_145."</a>.</div>";
+                $ns -> tablerender(LAN_ERROR,$mes);
+            	catch_error();
+			}
+
+		}
+
+		if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp")) 
+		{
+			$row = $sql -> db_Fetch();
+			if (!in_array('tmp_ip', $row)) {
+				mysql_query("ALTER TABLE `".MPREFIX."tmp` ADD INDEX `tmp_ip` (`tmp_ip`);");
+				mysql_query("ALTER TABLE `".MPREFIX."upload` ADD INDEX `upload_active` (`upload_active`);");
+				mysql_query("ALTER TABLE `".MPREFIX."generic` ADD INDEX `gen_type` (`gen_type`);");
+			}
+		}
+
+
+		// update new fields
+        require_once(e_HANDLER."plugin_class.php");
+		$ep = new e107plugin;
+		$ep->update_plugins_table();
+		$ep->save_addon_prefs();
+
+		if(!$sql->db_Field("online",6)) // online_active field
+		{
+			mysql_query("ALTER TABLE ".MPREFIX."online ADD online_active INT(10) UNSIGNED NOT NULL DEFAULT '0'");
+			catch_error();
+		}
+
+		return '';
+
+	}
+	else
+	{
+
+		if($sql->db_Field("plugin",5) == "plugin_rss")
+		{
+			return update_needed();
+		}
+
+		if($sql->db_Field("dblog",5) == "dblog_query")
+		{
+        	return update_needed();
+		}
+
+		if(!$sql->db_Field("plugin",5))
+		{
+			return update_needed();
+		}
+
+		if(!$sql->db_Field("plugin","plugin_path","UNIQUE"))
+		{
+            return update_needed();
+		}
+
+		if(!$sql->db_Field("online",6)) // online_active field
+		{
+			return update_needed();
+		}
+		
+		if ($sql -> db_Query("SHOW INDEX FROM ".MPREFIX."tmp")) 
+		{
+			$row = $sql -> db_Fetch();
+			if (!in_array('tmp_ip', $row)) {
+				return update_needed();
+			}
+		}
+
+		// No updates needed
+	 	return TRUE;
+	}
+}
+
 // ------------------------------- .6 to .7 ----------------------------------
 function update_617_to_700($type='') {
 	global $sql, $ns, $mySQLdefaultdb, $pref, $tp, $sysprefs, $eArrayStorage;
@@ -396,7 +501,6 @@
 				$sql->db_Insert("plugin", "0, 'Links Page', '1.0', 'links_page', 1");
 				$sql->db_Update("links", "link_url = '".$PLUGINS_DIRECTORY."links_page/links.php' WHERE link_url = 'links.php'");
 
-				$pref['plug_latest'] = $pref['plug_latest'].",links_page";
 				$s_prefs = TRUE;
 			}
 		// end links update -------------------------------------------------------------------------------------------
@@ -500,7 +604,7 @@
 					$parms = explode("|", $val);
 					$ext_name['ue_'.$key] = 'user_'.preg_replace("#\W#","",$parms[0]);
 					$new_field['name'] = preg_replace("#\W#","",$parms[0]);
-					$new_field['text'] = $parms[0];
+					$new_field['text'] = str_replace('_',' ',$parms[0]); // Spaces are ok now
 					$new_field['type'] = $new_types[$parms[1]];
 					$new_field['values'] = $parms[2];
 					$new_field['default'] = $parms[3];
@@ -641,8 +745,6 @@
 			if (!$sql->db_Select("plugin", "plugin_path", "plugin_path='chatbox_menu'")) {
 				$sql->db_Insert("plugin", "0, 'Chatbox', '1.0', 'chatbox_menu', 1");
 				catch_error();
-				$pref['plug_status'] = $pref['plug_status'].",chatbox_menu";
-				$s_prefs = TRUE;
 			}
 		// end chatbox update -------------------------------------------------------------------------------------------
 
@@ -688,12 +790,20 @@
 		}
 
 
+
+         // fix for the the moving of the stats.php file in 0.7.
+			if($sql -> db_Select("links", "*", "link_url = 'stats.php'")){
+				$sql -> db_Update("links", "link_url='{"."e_PLUGIN"."}log/stats.php' WHERE link_url='stats.php' ");
+				catch_error();
+			}
+
 		// Missing Forum upgrade stuff by Cam.
+
 			global $PLUGINS_DIRECTORY;
 			if($sql -> db_Select("links", "*", "link_url = 'forum.php'")){
 				$sql -> db_Insert("plugin", "0, 'Forum', '1.1', 'forum', '1' ");
 				catch_error();
-				$sql -> db_Update("links", "link_url='".$PLUGINS_DIRECTORY."forum/forum.php' WHERE link_url='forum.php' ");
+				$sql -> db_Update("links", "link_url='{"."e_PLUGIN"."}forum/forum.php' WHERE link_url='forum.php' ");
 				catch_error();
 			}
 
@@ -910,20 +1020,36 @@
 				$sql -> db_Select("links", "link_id,link_name", "link_name NOT LIKE 'submenu.%' ORDER BY link_name");
 				while($row = $sql-> db_Fetch()){
 					$name = $row['link_name'];
-					$parent[$name] = $row['link_id'];
+					$parent[$name] = $row['link_id']; // Possible top level parents
 				}
-        			if(!is_object($sql2)){
-        				$sql2 = new db;
+				$sql -> db_Select("links", "link_id,link_name", "link_name LIKE 'submenu.%' ORDER BY link_name");
+				while($row = $sql-> db_Fetch()){
+					$tmp = explode(".",$row['link_name']);
+					if (count($tmp) == 3) {
+						$name = $tmp[2]; // submenu.topname.midname
+						$parent[$name] = $row['link_id']; // Possible mid-level parents
+					}
+				}
+        if(!is_object($sql2)){
+        	$sql2 = new db;
 				}
 				$sql -> db_Select("links", "link_id,link_name", "link_name LIKE 'submenu.%' ORDER BY link_name");
 				while($row = $sql-> db_Fetch()){
 					$tmp = explode(".",$row['link_name']);
-            				$nm = $tmp[1];
+					$nm = $tmp[1];
 					$id = $row['link_id'];
-			   		$sql2 -> db_Update("links", "link_parent='".$parent[$nm]."' WHERE link_id ='$id' ");
+					$sql2 -> db_Update("links", "link_parent='".$parent[$nm]."' WHERE link_id ='$id' ");
 					catch_error();
 				}
-        		}
+				$sql -> db_Select("links", "link_id,link_name", "link_name LIKE '%.child.%' ORDER BY link_name");
+				while($row = $sql-> db_Fetch()){
+					$tmp = explode(".",$row['link_name']);
+					$nm = $tmp[2]; // submenu.topname.midname.child.finalname
+					$id = $row['link_id'];
+					$sql2 -> db_Update("links", "link_parent='".$parent[$nm]."' WHERE link_id ='$id' ");
+					catch_error();
+				}
+      }
 
 		//20050626 : update links_page_cat and links_page
 			$field1 = $sql->db_Field("links_page_cat",4);
@@ -1038,9 +1164,11 @@
 			}
 
 
-			if($sql->db_Field("plugin",5) != "plugin_rss"){
-				mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_rss` varchar(255) NOT NULL default ''");
-				catch_error();
+			if (!function_exists("update_70x_to_706")) {
+				if($sql->db_Field("plugin",5) != "plugin_rss"){
+					mysql_query("ALTER TABLE `".MPREFIX."plugin` ADD `plugin_rss` varchar(255) NOT NULL default ''");
+					catch_error();
+				}
 			}
 
 		//20050630: added comment_lock to comments
@@ -1178,7 +1306,7 @@
 			if($sql->db_Select("plugin", "plugin_version", "plugin_path = 'calendar_menu' AND plugin_installflag='1' ")) {
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_class int(10) unsigned NOT NULL default '0';");
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_subs tinyint(3) unsigned NOT NULL default '0';");
-				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_force tinyint(3) unsigned NOT NULL default '0';");
+				// mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_force tinyint(3) unsigned NOT NULL default '0';");
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_ahead tinyint(3) unsigned NOT NULL default '0';");
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_msg1 text;");
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_msg2 text;");
@@ -1187,6 +1315,9 @@
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_today int(10) unsigned NOT NULL default '0';");
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_lastupdate int(10) unsigned NOT NULL default '0';");
 				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_addclass int(10) unsigned NOT NULL default '0';");
+// 2 lines added for V3.6 event calendar
+				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_description text");
+				mysql_query("ALTER TABLE ".MPREFIX."event_cat ADD event_cat_force_class int(10) unsigned NOT NULL default '0';");
 
 				mysql_query("CREATE TABLE ".MPREFIX."event_subs (
 					event_subid int(10) unsigned NOT NULL auto_increment,
@@ -1309,8 +1440,10 @@
 			return update_needed();
 		}
 
-		if($sql->db_Field("plugin",5) != "plugin_rss"){
-		 	return update_needed();
+		if (!function_exists("update_70x_to_706")) {
+			if($sql->db_Field("plugin",5) != "plugin_rss"){
+				return update_needed();
+			}
 		}
 
 		if($sql->db_Field("links",7) != "link_parent"){
@@ -1525,7 +1658,7 @@
 function update_needed()
 {
 	global $ns;
-	if(E107_DEBUG_LEVEL > 0)
+	if(E107_DEBUG_LEVEL)
 	{
 		$tmp = debug_backtrace();
 		$ns->tablerender("", "<div style='text-align:center'>Update required in ".basename(__FILE__)." on line ".$tmp[0]['line']."</div>");
@@ -1541,7 +1674,7 @@
 
 
 function catch_error(){
-	if (mysql_error()!='' && E107_DEBUG_LEVEL > 0) {
+	if (mysql_error()!='' && E107_DEBUG_LEVEL != 0) {
 		$tmp2 = debug_backtrace();
 		$tmp = mysql_error();
 		echo $tmp." [ ".basename(__FILE__)." on line ".$tmp2[0]['line']."] <br />";
@@ -1550,4 +1683,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/userclass2.php 0.7.7/e107_admin/userclass2.php
--- 0.7.5/e107_admin/userclass2.php	2006-02-12 21:04:25.000000000 -0600
+++ 0.7.7/e107_admin/userclass2.php	2006-10-24 08:34:38.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/userclass2.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/02/13 03:04:25 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.21 $
+|     $Date: 2006/10/24 13:34:38 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -165,7 +165,7 @@
 	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
 
-$class_total = $sql->db_Select("userclass_classes");
+$class_total = $sql->db_Select("userclass_classes", "*", "ORDER BY userclass_name", "nowhere");
 
 $text = "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."' id='classForm'>
@@ -216,7 +216,7 @@
 $text .= "
 	<tr>
 	<td class='forumheader3'>".UCSLAN_24."</td>
-	<td class='forumheader3'>".r_userclass("userclass_editclass", $userclass_editclass, "off", "admin,classes,matchclass,public,nobody")."</td>
+	<td class='forumheader3'>".r_userclass("userclass_editclass", $userclass_editclass, "off", "main,admin,classes,matchclass,public,nobody")."</td>
 	</tr>
 	";
 
@@ -288,7 +288,7 @@
 	$text .= "</select><br /><br />
 		<input class='button' type='button' value='".UCSLAN_17."' onclick='removeMe();' />
 		<input class='button' type='button' value='".UCSLAN_18."' onclick='clearMe($userclass_id);' />
-		<input type='hidden' name='class_id' value='$userclass_id'>
+		<input type='hidden' name='class_id' value='$userclass_id' />
 
 		</td></tr></table>
 		</td></tr>
diff -ruN 0.7.5/e107_admin/userinfo.php 0.7.7/e107_admin/userinfo.php
--- 0.7.5/e107_admin/userinfo.php	2005-08-04 04:56:38.000000000 -0500
+++ 0.7.7/e107_admin/userinfo.php	2006-10-28 05:09:17.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/userinfo.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/08/04 09:56:38 $
-|     $Author: streaky $
+|     $Revision: 1.10 $
+|     $Date: 2006/10/28 10:09:17 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -34,6 +34,8 @@
 }
 
 if (isset($ipd)) {
+	if(!defined("BULLET")) define("BULLET", "bullet2.gif");
+
 	$obj = new convert;
 	$sql->db_Select("chatbox", "*", "cb_ip='$ipd' LIMIT 0,20");
 	$host = $e107->get_host_name($ipd);
@@ -52,8 +54,6 @@
 
 	$text .= "<hr />";
 
-	if(!defined("BULLET"))	 define("BULLET", "bullet2.gif");
-
 	$sql->db_Select("comments", "*", "comment_ip='$ipd' LIMIT 0,20");
 	while (list($comment_id, $comment_item_id, $comment_author, $comment_author_email, $comment_datestamp, $comment_comment, $comment_blocked, $comment_ip) = $sql->db_Fetch()) {
 		$datestamp = $obj->convert_date($comment_datestamp, "short");
diff -ruN 0.7.5/e107_admin/users.php 0.7.7/e107_admin/users.php
--- 0.7.5/e107_admin/users.php	2006-05-14 01:04:33.000000000 -0500
+++ 0.7.7/e107_admin/users.php	2006-11-28 12:16:36.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users.php,v $
-|     $Revision: 1.78 $
-|     $Date: 2006/05/14 06:04:33 $
-|     $Author: e107coders $
+|     $Revision: 1.88 $
+|     $Date: 2006/11/28 18:16:36 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -43,6 +43,7 @@
 require_once("auth.php");
 
 require_once(e_HANDLER."form_handler.php");
+require_once(e_HANDLER."userclass_class.php");
 
 $rs = new form;
 
@@ -58,8 +59,12 @@
 $from = (isset($from)) ? $from : 0;
 $amount = 30;
 
+
+// ------- Check for Bounces --------------
 if(isset($_POST['check_bounces'])){
 	$user->check_bounces();
+	require_once("footer.php");
+	exit;
 }
 
 
@@ -119,6 +124,7 @@
 	$pref['profile_comments'] = $_POST['profile_comments'];
 	$pref['track_online'] = $_POST['track_online'];
 	$pref['force_userupdate'] = $_POST['force_userupdate'];
+	$pref['memberlist_access'] = $_POST['memberlist_access'];
 	save_prefs();
 	$user->show_message(USRLAN_1);
 }
@@ -184,13 +190,13 @@
 
 		$username = strip_tags($_POST['name']);
 		$loginname = strip_tags($_POST['loginname']);
-		$ip = $e107->getip();
+
 //		extract($_POST);
 //		for($a = 0; $a <= (count($_POST['userclass'])-1); $a++) {
 //			$svar .= $userclass[$a].".";
 //		}
 		$svar = implode(",", $_POST['userclass']);
-		admin_update($sql -> db_Insert("user", "0, '$username', '$loginname',  '', '".md5($_POST['password1'])."', '$key', '".$_POST['email']."', '".$_POST['signature']."', '".$_POST['image']."', '".$_POST['timezone']."', '1', '".time()."', '".time()."', '".time()."', '0', '0', '0', '0', '".$ip."', '0', '0', '', '', '0', '0', '".$_POST['realname']."', '".$svar."', '', '', '".time()."', ''"), 'insert', USRLAN_70);
+		admin_update($sql -> db_Insert("user", "0, '$username', '$loginname',  '', '".md5($_POST['password1'])."', '$key', '".$_POST['email']."', '".$_POST['signature']."', '".$_POST['image']."', '".$_POST['timezone']."', '1', '".time()."', '".time()."', '".time()."', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '".$_POST['realname']."', '".$svar."', '', '', '".time()."', ''"), 'insert', USRLAN_70);
 	}
 }
 
@@ -311,7 +317,7 @@
 	}
 }
 // ------- Make Admin.. --------------
-if (isset($_POST['useraction']) && $_POST['useraction'] == "admin") {
+if (isset($_POST['useraction']) && $_POST['useraction'] == "admin" && getperms('3')) {
 	$sql->db_Select("user", "*", "user_id='".$_POST['userid']."'");
 	$row = $sql->db_Fetch();
 	 extract($row);
@@ -323,7 +329,7 @@
 }
 
 // ------- Remove Admin --------------
-if (isset($_POST['useraction']) && $_POST['useraction'] == "unadmin") {
+if (isset($_POST['useraction']) && $_POST['useraction'] == "unadmin" && getperms('3')) {
 	$sql->db_Select("user", "*", "user_id='".$_POST['userid']."'");
 	$row = $sql->db_Fetch();
 	 extract($row);
@@ -421,7 +427,7 @@
 	function show_existing_users($action, $sub_action, $id, $from, $amount) {
 		// ##### Display scrolling list of existing news items ---------------------------------------------------------------------------------------------------------
 
-		global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref;
+		global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref,$unverified;
 		// save the display choices.
 		if(isset($_POST['searchdisp'])){
 			$pref['admin_user_disp'] = implode("|",$_POST['searchdisp']);
@@ -437,7 +443,7 @@
 		if ($sql->db_Select("userclass_classes")) {
 			while ($row = $sql->db_Fetch())
 			{
-				$class[$row['userclass_id']] = $tp->toHTML($row['userclass_name'],"","defs");
+				$class[$row['userclass_id']] = $tp->toHTML($row['userclass_name'],"","defs,emotes_off, no_make_clickable");
 			}
 		}
 
@@ -635,10 +641,10 @@
 						$text .= "<option value='ban'>".USRLAN_30."</option>\n";
 					}
 
-					if (!$user_admin && !$user_ban && $user_ban != 2) {
+					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") {
+					else if ($user_admin && $user_perms != "0" && getperms('3')) {
 						$text .= "<option value='unadmin'>".USRLAN_34."</option>\n";
 					}
 
@@ -672,7 +678,8 @@
 
 		}
 
-		$users = $sql->db_Count("user");
+
+		$users = (e_QUERY != "unverified") ? $sql->db_Count("user"): $unverified;
 
 		if ($users > $amount && !$_POST['searchquery']) {
 			$parms = "{$users},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.user_id.desc.")."[FROM]";
@@ -719,7 +726,8 @@
 
 
 // ======================
-		$caption = USRLAN_77 ."&nbsp;&nbsp;   (total: $users)";
+		$total_cap = (isset($_POST['searchquery'])) ? $user_total : $users;
+		$caption = USRLAN_77 ."&nbsp;&nbsp;   (total: $total_cap)";
 		$ns->tablerender($caption, $text);
 
 	}
@@ -757,6 +765,7 @@
 
 	function show_prefs() {
 		global $ns, $pref;
+		$pref['memberlist_access'] = varset($pref['memberlist_access'], e_UC_MEMBER);
 		$text = "<div style='text-align:center'>
 			<form method='post' action='".e_SELF."?".e_QUERY."'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>
@@ -817,6 +826,13 @@
 			</td>
 			</tr>
 
+
+			<tr>
+			<td style='width:50%' class='forumheader3'>".USRLAN_146.":</td>
+			<td style='width:50%' class='forumheader3'>".r_userclass("memberlist_access",$pref['memberlist_access'], "off", "public,member,guest,admin,main,classes,nobody")."
+			</td>
+			</tr>
+
 			<tr>
 			<td colspan='2' style='text-align:center' class='forumheader'>
 			<input class='button' type='submit' name='update_options' value='".USRLAN_51."' />
@@ -987,7 +1003,7 @@
         	$sql3 = new db;
 		}
 
-        $sql3 -> db_Select_gen($query,TRUE);
+        $sql3 -> db_Select_gen($query);
 			while($row = $sql3-> db_Fetch()){
 				  	echo $row['user_id']." ".$row['user_sess']." ".$row['user_name']." ".$row['user_email']."<br />";
                     $this->resend($row['user_id'],$row['user_sess'],$row['user_name'],$row['user_email'],$row['user_language']);
@@ -1002,7 +1018,7 @@
 
 // ---------------------------------------------------------------------
 
-	function check_bounces(){
+    function check_bounces(){
 		global $sql,$pref;
         include(e_HANDLER."pop3_class.php");
 
@@ -1011,39 +1027,50 @@
 		$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[] = intval($result[1]);
+						$id[$i] = intval($result[1]);
 						$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[] = "'".$result[0]."'";
+						$emails[$i] = "'".$result[0]."'";
 						$found = TRUE;
 					}elseif($result[1] && $result[1] != $pref['mail_bounce_email']){
-                    	$emails[] = "'".$result[1]."'";
+                    	$emails[$i] = "'".$result[1]."'";
 						$found = TRUE;
 					}
 
 				}
-					if($DEL && $found){ $obj->deleteMails($i); }
+				 	if($DEL && $found){ $obj->deleteMails($i); }
+
 			}
 
+			$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>";
+
+		array_unique($id);
+		array_unique($emails);
+
         $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");
+        	$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");
-	  	}
+       		$this->show_message(LAN_UPDATED_FAILED."<br >Found $tot, not updated $ed / $found".$text);
+   	  	}
 
 	}
 
@@ -1053,4 +1080,4 @@
 	global $action;
 	$user->show_options($action);
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_admin/users_extended.php 0.7.7/e107_admin/users_extended.php
--- 0.7.5/e107_admin/users_extended.php	2006-04-29 01:53:08.000000000 -0500
+++ 0.7.7/e107_admin/users_extended.php	2006-11-07 17:46:19.000000000 -0600
@@ -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.37 $
-|     $Date: 2006/04/29 06:53:08 $
-|     $Author: e107coders $
+|     $Revision: 1.39 $
+|     $Date: 2006/11/07 23:46:19 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -91,12 +91,20 @@
 
 if (isset($_POST['add_field']))
 {
-	if($_POST['user_type']==4){
+	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']);
-	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);
+	$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;
+		}
+	}
 }
 
 if (isset($_POST['update_field'])) {
@@ -890,7 +898,7 @@
 		$tmp[$f]['parms'] = $tp->toDB($tmp[$f]['parms']);
 		if($ue->user_extended_add($tmp[$f]))
 		{
-			$ret .= "Field: $f has been activated <br />";
+			$ret .= EXTLAN_68." $f ".EXTLAN_69."<br />";
 
 			if($tmp[$f]['type']=="db field" && is_readable(e_ADMIN."sql/extended_".$f.".php")){
              	$ret .= (process_sql($f)) ? LAN_CREATED." user_extended_{$f}<br />" : LAN_CREATED_FAILED." user_extended_{$f}<br />";
@@ -898,7 +906,7 @@
 		}
 		else
 		{
-			$ret .= "ERROR!!  Field: $f was not activated! <br />";
+			$ret .= EXTLAN_70." $f ".EXTLAN_71."<br />";
 		}
 	}
 	return $ret;
@@ -912,14 +920,14 @@
 	{
 		if($ue->user_extended_remove($f, $f))
 		{
-			$ret .= "Field: $f has been deactivated <br />";
+			$ret .= EXTLAN_68." $f ".EXTLAN_72."<br />";
 			if(is_readable(e_ADMIN."sql/extended_".$f.".php")){
              	$ret .= (mysql_query("DROP TABLE ".MPREFIX."user_extended_".$f)) ? LAN_DELETED." user_extended_".$f."<br />" : LAN_DELETED_FAILED." user_extended_".$f."<br />";
 			}
 		}
 		else
 		{
-			$ret .= "ERROR!!  Field: $f was not deactivated! <br />";
+			$ret .= EXTLAN_70." $f ".EXTLAN_73."<br />";
 		}
 	}
 	return $ret;
diff -ruN 0.7.5/e107_admin/ver.php 0.7.7/e107_admin/ver.php
--- 0.7.5/e107_admin/ver.php	2006-05-22 20:12:40.000000000 -0500
+++ 0.7.7/e107_admin/ver.php	2006-11-29 20:17:01.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.12 $
-|     $Date: 2006/05/23 01:12:40 $
+|     $Revision: 1.17 $
+|     $Date: 2006/11/30 02:17:01 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
-$e107info['e107_version'] = "0.7.5";
-	
+$e107info['e107_version'] = "0.7.7";
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_admin/wmessage.php 0.7.7/e107_admin/wmessage.php
--- 0.7.5/e107_admin/wmessage.php	2006-04-29 00:20:57.000000000 -0500
+++ 0.7.7/e107_admin/wmessage.php	2006-11-24 01:08:00.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/wmessage.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2006/04/29 05:20:57 $
-|     $Author: sweetas $
+|     $Revision: 1.28 $
+|     $Date: 2006/11/24 07:08:00 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -22,7 +22,7 @@
 	 exit;
 }
 $e_sub_cat = 'wmessage';
-$e_wysiwyg = "wm_text";
+$e_wysiwyg = "data";
 
 require_once(e_HANDLER."preset_class.php");
 $pst = new e_preset;
@@ -46,14 +46,19 @@
 	unset($tmp);
 }
 
+if($_POST)
+{
+	$e107cache->clear("wmessage");
+}
+
 if (isset($_POST['wm_update'])) {
-	$wm_text = $tp->toDB($_POST['wm_text']);
+	$data = $tp->toDB($_POST['data']);
 	$wm_title = $tp->toDB($_POST['wm_caption']);
-	$message = ($sql->db_Update("generic", "gen_chardata ='$wm_text',gen_ip ='$wm_title', gen_intdata='".$_POST['wm_active']."' WHERE gen_id='".$_POST['wm_id']."' ")) ? LAN_UPDATED : LAN_UPDATED_FAILED;
+	$message = ($sql->db_Update("generic", "gen_chardata ='$data',gen_ip ='$wm_title', gen_intdata='".$_POST['wm_active']."' WHERE gen_id='".$_POST['wm_id']."' ")) ? LAN_UPDATED : LAN_UPDATED_FAILED;
 }
 
 if (isset($_POST['wm_insert'])) {
-	$wmtext = $tp->toDB($_POST['wm_text']);
+	$wmtext = $tp->toDB($_POST['data']);
 	$wmtitle = $tp->toDB($_POST['wm_caption']);
 	$message = ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) ? LAN_CREATED :  LAN_CREATED_FAILED ;
 }
@@ -76,7 +81,7 @@
 
 // Show Existing -------
 if ($action == "main" || $action == "") {
-	if ($wm_total = $sql->db_Select("generic", "gen_id, gen_intdata, gen_chardata", "gen_type='wmessage' ORDER BY gen_id ASC")) {
+	if ($wm_total = $sql->db_Select("generic", "*", "gen_type='wmessage' ORDER BY gen_id ASC")) {
 		$wmList = $sql->db_getList();
 		$text = $rs->form_open("post", e_SELF, "myform_{$gen_id}", "", "");
 		$text .= "<div style='text-align:center'>
@@ -91,7 +96,7 @@
 			$text .= "
 			<tr>
 				<td class='forumheader3' style='width:5%; text-align: center; vertical-align: middle'>".$row['gen_id']."</td>
-				<td style='width:70%' class='forumheader3'>".strip_tags($tp->toHTML($row['gen_chardata']))."</td>
+				<td style='width:70%' class='forumheader3'>".strip_tags($tp->toHTML($row['gen_ip']))."</td>
 				<td style='width:70%' class='forumheader3'>".r_userclass_name($row['gen_intdata'])."</td>
             	<td style='width:15%; text-align:center; white-space: nowrap' class='forumheader3'>
 					<a href='".e_SELF."?create.edit.{$row['gen_id']}'>".ADMIN_EDIT_ICON."</a>
@@ -141,12 +146,11 @@
 	$text .= "<tr>
 		<td style='width:20%' class='forumheader3'>".WMLAN_04."</td>
 		<td style='width:60%' class='forumheader3'>
-		<textarea class='tbox' id='wm_text' name='wm_text' cols='70' rows='15' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this)'>".$tp->toForm($row['gen_chardata'])."</textarea>
+		<textarea class='tbox' id='data' name='data' cols='70' rows='15' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this)'>".$tp->toForm($row['gen_chardata'])."</textarea>
 		<br />";
 
-	if(!e_WYSIWYG){
-		$text .= "<br />".display_help("helpb", 2);
-	}
+		$text .= display_help("helpb", "admin");
+
 
 	$text .= "
 		</td>
diff -ruN 0.7.5/e107_docs/README.html 0.7.7/e107_docs/README.html
--- 0.7.5/e107_docs/README.html	2006-01-16 10:38:00.000000000 -0600
+++ 0.7.7/e107_docs/README.html	2006-10-31 15:16:29.000000000 -0600
@@ -4,9 +4,9 @@
 <!-- Version Info:
 
 $Source: /cvsroot/e107/e107_0.7/e107_docs/README.html,v $
-$Revision: 1.9 $
-$Date: 2006/01/16 16:38:00 $
-$Author: sweetas $
+$Revision: 1.13 $
+$Date: 2006/10/31 21:16:29 $
+$Author: e107coders $
 
 -->
 <title>e107 Readme</title>
@@ -23,15 +23,15 @@
   <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' name='requirements'></a><span class="headertext">Requirements</span>
+  <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>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 relevent folder.</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>
   </ul>
   <br />
-  <a id='installing' name='installing'></a><span class="headertext">Installing</span>
+  <a id='installing'></a><span class="headertext">Installing</span>
   <ul>
     <li>After downloading and unzipping the package, you need to upload the files to your server using an FTP client. e107 will happily run in your webserver root or in a sub-directory ... <br />
       <ul>
@@ -64,13 +64,12 @@
   </ul>
   <ul>
     <li>Now open your web browser and navigate to install.php, for example <i>http://yourwebspace.com/install.php</i> or <i>http://yourwebspace.com/e107/install.php</i><br />
-      </i></li>
     <ul>
       <li>If all the files have been uploaded successfully, you will see the first page of the install script. Choose the language you wish to use during the procedure and click the button to continue</li>
-      <li>e107 will now carry out a series of tests to see if requirements are met and all files that need permissions set are ok to be written to. If you get a warning about MySQL don't worry too much, some versions of MySQL don't return the correct version, or return nothing at all. Click on the button to continue if all criteria has been met, or else repair the prblem and retest. </li>
-      <li>Next you have to enter your MySQL details. Enter your server name (generally 'localhost'), username and password. If you don't know your username and/or password contact your webhosts. Now enter the name of the database ou want e107 to use. If you have the correct permissions you can create the database directly from the install script should you want to</li>
+      <li>e107 will now carry out a series of tests to see if requirements are met and all files that need permissions set are ok to be written to. If you get a warning about MySQL don't worry too much, some versions of MySQL don't return the correct version, or return nothing at all. Click on the button to continue if all criteria have been met, or else repair the problem and retest. </li>
+      <li>Next you have to enter your MySQL details. Enter your server name (generally 'localhost'), username and password. If you don't know your username and/or password contact your webhosts. Now enter the name of the database you want e107 to use. If you have the correct permissions you can create the database directly from the install script should you want to</li>
       <li>If all is well e107 should now connect to your MySQL database, if any error messages are shown return to the previous page and make sure you entered your details correctly</li>
-      Now you have to enter your main admin details. Enter your username, password and email address, you can change your email address and password at a later stage but your username cannot be changed, so make sure you enter it correctly
+      <li>Now you have to enter your main admin details. Enter your username, password and email address, you can change your email address and password at a later stage but your username cannot be changed, so make sure you enter it correctly
       </li>
       <li>e107 will now create the MySQL database tables and populate them with settings etc</li>
       <li>If all is well, the last button will take you to your new website. There, all done, that wasn't too bad was it?!</li>
@@ -79,21 +78,20 @@
   </ul>
   <ul>
     <li>You must now set the file permissions of the main config file back to 0644 ...<br />
-    </li>
     <ul>
       <li>Using your FTP client, select the e107_config.php file</li>
       <li>Set its file permission (using the method explained above) to 0644</li>
     </ul>
     </li>
-    <li><b>Now delete the install.php file, and the e107_install folder from your server, if you do not they could pose a potential security risk to your site</b></li>
+    <li><b>Now delete the install.php file from your server, if you do not it could pose a potential security risk to your site</b></li>
   </ul>
   <br />
   <br />
-  <a id='upgrading' name='upgrading'></a><span class="headertext">Upgrading</span><br />
+  <a id='upgrading'></a><span class="headertext">Upgrading</span><br />
   <br />
   <a href='README_UPGRADE.html'>Please click here for instructions on upgrading your 0.6175 website to 0.7.</a>
   <br /><br /><br />
-  <a id='backup' name='backup'></a><span class="headertext">Using phpMyAdmin to backup your database</span><br />
+  <a id='backup'></a><span class="headertext">Using phpMyAdmin to backup your database</span><br />
   <br />
   <ul>
     <li>First, navigate to your phpMyAdmin page and log in</li>
@@ -109,19 +107,16 @@
     <li>To restore a backup, Click on the 'SQL' tab at the top and browse to your backup, you may need to empty your existing database before you can restore the backup</li>
   </ul>
   <br />
-  <a id='security' name='security'></a><span class="headertext">Security</span><br />
+  <a id='security'></a><span class="headertext">Security</span><br />
   <br />
   Security has been a primary concern since the first released versions of e107, and for this reason there are some very easy measures you can take to make your site more secure ...
   <ul>
-    <li>Rename your e107_admin directory: this will make it less obvious to other e107 users where your admin files are.</li>
-    <br />
-    <br />
-    <li><strong>The procedure to change your directory names has changed. The definitions have been moved to e107_config.php.</strong></li>
-    <br />
-    <br />
-    <li>If you are <b><u>UPGRADING</u></b> from a very old version of e107 (e.g. less than v.615), you will need to open class2.php and find the following lines.</li>
-    <br />
-    <br />
+    <li>Rename your e107_admin directory: this will make it less obvious to other e107 users where your admin files are.<br /><br /></li>
+
+    <li><strong>The procedure to change your directory names has changed. The definitions have been moved to e107_config.php.</strong><br /><br /></li>
+
+    <li>If you are <span style="text-decoration: underline;"><b>UPGRADING</b></span> from a very old version of e107 (e.g. less than v.615), you will need to open class2.php and find the following lines.<br /><br />
+
     <div class='indent'> // If you need to change the names of any of your directories, change the value here then rename the respective folder on your server ...<br />
       $ADMIN_DIRECTORY = "e107_admin/";<br />
       $FILES_DIRECTORY = "e107_files/";<br />
@@ -131,14 +126,12 @@
       $HANDLERS_DIRECTORY = "e107_handlers/";<br />
       $LANGUAGES_DIRECTORY = "e107_languages/";<br />
       $HELP_DIRECTORY = "e107_docs/help/";<br />
-      $DOWNLOADS_DIRECTORY = "e107_files/downloads/";</div>
-    <br />
-    <li>Cut these lines from <u>class2.php</u> and paste them into <u>e107_config.php</u>. Now you can change the folder names from here.</li>
-    <br />
-    <br />
-    <li>If this is a <b><u>NEW INSTALL</u></b> 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.</li>
-    <br />
-    <br />
+      $DOWNLOADS_DIRECTORY = "e107_files/downloads/";</div><br />
+    </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>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 />
       <i>$ADMIN_DIRECTORY = "e107_admin/";</i><br />
@@ -147,33 +140,33 @@
     <li>There are some security settings that you can change from your admin area. Go to the preferences page and you'll see a section marked Security</li>
   </ul>
   <br />
-  <a id='problems' name='problems'></a><span class="headertext">Common Problems</span><br />
+  <a id='problems'></a><span class="headertext">Common Problems</span><br />
   <br />
   <ul>
-    <li>If for any reason you get a critical error message concering your core settings, you can easily reset them to default using the resetcore utility. You can find this in your e107_files folder, use your web browser to navigate to http://yoursite.com/e107_files/resetcore/resetcore.php and follow the instructions. This will not affect any content on your site, it will merely reset your core settings, so your site theme etc will revert to default. You can make a backup of your core at any time and restore this from the resetcore utility, to backup your core go to your admin section, click on Database ten click on Backup Core</li>
+    <li>If for any reason you get a critical error message concerning your core settings, you can easily reset them to default using the resetcore utility. You can find this in your e107_files folder, use your web browser to navigate to http://yoursite.com/e107_files/resetcore/resetcore.php and follow the instructions. This will not affect any content on your site; it will merely reset your core settings, so your site theme etc will revert to default. You can make a backup of your core at any time and restore this from the resetcore utility, to backup your core go to your admin section, click on Database ten click on Backup Core</li>
     <li>If after installing e107 you get a blank page, check your error_reporting level in your php.ini file. This is generally caused by an error on your site not being reported because your error reporting is set too low, or turned off completely. If you don't have access to your php.ini contact your web host</li>
     <li>If you are seeing Undefined Variable or Notice errors on your site, your error_reporting is set too high. Make sure it's set to E_ERROR | E_WARNING | E_PARSE in your php.ini, again if you don't have access contact your web hosts and ask them to change it</li>
   </ul>
   <br />
-  <a id='support' name='support'></a><span class="headertext">Support</span><br />
+  <a id='support'></a><span class="headertext">Support</span><br />
   <br />
-  All these places are very friendly, please dont hesitate to use them even if you think your question is trivial, you'll get a polite reply.
+  All these places are very friendly, please don't hesitate to use them even if you think your question is trivial, you'll get a polite reply.
   <ul>
-    <li><b>e107 forums</b></br >
+    <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 >
+    <li><b>e107 faq</b><br />
       <a href='http://e107faq.bkwon.net'>http://e107faq.bkwon.net</a></li>
     <li><b>IRC channel</b><br />
-      #e107 on <a href='irc://freenode.net'>irc.freenode.net</a></li>
-    <br />
+      #e107 on <a href='irc://freenode.net'>irc.freenode.net</a><br /></li>
+
     <li><b>Third party plugin support: e107coders</b><br />
-      <a href='http://e107coders.org'>http://e107coders.org/</a></li>
-    <br />
-    <li><b>Third party theme support: e107styles | e107themes</b><br />
-      <a href='http://e107styles.org'>http://e107styles.org/</a> | <a href='http://e107themes.org'>http://e107themes.org/</a></li>
+      <a href='http://e107coders.org'>http://e107coders.org/</a><br /></li>
+
+    <li><b>Third party theme support: e107themes</b><br />
+      <a href='http://e107themes.org'>http://e107themes.org/</a></li>
   </ul>
   <p><br />
-    <a id='development' name='development'></a><span class="headertext">Development</span><br />
+    <a id='development'></a><span class="headertext">Development</span><br />
     <br />
     e107 has been tested, and developed on Apache 1 and 2, IIS, and PHP 4.3+ (Including 5.0).<br />
     It is developed by the e107 dev team (Jalist, McFly, Cameron, Streaky, SweetAs, Asperon, Que, Lolo, Chavo, Lisa, MrPete).<br />
@@ -181,7 +174,7 @@
     If you have made changes to the core you think might benefit others please let us know about them in the forums at e107.org :)<br />
     <br />
     <br />
-    <a id='thankyou' name='thankyou'></a><span class="headertext">Thank you</span><br />
+    <a id='thankyou'></a><span class="headertext">Thank you</span><br />
     <br />
     Thanks first to jalist for starting this whole thing out and sticking with it for so long. </p>
   <ul>
@@ -192,11 +185,11 @@
     <li>e107.net for donated hosting</li>
     <li>Thanks to all of you who have taken the time to create plugins/themes/hacks, answer questions in the forums and IRC channel etc. We have a wonderful community here and it's because of people like you.</li>
     <li>And thanks to you for trying e107, I hope you like it and it fits your website needs. If it doesn't try <a href='http://opensourcecms.com'>OpenSourceCMS</a> for a full list of alternative systems.</li>
-    <li>A couple of third-party scripts have been integrated into e107 to make your life easier, so thankyou to ...<br />
+    <li>A couple of third-party scripts have been integrated into e107 to make your life easier, so thank you to ...<br />
       <ul>
     <li>MagpieRSS (<a href='http://magpierss.sourceforge.net'>http://magpierss.sourceforge.net</a>) MagpieRSS provides an XML-based (expat) RSS parser in PHP.</li>
 	<li>PCLZip (<a href='http://www.phpconcept.net/pclzip/'>http://www.phpconcept.net/pclzip/</a>) PclZip library offers compression and extraction functions for Zip formatted archives (WinZip, PKZIP).</li>
-	<li>PCLTar (<a href='http://www.phpconcept.net/pcltar/'>http://www.phpconcept.net/pcltar/</a>) PclTar offer the ability to archive a list of files or directories with or without compression. The archives created by PclTar are readeable by most of gzip/tar applications and by the Windows WinZip application.</li>
+	<li>PCLTar (<a href='http://www.phpconcept.net/pcltar/'>http://www.phpconcept.net/pcltar/</a>) PclTar offer the ability to archive a list of files or directories with or without compression. The archives created by PclTar are readable by most of gzip/tar applications and by the Windows WinZip application.</li>
 	<li>TinyMCE (<a href='http://tinymce.moxiecode.com'>http://tinymce.moxiecode.com</a>) TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</li>
 	<li>Nuvolo Icons (<a href='http://www.icon-king.com'>http://www.icon-king.com</a>) Icons used in e107</li>
 	<li>PHPMailer (<a href='http://phpmailer.sourceforge.net'>http://phpmailer.sourceforge.net</a>) Full featured email transfer class for PHP</li>
@@ -208,10 +201,10 @@
       <br />
       Both these scripts are released under the GPL license and as stated the copyright information has been left intact in the scripts themselves, if you want to use these scripts in your own code you must abide by the GPL license.</li>
   </ul>
-  </br >
-  <a id='disclaimer' name='disclaimer'></a><span class="headertext">Disclaimer</span><br />
   <br />
-  This software is free and as such comes without warranty as stated in the GNU GPL License  (included in this package). Any problems encountered due to deficiancies in this software is not the responsibility of the author. </br >
+  <a id='disclaimer'></a><span class="headertext">Disclaimer</span><br />
+  <br />
+  This software is free and as such comes without warranty as stated in the GNU GPL License (included in this package). Any problems encountered due to deficiencies in this software are not the responsibility of the author. <br />
 </div>
 </body>
 </html>
diff -ruN 0.7.5/e107_docs/README_UPGRADE.html 0.7.7/e107_docs/README_UPGRADE.html
--- 0.7.5/e107_docs/README_UPGRADE.html	2006-01-16 10:38:32.000000000 -0600
+++ 0.7.7/e107_docs/README_UPGRADE.html	2006-10-31 15:16:29.000000000 -0600
@@ -4,9 +4,9 @@
 <!-- Version Info:
 
 $Source: /cvsroot/e107/e107_0.7/e107_docs/README_UPGRADE.html,v $
-$Revision: 1.2 $
-$Date: 2006/01/16 16:38:32 $
-$Author: sweetas $
+$Revision: 1.5 $
+$Date: 2006/10/31 21:16:29 $
+$Author: e107coders $
 
 -->
 <title>e107 Readme</title>
@@ -20,7 +20,7 @@
   <span class="smalltext">© Steve Dunstan 2002. See gpl.txt for license details.</span><br />
   <br />
   <br />
-  <a id='upgrading' name='upgrading'></a><span class="headertext">Upgrading</span><br />
+  <a id='upgrading'></a><span class="headertext">Upgrading</span><br />
   <br />
 0.6175 -> .7 Upgrade Guide
 <pre>
@@ -29,10 +29,10 @@
 
 Essential Points
 
-    * If you are upgrading an English site from .617 you will need the seperate English iso-8859-1 language pack, as the
+    * If you are upgrading an English site from .617 you will need the separate English iso-8859-1 language pack, as the
       default core English language pack is now in the UTF character set. If you do not do this some characters in your
       database content will display corrupted.
-    * If your .617 site is non English you will need to make sure the .7 lan pack in your language is both available and in the same 
+    * If your .617 site is non English you will need to make sure the .7 lan pack in your language is both available and in the same
       character set as your current .617 language pack. If it is not in the same character set as your original,
       some characters in your content, if not all, will display corrupted.
     * The plugins you currently use on your .617 site may not work with .7 so you must check this before upgrading your site.
@@ -44,7 +44,7 @@
 
 
 Warning!
-There are files related to htmlArea, the WYSIWYG system in the 0.6xx branch of e107 that are known to be exploitable. These must be 
+There are files related to htmlArea, the WYSIWYG system in the 0.6xx branch of e107 that are known to be exploitable. These must be
 removed immediately. Please delete the following directories and all their contents from your server:
 e107_handlers/htmlarea/
 e107_admin/htmlarea/
@@ -58,10 +58,10 @@
       any errors do not continue with the upgrade process as these must be fixed first.
    4. Go back to your admin area frontpage.
    5. Extract the contents of the core zip and upload the files to your server - overwriting the existing .617 files.
-   6. Extract the contents of the language pack (in this release its just one file - English.php) and upload the file(s) to 
+   6. Extract the contents of the language pack (in this release its just one file - English.php) and upload the file(s) to
       your server - overwriting the existing one(s).
    7. Refresh your admin front page in your browser and you will see an update available button appear.
-      Click this to take to you to the update page (Alternatively you can reach the update page through Admin =>Database => 
+      Click this to take to you to the update page (Alternatively you can reach the update page through Admin =>Database =>
       Check For Updates).
    8. Click the .617 to .7 core update button. This will run the first step in the upgrade process.
       When it finishes you will see several new buttons appear for the upgrade routines for forum, content
@@ -72,14 +72,14 @@
 
 
 
-You may notice some e107 elements have gone missing - forum, chatbox, content, links, etc... well dont worry
+You may notice some e107 elements have gone missing - forum, chatbox, content, links, etc... well don't worry
 they haven't really! A large part of the e107 core has been 'pluginfied' and you will find all these elements are
 now stand alone plugins and can be located under Admin => Plugins. A point to note with links is that your existing
-links page links have been seperated from the main 'site links' and the upgrade routine has moved them to the new
+links page links have been separated from the main 'site links' and the upgrade routine has moved them to the new
 links page plugin.
 
 Reviews, articles and content have also been pluginfied and incorporated into one plugin called 'Content Management'.
-If you used any of these features in 0.6xx or will be wanting to use this new plugin for new content, you will need to
+If you used any of these features in 0.6xx or want to use this new plugin for new content, you will need to
 change some additional directory permissions for the new plugin. Please see the relevant entry regards this under
 'Permissions'.
 
@@ -87,7 +87,7 @@
 make administration more user friendly, implementing several new features for this job. If you would like to try it
 out, go to Admin => Theme Manager and change the admin area theme to 'Jayya'.
 
-Because of the huge number of changes in .7 and on the basis its an almost total rewrite, there may be some
+Because of the huge number of changes in .7 and on the basis it's an almost total rewrite, there may be some
 problems when you upgrade. If you find a specific bug please post this in the bugtracker here on e107.org so that
 we may fix the issue in the next release of the system. Thanks.
 
@@ -133,18 +133,18 @@
 the php files in e107_files/cache/.
 
 CVS Users
-If you have upgraded your 0.6xx install to 0.7 using a CVS nightly build or downloading directly from the CVS 
-repository, you need to check what character set you are currently using. You will find this information displayed 
-on your admin area front page under the 'Site Info' menu where it says 'Charset'. If under Charset it says you are 
-using 'utf-8' then you need only download the main core zip and upgrade with that. Your charset is the default that 
-0.7 runs with and so is included in the main zip. However, if the Charset says iso-8859-1 and you run an English site 
-then you must download the seperate English iso-8858-1 language pack alongside the main core zip and overwrite the 
-language files in the core zip with those you find in the iso-8858-1 zip. For non English sites make sure to get your 
+If you have upgraded your 0.6xx install to 0.7 using a CVS nightly build or downloading directly from the CVS
+repository, you need to check what character set you are currently using. You will find this information displayed
+on your admin area front page under the 'Site Info' menu where it says 'Charset'. If under Charset it says you are
+using 'utf-8' then you need only download the main core zip and upgrade with that. Your charset is the default that
+0.7 runs with and so is included in the main zip. However, if the Charset says iso-8859-1 and you run an English site
+then you must download the separate English iso-8858-1 language pack alongside the main core zip and overwrite the
+language files in the core zip with those you find in the iso-8858-1 zip. For non English sites make sure to get your
 language in the same Charset as is listed on the admin area frontpage under Site Info.
 </pre>
-  <a id='disclaimer' name='disclaimer'></a><span class="headertext">Disclaimer</span><br />
+  <a id='disclaimer'></a><span class="headertext">Disclaimer</span><br />
   <br />
-  This software is free and as such comes without warranty as stated in the GNU GPL License  (included in this package). Any problems encountered due to deficiancies in this software is not the responsibility of the author. </br >
+  This software is free and as such comes without warranty as stated in the GNU GPL License (included in this package). Any problems encountered due to deficiencies in this software are not the responsibility of the author. <br />
 </div>
 </body>
 </html>
diff -ruN 0.7.5/e107_docs/help/English/Administrators 0.7.7/e107_docs/help/English/Administrators
--- 0.7.5/e107_docs/help/English/Administrators	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Administrators	2006-08-26 21:24:44.000000000 -0500
@@ -1,6 +1,6 @@
 
 Q>	What are permissions?
-A>	These allow you to give administrators different access levels to the admin section. For example you might only want to let a certain admin post news items, using permissions you can do this. There are some admin functions that are only accessable to the main site admin, this is for security reasons.
+A>	These allow you to give administrators different access levels to the admin section. For example you might only want to let a certain admin post news items; using permissions you can do this. There are some admin functions that are only accessible to the main site admin, this is for security reasons.
 
 Q>	I want to make an existing registered member into an administrator - how?
 A>	Click on Users in your admin section and search for the registered member, then click on Make Admin. You should then go immediately to the Administrators section and set his permissions. You can also remove admin status from someone in this way.
diff -ruN 0.7.5/e107_docs/help/English/BBCode 0.7.7/e107_docs/help/English/BBCode
--- 0.7.5/e107_docs/help/English/BBCode	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/BBCode	2006-08-26 21:24:44.000000000 -0500
@@ -9,4 +9,4 @@
 A>	There is a bug in Internet Explorer that can cause it to crash if e107 tries to enter the code at the cursor position, so in the interests of compatibility the code is entered at the end of your text.
 
 Q>	What BBCodes can I use?
-A>	Hover your mouse pointer above any of the bbcode boxes, you'll see a small explanation appear just above the buttons. There are also codes for links &#91;url] &#91;/url] and email &#91;email] &#91;/email], although again using normal HTML tags is ok. All web addresses and email addresses entered are automatically made into clickable hyperlinks.
+A>	Hover your mouse pointer above any of the bbcode boxes; you'll see a small explanation appear just above the buttons. There are also codes for links &#91;url] &#91;/url] and email &#91;email] &#91;/email], although again using normal HTML tags is ok. All web addresses and email addresses entered are automatically made into clickable hyperlinks.
diff -ruN 0.7.5/e107_docs/help/English/Banlist 0.7.7/e107_docs/help/English/Banlist
--- 0.7.5/e107_docs/help/English/Banlist	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Banlist	2006-08-26 21:24:44.000000000 -0500
@@ -3,4 +3,4 @@
 A>	This page allows you to ban visitors to your site, either by their IP address and/or email address.
 
 Q>	Why do I have to give a reason?
-A>	You dont, that textbox is there so that other administrators can see the reason for the ban, or they might remove it by mistake.
+A>	You don't, that textbox is there so that other administrators can see the reason for the ban, or they might remove it by mistake.
diff -ruN 0.7.5/e107_docs/help/English/Banners 0.7.7/e107_docs/help/English/Banners
--- 0.7.5/e107_docs/help/English/Banners	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Banners	2006-08-26 21:24:44.000000000 -0500
@@ -9,10 +9,10 @@
 A>	You can define a login and password for your banner clients, they can then use these to access information about how their banners are performing by going to http://yoursite.com/banner.php and entering the name and pass.
 
 Q>	How can I have a 'tower' type banner in a menu item?
-A>	First you need to define the campaign for the tower type banners (this will keep them seperate from bar type banners) ...
+A>	First you need to define the campaign for the tower type banners (this will keep them separate from bar type banners) ...
 	1. Go to your admin area and click on banners.
 	2. Enter your tower-type banner(s), make sure you use a new campaign name, for example 'towers'.
 	3. Now go to your Menus area, and activate the Banner_menu into one of your menu areas.
 	4. Click on the 'Configure' link in the menu item.
-	5. Enter the caption title (by default it's 'Advertisment'), and enter the campaign name you defined before.
+	5. Enter the caption title (by default it's 'Advertisement'), and enter the campaign name you defined before.
 	6. Leave your admin area and you'll see your tower-type banner(s) in the area you assigned them to.
\ No newline at end of file
diff -ruN 0.7.5/e107_docs/help/English/Cache 0.7.7/e107_docs/help/English/Cache
--- 0.7.5/e107_docs/help/English/Cache	2005-11-24 10:26:27.000000000 -0600
+++ 0.7.7/e107_docs/help/English/Cache	2006-09-28 19:48:11.000000000 -0500
@@ -1,9 +1,9 @@
 
-Q>	Whats this section for?
+Q>	What's this section for?
 A>	Setting Cache Status to on will save certain areas of your site in your database. This reduces calls to MySQL, and vastly speeds up your site.
 
 Q>	I made some alterations to the theme I'm using but it hasn't changed - is it because it's cached.
-A>	Most probably. When you change themes the cache is cleared but altering code in your theme.php wont clear the cache. Set Cache Status to off until you're finished.
+A>	Most probably. When you change themes the cache is cleared but altering code in your theme.php won't clear the cache. Set Cache Status to off until you're finished.
 
-Q>	Can I save the cache to files on the hardrive?
+Q>	Can I save the cache to files on the hard drive?
 A>	Yes. Just make sure that your e107_files/cache directory is writable (chmod 777). And then click the option on the cache page.
diff -ruN 0.7.5/e107_docs/help/English/Chatbox 0.7.7/e107_docs/help/English/Chatbox
--- 0.7.5/e107_docs/help/English/Chatbox	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Chatbox	2006-09-28 19:48:11.000000000 -0500
@@ -2,8 +2,8 @@
 Q>	What is the Replace Links section for?
 A>	You can convert any links entered in your chatbox to other text, or an image. This keeps your chatbox from overflowing with long website addresses. To use an image, tick Replace Links, and in the box below enter &lt;img src='path_to_your_image' alt='' />, now any links entered will be converted to the image you entered.
 
-Q>	Whats Wordwrap for?
-A>	If someone entered a very long word in your chatbox it could disrupt the layout of your site. If you were to enter 40 in the Wordrap box, any works longer than 40 characters would be wrapped so the column wouldn't be extended. You may have to change this value corrosponding to the theme you are using, and the width of the column your chatbox is in.
+Q>	What's Wordwrap for?
+A>	If someone entered a very long word in your chatbox it could disrupt the layout of your site. If you were to enter 40 in the Wordwrap box, any works longer than 40 characters would be wrapped so the column wouldn't be extended. You may have to change this value corresponding to the theme you are using, and the width of the column your chatbox is in.
 
 Q>	My site is for all ages yet someone keeps swearing in the chatbox - how can I stop this?
 A>	Go to the Preferences screen in your admin section, and find the Protection of minors options. You can add a list of words here that will be replaced by a word or sentence of your choice, for example CENSORED! Now anytime that work is encountered on your site it will be replaced with the text you entered.
diff -ruN 0.7.5/e107_docs/help/English/Classes 0.7.7/e107_docs/help/English/Classes
--- 0.7.5/e107_docs/help/English/Classes	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Classes	2006-08-26 21:24:44.000000000 -0500
@@ -1,5 +1,5 @@
 
 Q>	What are these user-classes I keep seeing? What are they for?
-A>	User classes restrict access to certain areas or functions of your site. If you define a class, then add certain users to it, you can choose to make things visible to only the users in that class.
-For example, there is a class already created by default when you install e107 called PRIVATEFORUM. Adding users to this class then creating a forum under that class will make only the uers in that class able to access that forum. You can restrict other areas and functions by class, like news items, links, downloads etc.
+A>	User classes restrict access to certain areas or functions of your site. If you define a class and then add certain users to it, you can choose to make things visible to only the users in that class.
+For example, there is a class already created by default when you install e107 called PRIVATEFORUM. Adding users to this class then creating a forum under that class will make only the users in that class able to access that forum. You can restrict other areas and functions by class, like news items, links, downloads, etc.
 
diff -ruN 0.7.5/e107_docs/help/English/Downloads 0.7.7/e107_docs/help/English/Downloads
--- 0.7.5/e107_docs/help/English/Downloads	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Downloads	2006-08-26 21:24:44.000000000 -0500
@@ -3,4 +3,4 @@
 A>	This allows you to group your downloads into different categories.
 
 Q>	I want to add a download but the file doesn't appear in the list - why?
-A>	Only files in the e107_files/downloads folder appear in the dropdown list. Copy the file into this folder and it will appear. The same applies to images, they must be in the e107_files/downloadimages folder.
+A>	Only files in the e107_files/downloads folder appear in the dropdown list. Copy the file into this folder and it will appear. The same applies to images; they must be in the e107_files/downloadimages folder.
diff -ruN 0.7.5/e107_docs/help/English/Forums 0.7.7/e107_docs/help/English/Forums
--- 0.7.5/e107_docs/help/English/Forums	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Forums	2006-09-20 09:04:31.000000000 -0500
@@ -1,15 +1,15 @@
 
 Q>	What are forum parents?
-A>	A parent is a heading to group other foums under, this makes it easier to navigate your forums.
+A>	A parent is a heading to group other forums under, this makes it easier to navigate your forums.
 
-Q>	I want to make a certain administator a forum moderator but his name isn't in the list - why?
-A>	Administrators will only be listed if they have the correct permission set to be a forum moderator, Go to the Administrators section and edit the admin in quetion, and make sure 'Moderate forums' is ticked.
+Q>	I want to make a certain administrator a forum moderator but his name isn't in the list - why?
+A>	Administrators will only be listed if they have the correct permission set to be a forum moderator. Go to the Administrators section and edit the admin in question, and make sure 'Moderate forums' is ticked.
 
 Q>	What's tracking?
-A>	If you have this enabled, it allows users to track a forum thread, they will receive an email when someone replies to the thread.
+A>	If you have this enabled, it allows users to track a forum thread; they will receive an email when someone replies to the thread.
 
 Q>	What's pruning?
-A>	This allows you to remove old threads that havent received a reply in a certain time. Please be careful with this function, once threads are deleted they cannot be retrieved.
+A>	This allows you to remove old threads that haven't received a reply in a certain time. Please be careful with this function, once threads are deleted they cannot be retrieved.
 
 Q>	What are reported posts?
 A>	Users can report posts that they find to contain objectionable material. You can open the reported thread and moderate as you wish.
diff -ruN 0.7.5/e107_docs/help/English/Front_Page 0.7.7/e107_docs/help/English/Front_Page
--- 0.7.5/e107_docs/help/English/Front_Page	2005-08-31 04:14:04.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Front_Page	2006-08-26 21:24:44.000000000 -0500
@@ -1,6 +1,6 @@
 
-Q>	Whats this section for?
+Q>	What's this section for?
 A>	This screen allows you to set what appears on the front page of your site, by default it's set to news.
 
 Q>	What other pages can I display?
-A>	Any. You can either tick the preset ones (forum, downloads etc) or enter the address to the page you want to use.
+A>	Any. You can either tick the preset ones (forum, downloads, etc.) or enter the address to the page you want to use.
diff -ruN 0.7.5/e107_docs/help/English/Help! 0.7.7/e107_docs/help/English/Help!
--- 0.7.5/e107_docs/help/English/Help!	2005-11-24 10:26:27.000000000 -0600
+++ 0.7.7/e107_docs/help/English/Help!	2006-10-31 15:16:29.000000000 -0600
@@ -2,8 +2,8 @@
 Q>	I made some changes to my site and now I'm getting MySQL errors and my site doesn't appear.
 A>	It could be that your core has become corrupt. The core is the core settings and variables of e107. To reset your core, go to http://yoursite.com/e107_files/resetcore/resetcore.php. Always back up your core (from the Database screen) before you apply changes, you can then restore the core backup if something goes wrong (again from resetcore.php).
 
-Q>	I forgot my main admin password and now I cant access my admin area.
-A>	For very good security reasons it's impossible to reset your password unless you're logged in. If you haven't written your password down in a safe place please do so now, then this scenario will never happen. If it does, you will have to reset your password manually using PHPMyAdmin or another similar MySQL manager. Go to the users table, the main admin should be user numver 1. Click on the edit button and change the password to 4cb9c8a8048fd02294477fcb1a41191a, this will change your password to changeme. Now log in and [b]update your password immediately[/b].
+Q>	I forgot my main admin password and now I can't access my admin area.
+A>	For very good security reasons it's impossible to reset your password unless you're logged in. If you haven't written your password down in a safe place please do so now, then this scenario will never happen. If it does, you will have to reset your password manually using phpMyAdmin or another similar MySQL manager. Go to the users table, the main admin should be user number 1. Click on the edit button and change the password to 4cb9c8a8048fd02294477fcb1a41191a, this will change your password to changeme. Now log in and [b]update your password immediately[/b].
 
-Q>	I installed a theme/plugin etc and now my site is unreachable, what can I do?
+Q>	I installed a theme/plugin etc. and now my site is unreachable, what can I do?
 A>	Use resetcore.php (see above).
diff -ruN 0.7.5/e107_docs/help/English/Maintainance 0.7.7/e107_docs/help/English/Maintainance
--- 0.7.5/e107_docs/help/English/Maintainance	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Maintainance	2006-09-28 19:48:11.000000000 -0500
@@ -1,6 +1,6 @@
 
-Q>	Whats this section for?
-A>	This screen allows you to make your site inaccessable to visitors, use it when you are upgrading your site or need to take it down for any reason. Only the main site administrator can access the site when in maintainance mode, you'll know this as a message is displayed on every page.
+Q>	What's this section for?
+A>	This screen allows you to make your site inaccessible to visitors, use it when you are upgrading your site or need to take it down for any reason. Only the main site administrator can access the site when in maintenance mode, you'll know this as a message is displayed on every page.
 
-Q>	Help! I set the Maintainance Flag and accidently logged out, how do I get back in to my admin section to put the site back up?
-A>	Go to http://yoursite.com/e107_admin.php/admin.php and log in from there.
+Q>	Help! I set the Maintenance Flag and accidentally logged out, how do I get back in to my admin section to put the site back up?
+A>	Go to http://yoursite.com/e107_admin/admin.php and log in from there.
diff -ruN 0.7.5/e107_docs/help/English/Menus 0.7.7/e107_docs/help/English/Menus
--- 0.7.5/e107_docs/help/English/Menus	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Menus	2006-08-26 21:24:44.000000000 -0500
@@ -3,7 +3,7 @@
 A>	They are items that appear in the menu areas (or columns) of your site. These can contain text, links, anything.
 
 Q>	How do I activate a menu item?
-A>	Go to your admin area and click on Menus. You'll see the main layout of your site with a list of the menus in their respective areas. The menu items in the center of the page are inactive, you can move them into an active area by clicking on Activate this menu. You can also move the area the menu is in or move it up and down the column once it's activated.
+A>	Go to your admin area and click on Menus. You'll see the main layout of your site with a list of the menus in their respective areas. The menu items in the center of the page are inactive; you can move them into an active area by clicking on Activate this menu. You can also move the area the menu is in or move it up and down the column once it's activated.
 
 Q>	I need to put some text inside a menu item, how can I do this?
 A>	Go to the admin area and click on Custom Menus. From here you can enter any text you like to a menu and it will be saved and available like any other menu.
diff -ruN 0.7.5/e107_docs/help/English/News 0.7.7/e107_docs/help/English/News
--- 0.7.5/e107_docs/help/English/News	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/News	2006-08-26 21:24:44.000000000 -0500
@@ -6,7 +6,7 @@
 A>	You may have noticed the way news items are reported on some sites, they have a small intro with a link to the whole article, you can do this by entering the intro in the Body text box and the rest of the article in the Extended box.
 
 Q>	What are the activation boxes for? 
-A>	You can set up a news item to only appear between cerain dates by using the activation boxes. If you leave them blank the news you post will appear immediately.
+A>	You can set up a news item to only appear between certain dates by using the activation boxes. If you leave them blank the news you post will appear immediately.
 
 Q>	I entered a news item and it says 'News saved in database' - does that mean it will show on my news page?
-A>	It means the text you entered has been saved. If the news item you entered is set to active, then yes it will apaear on your news page.
+A>	It means the text you entered has been saved. If the news item you entered is set to active, then yes it will appear on your news page.
diff -ruN 0.7.5/e107_docs/help/English/Preferences 0.7.7/e107_docs/help/English/Preferences
--- 0.7.5/e107_docs/help/English/Preferences	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Preferences	2006-08-26 21:24:44.000000000 -0500
@@ -3,9 +3,9 @@
 A>	There is a section in your Preferences page that allows you to change your site theme. Please preview the theme first as some older themes are no longer compatible and could render your site unusable if applied.
 
 Q>	What's COPPA?
-A>	The Children's Online Privacy Protection Act of 1998. It's a univarsally used rule that protects minors aged 13 and under. It ensures that no information on minors will be used by the 'Operator' (ie, you) for purposes other than maintaining the website. For more information please see http://www.cdt.org/legislation/105th/privacy/coppa.html.
+A>	The Children's Online Privacy Protection Act of 1998. It's a universally used rule that protects minors aged 13 and under. It ensures that no information on minors will be used by the 'Operator' (i.e., you) for purposes other than maintaining the website. For more information please see http://www.cdt.org/legislation/105th/privacy/coppa.html.
 
-Q>	What's flood protextion?
+Q>	What's flood protection?
 A>	It prevents your site being flooded by HTTP calls, which can render your site unreachable.
 
 Q>	Should I use Cookies or Sessions for tracking my users?
diff -ruN 0.7.5/e107_docs/help/English/Uploads 0.7.7/e107_docs/help/English/Uploads
--- 0.7.5/e107_docs/help/English/Uploads	2005-11-24 10:26:27.000000000 -0600
+++ 0.7.7/e107_docs/help/English/Uploads	2006-08-26 21:24:44.000000000 -0500
@@ -1,6 +1,6 @@
 
-Q>	I'd like to let people upload files to my site but I'm worried about security ...
-A>	There are a couple of things to do to improve security. First, use Binary storage, the uploaded files will then be stored in the MySQL database and wont be accessable to anyone apart from to download. Also, set the list of allowed file types, if anyone tries to upload a filetype other than the types you have defined it will be deleted immediately from your server.
+Q>	I'd like to let people upload files to my site but I'm worried about security...
+A>	There are a couple of things to do to improve security. First, use Binary storage, the uploaded files will then be stored in the MySQL database and won't be accessible to anyone apart from to download. Also, set the list of allowed file types, if anyone tries to upload a filetype other than the types you have defined it will be deleted immediately from your server.
 
 Q>	I've had some files uploaded, what do I do now?
 A>	You have the option to copy the file to your Download Manager, to allow others to download it, and to copy the upload information to your newspost section, to make a news item announcement about it.
diff -ruN 0.7.5/e107_docs/help/English/Users 0.7.7/e107_docs/help/English/Users
--- 0.7.5/e107_docs/help/English/Users	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Users	2006-08-26 21:24:44.000000000 -0500
@@ -1,3 +1,3 @@
 
 Q>	What's the Extended Field section for?
-A>	This allows you to add more sections to the Users page. For example, if you were running a clan, you could add a field for clan nickname, or average number of frags :) The new field will appear in the User Settings page, and also the Members list.
+A>	This allows you to add more sections to the Users page. For example, if you were running a clan, you could add a field for clan nickname, or average number of flags :) The new field will appear in the User Settings page, and also the Members list.
diff -ruN 0.7.5/e107_docs/help/English/Welcome_Message 0.7.7/e107_docs/help/English/Welcome_Message
--- 0.7.5/e107_docs/help/English/Welcome_Message	2004-09-21 14:10:23.000000000 -0500
+++ 0.7.7/e107_docs/help/English/Welcome_Message	2006-08-26 21:24:44.000000000 -0500
@@ -1,3 +1,3 @@
 
 Q>	What's this section for?
-A>	You can enter some text here that will always be displayed above your news items on the front page. You can enter a different message for Guests, Members and Administators.
+A>	You can enter some text here that will always be displayed above your news items on the front page. You can enter a different message for Guests, Members and Administrators.
diff -ruN 0.7.5/e107_files/bbcode/b.bb 0.7.7/e107_files/bbcode/b.bb
--- 0.7.5/e107_files/bbcode/b.bb	2004-09-24 21:19:43.000000000 -0500
+++ 0.7.7/e107_files/bbcode/b.bb	2006-06-07 01:10:30.000000000 -0500
@@ -1 +1 @@
-return "<strong class='bbcode'>$code_text</strong>";
\ No newline at end of file
+return "<strong class='bbcode bold'>$code_text</strong>";
\ No newline at end of file
diff -ruN 0.7.5/e107_files/bbcode/code.bb 0.7.7/e107_files/bbcode/code.bb
--- 0.7.5/e107_files/bbcode/code.bb	2006-05-17 07:03:13.000000000 -0500
+++ 0.7.7/e107_files/bbcode/code.bb	2006-11-18 13:50:51.000000000 -0600
@@ -18,20 +18,21 @@
 		} else {
 			$geshi = new GeSHi($code_text, ($pref['defaultLanGeshi'] ? $pref['defaultLanGeshi'] : 'php'), e_PLUGIN."geshi/geshi/");
 		}
+		$geshi->line_style1 = "font-family: 'Courier New', Courier, monospace; font-weight: normal; font-style: normal;";
 		$geshi->set_encoding(CHARSET);
 		$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
 		$geshi->set_header_type(GESHI_HEADER_DIV);
 		$CodeCache = $geshi->parse_code();
 		$e107cache->set('GeshiParsed_'.$code_md5, $CodeCache);
 	}
-	$ret = "<div class='code_highlight'>".str_replace("&amp;", "&", $CodeCache)."</div>";
+	$ret = "<div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'>".str_replace("&amp;", "&", $CodeCache)."</div>";
 }
 else
 {
 	$code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET);
 	$highlighted_text = highlight_string($code_text, TRUE);
 	$divClass = ($parm) ? $parm : 'code_highlight';
-	$ret = "<div class='".$tp -> toAttribute($divClass)."'>{$highlighted_text}</div>";
+	$ret = "<div class='".$tp -> toAttribute($divClass)." code-box' style='unicode-bidi: embed; direction: ltr'>{$highlighted_text}</div>";
 }
 $ret = str_replace("[", "&#091;", $ret);
 return $ret;
\ No newline at end of file
diff -ruN 0.7.5/e107_files/bbcode/file.bb 0.7.7/e107_files/bbcode/file.bb
--- 0.7.5/e107_files/bbcode/file.bb	2006-03-18 08:59:48.000000000 -0600
+++ 0.7.7/e107_files/bbcode/file.bb	2006-10-25 11:24:09.000000000 -0500
@@ -1,8 +1,9 @@
 global $pref, $fromadmin;
+
 if (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin)
 {
-	$image = (file_exists(THEME."generic/file.png") ? THEME."generic/file.png" : e_IMAGE."generic/".IMODE."/file.png");
-	list($fname, $uc) = explode("^", $parm);
+	$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(!check_class($uc))
@@ -10,5 +11,5 @@
 			return;
 		}
 	}
-	return "<br /><a href='".$tp -> toAttribute($fname)."'><img src='".$image."' alt='' style='border:0; vertical-align:middle' /></a> <a href='".$tp -> toAttribute($fname)."'>".$code_text."</a>";
-}
\ No newline at end of file
+	return "<a href='".$tp -> toAttribute($fname)."'><img src='".$image."' alt='' style='border:0; vertical-align:middle' /></a> <a href='".$tp -> toAttribute($fname)."'>".$code_text."</a>";
+}
diff -ruN 0.7.5/e107_files/bbcode/flash.bb 0.7.7/e107_files/bbcode/flash.bb
--- 0.7.5/e107_files/bbcode/flash.bb	2006-02-16 11:14:09.000000000 -0600
+++ 0.7.7/e107_files/bbcode/flash.bb	2006-07-05 00:43:58.000000000 -0500
@@ -5,17 +5,17 @@
 
 $parm_array   = explode(",",$parm);
 
-$width_type   = strpos($parm_array[0], "%") !== FALSE ? "%" : "px";
-$height_type  = strpos($parm_array[1], "%") !== FALSE ? "%" : "px";
+$width_type   = strpos($parm_array[0], "%") !== FALSE ? "%" : "";
+$height_type  = strpos($parm_array[1], "%") !== FALSE ? "%" : "";
 
 $width_value  = ereg_replace("[^0-9]","",$parm_array[0]);
 $height_value = ereg_replace("[^0-9]","",$parm_array[1]);
 
-$width_value  = $width_value  ? $width_value.$width_type   : "50px";
-$height_value = $height_value ? $height_value.$height_type : "50px";
+$width_value  = $width_value  ? $width_value.$width_type   : "50";
+$height_value = $height_value ? $height_value.$height_type : "50";
 
 return "<object type='application/x-shockwave-flash' data='$movie_path' width='$width_value' height='$height_value'>
 		<param name='movie'   value='$movie_path' />
 		<param name='quality' value='high' />
 		<param name='allowscriptaccess' value='samedomain' />
-		</object>";
+		</object>";
\ No newline at end of file
diff -ruN 0.7.5/e107_files/bbcode/i.bb 0.7.7/e107_files/bbcode/i.bb
--- 0.7.5/e107_files/bbcode/i.bb	2004-09-24 21:20:00.000000000 -0500
+++ 0.7.7/e107_files/bbcode/i.bb	2006-06-07 01:10:30.000000000 -0500
@@ -1 +1 @@
-return "<em class='bbcode'>$code_text</em>";
\ No newline at end of file
+return "<em class='bbcode italic'>$code_text</em>";
\ No newline at end of file
diff -ruN 0.7.5/e107_files/bbcode/link.bb 0.7.7/e107_files/bbcode/link.bb
--- 0.7.5/e107_files/bbcode/link.bb	2006-02-17 13:13:54.000000000 -0600
+++ 0.7.7/e107_files/bbcode/link.bb	2006-11-27 02:29:18.000000000 -0600
@@ -1,14 +1,26 @@
 global $pref;
 
 $parm     = trim($parm);
-$external = ($pref['links_new_window'] || strpos($parm, 'external') === 0) ? " rel='external'" : "";
+$external = (($pref['links_new_window'] || strpos($parm, 'external') === 0) && substr($parm,0,1) != "#") ? " rel='external'" : "";
+
+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 href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
+	return "<a class='bbcode' href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
 }
+
 else
 {
-	return "<a href='".$tp -> toAttribute($code_text)."'".$external.">".$code_text."</a>";
+	return "<a class='bbcode' href='".$tp -> toAttribute($link_text)."'".$external.">".$code_text."</a>";
 }
diff -ruN 0.7.5/e107_files/bbcode/quote.bb 0.7.7/e107_files/bbcode/quote.bb
--- 0.7.5/e107_files/bbcode/quote.bb	2005-07-27 13:21:58.000000000 -0500
+++ 0.7.7/e107_files/bbcode/quote.bb	2006-10-25 11:39:41.000000000 -0500
@@ -1 +1,2 @@
-return "<div class='indent'><em>$parm said</em> ...<br />$code_text</div>";
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_parser_functions.php");
+return "<div class='indent'><em>$parm ".LAN_WROTE."</em> ...<br />$code_text</div>";
diff -ruN 0.7.5/e107_files/bbcode/u.bb 0.7.7/e107_files/bbcode/u.bb
--- 0.7.5/e107_files/bbcode/u.bb	2006-01-11 12:13:28.000000000 -0600
+++ 0.7.7/e107_files/bbcode/u.bb	2006-06-07 01:10:30.000000000 -0500
@@ -1 +1 @@
-return "<span style='text-decoration:underline'>$code_text</span>";
\ No newline at end of file
+return "<span class='bbcode underline' style='text-decoration:underline'>$code_text</span>";
\ No newline at end of file
diff -ruN 0.7.5/e107_files/def_e107_prefs.php 0.7.7/e107_files/def_e107_prefs.php
--- 0.7.5/e107_files/def_e107_prefs.php	2006-05-05 01:41:38.000000000 -0500
+++ 0.7.7/e107_files/def_e107_prefs.php	2006-11-07 14:16:40.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.56 $
-|     $Date: 2006/05/05 06:41:38 $
-|     $Author: e107coders $
+|     $Revision: 1.59 $
+|     $Date: 2006/11/07 20:16:40 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -55,7 +55,7 @@
   'longdate' => '%A %d %B %Y - %H:%M:%S',
   'shortdate' => '%d %b : %H:%M',
   'forumdate' => '%a %b %d %Y, %I:%M%p',
-  'sitelanguage' => 'English',
+  'sitelanguage' => $pref_language,
   'maintainance_flag' => '0',
   'time_offset' => '0',
   'log_lvcount' => '10',
@@ -70,7 +70,7 @@
   'im_width' => '120',
   'im_height' => '100',
   'upload_enabled' => '0',
-  'upload_storagetype' => '2',
+  'upload_storagetype' => '1',
   'upload_maxfilesize' => '',
   'upload_class' => '255',
   'cachestatus' => '',
@@ -82,7 +82,7 @@
   'antiflood1' => '1',
   'antiflood_timeout' => '10',
   'autoban' => '1',
-  'sitelang_init' => (isset($_POST['installlanguage']) ? $_POST['installlanguage'] :  "English"),
+  'sitelang_init' => $pref_language,
   'linkpage_screentip' => '0',
   'plug_status' => 'rss_menu',
   'plug_latest' => '',
@@ -154,7 +154,8 @@
   'admincss' => 'style.css',
   'developer' => '0',
   'download_email' => '0',
-  'comments_disabled' => '0'
+  'comments_disabled' => '0',
+  'memberlist_access' => '253'
 );
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/import/import_mapper.php 0.7.7/e107_files/import/import_mapper.php
--- 0.7.5/e107_files/import/import_mapper.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/import/import_mapper.php	2006-07-04 19:03:49.000000000 -0500
@@ -0,0 +1,149 @@
+<?php
+/*  Database import function for E107 website system
+Use: See separate documentation.
+
+11.06.06 - zeronull handling added
+*/
+
+function createQuery($convertArray, $dataArray, $table, $maptable = null)
+{
+	global $tp;
+
+	$columns = "(";
+	$values = "(";
+
+
+	foreach($convertArray as $convert)
+	{   // Possible types: STRING, INT
+	  if (array_key_exists("value", $convert))
+	  {
+	    $newvalue = $convert['value'];
+	  }
+	  elseif (array_key_exists($convert['srcdata'],$dataArray))
+	  {   // Real value read from database here - need to check it
+		if($convert['type'] == "STRING")
+		  {
+		    $newvalue = $tp -> toDB($dataArray[$convert['srcdata']]);
+//		    $newvalue = $dataArray[$convert['srcdata']];				// USE IN PLACE OF PREVIOUS LINE FOR STANDALONE TEST
+			if (array_key_exists('sproc',$convert))
+			{
+			  if (strpos($convert['sproc'],"usebb") !== FALSE) $newvalue = proc_bb($newvalue,$convert['sproc'], $maptable);
+			  if (strpos($convert['sproc'],"stripbb") !== FALSE) $newvalue = preg_replace("#\[.*\]#", "",$newvalue);
+			}
+		  }
+		  else
+		  if ($convert['type'] == "INT")
+		  {
+		    $newvalue = intval($dataArray[$convert['srcdata']]); 	// intval added 25.05.06
+			if (($newvalue == 0) && ((array_key_exists('sproc',$convert)) && (strpos($convert['sproc'],"zeronull") !== FALSE))) $newvalue = '';
+		  }
+		  else
+		    echo "Invalid field type: ".$convert['type'];
+	  }
+	  else
+	  {    // blank (undefined) value
+		if (array_key_exists('default', $convert)) 
+		{
+		  $newvalue = $convert['default'];
+		}
+		else
+		{
+	      if (($convert['type'] == "INT") && ((array_key_exists('sproc',$convert)) && (strpos($convert['sproc'],"zeronull") === FALSE)))
+		    $newvalue = "0";     // Should help mySQL5
+		  else
+		    $newvalue = '';
+		}
+	  }
+	  
+	  $columns .= $convert['e107'].",";
+	  $values .=  "'".$newvalue."',";
+	}
+
+// Knock off last comma of each line
+	$columns = substr($columns, 0, -1).")";
+	$values = substr($values, 0, -1).")";
+
+	return "INSERT INTO $table $columns VALUES $values";
+
+}
+
+// Process all bbcodes in the passed value; return the processed string.
+// Works recursively
+// Start by assembling matched pairs. Then map and otherwise process as required.
+// Divide the value into five bits:
+//      Preamble - up to the identified bbcode (won't contain bbcode)
+//		BBCode start code
+//		Inner - text between the two bbcodes (may contain another bbcode)
+//		BBCode end code
+//		Trailer - remaining unprocessed text (may contain more bbcodes)
+// (Note: preg_split might seem obvious, but doesn't pick out the actual codes
+// Tested with various strings (see testdata.txt; also mapping table to see what is going on.
+
+function proc_bb($value, $options = "", $maptable = null)
+{
+  $nextchar = 0;
+  $loopcount = 0;
+// echo "<br />starting match<br />";
+ 
+  while ($nextchar < strlen($value)) :
+    $firstbit = '';
+    $middlebit = '';
+    $lastbit = '';
+    $loopcount++;
+	if ($loopcount > 10) return 'Max depth exceeded';
+    unset($bbword);
+    $firstcode = strpos($value,'[',$nextchar);
+    if ($firstcode === FALSE) return $value;   	// Done if no square brackets
+    $firstend = strpos($value,']',$firstcode);
+    if ($firstend === FALSE) return $value;		// Done if no closing bracket
+    $bbword = substr($value,$firstcode+1,$firstend - $firstcode - 1);	// May need to process this more if parameter follows
+	$bbparam = '';
+	$temp = strpos($bbword,'=');
+	if ($temp !== FALSE)
+	{
+	  $bbparam = substr($bbword,$temp);
+	  $bbword  = substr($bbword,0,-strlen($bbparam));
+	}
+//	echo $bbword."<<||>>".$bbparam;
+    if (($bbword) && ($bbword == trim($bbword)))
+    {
+      $laststart = strpos($value,'[/'.$bbword,$firstend);    // Find matching end
+	  $lastend   = strpos($value,']',$laststart);
+	  if (($laststart === FALSE) || ($lastend === FALSE))
+	  {   //  No matching end character
+	    $nextchar = $firstend;	// Just move scan pointer along 
+//		echo " - no match<br />";
+	  }
+	  else
+	  {  // Got a valid bbcode pair here
+	    $firstbit = '';
+	    if ($firstcode > 0) $firstbit = substr($value,0,$firstcode);
+	    $middlebit = substr($value,$firstend+1,$laststart - $firstend-1);
+	    $lastbit = substr($value,$lastend+1,strlen($value) - $lastend);
+//	    echo " - match||".$firstbit."||".$middlebit."||".$lastbit."<br />";
+	    // Process bbcodes here
+		if (strpos($options,'bblower') !== FALSE) $bbword = strtolower($bbword);
+		if ((strpos($options,'phpbb') !== FALSE) && (strpos($bbword,':') !== FALSE)) $bbword = substr($bbword,0,strpos($bbword,':'));
+		if ($maptable)
+		{   // Do mapping
+		  if (array_key_exists($bbword,$maptable)) $bbword = $maptable[$bbword];
+		}
+	    $bbbegin = '['.$bbword.$bbparam.']';
+	    $bbend   = '[/'.$bbword.']';
+	    return $firstbit.$bbbegin.proc_bb($middlebit,$options,$maptable).$bbend.proc_bb($lastbit,$options,$maptable);
+	  }
+    }
+	else
+	{
+	  $nextchar = $firstend+1;
+	}
+//  echo "  -->".$firstcode.", ".$firstend.", ".$laststart.", ".$lastend."<br />";
+//  echo "<br />";
+  endwhile;
+  
+}
+
+
+
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/import/import_readme.txt 0.7.7/e107_files/import/import_readme.txt
--- 0.7.5/e107_files/import/import_readme.txt	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/import/import_readme.txt	2006-07-04 19:03:49.000000000 -0500
@@ -0,0 +1,135 @@
+PHPBB2 to E107 Conversion Routine
+=================================
+
+Issue dated: 13.06.2006
+
+Any updates, bugfixes or comments please send pm to steved at e107.org
+
+
+Conversion routines from other BBS
+==================================
+phpbb2.php - modified from earlier script, with ability to process and re-map bbcodes, plus more options.
+
+Note: Only the underlying read/translate routine has been modified, plus some detail changes in the configuration table. The key routines which read and write the databases should be the same as those originally shipped.
+
+Credits:  Based on the script originally shipped with E107 (jalist)
+	  Modified to mostly work by aidee
+	  Enhanced by steved
+	  Reflects mods made by McFly in the "official" script between V1.4 and V1.5
+	  Thanks to Rashan for a lot of testing and feedback.
+
+********* This is still to some extent a work in progress - please report any problems to steved by PM ***********
+
+Installation
+============
+1. Create a fresh install of E107. (Not essential, but it will overwrite rather a lot!)
+2. Copy the files into the e107_files/convert subdirectory.
+
+
+To Run
+======
+1) If there's anything in the e107 user table, you must delete ALL entries, EXCEPT user ID:1 - This is the admin login. (or whatever you named the #1 when you installed e107)
+2) Make sure the forum plugin is installed (don't define any categories etc)
+3) login to the e107 as admin (or whatever #1 is)
+4) browse to e107_files/import/new_phpbb2.php
+5) fill in the required info for login/password, etc. 
+      db to import FROM is your phpbb2 database, with whatever prefix is set - often _phpbb_
+6) once the script runs sucessfully, return to the e107 admin, head on over to the Administrators page and set the proper people up with their admin access, delete unnessesary admins
+7) go to the Forum plugin page, select Tools from the right hand side and tell it to recalculate posts and such for all the forums, and sub-forums and posts.
+8) double-check forum mods to make sure the proper userclasses are setup as mods for the proper forums
+9) Head on over to the UserClasses page and doublecheck that the proper users are in the proper classes (Forum Mods, etc...)
+
+
+
+Known Issues
+============
+1. Forum polls may not be transferred. At the current time there are various issues with this in the E107 core, and this may be the reason. So this has been put on hold until the core is definitely fixed.
+
+
+BBCodes
+=======
+BBCode conversion may not always appear to work completely, especially if they were originally not been entered correctly. And there may be bbcodes which are not supported in E107.
+In some cases it is possible to do a direct translation within the conversion routine (see later).
+Otherwise download the add_bbcodes plugin from e107coders.org, and create bbcodes to match the originals (its often possible to use an existing bbcode as a template).
+
+
+===========================================================================
+		MODIFYING THE BEHAVIOUR
+===========================================================================
+
+File import routine (import_mapper.php)
+===================
+
+The import is based on a processing routine whose behaviour is defined in an array. The rest of these notes deal with that routine. Using the tables in the accompanying file as an example, it should be possible to modify the behavior of the conversion, and adapt to other CMS.
+
+
+Using the conversion routine
+============================
+Read one line from your database; pass to:
+
+function createQuery($convertArray, $dataArray, $table, $maptable default null)
+
+where:
+$convertArray is an array defining the translations and lookups to be done
+$dataArray is an array of input data, keyed by source field name.
+$table is the table name
+$maptable if specified is used to translate bbcodes.
+
+The function returns a line of text which is a mySQL 'INSERT' query.
+
+
+$convertArray format
+====================
+This is a 2-dimensional array which relates fields in the source and destination databases.
+Each row has a number of definition fields which relate to a single data item. The first three are 
+mandatory. The keys must be as specified:
+
+Field 1	"srcdata"	Source field name
+
+Field 2	"e107"		Destination field name
+
+Field 3	"type"		Type of destination field:
+				INT	- Integer
+				STRING	- Text/string of any sort
+				STRTOTIME - time/date as text string (not yet supported)
+				
+Field 4	"value"		(Not always present - should only be if source field is null)
+				Sets a value (sometimes from a function parameter). Overrides all other options.
+					
+Field 5 "default"	Sets default if the source field is undefined
+
+Field 6	"sproc"		Various processing options (see below)
+
+
+Processing Options
+------------------
+Comma separated string of processing options; options are invoked if present.
+
+The following are applied to string fields:
+usebb	Allows bbcode, and enables other bbcode processing options.
+			If the $maptable parameter is non-null, translates bbcodes as well
+phpbb	Causes numerics after colons within bbcodes to be stripped
+bblower All bbcodes are converted to lower case. (Applied before other processing)
+stripbb	Strips all bbcode in a string (i.e. anything between [])
+					
+The following are applied to integer fields:
+zeronull If the integer value is zero, writes a null string.
+
+
+BBCode Mapping Table
+====================
+A mapping table may be passed to the conversion routine, which translates bbcode between the two systems.
+The table is an array of key/data pairs, for example:
+
+$mapdata = array("b" => "bold","u" => "ul");
+
+The above translates the 'b' bbcode to 'bold', and the 'u' bbcode to 'ul'.
+It is also possible to delete a specific bbcode (while retaining the text between the start and end of the code) by setting the translated value to an empty string.
+The above method can also be used to translate bbcodes from upper to lower case.
+Parameters after the bbcode (identified as following an '=') are retained;
+
+
+Base routines read one record at a time from the source database, and 
+pass it to createQuery, which uses the above tables to generate an 'insert' 
+line with the appropriate data.
+
diff -ruN 0.7.5/e107_files/import/phpbb2.php 0.7.7/e107_files/import/phpbb2.php
--- 0.7.5/e107_files/import/phpbb2.php	2005-12-24 20:02:41.000000000 -0600
+++ 0.7.7/e107_files/import/phpbb2.php	2006-09-28 19:48:11.000000000 -0500
@@ -11,9 +11,34 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/import/phpbb2.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/25 02:02:41 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/09/29 00:48:11 $
+|     $Author: mcfly_e107 $
+|
+|     31/1/2006  Changes by Albert Drent
+|                Aducom Software
+|                www.aducom.com
+|
+|	  20/4/2006  Tweaks by steved, based on information from Prodigal and forum thread:
+|					Processing routine made more generic
+|					BBCode processing options - strip, phpbb processing, mapping
+|					Allows setting of default for null field
+|					Forces null integer field to zero (required for mySQL5?)
+|					Sets forum_moderators to empty
+|					User last visit and reg. date added (may not be suitable format)
+|
+|	  17/5/2006  Tweak to bring across admins as well, other than user ID = 1 (which will be E107 main admin)
+|				 Include of mapper function moved to earlier in file to try and avoid error.
+|	  18/5/2006  Table added to convert IMG and URL bbcodes to lower case.
+|	  25/5/2006  Modifications to original script made by McFly (version 1.5) added where appropriate.
+|	  10/6/2006  Bug fix - user_join mapping line specified twice
+|				 BBCodes now decoded in signatures as well as forums
+|	  11/6/2006  zeronull code added to try and sort user_perms
+|
+| Note: Apparently no field in the phpbb database with which to populate 'last post' - but can
+|			be recalculated through E107.
+|
+| Note: Typically phpbb tables are prefixed '_phpbb_'
 +----------------------------------------------------------------------------+
 */
 
@@ -91,13 +116,13 @@
 $phpbbConnection = mysql_connect($phpbb2Host, $phpbb2Username, $phpbb2Password, TRUE);
 if(!mysql_select_db($phpbb2Database, $phpbbConnection))
 {
-	goError("Error! Cound not connect to phpBB database. Please go back to the previous page and check your settings");
+	goError("Error! Could not connect to phpBB database. Please go back to the previous page and check your settings");
 }
 
 $e107Connection = mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword, TRUE);
 if(!mysql_select_db($mySQLdefaultdb, $e107Connection))
 {
-	goError("Error! Cound not connect to e107 database.");
+	goError("Error! Could not connect to e107 database.");
 }
 
 echo "Successfully connected to phpBB and e107 databases ...<br><br />";
@@ -109,11 +134,18 @@
 	goError("Error! Unable to access ".$phpbb2Prefix."users table.");
 }
 
+require_once('import_mapper.php');
 
+
+//------------------------------------------------------
+//      Convert users
+//------------------------------------------------------
 while($user = mysql_fetch_array($phpbb_res))
 {
 	$userArray = convertUsers();
-	if($user['user_level'] != 1 && $user['user_id'] != -1)
+//	if($user['user_level'] != 1 && $user['user_id'] != -1)
+// Convert any user other than ID=1 (which will be E107 main admin)
+	if($user['user_id'] > 1)
 	{
 		$query = createQuery($userArray, $user, $mySQLprefix."user");		
 		echo (mysql_query($query, $e107Connection) ? "Successfully inserted user: ".$user['user_id'].": ".$user['username'] : "Unable to insert user: ".$user['user_id'].": ".$user['username']."<br />".mysql_errno() . ": " . mysql_error())."<br />";
@@ -122,7 +154,9 @@
 }
 
 
-// ### get phpbb categrories and inset them as forum parents
+//-----------------------------------------------------------
+// ### get phpbb categories and insert them as forum parents
+//-----------------------------------------------------------
 
 mysql_query("TRUNCATE TABLE {$mySQLprefix}forum", $e107Connection);
 
@@ -161,10 +195,15 @@
 	$catcount ++;
 }
 
+
+//------------------------------------------------------
+//          Read in forum topics
+//------------------------------------------------------
+
 mysql_query("TRUNCATE TABLE {$mySQLprefix}forum_t", $e107Connection);
 mysql_query("TRUNCATE TABLE {$mySQLprefix}polls", $e107Connection);
 
-$query = "SELECT * FROM {$phpbb2Prefix}topics 
+$query = "SELECT * FROM {$phpbb2Prefix}topics
 LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}topics.topic_title = {$phpbb2Prefix}posts_text.post_subject)
 LEFT JOIN {$phpbb2Prefix}posts ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id)
 ORDER BY topic_time ASC";
@@ -186,7 +225,7 @@
 		$query = "SELECT * FROM {$phpbb2Prefix}vote_desc WHERE topic_id=".$topic['topic_id'];
 		$phpbb_res3 = mysql_query($query, $phpbbConnection);
 		$pollQ = mysql_fetch_array($phpbb_res3);
-		
+
 		$query = "SELECT * FROM {$phpbb2Prefix}vote_results WHERE vote_id=".$pollQ['vote_id'];
 		$phpbb_res3 = mysql_query($query, $phpbbConnection);
 		$options = "";
@@ -198,6 +237,8 @@
 		}
 
 		extract($pollQ);
+		$vote_text = $tp->toDB($vote_text);		// McFly added 25/5/06
+        $options = $tp->toDB($options);			// McFly added 25/5/06
 		$query = "INSERT INTO ".$mySQLprefix."polls VALUES ('0', {$vote_start}, {$vote_start}, 0, 0, '{$vote_text}', '{$options}', '{$votes}', '', 2, 0, 0, 0, 255, 0)";
 		echo (mysql_query($query, $e107Connection) ? "Poll successfully inserted" : "Unable to insert poll ({$query})")."<br />";
 	}
@@ -210,12 +251,12 @@
 
 	if($topic['topic_poster'] == -1)
 	{
-		$topic['topic_poster'] = 0;
 		$poster = ($topic['post_username'] ? $topic['post_username'] : "Anonymous");
+		$topic['topic_poster'] = "0.".$poster; 		// McFly moved, edited 25/5/06
 	}
 
-	$topicArray = convertTopics($poster);
-	$query = createQuery($topicArray, $topic, $mySQLprefix."forum_t");	
+	$topicArray = convertTopics();					// McFly edited 25/5/06
+	$query = createQuery($topicArray, $topic, $mySQLprefix."forum_t");
 
 	if(!mysql_query($query, $e107Connection))
 	{
@@ -246,19 +287,22 @@
 			}
 			if($post['poster_id'] == -1)
 			{
-				$post['poster_id'] = 0;
 				$poster = ($post['post_username'] ? $post['post_username'] : "Anonymous");
+				$post['poster_id'] = "0.".$poster;		// McFly moved, edited 25/5/06
 			}
 	
 
 			$postArray = convertForumPosts($parent_id, $poster);
-			$query = createQuery($postArray, $post, $mySQLprefix."forum_t");	
+			$query = createQuery($postArray, $post, $mySQLprefix."forum_t",$mapdata);	
 			echo (mysql_query($query, $e107Connection) ? "Successfully inserted thread: ".$post['post_id'] : "Unable to insert thread: ".$parent['cat_id'].": ".$parent['cat_title']."<br />".mysql_errno() . ": " . mysql_error())."<br />";
 			flush();
 		}
 	}
 }
 
+//------------------------------------------------------
+//          Consider polls here later
+//------------------------------------------------------
 
 echo "</td></tr></table>";
 
@@ -272,32 +316,46 @@
 	exit;
 }
 
+//-----------------------------------------------------------
+//     Table to convert selected bbcodes to lower case
+//-----------------------------------------------------------
+//$mapdata = array("URL" => "url","IMG" => "img");
+$mapdata = array();
 
 function convertUsers()
 {
 	$usersArray = array(
-		array("phpbb" => "user_id", "e107" => "user_id", "type" => "INT"),
-		array("phpbb" => "username", "e107" => "user_name", "type" => "STRING"),
-		array("phpbb" => "username", "e107" => "user_loginname", "type" => "STRING"),
-		array("phpbb" => "user_password", "e107" => "user_password", "type" => "STRING"),
-		array("phpbb" => "user_email", "e107" => "user_email", "type" => "STRING"),
-		array("phpbb" => "user_website", "e107" => "user_homepage", "type" => "STRING"),
-		array("phpbb" => "user_from", "e107" => "user_location", "type" => "STRING"),
-		array("phpbb" => "user_sig", "e107" => "user_signature", "type" => "STRING"),
-		array("phpbb" => "user_viewemail", "e107" => "user_hideemail", "type" => "INT"),
-		array("phpbb" => "user_regdate", "e107" => "user_join", "type" => "INT"), 
-		array("phpbb" => "user_posts", "e107" => "user_forums", "type" => "INT"), 
-		array("phpbb" => "user_level", "e107" => "user_admin", "type" => "INT")
-	);
+		array("srcdata" => "user_id", "e107" => "user_id", "type" => "INT"),
+		array("srcdata" => "username", "e107" => "user_name", "type" => "STRING"),
+		array("srcdata" => "username", "e107" => "user_loginname", "type" => "STRING"),
+		array("srcdata" => "user_password", "e107" => "user_password", "type" => "STRING"),
+		array("srcdata" => "user_email", "e107" => "user_email", "type" => "STRING"),
+		array("srcdata" => "user_sig", "e107" => "user_signature", "type" => "STRING", "sproc" => "usebb,phpbb,bblower"),
+		array("srcdata" => "user_viewemail", "e107" => "user_hideemail", "type" => "INT"),
+		array("srcdata" => "user_regdate", "e107" => "user_join", "type" => "INT"),
+		array("srcdata" => "user_posts", "e107" => "user_forums", "type" => "INT"),
+		array("srcdata" => "user_level", "e107" => "user_admin", "type" => "INT"),
+		array("srcdata" => "user_lastvisit","e107" => "user_lastvisit", "type" => "INT"),
+// Rest of these added by McFly 
+		array("srcdata" => "null", "e107" => "user_prefs", "type" => "INT", "value" => 0),
+        array("srcdata" => "null", "e107" => "user_new", "type" => "INT", "value" => 0),
+        array("srcdata" => "null", "e107" => "user_realm", "type" => "INT", "value" => 0),
+        array("srcdata" => "null", "e107" => "user_class", "type" => "INT", "value" => 0),
+        array("srcdata" => "null", "e107" => "user_viewed", "type" => "INT", "value" => 0),
+// This one changed from McFly's code to try and get null string if non-admin
+        array("srcdata" => "user_level", "e107" => "user_perms", "type" => "INT", "sproc" => "zeronull")	);
 	return $usersArray;
 }
 
 function convertParents($catid)
 {
 	$parentArray = array(
-		array("phpbb" => "cat_id", "e107" => "forum_id", "type" => "INT", "value" => $catid),
-		array("phpbb" => "cat_title", "e107" => "forum_name", "type" => "STRING"),
-		array("phpbb" => "cat_order", "e107" => "forum_order", "type" => "INT")
+		array("srcdata" => "cat_id", "e107" => "forum_id", "type" => "INT", "value" => $catid),
+		array("srcdata" => "cat_title", "e107" => "forum_name", "type" => "STRING"),
+		array("srcdata" => "cat_order", "e107" => "forum_order", "type" => "INT"),
+// Rest of these added by McFly
+		array("srcdata" => "cat_desc", "e107" => "forum_description", "type" => "STRING"),
+        array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254)
 	);
 	return $parentArray;
 }
@@ -305,31 +363,37 @@
 function convertForums($catid)
 {
 	$forumArray = array(
-		array("phpbb" => "forum_id", "e107" => "forum_id", "type" => "INT"),
-		array("phpbb" => "cat_id", "e107" => "forum_parent", "type" => "STRING", "value" => $catid),
-		array("phpbb" => "forum_name", "e107" => "forum_name", "type" => "STRING"),
-		array("phpbb" => "forum_desc", "e107" => "forum_description", "type" => "STRING"),
-		array("phpbb" => "forum_order", "e107" => "forum_order", "type" => "INT"),
-		array("phpbb" => "forum_topics", "e107" => "forum_threads", "type" => "INT"),
-		array("phpbb" => "forum_posts", "e107" => "forum_replies", "type" => "INT")
+		array("srcdata" => "forum_id", "e107" => "forum_id", "type" => "INT"),
+		array("srcdata" => "cat_id", "e107" => "forum_parent", "type" => "STRING", "value" => $catid),
+		array("srcdata" => "forum_name", "e107" => "forum_name", "type" => "STRING"),
+		array("srcdata" => "forum_desc", "e107" => "forum_description", "type" => "STRING"),
+		array("srcdata" => "forum_order", "e107" => "forum_order", "type" => "INT"),
+		array("srcdata" => "forum_topics", "e107" => "forum_threads", "type" => "INT"),
+		array("srcdata" => "forum_posts", "e107" => "forum_replies", "type" => "INT"),
+//		array("srcdata" => "null", "e107" => "forum_moderators", "type" => "STRING")
+// Previous line replaced with this on the basis that McFly knows best
+		array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254)
 	);
 	return $forumArray;
 }
 
 
-function convertTopics($poster)
+//function convertTopics($poster)
+// Changed by McFly
+function convertTopics()
 {
 	$topicArray = array(
-		array("phpbb" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"),
-		array("phpbb" => "topic_title", "e107" => "thread_name", "type" => "STRING"),
-		array("phpbb" => "post_text", "e107" => "thread_thread", "type" => "STRING"),
-		array("phpbb" => "topic_poster", "e107" => "thread_user", "type" => "INT"), 
-		array("phpbb" => "null", "e107" => "thread_active", "type" => "INT", "value" => 1), 
-		array("phpbb" => "topic_time", "e107" => "thread_datestamp", "type" => "INT"),
-		array("phpbb" => "topic_views", "e107" => "thread_views", "type" => "INT"),
-		array("phpbb" => "topic_replies", "e107" => "thread_total_replies", "type" => "INT"), 
-		array("phpbb" => "null", "e107" => "thread_parent", "type" => "INT", "value" => 0), 
-		array("phpbb" => "null", "e107" => "thread_anon", "type" => "INT", "value" => $poster)
+		array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"),
+		array("srcdata" => "topic_title", "e107" => "thread_name", "type" => "STRING"),
+		array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"),
+//		array("srcdata" => "topic_poster", "e107" => "thread_user", "type" => "INT"),
+// Previous line replaced by next - GAT McFly
+		array("srcdata" => "topic_poster", "e107" => "thread_user", "type" => "STRING"),
+		array("srcdata" => "null", "e107" => "thread_active", "type" => "INT", "value" => 1),
+		array("srcdata" => "topic_time", "e107" => "thread_datestamp", "type" => "INT"),
+		array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"),
+		array("srcdata" => "topic_replies", "e107" => "thread_total_replies", "type" => "INT"),
+		array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => 0),
 	);
 	return $topicArray;
 }
@@ -340,57 +404,68 @@
 function convertForumPosts($parent_id, $poster)
 {
 	$postArray = array(
-		array("phpbb" => "post_text", "e107" => "thread_thread", "type" => "STRING"),
-		array("phpbb" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"),
-		array("phpbb" => "post_time", "e107" => "thread_datestamp", "type" => "INT"),
-		array("phpbb" => "topic_views", "e107" => "thread_views", "type" => "INT"),
-		array("phpbb" => "post_time", "e107" => "thread_lastpost", "type" => "INT"),
-		array("phpbb" => "poster_id", "e107" => "thread_user", "type" => "INT"), 
-		array("phpbb" => "post_subject", "e107" => "thread_name", "type" => "STRING"), 
-		array("phpbb" => "null", "e107" => "thread_parent", "type" => "INT", "value" => $parent_id), 
-		array("phpbb" => "null", "e107" => "thread_anon", "type" => "INT", "value" => $poster)
+		array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"),
+		array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"),
+		array("srcdata" => "post_time", "e107" => "thread_datestamp", "type" => "INT"),
+		array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"),
+		array("srcdata" => "post_time", "e107" => "thread_lastpost", "type" => "INT"),
+//		array("srcdata" => "poster_id", "e107" => "thread_user", "type" => "INT"),
+// Previous line replaced by next - GAT McFly
+		array("srcdata" => "poster_id", "e107" => "thread_user", "type" => "STRING"),
+		array("srcdata" => "post_subject", "e107" => "thread_name", "type" => "STRING"),
+		array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => $parent_id),
 	);
 	return $postArray;
 }
 
 
+/*
+-- --------------------------------------------------------
+PHPBB uses three tables to record a poll. Looks wildly different to E107!
+-- 
+-- Table structure for table `_phpbb_vote_desc`
+-- 
+
+CREATE TABLE `_phpbb_vote_desc` (
+  `vote_id` mediumint(8) unsigned NOT NULL auto_increment,
+  `topic_id` mediumint(8) unsigned NOT NULL default '0',
+  `vote_text` text NOT NULL,
+  `vote_start` int(11) NOT NULL default '0',
+  `vote_length` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`vote_id`),
+  KEY `topic_id` (`topic_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
+
+-- --------------------------------------------------------
+
+-- 
+-- Table structure for table `_phpbb_vote_results`
+-- 
+
+CREATE TABLE `_phpbb_vote_results` (
+  `vote_id` mediumint(8) unsigned NOT NULL default '0',
+  `vote_option_id` tinyint(4) unsigned NOT NULL default '0',
+  `vote_option_text` varchar(255) NOT NULL default '',
+  `vote_result` int(11) NOT NULL default '0',
+  KEY `vote_option_id` (`vote_option_id`),
+  KEY `vote_id` (`vote_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- --------------------------------------------------------
+
+-- 
+-- Table structure for table `_phpbb_vote_voters`
+-- 
+
+CREATE TABLE `_phpbb_vote_voters` (
+  `vote_id` mediumint(8) unsigned NOT NULL default '0',
+  `vote_user_id` mediumint(8) NOT NULL default '0',
+  `vote_user_ip` char(8) NOT NULL default '',
+  KEY `vote_id` (`vote_id`),
+  KEY `vote_user_id` (`vote_user_id`),
+  KEY `vote_user_ip` (`vote_user_ip`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
-
-
-
-function createQuery($convertArray, $dataArray, $table)
-{
-	global $tp;
-
-	$columns = "(";
-	$values = "(";
-
-
-	foreach($convertArray as $convert)
-	{
-		if($convert['type'] == "STRING")
-		{
-			$dataArray[$convert['phpbb']] = preg_replace("#\[.*\]#", "", $tp -> toDB($dataArray[$convert['phpbb']]));
-		}
-		$columns .= $convert['e107'].",";
-		$values .= (array_key_exists("value", $convert) ? "'".$convert['value']."'," : "'".$dataArray[$convert['phpbb']]."',");
-	}
-	
-
-	$columns = substr($columns, 0, -1).")";
-	$values = substr($values, 0, -1).")";
-
-	return "INSERT INTO $table $columns VALUES $values";
-	
-}	
-
-
-
-
-
-
-
-
-
+*/
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/resetcore/resetcore.php 0.7.7/e107_files/resetcore/resetcore.php
--- 0.7.5/e107_files/resetcore/resetcore.php	2006-05-12 20:21:56.000000000 -0500
+++ 0.7.7/e107_files/resetcore/resetcore.php	2006-10-24 08:38:05.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/resetcore/resetcore.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2006/05/13 01:21:56 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.15 $
+|     $Date: 2006/10/24 13:38:05 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,16 +28,16 @@
 When you have finished with resetcore you should swap true for false so it can't be used by
 people it shouldn't be used by.
 
+If your site uses a different charset than utf-8, change the CHARSET to reflect the correct encoding.
+
 */
 
 define("ACTIVE", false);
-
+define("CHARSET", 'utf-8');
 
 /* #################################################### */
 
 
-
-
 $register_globals = true;
 if(function_exists('ini_get'))
 {
@@ -64,14 +64,14 @@
 require_once('../../'.$HANDLERS_DIRECTORY.'arraystorage_class.php');
 $eArrayStorage = new ArrayData();
 
-echo "<?xml version='1.0' encoding='iso-8859-1' ?>\n";
+echo "<?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">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title><e107 resetcore></title>
 <link rel="stylesheet" href="style.css" />
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
 <meta http-equiv="content-style-type" content="text/css" />
 </head>
 <body>
@@ -97,14 +97,14 @@
 
 		$admin_directory = "e107_admin";
 
-//			<input type='radio' name='mode' value='1'> <span class='headertext2'>Manually edit core values</span><br />
+//			<input type='radio' name='mode' value='1' /> <span class='headertext2'>Manually edit core values</span><br />
 
 		echo "<span class='headertext2'><b>Please select which method you want to use, then click the button to proceed ...</b></span><br /><br /><br /><br />
 			<table style='width: auto; margin-left:auto; margin-right: auto;'>
 			<tr>
 			<td>
 			<form method='post' action='".$_SERVER['PHP_SELF']."'>
-			<input type='radio' name='mode' value='2'> <span class='headertext2'>Reset core to default values</span><br />". ($bu_exist ? "<input type='radio' name='mode' value='3'> <span class='headertext2'>Restore core backup</span>" : "<br />( There is no backed-up core - unable to offer option to restore backup )")."<br /><br /><input class='button' type='submit' name='reset_core_sub' value='Select method then click here to continue' />
+			<input type='radio' name='mode' value='2' /> <span class='headertext2'>Reset core to default values</span><br />". ($bu_exist ? "<input type='radio' name='mode' value='3' /> <span class='headertext2'>Restore core backup</span>" : "<br />( There is no backed-up core - unable to offer option to restore backup )")."<br /><br /><input class='button' type='submit' name='reset_core_sub' value='Select method then click here to continue' />
 				 
 			<input type='hidden' name='a_name' value='".$_POST['a_name']."' />
 			<input type='hidden' name='a_password' value='".$_POST['a_password']."' />
diff -ruN 0.7.5/e107_files/shortcode/admin_alt_nav.sc 0.7.7/e107_files/shortcode/admin_alt_nav.sc
--- 0.7.5/e107_files/shortcode/admin_alt_nav.sc	2006-05-13 18:37:50.000000000 -0500
+++ 0.7.7/e107_files/shortcode/admin_alt_nav.sc	2006-10-27 18:06:55.000000000 -0500
@@ -1,12 +1,12 @@
 if (ADMIN) {
-	global $sql, $pref;
+	global $sql, $pref, $tp;
 	parse_str($parm);
 	require(e_ADMIN.'ad_links.php');
 	require_once(e_HANDLER.'admin_handler.php');
 	function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id=FALSE) {
 		$cat_link = ($cat_link ? $cat_link : "javascript:void(0);");
 		$text = "<a class='menuButton' href='".$cat_link."' style='background-image: url(".$cat_img."); background-repeat: no-repeat;  background-position: 3px 1px' ";
-		if ($cat_id) { 
+		if ($cat_id) {
 			$text .= "onclick=\"return buttonClick(event, '".$cat_id."');\" onmouseover=\"buttonMouseover(event, '".$cat_id."');\"";
 		}
 		$text .= ">".$cat_title."</a>";
@@ -15,11 +15,11 @@
 
 	function adnav_main($cat_title, $cat_link, $cat_img, $cat_id=FALSE, $cat_highlight='') {
 		$text = "<a class='menuItem ".$cat_highlight."' href='".$cat_link."' ";
-		if ($cat_id) { 
+		if ($cat_id) {
 			$text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '".$cat_id."');\"";
 		}
 			$text .= "><span class='menuItemBuffer'>".$cat_img."</span><span class='menuItemText'>".$cat_title."</span>";
-		if ($cat_id) { 
+		if ($cat_id) {
 			$text .= "<span class=\"menuItemArrow\">&#9654;</span>";
 		}
 			$text .= "</a>";
@@ -30,7 +30,7 @@
 	} else {
 		$text = "<script type='text/javascript' src='".e_FILE_ABS."nav_menu.js'></script>";
 	}
-	
+
 	$text .= "<div style='width: 100%'><table border='0' cellspacing='0' cellpadding='0' style='width: 100%'>
 	<tr><td>
 	<div class='menuBar' style='width: 100%'>";
@@ -56,13 +56,14 @@
 			$text .= $ad_texti;
 		}
 	}
-	
+
 	$render_plugins = FALSE;
-	if($sql -> db_Select("plugin", "*", "plugin_installflag=1")){
+	if($sql -> db_Select("plugin", "*", "plugin_installflag=1 ORDER BY plugin_path")){
 		while($row = $sql -> db_Fetch()){
 			if(getperms('P'.$row['plugin_id'])){
 				include_once(e_PLUGIN.$row['plugin_path']."/plugin.php");
 				if($eplug_conffile){
+					$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs");
 					$plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN_ABS.$eplug_icon_small."' alt='".$eplug_caption."' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN;
 					$plugin_array[ucfirst($eplug_name)] = adnav_main($eplug_name, e_PLUGIN.$row['plugin_path']."/".$eplug_conffile, $plugin_icon);
 				}
@@ -77,20 +78,20 @@
 			$plugs_text .= $plugin_compile;
 		}
 	}
-	
+
 	if (getperms('Z')) {
 		$pclass_extended = $active_plugs ? 'header' : '';
 		$plugin_text = adnav_main(ADLAN_98, e_ADMIN.'plugin.php', E_16_PLUGMANAGER, FALSE, $pclass_extended);
 		$render_plugins = TRUE;
 	}
-	
+
 	if ($render_plugins) {
 		$text .= adnav_cat(ADLAN_CL_7, '', E_16_CAT_PLUG, 'plugMenu');
 		$text .= "<div id='plugMenu' class='menu' onmouseover=\"menuMouseover(event)\">";
 		$text .= $plugin_text.$plugs_text;
 		$text .= "</div>";
 	}
-	
+
 	$text .= adnav_cat(ADLAN_CL_8, '', E_16_NAV_DOCS, 'docsMenu');
 	$text .= "<div id='docsMenu' class='menu' onmouseover=\"menuMouseover(event)\">";
 	if (!$handle=opendir(e_DOCS.e_LANGUAGE."/")) {
@@ -109,22 +110,21 @@
 
 	$text .= "</div>
 	</td>";
-	
+
 	if ($exit != 'off') {
 		$text .= "<td style='width: 160px; white-space: nowrap'>
 		<div class='menuBar' style='width: 100%'>";
-	
+
 		$text .= adnav_cat(ADLAN_53, e_BASE.'index.php', E_16_NAV_LEAV);
 		$text .= adnav_cat(ADLAN_46, e_ADMIN.'admin.php?logout', E_16_NAV_LGOT);
-	
+
 		$text .= "</div>
 		</td>";
 	}
-	
+
 	$text .= "</tr>
 	</table>
 	</div>";
 
 	return $text;
 }
-
diff -ruN 0.7.5/e107_files/shortcode/admin_credits.sc 0.7.7/e107_files/shortcode/admin_credits.sc
--- 0.7.5/e107_files/shortcode/admin_credits.sc	2005-08-22 11:53:23.000000000 -0500
+++ 0.7.7/e107_files/shortcode/admin_credits.sc	2006-10-28 20:00:20.000000000 -0500
@@ -1,5 +1,5 @@
 if (ADMIN) {
 	return "<div style='text-align: center'>
-			<input class='button' type='button' onclick=\"javascript: window.open('".e_ADMIN."credits.php', 'myWindow', 'status = 1, height = 400, width = 300, resizable = 0')\" value='Credits' />
+			<input class='button' type='button' onclick=\"javascript: window.open('".e_ADMIN."credits.php', 'myWindow', 'status = 1, height = 400, width = 300, resizable = 0')\" value='".LAN_CREDITS."' />
 			</div>";
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_files/shortcode/admin_lang.sc 0.7.7/e107_files/shortcode/admin_lang.sc
--- 0.7.5/e107_files/shortcode/admin_lang.sc	2005-10-20 11:46:59.000000000 -0500
+++ 0.7.7/e107_files/shortcode/admin_lang.sc	2006-11-15 19:43:11.000000000 -0600
@@ -21,12 +21,19 @@
 			}
 		}
 
+		require_once(e_HANDLER."language_class.php");
+		$slng = new language;
+
+
 		if(!getperms($sql->mySQLlanguage) && $lanperms)
 		{
 			$sql->mySQLlanguage = ($lanperms[0] != $pref['sitelanguage']) ? $lanperms[0] : "";
 			if ($pref['user_tracking'] == "session")
 			{
 				$_SESSION['e107language_'.$pref['cookie_name']] = $lanperms[0];
+				if($pref['multilanguage_subdomain']){
+					header("Location:".$slng->subdomainUrl($lanperms[0]));
+				}
 			}
 			else
 			{
@@ -44,44 +51,66 @@
 			}
 		}
 
+
 		$text .= "<div><img src='".e_IMAGE."admin_images/language_16.png' alt='' />&nbsp;";
 		if(isset($aff))
 		{
-			$text .= $sql->mySQLlanguage.
-			": <span class='button' style='cursor: pointer;' onclick='expandit(\"lan_tables\");'><a style='text-decoration:none' title='' href=\"javascript:void(0);\" >&nbsp;&nbsp;".count($aff)." ".UTHEME_MENU_L3."&nbsp;&nbsp;</a></span><br />
+			$text .= $sql->mySQLlanguage;
+			$text .= " (".$slng->convert($sql->mySQLlanguage).")
+			: <span class='button' style='cursor: pointer;' onclick='expandit(\"lan_tables\");'><a style='text-decoration:none' title='' href=\"javascript:void(0);\" >&nbsp;&nbsp;".count($aff)." ".UTHEME_MENU_L3."&nbsp;&nbsp;</a></span><br />
 			<span style='display:none' id='lan_tables'>
 			";
 			$text .= implode("<br />",$aff);
 			$text .= "</span>";
 		}
-		elseif($sql->mySQLlanguage)
+		elseif($sql->mySQLlanguage && ($sql->mySQLlanguage != $pref['sitelanguage']))
 		{
-			$text .= $sql->mySQLlanguage.": ".LAN_INACTIVE;
+			$text .= $sql->mySQLlanguage;
+			$text .= " (".$slng->convert($sql->mySQLlanguage)."): ".LAN_INACTIVE;
 		}
 		else
 		{
-			$text .= $pref['sitelanguage'].": ".LAN_INACTIVE;
+			$text .= $pref['sitelanguage'];
 		}
 		$text .= "<br /><br /></div>";
 
-		$text .= "<div style='text-align:center'>
-		<form method='post' action='".e_SELF."'>
-		<div>
-		<select name='sitelanguage' class='tbox'>";
-
-		foreach($lanperms as $lng)
-		{
-			$langval = ($lng == $pref['sitelanguage']) ? "" : $lng;
-			$selected = ($lng == $sql->mySQLlanguage || ($lng == $pref['sitelanguage'] && !$sql->mySQLlanguage)) ? "selected='selected'" : "";
-			$text .= "<option value='".$langval."' $selected>$lng</option>\n";
-		}
-		$text .= "</select>
-		<br /><br />
-		<input class='button' type='submit' name='setlanguage' value='".UTHEME_MENU_L1."' />
-		</div>
-		</form>
-		</div>";
+
+
+		if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'])
+		{
+        	$text .= "<div style='text-align:center'>
+			<select class='tbox' name='lang_select' style='width:95%' onchange=\"location.href=this.options[selectedIndex].value\">";
+			foreach($lanperms as $lng)
+			{
+				$selected = ($lng == $sql->mySQLlanguage || ($lng == $pref['sitelanguage'] && !$sql->mySQLlanguage)) ? "selected='selected'" : "";
+                $urlval = $slng->subdomainUrl($lng);
+				$text .= "<option value='".$urlval."' $selected>$lng</option>\n";
+			}
+			$text .= "</select></div>";
+
+		}
+        else
+		{
+
+			$text .= "<div style='text-align:center'>
+			<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>
+			<div>
+			<select name='sitelanguage' class='tbox'>";
+
+			foreach($lanperms as $lng)
+			{
+				$langval = ($lng == $pref['sitelanguage'] && $lng == 'English') ? "" : $lng;
+				$selected = ($lng == $sql->mySQLlanguage || ($lng == $pref['sitelanguage'] && !$sql->mySQLlanguage)) ? "selected='selected'" : "";
+				$text .= "<option value='".$langval."' $selected>$lng</option>\n";
+			}
+			$text .= "</select>
+			<br /><br />
+	   		<input class='button' type='submit' name='setlanguage' value='".UTHEME_MENU_L1."' />
+			</div>
+				</form>
+			</div>";
+		}
 
 		return $ns -> tablerender(UTHEME_MENU_L2, $text, '', TRUE);
 	}
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_files/shortcode/admin_latest.sc 0.7.7/e107_files/shortcode/admin_latest.sc
--- 0.7.5/e107_files/shortcode/admin_latest.sc	2005-10-16 04:07:27.000000000 -0500
+++ 0.7.7/e107_files/shortcode/admin_latest.sc	2006-11-07 23:15:07.000000000 -0600
@@ -2,18 +2,18 @@
 	if (!function_exists('admin_latest')) {
 		function admin_latest() {
 			global $sql, $ns, $pref;
-			$active_uploads = $sql -> db_Select("upload", "*", "upload_active=0");
-			$submitted_news = $sql -> db_Select("submitnews", "*", "submitnews_auth ='0' ");
+
+	   		$active_uploads = $sql -> db_Count("upload", "(*)", "WHERE upload_active = '0' ");
+			$submitted_news = $sql -> db_Count("submitnews", "(*)", "WHERE submitnews_auth = '0' ");
 
 			$text = "<div style='padding-bottom: 2px;'>".E_16_NEWS.($submitted_news ? " <a href='".e_ADMIN."newspost.php?sn'>".ADLAN_LAT_2.": $submitted_news</a>" : " ".ADLAN_LAT_2.": 0")."</div>";
 			$text .= "<div style='padding-bottom: 2px;'>".E_16_UPLOADS.($active_uploads ? " <a href='".e_ADMIN."upload.php'>".ADLAN_LAT_7.": $active_uploads</a>" : " ".ADLAN_LAT_7.": ".$active_uploads)."</div>";
 
-			if ($pref['plug_latest']) {
-				$lats = explode(",", $pref['plug_latest']);
-				foreach($lats as $lat) {
-					if (file_exists(e_PLUGIN.$lat."/e_latest.php")) {
-						include_once(e_PLUGIN.$lat."/e_latest.php");
-					}
+			foreach($pref['e_latest_list'] as $val)
+			{
+				if (is_readable(e_PLUGIN.$val."/e_latest.php"))
+				{
+				   		include_once(e_PLUGIN.$val."/e_latest.php");
 				}
 			}
 
@@ -41,4 +41,4 @@
 	} else {
 		return admin_latest();
 	}
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_files/shortcode/admin_log.sc 0.7.7/e107_files/shortcode/admin_log.sc
--- 0.7.5/e107_files/shortcode/admin_log.sc	2006-02-18 16:52:34.000000000 -0600
+++ 0.7.7/e107_files/shortcode/admin_log.sc	2006-10-24 12:23:18.000000000 -0500
@@ -14,7 +14,7 @@
 			$gen = new convert;
 			while ($row = $sql -> db_Fetch()) {
 				$datestamp = $gen->convert_date($row['dblog_datestamp'], 'short');
-				$text .= "<li>{$datestamp} - {$row['dblog_remarks']}</li>";
+				$text .= "<li>{$datestamp} - {$row['dblog_title']}</li>";
 			}
 			$text .= ($cnt ? "</ul>" : "");
 
@@ -33,4 +33,4 @@
 	} else {
 		return admin_log();
 	}
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_files/shortcode/admin_menu.sc 0.7.7/e107_files/shortcode/admin_menu.sc
--- 0.7.5/e107_files/shortcode/admin_menu.sc	2005-01-17 20:55:22.000000000 -0600
+++ 0.7.7/e107_files/shortcode/admin_menu.sc	2006-11-21 23:12:25.000000000 -0600
@@ -8,6 +8,7 @@
 		if (!$parm) {
 			call_user_func($adminmenu_func,$adminmenu_parms);
 		} else {
+			ob_end_clean();
 			return 'pre';
 		}
 	}
@@ -17,6 +18,7 @@
 		if (!$parm) {
 			@require_once($plugpath);
 		} else {
+			ob_end_clean();
 			return 'pre';
 		}
 	}
diff -ruN 0.7.5/e107_files/shortcode/admin_status.sc 0.7.7/e107_files/shortcode/admin_status.sc
--- 0.7.5/e107_files/shortcode/admin_status.sc	2006-01-04 14:46:45.000000000 -0600
+++ 0.7.7/e107_files/shortcode/admin_status.sc	2006-10-14 09:08:27.000000000 -0500
@@ -13,27 +13,17 @@
 			$text .= "<div style='padding-bottom: 2px;'>".E_16_BANLIST." ".ADLAN_112.": ".$banned."</div>";
 			$text .= "<div style='padding-bottom: 2px;'>".E_16_COMMENT." ".ADLAN_114.": ".$comments."</div>";
 
-			if ($pref['plug_status']) {
-				$stas = explode(",", $pref['plug_status']);
-				foreach($stas as $sta) {
-					if (file_exists(e_PLUGIN.$sta."/e_status.php")) {
-						include_once(e_PLUGIN.$sta."/e_status.php");
-					}
+			foreach($pref['e_status_list'] as $val)
+			{
+				if (is_readable(e_PLUGIN.$val."/e_status.php"))
+				{
+				   		include_once(e_PLUGIN.$val."/e_status.php");
 				}
 			}
 
-			require_once(e_HANDLER.'file_class.php');
-			$fl = new e_file;
-			$pluginList = $fl->get_files(e_PLUGIN, "^adminlist\.php$", "standard", 1);
 
-			foreach($pluginList as $p)
+			if($flo = $sql -> db_Count("generic", "(*)", "WHERE gen_type='failed_login'"))
 			{
-				$text .= include_once($p['path'].$p['fname']);
-			}
-
-			if($flo = $sql -> db_Select("generic", "*", "gen_type='failed_login' "))
-			{
-
 				$text .= "<img src='".e_IMAGE."admin_images/failedlogin_16.png' alt='' style='vertical-align: middle;' /> <a href='".e_ADMIN."fla.php'>".ADLAN_146.": $flo</a>";
 			}
 
@@ -51,4 +41,4 @@
 	} else {
 		return admin_status();
 	}
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_files/shortcode/batch/bbcode_shortcodes.php 0.7.7/e107_files/shortcode/batch/bbcode_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/bbcode_shortcodes.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/batch/bbcode_shortcodes.php	2006-07-16 14:56:46.000000000 -0500
@@ -0,0 +1,142 @@
+<?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_files/shortcode/batch/bbcode_shortcodes.php,v $
+|     $Revision: 1.10 $
+|     $Date: 2006/07/16 19:56:46 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+
+include_once(e_HANDLER.'shortcode_handler.php');
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_ren_help.php");
+global $register_bb;
+$bbcode_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+
+/*
+SC_BEGIN BB
+
+global $pref, $eplug_bb, $bbcode_func, $bbcode_help, $bbcode_filedir, $bbcode_imagedir, $bbcode_helpactive, $bbcode_helptag, $register_bb;
+
+if(e_WYSIWYG){ return; }
+
+$bbcode_func = ($bbcode_func) ? $bbcode_func : "addtext";
+$bbcode_help  = ($bbcode_help) ? $bbcode_help : "help";
+$bbcode_tag  = ($bbcode_helptag != 'helpb') ? ",'$bbcode_helptag'" : "";
+
+$rand = rand(1000,9999);
+$imagedir_display = str_replace("../","",$bbcode_imagedir);
+
+if($parm == "emotes" && $pref['comments_emoticons'] && $pref['smiley_activate'] && !e_WYSIWYG)
+{
+	$bbcode['emotes'] = array("expandit","emoticon_selector_".$rand, LANHELP_44, "emotes.png", "Emoticon_Select", "emoticon_selector_".$rand);
+}
+
+// Format: $bbcode['UNIQUE_NAME'] = array(ONCLICK_FUNC, ONCLICK_VAR, HELPTEXT, ICON, INCLUDE_FUNC, INCLUDE_FUNCTION_VAR);
+
+$bbcode['newpage'] = array($bbcode_func,"[newpage]", LANHELP_34, "newpage.png");
+$bbcode['link'] = array($bbcode_func,"[link=".LANHELP_35."][/link]", LANHELP_23,"link.png");
+$bbcode['b'] = array($bbcode_func,"[b][/b]", LANHELP_24,"bold.png");
+$bbcode['i'] = array($bbcode_func,"[i][/i]", LANHELP_25,"italic.png");
+$bbcode['u'] = array($bbcode_func,"[u][/u]", LANHELP_26,"underline.png");
+$bbcode['center'] = array($bbcode_func,"[center][/center]", LANHELP_28,"center.png");
+$bbcode['left'] = array($bbcode_func,"[left][/left]", LANHELP_29,"left.png");
+$bbcode['right'] = array($bbcode_func,"[right][/right]", LANHELP_30,"right.png");
+$bbcode['bq'] = array($bbcode_func,"[blockquote][/blockquote]", LANHELP_31,"blockquote.png");
+$bbcode['code'] = array($bbcode_func,"[code][/code]", LANHELP_32,"code.png");
+$bbcode['list'] = array($bbcode_func,"[list][/list]", LANHELP_36,"list.png");
+$bbcode['img'] = array($bbcode_func,"[img][/img]", LANHELP_27,"image.png");
+$bbcode['flash'] = array($bbcode_func,"[flash=width,height][/flash]", LANHELP_47,"flash.png");
+
+$bbcode['fontsize'] = array("expandit","size_selector_".$rand, LANHELP_22,"fontsize.png","Size_Select",'size_selector_'.$rand);
+$bbcode['fontcol'] = array("expandit","col_selector_".$rand, LANHELP_21,"fontcol.png","Color_Select",'col_selector_'.$rand);
+$bbcode['preimage'] = array("expandit","preimage_selector_".$rand, LANHELP_45.$imagedir_display,"preimage.png","PreImage_Select","preimage_selector_".$rand);
+$bbcode['prefile'] = array("expandit","prefile_selector_".$rand, LANHELP_39,"prefile.png","PreFile_Select",'prefile_selector_'.$rand);
+
+if(!isset($iconpath[$parm]))
+{
+	$iconpath[$parm] =  (file_exists(THEME."bbcode/bold.png") ? THEME."bbcode/" : e_IMAGE."generic/bbcode/");
+    $iconpath[$parm] .= $bbcode[$parm][3];
+}
+
+
+foreach($register_bb as $key=>$val) // allow themes to plug in to it.
+{
+	if($val[0]=="")
+	{
+    	$val[0] = $bbcode_func;
+	}
+	$bbcode[$key] = $val;
+	$iconpath[$key] = $val[3];
+}
+
+
+foreach($eplug_bb as $key=>$val)  // allow plugins to plug into it.
+{
+	extract($val);
+   //	echo "$onclick $onclick_var $helptext $icon <br />";
+    $bbcode[$name] = array($onclick,$onclick_var,$helptext,$icon,$function,$function_var);
+	$iconpath[$name] = $icon;
+}
+
+
+$_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];
+
+
+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";
+}
+
+if($_function)
+{
+
+	$text .= ($bbcode_helpactive && $_helptxt && !$iconpath[$parm]) ? "<span onmouseout=\"{$bbcode_help}(''{$bbcode_tag})\" onmouseover=\"{$bbcode_help}('".$_helptxt."'{$bbcode_tag})\" >" : "";
+	$text .= $_function($_function_var);
+	$text .= ($bbcode_helpactive && $_helptxt && !$iconpath[$parm]) ? "</span>" : "";
+}
+
+return $text;
+
+
+
+
+SC_END
+
+
+
+
+SC_BEGIN BB_HELP
+	if(e_WYSIWYG){	return;	}
+	global $bbcode_helpactive,$bbcode_helptag;
+	$bbcode_helptag = ($parm) ? $parm : "helpb";
+	$bbcode_helpactive = TRUE;
+	return "<input id='{$bbcode_helptag}' class='helpbox' type='text' name='{$bbcode_helptag}' size='100'  />\n";
+SC_END
+
+
+
+SC_BEGIN BB_PREIMAGEDIR
+	if(e_WYSIWYG){	return;	}
+	global $bbcode_imagedir;
+	$bbcode_imagedir = $parm;
+	return;
+SC_END
+
+
+*/
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/batch/comment_shortcodes.php 0.7.7/e107_files/shortcode/batch/comment_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/comment_shortcodes.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_files/shortcode/batch/comment_shortcodes.php	2006-11-06 04:00:52.000000000 -0600
@@ -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.15 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.19 $
+|     $Date: 2006/11/06 10:00:52 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -38,6 +38,7 @@
 }else{
 	$comrow['user_id'] = 0;
 	$USERNAME = preg_replace("/[0-9]+\./", '', $comrow['comment_author']);
+	$USERNAME = str_replace("Anonymous", LAN_ANONYMOUS, $USERNAME);
 }
 return $USERNAME;
 SC_END
@@ -53,7 +54,7 @@
 $REPLY = '';
 if($comrow['comment_lock'] != "1"){
 	if ($thisaction == "comment" && $pref['nested_comments']) {
-		$REPLY = "<a href='".e_BASE."comment.php?reply.".$thistable.".".$comrow['comment_id'].".".$thisid."'>".COMLAN_6."</a>";
+		$REPLY = "<a href='".e_BASE."comment.php?reply.".$thistable.".".$comrow['comment_id'].".".$thisid."'>".COMLAN_326."</a>";
 	}
 }
 return $REPLY;
@@ -77,7 +78,7 @@
 
 SC_BEGIN COMMENTS
 global $COMMENTS, $comrow;
-return (isset($comrow['user_id']) && $comrow['user_id'] ? LAN_99.": ".$comrow['user_comments'] : LAN_194)."<br />";
+return (isset($comrow['user_id']) && $comrow['user_id'] ? COMLAN_99.": ".$comrow['user_comments'] : COMLAN_194)."<br />";
 SC_END
 
 SC_BEGIN JOINED
@@ -85,19 +86,33 @@
 $JOINED = '';
 if ($comrow['user_id'] && !$comrow['user_admin']) {
 	$comrow['user_join'] = $gen->convert_date($comrow['user_join'], "short");
-	$JOINED = ($comrow['user_join'] ? LAN_145." ".$comrow['user_join'] : '');
+	$JOINED = ($comrow['user_join'] ? COMLAN_145." ".$comrow['user_join'] : '');
 }
 return $JOINED;
 SC_END
 
 SC_BEGIN COMMENT
 global $COMMENT, $comrow, $tp, $pref;
-return (isset($comrow['comment_blocked']) && $comrow['comment_blocked'] ? LAN_0 : $tp->toHTML($comrow['comment_comment'], TRUE, FALSE, $comrow['user_id']));
+return (isset($comrow['comment_blocked']) && $comrow['comment_blocked'] ? COMLAN_0 : $tp->toHTML($comrow['comment_comment'], TRUE, FALSE, $comrow['user_id']));
 SC_END
 
 SC_BEGIN COMMENTEDIT
 global $COMMENTEDIT, $pref, $comrow;
-return ($pref['allowCommentEdit'] && (ADMIN || (USER && $comrow['user_id'] == USERID && $comrow['comment_lock'] != "1")) && !strstr(e_QUERY, "edit") ? "<a href='".e_SELF."?".e_QUERY.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".LAN_318."' title='".LAN_318."' style='border: 0;' /></a>" : "");
+if ($pref['allowCommentEdit'] && USER && $comrow['user_id'] == USERID && $comrow['comment_lock'] != "1")
+{
+	if (!strstr(e_QUERY, "."))
+	{
+		return "<a href='".e_SELF."?".e_QUERY."&amp;comment=edit&amp;comment_id=".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
+	}
+	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>";
+	}
+}
+else
+{
+	return "";
+}
 SC_END
 
 SC_BEGIN RATING
@@ -108,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']."'>IP: ".decode_ip($comrow['comment_ip'])."</a>" : "");
+return (ADMIN ? "<a href='".e_BASE."userposts.php?0.comments.".$comrow['comment_ip']."'>".COMLAN_330." ".decode_ip($comrow['comment_ip'])."</a>" : "");
 SC_END
 
 SC_BEGIN LEVEL
@@ -119,7 +134,7 @@
 
 SC_BEGIN LOCATION
 global $LOCATION, $comrow, $tp;
-return (isset($comrow['user_location']) && $comrow['user_location'] ? LAN_313.": ".$tp->toHTML($comrow['user_location'], TRUE) : '');
+return (isset($comrow['user_location']) && $comrow['user_location'] ? COMLAN_313.": ".$tp->toHTML($comrow['user_location'], TRUE) : '');
 SC_END
 
 SC_BEGIN SIGNATURE
diff -ruN 0.7.5/e107_files/shortcode/batch/contact_shortcodes.php 0.7.7/e107_files/shortcode/batch/contact_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/contact_shortcodes.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/batch/contact_shortcodes.php	2006-10-24 08:38:46.000000000 -0500
@@ -0,0 +1,65 @@
+<?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_files/shortcode/batch/contact_shortcodes.php,v $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/24 13:38:46 $
+|     $Author: mrpete $
++----------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+include_once(e_HANDLER.'shortcode_handler.php');
+$contact_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+/*
+SC_BEGIN CONTACT_EMAIL_COPY
+global $pref;
+if(!isset($pref['contact_emailcopy']) || !$pref['contact_emailcopy'])
+{
+	return;
+}
+return "<input type='checkbox' name='email_copy'  value='1'  />";
+SC_END
+
+SC_BEGIN CONTACT_PERSON
+global $sql,$tp,$pref;
+if($pref['sitecontacts'] == e_UC_ADMIN){
+	$query = "user_admin =1";
+}elseif($pref['sitecontacts'] == e_UC_MAINADMIN){
+    $query = "user_admin = 1 AND (user_perms = '0' OR user_perms = '0.') ";
+}else{
+	$query = "FIND_IN_SET(".$pref['sitecontacts'].",user_class) ";
+}
+
+$text = "<select name='contact_person' class='tbox contact_person'>\n";
+$count = $sql -> db_Select("user", "user_id,user_name", $query . " ORDER BY user_name");
+if($count > 1){
+    while($row = $sql-> db_Fetch())
+	{
+    	$text .= "<option value='".$row['user_id']."'>".$row['user_name']."</option>\n";
+    }
+}else{
+	return;
+}
+$text .= "</select>";
+return $text;
+SC_END
+
+
+SC_BEGIN CONTACT_IMAGECODE
+global $sec_img;
+return "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />".$sec_img->r_image();
+SC_END
+
+SC_BEGIN CONTACT_IMAGECODE_INPUT
+return "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
+SC_END
+
+*/
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/batch/download_shortcodes.php 0.7.7/e107_files/shortcode/batch/download_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/download_shortcodes.php	2006-01-15 20:37:30.000000000 -0600
+++ 0.7.7/e107_files/shortcode/batch/download_shortcodes.php	2006-11-26 20:23:16.000000000 -0600
@@ -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.8 $
-|     $Date: 2006/01/16 02:37:30 $
-|     $Author: e107coders $
+|     $Revision: 1.19 $
+|     $Date: 2006/11/27 02:23:16 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -21,8 +21,23 @@
 $download_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
 /*
 SC_BEGIN DOWNLOAD_LIST_NAME
-global $row,$tp;
-return  "<a href='".e_SELF."?view.".$row['download_id']."'>".$tp->toHTML($row['download_name'])."</a>";
+global $row,$tp,$pref;
+if($parm == "nolink"){
+	return $tp->toHTML($row['download_name'],TRUE,"no_hook");
+}
+if($parm == "request"){
+
+	$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{
+		$text = ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."request.php?".$row['download_id']."' title='".LAN_dl_32."'>");
+	}
+	$text .= $tp->toHTML($row['download_name'])."</a>";
+	return $text;
+}
+
+return  "<a href='".e_BASE."download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name'],TRUE,"no_hook")."</a>";
 SC_END
 
 
@@ -42,7 +57,7 @@
 global $row;
 $img = "<img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' title='".LAN_dl_32."' />";
 if($parm == "link"){
-	return "<a href='".e_SELF."?view.".$row['download_id']."' >".$img."</a>";
+	return "<a href='".e_BASE."download.php?view.".$row['download_id']."' >".$img."</a>";
 }else{
 	return $img;
 }
@@ -73,7 +88,7 @@
 global $row;
 $img = ($row['download_thumb']) ? "<img src='".e_FILE."downloadthumbs/".$row['download_thumb']."' alt='' style='".DL_IMAGESTYLE."' />" : "";
 if($parm == "link" && $row['download_thumb']){
-	return "<a href='".e_SELF."?view.".$row['download_id']."'>".$img."</a>";
+	return "<a href='".e_BASE."download.php?view.".$row['download_id']."'>".$img."</a>";
 }else{
 	return $img;
 }
@@ -100,14 +115,390 @@
 
 SC_BEGIN DOWNLOAD_LIST_LINK
 global $tp,$row,$pref;
-$agreetext = $tp->toJS($pref['agree_text']);
+$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc defs"));
 	if($row['download_mirror_type']){
-		return ($pref['agree_flag'] ? "<a href='".e_SELF."?mirror.".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_SELF."?mirror.".$row['download_id']."' >");
+		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{
 		return ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."request.php?".$row['download_id']."' >");
 	}
 SC_END
 
 
+
+// ---------------------- Download View ----------------------------------------
+
+SC_BEGIN DOWNLOAD_VIEW_ID
+global $dl;
+return $dl['download_id'];
+SC_END
+
+
+SC_BEGIN DOWNLOAD_ADMIN_EDIT
+global $dl;
+return (ADMIN && getperms('6')) ? "<a href='".e_ADMIN."download.php?create.edit.".$dl['download_id']."' title='edit'><img src='".e_IMAGE."generic/lite/edit.png' alt='' style='padding:0px;border:0px' /></a>" : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_CATEGORY
+global $dl;
+return $dl['download_category_name'];
+SC_END
+
+SC_BEGIN DOWNLOAD_CATEGORY_ICON
+global $dl;
+list($present,$missing) = explode(chr(1),$dl['download_category_icon']);
+if($present)
+{
+	return "<img class='dl_cat_icon' src='".e_IMAGE."icons/".$present."' alt='' />";
+}
+
+SC_END
+
+SC_BEGIN DOWNLOAD_CATEGORY_DESCRIPTION
+global $tp,$dl;
+$text = $tp -> toHTML($dl['download_category_description'], TRUE);
+if($parm){
+	return substr($text,0,$parm);
+}else{
+	return $text;
+}
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_NAME
+global $dl;
+$link['view'] = "<a href='".e_BASE."download.php?view.".$dl['download_id']."'>".$dl['download_name']."</a>";
+$link['request'] = "<a href='".e_BASE."request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
+
+if($parm){
+	return $link[$parm];
+}
+return $dl['download_name'];
+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>";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_AUTHOR
+global $dl;
+return ($dl['download_author'] ? $dl['download_author'] : "");
+SC_END
+
+
+SC_BEGIN DOWNLOAD_VIEW_AUTHOREMAIL
+global $tp,$dl;
+return ($dl['download_author_email']) ? $tp -> toHTML($dl['download_author_email'], TRUE) : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_AUTHORWEBSITE
+global $tp,$dl;
+return ($dl['download_author_website']) ? $tp -> toHTML($dl['download_author_website'], TRUE) : "";
+SC_END
+
+
+
+SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION
+global $tp, $dl;
+$maxlen = ($parm ? intval($parm) : 0);
+$text = ($dl['download_description'] ?  $tp->toHTML($dl['download_description'], TRUE) : "");
+if($maxlen){
+	return substr($text, 0, $maxlen);
+}else{
+	return $text;
+}
+return $text;
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_DATE
+global $gen,$dl;
+return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], $parm) : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_DATE_SHORT
+// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
+global $gen,$dl;
+return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], "short") : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_DATE_LONG
+// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
+global $gen,$dl;
+return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], "long") : "";
+SC_END
+
+
+
+SC_BEGIN DOWNLOAD_VIEW_IMAGE
+global $dl;
+if ($dl['download_thumb']) {
+	return ($dl['download_image'] ? "<a href='".e_BASE."request.php?download.".$dl['download_id']."'><img class='dl_image' src='".e_FILE."downloadthumbs/".$dl['download_thumb']."' alt='' style='".DL_IMAGESTYLE."' /></a>" : "<img class='dl_image' src='".e_FILE."downloadthumbs/".$dl['download_thumb']."' alt='' style='".DL_IMAGESTYLE."' />");
+}
+else if($dl['download_image']) {
+	return "<a href='".e_BASE."request.php?download.".$dl['download_id']."'>".LAN_dl_40."</a>";
+}
+else
+{
+	return LAN_dl_75;
+}
+
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_IMAGEFULL
+global $dl;
+return ($dl['download_image']) ? "<img class='dl_image' src='".e_FILE."downloadimages/".$dl['download_image']."' alt='' style='".DL_IMAGESTYLE."' />" : "";
+SC_END
+
+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"))."');\">";
+} else {
+	$dnld_link = "<a href='".e_BASE."request.php?".$dl['download_id']."'>";
+}
+
+if($dl['download_mirror'])
+{
+	if($dl['download_mirror_type'])
+	{
+		return "<a href='".e_BASE."download.php?mirror.".$dl['download_id']."'>".LAN_dl_66."</a>";
+	}
+	else
+	{
+		return $dnld_link." <img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
+	}
+}
+else
+{
+	return $dnld_link." <img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
+}
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_FILESIZE
+global $dl;
+return ($dl['download_filesize']) ? parsesize($dl['download_filesize']) : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_RATING
+	require_once(e_HANDLER."rate_class.php");
+	$rater = new rater;
+global $dl;
+	$text = "
+		<table style='width:100%'>
+		<tr>
+		<td style='width:50%'>";
+
+	if ($ratearray = $rater->getrating("download", $dl['download_id'])) {
+		for($c = 1; $c <= $ratearray[1]; $c++) {
+			$text .= "<img src='".e_IMAGE."rate/".IMODE."/star.png' alt='' />";
+		}
+		if ($ratearray[2]) {
+			$text .= "<img src='".e_IMAGE."rate/".IMODE."/".$ratearray[2].".png'  alt='' />";
+		}
+		if ($ratearray[2] == "") {
+			$ratearray[2] = 0;
+		}
+		$text .= "&nbsp;".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]."&nbsp;";
+		$text .= ($ratearray[0] == 1 ? LAN_dl_43 : LAN_dl_44);
+	} else {
+		$text .= LAN_dl_13;
+	}
+	$text .= "</td><td style='width:50%; text-align:right'>";
+
+	if (!$rater->checkrated("download", $dl['download_id']) && USER) {
+		$text .= $rater->rateselect("&nbsp;&nbsp;&nbsp;&nbsp; <b>".LAN_dl_14, "download", $dl['download_id'])."</b>";
+	}
+	else if(!USER) {
+		$text .= "&nbsp;";
+	} else {
+		$text .= LAN_dl_15;
+	}
+	$text .= "</td></tr></table>";
+return $text;
+SC_END
+
+SC_BEGIN DOWNLOAD_REPORT_LINK
+global $dl,$pref;
+return (check_class($pref['download_reportbroken'])) ? "<a href='".e_BASE."download.php?report.".$dl['download_id']."'>".LAN_dl_45."</a>" : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_CAPTION
+global $dl;
+	$text = $dl['download_category_name'];
+	$text .= ($dl['download_category_description']) ? " [ ".$dl['download_category_description']." ]" : "";
+return $text;
+SC_END
+
+
+// --------- Download View Lans -----------------------------
+
+SC_BEGIN DOWNLOAD_VIEW_AUTHOR_LAN
+global $dl;
+return ($dl['download_author']) ? LAN_dl_24 : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_AUTHOREMAIL_LAN
+global $dl;
+return ($dl['download_author_email']) ? LAN_dl_30 : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_AUTHORWEBSITE_LAN
+global $dl;
+return ($dl['download_author_website']) ? LAN_dl_31 : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_DATE_LAN
+global $dl;
+return ($dl['download_datestamp']) ? LAN_dl_22 : "";
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_IMAGE_LAN
+return LAN_dl_11;
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_REQUESTED
+global $dl;
+return $dl['download_requested'];
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_RATING_LAN
+return LAN_dl_12;
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_FILESIZE_LAN
+return LAN_dl_10;
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION_LAN
+return LAN_dl_7;
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_REQUESTED_LAN
+return LAN_dl_18;
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_LINK_LAN
+return LAN_dl_32;
+SC_END
+
+
+
+//  -----------  Download View : Previous and Next  ---------------
+
+SC_BEGIN DOWNLOAD_VIEW_PREV
+global $dl,$sql;
+
+	$dl_id = intval($dl['download_id']);
+
+	if ($sql->db_Select("download", "*", "download_category='".intval($dl['download_category_id'])."' AND download_id < {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC LIMIT 1")) {
+		$row = $sql->db_Fetch();
+		return "<a href='".e_BASE."download.php?view.".$row['download_id']."'>&lt;&lt; ".LAN_dl_33." [".$row['download_name']."]</a>\n";
+	} else {
+		return "&nbsp;";
+	}
+SC_END
+
+SC_BEGIN DOWNLOAD_VIEW_NEXT
+global $dl,$sql;
+$dl_id = intval($dl['download_id']);
+	if ($sql->db_Select("download", "*", "download_category='".intval($dl['download_category_id'])."' AND download_id > {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC LIMIT 1")) {
+		$row = $sql->db_Fetch();
+		 extract($row);
+		return "<a href='".e_BASE."download.php?view.".$row['download_id']."'>[".$row['download_name']."] ".LAN_dl_34." &gt;&gt;</a>\n";
+	} else {
+		return "&nbsp;";
+	}
+SC_END
+
+
+SC_BEGIN DOWNLOAD_BACK_TO_LIST
+global $dl;
+return "<a href='".e_BASE."download.php?list.".$dl['download_category']."'>".LAN_dl_35."</a>";
+SC_END
+
+
+//  ---------------   Download - Admin  -----------------------------------
+
+SC_BEGIN DOWNLOAD_CATEGORY_SELECT
+	global $sql;
+	$cdc = $parm;
+
+      	$boxinfo = "\n";
+	  	$qry = "
+	  	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";
+
+  	  	if (!$sql->db_Select_gen($qry))
+	  	{
+	    	return "Error reading categories<br />";
+	    	exit;
+	  	}
+
+	  	$boxinfo .= "<select name='download_category' class='tbox'>
+					<option value=''>&nbsp;</option>\n";
+
+		// Its a structured display option - need a 2-step process to create a tree
+	    $catlist = array();
+	    while ($row = $sql->db_Fetch())
+	    {
+			$tmp = $row['download_category_parent'];
+	      	if ($tmp == '0')
+	      	{
+		    	$row['subcats'] = array();
+	        	$catlist[$row['download_category_id']] = $row;
+	      	}
+	      	else
+	      	{
+	        	if (isset($catlist[$tmp]))
+		    	{  // Sub-Category
+		      		$catlist[$tmp]['subcats'][$row['download_category_id']] = $row;
+		      		$catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array();
+		    	}
+		    	else
+		    	{  // Its a sub-sub category
+		      		if (isset($catlist[$row['d_parent1']]['subcats'][$tmp]))
+		      		{
+		        		$catlist[$row['d_parent1']]['subcats'][$tmp]['subsubcats'][$row['download_category_id']] = $row;
+		      		}
+		    	}
+	      	}
+	    }
+
+		// Now generate the options
+	    foreach ($catlist as $thiscat)
+	    {  // Main categories
+			// Could add a display class to the group, but the default looked OK
+			$boxinfo .= "<optgroup label='".htmlspecialchars($thiscat['download_category_name'])."'>\n";
+		  	$scprefix = '';
+
+	      	foreach ($thiscat['subcats'] as $sc)
+	      	{  // Sub-categories
+		    	$sscprefix = '--> ';
+		    	$boxinfo .= "<option value='".$sc['download_category_id']."'";
+		    	if ($cdc == $sc['download_category_id']) { $boxinfo .= " selected='selected'"; }
+		   		$boxinfo .= ">".$scprefix.htmlspecialchars($sc['download_category_name'])."</option>\n";
+		    	foreach ($sc['subsubcats'] as $ssc)
+		    	{  // Sub-sub categories
+		      		$boxinfo .= "<option value='".$ssc['download_category_id']."'";
+		      		if ($cdc == $ssc['download_category_id']) { $boxinfo .= " selected='selected'"; }
+		      		$boxinfo .= ">".htmlspecialchars($sscprefix.$ssc['download_category_name'])."</option>\n";
+		    	}
+	      	}
+			$boxinfo .= "</optgroup>\n";
+	    }
+
+	  $boxinfo .= "</select>\n";
+	  return $boxinfo;
+
+SC_END
+
+
+
+
+
+
 */
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_files/shortcode/batch/news_shortcodes.php 0.7.7/e107_files/shortcode/batch/news_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/news_shortcodes.php	2006-04-26 07:54:28.000000000 -0500
+++ 0.7.7/e107_files/shortcode/batch/news_shortcodes.php	2006-11-11 22:04:59.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/news_shortcodes.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2006/04/26 12:54:28 $
-|     $Author: sweetas $
+|     $Revision: 1.25 $
+|     $Date: 2006/11/12 04:04:59 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -24,7 +24,7 @@
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return $tp -> toHTML($news_item['news_title'], TRUE, 'parse_sc');
+return $tp -> toHTML($news_item['news_title'], TRUE, 'parse_sc,no_hook,emotes_off, no_make_clickable');
 SC_END
 
 SC_BEGIN NEWSBODY
@@ -46,7 +46,7 @@
 $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>";
 SC_END
-	
+
 SC_BEGIN NEWSHEADER
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
@@ -57,7 +57,7 @@
 	return e_IMAGE."icons/".$category_icon;
 }
 SC_END
-	
+
 SC_BEGIN NEWSCATEGORY
 global $tp;
 $news_item = getcachedvars('current_news_item');
@@ -65,7 +65,7 @@
 $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>";
 SC_END
-	
+
 SC_BEGIN NEWSAUTHOR
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
@@ -82,7 +82,7 @@
 }
 return "<a href='http://e107.org'>e107</a>";
 SC_END
-	
+
 SC_BEGIN NEWSDATE
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
@@ -105,7 +105,7 @@
 	default :
 		return date($parm, $news_item['news_datestamp']);
 		break;
-}	
+}
 SC_END
 
 SC_BEGIN NEWSCOMMENTS
@@ -141,14 +141,14 @@
 return $news_item['news_comment_total'];
 SC_END
 
-	
+
 SC_BEGIN EMAILICON
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 require_once(e_HANDLER.'emailprint_class.php');
 return emailprint::render_emailprint('news', $news_item['news_id'], 1);
 SC_END
-	
+
 SC_BEGIN PRINTICON
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
@@ -167,18 +167,18 @@
 $param = getcachedvars('current_news_param');
 return $news_item['news_id'];
 SC_END
-	
+
 SC_BEGIN ADMINOPTIONS
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 if (ADMIN && getperms("H")) {
-	$adop_icon = (file_exists(THEME."generic/newsedit.png") ? THEME."generic/newsedit.png" : e_IMAGE."generic/".IMODE."/newsedit.png");
+	$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME."images/newsedit.png" : e_IMAGE."generic/".IMODE."/newsedit.png");
 	return " <a href='".e_BASE.e_ADMIN."newspost.php?create.edit.".$news_item['news_id']."'><img src='".$adop_icon."' alt='' style='border:0' /></a>\n";
 } else {
 	return '';
 }
 SC_END
-	
+
 SC_BEGIN EXTENDED
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
@@ -198,23 +198,23 @@
 	return "";
 }
 SC_END
-	
+
 SC_BEGIN CAPTIONCLASS
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$news_title = $tp -> toHTML($news_item['news_title'], TRUE);
+$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
 return "<div class='category".$news_item['news_category']."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
 SC_END
-	
+
 SC_BEGIN ADMINCAPTION
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$news_title = $tp -> toHTML($news_item['news_title'], TRUE);
+$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
 return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
 SC_END
-	
+
 SC_BEGIN ADMINBODY
 global $tp, $news_shortcodes;
 $news_item = getcachedvars('current_news_item');
@@ -222,13 +222,13 @@
 $news_body = $tp -> parseTemplate('{NEWSBODY}', FALSE, $news_shortcodes);
 return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".$news_body."</div>";
 SC_END
-	
+
 SC_BEGIN NEWSSUMMARY
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 return ($news_item['news_summary']) ? $news_item['news_summary']."<br />" : "";
 SC_END
-	
+
 SC_BEGIN NEWSTHUMBNAIL
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
@@ -240,19 +240,19 @@
 $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>" : "";
 SC_END
-	
+
 SC_BEGIN STICKY_ICON
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 return $news_item['news_sticky'] ? $param['image_sticky'] : "";
 SC_END
-	
+
 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>";
 SC_END
-	
+
 SC_BEGIN NEWSCATICON
 global $tp, $news_shortcodes;
 $news_item = getcachedvars('current_news_item');
@@ -261,7 +261,7 @@
 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>";
 SC_END
-	
+
 SC_BEGIN TRACKBACK
 global $pref;
 $news_item = getcachedvars('current_news_item');
@@ -285,7 +285,7 @@
 $info .= $news_item['news_sticky'] ? "<br />".LAN_NEWS_31 : "";
 $info .= "<br />".($news_item['news_allow_comments'] ? LAN_NEWS_13 : LAN_NEWS_12);
 $info .= LAN_NEWS_14.$news_item['news_start'].$news_item['news_end']."<br />";
-$info .= LAN_NEWS_15.strlen($news_item['news_body']).LAN_NEWS_16.strlen($news_item['news_extended']).LAN_NEWS_17."<br /><br /></div>";
+$info .= LAN_NEWS_15.strlen($news_item['news_body']).LAN_NEWS_16.strlen($news_item['news_extended']).LAN_NEWS_17."<br /><br />";
 return $ns -> tablerender(LAN_NEWS_18, $info);
 SC_END
 */
diff -ruN 0.7.5/e107_files/shortcode/batch/signup_shortcodes.php 0.7.7/e107_files/shortcode/batch/signup_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/signup_shortcodes.php	2006-05-05 01:40:20.000000000 -0500
+++ 0.7.7/e107_files/shortcode/batch/signup_shortcodes.php	2006-08-25 10:14:58.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/signup_shortcodes.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/05/05 06:40:20 $
+|     $Revision: 1.6 $
+|     $Date: 2006/08/25 15:14:58 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -34,7 +34,7 @@
 <input type='radio' name='coppa' value='0' checked='checked' /> ".LAN_200."
 <input type='radio' name='coppa' value='1' /> ".LAN_201."<br />
 <br />
-<input class='button' type='submit' name='newver' value='".LAN_399."' />
+<input class='button' type='submit' name='newver' value=\"".LAN_399."\" />
 </div></form>
 ";
 }
@@ -121,7 +121,7 @@
 
 SC_BEGIN SIGNUP_HIDE_EMAIL
 global $rs;
-return $rs->form_radio("hideemail", 1)." ".LAN_SIGNUP_10."&nbsp;&nbsp;".$rs->form_radio("hideemail", 0, 1)." ".LAN_200;
+return $rs->form_radio("hideemail", 0, 1)." ".LAN_SIGNUP_10."&nbsp;&nbsp;".$rs->form_radio("hideemail", 0)." ".LAN_200;
 SC_END
 
 
@@ -177,8 +177,8 @@
 if($pref['signup_option_signature'])
 {
 	require_once(e_HANDLER."ren_help.php");
-	$SIGNUP_SIGNATURE_START = str_replace("{REN_HELP}", ren_help(2), $SIGNUP_SIGNATURE_START);
-	$SIGNUP_SIGNATURE_END = str_replace("{REN_HELP}", ren_help(2), $SIGNUP_SIGNATURE_END);
+	$SIGNUP_SIGNATURE_START = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_START);
+	$SIGNUP_SIGNATURE_END = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_END);
 	$sig = ($_POST['signature'] ? $_POST['signature'] : $signature);
 	return $SIGNUP_SIGNATURE_START.$sig.$SIGNUP_SIGNATURE_END;
 }
diff -ruN 0.7.5/e107_files/shortcode/batch/sitedown_shortcodes.php 0.7.7/e107_files/shortcode/batch/sitedown_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/sitedown_shortcodes.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/batch/sitedown_shortcodes.php	2006-06-29 23:16:39.000000000 -0500
@@ -0,0 +1,39 @@
+<?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_files/shortcode/batch/sitedown_shortcodes.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/06/30 04:16:39 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+include_once(e_HANDLER.'shortcode_handler.php');
+$sitedown_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+/*
+
+SC_BEGIN SITEDOWN_TABLE_MAINTAINANCETEXT
+global $pref,$tp;
+if($pref['maintainance_text']) {
+	return $tp->toHTML($pref['maintainance_text'], TRUE, 'parse_sc', 'admin');
+} else {
+	return "<b>- ".SITENAME." ".LAN_SITEDOWN_00." -</b><br /><br />".LAN_SITEDOWN_01 ;
+}
+SC_END
+
+
+SC_BEGIN SITEDOWN_TABLE_PAGENAME
+return PAGE_NAME;
+SC_END
+
+*/
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/batch/user_shortcodes.php 0.7.7/e107_files/shortcode/batch/user_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/user_shortcodes.php	2006-02-22 19:02:13.000000000 -0600
+++ 0.7.7/e107_files/shortcode/batch/user_shortcodes.php	2006-10-14 18:41:11.000000000 -0500
@@ -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.16 $
-|     $Date: 2006/02/23 01:02:13 $
-|     $Author: whoisrich $
+|     $Revision: 1.22 $
+|     $Date: 2006/10/14 23:41:11 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -66,6 +66,12 @@
 return $user['user_chats'];
 SC_END
 
+SC_BEGIN USER_DOWNLOADS
+global $sql,$user;
+$downloads = $sql->db_Count("download_requests","(*)","where download_request_userid=".$user['user_id']);
+return $downloads;
+SC_END
+
 SC_BEGIN USER_CHATPER
 global $sql, $user;
 if(!$chatposts = getcachedvars('total_chatposts'))
@@ -147,9 +153,9 @@
 {
 	return USER_REALNAME_ICON;
 }
-if(file_exists(THEME."generic/user_realname.png"))
+if(file_exists(THEME."images/user_realname.png"))
 {
-	return "<img src='".THEME_ABS."generic/user_realname.png' alt='' style='border:0px;vertical-align:middle;' /> ";
+	return "<img src='".THEME_ABS."images/user_realname.png' alt='' style='border:0px;vertical-align:middle;' /> ";
 }
 return "<img src='".e_IMAGE_ABS."user_icons/user_realname_".IMODE.".png' alt='' style='border:0px;vertical-align:middle;' /> ";
 SC_END
@@ -164,9 +170,9 @@
 {
 	return USER_EMAIL_ICON;
 }
-if(file_exists(THEME."generic/email.png"))
+if(file_exists(THEME."images/email.png"))
 {
-	return "<img src='".THEME_ABS."generic/email.png' alt='' style='vertical-align:middle;' /> ";
+	return "<img src='".THEME_ABS."images/email.png' alt='' style='vertical-align:middle;' /> ";
 }
 return "<img src='".e_IMAGE_ABS."generic/".IMODE."/email.png' alt='' style='vertical-align:middle;' /> ";
 SC_END
@@ -178,7 +184,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'],"no_replace");
 SC_END
 
 SC_BEGIN USER_ICON
@@ -186,9 +192,9 @@
 {
 	return USER_ICON;
 }
-if(file_exists(THEME."generic/user.png"))
+if(file_exists(THEME."images/user.png"))
 {
-	return "<img src='".THEME_ABS."generic/user.png' alt='' style='border:0px;vertical-align:middle;' /> ";
+	return "<img src='".THEME_ABS."images/user.png' alt='' style='border:0px;vertical-align:middle;' /> ";
 }
 return "<img src='".e_IMAGE_ABS."user_icons/user_".IMODE.".png' alt='' style='border:0px;vertical-align:middle;' /> ";
 SC_END
@@ -199,9 +205,9 @@
 {
 	$icon = USER_ICON;
 }
-else if(file_exists(THEME."generic/user.png"))
+else if(file_exists(THEME."images/user.png"))
 {
-	$icon = "<img src='".THEME_ABS."generic/user.png' alt='' style='border:0px;vertical-align:middle;' /> ";
+	$icon = "<img src='".THEME_ABS."images/user.png' alt='' style='border:0px;vertical-align:middle;' /> ";
 }
 else
 {
@@ -237,9 +243,9 @@
 {
 	return USER_BIRTHDAY_ICON;
 }
-if(file_exists(THEME."generic/user_birthday.png"))
+if(file_exists(THEME."images/user_birthday.png"))
 {
-	return "<img src='".THEME_ABS."generic/user_birthday.png' alt='' style='vertical-align:middle;' /> ";
+	return "<img src='".THEME_ABS."images/user_birthday.png' alt='' style='vertical-align:middle;' /> ";
 }
 return "<img src='".e_IMAGE_ABS."user_icons/user_birthday_".IMODE.".png' alt='' style='vertical-align:middle;' /> ";
 SC_END
@@ -356,6 +362,19 @@
 }
 SC_END
 
+SC_BEGIN USER_AVATAR
+global $user, $tp;
+if ($user['user_image'])
+{
+	return $tp->parseTemplate("{USER_AVATAR=".$user['user_image']."}", true);
+}
+else
+{
+	return LAN_408;
+}
+SC_END
+
+
 SC_BEGIN USER_PICTURE_NAME
 global $user;
 if (ADMIN && getperms("4"))
@@ -376,15 +395,18 @@
 SC_END
 
 SC_BEGIN USER_EXTENDED_ALL
+
 global $user, $tp, $sql;
 global $EXTENDED_CATEGORY_START, $EXTENDED_CATEGORY_END, $EXTENDED_CATEGORY_TABLE;
-$qry = "
-	SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f
+$qry = "SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f
 	LEFT JOIN #user_extended_struct as c ON f.user_extended_struct_parent = c.user_extended_struct_id
 	ORDER BY c.user_extended_struct_order ASC, f.user_extended_struct_order ASC
 ";
 
+
+
 require_once(e_HANDLER."user_extended_class.php");
+
 $ue = new e107_user_extended;
 $ueCatList = $ue->user_extended_get_categories();
 $ueFieldList = $ue->user_extended_get_fields();
@@ -393,21 +415,22 @@
 foreach($ueCatList as $catnum => $cat)
 {
 	$key = $cat[0]['user_extended_struct_name'];
-	$cat_name = $tp->parseTemplate("{EXTENDED={$key}.text.{$user['user_id']}}", TRUE);
+	$cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$user['user_id']}}", TRUE);
 	if($cat_name != FALSE && count($ueFieldList[$catnum]))
 	{
+
 		$ret .= str_replace("{EXTENDED_NAME}", $key, $EXTENDED_CATEGORY_START);
 		foreach($ueFieldList[$catnum] as $f)
 		{
 			$key = $f['user_extended_struct_name'];
-			if($ue_name = $tp->parseTemplate("{EXTENDED={$key}.text.{$user['user_id']}}", TRUE))
+			if($ue_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$user['user_id']}}", TRUE))
 			{
-				$extended_record = str_replace("EXTENDED_ICON","EXTENDED={$key}.icon", $EXTENDED_CATEGORY_TABLE);
+				$extended_record = str_replace("EXTENDED_ICON","USER_EXTENDED={$key}.icon", $EXTENDED_CATEGORY_TABLE);
 			 	$extended_record = str_replace("{EXTENDED_NAME}", $tp->toHTML($ue_name,"","defs"), $extended_record);
-				$extended_record = str_replace("EXTENDED_VALUE","EXTENDED={$key}.value.{$user['user_id']}", $extended_record);
+				$extended_record = str_replace("EXTENDED_VALUE","USER_EXTENDED={$key}.value.{$user['user_id']}", $extended_record);
 				if(HIDE_EMPTY_FIELDS === TRUE)
 				{
-					$this_value = $tp->parseTemplate("{EXTENDED={$key}.value.{$user['user_id']}}", TRUE);
+					$this_value = $tp->parseTemplate("{USER_EXTENDED={$key}.value.{$user['user_id']}}", TRUE);
 					if($this_value != "")
 					{
 						$ret .= $tp->parseTemplate($extended_record, TRUE);
@@ -448,7 +471,7 @@
 			$ret .= $cobj->render_comment($row);
 		}
 	}
-	return $ns->tablerender(LAN_5, $ret, 'profile_comments', TRUE);
+	return $ns->tablerender(COMLAN_5, $ret, 'profile_comments', TRUE);
 }
 return "";
 SC_END
@@ -462,11 +485,67 @@
 	$ret = "";
 	if(ADMIN === TRUE)
 	{
-		$ret .= "<a href='".e_BASE.e_ADMIN."modcomment.php?profile.{$user['user_id']}'>".LAN_314."</a><br /><br />";
+		$ret .= "<a href='".e_BASE.e_ADMIN."modcomment.php?profile.{$user['user_id']}'>".COMLAN_314."</a><br /><br />";
 	}
 	$ret .= $cobj->form_comment("comment", "profile", $user['user_id'], "", "", TRUE);
 	return $ret;
 }
 SC_END
+
+SC_BEGIN TOTAL_USERS
+global $users_total;
+return $users_total;
+SC_END
+
+SC_BEGIN USER_FORM_RECORDS
+global $records, $user_frm;
+$ret = $user_frm->form_select_open("records");
+for($i=10; $i<=30; $i+=10)
+{
+	$sel = ($i == $records ? true: false);
+	$ret .= $user_frm->form_option($i, $sel, $i);
+}
+$ret .= $user_frm->form_select_close();
+return $ret;
+SC_END
+
+
+SC_BEGIN USER_FORM_ORDER
+global $order;
+if ($order == "ASC")
+{
+	$ret = "<select name='order' class='tbox'>
+	<option value='DESC'>".LAN_420."</option>
+	<option value='ASC' selected='selected'>".LAN_421."</option>
+	</select>";
+}
+else
+{
+	$ret = "<select name='order' class='tbox'>
+	<option value='DESC' selected='selected'>".LAN_420."</option>
+	<option value='ASC'>".LAN_421."</option>
+	</select>";
+}
+return $ret;
+SC_END
+
+
+SC_BEGIN USER_FORM_START
+global $from;
+return "
+<form method='post' action='".e_SELF."'>
+<input type='hidden' name='from' value='$from' />
+";
+SC_END
+
+SC_BEGIN USER_FORM_END
+return "</form>";
+SC_END
+
+SC_BEGIN USER_FORM_SUBMIT
+return "<input class='button' type='submit' name='submit' value='".LAN_422."' />";
+SC_END
+
+
 */
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_files/shortcode/batch/usersettings_shortcodes.php 0.7.7/e107_files/shortcode/batch/usersettings_shortcodes.php
--- 0.7.5/e107_files/shortcode/batch/usersettings_shortcodes.php	2006-05-15 22:11:13.000000000 -0500
+++ 0.7.7/e107_files/shortcode/batch/usersettings_shortcodes.php	2006-10-25 10:27: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.18 $
-|     $Date: 2006/05/16 03:11:13 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.21 $
+|     $Date: 2006/10/25 15:27:19 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -58,17 +58,31 @@
 SC_END
 
 SC_BEGIN PASSWORD1
-global $rs, $curVal;
-return $rs->form_password("password1", 40, "", 20);
+global $rs, $curVal, $pref;
+if(!isset($pref['auth_method']) || $pref['auth_method'] == '' || $pref['auth_method'] == 'e107' || $pref['auth_method'] == '>e107')
+{
+	return $rs->form_password("password1", 40, "", 20);
+}
+
+return "";
 SC_END
 
 SC_BEGIN PASSWORD2
-global $rs, $curVal;
-return $rs->form_password("password2", 40, "", 20);
+global $rs, $curVal, $pref;
+if(!isset($pref['auth_method']) || $pref['auth_method'] == '' || $pref['auth_method'] == 'e107' || $pref['auth_method'] == '>e107')
+{
+	return $rs->form_password("password2", 40, "", 20);
+}
+
+return "";
 SC_END
 
 SC_BEGIN PASSWORD_LEN
 global $pref;
+if(!isset($pref['auth_method']) || ($pref['auth_method'] != 'e107' && $pref['auth_method'] != '>e107'))
+{
+	return "";
+}
 return $pref['signup_pass_len'];
 SC_END
 
@@ -120,7 +134,7 @@
 parse_str($parm);
 $cols = (isset($cols) ? $cols : 58);
 $rows = (isset($rows) ? $rows : 4);
-return "<textarea class='tbox' name='signature' cols='{$cols}' rows='{$rows}' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$curVal['user_signature']."</textarea>";
+return "<textarea class='tbox signature' name='signature' cols='{$cols}' rows='{$rows}' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$curVal['user_signature']."</textarea>";
 SC_END
 
 SC_BEGIN SIGNATURE_HELP
@@ -341,4 +355,4 @@
 SC_END
 
 */
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_files/shortcode/custom.sc 0.7.7/e107_files/shortcode/custom.sc
--- 0.7.5/e107_files/shortcode/custom.sc	2006-04-24 18:46:36.000000000 -0500
+++ 0.7.7/e107_files/shortcode/custom.sc	2006-11-28 17:18:43.000000000 -0600
@@ -14,9 +14,9 @@
 								$ret .= "<a href='".e_ADMIN."admin.php'>".LOGIN_MENU_L11."</a> .:. ";
 						}
 						$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."?logout'>".LOGIN_MENU_L8."</a> .:.</span>";
+						$ret .= "<a href='" . e_BASE . "usersettings.php'>".LOGIN_MENU_L12."</a> .:. <a href='".e_BASE."index.php?logout'>".LOGIN_MENU_L8."</a> .:.</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' />";
+						$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."' />";
 						if($pref['user_reg'])
 						{
 							$ret .= "&nbsp;&nbsp;<a href='".e_SIGNUP."'>".LOGIN_MENU_L3."</a>";
@@ -88,4 +88,4 @@
 
 				return $tp->parseTemplate("{WMESSAGE}");
 				break;
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_files/shortcode/extended.sc 0.7.7/e107_files/shortcode/extended.sc
--- 0.7.5/e107_files/shortcode/extended.sc	2006-01-14 18:13:05.000000000 -0600
+++ 0.7.7/e107_files/shortcode/extended.sc	2006-10-14 18:41:11.000000000 -0500
@@ -1,106 +1,5 @@
-//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
-include(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
-$parms = explode(".", $parm);
-global $currentUser, $sql, $tp, $loop_uid, $e107;
-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);
-}
+//this shortcode is deprecated due to a conflict with the news {EXTENDED} shortcode.
+// Use USER_EXTENDED instead.
 
-$uid = intval($parms[2]);
-if($uid == 0)
-{
-	if(isset($loop_uid) && intval($loop_uid) > 0)
-	{
-		$uid = $loop_uid;
-	}
-	else
-	{
-		$uid = USERID;
-	}
-}
-
-$udata = get_user_data($uid);
-
-$udata['user_class'] .= ($udata['user_class'] == "" ? "" : ",");
-$udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
-if($udata['user_admin'] == 1)
-{
-	$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)
-)
-{
-	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')
-{
-	if(defined(strtoupper($parms[0])."_ICON"))
-	{
-		return constant(strtoupper($parms[0])."_ICON");
-	}
-	elseif(file_exists(e_IMAGE."user_icons/{$parms[0]}.png"))
-	{
-		return "<img src='".e_IMAGE."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
-	}
-	return "";
-}
-
-if ($parms[1] == 'value')
-{
-	$uVal = str_replace(chr(1), "", $udata['user_'.$parms[0]]);
-	// check for db_lookup type
-	if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '4')
-	{
-		$tmp = explode(",",$ueStruct["user_".$parms[0]]['user_extended_struct_values']);
-		if($sql->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
-		{
-			$row = $sql->db_Fetch();
-			$ret_data = $row[$tmp[2]];
-		}
-		else
-		{
-			$ret_data = FALSE;
-		}
-	}
-	else
-	{
-		//check for 0000-00-00 in date field
-		if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '7')
-		{
-			if($uVal == "0000-00-00") { $uVal = ""; }
-		}
-		$ret_data = $uVal;
-	}
-	if($ret_data != "")
-	{
-		return $tp->toHTML($ret_data, TRUE, "no_make_clickable", "class:{$udata['user_class']}");
-	}
-	return FALSE;
-}
-return TRUE;
+global $tp;
+return $tp->parseTemplate("{USER_EXTENDED=$parm}");
diff -ruN 0.7.5/e107_files/shortcode/extended_icon.sc 0.7.7/e107_files/shortcode/extended_icon.sc
--- 0.7.5/e107_files/shortcode/extended_icon.sc	2005-09-04 22:00:57.000000000 -0500
+++ 0.7.7/e107_files/shortcode/extended_icon.sc	2006-10-14 18:41:11.000000000 -0500
@@ -2,4 +2,4 @@
 //EXAMPLE: {EXTENDED_ICON=user_gender.5}  will show the icon of the extended field user_gender for user #5
 $parms = explode(".", $parm);
 global $tp;
-return $tp->parseTemplate("{EXTENDED={$parms[0]}.icon.{$parms[1]}}");
+return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.icon.{$parms[1]}}");
diff -ruN 0.7.5/e107_files/shortcode/extended_text.sc 0.7.7/e107_files/shortcode/extended_text.sc
--- 0.7.5/e107_files/shortcode/extended_text.sc	2005-09-04 22:02:07.000000000 -0500
+++ 0.7.7/e107_files/shortcode/extended_text.sc	2006-10-14 18:41:11.000000000 -0500
@@ -2,4 +2,4 @@
 //EXAMPLE: {EXTENDED_TEXT=user_gender.5}  will show the text of the extended field user_gender for user #5
 $parms = explode(".", $parm);
 global $tp;
-return $tp->parseTemplate("{EXTENDED={$parms[0]}.text.{$parms[1]}}");
+return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text.{$parms[1]}}");
diff -ruN 0.7.5/e107_files/shortcode/extended_value.sc 0.7.7/e107_files/shortcode/extended_value.sc
--- 0.7.5/e107_files/shortcode/extended_value.sc	2005-09-04 21:51:59.000000000 -0500
+++ 0.7.7/e107_files/shortcode/extended_value.sc	2006-10-14 18:41:11.000000000 -0500
@@ -2,4 +2,5 @@
 //EXAMPLE: {EXTENDED_VALUE=user_gender.5}  will show the value of the extended field user_gender for user #5
 $parms = explode(".", $parm);
 global $tp;
-return $tp->parseTemplate("{EXTENDED={$parms[0]}.value.{$parms[1]}}");
+return "hello";
+return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value.{$parms[1]}}");
diff -ruN 0.7.5/e107_files/shortcode/imageselector.sc 0.7.7/e107_files/shortcode/imageselector.sc
--- 0.7.5/e107_files/shortcode/imageselector.sc	2006-05-05 22:25:40.000000000 -0500
+++ 0.7.7/e107_files/shortcode/imageselector.sc	2006-05-31 01:33:28.000000000 -0500
@@ -1,4 +1,4 @@
-// $Id: imageselector.sc,v 1.2 2006/05/06 03:25:40 e107coders Exp $
+// $Id: imageselector.sc,v 1.4 2006/05/31 06:33:28 e107coders Exp $
 
 global $sql,$parm;
 
@@ -6,7 +6,7 @@
     	 parse_str($parm, $tmp);
 		 extract($tmp);
 	}else{        // comma separated parms.
-    	list($name,$path,$default,$width,$height,$multiple,$label) = explode(",",$parm);
+    	list($name,$path,$default,$width,$height,$multiple,$label,$subdirs) = explode(",",$parm);
     }
 
 
@@ -14,8 +14,8 @@
 	$fl = new e_file;
 
   //	$paths = explode("|",$path);
-
-	if($imagelist = $fl->get_files($path,".jpg|.gif|.png")){
+    $recurse = ($subdirs) ? $subdirs : 0;
+	if($imagelist = $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse)){
 		sort($imagelist);
 	}
 
@@ -28,8 +28,9 @@
 	<option value=''>".$label."</option>\n";
 	foreach($imagelist as $icon)
 	{
-		$selected = ($default == $icon['fname']) ? " selected='selected'" : "";
-		$text .= "<option value='".$icon['fname']."'".$selected.">".$icon['fname']."</option>\n";
+		$dir = str_replace($path,"",$icon['path']);
+		$selected = ($default == $dir.$icon['fname']) ? " selected='selected'" : "";
+		$text .= "<option value='".$dir.$icon['fname']."'".$selected.">".$dir.$icon['fname']."</option>\n";
 	}
 	$text .= "</select>";
 
diff -ruN 0.7.5/e107_files/shortcode/languagelinks.sc 0.7.7/e107_files/shortcode/languagelinks.sc
--- 0.7.5/e107_files/shortcode/languagelinks.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/languagelinks.sc	2006-09-10 18:59:55.000000000 -0500
@@ -0,0 +1,43 @@
+// $Id: languagelinks.sc,v 1.6 2006/09/10 23:59:55 e107coders Exp $
+global $pref;
+$sep = (defined("LANGLINKS_SEPARATOR")) ? LANGLINKS_SEPARATOR : "|&nbsp;";
+$cursub = explode(".",$_SERVER['HTTP_HOST']);
+
+require_once(e_HANDLER."language_class.php");
+$lng = new language;
+
+	if($parm)
+	{
+		$tmp = explode(",",$parm);
+	}
+	else
+	{
+		$tmp = explode(",",e_LANLIST);
+		sort($tmp);
+	}
+
+	if(count($tmp) < 2)
+	{
+		return;
+	}
+
+	foreach($tmp as $val)
+	{
+		$code = $lng->convert($val);
+		$name = $lng->toNative($val);
+		$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);
+		}
+		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);
+		}
+		$class = ($val == e_LANGUAGE) ? "languagelink_active" : "languagelink";
+    	$ret[] =  "<a class='{$class}' href='{$link}' title=\"".$name."\">".$name."</a>\n";
+	}
+
+return implode($sep,$ret);
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/menu.sc 0.7.7/e107_files/shortcode/menu.sc
--- 0.7.5/e107_files/shortcode/menu.sc	2006-05-04 12:01:27.000000000 -0500
+++ 0.7.7/e107_files/shortcode/menu.sc	2006-10-14 08:13:45.000000000 -0500
@@ -1,3 +1,4 @@
+/* $Id: menu.sc,v 1.27 2006/10/14 13:13:45 lisa_ Exp $ */
 global $sql;
 global $ns;
 global $eMenuList;
@@ -18,7 +19,7 @@
 	if($row['menu_pages']) {
 		list($listtype,$listpages) = explode("-",$row['menu_pages']);
 		$pagelist = explode("|",$listpages);
-		$check_url = e_SELF."?".e_QUERY;
+		$check_url = e_SELF.(e_QUERY ? "?".e_QUERY : '');
 
 		if($listtype == '1')  //show menu
 		{
@@ -91,7 +92,9 @@
 				include_once(e_LANGUAGEDIR."English/plugins/lan_{$row['menu_path']}.php");
 			} elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/English.php")) {
 				include_once(e_PLUGIN.$row['menu_path']."/languages/English.php");
-			} 
+			} elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/English/English.php")) {
+				include_once(e_PLUGIN.$row['menu_path']."/languages/English/English.php");
+			}
 			
 			if(file_exists(e_PLUGIN.$row['menu_path']."/".$mname.".php"))
 			{
diff -ruN 0.7.5/e107_files/shortcode/newsfile.sc 0.7.7/e107_files/shortcode/newsfile.sc
--- 0.7.5/e107_files/shortcode/newsfile.sc	2005-03-30 09:46:23.000000000 -0600
+++ 0.7.7/e107_files/shortcode/newsfile.sc	2006-06-02 10:53:14.000000000 -0500
@@ -1,5 +1,5 @@
 
 
-$image = (file_exists(THEME."generic/download.png") ? THEME."generic/download.png" : e_IMAGE."generic/".IMODE."/download.png");
+$image = (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/".IMODE."/download.png");
 return "<img src='$image' alt='' style='vertical-align: middle;' /> <a href='".e_FILE."downloads/".$parm."'>".$parm."</a>";
 
diff -ruN 0.7.5/e107_files/shortcode/nextprev.sc 0.7.7/e107_files/shortcode/nextprev.sc
--- 0.7.5/e107_files/shortcode/nextprev.sc	2006-04-27 13:37:54.000000000 -0500
+++ 0.7.7/e107_files/shortcode/nextprev.sc	2006-11-03 16:30:20.000000000 -0600
@@ -4,16 +4,26 @@
 @include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
 @include_once(e_LANGUAGEDIR."English/lan_np.php");
 
-list($total_items, $perpage, $current_start, $url, $caption) = explode(",", $parm, 5);
+$parm_count = substr_count($parm, ",");
 
-if($total_items < $perpage){
-	return "";
+while($parm_count < 4)
+{
+	$parm .= ",";
+	$parm_count++;
 }
 
-$caption = (!$caption && $caption != "off") ? NP_3."&nbsp;" : $caption;
-if($caption == "off"){
- $caption = "";
-}
+$p = explode(",", $parm, 5);
+
+$total_items = intval($p[0]);
+$perpage = intval($p[1]);
+$current_start = intval($p[2]);
+$url = trim($p[3]);
+$caption = trim($p[4]);
+
+if($total_items < $perpage) {	return ""; }
+
+$caption = (!$caption || $caption == "off") ? NP_3."&nbsp;" : $caption;
+
 while(substr($url, -1) == ".")
 {
 	$url=substr($url, 0, -1);
@@ -38,7 +48,7 @@
 		}
 
 
-		//	Use OLD nextprev metod
+		//	Use OLD nextprev method
 		$nppage = '';
 		$nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
 		if ($total_pages > 10)
@@ -183,4 +193,4 @@
 	$ret = str_replace('[NEXT]', $next, $ret);
 	return $caption.$ret;
 }
-return "";
\ No newline at end of file
+return "";
diff -ruN 0.7.5/e107_files/shortcode/print_item.sc 0.7.7/e107_files/shortcode/print_item.sc
--- 0.7.5/e107_files/shortcode/print_item.sc	2005-04-09 14:47:15.000000000 -0500
+++ 0.7.7/e107_files/shortcode/print_item.sc	2006-09-03 08:41:58.000000000 -0500
@@ -1,4 +1,4 @@
-if (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT)) 
+if (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT))
 {
 	$icon = THEME."images/".ICONPRINT;
 }
@@ -7,4 +7,4 @@
 	$icon = e_IMAGE."generic/".IMODE."/printer.png";
 }
 $parms = explode("^",$parm);
-return "<a href='".e_BASE."print.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
+return "<a href='".e_BASE."print.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/search.sc 0.7.7/e107_files/shortcode/search.sc
--- 0.7.5/e107_files/shortcode/search.sc	2006-04-25 00:28:07.000000000 -0500
+++ 0.7.7/e107_files/shortcode/search.sc	2006-10-21 22:52:06.000000000 -0500
@@ -1,8 +1,7 @@
 global $sql,$sysprefs,$SEARCH_SHORTCODE;
 
-
-@include_once(e_PLUGIN."search_menu/languages/".e_LANGUAGE.".php");
-
+include_lan(e_PLUGIN."search_menu/languages/".e_LANGUAGE.".php");
+$text = "";
 if (!isset($SEARCH_SHORTCODE)) {
 	if (file_exists(THEME."search_template.php")) {
 			include(THEME."search_template.php");
@@ -46,4 +45,3 @@
 	$text .="\n</div></form>";
 
  return $text;
-
diff -ruN 0.7.5/e107_files/shortcode/sitedescription.sc 0.7.7/e107_files/shortcode/sitedescription.sc
--- 0.7.5/e107_files/shortcode/sitedescription.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/sitedescription.sc	2006-06-02 06:38:28.000000000 -0500
@@ -0,0 +1 @@
+return SITEDESCRIPTION.(defined("THEME_DESCRIPTION") && $pref['displaythemeinfo'] ? THEME_DESCRIPTION : "");
diff -ruN 0.7.5/e107_files/shortcode/sitedisclaimer.sc 0.7.7/e107_files/shortcode/sitedisclaimer.sc
--- 0.7.5/e107_files/shortcode/sitedisclaimer.sc	2004-09-25 23:09:25.000000000 -0500
+++ 0.7.7/e107_files/shortcode/sitedisclaimer.sc	2006-07-02 21:07:10.000000000 -0500
@@ -1 +1,4 @@
-return SITEDISCLAIMER.(defined("THEME_DISCLAIMER") && $pref['displaythemeinfo'] ? THEME_DISCLAIMER : "");
+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 -ruN 0.7.5/e107_files/shortcode/sitelinks.sc 0.7.7/e107_files/shortcode/sitelinks.sc
--- 0.7.5/e107_files/shortcode/sitelinks.sc	2006-01-24 01:18:35.000000000 -0600
+++ 0.7.7/e107_files/shortcode/sitelinks.sc	2006-10-22 17:57:54.000000000 -0500
@@ -2,8 +2,8 @@
 if(!in_array('edynamic_menu',$eMenuActive) && !in_array('tree_menu',$eMenuActive) && !in_array('q_tree_menu',$eMenuActive)) {
     $tmp = explode(":",$parm);
 	$linktype = $tmp[0];
-	$cat = ($tmp[1]) ? $tmp[1] : 1;
-	$css_class = ($tmp[2]) ? $tmp[2] : false;
+	$cat = (isset($tmp[1])) ? $tmp[1] : 1;
+	$css_class = (isset($tmp[2])) ? $tmp[2] : false;
 	if(!defined('LINKDISPLAY')) {
 		define("LINKDISPLAY", ($linktype == "menu" ? 2 : 1));
 	}
diff -ruN 0.7.5/e107_files/shortcode/sitelinks_alt.sc 0.7.7/e107_files/shortcode/sitelinks_alt.sc
--- 0.7.5/e107_files/shortcode/sitelinks_alt.sc	2006-01-13 18:23:04.000000000 -0600
+++ 0.7.7/e107_files/shortcode/sitelinks_alt.sc	2006-07-24 18:50:13.000000000 -0500
@@ -3,9 +3,9 @@
 |     e107 website system
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/sitelinks_alt.sc,v $
-|     $Revision: 1.33 $
-|     $Date: 2006/01/14 00:23:04 $
-|     $Author: qnome $
+|     $Revision: 1.36 $
+|     $Date: 2006/07/24 23:50:13 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -19,15 +19,16 @@
 
 	function adnav_cat($cat_title, $cat_link, $cat_img, $cat_id=FALSE, $cat_open=FALSE) {
 		global $tp;
+
 		$cat_link = (strpos($cat_link, '://') === FALSE && strpos($cat_link, 'mailto:') !== 0 ? e_HTTP.$cat_link : $cat_link);
-		
+
 		if ($cat_open == 4 || $cat_open == 5){
 			$dimen = ($cat_open == 4) ? "600,400" : "800,600";
 			$href = " href=\"javascript:open_window('".$cat_link."',".$dimen.")\"";
 		} else {
 			$href = "href='".$cat_link."'";
 		}
-		
+
 		$text = "<a class='menuButton' ".$href." ";
 		if ($cat_img != 'no_icons') {
 			$text .= "style='background-image: url(".$cat_img."); background-repeat: no-repeat; background-position: 3px 1px; white-space: nowrap' ";
@@ -44,15 +45,17 @@
 
 	function adnav_main($cat_title, $cat_link, $cat_img, $cat_id=FALSE, $params, $cat_open=FALSE) {
 		global $tp;
+
 		$cat_link = (strpos($cat_link, '://') === FALSE) ? e_HTTP.$cat_link : $cat_link;
-		
+        $cat_link = $tp->replaceConstants($cat_link,TRUE);
+
 		if ($cat_open == 4 || $cat_open == 5){
 			$dimen = ($cat_open == 4) ? "600,400" : "800,600";
 			$href = " href=\"javascript:open_window('".$cat_link."',".$dimen.")\"";
 		} else {
 			$href = "href='".$cat_link."'";
 		}
-		
+
 		$text = "<a class='menuItem' ".$href." ";
 		if ($cat_id) {
 			if (isset($params[2]) && $params[2] == 'link') {
@@ -99,9 +102,9 @@
 
 
 	// Loops thru parents.--------->
-
+    global $tp;
     foreach ($linklist['head_menu'] as $lk) {
-
+        $lk['link_url'] = $tp -> replaceConstants($lk['link_url'],TRUE);
 		if ($params[0] == 'no_icons') {
 			$link_icon = 'no_icons';
 		} else {
@@ -126,7 +129,7 @@
 	$text .= "</div>";
 
 	return $text;
-	
+
 	function render_sub($linklist, $id, $params, $icon) {
 		$text = "<div id='l_".$id."' class='menu' onmouseover=\"menuMouseover(event)\">";
 			foreach ($linklist['sub_'.$id] as $sub) {
@@ -157,13 +160,13 @@
 
 			}
 			$text .= "</div>";
-			
+
 			if(isset($sub_ids) && is_array($sub_ids))
 			{
 				foreach ($sub_ids as $sub_id) {
 					$text .= render_sub($linklist, $sub_id, $params, $icon);
 				}
 			}
-			
+
 			return $text;
 	}
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/sitename.sc 0.7.7/e107_files/shortcode/sitename.sc
--- 0.7.5/e107_files/shortcode/sitename.sc	2004-09-24 21:20:00.000000000 -0500
+++ 0.7.7/e107_files/shortcode/sitename.sc	2006-07-03 21:32:04.000000000 -0500
@@ -1 +1,2 @@
-return SITENAME;
\ No newline at end of file
+return ($parm == "link") ? "<a href='".SITEURL."' title=\"".SITENAME."\">".SITENAME."</a>" : SITENAME;
+
diff -ruN 0.7.5/e107_files/shortcode/stylesheet.sc 0.7.7/e107_files/shortcode/stylesheet.sc
--- 0.7.5/e107_files/shortcode/stylesheet.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/stylesheet.sc	2006-07-12 11:29:50.000000000 -0500
@@ -0,0 +1,11 @@
+// $Id: stylesheet.sc,v 1.1 2006/07/12 16:29:50 e107coders Exp $
+
+$css = file_get_contents(THEME."style.css");
+$search = array("url(images","url('images");
+$replace[0] = "url(".SITEURL.$THEMES_DIRECTORY.$pref['sitetheme']."/images";
+$replace[1] = "url('".SITEURL.$THEMES_DIRECTORY.$pref['sitetheme']."/images";
+$CSS = str_replace($search,$replace,$css);
+
+return "\n<style>\n".$CSS."\n</style>\n";
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_files/shortcode/uploadfile.sc 0.7.7/e107_files/shortcode/uploadfile.sc
--- 0.7.5/e107_files/shortcode/uploadfile.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/uploadfile.sc	2006-11-08 14:45:00.000000000 -0600
@@ -0,0 +1,37 @@
+// $Id: uploadfile.sc,v 1.5 2006/11/08 20:45:00 e107coders Exp $
+
+// Your <form> tag must include: enctype='multipart/form-data' - in order to work.
+// parm is the path to the upload folder.
+global $pref;
+
+if(!FILE_UPLOADS)
+{
+	return LAN_UPLOAD_SERVEROFF;
+}
+if(USER_AREA === TRUE && !check_class($pref['upload_class']))
+{
+	return LAN_DISABLED;
+}
+
+
+if($parm && !is_writable($parm))
+{
+	return LAN_UPLOAD_777." <b>".str_replace("../","",$parm)."</b>";
+}
+
+$name = "file_userfile[]";
+
+$text .="
+        <!-- Upload Shortcode -->
+		<div style='width:90%'><div id='up_container' >
+		<span id='upline' style='white-space:nowrap'>
+		<input class='tbox' type='file' name='$name' size='40' />
+        </span><br />
+		</div>
+		<span style='float:left;padding-top:3px'><input type='button' class='button' value=\"".LAN_UPLOAD_ADDFILE."\" onclick=\"duplicateHTML('upline','up_container');\"  /></span>
+		<span style='float:right;padding-top:3px'><input class='button' type='submit' name='uploadfiles' value=\"".LAN_UPLOAD_FILES."\" onclick=\"return jsconfirm('".LAN_UPLOAD_CONFIRM."')\" /></span>
+		</div>
+		<!-- End Upload Shortcode -->
+	";
+
+return $text;
diff -ruN 0.7.5/e107_files/shortcode/user_avatar.sc 0.7.7/e107_files/shortcode/user_avatar.sc
--- 0.7.5/e107_files/shortcode/user_avatar.sc	2006-04-30 18:48:39.000000000 -0500
+++ 0.7.7/e107_files/shortcode/user_avatar.sc	2006-06-23 19:15:49.000000000 -0500
@@ -1,3 +1,9 @@
+global $loop_uid;
+if(intval($loop_uid) > 0 && trim($parm) == "")
+{
+	$parm = $loop_uid;
+}
+
 if(is_numeric($parm))
 {
 	if($parm == USERID)
diff -ruN 0.7.5/e107_files/shortcode/user_extended.sc 0.7.7/e107_files/shortcode/user_extended.sc
--- 0.7.5/e107_files/shortcode/user_extended.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_files/shortcode/user_extended.sc	2006-10-14 18:41:11.000000000 -0500
@@ -0,0 +1,106 @@
+//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
+include(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
+$parms = explode(".", $parm);
+global $currentUser, $sql, $tp, $loop_uid, $e107;
+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);
+}
+
+$uid = intval($parms[2]);
+if($uid == 0)
+{
+	if(isset($loop_uid) && intval($loop_uid) > 0)
+	{
+		$uid = $loop_uid;
+	}
+	else
+	{
+		$uid = USERID;
+	}
+}
+
+$udata = get_user_data($uid);
+
+$udata['user_class'] .= ($udata['user_class'] == "" ? "" : ",");
+$udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
+if($udata['user_admin'] == 1)
+{
+	$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)
+)
+{
+	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')
+{
+	if(defined(strtoupper($parms[0])."_ICON"))
+	{
+		return constant(strtoupper($parms[0])."_ICON");
+	}
+	elseif(file_exists(e_IMAGE."user_icons/{$parms[0]}.png"))
+	{
+		return "<img src='".e_IMAGE."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
+	}
+	return "";
+}
+
+if ($parms[1] == 'value')
+{
+	$uVal = str_replace(chr(1), "", $udata['user_'.$parms[0]]);
+	// check for db_lookup type
+	if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '4')
+	{
+		$tmp = explode(",",$ueStruct["user_".$parms[0]]['user_extended_struct_values']);
+		if($sql->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
+		{
+			$row = $sql->db_Fetch();
+			$ret_data = $row[$tmp[2]];
+		}
+		else
+		{
+			$ret_data = FALSE;
+		}
+	}
+	else
+	{
+		//check for 0000-00-00 in date field
+		if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '7')
+		{
+			if($uVal == "0000-00-00") { $uVal = ""; }
+		}
+		$ret_data = $uVal;
+	}
+	if($ret_data != "")
+	{
+		return $tp->toHTML($ret_data, TRUE, "no_make_clickable", "class:{$udata['user_class']}");
+	}
+	return FALSE;
+}
+return TRUE;
diff -ruN 0.7.5/e107_files/shortcode/wmessage.sc 0.7.7/e107_files/shortcode/wmessage.sc
--- 0.7.5/e107_files/shortcode/wmessage.sc	2006-04-24 19:40:53.000000000 -0500
+++ 0.7.7/e107_files/shortcode/wmessage.sc	2006-11-13 04:21:17.000000000 -0600
@@ -1,38 +1,60 @@
-// $Id: wmessage.sc,v 1.11 2006/04/25 00:40:53 e107coders Exp $
-
-if (($pref['wmessage_sc'] && $parm == "header") || (!$pref['wmessage_sc'] && $parm !='header') ){
+// $Id: wmessage.sc,v 1.17 2006/11/13 10:21:17 e107coders Exp $
+$prefwmsc = isset($pref['wmessage_sc']) && $pref['wmessage_sc'];
+if (($prefwmsc && $parm == "header") || (!$prefwmsc && ($parm !='header')) ){
 	return;
 }
 
-	global $e107;
+	global $e107,$e107cache;
+
+
 	if (isset($pref['frontpage']['all']) && $pref['frontpage']['all']) {
-		$front_url = ((strpos($pref['frontpage']['all'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['all'];
+		$full_url = ((strpos($pref['frontpage']['all'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['all'];
 	} else if (ADMIN) {
-		$front_url = ((strpos($pref['frontpage']['254'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['254'];
+		$full_url = ((strpos($pref['frontpage']['254'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['254'];
 	} else if (USER) {
 		require_once(e_HANDLER.'userclass_class.php');
 		$class_list = get_userclass_list();
 		foreach ($class_list as $fp_class) {
 			if (check_class($fp_class['userclass_id'])) {
-				$front_url = ((strpos($pref['frontpage'][$fp_class['userclass_id']], 'http') === FALSE) ? SITEURL : '').$pref['frontpage'][$fp_class['userclass_id']];
-				$class_match = true;
+				$full_url = ((strpos($pref['frontpage'][$fp_class['userclass_id']], 'http') === FALSE) ? SITEURL : '').$pref['frontpage'][$fp_class['userclass_id']];
+        $class_match = true;
 				break;
 			}
 		}
 		if (!$class_match) {
-			$front_url = ((strpos($pref['frontpage']['253'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['253'];
+			$full_url = ((strpos($pref['frontpage']['253'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['253'];
 		}
 	} else {
-		$front_url = ((strpos($pref['frontpage']['252'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['252'];
+		$full_url = ((strpos($pref['frontpage']['252'], 'http') === FALSE) ? SITEURL : '').$pref['frontpage']['252'];
+	}
+	list($front_url,$front_qry) = explode("?",$full_url."?"); // extra '?' ensure the array is filled
+
+	if($parm == "ignore_query"){
+    	$front_qry = e_QUERY;
+	}
+
+	if($parm == "force"){
+    	$front_url = e_SELF;
+		$front_qry = e_QUERY;
 	}
 
-	if (e_SELF == $front_url) {
+	if (e_SELF == $front_url && e_QUERY == $front_qry) {
 		global $sql, $pref, $tp, $ns;
+
+
+		if($cacheData = $e107cache->retrieve("wmessage"))
+		{
+			echo $cacheData;
+   			return;
+		}
+
+
 		if (!defined("WMFLAG")) {
 			$qry = "
 			SELECT * FROM #generic
 			WHERE gen_type ='wmessage' AND gen_intdata IN (".USERCLASS_LIST.")";
-
+            $wmessage = "";
+			$wmcaption = "";
 			if($sql->db_Select_gen($qry))
 			{
 				while ($row = $sql->db_Fetch())
@@ -46,6 +68,8 @@
 
 			if (isset($wmessage) && $wmessage)
 			{
+				ob_start();
+
 				if ($pref['wm_enclose'])
 				{
 					$ns->tablerender($wmcaption, $wmessage, "wm");
@@ -55,6 +79,9 @@
 					echo ($wmcaption) ? $wmcaption."<br />" : "";
 					echo $wmessage;
 				}
+
+				$cache_data = ob_get_flush();
+				$e107cache->set("wmessage", $cache_data);
 			}
 		}
 	}
diff -ruN 0.7.5/e107_handlers/admin_log_class.php 0.7.7/e107_handlers/admin_log_class.php
--- 0.7.5/e107_handlers/admin_log_class.php	2006-04-13 09:33:06.000000000 -0500
+++ 0.7.7/e107_handlers/admin_log_class.php	2006-10-24 12:02:57.000000000 -0500
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/admin_log_class.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/04/13 14:33:06 $
+|     $Revision: 1.9 $
+|     $Date: 2006/10/24 17:02:57 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -71,6 +71,12 @@
 		 *
 		 */
 		define("E_LOG_FATAL", 3);
+
+		/*
+		 * 	Plugin Information.
+		 */
+
+		define("E_LOG_PLUGIN", 4);
 	}
 
 	/**
@@ -92,7 +98,7 @@
 			if($this->_options['backtrace'] == true) {
 				$event_detail .= "\n\n".debug_backtrace();
 			}
-			$sql->db_Insert('dblog', "'', '{$event_type}', {$time_stamp}, {$uid}, '{$ip}', '{$event_title}', '{$event_detail}'");
+			$sql->db_Insert('dblog', "'', '{$event_type}', {$time_stamp}, {$uid}, '{$ip}', '{$event_title}', '{$event_detail}' ");
 		}
 	}
 
@@ -121,4 +127,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/bbcode_handler.php 0.7.7/e107_handlers/bbcode_handler.php
--- 0.7.5/e107_handlers/bbcode_handler.php	2006-05-05 18:06:45.000000000 -0500
+++ 0.7.7/e107_handlers/bbcode_handler.php	2006-11-27 03:38:20.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/bbcode_handler.php,v $
-|     $Revision: 1.40 $
-|     $Date: 2006/05/05 23:06:45 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.48 $
+|     $Date: 2006/11/27 09:38:20 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -33,7 +33,7 @@
 		global $pref;
 		$core_bb = array(
 		'blockquote', 'img', 'i', 'u', 'center',
-		'*br', 'color', 'size', 'code',
+		'_br', 'color', 'size', 'code',
 		'html', 'flash', 'link', 'email',
 		'url', 'quote', 'left', 'right',
 		'b', 'justify', 'file', 'stream',
@@ -45,19 +45,25 @@
 		{
 			$this->bbLocation[$c] = 'core';
 		}
-		if(isset($pref['plug_bb']) && $pref['plug_bb'] != '')
+
+
+		// grab list of plugin bbcodes.
+		if(isset($pref['bbcode_list']) && $pref['bbcode_list'] != '')
 		{
-			$tmp = explode(',',$pref['plug_bb']);
-			foreach($tmp as $val)
+        	foreach($pref['bbcode_list'] as $path=>$namearray)
 			{
-				list($code, $location) = explode(':',$val);
-				$this->bbLocation[$code] = $location;
+				foreach($namearray as $code=>$uclass)
+				{
+                	$this->bbLocation[$code] = $path;
+				}
 			}
 		}
+
+
 		$this->bbLocation = array_diff($this->bbLocation, array(''));
 		krsort($this->bbLocation);
 		$this->List = array_keys($this->bbLocation);
-		while($this->List[count($this->List)-1]{0} == "*")
+		while($this->List[count($this->List)-1]{0} == "_")
 		{
 			array_unshift($this->List, array_pop($this->List));
 		}
@@ -66,6 +72,7 @@
 			unset($this->List[$c]);
 			array_unshift($this->List, "code");
 		}
+
 	}
 
 	function parseBBCodes($text, $p_ID)
@@ -78,11 +85,11 @@
 		$done = false;
 		$single_bb = false;
 		$i=0;
-		
+
 		$tmplist = array();
 		foreach($this->List as $code)
 		{
-			if("*" == $code[0])
+			if("_" == $code[0])
 			{
 				if(strpos($text, "[".substr($code, 1)) !== FALSE)
 				{
@@ -100,7 +107,7 @@
 
 		foreach($tmplist as $code)
 		{
-			if("*" == $code{0})
+			if("_" == $code{0})
 			{
 				$code = substr($code, 1);
 				$this->single_bb = true;
@@ -117,6 +124,15 @@
 				$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);
+    			}
 			}
 		}
 		return $text;
@@ -132,7 +148,7 @@
 		$code_text = $tp->replaceConstants($matches[4]);
 		if($this->single_bb == true)
 		{
-			$code = '*'.$code;
+			$code = '_'.$code;
 		}
 		if (E107_DEBUG_LEVEL)
 		{
@@ -148,12 +164,12 @@
 		{
 			if ($this->bbLocation[$code] == 'core')
 			{
-				$bbFile = e_FILE.'bbcode/'.strtolower(str_replace('*', '', $code)).'.bb';
+				$bbFile = e_FILE.'bbcode/'.strtolower(str_replace('_', '', $code)).'.bb';
 			}
 			else
 			{
 				// Add code to check for plugin bbcode addition
-				$bbFile = e_PLUGIN.$this->bbLocation[$code].'/'.strtolower(str_replace('*', '', $code)).'.bb';
+				$bbFile = e_PLUGIN.$this->bbLocation[$code].'/'.strtolower($code).'.bb';
 			}
 			if (file_exists($bbFile))
 			{
@@ -167,7 +183,7 @@
 			}
 		}
 		global $e107_debug;
-		if($e107_debug)
+		if(E107_DBG_BBSC)
 		{
 			trigger_error("starting bbcode [$code]", E_USER_ERROR);
 		}
@@ -186,4 +202,4 @@
 		return $bbcode_output.$bbcode_return;
 	}
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/cache_handler.php 0.7.7/e107_handlers/cache_handler.php
--- 0.7.5/e107_handlers/cache_handler.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/cache_handler.php	2006-11-17 07:26:38.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.27 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.35 $
+|     $Date: 2006/11/17 13:26:38 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,26 +24,47 @@
 * Class to cache data as files, improving site speed and throughput.
 *
 * @package     e107
-* @version     $Revision: 1.27 $
-* @author      $Author: sweetas $
+* @version     $Revision: 1.35 $
+* @author      $Author: mrpete $
 */
 class ecache {
 
 	var $CachePageMD5;
+	var $CachenqMD5;
 
 	/**
 	* @return string
 	* @param string $query
 	* @desc Internal class function that returns the filename of a cache file based on the query.
 	* @scope private
+	* If the tag begins 'menu_', e_QUERY is not included in the hash which creates the file name
 	*/
 	function cache_fname($CacheTag) {
 		global $FILES_DIRECTORY;
-		if (isset($this)) {
-			if (defined("THEME") && !$this->CachePageMD5) {
-				$this->CachePageMD5 = md5(e_BASE.e_LANGUAGE.THEME.USERCLASS.e_QUERY.filemtime(THEME.'theme.php'));
+		if(strpos($CacheTag, "nomd5_") === 0) {
+			// Add 'nomd5' to indicate we are not calculating an md5
+			$CheckTag = '_nomd5';
+		}
+		elseif (isset($this)) {
+			if (defined("THEME")) {
+				if (strpos($CacheTag, "nq_") === 0)	{
+					// We do not care about e_QUERY, so don't use it in the md5 calculation
+					if (!$this->CachenqMD5) {
+						$this->CachenqMD5 = md5(e_BASE.(defined("ADMIN") && ADMIN == true ? "admin" : "").e_LANGUAGE.THEME.USERCLASS_LIST.filemtime(THEME.'theme.php'));
+					}
+					// Add 'nq' to indicate we are not using e_QUERY
+					$CheckTag = '_nq_'.$this->CachenqMD5;
+					
+				} else {
+					// It's a page - need the query in the hash
+					if (!$this->CachePageMD5) {
+						$this->CachePageMD5 = md5(e_BASE.e_LANGUAGE.THEME.USERCLASS_LIST.e_QUERY.filemtime(THEME.'theme.php'));
+					}
+					$CheckTag = '_'.$this->CachePageMD5;
+				}
+			} else {
+				$CheckTag = '';
 			}
-			$CheckTag = '_'.$this->CachePageMD5;
 		} else {
 			$CheckTag = '';
 		}
@@ -60,8 +81,8 @@
 	* @scope public
 	*/
 	function retrieve($CacheTag, $MaximumAge = false, $ForcedCheck = false) {
-		global $pref, $FILES_DIRECTORY;
-		if ($pref['cachestatus'] || $ForcedCheck == true) {
+		global $pref, $FILES_DIRECTORY, $tp;
+		if (($pref['cachestatus'] || $ForcedCheck == true) && !$tp->checkHighlighting()) {
 			$cache_file = (isset($this) ? $this->cache_fname($CacheTag) : ecache::cache_fname($CacheTag));
 			if (file_exists($cache_file)) {
 				if ($MaximumAge != false && (filemtime($cache_file) + ($MaximumAge * 60)) < time()) {
@@ -76,20 +97,23 @@
 				return false;
 			}
 		}
+		return false;
 	}
 
 	/**
 	* @return void
-	* @param string $query
-	* @param string $text
+	* @param string $CacheTag - name of tag for future retrieval
+	* @param string $Data - data to be cached
+	* @param bool   $ForceCache (optional, default false) - if TRUE, writes cache even when disabled
+	* @param bool   $bRaw (optional, default false) - if TRUE, writes data exactly as provided instead of prefacing with php leadin
 	* @desc Creates / overwrites the cache file for $query, $text is the data to store for $query.
 	* @scope public
 	*/
-	function set($CacheTag, $Data, $ForceCache = false) {
-		global $pref, $FILES_DIRECTORY;
-		if ($pref['cachestatus'] || $ForceCache == true) {
+	function set($CacheTag, $Data, $ForceCache = false, $bRaw=0) {
+		global $pref, $FILES_DIRECTORY, $tp;
+		if (($pref['cachestatus'] || $ForceCache == true) && !$tp->checkHighlighting()) {
 			$cache_file = (isset($this) ? $this->cache_fname($CacheTag) : ecache::cache_fname($CacheTag));
-			file_put_contents($cache_file, '<?php'.$Data);
+			file_put_contents($cache_file, ($bRaw? $Data : '<?php'.$Data) );
 			@chmod($cache_file, 0777);
 			@touch($cache_file);
 		}
diff -ruN 0.7.5/e107_handlers/calendar/language/English.js 0.7.7/e107_handlers/calendar/language/English.js
--- 0.7.5/e107_handlers/calendar/language/English.js	2005-03-30 13:40:39.000000000 -0600
+++ 0.7.7/e107_handlers/calendar/language/English.js	2006-09-28 19:48:12.000000000 -0500
@@ -83,7 +83,7 @@
 
 Calendar._TT["ABOUT"] =
 "DHTML Date/Time Selector\n" +
-"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
+"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-)
 "For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
 "Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
 "\n\n" +
diff -ruN 0.7.5/e107_handlers/comment_class.php 0.7.7/e107_handlers/comment_class.php
--- 0.7.5/e107_handlers/comment_class.php	2006-05-13 10:05:38.000000000 -0500
+++ 0.7.7/e107_handlers/comment_class.php	2006-11-11 22:04:27.000000000 -0600
@@ -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.58 $
-|     $Date: 2006/05/13 15:05:38 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.67 $
+|     $Date: 2006/11/12 04:04:27 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -57,14 +57,14 @@
 			$ns = new e107table;
 			if ($action == "reply" && substr($subject, 0, 4) != "Re: ")
 			{
-				$subject = COMLAN_5.' '.$subject;
+				$subject = COMLAN_325.' '.$subject;
 			}
 
 			$text = "\n<div style='text-align:center'><form method='post' action='".e_SELF."?".e_QUERY."' id='dataform' >\n<table style='width:100%'>";
 
 			if ($pref['nested_comments'])
 			{
-				$text .= "<tr>\n<td style='width:20%'>".COMLAN_4."</td>\n<td style='width:80%'>\n<input class='tbox' type='text' name='subject' size='61' value='".$tp -> toForm($subject)."' maxlength='100' />\n</td>\n</tr>";
+				$text .= "<tr>\n<td style='width:20%'>".COMLAN_324."</td>\n<td style='width:80%'>\n<input class='tbox comment subject' type='text' name='subject' size='61' value='".$tp -> toForm($subject)."' maxlength='100' />\n</td>\n</tr>";
 				$text2 = "";
 			}
 			else
@@ -72,7 +72,12 @@
 				$text2 = "<input type='hidden' name='subject' value='".$tp -> toForm($subject)."'  />\n";
 			}
 
-			if(strstr(e_QUERY, "edit"))
+			if (isset($_GET['comment']) && $_GET['comment'] == 'edit')
+			{
+				$eaction = 'edit';
+				$id = $_GET['comment_id'];
+			}
+			else if (strstr(e_QUERY, "edit"))
 			{
 				$eaction = "edit";
 				$tmp = explode(".", e_QUERY);
@@ -98,18 +103,18 @@
 
 				if($prid != USERID || !USER)
 				{
-					echo "<div style='text-align: center;'>Unauthorized</div>";
+					echo "<div style='text-align: center;'>".COMLAN_329."</div>";
 					require_once(FOOTERF);
 					exit;
 				}
 
-				$caption = LAN_318;
+				$caption = COMLAN_318;
 				$comval = $tp -> toFORM($ecom['comment_comment']);
-				$comval = preg_replace("#\[ ".LAN_319.".*\]#si", "", $comval);
+				$comval = preg_replace("#\[ ".COMLAN_319.".*\]#si", "", $comval);
 			}
 			else
 			{
-				$caption = LAN_9;
+				$caption = COMLAN_9;
 				$comval = "";
 			}
 
@@ -121,17 +126,17 @@
 				require_once(e_HANDLER."rate_class.php");
 				if(!is_object($rater)){ $rater = new rater; }
 				$rate = $rater -> composerating($table, $itemid, $enter=TRUE, USERID, TRUE);
-				$rate = "<tr><td style='width:20%; vertical-align:top;'>".COMLAN_7.":</td>\n<td style='width:80%;'>".$rate."</td></tr>\n";
+				$rate = "<tr><td style='width:20%; vertical-align:top;'>".COMLAN_327.":</td>\n<td style='width:80%;'>".$rate."</td></tr>\n";
 			}
 			//end rating area
 
 			if (ANON == TRUE && USER == FALSE)
 			{
-				$text .= "<tr>\n<td style='width:20%; vertical-align:top;'>".LAN_16."</td>\n<td style='width:80%'>\n<input class='tbox' type='text' name='author_name' size='61' value='$author_name' maxlength='100' />\n</td>\n</tr>";
+				$text .= "<tr>\n<td style='width:20%; vertical-align:top;'>".COMLAN_16."</td>\n<td style='width:80%'>\n<input class='tbox comment author' type='text' name='author_name' size='61' value='$author_name' maxlength='100' />\n</td>\n</tr>";
 			}
 			$text .= $rate."<tr> \n
-			<td style='width:20%; vertical-align:top;'>".LAN_8.":</td>\n<td id='commentform' style='width:80%;'>\n<textarea class='tbox' name='comment' cols='62' rows='7' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$comval</textarea>\n<br />
-			<input class='helpbox' type='text' name='helpb' style='width:80%' /><br />".ren_help(1, 'addtext', 'help')."</td></tr>\n<tr style='vertical-align:top'> \n<td style='width:20%'>".$text2."</td>\n<td id='commentformbutton' style='width:80%;'>\n". (isset($action) && $action == "reply" ? "<input type='hidden' name='pid' value='$id' />" : '').(isset($eaction) && $eaction == "edit" ? "<input type='hidden' name='editpid' value='$id' />" : "").(isset($content_type) && $content_type ? "<input type='hidden' name='content_type' value='$content_type' />" : ''). "<input class='button' type='submit' name='".$action."submit' value='".(isset($eaction) && $eaction == "edit" ? LAN_320 : LAN_9)."' />\n</td>\n</tr>\n</table>\n</form></div>";
+			<td style='width:20%; vertical-align:top;'>".COMLAN_8.":</td>\n<td id='commentform' style='width:80%;'>\n<textarea class='tbox comment' id='comment' name='comment' cols='62' rows='7' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$comval</textarea>\n<br />
+			".display_help('helpb',"comment")."</td></tr>\n<tr style='vertical-align:top'> \n<td style='width:20%'>".$text2."</td>\n<td id='commentformbutton' style='width:80%;'>\n". (isset($action) && $action == "reply" ? "<input type='hidden' name='pid' value='$id' />" : '').(isset($eaction) && $eaction == "edit" ? "<input type='hidden' name='editpid' value='$id' />" : "").(isset($content_type) && $content_type ? "<input type='hidden' name='content_type' value='$content_type' />" : ''). "<input class='button' type='submit' name='".$action."submit' value='".(isset($eaction) && $eaction == "edit" ? COMLAN_320 : COMLAN_9)."' />\n</td>\n</tr>\n</table>\n</form></div>";
 
 			if($tablerender)
 			{
@@ -149,7 +154,7 @@
 		}
 		else
 		{
-			echo "<br /><div style='text-align:center'><b>".LAN_6." <a href='".e_SIGNUP."'>".COMLAN_1."</a> ".COMLAN_2."</b></div>";
+			echo "<br /><div style='text-align:center'><b>".COMLAN_6." <a href='".e_SIGNUP."'>".COMLAN_321."</a> ".COMLAN_322."</b></div>";
 		}
 	}
 
@@ -191,18 +196,18 @@
 			$width = 0;
 		}
 		if(!defined("IMAGE_nonew_comments")){
-			define("IMAGE_nonew_comments", (file_exists(THEME."generic/nonew_comments.png") ? "<img src='".THEME_ABS."generic/nonew_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/nonew_comments.png' alt=''  />"));
+			define("IMAGE_nonew_comments", (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_comments")){
-			define("IMAGE_new_comments", (file_exists(THEME."generic/new_comments.png") ? "<img src='".THEME_ABS."generic/new_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/new_comments.png' alt=''  /> "));
+			define("IMAGE_new_comments", (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=''  /> "));
 		}
 		$ns			= new e107table;
 		if(!$gen || !is_object($gen)){ $gen = new convert; }
 		$url		= e_PAGE."?".e_QUERY;
-		$unblock	= "[<a href='".e_ADMIN_ABS."comment.php?unblock-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".LAN_1."</a>] ";
-		$block		= "[<a href='".e_ADMIN_ABS."comment.php?block-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".LAN_2."</a>] ";
-		$delete		= "[<a href='".e_ADMIN_ABS."comment.php?delete-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".LAN_3."</a>] ";
-		$userinfo	= "[<a href='".e_ADMIN_ABS."userinfo.php?".$comrow['comment_ip']."'>".LAN_4."</a>]";
+		$unblock	= "[<a href='".e_ADMIN_ABS."comment.php?unblock-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_1."</a>] ";
+		$block		= "[<a href='".e_ADMIN_ABS."comment.php?block-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_2."</a>] ";
+		$delete		= "[<a href='".e_ADMIN_ABS."comment.php?delete-".$comrow['comment_id']."-$url-".$comrow['comment_item_id']."'>".COMLAN_3."</a>] ";
+		$userinfo	= "[<a href='".e_ADMIN_ABS."userinfo.php?".$comrow['comment_ip']."'>".COMLAN_4."</a>]";
 
 		if (!$COMMENTSTYLE) {
 			global $THEMES_DIRECTORY;
@@ -309,7 +314,12 @@
         	return;
 		}
 
-		if(strstr(e_QUERY, "edit"))
+		if (isset($_GET['comment']) && $_GET['comment'] == 'edit')
+		{
+			$eaction = 'edit';
+			$editpid = $_GET['comment_id'];
+		}
+		else if (strstr(e_QUERY, "edit"))
 		{
 			$eaction = "edit";
 			$tmp = explode(".", e_QUERY);
@@ -341,7 +351,7 @@
 							list($cuser_id, $cuser_name) = $sql2->db_Fetch();
 							$nick = $cuser_id.".".$cuser_name;
 						} else {
-							define("emessage", LAN_310);
+							define("emessage", COMLAN_310);
 						}
 					} else {
 						$nick = "0.".$tp->toDB($author_name);
@@ -357,7 +367,7 @@
 
 					if($editpid)
 					{
-						$comment .= "\n[ ".LAN_319." [time=short]".time()."[/time] ]";
+						$comment .= "\n[ ".COMLAN_319." [time=short]".time()."[/time] ]";
 						$sql -> db_Update("comments", "comment_comment='$comment' WHERE comment_id='".intval($editpid)."' ");
 						$e107cache->clear("comment");
 						return;
@@ -365,7 +375,7 @@
 
 					if (!$sql->db_Insert("comments", "0, '".intval($pid)."', '".intval($id)."', '$subject', '$nick', '', '".$_t."', '$comment', '0', '$ip', '".$tp -> toDB($type, true)."', '0' "))
 					{
-						echo "<b>".COMLAN_3."</b> ".LAN_11;
+						echo "<b>".COMLAN_323."</b> ".COMLAN_11;
 					}
 					else
 					{
@@ -385,7 +395,7 @@
 		}
 		else
 		{
-			define("emessage", LAN_312);
+			define("emessage", COMLAN_312);
 		}
 		//if rateindex is posted, enter the rating from this user
 		if($rateindex){
@@ -404,23 +414,25 @@
 	 * @param unknown_type $table
 	 * @return unknown
 	 */
-	function getCommentType($table){
-			switch($table) {
-				case "news"		: $type = 0; break;
+	function getCommentType($table)
+	{
+			if(is_numeric($table)) { return $table;	}
+
+			switch($table)
+			{
+				case "news"			: $type = 0; break;
 				case "content"	: $type = 1; break;
 				case "download"	: $type = 2; break;
-				case "faq"		: $type = 3; break;
-				case "poll"		: $type = 4; break;
-				case "docs"		: $type = 5; break;
+				case "faq"			: $type = 3; break;
+				case "poll"			: $type = 4; break;
+				case "docs"			: $type = 5; break;
 				case "bugtrack"	: $type = 6; break;
+				default					: $type = $table; break;
 				/****************************************
 				Add your comment type here in same format as above, ie ...
 				case "your_comment_type"; $type = your_type_id; break;
 				****************************************/
 			}
-			if (!isset($type)) {
-				$type = $table;
-			}
 			return $type;
 	}
 
@@ -431,14 +443,10 @@
 	 * @param unknown_type $id
 	 * @return unknown
 	 */
-	function count_comments($table, $id){
+	function count_comments($table, $id)
+	{
 		global $sql, $tp;
-
-		if(is_numeric($table)){
-			$type = $table;
-		}else{
-			$type = $this -> getCommentType($table);
-		}
+		$type = $this -> getCommentType($table);
 		$count_comments = $sql -> db_Count("comments", "(*)", "WHERE comment_item_id='".intval($id)."' AND comment_type='".$tp -> toDB($type, true)."' ORDER BY comment_item_id");
 		return $count_comments;
 	}
@@ -499,7 +507,7 @@
 
 			if ($tablerender)
 			{
-				$text = $ns->tablerender(LAN_99, $text, '', TRUE);
+				$text = $ns->tablerender(COMLAN_99, $text, '', TRUE);
 			}
 
 			if (!$return)
@@ -513,7 +521,7 @@
 
 			if (ADMIN && getperms("B"))
 			{
-				$modcomment =  "<div style='text-align:right'><a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".LAN_314."</a></div><br />";
+				$modcomment =  "<div style='text-align:right'><a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".COMLAN_314."</a></div><br />";
 			}
 		}
 
@@ -523,7 +531,7 @@
 		}
 		else
 		{
-			$comment = "<br /><div style='text-align:center'><b>".COMLAN_8."</b></div>";
+			$comment = "<br /><div style='text-align:center'><b>".COMLAN_328."</b></div>";
 		}
 
 		if (!$return)
@@ -533,29 +541,312 @@
 
 		$ret['comment'] .= $modcomment;
 		$ret['comment_form'] = $comment;
-		$ret['caption'] = LAN_99;
+		$ret['caption'] = COMLAN_99;
 
 		return (!$return) ? "" : $ret;
 	}
-	
-	function delete_comments($table, $id)
-	{
-		global $sql, $tp;
 
-		if(is_numeric($table))
+	function recalc_user_comments($id)
+	{
+		global $sql;
+	
+		if(is_array($id))
 		{
-			$type = $table;
+			foreach($id as $_id)
+			{
+				$this->recalc_user_comments($_id);
+			}
 		}
-		else
+		$qry = "
+		SELECT COUNT(*) AS count
+		FROM #comments
+		WHERE SUBSTRING_INDEX(comment_author,'.',1) = '{$id}'
+		";
+		if($sql->db_Select_gen($qry))
+		{
+			$row = $sql->db_Fetch();
+			$sql->db_Update("user","user_comments = '{$row['count']}' WHERE user_id = '{$id}'");
+		}
+	}
+	
+	function get_author_list($id, $comment_type)
+	{
+		global $sql;
+		$authors = array();
+		$qry = "
+		SELECT DISTINCT(SUBSTRING_INDEX(comment_author,'.',1)) AS author 
+		FROM #comments
+		WHERE comment_item_id='{$id}' AND comment_type='{$comment_type}' 
+		GROUP BY author
+		";
+		if($sql->db_Select_gen($qry))
 		{
-			$type = $this -> getCommentType($table);
+			while($row = $sql->db_Fetch())
+			{
+				$authors[] = $row['author'];
+			}
 		}
+		return $authors;
+	}
+
+	function delete_comments($table, $id)
+	{
+		global $sql, $tp;
+
+		$type = $this -> getCommentType($table);
 		$type = $tp -> toDB($type, true);
 		$id = intval($id);
+		$author_list = $this->get_author_list($id, $type);
 		$num_deleted = $sql -> db_Delete("comments", "comment_item_id='{$id}' AND comment_type='{$type}'");
+		$this->recalc_user_comments($author_list);
 		return $num_deleted;
 	}
-	
-}
+
+
+	//1) call function getCommentData(); from file
+	//2) function-> get number of records from comments db
+	//3) get all e_comment.php files and collect the variables
+	//4) interchange the db rows and the e_ vars
+	//5) return the interchanged data in array
+	//6) from file: render the returned data
+
+	//get all e_comment.php files and collect the variables
+	function get_e_comment(){
+
+		$data = getcachedvars('e_comment');
+		if($data!==FALSE){
+			return $data;
+		}
+
+		require_once(e_HANDLER."file_class.php");
+		$fl = new e_file;
+
+		$omit = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','.bak$');
+		$files = $fl->get_files(e_PLUGIN, $fmask = 'e_comment.php', $omit, $recurse_level = 1, $current_level = 0);
+
+		foreach($files as $file){
+			unset($e_comment, $key);
+			include($file['path'].$file['fname']);
+			if($e_comment && is_array($e_comment)){
+				$key = $e_comment['eplug_comment_ids'];
+				if(isset($key) && $key!=''){
+					$data[$key] = $e_comment;
+				}
+			}else{
+				//convert old method variables into the same array method
+				$key = $e_plug_table;
+				if(isset($key) && $key!=''){
+					$e_comment['eplug_comment_ids']	= $e_plug_table;
+					$e_comment['plugin_name']		= $plugin_name;
+					$e_comment['plugin_path']		= $plugin_path;
+					$e_comment['reply_location']	= $reply_location;
+					$e_comment['db_title']			= $link_name;
+					$e_comment['db_id']				= $db_id;
+					$e_comment['db_table']			= $db_table;
+					$e_comment['qry']				= '';
+					$data[$key] = $e_comment;
+				}
+			}
+		}
+		cachevars('e_comment', $data);
+		return $data;
+	}
+
+
+	/*
+	* get number of records from comments db
+	* interchange the db rows and the e_comment vars
+	* return the interchanged data in array
+	*
+	* @param int $amount : holds numeric value for number of comments to ge
+	* @param int $from : holds numeric value from where to start retrieving
+	* @param string $qry : holds custom query to add in the comment retrieval
+	* next two parms are only used in iterating loop if less valid records are found
+	* @param int $cdvalid : number of valid records found
+	* @param array $cdreta : current data set
+	*/
+
+	function getCommentData($amount='', $from='', $qry='', $cdvalid=FALSE, $cdreta=FALSE){
+		global $pref, $menu_pref, $sql, $sql2, $tp;
+
+		$from1 = ($from ? $from : '0');
+		$amount1 = ($amount ? $amount : '10');
+		$valid = ($cdvalid ? $cdvalid : '0');
+		$reta = ($cdreta ? $cdreta : array());
+
+		//get all e_comment data
+		$e_comment = $this->get_e_comment();
+
+		$qry1 = ($qry ? " AND ".$qry : "");
+
+		//get 'amount' of records from comment db
+		/*
+		$query = $pref['nested_comments'] ?
+		"SELECT c.*, u.*, ue.* FROM #comments AS c
+		LEFT JOIN #user AS u ON c.comment_author = u.user_id
+		LEFT JOIN #user_extended AS ue ON c.comment_author = ue.user_extended_id
+		WHERE c.comment_pid='0' ".$qry1." ORDER BY c.comment_datestamp DESC LIMIT ".intval($from1).",".intval($amount1)." "
+		:
+		"SELECT c.*, u.*, ue.* FROM #comments AS c
+		LEFT JOIN #user AS u ON c.comment_author = u.user_id
+		LEFT JOIN #user_extended AS ue ON c.comment_author = ue.user_extended_id
+		WHERE c.comment_id!='' ".$qry1." ORDER BY c.comment_datestamp DESC LIMIT ".intval($from1).",".intval($amount1)." ";
+		*/
+
+		$query = "
+		SELECT c.*, u.*, ue.* FROM #comments AS c
+		LEFT JOIN #user AS u ON c.comment_author = u.user_id
+		LEFT JOIN #user_extended AS ue ON c.comment_author = ue.user_extended_id
+		WHERE c.comment_id!='' ".$qry1." ORDER BY c.comment_datestamp DESC LIMIT ".intval($from1).",".intval($amount1)." ";
+
+		if ($comment_total = $sql->db_Select_gen($query))
+		{
+			$width = 0;
+			while ($row = $sql->db_Fetch()){
+
+				$ret = array();
+
+				//date
+				$ret['comment_datestamp'] = $row['comment_datestamp'];
+
+				//author
+				$comment_author_id = substr($row['comment_author'] , 0, strpos($row['comment_author'] , "."));
+				$comment_author_name = substr($row['comment_author'] , (strpos($row['comment_author'] , ".")+1));
+				$ret['comment_author_id'] = $comment_author_id;
+				$ret['comment_author_name'] = $comment_author_name;
+				$ret['comment_author'] = (USERID ? "<a href='".e_BASE."user.php?id.".$comment_author_id."'>".$comment_author_name."</a>" : $comment_author_name);
+
+				//comment text
+				$comment = strip_tags(preg_replace("/\[.*\]/", "", $row['comment_comment'])); // remove bbcode
+				$ret['comment_comment'] = $tp->toHTML($comment, FALSE, "", "", $pref['menu_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."' ")){
+						$row2 = $sql2 -> db_Fetch();
+
+						$ret['comment_type']				= COMLAN_TYPE_1;
+						$ret['comment_title']				= $tp -> toHTML($row2['news_title'], TRUE,'emotes_off, no_make_clickable');
+						$ret['comment_url']					= e_BASE."comment.php?comment.news.".$row['comment_item_id'];
+						$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)){
+						$row2 = $sql2->db_Fetch();
+
+						$ret['comment_type']				= COMLAN_TYPE_2;
+						$ret['comment_title']				= $tp -> toHTML($row2['download_name'], TRUE,'emotes_off, no_make_clickable');
+						$ret['comment_url']					= e_BASE."download.php?view.".$row['comment_item_id'];
+						$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']."' ")){
+						$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"){
+					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' ")){
+							$qryp = str_replace("{NID}", $row['comment_item_id'], $var['qry']);
+							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');
+								$ret['comment_url']					= str_replace("{NID}", $row['comment_item_id'], $var['reply_location']);
+								$ret['comment_category_heading']	= $var['plugin_name'];
+								$ret['comment_category_url']		= $var['plugin_name'];
+							}
+						}
+					//old method
+					}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'];
+							$ret['comment_title']				= $tp -> toHTML($row2[$var['db_title']], TRUE,'emotes_off, no_make_clickable');
+							$ret['comment_url']					= str_replace("{NID}", $row['comment_item_id'], $var['reply_location']);
+							$ret['comment_category_heading']	= $var['plugin_name'];
+							$ret['comment_category_url']		= $var['plugin_name'];
+						}
+					}
+				}
+				if($ret['comment_title']){
+					$reta[] = $ret;
+					$valid++;
+				}
+				if($amount && $valid>=$amount){
+					return $reta;
+				}
+			}
+			//loop if less records found than given $amount
+			if($amount && $valid<$amount){
+				$reta = $this->getCommentData($amount, $from+$amount, $qry, $valid, $reta);
+			}
+		}
+		return $reta;
+	}
+
+} //end class
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/db_debug_class.php 0.7.7/e107_handlers/db_debug_class.php
--- 0.7.5/e107_handlers/db_debug_class.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/db_debug_class.php	2006-11-09 10:50:23.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/db_debug_class.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2006/11/09 16:50:23 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -31,7 +31,7 @@
 	var $aBadQueries = array();
 	var $scbbcodes = array();
 	var $scbcount;
-	var $depreciated_funcs = array();
+	var $deprecated_funcs = array();
 
 	function e107_db_debug() {
 		global $eTimingStart;
@@ -49,30 +49,30 @@
 	}
 
 	function Mark_Time($sMarker) { // Should move to traffic_class?
-	$timeNow=microtime();
-	$nMarks=++$this->nTimeMarks;
-
-	if (!strlen($sMarker)) {
-		$sMarker = "Mark not set";
-	}
-
-	$this->aTimeMarks[$nMarks]=array(
-	'Index' => ($this->nTimeMarks),
-	'What' => $sMarker,
-	'%Time' => 0,
-	'%DB Time' => 0,
-	'%DB Count' => 0,
-	'Time' => $timeNow,
-	'DB Time' => 0,
-	'DB Count' => 0
-	);
-
-	$this->aOBMarks[$nMarks]=ob_get_level().'('.ob_get_length().')';
-	$this->curTimeMark=$sMarker;
-
-	// Add any desired notes to $aMarkNotes[$nMarks]... e.g.
-	//global $eTimingStart;
-	//$this->aMarkNotes[$nMarks] .= "verify start: ".$eTimingStart."<br/>";
+		$timeNow=microtime();
+		$nMarks=++$this->nTimeMarks;
+	
+		if (!strlen($sMarker)) {
+			$sMarker = "Mark not set";
+		}
+	
+		$this->aTimeMarks[$nMarks]=array(
+		'Index' => ($this->nTimeMarks),
+		'What' => $sMarker,
+		'%Time' => 0,
+		'%DB Time' => 0,
+		'%DB Count' => 0,
+		'Time' => $timeNow,
+		'DB Time' => 0,
+		'DB Count' => 0
+		);
+	
+		$this->aOBMarks[$nMarks]=ob_get_level().'('.ob_get_length().')';
+		$this->curTimeMark=$sMarker;
+	
+		// Add any desired notes to $aMarkNotes[$nMarks]... e.g.
+		//global $eTimingStart;
+		//$this->aMarkNotes[$nMarks] .= "verify start: ".$eTimingStart."<br/>";
 	}
 
 	function Mark_Query($query, $rli, $origQryRes, $aTrace, $mytime, $curtable) {
@@ -226,9 +226,8 @@
 
 		if (!E107_DBG_TIMEDETAILS) return '';
 
-		$text='';
 		$totTime=$eTraffic->TimeDelta($eTimingStart, $eTimingStop);
-		$text .= "\n<table class='fborder'>\n";
+		$text = "\n<table class='fborder'>\n";
 		$bRowHeaders=FALSE;
 		reset($this->aTimeMarks);
 		$aSum=$this->aTimeMarks[0]; // create a template from the 'real' array
@@ -260,30 +259,37 @@
 			}
 
 			if ($tMarker['What'] == 'Stop') {
-				break; // We're on the 'stop' mark
+				$tMarker['Time']='&nbsp;';
+				$tMarker['%Time']='&nbsp;';
+				$tMarker['%DB Count']='&nbsp;';
+				$tMarker['%DB Time']='&nbsp;';
+				$tMarker['DB Time']='&nbsp;';
+				$tMarker['OB Lev']=$this->aOBMarks[$tKey];
+				$tMarker['DB Count']='&nbsp;';
+			} else {
+				// Convert from start time to delta time, i.e. from now to next entry
+				$nextMarker=current($this->aTimeMarks);
+				$aNextT=$nextMarker['Time'];
+				$aThisT=$tMarker['Time'];
+	
+				$thisDelta=$eTraffic->TimeDelta($aThisT, $aNextT);
+				$aSum['Time'] += $thisDelta;
+				$aSum['DB Time'] += $tMarker['DB Time'];
+				$aSum['DB Count'] += $tMarker['DB Count'];
+				$tMarker['Time']=number_format($thisDelta*1000.0, 1);
+				$tMarker['%Time']=$totTime ? number_format(100.0 * ($thisDelta / $totTime), 0) : 0;
+				$tMarker['%DB Count']=number_format(100.0 * $tMarker['DB Count'] / $sql->db_QueryCount(), 0);
+				$tMarker['%DB Time']=$db_time ? number_format(100.0 * $tMarker['DB Time'] / $db_time, 0) : 0;
+				$tMarker['DB Time']=number_format($tMarker['DB Time']*1000.0, 1);
+				$tMarker['OB Lev']=$this->aOBMarks[$tKey];
 			}
-
-			// Convert from start time to delta time, i.e. from now to next entry
-			$nextMarker=current($this->aTimeMarks);
-			$aNextT=$nextMarker['Time'];
-			$aThisT=$tMarker['Time'];
-
-			$thisDelta=$eTraffic->TimeDelta($aThisT, $aNextT);
-			$aSum['Time'] += $thisDelta;
-			$aSum['DB Time'] += $tMarker['DB Time'];
-			$aSum['DB Count'] += $tMarker['DB Count'];
-			$tMarker['Time']=number_format($thisDelta*1000.0, 1);
-			$tMarker['%Time']=$totTime ? number_format(100.0 * ($thisDelta / $totTime), 0) : 0;
-			$tMarker['%DB Count']=number_format(100.0 * $tMarker['DB Count'] / $sql->db_QueryCount(), 0);
-			$tMarker['%DB Time']=$db_time ? number_format(100.0 * $tMarker['DB Time'] / $db_time, 0) : 0;
-			$tMarker['DB Time']=number_format($tMarker['DB Time']*1000.0, 1);
-			$tMarker['OB Lev']=$this->aOBMarks[$tKey];
 			$text .= "<tr><td class='forumheader3' >".implode("&nbsp;</td><td class='forumheader3'  style='text-align:right'>", array_values($tMarker))."&nbsp;</td></tr>\n";
 
 			if (isset($this->aMarkNotes[$tKey])) {
 				$text .= "<tr><td class='forumheader3' >&nbsp;</td><td class='forumheader3' colspan='4'>";
 				$text .= $this->aMarkNotes[$tKey]."</td></tr>\n";
 			}
+			if ($tMarker['What'] == 'Stop') break;
 		}
 
 		$aSum['%Time']=$totTime ? number_format(100.0 * ($aSum['Time'] / $totTime), 0) : 0;
@@ -302,6 +308,12 @@
 		$text .= "\n<table class='fborder'>\n";
 
 		$bRowHeaders=FALSE;
+		$aSum=$this->aDBbyTable['core']; // create a template from the 'real' array
+		$aSum['Table']='Total';
+		$aSum['%DB Count']=0;
+		$aSum['%DB Time']=0;
+		$aSum['DB Time']=0;
+		$aSum['DB Count']=0;
 
 		foreach ($this->aDBbyTable as $curTable) {
 			if (!$bRowHeaders) {
@@ -321,25 +333,31 @@
 				$text .= "<tr><td class='fcaption' style='text-align:right'><b>".implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", $aUnits)."</b>&nbsp;</td></tr>\n";
 			}
 
+			$aSum['DB Time'] += $curTable['DB Time'];
+			$aSum['DB Count'] += $curTable['DB Count'];
 			$curTable['%DB Count']=number_format(100.0 * $curTable['DB Count'] / $sql->db_QueryCount(), 0);
 			$curTable['%DB Time']=number_format(100.0 * $curTable['DB Time'] / $db_time, 0);
-			$curTable['DB Time']=number_format($curTable['DB Time'], 4);
+			$curTable['DB Time']=number_format($curTable['DB Time']*1000.0, 1);
 			$text .= "<tr><td class='forumheader3'>".implode("&nbsp;</td><td class='forumheader3' style='text-align:right'>", array_values($curTable))."&nbsp;</td></tr>\n";
 		}
 
+		$aSum['%DB Time']=$db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time), 0) : 0;
+		$aSum['%DB Count']=($sql->db_QueryCount()) ? number_format(100.0 * ($aSum['DB Count'] / ($sql->db_QueryCount())), 0) : 0;
+		$aSum['DB Time']=number_format($aSum['DB Time']*1000.0, 1);
+		$text .= "<tr><td class='fcaption'>".implode("&nbsp;</td><td class='fcaption' style='text-align:right'>", array_values($aSum))."&nbsp;</td></tr>\n";
 		$text .= "\n</table><br/>\n";
 
 		return $text;
 	}
 
-	function aDeprecatiated(){
+	function logDeprecated(){
 
 		$back_trace = debug_backtrace();
 
 		print_r($back_trace);
 
-		$this->depreciated_funcs[] =	array (
-		'func'	=> ($back_trace[1]['type'] == '::' || $back_trace[1]['type'] == '->' ? $back_trace[1]['class'].$back_trace[1]['type'].$back_trace[1]['function'] : $back_trace[1]['function']),
+		$this->deprecated_funcs[] =	array (
+		'func'	=> (isset($back_trace[1]['type']) && ($back_trace[1]['type'] == '::' || $back_trace[1]['type'] == '->') ? $back_trace[1]['class'].$back_trace[1]['type'].$back_trace[1]['function'] : $back_trace[1]['function']),
 		'file'	=> $back_trace[1]['file'],
 		'line'	=> $back_trace[1]['line']
 		);
@@ -365,7 +383,7 @@
 		{
 			return FALSE;
 		}
-		$text .= "<table class='fborder' style='width: 100%'>
+		$text = "<table class='fborder' style='width: 100%'>
 			<tr><td class='fcaption' colspan='4'><b>Shortcode / BBCode</b></td></tr>
 			<tr>
 			<td class='fcaption' style='width: 10%;'>Type</td>
@@ -394,7 +412,7 @@
 			return FALSE;
 		}
 		global $e107;
-		$text .= "<table class='fborder' style='width: 100%'>
+		$text = "<table class='fborder' style='width: 100%'>
 			<tr><td class='fcaption' colspan='4'><b>Paths</b></td></tr>
 			<tr>
 			<td class='forumheader3'>\n";
@@ -415,20 +433,19 @@
 	}
 
 
-	function Show_DEPRECIATED(){
-		$text = '';
-		if (!E107_DBG_DEPRECIATED){
+	function Show_DEPRECATED(){
+		if (!E107_DBG_DEPRECATED){
 			return FALSE;
 		} else {
-			$text .= "<table class='fborder' style='width: 100%'>
-			<tr><td class='fcaption' colspan='4'><b>The following depreciated functions were used:</b></td></tr>
+			$text = "<table class='fborder' style='width: 100%'>
+			<tr><td class='fcaption' colspan='4'><b>The following deprecated functions were used:</b></td></tr>
 			<tr>
 			<td class='fcaption' style='width: 10%;'>Function</td>
 			<td class='fcaption' style='width: 10%;'>File</td>
 			<td class='fcaption' style='width: 10%;'>Line</td>
 			</tr>\n";
 
-			foreach($this->depreciated_funcs as $funcs)
+			foreach($this->deprecated_funcs as $funcs)
 			{
 				$text .= "<tr>
 				<td class='forumheader3' style='width: 10%;'>{$funcs['func']}()</td>
diff -ruN 0.7.5/e107_handlers/debug_handler.php 0.7.7/e107_handlers/debug_handler.php
--- 0.7.5/e107_handlers/debug_handler.php	2006-02-01 08:19:15.000000000 -0600
+++ 0.7.7/e107_handlers/debug_handler.php	2006-11-09 10:50:32.000000000 -0600
@@ -11,14 +11,72 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/debug_handler.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/02/01 14:19:15 $
-|     $Author: sweetas $
+|     $Revision: 1.20 $
+|     $Date: 2006/11/09 16:50:32 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
+//
+// IMPORTANT Info for devs who want to add to and/or use debug definitions!
+//
+// MAKING NEW DEBUG DEFS
+// The debug levels are Single Bit Binary Values. i.e, 1,2,4,8,16...
+// In the table below, if you want to define a new value, pick one of
+// the "FILLIN" items and give it the name and definition you need
+//
+// USING DEBUG DEFINITIONS
+// Since these are Bit Values, **never** test using < or > comparisons. Always
+// test using boolean operations, such as
+//    if (E107_DBG_PATH)
+//    if (E107_DBG_SQLQUERIES | E107_DBG_SQLDETAILS)
+// Since constants are defined for all possible bits, you should never need to use a number value like
+//    if (E107_DEBUG_LEVEL & 256)
+// And there's never a reason to use
+//    if (E107_DEBUG_LEVEL > 254)
+
 if (!defined('e107_INIT')) { exit; }
 
+//
+// If debugging enabled, set it all up
+// If no debugging, then E107_DEBUG_LEVEL will be zero
+//
+if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level'])) {
+	$e107_debug = new e107_debug;
+	require_once(e_HANDLER.'db_debug_class.php');
+	$db_debug = new e107_db_debug;
+	$e107_debug->set_error_reporting();
+	$e107_debug_level = $e107_debug->debug_level;
+	define('E107_DEBUG_LEVEL', $e107_debug_level);
+} else {
+	define('E107_DEBUG_LEVEL', 0);
+}
+
+// 
+// Define all debug constants -- each one will be zero or a value
+// They all have different values and can be 'or'ed together
+//
+
+// Basic levels
+define('E107_DBG_BASIC',		(E107_DEBUG_LEVEL & 1));       // basics: worst php errors, sql errors, 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
+define('E107_DBG_FILLIN16',		(E107_DEBUG_LEVEL & 16));      // fill in what it is
+define('E107_DBG_FILLIN32',		(E107_DEBUG_LEVEL & 32));      // fill in what it is
+define('E107_DBG_FILLIN64',		(E107_DEBUG_LEVEL & 64));      // fill in what it is
+define('E107_DBG_FILLIN128',	(E107_DEBUG_LEVEL & 128));     // fill in what it is
+
+// Gory detail levels
+define('E107_DBG_TIMEDETAILS',(E107_DEBUG_LEVEL &   256));    // detailed time profile
+define('E107_DBG_SQLDETAILS',	(E107_DEBUG_LEVEL &   512));    // detailed sql analysis
+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_DEPRECATED', (E107_DEBUG_LEVEL & 16384));    // Show use of deprecated functions
+define('E107_DBG_ALLERRORS',	(E107_DEBUG_LEVEL & 32768));   // show ALL errors//...
+
 class e107_debug {
 
 	var $debug_level = 1;
@@ -26,22 +84,23 @@
 	// DEBUG SHORTCUTS
 	//
 	var $aDebugShortcuts = array(
-		'all'		 	=> 255,     // all basics
+		'all'		 	  => 255,     // all basics
 		'basic'			=> 255,     // all basics
-		'b'				=> 255,     // all basics
-		'depreciated'	=> 32766,   // show if code is using depreciated functions
+		'b'				  => 255,     // all basics
+		'warn'			=> 1,       // just warnings, parse errrors, etc
 		'showsql'		=> 2,       // sql basics
 		'counts'		=> 4,       // traffic counters
+
 		'detail'		=> 32767,   // all details
-		'd' 			=> 32767,   // all details
+		'd' 			  => 32767,   // all details
 		'time' 			=> 256,     // time details
 		'sql' 			=> 512,     // sql details
-		'warn'			=> 1,       // just warnings, parse errrors, etc
+		'paths' 		=> 1024,		// dump path strings
+		'bbsc' 			=> 2048,		// show bb and sc details
+		'sc'			  => 4096,   		// Shortcode paths dumped inline
+		'deprecated'	=> 16384,   // show if code is using deprecated functions
 		'notice'		=> 32768,   // you REALLY don't want all this, do you?
-		'everything' 	=> 65535,
-		'bbsc' 			=> 65536,
-		'paths' 		=> 131072,
-		'sc'			=> 5		// Shortcode paths only.
+		'everything'=> 65535,
 	);
 
 	function e107_debug() {
@@ -52,13 +111,16 @@
 			if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU)) {
 				$dVal = $debug_param[1] == '=' ? $debug_param[2] : 'everything';
 			}
-			if ($debug_param[3] == '+' || $debug_param[3] == 'stick')
-			{
-				cookie('e107_debug_level', 'level='.$dVal, time() + 86400);
-			}
-			if ($debug_param[3] == '-' || $debug_param[3] == 'unstick')
+			if (isset($debug_param[3]))
 			{
-				cookie('e107_debug_level', '', time() - 3600);
+				if ($debug_param[3] == '+' || $debug_param[3] == 'stick')
+				{
+					cookie('e107_debug_level', 'level='.$dVal, time() + 86400);
+				}
+				if ($debug_param[3] == '-' || $debug_param[3] == 'unstick')
+				{
+					cookie('e107_debug_level', '', time() - 3600);
+				}
 			}
 
 			if (isset($this->aDebugShortcuts[$dVal])) {
@@ -72,36 +134,4 @@
 	function set_error_reporting() {
 	}
 }
-
-if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level'])) {
-	$e107_debug = new e107_debug;
-	require_once(e_HANDLER.'db_debug_class.php');
-	$db_debug = new e107_db_debug;
-	$e107_debug->set_error_reporting();
-	$e107_debug_level = $e107_debug->debug_level;
-	define('E107_DEBUG_LEVEL', $e107_debug_level);
-} else {
-	define('E107_DEBUG_LEVEL', 0);
-}
-
-// Basic levels
-define('E107_DBG_BASIC',		(E107_DEBUG_LEVEL & 1));       // basics: worst php errors, sql errors, 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
-define('E107_DBG_FILLIN16',		(E107_DEBUG_LEVEL & 16));      // fill in what it is
-define('E107_DBG_FILLIN32',		(E107_DEBUG_LEVEL & 32));      // fill in what it is
-define('E107_DBG_FILLIN64',		(E107_DEBUG_LEVEL & 64));      // fill in what it is
-define('E107_DBG_FILLIN128',	(E107_DEBUG_LEVEL & 128));     // fill in what it is
-
-// Gory detail levels
-define('E107_DBG_TIMEDETAILS',	(E107_DEBUG_LEVEL & 256));     // detailed time profile
-define('E107_DBG_SQLDETAILS',	(E107_DEBUG_LEVEL & 512));     // detailed sql analysis
-define('E107_DBG_FILLIN1024',	(E107_DEBUG_LEVEL & 1024));    // fill in what it is
-define('E107_DBG_FILLIN2048',	(E107_DEBUG_LEVEL & 2048));    // fill in what it is
-define('E107_DBG_DEPRECIATED',	(E107_DEBUG_LEVEL & 32766));   // show used depricated funcs
-define('E107_DBG_ALLERRORS',	(E107_DEBUG_LEVEL & 32768));   // show ALL errors//...
-define('E107_DBG_BBSC',			(E107_DEBUG_LEVEL & 65536));   // BBCode / Shortcode
-define('E107_DBG_PATH',			(E107_DEBUG_LEVEL & 131072));
-
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/e107_Compat_handler.php 0.7.7/e107_handlers/e107_Compat_handler.php
--- 0.7.5/e107_handlers/e107_Compat_handler.php	2005-12-21 14:48:43.000000000 -0600
+++ 0.7.7/e107_handlers/e107_Compat_handler.php	2006-10-21 06:05:49.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e107_Compat_handler.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/12/21 20:48:43 $
-|     $Author: sweetas $
+|     $Revision: 1.14 $
+|     $Date: 2006/10/21 11:05:49 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -29,9 +29,9 @@
  * @return string
  */
 function retrieve_cache($query) {
-	if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+	if (E107_DBG_DEPRECATED) {
 		global $db_debug;
-		$db_debug->aDeprecatiated();
+		$db_debug->logDeprecated();
 	}
 	global $e107cache, $e107_debug;
 	if (!is_object($e107cache)) {
@@ -55,9 +55,9 @@
  * @return string
  */
 function set_cache($query, $text) {
-	if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+	if (E107_DBG_DEPRECATED) {
 		global $db_debug;
-		$db_debug->aDeprecatiated();
+		$db_debug->logDeprecated();
 	}
 	global $e107cache;
 	if (!is_object($e107cache)) {
@@ -79,9 +79,9 @@
  * @return bool
  */
 function clear_cache($query) {
-	if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+	if (E107_DBG_DEPRECATED) {
 		global $db_debug;
-		$db_debug->aDeprecatiated();
+		$db_debug->logDeprecated();
 	}
 	global $e107cache;
 	if (!is_object($e107cache)) {
@@ -97,9 +97,9 @@
  * @deprecated deprecated since v.700
  */
 function ban() {
-	if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+	if (E107_DBG_DEPRECATED) {
 		global $db_debug;
-		$db_debug->aDeprecatiated();
+		$db_debug->logDeprecated();
 	}
 	global $e107;
 	$e107->ban();
@@ -112,9 +112,9 @@
  * @deprecated deprecated since v.700
  */
 function getip() {
-	if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+	if (E107_DBG_DEPRECATED) {
 		global $db_debug;
-		$db_debug->aDeprecatiated();
+		$db_debug->logDeprecated();
 	}
 	global $e107;
 	return $e107->getip();
@@ -123,44 +123,44 @@
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 class textparse {
 	function editparse($text, $mode = "off") {
-		if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+		if (E107_DBG_DEPRECATED) {
 			global $db_debug;
-			$db_debug->aDeprecatiated();
+			$db_debug->logDeprecated();
 		}
 		global $tp;
 		return $tp->toForm($text);
 	}
 
 	function tpa($text, $mode = '', $referrer = '', $highlight_search = FALSE, $poster_id = '') {
-		if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+		if (E107_DBG_DEPRECATED) {
 			global $db_debug;
-			$db_debug->aDeprecatiated();
+			$db_debug->logDeprecated();
 		}
 		global $tp;
 		return $tp->toHTML($text, TRUE, $mode, $poster_id);
 	}
 
 	function tpj($text) {
-		if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+		if (E107_DBG_DEPRECATED) {
 			global $db_debug;
-			$db_debug->aDeprecatiated();
+			$db_debug->logDeprecated();
 		}
 		return $text;
 	}
 
 	function formtpa($text, $mode = '') {
-		if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+		if (E107_DBG_DEPRECATED) {
 			global $db_debug;
-			$db_debug->aDeprecatiated();
+			$db_debug->logDeprecated();
 		}
 		global $tp;
 		return $tp->toDB($text);
 	}
 
 	function formtparev($text) {
-		if (defined('E107_DEBUG_LEVEL') && E107_DEBUG_LEVEL >= 32766) {
+		if (E107_DBG_DEPRECATED) {
 			global $db_debug;
-			$db_debug->aDeprecatiated();
+			$db_debug->logDeprecated();
 		}
 		global $tp;
 		return $tp->toFORM($text);
diff -ruN 0.7.5/e107_handlers/e107_class.php 0.7.7/e107_handlers/e107_class.php
--- 0.7.5/e107_handlers/e107_class.php	2006-04-05 07:03:04.000000000 -0500
+++ 0.7.7/e107_handlers/e107_class.php	2006-11-29 17:32:20.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     �Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -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.51 $
-|     $Date: 2006/04/05 12:03:04 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.56 $
+|     $Date: 2006/11/29 23:32:20 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -34,7 +34,6 @@
 	var $relative_base_path;
 	var $_ip_cache;
 	var $_host_name_cache;
-
 	/**
 	 * e107 class constructor
 	 *
@@ -84,33 +83,36 @@
 		$this->https_path = "https://{$_SERVER['HTTP_HOST']}{$this->server_path}";
 		$this->file_path = $path;
 
-		define("e_HTTP", $this->server_path);
-		define("e_BASE", $this->relative_base_path);
-		define("e_ADMIN", e_BASE.$ADMIN_DIRECTORY);
-		define("e_IMAGE", e_BASE.$IMAGES_DIRECTORY);
-		define("e_THEME", e_BASE.$THEMES_DIRECTORY);
-		define("e_PLUGIN", e_BASE.$PLUGINS_DIRECTORY);
-		define("e_FILE", e_BASE.$FILES_DIRECTORY);
-		define("e_HANDLER", e_BASE.$HANDLERS_DIRECTORY);
-		define("e_LANGUAGEDIR", e_BASE.$LANGUAGES_DIRECTORY);
-
-		define("e_ADMIN_ABS", e_HTTP.$ADMIN_DIRECTORY);
-		define("e_IMAGE_ABS", e_HTTP.$IMAGES_DIRECTORY);
-		define("e_THEME_ABS", e_HTTP.$THEMES_DIRECTORY);
-		define("e_PLUGIN_ABS", e_HTTP.$PLUGINS_DIRECTORY);
-		define("e_FILE_ABS", e_HTTP.$FILES_DIRECTORY);
-		define("e_HANDLER_ABS", e_HTTP.$HANDLERS_DIRECTORY);
-		define("e_LANGUAGEDIR_ABS", e_HTTP.$LANGUAGES_DIRECTORY);
+		if(!defined("e_HTTP") || !defined("e_ADMIN") )
+		{
+			define("e_HTTP", $this->server_path);
+			define("e_BASE", $this->relative_base_path);
+			define("e_ADMIN", e_BASE.$ADMIN_DIRECTORY);
+			define("e_IMAGE", e_BASE.$IMAGES_DIRECTORY);
+			define("e_THEME", e_BASE.$THEMES_DIRECTORY);
+			define("e_PLUGIN", e_BASE.$PLUGINS_DIRECTORY);
+			define("e_FILE", e_BASE.$FILES_DIRECTORY);
+			define("e_HANDLER", e_BASE.$HANDLERS_DIRECTORY);
+			define("e_LANGUAGEDIR", e_BASE.$LANGUAGES_DIRECTORY);
+
+			define("e_ADMIN_ABS", e_HTTP.$ADMIN_DIRECTORY);
+			define("e_IMAGE_ABS", e_HTTP.$IMAGES_DIRECTORY);
+			define("e_THEME_ABS", e_HTTP.$THEMES_DIRECTORY);
+			define("e_PLUGIN_ABS", e_HTTP.$PLUGINS_DIRECTORY);
+			define("e_FILE_ABS", e_HTTP.$FILES_DIRECTORY);
+			define("e_HANDLER_ABS", e_HTTP.$HANDLERS_DIRECTORY);
+			define("e_LANGUAGEDIR_ABS", e_HTTP.$LANGUAGES_DIRECTORY);
 
-		define("e_DOCS", e_BASE.$HELP_DIRECTORY);
-		define("e_DOCROOT", $_SERVER['DOCUMENT_ROOT']."/");
+			define("e_DOCS", e_BASE.$HELP_DIRECTORY);
+			define("e_DOCROOT", $_SERVER['DOCUMENT_ROOT']."/");
 
-		define("e_DOCS_ABS", e_HTTP.$HELP_DIRECTORY);
+			define("e_DOCS_ABS", e_HTTP.$HELP_DIRECTORY);
 
-		if ($DOWNLOADS_DIRECTORY{0} == "/") {
-			define("e_DOWNLOAD", $DOWNLOADS_DIRECTORY);
-		} else {
-			define("e_DOWNLOAD", e_BASE.$DOWNLOADS_DIRECTORY);
+			if ($DOWNLOADS_DIRECTORY{0} == "/") {
+				define("e_DOWNLOAD", $DOWNLOADS_DIRECTORY);
+			} else {
+				define("e_DOWNLOAD", e_BASE.$DOWNLOADS_DIRECTORY);
+			}
 		}
 	}
 
@@ -125,21 +127,30 @@
 	 *
 	 */
 	function ban() {
-		global $sql, $e107, $tp;
+		global $sql, $e107, $tp, $pref;
 		$ban_count = $sql->db_Count("banlist");
-		if($ban_count){
+		if($ban_count)
+		{
 			$ip = $this->getip();
 			$tmp = explode(".",$ip);
 			$wildcard =  $tmp[0].".".$tmp[1].".".$tmp[2].".*";
 			$wildcard2 = $tmp[0].".".$tmp[1].".*.*";
 
-			$tmp = $e107->get_host_name(getenv('REMOTE_ADDR'));
-
-			preg_match("/[\w]+\.[\w]+$/si", $tmp, $match);
-			$bhost = (isset($match[0]) ? " OR banlist_ip='".$tp -> toDB($match[0], true)."'" : "");
+			if(varsettrue($pref['enable_rdns']))
+			{
+				$tmp = $e107->get_host_name(getenv('REMOTE_ADDR'));
+				preg_match("/[\w]+\.[\w]+$/si", $tmp, $match);
+				$bhost = (isset($match[0]) ? " OR banlist_ip='".$tp -> toDB($match[0], true)."'" : "");
+			}
+			else
+			{
+				$bhost = "";
+			}
 
-			if ($ip != '127.0.0.1') {
-				if ($sql->db_Select("banlist", "*", "banlist_ip='".$tp -> toDB($_SERVER['REMOTE_ADDR'], true)."' OR banlist_ip='".USEREMAIL."' OR banlist_ip='{$ip}' OR banlist_ip='{$wildcard}' OR banlist_ip='{$wildcard2}' {$bhost}")) {
+			if ($ip != '127.0.0.1')
+			{
+				if ($sql->db_Select("banlist", "*", "banlist_ip='".$tp -> toDB($_SERVER['REMOTE_ADDR'], true)."' OR banlist_ip='".USEREMAIL."' OR banlist_ip='{$ip}' OR banlist_ip='{$wildcard}' OR banlist_ip='{$wildcard2}' {$bhost}"))
+				{
 				  header("HTTP/1.1 403 Forbidden", true);
 					// enter a message here if you want some text displayed to banned users ...
 					exit();
@@ -196,15 +207,15 @@
 		if(function_exists("memory_get_usage")){
 			$memusage = memory_get_usage();
 			$memunit = 'b';
-			if ($memusage > 1024){
+			if ($memusage > 1048576){
 				$memusage = $memusage / 1024;
 				$memunit = 'kb';
 			}
-			if ($memusage > 1024){
+			if ($memusage > 1048576){
 				$memusage = $memusage / 1024;
 				$memunit = 'mb';
 			}
-			if ($memusage > 1024){
+			if ($memusage > 1048576){
 				$memusage = $memusage / 1024;
 				$memunit = 'gb';
 			}
@@ -215,4 +226,4 @@
 	}
 
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/e_parse_class.php 0.7.7/e107_handlers/e_parse_class.php
--- 0.7.5/e107_handlers/e_parse_class.php	2006-04-28 20:03:10.000000000 -0500
+++ 0.7.7/e107_handlers/e_parse_class.php	2006-11-28 22:22:40.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|      Steve Dunstan 2001-2002
+|      Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -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.150 $
-|     $Date: 2006/04/29 01:03:10 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.176 $
+|     $Date: 2006/11/29 04:22:40 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -28,7 +28,8 @@
 	var $e_hook;
 	var $search = array('&#39;', '&#039;', '&quot;', 'onerror', '&gt;', '&amp;#039;', '&amp;quot;');
 	var $replace = array("'", "'", '"', 'one<i></i>rror', '>', "'", '"');
-	var $e_query;
+	var $e_highlighting;		// Set to TRUE or FALSE once it has been calculated
+	var $e_query;			// Highlight query
 
 	function toDB($data, $nostrip = false, $no_encode = false, $mod = false)
 	{
@@ -46,16 +47,22 @@
 			{
 				$no_encode = TRUE;
 			}
-			if (getperms("0") || $no_encode === TRUE)
+			if ($no_encode === TRUE && $mod != 'no_html')
 			{
 				$search = array('$', '"', "'", '\\', '<?');
-				$replace = array('&#036;','&quot;','&#039;', '&#092;', '&lt?');
+				$replace = array('&#036;','&quot;','&#039;', '&#092;', '&lt;?');
 				$ret = str_replace($search, $replace, $data);
 			} else {
 				$data = htmlspecialchars($data, ENT_QUOTES, CHARSET);
 				$data = str_replace('\\', '&#092;', $data);
 				$ret = preg_replace("/&amp;#(\d*?);/", "&#\\1;", $data);
 			}
+			//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);
+			}
+
 		}
 
 		return $ret;
@@ -68,17 +75,24 @@
 		$search = array('&#036;', '&quot;');
 		$replace = array('$', '"');
 		$text = str_replace($search, $replace, $text);
-		return html_entity_decode($text, $mode);
+		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);
+
+		return $text;
 	}
 
+
 	function post_toForm($text) {
-		if (MAGIC_QUOTES_GPC == TRUE) {
+		if (defined("MAGIC_QUOTES_GPC") && (MAGIC_QUOTES_GPC == TRUE)) {
 			$text = stripslashes($text);
 		}
 		// ensure apostrophes are properly converted, or else the form item could break
 		return str_replace(array( "'", '"'), array("&#039;", "&quot;"), $text);
 	}
 
+
 	function post_toHTML($text, $modifier = true, $extra = '') {
 		/*
 		changes by jalist 30/01/2005:
@@ -113,6 +127,12 @@
 
 		$text = $this->replaceConstants($text);
 
+		//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);
+		}
+
 		return ($modifier ? $this->toHTML($text, true, $extra) : $text);
 	}
 
@@ -259,8 +279,10 @@
 	function text_truncate($text, $len = 200, $more = "[more]") {
 		if(strlen($text) <= $len) {
 			return $text;
-		} else {
-			return substr($text, 0, $len).$more;
+		} 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;
 		}
 	}
 
@@ -273,6 +295,36 @@
 		return $text;
 	}
 
+	//
+	// Test for text highlighting, and determine the text highlighting transformation
+	// Returns TRUE if highlighting is active for this page display
+	//
+	function checkHighlighting()
+	{
+		global $pref;
+
+		if (!defined('e_SELF'))
+		{
+			return FALSE;	// Still in startup, so can't calculate highlighting
+		}
+
+		if (!isset($this->e_highlighting))
+		{
+			$this->e_highlighting = FALSE;
+			$shr = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
+			if ($pref['search_highlight'] && (strpos(e_SELF, 'search.php') === FALSE) && ((strpos($shr, 'q=') !== FALSE) || (strpos($shr, 'p=') !== FALSE)))
+			{
+				$this->e_highlighting = TRUE;
+				if (!isset($this -> e_query))
+				{
+					$query = preg_match('#(q|p)=(.*?)(&|$)#', $shr, $matches);
+					$this -> e_query = str_replace(array('+', '*', '"', ' '), array('', '.*?', '', '\b|\b'), trim(urldecode($matches[2])));
+				}
+			}
+		}
+		return $this->e_highlighting;
+	}
+
 	function toHTML($text, $parseBB = FALSE, $modifiers = "", $postID = "", $wrap=FALSE) {
 		if ($text == '')
 		{
@@ -283,7 +335,7 @@
 		$fromadmin = strpos($modifiers, "fromadmin");
 		//$text = str_replace(array("&#092;&quot;", "&#092;&#039;", "&#092;&#092;"), array("&quot;", "&#039;", "&#092;"), $text);
 
-		// support for converting defines(constants) within text. eg. Lan_XXXX
+		// 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))){
 			return constant(trim($text));
 		}
@@ -294,125 +346,135 @@
 			$text = $this->replaceConstants($text);
 		}
 
-		if(!$wrap && $pref['main_wordwrap']) $wrap = $pref['main_wordwrap'];
-		$text = " ".$text;
-
-		if (strpos($modifiers, 'nobreak') === FALSE) {
-			$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);
-		}
-
-		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']) ? $pref['email_text'] : "\\1\\2&copy;\\3";
-				}else{
-					$email_text = ($pref['email_text']) ? $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 (strpos($modifiers, 'emotes_off') === FALSE) {
-			if ($pref['smiley_activate'] || strpos($modifiers,'emotes_on') !== FALSE) {
-				if (!is_object($this->e_emote)) {
-					require_once(e_HANDLER.'emote_filter.php');
-					$this->e_emote = new e_emoteFilter;
-				}
-				$text = $this->e_emote->filterEmotes($text);
-			}
-		}
-
-		if (strpos($modifiers, 'nobreak') === FALSE) {
-			$text = preg_replace("#[\r]*\n[\r]*#", E_NL, $text);
-			foreach ($embeds[0] as $embed) {
-				$text = preg_replace("#<\|>#", $embed, $text, 1);
-			}
-		}
-
-		$text = str_replace($this -> search, $this -> replace, $text);
-
-		// Start parse [bb][/bb] codes
-		if ($parseBB === TRUE) {
-			if (!is_object($this->e_bb)) {
-				require_once(e_HANDLER.'bbcode_handler.php');
-				$this->e_bb = new e_bbcode;
-			}
-			$text = $this->e_bb->parseBBCodes($text, $postID);
-		}
-		// End parse [bb][/bb] codes
-
-		if ($pref['profanity_filter']) {
-			if (!is_object($this->e_pf)) {
-				require_once(e_HANDLER."profanity_filter.php");
-				$this->e_pf = new e_profanityFilter;
-			}
-			$text = $this->e_pf->filterProfanities($text);
-		}
-
-		if (strpos($modifiers,'parse_sc') !== FALSE)
-		{
-			$text = $this->parseTemplate($text, TRUE);
-		}
+       if(!$wrap && $pref['main_wordwrap']) $wrap = $pref['main_wordwrap'];
+        $text = " ".$text;
 
-		//Run any hooked in parsers
-		if(isset($pref['tohtml_hook']) && $pref['tohtml_hook'])
-		{
-			foreach(explode(",",$pref['tohtml_hook']) as $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;
+			// Prepare for line-break compression. Avoid compressing newlines in embedded scripts and CSS
+        if (strpos($modifiers, 'nobreak') === FALSE) {
+            $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);
+            }
+        }
+
+			// Convert emoticons to graphical icons, unless modifiers override
+        if (strpos($modifiers, 'emotes_off') === FALSE) {
+            if ($pref['smiley_activate'] || strpos($modifiers,'emotes_on') !== FALSE) {
+                if (!is_object($this->e_emote)) {
+                    require_once(e_HANDLER.'emote_filter.php');
+                    $this->e_emote = new e_emoteFilter;
+                }
+                $text = $this->e_emote->filterEmotes($text);
+            }
+        }
+
+			// Reduce multiple newlines in all forms to a single newline character, except for embedded scripts and CSS
+        if (strpos($modifiers, 'nobreak') === FALSE) {
+            $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.
+	       	$text = str_replace($this -> search, $this -> replace, $text);
+        }else{   									// output used for attribute values.
+            $text = str_replace($this -> replace, $this -> search, $text);
+		}
+
+        // Start parse [bb][/bb] codes
+        if ($parseBB === TRUE) {
+            if (!is_object($this->e_bb)) {
+                require_once(e_HANDLER.'bbcode_handler.php');
+                $this->e_bb = new e_bbcode;
+            }
+            $text = $this->e_bb->parseBBCodes($text, $postID);
+        }
+        // End parse [bb][/bb] codes
+
+				// profanity filter
+        if ($pref['profanity_filter']) {
+            if (!is_object($this->e_pf)) {
+                require_once(e_HANDLER."profanity_filter.php");
+                $this->e_pf = new e_profanityFilter;
+            }
+            $text = $this->e_pf->filterProfanities($text);
+        }
+
+			// Optional short-code conversion
+        if (strpos($modifiers,'parse_sc') !== FALSE)
+        {
+            $text = $this->parseTemplate($text, TRUE);
+        }
+
+        //Run any hooked in parsers
+        if(isset($pref['tohtml_hook']) && $pref['tohtml_hook'])
+        {
+            foreach(explode(",",$pref['tohtml_hook']) as $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);
+                }
+            }
+        }
+
+        if (strpos($modifiers, 'nobreak') === FALSE) {
+            $text = $this -> textclean($text, $wrap);
+        }
+
+        // Search Highlight
+        if (strpos($modifiers, 'emotes_off') === FALSE) {
+        	if ($this->checkHighlighting())
+        	{
+						$text = $this -> e_highlight($text, $this -> e_query);
 					}
-					$text = $this->e_hook[$hook]->$hook($text);
-				}
-			}
-		}
-
-		if (strpos($modifiers, 'nobreak') === FALSE) {
-			$text = $this -> textclean($text, $wrap);
-		}
-
-		// Search Highlight
-		if (strpos($modifiers, 'emotes_off') === FALSE) {
-			$shr = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "");
-			if ($pref['search_highlight'] && (strpos(e_SELF, 'search.php') === FALSE) && ((strpos($shr, 'q=') !== FALSE) || (strpos($shr, 'p=') !== FALSE))) {
-				if (!isset($this -> e_query)) {
-					$query = preg_match('#(q|p)=(.*?)(&|$)#', $shr, $matches);
-					$this -> e_query = str_replace(array('+', '*', '"', ' '), array('', '.*?', '', '\b|\b'), trim(urldecode($matches[2])));
 				}
-				$text = $this -> e_highlight($text, $this -> e_query);
-			}
-		}
 
-		$nl_replace = "<br />";
-		if (strpos($modifiers, 'nobreak') !== FALSE)
-		{
-			$nl_replace = '';
-		}
-		elseif (strpos($modifiers, 'retain_nl') !== FALSE)
-		{
-			$nl_replace = "\n";
-		}
-		$text = str_replace(E_NL, $nl_replace, $text);
+        $nl_replace = "<br />";
+        if (strpos($modifiers, 'nobreak') !== FALSE)
+        {
+            $nl_replace = '';
+        }
+        elseif (strpos($modifiers, 'retain_nl') !== FALSE)
+        {
+            $nl_replace = "\n";
+        }
+        $text = str_replace(E_NL, $nl_replace, $text);
 
 		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;
 		} else {
 			return '';
@@ -420,26 +482,35 @@
 	}
 
 	function toJS($stringarray) {
-		$stringarray = str_replace("\r\n", "\\n", $stringarray);
-		$stringarray = str_replace("\r", "", $stringarray);
+		$search = array("\r\n","\r","<br />","'");
+		$replace = array("\\n","","\\n","\'");
+		$stringarray = str_replace($search, $replace, $stringarray);
+        $stringarray = strip_tags($stringarray);
+
 		$trans_tbl = get_html_translation_table (HTML_ENTITIES);
 		$trans_tbl = array_flip ($trans_tbl);
+
 		return strtr ($stringarray, $trans_tbl);
 	}
 
 	function toRss($text,$tags=FALSE)
 	{
 
-		if($tags != TRUE){
+		if($tags != TRUE)
+		{
 			$text = $this -> toHTML($text,TRUE);
 			$text = strip_tags($text);
 		}
 
-		$search = array("&amp;#039;", "&amp;#036;", "&#039;", "&#036;"," & ",);
-		$replace = array("'", '$', "'", '$',' &amp; ' );
-		$text = str_replace($search, $replace, $text);
+		$text = $this->toEmail($text);
+   		$search = array("&amp;#039;", "&amp;#036;", "&#039;", "&#036;"," & ", e_BASE, "href='request.php");
+   		$replace = array("'", '$', "'", '$',' &amp; ', SITEURL, "href='".SITEURL."request.php" );
+   		$text = str_replace($search, $replace, $text);
 
-		//$text = htmlspecialchars($text);
+		if($tags == TRUE && ($text))
+		{
+        	$text = "<![CDATA[".$text."]]>";
+		}
 
 		return $text;
 	}
@@ -453,17 +524,36 @@
 		return $text;
 	}
 
-	function replaceConstants($text,$nonrelative = FALSE)
+//
+// $nonrelative:
+//   "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
+//
+// only an ADMIN user can convert {e_ADMIN}
+//
+	function replaceConstants($text, $nonrelative = "", $all = false)
 	{
-		if($nonrelative !== FALSE){
-			global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY, $THEMES_DIRECTORY;
-        	$replace = array($IMAGES_DIRECTORY,$PLUGINS_DIRECTORY,$FILES_DIRECTORY,$THEMES_DIRECTORY);
-        	$search = array("{"."e_IMAGE"."}","{"."e_PLUGIN"."}","{"."e_FILE"."}","{"."e_THEME"."}");
-            return str_replace($search,$replace,$text);
-		}
+		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}");
+			if (ADMIN) {
+				$replace_relative[] = $ADMIN_DIRECTORY;
+				$replace_absolute[] = SITEURL.$ADMIN_DIRECTORY;
+				$search[] = "{e_ADMIN}";
+			}
+			$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");
+	 	$text = preg_replace_callback($pattern, array($this, 'doReplace'), $text);
+		$theme_path = (defined("THEME")) ? constant("THEME") : "";
+		$text = str_replace("{THEME}",$theme_path,$text);
 
-		$text = preg_replace_callback("#\{(e_[A-Z]*)\}#s", array($this, 'doReplace'), $text);
-		$text = str_replace("{THEME}",constant("THEME"),$text);
 		return $text;
 	}
 
@@ -476,11 +566,41 @@
 		return $matches[1];
 	}
 
-    function createConstants($text){
-        global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY, $THEMES_DIRECTORY;
-        $search = array($IMAGES_DIRECTORY,$PLUGINS_DIRECTORY,$FILES_DIRECTORY,$THEMES_DIRECTORY);
-        $replace = array("{"."e_IMAGE"."}","{"."e_PLUGIN"."}","{"."e_FILE"."}","{"."e_THEME"."}");
-		return str_replace($search,$replace,$text);
+    function createConstants($url,$mode=0){
+        global $IMAGES_DIRECTORY,$PLUGINS_DIRECTORY,$FILES_DIRECTORY,$THEMES_DIRECTORY,$DOWNLOADS_DIRECTORY,$ADMIN_DIRECTORY;
+
+        if($mode == 0) // folder name only.
+		{
+			$tmp = array(
+				"{"."e_IMAGE"."}"=>$IMAGES_DIRECTORY,
+				"{"."e_PLUGIN"."}"=>$PLUGINS_DIRECTORY,
+				"{"."e_FILE"."}"=>$FILES_DIRECTORY,
+				"{"."e_THEME"."}"=>$THEMES_DIRECTORY,
+				"{"."e_DOWNLOAD"."}"=>$DOWNLOADS_DIRECTORY,
+				"{"."e_ADMIN"."}"=>$ADMIN_DIRECTORY,
+  			);
+        }
+		elseif($mode == 1)  // relative path
+		{
+			$tmp = array(
+				"{"."e_IMAGE"."}"=>e_IMAGE,
+				"{"."e_PLUGIN"."}"=>e_PLUGIN,
+				"{"."e_FILE"."}"=>e_FILE,
+				"{"."e_THEME"."}"=>e_THEME,
+				"{"."e_DOWNLOAD"."}"=>e_DOWNLOAD,
+				"{"."e_ADMIN"."}"=>e_ADMIN
+			);
+		}
+		foreach($tmp as $key=>$val)
+		{
+        	$len = strlen($val);
+			if(substr($url,0,$len) == $val)
+			{
+            	return str_replace($val,$key,$url);
+			}
+		}
+
+		return $url;
     }
 
 
@@ -493,6 +613,18 @@
 		}
 		return $text;
 	}
+
+    function toEmail($text,$posted="")
+	{
+		if ($posted === TRUE && MAGIC_QUOTES_GPC) {
+			$text = stripslashes($text);
+		}
+
+	  	$text = $this->replaceConstants($text,"full");
+    	$text = $this->toHTML($text,TRUE,"parse_sc");
+        return $text;
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/emailprint_class.php 0.7.7/e107_handlers/emailprint_class.php
--- 0.7.5/e107_handlers/emailprint_class.php	2006-02-17 17:49:04.000000000 -0600
+++ 0.7.7/e107_handlers/emailprint_class.php	2006-09-03 08:43:18.000000000 -0500
@@ -11,12 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/emailprint_class.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/02/17 23:49:04 $
-|     $Author: lisa_ $
+|     $Revision: 1.11 $
+|     $Date: 2006/09/03 13:43:18 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 @include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
@@ -51,15 +51,15 @@
 		}
 
 		if ($look == 0 || $look == 1) {
-			$ico_mail = (file_exists(THEME."generic/email.png") ? THEME."generic/email.png" : e_IMAGE."generic/".IMODE."/email.png");
-			$text_emailprint .= "<a href='".e_BASE."email.php?".$email.".".$id."'><img src='".$ico_mail."' style='border:0' alt='".LAN_email_7."' title='".LAN_email_7."' /></a> ";
+			$ico_mail = (file_exists(THEME."images/email.png") ? THEME."images/email.png" : e_IMAGE."generic/".IMODE."/email.png");
+			$text_emailprint .= "<a href='".e_BASE."email.php?".$email.".".$id."'><img src='".$ico_mail."' style='border:0' alt='".LAN_EMAIL_7."' title='".LAN_EMAIL_7."' /></a> ";
 		}
 		if ($look == 0 || $look == 2) {
-			$ico_print = (file_exists(THEME."generic/printer.png") ? THEME."generic/printer.png" : e_IMAGE."generic/".IMODE."/printer.png");
-			$text_emailprint .= "<a href='".e_BASE."print.php?".$print.".".$id."'><img src='".$ico_print."' style='border:0' alt='".LAN_PRINT_1."' title='".LAN_PRINT_1."'/></a>";
+			$ico_print = (file_exists(THEME."images/printer.png") ? THEME."images/printer.png" : e_IMAGE."generic/".IMODE."/printer.png");
+			$text_emailprint .= "<a href='".e_BASE."print.php?".$print.".".$id."'><img src='".$ico_print."' style='border:0' alt='".LAN_PRINT_1."' title='".LAN_PRINT_1."' /></a>";
 		}
 		return $text_emailprint;
 	}
 }
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/file_class.php 0.7.7/e107_handlers/file_class.php
--- 0.7.5/e107_handlers/file_class.php	2006-01-31 13:36:21.000000000 -0600
+++ 0.7.7/e107_handlers/file_class.php	2006-10-26 18:36:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/file_class.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/01/31 19:36:21 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.13 $
+|     $Date: 2006/10/26 23:36:27 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -39,7 +39,7 @@
 		}
 		if($omit == 'standard')
 		{
-			$rejectArray = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$');
+			$rejectArray = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','^\.htaccess$','index\.html','null\.txt');
 		}
 		else
 		{
@@ -175,4 +175,4 @@
 	}
 
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/forum.php 0.7.7/e107_handlers/forum.php
--- 0.7.5/e107_handlers/forum.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/forum.php	2006-10-24 08:35:06.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/forum.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/10/24 13:35:06 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -50,15 +50,15 @@
 			<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> ".FORLAN_4."
+			<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']."'>
+			<input type='hidden' name='prune_days' value='".$_POST['prune_days']."' />
 			</td>
 			</tr>
 			 
@@ -249,7 +249,7 @@
 	$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>
+		<input type=\"checkbox\" name=\"confirm\" value=\"1\"><span class=\"smalltext\" /> ".FORLAN_21."</span>
 		";
 }
 $text .= "
@@ -271,7 +271,7 @@
 
 if (isset($_POST['pedit'])) {
 	$text .= "<input class='button' type='submit' name='pupdate' value='".FORLAN_25."' />
-		<input type='hidden' name='existing' value='".$_POST['existing']."'>";
+		<input type='hidden' name='existing' value='".$_POST['existing']."' />";
 } else {
 	$text .= "<input class='button' type='submit' name='psubmit' value='".FORLAN_26."' />";
 }
@@ -311,7 +311,7 @@
 	$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>
+		<input type='checkbox' name='confirm' value='1' /><span class='smalltext'> ".FORLAN_21."</span>
 		";
 }
 
@@ -366,7 +366,7 @@
 	if (strpos($forum_moderators, $user_name) !== FALSE) {
 		$text .= " checked";
 	}
-	$text .= "> {$user_name}<br />";
+	$text .= " /> {$user_name}<br />";
 }
 
 $text .= "</td>
@@ -377,7 +377,7 @@
 
 If(isset($_POST['edit'])) {
 	$text .= "<input class='button' type='submit' name='update' value='".FORLAN_35."' />
-		<input type='hidden' name='forum_id' value='{$forum_id}'>";
+		<input type='hidden' name='forum_id' value='{$forum_id}' />";
 } else {
 	$text .= "<input class='button' type='submit' name='submit' value='".FORLAN_36."' />";
 }
@@ -463,7 +463,7 @@
 	".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 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>
 	 
@@ -483,7 +483,7 @@
 	".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 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>
 	 
@@ -492,7 +492,7 @@
 	".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 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>
 	 
@@ -501,7 +501,7 @@
 	".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'>")."
+	<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>
@@ -509,7 +509,7 @@
 	".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 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>
 	 
@@ -521,7 +521,7 @@
 	".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'>")."
+	<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>
 	 
 	 
diff -ruN 0.7.5/e107_handlers/language_class.php 0.7.7/e107_handlers/language_class.php
--- 0.7.5/e107_handlers/language_class.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/language_class.php	2006-09-11 20:53:11.000000000 -0500
@@ -0,0 +1,248 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     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 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+
+class language{
+
+// Converts iso to language-name and visa-versa.
+
+	function convert($data){
+
+         $lang = array(
+            "aa" => "Afar",
+			"ab" => "Abkhazian",
+			"af" => "Afrikaans",
+			"am" => "Amharic",
+			"ar" => "Arabic",
+			"as" => "Assamese",
+			"ae" => "Avestan",
+			"ay" => "Aymara",
+			"az" => "Azerbaijani",
+			"ba" => "Bashkir",
+			"be" => "Belarusian",
+			"bn" => "Bengali",
+			"bh" => "Bihari",
+			"bi" => "Bislama",
+			"bo" => "Tibetan",
+			"bs" => "Bosnian",
+			"br" => "Breton",
+			"bg" => "Bulgarian",
+			"ca" => "Catalan",
+			"cs" => "Czech",
+			"ch" => "Chamorro",
+			"ce" => "Chechen",
+			"cn" => "Chinese-Simp",
+
+			"cv" => "Chuvash",
+			"kw" => "Cornish",
+			"co" => "Corsican",
+			"cy" => "Welsh",
+			"da" => "Danish",
+			"de" => "German",
+			"dz" => "Dzongkha",
+			"el" => "Greek",
+			"en" => "English",
+			"eo" => "Esperanto",
+			"et" => "Estonian",
+			"eu" => "Basque",
+			"fo" => "Faroese",
+			"fa" => "Persian",
+			"fj" => "Fijian",
+			"fi" => "Finnish",
+			"fr" => "French",
+			"fy" => "Frisian",
+			"gd" => "Gaelic",
+			"ga" => "Irish",
+			"gl" => "Gallegan",
+			"gv" => "Manx",
+			"gn" => "Guarani",
+			"gu" => "Gujarati",
+			"ha" => "Hausa",
+			"he" => "Hebrew",
+			"hz" => "Herero",
+			"hi" => "Hindi",
+			"ho" => "Hiri Motu",
+			"hr" => "Croatian",
+			"hu" => "Hungarian",
+			"hy" => "Armenian",
+			"iu" => "Inuktitut",
+			"ie" => "Interlingue",
+			"id" => "Indonesian",
+			"ik" => "Inupiaq",
+			"is" => "Icelandic",
+			"it" => "Italian",
+			"jw" => "Javanese",
+			"ja" => "Japanese",
+			"kl" => "Kalaallisut",
+			"kn" => "Kannada",
+			"ks" => "Kashmiri",
+			"ka" => "Georgian",
+			"kk" => "Kazakh",
+			"km" => "Khmer",
+			"ki" => "Kikuyu",
+			"rw" => "Kinyarwanda",
+			"ky" => "Kirghiz",
+			"kv" => "Komi",
+			"ko" => "Korean",
+			"ku" => "Kurdish",
+			"lo" => "Lao",
+			"la" => "Latin",
+			"lv" => "Latvian",
+			"ln" => "Lingala",
+			"lt" => "Lithuanian",
+			"lb" => "Letzeburgesch",
+			"mh" => "Marshall",
+			"ml" => "Malayalam",
+	        "mr" => "Marathi",
+	        "mk" => "Macedonian",
+	        "mg" => "Malagasy",
+	        "mt" => "Maltese",
+	        "mo" => "Moldavian",
+	        "mn" => "Mongolian",
+	        "mi" => "Maori",
+	        "ms" => "Malay",
+	        "my" => "Burmese",
+	        "na" => "Nauru",
+	        "nv" => "Navajo",
+
+	        "ng" => "Ndonga",
+	        "ne" => "Nepali",
+	        "nl" => "Dutch",
+	        "nb" => "Norwegian",
+
+	        "ny" => "Chichewa",
+	        "or" => "Oriya",
+	        "om" => "Oromo",
+	        "pa" => "Panjabi",
+	        "pi" => "Pali",
+	        "pl" => "Polish",
+	        "pt" => "Portuguese",
+	        "ps" => "Pushto",
+	        "qu" => "Quechua",
+	        "ro" => "Romanian",
+	        "rn" => "Rundi",
+	        "ru" => "Russian",
+	        "sg" => "Sango",
+	        "sa" => "Sanskrit",
+	        "si" => "Sinhalese",
+	        "sk" => "Slovak",
+	        "sl" => "Slovenian",
+
+	        "sm" => "Samoan",
+	        "sn" => "Shona",
+	        "sd" => "Sindhi",
+	        "so" => "Somali",
+
+	        "es" => "Spanish",
+	        "sq" => "Albanian",
+	        "sc" => "Sardinian",
+	        "sr" => "Serbian",
+	        "ss" => "Swati",
+	        "su" => "Sundanese",
+	        "sw" => "Swahili",
+	        "sv" => "Swedish",
+	        "ty" => "Tahitian",
+	        "ta" => "Tamil",
+	        "tt" => "Tatar",
+	        "te" => "Telugu",
+	        "tg" => "Tajik",
+	        "tl" => "Tagalog",
+	        "th" => "Thai",
+	        "ti" => "Tigrinya",
+
+	        "tn" => "Tswana",
+	        "ts" => "Tsonga",
+	        "tk" => "Turkmen",
+	        "tr" => "Turkish",
+			"tw" => "Chinese-Trad",
+	        "ug" => "Uighur",
+	        "uk" => "Ukrainian",
+	        "ur" => "Urdu",
+	        "uz" => "Uzbek",
+	        "vi" => "Vietnamese",
+
+	        "wo" => "Wolof",
+	        "xh" => "Xhosa",
+	        "yi" => "Yiddish",
+	        "yo" => "Yoruba",
+	        "za" => "Zhuang",
+	        "zh" => "Chinese",
+	        "zu" => "Zulu"
+		);
+
+		if(strlen($data) > 2)
+		{
+        	$tmp = array_flip($lang);
+			return $tmp[$data];
+		}
+		else
+		{
+			return $lang[$data];
+		}
+	}
+
+
+
+
+   // -------------------------------------------------------------------
+
+	function toNative($lang){
+
+		$name = array(
+			"Arabic" 		=> "العربية",
+			"Bulgarian"		=> "Български",
+			"Croatian"		=> "Hrvatski",
+			"Dutch"			=> "Nederlands",
+			"English"		=> "English",
+			"Farsi"			=> "فارسي",
+			"French"		=> "Français",
+			"German"		=> "Deutsch",
+			"Greek"			=> "Ελληνικά",
+			"Hebrew"		=> "עִבְרִית",
+			"Hungarian"		=> "Magyar",
+			"Italian"		=> "Italiano",
+			"Japanese"		=> "日本語",
+			"Korean"		=> "한국어",
+			"Mongolian"		=> "монгол",
+			"Nepali"		=> "नेपाली",
+		    "Portuguese"	=> "Português",
+			"Polish"		=> "Polski",
+			"Romanian"		=> "Romanesc",
+			"Russian"		=> "Pусский",
+			"Serbian"		=> "Srpski",
+			"Spanish"		=> "Español",
+			"Slovenian"		=> "Slovensko",
+			"Slovakian"		=> "Slovensky",
+			"Slovak"		=> "Slovensky",
+			"Swedish"		=> "Svenska",
+			"Thai"			=> " าษาไทย",
+			"Turkish"		=> "Türkçe"
+		);
+
+       return ($name[$lang]) ? $name[$lang] : $lang;
+
+	}
+
+
+	function subdomainUrl($language)
+	{
+		global $pref;
+		$codelnk = ($language == $pref['sitelanguage']) ? "www" : $this->convert($language);
+        $urlval = str_replace($_SERVER['HTTP_HOST'],$codelnk.$pref['multilanguage_subdomain'],e_SELF);
+        return $urlval;
+	}
+
+}
+
+
+
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/login.php 0.7.7/e107_handlers/login.php
--- 0.7.5/e107_handlers/login.php	2006-02-24 12:36:35.000000000 -0600
+++ 0.7.7/e107_handlers/login.php	2006-10-28 23:08:13.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/login.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/02/24 18:36:35 $
-|     $Author: whoisrich $
+|     $Revision: 1.37 $
+|     $Date: 2006/10/29 04:08:13 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -165,10 +165,41 @@
 					$$value = $tp -> toDB($match[2][$count]);
 					$count++;
 				}
-				$sql -> db_Update("user", "user_login='{$FN}', user_homepage='{$URL}', user_icq='{$ICQ}', user_aim='{$AIM}', user_msn='{$MSN}', user_location='{$GEO}', user_birthday='{$BDAY}', user_signature='{$SIG}', user_sess='{$PHOTO}', user_image='{$AV}', user_timezone='{$TZ}' WHERE user_id='".intval($user_id)."'");
+
+				$sql -> db_Update("user", "user_login='{$FN}', user_hideemail='{EMAILHIDE}', user_signature='{$SIG}', user_sess='{$PHOTO}', user_image='{$AV}', user_timezone='{$TZ}' WHERE user_id='".intval($user_id)."'");
+
+				$ue_fields = "";
+				$fields = array("URL" => "homepage",
+					"ICQ" => "icq",
+					"AIM" => "aim",
+					"MSN" => "msn",
+					"YAHOO" => "yahoo",
+					"GEO" => "location",
+					"BDAY" => "birthday");
+					include_once(e_HANDLER."user_extended_class.php");
+					$usere = new e107_user_extended;
+					$extList = $usere->user_extended_get_fieldList();
+					$extName = array();
+					foreach($extList as $ext)
+					{
+						$extName[] = $ext['user_extended_struct_name'];
+					}
+					foreach($fields as $keyxup => $keydb)
+					{
+						if (in_array($keydb, $extName))
+						{
+							$key = "user_".$keydb;
+							$key = $tp->toDB($key);
+							$val = $tp->toDB($$keyxup);
+							$ue_fields .= ($ue_fields) ? ", " : "";
+							$ue_fields .= $key."='".$val."'";
+						}
+					}
+					$sql -> db_Select_gen("INSERT INTO #user_extended (user_extended_id) values ('".intval($user_id)."')");
+					$sql -> db_Update("user_extended", $ue_fields." WHERE user_extended_id = '".intval($user_id)."'");
 			}
 		}
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/mail.php 0.7.7/e107_handlers/mail.php
--- 0.7.5/e107_handlers/mail.php	2006-05-12 17:50:40.000000000 -0500
+++ 0.7.7/e107_handlers/mail.php	2006-11-09 03:28:58.000000000 -0600
@@ -11,20 +11,33 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/mail.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2006/05/12 22:50:40 $
-|     $Author: e107coders $
+|     $Revision: 1.36 $
+|     $Date: 2006/11/09 09:28:58 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+	if(is_readable(THEME."email_template.php"))
+	{
+    	require_once(THEME."email_template.php");
+	}
+	else
+	{
+    	require_once(e_THEME."templates/email_template.php");
+	}
+
+    if(isset($EMAIL_HEADER) && isset($EMAIL_FOOTER) && is_object($tp)){
+		$EMAIL_HEADER = $tp->parseTemplate($EMAIL_HEADER);
+		$EMAIL_FOOTER = $tp->parseTemplate($EMAIL_FOOTER);
+	}
 /*
 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.
-// ini_set(sendmail_path, "/usr/sbin/sendmail -t -f ".$pref['siteadminemail']);
+// 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;
@@ -38,11 +51,19 @@
     }
 
 	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();
+			$pop->Authorise($pref['smtp_server'], 110, 30, $pref['smtp_username'], $pref['smtp_password'], 1);
+        }
+
 		$mail->Mailer = "smtp";
 	 	$mail->SMTPKeepAlive = FALSE;
 		$mail->Host = $pref['smtp_server'];
 		if($pref['smtp_username'] && $pref['smtp_password']){
-			$mail->SMTPAuth = TRUE;
+			$mail->SMTPAuth = (isset($pref['smtp_pop3auth']) && $pref['smtp_pop3auth']) ? FALSE : TRUE;
 			$mail->Username = $pref['smtp_username'];
 			$mail->Password = $pref['smtp_password'];
 			$mail->PluginDir = e_HANDLER."phpmailer/";
@@ -60,11 +81,12 @@
 	$mail->CharSet = CHARSET;
 	$mail->From = ($send_from)? $send_from: $pref['siteadminemail'];
 	$mail->FromName = ($from_name)? $from_name:	$pref['siteadmin'];
-	$mail->Host = $pref['smtp_server'];
 	$mail->Subject = $subject;
 	$mail->SetLanguage("en",e_HANDLER."phpmailer/language/");
 
 	$lb = "\n";
+
+
 	// Clean up the HTML. ==
 
 	if (preg_match('/<(font|br|a|img|b)/i', $message)) {
@@ -87,7 +109,13 @@
 	$mail->Body = $Html; //Main message is HTML
 	$mail->IsHTML(TRUE);
  	$mail->AltBody = $text; //Include regular plaintext as well
-	$mail->AddAddress($send_to, $to_name);
+
+
+	$tmp = explode(",",$send_to);
+    foreach($tmp as $adr){
+		$mail->AddAddress($adr, $to_name);
+    }
+
 
 		if ($attachments){
 			if (is_array($attachments))	{
@@ -119,7 +147,7 @@
 		}else{
         	$tmp = explode(",",$Cc);
 			foreach($tmp as $addc){
-		  		$mail->AddCC("Cc", $addc);
+		  		$mail->AddCC($addc);
         	}
 		}
 	}
diff -ruN 0.7.5/e107_handlers/message_handler.php 0.7.7/e107_handlers/message_handler.php
--- 0.7.5/e107_handlers/message_handler.php	2006-01-14 16:01:34.000000000 -0600
+++ 0.7.7/e107_handlers/message_handler.php	2006-10-25 11:57:47.000000000 -0500
@@ -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.10 $
-|     $Date: 2006/01/14 22:01:34 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.11 $
+|     $Date: 2006/10/25 16:57:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,15 +21,19 @@
 
 function show_emessage($mode, $message, $line = 0, $file = "") {
 	global $tp;
-	$emessage[1] = "<b>[1]: Unable to read core settings from database - Core settings exist but cannot be unserialized. Attempting to restore core backup ...</b>";
-	$emessage[2] = "<b>[2]: Unable to read core settings from database - non-existant core settings.</b>";
-	$emessage[3] = "<b>[3]: Core settings saved - backup made active.</b>";
-	$emessage[4] = "<b>[4]: No core backup found. Please run the <a href='".e_FILE."resetcore/resetcore.php'>Reset_Core</a> utility to rebuild your core settings. <br />After rebuilding your core please save a backup from the admin/sql screen.</b>";
-	$emessage[5] = "[5]: Field(s) have been left blank. Please resubmit the form and fill in the required fields.";
-	$emessage[6] = "<b>[6]: Unable to form a valid connection to mySQL. Please check that your e107_config.php contains the correct information.</b>";
-	$emessage[7] = "<b>[7]: mySQL is running but database ({$mySQLdefaultdb}) couldn't be connected to.<br />Please check it exists and that your e107_config.php contains the correct information.</b>";
+	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>";
+	$emessage[4] = "<b>".LAN_ERROR_28."</b>";
+	$emessage[5] = LAN_ERROR_29;
+	$emessage[6] = "<b>".LAN_ERROR_30."</b>";
+	$emessage[7] = "<b>".LAN_ERROR_31."</b>";
 	$emessage[8] = "
-		<div style='text-align:center; font: 12px Verdana, Tahoma'><b>To complete the upgrade, copy the following text into your e107_config.php file: </b><br /><br />
+		<div style='text-align:center; font: 12px Verdana, Tahoma'><b>".LAN_ERROR_32." </b><br /><br />
 		".chr(36)."ADMIN_DIRECTORY = \"e107_admin/\";<br />
 		".chr(36)."FILES_DIRECTORY = \"e107_files/\";<br />
 		".chr(36)."IMAGES_DIRECTORY = \"e107_images/\"; <br />
@@ -88,4 +92,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/mysql_class.php 0.7.7/e107_handlers/mysql_class.php
--- 0.7.5/e107_handlers/mysql_class.php	2006-04-26 01:02:13.000000000 -0500
+++ 0.7.7/e107_handlers/mysql_class.php	2006-10-21 06:07:06.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/mysql_class.php,v $
-|     $Revision: 1.57 $
-|     $Date: 2006/04/26 06:02:13 $
-|     $Author: sweetas $
+|     $Revision: 1.60 $
+|     $Date: 2006/10/21 11:07:06 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,8 +27,8 @@
 * MySQL Abstraction class
 *
 * @package e107
-* @version $Revision: 1.57 $
-* @author $Author: sweetas $
+* @version $Revision: 1.60 $
+* @author $Author: mrpete $
 */
 class db {
 
@@ -82,6 +82,8 @@
 	* @access public
 	*/
 	function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb) {
+		global $eTraffic;
+		$eTraffic->BumpWho('db Connect', 1);
 
 		$this->mySQLserver = $mySQLserver;
 		$this->mySQLuser = $mySQLuser;
@@ -397,6 +399,8 @@
 	* @access public
 	*/
 	function db_Close() {
+		global $eTraffic;
+		$eTraffic->BumpWho('db Close', 1);
 		mysql_close();
 		$this->dbError('dbClose');
 	}
@@ -663,7 +667,7 @@
 				}
 
 				if(!$this->db_Query($querylan)){ // run query on other language tables.
-					$error .= $qrylan." failed for language";
+					$error .= $querylan." failed for language";
 				}
 			 	if($debug){ echo "<br />** lang= ".$querylan; }
 			}
@@ -673,13 +677,43 @@
 		return ($error)? FALSE : TRUE;
 	}
 
-    function db_Field($table,$fieldid=""){
+	// Determines if a plugin field (and key) exist. OR if fieldid is numeric - return the field name in that position.
+    function db_Field($table,$fieldid="",$key=""){
 		if(!$this->mySQLdefaultdb){
 			global $mySQLdefaultdb;
 			$this->mySQLdefaultdb = $mySQLdefaultdb;
 		}
-		$fields = mysql_list_fields($this->mySQLdefaultdb, MPREFIX.$table);
-		return mysql_field_name($fields, $fieldid);
+        $convert = array("PRIMARY"=>"PRI","INDEX"=>"MUL","UNIQUE"=>"UNI");
+        $key = ($convert[$key]) ? $convert[$key] : "OFF";
+
+        $result = mysql_query("SHOW COLUMNS FROM ".MPREFIX.$table);
+        if (mysql_num_rows($result) > 0) {
+            $c=0;
+   			while ($row = mysql_fetch_assoc($result)) {
+				if(is_numeric($fieldid))
+				{
+                	if($c == $fieldid)
+					{
+                       return $row['Field']; // field number matches.
+					}
+				}
+                else
+				{
+					if(($key == "") && ($fieldid == $row['Field']))
+					{
+                    	return TRUE;  // key not in use, but field matches.
+					}
+					elseif(($fieldid == $row['Field']) && $key == $row['Key'])
+					{
+                    	return TRUE;
+					}
+
+ 			    }
+				$c++;
+        	}
+		}
+
+		return FALSE;
 
 	}
 
diff -ruN 0.7.5/e107_handlers/news_class.php 0.7.7/e107_handlers/news_class.php
--- 0.7.5/e107_handlers/news_class.php	2006-04-12 09:58:12.000000000 -0500
+++ 0.7.7/e107_handlers/news_class.php	2006-11-22 15:16:14.000000000 -0600
@@ -12,16 +12,16 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/news_class.php,v $
-| $Revision: 1.71 $
-| $Date: 2006/04/12 14:58:12 $
-| $Author: sweetas $
+| $Revision: 1.75 $
+| $Date: 2006/11/22 21:16:14 $
+| $Author: e107coders $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 class news {
-	
+
 	function submit_item($news) {
 		global $sql, $tp, $e107cache, $e_event, $pref;
 		if (!is_object($tp)) $tp = new e_parse;
@@ -31,8 +31,10 @@
 		$news['news_body'] = $tp->toDB($news['data']);
 		$news['news_extended'] = $tp->toDB($news['news_extended']);
 		$news['news_summary'] = $tp->toDB($news['news_summary']);
+		$news['news_userid'] = ($news['news_userid']) ? $news['news_userid'] : USERID;
 		if(!isset($news['news_sticky'])) {$news['news_sticky'] = 0;}
 		$author_insert = ($news['news_author'] == 0) ? "news_author = '".USERID."'," : "";
+        $news['news_author'] = ($news['news_author']) ? $news['news_author'] : USERID;
 
 		if ($news['news_id']) {
 			$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' ";
@@ -44,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']).", ".USERID.", '".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 ($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');
@@ -106,7 +108,7 @@
 	}
 
 	function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param='') {
-		global $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes;
+		global $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid;
 		if ($override_newsitem = $override -> override_check('render_newsitem')) {
 			$result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param);
 			if ($result == 'return') {
@@ -129,10 +131,10 @@
 
 		if (!$param) {
 			if (!defined("IMAGE_nonew_small")){
-				define("IMAGE_nonew_small", (file_exists(THEME."generic/nonew_comments.png") ? "<img src='".THEME_ABS."generic/nonew_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/nonew_comments.png' alt=''  />"));
+				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."generic/new_comments.png") ? "<img src='".THEME_ABS."generic/new_comments.png' alt=''  /> " : "<img src='".e_IMAGE_ABS."generic/".IMODE."/new_comments.png' alt=''  /> "));
+				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' /> "));
@@ -152,7 +154,7 @@
 			$param['catlink']  = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
 			$param['caticon'] =  (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
 		}
-		
+
 		cachevars('current_news_item', $news);
 		cachevars('current_news_param', $param);
 
@@ -162,7 +164,7 @@
 			} else if ($NEWSLISTSTYLE) {
 				$NEWS_PARSE = $NEWSLISTSTYLE;
 			} else {
-				$NEWS_PARSE = "{NEWSICON}&nbsp;<b>{NEWSTITLELINK}</b><div class='smalltext'>{NEWSAUTHOR} ".LAN_100." {NEWSDATE} | {NEWSCOMMENTS}</div>";
+				$NEWS_PARSE = "{NEWSICON}&nbsp;<b>{NEWSTITLELINK}</b><div class='smalltext'>{NEWSAUTHOR} ".LAN_NEWS_100." {NEWSDATE} | {NEWSCOMMENTS}</div>";
 			}
 		} else {
 			if ($NEWS_TEMPLATE) {
@@ -175,16 +177,17 @@
 				}
 			}
 		}
+		$loop_uid = $news['news_author'];
 
 		require_once(e_FILE.'shortcode/batch/news_shortcodes.php');
-		$text = $tp -> parseTemplate($NEWS_PARSE, FALSE, $news_shortcodes);
+		$text = $tp -> parseTemplate($NEWS_PARSE, TRUE, $news_shortcodes);
 
 		if ($mode == 'return') {
 			return $text;
 		} else {
 			echo $text;
 			return TRUE;
-		}		
+		}
 	}
 
 	function make_xml_compatible($original) {
@@ -197,4 +200,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/notify_class.php 0.7.7/e107_handlers/notify_class.php
--- 0.7.5/e107_handlers/notify_class.php	2006-04-10 20:43:42.000000000 -0500
+++ 0.7.7/e107_handlers/notify_class.php	2006-11-17 14:23:13.000000000 -0600
@@ -11,18 +11,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/notify_class.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/04/11 01:43:42 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.14 $
+|     $Date: 2006/11/17 20:23:13 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 class notify {
-	
+
 	var $notify_prefs;
-	
+
 	function notify() {
 		global $sysprefs, $e_event, $eArrayStorage;
 		$this -> notify_prefs = $sysprefs -> get('notify_prefs');
@@ -32,20 +32,20 @@
 				$e_event -> register($id, 'notify_'.$id);
 			}
 		}
-		
+
 		if(defined("e_LANGUAGE") && is_readable(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php')) {
 			include_once(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php');
 		} else {
 			include_once(e_LANGUAGEDIR.'English/lan_notify.php');
 		}
 	}
-	
+
 	function send($id, $subject, $message) {
-		global $sql;
+		global $sql,$tp;
 		e107_require_once(e_HANDLER.'mail.php');
 		$subject = SITENAME.': '.$subject;
 		if ($this -> notify_prefs['event'][$id]['type'] == 'main') {
-			sendemail(SITEADMINEMAIL, $subject, $message);
+			sendemail(SITEADMINEMAIL, $tp->toEmail($subject), $tp->toEmail($message));
 		} else if ($this -> notify_prefs['event'][$id]['type'] == 'class') {
 			if ($this -> notify_prefs['event'][$id]['class'] == '254') {
 				$sql -> db_Select('user', 'user_email', "user_admin = 1");
@@ -55,10 +55,10 @@
 				$sql -> db_Select('user', 'user_email', "user_class REGEXP '(^|,)(".$this -> notify_prefs['event'][$id]['class'].")(,|$)'");
 			}
 			while ($email = $sql -> db_Fetch()) {
-				sendemail($email['user_email'], $subject, $message);
+				sendemail($email['user_email'], $tp->toEmail($subject), $tp->toEmail($message));
 			}
 		} else if ($this -> notify_prefs['event'][$id]['type'] == 'email') {
-			sendemail($this -> notify_prefs['event'][$id]['email'], $subject, $message);
+			sendemail($this -> notify_prefs['event'][$id]['email'], $tp->toEmail($subject), $tp->toEmail($message));
 		}
 	}
 }
@@ -68,8 +68,22 @@
 
 function notify_usersup($data) {
 	global $nt;
-	foreach ($data as $key => $value) {
-		$message .= $key.': '.$value.'<br />';
+	foreach ($data as $key => $value)
+	{
+		if($key != "password1" && $key != "password2" && $key != "email_confirm" && $key != "register")
+		{
+			if(is_array($value))  // show user-extended values.
+			{
+            	foreach($value as $k => $v)
+				{
+                	$message .= str_replace("user_","",$k).': '.$v.'<br />';
+				}
+			}
+			else
+			{
+				$message .=  $key.': '.$value.'<br />';
+			}
+		}
 	}
 	$nt -> send('usersup', NT_LAN_US_1, $message);
 }
@@ -101,7 +115,7 @@
 }
 
 function notify_subnews($data) {
-	global $nt;
+	global $nt,$tp;
 	foreach ($data as $key => $value) {
 		$message .= $key.': '.$value.'<br />';
 	}
@@ -125,10 +139,20 @@
 	$nt -> send('newsdel', NT_LAN_ND_1, NT_LAN_ND_2.': '.$data);
 }
 
+
+function notify_fileupload($data) {
+	global $nt;
+	$message = '<b>'.$data['upload_name'].'</b><br /><br />'.$data['upload_description'].'<br /><br />'.$data['upload_size'].'<br /><br />'.$data['upload_user'];
+	$nt -> send('fileupload', $data['upload_name'], $message);
+}
+
 if (isset($nt -> notify_prefs['plugins'])) {
 	foreach ($nt -> notify_prefs['plugins'] as $plugin_id => $plugin_settings) {
-		require_once(e_PLUGIN.$plugin_id.'/e_notify.php');
+		if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
+		{
+			require_once(e_PLUGIN.$plugin_id.'/e_notify.php');
+		}
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/np_class.php 0.7.7/e107_handlers/np_class.php
--- 0.7.5/e107_handlers/np_class.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/np_class.php	2006-10-06 19:19:31.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/np_class.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/10/07 00:19:31 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -42,9 +42,7 @@
 	 */
 	function nextprev($url, $from, $view, $total, $td, $qs = "", $return = false) {
 		if ($total > $view) {
-			$a = $total / $view;
-			$r = explode(".", $a);
-			if (isset($r[1]) && $r[1] != 0 ? $pages = ($r[0] + 1) : $pages = $r[0]);
+			$pages = ceil($total / $view);
 		} else {
 			$pages = FALSE;
 		}
diff -ruN 0.7.5/e107_handlers/override_class.php 0.7.7/e107_handlers/override_class.php
--- 0.7.5/e107_handlers/override_class.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/override_class.php	2006-10-06 18:43:03.000000000 -0500
@@ -11,14 +11,27 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/override_class.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2006/10/06 23:43:03 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 	
 if (!defined('e107_INIT')) { exit; }
 
+/*
+ * USAGE
+ * In user code, to override an existing function...
+ *
+ * $override->override_function('original_func_name','mynew_function_name',['optional_include_file_from_root']);
+ *
+ * In e107 code...
+ * if ($over_func_name = $override->override_check('original_func_name')) {
+ *	$result=call_user_func($over_func_name, params...);
+ * }
+ *
+ */
+ 
 class override {
 	var $functions = array();
 	var $includes = array();
diff -ruN 0.7.5/e107_handlers/phpmailer/class.phpmailer.php 0.7.7/e107_handlers/phpmailer/class.phpmailer.php
--- 0.7.5/e107_handlers/phpmailer/class.phpmailer.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/phpmailer/class.phpmailer.php	2006-11-09 03:28:58.000000000 -0600
@@ -1,5 +1,4 @@
 <?php
-
 ////////////////////////////////////////////////////
 // PHPMailer - PHP email class
 //
@@ -12,19 +11,6 @@
 // License: LGPL, see LICENSE
 ////////////////////////////////////////////////////
 
-// --------------------------------------------------------------
-// BUGFIX
-//
-// handles embedded images correctly
-// also handles multipart/alternative (->altBody('text'))
-// messages correctly, even with embedded images
-// and on top of it all, handles attachments correctly
-// EVEN when you have embedded images, and/or used ->altBody()
-//
-// Fix (c) by Csaba Kiss (ironclad@freemail.hu), 2004-April-30
-// --------------------------------------------------------------
-
-
 /**
  * PHPMailer - PHP email transport class
  * @package PHPMailer
@@ -47,7 +33,7 @@
      * Sets the CharSet of the message.
      * @var string
      */
-    var $CharSet           = CHARSET;
+    var $CharSet           = "iso-8859-1";
 
     /**
      * Sets the Content-type of the message.
@@ -110,7 +96,7 @@
     var $AltBody           = "";
 
     /**
-     * Sets word wrapping on the body of the message to a given number of
+     * Sets word wrapping on the body of the message to a given number of 
      * characters.
      * @var int
      */
@@ -127,10 +113,10 @@
      * @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.
+     * 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         = "";
@@ -139,7 +125,7 @@
      *  Holds PHPMailer version.
      *  @var string
      */
-    var $Version           = "1.71";
+    var $Version           = "1.73";
 
     /**
      * Sets the email address that a reading confirmation will be sent.
@@ -155,7 +141,6 @@
      */
     var $Hostname          = "";
 
-
     /////////////////////////////////////////////////
     // SMTP VARIABLES
     /////////////////////////////////////////////////
@@ -201,7 +186,7 @@
     var $Password     = "";
 
     /**
-     *  Sets the SMTP server timeout in seconds. This function will not
+     *  Sets the SMTP server timeout in seconds. This function will not 
      *  work with the win32 version.
      *  @var int
      */
@@ -214,9 +199,9 @@
     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().
+     * 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;
@@ -237,13 +222,13 @@
     var $error_count     = 0;
     var $LE              = "\n";
     /**#@-*/
-
+    
     /////////////////////////////////////////////////
     // VARIABLE METHODS
     /////////////////////////////////////////////////
 
     /**
-     * Sets message type to HTML.
+     * Sets message type to HTML.  
      * @param bool $bool
      * @return void
      */
@@ -279,7 +264,7 @@
     }
 
     /**
-     * Sets Mailer to send message using the qmail MTA.
+     * Sets Mailer to send message using the qmail MTA. 
      * @return void
      */
     function IsQmail() {
@@ -293,7 +278,7 @@
     /////////////////////////////////////////////////
 
     /**
-     * Adds a "To" address.
+     * Adds a "To" address.  
      * @param string $address
      * @param string $name
      * @return void
@@ -307,7 +292,7 @@
     /**
      * Adds a "Cc" address. Note: this function works
      * with the SMTP mailer on win32, not with the "mail"
-     * mailer.
+     * mailer.  
      * @param string $address
      * @param string $name
      * @return void
@@ -321,7 +306,7 @@
     /**
      * Adds a "Bcc" address. Note: this function works
      * with the SMTP mailer on win32, not with the "mail"
-     * mailer.
+     * mailer.  
      * @param string $address
      * @param string $name
      * @return void
@@ -333,7 +318,7 @@
     }
 
     /**
-     * Adds a "Reply-to" address.
+     * Adds a "Reply-to" address.  
      * @param string $address
      * @param string $name
      * @return void
@@ -352,14 +337,16 @@
     /**
      * 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.
+     * 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)       {
+        if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
+        {
             $this->SetError($this->Lang("provide_address"));
             return false;
         }
@@ -368,36 +355,36 @@
         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;
- }
+        if($body == "") { return false; }
 
         // Choose the mailer
-        if($this->Mailer == "sendmail")     {
-          if(!$this->SendmailSend($header, $body))
-              return false;
-        }
-        elseif($this->Mailer == "mail")        {
-          if(!$this->MailSend($header, $body))
-              return false;
-        }
-        elseif($this->Mailer == "smtp")        {
-          if(!$this->SmtpSend($header, $body))
-              return false;
-        }        else        {
+        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"));
-            return false;
+                $result = false;
+                break;
         }
 
-        return true;
+        return $result;
     }
-
+    
     /**
-     * Sends mail using the $Sendmail program.
+     * Sends mail using the $Sendmail program.  
      * @access private
      * @return bool
      */
@@ -407,16 +394,18 @@
         else
             $sendmail = sprintf("%s -oi -t", $this->Sendmail);
 
-        if(!@$mail = popen($sendmail, "w"))        {
+        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)        {
+        if($result != 0)
+        {
             $this->SetError($this->Lang("execute") . $this->Sendmail);
             return false;
         }
@@ -425,33 +414,34 @@
     }
 
     /**
-     * Sends mail using the PHP mail() function.
+     * 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 .= ", "; 
-}
+        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)        {
+        if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
+        {
             $old_from = ini_get("sendmail_from");
-            ini_set("sendmail_from", $this->Sender);
+            e107_ini_set("sendmail_from", $this->Sender);
             $params = sprintf("-oi -f %s", $this->Sender);
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
+            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, 
                         $header, $params);
         }
         else
             $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
 
         if (isset($old_from))
-            ini_set("sendmail_from", $old_from);
+            e107_ini_set("sendmail_from", $old_from);
 
-        if(!$rt)        {
+        if(!$rt)
+        {
             $this->SetError($this->Lang("instantiate"));
             return false;
         }
@@ -475,7 +465,8 @@
             return false;
 
         $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
-        if(!$this->smtp->Mail($smtp_from))        {
+        if(!$this->smtp->Mail($smtp_from))
+        {
             $error = $this->Lang("from_failed") . $smtp_from;
             $this->SetError($error);
             $this->smtp->Reset();
@@ -483,25 +474,27 @@
         }
 
         // Attempt to send attach all recipients
-        for($i = 0; $i < count($this->to); $i++)        {
+        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++)        {
+        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++)        {
+        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 .= ", "; 
-}
+            for($i = 0; $i < count($bad_rcpt); $i++)
+            {
+                if($i != 0) { $error .= ", "; }
                 $error .= $bad_rcpt[$i];
             }
             $error = $this->Lang("recipients_failed") . $error;
@@ -510,7 +503,8 @@
             return false;
         }
 
-        if(!$this->smtp->Data($header . $body))        {
+        if(!$this->smtp->Data($header . $body))
+        {
             $this->SetError($this->Lang("data_not_accepted"));
             $this->smtp->Reset();
             return false;
@@ -524,23 +518,22 @@
     }
 
     /**
-     * Initiates a connection to an SMTP server.  Returns false if the
+     * 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();
- }
+        if($this->smtp == NULL) { $this->smtp = new SMTP(); }
 
         $this->smtp->do_debug = $this->SMTPDebug;
         $hosts = explode(";", $this->Host);
         $index = 0;
-        $connection = ($this->smtp->Connected());
+        $connection = ($this->smtp->Connected()); 
 
         // Retry while there is no connection
-        while($index < count($hosts) && $connection == false) {
+        while($index < count($hosts) && $connection == false)
+        {
             if(strstr($hosts[$index], ":"))
                 list($host, $port) = explode(":", $hosts[$index]);
             else
@@ -549,15 +542,18 @@
                 $port = $this->Port;
             }
 
-            if($this->smtp->Connect($host, $port, $this->Timeout)) {
+            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))  {
+        
+                if($this->SMTPAuth)
+                {
+                    if(!$this->smtp->Authenticate($this->Username, 
+                                                  $this->Password))
+                    {
                         $this->SetError($this->Lang("authenticate"));
                         $this->smtp->Reset();
                         $connection = false;
@@ -578,8 +574,10 @@
      * @return void
      */
     function SmtpClose() {
-        if($this->smtp != NULL)        {
-            if($this->smtp->Connected())            {
+        if($this->smtp != NULL)
+        {
+            if($this->smtp->Connected())
+            {
                 $this->smtp->Quit();
                 $this->smtp->Close();
             }
@@ -587,7 +585,7 @@
     }
 
     /**
-     * Sets the language for all class error messages.  Returns false
+     * 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")
@@ -606,7 +604,7 @@
             return false;
         }
         $this->language = $PHPMAILER_LANG;
-
+    
         return true;
     }
 
@@ -615,14 +613,15 @@
     /////////////////////////////////////////////////
 
     /**
-     * Creates recipient headers.
+     * Creates recipient headers.  
      * @access private
      * @return string
      */
     function AddrAppend($type, $addr) {
         $addr_str = $type . ": ";
         $addr_str .= $this->AddrFormat($addr[0]);
-        if(count($addr) > 1)        {
+        if(count($addr) > 1)
+        {
             for($i = 1; $i < count($addr); $i++)
                 $addr_str .= ", " . $this->AddrFormat($addr[$i]);
         }
@@ -630,9 +629,9 @@
 
         return $addr_str;
     }
-
+    
     /**
-     * Formats an address correctly.
+     * Formats an address correctly. 
      * @access private
      * @return string
      */
@@ -641,7 +640,8 @@
             $formatted = $addr[0];
         else
         {
-            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" .  $addr[0] . ">";
+            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . 
+                         $addr[0] . ">";
         }
 
         return $formatted;
@@ -650,13 +650,12 @@
     /**
      * Wraps message for use with mailers that do not
      * automatically perform wrapping and for quoted-printable.
-     * Original written by philippe.
+     * 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;
+        $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
 
         $message = $this->FixEOL($message);
         if (substr($message, -1) == $this->LE)
@@ -664,15 +663,20 @@
 
         $line = explode($this->LE, $message);
         $message = "";
-        for ($i=0 ;$i < count($line); $i++)        {
+        for ($i=0 ;$i < count($line); $i++)
+        {
           $line_part = explode(" ", $line[$i]);
           $buf = "";
-          for ($e = 0; $e<count($line_part); $e++)          {
+          for ($e = 0; $e<count($line_part); $e++)
+          {
               $word = $line_part[$e];
-              if ($qp_mode and (strlen($word) > $length))              {
+              if ($qp_mode and (strlen($word) > $length))
+              {
                 $space_left = $length - strlen($buf) - 1;
-                if ($e != 0)                {
-                    if ($space_left > 20)                    {
+                if ($e != 0)
+                {
+                    if ($space_left > 20)
+                    {
                         $len = $space_left;
                         if (substr($word, $len - 1, 1) == "=")
                           $len--;
@@ -682,12 +686,15 @@
                         $word = substr($word, $len);
                         $buf .= " " . $part;
                         $message .= $buf . sprintf("=%s", $this->LE);
-                    }                    else                    {
+                    }
+                    else
+                    {
                         $message .= $buf . $soft_break;
                     }
                     $buf = "";
                 }
-                while (strlen($word) > 0)                {
+                while (strlen($word) > 0)
+                {
                     $len = $length;
                     if (substr($word, $len - 1, 1) == "=")
                         $len--;
@@ -701,11 +708,14 @@
                     else
                         $buf = $part;
                 }
-              }              else              {
+              }
+              else
+              {
                 $buf_o = $buf;
-                $buf .= ($e == 0) ? $word : (" " . $word);
+                $buf .= ($e == 0) ? $word : (" " . $word); 
 
-                if (strlen($buf) > $length and $buf_o != "")                {
+                if (strlen($buf) > $length and $buf_o != "")
+                {
                     $message .= $buf_o . $soft_break;
                     $buf = $word;
                 }
@@ -716,7 +726,7 @@
 
         return $message;
     }
-
+    
     /**
      * Set the body wrapping.
      * @access private
@@ -725,11 +735,12 @@
     function SetWordWrap() {
         if($this->WordWrap < 1)
             return;
-
-        switch($this->message_type)        {
+            
+        switch($this->message_type)
+        {
            case "alt":
               // fall through
-           case "alt_attachment":
+           case "alt_attachments":
               $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
               break;
            default:
@@ -739,28 +750,27 @@
     }
 
     /**
-     * Assembles message header.
+     * Assembles message header.  
      * @access private
      * @return string
      */
     function CreateHeader() {
         $result = "";
-
+        
         // Set the boundaries
-        $uniq_id = substr(md5(uniqid(time())),0,16).'_PORKOLT';
-        $this->boundary[1] = "B1grr_" . $uniq_id;
-        $this->boundary[2] = "B2grr_" . $uniq_id;
-        $this->boundary[3] = "B3grr_" . $uniq_id; // added by Csaba Kiss (fix) used if alternative, and inline + normal atts exist
+        $uniq_id = md5(uniqid(time()));
+        $this->boundary[1] = "b1_" . $uniq_id;
+        $this->boundary[2] = "b2_" . $uniq_id;
 
-        $result .= $this->Received();
         $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($this->Mailer != "mail")
+        {
             if(count($this->to) > 0)
                 $result .= $this->AddrAppend("To", $this->to);
             else if (count($this->cc) == 0)
@@ -772,7 +782,7 @@
         $from = array();
         $from[0][0] = trim($this->From);
         $from[0][1] = $this->FromName;
-        $result .= $this->AddrAppend("From", $from);
+        $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))
@@ -787,21 +797,24 @@
 
         $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 BugFix 1.71+ (C)KCS for AES [version " . $this->Version . "]");
-
-        if($this->ConfirmReadingTo != "")   {
-            $result .= $this->HeaderLine("Disposition-Notification-To",
+        $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]),
+        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)        {
+        switch($this->message_type)
+        {
             case "plain":
                 $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
                 $result .= sprintf("Content-Type: %s; charset=\"%s\"",
@@ -810,42 +823,16 @@
             case "attachments":
                 // fall through
             case "alt_attachments":
-                if($this->InlineImageExists() && $this->AttachmentNotInlineExists())               {
-                    // BUGFIX! if alternative, and attached images exist as well
-                    // then type must be multipart/alternative NOT text/html (c) Csaba Kiss
-                    $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
-                    $result .= $this->TextLine("\tboundary=\"" . $this->boundary[3] . '"');
-                    $result .= $this->TextLine("This is a multipart message in MIME format. :-)");
-
-                    if($this->message_type=='alt_attachments')
-						$alt = 'multipart/alternative';
-					else
-						$alt = 'text/html';
-
-					$result .= $this->LE;
-		            $result .= sprintf("--%s%s", $this->boundary[3], $this->LE);  // add mixed start
-                   	$result .= sprintf("Content-Type: %s;%s\ttype=\"{$alt}\";%s\tboundary=\"%s\"%s",
-                                    "multipart/related", $this->LE, $this->LE,
+                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);
-                	$result .= $this->LE;
                 }
-				else if($this->InlineImageExists())
-				{
-					if($this->message_type=='alt_attachments')
-						$alt = 'multipart/alternative';
-					else
-						$alt = 'text/html';
-                    $result .= sprintf("Content-Type: %s;%s\ttype=\"{$alt}\";%s\tboundary=\"%s\"%s",
-                                    "multipart/related", $this->LE, $this->LE,
-                                    $this->boundary[1], $this->LE);
-
-				}
                 else
                 {
-                    // attachment(not inline) exists
                     $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
                     $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                    $result .= $this->TextLine("This is a multipart message in MIME format. :-)");
                 }
                 break;
             case "alt":
@@ -870,86 +857,55 @@
 
         $this->SetWordWrap();
 
-        switch($this->message_type)   {
+        switch($this->message_type)
+        {
             case "alt":
-                $result .= $this->GetBoundary($this->boundary[1], "",
+                $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], "",
+                $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":
-                if($this->InlineImageExists() && $this->AttachmentNotInlineExists()) {
-						// first attach inline then other attachments
-						// other attachments will go with multipart/mixed
-						// not multipart/related!  - fix by Csaba Kiss, 2004-april-30
-                       	$result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
-	        	        $result .= $this->GetBoundary($this->boundary[1], "", "", "");
-    	        	    $result .= $this->EncodeString($this->Body, $this->Encoding);
-		                $result .= $this->LE.$this->LE;
-                        $result .= $this->AttachAll('inline', $this->boundary[1]); // ends boundary
-                        $result .= $this->LE;
-                        $result .= $this->AttachAll('attachment', $this->boundary[3]);
-                		}
-				else {
-        	        $result .= $this->GetBoundary($this->boundary[1], "", "", "");
-    	       	    $result .= $this->EncodeString($this->Body, $this->Encoding);
-		            $result .= $this->LE;
-                    $result .= $this->AttachAll();
-                    }
+                $result .= $this->GetBoundary($this->boundary[1], "", "", "");
+                $result .= $this->EncodeString($this->Body, $this->Encoding);
+                $result .= $this->LE;
+     
+                $result .= $this->AttachAll();
                 break;
             case "alt_attachments":
-                if($this->InlineImageExists() && $this->AttachmentNotInlineExists()) {
-                  	$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->LE;
-                	$result .= $this->AttachAll('inline', $this->boundary[1]); //multipart/related END
-                	$result .= $this->LE;
-                	$result .= $this->AttachAll('attachment', $this->boundary[3]); // multipart/mixed END
-                }
-                else {
-	                $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();
-                }
+                $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())
@@ -969,23 +925,23 @@
         if($encoding == "") { $encoding = $this->Encoding; }
 
         $result .= $this->TextLine("--" . $boundary);
-        $result .= sprintf("Content-Type: %s; charset = \"%s\"",
+        $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;
+        return $this->LE . "--" . $boundary . "--" . $this->LE; 
     }
-
+    
     /**
      * Sets the message type.
      * @access private
@@ -1037,9 +993,10 @@
      * @param string $type File extension (MIME) type.
      * @return bool
      */
-    function AddAttachment($path, $name = "", $encoding = "base64",
+    function AddAttachment($path, $name = "", $encoding = "base64", 
                            $type = "application/octet-stream") {
-        if(!@is_file($path))        {
+        if(!@is_file($path))
+        {
             $this->SetError($this->Lang("file_access") . $path);
             return false;
         }
@@ -1066,32 +1023,14 @@
      * Returns an empty string on failure.
      * @access private
      * @return string
-	 * @comment modified by KCS, you can call it to add only 'inline'/'attachment' attachments with a specific boundary
      */
-    function AttachAll($type_to_add=false, $boundary=false) {
+    function AttachAll() {
         // Return text of body
-		if(!$boundary)
-				$boundary = $this->boundary[1];
         $mime = array();
 
         // Add all attachments
         for($i = 0; $i < count($this->attachment); $i++)
         {
-
-            $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];
-
-			// nothing spec.
-			if($type_to_add!==false) {
-                // skip, not inline or not attachment desired to add
-	            if(0<>strcmp($type_to_add, $disposition))
-    	        	continue;
-            	}
-
             // Check for string attachment
             $bString = $this->attachment[$i][5];
             if ($bString)
@@ -1099,14 +1038,21 @@
             else
                 $path = $this->attachment[$i][0];
 
-            $mime[] = sprintf("--%s%s", $boundary, $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);
 
             if($disposition == "inline")
                 $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
 
-            $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s",
+            $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", 
                               $disposition, $name, $this->LE.$this->LE);
 
             // Encode as string attachment
@@ -1118,17 +1064,17 @@
             }
             else
             {
-                $mime[] = $this->EncodeFile($path, $encoding);
+                $mime[] = $this->EncodeFile($path, $encoding);                
                 if($this->IsError()) { return ""; }
                 $mime[] = $this->LE.$this->LE;
             }
         }
 
-        $mime[] = sprintf("--%s--%s", $boundary, $this->LE);
+        $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
 
         return join("", $mime);
     }
-
+    
     /**
      * Encodes attachment in requested format.  Returns an
      * empty string on failure.
@@ -1136,13 +1082,17 @@
      * @return string
      */
     function EncodeFile ($path, $encoding = "base64") {
-        if(!@$fd = fopen($path, "rb"))        {
+        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;
     }
@@ -1180,13 +1130,13 @@
     }
 
     /**
-     * Encode a header string to best of Q, B, quoted or none.
+     * 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)) {
@@ -1228,12 +1178,12 @@
 
       $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
       $encoded = trim(str_replace("\n", $this->LE, $encoded));
-
+      
       return $encoded;
     }
-
+    
     /**
-     * Encode string to quoted-printable.
+     * Encode string to quoted-printable.  
      * @access private
      * @return string
      */
@@ -1256,7 +1206,7 @@
     }
 
     /**
-     * Encode string to q encoding.
+     * Encode string to q encoding.  
      * @access private
      * @return string
      */
@@ -1277,7 +1227,7 @@
                   "'='.sprintf('%02X', ord('\\1'))", $encoded);
             break;
         }
-
+        
         // Replace every spaces to _ (more readable than =20)
         $encoded = str_replace(" ", "_", $encoded);
 
@@ -1294,7 +1244,7 @@
      * @param string $type File extension (MIME) type.
      * @return void
      */
-    function AddStringAttachment($string, $filename, $encoding = "base64",
+    function AddStringAttachment($string, $filename, $encoding = "base64", 
                                  $type = "application/octet-stream") {
         // Append to $attachment array
         $cur = count($this->attachment);
@@ -1307,24 +1257,25 @@
         $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
+     * 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
+     * @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.
+     * @param string $type File extension (MIME) type.  
      * @return bool
      */
-    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64",
+    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", 
                               $type = "application/octet-stream") {
-
-        if(!@is_file($path))        {
+    
+        if(!@is_file($path))
+        {
             $this->SetError($this->Lang("file_access") . $path);
             return false;
         }
@@ -1343,10 +1294,10 @@
         $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
@@ -1362,31 +1313,10 @@
                 break;
             }
         }
-
-        return $result;
-    }
-
-    /**
-     * Returns true if a normal attachment is present.
-     * @access private
-     * @return bool
-     * @comment modification added by KCS2004-04-30
-     */
-    function AttachmentNotInlineExists() {
-        $result = false;
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            if($this->attachment[$i][6] == "attachment")
-            {
-                $result = true;
-                break;
-            }
-        }
-
+        
         return $result;
     }
 
-
     /////////////////////////////////////////////////
     // MESSAGE RESET METHODS
     /////////////////////////////////////////////////
@@ -1468,7 +1398,7 @@
     }
 
     /**
-     * Returns the proper RFC 822 formatted date.
+     * Returns the proper RFC 822 formatted date. 
      * @access private
      * @return string
      */
@@ -1481,40 +1411,10 @@
 
         return $result;
     }
-
-    /**
-     * Returns Received header for message tracing.
-     * @access private
-     * @return string
-     */
-    function Received() {
-        if ($this->ServerVar('SERVER_NAME') != '')
-        {
-            $protocol = ($this->ServerVar('HTTPS') == 'on') ? 'HTTPS' : 'HTTP';
-            $remote = $this->ServerVar('REMOTE_HOST');
-            if($remote == "")
-                $remote = 'phpmailer';
-            $remote .= ' (['.$this->ServerVar('REMOTE_ADDR').'])';
-        }
-        else
-        {
-            $protocol = 'local';
-            $remote = $this->ServerVar('USER');
-            if($remote == '')
-                $remote = 'phpmailer';
-        }
-
-        $result = sprintf("Received: from %s %s\tby %s " .
-                          "with %s (PHPMailer);%s\t%s%s", $remote, $this->LE,
-                          $this->ServerHostname(), $protocol, $this->LE,
-                          $this->RFCDate(), $this->LE);
-
-        return $result;
-    }
-
+    
     /**
-     * Returns the appropriate server variable.  Should work with both
-     * PHP 4.1.0+ as well as older versions.  Returns an empty string
+     * 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
@@ -1523,12 +1423,13 @@
         global $HTTP_SERVER_VARS;
         global $HTTP_ENV_VARS;
 
-        if(!isset($_SERVER))        {
+        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
@@ -1559,13 +1460,13 @@
     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
@@ -1575,7 +1476,7 @@
     }
 
     /**
-     * Changes every end of line from CR or LF to CRLF.
+     * Changes every end of line from CR or LF to CRLF.  
      * @access private
      * @return string
      */
@@ -1587,7 +1488,7 @@
     }
 
     /**
-     * Adds a custom header.
+     * Adds a custom header. 
      * @return void
      */
     function AddCustomHeader($custom_header) {
@@ -1595,4 +1496,4 @@
     }
 }
 
-?>
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/phpmailer/class.pop3.php 0.7.7/e107_handlers/phpmailer/class.pop3.php
--- 0.7.5/e107_handlers/phpmailer/class.pop3.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/phpmailer/class.pop3.php	2006-08-10 11:11:50.000000000 -0500
@@ -0,0 +1,389 @@
+<?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
+{
+	//	Default POP3 port
+	var $POP3_PORT = 110;
+
+	//	Default Timeout
+	var $POP3_TIMEOUT = 30;
+
+	//	Carriage Return + Line Feed
+	var $CRLF = "\r\n";
+
+	//	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;
+    	}
+
+    }
+    
+    /**
+     * Login to the POP3 server (does not support APOP yet)
+     *
+     * @param string $username
+     * @param string $password
+     * @return boolean
+     */
+    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;
+    	}
+    }
+    
+    /**
+     * Disconnect from the POP3 server
+     *
+     */
+    function Disconnect ()
+    {
+    	$this->sendString('QUIT');
+
+    	fclose($this->pop_conn);
+    }
+
+    /*
+    	---------------
+    	Private Methods
+    	---------------
+    */
+    
+    /**
+     * Get the socket response back.
+     * $size is the maximum number of bytes to retrieve
+     *
+     * @param integer $size
+     * @return string
+     */
+    function getResponse ($size = 128)
+    {
+    	$pop3_response = fgets($this->pop_conn, $size);
+
+    	return $pop3_response;
+    }
+
+    /**
+     * Send a string down the open socket connection to the POP3 server
+     *
+     * @param string $string
+     * @return integer
+     */
+    function sendString ($string)
+    {
+    	$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
+    	
+    	return $bytes_sent;
+    	
+    }
+    
+    /**
+     * Checks the POP3 server response for +OK or -ERR
+     *
+     * @param string $string
+     * @return boolean
+     */
+    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 debug is enabled, display the error message array
+     *
+     */
+    function displayErrors ()
+    {
+    	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
+		);
+	}
+
+//	End of class
+}
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/phpmailer/class.smtp.php 0.7.7/e107_handlers/phpmailer/class.smtp.php
--- 0.7.5/e107_handlers/phpmailer/class.smtp.php	2005-01-27 13:52:30.000000000 -0600
+++ 0.7.7/e107_handlers/phpmailer/class.smtp.php	2006-08-26 21:24:44.000000000 -0500
@@ -12,1008 +12,1034 @@
 //
 // License: LGPL, see LICENSE
 ////////////////////////////////////////////////////
-	
+
 /**
-* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
-* commands except TURN which will always return a not implemented
-* error. SMTP also provides some utility methods for sending mail
-* to an SMTP server.
-* @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
-		}
-		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 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'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], ":"));
-		$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), " ");
-				$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)) {
-			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;
-	}
-	 
+ * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
+ * commands except TURN which will always return a not implemented
+ * error. SMTP also provides some utility methods for sending mail
+ * to an SMTP server.
+ * @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
+        }
+        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],":"));
+        $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))
+        {
+            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;
+    }
+
 }
-	
-	
-?>
\ No newline at end of file
+
+
+ ?>
diff -ruN 0.7.5/e107_handlers/phpmailer/mailout_process.php 0.7.7/e107_handlers/phpmailer/mailout_process.php
--- 0.7.5/e107_handlers/phpmailer/mailout_process.php	2006-05-12 17:50:40.000000000 -0500
+++ 0.7.7/e107_handlers/phpmailer/mailout_process.php	2006-11-29 16:27:40.000000000 -0600
@@ -11,17 +11,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/phpmailer/mailout_process.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/05/12 22:50:40 $
+|     $Revision: 1.12 $
+|     $Date: 2006/11/29 22:27:40 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 if(!getperms("W")){ header("location:".e_BASE."index.php"); }
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_mailout.php");
 
 $HEADER = "";
 $FOOTER = "";
-define("e_PAGETITLE","Mailing...");
+define("e_PAGETITLE",MAILAN_60);
 require_once(HEADERF);
 set_time_limit(18000);
 session_write_close();
@@ -30,12 +31,12 @@
 if($_POST['cancel_emails']){
 	$sql -> db_Delete("generic", "gen_datestamp='".intval($_POST['mail_id'])."' ");
 
-    $text = "<div style='text-align:center;width:220px'><br />Cancelled Successfully";
+    $text = "<div style='text-align:center;width:220px'><br />".MAILAN_66;   // Cancelled Successfully;
     $text .= "<div style='text-align:center;margin-left:auto;margin-right:auto;position:absolute;left:10px;top:110px'>
 	<br /><input type='button' class='button' name='close' value='Close' onclick=\"window.close()\" />
      </div></div>";
 
-    $ns -> tablerender("Mailing Progress", $text);
+    $ns -> tablerender(MAILAN_59, $text);
 	echo "</body></html>";
 
 	exit;
@@ -57,20 +58,29 @@
 	$mail->From = ($_POST['email_from_email'])? $_POST['email_from_email']:	$pref['siteadminemail'];
 	$mail->FromName = ($_POST['email_from_name'])? $_POST['email_from_name']: $pref['siteadmin'];
 	//  $mail->Host     = "smtp1.site.com;smtp2.site.com";
-	if ($pref['mailer']== 'smtp') {
+	if ($pref['mailer']== 'smtp')
+	{
 		$mail->Mailer = "smtp";
-		$mail->SMTPKeepAlive = TRUE;
-		$mail->Host = $pref['smtp_server'];
-		if($pref['smtp_username'] && $pref['smtp_password']){
+		$mail->SMTPKeepAlive = (isset($pref['smtp_keepalive']) && $pref['smtp_keepalive']==1)  ? TRUE : FALSE;
+		if($pref['smtp_server'])
+		{
+			$mail->Host = $pref['smtp_server'];
+		}
+		if($pref['smtp_username'] && $pref['smtp_password'])
+		{
 			$mail->SMTPAuth = TRUE;
 			$mail->Username = $pref['smtp_username'];
 			$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";
 	}
 
@@ -79,36 +89,49 @@
 	$mail->Charset = CHARSET;
 	$mail->Subject = $_POST['email_subject'];
 	$mail->IsHTML(TRUE);
-	$mail->SMTPDebug = False;
+	$mail->SMTPDebug = (e_MENU == "debug") ? TRUE : FALSE;
 
-	if($_POST['email_cc']){
+	if($_POST['email_cc'])
+	{
         $tmp = explode(",",$_POST['email_cc']);
-		foreach($tmp as $addc){
+		foreach($tmp as $addc)
+		{
 			$mail->AddCC($addc);
         }
 	}
 
-	if($_POST['email_bcc']){
+	if($_POST['email_bcc'])
+	{
         $tmp = explode(",",$_POST['email_bcc']);
-		foreach($tmp as $addbc){
+		foreach($tmp as $addbc)
+		{
 			$mail->AddBCC($addbc);
         }
 	}
 
-	if($pref['mail_bounce_email'] !=''){
+	if($pref['mail_bounce_email'] !='')
+	{
 		$mail->Sender = $pref['mail_bounce_email'];
 	}
 
 	$attach = chop($_POST['email_attachment']);
+	if (($temp = strrchr($attach,'/')) !== FALSE)
+	{
+		$attach = substr($attach,$temp + 1);
+	}
 
-	if(is_readable(e_DOWNLOAD.$attach))	{
+	if(is_readable(e_DOWNLOAD.$attach))
+	{
 		$attach_link = e_DOWNLOAD.$attach;
-	}else{
+	}
+	else
+	{
 		$attach_link = e_FILE.'public/'.$attach;
 	}
 
-	if ($attach != "" && !$mail->AddAttachment($attach_link, $attach)){
-		$mss = "There is a problem with the attachment<br />$attach_link";
+	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");
 		exit;
@@ -125,7 +148,8 @@
 	$mail_head .= "<html xmlns='http://www.w3.org/1999/xhtml' >\n";
 	$mail_head .= "<head><meta http-equiv='content-type' content='text/html; charset=utf-8' />\n";
 
-	if (isset($_POST['use_theme'])) {
+	if (isset($_POST['use_theme']))
+	{
 		$theme = $THEMES_DIRECTORY.$pref['sitetheme']."/";
    	//	$mail_head .= "<link rel=\"stylesheet\" href=\"".SITEURL.$theme."style.css\" type=\"text/css\" />\n";
         $style_css = file_get_contents(e_THEME.$pref['sitetheme']."/style.css");
@@ -134,11 +158,13 @@
 		$message_body = $mail_head;
 		$message_body .= "</head>\n<body>\n";
 		$message_body .= "<div style='padding:10px;width:97%'><div class='forumheader3'>\n";
-		$message_body .= $tp -> toHTML($_POST['email_body'],TRUE)."</div></div></body></html>";
-	}else{
+		$message_body .= $tp -> toEmail($_POST['email_body'])."</div></div></body></html>";
+	}
+	else
+	{
 		$message_body = $mail_head;
 		$message_body .= "</head>\n<body>\n";
-		$message_body .= $tp -> toHTML($_POST['email_body'],TRUE)."</body></html>";
+		$message_body .= $tp -> toEmail($_POST['email_body'])."</body></html>";
 		$message_body = str_replace("&quot;", '"', $message_body);
 		$message_body = str_replace('src="', 'src="'.SITEURL, $message_body);
     }
@@ -150,12 +176,13 @@
 // ----------------  Display Progress and Send Emails. ----------------------->
 
 
-    echo "<div class='fcaption'>&nbsp;Mailing Progress</div>";
+    echo "<div class='fcaption'>&nbsp;".MAILAN_59."</div>";
     $qry = "SELECT g.*,u.* FROM #generic AS g LEFT JOIN #user AS u ON g.gen_user_id = u.user_id WHERE g.gen_type='sendmail' and g.gen_datestamp = '".intval($_POST['mail_id'])."' ";
     $count = $sql -> db_Select_gen($qry);
 
-	if(!$count){
-		echo "<div style='text-align:center;width:200px'><br />There are no remaining emails to be sent.</div>";
+	if(!$count)
+	{
+		echo "<div style='text-align:center;width:200px'><br />".MAILAN_61."</div>";
 		echo "</body></html>";
         echo "<div style='text-align:center;margin-left:auto;margin-right:auto;position:absolute;left:10px;top:110px'>
 			<input type='button' class='button' name='close' value='Close' onclick=\"window.close()\" />
@@ -183,7 +210,7 @@
 		$activator = (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$row['user_id'].".".$row['user_sess'] : SITEURL."/signup.php?activate.".$row['user_id'].".".$row['user_sess']);
         $signup_link = ($row['user_sess']) ? "<a href='$activator'>$activator</a>" : "";
 
-		$search = array("{USERNAME}","{USERID}","{SIGNUP_LINK}");
+		$search = array("|USERNAME|","|USERID|","|SIGNUP_LINK|");
 		$replace = array($row['user_name'],$row['user_id'],$signup_link);
 
         $mes_body = str_replace($search,$replace,$message_body);
@@ -235,9 +262,9 @@
 	ob_end_flush();
 
 	echo "<div style='position:absolute;left:10px;top:50px'><br />";
-	echo count($sent)." emails were sent.<br />";
-	echo count($failed)." emails failed.<br />";
-	echo "Total time elapsed: ".stopwatch()." seconds<br />";
+	echo MAILAN_62." ".count($sent)."<br />";
+	echo MAILAN_63." ".count($failed)."<br />";
+	echo MAILAN_64." ".stopwatch()." ".MAILAN_65."<br />";
 	echo "</div>";
 
 	$message = $sql -> db_Delete("generic", "gen_datestamp='".intval($_POST['mail_id'])."' ") ? "deleted" : "deleted_failed";
@@ -334,4 +361,4 @@
      return round(sprintf('%.16f',$mt_diff),2);
   }
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/plugin_class.php 0.7.7/e107_handlers/plugin_class.php
--- 0.7.5/e107_handlers/plugin_class.php	2006-03-19 17:43:28.000000000 -0600
+++ 0.7.7/e107_handlers/plugin_class.php	2006-11-07 21:18:34.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/plugin_class.php,v $
-|     $Revision: 1.41 $
-|     $Date: 2006/03/19 23:43:28 $
-|     $Author: whoisrich $
+|     $Revision: 1.54 $
+|     $Date: 2006/11/08 03:18:34 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,6 +21,7 @@
 
 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");
 
 	/**
 	 * 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.
@@ -30,10 +31,13 @@
 	function getall($flag)
 	{
 		global $sql;
-		if ($sql->db_Select("plugin","*","plugin_installflag = '".intval($flag)."' ORDER BY plugin_name ASC"))
+		if ($sql->db_Select("plugin","*","plugin_installflag = '".intval($flag)."' ORDER BY plugin_path ASC"))
 		{
 			$ret = $sql->db_getList();
  		}
+
+
+
 		return ($ret) ? $ret : FALSE;
 	}
 
@@ -59,21 +63,24 @@
 
 		 	include_once("{$p['path']}{$p['fname']}");
 			$plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
-			if ((!$sql->db_Select("plugin", "plugin_id", "plugin_path = '".$tp -> toDB($plugin_path, true)."'")) && $eplug_name){
+
+			// scan for addons.
+			$eplug_addons = $this->getAddons($plugin_path);
+
+			if($sql->db_Select("plugin", "plugin_id", "plugin_path = '$plugin_path'"))
+			{
+				$sql->db_Update("plugin", "plugin_addons = '{$eplug_addons}' WHERE plugin_path = '$plugin_path'");
+			}
+
+			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){
-					if(is_array($eplug_rss)){
-                    	foreach($eplug_rss as $key=>$val){
-                        	$feeds[] = $key;
-						}
-						$plugin_rss = implode(",",$feeds);
-					}
 					// 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, '".$tp -> toDB($plugin_rss, true)."' ");
+					$sql->db_Insert("plugin", "0, '".$tp -> toDB($eplug_name, true)."', '".$tp -> toDB($eplug_version, true)."', '".$tp -> toDB($eplug_folder, true)."', 1, '$eplug_addons' ");
 				}
 				else
 				{
 					// 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, '' ");
+					$sql->db_Insert("plugin", "0, '".$tp -> toDB($eplug_name, true)."', '".$tp -> toDB($eplug_version, true)."', '".$tp -> toDB($eplug_folder, true)."', 0, '$eplug_addons' ");
 				}
 			}
 		}
@@ -379,20 +386,10 @@
 
 			if (is_array($eplug_prefs)) {
 				$this->manage_prefs('add', $eplug_prefs);
-				$text .= EPL_ADLAN_20.'<br />';
+				$text .= EPL_ADLAN_8.'<br />';
 			}
 
-			if ($eplug_module === TRUE) {
-				$this->manage_plugin_prefs('add', 'modules', $eplug_folder);
-			}
 
-			if ($eplug_status === TRUE) {
-				$this->manage_plugin_prefs('add', 'plug_status', $eplug_folder);
-			}
-
-			if ($eplug_latest === TRUE) {
-				$this->manage_plugin_prefs('add', 'plug_latest', $eplug_folder);
-			}
 
 			if (is_array($eplug_array_pref)){
 				foreach($eplug_array_pref as $key => $val){
@@ -423,7 +420,7 @@
 				} else {
 					$sql->db_Insert("core", "'user_entended', '{$tmp}' ");
 				}
-				$text .= EPL_ADLAN_20."<br />";
+				$text .= EPL_ADLAN_8."<br />";
 			}
 
 			if ($eplug_link === TRUE && $eplug_link_url != '' && $eplug_link_name != '') {
@@ -445,24 +442,160 @@
 
 			$this -> manage_notify('add', $eplug_folder);
 
-			if(is_array($eplug_rss)){
-				foreach($eplug_rss as $key=>$values){
-					$rssfeeds[] = $tp -> toDB($key);
-                	$tmp = serialize($values);
-					$rssmess .= EPL_ADLAN_46 . ". ($key)<br />";
-                }
-				$feeds = implode(",",$rssfeeds);
-			}
-            $plugin_rss = ($feeds) ? $feeds : "";
-			$sql->db_Update('plugin', "plugin_installflag = 1, plugin_rss = '$plugin_rss' WHERE plugin_id = '".intval($id)."'");
+			$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; }
-			$text .= ($eplug_done ? "<br />{$eplug_done}" : "");
+			$text .= (isset($eplug_done) ? "<br />{$eplug_done}" : "<br />".LAN_INSTALL_SUCCESSFUL);
 		} else {
 			$text = EPL_ADLAN_21;
 		}
-		if($eplug_conffile){ $text .= "&nbsp;<a href='".e_PLUGIN."$eplug_folder/$eplug_conffile'>[".EPL_CONFIGURE."]</a>"; }
+		if($eplug_conffile){ $text .= "&nbsp;<a href='".e_PLUGIN."$eplug_folder/$eplug_conffile'>[".LAN_CONFIGURE."]</a>"; }
 		$ns->tablerender(EPL_ADLAN_33, $text);
 	}
+
+
+
+	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";
+
+		// clear all addon prefs before re-creation. 
+		unset($pref['shortcode_list'],$pref['bbcode_list'],$pref['e_sql_list']);
+        foreach($this->plugin_addons as $plg)
+		{
+        	unset($pref[$plg."_list"]);
+		}
+
+		if ($sql -> db_Select_gen($query))
+		{
+			while($row = $sql-> db_Fetch())
+			{
+                $tmp = explode(",",$row['plugin_addons']);
+				$path = $row['plugin_path'];
+
+        		foreach($this->plugin_addons as $val)
+				{
+                	if(in_array($val,$tmp))
+					{
+ 						$pref[$val."_list"][$path] = $path;
+					}
+				}
+                // search for .bb and .sc files.
+				$sc_array = array();
+				$bb_array = array();
+				$sql_array = array();
+
+                foreach($tmp as $adds)
+				{
+                	if(substr($adds,-3) == ".sc")
+					{
+						$sc_name = substr($adds, 0,-3);  // remove the .sc
+                    	$sc_array[$sc_name] = "0"; // default userclass.
+					}
+
+					if(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")
+					{
+						$pref['e_sql_list'][$path] = $adds;
+					}
+				}
+
+                // Build Bbcode list
+                if(count($bb_array) > 0)
+				{
+					ksort($bb_array);
+                	$pref['bbcode_list'][$path] = $bb_array;
+
+				}
+				else
+				{
+                    unset($pref['bbcode_list'][$path]);
+				}
+
+                // Build shortcode list
+				if(count($sc_array) > 0){
+					ksort($sc_array);
+					$pref['shortcode_list'][$path] = $sc_array;
+                }
+				else
+				{
+                    unset($pref['shortcode_list'][$path]);
+				}
+
+			}
+		}
+
+	  	save_prefs();
+		return;
+
+	}
+
+    // 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;
+			}
+		}
+
+		if(!is_object($fl)){
+			require_once(e_HANDLER.'file_class.php');
+ 			$fl = new e_file;
+		}
+
+		// Grab List of Shortcodes & BBcodes
+		$shortcodeList	= $fl->get_files(e_PLUGIN.$plugin_path, ".sc$", "standard", 1);
+		$bbcodeList		= $fl->get_files(e_PLUGIN.$plugin_path, ".bb$", "standard", 1);
+        $sqlList		= $fl->get_files(e_PLUGIN.$plugin_path, "_sql.php$", "standard", 1);
+
+		// Search Shortcodes
+		foreach($shortcodeList as $sc)
+		{
+			if(is_readable(e_PLUGIN.$plugin_path."/".$sc['fname']))
+			{
+				$p_addons[] = $sc['fname'];
+			}
+		}
+
+        // Search Bbcodes.
+        foreach($bbcodeList as $bb)
+		{
+			if(is_readable(e_PLUGIN.$plugin_path."/".$bb['fname']))
+			{
+				$p_addons[] = $bb['fname'];
+			}
+		}
+
+        // Search _sql files.
+        foreach($sqlList as $esql)
+		{
+			if(is_readable(e_PLUGIN.$plugin_path."/".$esql['fname']))
+			{
+				$p_addons[] = str_replace(".php","",$esql['fname']);
+			}
+		}
+
+
+		if($debug)
+		{
+			echo $plugin_path." = ".implode(",",$p_addons)."<br />";
+		}
+
+		return implode(",",$p_addons);
+	}
+
+
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/pop3_class.php 0.7.7/e107_handlers/pop3_class.php
--- 0.7.5/e107_handlers/pop3_class.php	2006-05-12 17:50:40.000000000 -0500
+++ 0.7.7/e107_handlers/pop3_class.php	2006-07-12 02:41:44.000000000 -0500
@@ -1,6 +1,6 @@
 <?php
 if (!defined('e107_INIT')) { exit; }
-// $Id: pop3_class.php,v 1.1 2006/05/12 22:50:40 e107coders Exp $ 
+// $Id: pop3_class.php,v 1.3 2006/07/12 07:41:44 e107coders Exp $
 // Main ReciveMail Class File - Version 1.0 (01-03-2006)
 /*
  * File: recivemail.class.php
@@ -10,6 +10,9 @@
  * Author: Mitul Koradia
  * Email: mitulkoradia@gmail.com
  * Cell : +91 9879697592
+
+Modified by CaMer0n (www.e107coders.org)
+
  */
 class receiveMail
 {
@@ -48,7 +51,9 @@
 		$sender=$mail_header->from[0];
 		$sender_replyto=$mail_header->reply_to[0];
 		$stat = (strtolower($sender->mailbox)!='mailer-daemon' && strtolower($sender->mailbox)!='postmaster') ? FALSE : TRUE;
-
+        if(strpos($mail_header->subject,"delayed")){
+           $stat = FALSE;
+		}
 			$mail_details=array(
 					'from'=>strtolower($sender->mailbox).'@'.$sender->host,
 					'fromName'=>$sender->personal,
@@ -56,7 +61,8 @@
 					'toNameOth'=>$sender_replyto->personal,
 					'subject'=>$mail_header->subject,
 					'to'=>strtolower($mail_header->toaddress),
-					'bounce'=>$stat
+					'bounce'=>$stat,
+					'date'=>$mail_header->date
 				);
 
 		return $mail_details;
@@ -119,7 +125,7 @@
 		$headers=imap_headers($this->marubox);
 		return count($headers);
 	}
-	function GetAttech($mid,$path) // Get Atteced File from Mail
+	function GetAttach($mid,$path) // Get Atteced File from Mail
 	{
 		$struckture = imap_fetchstructure($this->marubox,$mid);
 		$ar="";
@@ -151,10 +157,13 @@
 		$ar=substr($ar,0,(strlen($ar)-1));
 		return $ar;
 	}
-	function getBody($mid) // Get Message Body
+	function getBody($mid,$mode="") // Get Message Body
 	{
-		$body = $this->get_part($this->marubox, $mid, "TEXT/HTML");
-		if ($body == "")
+		if($mode != "plain")
+		{
+			$body = $this->get_part($this->marubox, $mid, "TEXT/HTML");
+		}
+		if (($body == "") || $mode == 'plain')
 			$body = $this->get_part($this->marubox, $mid, "TEXT/PLAIN");
 		if ($body == "") {
 			return "";
diff -ruN 0.7.5/e107_handlers/popup_handler.php 0.7.7/e107_handlers/popup_handler.php
--- 0.7.5/e107_handlers/popup_handler.php	2006-01-11 03:26:39.000000000 -0600
+++ 0.7.7/e107_handlers/popup_handler.php	2006-11-09 03:37:11.000000000 -0600
@@ -11,16 +11,14 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_handlers/popup_handler.php,v $
-|		$Revision: 1.4 $
-|		$Date: 2006/01/11 09:26:39 $
+|		$Revision: 1.6 $
+|		$Date: 2006/11/09 09:37:11 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-define("POPUP_LAN_1", "click to enlarge image");
-
 class popup{
 
 	// usage:
@@ -81,7 +79,7 @@
 				$title		= str_replace($search, $replace, $title);
 				$text		= str_replace($search, $replace, $text);
 
-				$popup = "<a href='javascript:void(0);' onclick=\"javascript:openPerfectPopup('".$image."',".$width.",'".$title."','".$text."')\" style='cursor:pointer;' onmouseover=\"window.status='".POPUP_LAN_1."'; return true;\" onmouseout=\"window.status=''; return true;\" ><img src='".$thumb."' style='border:1px solid #000; ".$iconwidth."' alt='' /></a><br /><br />";
+				$popup = "<a href='javascript:void(0);' onclick=\"javascript:openPerfectPopup('".$image."',".$width.",'".$title."','".$text."')\" style='cursor:pointer;' onmouseover=\"window.status='".POPUP_LAN_1."'; return true;\" onmouseout=\"window.status=''; return true;\" ><img src='".$thumb."' style='".$iconwidth."' alt='' /></a><br /><br />";
 
 			}else{
 				$popup = "";
diff -ruN 0.7.5/e107_handlers/pref_class.php 0.7.7/e107_handlers/pref_class.php
--- 0.7.5/e107_handlers/pref_class.php	2006-01-10 13:19:19.000000000 -0600
+++ 0.7.7/e107_handlers/pref_class.php	2006-10-20 15:59:09.000000000 -0500
@@ -67,14 +67,16 @@
 	* - @access  public
 	*/
 	function get($Name) {
-		$get_sql = new db; // required so sql loops don't break using $tp->toHTML(). 
 		if(isset($this->prefVals['core'][$Name])){
 			if($this->prefVals['core'][$Name] != '### ROW CACHE FALSE ###'){
 				return $this->prefVals['core'][$Name];
 			} else {
 				return false;
 			}
-		} elseif($get_sql->db_Select('core', '*', "`e107_name` = '{$Name}'", 'default')) {
+		}
+
+		$get_sql = new db; // required so sql loops don't break using $tp->toHTML(). 
+		if($get_sql->db_Select('core', '*', "`e107_name` = '{$Name}'", 'default')) {
 			$row = $get_sql->db_Fetch();
 			$this->prefVals['core'][$Name] = $row['e107_value'];
 			return $this->prefVals['core'][$Name];
diff -ruN 0.7.5/e107_handlers/profanity_filter.php 0.7.7/e107_handlers/profanity_filter.php
--- 0.7.5/e107_handlers/profanity_filter.php	2005-12-14 11:37:34.000000000 -0600
+++ 0.7.7/e107_handlers/profanity_filter.php	2006-10-16 17:51:09.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/profanity_filter.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:34 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/10/16 22:51:09 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,12 +21,12 @@
 
 class e_profanityFilter {
 	var $profanityList;
-	 
+
 	function e_profanityFilter() {
 		global $pref;
 
 		$words = explode(",", $pref['profanity_words']);
-		
+        $word_array = array();
 		foreach($words as $word) {
 			$word = trim($word);
 			if($word != "")
@@ -34,11 +34,14 @@
 				$word_array[] = $word;
 			}
 		}
-		$this->profanityList = implode("\b|\b", $word_array);
+		if(count($word_array))
+		{
+			$this->profanityList = implode("\b|\b", $word_array);
+		}
 		unset($words);
 		return TRUE;
 	}
-	 
+
 	function filterProfanities($text) {
 		global $pref;
 		if (!$this->profanityList) {
@@ -50,7 +53,7 @@
 			return preg_replace_callback("#\b".$this->profanityList."\b#is", array($this, 'replaceProfanities'), $text);
 		}
 	}
-	 
+
 	function replaceProfanities($matches) {
 		/*!
 		@function replaceProfanities callback
@@ -58,9 +61,9 @@
 		@param text string - text string to be filtered
 		@result filtered text
 		*/
-		 
+
 		return preg_replace("#a|e|i|o|u#i", "*" , $matches[0]);
 	}
 }
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_handlers/rate_class.php 0.7.7/e107_handlers/rate_class.php
--- 0.7.5/e107_handlers/rate_class.php	2006-05-13 13:18:43.000000000 -0500
+++ 0.7.7/e107_handlers/rate_class.php	2006-10-28 21:30:31.000000000 -0500
@@ -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.18 $
-|     $Date: 2006/05/13 18:18:43 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.19 $
+|     $Date: 2006/10/29 02:30:31 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -32,14 +32,14 @@
 		if ($_SERVER['QUERY_STRING']) {
 			$self .= "?".$_SERVER['QUERY_STRING'];
 		}
-		
+
 		$jump = "";
 		$url = "";
 		if($mode==FALSE){
 			$jump = "onchange='urljump(this.options[selectedIndex].value)'";
 			$url = e_BASE."rate.php?";
 		}
-		
+
 		$str = $text."
 			<select name='rateindex' ".$jump." class='tbox'>
 			<option selected='selected'  value='0'>".RATELAN_5."</option>
@@ -124,13 +124,13 @@
 					}else{
 						$rating[0] = 0;		//number of votes, not relevant in users rating
 						$rating[1] = 0;		//the rating by this user
-						$rating[2] = 0;		//no remainder is present, because we have a single users rating							
+						$rating[2] = 0;		//no remainder is present, because we have a single users rating
 					}
 				}
 			}else{
 				$rating[0] = $rowgr['rate_votes']; // $rating[0] == number of votes
 				$tmp = $rowgr['rate_rating'] / $rowgr['rate_votes'];
-				$tmp = explode(".", $tmp);
+				$tmp = (strpos($tmp,",")) ? explode(",", $tmp) : explode(".", $tmp);
 				$rating[1] = $tmp[0];
 				if(isset($tmp[1])){
 					$rating[2] = substr($tmp[1], 0, 1);
@@ -147,12 +147,12 @@
 		global $sql, $tp;
 
 		$qs = explode("^", $rateindex);
-			
+
 		if (!$qs[0] || USER == FALSE || $qs[3] > 10 || $qs[3] < 1) {
 			header("location:".e_BASE."index.php");
 			exit;
 		}
-			
+
 		$table = $tp -> toDB($qs[0], true);
 		$itemid = intval($qs[1]);
 		$rate = intval($qs[3]);
@@ -206,7 +206,7 @@
 			}
 			if(!$this -> checkrated($table, $id) && USER){
 				$rate .= $this -> rateselect(RATELAN_2, $table, $id, $nojump);
-				
+
 			}else if(USER){
 				$rate .= RATELAN_3;
 			}
@@ -224,4 +224,4 @@
 		return $sql -> db_Delete("rate", "rate_itemid='{$id}' AND rate_table='{$table}'");
 	}
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/ren_help.php 0.7.7/e107_handlers/ren_help.php
--- 0.7.5/e107_handlers/ren_help.php	2006-05-13 21:08:13.000000000 -0500
+++ 0.7.7/e107_handlers/ren_help.php	2006-08-08 22:10:58.000000000 -0500
@@ -11,166 +11,108 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/ren_help.php,v $
-|     $Revision: 1.43 $
-|     $Date: 2006/05/14 02:08:13 $
+|     $Revision: 1.60 $
+|     $Date: 2006/08/09 03:10:58 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_ren_help.php");
-@include_once(e_LANGUAGEDIR."English/lan_ren_help.php");
-function ren_help($mode = 1, $addtextfunc = "addtext", $helpfunc = "help") {
-
-	//        $mode == TRUE : fontsize and colour dialogs are rendered
-	//        $mode == 2 : no helpbox
-
-	$rand = rand(1000,9999);
-
-	if (strstr(e_SELF, "content") || strstr(e_SELF, "cpage")) {
-		$code[0] = array("newpage", "[newpage]", LANHELP_34);
-	}
-	$code[1] = array("link", "[link=".LANHELP_35."][/link]", LANHELP_23);
-	$code[2] = array("b", "[b][/b]", LANHELP_24);
-	$code[3] = array("i", "[i][/i]", LANHELP_25);
-	$code[4] = array("u", "[u][/u]", LANHELP_26);
-	$code[5] = array("img", "[img][/img]", LANHELP_27);
-	$code[6] = array("center", "[center][/center]", LANHELP_28);
-	$code[7] = array("left", "[left][/left]", LANHELP_29);
-	$code[8] = array("right", "[right][/right]", LANHELP_30);
-	$code[9] = array("bq", "[blockquote][/blockquote]", LANHELP_31);
-	$code[10] = array("code", "[code][/code]", LANHELP_32 );
-	$code[11] = array("list", "[list][/list]", LANHELP_36);
-	$code[12] = array("fontcol", "[color][/color]", LANHELP_21);
-	$code[13] = array("fontsize", "[size][/size]", LANHELP_22);
-
-	$img[0] = "newpage.png";
-	$img[1] = "link.png";
-	$img[2] = "bold.png";
-	$img[3] = "italic.png";
-	$img[4] = "underline.png";
-	$img[5] = "image.png";
-	$img[6] = "center.png";
-	$img[7] = "left.png";
-	$img[8] = "right.png";
-	$img[9] = "blockquote.png";
-	$img[10] = "code.png";
-	$img[11] = "list.png";
-	$img[12] = "fontcol.png";
-	$img[13] = "fontsize.png";
-
-	$imgpath = (file_exists(THEME."bbcode/bold.png") ? THEME."bbcode/" : e_IMAGE."generic/bbcode/");
-
-	$text = "";
-	foreach($code as $key=>$bbcode){
-		if($key == 12){
-			$text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"expandit('col_selector_".$rand."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}else if($key == 13){
-			$text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"expandit('size_selector_".$rand."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}else{
-		  $text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"{$addtextfunc}('".$bbcode[1]."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}
-	}
 
 
-	$text .= Size_Select('size_selector_'.$rand);
-	$text .= Color_Select('col_selector_'.$rand);
-	return $text;
+function ren_help($mode = 1, $addtextfunc = "addtext", $helpfunc = "help")
+{
+    // ren_help() is deprecated - use display_help().
+    return display_help("helpb", $mode, $addtextfunc, $helpfunc = "help");
 }
 
-// New Function - display_help() [ ren_help() is deprecated. ]
 
-function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $helpfunc = "help") {
 
-	global $pref;
-	//        $mode == TRUE : fontsize and colour dialogs are rendered
-	//        $mode == 2 : no helpbox
-	//        $mode == 'news' : preuploaded news images dialog is rendered
-	$rand = rand(1000,9999);
-	if (strstr(e_SELF, "content") || strstr(e_SELF, "cpage")) {
-		$code[0] = array("newpage", "[newpage]", LANHELP_34);
-	}
-	$code[1] = array("link", "[link=".LANHELP_35."][/link]", LANHELP_23);
-	$code[2] = array("b", "[b][/b]", LANHELP_24);
-	$code[3] = array("i", "[i][/i]", LANHELP_25);
-	$code[4] = array("u", "[u][/u]", LANHELP_26);
-	$code[5] = array("img", "[img][/img]", LANHELP_27);
-	$code[6] = array("center", "[center][/center]", LANHELP_28);
-	$code[7] = array("left", "[left][/left]", LANHELP_29);
-	$code[8] = array("right", "[right][/right]", LANHELP_30);
-	$code[9] = array("bq", "[blockquote][/blockquote]", LANHELP_31);
-	$code[10] = array("code", "[code][/code]", LANHELP_32 );
-	$code[11] = array("list", "[list][/list]", LANHELP_36);
-	$code[12] = array("fontcol", "[color][/color]", LANHELP_21);
-	$code[13] = array("fontsize", "[size][/size]", LANHELP_22);
-	if ($mode == 'news') {
-		$code[14] = array("preimage", "[img][/img]", LANHELP_37);
-		$code[15] = array("prefile", "[file][/file]", LANHELP_39);
-	}
-
-	$img[0] = "newpage.png";
-	$img[1] = "link.png";
-	$img[2] = "bold.png";
-	$img[3] = "italic.png";
-	$img[4] = "underline.png";
-	$img[5] = "image.png";
-	$img[6] = "center.png";
-	$img[7] = "left.png";
-	$img[8] = "right.png";
-	$img[9] = "blockquote.png";
-	$img[10] = "code.png";
-	$img[11] = "list.png";
-	$img[12] = "fontcol.png";
-	$img[13] = "fontsize.png";
-	if ($mode == 'news') {
-		$img[14] = "preimage.png";
-		$img[15] = "prefile.png";
-	}
-
-	$imgpath = (file_exists(THEME."bbcode/bold.png") ? THEME."bbcode/" : e_IMAGE."generic/bbcode/");
-
-	$text = "";
-	foreach($code as $key=>$bbcode){
-		if($key == 12){
-			$text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"expandit('col_selector_".$rand."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}else if($key == 13){
-			$text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"expandit('size_selector_".$rand."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}else if($key == 14){
-			$text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"expandit('preimage_selector_".$rand."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}else if($key == 15){
-			$text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"expandit('prefile_selector_".$rand."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
-		}else{
-		  $text .= "<img class='bbcode' src='".$imgpath.$img[$key]."' alt='' title='".$bbcode[2]."' onclick=\"{$addtextfunc}('".$bbcode[1]."')\" ".($mode != 2 ? "onmouseout=\"{$helpfunc}('')\" onmouseover=\"{$helpfunc}('".$bbcode[2]."')\"" : "" )." />\n";
+
+
+function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $helpfunc = "help")
+{
+    if(e_WYSIWYG){ return; }
+	global $tp, $pref, $eplug_bb, $bbcode_func, $register_bb, $bbcode_help, $bbcode_helpactive, $bbcode_helptag;
+
+	$bbcode_func = $addtextfunc;
+ 	$bbcode_help = $helpfunc;
+    $bbcode_helptag = $tagid;
+
+    // load the template
+	if(is_readable(THEME."bbcode_template.php"))
+	{
+		include(THEME."bbcode_template.php");
+	}
+	else
+	{
+		include(e_THEME."templates/bbcode_template.php");
+	}
+
+	if($mode != 2 && $mode != "forum")
+	{
+    	$bbcode_helpactive = TRUE;
+	}
+
+    // Load the Plugin bbcode AFTER the templates, so they can modify or replace.
+	foreach($pref['e_bb_list'] as $val)
+	{
+    	if(is_readable(e_PLUGIN.$val."/e_bb.php"))
+		{
+        	require(e_PLUGIN.$val."/e_bb.php");
 		}
 	}
 
+    $temp['news'] 		= $BBCODE_TEMPLATE_NEWSPOST;
+	$temp['extended']	= $BBCODE_TEMPLATE_NEWSPOST;
+	$temp['admin']		= $BBCODE_TEMPLATE_ADMIN;
+	$temp['mailout']	= $BBCODE_TEMPLATE_ADMIN."{BB=shortcode}";
+	$temp['cpage']		= $BBCODE_TEMPLATE_CPAGE;
+	$temp['maintenance']= $BBCODE_TEMPLATE_ADMIN;
+	$temp['comment'] 	= "{BB_HELP}<br />".$BBCODE_TEMPLATE;
 
-/*
-	if(file_exists(e_PLUGIN."sphpell/spellcheckpageinc.php"))
+	if($temp[$mode])
 	{
-		require_once(e_PLUGIN."sphpell/spellcheckpageinc.php");
-		$string .= "<input type='button' value='Check Spelling' onclick=\"DoSpellCheck('top.opener.parent.document.dataform.data')\">";
+        $BBCODE_TEMPLATE = $temp[$mode];
+	}
+    if(is_readable(e_FILE."shortcode/batch/bbcode_shortcodes.php"))
+	{
+  		require_once(e_FILE."shortcode/batch/bbcode_shortcodes.php");
+  		return $tp->parseTemplate($BBCODE_TEMPLATE, FALSE, $bbcode_shortcodes);
+	}
+	else
+	{
+    	return "ERROR: ".e_FILE."shortcode/batch/bbcode_shortcodes.php IS NOT READABLE.";
 	}
-*/
 
+}
 
-	if ($mode) {
-		$text .= Size_Select('size_selector_'.$rand);
-		$text .= Color_Select('col_selector_'.$rand);
-		if ($mode == 'news') {
-			$text .= PreImage_Select('preimage_selector_'.$rand);
-			$text .= PreFile_Select('prefile_selector_'.$rand);
-		}
+
+function Size_Select($formid='size_selector') {
+	$text ="<!-- Start of Size selector -->
+	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
+	$text .="<div style='position:absolute; bottom:30px; right:125px'>";
+	$text .= "<table class='fborder' style='background-color: #fff'>
+	<tr><td class='forumheader3'>
+	<select class='tbox' name='preimageselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
+	<option value=''>".LANHELP_41."</option>";
+
+	$sizes = array(7,8,9,10,11,12,14,15,18,20,22,24,26,28,30,36);
+	foreach($sizes as $s){
+		$text .= "<option value='[size=".$s."][/size]'>".$s."px</option>\n";
 	}
+	$text .="</select></td></tr>	\n </table></div>
+	</div>\n<!-- End of Size selector -->";
 
 	return $text;
 }
 
+
 function Color_Select($formid='col_selector') {
 
 	$text = "<!-- Start of Color selector -->
-	<div style='margin-left: 0px; margin-right: 0px; width: 221px; position: relative; z-index: 1000; float: right; display: none' id='{$formid}' onclick=\"this.style.display='none'\">
+	<div style='margin-left: 0px; margin-right: 0px; width: 221px; position: relative; z-index: 1000; float: right; display: none' id='{$formid}' onclick=\"this.style.display='none'\" >
 	<div style='position: absolute; bottom: 30px; right: 145px; width: 221px'>";
 
 	$text .= "<script type='text/javascript'>
@@ -235,35 +177,22 @@
 }
 
 
-function Size_Select($formid='size_selector') {
-	$text ="<!-- Start of Size selector -->
-	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
-	$text .="<div style='position:absolute; bottom:30px; right:125px'>";
-	$text .= "<table class='fborder' style='background-color: #fff'>
-	<tr><td class='forumheader3'>
-	<select class='tbox' name='preimageselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
-	<option value=''>".LANHELP_41."</option>";
+function PreImage_Select($formid) {
+	global $fl, $tp, $bbcode_imagedir;
 
-	$sizes = array(7,8,9,10,11,12,14,15,18,20,22,24,26,28,30,36);
-	foreach($sizes as $s){
-		$text .= "<option value='[size=".$s."][/size]'>".$s."px</option>\n";
-	}
-	$text .="</select></td></tr>	\n </table></div>
-	</div>\n<!-- End of Size selector -->";
-	return $text;
-}
+	$path = ($bbcode_imagedir) ?  $bbcode_imagedir : e_IMAGE."newspost_images/";
+	$formid = ($formid) ? ($formid) : "preimage_selector";
 
-function PreImage_Select($formid='preimage_selector') {
 
-	global $IMAGES_DIRECTORY, $fl;
 	if(!is_object($fl)){
         require_once(e_HANDLER."file_class.php");
 		$fl = new e_file;
 	}
 
 	$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
-	$imagelist = $fl->get_files(e_IMAGE."newspost_images/","",$rejecthumb);
+	$imagelist = $fl->get_files($path,"",$rejecthumb,2);
     sort($imagelist);
+
 	$text ="<!-- Start of PreImage selector -->
 	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
 	$text .="<div style='position:absolute; bottom:30px; right:100px'>";
@@ -272,7 +201,8 @@
 
 	if(!count($imagelist))
 			{
-				$text .= LAN_NEWS_43;
+
+				$text .= LANHELP_46."<b>".str_replace("../","",$path)."</b>";
 			}
 			else
 			{
@@ -280,25 +210,26 @@
 				<option value=''>".LANHELP_42."</option>";
 				foreach($imagelist as $image)
 				{
+					$e_path = $tp->createConstants($image['path'],1);
+					$showpath = str_replace($path,"",$image['path']);
 					if(strstr($image['fname'], "thumb"))
 					{
 						$fi = str_replace("thumb_", "", $image['fname']);
-						if(file_exists(e_IMAGE."newspost_images/".$fi))
+						if(file_exists($path.$fi))
 						{
 							// thumb and main image found
-							$text .= "<option value=\"[link=".$IMAGES_DIRECTORY."newspost_images/".$fi."][img]{E_IMAGE}newspost_images/".$image['fname']."[/img][/link]\">".$image['fname']." (".LANHELP_38.")</option>\n
+							$text .= "<option value=\"[link=".$e_path.$fi."][img]".$e_path.$image['fname']."[/img][/link]\">".$showpath.$image['fname']." (".LANHELP_38.")</option>\n
 							";
 						}
 						else
 						{
-							$text .= "<option value=\"[img]{E_IMAGE}newspost_images/".$image['fname']."[/img]\">".$image['fname']."</option>\n
+							$text .= "<option value=\"[img]".$e_path.$image['fname']."[/img]\">".$showpath.$image['fname']."</option>\n
 							";
 						}
 					}
 					else
 					{
-						$text .= "<option value=\"[img]{E_IMAGE}newspost_images/".$image['fname']."[/img]\">".$image['fname']."</option>\n
-						";
+						$text .= "<option value=\"[img]".$e_path.$image['fname']."[/img]\">".$showpath.$image['fname']."</option>\n";
 					}
 				}
 				$text .="</select>";
@@ -308,11 +239,11 @@
 	return $text;
 }
 
-function PreFile_Select($formid='prefile_selector') {
+function PreFile_Select($formid='prefile_selector',$bbcode_filedir) {
+	require_once(e_HANDLER."userclass_class.php");
 	global $IMAGES_DIRECTORY, $fl, $sql;
 		$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
-		$imagelist = $fl->get_files(e_IMAGE."newspost_images/","",$rejecthumb);
-		sort($imagelist); 
+
 		$filelist = array();
 		$downloadList = array();
 
@@ -364,11 +295,11 @@
 
 					if($file['id'])
 					{
-						$text .= "<option value=\"[file=request.php?".$file['id']."{$cinfo}]".$file['name']."[/file]\">".$file['name']." - $ucname</option>\n";
+						$text .= "<option value=\"[file={e_BASE}request.php?".$file['id']."{$cinfo}]".$file['name']."[/file]\">".$file['name']." - $ucname</option>\n";
 											}
 					else
 					{
-						$text .= "<option value=\"[file=request.php?".$file['url']."{$cinfo}]".$file['name']."[/file]\">".$file['name']." - $ucname</option>\n";
+						$text .= "<option value=\"[file={e_BASE}request.php?".$file['url']."{$cinfo}]".$file['name']."[/file]\">".$file['name']." - $ucname</option>\n";
 					}
 
 		}
@@ -380,5 +311,18 @@
 	return $text;
 }
 
+function Emoticon_Select($formid='emoticon_selector') {
+	require_once(e_HANDLER."emote.php");
+	$text ="<!-- Start of Emoticon selector -->
+	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}' onclick=\"this.style.display='none'\" >
+		<div style='position:absolute; bottom:30px; right:75px; width:221px; height:133px; overflow:auto;'>
+			<table class='fborder' style='background-color:#fff;'>
+			<tr><td class='forumheader3'>
+			".r_emote()."
+			</td></tr></table>
+		</div>
+	</div>\n<!-- End of Emoticon selector -->\n";
+	return $text;
+}
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/search/search_comment.php 0.7.7/e107_handlers/search/search_comment.php
--- 0.7.5/e107_handlers/search/search_comment.php	2005-12-28 08:50:24.000000000 -0600
+++ 0.7.7/e107_handlers/search/search_comment.php	2006-11-17 08:49:23.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_comment.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/28 14:50:24 $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/17 14:49:23 $
 |     $Author: sweetas $
 +----------------------------------------------------------------------------+
 */
@@ -39,10 +39,13 @@
 foreach ($search_prefs['comments_handlers'] as $h_key => $value) {
 	if (check_class($value['class'])) {
 		$path = ($value['dir'] == 'core') ? e_HANDLER.'search/comments_'.$h_key.'.php' : e_PLUGIN.$value['dir'].'/search/search_comments.php';
-		require_once($path);
-		$in[] = "'".$value['id']."'";
-		$join[] = $comments_table[$h_key];
-		$return_fields .= ', '.$comments_return[$h_key];
+		if (is_readable($path)) {
+			require_once($path);
+			$in[] = "'".$value['id']."'";
+			$join[] = $comments_table[$h_key];
+			$return_fields .= ', '.$comments_return[$h_key];
+		}
+		
 	}
 }
 
@@ -58,8 +61,10 @@
 $results = $ps['results'];
 
 function search_comment($row) {	
-	$res = call_user_func('com_search_'.$row['comment_type'], $row);
-	return $res;
+	if (is_callable('com_search_'.$row['comment_type'])) {
+		$res = call_user_func('com_search_'.$row['comment_type'], $row);
+		return $res;
+	}
 }
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/search/search_download.php 0.7.7/e107_handlers/search/search_download.php
--- 0.7.5/e107_handlers/search/search_download.php	2006-02-18 12:08:16.000000000 -0600
+++ 0.7.7/e107_handlers/search/search_download.php	2006-11-09 21:16:30.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_download.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/02/18 18:08:16 $
+|     $Revision: 1.12 $
+|     $Date: 2006/11/10 03:16:30 $
 |     $Author: sweetas $
 +----------------------------------------------------------------------------+
 */
@@ -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_class IN (".USERCLASS_LIST.") AND c.download_category_class IN (".USERCLASS_LIST.") AND".$advanced_where;
+$where = "download_active = '1' 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 -ruN 0.7.5/e107_handlers/secure_img_handler.php 0.7.7/e107_handlers/secure_img_handler.php
--- 0.7.5/e107_handlers/secure_img_handler.php	2005-12-28 14:01:21.000000000 -0600
+++ 0.7.7/e107_handlers/secure_img_handler.php	2006-10-16 17:46:52.000000000 -0500
@@ -11,22 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/secure_img_handler.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/28 20:01:21 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/10/16 22:46:52 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 class secure_image {
 	var $random_number;
-	 
+
 	function secure_image() {
 		list($usec, $sec) = explode(" ", microtime());
 		$this->random_number = str_replace(".", "", $sec.$usec);
 	}
-	 
+
 	function create_code() {
 		global $pref, $sql, $IMAGES_DIRECTORY, $HANDLERS_DIRECTORY;
 
@@ -41,14 +41,14 @@
 		$maxran = 1000000;
 		$rand_num = mt_rand(0, $maxran);
 		$datekey = date("r");
-		$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . serialize($pref). $rand_num . $datekey));
+		$rcode = hexdec(md5($_SERVER['HTTP_USER_AGENT'] . serialize($pref). $rand_num . $datekey));
 		$code = substr($rcode, 2, 6);
 		$recnum = $this->random_number;
 		$del_time = time()+1200;
 		$sql->db_Insert("tmp", "'{$recnum}',{$del_time},'{$code},{$imgp}'");
 		return $recnum;
 	}
-	 
+
 	function verify_code($rec_num, $checkstr) {
 		global $sql, $tp;
 		if ($sql->db_Select("tmp", "tmp_info", "tmp_ip = '".$tp -> toDB($rec_num)."'")) {
@@ -59,11 +59,11 @@
 		}
 		return FALSE;
 	}
-	 
+
 	function r_image() {
 		global $HANDLERS_DIRECTORY;
 		$code = $this->create_code();
 		return "<img src='".e_BASE.$HANDLERS_DIRECTORY."secure_img_render.php?{$code}' alt='' />";
 	}
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/secure_img_render.php 0.7.7/e107_handlers/secure_img_render.php
--- 0.7.5/e107_handlers/secure_img_render.php	2005-12-17 10:04:20.000000000 -0600
+++ 0.7.7/e107_handlers/secure_img_render.php	2006-11-20 05:48:44.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,51 +11,72 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/secure_img_render.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2005/12/17 16:04:20 $
-|     $Author: streaky $
+|     $Revision: 1.16 $
+|     $Date: 2006/11/20 11:48:44 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
-while (list($global) = each($GLOBALS))
-{
+while (@ob_end_clean());
+
+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);
+
+while (list($global) = each($GLOBALS)) {
 	if (!preg_match('/^(_SERVER|GLOBALS)$/', $global)) {
 		unset($$global);
 	}
 }
+
 unset($global);
+
 $imgtypes = array("jpeg", "png", "gif");
 
 define("e_QUERY", preg_replace("#&|/?PHPSESSID.*#i", "", $_SERVER['QUERY_STRING']));
-$recnum = preg_replace("#\D#", "", e_QUERY);
-if (!$recnum) {
+
+$recnum = preg_replace("#\D#","",e_QUERY);
+
+if($recnum == false){
 	exit;
 }
 
 $mySQLserver = "";
 
 @include_once(dirname(__FILE__)."e107_config.php");
+
 $a = 0;
 $p = "";
 
-while (!$mySQLserver && $a < 5) {
-	$a++;
+while(!$mySQLserver && $a < 5){
+	$a ++;
 	$p .= "../";
 	@include_once($p."e107_config.php");
 }
+
 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;
 }
 
-list($code, $url) = explode(",", $row['tmp_info']);
+list($code, $url) = explode(",",$row['tmp_info']);
+
 $type = "none";
-foreach($imgtypes as $t)
-{
-	if (function_exists("imagecreatefrom".$t))
-	{
+
+foreach($imgtypes as $t) {
+	if(function_exists("imagecreatefrom".$t)) {
 		$type = $t;
 		break;
 	}
@@ -63,36 +84,62 @@
 
 $path = realpath(dirname(__FILE__)."/../")."/".$IMAGES_DIRECTORY;
 
-switch($type)
-{
+if(is_readable($path."secure_image_custom.php")) {
+	require_once($path."secure_image_custom.php");
+	/*   Example secure_image_custom.php file:
+
+	$secureimg['image'] = "code_bg_custom";  // filename excluding the .ext
+	$secureimg['size']	= "15";
+	$secureimg['angle']	= "0";
+	$secureimg['x']		= "6";
+	$secureimg['y']		= "22";
+	$secureimg['font'] 	= "imagecode.ttf";
+	$secureimg['color'] = array(90,90,90); // red,green,blue
+
+	*/
+	$bg_file = $secureimg['image'];
+} else {
+	$bg_file = "generic/code_bg";
+}
+
+switch($type) {
 	case "jpeg":
-		$image = ImageCreateFromJPEG($path."generic/code_bg.jpg");
+		$image = ImageCreateFromJPEG($path.$bg_file.".jpg");
 		break;
 	case "png":
-		$image = ImageCreateFromPNG($path."generic/code_bg.png");
+		$image = ImageCreateFromPNG($path.$bg_file.".png");
 		break;
 	case "gif":
-		$image = ImageCreateFromGIF($path."generic/code_bg.gif");
+		$image = ImageCreateFromGIF($path.$bg_file.".gif");
 		break;
 }
-$text_color = ImageColorAllocate($image, 80, 80, 80);
-//ob_clean();
 
-header("Content-type: image/".$type);
-ImageString ($image, 5, 12, 2, $code, $text_color);
-switch($type)
-{
+if(isset($secureimg['color'])) {
+	$tmp = explode(",",$secureimg['color']);
+	$text_color = ImageColorAllocate($image,$tmp[0],$tmp[1],$tmp[2]);
+} else {
+	$text_color = ImageColorAllocate($image, 90, 90, 90);
+}
+
+header("Content-type: image/{$type}");
+
+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 {
+	imagestring ($image, 5, 12, 2, $code, $text_color);
+}
+
+switch($type) {
 	case "jpeg":
-		ImageJPEG($image, '', 75);
+		imagejpeg($image);
 		break;
 	case "png":
-		ImagePNG($image, '', 75);
+		imagepng($image);
 		break;
 	case "gif":
-		ImageGIF($image, '', 75);
+		imagegif($image);
 		break;
 }
-ImageDestroy($image);
-die();
 
+imagedestroy($image);
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/session_handler.php 0.7.7/e107_handlers/session_handler.php
--- 0.7.5/e107_handlers/session_handler.php	2006-01-03 09:53:12.000000000 -0600
+++ 0.7.7/e107_handlers/session_handler.php	2006-11-09 03:28:58.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/session_handler.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/01/03 15:53:12 $
-|     $Author: streaky $
+|     $Revision: 1.7 $
+|     $Date: 2006/11/09 09:28:58 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -92,7 +92,7 @@
 
 session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc");
 
-ini_set ("session.save_handler", "user" );
+e107_ini_set ("session.save_handler", "user" );
 $session_cookie_lifetime = 0;
 $session_cookie_path = '/';
 $session_cookie_domain = '';
@@ -104,9 +104,9 @@
 	$session_cookie_secure = true;
 }
 session_set_cookie_params($session_cookie_lifetime, $session_cookie_path, $session_cookie_domain, $session_cookie_secure);
-if (version_compare(phpversion(), "4.3.0", ">=")) ini_set ("session.use_only_cookies", $session_use_only_cookies );
+if (version_compare(phpversion(), "4.3.0", ">=")) e107_ini_set ("session.use_only_cookies", $session_use_only_cookies );
 if (version_compare(phpversion(), "4.2.0", ">=")) session_cache_expire ($session_cache_expire);
-ini_set ("session.url_rewriter.tags", 'a=href,area=href,frame=src,input=src,form=fakeentry');
+e107_ini_set ("session.url_rewriter.tags", 'a=href,area=href,frame=src,input=src,form=fakeentry');
 
 if ($sql->db_Select("session", "session_id", "session_ip='".get_full_ip()."' ")) {
 	$row = $sql->db_Fetch();
diff -ruN 0.7.5/e107_handlers/shortcode_handler.php 0.7.7/e107_handlers/shortcode_handler.php
--- 0.7.5/e107_handlers/shortcode_handler.php	2006-02-17 10:20:42.000000000 -0600
+++ 0.7.7/e107_handlers/shortcode_handler.php	2006-11-28 06:37:46.000000000 -0600
@@ -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.29 $
-| $Date: 2006/02/17 16:20:42 $
-| $Author: lisa_ $
+| $Revision: 1.39 $
+| $Date: 2006/11/28 12:37:46 $
+| $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -33,16 +33,21 @@
 	function e_shortcode()
 	{
 		global $pref, $register_sc;
-		if($pref['plug_sc'] != '')
+
+		if($pref['shortcode_list'] != '')
 		{
-			$tmp = explode(',',$pref['plug_sc']);
-			foreach($tmp as $val)
+        	foreach($pref['shortcode_list'] as $path=>$namearray)
 			{
-				list($code, $path) = explode(':',$val);
-				$this->registered_codes[$code]['type'] = 'plugin';
-				$this->registered_codes[$code]['path'] = $path;
+				foreach($namearray as $code=>$uclass)
+				{
+					$code = strtoupper($code);
+					$this->registered_codes[$code]['type'] = 'plugin';
+                	$this->registered_codes[$code]['path'] = $path;
+                  //  $this->registered_codes[$code]['perms'] = $uclass;
+				}
 			}
 		}
+
 		if(isset($register_sc) && is_array($register_sc))
 		{
 			foreach($register_sc as $code)
@@ -63,7 +68,7 @@
 		$tmp = explode("\n", $text);
 		foreach($tmp as $line) {
 			if (preg_match("/{.+?}/", $line, $match)) {
-				$ret .= preg_replace_callback("/\{(.*?)\}/", array($this, 'doCode'), $line);
+				$ret .= preg_replace_callback("#\{(\S[^\x02]*?\S)\}#", array($this, 'doCode'), $line);
 			} else {
 				$ret .= $line;
 			}
@@ -74,6 +79,12 @@
 	function doCode($matches)
 	{
 		global $pref, $e107cache, $menu_pref, $sc_style, $parm;
+
+		if(strpos($matches[1], E_NL) !== false)
+		{
+			return $matches[0];
+		}
+		
 		if (strpos($matches[1], '='))
 		{
 			list($code, $parm) = explode("=", $matches[1], 2);
@@ -121,18 +132,17 @@
 			}
 		}
 
-        if(E107_DEBUG_LEVEL == 5){
+        if(E107_DBG_SC){
 			echo " sc= ".str_replace(e_FILE."shortcode/","",$scFile)."<br />";
 		}
 
-		global $e107_debug;
-		if($e107_debug)
+		if(E107_DBG_BBSC)
 		{
 			trigger_error("starting shortcode {".$code."}", E_USER_ERROR);
 		}
 		$ret = (isset($shortcode) ? eval($shortcode) : "");
 
-		if($ret != '')
+		if($ret != '' || is_numeric($ret))
 		{
 			if(isset($sc_style) && is_array($sc_style) && array_key_exists($code,$sc_style))
 			{
@@ -189,4 +199,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/sitelinks_class.php 0.7.7/e107_handlers/sitelinks_class.php
--- 0.7.5/e107_handlers/sitelinks_class.php	2006-04-22 23:54:09.000000000 -0500
+++ 0.7.7/e107_handlers/sitelinks_class.php	2006-11-23 21:17:48.000000000 -0600
@@ -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.87 $
-|     $Date: 2006/04/23 04:54:09 $
+|     $Revision: 1.107 $
+|     $Date: 2006/11/24 03:17:48 $
 |     $Author: e107coders $
 +---------------------------------------------------------------+
 */
@@ -55,9 +55,10 @@
 
 	function get($cat=1, $style='', $css_class = false)
 	{
-		global $pref, $ns, $e107cache;
+		global $pref, $ns, $e107cache, $linkstyle;
+		$usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
 
-		if (($data = $e107cache->retrieve('sitelinks_'.md5($cat.e_PAGE.e_QUERY))) && !strpos(e_SELF,e_ADMIN) ) {
+		if ($usecache && !strpos(e_SELF, e_ADMIN) & ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY)))) {
 			return $data;
 		}
 
@@ -96,11 +97,11 @@
     // 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){
-			  	$substyle[$key] = ($style["sub".$key]) ? $style["sub".$key] : $style[$key];
+			  	$aSubStyle[$key] = ($style["sub".$key]) ? $style["sub".$key] : $style[$key];
 			}
         }else{
 				$style['subindent'] = "&nbsp;&nbsp;";
-				$substyle = $style;
+				$aSubStyle = $style;
 		}
 
 		$text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
@@ -109,19 +110,19 @@
 			foreach ($this->eLinkList['head_menu'] as $key => $link){
 				$main_linkid = "sub_".$link['link_id'];
 
-				$link['link_expand'] = (isset($pref['sitelinks_expandsub']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ?  TRUE : FALSE;
+				$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"))	/* if this is defined in theme.php only main links will be rendered */
+				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) ? "visible" : "none";   // expanding sub-menus.
-						$render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle'>\n";
+						$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, $style, $css_class);
+							$render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
 						}
 						$render_link[$key] .= "\n</div>\n\n";
 					}
@@ -130,7 +131,7 @@
 			$text .= implode($style['linkseparator'], $render_link);
 			$text .= $style['postlink'];
 			if ($style['linkdisplay'] == 2)	{
-				$text = $ns->tablerender(LAN_183, $text, 'sitelinks', TRUE);
+				$text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks', TRUE);
 			}
 		}
 		else
@@ -143,7 +144,7 @@
 				}
 				$text .= $style['postlink'];
 			}
-			$text = $ns->tablerender(LAN_183, $text, 'sitelinks_main', TRUE);
+			$text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks_main', TRUE);
 			foreach(array_keys($this->eLinkList) as $k)
 			{
 				$mnu = $style['prelink'];
@@ -159,7 +160,10 @@
 			}
 		}
 		$text .= "\n\n\n<!--- end Site Links -->\n\n\n";
-		$e107cache->set('sitelinks_'.$cat.md5(e_PAGE.e_QUERY), $text);
+		if($usecache)
+		{
+			$e107cache->set('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY), $text);
+		}
 	 	return $text;
 	}
 
@@ -179,6 +183,11 @@
 			$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']."'" : "";
@@ -186,7 +195,7 @@
 
 		// Check for screentip regardless of URL.
 		if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description']){
-			$screentip = " title = '".$tp->toHTML($linkInfo['link_description'],"","emotes_off defs no_hook")."'";
+			$screentip = " title = \"".$tp->toHTML($linkInfo['link_description'],"","value emotes_off defs no_hook")."\"";
 		}
 
 		// Check if its expandable first. It should override its URL.
@@ -199,17 +208,19 @@
 
 			// Only check if its highlighted if it has an URL
 			if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE) {
-				$linkstart = $style['linkstart_hilite'];
+				$linkstart = (isset($style['linkstart_hilite'])) ? $style['linkstart_hilite'] : "";
+				$highlighted = TRUE;
 			}
 			if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE) {
-				$linkadd = " class='".$style['linkclass_hilite']."'";
+				$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('".$tp -> replaceConstants($linkInfo['link_url'])."',{$dimen})\"";
+				$href = " href=\"javascript:open_window('".$linkInfo['link_url']."',{$dimen})\"";
 			} else {
-				$href = " href='".$tp -> replaceConstants($linkInfo['link_url'])."'";
+				$href = " href='".$linkInfo['link_url']."'";
 			}
 
 			// Open link in a new window.  (equivalent of target='_blank' )
@@ -222,10 +233,15 @@
 			$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']."' " : "";
+        $accessdigit = (isset($style['accessdigit'],$style['accesskey']) && $style['accessdigit']==TRUE && $style['accesskey']==TRUE) ? $linkInfo['link_order'].". " : "";
+
 		// If its a link.. make a link
 		$_link = "";
-		if (!empty($href)){
-			$_link .= "<a".$linkadd.$screentip.$href.$link_append.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off defs no_hook")."</a>";
+		$_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>";
@@ -234,9 +250,9 @@
 			$_link .= $tp->toHTML($linkInfo['link_name'],"","emotes_off defs no_hook");
 		}
 
-		$_link = $linkstart.$indent.$_link."\n";
+		$_link = $linkstart.$indent.$_link;
 
-		return $_link.$style['linkend'];
+		return $_link.$style['linkend']."\n";
 	}
 
 
@@ -247,7 +263,21 @@
 	global $PLUGINS_DIRECTORY,$tp,$pref;
     if(!$enabled){ return FALSE; }
 
-	$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]);
+
+    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 />";
+
+	}
 
 // ----------- highlight overriding - set the link matching in the page itself.
 
@@ -260,37 +290,40 @@
 
 // --------------- highlighting for 'HOME'. ----------------
 	global $pref;
-	list($fp,$fp_q) = explode("?",$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(str_replace("?","",$link)){  // plugin links with queries
-                $subq = explode("?",$link);
 
+			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;
+				  	return FALSE;
 				}
-			}else{  // plugin links without queries
+			}
+			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?list.1 or news.php?cat.2 etc
-
-		if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")) {
+// 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(".",$tmp[1]); // link queries.
+			$lnk = explode(".",$link_qry); // link queries.
 			$qry = explode(".",e_QUERY); // current page queries.
 
 			if($qry[0] == "item"){
@@ -302,22 +335,32 @@
 			}
 
 		}
+		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")) {
-			$tmp = explode("?",$link);
-			if(e_QUERY == $tmp[1]){
+            list($custom,$page) = explode(".",$link_qry);
+			list($q_custom,$q_page) = explode(".",e_QUERY);
+			if($custom == $q_custom){
             	return TRUE;
+			}else{
+              	return FALSE;
 			}
 		}
 
 // --------------- highlight default ----------------
 		if(strpos($link, "?") !== FALSE){
-			$subq = explode("?",$link);
-			$linkq = $subq[1];
+
 			$thelink = str_replace("../", "", $link);
-			if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$linkq) !== false)){
+			if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$link_qry) !== false)){
 		   		return true;
 			}
 		}
@@ -325,7 +368,15 @@
 		  	return true;
 		}
 
-		return false;
+   		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;
 	}
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/theme_handler.php 0.7.7/e107_handlers/theme_handler.php
--- 0.7.5/e107_handlers/theme_handler.php	2006-04-29 01:29:37.000000000 -0500
+++ 0.7.7/e107_handlers/theme_handler.php	2006-06-25 13:11:41.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.30 $
-|     $Date: 2006/04/29 06:29:37 $
-|     $Author: sweetas $
+|     $Revision: 1.31 $
+|     $Date: 2006/06/25 18:11:41 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -106,7 +106,7 @@
 								{
 									$STYLESHEET = TRUE;
 								}
-								
+
 							}
 						}
 						$fp=fopen(e_THEME.$file."/theme.php", "r");
@@ -305,12 +305,14 @@
 		<br />
 		</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 .= $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>" : "";
 		$itext .= !$mode ? "<tr><td style='vertical-align:top'><b>".TPVLAN_8."</b>:</td><td style='vertical-align:top'>".$previewbutton.$selectmainbutton.$selectadminbutton."</td></tr>" : "";
+
+
 		if ($itext) {
 			$text .= "<table cellspacing='3' style='width:97%'>".$itext."</table>";
 		}
@@ -343,11 +345,12 @@
 			}
 			else
 			{
-				$text .= "<br /><br /><b>".TPVLAN_22.": </b><br />";
+				$text .= "<br /><table style='width:97%' cellspacing='3'><tr><td colspan='2'><b>".TPVLAN_22.": </b></td></tr>";
 				foreach($theme['css'] as $css)
 				{
-					$text .= "<b>".$css['name'].":</b> ".($css['info'] ? $css['info'] : ($css['name'] == "style.css" ? TPVLAN_23 : TPVLAN_24))."<br />";
+					$text .= "<tr><td style='width:24%;vertical-align:top'><b>".$css['name'].":</b></td><td> ".($css['info'] ? $css['info'] : ($css['name'] == "style.css" ? TPVLAN_23 : TPVLAN_24))."</td></tr>\n";
 				}
+				$text .= "</table><br />\n";
 			}
 		}
 
@@ -376,7 +379,7 @@
 
 			$adminstyles = $file -> get_files(e_ADMIN."includes");
 
-			$astext = "<select name='adminstyle' class='tbox'>\n";
+			$astext = "<select id='mode2' name='adminstyle' class='tbox'>\n";
 
 			foreach($adminstyles as $as)
 			{
@@ -387,23 +390,18 @@
 
 			$text .= "<br /><br /><table cellspacing='3' style='width:97%'>
 			<tr><td style='vertical-align:top; width:50%;'><b>".TPVLAN_41.":</b></td><td style='vertical-align:top width:50%;'>$astext</td></tr>
-			<td colspan='2' class='center'>
+			<tr><td colspan='2' class='center'>
 			<input class='button' type='submit' name='submit_adminstyle' value='".TPVLAN_42."' /> ".$selectmainbutton."
-			</td>
-			</table>\n";
-		}
-
-
-		if($theme['xhtmlcompliant'])
-		{
-			$text .= "<img src='".e_IMAGE."generic/valid-xhtml11_small.png' alt='' style='border: 0;' /> ";
-		}
-
-		if($theme['csscompliant'])
-		{
-			$text .= "<img src='".e_IMAGE."generic/vcss_small.png' alt='' style='border: 0;' /> ";
+			</td></tr></table>\n";
 		}
 
+			if($theme['xhtmlcompliant'] || $theme['xhtmlcompliant'])
+			{
+				$text .= "<table cellspacing='3' style='width:97%'><tr><td >";
+				$text .= ($theme['xhtmlcompliant']) ? "<img src='".e_IMAGE."generic/valid-xhtml11_small.png' alt='' style='border: 0px;' /> ": "";
+            	$text .= ($theme['csscompliant']) ? "<img src='".e_IMAGE."generic/vcss_small.png' alt='' style='border: 0px;' /> " : "";
+				$text .= "</td></tr></table>";
+			}
 
 		$text .= "</td></tr></table></div>\n";
 		return $text;
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js	2006-10-27 17:36:57.000000000 -0500
@@ -1 +1 @@
-if(!tinyMCE.settings['contextmenu_skip_plugin_css']){tinyMCE.loadCSS(tinyMCE.baseURL+"/plugins/contextmenu/css/contextmenu.css");}var TinyMCE_ContextMenuPlugin={_contextMenu:null,getInfo:function(){return{longname:'Context menus',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_contextmenu.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(tinyMCE.isMSIE5_0&&tinyMCE.isOpera)return;TinyMCE_ContextMenuPlugin._contextMenu=new TinyMCE_ContextMenu({commandhandler:"TinyMCE_ContextMenuPlugin._commandHandler",spacer_image:tinyMCE.baseURL+"/plugins/contextmenu/images/spacer.gif"});tinyMCE.addEvent(inst.getDoc(),"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);if(tinyMCE.isGecko){tinyMCE.addEvent(inst.getDoc(),"contextmenu",function(e){TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?inst.contentWindow.event:e,inst);});}else tinyMCE.addEvent(inst.getDoc(),"contextmenu",TinyMCE_ContextMenuPlugin._onContextMenu);},_onContextMenu:function(e){var elm=tinyMCE.isMSIE?e.srcElement:e.target;var targetInst,body;if((body=tinyMCE.getParentElement(elm,"body"))!=null){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(body==inst.getBody()){targetInst=inst;break;}}return TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?targetInst.contentWindow.event:e,targetInst);}},_showContextMenu:function(e,inst){function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";}var x,y,elm,contextMenu;var pos=tinyMCE.getAbsPosition(inst.iframeElement);x=tinyMCE.isMSIE?e.screenX:pos.absLeft+(e.pageX-inst.getBody().scrollLeft);y=tinyMCE.isMSIE?e.screenY:pos.absTop+(e.pageY-inst.getBody().scrollTop);elm=tinyMCE.isMSIE?e.srcElement:e.target;contextMenu=this._contextMenu;contextMenu.inst=inst;window.setTimeout(function(){var theme=tinyMCE.getParam("theme");contextMenu.clearAll();var sel=inst.selection.getSelectedText().length!=0||elm.nodeName=="IMG";contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_cut_desc","Cut","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_copy_desc","Copy","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_paste_desc","Paste","",false);if(sel||(elm?(elm.nodeName=='A')||(elm.nodeName=='IMG'):false)){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/link.gif","$lang_link_desc",inst.hasPlugin("advlink")?"mceAdvLink":"mceLink");contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/unlink.gif","$lang_unlink_desc","unlink","",(elm?(elm.nodeName!='A')&&(elm.nodeName!='IMG'):true));}elm=tinyMCE.getParentElement(elm,"img,table,td"+(inst.hasPlugin("advhr")?',hr':''));if(elm){switch(elm.nodeName){case"IMG":contextMenu.addSeparator();if(tinyMCE.getAttrib(elm,'class').indexOf('mceItemFlash')!=-1)contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_flash_props","mceFlash");else contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/image.gif","$lang_image_props_desc",inst.hasPlugin("advimage")?"mceAdvImage":"mceImage");break;case"HR":contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/advhr/images/advhr.gif","$lang_insert_advhr_desc","mceAdvancedHr");break;case"TABLE":case"TD":if(inst.hasPlugin("table")){var colspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"colspan");var rowspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_table_cut_row_desc","mceTableCutRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_table_copy_row_desc","mceTableCopyRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_before_desc","mceTablePasteRowBefore","",inst.tableRowClipboard==null);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_after_desc","mceTablePasteRowAfter","",inst.tableRowClipboard==null);contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_props_desc","mceInsertTable");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_cell_props.gif","$lang_table_cell_desc","mceTableCellProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete.gif","$lang_table_del","mceTableDelete");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_row_props.gif","$lang_table_row_desc","mceTableRowProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_before.gif","$lang_table_row_before_desc","mceTableInsertRowBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_after.gif","$lang_table_row_after_desc","mceTableInsertRowAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_row.gif","$lang_table_delete_row_desc","mceTableDeleteRow");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_before.gif","$lang_table_col_before_desc","mceTableInsertColBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_after.gif","$lang_table_col_after_desc","mceTableInsertColAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_col.gif","$lang_table_delete_col_desc","mceTableDeleteCol");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_split_cells.gif","$lang_table_split_cells_desc","mceTableSplitCells","",(colspan=="1"&&rowspan=="1"));contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_merge_cells.gif","$lang_table_merge_cells_desc","mceTableMergeCells","",false);}break;}}else{if(inst.hasPlugin("table")){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert");}}contextMenu.show(x,y);},10);tinyMCE.cancelEvent(e);return false;},_hideContextMenu:function(){if(TinyMCE_ContextMenuPlugin._contextMenu)TinyMCE_ContextMenuPlugin._contextMenu.hide();},_commandHandler:function(command,value){var cm=TinyMCE_ContextMenuPlugin._contextMenu;cm.hide();var ui=false;if(command=="mceInsertTable"||command=="mceTableCellProps"||command=="mceTableRowProps"||command=="mceTableMergeCells")ui=true;if(command=="Paste")value=null;if(tinyMCE.getParam("dialog_type")=="modal"&&tinyMCE.isMSIE){window.setTimeout(function(){cm.inst.execCommand(command,ui,value);},100);}else cm.inst.execCommand(command,ui,value);}};tinyMCE.addPlugin("contextmenu",TinyMCE_ContextMenuPlugin);function TinyMCE_ContextMenu(settings){function defParam(key,def_val){settings[key]=typeof(settings[key])!="undefined"?settings[key]:def_val;}var self=this;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.contextMenuDiv=document.createElement("div");this.contextMenuDiv.className="contextMenu";this.contextMenuDiv.setAttribute("class","contextMenu");this.contextMenuDiv.style.display="none";this.contextMenuDiv.style.position='absolute';this.contextMenuDiv.style.zindex=1000;this.contextMenuDiv.style.left='0';this.contextMenuDiv.style.top='0';this.contextMenuDiv.unselectable="on";document.body.appendChild(this.contextMenuDiv);defParam("commandhandler","");defParam("spacer_image","images/spacer.gif");this.items=new Array();this.settings=settings;this.html="";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop=window.createPopup();doc=this.pop.document;doc.open();doc.write('<html><head><link href="'+tinyMCE.baseURL+'/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');doc.close();}};TinyMCE_ContextMenu.prototype={clearAll:function(){this.html="";this.contextMenuDiv.innerHTML="";},addSeparator:function(){this.html+='<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="'+this.settings['spacer_image']+'" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="'+this.settings['spacer_image']+'" /></td></tr>';},addItem:function(icon,title,command,value,disabled){if(title.charAt(0)=='$')title=tinyMCE.getLang(title.substring(1));var onMouseDown='';var html='';if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0)onMouseDown='contextMenu.execCommand(\''+command+'\', \''+value+'\');return false;';else onMouseDown=this.settings['commandhandler']+'(\''+command+'\', \''+value+'\');return false;';if(icon=="")icon=this.settings['spacer_image'];if(!disabled)html+='<tr class="contextMenuItem">';else html+='<tr class="contextMenuItemDisabled">';html+='<td class="contextMenuIcon"><img src="'+icon+'" width="20" height="20" class="contextMenuImage" /></td>';html+='<td><div class="contextMenuText">';html+='<a href="javascript:void(0);" onclick="'+onMouseDown+'" onmousedown="return false;">&#160;';html+=title;html+='&#160;</a>';html+='</div></td>';html+='</tr>';this.html+=html;},show:function(x,y){var vp,width,height;if(this.html=="")return;var html='';html+='<a href="#"></a><table border="0" cellpadding="0" cellspacing="0">';html+=this.html;html+='</table>';this.contextMenuDiv.innerHTML=html;this.contextMenuDiv.style.display="block";width=this.contextMenuDiv.offsetWidth;height=this.contextMenuDiv.offsetHeight;this.contextMenuDiv.style.display="none";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop.document.body.innerHTML='<div class="contextMenu">'+html+"</div>";this.pop.document.tinyMCE=tinyMCE;this.pop.document.contextMenu=this;this.pop.show(x,y,width,height);}else{vp=this.getViewPort();this.contextMenuDiv.style.left=(x>vp.width-width?vp.width-width:x)+'px';this.contextMenuDiv.style.top=(y>vp.height-height?vp.height-height:y)+'px';this.contextMenuDiv.style.display="block";}},getViewPort:function(){return{width:document.documentElement.offsetWidth||document.body.offsetWidth,height:self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight};},hide:function(){if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera)this.pop.hide();else this.contextMenuDiv.style.display="none";},execCommand:function(command,value){eval(this.settings['commandhandler']+"(command, value);");}};
\ No newline at end of file
+if(!tinyMCE.settings['contextmenu_skip_plugin_css']){tinyMCE.loadCSS(tinyMCE.baseURL+"/plugins/contextmenu/css/contextmenu.css")}var TinyMCE_ContextMenuPlugin={_contextMenu:null,getInfo:function(){return{longname:'Context menus',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_contextmenu.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(tinyMCE.isMSIE5_0&&tinyMCE.isOpera)return;TinyMCE_ContextMenuPlugin._contextMenu=new TinyMCE_ContextMenu({commandhandler:"TinyMCE_ContextMenuPlugin._commandHandler",spacer_image:tinyMCE.baseURL+"/plugins/contextmenu/images/spacer.gif"});tinyMCE.addEvent(inst.getDoc(),"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);if(tinyMCE.isGecko){tinyMCE.addEvent(inst.getDoc(),"contextmenu",function(e){TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?inst.contentWindow.event:e,inst)})}else tinyMCE.addEvent(inst.getDoc(),"contextmenu",TinyMCE_ContextMenuPlugin._onContextMenu)},_onContextMenu:function(e){var elm=tinyMCE.isMSIE?e.srcElement:e.target;var targetInst,body;if((body=tinyMCE.getParentElement(elm,"body"))!=null){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(body==inst.getBody()){targetInst=inst;break}}return TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?targetInst.contentWindow.event:e,targetInst)}},_showContextMenu:function(e,inst){function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""}var x,y,elm,contextMenu;var pos=tinyMCE.getAbsPosition(inst.iframeElement);x=tinyMCE.isMSIE?e.screenX:pos.absLeft+(e.pageX-inst.getBody().scrollLeft);y=tinyMCE.isMSIE?e.screenY:pos.absTop+(e.pageY-inst.getBody().scrollTop);elm=tinyMCE.isMSIE?e.srcElement:e.target;contextMenu=this._contextMenu;contextMenu.inst=inst;window.setTimeout(function(){var theme=tinyMCE.getParam("theme");contextMenu.clearAll();var sel=inst.selection.getSelectedText().length!=0||elm.nodeName=="IMG";contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_cut_desc","Cut","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_copy_desc","Copy","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_paste_desc","Paste","",false);if(sel||(elm?(elm.nodeName=='A')||(elm.nodeName=='IMG'):false)){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/link.gif","$lang_link_desc",inst.hasPlugin("advlink")?"mceAdvLink":"mceLink");contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/unlink.gif","$lang_unlink_desc","unlink","",(elm?(elm.nodeName!='A')&&(elm.nodeName!='IMG'):true))}elm=tinyMCE.getParentElement(elm,"img,table,td"+(inst.hasPlugin("advhr")?',hr':''));if(elm){switch(elm.nodeName){case"IMG":contextMenu.addSeparator();if(tinyMCE.hasPlugin('flash')&&tinyMCE.getAttrib(elm,'class').indexOf('mceItemFlash')!=-1)contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_flash_props","mceFlash");else if(tinyMCE.hasPlugin('media')&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm,'class')))contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_media_title","mceMedia");else contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/image.gif","$lang_image_props_desc",inst.hasPlugin("advimage")?"mceAdvImage":"mceImage");break;case"HR":contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/advhr/images/advhr.gif","$lang_insert_advhr_desc","mceAdvancedHr");break;case"TABLE":case"TD":if(inst.hasPlugin("table")){var colspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"colspan");var rowspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_table_cut_row_desc","mceTableCutRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_table_copy_row_desc","mceTableCopyRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_before_desc","mceTablePasteRowBefore","",inst.tableRowClipboard==null);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_after_desc","mceTablePasteRowAfter","",inst.tableRowClipboard==null);contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_props_desc","mceInsertTable");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_cell_props.gif","$lang_table_cell_desc","mceTableCellProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete.gif","$lang_table_del","mceTableDelete");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_row_props.gif","$lang_table_row_desc","mceTableRowProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_before.gif","$lang_table_row_before_desc","mceTableInsertRowBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_after.gif","$lang_table_row_after_desc","mceTableInsertRowAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_row.gif","$lang_table_delete_row_desc","mceTableDeleteRow");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_before.gif","$lang_table_col_before_desc","mceTableInsertColBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_after.gif","$lang_table_col_after_desc","mceTableInsertColAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_col.gif","$lang_table_delete_col_desc","mceTableDeleteCol");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_split_cells.gif","$lang_table_split_cells_desc","mceTableSplitCells","",(colspan=="1"&&rowspan=="1"));contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_merge_cells.gif","$lang_table_merge_cells_desc","mceTableMergeCells","",false)}break}}else{if(inst.hasPlugin("table")){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert")}}contextMenu.show(x,y)},10);tinyMCE.cancelEvent(e);return false},_hideContextMenu:function(){if(TinyMCE_ContextMenuPlugin._contextMenu)TinyMCE_ContextMenuPlugin._contextMenu.hide()},_commandHandler:function(command,value){var cm=TinyMCE_ContextMenuPlugin._contextMenu;cm.hide();var ui=false;if(command=="mceInsertTable"||command=="mceTableCellProps"||command=="mceTableRowProps"||command=="mceTableMergeCells")ui=true;if(command=="Paste")value=null;if(tinyMCE.getParam("dialog_type")=="modal"&&tinyMCE.isMSIE){window.setTimeout(function(){cm.inst.execCommand(command,ui,value)},100)}else cm.inst.execCommand(command,ui,value)}};tinyMCE.addPlugin("contextmenu",TinyMCE_ContextMenuPlugin);function TinyMCE_ContextMenu(settings){var doc,self=this;function defParam(key,def_val){settings[key]=typeof(settings[key])!="undefined"?settings[key]:def_val}this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.contextMenuDiv=document.createElement("div");this.contextMenuDiv.className="contextMenu";this.contextMenuDiv.setAttribute("class","contextMenu");this.contextMenuDiv.style.display="none";this.contextMenuDiv.style.position='absolute';this.contextMenuDiv.style.zindex=1000;this.contextMenuDiv.style.left='0';this.contextMenuDiv.style.top='0';this.contextMenuDiv.unselectable="on";document.body.appendChild(this.contextMenuDiv);defParam("commandhandler","");defParam("spacer_image","images/spacer.gif");this.items=new Array();this.settings=settings;this.html="";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop=window.createPopup();doc=this.pop.document;doc.open();doc.write('<html><head><link href="'+tinyMCE.baseURL+'/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');doc.close()}};TinyMCE_ContextMenu.prototype={clearAll:function(){this.html="";this.contextMenuDiv.innerHTML=""},addSeparator:function(){this.html+='<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="'+this.settings['spacer_image']+'" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="'+this.settings['spacer_image']+'" /></td></tr>'},addItem:function(icon,title,command,value,disabled){if(title.charAt(0)=='$')title=tinyMCE.getLang(title.substring(1));var onMouseDown='';var html='';if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0)onMouseDown='contextMenu.execCommand(\''+command+'\', \''+value+'\');return false;';else onMouseDown=this.settings['commandhandler']+'(\''+command+'\', \''+value+'\');return false;';if(icon=="")icon=this.settings['spacer_image'];if(!disabled)html+='<tr class="contextMenuItem">';else html+='<tr class="contextMenuItemDisabled">';html+='<td class="contextMenuIcon"><img src="'+icon+'" width="20" height="20" class="contextMenuImage" /></td>';html+='<td><div class="contextMenuText">';html+='<a href="javascript:void(0);" onclick="'+onMouseDown+'" onmousedown="return false;">&#160;';html+=title;html+='&#160;</a>';html+='</div></td>';html+='</tr>';this.html+=html},show:function(x,y){var vp,width,height,yo;if(this.html=="")return;var html='';html+='<a href="#"></a><table border="0" cellpadding="0" cellspacing="0">';html+=this.html;html+='</table>';this.contextMenuDiv.innerHTML=html;this.contextMenuDiv.style.display="block";width=this.contextMenuDiv.offsetWidth;height=this.contextMenuDiv.offsetHeight;this.contextMenuDiv.style.display="none";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop.document.body.innerHTML='<div class="contextMenu">'+html+"</div>";this.pop.document.tinyMCE=tinyMCE;this.pop.document.contextMenu=this;this.pop.show(x,y,width,height)}else{vp=this.getViewPort();yo=tinyMCE.isMSIE5_0?document.body.scrollTop:self.pageYOffset;this.contextMenuDiv.style.left=(x>vp.left+vp.width-width?vp.left+vp.width-width:x)+'px';this.contextMenuDiv.style.top=(y>vp.top+vp.height-height?vp.top+vp.height-height:y)+'px';this.contextMenuDiv.style.display="block"}},getViewPort:function(){return{left:self.pageXOffset||self.document.documentElement.scrollLeft||self.document.body.scrollLeft,top:self.pageYOffset||self.document.documentElement.scrollTop||self.document.body.scrollTop,width:document.documentElement.offsetWidth||document.body.offsetWidth,height:self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}},hide:function(){if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera)this.pop.hide();else this.contextMenuDiv.style.display="none"},execCommand:function(command,value){eval(this.settings['commandhandler']+"(command, value);")}};
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js 0.7.7/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,14 +1,11 @@
 /**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.8 $
- * $Date: 2006/05/06 03:05:15 $
+ * $Id: editor_plugin_src.js,v 1.9 2006/10/27 22:36:57 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
  */
 
 /* Import plugin specific language pack */
-//tinyMCE.importPluginLanguagePack('contextmenu', 'en,tr,zh_cn,cs,fa,fr_ca,fr,de,nb');
 if (!tinyMCE.settings['contextmenu_skip_plugin_css']) {
 	tinyMCE.loadCSS(tinyMCE.baseURL + "/plugins/contextmenu/css/contextmenu.css");
 }
@@ -20,7 +17,7 @@
 	getInfo : function() {
 		return {
 			longname : 'Context menus',
-			author : 'Moxiecode Systems',
+			author : 'Moxiecode Systems AB',
 			authorurl : 'http://tinymce.moxiecode.com',
 			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_contextmenu.html',
 			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
@@ -116,8 +113,10 @@
 						contextMenu.addSeparator();
 
 						// If flash
-						if (tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1)
+						if (tinyMCE.hasPlugin('flash') && tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1)
 							contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_flash_props", "mceFlash");
+						else if (tinyMCE.hasPlugin('media') && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm, 'class')))
+							contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_media_title", "mceMedia");
 						else
 							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/image.gif", "$lang_image_props_desc", inst.hasPlugin("advimage") ? "mceAdvImage" : "mceImage");
 						break;
@@ -216,13 +215,13 @@
 // Context menu class
 
 function TinyMCE_ContextMenu(settings) {
+	var doc, self = this;
+
 	// Default value function
 	function defParam(key, def_val) {
 		settings[key] = typeof(settings[key]) != "undefined" ? settings[key] : def_val;
 	}
 
-	var self = this;
-
 	this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
 
 	// Setup contextmenu div
@@ -302,7 +301,7 @@
 	},
 
 	show : function(x, y) {
-		var vp, width, height;
+		var vp, width, height, yo;
 
 		if (this.html == "")
 			return;
@@ -329,15 +328,17 @@
 			this.pop.show(x, y, width, height);
 		} else {
 			vp = this.getViewPort();
-
-			this.contextMenuDiv.style.left = (x > vp.width - width ? vp.width - width : x) + 'px';
-			this.contextMenuDiv.style.top = (y > vp.height - height ? vp.height - height : y) + 'px';
+			yo = tinyMCE.isMSIE5_0 ? document.body.scrollTop : self.pageYOffset;
+			this.contextMenuDiv.style.left = (x > vp.left + vp.width - width ? vp.left + vp.width - width : x) + 'px';
+			this.contextMenuDiv.style.top = (y > vp.top + vp.height - height ? vp.top + vp.height - height : y) + 'px';
 			this.contextMenuDiv.style.display = "block";
 		}
 	},
 
 	getViewPort : function() {
 		return {
+			left : self.pageXOffset || self.document.documentElement.scrollLeft || self.document.body.scrollLeft,
+			top: self.pageYOffset || self.document.documentElement.scrollTop || self.document.body.scrollTop,
 			width : document.documentElement.offsetWidth || document.body.offsetWidth,
 			height : self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
 		};
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js 0.7.7/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js	2005-09-24 10:21:57.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js	2006-06-01 06:25:50.000000000 -0500
@@ -1,5 +1,5 @@
 // UK lang variables
 
-tinyMCELang['lang_insert_emotions_title'] = 'Insert emotion';
-tinyMCELang['lang_emotions_desc'] = 'Emotions';
+tinyMCELang['lang_insert_emoticons_title'] = 'Insert emotion';
+tinyMCELang['lang_emoticons_desc'] = 'Emotions';
 
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/css/content.css 0.7.7/e107_handlers/tiny_mce/plugins/flash/css/content.css
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/css/content.css	2005-09-24 10:21:57.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/css/content.css	1969-12-31 18:00:00.000000000 -0600
@@ -1,7 +0,0 @@
-.mceItemFlash {
-	border: 1px dotted #cc0000;
-	background-image: url('../images/flash.gif');
-	background-position: center;
-	background-repeat: no-repeat;
-	background-color: #ffffcc;
-}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/css/flash.css 0.7.7/e107_handlers/tiny_mce/plugins/flash/css/flash.css
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/css/flash.css	2005-12-23 18:09:57.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/css/flash.css	1969-12-31 18:00:00.000000000 -0600
@@ -1,11 +0,0 @@
-.panel_wrapper div.current {
-	height: 100px;
-}
-
-#width, #height {
-	width: 50px;
-}
-
-#file {
-	width: 250px;
-}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/flash/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/editor_plugin.js	2006-03-02 23:07:12.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/editor_plugin.js	1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-tinyMCE.importPluginLanguagePack('flash','en,tr,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,zh_tw,zh_tw_utf8,sk,pt_br');var TinyMCE_FlashPlugin={getInfo:function(){return{longname:'Flash',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_flash.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(!tinyMCE.settings['flash_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/flash/css/content.css");},getControlHTML:function(cn){switch(cn){case"flash":return tinyMCE.getButtonHTML(cn,'lang_flash_desc','{$pluginurl}/images/flash.gif','mceFlash');}return"";},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceFlash":var name="",swffile="",swfwidth="",swfheight="",action="insert";var template=new Array();var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();template['file']='../../plugins/flash/flash.htm';template['width']=430;template['height']=175;template['width']+=tinyMCE.getLang('lang_flash_delta_width',0);template['height']+=tinyMCE.getLang('lang_flash_delta_height',0);if(focusElm!=null&&focusElm.nodeName.toLowerCase()=="img"){name=tinyMCE.getAttrib(focusElm,'class');if(name.indexOf('mceItemFlash')==-1)return true;swffile=tinyMCE.getAttrib(focusElm,'alt');if(tinyMCE.getParam('convert_urls'))swffile=eval(tinyMCE.settings['urlconverter_callback']+"(swffile, null, true);");swfwidth=tinyMCE.getAttrib(focusElm,'width');swfheight=tinyMCE.getAttrib(focusElm,'height');action="update";}tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",swffile:swffile,swfwidth:swfwidth,swfheight:swfheight,action:action});return true;}return false;},cleanup:function(type,content){switch(type){case"insert_to_editor_dom":if(tinyMCE.getParam('convert_urls')){var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){if(tinyMCE.getAttrib(imgs[i],"class")=="mceItemFlash"){var src=tinyMCE.getAttrib(imgs[i],"alt");if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('alt',src);imgs[i].setAttribute('title',src);}}}break;case"get_from_editor_dom":var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){if(tinyMCE.getAttrib(imgs[i],"class")=="mceItemFlash"){var src=tinyMCE.getAttrib(imgs[i],"alt");if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('alt',src);imgs[i].setAttribute('title',src);}}break;case"insert_to_editor":var startPos=0;var embedList=new Array();content=content.replace(new RegExp('<[ ]*embed','gi'),'<embed');content=content.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');content=content.replace(new RegExp('<[ ]*object','gi'),'<object');content=content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');while((startPos=content.indexOf('<embed',startPos+1))!=-1){var endPos=content.indexOf('>',startPos);var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+6,endPos));embedList[embedList.length]=attribs;}var index=0;while((startPos=content.indexOf('<object',startPos))!=-1){if(index>=embedList.length)break;var attribs=embedList[index];endPos=content.indexOf('</object>',startPos);endPos+=9;var contentAfter=content.substring(endPos);content=content.substring(0,startPos);content+='<img width="'+attribs["width"]+'" height="'+attribs["height"]+'"';content+=' src="'+(tinyMCE.getParam("theme_href")+'/images/spacer.gif')+'" title="'+attribs["src"]+'"';content+=' alt="'+attribs["src"]+'" class="mceItemFlash" />'+content.substring(endPos);content+=contentAfter;index++;startPos++;}var index=0;while((startPos=content.indexOf('<embed',startPos))!=-1){if(index>=embedList.length)break;var attribs=embedList[index];endPos=content.indexOf('>',startPos);endPos+=9;var contentAfter=content.substring(endPos);content=content.substring(0,startPos);content+='<img width="'+attribs["width"]+'" height="'+attribs["height"]+'"';content+=' src="'+(tinyMCE.getParam("theme_href")+'/images/spacer.gif')+'" title="'+attribs["src"]+'"';content+=' alt="'+attribs["src"]+'" class="mceItemFlash" />'+content.substring(endPos);content+=contentAfter;index++;startPos++;}break;case"get_from_editor":var startPos=-1;while((startPos=content.indexOf('<img',startPos+1))!=-1){var endPos=content.indexOf('/>',startPos);var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+4,endPos));if(attribs['class']!="mceItemFlash")continue;endPos+=2;var embedHTML='';var wmode=tinyMCE.getParam("flash_wmode","");var quality=tinyMCE.getParam("flash_quality","high");var menu=tinyMCE.getParam("flash_menu","false");embedHTML+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';embedHTML+=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';embedHTML+=' width="'+attribs["width"]+'" height="'+attribs["height"]+'">';embedHTML+='<param name="movie" value="'+attribs["title"]+'" />';embedHTML+='<param name="quality" value="'+quality+'" />';embedHTML+='<param name="menu" value="'+menu+'" />';embedHTML+='<param name="wmode" value="'+wmode+'" />';embedHTML+='<embed src="'+attribs["title"]+'" wmode="'+wmode+'" quality="'+quality+'" menu="'+menu+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+attribs["width"]+'" height="'+attribs["height"]+'"></embed></object>';chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter;}break;}return content;},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&tinyMCE.getAttrib(node,'class').indexOf('mceItemFlash')==0){tinyMCE.switchClass(editor_id+'_flash','mceButtonSelected');return true;}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_flash','mceButtonNormal');return true;},_parseAttributes:function(attribute_string){var attributeName="";var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i<attribute_string.length;i++){var chr=attribute_string.charAt(i);if((chr=='"'||chr=="'")&&!withInValue)withInValue=true;else if((chr=='"'||chr=="'")&&withInValue){withInValue=false;var pos=attributeName.lastIndexOf(' ');if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);attributeName="";attributeValue="";}else if(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;if(chr=='='&&withInName)withInName=false;if(withInName)attributeName+=chr;if(withInValue)attributeValue+=chr;}return attributes;}};tinyMCE.addPlugin("flash",TinyMCE_FlashPlugin);
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/editor_plugin_src.js 0.7.7/e107_handlers/tiny_mce/plugins/flash/editor_plugin_src.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/editor_plugin_src.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/editor_plugin_src.js	1969-12-31 18:00:00.000000000 -0600
@@ -1,287 +0,0 @@
-/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.14 $
- * $Date: 2006/05/06 03:05:15 $
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
- */
-
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('flash', 'en,tr,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,zh_tw,zh_tw_utf8,sk,pt_br');
-
-var TinyMCE_FlashPlugin = {
-	getInfo : function() {
-		return {
-			longname : 'Flash',
-			author : 'Moxiecode Systems',
-			authorurl : 'http://tinymce.moxiecode.com',
-			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_flash.html',
-			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-		};
-	},
-
-	initInstance : function(inst) {
-		if (!tinyMCE.settings['flash_skip_plugin_css'])
-			tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/flash/css/content.css");
-	},
-
-	getControlHTML : function(cn) {
-		switch (cn) {
-			case "flash":
-				return tinyMCE.getButtonHTML(cn, 'lang_flash_desc', '{$pluginurl}/images/flash.gif', 'mceFlash');
-		}
-
-		return "";
-	},
-
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Handle commands
-		switch (command) {
-			case "mceFlash":
-				var name = "", swffile = "", swfwidth = "", swfheight = "", action = "insert";
-				var template = new Array();
-				var inst = tinyMCE.getInstanceById(editor_id);
-				var focusElm = inst.getFocusElement();
-
-				template['file']   = '../../plugins/flash/flash.htm'; // Relative to theme
-				template['width']  = 430;
-				template['height'] = 175;
-
-				template['width'] += tinyMCE.getLang('lang_flash_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_flash_delta_height', 0);
-
-				// Is selection a image
-				if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
-					name = tinyMCE.getAttrib(focusElm, 'class');
-
-					if (name.indexOf('mceItemFlash') == -1) // Not a Flash
-						return true;
-
-					// Get rest of Flash items
-					swffile = tinyMCE.getAttrib(focusElm, 'alt');
-
-					if (tinyMCE.getParam('convert_urls'))
-						swffile = eval(tinyMCE.settings['urlconverter_callback'] + "(swffile, null, true);");
-
-					swfwidth = tinyMCE.getAttrib(focusElm, 'width');
-					swfheight = tinyMCE.getAttrib(focusElm, 'height');
-					action = "update";
-				}
-
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", swffile : swffile, swfwidth : swfwidth, swfheight : swfheight, action : action});
-			return true;
-	   }
-
-	   // Pass to next handler in chain
-	   return false;
-	},
-
-	cleanup : function(type, content) {
-		switch (type) {
-			case "insert_to_editor_dom":
-				// Force relative/absolute
-				if (tinyMCE.getParam('convert_urls')) {
-					var imgs = content.getElementsByTagName("img");
-					for (var i=0; i<imgs.length; i++) {
-						if (tinyMCE.getAttrib(imgs[i], "class") == "mceItemFlash") {
-							var src = tinyMCE.getAttrib(imgs[i], "alt");
-
-							if (tinyMCE.getParam('convert_urls'))
-								src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
-
-							imgs[i].setAttribute('alt', src);
-							imgs[i].setAttribute('title', src);
-						}
-					}
-				}
-				break;
-
-			case "get_from_editor_dom":
-				var imgs = content.getElementsByTagName("img");
-				for (var i=0; i<imgs.length; i++) {
-					if (tinyMCE.getAttrib(imgs[i], "class") == "mceItemFlash") {
-						var src = tinyMCE.getAttrib(imgs[i], "alt");
-
-						if (tinyMCE.getParam('convert_urls'))
-							src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
-
-						imgs[i].setAttribute('alt', src);
-						imgs[i].setAttribute('title', src);
-					}
-				}
-				break;
-
-			case "insert_to_editor":
-				var startPos = 0;
-				var embedList = new Array();
-
-				// Fix the embed and object elements
-				content = content.replace(new RegExp('<[ ]*embed','gi'),'<embed');
-				content = content.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');
-				content = content.replace(new RegExp('<[ ]*object','gi'),'<object');
-				content = content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');
-
-				// Parse all embed tags
-				while ((startPos = content.indexOf('<embed', startPos+1)) != -1) {
-					var endPos = content.indexOf('>', startPos);
-					var attribs = TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos + 6, endPos));
-					embedList[embedList.length] = attribs;
-				}
-
-				// Parse all object tags and replace them with images from the embed data
-				var index = 0;
-				while ((startPos = content.indexOf('<object', startPos)) != -1) {
-					if (index >= embedList.length)
-						break;
-
-					var attribs = embedList[index];
-
-					// Find end of object
-					endPos = content.indexOf('</object>', startPos);
-					endPos += 9;
-
-					// Insert image
-					var contentAfter = content.substring(endPos);
-					content = content.substring(0, startPos);
-					content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
-					content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
-					content += ' alt="' + attribs["src"] + '" class="mceItemFlash" />' + content.substring(endPos);
-					content += contentAfter;
-					index++;
-
-					startPos++;
-				}
-
-				// Parse all embed tags and replace them with images from the embed data
-				var index = 0;
-				while ((startPos = content.indexOf('<embed', startPos)) != -1) {
-					if (index >= embedList.length)
-						break;
-
-					var attribs = embedList[index];
-
-					// Find end of embed
-					endPos = content.indexOf('>', startPos);
-					endPos += 9;
-
-					// Insert image
-					var contentAfter = content.substring(endPos);
-					content = content.substring(0, startPos);
-					content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
-					content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["src"] + '"';
-					content += ' alt="' + attribs["src"] + '" class="mceItemFlash" />' + content.substring(endPos);
-					content += contentAfter;
-					index++;
-
-					startPos++;
-				}
-
-				break;
-
-			case "get_from_editor":
-				// Parse all img tags and replace them with object+embed
-				var startPos = -1;
-
-				while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
-					var endPos = content.indexOf('/>', startPos);
-					var attribs = TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos + 4, endPos));
-
-					// Is not flash, skip it
-					if (attribs['class'] != "mceItemFlash")
-						continue;
-
-					endPos += 2;
-
-					var embedHTML = '';
-					var wmode = tinyMCE.getParam("flash_wmode", "");
-					var quality = tinyMCE.getParam("flash_quality", "high");
-					var menu = tinyMCE.getParam("flash_menu", "false");
-
-					// Insert object + embed
-					embedHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
-					embedHTML += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';
-					embedHTML += ' width="' + attribs["width"] + '" height="' + attribs["height"] + '">';
-					embedHTML += '<param name="movie" value="' + attribs["title"] + '" />';
-					embedHTML += '<param name="quality" value="' + quality + '" />';
-					embedHTML += '<param name="menu" value="' + menu + '" />';
-					embedHTML += '<param name="wmode" value="' + wmode + '" />';
-					embedHTML += '<embed src="' + attribs["title"] + '" wmode="' + wmode + '" quality="' + quality + '" menu="' + menu + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + attribs["width"] + '" height="' + attribs["height"] + '"></embed></object>';
-
-					// Insert embed/object chunk
-					chunkBefore = content.substring(0, startPos);
-					chunkAfter = content.substring(endPos);
-					content = chunkBefore + embedHTML + chunkAfter;
-				}
-				break;
-		}
-
-		// Pass through to next handler in chain
-		return content;
-	},
-
-	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-		if (node == null)
-			return;
-
-		do {
-			if (node.nodeName == "IMG" && tinyMCE.getAttrib(node, 'class').indexOf('mceItemFlash') == 0) {
-				tinyMCE.switchClass(editor_id + '_flash', 'mceButtonSelected');
-				return true;
-			}
-		} while ((node = node.parentNode));
-
-		tinyMCE.switchClass(editor_id + '_flash', 'mceButtonNormal');
-
-		return true;
-	},
-
-	// Private plugin internal functions
-
-	_parseAttributes : function(attribute_string) {
-		var attributeName = "";
-		var attributeValue = "";
-		var withInName;
-		var withInValue;
-		var attributes = new Array();
-		var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
-
-		if (attribute_string == null || attribute_string.length < 2)
-			return null;
-
-		withInName = withInValue = false;
-
-		for (var i=0; i<attribute_string.length; i++) {
-			var chr = attribute_string.charAt(i);
-
-			if ((chr == '"' || chr == "'") && !withInValue)
-				withInValue = true;
-			else if ((chr == '"' || chr == "'") && withInValue) {
-				withInValue = false;
-
-				var pos = attributeName.lastIndexOf(' ');
-				if (pos != -1)
-					attributeName = attributeName.substring(pos+1);
-
-				attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
-
-				attributeName = "";
-				attributeValue = "";
-			} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
-				withInName = true;
-
-			if (chr == '=' && withInName)
-				withInName = false;
-
-			if (withInName)
-				attributeName += chr;
-
-			if (withInValue)
-				attributeValue += chr;
-		}
-
-		return attributes;
-	}
-};
-
-tinyMCE.addPlugin("flash", TinyMCE_FlashPlugin);
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/flash.css 0.7.7/e107_handlers/tiny_mce/plugins/flash/flash.css
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/flash.css	2005-06-11 14:48:42.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/flash.css	1969-12-31 18:00:00.000000000 -0600
@@ -1,7 +0,0 @@
-.mce_plugin_flash {
-	border: 1px dotted #cc0000;
-	background-image: url(images/flash.gif);
-	background-position: center;
-	background-repeat: no-repeat;
-	background-color: #ffffcc;
-}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/flash.htm 0.7.7/e107_handlers/tiny_mce/plugins/flash/flash.htm
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/flash.htm	2005-12-23 18:09:57.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/flash.htm	1969-12-31 18:00:00.000000000 -0600
@@ -1,70 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-	<title>{$lang_flash_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/flash.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<link href="css/flash.css" rel="stylesheet" type="text/css" />
-	<base target="_self" />
-</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-    <form onsubmit="insertFlash();return false;" action="#">
-		<div class="tabs">
-			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_flash_general}</a></span></li>
-			</ul>
-		</div>
-
-		<div class="panel_wrapper">
-			<div id="general_panel" class="panel current">
-				<fieldset>
-					<legend>{$lang_flash_general}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-							<tr>
-							<td nowrap="nowrap"><label for="file">{$lang_flash_file}</label></td>
-							  <td nowrap="nowrap">
-									<table border="0" cellspacing="0" cellpadding="0">
-									  <tr>
-										<td><input id="file" name="file" type="text" value="" onfocus="this.select();" /></td>
-										<td id="filebrowsercontainer">&nbsp;</td>
-									  </tr>
-									</table>
-								</td>
-							</tr>
-							<tr id="linklistrow">
-								<td><label for="linklist">{$lang_flash_list}</label></td>
-								<td id="linklistcontainer">&nbsp;</td>
-							</tr>
-							<tr>
-								<td nowrap="nowrap"><label>{$lang_flash_size}</label></td>
-								<td nowrap="nowrap">
-									<input type="text" id="width" name="width" value="" onfocus="this.select();" />
-									<select name="width2" id="width2" style="width: 50px">
-										<option value="">px</option>
-										<option value="%">%</option>
-									</select>&nbsp;x&nbsp;<input id="height" name="height" type="text"  value="" onfocus="this.select();" />
-									<select name="height2" id="height2" style="width: 50px">
-										<option value="">px</option>
-										<option value="%">%</option>
-									</select>
-								</td>
-							</tr>
-					</table>
-				</fieldset>
-			</div>
-		</div>
-
-		<div class="mceActionPanel">
-			<div style="float: left">
-				<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertFlash();" />
-			</div>
-
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
-			</div>
-		</div>
-	</form>
-</body>
-</html>
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/flash/images/flash.gif and 0.7.7/e107_handlers/tiny_mce/plugins/flash/images/flash.gif differ
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/jscripts/flash.js 0.7.7/e107_handlers/tiny_mce/plugins/flash/jscripts/flash.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/jscripts/flash.js	2005-12-23 18:09:57.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/jscripts/flash.js	1969-12-31 18:00:00.000000000 -0600
@@ -1,107 +0,0 @@
-var url = tinyMCE.getParam("flash_external_list_url");
-if (url != null) {
-	// Fix relative
-	if (url.charAt(0) != '/' && url.indexOf('://') == -1)
-		url = tinyMCE.documentBasePath + "/" + url;
-
-	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
-}
-
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
-
-	document.getElementById("filebrowsercontainer").innerHTML = getBrowserHTML('filebrowser','file','flash','flash');
-
-	// Image list outsrc
-	var html = getFlashListHTML('filebrowser','file','flash','flash');
-	if (html == "")
-		document.getElementById("linklistrow").style.display = 'none';
-	else
-		document.getElementById("linklistcontainer").innerHTML = html;
-
-	var formObj = document.forms[0];
-	var swffile   = tinyMCE.getWindowArg('swffile');
-	var swfwidth  = '' + tinyMCE.getWindowArg('swfwidth');
-	var swfheight = '' + tinyMCE.getWindowArg('swfheight');
-
-	if (swfwidth.indexOf('%')!=-1) {
-		formObj.width2.value = "%";
-		formObj.width.value  = swfwidth.substring(0,swfwidth.length-1);
-	} else {
-		formObj.width2.value = "px";
-		formObj.width.value  = swfwidth;
-	}
-
-	if (swfheight.indexOf('%')!=-1) {
-		formObj.height2.value = "%";
-		formObj.height.value  = swfheight.substring(0,swfheight.length-1);
-	} else {
-		formObj.height2.value = "px";
-		formObj.height.value  = swfheight;
-	}
-
-	formObj.file.value = swffile;
-	formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
-
-	selectByValue(formObj, 'linklist', swffile);
-
-	// Handle file browser
-	if (isVisible('filebrowser'))
-		document.getElementById('file').style.width = '230px';
-
-	// Auto select flash in list
-	if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
-		for (var i=0; i<formObj.linklist.length; i++) {
-			if (formObj.linklist.options[i].value == tinyMCE.getWindowArg('swffile'))
-				formObj.linklist.options[i].selected = true;
-		}
-	}
-}
-
-function getFlashListHTML() {
-	if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
-		var html = "";
-
-		html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.file.value=this.options[this.selectedIndex].value;">';
-		html += '<option value="">---</option>';
-
-		for (var i=0; i<tinyMCEFlashList.length; i++)
-			html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
-
-		html += '</select>';
-
-		return html;
-	}
-
-	return "";
-}
-
-function insertFlash() {
-	var formObj = document.forms[0];
-	var html      = '';
-	var file      = formObj.file.value;
-	var width     = formObj.width.value;
-	var height    = formObj.height.value;
-	if (formObj.width2.value=='%') {
-		width = width + '%';
-	}
-	if (formObj.height2.value=='%') {
-		height = height + '%';
-	}
-
-	if (width == "")
-		width = 100;
-
-	if (height == "")
-		height = 100;
-
-	html += ''
-		+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
-		+ 'width="' + width + '" height="' + height + '" '
-		+ 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
-
-	tinyMCEPopup.execCommand("mceInsertContent", true, html);
-	tinyMCE.selectedInstance.repaint();
-
-	tinyMCEPopup.close();
-}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/flash/langs/en.js 0.7.7/e107_handlers/tiny_mce/plugins/flash/langs/en.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/flash/langs/en.js	2005-09-07 08:32:50.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/flash/langs/en.js	1969-12-31 18:00:00.000000000 -0600
@@ -1,11 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('flash',{
-title : 'Insert / edit Flash Movie',
-desc : 'Insert / edit Flash Movie',
-file : 'Flash-File (.swf)',
-size : 'Size',
-list : 'Flash files',
-props : 'Flash properties',
-general : 'General'
-});
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/ibrowser/config.php 0.7.7/e107_handlers/tiny_mce/plugins/ibrowser/config.php
--- 0.7.5/e107_handlers/tiny_mce/plugins/ibrowser/config.php	2005-09-05 15:25:38.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/ibrowser/config.php	2006-07-04 00:44:31.000000000 -0500
@@ -38,6 +38,10 @@
     'text'    => 'Newspost Images',
   ),
   array(
+    'value'   => $IMAGES_DIRECTORY."custom/",
+    'text'    => 'Custom Images',
+  ),
+  array(
     'value'   => $IMAGES_DIRECTORY."icons/",
     'text'    => 'Icons',
   ),
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js	2006-04-05 00:37:10.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,10 +1,10 @@
 // Import theme specific language pack
 // $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js,v $
-// $Revision: 1.3 $
-// $Date: 2006/04/05 05:37:10 $
+// $Revision: 1.4 $
+// $Date: 2006/10/27 22:36:57 $
 // $Author: e107coders $
 
-tinyMCE.importPluginLanguagePack('ibrowser', 'en,es,da,de,fr,nl,pl,sv');
+tinyMCE.importPluginLanguagePack('ibrowser', 'en,es,da,de,fr,nl,pl,sv,ru');
 
 // Returns the HTML contents of the ibrowser control.
 
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php 0.7.7/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php
--- 0.7.5/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2006-03-02 23:07:12.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2006-10-24 08:39:45.000000000 -0500
@@ -9,13 +9,13 @@
 // ------------------------------------------------
 //                                   www.j-cons.com
 // ================================================
-// $Revision: 1.4 $Date: 2004/10/04
+// $Revision: 1.8 $Date: 2004/10/04
 // ================================================
 //
 // $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php,v $
-// $Revision: 1.4 $
-// $Date: 2006/03/03 05:07:12 $
-// $Author: e107coders $
+// $Revision: 1.8 $
+// $Date: 2006/10/24 13:39:45 $
+// $Author: mrpete $
 // +----------------------------------------------------------------------------+
 // Major Re-work by CaMer0n
 
@@ -28,7 +28,7 @@
 // include image library config settings
 include 'config.php';
 
-$request_uri = urldecode(empty($HTTP_POST_VARS['request_uri'])?(empty($HTTP_GET_VARS['request_uri'])?'':$HTTP_GET_VARS['request_uri']):$HTTP_POST_VARS['request_uri']);
+$request_uri = urldecode(empty($_POST['request_uri'])?(empty($_GET['request_uri'])?'':$_GET['request_uri']):$_POST['request_uri']);
 
 // if set include file specified in $tinyMCE_imglib_include
 if (!empty($tinyMCE_imglib_include))
@@ -37,8 +37,8 @@
 }
 
 
-$imglib = isset($HTTP_POST_VARS['lib'])?$HTTP_POST_VARS['lib']:'';
-if (empty($imglib) && isset($HTTP_GET_VARS['lib'])) $imglib = $HTTP_GET_VARS['lib'];
+$imglib = isset($_POST['lib'])?$_POST['lib']:'';
+if (empty($imglib) && isset($_GET['lib'])) $imglib = $_GET['lib'];
 
 $value_found = false;
 // callback function for preventing listing of non-library directory
@@ -59,24 +59,12 @@
 $lib_options = liboptions($tinyMCE_imglibs,'',$imglib);
 
 
-$img = isset($HTTP_POST_VARS['imglist'])?$HTTP_POST_VARS['imglist']:'';
+$img = isset($_POST['imglist'])? $_POST['imglist']:'';
 
-$preview = '';
+$preview = e_IMAGE."generic/blank.gif";
 
 $errors = array();
-if (isset($HTTP_POST_FILES['img_file']['size']) && $HTTP_POST_FILES['img_file']['size']>0)
-{
-  if ($img = uploadImg('img_file'))
-  {
-    $preview = $tinyMCE_base_url.$imglib.$img;
-  }
-}
 
-// delete image
-if ($tinyMCE_img_delete_allowed && isset($HTTP_POST_VARS['lib_action'])
-	&& ($HTTP_POST_VARS['lib_action']=='delete') && !empty($img)) {
-  deleteImg();
-}
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
@@ -84,7 +72,7 @@
 <title>{$lang_ibrowser_title}</title>
 <script type="text/javaScript" src="../../tiny_mce_popup.js"></script>
 <meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET ?>" />
 <script type="text/javascript">
 	// click ok - select picture or save changes
 	function selectClick() {
@@ -274,9 +262,9 @@
 <script type="text/javascript">
     window.name = 'imglibrary';
 </script>
-<form name="libbrowser" method="post" action="ibrowser.php?request_uri=<?php echo $HTTP_GET_VARS['request_uri']?>" enctype="multipart/form-data" target="imglibrary">
-  <input type="hidden" name="request_uri" value="<?php echo urlencode($request_uri)?>">
-  <input type="hidden" name="lib_action" value="">
+<form name="libbrowser" method="post" action="ibrowser.php?request_uri=<?php echo $_GET['request_uri']?>" enctype="multipart/form-data" target="imglibrary">
+  <input type="hidden" name="request_uri" value="<?php echo urlencode($request_uri)?>" />
+  <input type="hidden" name="lib_action" value="" />
   <fieldset style= "padding: 5 5 5 5; margin-top: -5px;">
   <legend>{$lang_ibrowser_img_sel}</legend>
   <table width="440" border="0" cellspacing="0" cellpadding="0">
@@ -301,11 +289,11 @@
           </tr>
           <tr>
             <td><?php
-    if (!preg_match('#/$#', $HTTP_SERVER_VARS['DOCUMENT_ROOT'])){
-    //  $_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'].'/';
+    if (!preg_match('#/$#', $_SERVER['DOCUMENT_ROOT'])){
+    //  $_root = $_SERVER['DOCUMENT_ROOT'].'/';
 		$_root = e_BASE;
    } else {
-   //   $_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
+   //   $_root = $_SERVER['DOCUMENT_ROOT'];
       $_root = e_BASE;
 	}
   //  $d = @dir($_root.$imglib);
@@ -335,7 +323,7 @@
 	  $size = getimagesize($tinyMCE_base_url.$imglib.$entry);
 	  $fsize = filesize($_root.$imglib.$entry);
    ?>
-            <option img_width="<?php echo $size[0]; ?>" img_height="<?php echo $size[1]; ?>" f_size="<?php echo filesize_h($fsize,2); ?>" 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>
+            <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>
             <?php
 	  }
     }
@@ -351,10 +339,10 @@
             <td colspan="3"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td width="40%"><?php if ($tinyMCE_img_delete_allowed) { ?>
-                    <input type="button" value="{$lang_ibrowser_delete}" class="bt" onClick="deleteClick();">
+                    <input type="button" value="{$lang_ibrowser_delete}" class="bt" onClick="deleteClick();" />
                     <?php } ?></td>
-                  <td align="right"><input type="button" name="selectbt" value="{$lang_ibrowser_select}" class="bt" onClick="selectClick();">
-                    <input type="button" value="{$lang_ibrowser_cancel}" class="bt" onClick="window.close();"></td>
+                  <td align="right"><input type="button" name="selectbt" value="{$lang_ibrowser_select}" class="bt" onClick="selectClick();" />
+                    <input type="button" value="{$lang_ibrowser_cancel}" class="bt" onClick="window.close();" /></td>
                 </tr>
               </table></td>
           </tr>
@@ -369,11 +357,11 @@
       <td><table style='width:440px;border:0px' cellpadding="2" cellspacing="0">
           <tr>
             <td style='width:80px'>{$lang_ibrowser_src}:</td>
-            <td colspan="5"><input name="src" type="text" id="src" value="" style="width: 100%;" readonly="true"></td>
+            <td colspan="5"><input name="src" type="text" id="src" value="" style="width: 100%;" /></td>
           </tr>
           <tr>
             <td>{$lang_ibrowser_alt}:</td>
-            <td colspan="5"><input name="alt" type="text" id="alt" value="" style="width: 100%;" onChange="updateStyle()"></td>
+            <td colspan="5"><input name="alt" type="text" id="alt" value="" style="width: 100%;" onChange="updateStyle()" /></td>
           </tr>
           <tr>
             <td>{$lang_ibrowser_align}:</td>
@@ -385,7 +373,7 @@
             <td width="5">&nbsp;</td>
             <td rowspan="8" align="left" valign="top" style='width:210px;overflow:hidden'>
 			<div id="stylepreview" style="padding:10px; width: 200px; height:100%; overflow:hidden; background-color:#ffffff; font-size:8px" class="previewWindow">
-                <p><img id="wrap" src="images/textflow.gif" width="45" height="45" align="" alt="" hspace="" vspace="" border="" style="float:right; margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px" />Lorem
+                <p><img id="wrap" src="images/textflow.gif" width="45" height="45" alt="" style="border:0px; float:right; margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px" />Lorem
                   ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum
                   edipiscing elit, sed diam nonummy nibh euismod tincidunt ut
                   laoreet dolore magna aliquam erat volutpat.Loreum ipsum edipiscing
@@ -400,19 +388,19 @@
           </tr>
           <tr>
             <td>{$lang_ibrowser_size}:</td>
-            <td colspan="3"><input name="size" type="text" id="size" value="" readonly="true" style="width: 100%;"></td>
+            <td colspan="3"><input name="size" type="text" id="size" value="" readonly="true" style="width: 100%;" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td>{$lang_ibrowser_height}:</td>
-            <td width="40"><input name="height" type="text" id="height" value="" size="5" maxlength="4" style="text-align: right;" onChange="changeDim(0)"></td>
+            <td width="40"><input name="height" type="text" id="height" value="" size="5" maxlength="4" style="text-align: right;" onChange="changeDim(0)" /></td>
             <td width="25" rowspan="2" align="left" valign="middle"><a href="#" onClick="resetDim();" ><img src="images/constrain.gif" alt="{$lang_ibrowser_reset}" width="22" height="29" border="0"></a></td>
             <td rowspan="2">&nbsp;</td>
             <td>&nbsp;</td>
           </tr>
           <tr>
             <td>{$lang_ibrowser_width}:</td>
-            <td><input name="width" type="text" id="width" value="" size="5" maxlength="4" style="text-align: right;" onChange="changeDim(1)"></td>
+            <td><input name="width" type="text" id="width" value="" size="5" maxlength="4" style="text-align: right;" onChange="changeDim(1)" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
@@ -452,42 +440,7 @@
     </tr>
   </table>
   </fieldset>
-  <?php  if ($tinyMCE_upload_allowed) { ?>
-  <fieldset style= "padding: 5 5 5 5; margin-top: 10px;">
-  <legend>{$lang_ibrowser_img_upload}</legend>
-  <table width="440" border="0" cellpadding="0" cellspacing="0">
-    <tr>
-      <td><?php
-    if (!empty($errors))
-    {
-      echo '<span class="error">';
-      foreach ($errors as $err)
-      {
-        echo $err.'<br />';
-      }
-      echo '</span>';
-    }
-    ?>
-        <?php
-  if ($d) {
-  ?>
-        <table width="440" border="0" cellpadding="2" cellspacing="0">
-          <tr>
-            <td width="80">{$lang_ibrowser_uploadtxt}:</td>
-            <td colspan="2"><input type="file" name="img_file" style="width: 100%;"></td>
-          </tr>
-          <tr>
-            <td colspan="3"><input type="submit" name="btnupload" class="bt" value="{$lang_ibrowser_uploadbt}"></td>
-          </tr>
-        </table>
-        <?php
-  }
-  ?>
-      </td>
-    </tr>
-  </table>
-  </fieldset>
-  <?php  } ?>
+
 </form>
 </body>
 </html>
@@ -500,83 +453,7 @@
   }
   return $buf;
 }
-// upload image
-function uploadImg($img) {
 
-  global $HTTP_POST_FILES;
-  global $HTTP_SERVER_VARS;
-  global $tinyMCE_valid_imgs;
-  global $imglib;
-  global $errors;
-  global $l;
-  global $tinyMCE_upload_allowed;
-
-  if (!$tinyMCE_upload_allowed) return false;
-
-  if (!preg_match('#/$#', $HTTP_SERVER_VARS['DOCUMENT_ROOT'])){
-	$_root = e_BASE;
-  } else {
-  	$_root = e_BASE;
-  }
-  if ($HTTP_POST_FILES[$img]['size']>0) {
-    $data['type'] = $HTTP_POST_FILES[$img]['type'];
-    $data['name'] = $HTTP_POST_FILES[$img]['name'];
-    $data['size'] = $HTTP_POST_FILES[$img]['size'];
-    $data['tmp_name'] = $HTTP_POST_FILES[$img]['tmp_name'];
-
-    // get file extension
-    $ext = strtolower(substr(strrchr($data['name'],'.'), 1));
-    if (in_array($ext,$tinyMCE_valid_imgs)) {
-      $dir_name = $_root.$imglib;
-
-      $img_name = $data['name'];
-      $i = 1;
-      while (file_exists($dir_name.$img_name)) {
-        $img_name = preg_replace('#(.*)(\.[a-zA-Z]+)$#', '\\1_'.$i.'\\2', $data['name']);
-        $i++;
-      }
-      if (!move_uploaded_file($data['tmp_name'], $dir_name.$img_name)) {
-        $errors[] = '{lang_ibrowser_errorupload}';
-        return false;
-      }
-
-      return $img_name;
-    }
-    else
-    {
-      $errors[] = '{$lang_ibrowser_errortype}';
-    }
-  }
-  return false;
-}
-
-function deleteImg()
-{
-  global $HTTP_SERVER_VARS;
-  global $imglib;
-  global $img;
-  global $tinyMCE_img_delete_allowed;
-  global $errors;
-  global $l;
-
-  if (!$tinyMCE_img_delete_allowed) return false;
-
-  if (!preg_match('#/$#', $HTTP_SERVER_VARS['DOCUMENT_ROOT']))
-    $_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'].'/';
-  else
-    $_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
-
-  $full_img_name = $_root.$imglib.$img;
-
-  if (@unlink($full_img_name)) {
-  	return true;
-  }
-  else
-  {
-  	$errors[] = '{$lang_ibrowser_errordelete}';
-	return false;
-  }
-}
 
 // Return the human readable size of a file
 // @param int $size a file size
@@ -596,4 +473,4 @@
 	return round($size, $dec) . ' ' . $sizes[$i];
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js	2006-03-02 23:07:12.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js	2006-10-27 17:36:57.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('iespell','en,tr,cs,el,fr_ca,it,ko,sv,zh_cn,fr,de,pl,pt_br,nl,da,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,zh_tw,zh_tw_utf8,sk');var TinyMCE_IESpellPlugin={getInfo:function(){return{longname:'IESpell (MSIE Only)',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_iespell.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},getControlHTML:function(cn){if(cn=="iespell"&&(tinyMCE.isMSIE&&!tinyMCE.isOpera))return tinyMCE.getButtonHTML(cn,'lang_iespell_desc','{$pluginurl}/images/iespell.gif','mceIESpell');return"";},execCommand:function(editor_id,element,command,user_interface,value){if(command=="mceIESpell"){try{var ieSpell=new ActiveXObject("ieSpell.ieSpellExtension");ieSpell.CheckDocumentNode(tinyMCE.getInstanceById(editor_id).contentDocument.documentElement);}catch(e){if(e.number==-2146827859){if(confirm(tinyMCE.getLang("lang_iespell_download","",true)))window.open('http://www.iespell.com/download.php','ieSpellDownload','');}else alert("Error Loading ieSpell: Exception "+e.number);}return true;}return false;}};tinyMCE.addPlugin("iespell",TinyMCE_IESpellPlugin);
\ No newline at end of file
+tinyMCE.importPluginLanguagePack('iespell');var TinyMCE_IESpellPlugin={getInfo:function(){return{longname:'IESpell (MSIE Only)',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_iespell.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){if(cn=="iespell"&&(tinyMCE.isMSIE&&!tinyMCE.isOpera))return tinyMCE.getButtonHTML(cn,'lang_iespell_desc','{$pluginurl}/images/iespell.gif','mceIESpell');return""},execCommand:function(editor_id,element,command,user_interface,value){if(command=="mceIESpell"){try{var ieSpell=new ActiveXObject("ieSpell.ieSpellExtension");ieSpell.CheckDocumentNode(tinyMCE.getInstanceById(editor_id).contentDocument.documentElement)}catch(e){if(e.number==-2146827859){if(confirm(tinyMCE.getLang("lang_iespell_download","",true)))window.open('http://www.iespell.com/download.php','ieSpellDownload','')}else alert("Error Loading ieSpell: Exception "+e.number)}return true}return false}};tinyMCE.addPlugin("iespell",TinyMCE_IESpellPlugin);
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js 0.7.7/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,20 +1,18 @@
 /**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.8 $
- * $Date: 2006/05/06 03:05:15 $
+ * $Id: editor_plugin_src.js,v 1.9 2006/10/27 22:36:57 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
  */
 
 /* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('iespell', 'en,tr,cs,el,fr_ca,it,ko,sv,zh_cn,fr,de,pl,pt_br,nl,da,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,zh_tw,zh_tw_utf8,sk');
+tinyMCE.importPluginLanguagePack('iespell');
 
 var TinyMCE_IESpellPlugin = {
 	getInfo : function() {
 		return {
 			longname : 'IESpell (MSIE Only)',
-			author : 'Moxiecode Systems',
+			author : 'Moxiecode Systems AB',
 			authorurl : 'http://tinymce.moxiecode.com',
 			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_iespell.html',
 			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/css/content.css 0.7.7/e107_handlers/tiny_mce/plugins/media/css/content.css
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/css/content.css	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/css/content.css	2006-10-27 17:36:57.000000000 -0500
@@ -0,0 +1,26 @@
+.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
+	border: 1px dotted #cc0000;
+	background-position: center;
+	background-repeat: no-repeat;
+	background-color: #ffffcc;
+}
+
+.mceItemShockWave {
+	background-image: url('../images/shockwave.gif');
+}
+
+.mceItemFlash {
+	background-image: url('../images/flash.gif');
+}
+
+.mceItemQuickTime {
+	background-image: url('../images/quicktime.gif');
+}
+
+.mceItemWindowsMedia {
+	background-image: url('../images/windowsmedia.gif');
+}
+
+.mceItemRealMedia {
+	background-image: url('../images/realmedia.gif');
+}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/css/media.css 0.7.7/e107_handlers/tiny_mce/plugins/media/css/media.css
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/css/media.css	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/css/media.css	2006-10-27 17:36:57.000000000 -0500
@@ -0,0 +1,68 @@
+#id, #name, #hspace, #vspace, #class_name, #align {
+	width: 100px;
+}
+
+#hspace, #vspace {
+	width: 50px;
+}
+
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
+	width: 100px;
+}
+
+#flash_base, #flash_flashvars {
+	width: 240px;
+}
+
+#width, #height {
+	width: 40px;
+}
+
+#src, #media_type {
+	width: 250px;
+}
+
+#class {
+	width: 120px;
+}
+
+#prev {
+	margin: 0;
+	border: 1px solid black;
+	width: 99%;
+	height: 230px;
+	overflow: auto;
+}
+
+.panel_wrapper div.current {
+	height: 390px;
+	overflow: auto;
+}
+
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
+	display: none;
+}
+
+.mceAddSelectValue {
+	background-color: #DDDDDD;
+}
+
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
+	width: 70px;
+}
+
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
+	width: 70px;
+}
+
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
+	width: 70px;
+}
+
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
+	width: 90px;
+}
+
+#qt_qtsrc {
+	width: 200px;
+}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/media/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2006-10-27 17:36:57.000000000 -0500
@@ -0,0 +1 @@
+tinyMCE.importPluginLanguagePack('media');var TinyMCE_MediaPlugin={getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_media.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(!tinyMCE.settings['media_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/media/css/content.css")},getControlHTML:function(cn){switch(cn){case"media":return tinyMCE.getButtonHTML(cn,'lang_media_desc','{$pluginurl}/images/media.gif','mceMedia')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceMedia":tinyMCE.openWindow({file:'../../plugins/media/media.htm',width:430+tinyMCE.getLang('lang_media_delta_width',0),height:470+tinyMCE.getLang('lang_media_delta_height',0)},{editor_id:editor_id,inline:"yes"});return true}return false},cleanup:function(type,content,inst){var nl,img,i,ne,d,s,ci;switch(type){case"insert_to_editor":img=tinyMCE.getParam("theme_href")+'/images/spacer.gif';content=content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,'<img class="mceItem$1" title="$2" src="'+img+'" />');content=content.replace(/<object([^>]*)>/gi,'<div class="mceItemObject" $1>');content=content.replace(/<embed([^>]*)>/gi,'<div class="mceItemObjectEmbed" $1>');content=content.replace(/<\/(object|embed)([^>]*)>/gi,'</div>');content=content.replace(/<param([^>]*)>/gi,'<div $1 class="mceItemParam"></div>');content=content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>','gi'),'class="mceItemParam"></div>');break;case"insert_to_editor_dom":d=inst.getDoc();nl=content.getElementsByTagName("img");for(i=0;i<nl.length;i++){if(/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)){nl[i].width=nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g,'$1');nl[i].height=nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g,'$1');}}nl=tinyMCE.selectElements(content,'DIV',function(n){return tinyMCE.hasCSSClass(n,'mceItemObject')});for(i=0;i<nl.length;i++){ci=tinyMCE.getAttrib(nl[i],"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash',d,nl[i]),nl[i]);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave',d,nl[i]),nl[i]);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia',d,nl[i]),nl[i]);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime',d,nl[i]),nl[i]);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia',d,nl[i]),nl[i]);break}}nl=tinyMCE.selectNodes(content,function(n){return n.className=='mceItemObjectEmbed'});for(i=0;i<nl.length;i++){switch(tinyMCE.getAttrib(nl[i],'type')){case'application/x-shockwave-flash':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemFlash');break;case'application/x-director':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemShockWave');break;case'application/x-mplayer2':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemWindowsMedia');break;case'video/quicktime':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemQuickTime');break;case'audio/x-pn-realaudio-plugin':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemRealMedia');break}}break;case"get_from_editor":var startPos=-1,endPos,attribs,chunkBefore,chunkAfter,embedHTML,at,pl,cb,mt,ex;while((startPos=content.indexOf('<img',startPos+1))!=-1){endPos=content.indexOf('/>',startPos);attribs=TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos+4,endPos));if(!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))continue;endPos+=2;at=attribs['title'];if(at){at=at.replace(/&#39;/g,"'");at=at.replace(/&#quot;/g,'"');try{pl=eval('x={'+at+'};')}catch(ex){pl={}}}if(!tinyMCE.getParam('media_use_script',false)){switch(attribs['class']){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166B1BCA-3F9C-11CF-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=tinyMCE.getParam('media_wmp6_compatible')?'05589FA1-C356-11CE-BF01-00AA0055595A':'6BF52A52-394A-11D3-B153-00C04F79FAA6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break}if(!tinyMCE.getParam("relative_urls"))pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);embedHTML=TinyMCE_MediaPlugin._getEmbed(ci,cb,mt,pl,attribs)}else{switch(attribs['class']){case'mceItemFlash':s='writeFlash';break;case'mceItemShockWave':s='writeShockWave';break;case'mceItemWindowsMedia':s='writeWindowsMedia';break;case'mceItemQuickTime':s='writeQuickTime';break;case'mceItemRealMedia':s='writeRealMedia';break}if(attribs.width)at=at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g,"width:'"+attribs.width+"'");if(attribs.height)at=at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g,"height:'"+attribs.height+"'");if(!tinyMCE.getParam("relative_urls")){pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);at=at.replace(new RegExp("src:'[^']*'","g"),"src:'"+pl.src+"'")}embedHTML='<script type="text/javascript">'+s+'({'+at+'});</script>'}chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node,'class'))){tinyMCE.switchClass(editor_id+'_media','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_media','mceButtonNormal');return true},_createImgFromEmbed:function(n,d,cl){var ne,at,i,ti='',an;ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;at=n.attributes;for(i=0;i<at.length;i++){if(at[i].specified&&at[i].nodeValue){an=at[i].nodeName.toLowerCase();if(an=='src')continue;if(an=='mce_src')an='src';if(an.indexOf('mce_')==-1&&!new RegExp('^(class|type)$').test(an))ti+=an.toLowerCase()+':\''+at[i].nodeValue+"',"}}ti=ti.length>0?ti.substring(0,ti.length-1):ti;ne.title=ti;n.parentNode.replaceChild(ne,n)},_createImg:function(cl,d,n){var i,nl,ti="",an,av,al=new Array();ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;al.id=tinyMCE.getAttrib(n,'id');al.name=tinyMCE.getAttrib(n,'name');al.width=tinyMCE.getAttrib(n,'width');al.height=tinyMCE.getAttrib(n,'height');al.bgcolor=tinyMCE.getAttrib(n,'bgcolor');al.align=tinyMCE.getAttrib(n,'align');al.class_name=tinyMCE.getAttrib(n,'mce_class');nl=n.getElementsByTagName('div');for(i=0;i<nl.length;i++){av=tinyMCE.getAttrib(nl[i],'value');av=av.replace(new RegExp('\\\\','g'),'\\\\');av=av.replace(new RegExp('"','g'),'\\"');av=av.replace(new RegExp("'",'g'),"\\'");an=tinyMCE.getAttrib(nl[i],'name');al[an]=av}if(al.movie){al.src=al.movie;al.movie=null}for(an in al){if(al[an]!=null&&typeof(al[an])!="function"&&al[an]!='')ti+=an.toLowerCase()+':\''+al[an]+"',"}ti=ti.length>0?ti.substring(0,ti.length-1):ti;ne.title=ti;return ne},_getEmbed:function(cls,cb,mt,p,at){var h='',n;p.width=at.width?at.width:p.width;p.height=at.height?at.height:p.height;h+='<object classid="clsid:'+cls+'" codebase="'+cb+'"';h+=typeof(p.id)!="undefined"?' id="'+p.id+'"':'';h+=typeof(p.name)!="undefined"?' name="'+p.name+'"':'';h+=typeof(p.width)!="undefined"?' width="'+p.width+'"':'';h+=typeof(p.height)!="undefined"?' height="'+p.height+'"':'';h+=typeof(p.align)!="undefined"?' align="'+p.align+'"':'';h+='>';for(n in p){if(p[n]&&typeof(p[n])!="function"){h+='<param name="'+n+'" value="'+p[n]+'" />';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+='<param name="url" value="'+p[n]+'" />'}}h+='<embed type="'+mt+'"';for(n in p){if(typeof(p[n])=="function")continue;if(!(n=='url'&&mt=='application/x-mplayer2'))h+=' '+n+'="'+p[n]+'"'}h+='></embed></object>';return h},_parseAttributes:function(attribute_string){var attributeName="";var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i<attribute_string.length;i++){var chr=attribute_string.charAt(i);if((chr=='"'||chr=="'")&&!withInValue)withInValue=true;else if((chr=='"'||chr=="'")&&withInValue){withInValue=false;var pos=attributeName.lastIndexOf(' ');if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);attributeName="";attributeValue=""}else if(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;if(chr=='='&&withInName)withInName=false;if(withInName)attributeName+=chr;if(withInValue)attributeValue+=chr}return attributes}};tinyMCE.addPlugin("media",TinyMCE_MediaPlugin);
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js 0.7.7/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -0,0 +1,428 @@
+/**
+ * $Id: editor_plugin_src.js,v 1.1 2006/10/27 22:36:57 e107coders Exp $
+ *
+ * @author Moxiecode
+ * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('media');
+
+var TinyMCE_MediaPlugin = {
+	getInfo : function() {
+		return {
+			longname : 'Media',
+			author : 'Moxiecode Systems AB',
+			authorurl : 'http://tinymce.moxiecode.com',
+			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_media.html',
+			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+		};
+	},
+
+	initInstance : function(inst) {
+		if (!tinyMCE.settings['media_skip_plugin_css'])
+			tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
+	},
+
+	getControlHTML : function(cn) {
+		switch (cn) {
+			case "media":
+				return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
+		}
+
+		return "";
+	},
+
+	execCommand : function(editor_id, element, command, user_interface, value) {
+		// Handle commands
+		switch (command) {
+			case "mceMedia":
+				tinyMCE.openWindow({
+						file : '../../plugins/media/media.htm',
+						width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
+						height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
+					}, {
+						editor_id : editor_id,
+						inline : "yes"
+				});
+
+				return true;
+	   }
+
+	   // Pass to next handler in chain
+	   return false;
+	},
+
+	cleanup : function(type, content, inst) {
+		var nl, img, i, ne, d, s, ci;
+
+		switch (type) {
+			case "insert_to_editor":
+				img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
+				content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
+				content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
+				content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
+				content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
+				content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
+				content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
+				break;
+
+			case "insert_to_editor_dom":
+				d = inst.getDoc();
+				nl = content.getElementsByTagName("img");
+				for (i=0; i<nl.length; i++) {
+					if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
+						nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
+						nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
+						//nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
+					}
+				}
+
+				nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
+				for (i=0; i<nl.length; i++) {
+					ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
+
+					switch (ci) {
+						case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
+							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
+							break;
+
+						case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
+							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
+							break;
+
+						case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
+							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
+							break;
+
+						case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
+							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
+							break;
+
+						case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
+						case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
+						case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
+							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
+							break;
+					}
+				}
+
+				// Handle embed (if any)
+				nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
+				for (i=0; i<nl.length; i++) {
+					switch (tinyMCE.getAttrib(nl[i], 'type')) {
+						case 'application/x-shockwave-flash':
+							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
+							break;
+
+						case 'application/x-director':
+							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
+							break;
+
+						case 'application/x-mplayer2':
+							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
+							break;
+
+						case 'video/quicktime':
+							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
+							break;
+
+						case 'audio/x-pn-realaudio-plugin':
+							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
+							break;
+					}
+				}
+				break;
+
+			case "get_from_editor":
+				var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
+
+				while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
+					endPos = content.indexOf('/>', startPos);
+					attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
+
+					// Is not flash, skip it
+					if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
+						continue;
+
+					endPos += 2;
+
+					// Parse attributes
+					at = attribs['title'];
+					if (at) {
+						at = at.replace(/&#39;/g, "'");
+						at = at.replace(/&#quot;/g, '"');
+
+						try {
+							pl = eval('x={' + at + '};');
+						} catch (ex) {
+							pl = {};
+						}
+					}
+
+					// Use object/embed
+					if (!tinyMCE.getParam('media_use_script', false)) {
+						switch (attribs['class']) {
+							case 'mceItemFlash':
+								ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
+								cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+								mt = 'application/x-shockwave-flash';
+								break;
+
+							case 'mceItemShockWave':
+								ci = '166B1BCA-3F9C-11CF-8075-444553540000';
+								cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
+								mt = 'application/x-director';
+								break;
+
+							case 'mceItemWindowsMedia':
+								ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
+								cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+								mt = 'application/x-mplayer2';
+								break;
+
+							case 'mceItemQuickTime':
+								ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+								cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
+								mt = 'video/quicktime';
+								break;
+
+							case 'mceItemRealMedia':
+								ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+								cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+								mt = 'audio/x-pn-realaudio-plugin';
+								break;
+						}
+
+						// Force absolute URL
+						if (!tinyMCE.getParam("relative_urls"))
+							pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
+
+						embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
+					} else {
+						// Use script version
+						switch (attribs['class']) {
+							case 'mceItemFlash':
+								s = 'writeFlash';
+								break;
+
+							case 'mceItemShockWave':
+								s = 'writeShockWave';
+								break;
+
+							case 'mceItemWindowsMedia':
+								s = 'writeWindowsMedia';
+								break;
+
+							case 'mceItemQuickTime':
+								s = 'writeQuickTime';
+								break;
+
+							case 'mceItemRealMedia':
+								s = 'writeRealMedia';
+								break;
+						}
+
+						if (attribs.width)
+							at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
+
+						if (attribs.height)
+							at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
+
+						// Force absolute URL
+						if (!tinyMCE.getParam("relative_urls")) {
+							pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
+							at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
+						}
+
+						embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
+					}
+
+					// Insert embed/object chunk
+					chunkBefore = content.substring(0, startPos);
+					chunkAfter = content.substring(endPos);
+					content = chunkBefore + embedHTML + chunkAfter;
+				}
+				break;
+		}
+
+		return content;
+	},
+
+	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+		if (node == null)
+			return;
+
+		do {
+			if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
+				tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
+				return true;
+			}
+		} while ((node = node.parentNode));
+
+		tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
+
+		return true;
+	},
+
+	_createImgFromEmbed : function(n, d, cl) {
+		var ne, at, i, ti = '', an;
+
+		ne = d.createElement('img');
+		ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
+		ne.width = tinyMCE.getAttrib(n, 'width');
+		ne.height = tinyMCE.getAttrib(n, 'height');
+		ne.className = cl;
+
+		at = n.attributes;
+		for (i=0; i<at.length; i++) {
+			if (at[i].specified && at[i].nodeValue) {
+				an = at[i].nodeName.toLowerCase();
+
+				if (an == 'src')
+					continue;
+
+				if (an == 'mce_src')
+					an = 'src';
+
+				if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
+					ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
+			}
+		}
+
+		ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
+		ne.title = ti;
+
+		n.parentNode.replaceChild(ne, n);
+	},
+
+	_createImg : function(cl, d, n) {
+		var i, nl, ti = "", an, av, al = new Array();
+
+		ne = d.createElement('img');
+		ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
+		ne.width = tinyMCE.getAttrib(n, 'width');
+		ne.height = tinyMCE.getAttrib(n, 'height');
+		ne.className = cl;
+
+		al.id = tinyMCE.getAttrib(n, 'id');
+		al.name = tinyMCE.getAttrib(n, 'name');
+		al.width = tinyMCE.getAttrib(n, 'width');
+		al.height = tinyMCE.getAttrib(n, 'height');
+		al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
+		al.align = tinyMCE.getAttrib(n, 'align');
+		al.class_name = tinyMCE.getAttrib(n, 'mce_class');
+
+		nl = n.getElementsByTagName('div');
+		for (i=0; i<nl.length; i++) {
+			av = tinyMCE.getAttrib(nl[i], 'value');
+			av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
+			av = av.replace(new RegExp('"', 'g'), '\\"');
+			av = av.replace(new RegExp("'", 'g'), "\\'");
+			an = tinyMCE.getAttrib(nl[i], 'name');
+			al[an] = av;
+		}
+
+		if (al.movie) {
+			al.src = al.movie;
+			al.movie = null;
+		}
+
+		for (an in al) {
+			if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
+				ti += an.toLowerCase() + ':\'' + al[an] + "',";
+		}
+
+		ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
+		ne.title = ti;
+
+		return ne;
+	},
+
+	_getEmbed : function(cls, cb, mt, p, at) {
+		var h = '', n;
+
+		p.width = at.width ? at.width : p.width;
+		p.height = at.height ? at.height : p.height;
+
+		h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
+		h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
+		h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
+		h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
+		h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
+		h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
+		h += '>';
+
+		for (n in p) {
+			if (p[n] && typeof(p[n]) != "function") {
+				h += '<param name="' + n + '" value="' + p[n] + '" />';
+
+				// Add extra url parameter if it's an absolute URL on WMP
+				if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
+					h += '<param name="url" value="' + p[n] + '" />';
+			}
+		}
+
+		h += '<embed type="' + mt + '"';
+
+		for (n in p) {
+			if (typeof(p[n]) == "function")
+				continue;
+
+			// Skip url parameter for embed tag on WMP
+			if (!(n == 'url' && mt == 'application/x-mplayer2'))
+				h += ' ' + n + '="' + p[n] + '"';
+		}
+
+		h += '></embed></object>';
+
+		return h;
+	},
+
+	_parseAttributes : function(attribute_string) {
+		var attributeName = "";
+		var attributeValue = "";
+		var withInName;
+		var withInValue;
+		var attributes = new Array();
+		var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
+
+		if (attribute_string == null || attribute_string.length < 2)
+			return null;
+
+		withInName = withInValue = false;
+
+		for (var i=0; i<attribute_string.length; i++) {
+			var chr = attribute_string.charAt(i);
+
+			if ((chr == '"' || chr == "'") && !withInValue)
+				withInValue = true;
+			else if ((chr == '"' || chr == "'") && withInValue) {
+				withInValue = false;
+
+				var pos = attributeName.lastIndexOf(' ');
+				if (pos != -1)
+					attributeName = attributeName.substring(pos+1);
+
+				attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
+
+				attributeName = "";
+				attributeValue = "";
+			} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
+				withInName = true;
+
+			if (chr == '=' && withInName)
+				withInName = false;
+
+			if (withInName)
+				attributeName += chr;
+
+			if (withInValue)
+				attributeValue += chr;
+		}
+
+		return attributes;
+	}
+};
+
+tinyMCE.addPlugin("media", TinyMCE_MediaPlugin);
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/media/images/flash.gif and 0.7.7/e107_handlers/tiny_mce/plugins/media/images/flash.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/media/images/media.gif and 0.7.7/e107_handlers/tiny_mce/plugins/media/images/media.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/media/images/quicktime.gif and 0.7.7/e107_handlers/tiny_mce/plugins/media/images/quicktime.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/media/images/realmedia.gif and 0.7.7/e107_handlers/tiny_mce/plugins/media/images/realmedia.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/media/images/shockwave.gif and 0.7.7/e107_handlers/tiny_mce/plugins/media/images/shockwave.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/media/images/windowsmedia.gif and 0.7.7/e107_handlers/tiny_mce/plugins/media/images/windowsmedia.gif differ
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/jscripts/embed.js 0.7.7/e107_handlers/tiny_mce/plugins/media/jscripts/embed.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/jscripts/embed.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/jscripts/embed.js	2006-10-27 17:36:58.000000000 -0500
@@ -0,0 +1,73 @@
+/**
+ * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
+ */
+
+function writeFlash(p) {
+	writeEmbed(
+		'D27CDB6E-AE6D-11cf-96B8-444553540000',
+		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+		'application/x-shockwave-flash',
+		p
+	);
+}
+
+function writeShockWave(p) {
+	writeEmbed(
+	'166B1BCA-3F9C-11CF-8075-444553540000',
+	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
+	'application/x-director',
+		p
+	);
+}
+
+function writeQuickTime(p) {
+	writeEmbed(
+		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
+		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
+		'video/quicktime',
+		p
+	);
+}
+
+function writeRealMedia(p) {
+	writeEmbed(
+		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
+		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+		'audio/x-pn-realaudio-plugin',
+		p
+	);
+}
+
+function writeWindowsMedia(p) {
+	p.url = p.src;
+	writeEmbed(
+		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
+		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
+		'application/x-mplayer2',
+		p
+	);
+}
+
+function writeEmbed(cls, cb, mt, p) {
+	var h = '', n;
+
+	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
+	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
+	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
+	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
+	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
+	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
+	h += '>';
+
+	for (n in p)
+		h += '<param name="' + n + '" value="' + p[n] + '">';
+
+	h += '<embed type="' + mt + '"';
+
+	for (n in p)
+		h += n + '="' + p[n] + '" ';
+
+	h += '></embed></object>';
+
+	document.write(h);
+}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/jscripts/media.js 0.7.7/e107_handlers/tiny_mce/plugins/media/jscripts/media.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/jscripts/media.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/jscripts/media.js	2006-10-27 17:36:58.000000000 -0500
@@ -0,0 +1,572 @@
+var oldWidth, oldHeight;
+var url = tinyMCE.getParam("media_external_list_url");
+if (url != null) {
+	// Fix relative
+	if (url.charAt(0) != '/' && url.indexOf('://') == -1)
+		url = tinyMCE.documentBasePath + "/" + url;
+
+	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
+}
+
+function init() {
+	var pl = "", f, val;
+	var type = "flash", fe, i;
+
+	tinyMCEPopup.resizeToInnerSize();
+	f = document.forms[0]
+
+	fe = tinyMCE.selectedInstance.getFocusElement();
+	if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
+		pl = "x={" + fe.title + "};";
+
+		switch (tinyMCE.getAttrib(fe, 'class')) {
+			case 'mceItemFlash':
+				type = 'flash';
+				break;
+
+			case 'mceItemShockWave':
+				type = 'shockwave';
+				break;
+
+			case 'mceItemWindowsMedia':
+				type = 'wmp';
+				break;
+
+			case 'mceItemQuickTime':
+				type = 'qt';
+				break;
+
+			case 'mceItemRealMedia':
+				type = 'rmp';
+				break;
+		}
+
+		document.forms[0].insert.value = tinyMCE.getLang('lang_update', 'Insert', true); 
+	}
+
+	document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
+	document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
+	document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+	var html = getMediaListHTML('filebrowser','src','media','media');
+	if (html == "")
+		document.getElementById("linklistrow").style.display = 'none';
+	else
+		document.getElementById("linklistcontainer").innerHTML = html;
+
+	// Resize some elements
+	if (isVisible('filebrowsercontainer'))
+		document.getElementById('src').style.width = '230px';
+
+	// Setup form
+	if (pl != "") {
+		pl = eval(pl);
+
+		switch (type) {
+			case "flash":
+				setBool(pl, 'flash', 'play');
+				setBool(pl, 'flash', 'loop');
+				setBool(pl, 'flash', 'menu');
+				setBool(pl, 'flash', 'swliveconnect');
+				setStr(pl, 'flash', 'quality');
+				setStr(pl, 'flash', 'scale');
+				setStr(pl, 'flash', 'salign');
+				setStr(pl, 'flash', 'wmode');
+				setStr(pl, 'flash', 'base');
+				setStr(pl, 'flash', 'flashvars');
+			break;
+
+			case "qt":
+				setBool(pl, 'qt', 'loop');
+				setBool(pl, 'qt', 'autoplay');
+				setBool(pl, 'qt', 'cache');
+				setBool(pl, 'qt', 'controller');
+				setBool(pl, 'qt', 'correction');
+				setBool(pl, 'qt', 'enablejavascript');
+				setBool(pl, 'qt', 'kioskmode');
+				setBool(pl, 'qt', 'autohref');
+				setBool(pl, 'qt', 'playeveryframe');
+				setBool(pl, 'qt', 'tarsetcache');
+				setStr(pl, 'qt', 'scale');
+				setStr(pl, 'qt', 'starttime');
+				setStr(pl, 'qt', 'endtime');
+				setStr(pl, 'qt', 'tarset');
+				setStr(pl, 'qt', 'qtsrcchokespeed');
+				setStr(pl, 'qt', 'volume');
+				setStr(pl, 'qt', 'qtsrc');
+			break;
+
+			case "shockwave":
+				setBool(pl, 'shockwave', 'sound');
+				setBool(pl, 'shockwave', 'progress');
+				setBool(pl, 'shockwave', 'autostart');
+				setBool(pl, 'shockwave', 'swliveconnect');
+				setStr(pl, 'shockwave', 'swvolume');
+				setStr(pl, 'shockwave', 'swstretchstyle');
+				setStr(pl, 'shockwave', 'swstretchhalign');
+				setStr(pl, 'shockwave', 'swstretchvalign');
+			break;
+
+			case "wmp":
+				setBool(pl, 'wmp', 'autostart');
+				setBool(pl, 'wmp', 'enabled');
+				setBool(pl, 'wmp', 'enablecontextmenu');
+				setBool(pl, 'wmp', 'fullscreen');
+				setBool(pl, 'wmp', 'invokeurls');
+				setBool(pl, 'wmp', 'mute');
+				setBool(pl, 'wmp', 'stretchtofit');
+				setBool(pl, 'wmp', 'windowlessvideo');
+				setStr(pl, 'wmp', 'balance');
+				setStr(pl, 'wmp', 'baseurl');
+				setStr(pl, 'wmp', 'captioningid');
+				setStr(pl, 'wmp', 'currentmarker');
+				setStr(pl, 'wmp', 'currentposition');
+				setStr(pl, 'wmp', 'defaultframe');
+				setStr(pl, 'wmp', 'playcount');
+				setStr(pl, 'wmp', 'rate');
+				setStr(pl, 'wmp', 'uimode');
+				setStr(pl, 'wmp', 'volume');
+			break;
+
+			case "rmp":
+				setBool(pl, 'rmp', 'autostart');
+				setBool(pl, 'rmp', 'loop');
+				setBool(pl, 'rmp', 'autogotourl');
+				setBool(pl, 'rmp', 'center');
+				setBool(pl, 'rmp', 'imagestatus');
+				setBool(pl, 'rmp', 'maintainaspect');
+				setBool(pl, 'rmp', 'nojava');
+				setBool(pl, 'rmp', 'prefetch');
+				setBool(pl, 'rmp', 'shuffle');
+				setStr(pl, 'rmp', 'console');
+				setStr(pl, 'rmp', 'controls');
+				setStr(pl, 'rmp', 'numloop');
+				setStr(pl, 'rmp', 'scriptcallbacks');
+			break;
+		}
+
+		setStr(pl, null, 'src');
+		setStr(pl, null, 'id');
+		setStr(pl, null, 'name');
+		setStr(pl, null, 'vspace');
+		setStr(pl, null, 'hspace');
+		setStr(pl, null, 'bgcolor');
+		setStr(pl, null, 'align');
+		setStr(pl, null, 'width');
+		setStr(pl, null, 'height');
+
+		if ((val = tinyMCE.getAttrib(fe, "width")) != "")
+			pl.width = f.width.value = val;
+
+		if ((val = tinyMCE.getAttrib(fe, "height")) != "")
+			pl.height = f.height.value = val;
+
+		oldWidth = pl.width ? parseInt(pl.width) : 0;
+		oldHeight = pl.height ? parseInt(pl.height) : 0;
+	} else
+		oldWidth = oldHeight = 0;
+
+	selectByValue(f, 'media_type', type);
+	changedType(type);
+	updateColor('bgcolor_pick', 'bgcolor');
+
+	TinyMCE_EditableSelects.init();
+	generatePreview();
+}
+
+function insertMedia() {
+	var fe, f = document.forms[0], h;
+
+	if (!AutoValidator.validate(f)) {
+		alert(tinyMCE.getLang('lang_invalid_data'));
+		return false;
+	}
+
+	f.width.value = f.width.value == "" ? 100 : f.width.value;
+	f.height.value = f.height.value == "" ? 100 : f.height.value;
+
+	fe = tinyMCE.selectedInstance.getFocusElement();
+	if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) {
+		switch (f.media_type.options[f.media_type.selectedIndex].value) {
+			case "flash":
+				fe.className = "mceItemFlash";
+				break;
+
+			case "shockwave":
+				fe.className = "mceItemShockWave";
+				break;
+
+			case "qt":
+				fe.className = "mceItemQuickTime";
+				break;
+
+			case "wmp":
+				fe.className = "mceItemWindowsMedia";
+				break;
+
+			case "rmp":
+				fe.className = "mceItemRealMedia";
+				break;
+		}
+
+		if (fe.width != f.width.value || fe.height != f.width.height)
+			tinyMCE.selectedInstance.repaint();
+
+		fe.title = serializeParameters();
+		fe.width = f.width.value;
+		fe.height = f.height.value;
+		fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
+		fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
+		fe.align = f.align.options[f.align.selectedIndex].value;
+	} else {
+		h = '<img src="' + tinyMCE.getParam("theme_href") + '/images/spacer.gif"' ;
+
+		switch (f.media_type.options[f.media_type.selectedIndex].value) {
+			case "flash":
+				h += ' class="mceItemFlash"';
+				break;
+
+			case "shockwave":
+				h += ' class="mceItemShockWave"';
+				break;
+
+			case "qt":
+				h += ' class="mceItemQuickTime"';
+				break;
+
+			case "wmp":
+				h += ' class="mceItemWindowsMedia"';
+				break;
+
+			case "rmp":
+				h += ' class="mceItemRealMedia"';
+				break;
+		}
+
+		h += ' title="' + serializeParameters() + '"';
+		h += ' width="' + f.width.value + '"';
+		h += ' height="' + f.height.value + '"';
+		h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';
+
+		h += ' />';
+
+		tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h);
+	}
+
+	tinyMCEPopup.close();
+}
+
+function getMediaListHTML() {
+	if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
+		var html = "";
+
+		html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.src.value=this.options[this.selectedIndex].value;">';
+		html += '<option value="">---</option>';
+
+		for (var i=0; i<tinyMCEMediaList.length; i++)
+			html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
+
+		html += '</select>';
+
+		return html;
+	}
+
+	return "";
+}
+
+function getType(v) {
+	var fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'), i, c, el, x;
+
+	for (i=0; i<fo.length; i++) {
+		c = fo[i].split('=');
+
+		el = c[1].split(',');
+		for (x=0; x<el.length; x++)
+		if (v.indexOf('.' + el[x]) != -1)
+			return c[0];
+	}
+
+	return null;
+}
+
+function switchType(v) {
+	var t = getType(v), d = document, f = d.forms[0];
+
+	if (!t)
+		return;
+
+	selectByValue(d.forms[0], 'media_type', t);
+	changedType(t);
+
+	// Update qtsrc also
+	if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {
+		alert(tinyMCE.getLang("lang_media_qt_stream_warn"));
+
+		if (f.qt_qtsrc.value == '')
+			f.qt_qtsrc.value = f.src.value;
+	}
+}
+
+function changedType(t) {
+	var d = document;
+
+	d.getElementById('flash_options').style.display = 'none';
+	d.getElementById('qt_options').style.display = 'none';
+	d.getElementById('shockwave_options').style.display = 'none';
+	d.getElementById('wmp_options').style.display = 'none';
+	d.getElementById('rmp_options').style.display = 'none';
+	d.getElementById(t + '_options').style.display = 'block';
+}
+
+function serializeParameters() {
+	var d = document, f = d.forms[0], s = '';
+
+	switch (f.media_type.options[f.media_type.selectedIndex].value) {
+		case "flash":
+			s += getBool('flash', 'play', true);
+			s += getBool('flash', 'loop', true);
+			s += getBool('flash', 'menu', true);
+			s += getBool('flash', 'swliveconnect', false);
+			s += getStr('flash', 'quality');
+			s += getStr('flash', 'scale');
+			s += getStr('flash', 'salign');
+			s += getStr('flash', 'wmode');
+			s += getStr('flash', 'base');
+			s += getStr('flash', 'flashvars');
+		break;
+
+		case "qt":
+			s += getBool('qt', 'loop', false);
+			s += getBool('qt', 'autoplay', false);
+			s += getBool('qt', 'cache', false);
+			s += getBool('qt', 'controller', true);
+			s += getBool('qt', 'correction', false, 'none', 'full');
+			s += getBool('qt', 'enablejavascript', false);
+			s += getBool('qt', 'kioskmode', false);
+			s += getBool('qt', 'autohref', false);
+			s += getBool('qt', 'playeveryframe', false);
+			s += getBool('qt', 'targetcache', false);
+			s += getStr('qt', 'scale');
+			s += getStr('qt', 'starttime');
+			s += getStr('qt', 'endtime');
+			s += getStr('qt', 'target');
+			s += getStr('qt', 'qtsrcchokespeed');
+			s += getStr('qt', 'volume');
+			s += getStr('qt', 'qtsrc');
+		break;
+
+		case "shockwave":
+			s += getBool('shockwave', 'sound');
+			s += getBool('shockwave', 'progress');
+			s += getBool('shockwave', 'autostart');
+			s += getBool('shockwave', 'swliveconnect');
+			s += getStr('shockwave', 'swvolume');
+			s += getStr('shockwave', 'swstretchstyle');
+			s += getStr('shockwave', 'swstretchhalign');
+			s += getStr('shockwave', 'swstretchvalign');
+		break;
+
+		case "wmp":
+			s += getBool('wmp', 'autostart', true);
+			s += getBool('wmp', 'enabled', false);
+			s += getBool('wmp', 'enablecontextmenu', true);
+			s += getBool('wmp', 'fullscreen', false);
+			s += getBool('wmp', 'invokeurls', true);
+			s += getBool('wmp', 'mute', false);
+			s += getBool('wmp', 'stretchtofit', false);
+			s += getBool('wmp', 'windowlessvideo', false);
+			s += getStr('wmp', 'balance');
+			s += getStr('wmp', 'baseurl');
+			s += getStr('wmp', 'captioningid');
+			s += getStr('wmp', 'currentmarker');
+			s += getStr('wmp', 'currentposition');
+			s += getStr('wmp', 'defaultframe');
+			s += getStr('wmp', 'playcount');
+			s += getStr('wmp', 'rate');
+			s += getStr('wmp', 'uimode');
+			s += getStr('wmp', 'volume');
+		break;
+
+		case "rmp":
+			s += getBool('rmp', 'autostart', false);
+			s += getBool('rmp', 'loop', false);
+			s += getBool('rmp', 'autogotourl', true);
+			s += getBool('rmp', 'center', false);
+			s += getBool('rmp', 'imagestatus', true);
+			s += getBool('rmp', 'maintainaspect', false);
+			s += getBool('rmp', 'nojava', false);
+			s += getBool('rmp', 'prefetch', false);
+			s += getBool('rmp', 'shuffle', false);
+			s += getStr('rmp', 'console');
+			s += getStr('rmp', 'controls');
+			s += getStr('rmp', 'numloop');
+			s += getStr('rmp', 'scriptcallbacks');
+		break;
+	}
+
+	s += getStr(null, 'id');
+	s += getStr(null, 'name');
+	s += getStr(null, 'src');
+	s += getStr(null, 'align');
+	s += getStr(null, 'bgcolor');
+	s += getInt(null, 'vspace');
+	s += getInt(null, 'hspace');
+	s += getStr(null, 'width');
+	s += getStr(null, 'height');
+
+	s = s.length > 0 ? s.substring(0, s.length - 1) : s;
+
+	return s;
+}
+
+function setBool(pl, p, n) {
+	if (typeof(pl[n]) == "undefined")
+		return;
+
+	document.forms[0].elements[p + "_" + n].checked = pl[n];
+}
+
+function setStr(pl, p, n) {
+	var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
+
+	if (typeof(pl[n]) == "undefined")
+		return;
+
+	if (e.type == "text")
+		e.value = pl[n];
+	else
+		selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
+}
+
+function getBool(p, n, d, tv, fv) {
+	var v = document.forms[0].elements[p + "_" + n].checked;
+
+	tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
+	fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
+
+	return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
+}
+
+function getStr(p, n, d) {
+	var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+	var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+	return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
+}
+
+function getInt(p, n, d) {
+	var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+	var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+	return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
+}
+
+function jsEncode(s) {
+	s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
+	s = s.replace(new RegExp('"', 'g'), '\\"');
+	s = s.replace(new RegExp("'", 'g'), "\\'");
+
+	return s;
+}
+
+function generatePreview(c) {
+	var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
+
+	p.innerHTML = '<!-- x --->';
+
+	nw = parseInt(f.width.value);
+	nh = parseInt(f.height.value);
+
+	if (f.width.value != "" && f.height.value != "") {
+		if (f.constrain.checked) {
+			if (c == 'width' && oldWidth != 0) {
+				wp = nw / oldWidth;
+				nh = Math.round(wp * nh);
+				f.height.value = nh;
+			} else if (c == 'height' && oldHeight != 0) {
+				hp = nh / oldHeight;
+				nw = Math.round(hp * nw);
+				f.width.value = nw;
+			}
+		}
+	}
+
+	if (f.width.value != "")
+		oldWidth = nw;
+
+	if (f.height.value != "")
+		oldHeight = nh;
+
+	// After constrain
+	pl = serializeParameters();
+
+	switch (f.media_type.options[f.media_type.selectedIndex].value) {
+		case "flash":
+			cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
+			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+			type = 'application/x-shockwave-flash';
+			break;
+
+		case "shockwave":
+			cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
+			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
+			type = 'application/x-director';
+			break;
+
+		case "qt":
+			cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+			codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
+			type = 'video/quicktime';
+			break;
+
+		case "wmp":
+			cls = tinyMCE.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
+			codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+			type = 'application/x-mplayer2';
+			break;
+
+		case "rmp":
+			cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+			codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+			type = 'audio/x-pn-realaudio-plugin';
+			break;
+	}
+
+	if (pl == '') {
+		p.innerHTML = '';
+		return;
+	}
+
+	pl = eval('x={' + pl + '};');
+
+	if (!pl.src) {
+		p.innerHTML = '';
+		return;
+	}
+
+	pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
+	pl.width = !pl.width ? 100 : pl.width;
+	pl.height = !pl.height ? 100 : pl.height;
+	pl.id = !pl.id ? 'obj' : pl.id;
+	pl.name = !pl.name ? 'eobj' : pl.name;
+	pl.align = !pl.align ? '' : pl.align;
+
+	h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+
+	for (n in pl) {
+		h += '<param name="' + n + '" value="' + pl[n] + '">';
+
+		// Add extra url parameter if it's an absolute URL
+		if (n == 'src' && pl[n].indexOf('://') != -1)
+			h += '<param name="url" value="' + pl[n] + '" />';
+	}
+
+	h += '<embed type="' + type + '" ';
+
+	for (n in pl)
+		h += n + '="' + pl[n] + '" ';
+
+	h += '></embed></object>';
+
+	p.innerHTML = "<!-- x --->" + h;
+}
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/langs/en.js 0.7.7/e107_handlers/tiny_mce/plugins/media/langs/en.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/langs/en.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/langs/en.js	2006-10-27 17:36:58.000000000 -0500
@@ -0,0 +1,85 @@
+// UK lang variables
+
+tinyMCE.addToLang('media',{
+title : 'Insert / edit embedded media',
+desc : 'Insert / edit embedded media',
+general : 'General',
+advanced : 'Advanced',
+file : 'File',
+list : 'List',
+size : 'Dimensions',
+preview : 'Preview',
+constrain_proportions : 'Constrain proportions',
+type : 'Type',
+id : 'Id',
+name : 'Name',
+class_name : 'Class',
+vspace : 'V-Space',
+hspace : 'H-Space',
+play : 'Auto play',
+loop : 'Loop',
+menu : 'Show menu',
+quality : 'Quality',
+scale : 'Scale',
+align : 'Align',
+salign : 'SAlign',
+wmode : 'WMode',
+bgcolor : 'Background',
+base : 'Base',
+flashvars : 'Flashvars',
+liveconnect : 'SWLiveConnect',
+autohref : 'AutoHREF',
+cache : 'Cache',
+hidden : 'Hidden',
+controller : 'Controller',
+kioskmode : 'Kiosk mode',
+playeveryframe : 'Play every frame',
+targetcache : 'Target cache',
+correction : 'No correction',
+enablejavascript : 'Enable JavaScript',
+starttime : 'Start time',
+endtime : 'End time',
+href : 'Href',
+qtsrcchokespeed : 'Choke speed',
+target : 'Target',
+volume : 'Volume',
+autostart : 'Auto start',
+enabled : 'Enabled',
+fullscreen : 'Fullscreen',
+invokeurls : 'Invoke URLs',
+mute : 'Mute',
+stretchtofit : 'Stretch to fit',
+windowlessvideo : 'Windowless video',
+balance : 'Balance',
+baseurl : 'Base URL',
+captioningid : 'Captioning id',
+currentmarker : 'Current marker',
+currentposition : 'Current position',
+defaultframe : 'Default frame',
+playcount : 'Play count',
+rate : 'Rate',
+uimode : 'UI Mode',
+flash_options : 'Flash options',
+qt_options : 'Quicktime options',
+wmp_options : 'Windows media player options',
+rmp_options : 'Real media player options',
+shockwave_options : 'Shockwave options',
+autogotourl : 'Auto goto URL',
+center : 'Center',
+imagestatus : 'Image status',
+maintainaspect : 'Maintain aspect',
+nojava : 'No java',
+prefetch : 'Prefetch',
+shuffle : 'Shuffle',
+console : 'Console',
+numloop : 'Num loops',
+controls : 'Controls',
+scriptcallbacks : 'Script callbacks',
+swstretchstyle : 'Stretch style',
+swstretchhalign : 'Stretch H-Align',
+swstretchvalign : 'Stretch V-Align',
+sound : 'Sound',
+progress : 'Progress',
+qtsrc : 'QT Src',
+qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..'
+});
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/media/media.htm 0.7.7/e107_handlers/tiny_mce/plugins/media/media.htm
--- 0.7.5/e107_handlers/tiny_mce/plugins/media/media.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/media/media.htm	2006-10-27 17:36:57.000000000 -0500
@@ -0,0 +1,723 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>{$lang_media_title}</title>
+	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script language="javascript" type="text/javascript" src="jscripts/media.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/editable_selects.js"></script>
+	<link href="css/media.css" rel="stylesheet" type="text/css" />
+	<base target="_self" />
+</head>
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+    <form onsubmit="insertMedia();return false;" action="#">
+		<div class="tabs">
+			<ul>
+				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{$lang_media_general}</a></span></li>
+				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_media_advanced}</a></span></li>
+			</ul>
+		</div>
+
+		<div class="panel_wrapper">
+			<div id="general_panel" class="panel current">
+				<fieldset>
+					<legend>{$lang_media_general}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+							<tr>
+								<td><label for="media_type">{$lang_media_type}</label></td>
+								<td>
+									<select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();">
+										<option value="flash">Flash</option>
+										<option value="qt">Quicktime</option>
+										<option value="shockwave">Shockware</option>
+										<option value="wmp">Windows Media</option>
+										<option value="rmp">Real Media</option>
+									</select>
+								</td>
+							</tr>
+							<tr>
+							<td><label for="src">{$lang_media_file}</label></td>
+							  <td>
+									<table border="0" cellspacing="0" cellpadding="0">
+									  <tr>
+										<td><input id="src" name="src" type="text" value="" onchange="switchType(this.value);generatePreview();" /></td>
+										<td id="filebrowsercontainer">&nbsp;</td>
+									  </tr>
+									</table>
+								</td>
+							</tr>
+							<tr id="linklistrow">
+								<td><label for="linklist">{$lang_media_list}</label></td>
+								<td id="linklistcontainer">&nbsp;</td>
+							</tr>
+							<tr>
+								<td><label for="width">{$lang_media_size}</label></td>
+								<td>
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size"  onchange="generatePreview('height');" /></td>
+										<td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
+										<td><label id="constrainlabel" for="constrain">{$lang_media_constrain_proportions}</label></td>
+									</tr>
+								</table>
+							</tr>
+					</table>
+				</fieldset>
+
+				<fieldset>
+					<legend>{$lang_media_preview}</legend>
+					<div id="prev"></div>
+				</fieldset>
+			</div>
+
+			<div id="advanced_panel" class="panel">
+				<fieldset>
+					<legend>{$lang_media_advanced}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0" width="100%">
+						<tr>
+							<td><label for="id">{$lang_media_id}</label></td>
+							<td><input type="text" id="id" name="id" onchange="generatePreview();" /></td>
+							<td><label for="name">{$lang_media_name}</label></td>
+							<td><input type="text" id="name" name="name" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="align">{$lang_media_align}</label></td>
+							<td>
+								<select id="align" name="align" onchange="generatePreview();">
+									<option value="">{$lang_not_set}</option> 
+									<option value="top">top</option>
+									<option value="right">right</option>
+									<option value="bottom">bottom</option>
+									<option value="left">left</option>
+								</select>
+							</td>
+
+							<td><label for="bgcolor">{$lang_media_bgcolor}</label></td>
+							<td>
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');generatePreview();" /></td>
+										<td id="bgcolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="vspace">{$lang_media_vspace}</label></td>
+							<td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td>
+							<td><label for="hspace">{$lang_media_hspace}</label></td>
+							<td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="flash_options">
+					<legend>{$lang_media_flash_options}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="flash_quality">{$lang_media_quality}</label></td>
+							<td>
+								<select id="flash_quality" name="flash_quality" onchange="generatePreview();">
+									<option value="">{$lang_not_set}</option> 
+									<option value="high">high</option>
+									<option value="low">low</option>
+									<option value="autolow">autolow</option>
+									<option value="autohigh">autohigh</option>
+									<option value="best">best</option>
+								</select>
+							</td>
+
+							<td><label for="flash_scale">{$lang_media_scale}</label></td>
+							<td>
+								<select id="flash_scale" name="flash_scale" onchange="generatePreview();">
+									<option value="">{$lang_not_set}</option> 
+									<option value="showall">showall</option>
+									<option value="noborder">noborder</option>
+									<option value="exactfit">exactfit</option>
+								</select>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="flash_wmode">{$lang_media_wmode}</label></td>
+							<td>
+								<select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">
+									<option value="">{$lang_not_set}</option> 
+									<option value="window">window</option>
+									<option value="opaque">opaque</option>
+									<option value="transparent">transparent</option>
+								</select>
+							</td>
+
+							<td><label for="flash_salign">{$lang_media_salign}</label></td>
+							<td>
+								<select id="flash_salign" name="flash_salign" onchange="generatePreview();">
+									<option value="">{$lang_not_set}</option> 
+									<option value="l">left</option>
+									<option value="t">top</option>
+									<option value="r">right</option>
+									<option value="b">bottom</option>
+									<option value="tl">top-left</option>
+									<option value="tr">top_right</option>
+									<option value="bl">bottom-left</option>
+									<option value="br">bottom-right</option>
+								</select>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flash_play">{$lang_media_play}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flash_loop">{$lang_media_loop}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flash_menu">{$lang_media_menu}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td>
+										<td><label for="flash_swliveconnect">{$lang_media_liveconnect}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+
+					<table>
+						<tr>
+							<td><label for="flash_base">{$lang_media_base}</label></td>
+							<td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="flash_flashvars">{$lang_media_flashvars}</label></td>
+							<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="qt_options">
+					<legend>{$lang_media_qt_options}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td>
+										<td><label for="qt_loop">{$lang_media_loop}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" onchange="generatePreview();" /></td>
+										<td><label for="qt_autoplay">{$lang_media_play}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td>
+										<td><label for="qt_cache">{$lang_media_cache}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="qt_controller">{$lang_media_controller}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>
+										<td><label for="qt_correction">{$lang_media_correction}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td>
+										<td><label for="qt_enablejavascript">{$lang_media_enablejavascript}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>
+										<td><label for="qt_kioskmode">{$lang_media_kioskmode}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td>
+										<td><label for="qt_autohref">{$lang_media_autohref}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>
+										<td><label for="qt_playeveryframe">{$lang_media_playeveryframe}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td>
+										<td><label for="qt_targetcache">{$lang_media_targetcache}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="qt_scale">{$lang_media_scale}</label></td>
+							<td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">
+									<option value="">{$lang_not_set}</option> 
+									<option value="tofit">tofit</option>
+									<option value="aspect">aspect</option>
+								</select>
+							</td>
+
+							<td colspan="2">&nbsp;</td>
+						</tr>
+
+						<tr>
+							<td><label for="qt_starttime">{$lang_media_starttime}</label></td>
+							<td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td>
+
+							<td><label for="qt_endtime">{$lang_media_endtime}</label></td>
+							<td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="qt_target">{$lang_media_target}</label></td>
+							<td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td>
+
+							<td><label for="qt_href">{$lang_media_href}</label></td>
+							<td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="qt_qtsrcchokespeed">{$lang_media_qtsrcchokespeed}</label></td>
+							<td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td>
+
+							<td><label for="qt_volume">{$lang_media_volume}</label></td>
+							<td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="qt_qtsrc">{$lang_media_qtsrc}</label></td>
+							<td colspan="4">
+							<table border="0" cellspacing="0" cellpadding="0">
+								  <tr>
+									<td><input type="text" id="qt_qtsrc" name="qt_qtsrc" onchange="generatePreview();" /></td>
+									<td id="qtsrcfilebrowsercontainer">&nbsp;</td>
+								  </tr>
+							</table>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="wmp_options">
+					<legend>{$lang_media_wmp_options}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="wmp_autostart">{$lang_media_autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td>
+										<td><label for="wmp_enabled">{$lang_media_enabled}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="wmp_enablecontextmenu">{$lang_media_menu}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td>
+										<td><label for="wmp_fullscreen">{$lang_media_fullscreen}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="wmp_invokeurls">{$lang_media_invokeurls}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td>
+										<td><label for="wmp_mute">{$lang_media_mute}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>
+										<td><label for="wmp_stretchtofit">{$lang_media_stretchtofit}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td>
+										<td><label for="wmp_windowlessvideo">{$lang_media_windowlessvideo}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="wmp_balance">{$lang_media_balance}</label></td>
+							<td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td>
+
+							<td><label for="wmp_baseurl">{$lang_media_baseurl}</label></td>
+							<td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="wmp_captioningid">{$lang_media_captioningid}</label></td>
+							<td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td>
+
+							<td><label for="wmp_currentmarker">{$lang_media_currentmarker}</label></td>
+							<td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="wmp_currentposition">{$lang_media_currentposition}</label></td>
+							<td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td>
+
+							<td><label for="wmp_defaultframe">{$lang_media_defaultframe}</label></td>
+							<td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="wmp_playcount">{$lang_media_playcount}</label></td>
+							<td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td>
+
+							<td><label for="wmp_rate">{$lang_media_rate}</label></td>
+							<td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="wmp_uimode">{$lang_media_uimode}</label></td>
+							<td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td>
+
+							<td><label for="wmp_volume">{$lang_media_volume}</label></td>
+							<td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td>
+						</tr>
+
+					</table>
+				</fieldset>
+
+				<fieldset id="rmp_options">
+					<legend>{$lang_media_rmp_options}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td>
+										<td><label for="rmp_autostart">{$lang_media_autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td>
+										<td><label for="rmp_loop">{$lang_media_loop}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="rmp_autogotourl">{$lang_media_autogotourl}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td>
+										<td><label for="rmp_center">{$lang_media_center}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="rmp_imagestatus">{$lang_media_imagestatus}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td>
+										<td><label for="rmp_maintainaspect">{$lang_media_maintainaspect}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>
+										<td><label for="rmp_nojava">{$lang_media_nojava}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td>
+										<td><label for="rmp_prefetch">{$lang_media_prefetch}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>
+										<td><label for="rmp_shuffle">{$lang_media_shuffle}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								&nbsp;
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="rmp_console">{$lang_media_console}</label></td>
+							<td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td>
+
+							<td><label for="rmp_controls">{$lang_media_controls}</label></td>
+							<td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="rmp_numloop">{$lang_media_numloop}</label></td>
+							<td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td>
+
+							<td><label for="rmp_scriptcallbacks">{$lang_media_scriptcallbacks}</label></td>
+							<td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="shockwave_options">
+					<legend>{$lang_media_shockwave_options}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="shockwave_swstretchstyle">{$lang_media_swstretchstyle}</label></td>
+							<td>
+								<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">
+									<option value="none">None</option>
+									<option value="meet">Meet</option>
+									<option value="fill">Fill</option>
+									<option value="stage">Stage</option>
+								</select>
+							</td>
+
+							<td><label for="shockwave_swvolume">{$lang_media_volume}</label></td>
+							<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="shockwave_swstretchhalign">{$lang_media_swstretchhalign}</label></td>
+							<td>
+								<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">
+									<option value="none">None</option>
+									<option value="left">left</option>
+									<option value="center">center</option>
+									<option value="right">right</option>
+								</select>
+							</td>
+
+							<td><label for="shockwave_swstretchvalign">{$lang_media_swstretchvalign}</label></td>
+							<td>
+								<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">
+									<option value="none">None</option>
+									<option value="meet">Top</option>
+									<option value="fill">Center</option>
+									<option value="stage">Bottom</option>
+								</select>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td>
+										<td><label for="shockwave_autostart">{$lang_media_autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td>
+										<td><label for="shockwave_sound">{$lang_media_sound}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>
+										<td><label for="shockwave_swliveconnect">{$lang_media_liveconnect}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td>
+										<td><label for="shockwave_progress">{$lang_media_progress}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+			</div>
+		</div>
+
+		<div class="mceActionPanel">
+			<div style="float: left">
+				<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertMedia();" />
+			</div>
+
+			<div style="float: right">
+				<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+			</div>
+		</div>
+	</form>
+</body>
+</html>
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/table/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/table/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2006-03-02 23:07:12.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2006-10-27 17:36:57.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('table','en,tr,ar,cs,da,de,el,es,fi,fr_ca,hu,it,ja,ko,nl,nb,pl,pt,pt_br,sv,tw,zh_cn,fr,de,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,cy,is,zh_tw,zh_tw_utf8,sk');var TinyMCE_TablePlugin={getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(tinyMCE.isGecko){var doc=inst.getDoc();tinyMCE.addEvent(doc,"mouseup",TinyMCE_TablePlugin._mouseDownHandler);}inst.tableRowClipboard=null;},getControlHTML:function(control_name){var controls=new Array(['table','table.gif','lang_table_desc','mceInsertTable',true],['delete_col','table_delete_col.gif','lang_table_delete_col_desc','mceTableDeleteCol'],['delete_row','table_delete_row.gif','lang_table_delete_row_desc','mceTableDeleteRow'],['col_after','table_insert_col_after.gif','lang_table_col_after_desc','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','lang_table_col_before_desc','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','lang_table_row_after_desc','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','lang_table_row_before_desc','mceTableInsertRowBefore'],['row_props','table_row_props.gif','lang_table_row_desc','mceTableRowProps',true],['cell_props','table_cell_props.gif','lang_table_cell_desc','mceTableCellProps',true],['split_cells','table_split_cells.gif','lang_table_split_cells_desc','mceTableSplitCells',true],['merge_cells','table_merge_cells.gif','lang_table_merge_cells_desc','mceTableMergeCells',true]);for(var i=0;i<controls.length;i++){var but=controls[i];var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+');return false;';if(but[0]==control_name)return tinyMCE.getButtonHTML(control_name,but[2],'{$pluginurl}/images/'+but[1],but[3],(but.length>4?but[4]:false));}if(control_name=="tablecontrols"){var html="";html+=tinyMCE.getControlHTML("table");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_props");html+=tinyMCE.getControlHTML("cell_props");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_before");html+=tinyMCE.getControlHTML("row_after");html+=tinyMCE.getControlHTML("delete_row");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("col_before");html+=tinyMCE.getControlHTML("col_after");html+=tinyMCE.getControlHTML("delete_col");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("split_cells");html+=tinyMCE.getControlHTML("merge_cells");return html;}return"";},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":var inst=tinyMCE.getInstanceById(editor_id);inst.execCommand('mceBeginUndoLevel');TinyMCE_TablePlugin._doExecCommand(editor_id,element,command,user_interface,value);inst.execCommand('mceEndUndoLevel');return true;}return false;},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){var colspan="1",rowspan="1";var inst=tinyMCE.getInstanceById(editor_id);tinyMCE.switchClass(editor_id+'_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_cell_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_split_cells','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonDisabled');if(tdElm=tinyMCE.getParentElement(node,"td,th")){tinyMCE.switchClass(editor_id+'_cell_props','mceButtonSelected');tinyMCE.switchClass(editor_id+'_row_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonNormal');colspan=tinyMCE.getAttrib(tdElm,"colspan");rowspan=tinyMCE.getAttrib(tdElm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;if(colspan!="1"||rowspan!="1")tinyMCE.switchClass(editor_id+'_split_cells','mceButtonNormal');}if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClass(editor_id+'_row_props','mceButtonSelected');if(tinyMCE.getParentElement(node,"table")){tinyMCE.switchClass(editor_id+'_table','mceButtonSelected');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonNormal');}},_mouseDownHandler:function(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||focusElm.nodeName=="TH"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD")||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TH"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);},10);}},_doExecCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var trElm=tinyMCE.getParentElement(focusElm,"tr");var tdElm=tinyMCE.getParentElement(focusElm,"td,th");var tableElm=tinyMCE.getParentElement(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function makeTD(){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";}function getColRowSpan(td){var colspan=tinyMCE.getAttrib(td,"colspan");var rowspan=tinyMCE.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y};}}return null;}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null;}function getTableGrid(table){var grid=new Array();var rows=table.rows;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].cells.length;x++){var td=rows[y].cells[x];var sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(var y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=new Array();for(var x2=xstart;x2<xstart+sd['colspan'];x2++){grid[y2][x2]=td;}}}}return grid;}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table);var cpos=getCellPos(grid,td);if(new_tr.cells.length!=tr.childNodes.length){var cells=tr.childNodes;var lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true;}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true;}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node;}}return null;}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue;}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";if(tinyMCE.isMSIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=tinyMCE.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break;}}}if(newTD==null){newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_rowprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_rowprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_cellprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_cellprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"});}return true;case"mceInsertTable":if(user_interface){var template=new Array();template['file']='../../plugins/table/table.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:value});}return true;case"mceTableDelete":var table=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(table){table.parentNode.removeChild(table);inst.repaint();}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){tableElm.parentNode.removeChild(tableElm);return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;inst.selection.selectNode(getCell(grid,cpos.rowindex,0),true,true);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){tableElm.parentNode.removeChild(tableElm);return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}cpos.cellindex--;if(cpos.cellindex<0)cpos.cellindex=0;inst.selection.selectNode(getCell(grid,0,cpos.cellindex),true,true);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");break;case"mceTableMergeCells":var rows=new Array();var sel=inst.getSel();var grid=getTableGrid(tableElm);if(tinyMCE.isMSIE||sel.rangeCount==1){if(user_interface){var template=new Array();var sp=getColRowSpan(tdElm);template['file']='../../plugins/table/merge_cells.htm';template['width']=250;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_table_merge_cells_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_merge_cells_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:"update",numcols:sp.colspan,numrows:sp.rowspan});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=new Array();for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td;}}if(rowCells.length>0)rows[rows.length]=rowCells;}}}else{var cells=new Array();var sel=inst.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm;}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=new Array();for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td;}}}if(rowCells.length>0)rows[rows.length]=rowCells;}var curRow=new Array();var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y;}x2=x;y2=y;grid[y][x]._selected=true;}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true;}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true;}lastRowSpan=sd['rowspan'];}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true;}lastColSpan=sd['colspan'];}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","");if(chk!="<br/>"&&chk!="<br>"&&chk!="&nbsp;"&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}break;}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);tinyMCE.triggerNodeChange();inst.repaint();}return true;}return false;}};tinyMCE.addPlugin("table",TinyMCE_TablePlugin);
\ No newline at end of file
+tinyMCE.importPluginLanguagePack('table');var TinyMCE_TablePlugin={getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(tinyMCE.isGecko){var doc=inst.getDoc();tinyMCE.addEvent(doc,"mouseup",TinyMCE_TablePlugin._mouseDownHandler)}inst.tableRowClipboard=null},getControlHTML:function(control_name){var controls=new Array(['table','table.gif','lang_table_desc','mceInsertTable',true],['delete_table','table_delete.gif','lang_table_del','mceTableDelete'],['delete_col','table_delete_col.gif','lang_table_delete_col_desc','mceTableDeleteCol'],['delete_row','table_delete_row.gif','lang_table_delete_row_desc','mceTableDeleteRow'],['col_after','table_insert_col_after.gif','lang_table_col_after_desc','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','lang_table_col_before_desc','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','lang_table_row_after_desc','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','lang_table_row_before_desc','mceTableInsertRowBefore'],['row_props','table_row_props.gif','lang_table_row_desc','mceTableRowProps',true],['cell_props','table_cell_props.gif','lang_table_cell_desc','mceTableCellProps',true],['split_cells','table_split_cells.gif','lang_table_split_cells_desc','mceTableSplitCells',true],['merge_cells','table_merge_cells.gif','lang_table_merge_cells_desc','mceTableMergeCells',true]);for(var i=0;i<controls.length;i++){var but=controls[i];var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+');return false;';if(but[0]==control_name)return tinyMCE.getButtonHTML(control_name,but[2],'{$pluginurl}/images/'+but[1],but[3],(but.length>4?but[4]:false))}if(control_name=="tablecontrols"){var html="";html+=tinyMCE.getControlHTML("table");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_props");html+=tinyMCE.getControlHTML("cell_props");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_before");html+=tinyMCE.getControlHTML("row_after");html+=tinyMCE.getControlHTML("delete_row");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("col_before");html+=tinyMCE.getControlHTML("col_after");html+=tinyMCE.getControlHTML("delete_col");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("split_cells");html+=tinyMCE.getControlHTML("merge_cells");return html}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":var inst=tinyMCE.getInstanceById(editor_id);inst.execCommand('mceBeginUndoLevel');TinyMCE_TablePlugin._doExecCommand(editor_id,element,command,user_interface,value);inst.execCommand('mceEndUndoLevel');return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){var colspan="1",rowspan="1",tdElm;var inst=tinyMCE.getInstanceById(editor_id);tinyMCE.switchClass(editor_id+'_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_cell_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_split_cells','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonDisabled');if(tdElm=tinyMCE.getParentElement(node,"td,th")){tinyMCE.switchClass(editor_id+'_cell_props','mceButtonSelected');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonNormal');colspan=tinyMCE.getAttrib(tdElm,"colspan");rowspan=tinyMCE.getAttrib(tdElm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;if(colspan!="1"||rowspan!="1")tinyMCE.switchClass(editor_id+'_split_cells','mceButtonNormal')}if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClass(editor_id+'_row_props','mceButtonSelected');if(tinyMCE.getParentElement(node,"table")){tinyMCE.switchClass(editor_id+'_table','mceButtonSelected');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonNormal')}},_mouseDownHandler:function(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||focusElm.nodeName=="TH"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD")||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TH"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance)},10)}},_doExecCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var trElm=tinyMCE.getParentElement(focusElm,"tr");var tdElm=tinyMCE.getParentElement(focusElm,"td,th");var tableElm=tinyMCE.getParentElement(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true}return false}function makeTD(){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;"}function getColRowSpan(td){var colspan=tinyMCE.getAttrib(td,"colspan");var rowspan=tinyMCE.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan}}function getCellPos(grid,td){var x,y;for(y=0;y<grid.length;y++){for(x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y}}}return null}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null}function getTableGrid(table){var grid=new Array(),rows=table.rows,x,y,td,sd,xstart,x2,y2;for(y=0;y<rows.length;y++){for(x=0;x<rows[y].cells.length;x++){td=rows[y].cells[x];sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=new Array();for(x2=xstart;x2<xstart+sd['colspan'];x2++)grid[y2][x2]=td}}}return grid}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table),cpos=getCellPos(grid,td);var cells,lastElm;if(new_tr.cells.length!=tr.childNodes.length){cells=tr.childNodes;lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td}deleteMarked(tableElm)}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node}return null}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node}}return null}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td)}while((td=nexttd)!=null)}}while((tr=next)!=null)}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";if(tinyMCE.isMSIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR")}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=tinyMCE.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break}}}if(newTD==null){newTD=doc.createElement("td");newTD.innerHTML="&nbsp;"}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm}return newTR}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_rowprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_rowprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_cellprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_cellprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceInsertTable":if(user_interface){var template=new Array();template['file']='../../plugins/table/table.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:value})}return true;case"mceTableDelete":var table=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(table){table.parentNode.removeChild(table);inst.repaint()}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}trElm.parentNode.insertBefore(newTR,trElm);grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex+1,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR)}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD)}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true}lastTDElm=tdElm}}deleteMarked(tableElm);cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex+1),tinyMCE.isGecko,true);break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm)}lastTDElm=tdElm}}cpos.cellindex--;if(cpos.cellindex<0)cpos.cellindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan)}addRows(tdElm,trElm,rowspan)}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");break;case"mceTableMergeCells":var rows=new Array();var sel=inst.getSel();var grid=getTableGrid(tableElm);if(tinyMCE.isMSIE||sel.rangeCount==1){if(user_interface){var template=new Array();var sp=getColRowSpan(tdElm);template['file']='../../plugins/table/merge_cells.htm';template['width']=250;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_table_merge_cells_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_merge_cells_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:"update",numcols:sp.colspan,numrows:sp.rowspan});return true}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=new Array();for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td}}if(rowCells.length>0)rows[rows.length]=rowCells}}}else{var cells=new Array();var sel=inst.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=new Array();for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td}}}if(rowCells.length>0)rows[rows.length]=rowCells}var curRow=new Array();var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y}x2=x;y2=y;grid[y][x]._selected=true}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true}lastRowSpan=sd['rowspan']}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true}lastColSpan=sd['colspan']}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","");if(chk!="<br/>"&&chk!="<br>"&&chk!="&nbsp;"&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm}if(tdElm.rowSpan>1)tdElm.rowSpan--}}}}break}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);tinyMCE.triggerNodeChange();inst.repaint()}return true}return false}};tinyMCE.addPlugin("table",TinyMCE_TablePlugin);
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js 0.7.7/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,20 +1,18 @@
 /**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.10 $
- * $Date: 2006/05/06 03:05:15 $
+ * $Id: editor_plugin_src.js,v 1.11 2006/10/27 22:36:57 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
  */
 
 /* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('table', 'en,tr,ar,cs,da,de,el,es,fi,fr_ca,hu,it,ja,ko,nl,nb,pl,pt,pt_br,sv,tw,zh_cn,fr,de,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,cy,is,zh_tw,zh_tw_utf8,sk');
+tinyMCE.importPluginLanguagePack('table');
 
 var TinyMCE_TablePlugin = {
 	getInfo : function() {
 		return {
 			longname : 'Tables',
-			author : 'Moxiecode Systems',
+			author : 'Moxiecode Systems AB',
 			authorurl : 'http://tinymce.moxiecode.com',
 			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',
 			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
@@ -36,6 +34,7 @@
 	getControlHTML : function(control_name) {
 		var controls = new Array(
 			['table', 'table.gif', 'lang_table_desc', 'mceInsertTable', true],
+			['delete_table', 'table_delete.gif', 'lang_table_del', 'mceTableDelete'],
 			['delete_col', 'table_delete_col.gif', 'lang_table_delete_col_desc', 'mceTableDeleteCol'],
 			['delete_row', 'table_delete_row.gif', 'lang_table_delete_row_desc', 'mceTableDeleteRow'],
 			['col_after', 'table_insert_col_after.gif', 'lang_table_col_after_desc', 'mceTableInsertColAfter'],
@@ -118,12 +117,13 @@
 	},
 
 	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-		var colspan = "1", rowspan = "1";
+		var colspan = "1", rowspan = "1", tdElm;
 
 		var inst = tinyMCE.getInstanceById(editor_id);
 
 		// Reset table controls
 		tinyMCE.switchClass(editor_id + '_table', 'mceButtonNormal');
+		tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonDisabled');
 		tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonDisabled');
 		tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonDisabled');
 		tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonDisabled');
@@ -138,6 +138,7 @@
 		// Within a td element
 		if (tdElm = tinyMCE.getParentElement(node, "td,th")) {
 			tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonSelected');
+			tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonNormal');
 			tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonNormal');
 			tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonNormal');
 			tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonNormal');
@@ -228,8 +229,10 @@
 		}
 
 		function getCellPos(grid, td) {
-			for (var y=0; y<grid.length; y++) {
-				for (var x=0; x<grid[y].length; x++) {
+			var x, y;
+
+			for (y=0; y<grid.length; y++) {
+				for (x=0; x<grid[y].length; x++) {
 					if (grid[y][x] == td)
 						return {cellindex : x, rowindex : y};
 				}
@@ -246,25 +249,23 @@
 		}
 
 		function getTableGrid(table) {
-			var grid = new Array();
-			var rows = table.rows;
+			var grid = new Array(), rows = table.rows, x, y, td, sd, xstart, x2, y2;
 
-			for (var y=0; y<rows.length; y++) {
-				for (var x=0; x<rows[y].cells.length; x++) {
-					var td = rows[y].cells[x];
-					var sd = getColRowSpan(td);
+			for (y=0; y<rows.length; y++) {
+				for (x=0; x<rows[y].cells.length; x++) {
+					td = rows[y].cells[x];
+					sd = getColRowSpan(td);
 
 					// All ready filled
 					for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
 
 					// Fill box
-					for (var y2=y; y2<y+sd['rowspan']; y2++) {
+					for (y2=y; y2<y+sd['rowspan']; y2++) {
 						if (!grid[y2])
 							grid[y2] = new Array();
 
-						for (var x2=xstart; x2<xstart+sd['colspan']; x2++) {
+						for (x2=xstart; x2<xstart+sd['colspan']; x2++)
 							grid[y2][x2] = td;
-						}
 					}
 				}
 			}
@@ -273,13 +274,13 @@
 		}
 
 		function trimRow(table, tr, td, new_tr) {
-			var grid = getTableGrid(table);
-			var cpos = getCellPos(grid, td);
+			var grid = getTableGrid(table), cpos = getCellPos(grid, td);
+			var cells, lastElm;
 
 			// Time to crop away some
 			if (new_tr.cells.length != tr.childNodes.length) {
-				var cells = tr.childNodes;
-				var lastElm = null;
+				cells = tr.childNodes;
+				lastElm = null;
 
 				for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
 					var remove = true;
@@ -500,46 +501,11 @@
 				// Table has a tbody use that reference
 				// Changed logic by ApTest 2005.07.12 (www.aptest.com)
 				// Now lookk at the focused element and take its parentNode.  That will be a tbody or a table.
-				if (tableElm != trElm.parentNode)
+				if (trElm && tableElm != trElm.parentNode)
 					tableElm = trElm.parentNode;
 
 				if (tableElm && trElm) {
 					switch (command) {
-						case "mceTableInsertRowBefore":
-							if (!trElm || !tdElm)
-								return true;
-
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
-							var newTR = doc.createElement("tr");
-							var lastTDElm = null;
-
-							cpos.rowindex--;
-							if (cpos.rowindex < 0)
-								cpos.rowindex = 0;
-
-							// Create cells
-							for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
-
-									if (sd['rowspan'] == 1) {
-										var newTD = doc.createElement("td");
-
-										newTD.innerHTML = "&nbsp;";
-										newTD.colSpan = tdElm.colSpan;
-
-										newTR.appendChild(newTD);
-									} else
-										tdElm.rowSpan = sd['rowspan'] + 1;
-
-									lastTDElm = tdElm;
-								}
-							}
-
-							trElm.parentNode.insertBefore(newTR, trElm);
-						break;
-
 						case "mceTableCutRow":
 							if (!trElm || !tdElm)
 								return true;
@@ -584,6 +550,44 @@
 
 							break;
 
+						case "mceTableInsertRowBefore":
+							if (!trElm || !tdElm)
+								return true;
+
+							var grid = getTableGrid(tableElm);
+							var cpos = getCellPos(grid, tdElm);
+							var newTR = doc.createElement("tr");
+							var lastTDElm = null;
+
+							cpos.rowindex--;
+							if (cpos.rowindex < 0)
+								cpos.rowindex = 0;
+
+							// Create cells
+							for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+								if (tdElm != lastTDElm) {
+									var sd = getColRowSpan(tdElm);
+
+									if (sd['rowspan'] == 1) {
+										var newTD = doc.createElement("td");
+
+										newTD.innerHTML = "&nbsp;";
+										newTD.colSpan = tdElm.colSpan;
+
+										newTR.appendChild(newTD);
+									} else
+										tdElm.rowSpan = sd['rowspan'] + 1;
+
+									lastTDElm = tdElm;
+								}
+							}
+
+							trElm.parentNode.insertBefore(newTR, trElm);
+
+							grid = getTableGrid(tableElm);
+							inst.selection.selectNode(getCell(grid, cpos.rowindex + 1, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
+						break;
+
 						case "mceTableInsertRowAfter":
 							if (!trElm || !tdElm)
 								return true;
@@ -619,17 +623,21 @@
 								else
 									tableElm.appendChild(newTR);
 							}
+
+							grid = getTableGrid(tableElm);
+							inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
 						break;
 
 						case "mceTableDeleteRow":
 							if (!trElm || !tdElm)
 								return true;
-		
+
 							var grid = getTableGrid(tableElm);
 							var cpos = getCellPos(grid, tdElm);
 
 							// Only one row, remove whole table
 							if (grid.length == 1) {
+								tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
 								tableElm.parentNode.removeChild(tableElm);
 								return true;
 							}
@@ -678,7 +686,9 @@
 							if (cpos.rowindex < 0)
 								cpos.rowindex = 0;
 
-							inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), true, true);
+							// Recalculate grid and select
+							grid = getTableGrid(tableElm);
+							inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
 						break;
 
 						case "mceTableInsertColBefore":
@@ -706,6 +716,9 @@
 									lastTDElm = tdElm;
 								}
 							}
+
+							grid = getTableGrid(tableElm);
+							inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex + 1), tinyMCE.isGecko, true); // Only collape on gecko
 						break;
 
 						case "mceTableInsertColAfter":
@@ -737,6 +750,9 @@
 									lastTDElm = tdElm;
 								}
 							}
+
+							grid = getTableGrid(tableElm);
+							inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
 						break;
 
 						case "mceTableDeleteCol":
@@ -749,6 +765,7 @@
 
 							// Only one col, remove whole table
 							if (grid.length > 1 && grid[0].length <= 1) {
+								tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
 								tableElm.parentNode.removeChild(tableElm);
 								return true;
 							}
@@ -773,7 +790,9 @@
 							if (cpos.cellindex < 0)
 								cpos.cellindex = 0;
 
-							inst.selection.selectNode(getCell(grid, 0, cpos.cellindex), true, true);
+							// Recalculate grid and select
+							grid = getTableGrid(tableElm);
+							inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
 						break;
 
 					case "mceTableSplitCells":
Binary files 0.7.5/e107_handlers/tiny_mce/plugins/table/images/buttons.gif and 0.7.7/e107_handlers/tiny_mce/plugins/table/images/buttons.gif differ
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/table/jscripts/merge_cells.js 0.7.7/e107_handlers/tiny_mce/plugins/table/jscripts/merge_cells.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/table/jscripts/merge_cells.js	2005-12-23 18:09:57.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/table/jscripts/merge_cells.js	2006-10-27 17:36:57.000000000 -0500
@@ -11,6 +11,11 @@
 	var args = new Array();
 	var formObj = document.forms[0];
 
+	if (!AutoValidator.validate(formObj)) {
+		alert(tinyMCE.getLang('lang_invalid_data'));
+		return false;
+	}
+
 	args["numcols"] = formObj.numcols.value;
 	args["numrows"] = formObj.numrows.value;
 
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/table/jscripts/table.js 0.7.7/e107_handlers/tiny_mce/plugins/table/jscripts/table.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/table/jscripts/table.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/table/jscripts/table.js	2006-10-27 17:36:57.000000000 -0500
@@ -8,6 +8,11 @@
 	var elm = tinyMCE.tableElm;
 	var cellLimit, rowLimit, colLimit;
 
+	if (!AutoValidator.validate(formObj)) {
+		alert(tinyMCE.getLang('lang_invalid_data'));
+		return false;
+	}
+
 	tinyMCEPopup.restoreSelection();
 
 	// Get form data
@@ -180,7 +185,7 @@
 	document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
 	document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
 
-	var cols = 2, rows = 2, border = 0, cellpadding = "", cellspacing = "";
+	var cols = 2, rows = 2, border = tinyMCE.getParam('table_default_border', '0'), cellpadding = tinyMCE.getParam('table_default_cellpadding', ''), cellspacing = tinyMCE.getParam('table_default_cellspacing', '');
 	var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
 	var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "";
 	var inst = tinyMCE.selectedInstance;
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/table/merge_cells.htm 0.7.7/e107_handlers/tiny_mce/plugins/table/merge_cells.htm
--- 0.7.5/e107_handlers/tiny_mce/plugins/table/merge_cells.htm	2005-12-23 18:09:57.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/plugins/table/merge_cells.htm	2006-10-27 17:36:57.000000000 -0500
@@ -3,6 +3,7 @@
 	<title>{$lang_table_merge_cells_title}</title>
 	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
 	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
 	<script language="javascript" type="text/javascript" src="jscripts/merge_cells.js"></script>
 	<base target="_self" />
 </head>
@@ -13,12 +14,12 @@
 		  <table border="0" cellpadding="0" cellspacing="3" width="100%">
 			  <tr>
 				<td>{$lang_table_cols}:</td>
-				<td align="right"><input type="text" name="numcols" value="" style="width: 30px" /></td>
+				<td align="right"><input type="text" name="numcols" value="" class="number min1" style="width: 30px" /></td>
 				<td>
 			  </tr>
 			  <tr>
 				<td>{$lang_table_rows}:</td>
-				<td align="right"><input type="text" name="numrows" value="" style="width: 30px" /></td>
+				<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
 			  </tr>
 		  </table>
 	</fieldset>
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/table/table.htm 0.7.7/e107_handlers/tiny_mce/plugins/table/table.htm
--- 0.7.5/e107_handlers/tiny_mce/plugins/table/table.htm	2006-04-16 02:02:35.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/table/table.htm	2006-10-27 17:36:57.000000000 -0500
@@ -4,6 +4,7 @@
 	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
 	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
 	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
 	<script language="javascript" type="text/javascript" src="jscripts/table.js"></script>
 	<link href="css/table.css" rel="stylesheet" type="text/css" />
 	<base target="_self" />
@@ -25,15 +26,15 @@
 					  <table border="0" cellpadding="4" cellspacing="0" width="100%">
 							  <tr>
 								<td><label id="colslabel" for="cols">{$lang_table_cols}</label></td>
-								<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" /></td>
+								<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
 								<td><label id="rowslabel" for="rows">{$lang_table_rows}</label></td>
-								<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" /></td>
+								<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
 							  </tr>
 							  <tr>
 								<td><label id="cellpaddinglabel" for="cellpadding">{$lang_table_cellpadding}</label></td>
-								<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" /></td>
+								<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
 								<td><label id="cellspacinglabel" for="cellspacing">{$lang_table_cellspacing}</label></td>
-								<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" /></td>
+								<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
 							  </tr>
 							  <tr>
 								<td><label id="alignlabel" for="align">{$lang_table_align}</label></td>
@@ -44,13 +45,13 @@
 									<option value="right">{$lang_table_align_right}</option>
 								  </select></td>
 								<td><label id="borderlabel" for="border">{$lang_table_border}</label></td>
-								<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" /></td>
+								<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
 							  </tr>
-							  <tr>
+							  <tr id="width_row">
 								<td><label id="widthlabel" for="width">{$lang_table_width}</label></td>
-								<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+								<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
 								<td><label id="heightlabel" for="height">{$lang_table_height}</label></td>
-								<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
+								<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
 							  </tr>
 							  <tr id="styleSelectRow">
 								<td><label id="classlabel" for="class">{$lang_class_name}</label></td>
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/zoom/editor_plugin.js 0.7.7/e107_handlers/tiny_mce/plugins/zoom/editor_plugin.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/zoom/editor_plugin.js	2006-05-06 21:50:09.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/zoom/editor_plugin.js	2006-10-27 17:36:57.000000000 -0500
@@ -1 +1 @@
-var TinyMCE_ZoomPlugin={getInfo:function(){return{longname:'Zoom',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_zoom.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},getControlHTML:function(control_name){if(!tinyMCE.isMSIE||tinyMCE.isMSIE5_0||tinyMCE.isOpera)return"";switch(control_name){case"zoom":return'<select id="{$editor_id}_zoomSelect" name="{$editor_id}_zoomSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceZoom\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+'<option value="100%">+ 100%</option>'+'<option value="150%">+ 150%</option>'+'<option value="200%">+ 200%</option>'+'<option value="250%">+ 250%</option>'+'</select>';}return"";},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceZoom":tinyMCE.getInstanceById(editor_id).contentDocument.body.style.zoom=value;tinyMCE.getInstanceById(editor_id).contentDocument.body.style.mozZoom=value;return true;}return false;}};tinyMCE.addPlugin("zoom",TinyMCE_ZoomPlugin);
\ No newline at end of file
+var TinyMCE_ZoomPlugin={getInfo:function(){return{longname:'Zoom',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_zoom.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(control_name){if(!tinyMCE.isMSIE||tinyMCE.isMSIE5_0||tinyMCE.isOpera)return"";switch(control_name){case"zoom":return'<select id="{$editor_id}_zoomSelect" name="{$editor_id}_zoomSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceZoom\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+'<option value="100%">+ 100%</option>'+'<option value="150%">+ 150%</option>'+'<option value="200%">+ 200%</option>'+'<option value="250%">+ 250%</option>'+'</select>'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceZoom":tinyMCE.getInstanceById(editor_id).contentDocument.body.style.zoom=value;tinyMCE.getInstanceById(editor_id).contentDocument.body.style.mozZoom=value;return true}return false}};tinyMCE.addPlugin("zoom",TinyMCE_ZoomPlugin);
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/plugins/zoom/editor_plugin_src.js 0.7.7/e107_handlers/tiny_mce/plugins/zoom/editor_plugin_src.js
--- 0.7.5/e107_handlers/tiny_mce/plugins/zoom/editor_plugin_src.js	2006-05-06 21:50:09.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/plugins/zoom/editor_plugin_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.1 $
- * $Date: 2006/05/07 02:50:09 $
+ * $Id: editor_plugin_src.js,v 1.2 2006/10/27 22:36:57 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
@@ -11,7 +9,7 @@
 	getInfo : function() {
 		return {
 			longname : 'Zoom',
-			author : 'Moxiecode Systems',
+			author : 'Moxiecode Systems AB',
 			authorurl : 'http://tinymce.moxiecode.com',
 			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_zoom.html',
 			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/css/editor_popup.css 0.7.7/e107_handlers/tiny_mce/themes/advanced/css/editor_popup.css
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/css/editor_popup.css	2006-03-02 23:07:12.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/css/editor_popup.css	2006-10-27 17:36:57.000000000 -0500
@@ -312,6 +312,10 @@
 	height: 190px;
 }
 
+label.msg { display: none; }
+label.invalid { color: #EE0000; display: inline; }
+input.invalid { border: 1px solid #EE0000; }
+
 /* Disables the advanced tab in the table plugin. */
 /*
 #table #advanced_tab {
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/css/editor_ui.css 0.7.7/e107_handlers/tiny_mce/themes/advanced/css/editor_ui.css
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/css/editor_ui.css	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/css/editor_ui.css	2006-10-27 17:36:57.000000000 -0500
@@ -1,353 +1,97 @@
 /* This file contains the CSS data for the editor UI of TinyMCE instances */
 
-.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
-	border: 0; margin: 0; padding: 0; background: transparent;
-}
-
-.mceSeparatorLine {
-	border: 0;
-	padding: 0;
-	margin-left: 4px;
-	margin-right: 2px;
-}
-
-.mceSelectList {
-	font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
-	font-size: 7pt !important;
-	font-weight: normal;
-	margin-top: 3px;
-	padding: 0;
-	display: inline;
-	vertical-align: top;
-	background-color: #F0F0EE;
-}
-
-.mceLabel, .mceLabelDisabled {
-	font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
-	font-size: 9pt;
-}
-
-.mceLabel {
-	color: #000000;
-}
-
-.mceLabelDisabled {
-	cursor: text;
-	color: #999999;
-}
-
-.mceEditor {
-	background: #F0F0EE;
-	border: 1px solid #cccccc;
-	padding: 0;
-	margin: 0;
-}
-
-.mceEditorArea {
-	font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
-	background: #FFFFFF;
-	padding: 0;
-	margin: 0;
-}
-
-.mceToolbarTop, .mceToolbarBottom {
-	background: #F0F0EE;
-	line-height: 1px;
-	font-size: 1px;
-}
-
-.mceToolbarTop {
-	border-bottom: 1px solid #cccccc;
-	padding-bottom: 1px;
-}
-
-.mceToolbarBottom {
-	border-top: 1px solid #cccccc;
-}
-
-.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {
-	height: 20px;
-}
-
-.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {
-	font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
-	font-size: 9pt;
-	padding: 2px;
-	line-height: 16px;
-	overflow: visible;
-}
-
-.mceStatusbarTop {
-	border-bottom: 1px solid #cccccc;
-}
-
-.mceStatusbarBottom {
-	border-top: 1px solid #cccccc;
-}
-
-.mceStatusbar {
-	border-bottom: 1px solid #cccccc;
-}
-
-.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {
-	text-decoration: none;
-	font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
-	font-size: 9pt;
-	color: #000000;
-}
-
-.mcePathItem:hover {
-	text-decoration: underline;
-}
-
-.mceStatusbarPathText {
-	float: left;
-}
-
-.mceStatusbarResize {
-	float: right;
-	background-image: url('../images/statusbar_resize.gif');
-	background-repeat: no-repeat;
-	width: 11px;
-	height: 20px;
-	cursor: se-resize;
-}
-
-.mceResizeBox {
-	width: 10px;
-	height: 10px;
-	display: none;
-	border: 1px dotted gray;
-	margin: 0;
-	padding: 0;
-}
-
-.mceEditorIframe {
-	border: 0;
-}
+.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0;  margin: 0;  padding: 0;  background: transparent;}
+.mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;}
+.mceSelectList {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 7pt !important; font-weight: normal; margin-top: 3px; padding: 0; display: inline; vertical-align: top; background-color: #F0F0EE;}
+.mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;}
+.mceLabel {color: #000000;}
+.mceLabelDisabled {cursor: text;  color: #999999;}
+.mceEditor {background: #F0F0EE;  border: 1px solid #cccccc;  padding: 0;  margin: 0;}
+.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;  background: #FFFFFF;  padding: 0;  margin: 0;  }
+.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE;  line-height: 1px;  font-size: 1px;}
+.mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;}
+.mceToolbarBottom {border-top: 1px solid #cccccc;}
+.mceToolbarContainer {position: relative;  left: 0;  top: 0;  display: block;}
+.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;}
+.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;  font-size: 9pt;  padding: 2px;  line-height: 16px;  overflow: visible;}
+.mceStatusbarTop {border-bottom: 1px solid #cccccc;}
+.mceStatusbarBottom {border-top: 1px solid #cccccc;}
+.mceStatusbar {border-bottom: 1px solid #cccccc;}
+.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none;  font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;  font-size: 9pt;  color: #000000;}
+.mcePathItem:hover {text-decoration: underline;}
+.mceStatusbarPathText {float: left;}
+.mceStatusbarResize {float: right;  background-image: url('../images/statusbar_resize.gif');  background-repeat: no-repeat;  width: 11px;  height: 20px;  cursor: se-resize;}
+.mceResizeBox {width: 10px;  height: 10px;  display: none;  border: 1px dotted gray;  margin: 0;  padding: 0;}
+.mceEditorIframe {border: 0;}
 
 /* Button CSS rules */
 
-a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {
-	width: 20px;
-	height: 20px;
-	cursor: default;
-	margin-top: 1px;
-	margin-left: 1px;
-}
-
-a.mceButtonDisabled img {
-	border: 0 !important;
-}
-
-a.mceButtonNormal img, a.mceButtonSelected img {
-	border: 1px solid #F0F0EE !important;
-}
-
-a.mceButtonSelected img {
-	border: 1px solid #6779AA !important;
-	background-color: #D4D5D8;
-}
-
-a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {
-	border: 1px solid #0A246A !important;
-	cursor: default;
-	background-color: #B6BDD2;
-}
-
-a.mceButtonDisabled img {
-	-moz-opacity:0.3;
-	opacity: 0.3;
-	border: 1px solid #F0F0EE !important;
-	cursor: default;
-}
-
-a.mceTiledButton img {
-	background-image: url('../images/buttons.gif');
-	background-repeat: no-repeat;
-}
-
-/* MSIE specific rules */
-
-* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {
-	border: 0 !important;
-	margin-top: 2px;
-	margin-bottom: 1px;
-}
-
-* html a.mceButtonDisabled img {
-	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
-	border: 0 !important;
-}
-
-* html a.mceButtonDisabled {
-	border: 1px solid #F0F0EE !important;
-}
-
-* html a.mceButtonNormal, * html a.mceButtonSelected {
-	border: 1px solid #F0F0EE !important;
-	cursor: default;
-}
-
-* html a.mceButtonSelected {
-	border: 1px solid #6779AA !important;
-	background-color: #D4D5D8;
-}
-
-* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {
-	border: 1px solid #0A246A !important;
-	cursor: default;
-	background-color: #B6BDD2;
-}
-
-* html .mceSelectList {
-	margin-top: 2px;
-}
+a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px;  height: 20px;  cursor: default;  margin-top: 1px;  margin-left: 1px;}
+a.mceButtonDisabled img {border: 0 !important;}
+a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;}
+a.mceButtonSelected img {border: 1px solid #6779AA !important;  background-color: #D4D5D8;}
+a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important;  cursor: default;  background-color: #B6BDD2;}
+a.mceButtonDisabled img {-moz-opacity:0.3;  opacity: 0.3;  border: 1px solid #F0F0EE !important;  cursor: default;}
+a.mceTiledButton img {background-image: url('../images/buttons.gif');  background-repeat: no-repeat;}
 
 /* Menu button CSS rules */
 
-span.mceMenuButton img, span.mceMenuButtonSelected img {
-	border: 1px solid #F0F0EE;
-	margin-left: 1px;
-}
-
-span.mceMenuButtonSelected img {
-	border: 1px solid #6779AA;
-	background-color: #B6BDD2;
-}
-
-span.mceMenuButtonSelected img.mceMenuButton {
-	border: 1px solid #F0F0EE;
-	background-color: transparent;
-}
-
-span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {
-	border-left: 0;
-	margin-left: 0;
-}
-
-span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {
-	border: 1px solid #0A246A;
-	background-color: #B6BDD2;
-}
-
-span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {
-	border-left: 0;
-}
-
-span.mceMenuButtonFocus img {
-	border: 1px solid gray;
-	border-right: 0;
-	margin-left: 1px;
-	background-color: #F5F4F2;
-}
-
-span.mceMenuButtonFocus img.mceMenuButton {
-	border: 1px solid gray;
-	border-left: 1px solid #F5F4F2;
-	margin-left: 0;
-}
-
-/* Menu button MSIE specific rules */
-
-* html span.mceMenuButton, * html span.mceMenuButtonFocus {
-	position: relative;
-	left: 0;
-	top: 0;
-}
-
-* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {
-	position: relative;
-	top: 1px;
-}
-
-* html span.mceMenuHover img {
-	border: 1px solid #0A246A;
-	background-color: #B6BDD2;
-}
-
-* html span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {
-	border: 1px solid #0A246A;
-	background-color: #B6BDD2;
-	border-left: 0;
-}
+span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE;  margin-left: 1px;}
+span.mceMenuButtonSelected img {border: 1px solid #6779AA;  background-color: #B6BDD2;}
+span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE;  background-color: transparent;}
+span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0;  margin-left: 0;}
+span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A;  background-color: #B6BDD2;}
+span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;}
+span.mceMenuButtonFocus img {border: 1px solid gray;  border-right: 0;  margin-left: 1px;  background-color: #F5F4F2;}
+span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray;  border-left: 1px solid #F5F4F2;  margin-left: 0;}
+span.mceMenuHover img {border: 1px solid #0A246A;  background-color: #B6BDD2;}
+span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A;  background-color: #B6BDD2;  border-left: 0;}
 
 /* Menu */
 
-.mceMenu {
-	position: absolute;
-	left: 0;
-	top: 0;
-	display: none;
-	z-index: 100;
-	background-color: white;
-	border: 1px solid gray;
-	font-weight: normal;
-}
-
-.mceMenu a, .mceMenuTitle, .mceMenuDisabled {
-	display: block;
-	width: 100%;
-	text-decoration: none;
-	background-color: white;
-	font-family: Tahoma, Verdana, Arial, Helvetica;
-	font-size: 11px;
-	line-height: 20px;
-	color: black;
-}
-
-.mceMenu a:hover {
-	background-color: #B6BDD2;
-	color: black;
-	text-decoration: none !important;
-}
-
-.mceMenu span {
-	padding-left: 10px;
-	padding-right: 10px;
-	display: block;
-	line-height: 20px;
-}
-
-.mceMenuSeparator {
-	border-bottom: 1px solid gray;
-	background-color: gray;
-	height: 1px;
-}
-
-.mceMenuTitle span {
-	padding-left: 5px;
-}
-
-.mceMenuTitle {
-	background-color: #DDDDDD;
-	font-weight: bold;
-}
-
-.mceMenuDisabled {
-	color: gray;
-}
-
-span.mceMenuSelectedItem {
-	background-image: url('../images/menu_check.gif');
-	background-repeat: no-repeat;
-	background-position: 5px 8px;
-	padding-left: 20px;
-}
-
-span.mceMenuCheckItem {
-	padding-left: 20px;
-}
-
-span.mceMenuLine {
-	display: block;
-	position: absolute;
-	left: 0;
-	top: -1px;
-	background-color: #F5F4F2;
-	width: 30px;
-	height: 1px;
-	overflow: hidden;
-	padding-left: 0;
-	padding-right: 0;
-}
+.mceMenu {position: absolute;  left: 0;  top: 0;  display: none;  z-index: 100;  background-color: white;  border: 1px solid gray;  font-weight: normal;}
+.mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block;  width: 100%;  text-decoration: none;  background-color: white;  font-family: Tahoma, Verdana, Arial, Helvetica;  font-size: 11px;  line-height: 20px;  color: black;}
+.mceMenu a:hover {background-color: #B6BDD2;  color: black;  text-decoration: none !important;}
+.mceMenu span {padding-left: 10px;  padding-right: 10px;  display: block;  line-height: 20px;}
+.mceMenuSeparator {border-bottom: 1px solid gray;  background-color: gray;  height: 1px;}
+.mceMenuTitle span {padding-left: 5px;}
+.mceMenuTitle {background-color: #DDDDDD;  font-weight: bold;}
+.mceMenuDisabled {color: gray;}
+span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif');  background-repeat: no-repeat;  background-position: 5px 8px;  padding-left: 20px;}
+span.mceMenuCheckItem {padding-left: 20px;}
+span.mceMenuLine {display: block;  position: absolute;  left: 0;  top: -1px;  background-color: #F5F4F2;  width: 30px;  height: 1px;  overflow: hidden;  padding-left: 0;  padding-right: 0;}
+.mceColors table, .mceColors td {margin: 0;  padding: 2px;}
+a.mceMoreColors {width: 130px;  margin: 0;  padding: 0;  margin-left: 3px;  margin-bottom: 3px;  text-align: center;  border: 1px solid white;}
+.mceColorPreview {position: absolute;  left: 0;  top: 0;  margin-left: 3px;  margin-top: 15px;  width: 16px;  height: 4px;  background-color: red;}
+a.mceMoreColors:hover {border: 1px solid #0A246A;}
+.mceColors td a {width: 9px;  height: 9px;  overflow: hidden;  border: 1px solid #808080;}
+
+/* MSIE 6 specific rules */
+
+* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important;  margin-top: 2px;  margin-bottom: 1px;}
+* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);  border: 0 !important;}
+* html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
+* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important;  cursor: default;}
+* html a.mceButtonSelected {border: 1px solid #6779AA !important;  background-color: #D4D5D8;}
+* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important;  background-color: #B6BDD2;  cursor: default;}
+* html .mceSelectList {margin-top: 2px;}
+* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative;  left: 0;  top: 0;}
+* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative;  top: 1px;}
+* html a.mceMoreColors {width: 132px;}
+* html .mceColors td a {width: 10px;  height: 10px;}
+* html .mceColorPreview {margin-left: 2px;  margin-top: 14px;}
+
+/* MSIE 7 specific rules */
+
+*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important;  margin-top: 2px;  margin-bottom: 1px;}
+*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);  border: 0 !important;}
+*:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;}
+*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important;  cursor: default;}
+*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important;  background-color: #D4D5D8;}
+*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important;  background-color: #B6BDD2;  cursor: default;}
+*:first-child+html .mceSelectList {margin-top: 2px;}
+*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative;  left: 0;  top: 0;}
+*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative;  top: 1px;}
+*:first-child+html a.mceMoreColors {width: 132px;}
+*:first-child+html .mceColors td a {width: 10px;  height: 10px;}
+*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px;  margin-top: 14px; width: 14px;}
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/editor_template.js 0.7.7/e107_handlers/tiny_mce/themes/advanced/editor_template.js
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/editor_template.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/editor_template.js	2006-10-27 17:36:57.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','bullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lang_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','mceForeColor',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','mceBackColor',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells',getControlHTML:function(button_name){var i,x;for(i=0;i<TinyMCE_AdvancedTheme._buttons.length;i++){var but=TinyMCE_AdvancedTheme._buttons[i];if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null));}switch(button_name){case"formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0])html+='<option value="&lt;'+lookup[x][0]+'&gt;">'+lookup[x][1]+'</option>';}}html+='</select>';return html;case"styleselect":return'<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case"fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>';}}fontHTML+='</select>';return fontHTML;case"fontsizeselect":return'<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+'<option value="0">{$lang_theme_font_size}</option>'+'<option value="1">1 (8 pt)</option>'+'<option value="2">2 (10 pt)</option>'+'<option value="3">3 (12 pt)</option>'+'<option value="4">4 (14 pt)</option>'+'<option value="5">5 (18 pt)</option>'+'<option value="6">6 (24 pt)</option>'+'<option value="7">7 (36 pt)</option>'+'</select>';case"|":case"separator":return'<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';case"spacer":return'<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case"rowseparator":return'<br />';}return"";},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");}action="update";}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"});}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");}action="update";}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"mceForeColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=tinyMCE.getAttrib(elm,"color");if(inputColor=='')inputColor=elm.style.color;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case"mceBackColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=elm.style.backgroundColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case"mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();');}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true;}return false;},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true;}}if(!skip){outArray[outArray.length]=in_array[i];}}return outArray;}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i];}return in_array;}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>';}TinyMCE_AdvancedTheme._autoImportCSSClasses=false;}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"';if(!tinyMCE.getParam("accessibility_focus"))toolbarHTML+=' onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"';toolbarHTML+='></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23;}}toolbarHTML+='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap">'+toolbarHTML+'</td></tr>';}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1">'+toolbarHTML+'</td></tr>';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null;}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='</tbody></table>';break;case"RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor")template['html']+='<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j<curContainer.length;j++){curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);}if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23;}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>';}}template['html']+='</tbody></table>';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;}if(resizing)template['html']+='<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true));}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink');},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true;}if(ov==value){select_elm.selectedIndex=i;return true;}}}return false;};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";};if(node==null)return;var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(pathElm){var parentNode=node;var path=new Array();while(parentNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break;}if(parentNode.nodeType==1&&tinyMCE.getAttrib(parentNode,"class").indexOf('mceItemHidden')==-1){path[path.length]=parentNode;}parentNode=parentNode.parentNode;}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+st+" ";}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+face+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+size+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+color+" ";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+src+" ";}if(getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+href+" ";}if(nodeName=="img"&&tinyMCE.getAttrib(path[i],"class").indexOf('mceItemFlash')!=-1){nodeName="flash";nodeData="src: "+path[i].getAttribute('title');}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className;}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; ";}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&#160;';}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal');}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled');}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break;}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index;}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");else selectByValue(selectElm,"");}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="");}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"");}else selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size);}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break;}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"");}else selectByValue(selectElm,"0");}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align'))continue;switch(alignNode.getAttribute('align').toLowerCase()){case"left":tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case"right":tinyMCE.switchClass(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case"middle":case"center":tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case"justify":tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(inst.queryCommandState(ar[i]))tinyMCE.switchClass(editor_id+ar[i+1],'mceButtonSelected');}if(inst.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A"))tinyMCE.switchClass(editor_id+'_underline','mceButtonSelected');}do{switch(node.nodeName){case"UL":tinyMCE.switchClass(editor_id+'_bullist','mceButtonSelected');break;case"OL":tinyMCE.switchClass(editor_id+'_numlist','mceButtonSelected');break;case"HR":tinyMCE.switchClass(editor_id+'_hr','mceButtonSelected');break;case"IMG":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClass(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode)!=null);},_setupCSSClasses:function(editor_id){var i,selectElm;if(!TinyMCE_AdvancedTheme._autoImportCSSClasses)return;selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(i=0;i<csses.length;i++)selectElm.options[selectElm.options.length]=new Option(csses[i],csses[i]);}if(csses!=null&&csses.length>0)selectElm.setAttribute('cssImported','true');}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie;},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end));},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0;}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2;}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2;}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px";}}},_resizeEventHandler:function(e){var resizer=TinyMCE_AdvancedTheme._resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case"mousemove":var w,h;w=resizer.width+dx;h=resizer.height+dy;w=w<1?1:w;h=h<1?1:h;if(resizer.horizontal)resizeBox.style.width=w+"px";resizeBox.style.height=h+"px";break;case"mouseup":TinyMCE_AdvancedTheme._setResizing(e,editorId,false);TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires);}break;}},_setResizing:function(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_AdvancedTheme._resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_AdvancedTheme._resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE&&!tinyMCE.isOpera?"block":"table";tinyMCE.execCommand('mceResetDesignMode');}},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!tinyMCE.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!tinyMCE.imgElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="'+tinyMCE.uniqueURL+'" />');else tinyMCE.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL);}}if(tinyMCE.imgElement){var needsRepaint=false;var msrc=src;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(tinyMCE.getParam('convert_urls'))msrc=src;if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=tinyMCE.imgElement.getAttribute("width")||height!=tinyMCE.imgElement.getAttribute("height")||align!=tinyMCE.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(tinyMCE.imgElement,'src',src);tinyMCE.setAttrib(tinyMCE.imgElement,'mce_src',msrc);tinyMCE.setAttrib(tinyMCE.imgElement,'alt',alt);tinyMCE.setAttrib(tinyMCE.imgElement,'title',title);tinyMCE.setAttrib(tinyMCE.imgElement,'align',align);tinyMCE.setAttrib(tinyMCE.imgElement,'border',border,true);tinyMCE.setAttrib(tinyMCE.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'width',width,true);tinyMCE.setAttrib(tinyMCE.imgElement,'height',height,true);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseout',onmouseout);if(width&&width!="")tinyMCE.imgElement.style.pixelWidth=width;if(height&&height!="")tinyMCE.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}tinyMCE.execCommand('mceEndUndoLevel');},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement);}return;}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+tinyMCE.selectedInstance.selection.getSelectedHTML()+'</a>');}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(elementArray[i],'href',thref);tinyMCE.setAttrib(elementArray[i],'mce_href',mhref);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class);}tinyMCE.linkElement=elementArray[0];}if(tinyMCE.linkElement){var mhref=href;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(tinyMCE.linkElement,'href',href);tinyMCE.setAttrib(tinyMCE.linkElement,'mce_href',mhref);tinyMCE.setAttrib(tinyMCE.linkElement,'target',target);tinyMCE.setAttrib(tinyMCE.linkElement,'title',title);tinyMCE.setAttrib(tinyMCE.linkElement,'onclick',onclick);tinyMCE.setAttrib(tinyMCE.linkElement,'class',style_class);}tinyMCE.execCommand('mceEndUndoLevel');}};tinyMCE.addTheme("advanced",TinyMCE_AdvancedTheme);tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
\ No newline at end of file
+tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','bullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lang_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','forecolor',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i<TinyMCE_AdvancedTheme._buttons.length;i++){but=TinyMCE_AdvancedTheme._buttons[i];if(but[0]==button_name&&(button_name=="forecolor"||button_name=="backcolor"))return tinyMCE.getMenuButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3]+"Menu",but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0])html+='<option value="&lt;'+lookup[x][0]+'&gt;">'+lookup[x][1]+'</option>'}}html+='</select>';return html;case"styleselect":return'<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case"fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>'}}fontHTML+='</select>';return fontHTML;case"fontsizeselect":return'<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+'<option value="0">{$lang_theme_font_size}</option>'+'<option value="1">1 (8 pt)</option>'+'<option value="2">2 (10 pt)</option>'+'<option value="3">3 (12 pt)</option>'+'<option value="4">4 (14 pt)</option>'+'<option value="5">5 (18 pt)</option>'+'<option value="6">6 (24 pt)</option>'+'<option value="7">7 (36 pt)</option>'+'</select>';case"|":case"separator":return'<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';case"spacer":return'<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case"rowseparator":return'<br />'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h)}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout'])}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor})}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array(),skip;for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true}}if(!skip){outArray[outArray.length]=in_array[i]}}return outArray}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i]}return in_array}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>'}TinyMCE_AdvancedTheme._autoImportCSSClasses=false}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"';if(!tinyMCE.getParam("accessibility_focus"))toolbarHTML+=' onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"';toolbarHTML+='></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23}}toolbarHTML+='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>'}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>'}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='</tbody></table>';break;case"RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor")template['html']+='<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom"}else if(i==0){pathClass="mceStatusbar"}else{deltaHeight-=2}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j<curContainer.length;j++)curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>'}}template['html']+='</tbody></table>';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_Layer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true}if(ov==value){select_elm.selectedIndex=i;return true}}}return false};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""};if(node==null)return;var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();TinyMCE_AdvancedTheme._hideMenus(editor_id);if(pathElm){var parentNode=node;var path=new Array();while(parentNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break}if(parentNode.nodeType==1&&tinyMCE.getAttrib(parentNode,"class").indexOf('mceItemHidden')==-1){path[path.length]=parentNode}parentNode=parentNode.parentNode}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+st+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+face+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+size+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+color+" "}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+src+" "}if(path[i].nodeName=='A'&&getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+href+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i].getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData=""}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; "}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&#160;'}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");else selectByValue(selectElm,"")}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"")}else selectByValue(selectElm,"0")}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align'))continue;switch(alignNode.getAttribute('align').toLowerCase()){case"left":tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case"right":tinyMCE.switchClass(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case"middle":case"center":tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case"justify":tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(inst.queryCommandState(ar[i]))tinyMCE.switchClass(editor_id+ar[i+1],'mceButtonSelected')}if(inst.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A"))tinyMCE.switchClass(editor_id+'_underline','mceButtonSelected')}do{switch(node.nodeName){case"UL":tinyMCE.switchClass(editor_id+'_bullist','mceButtonSelected');break;case"OL":tinyMCE.switchClass(editor_id+'_numlist','mceButtonSelected');break;case"HR":tinyMCE.switchClass(editor_id+'_hr','mceButtonSelected');break;case"IMG":if(getAttrib(node,'name').indexOf('mce_')!=0&&tinyMCE.getAttrib(node,'class').indexOf('mceItem')==-1){tinyMCE.switchClass(editor_id+'_image','mceButtonSelected')}break}}while((node=node.parentNode)!=null)},_setupCSSClasses:function(editor_id){var i,selectElm;if(!TinyMCE_AdvancedTheme._autoImportCSSClasses)return;selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(i=0;i<csses.length;i++)selectElm.options[selectElm.options.length]=new Option(csses[i],csses[i])}if(csses!=null&&csses.length>0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px"}}inst.useCSS=false},_resizeEventHandler:function(e){var resizer=TinyMCE_AdvancedTheme._resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case"mousemove":var w,h;w=resizer.width+dx;h=resizer.height+dy;w=w<1?1:w;h=h<1?1:h;if(resizer.horizontal)resizeBox.style.width=w+"px";resizeBox.style.height=h+"px";break;case"mouseup":TinyMCE_AdvancedTheme._setResizing(e,editorId,false);TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires)}break}},_setResizing:function(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_AdvancedTheme._resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_AdvancedTheme._resizeEventHandler);resizer.eventHandlers=true}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true)}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE&&!tinyMCE.isOpera?"block":"table";tinyMCE.execCommand('mceResetDesignMode')}},_getColorHTML:function(id,n,cm){var i,h,cl;h='<span class="mceMenuLine"></span>';cl=tinyMCE.getParam(n,TinyMCE_AdvancedTheme._defColors).split(',');h+='<table class="mceColors"><tr>';for(i=0;i<cl.length;i++){c='tinyMCE.execInstanceCommand(\''+id+'\', \''+cm+'\', false, \'#'+cl[i]+'\');';h+='<td><a href="javascript:'+c+'" style="background-color: #'+cl[i]+'" onclick="'+c+';return false;"></a></td>';if((i+1)%8==0)h+='</tr><tr>'}h+='</tr></table>';return h},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!tinyMCE.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html)}else{if(!tinyMCE.imgElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="'+tinyMCE.uniqueURL+'" />');else tinyMCE.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL)}}if(tinyMCE.imgElement){var needsRepaint=false;var msrc=src;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(tinyMCE.getParam('convert_urls'))msrc=src;if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=tinyMCE.imgElement.getAttribute("width")||height!=tinyMCE.imgElement.getAttribute("height")||align!=tinyMCE.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(tinyMCE.imgElement,'src',src);tinyMCE.setAttrib(tinyMCE.imgElement,'mce_src',msrc);tinyMCE.setAttrib(tinyMCE.imgElement,'alt',alt);tinyMCE.setAttrib(tinyMCE.imgElement,'title',title);tinyMCE.setAttrib(tinyMCE.imgElement,'align',align);tinyMCE.setAttrib(tinyMCE.imgElement,'border',border,true);tinyMCE.setAttrib(tinyMCE.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'width',width,true);tinyMCE.setAttrib(tinyMCE.imgElement,'height',height,true);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseout',onmouseout);if(width&&width!="")tinyMCE.imgElement.style.pixelWidth=width;if(height&&height!="")tinyMCE.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint()}tinyMCE.execCommand('mceEndUndoLevel')},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+tinyMCE.selectedInstance.selection.getSelectedHTML()+'</a>')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(elementArray[i],'href',thref);tinyMCE.setAttrib(elementArray[i],'mce_href',mhref);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class)}tinyMCE.linkElement=elementArray[0]}if(tinyMCE.linkElement){var mhref=href;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(tinyMCE.linkElement,'href',href);tinyMCE.setAttrib(tinyMCE.linkElement,'mce_href',mhref);tinyMCE.setAttrib(tinyMCE.linkElement,'target',target);tinyMCE.setAttrib(tinyMCE.linkElement,'title',title);tinyMCE.setAttrib(tinyMCE.linkElement,'onclick',onclick);tinyMCE.setAttrib(tinyMCE.linkElement,'class',style_class)}tinyMCE.execCommand('mceEndUndoLevel')}};tinyMCE.addTheme("advanced",TinyMCE_AdvancedTheme);tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js 0.7.7/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: editor_template_src.js,v $
- * $Revision: 1.12 $
- * $Date: 2006/05/06 03:05:15 $
+ * $Id: editor_template_src.js,v 1.13 2006/10/27 22:36:57 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
@@ -12,6 +10,7 @@
 
 var TinyMCE_AdvancedTheme = {
 	// Private theme fields
+	_defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",
 	_autoImportCSSClasses : true,
 	_resizer : {},
 	_buttons : [
@@ -43,25 +42,28 @@
 		['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
 		['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
 		['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
-		['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'mceForeColor', true],
-		['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'mceBackColor', true],
+		['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
+		['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
 		['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
 		['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
 		['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
 		['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
 	],
 
-	_buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells',
+	_buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',
 
 	/**
 	 * Returns HTML code for the specificed control.
 	 */
 	getControlHTML : function(button_name) {
-		var i, x;
+		var i, x, but;
 
 		// Lookup button in button list
 		for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) {
-			var but = TinyMCE_AdvancedTheme._buttons[i];
+			but = TinyMCE_AdvancedTheme._buttons[i];
+
+			if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor"))
+				return tinyMCE.getMenuButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3] + "Menu", but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
 
 			if (but[0] == button_name)
 				return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
@@ -153,6 +155,18 @@
 	 */
 	execCommand : function(editor_id, element, command, user_interface, value) {
 		switch (command) {
+			case 'mceHelp':
+				tinyMCE.openWindow({
+					file : 'about.htm',
+					width : 480,
+					height : 380
+				}, {
+					tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
+					tinymce_releasedate : tinyMCE.releaseDate,
+					inline : "yes"
+				});
+			return true;
+
 			case "mceLink":
 				var inst = tinyMCE.getInstanceById(editor_id);
 				var doc = inst.getDoc();
@@ -317,41 +331,94 @@
 
 				return true;
 
-			case "mceForeColor":
-				var template = new Array();
-				var elm = tinyMCE.selectedInstance.getFocusElement();
-				var inputColor = tinyMCE.getAttrib(elm, "color");
+			case "forecolor":
+				var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm;
+
+				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+				if (!fcp.exists()) {
+					fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
+					elm = fcp.getElement();
+					elm._editor_id = editor_id;
+					elm._command = "forecolor";
+					elm._switchId = editor_id + "_forecolor";
+					tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
+					tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
+					tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+				}
+
+				img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0];
+				p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+
+				fcp.moveTo(p.absLeft, p.absTop);
+				fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor;
+				fcp.show();
+
+				return false;
+
+			case "forecolorMenu":
+				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+				// Create color layer
+				var ml = new TinyMCE_Layer(editor_id + '_fcMenu');
 
-				if (inputColor == '')
-					inputColor = elm.style.color;
+				if (!ml.exists())
+					ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor'));
 
-				if (!inputColor)
-					inputColor = "#000000";
+				tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus');
+				ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl');
 
-				template['file'] = 'color_picker.htm';
-				template['width'] = 220;
-				template['height'] = 190;
+				ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
+				if (tinyMCE.isOpera)
+					ml.moveBy(0, -2);
+
+				ml.show();
 			return true;
 
-			case "mceBackColor":
-				var template = new Array();
-				var elm = tinyMCE.selectedInstance.getFocusElement();
-				var inputColor = elm.style.backgroundColor;
+			case "HiliteColor":
+				var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img;
+
+				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+				if (!bcp.exists()) {
+					bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
+					elm = bcp.getElement();
+					elm._editor_id = editor_id;
+					elm._command = "HiliteColor";
+					elm._switchId = editor_id + "_backcolor";
+					tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
+					tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
+					tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+				}
+
+				img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0];
+				p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+
+				bcp.moveTo(p.absLeft, p.absTop);
+				bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor;
+				bcp.show();
+
+				return false;
+
+			case "HiliteColorMenu":
+				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+
+				// Create color layer
+				var ml = new TinyMCE_Layer(editor_id + '_bcMenu');
+
+				if (!ml.exists())
+					ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor'));
 
-				if (!inputColor)
-					inputColor = "#000000";
+				tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus');
+				ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl');
 
-				template['file'] = 'color_picker.htm';
-				template['width'] = 220;
-				template['height'] = 190;
+				ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
 
-				template['width'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height', 0);
+				if (tinyMCE.isOpera)
+					ml.moveBy(0, -2);
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
-				//mceBackColor
+				ml.show();
 			return true;
 
 			case "mceColorPicker":
@@ -433,7 +500,7 @@
 	 */
 	getEditorTemplate : function(settings, editorId) {
 		function removeFromArray(in_array, remove_array) {
-			var outArray = new Array();
+			var outArray = new Array(), skip;
 			
 			for (var i=0; i<in_array.length; i++) {
 				skip = false;
@@ -530,10 +597,10 @@
 				toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
 
 				// Setup template html
-				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
+				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
 
 				if (toolbarLocation == "top") {
-					template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap">' + toolbarHTML + '</td></tr>';
+					template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
 				}
 
 				if (statusbarLocation == "top") {
@@ -544,7 +611,7 @@
 				template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
 
 				if (toolbarLocation == "bottom") {
-					template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1">' + toolbarHTML + '</td></tr>';
+					template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
 				}
 
 				// External toolbar changes
@@ -615,9 +682,10 @@
 						var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
 						var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
 
-						for (var j=0; j<curContainer.length; j++) {
+						curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
+
+						for (var j=0; j<curContainer.length; j++)
 							curContainerHTML += tinyMCE.getControlHTML(curContainer[j]);
-						}
 
 						if (curContainer.length > 0) {
 							curContainerHTML += "<br />";
@@ -664,10 +732,34 @@
 		inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
 	},
 
+	_handleMenuEvent : function(e) {
+		var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
+		tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
+
+		if (e.type == "click")
+			tinyMCE.execInstanceCommand(te._editor_id, te._command);
+	},
+
+	_hideMenus : function(id) {
+		var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu');
+
+		if (fcml.exists() && fcml.isVisible()) {
+			tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton');
+			fcml.hide();
+		}
+
+		if (bcml.exists() && bcml.isVisible()) {
+			tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton');
+			bcml.hide();
+		}
+	},
+
 	/**
 	 * Node change handler.
 	 */
 	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
+		var alignNode, breakOut, classNode;
+
 		function selectByValue(select_elm, value, first_index) {
 			first_index = typeof(first_index) == "undefined" ? false : true;
 
@@ -702,6 +794,7 @@
 		var pathElm = document.getElementById(editor_id + "_path");
 		var inst = tinyMCE.getInstanceById(editor_id);
 		var doc = inst.getDoc();
+		TinyMCE_AdvancedTheme._hideMenus(editor_id);
 
 		if (pathElm) {
 			// Get node path
@@ -727,6 +820,9 @@
 				var nodeName = path[i].nodeName.toLowerCase();
 				var nodeData = "";
 
+				if (nodeName.indexOf("html:") == 0)
+					nodeName = nodeName.substring(5);
+
 				if (nodeName == "b") {
 					nodeName = "strong";
 				}
@@ -781,7 +877,7 @@
 					nodeData += "src: " + src + " ";
 				}
 
-				if (getAttrib(path[i], 'href') != "") {
+				if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") {
 					var href = tinyMCE.getAttrib(path[i], "mce_href");
 
 					if (href == "")
@@ -790,9 +886,10 @@
 					nodeData += "href: " + href + " ";
 				}
 
-				if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
-					nodeName = "flash";
-					nodeData = "src: " + path[i].getAttribute('title');
+				className = tinyMCE.getAttrib(path[i], "class");
+				if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) {
+					nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase();
+					nodeData = path[i].getAttribute('title');
 				}
 
 				if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
@@ -1027,7 +1124,7 @@
 				break;
 
 				case "IMG":
-				if (getAttrib(node, 'name').indexOf('mce_') != 0) {
+				if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
 					tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
 				}
 				break;
@@ -1148,6 +1245,9 @@
 				inst.iframeElement.style.width = (iw + dx) + "px";
 			}
 		}
+
+		// Remove pesky table controls
+		inst.useCSS = false;
 	},
 
 	/**
@@ -1255,6 +1355,29 @@
 		}
 	},
 
+	_getColorHTML : function(id, n, cm) {
+		var i, h, cl;
+
+		h = '<span class="mceMenuLine"></span>';
+		cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(',');
+
+		h += '<table class="mceColors"><tr>';
+		for (i=0; i<cl.length; i++) {
+			c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');';
+			h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>';
+
+			if ((i+1) % 8 == 0)
+				h += '</tr><tr>';
+		}
+
+		h += '</tr></table>';
+		/*
+		h += '<a href="" class="mceMoreColors">More colors</a>';
+		*/
+
+		return h;
+	},
+
 	_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
 		tinyMCE.execCommand('mceBeginUndoLevel');
 
Binary files 0.7.5/e107_handlers/tiny_mce/themes/advanced/images/backcolor.gif and 0.7.7/e107_handlers/tiny_mce/themes/advanced/images/backcolor.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/themes/advanced/images/buttons.gif and 0.7.7/e107_handlers/tiny_mce/themes/advanced/images/buttons.gif differ
Binary files 0.7.5/e107_handlers/tiny_mce/themes/advanced/images/forecolor.gif and 0.7.7/e107_handlers/tiny_mce/themes/advanced/images/forecolor.gif differ
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/jscripts/source_editor.js 0.7.7/e107_handlers/tiny_mce/themes/advanced/jscripts/source_editor.js
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/jscripts/source_editor.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/jscripts/source_editor.js	2006-10-27 17:36:57.000000000 -0500
@@ -3,29 +3,25 @@
 	tinyMCE.closeWindow(window);
 }
 
-// Fixes some charcode issues
-function fixContent(html) {
-/*	html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
-	html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
-	html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
-	html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
-	return html;
-}
-
 function onLoadInit() {
 	tinyMCEPopup.resizeToInnerSize();
 
-	document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
+	// Remove Gecko spellchecking
+	if (tinyMCE.isGecko)
+		document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
+	document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'));
+
 	resizeInputs();
 
 	if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
 		setWrap('soft');
-		document.forms[0].wraped.checked = true;
+		document.getElementById('wraped').checked = true;
 	}
 }
 
 function setWrap(val) {
-	var s = document.forms[0].htmlSource;
+	var s = document.getElementById('htmlSource');
 
 	s.wrap = val;
 
@@ -48,6 +44,8 @@
 var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
 
 function resizeInputs() {
+	var el = document.getElementById('htmlSource');
+
 	if (!tinyMCE.isMSIE) {
 		 wHeight = self.innerHeight-80;
 		 wWidth = self.innerWidth-16;
@@ -56,11 +54,7 @@
 		 wWidth = document.body.clientWidth - 16;
 	}
 
-	document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
-	document.forms[0].htmlSource.style.width  = Math.abs(wWidth) + 'px';
+	el.style.height = Math.abs(wHeight) + 'px';
+	el.style.width  = Math.abs(wWidth) + 'px';
 }
 
-function renderWordWrap() {
-	if (tinyMCE.isMSIE || tinyMCE.isGecko)
-		document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');
-}
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/langs/en.js 0.7.7/e107_handlers/tiny_mce/themes/advanced/langs/en.js
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/langs/en.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/langs/en.js	2006-10-27 17:36:57.000000000 -0500
@@ -77,5 +77,6 @@
 help : 'Help',
 not_set : '-- Not set --',
 close : 'Close',
-toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'
+toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
+invalid_data : 'Error: Invalid values entered, these are marked in red.'
 });
diff -ruN 0.7.5/e107_handlers/tiny_mce/themes/advanced/source_editor.htm 0.7.7/e107_handlers/tiny_mce/themes/advanced/source_editor.htm
--- 0.7.5/e107_handlers/tiny_mce/themes/advanced/source_editor.htm	2006-03-02 23:07:12.000000000 -0600
+++ 0.7.7/e107_handlers/tiny_mce/themes/advanced/source_editor.htm	2006-10-27 17:36:57.000000000 -0500
@@ -10,10 +10,12 @@
 	<form name="source" onsubmit="saveContent();" action="#">
 		<div style="float: left" class="title">{$lang_theme_code_title}</div>
 
-		<div style="float: right">
-			<script language="javascript" type="text/javascript">renderWordWrap();</script>
+		<div id="wrapline" style="float: right">
+			<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>
 		</div>
 
+		<br style="clear: both" />
+
 		<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px" dir="ltr" wrap="off"></textarea>
 
 		<div class="mceActionPanel">
diff -ruN 0.7.5/e107_handlers/tiny_mce/tiny_mce.js 0.7.7/e107_handlers/tiny_mce/tiny_mce.js
--- 0.7.5/e107_handlers/tiny_mce/tiny_mce.js	2006-05-05 22:05:14.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/tiny_mce.js	2006-10-27 17:36:57.000000000 -0500
@@ -1 +1 @@
-function TinyMCE_Engine(){this.majorVersion="2";this.minorVersion="0.6.1";this.releaseDate="2006-05-04";this.instances=new Array();this.switchClassCache=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.pendingFiles=new Array();this.loadingIndex=0;this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();var ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=new Array();this.themes=new Array();this.menus=new Array();this.loadedPlugins=new Array();this.buttonMap=new Array();this.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false;}this.idCounter=0;};TinyMCE_Engine.prototype={init:function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';tinyMCE.baseURL=src;break;}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL;}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings['language']);this._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("debug",false);this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",false);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",'');if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;if(this.isOpera&&this.settings['browsers'].indexOf('opera')==-1)return;var baseHREF=tinyMCE.settings['document_base_url'];var h=document.location.href;var p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings['document_base_url']=baseHREF;tinyMCE.settings['document_base_prefix']=h;}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.blockRegExp=new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dt|dd|dir|fieldset|form|noscript|noframes|menu|isindex|samp)$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='javascript:TINYMCE_UNIQUEURL();';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=new Array('onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup');this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isMSIE)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath;}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath;}else this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css";if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg);}if(this.configs.length==0){if(this.isSafari&&this.getParam('safari_warning',false))alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isMSIE&&!tinyMCE.isOpera){if(document.body)tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad);}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents();}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(var i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js');}}settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)settings['cleanup_entities']['c'+entities[i]]=entities[i+1];settings['index']=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();},_addUnloadEvents:function(){if(tinyMCE.isMSIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler);}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v;},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null;},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript();},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u};},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substring(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js");},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null;},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript();},addMenu:function(n,m){this.menus[n]=m;},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null;},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url;},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xhtml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se);}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0;var skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){ignore_css=false;if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break;}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le);}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x];}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',');var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm);}else doc.createStyleSheet(css_file);}}},confirmAdd:function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings['convert_on_click']||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm'])))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');},updateContent:function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid);}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document);},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(editor_id);if(inst){inst.switchSettings();editor_id=inst.editorId;var html=tinyMCE.getContent(editor_id);var tmpInstances=new Array();for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;if(instanceName!=editor_id)tmpInstances[instanceName]=instance;}tinyMCE.instances=tmpInstances;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var replaceElement=document.getElementById(editor_id+"_parent");var oldTargetElement=inst.oldTargetElement;var targetName=oldTargetElement.nodeName.toLowerCase();if(targetName=="textarea"||targetName=="input"){replaceElement.parentNode.removeChild(replaceElement);oldTargetElement.style.display="inline";oldTargetElement.value=html;}else{oldTargetElement.innerHTML=html;oldTargetElement.style.display='block';replaceElement.parentNode.insertBefore(oldTargetElement,replaceElement);replaceElement.parentNode.removeChild(replaceElement);}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip_cleanup,skip_callback);}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent;}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id);if(inst){if(typeof(focus)=="undefined")focus=true;if(focus)inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();this.selectedInstance=inst;tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isMSIE&&window.event!=null)tinyMCE.cancelEvent(window.event);}},execCommand:function(command,user_interface,value){user_interface=user_interface?user_interface:false;value=value?value:null;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return;case'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.contentWindow.focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'],value['document']),value['element'],value['document']);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case"mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance){this.selectedInstance.execCommand(command,user_interface,value);}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert']);},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=aw<0?300:aw;aw=aw+"px";}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=ah<0?240:ah;ah=ah+"px";}iframe.setAttribute("id",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isMSIE&&!tinyMCE.isOpera)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isMSIE&&!tinyMCE.isOpera)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return win.frames[id];else return iframe;},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;/g,'"');content=content.replace(/&amp;/g,'&');}inst.switchSettings();if(!tinyMCE.isMSIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm";}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return;}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return;}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo');}if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline');}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getDoc().body.setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isMSIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings['base_href']);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi");}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])doc.styleSheets[0].addRule("p","margin: 0;");var body=inst.getBody();body.editorId=editor_id;}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else{content=tinyMCE.regexpReplace(content,"<strong","<b","gi");content=tinyMCE.regexpReplace(content,"<em(/?)>","<i$1>","gi");content=tinyMCE.regexpReplace(content,"<em ","<i ","gi");content=tinyMCE.regexpReplace(content,"</strong>","</b>","gi");content=tinyMCE.regexpReplace(content,"</em>","</i>","gi");tinyMCE.setInnerHTML(inst.getBody(),content);}tinyMCE.convertAllRelativeURLs(inst.getBody());}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}var parentElm=inst.targetDoc.getElementById(inst.editorId+'_parent');inst.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.dispatchCallback(inst,'setupcontent_callback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isMSIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch);}}tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.add({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");n.nodeValue=n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");}return false;});}tinyMCE._removeInternal(inst.getBody());tinyMCE.selectedInstance=inst;tinyMCE.triggerNodeChange(false,true);},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"');}return s;},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");n.nodeValue=n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");}return false;});}},removeTinyMCEFormElements:function(form_obj){if(typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form");}if(form_obj==null)return;for(var i=0;i<form_obj.elements.length;i++){var elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true;}},handleEvent:function(e){var inst=tinyMCE.selectedInstance;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.setBaseHREF(null);if(tinyMCE.isMSIE&&!tinyMCE.isOpera){var ife=tinyMCE.selectedInstance.iframeElement;if(ife.style.height.indexOf('%')!=-1){ife._oldHeight=ife.style.height;ife.style.height=ife.clientHeight;}}window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();",1);return;case"submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case"reset":var formObj=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10);}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.cancelEvent(e);return false;}}if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.cancelEvent(e);return false;}}if(tinyMCE.isMSIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isMSIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isMSIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;";}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break;}}if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false);}}}if(e.keyCode==17)return true;if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping");if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isMSIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case"mousedown":case"mouseup":case"click":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true;}var targetBody=tinyMCE.getParentElement(e.target,"body");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody()==targetBody){tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break;}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark)tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.selection.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];return false;break;}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x;cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isMSIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" title="{$'+lang+'}" />';h+='</a>';}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" />';h+='</a>';}return h;},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i;},submitPatch:function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.mceOldSubmit();tinyMCE.isNotDirty=true;},onLoad:function(){if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return;}if(tinyMCE.isMSIE&&!tinyMCE.isOpera&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch;}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case"exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(tinyMCE.getAttrib(element,"class").indexOf(deselector)!=-1)continue;if(trigger=="false")continue;if((tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click'])&&element){elementRefAr[elementRefAr.length]=element;continue;}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i]);}break;case"specific_textareas":case"textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&tinyMCE.getAttrib(elm,"class").indexOf(selector)==-1)continue;if(selector!='')trigger=selector!=""?"true":"";if(tinyMCE.getAttrib(elm,"class").indexOf(deselector)!=-1)continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm;}break;}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings);},10);});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings);},10);});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings);});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings);});}}else tinyMCE.addMCEControl(element,elementId);}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus();},10);}tinyMCE.dispatchCallback(null,'oninit','onInit');}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control;},getParam:function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i];}value=outArray;}return value;},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n]);}return v;},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return e.innerHTML;},addToLang:function(prefix,ar){for(var key in ar){if(typeof(ar[key])=='function')continue;tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key];}this.loadNextScript();},triggerNodeChange:function(focus,setup_content){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1;var undoLevels=-1;var anySelection=false;var selectedText=inst.selection.getSelectedText();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length;}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content);}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();},_customCleanup:function(inst,type,content){var pl,po,i;var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst);}return content;},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint();}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js');},importPluginLanguagePack:function(name,valid_languages){var lang="en",b=tinyMCE.baseURL+'/plugins/'+name;valid_languages=valid_languages.split(',');for(var i=0;i<valid_languages.length;i++){if(tinyMCE.settings['language']==valid_languages[i])lang=tinyMCE.settings['language'];}if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+lang+'.js');},applyTemplate:function(h,as){var i,s,ar=h.match(new RegExp('\\{\\$[a-z0-9_]+\\}','gi'));if(ar&&ar.length>0){for(i=ar.length-1;i>=0;i--){s=ar[i].substring(2,ar[i].length-1);if(s.indexOf('lang_')==0&&tinyMCELang[s])h=tinyMCE.replaceVar(h,s,tinyMCELang[s]);else if(as&&as[s])h=tinyMCE.replaceVar(h,s,as[s]);else if(tinyMCE.settings[s])h=tinyMCE.replaceVar(h,s,tinyMCE.settings[s]);}}h=tinyMCE.replaceVar(h,"themeurl",tinyMCE.themeURL);return h;},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v);},openWindow:function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args['mce_template_file']=template['file'];args['mce_width']=template['width'];args['mce_height']=template['height'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;if(tinyMCE.isMSIE)height+=40;else height+=20;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]));}if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus();}else{if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){height+=10;var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features);}else{var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template['close_previous']!="no")try{tinyMCE.lastWindow.close();}catch(ex){}var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return;}if(template['close_previous']!="no")tinyMCE.lastWindow=win;eval('try { win.resizeTo(width, height); } catch(e) { }');if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24);}win.focus();}}},closeWindow:function(win){win.close();},getVisualAidClass:function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i];}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i];}return className;},handleVisualAid:function(el,deep,state,inst,skip_dispatch){if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);var tableElement=null;switch(el.nodeName){case"TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y<el.rows.length;y++){for(var x=0;x<el.rows[y].cells.length;x++){var cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn);}}break;case"A":var anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!=''&&state){el.title=anchorName;el.className='mceItemAnchor';}else if(anchorName!=''&&!state)el.className='';break;}if(deep&&el.hasChildNodes()){for(var i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true);}},fixGeckoBaseHREFBug:function(m,e,h){var nl,i,a,n,xsrc,xhref,el;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");return h;}else{el=new Array('a','img','select','area','iframe','base','input','script','embed','object','link');for(a=0;a<el.length;a++){n=e.getElementsByTagName(el[a]);for(i=0;i<n.length;i++){xsrc=tinyMCE.getAttrib(n[i],"mce_tsrc");xhref=tinyMCE.getAttrib(n[i],"mce_thref");if(xsrc!=""){try{n[i].src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xsrc);}catch(e){}n[i].removeAttribute("mce_tsrc");}if(xhref!=""){try{n[i].href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xhref);}catch(e){}n[i].removeAttribute("mce_thref");}}}el=tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=");}return false;});}}return h;},_setHTML:function(doc,html_content){html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content);}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML;}}var html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html);}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId;},getInstanceById:function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var n in tinyMCE.instances){var instance=tinyMCE.instances[n];if(!tinyMCE.isInstance(instance))continue;if(instance.formTargetElementId==editor_id){inst=instance;break;}}}return inst;},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false;},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null;},setWindowArg:function(n,v){this.windowArgs[n]=v;},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n];},getCSSClasses:function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;break;}doc=instance.getDoc();}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc();}if(doc){var styles=doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets("+x+").rules : styles["+x+"].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){var rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')!=-1)continue;if(rule.indexOf(tinyMCE.settings['visual_table_class'])!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){var cssClass=rule.substring(rule.indexOf('.')+1);var addClass=true;for(var p=0;p<output.length&&addClass;p++){if(output[p]==cssClass)addClass=false;}if(addClass)output[output.length]=cssClass;}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output;},regexpReplace:function(in_str,reg_exp,replace_str,opts){if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);},trim:function(s){return s.replace(/^\s*|\s*$/g,"");},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s;},getControlHTML:function(c){var i,l,n,o,v;l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!='')return tinyMCE.replaceVar(v,"pluginurl",o.baseURL);}o=tinyMCE.themes[tinyMCE.settings['theme']];if(o.getControlHTML&&(v=o.getControlHTML(c))!='')return v;return'';},evalFunc:function(f,idx,a){var s='(',i;for(i=idx;i<a.length;i++){s+='a['+i+']';if(i<a.length-1)s+=',';}s+=');';return eval("f"+s);},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments);},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments);},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments);},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!=''&&(v=tinyMCE.evalFunc(typeof(l)=="function"?l:eval(l),3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(o[n],3,a))==s&&m>0)return true;}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(o[n],3,a))==s&&m>0)return true;}return false;},xmlEncode:function(s){s=""+s;s=s.replace(/&/g,'&amp;');s=s.replace(new RegExp('"','g'),'&quot;');s=s.replace(/\'/g,'&#39;');s=s.replace(/</g,'&lt;');s=s.replace(/>/g,'&gt;');return s;},extend:function(p,np){var o={};o.parent=p;for(n in p)o[n]=p[n];for(n in np)o[n]=np[n];return o;},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null;}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null;}},explode:function(d,s){var ar=s.split(d),oar=new Array(),i;for(i=0;i<ar.length;i++){if(ar[i]!="")oar[oar.length]=ar[i];}return oar;}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,to,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.settings=s;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=new Array();this.hasMouseMoved=false;this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,url_converter:'TinyMCE_Cleanup.prototype._urlConverter',indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication});t=this.settings['theme'];if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;to={};for(i=0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))to[fn[i]]=fu;}tinyMCE.addTheme(t,to);}this.plugins=new Array();p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;to={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))to[fn[x]]=fu;}tinyMCE.addPlugin(pn,to);}this.plugins[this.plugins.length]=pn;}}};TinyMCE_Control.prototype={hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true;}return false;},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n;}},repaint:function(){if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return;try{var s=this.selection;var b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,null);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b);}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}},getBody:function(){return this.getDoc().body;},getDoc:function(){return this.contentWindow.document;},getWin:function(){return this.contentWindow;},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isMSIE,c,sc,i;var scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false;}}scl[scl.length]=sc;return true;},handleShortcut:function(e){var i,s=this.shortcuts,o;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true;}}return false;},autoResetDesignMode:function(){if(!tinyMCE.isMSIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; } catch(e) {}');},isHidden:function(){if(tinyMCE.isMSIE)return false;var s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},isDirty:function(){return this.startContent!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty;},_mergeElements:function(scmd,pa,ch,override){if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return;}var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className+=" "+tinyMCE.getAttrib(ch,"class");if(override){for(var n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n];}}else{for(var n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n];}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style");},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b);}catch(ex){}try{d.execCommand("styleWithCSS",false,b);}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false");}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false");}catch(ex){}},execCommand:function(command,user_interface,value){var doc=this.getDoc();var win=this.getWin();var focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(this.lastSafariSelection&&!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command)){this.selection.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return;if(focusElm&&focusElm.nodeName=="IMG"){var align=focusElm.getAttribute('align');var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.removeAttribute('align');var div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);}else{var div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm);}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break;}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return;}}}switch(command){case"mceRepaint":this.repaint();return true;case"InsertUnorderedList":case"InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"><li>&nbsp;</li><"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<strike>"+this.selection.getSelectedHTML()+"</strike>");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm);}else{if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isMSIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b);}else this.getDoc().execCommand("FormatBlock",false,value);}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value']==null?'':value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings['merge_styles_invalid_parents']!=''?new RegExp(tinyMCE.settings['merge_styles_invalid_parents'],"gi"):null;if(tinyMCE.isMSIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm;}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm;}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','');}var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','');}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','');}if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true));}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','');}}}}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue;}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false);}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(var x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm);}elm.parentNode.removeChild(elm);}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,false);}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r);}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":if(tinyMCE.isGecko){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(false);}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);tinyMCE._setHTML(doc,value);tinyMCE.setInnerHTML(doc.body,tinyMCE._cleanupHTML(this,doc,tinyMCE.settings,doc.body));tinyMCE.convertAllRelativeURLs(doc.body);tinyMCE._removeInternal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(doc.body,true,this.visualAid,this);tinyMCE._setEventsEnabled(doc.body,false);return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case"mceSetCSSClass":this.execCommand("SetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getDoc().body.scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getDoc().body.scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;this.getWin().focus();if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2);}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value);}}catch(ex){insertHTMLFailed=true;}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return;}}if(tinyMCE.isOpera&&insertHTMLFailed){this.getDoc().execCommand("insertimage",false,tinyMCE.uniqueURL);var ar=tinyMCE.getElementsByAttributeValue(this.getBody(),"img","src",tinyMCE.uniqueURL);ar[0].outerHTML=value;return;}if(!tinyMCE.isMSIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value);}else value=rng.createContextualFragment(value);}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value);}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true;}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true;}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node);}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng);}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value);}else{var rng=doc.selection.createRange();var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e);}}tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex==-1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;this.execCommand('mceAddUndoLevel');}break;case"mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1;}break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedoLevel){if(this.undoRedo.add())tinyMCE.triggerNodeChange(false);}break;case"Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isMSIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style");}}while(n!=null&&(n=n.parentNode)!=null);}break;case"removeformat":var text=this.selection.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return;}if(tinyMCE.isMSIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);}catch(e){}this.execCommand("SetStyleInfo",false,{command:"removeformat"});}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("SetStyleInfo",false,{command:"removeformat"});}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange();}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel");},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c);}catch(e){return null;}},queryCommandState:function(c){return this.getDoc().queryCommandState(c);},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,to,editorTemplate;th=this.settings['theme'];to=tinyMCE.themes[th];var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}if(to.getEditorTemplate)editorTemplate=to.getEditorTemplate(this.settings,this.editorId);var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate['html'];html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;if(tinyMCE.settings['debug']){hc='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>';}else{hc='<input type="hidden" id="'+form_element_name+'" name="'+form_element_name+'" />';this.oldTargetElement.style.display="none";}html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true;}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;}this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings['base_href']+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);tinyMCE.setupContent(this.editorId,true);return true;},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b);}else{if(u==""||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u);}},getFocusElement:function(){return this.selection.getFocusElement();},getSel:function(){return this.selection.getSel();},getRng:function(){return this.selection.getRng();},triggerSave:function(skip_cleanup,skip_callback){var e,nl=new Array(),i,s;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isMSIE&&!tinyMCE.isOpera){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'};}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'};}}while((e=e.parentNode)!=null)}tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings['cleanup']==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true);}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);var htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(this.formTargetElementId,htm,this.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if(tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class;}}};TinyMCE_Engine.prototype.cleanupHTMLCode=function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','gi'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isMSIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.getParam('convert_urls'))s=s.replace(new RegExp('(href=\"{0,1})(\\s*#)','gi'),'$1'+tinyMCE.settings['document_base_url']+"#");return s;};TinyMCE_Engine.prototype.parseStyle=function(str){var ar=new Array();if(str==null)return ar;var st=str.split(';');tinyMCE.clearArray(ar);for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1];}return ar;};TinyMCE_Engine.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return;}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null;};TinyMCE_Engine.prototype.serializeStyle=function(ar){var str="";tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(var key in ar){var val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){var m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')";}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);if(val!="url('')")str+=key.toLowerCase()+": "+val+"; ";}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str;};TinyMCE_Engine.prototype.convertRGBToHex=function(s,k){if(s.toLowerCase().indexOf('rgb')!=-1){var re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");var rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4];}}return s;};TinyMCE_Engine.prototype.convertHexToRGB=function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")";}return s;};TinyMCE_Engine.prototype.convertSpansToFonts=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<span/gi,'<font');h=h.replace(/<\/span/gi,'</font');doc.body.innerHTML=h;var s=doc.getElementsByTagName("font");for(var i=0;i<s.length;i++){var size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();var fSize=0;for(var x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break;}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize='';}var fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!=""){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily='';}var fColor=s[i].style.color;if(fColor!=null&&fColor!=""){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color='';}}};TinyMCE_Engine.prototype.convertFontsToSpans=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<font/gi,'<span');h=h.replace(/<\/font/gi,'</span');doc.body.innerHTML=h;var fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;var s=doc.getElementsByTagName("span");for(var i=0;i<s.length;i++){var fSize,fFace,fColor;fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!=""){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1];}s[i].removeAttribute('size');}if(fFace!=""){s[i].style.fontFamily=fFace;s[i].removeAttribute('face');}if(fColor!=""){s[i].style.color=fColor;s[i].removeAttribute('color');}}};TinyMCE_Engine.prototype.cleanupAnchors=function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!=""&&tinyMCE.getAttrib(an[i],"href")==""){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i]);}}};TinyMCE_Engine.prototype.getContent=function(editor_id){var h;if(typeof(editor_id)!="undefined")tinyMCE.selectedInstance=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedInstance){h=tinyMCE._cleanupHTML(this.selectedInstance,this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(this.selectedInstance.getDoc());return h;}return null;};TinyMCE_Engine.prototype._fixListElements=function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.prevNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild);}else np.appendChild(n);}}}};TinyMCE_Engine.prototype._fixTables=function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,div,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p);}}};TinyMCE_Engine.prototype._cleanupHTML=function(inst,doc,config,elm,visual,on_save,on_submit){var h,d,t1,t2,t3,t4,t5,c,s;if(!tinyMCE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=new Array();c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm);else h=c.serializeNodeAsHTML(elm);if(d)t3=new Date().getTime();h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>&nbsp;</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>&nbsp;</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>&nbsp;</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>&nbsp;</p>');h=h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>&nbsp;</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>&nbsp;</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>';}if(tinyMCE.isGecko){h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>&nbsp;</td>');}if(s.force_br_newlines)h=h.replace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'');}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on_submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h;};function TinyMCE_Cleanup(){this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray(new Array());this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray(new Array());this.vElementsRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|BUTTON|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'};}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayToRe(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');if(s.invalid_elements!='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this.inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements='';}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0;},addRuleStr:function(s){var r=this.parseRuleStr(s);var n;for(n in r){if(r[n])this.rules[n]=r[n];}this.vElements=tinyMCE.clearArray(new Array());for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag;}this.vElementsRe=this._arrayToRe(this.vElements,'');},parseRuleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray(new Array()),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r.tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].charAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray(new Array());r.forceAttribs[t.toLowerCase()]=av[0].substring(1);}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray(new Array());dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==""?"mce_empty":dv;}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray(new Array());r.validAttribValues[t.toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'');}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase();}r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray(new Array());r.vAttribsReIsWild=false;}or[r.tag]=r;}}return or;},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(this.isMSIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument');}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom');}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.");}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDoc.appendChild(b);this._convertToXML(n,b);if(this.isMSIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc);},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue);}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode(""));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return;}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn);}},serializeNodeAsHTML:function(n){var en,no,h='',i,l,r,cn,va=false,f=false,at,hc;this._setupRules();if(this._isDuplicate(n))return'';switch(n.nodeType){case 1:hc=n.hasChildNodes();if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&n.nodeName.indexOf('/')!=-1)break;if(this.vElementsRe.test(n.nodeName)&&(!this.iveRe||!this.iveRe.test(n.nodeName))){va=true;r=this.rules[n.nodeName];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(n.nodeName)){r=at[no];break;}}}en=r.isWild?n.nodeName.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";h+='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))h+=this._serializeAttribute(n,r,no.nodeName);}}else{for(i=r.vAttribs.length-1;i>-1;i--)h+=this._serializeAttribute(n,r,r.vAttribs[i]);}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])h+=this._serializeAttribute(n,r,at[no]);}}if(this.closeElementsRe.test(n.nodeName))return h+' />';h+='>';if(this.isMSIE&&this.codeElementsRe.test(n.nodeName))h+=n.innerHTML;}break;case 3:if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isMSIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:return"<!--"+this._trimComment(n.nodeValue)+"-->";}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i]);}if(f&&!hc)h+=this.fillStr;if(va)h+='</'+en+'>';return h;},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""';}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&this.settings.url_converter.length!=0&&/^(src|href|longdesc)$/.test(an))av=eval(this.settings.url_converter+'(this, n, av)');if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0)return" "+an+"="+'"'+this.xmlEncode(av)+'"';return"";},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr;}li=i;}return o;},xmlEncode:function(s){var i,l,e,o='',c;this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":for(i=0,l=s.length;i<l;i++){c=s.charCodeAt(i);e=this.entities[c];if(e&&e!='')o+='&'+e+';';else o+=String.fromCharCode(c);}return o;case"numeric":for(i=0,l=s.length;i<l;i++){c=s.charCodeAt(i);if(c>127||c==60||c==62||c==38||c==39||c==34)o+='&#'+c+";";else o+=String.fromCharCode(c);}return o;}return s;},split:function(re,s){var c=s.split(re);var i,l,o=new Array();for(i=0,l=c.length;i<l;i++){if(c[i]!='')o[i]=c[i];}return o;},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s;},_getAttrib:function(e,n,d){if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;var v=e.getAttribute(n,0);if(n=="class"&&!v)v=e.className;if(this.isMSIE&&n=="http-equiv")v=e.httpEquiv;if(this.isMSIE&&e.nodeName=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(this.isMSIE&&e.nodeName=="INPUT"&&n=="size"&&v=="20")v="";if(this.isMSIE&&e.nodeName=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="style"&&!tinyMCE.isOpera)v=e.style.cssText;if(n=='style')v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v));if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!="")v=tinyMCE.cleanupEventStr(v);return(v&&v!="")?''+v:d;},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls'))return eval(tinyMCE.settings.urlconverter_callback+"(v, n, true);");return v;},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=this._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op);},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s;},_setupEntities:function(){var n,a,i,s=this.settings;if(!this.entitiesDone){if(s.entity_encoding=="named"){n=tinyMCE.clearArray(new Array());a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n;}this.entitiesDone=true;}},_setupRules:function(){var s=this.settings;if(!this.rulesDone){this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.rulesDone=true;}},_isDuplicate:function(n){var i;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isMSIE&&!tinyMCE.isOpera&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId);}else{for(i=0;i<this.serializedNodes.length;i++){if(this.serializedNodes[i]==n)return true;}this.serializedNodes[this.serializedNodes.length]=n;}return false;}};TinyMCE_Engine.prototype.getElementByAttributeValue=function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0];};TinyMCE_Engine.prototype.getElementsByAttributeValue=function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=new Array();for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i];}return o;};TinyMCE_Engine.prototype.isBlockElement=function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName);};TinyMCE_Engine.prototype.getParentBlockElement=function(n){while(n){if(this.isBlockElement(n))return n;n=n.parentNode;}return null;};TinyMCE_Engine.prototype.insertAfter=function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.appendChild(n);};TinyMCE_Engine.prototype.setInnerHTML=function(e,h){var i,nl,n;if(tinyMCE.isMSIE&&!tinyMCE.isOpera){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n);}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h);}};TinyMCE_Engine.prototype.getOuterHTML=function(e){if(tinyMCE.isMSIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e);return d.innerHTML;};TinyMCE_Engine.prototype.setOuterHTML=function(e,h){if(tinyMCE.isMSIE){e.outerHTML=h;return;}var d=e.ownerDocument.createElement("body");d.innerHTML=h;e.parentNode.replaceChild(d.firstChild,e);};TinyMCE_Engine.prototype._getElementById=function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break;}}}}return e;};TinyMCE_Engine.prototype.getNodeTree=function(n,na,t,nn){var i;if(typeof(t)=="undefined"||n.nodeType==t&&(typeof(nn)=="undefined"||n.nodeName==nn))na[na.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.getNodeTree(n.childNodes[i],na,t,nn);}return na;};TinyMCE_Engine.prototype.getParentElement=function(node,names,attrib_name,attrib_value){if(typeof(names)=="undefined"){if(node.nodeType==1)return node;while((node=node.parentNode)!=null&&node.nodeType!=1);return node;}if(node==null)return null;var namesAr=names.toUpperCase().split(',');do{for(var i=0;i<namesAr.length;i++){if(node.nodeName==namesAr[i]||names=="*"){if(typeof(attrib_name)=="undefined")return node;else if(node.getAttribute(attrib_name)){if(typeof(attrib_value)=="undefined"){if(node.getAttribute(attrib_name)!="")return node;}else if(node.getAttribute(attrib_name)==attrib_value)return node;}}}}while((node=node.parentNode)!=null);return null;};TinyMCE_Engine.prototype.getParentNode=function(n,f){while(n){if(f(n))return n;n=n.parentNode;}return null;};TinyMCE_Engine.prototype.getAttrib=function(elm,name,default_value){if(typeof(default_value)=="undefined")default_value="";if(!elm||elm.nodeType!=1)return default_value;var v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko&&name=="src"&&elm.src!=null&&elm.src!="")v=elm.src;if(tinyMCE.isGecko&&name=="href"&&elm.href!=null&&elm.href!="")v=elm.href;if(name=="http-equiv"&&tinyMCE.isMSIE)v=elm.httpEquiv;if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!="")?v:default_value;};TinyMCE_Engine.prototype.setAttrib=function(element,name,value,fix_value){if(typeof(value)=="number"&&value!=null)value=""+value;if(fix_value){if(value==null)value="";var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(name=="style")element.style.cssText=value;if(name=="class")element.className=value;if(value!=null&&value!=""&&value!=-1)element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE_Engine.prototype.setStyleAttrib=function(elm,name,value){eval('elm.style.'+name+'=value;');if(tinyMCE.isMSIE&&value==null||value==''){var str=tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));elm.style.cssText=str;elm.setAttribute("style",str);}};TinyMCE_Engine.prototype.switchClass=function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c;}};TinyMCE_Engine.prototype.getAbsPosition=function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent;}return p;};TinyMCE_Engine.prototype.prevNode=function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e;}}return null;};TinyMCE_Engine.prototype.nextNode=function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e;}}return null;};TinyMCE_Engine.prototype.selectNodes=function(n,f,a){var i;if(!a)a=new Array();if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a);}return a;};TinyMCE_Engine.prototype.addCSSClass=function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!=''?(' '+o):''):(o!=''?(o+' '):'')+c;};TinyMCE_Engine.prototype.removeCSSClass=function(e,c){var a=this.explode(' ',e.className),i;for(i=0;i<a.length;i++){if(a[i]==c)a[i]='';}return e.className=a.join(' ');};TinyMCE_Engine.prototype.renameElement=function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue);}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.replaceChild(ne,e);}};TinyMCE_Engine.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break;}pos=i;urlParts['host']=url_str.substring(lastPos,pos);urlParts['port']="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos);}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos);}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos);}}return urlParts;};TinyMCE_Engine.prototype.serializeURL=function(up){var o="";if(up['protocol'])o+=up['protocol']+"://";if(up['host'])o+=up['host'];if(up['port'])o+=":"+up['port'];if(up['path'])o+=up['path'];if(up['query'])o+="?"+up['query'];if(up['anchor'])o+="#"+up['anchor'];return o;};TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var baseURL=this.parseURL(base_url);var targetURL=this.parseURL(url_to_relative);var strTok1;var strTok2;var breakPoint=0;var outPath="";var forceSlash=false;if(targetURL.path=="")targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i];}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==""&&forceSlash?"/":outPath;var fileName=baseURL.path;var pos;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!="")targetURL.path="";if(targetURL.path==""&&!targetURL.anchor)targetURL.path=fileName!=""?fileName:"/";return this.serializeURL(targetURL);};TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=this.parseURL(base_url);var relURL=this.parseURL(relative_url);if(relative_url==""||relative_url.charAt(0)=='/'||relative_url.indexOf('://')!=-1||relative_url.indexOf('mailto:')!=-1||relative_url.indexOf('javascript:')!=-1)return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL);};TinyMCE_Engine.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isMSIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(on_save&&tinyMCE.getParam('relative_urls')){var curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(curl.charAt(0)=='/')curl=tinyMCE.settings['document_base_prefix']+curl;var urlParts=tinyMCE.parseURL(curl);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],curl);}if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return"#"+urlParts['anchor'];}if(tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1);}return url;};TinyMCE_Engine.prototype.convertAllRelativeURLs=function(body){var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=tinyMCE.getAttrib(elms[i],'src');var msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!="")src=msrc;if(src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=tinyMCE.getAttrib(elms[i],'href');var mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!="")href=mhref;if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href);}}};TinyMCE_Engine.prototype.clearArray=function(a){for(var k in a)a[k]=null;return a;};TinyMCE_Engine.prototype._setEventsEnabled=function(node,state){var events=new Array('onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');var evs=tinyMCE.settings['event_elements'].split(',');for(var y=0;y<evs.length;y++){var elms=node.getElementsByTagName(evs[y]);for(var i=0;i<elms.length;i++){var event="";for(var x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event);}}}}};TinyMCE_Engine.prototype._eventPatch=function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return;}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;tinyMCE.selectedInstance=inst;win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return;}}}catch(ex){}};TinyMCE_Engine.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE_Engine.prototype.addEventHandlers=function(inst){var doc=inst.getDoc();inst.switchSettings();if(tinyMCE.isMSIE){tinyMCE.addEvent(doc,"keypress",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc,"mousedown",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE_Engine.prototype._eventPatch);}else{tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"blur",tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE_Engine.prototype.onMouseMove=function(){var inst;if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true;}}};TinyMCE_Engine.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE_Engine.prototype.addEvent=function(o,n,h){if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false);};TinyMCE_Engine.prototype.addSelectAccessibility=function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w;}return false;};TinyMCE_Engine.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isMSIE?win.event:e;var elm=tinyMCE.isMSIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null;}return true;}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false;}return true;};TinyMCE_Engine.prototype._resetIframeHeight=function(){var ife;if(tinyMCE.isMSIE&&!tinyMCE.isOpera){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight;}}};function TinyMCE_Selection(inst){this.instance=inst;};TinyMCE_Selection.prototype={getSelectedHTML:function(){var inst=this.instance;var e,r=this.getRng(),h;if(tinyMCE.isSafari){return r.toString();}e=document.createElement("body");if(tinyMCE.isGecko)e.appendChild(r.cloneContents());else e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());return h;},getSelectedText:function(){var inst=this.instance;var d,r,s,t;if(tinyMCE.isMSIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text;}else t='';}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t='';}return t;},getBookmark:function(simple){var rng=this.getRng();var doc=this.instance.getDoc();var sp,le,s,e,nl,i,si,ei;var trng,sx,sy,xx=-999999999;if(tinyMCE.isOpera)return null;sx=doc.body.scrollLeft+doc.documentElement.scrollLeft;sy=doc.body.scrollTop+doc.documentElement.scrollTop;if(tinyMCE.isSafari||tinyMCE.isGecko)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isMSIE){if(simple)return{rng:rng};if(rng.item){e=rng.item(0);nl=doc.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){sp=i;break;}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy};}else{trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp,length:le,scrollX:sx,scrollY:sy};}}if(tinyMCE.isGecko){s=tinyMCE.getParentElement(rng.startContainer);for(si=0;si<s.childNodes.length&&s.childNodes[si]!=rng.startContainer;si++);nl=doc.getElementsByTagName(s.nodeName);for(i=0;i<nl.length;i++){if(s==nl[i]){sp=i;break;}}e=tinyMCE.getParentElement(rng.endContainer);for(ei=0;ei<e.childNodes.length&&e.childNodes[ei]!=rng.endContainer;ei++);nl=doc.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){le=i;break;}}return{startTag:s.nodeName,start:sp,startIndex:si,endTag:e.nodeName,end:le,endIndex:ei,startOffset:rng.startOffset,endOffset:rng.endOffset,scrollX:sx,scrollY:sy};}return null;},moveToBookmark:function(bookmark){var rng,nl,i;var inst=this.instance;var doc=inst.getDoc();var win=inst.getWin();var sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari){sel.setBaseAndExtent(bookmark.startContainer,bookmark.startOffset,bookmark.endContainer,bookmark.endOffset);return true;}if(tinyMCE.isMSIE){if(bookmark.rng){bookmark.rng.select();return true;}win.focus();if(bookmark.tag){rng=inst.getBody().createControlRange();nl=doc.getElementsByTagName(bookmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index]);}catch(ex){}}}else{rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length);}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true;}if(tinyMCE.isGecko&&bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng);win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true;}if(tinyMCE.isGecko){rng=doc.createRange();nl=doc.getElementsByTagName(bookmark.startTag);if(nl.length>bookmark.start)rng.setStart(nl[bookmark.start].childNodes[bookmark.startIndex],bookmark.startOffset);nl=doc.getElementsByTagName(bookmark.endTag);if(nl.length>bookmark.end)rng.setEnd(nl[bookmark.end].childNodes[bookmark.endIndex],bookmark.endOffset);sel.removeAllRanges();sel.addRange(rng);win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true;}return false;},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(tinyMCE.isMSIE){rng=inst.getBody().createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select();}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd();}this.scrollToNode(node);return;}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;},scrollToNode:function(node){var inst=this.instance;var pos,doc,scrollX,scrollY,height;pos=tinyMCE.getAbsPosition(node);doc=inst.getDoc();scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;height=tinyMCE.isMSIE?document.getElementById(inst.editorId).style.pixelHeight:inst.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(pos.absTop>scrollY&&pos.absTop<(scrollY-25+height)))inst.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);},getSel:function(){var inst=this.instance;if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return inst.getDoc().selection;return inst.contentWindow.getSelection();},getRng:function(){var inst=this.instance;var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return sel.createRange();if(tinyMCE.isSafari&&!sel.getRangeAt)return''+window.getSelection();return sel.getRangeAt(0);},getFocusElement:function(){var inst=this.instance;if(tinyMCE.isMSIE&&!tinyMCE.isOpera){var doc=inst.getDoc();var rng=doc.selection.createRange();var elm=rng.item?rng.item(0):rng.parentElement();}else{if(inst.isHidden())return inst.getBody();var sel=this.getSel();var rng=this.getRng();if(!sel||!rng)return null;var elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset];}}}elm=tinyMCE.getParentElement(elm);}return elm;}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true;};TinyMCE_UndoRedo.prototype={add:function(l){var b;if(l){this.undoLevels[this.undoLevels.length]=l;return true;}var inst=this.instance;if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;}var newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};this.undoLevels.length=this.undoIndex+1;return true;}return false;},undo:function(){var inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);}tinyMCE.triggerNodeChange();}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false;}return true;}var doc=inst.getDoc();var sel=inst.getSel();var win=inst.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var rootElm=doc.documentElement;var blockName="P";var rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);var rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);var direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;var startNode=direct?sel.anchorNode:sel.focusNode;var startOffset=direct?sel.anchorOffset:sel.focusOffset;var endNode=direct?sel.focusNode:sel.anchorNode;var endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;var startBlock=tinyMCE.getParentBlockElement(startNode);var endBlock=tinyMCE.getParentBlockElement(endNode);if(startBlock&&new RegExp('absolute|relative|static','gi').test(startBlock.style.position))startBlock=null;if(endBlock&&new RegExp('absolute|relative|static','gi').test(endBlock.style.position))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(blockName=="TD"||blockName=="TABLE"||(blockName=="DIV"&&new RegExp('left|right','gi').test(startBlock.style.cssFloat)))blockName="P";}if(tinyMCE.getParentElement(startBlock,"OL,UL")!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;var paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);var paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");var startChop=startNode;var endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);var contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore);}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1];}inst.selection.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML;}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";var rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode);}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset);}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();rng.insertNode(paraAfter);rng.insertNode(paraBefore);paraAfter.normalize();paraBefore.normalize();inst.selection.selectNode(paraAfter,true,true);return true;},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"){nv=sn.nodeValue;if(nv!=null&&nv.length>=r.startOffset&&nv.charAt(r.startOffset-1)==' ')s=true;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling);}return s;}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document;};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re);var w=parseInt(re.offsetWidth);var h=parseInt(re.offsetHeight);var e=this.getElement();var ew=parseInt(e.offsetWidth);var eh=parseInt(e.offsetHeight);var x,y;switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/2)-(ew/2);y=rep.absTop+(h/2)-(eh/2);break;}this.moveTo(x,y);},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y);},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker();},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h);},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker();},show:function(){this.getElement().style.display='block';this.updateBlocker();},hide:function(){this.getElement().style.display='none';this.updateBlocker();},isVisible:function(){return this.getElement().style.display=='block';},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element;},setBlockMode:function(s){this.blockMode=s;},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display;}else b.style.display='none';}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.createElement("iframe");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b);this.blockerElement=b;}return this.blockerElement;},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent;}return p;},create:function(n,c,p){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;p.appendChild(e);return this.element=e;},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s);}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=new Array();this.needsUpdate=true;};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class);},clear:function(){this.items=new Array();},addTitle:function(t){this.add({type:'title',text:t});},addDisabled:function(t){this.add({type:'disabled',text:t});},addSeparator:function(){this.add({type:'separator'});},addItem:function(t,js){this.add({text:t,js:js});},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true;},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="javascript:void(0);" onmousedown="'+tinyMCE.xmlEncode(m[i].js)+';return false;"><span'+c+'>'+t+'</span></a>';}h+='</td></tr>';}h+='</table>';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker();},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this;}});TinyMCE_Engine.prototype.debug=function(){var m="",e,a,i;e=document.getElementById("tinymce_debug");if(!e){var d=document.createElement("div");d.setAttribute("className","debugger");d.className="debugger";d.innerHTML='Debug output:<textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap" mce_editable="false"></textarea>';document.body.appendChild(d);e=document.getElementById("tinymce_debug");}a=this.debug.arguments;for(i=0;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', ';}e.value+=m+"\n";};
\ No newline at end of file
+function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="0.8";this.releaseDate="2006-10-23";this.instances=new Array();this.switchClassCache=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.pendingFiles=new Array();this.loadingIndex=0;this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.log=new Array();this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=new Array();this.themes=new Array();this.menus=new Array();this.loadedPlugins=new Array();this.buttonMap=new Array();this.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!=""&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings['language']);this._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("debug",false);this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",false);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",'');this._def("gecko_spellcheck",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;if(this.isOpera&&this.settings['browsers'].indexOf('opera')==-1)return;baseHREF=tinyMCE.settings['document_base_url'];var h=document.location.href;var p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings['document_base_url']=baseHREF;tinyMCE.settings['document_base_prefix']=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='javascript:TINYMCE_UNIQUEURL();';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=new Array('onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup');this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath}else{if(this.settings.editor_css!='')this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg)}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(var i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)settings['cleanup_entities']['c'+entities[i]]=entities[i+1]}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isIE&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}},_addUnloadEvents:function(){if(tinyMCE.isIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substring(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xhtml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0;var skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',');var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings['convert_on_click']||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm'])))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(editor_id),h,re,ot,tn;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip_cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance;user_interface=user_interface?user_interface:false;value=value?value:null;if(inst)inst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'],value['document']),value['element'],value['document']);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case"mceResetDesignMode":if(!tinyMCE.isIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on"}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert'])},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i;var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;/g,'"');content=content.replace(/&amp;/g,'&')}inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8','','FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings['base_href']);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])doc.styleSheets[0].addRule("p","margin: 0;");var body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}')}else tinyMCE._setHTML(inst.getDoc(),content)}var parentElm=inst.targetDoc.getElementById(inst.editorId+'_parent');inst.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.dispatchCallback(inst,'setupcontent_callback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.add({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},handleEvent:function(e){var inst=tinyMCE.selectedInstance;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.setBaseHREF(null);if(tinyMCE.isRealIE){var ife=tinyMCE.selectedInstance.iframeElement;if(ife.style.height.indexOf('%')!=-1){ife._oldHeight=ife.style.height;ife.style.height=ife.clientHeight}}window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();",1);return;case"submit":tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false)}return false;break;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceStartTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false;break}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" title="{$'+lang+'}" />';h+='</a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},submitPatch:function(){tinyMCE.triggerSave();tinyMCE.isNotDirty=true;this.mceOldSubmit()},onLoad:function(){var r;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case"exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click'])&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i])}break;case"specific_textareas":case"textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!='')trigger=selector!=""?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return e.firstChild.nodeValue},addToLang:function(prefix,ar){for(var key in ar){if(typeof(ar[key])=='function')continue;tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key]}this.loadNextScript();},triggerNodeChange:function(focus,setup_content){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1,doc;var undoLevels=-1;var anySelection=false;var selectedText=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)inst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i;var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");po=tinyMCE.themes[tinyMCE.settings['theme']];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings['language']+'.js')},applyTemplate:function(h,as){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(as&&as[s])return as[s];if(tinyMCE.settings[s])return tinyMCE.settings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args['mce_template_file']=template['file'];args['mce_width']=template['width'];args['mce_height']=template['height'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){height+=10;var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}else{var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template['close_previous']!="no")try{tinyMCE.lastWindow.close()}catch(ex){}var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return}if(template['close_previous']!="no")tinyMCE.lastWindow=win;eval('try { win.resizeTo(width, height); } catch(e) { }');if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);var tableElement=null;switch(el.nodeName){case"TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y<el.rows.length;y++){for(var x=0;x<el.rows[y].cells.length;x++){var cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":var anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!=''&&state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!=''&&!state)el.className='';break}if(deep&&el.hasChildNodes()){for(var i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");return h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!=""){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!=""){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}return false})}}return h},_setHTML:function(doc,html_content){html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}var html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var n in tinyMCE.instances){var instance=tinyMCE.instances[n];if(!tinyMCE.isInstance(instance))continue;if(instance.formTargetElementId==editor_id){inst=instance;break}}}return inst},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;break}doc=instance.getDoc()}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc()}if(doc){var styles=doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isIE ? doc.styleSheets("+x+").rules : styles["+x+"].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){var rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')!=-1)continue;if(rule.indexOf(tinyMCE.settings['visual_table_class'])!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){var cssClass=rule.substring(rule.indexOf('.')+1);var addClass=true;for(var p=0;p<output.length&&addClass;p++){if(output[p]==cssClass)addClass=false}if(addClass)output[output.length]=cssClass}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output},regexpReplace:function(in_str,reg_exp,replace_str,opts){if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v;l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!='')return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}o=tinyMCE.themes[tinyMCE.settings['theme']];if(o.getControlHTML&&(v=o.getControlHTML(c))!='')return v;return''},evalFunc:function(f,idx,a,o){var s='(',i;for(i=idx;i<a.length;i++){s+='a['+i+']';if(i<a.length-1)s+=','}s+=');';return o?eval("o."+f+s):eval("f"+s)},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!=''&&(v=tinyMCE.evalFunc(typeof(l)=="function"?l:eval(l),3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},xmlEncode:function(s){return s?(''+s).replace(new RegExp('[<>&"\']','g'),function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'\'':return'&#39;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},extend:function(p,np){var o={};o.parent=p;for(n in p)o[n]=p[n];for(n in np)o[n]=np[n];return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,to,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.settings=s;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=new Array();this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,url_converter:'TinyMCE_Cleanup.prototype._urlConverter',indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication});t=this.settings['theme'];if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;to={};for(i=0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))to[fn[i]]=fu}tinyMCE.addTheme(t,to)}this.plugins=new Array();p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;to={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))to[fn[x]]=fu}tinyMCE.addPlugin(pn,to)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};return o},hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,null);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index']}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s=this.shortcuts,o;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0)},isDirty:function(){return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty},_mergeElements:function(scmd,pa,ch,override){if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(var n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(var n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true}this.contentDocument=doc;if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return;if(focusElm&&focusElm.nodeName=="IMG"){var align=focusElm.getAttribute('align');var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.removeAttribute('align');var div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div)}else{var div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"FormatBlock":if(!this.cleanup.isValid(value))return true;this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value']==null?'':value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings['merge_styles_invalid_parents']!=''?new RegExp(tinyMCE.settings['merge_styles_invalid_parents'],"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(var x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,false)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(false)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInternal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("SetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value)}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e)}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex==-1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedoLevel){if(this.undoRedo.add())tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"removeformat":var text=this.selection.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("SetStyleInfo",false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("SetStyleInfo",false,{command:"removeformat"})}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,to,editorTemplate;th=this.settings['theme'];to=tinyMCE.themes[th];var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(to.getEditorTemplate)editorTemplate=to.getEditorTemplate(this.settings,this.editorId);var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate['html'];html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;this.settings['width_style']=""+this.settings['width'];this.settings['height_style']=""+this.settings['height'];if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";else this.settings['width_style']+='px';if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";else this.settings['height_style']+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";this.settings['width_style']="100%"}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";this.settings['height_style']="100%"}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;if(tinyMCE.settings['debug']){hc='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>'}else{hc='<input type="hidden" id="'+form_element_name+'" name="'+form_element_name+'" />';this.oldTargetElement.style.display="none"}html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}var doc=this.contentDocument;if(dynamicIFrame){var html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings['base_href']+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==""||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,this.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_callback){var e,nl=[],i,s;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings['cleanup']==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);var htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(this.formTargetElementId,htm,this.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if(tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class}}};TinyMCE_Engine.prototype.cleanupHTMLCode=function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','gi'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s};TinyMCE_Engine.prototype.parseStyle=function(str){var ar=new Array();if(str==null)return ar;var st=str.split(';');tinyMCE.clearArray(ar);for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar};TinyMCE_Engine.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null};TinyMCE_Engine.prototype.serializeStyle=function(ar){var str="";tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(var key in ar){var val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){var m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str};TinyMCE_Engine.prototype.convertRGBToHex=function(s,k){if(s.toLowerCase().indexOf('rgb')!=-1){var re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");var rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4]}}return s};TinyMCE_Engine.prototype.convertHexToRGB=function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s};TinyMCE_Engine.prototype.convertSpansToFonts=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<span/gi,'<font');h=h.replace(/<\/span/gi,'</font');tinyMCE.setInnerHTML(doc.body,h);var s=doc.getElementsByTagName("font");for(var i=0;i<s.length;i++){var size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();var fSize=0;for(var x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}var fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!=""){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}var fColor=s[i].style.color;if(fColor!=null&&fColor!=""){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}};TinyMCE_Engine.prototype.convertFontsToSpans=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<font/gi,'<span');h=h.replace(/<\/font/gi,'</span');tinyMCE.setInnerHTML(doc.body,h);var fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;var s=doc.getElementsByTagName("span");for(var i=0;i<s.length;i++){var fSize,fFace,fColor;fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!=""){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!=""){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!=""){s[i].style.color=fColor;s[i].removeAttribute('color')}}};TinyMCE_Engine.prototype.cleanupAnchors=function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!=""&&tinyMCE.getAttrib(an[i],"href")==""){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}};TinyMCE_Engine.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null};TinyMCE_Engine.prototype._fixListElements=function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.prevNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}};TinyMCE_Engine.prototype._fixTables=function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,div,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}};TinyMCE_Engine.prototype._cleanupHTML=function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyMCE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=new Array();c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.replace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on_submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h};function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray(new Array());this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray(new Array());this.vElementsRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayToRe(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];if(s.invalid_elements!='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this.inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0},addRuleStr:function(s){var r=this.parseRuleStr(s);var n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray(new Array());for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){this._setupRules();n=n.replace(/[^a-z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(cl[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.childRules==null)this.childRules=tinyMCE.clearArray(new Array());this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseRuleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray(new Array()),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r.tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAttribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].charAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray(new Array());r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray(new Array());dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==""?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray(new Array());r.validAttribValues[t.toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray(new Array());r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDoc.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode(""));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr;this._setupRules();if(this._isDuplicate(n))return'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;if((tinyMCE.isRealIE)&&n.nodeName.indexOf('/')!=-1)break;if(this.vElementsRe.test(n.nodeName)&&(!this.iveRe||!this.iveRe.test(n.nodeName))&&!inn){va=true;r=this.rules[n.nodeName];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(n.nodeName)){r=at[no];break}}}en=r.isWild?n.nodeName.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serializeAttribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(n.nodeName))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(n.nodeName))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:if(st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&this.settings.url_converter.length!=0&&/^(src|href|longdesc)$/.test(an))av=eval(this.settings.url_converter+'(this, n, av)');if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this;this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']','g'),function(c,b){b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']','g'),function(c,b){return b?'&#'+c.charCodeAt(0)+';':c})}return s},split:function(re,s){var c=s.split(re);var i,l,o=new Array();for(i=0,l=c.length;i<l;i++){if(c[i]!='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;var v=e.getAttribute(n,0);if(n=="class"&&!v)v=e.className;if(this.isIE&&n=="http-equiv")v=e.httpEquiv;if(this.isIE&&e.nodeName=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(this.isIE&&e.nodeName=="INPUT"&&n=="size"&&v=="20")v="";if(this.isIE&&e.nodeName=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="style"&&!tinyMCE.isOpera)v=e.style.cssText;if(n=='style')v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v));if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!="")v=tinyMCE.cleanupEventStr(v);return(v&&v!="")?''+v:d},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls'))return eval(tinyMCE.settings.urlconverter_callback+"(v, n, true);");return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=this._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(!this.entitiesDone){if(s.entity_encoding=="named"){n=tinyMCE.clearArray(new Array());a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true}},_setupRules:function(){var s=this.settings;if(!this.rulesDone){this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elements);this.rulesDone=true}},_isDuplicate:function(n){var i;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{for(i=0;i<this.serializedNodes.length;i++){if(this.serializedNodes[i]==n)return true}this.serializedNodes[this.serializedNodes.length]=n}return false}};TinyMCE_Engine.prototype.createTagHTML=function(tn,a,h){var o='',f=tinyMCE.xmlEncode;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o};TinyMCE_Engine.prototype.createTag=function(d,tn,a,h){var o=d.createElement(tn);if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o};TinyMCE_Engine.prototype.getElementByAttributeValue=function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]};TinyMCE_Engine.prototype.getElementsByAttributeValue=function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=new Array();for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o};TinyMCE_Engine.prototype.isBlockElement=function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)};TinyMCE_Engine.prototype.getParentBlockElement=function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null};TinyMCE_Engine.prototype.insertAfter=function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.appendChild(n)};TinyMCE_Engine.prototype.setInnerHTML=function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<strong/gi,'<b');h=h.replace(/<em(\/?)/gi,'<i');h=h.replace(/<em /gi,'<i');h=h.replace(/<\/strong>/gi,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}};TinyMCE_Engine.prototype.getOuterHTML=function(e){if(tinyMCE.isIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML};TinyMCE_Engine.prototype.setOuterHTML=function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}};TinyMCE_Engine.prototype._getElementById=function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}}return e};TinyMCE_Engine.prototype.getNodeTree=function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:new Array())};TinyMCE_Engine.prototype.getParentElement=function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!=''});return this.getParentNode(n,function(n){return((n.nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)};TinyMCE_Engine.prototype.getParentNode=function(n,f,r){while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode}return null};TinyMCE_Engine.prototype.getAttrib=function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko&&name=="src"&&elm.src!=null&&elm.src!="")v=elm.src;if(tinyMCE.isGecko&&name=="href"&&elm.href!=null&&elm.href!="")v=elm.href;if(name=="http-equiv"&&tinyMCE.isIE)v=elm.httpEquiv;if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!="")?v:dv};TinyMCE_Engine.prototype.setAttrib=function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!=""&&va!=-1)el.setAttribute(name,va);else el.removeAttribute(name)};TinyMCE_Engine.prototype.setStyleAttrib=function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}};TinyMCE_Engine.prototype.switchClass=function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}};TinyMCE_Engine.prototype.getAbsPosition=function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n.offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}};TinyMCE_Engine.prototype.prevNode=function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null};TinyMCE_Engine.prototype.nextNode=function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null};TinyMCE_Engine.prototype.selectElements=function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a};TinyMCE_Engine.prototype.selectNodes=function(n,f,a){var i;if(!a)a=new Array();if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a};TinyMCE_Engine.prototype.addCSSClass=function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!=''?(' '+o):''):(o!=''?(o+' '):'')+c};TinyMCE_Engine.prototype.removeCSSClass=function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''};TinyMCE_Engine.prototype.hasCSSClass=function(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className)};TinyMCE_Engine.prototype.renameElement=function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.replaceChild(ne,e)}};TinyMCE_Engine.prototype.getViewPort=function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}};TinyMCE_Engine.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts['host']=url_str.substring(lastPos,pos);urlParts['port']="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos)}}return urlParts};TinyMCE_Engine.prototype.serializeURL=function(up){var o="";if(up['protocol'])o+=up['protocol']+"://";if(up['host'])o+=up['host'];if(up['port'])o+=":"+up['port'];if(up['path'])o+=up['path'];if(up['query'])o+="?"+up['query'];if(up['anchor'])o+="#"+up['anchor'];return o};TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var baseURL=this.parseURL(base_url);var targetURL=this.parseURL(url_to_relative);var strTok1;var strTok2;var breakPoint=0;var outPath="";var forceSlash=false;if(targetURL.path=="")targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==""&&forceSlash?"/":outPath;var fileName=baseURL.path;var pos;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!="")targetURL.path="";if(targetURL.path==""&&!targetURL.anchor)targetURL.path=fileName!=""?fileName:"/";return this.serializeURL(targetURL)};TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts;var relURL=this.parseURL(relative_url);if(relative_url==""||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)};TinyMCE_Engine.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(on_save&&tinyMCE.getParam('relative_urls')){var curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(curl.charAt(0)=='/')curl=tinyMCE.settings['document_base_prefix']+curl;var urlParts=tinyMCE.parseURL(curl);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],curl)}if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return"#"+urlParts['anchor']}if(tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url};TinyMCE_Engine.prototype.convertAllRelativeURLs=function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!="")src=msrc;if(src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!="")href=mhref;if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href)}}};TinyMCE_Engine.prototype.clearArray=function(a){var n;for(n in a)a[n]=null;return a};TinyMCE_Engine.prototype.explode=function(d,s){var ar=s.split(d),oar=new Array(),i;for(i=0;i<ar.length;i++){if(ar[i]!="")oar[oar.length]=ar[i]}return oar};TinyMCE_Engine.prototype._setEventsEnabled=function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings['event_elements'].split(',');for(y=0;y<evs.length;y++){elms=node.getElementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}};TinyMCE_Engine.prototype._eventPatch=function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}};TinyMCE_Engine.prototype.findEvent=function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.isInstance(inst)&&inst.getWin().event)return inst.getWin().event}return null};TinyMCE_Engine.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true)};TinyMCE_Engine.prototype.addEventHandlers=function(inst){this.setEventHandlers(inst,1)};TinyMCE_Engine.prototype.setEventHandlers=function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mousedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototype._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE_Engine.prototype.onMouseMove=function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}};TinyMCE_Engine.prototype.cancelEvent=function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}else{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false};TinyMCE_Engine.prototype.addEvent=function(o,n,h){if(n!='unload'){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)};TinyMCE_Engine.prototype.removeEvent=function(o,n,h){if(o.detachEvent)o.detachEvent("on"+n,h);else o.removeEventListener(n,h,false)};TinyMCE_Engine.prototype.addSelectAccessibility=function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false};TinyMCE_Engine.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isIE?win.event:e;var elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true};TinyMCE_Engine.prototype._resetIframeHeight=function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}};function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function(){var inst=this.instance;var e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(r.cloneContents());else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());return h},getSelectedText:function(){var inst=this.instance;var d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}else t=''}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance;var rng=this.getRng();var doc=inst.getDoc(),b=inst.getBody();var sp,le,s,e,nl,i,si,ei,w;var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();sx=vp.left;sy=vp.top;if(tinyMCE.isSafari||tinyMCE.isOpera||simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}if(tinyMCE.isGecko){s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){return{start:-1,end:-1,index:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:sy}}}return null},moveToBookmark:function(bookmark){var inst=this.instance;var rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc();var win=inst.getWin();var sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if(bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bookmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp.width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();return s.getRangeAt(0)},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyMCE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){var inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents;function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==""}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direct?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&new RegExp('absolute|relative|static','gi').test(startBlock.style.position))startBlock=null;if(endBlock&&new RegExp('absolute|relative|static','gi').test(endBlock.style.position))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(blockName=="TD"||blockName=="TABLE"||(blockName=="DIV"&&new RegExp('left|right','gi').test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re);var w=parseInt(re.offsetWidth);var h=parseInt(re.offsetHeight);var e=this.getElement();var ew=parseInt(e.offsetWidth);var eh=parseInt(e.offsetHeight);var x,y;switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){this.getElement().style.display='block';this.updateBlocker()},hide:function(){this.getElement().style.display='none';this.updateBlocker()},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=new Array();this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=new Array()},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="#" onclick="return tinyMCE.cancelEvent(event);" onmousedown="return tinyMCE.cancelEvent(event);" onmouseup="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});if(!Function.prototype.call){Function.prototype.call=function(){var a=arguments,s=a[0],i,as='',r,o;for(i=1;i<a.length;i++)as+=(i>1?',':'')+'a['+i+']';o=s._fu;s._fu=this;r=eval('s._fu('+as+')');s._fu=o;return r}};TinyMCE_Engine.prototype.debug=function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m};
\ No newline at end of file
diff -ruN 0.7.5/e107_handlers/tiny_mce/tiny_mce_popup.js 0.7.7/e107_handlers/tiny_mce/tiny_mce_popup.js
--- 0.7.5/e107_handlers/tiny_mce/tiny_mce_popup.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/tiny_mce_popup.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,270 +1,286 @@
-
-
 // Some global instances, this will be filled later
 var tinyMCE = null, tinyMCELang = null;
 
-
 function TinyMCE_Popup() {
 };
 
+TinyMCE_Popup.prototype = {
+	findWin : function(w) {
+		var c;
+
+		// Check parents
+		c = w;
+		while (c && (c = c.parent) != null) {
+			if (typeof(c.tinyMCE) != "undefined")
+				return c;
+		}
 
-TinyMCE_Popup.prototype.init = function() {
-	var win = window.opener ? window.opener : window.dialogArguments;
-	var inst;
-
-	if (!win) {
-		// Try parent
-		win = parent.parent;
+		// Check openers
+		c = w;
+		while (c && (c = c.opener) != null) {
+			if (typeof(c.tinyMCE) != "undefined")
+				return c;
+		}
 
 		// Try top
-		if (typeof(win.tinyMCE) == "undefined")
-			win = top;
-	}
+		if (typeof(top.tinyMCE) != "undefined")
+			return top;
 
-	window.opener = win;
-	this.windowOpener = win;
-	this.onLoadEval = "";
-
-	// Setup parent references
-	tinyMCE = win.tinyMCE;
-	tinyMCELang = win.tinyMCELang;
-
-	if (!tinyMCE) {
-		alert("tinyMCE object reference not found from popup.");
-		return;
-	}
+		return null;
+	},
 
-	inst = tinyMCE.selectedInstance;
-	this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
-	this.storeSelection = (tinyMCE.isMSIE && !tinyMCE.isOpera) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
-
-	if (this.isWindow)
-		window.focus();
-
-	// Store selection
-	if (this.storeSelection)
-		inst.selectionBookmark = inst.selection.getBookmark(true);
-
-	// Setup dir
-	if (tinyMCELang['lang_dir'])
-		document.dir = tinyMCELang['lang_dir'];
-
-	// Setup title
-	var re = new RegExp('{|\\\$|}', 'g');
-	var title = document.title.replace(re, "");
-	if (typeof tinyMCELang[title] != "undefined") {
-		var divElm = document.createElement("div");
-		divElm.innerHTML = tinyMCELang[title];
-		document.title = divElm.innerHTML;
-
-		if (tinyMCE.setWindowTitle != null)
-			tinyMCE.setWindowTitle(window, divElm.innerHTML);
-	}
+	init : function() {
+		var win = window.opener ? window.opener : window.dialogArguments, c;
+		var inst;
+
+		if (!win)
+			win = this.findWin(window);
+
+		if (!win) {
+			alert("tinyMCE object reference not found from popup.");
+			return;
+		}
 
-	// Output Popup CSS class
-	document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
+		window.opener = win;
+		this.windowOpener = win;
+		this.onLoadEval = "";
+
+		// Setup parent references
+		tinyMCE = win.tinyMCE;
+		tinyMCELang = win.tinyMCELang;
+
+		inst = tinyMCE.selectedInstance;
+		this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
+		this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
+
+		if (this.isWindow)
+			window.focus();
+
+		// Store selection
+		if (this.storeSelection)
+			inst.selectionBookmark = inst.selection.getBookmark(true);
+
+		// Setup dir
+		if (tinyMCELang['lang_dir'])
+			document.dir = tinyMCELang['lang_dir'];
+
+		// Setup title
+		var re = new RegExp('{|\\\$|}', 'g');
+		var title = document.title.replace(re, "");
+		if (typeof tinyMCELang[title] != "undefined") {
+			var divElm = document.createElement("div");
+			divElm.innerHTML = tinyMCELang[title];
+			document.title = divElm.innerHTML;
 
-	tinyMCE.addEvent(window, "load", this.onLoad);
-};
+			if (tinyMCE.setWindowTitle != null)
+				tinyMCE.setWindowTitle(window, divElm.innerHTML);
+		}
 
+		// Output Popup CSS class
+		document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
 
-TinyMCE_Popup.prototype.onLoad = function() {
-	var dir, i, elms, body = document.body;
+		if (tinyMCE.getParam("popups_css_add")) {
+			c = tinyMCE.getParam("popups_css_add");
 
-	if (tinyMCE.getWindowArg('mce_replacevariables', true))
-		body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
+			// Is relative
+			if (c.indexOf('://') == -1 && c.charAt(0) != '/')
+				c = tinyMCE.documentBasePath + "/" + c;
 
-	dir = tinyMCE.selectedInstance.settings['directionality'];
-	if (dir == "rtl" && document.forms && document.forms.length > 0) {
-		elms = document.forms[0].elements;
-		for (i=0; i<elms.length; i++) {
-			if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
-				elms[i].dir = dir;
+			document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
 		}
-	}
 
-	if (body.style.display == 'none')
-		body.style.display = 'block';
-
-	// Execute real onload (Opera fix)
-	if (tinyMCEPopup.onLoadEval != "")
-		eval(tinyMCEPopup.onLoadEval);
-};
-
-
-TinyMCE_Popup.prototype.executeOnLoad = function(str) {
-	if (tinyMCE.isOpera)
-		this.onLoadEval = str;
-	else
-		eval(str);
-};
+		tinyMCE.addEvent(window, "load", this.onLoad);
+	},
 
+	onLoad : function() {
+		var dir, i, elms, body = document.body;
 
-TinyMCE_Popup.prototype.resizeToInnerSize = function() {
-	// Netscape 7.1 workaround
-	if (this.isWindow && tinyMCE.isNS71) {
-		window.resizeBy(0, 10);
-		return;
-	}
+		if (tinyMCE.getWindowArg('mce_replacevariables', true))
+			body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
 
-	if (this.isWindow) {
-		var doc = document;
-		var body = doc.body;
-		var oldMargin, wrapper, iframe, nodes, dx, dy;
+		dir = tinyMCE.selectedInstance.settings['directionality'];
+		if (dir == "rtl" && document.forms && document.forms.length > 0) {
+			elms = document.forms[0].elements;
+			for (i=0; i<elms.length; i++) {
+				if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
+					elms[i].dir = dir;
+			}
+		}
 
 		if (body.style.display == 'none')
 			body.style.display = 'block';
 
-		// Remove margin
-		oldMargin = body.style.margin;
-		body.style.margin = '0';
-
-		// Create wrapper
-		wrapper = doc.createElement("div");
-		wrapper.id = 'mcBodyWrapper';
-		wrapper.style.display = 'none';
-		wrapper.style.margin = '0';
-
-		// Wrap body elements
-		nodes = doc.body.childNodes;
-		for (var i=nodes.length-1; i>=0; i--) {
-			if (wrapper.hasChildNodes())
-				wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
-			else
-				wrapper.appendChild(nodes[i].cloneNode(true));
-
-			nodes[i].parentNode.removeChild(nodes[i]);
+		// Execute real onload (Opera fix)
+		if (tinyMCEPopup.onLoadEval != "")
+			eval(tinyMCEPopup.onLoadEval);
+	},
+
+	executeOnLoad : function(str) {
+		if (tinyMCE.isOpera)
+			this.onLoadEval = str;
+		else
+			eval(str);
+	},
+
+	resizeToInnerSize : function() {
+		// Netscape 7.1 workaround
+		if (this.isWindow && tinyMCE.isNS71) {
+			window.resizeBy(0, 10);
+			return;
 		}
 
-		// Add wrapper
-		doc.body.appendChild(wrapper);
-
-		// Create iframe
-		iframe = document.createElement("iframe");
-		iframe.id = "mcWinIframe";
-		iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
-		iframe.width = "100%";
-		iframe.height = "100%";
-		iframe.style.margin = '0';
-
-		// Add iframe
-		doc.body.appendChild(iframe);
-
-		// Measure iframe
-		iframe = document.getElementById('mcWinIframe');
-		dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
-		dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
-
-		// Resize window
-		// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
-		window.resizeBy(dx, dy);
-
-		// Hide iframe and show wrapper
-		body.style.margin = oldMargin;
-		iframe.style.display = 'none';
-		wrapper.style.display = 'block';
-	}
-};
-
-
-TinyMCE_Popup.prototype.resizeToContent = function() {
-	var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
-	var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
-
-	if (isOpera)
-		return;
-
-	if (isMSIE) {
-		try { window.resizeTo(10, 10); } catch (e) {}
-
-		var elm = document.body;
-		var width = elm.offsetWidth;
-		var height = elm.offsetHeight;
-		var dx = (elm.scrollWidth - width) + 4;
-		var dy = elm.scrollHeight - height;
-
-		try { window.resizeBy(dx, dy); } catch (e) {}
-	} else {
-		window.scrollBy(1000, 1000);
-		if (window.scrollX > 0 || window.scrollY > 0) {
-			window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
-			window.sizeToContent();
-			window.scrollTo(0, 0);
-			var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
-			var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
-			window.moveTo(x, y);
+		if (this.isWindow) {
+			var doc = document;
+			var body = doc.body;
+			var oldMargin, wrapper, iframe, nodes, dx, dy;
+
+			if (body.style.display == 'none')
+				body.style.display = 'block';
+
+			// Remove margin
+			oldMargin = body.style.margin;
+			body.style.margin = '0';
+
+			// Create wrapper
+			wrapper = doc.createElement("div");
+			wrapper.id = 'mcBodyWrapper';
+			wrapper.style.display = 'none';
+			wrapper.style.margin = '0';
+
+			// Wrap body elements
+			nodes = doc.body.childNodes;
+			for (var i=nodes.length-1; i>=0; i--) {
+				if (wrapper.hasChildNodes())
+					wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
+				else
+					wrapper.appendChild(nodes[i].cloneNode(true));
+
+				nodes[i].parentNode.removeChild(nodes[i]);
+			}
+
+			// Add wrapper
+			doc.body.appendChild(wrapper);
+
+			// Create iframe
+			iframe = document.createElement("iframe");
+			iframe.id = "mcWinIframe";
+			iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
+			iframe.width = "100%";
+			iframe.height = "100%";
+			iframe.style.margin = '0';
+
+			// Add iframe
+			doc.body.appendChild(iframe);
+
+			// Measure iframe
+			iframe = document.getElementById('mcWinIframe');
+			dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
+			dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
+
+			// Resize window
+			// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
+			window.resizeBy(dx, dy);
+
+			// Hide iframe and show wrapper
+			body.style.margin = oldMargin;
+			iframe.style.display = 'none';
+			wrapper.style.display = 'block';
 		}
-	}
-};
-
-
-TinyMCE_Popup.prototype.getWindowArg = function(name, default_value) {
-	return tinyMCE.getWindowArg(name, default_value);
-};
-
-
-TinyMCE_Popup.prototype.restoreSelection = function() {
-	if (this.storeSelection) {
-		var inst = tinyMCE.selectedInstance;
-
-		inst.getWin().focus();
-
-		if (inst.selectionBookmark)
-			inst.selection.moveToBookmark(inst.selectionBookmark);
-	}
-};
-
-
-TinyMCE_Popup.prototype.execCommand = function(command, user_interface, value) {
-	var inst = tinyMCE.selectedInstance;
+	},
 
-	this.restoreSelection();
-	inst.execCommand(command, user_interface, value);
+	resizeToContent : function() {
+		var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
+		var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
+
+		if (isOpera)
+			return;
+
+		if (isMSIE) {
+			try { window.resizeTo(10, 10); } catch (e) {}
+
+			var elm = document.body;
+			var width = elm.offsetWidth;
+			var height = elm.offsetHeight;
+			var dx = (elm.scrollWidth - width) + 4;
+			var dy = elm.scrollHeight - height;
+
+			try { window.resizeBy(dx, dy); } catch (e) {}
+		} else {
+			window.scrollBy(1000, 1000);
+			if (window.scrollX > 0 || window.scrollY > 0) {
+				window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
+				window.sizeToContent();
+				window.scrollTo(0, 0);
+				var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
+				var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
+				window.moveTo(x, y);
+			}
+		}
+	},
 
-	// Store selection
-	if (this.storeSelection)
-		inst.selectionBookmark = inst.selection.getBookmark(true);
-};
+	getWindowArg : function(name, default_value) {
+		return tinyMCE.getWindowArg(name, default_value);
+	},
 
+	restoreSelection : function() {
+		if (this.storeSelection) {
+			var inst = tinyMCE.selectedInstance;
 
-TinyMCE_Popup.prototype.close = function() {
-	tinyMCE.closeWindow(window);
-};
+			inst.getWin().focus();
 
+			if (inst.selectionBookmark)
+				inst.selection.moveToBookmark(inst.selectionBookmark);
+		}
+	},
 
-TinyMCE_Popup.prototype.pickColor = function(e, element_id) {
-	tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
-		element_id : element_id,
-		document : document,
-		window : window,
-		store_selection : false
-	});
-};
+	execCommand : function(command, user_interface, value) {
+		var inst = tinyMCE.selectedInstance;
 
+		this.restoreSelection();
+		inst.execCommand(command, user_interface, value);
 
-TinyMCE_Popup.prototype.openBrowser = function(element_id, type, option) {
-	var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
-	var url = document.getElementById(element_id).value;
-
-	tinyMCE.setWindowArg("window", window);
-	tinyMCE.setWindowArg("document", document);
-
-	// Call to external callback
-	if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
-		alert("Callback function: " + cb + " could not be found.");
-	else
-		eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
-};
+		// Store selection
+		if (this.storeSelection)
+			inst.selectionBookmark = inst.selection.getBookmark(true);
+	},
+
+	close : function() {
+		tinyMCE.closeWindow(window);
+	},
+
+	pickColor : function(e, element_id) {
+		tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
+			element_id : element_id,
+			document : document,
+			window : window,
+			store_selection : false
+		});
+	},
+
+	openBrowser : function(element_id, type, option) {
+		var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
+		var url = document.getElementById(element_id).value;
+
+		tinyMCE.setWindowArg("window", window);
+		tinyMCE.setWindowArg("document", document);
+
+		// Call to external callback
+		if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
+			alert("Callback function: " + cb + " could not be found.");
+		else
+			eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
+	},
 
+	importClass : function(c) {
+		window[c] = function() {};
 
-TinyMCE_Popup.prototype.importClass = function(c) {
-	window[c] = function() {};
+		for (var n in window.opener[c].prototype)
+			window[c].prototype[n] = window.opener[c].prototype[n];
 
-	for (var n in window.opener[c].prototype)
-		window[c].prototype[n] = window.opener[c].prototype[n];
+		window[c].constructor = window.opener[c].constructor;
+	}
 
-	window[c].constructor = window.opener[c].constructor;
-};
+	};
 
 // Setup global instance
 var tinyMCEPopup = new TinyMCE_Popup();
diff -ruN 0.7.5/e107_handlers/tiny_mce/tiny_mce_src.js 0.7.7/e107_handlers/tiny_mce/tiny_mce_src.js
--- 0.7.5/e107_handlers/tiny_mce/tiny_mce_src.js	2006-05-05 22:05:15.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/tiny_mce_src.js	2006-10-27 17:36:57.000000000 -0500
@@ -2,9 +2,11 @@
 /* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */
 
 function TinyMCE_Engine() {
+	var ua;
+
 	this.majorVersion = "2";
-	this.minorVersion = "0.6.1";
-	this.releaseDate = "2006-05-04";
+	this.minorVersion = "0.8";
+	this.releaseDate = "2006-10-23";
 
 	this.instances = new Array();
 	this.switchClassCache = new Array();
@@ -15,12 +17,17 @@
 	this.configs = new Array();
 	this.currentConfig = 0;
 	this.eventHandlers = new Array();
+	this.log = new Array();
+	this.undoLevels = [];
+	this.undoIndex = 0;
+	this.typingUndoIndex = -1;
 
 	// Browser check
-	var ua = navigator.userAgent;
+	ua = navigator.userAgent;
 	this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
 	this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
 	this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
+	this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1);
 	this.isGecko = ua.indexOf('Gecko') != -1;
 	this.isSafari = ua.indexOf('Safari') != -1;
 	this.isOpera = ua.indexOf('Opera') != -1;
@@ -42,13 +49,20 @@
 		this.isSafari =  false;
 	}
 
+	this.isIE = this.isMSIE;
+	this.isRealIE = this.isMSIE && !this.isOpera;
+
 	// TinyMCE editor id instance counter
 	this.idCounter = 0;
 };
 
 TinyMCE_Engine.prototype = {
 	init : function(settings) {
-		var theme;
+		var theme, nl, baseHREF = "", i;
+
+		// IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry.
+		if (this.isMSIE5_0)
+			return;
 
 		this.settings = settings;
 
@@ -60,6 +74,13 @@
 		if (!tinyMCE.baseURL) {
 			var elements = document.getElementsByTagName('script');
 
+			// If base element found, add that infront of baseURL
+			nl = document.getElementsByTagName('base');
+			for (i=0; i<nl.length; i++) {
+				if (nl[i].href)
+					baseHREF = nl[i].href;
+			}
+
 			for (var i=0; i<elements.length; i++) {
 				if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) {
 					var src = elements[i].src;
@@ -71,7 +92,12 @@
 					if (settings.exec_mode == "src" || settings.exec_mode == "normal")
 						tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : '';
 
-					tinyMCE.baseURL = src;
+					// Force it absolute if page has a base href
+					if (baseHREF != "" && src.indexOf('://') == -1)
+						tinyMCE.baseURL = baseHREF + src;
+					else
+						tinyMCE.baseURL = src;
+
 					break;
 				}
 			}
@@ -100,7 +126,7 @@
 		this._def("textarea_trigger", "mce_editable");
 		this._def("editor_selector", "");
 		this._def("editor_deselector", "mceNoEditor");
-		this._def("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang]");
+		this._def("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");
 		this._def("extended_valid_elements", "");
 		this._def("invalid_elements", "");
 		this._def("encoding", "");
@@ -122,6 +148,7 @@
 		this._def("custom_undo_redo_levels", -1);
 		this._def("custom_undo_redo_keyboard_shortcuts", true);
 		this._def("custom_undo_redo_restore_selection", true);
+		this._def("custom_undo_redo_global", false);
 		this._def("verify_html", true);
 		this._def("apply_source_formatting", false);
 		this._def("directionality", "ltr");
@@ -164,6 +191,7 @@
 		this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml');
 		this._def("hidden_tab_class", '');
 		this._def("display_tab_class", '');
+		this._def("gecko_spellcheck", false);
 
 		// Force strict loading mode to false on non Gecko browsers
 		if (this.isMSIE && !this.isOpera)
@@ -186,7 +214,7 @@
 			return;
 
 		// If not super absolute make it so
-		var baseHREF = tinyMCE.settings['document_base_url'];
+		baseHREF = tinyMCE.settings['document_base_url'];
 		var h = document.location.href;
 		var p = h.indexOf('://');
 		if (p > 0 && document.location.protocol != "file:") {
@@ -207,7 +235,10 @@
 		this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
 
 		theme = this.settings['theme'];
-		this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dt|dd|dir|fieldset|form|noscript|noframes|menu|isindex|samp)$", "i");
+		this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
+		this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
+		this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
+		this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
 		this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
 		this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL
 		this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>';
@@ -216,7 +247,7 @@
 		// Theme url
 		this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
 
-		if (!tinyMCE.isMSIE)
+		if (!tinyMCE.isIE || tinyMCE.isOpera)
 			this.settings['force_br_newlines'] = false;
 
 		if (tinyMCE.getParam("popups_css", false)) {
@@ -238,8 +269,10 @@
 				this.settings['editor_css'] = this.documentBasePath + "/" + cssPath;
 			else
 				this.settings['editor_css'] = cssPath;
-		} else
-			this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+		} else {
+			if (this.settings.editor_css != '')
+				this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+		}
 
 		if (tinyMCE.settings['debug']) {
 			var msg = "Debug: \n";
@@ -255,14 +288,10 @@
 
 		// Only do this once
 		if (this.configs.length == 0) {
-			// Is Safari enabled
-			if (this.isSafari && this.getParam('safari_warning', false))
-				alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");
-
 			if (typeof(TinyMCECompressed) == "undefined") {
 				tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad);
 
-				if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+				if (tinyMCE.isRealIE) {
 					if (document.body)
 						tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad);
 					else
@@ -288,10 +317,12 @@
 		}
 
 		// Setup entities
-		settings['cleanup_entities'] = new Array();
-		var entities = tinyMCE.getParam('entities', '', true, ',');
-		for (var i=0; i<entities.length; i+=2)
-			settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
+		if (tinyMCE.getParam('entity_encoding') == 'named') {
+			settings['cleanup_entities'] = new Array();
+			var entities = tinyMCE.getParam('entities', '', true, ',');
+			for (var i=0; i<entities.length; i+=2)
+				settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
+		}
 
 		// Save away this config
 		settings['index'] = this.configs.length;
@@ -299,10 +330,18 @@
 
 		// Start loading first one in chain
 		this.loadNextScript();
+
+		// Force flicker free CSS backgrounds in IE
+		if (this.isIE && !this.isOpera) {
+			try {
+				document.execCommand('BackgroundImageCache', false, true);
+			} catch (e) {
+			}
+		}
 	},
 
 	_addUnloadEvents : function() {
-		if (tinyMCE.isMSIE) {
+		if (tinyMCE.isIE) {
 			if (tinyMCE.settings['add_unload_trigger']) {
 				tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler);
 				tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler);
@@ -316,7 +355,7 @@
 	_def : function(key, def_val, t) {
 		var v = tinyMCE.getParam(key, def_val);
 
-		v = t ? v.replace(/\s+/g,"") : v;
+		v = t ? v.replace(/\s+/g, "") : v;
 
 		this.settings[key] = v;
 	},
@@ -409,8 +448,6 @@
 		var x = 0, i = 0, nl, le;
 
 		for (x = 0,csslen = ar.length; x<csslen; x++) {
-			ignore_css = false;
-
 			if (ar[x] != null && ar[x] != 'null' && ar[x].length > 0) {
 				/* Make sure it doesn't exist. */
 				for (i=0, lflen=this.loadedFiles.length; i<lflen; i++) {
@@ -466,7 +503,7 @@
 	},
 
 	confirmAdd : function(e, settings) {
-		var elm = tinyMCE.isMSIE ? event.srcElement : e.target;
+		var elm = tinyMCE.isIE ? event.srcElement : e.target;
 		var elementId = elm.name ? elm.name : elm.id;
 
 		tinyMCE.settings = settings;
@@ -492,7 +529,7 @@
 		
 				tinyMCE._setHTML(doc, inst.formElement.value);
 
-				if (!tinyMCE.isMSIE)
+				if (!tinyMCE.isIE)
 					doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid);
 			}
 		}
@@ -508,46 +545,62 @@
 		inst._onAdd(replace_element, form_element_name, target_document);
 	},
 
+	removeInstance : function(ti) {
+		var t = [], n, i;
+
+		// Remove from instances
+		for (n in tinyMCE.instances) {
+			i = tinyMCE.instances[n];
+
+			if (tinyMCE.isInstance(i) && ti != i)
+					t[n] = i;
+		}
+
+		tinyMCE.instances = t;
+
+		// Remove from global undo/redo
+		n = [];
+		t = tinyMCE.undoLevels;
+
+		for (i=0; i<t.length; i++) {
+			if (t[i] != ti)
+				n.push(t[i]);
+		}
+
+		tinyMCE.undoLevels = n;
+		tinyMCE.undoIndex = n.length;
+
+		return ti;
+	},
+
 	removeMCEControl : function(editor_id) {
-		var inst = tinyMCE.getInstanceById(editor_id);
+		var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn;
 
 		if (inst) {
 			inst.switchSettings();
 
 			editor_id = inst.editorId;
-			var html = tinyMCE.getContent(editor_id);
-
-			// Remove editor instance from instances array
-			var tmpInstances = new Array();
-			for (var instanceName in tinyMCE.instances) {
-				var instance = tinyMCE.instances[instanceName];
-				if (!tinyMCE.isInstance(instance))
-					continue;
+			h = tinyMCE.getContent(editor_id);
 
-				if (instanceName != editor_id)
-						tmpInstances[instanceName] = instance;
-			}
-			tinyMCE.instances = tmpInstances;
+			this.removeInstance(inst);
 
 			tinyMCE.selectedElement = null;
 			tinyMCE.selectedInstance = null;
 
 			// Remove element
-			var replaceElement = document.getElementById(editor_id + "_parent");
-			var oldTargetElement = inst.oldTargetElement;
-			var targetName = oldTargetElement.nodeName.toLowerCase();
-
-			if (targetName == "textarea" || targetName == "input") {
-				// Just show the old text area
-				replaceElement.parentNode.removeChild(replaceElement);
-				oldTargetElement.style.display = "inline";
-				oldTargetElement.value = html;
+			re = document.getElementById(editor_id + "_parent");
+			ot = inst.oldTargetElement;
+			tn = ot.nodeName.toLowerCase();
+
+			if (tn == "textarea" || tn == "input") {
+				re.parentNode.removeChild(re);
+				ot.style.display = "inline";
+				ot.value = h;
 			} else {
-				oldTargetElement.innerHTML = html;
-				oldTargetElement.style.display = 'block';
-
-				replaceElement.parentNode.insertBefore(oldTargetElement, replaceElement);
-				replaceElement.parentNode.removeChild(replaceElement);
+				ot.innerHTML = h;
+				ot.style.display = 'block';
+				re.parentNode.insertBefore(ot, re);
+				re.parentNode.removeChild(re);
 			}
 		}
 	},
@@ -593,52 +646,75 @@
 	},
 
 	execInstanceCommand : function(editor_id, command, user_interface, value, focus) {
-		var inst = tinyMCE.getInstanceById(editor_id);
+		var inst = tinyMCE.getInstanceById(editor_id), r;
+
 		if (inst) {
+			r = inst.selection.getRng();
+
 			if (typeof(focus) == "undefined")
 				focus = true;
 
-			if (focus)
+			// IE bug lost focus on images in absolute divs Bug #1534575
+			if (focus && (!r || !r.item))
 				inst.contentWindow.focus();
 
 			// Reset design mode if lost
 			inst.autoResetDesignMode();
 
 			this.selectedElement = inst.getFocusElement();
-			this.selectedInstance = inst;
+			inst.select();
 			tinyMCE.execCommand(command, user_interface, value);
 
 			// Cancel event so it doesn't call onbeforeonunlaod
-			if (tinyMCE.isMSIE && window.event != null)
+			if (tinyMCE.isIE && window.event != null)
 				tinyMCE.cancelEvent(window.event);
 		}
 	},
 
 	execCommand : function(command, user_interface, value) {
+		var inst = tinyMCE.selectedInstance;
+
 		// Default input
 		user_interface = user_interface ? user_interface : false;
 		value = value ? value : null;
 
-		if (tinyMCE.selectedInstance)
-			tinyMCE.selectedInstance.switchSettings();
+		if (inst)
+			inst.switchSettings();
 
 		switch (command) {
-			case 'mceHelp':
-				tinyMCE.openWindow({
-					file : 'about.htm',
-					width : 480,
-					height : 380
-				}, {
-					tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
-					tinymce_releasedate : tinyMCE.releaseDate,
-					inline : "yes"
-				});
-			return;
+			case "Undo":
+				if (this.getParam('custom_undo_redo_global')) {
+					if (this.undoIndex > 0) {
+						tinyMCE.nextUndoRedoAction = 'Undo';
+						inst = this.undoLevels[--this.undoIndex];
+						inst.select();
+
+						if (!tinyMCE.nextUndoRedoInstanceId)
+							inst.execCommand('Undo');
+					}
+				} else
+					inst.execCommand('Undo');
+				return true;
+
+			case "Redo":
+				if (this.getParam('custom_undo_redo_global')) {
+					if (this.undoIndex <= this.undoLevels.length - 1) {
+						tinyMCE.nextUndoRedoAction = 'Redo';
+						inst = this.undoLevels[this.undoIndex++];
+						inst.select();
+
+						if (!tinyMCE.nextUndoRedoInstanceId)
+							inst.execCommand('Redo');
+					}
+				} else
+					inst.execCommand('Redo');
+
+				return true;
 
 			case 'mceFocus':
 				var inst = tinyMCE.getInstanceById(value);
 				if (inst)
-					inst.contentWindow.focus();
+					inst.getWin().focus();
 			return;
 
 			case "mceAddControl":
@@ -657,7 +733,7 @@
 
 			case "mceResetDesignMode":
 				// Resets the designmode state of the editors in Gecko
-				if (!tinyMCE.isMSIE) {
+				if (!tinyMCE.isIE) {
 					for (var n in tinyMCE.instances) {
 						if (!tinyMCE.isInstance(tinyMCE.instances[n]))
 							continue;
@@ -673,8 +749,8 @@
 				return;
 		}
 
-		if (this.selectedInstance) {
-			this.selectedInstance.execCommand(command, user_interface, value);
+		if (inst) {
+			inst.execCommand(command, user_interface, value);
 		} else if (tinyMCE.settings['focus_alert'])
 			alert(tinyMCELang['lang_focus_alert']);
 	},
@@ -696,17 +772,18 @@
 
 		if (aw.indexOf('%') == -1) {
 			aw = parseInt(aw);
-			aw = aw < 0 ? 300 : aw;
+			aw = (isNaN(aw) || aw < 0) ? 300 : aw;
 			aw = aw + "px";
 		}
 
 		if (ah.indexOf('%') == -1) {
 			ah = parseInt(ah);
-			ah = ah < 0 ? 240 : ah;
+			ah = (isNaN(ah) || ah < 0) ? 240 : ah;
 			ah = ah + "px";
 		}
 
 		iframe.setAttribute("id", id);
+		iframe.setAttribute("name", id);
 		iframe.setAttribute("class", "mceEditorIframe");
 		iframe.setAttribute("border", "0");
 		iframe.setAttribute("frameBorder", "0");
@@ -723,7 +800,7 @@
 			iframe.setAttribute("scrolling", "no");
 
 		// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+		if (tinyMCE.isRealIE)
 			iframe.setAttribute("src", this.settings['default_document']);
 
 		iframe.style.width = aw;
@@ -734,19 +811,19 @@
 			iframe.style.marginBottom = '-5px';
 
 		// MSIE 5.0 issue
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+		if (tinyMCE.isRealIE)
 			replace_element.outerHTML = iframe.outerHTML;
 		else
 			replace_element.parentNode.replaceChild(iframe, replace_element);
 
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+		if (tinyMCE.isRealIE)
 			return win.frames[id];
 		else
 			return iframe;
 	},
 
 	setupContent : function(editor_id) {
-		var inst = tinyMCE.instances[editor_id];
+		var inst = tinyMCE.instances[editor_id], i;
 		var doc = inst.getDoc();
 		var head = doc.getElementsByTagName('head').item(0);
 		var content = inst.startContent;
@@ -762,7 +839,7 @@
 		inst.switchSettings();
 
 		// Not loaded correctly hit it again, Mozilla bug #997860
-		if (!tinyMCE.isMSIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
+		if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
 			// This part will remove the designMode status
 			// Failes first time in Firefox 1.5b2 on Mac
 			try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
@@ -786,6 +863,14 @@
 			inst.addShortcut('ctrl', 'y', 'lang_redo_desc', 'Redo');
 		}
 
+		// BlockFormat shortcuts keys
+		for (i=1; i<=6; i++)
+			inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, '<h' + i + '>');
+
+		inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '<p>');
+		inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '<div>');
+		inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '<address>');
+
 		// Add default shortcuts for gecko
 		if (tinyMCE.isGecko) {
 			inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold');
@@ -795,7 +880,7 @@
 
 		// Setup span styles
 		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			inst.getDoc().body.setAttribute('id', 'mceSpanFonts');
+			inst.getBody().setAttribute('id', 'mceSpanFonts');
 
 		if (tinyMCE.settings['nowrap'])
 			doc.body.style.whiteSpace = "nowrap";
@@ -804,7 +889,7 @@
 		doc.editorId = editor_id;
 
 		// Add on document element in Mozilla
-		if (!tinyMCE.isMSIE)
+		if (!tinyMCE.isIE)
 			doc.documentElement.editorId = editor_id;
 
 		inst.setBaseHREF(tinyMCE.settings['base_href']);
@@ -823,7 +908,7 @@
 		content = tinyMCE.storeAwayURLs(content);
 		content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
 
-		if (tinyMCE.isMSIE) {
+		if (tinyMCE.isIE) {
 			// Ugly!!!
 			window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500);
 
@@ -837,7 +922,7 @@
 		content = tinyMCE.cleanupHTMLCode(content);
 
 		// Fix for bug #958637
-		if (!tinyMCE.isMSIE) {
+		if (!tinyMCE.isIE) {
 			var contentElement = inst.getDoc().createElement("body");
 			var doc = inst.getDoc();
 
@@ -849,15 +934,8 @@
 
 			if (tinyMCE.settings['cleanup_on_startup'])
 				tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
-			else {
-				// Convert all strong/em to b/i
-				content = tinyMCE.regexpReplace(content, "<strong", "<b", "gi");
-				content = tinyMCE.regexpReplace(content, "<em(/?)>", "<i$1>", "gi");
-				content = tinyMCE.regexpReplace(content, "<em ", "<i ", "gi");
-				content = tinyMCE.regexpReplace(content, "</strong>", "</b>", "gi");
-				content = tinyMCE.regexpReplace(content, "</em>", "</i>", "gi");
+			else
 				tinyMCE.setInnerHTML(inst.getBody(), content);
-			}
 
 			tinyMCE.convertAllRelativeURLs(inst.getBody());
 		} else {
@@ -881,11 +959,11 @@
 		tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
 
 		// Re-add design mode on mozilla
-		if (!tinyMCE.isMSIE)
+		if (!tinyMCE.isIE)
 			tinyMCE.addEventHandlers(inst);
 
 		// Add blur handler
-		if (tinyMCE.isMSIE) {
+		if (tinyMCE.isIE) {
 			tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch);
 			tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953
 
@@ -898,7 +976,7 @@
 		}
 
 		// Trigger node change, this call locks buttons for tables and so forth
-		tinyMCE.selectedInstance = inst;
+		inst.select();
 		tinyMCE.selectedElement = inst.contentWindow.document.body;
 
 		// Call custom DOM cleanup
@@ -917,19 +995,21 @@
 		if (tinyMCE.isGecko) {
 			// Remove mce_src from textnodes and comments
 			tinyMCE.selectNodes(inst.getBody(), function(n) {
-				if (n.nodeType == 3 || n.nodeType == 8) {
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
-				}
+				if (n.nodeType == 3 || n.nodeType == 8)
+					n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
 
 				return false;
 			});
 		}
 
+		// Remove Gecko spellchecking
+		if (tinyMCE.isGecko)
+			inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck");
+
 		// Cleanup any mess left from storyAwayURLs
 		tinyMCE._removeInternal(inst.getBody());
 
-		tinyMCE.selectedInstance = inst;
+		inst.select();
 		tinyMCE.triggerNodeChange(false, true);
 	},
 
@@ -950,42 +1030,14 @@
 		if (tinyMCE.isGecko) {
 			// Remove mce_src from textnodes and comments
 			tinyMCE.selectNodes(n, function(n) {
-				if (n.nodeType == 3 || n.nodeType == 8) {
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
-				}
+				if (n.nodeType == 3 || n.nodeType == 8)
+					n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
 
 				return false;
 			});
 		}
 	},
 
-	removeTinyMCEFormElements : function(form_obj) {
-		// Check if form is valid
-		if (typeof(form_obj) == "undefined" || form_obj == null)
-			return;
-
-		// If not a form, find the form
-		if (form_obj.nodeName != "FORM") {
-			if (form_obj.form)
-				form_obj = form_obj.form;
-			else
-				form_obj = tinyMCE.getParentElement(form_obj, "form");
-		}
-
-		// Still nothing
-		if (form_obj == null)
-			return;
-
-		// Disable all UI form elements that TinyMCE created
-		for (var i=0; i<form_obj.elements.length; i++) {
-			var elementId = form_obj.elements[i].name ? form_obj.elements[i].name : form_obj.elements[i].id;
-
-			if (elementId.indexOf('mce_editor_') == 0)
-				form_obj.elements[i].disabled = true;
-		}
-	},
-
 	handleEvent : function(e) {
 		var inst = tinyMCE.selectedInstance;
 
@@ -1016,7 +1068,7 @@
 
 				// Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks
 				// This logic forces the width/height to be in pixels while the user is drag/dropping
-				if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+				if (tinyMCE.isRealIE) {
 					var ife = tinyMCE.selectedInstance.iframeElement;
 
 					/*if (ife.style.width.indexOf('%') != -1) {
@@ -1034,13 +1086,12 @@
 				return;
 
 			case "submit":
-				tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target);
 				tinyMCE.triggerSave();
 				tinyMCE.isNotDirty = true;
 				return;
 
 			case "reset":
-				var formObj = tinyMCE.isMSIE ? window.event.srcElement : e.target;
+				var formObj = tinyMCE.isIE ? window.event.srcElement : e.target;
 
 				for (var i=0; i<document.forms.length; i++) {
 					if (document.forms[i] == formObj)
@@ -1054,41 +1105,39 @@
 					return false;
 
 				if (e.target.editorId) {
-					tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
+					tinyMCE.instances[e.target.editorId].select();
 				} else {
 					if (e.target.ownerDocument.editorId)
-						tinyMCE.selectedInstance = tinyMCE.instances[e.target.ownerDocument.editorId];
+						tinyMCE.instances[e.target.ownerDocument.editorId].select();
 				}
 
 				if (tinyMCE.selectedInstance)
 					tinyMCE.selectedInstance.switchSettings();
 
 				// Insert P element
-				if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {
+				if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {
 					// Insert P element instead of BR
 					if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) {
 						// Cancel event
 						tinyMCE.execCommand("mceAddUndoLevel");
-						tinyMCE.cancelEvent(e);
-						return false;
+						return tinyMCE.cancelEvent(e);
 					}
 				}
 
 				// Handle backspace
-				if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
+				if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
 					// Insert P element instead of BR
 					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
 						// Cancel event
 						tinyMCE.execCommand("mceAddUndoLevel");
-						tinyMCE.cancelEvent(e);
-						return false;
+						return tinyMCE.cancelEvent(e);
 					}
 				}
 
 				// Return key pressed
-				if (tinyMCE.isMSIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {
+				if (tinyMCE.isIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {
 					if (e.target.editorId)
-						tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
+						tinyMCE.instances[e.target.editorId].select();
 
 					if (tinyMCE.selectedInstance) {
 						var sel = tinyMCE.selectedInstance.getDoc().selection;
@@ -1132,9 +1181,7 @@
 					return false;
 
 				if (e.target.editorId)
-					tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
-				else
-					return;
+					tinyMCE.instances[e.target.editorId].select();
 
 				if (tinyMCE.selectedInstance)
 					tinyMCE.selectedInstance.switchSettings();
@@ -1164,11 +1211,11 @@
 					tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
 
 				// Fix empty elements on return/enter, check where enter occured
-				if (tinyMCE.isMSIE && e.type == "keydown" && e.keyCode == 13)
+				if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13)
 					tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement();
 
 				// Fix empty elements on return/enter
-				if (tinyMCE.isMSIE && e.type == "keyup" && e.keyCode == 13) {
+				if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) {
 					var elm = tinyMCE.enterKeyElement;
 					if (elm) {
 						var re = new RegExp('^HR|IMG|BR$','g'); // Skip these
@@ -1194,8 +1241,9 @@
 				}
 
 				// MSIE custom key handling
-				if (tinyMCE.isMSIE && tinyMCE.settings['custom_undo_redo']) {
+				if (tinyMCE.isIE && tinyMCE.settings['custom_undo_redo']) {
 					var keys = new Array(8,46); // Backspace,Delete
+
 					for (var i=0; i<keys.length; i++) {
 						if (keys[i] == e.keyCode) {
 							if (e.type == "keyup")
@@ -1210,9 +1258,15 @@
 
 				// Handle Undo/Redo when typing content
 
-				// Start typing (non position key)
-				if (!posKey && e.type == "keyup")
-					tinyMCE.execCommand("mceStartTyping");
+				if (tinyMCE.isGecko) {
+					// Start typing (not a position key or ctrl key, but ctrl+x and ctrl+p is ok)
+					if (!posKey && e.type == "keyup" && !e.ctrlKey || (e.ctrlKey && (e.keyCode == 86 || e.keyCode == 88)))
+						tinyMCE.execCommand("mceStartTyping");
+				} else {
+					// IE seems to be working better with this setting
+					if (!posKey && e.type == "keyup")
+						tinyMCE.execCommand("mceStartTyping");
+				}
 
 				// Store undo bookmark
 				if (e.type == "keydown" && (posKey || e.ctrlKey) && inst)
@@ -1225,13 +1279,14 @@
 				if (posKey && e.type == "keyup")
 					tinyMCE.triggerNodeChange(false);
 
-				if (tinyMCE.isMSIE && e.ctrlKey)
+				if (tinyMCE.isIE && e.ctrlKey)
 					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
 			break;
 
 			case "mousedown":
 			case "mouseup":
 			case "click":
+			case "dblclick":
 			case "focus":
 				tinyMCE.hideMenus();
 
@@ -1241,7 +1296,7 @@
 				}
 
 				// Check instance event trigged on
-				var targetBody = tinyMCE.getParentElement(e.target, "body");
+				var targetBody = tinyMCE.getParentElement(e.target, "html");
 				for (var instanceName in tinyMCE.instances) {
 					if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
 						continue;
@@ -1251,8 +1306,9 @@
 					// Reset design mode if lost (on everything just in case)
 					inst.autoResetDesignMode();
 
-					if (inst.getBody() == targetBody) {
-						tinyMCE.selectedInstance = inst;
+					// Use HTML element since users might click outside of body element
+					if (inst.getBody().parentNode == targetBody) {
+						inst.select();
 						tinyMCE.selectedElement = e.target;
 						tinyMCE.linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
 						tinyMCE.imgElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "img");
@@ -1261,30 +1317,9 @@
 				}
 
 				// Add first bookmark location
-				if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark)
+				if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark && (e.type == "mouseup" || e.type == "dblclick"))
 					tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark = tinyMCE.selectedInstance.selection.getBookmark();
 
-				if (tinyMCE.isSafari) {
-					tinyMCE.selectedInstance.lastSafariSelection = tinyMCE.selectedInstance.selection.getBookmark();
-					tinyMCE.selectedInstance.lastSafariSelectedElement = tinyMCE.selectedElement;
-
-					var lnk = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
-
-					// Patch the darned link
-					if (lnk && e.type == "mousedown") {
-						lnk.setAttribute("mce_real_href", lnk.getAttribute("href"));
-						lnk.setAttribute("href", "javascript:void(0);");
-					}
-
-					// Patch back
-					if (lnk && e.type == "click") {
-						window.setTimeout(function() {
-							lnk.setAttribute("href", lnk.getAttribute("mce_real_href"));
-							lnk.removeAttribute("mce_real_href");
-						}, 10);
-					}
-				}
-
 				// Reset selected node
 				if (e.type != "focus")
 					tinyMCE.selectedNode = null;
@@ -1297,7 +1332,7 @@
 
 				// Just in case
 				if (!tinyMCE.selectedInstance && e.target.editorId)
-					tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
+					tinyMCE.instances[e.target.editorId].select();
 
 				return false;
 			break;
@@ -1305,7 +1340,7 @@
 	},
 
 	getButtonHTML : function(id, lang, img, cmd, ui, val) {
-		var h = '', m, x;
+		var h = '', m, x, io = '';
 
 		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
 
@@ -1317,16 +1352,20 @@
 
 		cmd += ');';
 
+		// Patch for IE7 bug with hover out not restoring correctly
+		if (tinyMCE.isRealIE)
+			io = 'onmouseover="tinyMCE.lastHover = this;"';
+
 		// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
-		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
+		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
 			// Tiled button
 			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
-			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
+			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">';
 			h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
 			h += '</a>';
 		} else {
 			// Normal button
-			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceButtonNormal" target="_self">';
+			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">';
 			h += '<img src="' + img + '" title="{$' + lang + '}" />';
 			h += '</a>';
 		}
@@ -1334,6 +1373,58 @@
 		return h;
 	},
 
+	getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) {
+		var h = '', m, x;
+
+		mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');';
+		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+
+		if (typeof(ui) != "undefined" && ui != null)
+			cmd += ',' + ui;
+
+		if (typeof(val) != "undefined" && val != null)
+			cmd += ",'" + val + "'";
+
+		cmd += ');';
+
+		// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
+		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
+			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
+
+			if (tinyMCE.isRealIE)
+				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
+			else
+				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+
+			h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';
+			h += '<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: ' + x + 'px 0" title="{$' + lang + '}" /></a>';
+			h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
+			h += '</a></span>';
+		} else {
+			if (tinyMCE.isRealIE)
+				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
+			else
+				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+
+			h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
+			h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
+			h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
+			h += '</a></span>';
+		}
+
+		return h;
+	},
+
+	_menuButtonEvent : function(e, o) {
+		if (o.className == 'mceMenuButtonFocus')
+			return;
+
+		if (e == 'over')
+			o.className = o.className + ' mceMenuHover';
+		else
+			o.className = o.className.replace(/\s.*$/, '');
+	},
+
 	addButtonMap : function(m) {
 		var i, a = m.replace(/\s+/, '').split(',');
 
@@ -1342,20 +1433,21 @@
 	},
 
 	submitPatch : function() {
-		tinyMCE.removeTinyMCEFormElements(this);
 		tinyMCE.triggerSave();
-		this.mceOldSubmit();
 		tinyMCE.isNotDirty = true;
+		this.mceOldSubmit();
 	},
 
 	onLoad : function() {
+		var r;
+
 		// Wait for everything to be loaded first
 		if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) {
 			window.setTimeout('tinyMCE.onLoad();', 1);
 			return;
 		}
 
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera && window.event.type == "readystatechange" && document.readyState != "complete")
+		if (tinyMCE.isRealIE && window.event.type == "readystatechange" && document.readyState != "complete")
 			return true;
 
 		if (tinyMCE.isLoaded)
@@ -1363,6 +1455,15 @@
 
 		tinyMCE.isLoaded = true;
 
+		// IE produces JS error if TinyMCE is placed in a frame
+		// It seems to have something to do with the selection not beeing
+		// correctly initialized in IE so this hack solves the problem
+		if (tinyMCE.isRealIE && document.body) {
+			r = document.body.createTextRange();
+			r.collapse(true);
+			r.select();
+		}
+
 		tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad');
 
 		for (var c=0; c<tinyMCE.configs.length; c++) {
@@ -1403,7 +1504,7 @@
 						var element = tinyMCE._getElementById(elements[i]);
 						var trigger = element ? element.getAttribute(tinyMCE.settings['textarea_trigger']) : "";
 
-						if (tinyMCE.getAttrib(element, "class").indexOf(deselector) != -1)
+						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class")))
 							continue;
 
 						if (trigger == "false")
@@ -1429,13 +1530,13 @@
 						var elm = nodeList.item(i);
 						var trigger = elm.getAttribute(tinyMCE.settings['textarea_trigger']);
 
-						if (selector != '' && tinyMCE.getAttrib(elm, "class").indexOf(selector) == -1)
+						if (selector != '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
 							continue;
 
 						if (selector != '')
 							trigger = selector != "" ? "true" : "";
 
-						if (tinyMCE.getAttrib(elm, "class").indexOf(deselector) != -1)
+						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
 							continue;
 
 						if ((mode == "specific_textareas" && trigger == "true") || (mode == "textareas" && trigger != "false"))
@@ -1475,7 +1576,7 @@
 					var inst = tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);
 					inst.selection.selectNode(inst.getBody(), true, true);
 					inst.contentWindow.focus();
-				}, 10);
+				}, 100);
 			}
 
 			tinyMCE.dispatchCallback(null, 'oninit', 'onInit');
@@ -1527,8 +1628,10 @@
 
 	entityDecode : function(s) {
 		var e = document.createElement("div");
+
 		e.innerHTML = s;
-		return e.innerHTML;
+
+		return e.firstChild.nodeValue;
 	},
 
 	addToLang : function(prefix, ar) {
@@ -1550,23 +1653,19 @@
 			var inst = tinyMCE.selectedInstance;
 			var editorId = inst.editorId;
 			var elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement();
-			var undoIndex = -1;
+			var undoIndex = -1, doc;
 			var undoLevels = -1;
 			var anySelection = false;
 			var selectedText = inst.selection.getSelectedText();
 
+			if (tinyMCE.settings.auto_resize)
+				inst.resizeToContent();
+
 			if (setup_content && tinyMCE.isGecko && inst.isHidden())
 				elm = inst.getBody();
 
 			inst.switchSettings();
 
-			if (tinyMCE.settings["auto_resize"]) {
-				var doc = inst.getDoc();
-
-				inst.iframeElement.style.width = doc.body.offsetWidth + "px";
-				inst.iframeElement.style.height = doc.body.offsetHeight + "px";
-			}
-
 			if (tinyMCE.selectedElement)
 				anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);
 
@@ -1590,6 +1689,11 @@
 		if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined")
 			content = eval(customCleanup + "(type, content, inst);");
 
+		// Trigger theme cleanup
+		po = tinyMCE.themes[tinyMCE.settings['theme']];
+		if (po && po.cleanup)
+			content = po.cleanup(type, content, inst);
+
 		// Trigger plugin cleanups
 		pl = inst.plugins;
 		for (i=0; i<pl.length; i++) {
@@ -1616,40 +1720,31 @@
 		tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings['language'] + '.js');
 	},
 
-	importPluginLanguagePack : function(name, valid_languages) {
-		var lang = "en", b = tinyMCE.baseURL + '/plugins/' + name;
-
-		valid_languages = valid_languages.split(',');
-		for (var i=0; i<valid_languages.length; i++) {
-			if (tinyMCE.settings['language'] == valid_languages[i])
-				lang = tinyMCE.settings['language'];
-		}
+	importPluginLanguagePack : function(name) {
+		var b = tinyMCE.baseURL + '/plugins/' + name;
 
 		if (this.plugins[name])
 			b = this.plugins[name].baseURL;
 
-		tinyMCE.loadScript(b + '/langs/' + lang +  '.js');
+		tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings['language'] +  '.js');
 	},
 
 	applyTemplate : function(h, as) {
-		var i, s, ar = h.match(new RegExp('\\{\\$[a-z0-9_]+\\}', 'gi'));
+		return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) {
+			if (s.indexOf('lang_') == 0 && tinyMCELang[s])
+				return tinyMCELang[s];
 
-		if (ar && ar.length > 0) {
-			for (i=ar.length-1; i>=0; i--) {
-				s = ar[i].substring(2, ar[i].length-1);
+			if (as && as[s])
+				return as[s];
 
-				if (s.indexOf('lang_') == 0 && tinyMCELang[s])
-					h = tinyMCE.replaceVar(h, s, tinyMCELang[s]);
-				else if (as && as[s])
-					h = tinyMCE.replaceVar(h, s, as[s]);
-				else if (tinyMCE.settings[s])
-					h = tinyMCE.replaceVar(h, s, tinyMCE.settings[s]);
-			}
-		}
+			if (tinyMCE.settings[s])
+				return tinyMCE.settings[s];
 
-		h = tinyMCE.replaceVar(h, "themeurl", tinyMCE.themeURL);
+			if (m == 'themeurl')
+				return tinyMCE.themeURL;
 
-		return h;
+			return m;
+		});
 	},
 
 	replaceVar : function(h, r, v) {
@@ -1672,7 +1767,7 @@
 			height = 200;
 
 		// Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!!
-		if (tinyMCE.isMSIE)
+		if (tinyMCE.isIE)
 			height += 40;
 		else
 			height += 20;
@@ -1711,7 +1806,7 @@
 			win.resizeTo(width, height);
 			win.focus();
 		} else {
-			if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {
+			if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {
 				height += 10;
 
 				var features = "resizable:" + resizable 
@@ -1823,7 +1918,7 @@
 
 				if (anchorName != '' && state) {
 					el.title = anchorName;
-					el.className = 'mceItemAnchor';
+					tinyMCE.addCSSClass(el, 'mceItemAnchor');
 				} else if (anchorName != '' && !state)
 					el.className = '';
 
@@ -1870,7 +1965,7 @@
 	*/
 
 	fixGeckoBaseHREFBug : function(m, e, h) {
-		var nl, i, a, n, xsrc, xhref, el;
+		var xsrc, xhref;
 
 		if (tinyMCE.isGecko) {
 			if (m == 1) {
@@ -1879,38 +1974,40 @@
 
 				return h;
 			} else {
-				el = new Array('a','img','select','area','iframe','base','input','script','embed','object','link');
+				// Why bother if there is no src or href broken
+				if (!new RegExp('(src|href)=', 'g').test(h))
+					return h;
+
+				// Restore src and href that gets messed up by Gecko
+				tinyMCE.selectElements(e, 'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK', function (n) {
+					xsrc = tinyMCE.getAttrib(n, "mce_tsrc");
+					xhref = tinyMCE.getAttrib(n, "mce_thref");
 
-				for (a=0; a<el.length; a++) {
-					n = e.getElementsByTagName(el[a]);
-
-					for (i=0; i<n.length; i++) {
-						xsrc = tinyMCE.getAttrib(n[i], "mce_tsrc");
-						xhref = tinyMCE.getAttrib(n[i], "mce_thref");
-
-						if (xsrc != "") {
-							try {
-								n[i].src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc);
-							} catch (e) {
-								// Ignore, Firefox cast exception if local file wasn't found
-							}
-
-							n[i].removeAttribute("mce_tsrc");
+					if (xsrc != "") {
+						try {
+							n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc);
+						} catch (e) {
+							// Ignore, Firefox cast exception if local file wasn't found
 						}
 
-						if (xhref != "") {
-							try {
-								n[i].href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref);
-							} catch (e) {
-								// Ignore, Firefox cast exception if local file wasn't found
-							}
+						n.removeAttribute("mce_tsrc");
+					}
 
-							n[i].removeAttribute("mce_thref");
+					if (xhref != "") {
+						try {
+							n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref);
+						} catch (e) {
+							// Ignore, Firefox cast exception if local file wasn't found
 						}
+
+						n.removeAttribute("mce_thref");
 					}
-				}
 
-				el = tinyMCE.selectNodes(e, function(n) {
+					return false;
+				});
+
+				// Restore text/comment nodes
+				tinyMCE.selectNodes(e, function(n) {
 					if (n.nodeType == 3 || n.nodeType == 8) {
 						n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, " src=");
 						n.nodeValue = n.nodeValue.replace(/\smce_thref=/gi, " href=");
@@ -1939,7 +2036,7 @@
 		}
 
 		// Content duplication bug fix
-		if (tinyMCE.isMSIE && tinyMCE.settings['fix_content_duplication']) {
+		if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) {
 			// Remove P elements in P elements
 			var paras = doc.getElementsByTagName("P");
 			for (var i=0; i<paras.length; i++) {
@@ -2065,7 +2162,7 @@
 					var csses = null;
 
 					// Just ignore any errors
-					eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");
+					eval("try {var csses = tinyMCE.isIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");
 					if (!csses)
 						return new Array();
 
@@ -2158,7 +2255,7 @@
 		return '';
 	},
 
-	evalFunc : function(f, idx, a) {
+	evalFunc : function(f, idx, a, o) {
 		var s = '(', i;
 
 		for (i=idx; i<a.length; i++) {
@@ -2170,7 +2267,7 @@
 
 		s += ');';
 
-		return eval("f" + s);
+		return o ? eval("o." + f + s) : eval("f" + s);
 	},
 
 	dispatchCallback : function(i, p, n) {
@@ -2199,7 +2296,7 @@
 			for (i=0, l = ins.plugins; i<l.length; i++) {
 				o = tinyMCE.plugins[l[i]];
 
-				if (o[n] && (v = tinyMCE.evalFunc(o[n], 3, a)) == s && m > 0)
+				if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
 					return true;
 			}
 		}
@@ -2208,7 +2305,7 @@
 		for (on in l) {
 			o = l[on];
 
-			if (o[n] && (v = tinyMCE.evalFunc(o[n], 3, a)) == s && m > 0)
+			if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
 				return true;
 		}
 
@@ -2216,14 +2313,26 @@
 	},
 
 	xmlEncode : function(s) {
-		s = "" + s;
-		s = s.replace(/&/g, '&amp;');
-		s = s.replace(new RegExp('"', 'g'), '&quot;');
-		s = s.replace(/\'/g, '&#39;'); // &apos; is not working in MSIE
-		s = s.replace(/</g, '&lt;');
-		s = s.replace(/>/g, '&gt;');
+		return s ? ('' + s).replace(new RegExp('[<>&"\']', 'g'), function (c, b) {
+			switch (c) {
+				case '&':
+					return '&amp;';
 
-		return s;
+				case '"':
+					return '&quot;';
+
+				case '\'':
+					return '&#39;'; // &apos; is not working in MSIE
+
+				case '<':
+					return '&lt;';
+
+				case '>':
+					return '&gt;';
+			}
+
+			return c;
+		}) : s;
 	},
 
 	extend : function(p, np) {
@@ -2252,19 +2361,9 @@
 			tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass);
 			tinyMCE.lastSelectedMenuBtn = null;
 		}
-	},
-
-	explode : function(d, s) {
-		var ar = s.split(d), oar = new Array(), i;
-	
-		for (i = 0; i<ar.length; i++) {
-			if (ar[i] != "")
-				oar[oar.length] = ar[i];
-		}
-	
-		return oar;
 	}
-};
+
+	};
 
 // Global instances
 var TinyMCE = TinyMCE_Engine; // Compatiblity with gzip compressors
@@ -2289,10 +2388,13 @@
 	this.cleanup = new TinyMCE_Cleanup();
 	this.shortcuts = new Array();
 	this.hasMouseMoved = false;
+	this.foreColor = this.backColor = "#999999";
+	this.data = {};
 
 	this.cleanup.init({
 		valid_elements : s.valid_elements,
 		extended_valid_elements : s.extended_valid_elements,
+		valid_child_elements : s.valid_child_elements,
 		entities : s.entities,
 		entity_encoding : s.entity_encoding,
 		debug : s.cleanup_debug,
@@ -2345,6 +2447,21 @@
 };
 
 TinyMCE_Control.prototype = {
+	selection : null,
+
+	settings : null,
+
+	cleanup : null,
+
+	getData : function(na) {
+		var o = this.data[na];
+
+		if (!o)
+			o = this.data[na] = {};
+
+		return o;
+	},
+
 	hasPlugin : function(n) {
 		var i;
 
@@ -2364,12 +2481,14 @@
 	},
 
 	repaint : function() {
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+		var s, b, ex;
+
+		if (tinyMCE.isRealIE)
 			return;
 
 		try {
-			var s = this.selection;
-			var b = s.getBookmark(true);
+			s = this.selection;
+			b = s.getBookmark(true);
 			this.getBody().style.display = 'none';
 			this.getDoc().execCommand('selectall', false, null);
 			this.getSel().collapseToStart();
@@ -2387,11 +2506,24 @@
 		}
 	},
 
+	select : function() {
+		var oldInst = tinyMCE.selectedInstance;
+
+		if (oldInst != this) {
+			if (oldInst)
+				oldInst.execCommand('mceEndTyping');
+
+			tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst);
+			tinyMCE.selectedInstance = this;
+		}
+	},
+
 	getBody : function() {
-		return this.getDoc().body;
+		return this.contentBody ? this.contentBody : this.getDoc().body;
 	},
 
 	getDoc : function() {
+//		return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ?
 		return this.contentWindow.document;
 	},
 
@@ -2399,9 +2531,34 @@
 		return this.contentWindow;
 	},
 
+	getContainerWin : function() {
+		return this.containerWindow ? this.containerWindow : window;
+	},
+
+	getViewPort : function() {
+		return tinyMCE.getViewPort(this.getWin());
+	},
+
+	getParentNode : function(n, f) {
+		return tinyMCE.getParentNode(n, f, this.getBody());
+	},
+
+	getParentElement : function(n, na, f) {
+		return tinyMCE.getParentElement(n, na, f, this.getBody());
+	},
+
+	getParentBlockElement : function(n) {
+		return tinyMCE.getParentBlockElement(n, this.getBody());
+	},
+
+	resizeToContent : function() {
+		var d = this.getDoc(), b = d.body, de = d.documentElement;
+
+		this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px';
+	},
+
 	addShortcut : function(m, k, d, cmd, ui, va) {
-		var n = typeof(k) == "number", ie = tinyMCE.isMSIE, c, sc, i;
-		var scl = this.shortcuts;
+		var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts;
 
 		if (!tinyMCE.getParam('custom_shortcuts'))
 			return false;
@@ -2440,6 +2597,7 @@
 
 		for (i=0; i<s.length; i++) {
 			o = s[i];
+
 			if (o.alt == e.altKey && o.ctrl == e.ctrlKey && (o.keyCode == e.keyCode || o.charCode == e.charCode)) {
 				if (o.cmd && (e.type == "keydown" || (e.type == "keypress" && !tinyMCE.isOpera)))
 					tinyMCE.execCommand(o.cmd, o.ui, o.val);
@@ -2454,15 +2612,17 @@
 
 	autoResetDesignMode : function() {
 		// Add fix for tab/style.display none/block problems in Gecko
-		if (!tinyMCE.isMSIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))
-			eval('try { this.getDoc().designMode = "On"; } catch(e) {}');
+		if (!tinyMCE.isIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))
+			eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}');
 	},
 
 	isHidden : function() {
-		if (tinyMCE.isMSIE)
+		var s;
+
+		if (tinyMCE.isIE)
 			return false;
 
-		var s = this.getSel();
+		s = this.getSel();
 
 		// Weird, wheres that cursor selection?
 		return (!s || !s.rangeCount || s.rangeCount == 0);
@@ -2470,7 +2630,7 @@
 
 	isDirty : function() {
 		// Is content modified and not in a submit procedure
-		return this.startContent != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
+		return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
 	},
 
 	_mergeElements : function(scmd, pa, ch, override) {
@@ -2486,7 +2646,8 @@
 		var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
 		var className = tinyMCE.getAttrib(pa, "class");
 
-		className += " " + tinyMCE.getAttrib(ch, "class");
+		// Removed class adding due to bug #1478272
+		className = tinyMCE.getAttrib(ch, "class");
 
 		if (override) {
 			for (var n in st) {
@@ -2526,21 +2687,14 @@
 	},
 
 	execCommand : function(command, user_interface, value) {
-		var doc = this.getDoc();
-		var win = this.getWin();
-		var focusElm = this.getFocusElement();
+		var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();
 
-		// Is non udno specific command
+		// Is not a undo specific command
 		if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command))
 			this.undoBookmark = null;
 
-		if (this.lastSafariSelection && !new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) {
-			this.selection.moveToBookmark(this.lastSafariSelection);
-			tinyMCE.selectedElement = this.lastSafariSelectedElement;
-		}
-
 		// Mozilla issue
-		if (!tinyMCE.isMSIE && !this.useCSS) {
+		if (!tinyMCE.isIE && !this.useCSS) {
 			this._setUseCSS(false);
 			this.useCSS = true;
 		}
@@ -2654,24 +2808,39 @@
 				this.repaint();
 				return true;
 
-			case "InsertUnorderedList":
-			case "InsertOrderedList":
-				var tag = (command == "InsertUnorderedList") ? "ul" : "ol";
+			case "unlink":
+				// Unlink if caret is inside link
+				if (tinyMCE.isGecko && this.getSel().isCollapsed) {
+					focusElm = tinyMCE.getParentElement(focusElm, 'A');
 
-				if (tinyMCE.isSafari)
-					this.execCommand("mceInsertContent", false, "<" + tag + "><li>&nbsp;</li><" + tag + ">");
-				else
-					this.getDoc().execCommand(command, user_interface, value);
+					if (focusElm)
+						this.selection.selectNode(focusElm, false);
+				}
+
+				this.getDoc().execCommand(command, user_interface, value);
+
+				tinyMCE.isGecko && this.getSel().collapseToEnd();
+
+				tinyMCE.triggerNodeChange();
 
+				return true;
+
+			case "FormatBlock":
+				if (!this.cleanup.isValid(value))
+					return true;
+
+				this.getDoc().execCommand(command, user_interface, value);
 				tinyMCE.triggerNodeChange();
 				break;
 
-			case "Strikethrough":
-				if (tinyMCE.isSafari)
-					this.execCommand("mceInsertContent", false, "<strike>" + this.selection.getSelectedHTML() + "</strike>");
-				else
-					this.getDoc().execCommand(command, user_interface, value);
+			case "InsertUnorderedList":
+			case "InsertOrderedList":
+				this.getDoc().execCommand(command, user_interface, value);
+				tinyMCE.triggerNodeChange();
+				break;
 
+			case "Strikethrough":
+				this.getDoc().execCommand(command, user_interface, value);
 				tinyMCE.triggerNodeChange();
 				break;
 
@@ -2691,7 +2860,7 @@
 					if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value))
 						value = value.replace(/[^a-z]/gi, '');
 
-					if (tinyMCE.isMSIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {
+					if (tinyMCE.isIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {
 						var b = this.selection.getBookmark();
 						this.getDoc().execCommand("FormatBlock", false, '<p>');
 						tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()), value);
@@ -2708,7 +2877,7 @@
 				if (!value)
 					value = tinyMCE.getParentElement(this.getFocusElement());
 
-				if (tinyMCE.isMSIE) {
+				if (tinyMCE.isIE) {
 					value.outerHTML = value.innerHTML;
 				} else {
 					var rng = value.ownerDocument.createRange();
@@ -2759,7 +2928,7 @@
 				var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;
 
 				// Whole element selected check
-				if (tinyMCE.isMSIE) {
+				if (tinyMCE.isIE) {
 					// Control range
 					if (rng.item)
 						parentElm = rng.item(0);
@@ -2953,10 +3122,20 @@
 				return;
 
 			case "forecolor":
+				value = value == null ? this.foreColor : value;
+				value = tinyMCE.trim(value);
+				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
+
+				this.foreColor = value;
 				this.getDoc().execCommand('forecolor', false, value);
 				break;
 
 			case "HiliteColor":
+				value = value == null ? this.backColor : value;
+				value = tinyMCE.trim(value);
+				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
+				this.backColor = value;
+
 				if (tinyMCE.isGecko) {
 					this._setUseCSS(true);
 					this.getDoc().execCommand('hilitecolor', false, value);
@@ -2994,9 +3173,14 @@
 				// Call custom cleanup code
 				value = tinyMCE.storeAwayURLs(value);
 				value = tinyMCE._customCleanup(this, "insert_to_editor", value);
-				tinyMCE._setHTML(doc, value);
-				tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body));
-				tinyMCE.convertAllRelativeURLs(doc.body);
+
+				if (this.getBody().nodeName == 'BODY')
+					tinyMCE._setHTML(doc, value);
+				else
+					this.getBody().innerHTML = value;
+
+				tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, doc, this.settings, this.getBody(), false, false, false, true));
+				tinyMCE.convertAllRelativeURLs(this.getBody());
 
 				// Cleanup any mess left from storyAwayURLs
 				tinyMCE._removeInternal(this.getBody());
@@ -3005,8 +3189,8 @@
 				if (tinyMCE.getParam("convert_fonts_to_spans"))
 					tinyMCE.convertSpansToFonts(doc);
 
-				tinyMCE.handleVisualAid(doc.body, true, this.visualAid, this);
-				tinyMCE._setEventsEnabled(doc.body, false);
+				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
+				tinyMCE._setEventsEnabled(this.getBody(), false);
 				return true;
 
 			case "mceCleanup":
@@ -3035,7 +3219,7 @@
 
 				var selectedText = "";
 
-				if (tinyMCE.isMSIE) {
+				if (tinyMCE.isIE) {
 					var rng = doc.selection.createRange();
 					selectedText = rng.text;
 				} else
@@ -3074,8 +3258,8 @@
 				this.execCommand('mceInsertContent', false, key);
 
 				// Store away scroll pos
-				var scrollX = this.getDoc().body.scrollLeft + this.getDoc().documentElement.scrollLeft;
-				var scrollY = this.getDoc().body.scrollTop + this.getDoc().documentElement.scrollTop;
+				var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft;
+				var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop;
 
 				// Find marker and replace with RAW HTML
 				var html = this.getBody().innerHTML;
@@ -3095,7 +3279,9 @@
 					value = '';
 
 				var insertHTMLFailed = false;
-				this.getWin().focus();
+
+				// Removed since it produced problems in IE
+				// this.getWin().focus();
 
 				if (tinyMCE.isGecko || tinyMCE.isOpera) {
 					try {
@@ -3131,15 +3317,7 @@
 					}
 				}
 
-				// Ugly hack in Opera due to non working "inserthtml"
-				if (tinyMCE.isOpera && insertHTMLFailed) {
-					this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL);
-					var ar = tinyMCE.getElementsByAttributeValue(this.getBody(), "img", "src", tinyMCE.uniqueURL);
-					ar[0].outerHTML = value;
-					return;
-				}
-
-				if (!tinyMCE.isMSIE) {
+				if (!tinyMCE.isIE) {
 					var isHTML = value.indexOf('<') != -1;
 					var sel = this.getSel();
 					var rng = this.getRng();
@@ -3200,18 +3378,23 @@
 
 					tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value);
 				} else {
-					var rng = doc.selection.createRange();
+					var rng = doc.selection.createRange(), tmpRng = null;
 					var c = value.indexOf('<!--') != -1;
 
 					// Fix comment bug, add tag before comments
 					if (c)
 						value = tinyMCE.uniqueTag + value;
 
+					//	tmpRng = rng.duplicate(); // Store away range (Fixes Undo bookmark bug in IE)
+
 					if (rng.item)
 						rng.item(0).outerHTML = value;
 					else
 						rng.pasteHTML(value);
 
+					//if (tmpRng)
+					//	tmpRng.select(); // Restore range  (Fixes Undo bookmark bug in IE)
+
 					// Remove unique tag
 					if (c) {
 						var e = this.getDoc().getElementById('mceTMPElement');
@@ -3219,14 +3402,15 @@
 					}
 				}
 
+				tinyMCE.execCommand("mceAddUndoLevel");
 				tinyMCE.triggerNodeChange();
 			break;
 
 			case "mceStartTyping":
 				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex == -1) {
 					this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex;
+					tinyMCE.typingUndoIndex = tinyMCE.undoIndex;
 					this.execCommand('mceAddUndoLevel');
-					//tinyMCE.debug("mceStartTyping");
 				}
 				break;
 
@@ -3234,8 +3418,9 @@
 				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex != -1) {
 					this.execCommand('mceAddUndoLevel');
 					this.undoRedo.typingUndoIndex = -1;
-					//tinyMCE.debug("mceEndTyping");
 				}
+
+				tinyMCE.typingUndoIndex = -1;
 				break;
 
 			case "mceBeginUndoLevel":
@@ -3281,7 +3466,8 @@
 			case "Indent":
 				this.getDoc().execCommand(command, user_interface, value);
 				tinyMCE.triggerNodeChange();
-				if (tinyMCE.isMSIE) {
+
+				if (tinyMCE.isIE) {
 					var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote");
 					do {
 						if (n && n.nodeName == "BLOCKQUOTE") {
@@ -3300,7 +3486,7 @@
 					return;
 				}
 
-				if (tinyMCE.isMSIE) {
+				if (tinyMCE.isIE) {
 					try {
 						var rng = doc.selection.createRange();
 						rng.execCommand("RemoveFormat", false, null);
@@ -3406,21 +3592,30 @@
 		this.settings['area_width'] += deltaWidth;
 		this.settings['area_height'] += deltaHeight;
 
+		this.settings['width_style'] = "" + this.settings['width'];
+		this.settings['height_style'] = "" + this.settings['height'];
+
 		// Special % handling
 		if (("" + this.settings['width']).indexOf('%') != -1)
 			this.settings['area_width'] = "100%";
+		else
+			this.settings['width_style'] += 'px';
 
 		if (("" + this.settings['height']).indexOf('%') != -1)
 			this.settings['area_height'] = "100%";
+		else
+			this.settings['height_style'] += 'px';
 
 		if (("" + replace_element.style.width).indexOf('%') != -1) {
 			this.settings['width'] = replace_element.style.width;
 			this.settings['area_width'] = "100%";
+			this.settings['width_style'] = "100%";
 		}
 
 		if (("" + replace_element.style.height).indexOf('%') != -1) {
 			this.settings['height'] = replace_element.style.height;
 			this.settings['area_height'] = "100%";
+			this.settings['height_style'] = "100%";
 		}
 
 		html = tinyMCE.applyTemplate(html);
@@ -3489,7 +3684,7 @@
 		var dynamicIFrame = false;
 		var tElm = targetDoc.getElementById(this.editorId);
 
-		if (!tinyMCE.isMSIE) {
+		if (!tinyMCE.isIE) {
 			// Node case is preserved in XML strict mode
 			if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) {
 				tElm = tinyMCE._createIFrame(tElm, targetDoc);
@@ -3543,7 +3738,7 @@
 
 		// This timeout is needed in MSIE 5.5 for some odd reason
 		// it seems that the document.frames isn't initialized yet?
-		if (tinyMCE.isMSIE)
+		if (tinyMCE.isIE)
 			window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1);
 
 		tinyMCE.setupContent(this.editorId, true);
@@ -3573,9 +3768,28 @@
 		}
 	},
 
-	getFocusElement : function() {
-		return this.selection.getFocusElement();
-	},
+	getHTML : function(r) {
+		var h, d = this.getDoc(), b = this.getBody();
+
+		if (r)
+			return b.innerHTML;
+
+		h = tinyMCE._cleanupHTML(this, d, this.settings, b, false, true, false, true);
+
+		if (tinyMCE.getParam("convert_fonts_to_spans"))
+			tinyMCE.convertSpansToFonts(d);
+
+		return h;
+	},
+
+	setHTML : function(h) {
+		this.execCommand('mceSetContent', false, h);
+		this.repaint();
+	},
+
+	getFocusElement : function() {
+		return this.selection.getFocusElement();
+	},
 
 	getSel : function() {
 		return this.selection.getSel();
@@ -3586,13 +3800,13 @@
 	},
 
 	triggerSave : function(skip_cleanup, skip_callback) {
-		var e, nl = new Array(), i, s;
+		var e, nl = [], i, s;
 
 		this.switchSettings();
 		s = tinyMCE.settings;
 
 		// Force hidden tabs visible while serializing
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+		if (tinyMCE.isRealIE) {
 			e = this.iframeElement;
 
 			do {
@@ -3658,7 +3872,8 @@
 				nl[i].elm.className = s.hidden_tab_class;
 		}
 	}
-};
+
+	};
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */
 
@@ -3679,12 +3894,17 @@
 	s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');
 
 	// Weird MSIE bug, <p><hr /></p> breaks runtime?
-	if (tinyMCE.isMSIE)
+	if (tinyMCE.isIE)
 		s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");
 
+	// Weird tags will make IE error #bug: 1538495
+	if (tinyMCE.isIE)
+		s = s.replace(/<!(\s*)\/>/g, '');
+
 	// Convert relative anchors to absolute URLs ex: #something to file.htm#something
-	if (tinyMCE.getParam('convert_urls'))
-		s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
+	// Removed: Since local document anchors should never be forced absolute example edit.php?id=something
+	//if (tinyMCE.getParam('convert_urls'))
+	//	s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
 
 	return s;
 };
@@ -3826,7 +4046,7 @@
 	var h = doc.body.innerHTML;
 	h = h.replace(/<span/gi, '<font');
 	h = h.replace(/<\/span/gi, '</font');
-	doc.body.innerHTML = h;
+	tinyMCE.setInnerHTML(doc.body, h);
 
 	var s = doc.getElementsByTagName("font");
 	for (var i=0; i<s.length; i++) {
@@ -3865,7 +4085,7 @@
 	var h = doc.body.innerHTML;
 	h = h.replace(/<font/gi, '<span');
 	h = h.replace(/<\/font/gi, '</span');
-	doc.body.innerHTML = h;
+	tinyMCE.setInnerHTML(doc.body, h);
 
 	var fsClasses = tinyMCE.getParam('font_size_classes');
 	if (fsClasses != '')
@@ -3921,20 +4141,11 @@
 };
 
 TinyMCE_Engine.prototype.getContent = function(editor_id) {
-	var h;
-
 	if (typeof(editor_id) != "undefined")
-		tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id);
+		 tinyMCE.getInstanceById(editor_id).select();
 
-	if (tinyMCE.selectedInstance) {
-		h = tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true);
-
-		// When editing always use fonts internaly
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(this.selectedInstance.getDoc());
-
-		return h;
-	}
+	if (tinyMCE.selectedInstance)
+		return tinyMCE.selectedInstance.getHTML();
 
 	return null;
 };
@@ -3986,8 +4197,8 @@
 	}
 };
 
-TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit) {
-	var h, d, t1, t2, t3, t4, t5, c, s;
+TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit, inn) {
+	var h, d, t1, t2, t3, t4, t5, c, s, nb;
 
 	if (!tinyMCE.getParam('cleanup'))
 		return elm.innerHTML;
@@ -4025,25 +4236,28 @@
 	c.sourceIndex = -1;
 
 	if (s.cleanup_serializer == "xml")
-		h = c.serializeNodeAsXML(elm);
+		h = c.serializeNodeAsXML(elm, inn);
 	else
-		h = c.serializeNodeAsHTML(elm);
+		h = c.serializeNodeAsHTML(elm, inn);
 
 	if (d)
 		t3 = new Date().getTime();
 
 	// Post processing
+	nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? '&#160;' : '&nbsp;';
 	h = h.replace(/<\/?(body|head|html)[^>]*>/gi, '');
 	h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), '');
 	h = h.replace(/<p><hr \/><\/p>/g, '<hr />');
 	h = h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g, '<hr />');
-	h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>&nbsp;</td>');
-	h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>&nbsp;</p>');
-	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>&nbsp;</p>');
-	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>&nbsp;</p>');
-	h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>&nbsp;</p>');
+	h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>');
+	h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
+	h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko
+	h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko
+	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>' + nb + '</p>');
+	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
+	h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>' + nb + '</p>');
 	h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1');
-	h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>&nbsp;</p>');
+	h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>');
 
 	// Clean body
 	if (/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))
@@ -4059,7 +4273,7 @@
 	// Gecko specific processing
 	if (tinyMCE.isGecko) {
 		h = h.replace(/<o:p _moz-userdefined="" \/>/g, '');
-		h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>&nbsp;</td>');
+		h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>');
 	}
 
 	if (s.force_br_newlines)
@@ -4097,7 +4311,7 @@
 };
 
 function TinyMCE_Cleanup() {
-	this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
+	this.isIE = (navigator.appName == "Microsoft Internet Explorer");
 	this.rules = tinyMCE.clearArray(new Array());
 
 	// Default config
@@ -4118,7 +4332,7 @@
 
 	this.vElements = tinyMCE.clearArray(new Array());
 	this.vElementsRe = '';
-	this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|BUTTON|AREA)$/;
+	this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;
 	this.codeElementsRe = /^(SCRIPT|STYLE)$/;
 	this.serializationId = 0;
 	this.mceAttribs = {
@@ -4144,6 +4358,7 @@
 		this.nlBeforeRe = this._arrayToRe(s.newline_before_elements.split(','), 'gi', '<(',  ')([^>]*)>');
 		this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(',  ')([^>]*)>');
 		this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>');
+		this.serializedNodes = [];
 
 		if (s.invalid_elements != '')
 			this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$');
@@ -4186,6 +4401,71 @@
 		this.vElementsRe = this._arrayToRe(this.vElements, '');
 	},
 
+	isValid : function(n) {
+		this._setupRules(); // Will initialize cleanup rules
+
+		// Clean the name up a bit
+		n = n.replace(/[^a-z0-9]+/gi, '').toUpperCase();
+
+		return !tinyMCE.getParam('cleanup') || this.vElementsRe.test(n);
+	},
+
+	addChildRemoveRuleStr : function(s) {
+		var x, y, p, i, t, tn, ta, cl, r;
+
+		if (!s)
+			return;
+
+		ta = s.split(',');
+		for (x=0; x<ta.length; x++) {
+			s = ta[x];
+
+			// Split tag/children
+			p = this.split(/\[|\]/, s);
+			if (p == null || p.length < 1)
+				t = s.toUpperCase();
+			else
+				t = p[0].toUpperCase();
+
+			// Handle all tag names
+			tn = this.split('/', t);
+			for (y=0; y<tn.length; y++) {
+				r = "^(";
+
+				// Build regex
+				cl = this.split(/\|/, p[1]);
+				for (i=0; i<cl.length; i++) {
+					if (cl[i] == '%istrict')
+						r += tinyMCE.inlineStrict;
+					else if (cl[i] == '%itrans')
+						r += tinyMCE.inlineTransitional;
+					else if (cl[i] == '%istrict_na')
+						r += tinyMCE.inlineStrict.substring(2);
+					else if (cl[i] == '%itrans_na')
+						r += tinyMCE.inlineTransitional.substring(2);
+					else if (cl[i] == '%btrans')
+						r += tinyMCE.blockElms;
+					else if (cl[i] == '%strict')
+						r += tinyMCE.blockStrict;
+					else
+						r += (cl[i].charAt(0) != '#' ? cl[i].toUpperCase() : cl[i]);
+
+					r += (i != cl.length - 1 ? '|' : '');
+				}
+
+				r += ')$';
+//tinyMCE.debug(t + "=" + r);
+				if (this.childRules == null)
+					this.childRules = tinyMCE.clearArray(new Array());
+
+				this.childRules[tn[y]] = new RegExp(r);
+
+				if (p.length > 1)
+					this.childRules[tn[y]].wrapTag = p[2];
+			}
+		}
+	},
+
 	parseRuleStr : function(s) {
 		var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray(new Array()), dv;
 
@@ -4233,6 +4513,15 @@
 					for (i=0; i<a.length; i++) {
 						t = a[i];
 
+						if (t.charAt(0) == '!') {
+							a[i] = t = t.substring(1);
+
+							if (!r.reqAttribsRe)
+								r.reqAttribsRe = '\\s+(' + t;
+							else
+								r.reqAttribsRe += '|' + t;
+						}
+
 						av = new RegExp('(=|:|<)(.*?)$').exec(t);
 						t = t.replace(new RegExp('(=|:|<).*?$'), '');
 						if (av && av.length > 0) {
@@ -4252,7 +4541,7 @@
 								if (!r.validAttribValues)
 									r.validAttribValues = tinyMCE.clearArray(new Array());
 
-								r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), '');
+								r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i');
 							}
 						}
 
@@ -4261,6 +4550,9 @@
 						a[i] = t.toLowerCase();
 					}
 
+					if (r.reqAttribsRe)
+						r.reqAttribsRe = new RegExp(r.reqAttribsRe + ')=\"', 'g');
+
 					r.vAttribsRe += ')$';
 					r.vAttribsRe = this._wildcardToRe(r.vAttribsRe);
 					r.vAttribsReIsWild = new RegExp('\\*|\\?|\\+', 'g').test(r.vAttribsRe);
@@ -4285,7 +4577,7 @@
 		var s, b;
 
 		if (!this.xmlDoc) {
-			if (this.isMSIE) {
+			if (this.isIE) {
 				try {this.xmlDoc = new ActiveXObject('MSXML2.DOMDocument');} catch (e) {}
 
 				if (!this.xmlDoc)
@@ -4305,7 +4597,7 @@
 
 		this._convertToXML(n, b);
 
-		if (this.isMSIE)
+		if (this.isIE)
 			return this.xmlDoc.xml;
 		else
 			return new XMLSerializer().serializeToString(this.xmlDoc);
@@ -4356,23 +4648,36 @@
 		}
 	},
 
-	serializeNodeAsHTML : function(n) {
-		var en, no, h = '', i, l, r, cn, va = false, f = false, at, hc;
+	serializeNodeAsHTML : function(n, inn) {
+		var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr;
 
 		this._setupRules(); // Will initialize cleanup rules
 
 		if (this._isDuplicate(n))
 			return '';
 
+		// Skip non valid child elements
+		if (n.parentNode && this.childRules != null) {
+			cr = this.childRules[n.parentNode.nodeName];
+
+			if (typeof(cr) != "undefined" && !cr.test(n.nodeName)) {
+				st = true;
+				t = null;
+			}
+		}
+
 		switch (n.nodeType) {
 			case 1: // Element
 				hc = n.hasChildNodes();
 
+				if (st)
+					break;
+
 				// MSIE sometimes produces <//tag>
-				if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && n.nodeName.indexOf('/') != -1)
+				if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1)
 					break;
 
-				if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName))) {
+				if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName)) && !inn) {
 					va = true;
 
 					r = this.rules[n.nodeName];
@@ -4392,7 +4697,7 @@
 					if (r.removeEmpty && !hc)
 						return "";
 
-					h += '<' + en;
+					t = '<' + en;
 
 					if (r.vAttribsReIsWild) {
 						// Serialize wildcard attributes
@@ -4400,12 +4705,12 @@
 						for (i=at.length-1; i>-1; i--) {
 							no = at[i];
 							if (no.specified && r.vAttribsRe.test(no.nodeName))
-								h += this._serializeAttribute(n, r, no.nodeName);
+								t += this._serializeAttribute(n, r, no.nodeName);
 						}
 					} else {
 						// Serialize specific attributes
 						for (i=r.vAttribs.length-1; i>-1; i--)
-							h += this._serializeAttribute(n, r, r.vAttribs[i]);
+							t += this._serializeAttribute(n, r, r.vAttribs[i]);
 					}
 
 					// Serialize mce_ atts
@@ -4414,28 +4719,39 @@
 
 						for (no in at) {
 							if (at[no])
-								h += this._serializeAttribute(n, r, at[no]);
+								t += this._serializeAttribute(n, r, at[no]);
 						}
 					}
 
+					// Check for required attribs
+					if (r.reqAttribsRe && !t.match(r.reqAttribsRe))
+						t = null;
+
 					// Close these
-					if (this.closeElementsRe.test(n.nodeName))
-						return h + ' />';
+					if (t != null && this.closeElementsRe.test(n.nodeName))
+						return t + ' />';
 
-					h += '>';
+					if (t != null)
+						h += t + '>';
 
-					if (this.isMSIE && this.codeElementsRe.test(n.nodeName))
+					if (this.isIE && this.codeElementsRe.test(n.nodeName))
 						h += n.innerHTML;
 				}
 			break;
 
 			case 3: // Text
+				if (st)
+					break;
+
 				if (n.parentNode && this.codeElementsRe.test(n.parentNode.nodeName))
-					return this.isMSIE ? '' : n.nodeValue;
+					return this.isIE ? '' : n.nodeValue;
 
 				return this.xmlEncode(n.nodeValue);
 
 			case 8: // Comment
+				if (st)
+					break;
+
 				return "<!--" + this._trimComment(n.nodeValue) + "-->";
 		}
 
@@ -4451,7 +4767,7 @@
 			h += this.fillStr;
 
 		// End element
-		if (va)
+		if (t != null && va)
 			h += '</' + en + '>';
 
 		return h;
@@ -4488,8 +4804,12 @@
 		if (av.length != 0 && av == "{$uid}")
 			av = "uid_" + (this.idCount++);
 
-		if (av.length != 0)
-			return " " + an + "=" + '"' + this.xmlEncode(av) + '"';
+		if (av.length != 0) {
+			if (an.indexOf('on') != 0)
+				av = this.xmlEncode(av);
+
+			return " " + an + "=" + '"' + av + '"';
+		}
 
 		return "";
 	},
@@ -4497,6 +4817,12 @@
 	formatHTML : function(h) {
 		var s = this.settings, p = '', i = 0, li = 0, o = '', l;
 
+		// Replace BR in pre elements to \n
+		h = h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi, function (a, b, c) {
+			c = c.replace(/<br\s*\/>/gi, '\n');
+			return '<pre' + b + '>' + c + '</pre>';
+		});
+
 		h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :)
 		h = '\n' + h;
 		h = h.replace(new RegExp('\\n\\s+', 'gi'), '\n'); // Remove previous formatting
@@ -4527,7 +4853,7 @@
 	},
 
 	xmlEncode : function(s) {
-		var i, l, e, o = '', c;
+		var cl = this;
 
 		this._setupEntities(); // Will intialize lookup table
 
@@ -4536,29 +4862,16 @@
 				return tinyMCE.xmlEncode(s);
 
 			case "named":
-				for (i=0, l=s.length; i<l; i++) {
-					c = s.charCodeAt(i);
-					e = this.entities[c];
-
-					if (e && e != '')
-						o += '&' + e + ';';
-					else
-						o += String.fromCharCode(c);
-				}
+				return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) {
+					b = cl.entities[c.charCodeAt(0)];
 
-				return o;
+					return b ? '&' + b + ';' : c;
+				});
 
 			case "numeric":
-				for (i=0, l=s.length; i<l; i++) {
-					c = s.charCodeAt(i);
-
-					if (c > 127 || c == 60 || c == 62 || c == 38 || c == 39 || c == 34)
-						o += '&#' + c + ";";
-					else
-						o += String.fromCharCode(c);
-				}
-
-				return o;
+				return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) {
+					return b ? '&#' + c.charCodeAt(0) + ';' : c;
+				});
 		}
 
 		return s;
@@ -4596,16 +4909,16 @@
 		if (n == "class" && !v)
 			v = e.className;
 
-		if (this.isMSIE && n == "http-equiv")
+		if (this.isIE && n == "http-equiv")
 			v = e.httpEquiv;
 
-		if (this.isMSIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")
+		if (this.isIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")
 			v = "";
 
-		if (this.isMSIE && e.nodeName == "INPUT" && n == "size" && v == "20")
+		if (this.isIE && e.nodeName == "INPUT" && n == "size" && v == "20")
 			v = "";
 
-		if (this.isMSIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647")
+		if (this.isIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647")
 			v = "";
 
 		if (n == "style" && !tinyMCE.isOpera)
@@ -4679,6 +4992,7 @@
 		if (!this.rulesDone) {
 			this.addRuleStr(s.valid_elements);
 			this.addRuleStr(s.extended_valid_elements);
+			this.addChildRemoveRuleStr(s.valid_child_elements);
 
 			this.rulesDone = true;
 		}
@@ -4690,7 +5004,7 @@
 		if (!this.settings.fix_content_duplication)
 			return false;
 
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera && n.nodeType == 1) {
+		if (tinyMCE.isRealIE && n.nodeType == 1) {
 			// Mark elements
 			if (n.mce_serialized == this.serializationId)
 				return true;
@@ -4708,10 +5022,44 @@
 
 		return false;
 	}
-};
+
+	};
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */
 
+TinyMCE_Engine.prototype.createTagHTML = function(tn, a, h) {
+	var o = '', f = tinyMCE.xmlEncode;
+
+	o = '<' + tn;
+
+	if (a) {
+		for (n in a) {
+			if (typeof(a[n]) != 'function' && a[n] != null)
+				o += ' ' + f(n) + '="' + f('' + a[n]) + '"';
+		}
+	}
+
+	o += !h ? ' />' : '>' + h + '</' + tn + '>';
+
+	return o;
+};
+
+TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) {
+	var o = d.createElement(tn);
+
+	if (a) {
+		for (n in a) {
+			if (typeof(a[n]) != 'function' && a[n] != null)
+				tinyMCE.setAttrib(o, n, a[n]);
+		}
+	}
+
+	if (h)
+		o.innerHTML = h;
+
+	return o;
+};
+
 TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) {
 	return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
 };
@@ -4731,13 +5079,10 @@
 	return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);
 };
 
-TinyMCE_Engine.prototype.getParentBlockElement = function(n) {
-	while (n) {
-		if (this.isBlockElement(n))
-			return n;
-
-		n = n.parentNode;
-	}
+TinyMCE_Engine.prototype.getParentBlockElement = function(n, r) {
+	return this.getParentNode(n, function(n) {
+		return tinyMCE.isBlockElement(n);
+	}, r);
 
 	return null;
 };
@@ -4752,7 +5097,16 @@
 TinyMCE_Engine.prototype.setInnerHTML = function(e, h) {
 	var i, nl, n;
 
-	if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+	// Convert all strong/em to b/i in Gecko
+	if (tinyMCE.isGecko) {
+		h = h.replace(/<strong/gi, '<b');
+		h = h.replace(/<em(\/?)/gi, '<i');
+		h = h.replace(/<em /gi, '<i');
+		h = h.replace(/<\/strong>/gi, '</b>');
+		h = h.replace(/<\/em>/gi, '</i>');
+	}
+
+	if (tinyMCE.isRealIE) {
 		// Since MSIE handles invalid HTML better that valid XHTML we
 		// need to make some things invalid. <hr /> gets converted to <hr>.
 		h = h.replace(/\s\/>/g, '>');
@@ -4782,23 +5136,28 @@
 };
 
 TinyMCE_Engine.prototype.getOuterHTML = function(e) {
-	if (tinyMCE.isMSIE)
+	if (tinyMCE.isIE)
 		return e.outerHTML;
 
 	var d = e.ownerDocument.createElement("body");
-	d.appendChild(e);
+	d.appendChild(e.cloneNode(true));
 	return d.innerHTML;
 };
 
-TinyMCE_Engine.prototype.setOuterHTML = function(e, h) {
-	if (tinyMCE.isMSIE) {
+TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) {
+	var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;
+
+	if (tinyMCE.isIE && e.nodeType == 1)
 		e.outerHTML = h;
-		return;
-	}
+	else {
+		t = d.createElement("body");
+		t.innerHTML = h;
 
-	var d = e.ownerDocument.createElement("body");
-	d.innerHTML = h;
-	e.parentNode.replaceChild(d.firstChild, e);
+		for (i=0, nl=t.childNodes; i<nl.length; i++)
+			e.parentNode.insertBefore(nl[i].cloneNode(true), e);
+
+		e.parentNode.removeChild(e);
+	}
 };
 
 TinyMCE_Engine.prototype._getElementById = function(id, d) {
@@ -4825,56 +5184,28 @@
 };
 
 TinyMCE_Engine.prototype.getNodeTree = function(n, na, t, nn) {
-	var i;
-
-	if (typeof(t) == "undefined" || n.nodeType == t && (typeof(nn) == "undefined" || n.nodeName == nn))
-		na[na.length] = n;
-
-	if (n.hasChildNodes()) {
-		for (i=0; i<n.childNodes.length; i++)
-			tinyMCE.getNodeTree(n.childNodes[i], na, t, nn);
-	}
-
-	return na;
+	return this.selectNodes(n, function(n) {
+		return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
+	}, na ? na : new Array());
 };
 
-TinyMCE_Engine.prototype.getParentElement = function(node, names, attrib_name, attrib_value) {
-	if (typeof(names) == "undefined") {
-		if (node.nodeType == 1)
-			return node;
-
-		// Find parent node that is a element
-		while ((node = node.parentNode) != null && node.nodeType != 1) ;
+TinyMCE_Engine.prototype.getParentElement = function(n, na, f, r) {
+	var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;
 
-		return node;
-	}
-
-	if (node == null)
-		return null;
-
-	var namesAr = names.toUpperCase().split(',');
-
-	do {
-		for (var i=0; i<namesAr.length; i++) {
-			if (node.nodeName == namesAr[i] || names == "*") {
-				if (typeof(attrib_name) == "undefined")
-					return node;
-				else if (node.getAttribute(attrib_name)) {
-					if (typeof(attrib_value) == "undefined") {
-						if (node.getAttribute(attrib_name) != "")
-							return node;
-					} else if (node.getAttribute(attrib_name) == attrib_value)
-						return node;
-				}
-			}
-		}
-	} while ((node = node.parentNode) != null);
+	// Compatiblity with old scripts where f param was a attribute string
+	if (f && typeof(f) == 'string')
+		return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) != '';});
 
-	return null;
+	return this.getParentNode(n, function(n) {
+		return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));
+	}, r);
 };
 
-TinyMCE_Engine.prototype.getParentNode = function(n, f) {
+TinyMCE_Engine.prototype.getParentNode = function(n, f, r) {
 	while (n) {
+		if (n == r)
+			return null;
+
 		if (f(n))
 			return n;
 
@@ -4884,15 +5215,17 @@
 	return null;
 };
 
-TinyMCE_Engine.prototype.getAttrib = function(elm, name, default_value) {
-	if (typeof(default_value) == "undefined")
-		default_value = "";
+TinyMCE_Engine.prototype.getAttrib = function(elm, name, dv) {
+	var v;
+
+	if (typeof(dv) == "undefined")
+		dv = "";
 
 	// Not a element
 	if (!elm || elm.nodeType != 1)
-		return default_value;
+		return dv;
 
-	var v = elm.getAttribute(name);
+	v = elm.getAttribute(name);
 
 	// Try className for class attrib
 	if (name == "class" && !v)
@@ -4906,47 +5239,46 @@
 	if (tinyMCE.isGecko && name == "href" && elm.href != null && elm.href != "")
 		v = elm.href;
 
-	if (name == "http-equiv" && tinyMCE.isMSIE)
+	if (name == "http-equiv" && tinyMCE.isIE)
 		v = elm.httpEquiv;
 
 	if (name == "style" && !tinyMCE.isOpera)
 		v = elm.style.cssText;
 
-	return (v && v != "") ? v : default_value;
+	return (v && v != "") ? v : dv;
 };
 
-TinyMCE_Engine.prototype.setAttrib = function(element, name, value, fix_value) {
-	if (typeof(value) == "number" && value != null)
-		value = "" + value;
+TinyMCE_Engine.prototype.setAttrib = function(el, name, va, fix) {
+	if (typeof(va) == "number" && va != null)
+		va = "" + va;
 
-	if (fix_value) {
-		if (value == null)
-			value = "";
+	if (fix) {
+		if (va == null)
+			va = "";
 
-		var re = new RegExp('[^0-9%]', 'g');
-		value = value.replace(re, '');
+		va = va.replace(/[^0-9%]/g, '');
 	}
 
 	if (name == "style")
-		element.style.cssText = value;
+		el.style.cssText = va;
 
 	if (name == "class")
-		element.className = value;
+		el.className = va;
 
-	if (value != null && value != "" && value != -1)
-		element.setAttribute(name, value);
+	if (va != null && va != "" && va != -1)
+		el.setAttribute(name, va);
 	else
-		element.removeAttribute(name);
+		el.removeAttribute(name);
 };
 
-TinyMCE_Engine.prototype.setStyleAttrib = function(elm, name, value) {
-	eval('elm.style.' + name + '=value;');
+TinyMCE_Engine.prototype.setStyleAttrib = function(e, n, v) {
+	e.style[n] = v;
 
-	// Style attrib deleted
-	if (tinyMCE.isMSIE && value == null || value == '') {
-		var str = tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));
-		elm.style.cssText = str;
-		elm.setAttribute("style", str);
+	// Style attrib deleted in IE
+	if (tinyMCE.isIE && v == null || v == '') {
+		v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));
+		e.style.cssText = v;
+		e.setAttribute("style", v);
 	}
 };
 
@@ -4967,16 +5299,16 @@
 	}
 };
 
-TinyMCE_Engine.prototype.getAbsPosition = function(n) {
-	var p = {absLeft : 0, absTop : 0};
+TinyMCE_Engine.prototype.getAbsPosition = function(n, cn) {
+	var l = 0, t = 0;
 
-	while (n) {
-		p.absLeft += n.offsetLeft;
-		p.absTop += n.offsetTop;
+	while (n && n != cn) {
+		l += n.offsetLeft;
+		t += n.offsetTop;
 		n = n.offsetParent;
 	}
 
-	return p;
+	return {absLeft : l, absTop : t};
 };
 
 TinyMCE_Engine.prototype.prevNode = function(e, n) {
@@ -5005,6 +5337,16 @@
 	return null;
 };
 
+TinyMCE_Engine.prototype.selectElements = function(n, na, f) {
+	var i, a = [], nl, x;
+
+	for (x=0, na = na.split(','); x<na.length; x++)
+		for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
+			(!f || f(nl[i])) && a.push(nl[i]);
+
+	return a;
+};
+
 TinyMCE_Engine.prototype.selectNodes = function(n, f, a) {
 	var i;
 
@@ -5024,19 +5366,16 @@
 
 TinyMCE_Engine.prototype.addCSSClass = function(e, c, b) {
 	var o = this.removeCSSClass(e, c);
-
 	return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
 };
 
 TinyMCE_Engine.prototype.removeCSSClass = function(e, c) {
-	var a = this.explode(' ', e.className), i;
-
-	for (i=0; i<a.length; i++) {
-		if (a[i] == c)
-			a[i] = '';
-	}
+	c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+	return e.className = c != ' ' ? c : '';
+};
 
-	return e.className = a.join(' ');
+TinyMCE_Engine.prototype.hasCSSClass = function(n, c) {
+	return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
 };
 
 TinyMCE_Engine.prototype.renameElement = function(e, n, d) {
@@ -5061,6 +5400,17 @@
 	}
 };
 
+TinyMCE_Engine.prototype.getViewPort = function(w) {
+	var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement;
+
+	return {
+		left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft),
+		top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop),
+		width : w.innerWidth || (m ? de.clientWidth : b.clientWidth),
+		height : w.innerHeight || (m ? de.clientHeight : b.clientHeight)
+	};
+};
+
 /* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */
 
 TinyMCE_Engine.prototype.parseURL = function(url_str) {
@@ -5228,10 +5578,10 @@
 };
 
 TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url) {
-	var baseURL = this.parseURL(base_url);
+	var baseURL = this.parseURL(base_url), baseURLParts, relURLParts;
 	var relURL = this.parseURL(relative_url);
 
-	if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)
+	if (relative_url == "" || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))
 		return relative_url;
 
 	// Split parts
@@ -5306,7 +5656,7 @@
 		return url;
 
 	// Fix relative/Mozilla
-	if (!tinyMCE.isMSIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
+	if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
 		return tinyMCE.settings['base_href'] + url;
 
 	// Handle relative URLs
@@ -5353,12 +5703,14 @@
 };
 
 TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) {
+	var i, elms, src, href, mhref, msrc;
+
 	// Convert all image URL:s to absolute URL
-	var elms = body.getElementsByTagName("img");
-	for (var i=0; i<elms.length; i++) {
-		var src = tinyMCE.getAttrib(elms[i], 'src');
+	elms = body.getElementsByTagName("img");
+	for (i=0; i<elms.length; i++) {
+		src = tinyMCE.getAttrib(elms[i], 'src');
 
-		var msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
+		msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
 		if (msrc != "")
 			src = msrc;
 
@@ -5369,11 +5721,11 @@
 	}
 
 	// Convert all link URL:s to absolute URL
-	var elms = body.getElementsByTagName("a");
-	for (var i=0; i<elms.length; i++) {
-		var href = tinyMCE.getAttrib(elms[i], 'href');
+	elms = body.getElementsByTagName("a");
+	for (i=0; i<elms.length; i++) {
+		href = tinyMCE.getAttrib(elms[i], 'href');
 
-		var mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
+		mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
 		if (mhref != "")
 			href = mhref;
 
@@ -5387,26 +5739,40 @@
 /* file:jscripts/tiny_mce/classes/TinyMCE_Array.class.js */
 
 TinyMCE_Engine.prototype.clearArray = function(a) {
-	for (var k in a)
-		a[k] = null;
+	var n;
+
+	for (n in a)
+		a[n] = null;
 
 	return a;
 };
 
+TinyMCE_Engine.prototype.explode = function(d, s) {
+	var ar = s.split(d), oar = new Array(), i;
+
+	for (i = 0; i<ar.length; i++) {
+		if (ar[i] != "")
+			oar[oar.length] = ar[i];
+	}
+
+	return oar;
+};
+
 /* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */
 
 TinyMCE_Engine.prototype._setEventsEnabled = function(node, state) {
-	var events = new Array('onfocus','onblur','onclick','ondblclick',
+	var evs, x, y, elms, i, event;
+	var events = ['onfocus','onblur','onclick','ondblclick',
 				'onmousedown','onmouseup','onmouseover','onmousemove',
-				'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');
+				'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];
 
-	var evs = tinyMCE.settings['event_elements'].split(',');
-	for (var y=0; y<evs.length; y++){
-		var elms = node.getElementsByTagName(evs[y]);
-		for (var i=0; i<elms.length; i++) {
-			var event = "";
+	evs = tinyMCE.settings['event_elements'].split(',');
+	for (y=0; y<evs.length; y++){
+		elms = node.getElementsByTagName(evs[y]);
+		for (i=0; i<elms.length; i++) {
+			event = "";
 
-			for (var x=0; x<events.length; x++) {
+			for (x=0; x<events.length; x++) {
 				if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
 					event = tinyMCE.cleanupEventStr("" + event);
 
@@ -5453,7 +5819,7 @@
 			if (!tinyMCE.isInstance(inst))
 				continue;
 
-			tinyMCE.selectedInstance = inst;
+			inst.select();
 			win = inst.getWin();
 
 			if (win && win.event) {
@@ -5471,38 +5837,64 @@
 	}
 };
 
+TinyMCE_Engine.prototype.findEvent = function(e) {
+	var n, inst;
+
+	if (e)
+		return e;
+
+	for (n in tinyMCE.instances) {
+		inst = tinyMCE.instances[n];
+
+		if (tinyMCE.isInstance(inst) && inst.getWin().event)
+			return inst.getWin().event;
+	}
+
+	return null;
+};
+
 TinyMCE_Engine.prototype.unloadHandler = function() {
 	tinyMCE.triggerSave(true, true);
 };
 
 TinyMCE_Engine.prototype.addEventHandlers = function(inst) {
-	var doc = inst.getDoc();
+	this.setEventHandlers(inst, 1);
+};
+
+TinyMCE_Engine.prototype.setEventHandlers = function(inst, s) {
+	var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;
+
+	ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];
+	ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];
 
 	inst.switchSettings();
 
-	if (tinyMCE.isMSIE) {
-		tinyMCE.addEvent(doc, "keypress", TinyMCE_Engine.prototype._eventPatch);
-		tinyMCE.addEvent(doc, "keyup", TinyMCE_Engine.prototype._eventPatch);
-		tinyMCE.addEvent(doc, "keydown", TinyMCE_Engine.prototype._eventPatch);
-		tinyMCE.addEvent(doc, "mouseup", TinyMCE_Engine.prototype._eventPatch);
-		tinyMCE.addEvent(doc, "mousedown", TinyMCE_Engine.prototype._eventPatch);
-		tinyMCE.addEvent(doc, "click", TinyMCE_Engine.prototype._eventPatch);
+	if (tinyMCE.isIE) {
+		for (i=0; i<ie.length; i++)
+			f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);
 	} else {
-		tinyMCE.addEvent(doc, "keypress", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "keydown", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "keyup", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "click", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "mouseup", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "mousedown", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "focus", tinyMCE.handleEvent);
-		tinyMCE.addEvent(doc, "blur", tinyMCE.handleEvent);
+		for (i=0; i<ot.length; i++)
+			f(doc, ot[i], tinyMCE.handleEvent);
 
 		eval('try { doc.designMode = "On"; } catch(e) {}'); // Force designmode
 	}
 };
 
 TinyMCE_Engine.prototype.onMouseMove = function() {
-	var inst;
+	var inst, lh;
+
+	// Fix for IE7 bug where it's not restoring hover on anchors correctly
+	if (tinyMCE.lastHover) {
+		lh = tinyMCE.lastHover;
+
+		// Call out on menus and refresh class on normal buttons
+		if (lh.className.indexOf('mceMenu') != -1)
+			tinyMCE._menuButtonEvent('out', lh);
+		else
+			lh.className = lh.className;
+
+		tinyMCE.lastHover = null;
+	}
 
 	if (!tinyMCE.hasMouseMoved) {
 		inst = tinyMCE.selectedInstance;
@@ -5519,20 +5911,52 @@
 };
 
 TinyMCE_Engine.prototype.cancelEvent = function(e) {
-	if (tinyMCE.isMSIE) {
+	if (!e)
+		return false;
+
+	if (tinyMCE.isIE) {
 		e.returnValue = false;
 		e.cancelBubble = true;
-	} else
+	} else {
 		e.preventDefault();
+		e.stopPropagation && e.stopPropagation();
+	}
+
+	return false;
 };
 
 TinyMCE_Engine.prototype.addEvent = function(o, n, h) {
+	// Add cleanup for all non unload events
+	if (n != 'unload') {
+		function clean() {
+			var ex;
+
+			try {
+				tinyMCE.removeEvent(o, n, h);
+				tinyMCE.removeEvent(window, 'unload', clean);
+				o = n = h = null;
+			} catch (ex) {
+				// IE may produce access denied exception on unload
+			}
+		}
+
+		// Add memory cleaner
+		tinyMCE.addEvent(window, 'unload', clean);
+	}
+
 	if (o.attachEvent)
 		o.attachEvent("on" + n, h);
 	else
 		o.addEventListener(n, h, false);
 };
 
+TinyMCE_Engine.prototype.removeEvent = function(o, n, h) {
+	if (o.detachEvent)
+		o.detachEvent("on" + n, h);
+	else
+		o.removeEventListener(n, h, false);
+};
+
 TinyMCE_Engine.prototype.addSelectAccessibility = function(e, s, w) {
 	// Add event handlers 
 	if (!s._isAccessible) {
@@ -5547,8 +5971,8 @@
 
 TinyMCE_Engine.prototype.accessibleEventHandler = function(e) {
 	var win = this._win;
-	e = tinyMCE.isMSIE ? win.event : e;
-	var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
+	e = tinyMCE.isIE ? win.event : e;
+	var elm = tinyMCE.isIE ? e.srcElement : e.target;
 
 	// Unpiggyback onchange on blur
 	if (e.type == "blur") {
@@ -5582,7 +6006,7 @@
 TinyMCE_Engine.prototype._resetIframeHeight = function() {
 	var ife;
 
-	if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+	if (tinyMCE.isRealIE) {
 		ife = tinyMCE.selectedInstance.iframeElement;
 
 /*		if (ife._oldWidth) {
@@ -5608,17 +6032,17 @@
 		var inst = this.instance;
 		var e, r = this.getRng(), h;
 
-		if (tinyMCE.isSafari) {
-			// Not realy perfect!!
-			return r.toString();
-		}
+		if (!r)
+			return null;
 
 		e = document.createElement("body");
 
-		if (tinyMCE.isGecko)
+		if (r.cloneContents)
 			e.appendChild(r.cloneContents());
-		else 
+		else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined')
 			e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
+		else
+			e.innerHTML = r.toString(); // Failed, use text for now
 
 		h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false);
 
@@ -5633,7 +6057,7 @@
 		var inst = this.instance;
 		var d, r, s, t;
 
-		if (tinyMCE.isMSIE) {
+		if (tinyMCE.isIE) {
 			d = inst.getDoc();
 
 			if (d.selection.type == "Text") {
@@ -5654,29 +6078,23 @@
 	},
 
 	getBookmark : function(simple) {
+		var inst = this.instance;
 		var rng = this.getRng();
-		var doc = this.instance.getDoc();
-		var sp, le, s, e, nl, i, si, ei;
-		var trng, sx, sy, xx = -999999999;
-
-		// Skip Opera for now
-		if (tinyMCE.isOpera)
-			return null;
+		var doc = inst.getDoc(), b = inst.getBody();
+		var sp, le, s, e, nl, i, si, ei, w;
+		var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();
 
-		sx = doc.body.scrollLeft + doc.documentElement.scrollLeft;
-		sy = doc.body.scrollTop + doc.documentElement.scrollTop;
+		sx = vp.left;
+		sy = vp.top;
 
-		if (tinyMCE.isSafari || tinyMCE.isGecko)
+		if (tinyMCE.isSafari || tinyMCE.isOpera || simple)
 			return {rng : rng, scrollX : sx, scrollY : sy};
 
-		if (tinyMCE.isMSIE) {
-			if (simple)
-				return {rng : rng};
-
+		if (tinyMCE.isIE) {
 			if (rng.item) {
 				e = rng.item(0);
 
-				nl = doc.getElementsByTagName(e.nodeName);
+				nl = b.getElementsByTagName(e.nodeName);
 				for (i=0; i<nl.length; i++) {
 					if (e == nl[i]) {
 						sp = i;
@@ -5691,6 +6109,11 @@
 					scrollY : sy
 				};
 			} else {
+				trng = doc.body.createTextRange();
+				trng.moveToElementText(inst.getBody());
+				trng.collapse(true);
+				bp = Math.abs(trng.move('character', xx));
+
 				trng = rng.duplicate();
 				trng.collapse(true);
 				sp = Math.abs(trng.move('character', xx));
@@ -5700,7 +6123,7 @@
 				le = Math.abs(trng.move('character', xx)) - sp;
 
 				return {
-					start : sp,
+					start : sp - bp,
 					length : le,
 					scrollX : sx,
 					scrollY : sy
@@ -5709,51 +6132,64 @@
 		}
 
 		if (tinyMCE.isGecko) {
-			s = tinyMCE.getParentElement(rng.startContainer);
-			for (si=0; si<s.childNodes.length && s.childNodes[si] != rng.startContainer; si++) ;
+			s = this.getSel();
+			e = this.getFocusElement();
 
-			nl = doc.getElementsByTagName(s.nodeName);
-			for (i=0; i<nl.length; i++) {
-					if (s == nl[i]) {
+			if (!s)
+				return null;
+
+			if (e && e.nodeName == 'IMG') {
+				/*nl = b.getElementsByTagName('IMG');
+				for (i=0; i<nl.length; i++) {
+					if (e == nl[i]) {
 						sp = i;
 						break;
 					}
+				}*/
+
+				return {
+					start : -1,
+					end : -1,
+					index : sp,
+					scrollX : sx,
+					scrollY : sy
+				};
 			}
 
-			e = tinyMCE.getParentElement(rng.endContainer);
-			for (ei=0; ei<e.childNodes.length && e.childNodes[ei] != rng.endContainer; ei++) ;
+			// Caret or selection
+			if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
+				e = this._getPosText(b, s.anchorNode, s.focusNode);
 
-			nl = doc.getElementsByTagName(e.nodeName);
-			for (i=0; i<nl.length; i++) {
-					if (e == nl[i]) {
-						le = i;
-						break;
-					}
-			}
+				if (!e)
+					return {scrollX : sx, scrollY : sy};
 
-			//tinyMCE.debug(s.nodeName, sp, rng.startOffset, '-' , e.nodeName, le, rng.endOffset);
-			//tinyMCE.debug(sx, sy);
+				return {
+					start : e.start + s.anchorOffset,
+					end : e.end + s.focusOffset,
+					scrollX : sx,
+					scrollY : sy
+				};
+			} else {
+				e = this._getPosText(b, rng.startContainer, rng.endContainer);
 
-			return {
-				startTag : s.nodeName,
-				start : sp,
-				startIndex : si,
-				endTag : e.nodeName,
-				end : le,
-				endIndex : ei,
-				startOffset : rng.startOffset,
-				endOffset : rng.endOffset,
-				scrollX : sx,
-				scrollY : sy
-			};
+				if (!e)
+					return {scrollX : sx, scrollY : sy};
+
+				return {
+					start : e.start + rng.startOffset,
+					end : e.end + rng.endOffset,
+					scrollX : sx,
+					scrollY : sy
+				};
+			}
 		}
 
 		return null;
 	},
 
 	moveToBookmark : function(bookmark) {
-		var rng, nl, i;
 		var inst = this.instance;
+		var rng, nl, i, ex, b = inst.getBody(), sd;
 		var doc = inst.getDoc();
 		var win = inst.getWin();
 		var sel = this.getSel();
@@ -5762,22 +6198,27 @@
 			return false;
 
 		if (tinyMCE.isSafari) {
-			sel.setBaseAndExtent(bookmark.startContainer, bookmark.startOffset, bookmark.endContainer, bookmark.endOffset);
+			sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset);
 			return true;
 		}
 
-		if (tinyMCE.isMSIE) {
+		if (tinyMCE.isRealIE) {
 			if (bookmark.rng) {
-				bookmark.rng.select();
+				try {
+					bookmark.rng.select();
+				} catch (ex) {
+					// Ignore
+				}
+
 				return true;
 			}
 
 			win.focus();
 
 			if (bookmark.tag) {
-				rng = inst.getBody().createControlRange();
+				rng = b.createControlRange();
 
-				nl = doc.getElementsByTagName(bookmark.tag);
+				nl = b.getElementsByTagName(bookmark.tag);
 
 				if (nl.length > bookmark.index) {
 					try {
@@ -5787,11 +6228,20 @@
 					}
 				}
 			} else {
-				rng = inst.getSel().createRange();
-				rng.moveToElementText(inst.getBody());
-				rng.collapse(true);
-				rng.moveStart('character', bookmark.start);
-				rng.moveEnd('character', bookmark.length);
+				// Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
+				try {
+					// Incorrect bookmark
+					if (bookmark.start < 0)
+						return true;
+
+					rng = inst.getSel().createRange();
+					rng.moveToElementText(inst.getBody());
+					rng.collapse(true);
+					rng.moveStart('character', bookmark.start);
+					rng.moveEnd('character', bookmark.length);
+				} catch (ex) {
+					return true;
+				}
 			}
 
 			rng.select();
@@ -5800,30 +6250,37 @@
 			return true;
 		}
 
-		if (tinyMCE.isGecko && bookmark.rng) {
-			sel.removeAllRanges();
-			sel.addRange(bookmark.rng);
-			win.scrollTo(bookmark.scrollX, bookmark.scrollY);
-			return true;
-		}
+		if (tinyMCE.isGecko || tinyMCE.isOpera) {
+			if (bookmark.rng) {
+				sel.removeAllRanges();
+				sel.addRange(bookmark.rng);
+			}
 
-		if (tinyMCE.isGecko) {
-	//		try {
-				rng = doc.createRange();
+			if (bookmark.start != -1 && bookmark.end != -1) {
+				try {
+					sd = this._getTextPos(b, bookmark.start, bookmark.end);
+					rng = doc.createRange();
+					rng.setStart(sd.startNode, sd.startOffset);
+					rng.setEnd(sd.endNode, sd.endOffset);
+					sel.removeAllRanges();
+					sel.addRange(rng);
+					win.focus();
+				} catch (ex) {
+					// Ignore
+				}
+			}
 
-				nl = doc.getElementsByTagName(bookmark.startTag);
-				if (nl.length > bookmark.start)
-					rng.setStart(nl[bookmark.start].childNodes[bookmark.startIndex], bookmark.startOffset);
-
-				nl = doc.getElementsByTagName(bookmark.endTag);
-				if (nl.length > bookmark.end)
-					rng.setEnd(nl[bookmark.end].childNodes[bookmark.endIndex], bookmark.endOffset);
+			/*
+			if (typeof(bookmark.index) != 'undefined') {
+				tinyMCE.selectElements(b, 'IMG', function (n) {
+					if (bookmark.index-- == 0) {
+						// Select image in Gecko here
+					}
 
-				sel.removeAllRanges();
-				sel.addRange(rng);
-	/*		} catch {
-				// Ignore
-			}*/
+					return false;
+				});
+			}
+			*/
 
 			win.scrollTo(bookmark.scrollX, bookmark.scrollY);
 			return true;
@@ -5832,6 +6289,46 @@
 		return false;
 	},
 
+	_getPosText : function(r, sn, en) {
+		var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+
+		while ((n = w.nextNode()) != null) {
+			if (n == sn)
+				d.start = p;
+
+			if (n == en) {
+				d.end = p;
+				return d;
+			}
+
+			p += n.nodeValue ? n.nodeValue.length : 0;
+		}
+
+		return null;
+	},
+
+	_getTextPos : function(r, sp, ep) {
+		var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+
+		while ((n = w.nextNode()) != null) {
+			p += n.nodeValue ? n.nodeValue.length : 0;
+
+			if (p >= sp && !d.startNode) {
+				d.startNode = n;
+				d.startOffset = sp - (p - n.nodeValue.length);
+			}
+
+			if (p >= ep) {
+				d.endNode = n;
+				d.endOffset = ep - (p - n.nodeValue.length);
+
+				return d;
+			}
+		}
+
+		return null;
+	},
+
 	selectNode : function(node, collapse, select_text_node, to_start) {
 		var inst = this.instance, sel, rng, nodes;
 
@@ -5847,8 +6344,11 @@
 		if (typeof(to_start) == "undefined")
 			to_start = true;
 
-		if (tinyMCE.isMSIE) {
-			rng = inst.getBody().createTextRange();
+		if (inst.settings.auto_resize)
+			inst.resizeToContent();
+
+		if (tinyMCE.isRealIE) {
+			rng = inst.getDoc().body.createTextRange();
 
 			try {
 				rng.moveToElementText(node);
@@ -5915,69 +6415,79 @@
 	},
 
 	scrollToNode : function(node) {
-		var inst = this.instance;
-		var pos, doc, scrollX, scrollY, height;
-
-		// Scroll to node position
-		pos = tinyMCE.getAbsPosition(node);
-		doc = inst.getDoc();
-		scrollX = doc.body.scrollLeft + doc.documentElement.scrollLeft;
-		scrollY = doc.body.scrollTop + doc.documentElement.scrollTop;
-		height = tinyMCE.isMSIE ? document.getElementById(inst.editorId).style.pixelHeight : inst.targetElement.clientHeight;
+		var inst = this.instance, w = inst.getWin(), vp = inst.getViewPort(), pos = tinyMCE.getAbsPosition(node), cvp, p, cwin;
 
 		// Only scroll if out of visible area
-		if (!tinyMCE.settings['auto_resize'] && !(pos.absTop > scrollY && pos.absTop < (scrollY - 25 + height)))
-			inst.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25); 
+		if (pos.absLeft < vp.left || pos.absLeft > vp.left + vp.width || pos.absTop < vp.top || pos.absTop > vp.top + (vp.height-25))
+			w.scrollTo(pos.absLeft, pos.absTop - vp.height + 25);
+
+		// Scroll container window
+		if (inst.settings.auto_resize) {
+			cwin = inst.getContainerWin();
+			cvp = tinyMCE.getViewPort(cwin);
+			p = this.getAbsPosition(node);
+
+			if (p.absLeft < cvp.left || p.absLeft > cvp.left + cvp.width || p.absTop < cvp.top || p.absTop > cvp.top + cvp.height)
+				cwin.scrollTo(p.absLeft, p.absTop - cvp.height + 25);
+		}
+	},
+
+	getAbsPosition : function(n) {
+		var pos = tinyMCE.getAbsPosition(n), ipos = tinyMCE.getAbsPosition(this.instance.iframeElement);
+
+		return {
+			absLeft : ipos.absLeft + pos.absLeft,
+			absTop : ipos.absTop + pos.absTop
+		};
 	},
 
 	getSel : function() {
 		var inst = this.instance;
 
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+		if (tinyMCE.isRealIE)
 			return inst.getDoc().selection;
 
 		return inst.contentWindow.getSelection();
 	},
 
 	getRng : function() {
-		var inst = this.instance;
-		var sel = this.getSel();
+		var s = this.getSel();
 
-		if (sel == null)
+		if (s == null)
 			return null;
 
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera)
-			return sel.createRange();
+		if (tinyMCE.isRealIE)
+			return s.createRange();
 
-		if (tinyMCE.isSafari && !sel.getRangeAt)
+		if (tinyMCE.isSafari && !s.getRangeAt)
 			return '' + window.getSelection();
 
-		return sel.getRangeAt(0);
+		return s.getRangeAt(0);
 	},
 
 	getFocusElement : function() {
-		var inst = this.instance;
+		var inst = this.instance, doc, rng, sel, elm;
 
-		if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
-			var doc = inst.getDoc();
-			var rng = doc.selection.createRange();
+		if (tinyMCE.isRealIE) {
+			doc = inst.getDoc();
+			rng = doc.selection.createRange();
 
 	//		if (rng.collapse)
 	//			rng.collapse(true);
 
-			var elm = rng.item ? rng.item(0) : rng.parentElement();
+			elm = rng.item ? rng.item(0) : rng.parentElement();
 		} else {
-			if (inst.isHidden())
+			if (!tinyMCE.isSafari && inst.isHidden())
 				return inst.getBody();
 
-			var sel = this.getSel();
-			var rng = this.getRng();
+			sel = this.getSel();
+			rng = this.getRng();
 
 			if (!sel || !rng)
 				return null;
 
-			var elm = rng.commonAncestorContainer;
-			//var elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
+			elm = rng.commonAncestorContainer;
+			//elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
 
 			// Handle selection a image or other control like element such as anchors
 			if (!rng.collapsed) {
@@ -5999,7 +6509,8 @@
 
 		return elm;
 	}
-};
+
+	};
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_UndoRedo.class.js */
 
@@ -6013,39 +6524,40 @@
 
 TinyMCE_UndoRedo.prototype = {
 	add : function(l) {
-		var b;
+		var b, customUndoLevels, newHTML, inst = this.instance, i, ul, ur;
 
 		if (l) {
 			this.undoLevels[this.undoLevels.length] = l;
 			return true;
 		}
 
-		var inst = this.instance;
-
 		if (this.typingUndoIndex != -1) {
 			this.undoIndex = this.typingUndoIndex;
-			// tinyMCE.debug("Override: " + this.undoIndex);
+
+			if (tinyMCE.typingUndoIndex != -1)
+				tinyMCE.undoIndex = tinyMCE.typingUndoIndex;
 		}
 
-		var newHTML = tinyMCE.trim(inst.getBody().innerHTML);
+		newHTML = tinyMCE.trim(inst.getBody().innerHTML);
 		if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) {
-			//tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex]);
+			//tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content);
 
 			tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst);
 
 			// Time to compress
-			var customUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];
+			customUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];
 			if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) {
-				for (var i=0; i<this.undoLevels.length-1; i++) {
-					//tinyMCE.debug(this.undoLevels[i] + "=" + this.undoLevels[i+1]);
+				for (i=0; i<this.undoLevels.length-1; i++)
 					this.undoLevels[i] = this.undoLevels[i+1];
-				}
 
 				this.undoLevels.length--;
 				this.undoIndex--;
+
+				// Todo: Implement global undo/redo logic here
 			}
 
 			b = inst.undoBookmark;
+
 			if (!b)
 				b = inst.selection.getBookmark();
 
@@ -6055,12 +6567,24 @@
 				bookmark : b
 			};
 
+			// Remove all above from global undo/redo
+			ul = tinyMCE.undoLevels;
+			for (i=tinyMCE.undoIndex + 1; i<ul.length; i++) {
+				ur = ul[i].undoRedo;
+
+				if (ur.undoIndex == ur.undoLevels.length -1)
+					ur.undoIndex--;
+
+				ur.undoLevels.length--;
+			}
+
+			// Add global undo level
+			tinyMCE.undoLevels[tinyMCE.undoIndex++] = inst;
+			tinyMCE.undoLevels.length = tinyMCE.undoIndex;
+
 			this.undoLevels.length = this.undoIndex + 1;
 
-			//tinyMCE.debug("level added" + this.undoIndex);
 			return true;
-
-			// tinyMCE.debug(this.undoIndex + "," + (this.undoLevels.length-1));
 		}
 
 		return false;
@@ -6072,13 +6596,13 @@
 		// Do undo
 		if (this.undoIndex > 0) {
 			this.undoIndex--;
+
 			tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
 			inst.repaint();
+
 			if (inst.settings.custom_undo_redo_restore_selection)
 				inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
 		}
-
-		// tinyMCE.debug("Undo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
 	},
 
 	redo : function() {
@@ -6088,23 +6612,28 @@
 
 		if (this.undoIndex < (this.undoLevels.length-1)) {
 			this.undoIndex++;
+
 			tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
 			inst.repaint();
-//					if (this.undoIndex > 0)
-//						inst.selection.moveToBookmark(this.undoLevels[this.undoIndex-1].bookmark);
+
 			if (inst.settings.custom_undo_redo_restore_selection)
 				inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
-			// tinyMCE.debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
 		}
 
 		tinyMCE.triggerNodeChange();
 	}
-};
+
+	};
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_ForceParagraphs.class.js */
 
 var TinyMCE_ForceParagraphs = {
 	_insertPara : function(inst, e) {
+		var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0);
+		var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock;
+		var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null;
+		var paraBefore, paraAfter, startChop, endChop, contents;
+
 		function isEmpty(para) {
 			function isEmptyHTML(html) {
 				return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == "";
@@ -6133,43 +6662,33 @@
 			return true;
 		}
 
-		var doc = inst.getDoc();
-		var sel = inst.getSel();
-		var win = inst.contentWindow;
-		var rng = sel.getRangeAt(0);
-		var body = doc.body;
-		var rootElm = doc.documentElement;
-		var blockName = "P";
-
 	//	tinyMCE.debug(body.innerHTML);
 
 	//	debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString());
 
 		// Setup before range
-		var rngBefore = doc.createRange();
+		rngBefore = doc.createRange();
 		rngBefore.setStart(sel.anchorNode, sel.anchorOffset);
 		rngBefore.collapse(true);
 
 		// Setup after range
-		var rngAfter = doc.createRange();
+		rngAfter = doc.createRange();
 		rngAfter.setStart(sel.focusNode, sel.focusOffset);
 		rngAfter.collapse(true);
 
 		// Setup start/end points
-		var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;
-		var startNode = direct ? sel.anchorNode : sel.focusNode;
-		var startOffset = direct ? sel.anchorOffset : sel.focusOffset;
-		var endNode = direct ? sel.focusNode : sel.anchorNode;
-		var endOffset = direct ? sel.focusOffset : sel.anchorOffset;
+		direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;
+		startNode = direct ? sel.anchorNode : sel.focusNode;
+		startOffset = direct ? sel.anchorOffset : sel.focusOffset;
+		endNode = direct ? sel.focusNode : sel.anchorNode;
+		endOffset = direct ? sel.focusOffset : sel.anchorOffset;
 
 		startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
 		endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
 
-		// tinyMCE.debug(startNode, endNode);
-
 		// Get block elements
-		var startBlock = tinyMCE.getParentBlockElement(startNode);
-		var endBlock = tinyMCE.getParentBlockElement(endNode);
+		startBlock = inst.getParentBlockElement(startNode);
+		endBlock = inst.getParentBlockElement(endNode);
 
 		// If absolute force paragraph generation within
 		if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position))
@@ -6188,7 +6707,7 @@
 		}
 
 		// Within a list use normal behaviour
-		if (tinyMCE.getParentElement(startBlock, "OL,UL") != null)
+		if (tinyMCE.getParentElement(startBlock, "OL,UL", null, body) != null)
 			return false;
 
 		// Within a table create new paragraphs
@@ -6196,16 +6715,16 @@
 			startBlock = endBlock = null;
 
 		// Setup new paragraphs
-		var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
-		var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
+		paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
+		paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
 
 		// Is header, then force paragraph under
 		if (/^(H[1-6])$/.test(blockName))
 			paraAfter = doc.createElement("p");
 
 		// Setup chop nodes
-		var startChop = startNode;
-		var endChop = endNode;
+		startChop = startNode;
+		endChop = endNode;
 
 		// Get startChop node
 		node = startChop;
@@ -6236,7 +6755,9 @@
 		if (startBlock == null) {
 			// Delete selection
 			rng.deleteContents();
-			sel.removeAllRanges();
+
+			if (!tinyMCE.isSafari)
+				sel.removeAllRanges();
 
 			if (startChop != rootElm && endChop != rootElm) {
 				// Insert paragraph before
@@ -6260,7 +6781,7 @@
 				if (endChop.nodeName != "#text" && endChop.nodeName != "BODY")
 					rngBefore.setEndAfter(endChop);
 
-				var contents = rng.cloneContents();
+				contents = rng.cloneContents();
 				if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY"))
 					paraAfter.innerHTML = contents.firstChild.innerHTML;
 				else
@@ -6280,17 +6801,25 @@
 				rngBefore.deleteContents();
 
 				// Insert new paragraphs
-				paraAfter.normalize();
-				rngBefore.insertNode(paraAfter);
-				paraBefore.normalize();
-				rngBefore.insertNode(paraBefore);
+				if (tinyMCE.isOpera) {
+					paraBefore.normalize();
+					rngBefore.insertNode(paraBefore);
+					paraAfter.normalize();
+					rngBefore.insertNode(paraAfter);
+				} else {
+					paraAfter.normalize();
+					rngBefore.insertNode(paraAfter);
+					paraBefore.normalize();
+					rngBefore.insertNode(paraBefore);
+				}
 
-				// tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
+				//tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
 			} else {
 				body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">";
 				paraAfter = body.childNodes[1];
 			}
 
+			inst.selection.moveToBookmark(b);
 			inst.selection.selectNode(paraAfter, true, true);
 
 			return true;
@@ -6308,7 +6837,7 @@
 		// Place secound part within new paragraph
 		rngAfter.setEndAfter(endChop);
 		rngAfter.setStart(endNode, endOffset);
-		var contents = rngAfter.cloneContents();
+		contents = rngAfter.cloneContents();
 
 		if (contents.firstChild && contents.firstChild.nodeName == blockName) {
 	/*		var nodes = contents.firstChild.childNodes;
@@ -6331,7 +6860,7 @@
 			paraAfter.innerHTML = "&nbsp;";
 
 		// Create a range around everything
-		var rng = doc.createRange();
+		rng = doc.createRange();
 
 		if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) {
 			rng.setStartBefore(startChop.parentNode);
@@ -6349,14 +6878,22 @@
 
 		// Delete all contents and insert new paragraphs
 		rng.deleteContents();
-		rng.insertNode(paraAfter);
-		rng.insertNode(paraBefore);
+
+		if (tinyMCE.isOpera) {
+			rng.insertNode(paraBefore);
+			rng.insertNode(paraAfter);
+		} else {
+			rng.insertNode(paraAfter);
+			rng.insertNode(paraBefore);
+		}
+
 		//tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
 
 		// Normalize
 		paraAfter.normalize();
 		paraBefore.normalize();
 
+		inst.selection.moveToBookmark(b);
 		inst.selection.selectNode(paraAfter, true, true);
 
 		return true;
@@ -6365,21 +6902,26 @@
 	_handleBackSpace : function(inst) {
 		var r = inst.getRng(), sn = r.startContainer, nv, s = false;
 
-		if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR") {
+		// Added body check for bug #1527787
+		if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR" && sn.parentNode.nodeName != "BODY") {
 			nv = sn.nodeValue;
 
-			// Handle if a backspace is pressed after a space character #bug 1466054
-			if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')
-				s = true;
+			// Handle if a backspace is pressed after a space character #bug 1466054 removed since fix for #1527787
+			/*if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')
+				s = true;*/
 
 			// Only remove BRs if we are at the end of line #bug 1464152
 			if (nv != null && r.startOffset == nv.length)
 				sn.nextSibling.parentNode.removeChild(sn.nextSibling);
 		}
 
+		if (inst.settings.auto_resize)
+			inst.resizeToContent();
+
 		return s;
 	}
-};
+
+	};
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_Layer.class.js */
 
@@ -6515,14 +7057,20 @@
 
 		if (!this.blockerElement && this.blockMode) {
 			d = this.doc;
-			b = d.createElement("iframe");
+			b = d.getElementById(this.id + "_blocker");
 
-			b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
-			b.src = 'javascript:false;';
-			b.frameBorder = '0';
-			b.scrolling = 'no';
+			if (!b) {
+				b = d.createElement("iframe");
+
+				b.setAttribute('id', this.id + "_blocker");
+				b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
+				b.src = 'javascript:false;';
+				b.frameBorder = '0';
+				b.scrolling = 'no';
+	
+				d.body.appendChild(b);
+			}
 
-			d.body.appendChild(b);
 			this.blockerElement = b;
 		}
 
@@ -6541,7 +7089,7 @@
 		return p;
 	},
 
-	create : function(n, c, p) {
+	create : function(n, c, p, h) {
 		var d = this.doc, e = d.createElement(n);
 
 		e.setAttribute('id', this.id);
@@ -6552,18 +7100,26 @@
 		if (!p)
 			p = d.body;
 
+		if (h)
+			e.innerHTML = h;
+
 		p.appendChild(e);
 
 		return this.element = e;
 	},
 
+	exists : function() {
+		return this.doc.getElementById(this.id) != null;
+	},
+
 	parseInt : function(s) {
 		if (s == null || s == '')
 			return 0;
 
 		return parseInt(s);
 	}
-};
+
+	};
 
 /* file:jscripts/tiny_mce/classes/TinyMCE_Menu.class.js */
 
@@ -6582,7 +7138,6 @@
 	this.needsUpdate = true;
 };
 
-// Extends the TinyMCE_Layer class
 TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
 	init : function(s) {
 		var n;
@@ -6653,7 +7208,7 @@
 					break;
 
 				default:
-					h += '<tr><td><a href="javascript:void(0);" onmousedown="' + tinyMCE.xmlEncode(m[i].js) + ';return false;"><span' + c +'>' + t + '</span></a>';
+					h += '<tr><td><a href="#" onclick="return tinyMCE.cancelEvent(event);" onmousedown="return tinyMCE.cancelEvent(event);" onmouseup="' + tinyMCE.xmlEncode(m[i].js) + ';return tinyMCE.cancelEvent(event);"><span' + c +'>' + t + '</span></a>';
 			}
 
 			h += '</td></tr>';
@@ -6690,30 +7245,40 @@
 
 		tinyMCE.lastMenu = this;
 	}
-});
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
+	});
 
-TinyMCE_Engine.prototype.debug = function() {
-	var m = "", e, a, i;
+/* file:jscripts/tiny_mce/classes/TinyMCE_Compatibility.class.js */
 
-	e = document.getElementById("tinymce_debug");
-	if (!e) {
-		var d = document.createElement("div");
-		d.setAttribute("className", "debugger");
-		d.className = "debugger";
-		d.innerHTML = 'Debug output:<textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap" mce_editable="false"></textarea>';
+if (!Function.prototype.call) {
+	Function.prototype.call = function() {
+		var a = arguments, s = a[0], i, as = '', r, o;
 
-		document.body.appendChild(d);
-		e = document.getElementById("tinymce_debug");
-	}
+		for (i=1; i<a.length; i++)
+			as += (i > 1 ? ',' : '') + 'a[' + i + ']';
+
+		o = s._fu;
+		s._fu = this;
+		r = eval('s._fu(' + as + ')');
+		s._fu = o;
+
+		return r;
+	};
+};
 
-	a = this.debug.arguments;
-	for (i=0; i<a.length; i++) {
+/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
+
+TinyMCE_Engine.prototype.debug = function() {
+	var m = "", a, i, l = tinyMCE.log.length;
+
+	for (i=0, a = this.debug.arguments; i<a.length; i++) {
 		m += a[i];
+
 		if (i<a.length-1)
 			m += ', ';
 	}
 
-	e.value += m + "\n";
+	if (l < 1000)
+		tinyMCE.log[l] = "[debug] " + m;
 };
+
diff -ruN 0.7.5/e107_handlers/tiny_mce/utils/editable_selects.js 0.7.7/e107_handlers/tiny_mce/utils/editable_selects.js
--- 0.7.5/e107_handlers/tiny_mce/utils/editable_selects.js	2006-05-05 22:05:16.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/utils/editable_selects.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: editable_selects.js,v $
- * $Revision: 1.1 $
- * $Date: 2006/05/06 03:05:16 $
+ * $Id: editable_selects.js,v 1.2 2006/10/27 22:36:57 e107coders Exp $
  *
  * Makes select boxes editable.
  *
diff -ruN 0.7.5/e107_handlers/tiny_mce/utils/form_utils.js 0.7.7/e107_handlers/tiny_mce/utils/form_utils.js
--- 0.7.5/e107_handlers/tiny_mce/utils/form_utils.js	2006-05-05 22:05:16.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/utils/form_utils.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: form_utils.js,v $
- * $Revision: 1.5 $
- * $Date: 2006/05/06 03:05:16 $
+ * $Id: form_utils.js,v 1.6 2006/10/27 22:36:57 e107coders Exp $
  *
  * Various form utilitiy functions.
  *
@@ -9,18 +7,20 @@
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
  */
 
+var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
+
 function getColorPickerHTML(id, target_form_element) {
-	var html = "";
+	var h = "";
 
-	html += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
-	html += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme") + '/images/color.gif"';
-	html += ' onmouseover="this.className=\'mceButtonOver\'"';
-	html += ' onmouseout="this.className=\'mceButtonNormal\'"';
-	html += ' onmousedown="this.className=\'mceButtonDown\'"';
-	html += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
-	html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+	h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
+	h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
+	h += ' onmouseover="this.className=\'mceButtonOver\'"';
+	h += ' onmouseout="this.className=\'mceButtonNormal\'"';
+	h += ' onmousedown="this.className=\'mceButtonDown\'"';
+	h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
+	h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
 
-	return html;
+	return h;
 }
 
 function pickColor(e, target_form_element) {
@@ -57,7 +57,7 @@
 	var html = "";
 
 	html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
-	html += '<img id="' + id + '" src="../../themes/' + tinyMCE.getParam("theme") + '/images/browse.gif"';
+	html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
 	html += ' onmouseover="this.className=\'mceButtonOver\';"';
 	html += ' onmouseout="this.className=\'mceButtonNormal\';"';
 	html += ' onmousedown="this.className=\'mceButtonDown\';"';
diff -ruN 0.7.5/e107_handlers/tiny_mce/utils/mclayer.js 0.7.7/e107_handlers/tiny_mce/utils/mclayer.js
--- 0.7.5/e107_handlers/tiny_mce/utils/mclayer.js	2006-05-05 22:05:16.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/utils/mclayer.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: mclayer.js,v $
- * $Revision: 1.3 $
- * $Date: 2006/05/06 03:05:16 $
+ * $Id: mclayer.js,v 1.4 2006/10/27 22:36:57 e107coders Exp $
  *
  * Moxiecode floating layer script.
  *
@@ -209,4 +207,4 @@
 
 		return parseInt(s);
 	}
-}
\ No newline at end of file
+}
diff -ruN 0.7.5/e107_handlers/tiny_mce/utils/mctabs.js 0.7.7/e107_handlers/tiny_mce/utils/mctabs.js
--- 0.7.5/e107_handlers/tiny_mce/utils/mctabs.js	2006-05-05 22:05:16.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/utils/mctabs.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: mctabs.js,v $
- * $Revision: 1.5 $
- * $Date: 2006/05/06 03:05:16 $
+ * $Id: mctabs.js,v 1.6 2006/10/27 22:36:57 e107coders Exp $
  *
  * Moxiecode DHTML Tabs script.
  *
diff -ruN 0.7.5/e107_handlers/tiny_mce/utils/validate.js 0.7.7/e107_handlers/tiny_mce/utils/validate.js
--- 0.7.5/e107_handlers/tiny_mce/utils/validate.js	2006-05-05 22:05:16.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/utils/validate.js	2006-10-27 17:36:57.000000000 -0500
@@ -1,7 +1,5 @@
 /**
- * $RCSfile: validate.js,v $
- * $Revision: 1.5 $
- * $Date: 2006/05/06 03:05:16 $
+ * $Id: validate.js,v 1.6 2006/10/27 22:36:57 e107coders Exp $
  *
  * Various form validation methods.
  *
@@ -9,42 +7,213 @@
  * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
  */
 
-function testRegExp(form_name, element_name, re) {
-	return new RegExp(re).test(document.forms[form_name].elements[element_name].value);
-}
-
-function validateString(form_name, element_name) {
-	return (document.forms[form_name].elements[element_name].value.length > 0);
-}
-
-function validateSelection(form_name, element_name) {
-	return (document.forms[form_name].elements[element_name].selectedIndex > 0);
-}
-
-function validateCheckBox(form_name, element_name) {
-	return document.forms[form_name].elements[element_name].checked;
-}
-
-function validateCleanString(form_name, element_name) {
-	return testRegExp(form_name, element_name, '^[A-Za-z0-9_]+$');
-}
-
-function validateEmail(form_name, element_name) {
-	return testRegExp(form_name, element_name, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
-}
-
-function validateAbsUrl(form_name, element_name) {
-	return testRegExp(form_name, element_name, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+$');
-}
-
-function validateNumber(form_name, element_name, allow_blank) {
-	return (!allow_blank && value == '') ? false : testRegExp(form_name, element_name, '^-?[0-9]*\\.?[0-9]*$');
-}
-
-function validateSize(form_name, element_name,) {
-	return testRegExp(form_name, element_name, '^[0-9]+(px|%)?$');
-}
-
-function validateID(form_name, element_name,) {
-	return testRegExp(form_name, element_name, '^[A-Za-z_]([A-Za-z0-9_])*$');
-}
+/**
+	// String validation:
+
+	if (!Validator.isEmail('myemail'))
+		alert('Invalid email.');
+
+	// Form validation:
+
+	var f = document.forms['myform'];
+
+	if (!Validator.isEmail(f.myemail))
+		alert('Invalid email.');
+*/
+
+var Validator = {
+	isEmail : function(s) {
+		return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
+	},
+
+	isAbsUrl : function(s) {
+		return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
+	},
+
+	isSize : function(s) {
+		return this.test(s, '^[0-9]+(px|%)?$');
+	},
+
+	isId : function(s) {
+		return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
+	},
+
+	isEmpty : function(s) {
+		var nl, i;
+
+		if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
+			return true;
+
+		if (s.type == 'checkbox' && !s.checked)
+			return true;
+
+		if (s.type == 'radio') {
+			for (i=0, nl = s.form.elements; i<nl.length; i++) {
+				if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
+					return false;
+			}
+
+			return true;
+		}
+
+		return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
+	},
+
+	isNumber : function(s, d) {
+		return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
+	},
+
+	test : function(s, p) {
+		s = s.nodeType == 1 ? s.value : s;
+
+		return s == '' || new RegExp(p).test(s);
+	}
+};
+
+var AutoValidator = {
+	settings : {
+		id_cls : 'id',
+		int_cls : 'int',
+		url_cls : 'url',
+		number_cls : 'number',
+		email_cls : 'email',
+		size_cls : 'size',
+		required_cls : 'required',
+		invalid_cls : 'invalid',
+		min_cls : 'min',
+		max_cls : 'max'
+	},
+
+	init : function(s) {
+		var n;
+
+		for (n in s)
+			this.settings[n] = s[n];
+	},
+
+	validate : function(f) {
+		var i, nl, s = this.settings, c = 0;
+
+		nl = this.tags(f, 'label');
+		for (i=0; i<nl.length; i++)
+			this.removeClass(nl[i], s.invalid_cls);
+
+		c += this.validateElms(f, 'input');
+		c += this.validateElms(f, 'select');
+		c += this.validateElms(f, 'textarea');
+
+		return c == 3;
+	},
+
+	invalidate : function(n) {
+		this.mark(n.form, n);
+	},
+
+	reset : function(e) {
+		var t = new Array('label', 'input', 'select', 'textarea');
+		var i, j, nl, s = this.settings;
+
+		if (e == null)
+			return;
+
+		for (i=0; i<t.length; i++) {
+			nl = this.tags(e.form ? e.form : e, t[i]);
+			for (j=0; j<nl.length; j++)
+				this.removeClass(nl[j], s.invalid_cls);
+		}
+	},
+
+	validateElms : function(f, e) {
+		var nl, i, n, s = this.settings, st = true, va = Validator, v;
+
+		nl = this.tags(f, e);
+		for (i=0; i<nl.length; i++) {
+			n = nl[i];
+
+			this.removeClass(n, s.invalid_cls);
+
+			if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.size_cls) && !va.isSize(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.id_cls) && !va.isId(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.min_cls, true)) {
+				v = this.getNum(n, s.min_cls);
+
+				if (isNaN(v) || parseInt(n.value) < parseInt(v))
+					st = this.mark(f, n);
+			}
+
+			if (this.hasClass(n, s.max_cls, true)) {
+				v = this.getNum(n, s.max_cls);
+
+				if (isNaN(v) || parseInt(n.value) > parseInt(v))
+					st = this.mark(f, n);
+			}
+		}
+
+		return st;
+	},
+
+	hasClass : function(n, c, d) {
+		return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
+	},
+
+	getNum : function(n, c) {
+		c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
+		c = c.replace(/[^0-9]/g, '');
+
+		return c;
+	},
+
+	addClass : function(n, c, b) {
+		var o = this.removeClass(n, c);
+		n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
+	},
+
+	removeClass : function(n, c) {
+		c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+		return n.className = c != ' ' ? c : '';
+	},
+
+	tags : function(f, s) {
+		return f.getElementsByTagName(s);
+	},
+
+	mark : function(f, n) {
+		var s = this.settings;
+
+		this.addClass(n, s.invalid_cls);
+		this.markLabels(f, n, s.invalid_cls);
+
+		return false;
+	},
+
+	markLabels : function(f, n, ic) {
+		var nl, i;
+
+		nl = this.tags(f, "label");
+		for (i=0; i<nl.length; i++) {
+			if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
+				this.addClass(nl[i], ic);
+		}
+
+		return null;
+	}
+};
diff -ruN 0.7.5/e107_handlers/tiny_mce/wysiwyg.php 0.7.7/e107_handlers/tiny_mce/wysiwyg.php
--- 0.7.5/e107_handlers/tiny_mce/wysiwyg.php	2006-04-30 18:06:43.000000000 -0500
+++ 0.7.7/e107_handlers/tiny_mce/wysiwyg.php	2006-11-23 11:36:29.000000000 -0600
@@ -4,35 +4,36 @@
 |     e107 website system - Tiny MCE controller file.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/wysiwyg.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2006/04/30 23:06:43 $
+|     $Revision: 1.32 $
+|     $Date: 2006/11/23 17:36:29 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 function wysiwyg($formids){
 define("ADMIN","");
-global $pref,$HANDLERS_DIRECTORY;
+global $pref,$HANDLERS_DIRECTORY,$PLUGINS_DIRECTORY,$IMAGES_DIRECTORY;
 $lang = e_LANGUAGE;
 $tinylang = array(
-	"Arabic" => "ar",
-	"Danish" => "da",
-	"Dutch" => "nl",
-	"English" => "en",
-	"Farsi" => "fa",
-	"French" => "fr",
-	"Greek" => "el",
-	"Hebrew" => " ",
+	"Arabic" 	=> "ar",
+	"Danish" 	=> "da",
+	"Dutch" 		=> "nl",
+	"English" 	=> "en",
+	"Farsi" 		=> "fa",
+	"French" 	=> "fr",
+	"German"		=> "de", 
+	"Greek" 		=> "el",
+	"Hebrew" 	=> " ",
 	"Hungarian" => "hu",
-	"Italian" => "it",
-	"Japanese" => "ja",
-	"Korean" => "ko",
+	"Italian" 	=> "it",
+	"Japanese" 	=> "ja",
+	"Korean" 	=> "ko",
 	"Norwegian" => "nb",
-	"Polish" => "pl",
-	"Russian" => "ru",
-	"Slovak" => "sk",
-	"Spanish" => "es",
-	"Swedish" => "sv"
+	"Polish" 	=> "pl",
+	"Russian" 	=> "ru",
+	"Slovak" 	=> "sk",
+	"Spanish" 	=> "es",
+	"Swedish" 	=> "sv"
 );
 
 if(!$tinylang[$lang]){
@@ -53,23 +54,23 @@
 
 $text .= ($pref['smiley_activate']) ? ",emoticons" : "";
 $text .= (ADMIN) ? ",ibrowser" : ",image";
-$text .= ",iespell,zoom,flash,forecolor";
+$text .= ",iespell,zoom,media,forecolor";
 $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'";
 
 $text .= ",theme_advanced_buttons2   : 'tablecontrols,separator,undo,redo,separator,link,unlink";
 $text .= ($pref['smiley_activate']) ? ",emoticons" : "";
-$text .= ",charmap,iespell,flash";
+$text .= ",charmap,iespell,media";
 $text .= (ADMIN) ? ",ibrowser," : ",image";
 $text .= (ADMIN) ? ",code" : "";
 $text .= "'"; // end of buttons 2
 
 $text .= ",theme_advanced_buttons3 : ''";
 $text .= ",theme_advanced_toolbar_location : 'top'";
-$text .= ",extended_valid_elements : 'p[style],a[name|href|target|rel|title|style],img[class|src|style|alt|title|name],hr[class],span[class|style],div[class|style],table[class|style|cellpadding|cellspacing]'";
+$text .= ",extended_valid_elements : 'p[style],a[name|href|target|rel|title|style|class],img[class|src|style|alt|title|name],hr[class],span[align|class|style],div[align|class|style|height|width] ,table[class|style|cellpadding|cellspacing|background|height|width],td[background|style|class|valign|align|height|width]'";
 $text .= ",invalid_elements: 'p,font,align,script,applet,iframe'\n";
-// $text .= ",auto_cleanup_word: true\n";
+$text .= ",auto_cleanup_word: true\n";
 $text .= ",convert_fonts_to_spans : true\n";
 $text .= ",trim_span_elements: true\n";
 $text .= ",inline_styles: true\n";
@@ -79,7 +80,7 @@
 $text .= ",entity_encoding: \"raw\" \n";
 $text .= ",convert_fonts_to_styles: true\n";
 $text .= ",remove_script_host : true\n";
-$text .= ",relative_urls: false\n";
+$text .= ",relative_urls: true\n";
 $text .= ",document_base_url: '".SITEURL."'\n";
 $text .= ",theme_advanced_styles: 'border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3'\n";
 $text .= ",popup_css: '".THEME."style.css'\n";
@@ -91,43 +92,69 @@
 
 	});
 
-function tinymce_html_bbcode_control(type, value) {
+function tinymce_html_bbcode_control(type, source) {
 
-	switch (type) {
+    switch (type) {
 
-		case 'get_from_editor':
-
-			value = value.replace(/target=\"_blank\"/, 'rel=\"external\"');
-			value = value.replace(/^\s*|\s*$/g,'');
-			if(value != '')
-			{
-				value = '[html]\\n' + value + '\\n[/html]';
-			}
-
-			break;
-
-		case 'insert_to_editor':
-
-			value = value.replace(/rel=\"external\"/, 'target=\"_blank\"');
-
-			html_bbcode_check = value.slice(0,6);
-
-			if (html_bbcode_check == '[html]') {
-				value = value.slice(6);
-			}
+        case 'get_from_editor':
+            // Convert HTML to e107-BBcode
+            source = source.replace(/target=\"_blank\"/, 'rel=\"external\"');
+            source = source.replace(/^\s*|\s*$/g,'');
+            if(source != '')
+            {
+                source = '[html]\\n' + source + '\\n[/html]';
+/*
+				source = source.replace(/<\/strong>/gi,'[/b]');
+                source = source.replace(/<strong>/gi,'[b]');
+                source = source.replace(/<\/em>/gi,'[/i]');
+                source = source.replace(/<em>/gi,'[i]');
+                source = source.replace(/<\/u>/gi,'[/u]');
+                source = source.replace(/<u>/gi,'[u]');
+                source = source.replace(/<\/strong>/gi,'[/b]');
+                source = source.replace(/<img/gi,'[img');
+                source = source.replace(/<\/strong>/gi,'[/b]');
+				source = source.replace(/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/gi,'[link=$1 $2]$3[/link]');
+*/
 
-			html_bbcode_check = value.slice(-7);
+            }
 
-			if (html_bbcode_check == '[/html]') {
-				value = value.slice(0, -7);
-			}
+		// Convert e107 paths.
+                source = source.replace(/\"".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\"{e_IMAGE}');
+				source = source.replace(/\"".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\"{e_PLUGIN}');
+				source = source.replace(/\'".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\'{e_IMAGE}');
+				source = source.replace(/\'".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\'{e_PLUGIN}');
+
+            break;
+
+        case 'insert_to_editor':
+		// Convert e107-BBcode to HTML
+            source = source.replace(/rel=\"external\"/, 'target=\"_blank\"');
+
+            html_bbcode_check = source.slice(0,6);
+
+            if (html_bbcode_check == '[html]') {
+                source = source.slice(6);
+            }
+
+            html_bbcode_check = source.slice(-7);
+
+            if (html_bbcode_check == '[/html]') {
+                source = source.slice(0, -7);
+            }
+/*
+			source = source.replace(/\[b\]/gi,'<strong>');
+			source = source.replace(/\[\/b\]/gi,'<\/strong>');
+*/
+			source = source.replace(/\{e_IMAGE\}/gi,'".$IMAGES_DIRECTORY."');
+			source = source.replace(/\{e_PLUGIN\}/gi,'".$PLUGINS_DIRECTORY."');
 
-			break;
-	}
+            break;
+    }
 
-	return value;
+    return source;
 }
 
+
 </script>\n
 ";
 
@@ -136,4 +163,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/traffic_class.php 0.7.7/e107_handlers/traffic_class.php
--- 0.7.5/e107_handlers/traffic_class.php	2005-12-28 14:44:18.000000000 -0600
+++ 0.7.7/e107_handlers/traffic_class.php	2006-10-21 06:18:00.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/traffic_class.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/28 20:44:18 $
-|     $Author: streaky $
+|     $Revision: 1.10 $
+|     $Date: 2006/10/21 11:18:00 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -72,7 +72,7 @@
 		// ~15 usec err: $eTraffic->Bump('foo',$b,microtime());
 		// ~25 usec err: $eTraffic->Bump('foo',$b);
 
-		if (!defined("E107_DBG_TRAFFIC")) {
+		if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
 			return;
 		}
 
@@ -123,7 +123,7 @@
 	*/
 	function BumpWho($sWhat, $level = 0, $tStart = 0, $tFinish = 0) {
 		$x = microtime();
-		if (!defined("E107_DBG_TRAFFIC")) {
+		if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
 			return;
 		}
 
@@ -143,7 +143,7 @@
 	}
 
 	function Calibrate($tObject, $count = 10 ) {
-		if (!defined("E107_DBG_TRAFFIC")) {
+		if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
 			return;
 		}
 		if ($tObject != $this) {
@@ -167,7 +167,9 @@
 	}
 
 	function Display() {
-		if (!E107_DBG_TRAFFIC) return '';
+		if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
+			return '';
+		}
 
 		$text = '';
 		@include_once(e_HANDLER.'traffic_class_display.php');
diff -ruN 0.7.5/e107_handlers/upload_handler.php 0.7.7/e107_handlers/upload_handler.php
--- 0.7.5/e107_handlers/upload_handler.php	2005-12-28 08:03:36.000000000 -0600
+++ 0.7.7/e107_handlers/upload_handler.php	2006-11-28 17:41:23.000000000 -0600
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_handlers/upload_handler.php,v $
-|   $Revision: 1.20 $
-|   $Date: 2005/12/28 14:03:36 $
-|   $Author: sweetas $
+|   $Revision: 1.22 $
+|   $Date: 2006/11/28 23:41:23 $
+|   $Author: mcfly_e107 $
 +---------------------------------------------------------------+
 */
 
@@ -22,14 +22,14 @@
 
 @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 = "")
+function file_upload($uploaddir, $avatar = FALSE, $fileinfo = "", $overwrite = "")
 {
 
 	global $pref, $sql, $tp;
 
 	if (!$uploaddir) {$uploaddir = e_FILE."public/";}
 	if($uploaddir == e_THEME) {$pref['upload_storagetype'] = 1;}
-	
+
 	if (is_readable(e_ADMIN.'filetypes.php')) {
 		$a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php'));
 		$a_filetypes = explode(',', $a_filetypes);
@@ -93,18 +93,18 @@
 		if ($files['size'][$key])
 		{
 			$filesize[] = $files['size'][$key];
-			$name = preg_replace("/[^a-z0-9._]/", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($name))));
+			$name = preg_replace("/[^a-z0-9._-]/", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($name))));
 			if ($avatar == "attachment") {
 				$name = time()."_".USERID."_".$fileinfo.$name;
 			}
-			
+
 			$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))
+			if (file_exists($destination_file) && !$overwrite)
 			{
 				require_once(e_HANDLER."message_handler.php");
 				message_handler("MESSAGE", LANUPLOAD_10, __LINE__, __FILE__); // duplicate file
diff -ruN 0.7.5/e107_handlers/user_extended_class.php 0.7.7/e107_handlers/user_extended_class.php
--- 0.7.5/e107_handlers/user_extended_class.php	2006-03-11 15:08:26.000000000 -0600
+++ 0.7.7/e107_handlers/user_extended_class.php	2006-11-28 23:11:16.000000000 -0600
@@ -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.37 $
-|     $Date: 2006/03/11 21:08:26 $
+|     $Revision: 1.40 $
+|     $Date: 2006/11/29 05:11:16 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -41,6 +41,7 @@
 	var $user_extended_types;
 	var $extended_xml;
 	var $typeArray;
+	var $reserved_names;
 
 	function e107_user_extended()
 	{
@@ -73,6 +74,22 @@
 		7 => UE_LAN_7,
 		8 => UE_LAN_8
 		);
+
+		//load array with field names from main user table, so we can disallow these
+		$this->reserved_names = array (
+		'id', 'name', 'loginname', 'customtitle', 'password',
+		'sess', 'email', 'signature', 'image', 'timezone', 'hideemail',
+		'join', 'lastvisit', 'currentvisit', 'lastpost', 'chats',
+		'comments', 'forums', 'ip', 'ban', 'prefs', 'new', 'viewed',
+		'visits', 'admin', 'login', 'class', 'perms', 'realm', 'pwchange',
+		'xup'
+		);
+
+	}
+
+	function user_extended_reserved($name)
+	{
+		return (in_array($name, $this->reserved_names));
 	}
 
 	function user_extended_get_categories($byID = TRUE)
@@ -182,7 +199,8 @@
 		{
 			$type = $this->typeArray[$type];
 		}
-		if (!($this->user_extended_field_exist($name)))
+
+		if (!$this->user_extended_field_exist($name) && !$this->user_extended_reserved($name))
 		{
 			$field_info = $this->user_extended_type_text($type, $default);
 			if($order === '')
@@ -312,7 +330,7 @@
 				$order = ($choices[3]) ? "ORDER BY ".$tp -> toDB($choices[3], true) : "";
 
 				if($sql->db_Select($tp -> toDB($choices[0], true), $tp -> toDB($choices[1], true).",".$tp -> toDB($choices[2], true), "1 $order")){
-					$choiceList = $sql->db_getList('ALL',FALSE,300);
+					$choiceList = $sql->db_getList('ALL',FALSE);
 					$ret = "<select {$include} name='{$fname}'  >\n";
 					$ret .= "<option value=''>&nbsp;</option>\n";  // ensures that the user chose it.
 					foreach($choiceList as $cArray)
@@ -352,7 +370,7 @@
 				$lanlist = $fl->get_dirs(e_LANGUAGEDIR);
 				sort($lanlist);
             $ret = "<select {$include} name='{$fname}'>\n";
-				$ret .= "<option value=''></option>\n";  // ensures that the user chose it.
+				$ret .= "<option value=''>&nbsp;</option>\n";  // ensures that the user chose it.
 				foreach($lanlist as $choice)
 				{
 					$choice = trim($choice);
@@ -467,4 +485,4 @@
 		$sql->db_Select_gen($qry);
 	}
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_handlers/user_select_class.php 0.7.7/e107_handlers/user_select_class.php
--- 0.7.5/e107_handlers/user_select_class.php	2005-12-28 08:03:36.000000000 -0600
+++ 0.7.7/e107_handlers/user_select_class.php	2006-10-24 08:35:06.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.8 $
-|     $Date: 2005/12/28 14:03:36 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/10/24 13:35:06 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -84,6 +84,7 @@
 	}
 	
 	function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false) {
+		global $tp;
 		$text .= "<script type='text/javascript'>
 		<!--
 		function uc_switch(uctype) {
@@ -106,7 +107,7 @@
 			}
 			else
 			{
-				$text .= "<input class='tbox' type='text' name='".$form_id."' id='".$form_id."' size='25' maxlength='30' value='".$user_value."'>&nbsp;";
+				$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."...' 
@@ -131,7 +132,7 @@
 	}
 	
 	function popup() {
-		global $ns;
+		global $ns, $tp;
 		list($elementType, $elementID) = explode(".", e_QUERY);
 		if($elementType == 'textarea')
 		{
@@ -167,8 +168,8 @@
 		$text = "<form action='".e_SELF."?".e_QUERY."' method='POST'>
 			<table style='width:100%' class='fborder'>
 			<tr>
-			<td class='forumheader3' style='text-align: center'><input type='text' name='srch' class='tbox' value='".$_POST['srch']."' size='40'>
-			<input class='button' type='submit' name='dosrch' class='tbox' value='".US_LAN_6."'></td>
+			<td class='forumheader3' style='text-align: center'><input type='text' name='srch' class='tbox' value='".$tp -> post_toForm($_POST['srch'])."' size='40'>
+			<input class='button' type='submit' name='dosrch' class='tbox' value='".US_LAN_6."' /></td>
 			</tr>
 			</table>
 			</form>
@@ -196,7 +197,7 @@
 			}
 			$text .= "
 			</select>
-			<input type='button' class='button' value='".US_LAN_1."' onClick='SelectUser()'>
+			<input type='button' class='button' value='".US_LAN_1."' onClick='SelectUser()' />
 			</td>
 		 
 			</tr>
diff -ruN 0.7.5/e107_handlers/userclass_class.php 0.7.7/e107_handlers/userclass_class.php
--- 0.7.5/e107_handlers/userclass_class.php	2006-01-05 13:38:57.000000000 -0600
+++ 0.7.7/e107_handlers/userclass_class.php	2006-06-29 01:53:06.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.17 $
-|     $Date: 2006/01/05 19:38:57 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.19 $
+|     $Date: 2006/06/29 06:53:06 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -32,6 +32,7 @@
 member
 readonly
 admin
+main - main admin
 classes - shows all classes
 matchclass - if 'classes' is set, this option will only show the classes that the user is a member of
 language - list of languages.
@@ -44,27 +45,32 @@
 
 	$text = "<select class='tbox' name='{$fieldname}'>\n";
 	if (!$optlist || strpos($optlist, "public") !== FALSE) {
-		($curval == e_UC_PUBLIC) ? $s = " selected='selected'" : $s = "";
+		$s = ($curval == e_UC_PUBLIC) ?  "selected='selected'" : "";
 		$text .= "<option  value='".e_UC_PUBLIC."' ".$s.">".UC_LAN_0."</option>\n";
 	}
 
 	if (!$optlist || strpos($optlist, "guest") !== FALSE) {
-		($curval == e_UC_GUEST) ? $s = " selected='selected'" : $s = "";
+		$s = ($curval == e_UC_GUEST) ? "selected='selected'" : "";
 		$text .= "<option  value='".e_UC_GUEST."' ".$s.">".UC_LAN_1."</option>\n";
 	}
 	if (!$optlist || strpos($optlist, "nobody") !== FALSE) {
-		($curval == e_UC_NOBODY) ? $s = " selected='selected'" : $s = "";
+		$s = ($curval == e_UC_NOBODY) ? "selected='selected'" : "";
 		$text .= "<option value='".e_UC_NOBODY."' ".$s.">".UC_LAN_2."</option>\n";
 	}
 	if (!$optlist || strpos($optlist, "member") !== FALSE) {
-		($curval == e_UC_MEMBER) ? $s = " selected='selected'" : $s = "";
+		$s = ($curval == e_UC_MEMBER) ?  "selected='selected'" : "";
 		$text .= "<option value='".e_UC_MEMBER."' ".$s.">".UC_LAN_3."</option>\n";
 	}
 	if ($mode != "off" || strpos($optlist, "admin") !== FALSE)
 	{
-		($curval == e_UC_ADMIN) ? $s = " selected='selected'" : $s = "";
+		$s = ($curval == e_UC_ADMIN) ? "selected='selected'" : "";
 		$text .= "<option  value='".e_UC_ADMIN."' ".$s.">".UC_LAN_5."</option>\n";
 	}
+	if ($mode != "off" || strpos($optlist, "main") !== FALSE)
+	{
+		$s = ($curval == e_UC_MAINADMIN) ?  "selected='selected'" : "";
+		$text .= "<option  value='".e_UC_MAINADMIN."' ".$s.">".UC_LAN_6."</option>\n";
+	}
 	if (!$optlist || strpos($optlist, "classes") !== FALSE)
 	{
 		$classList = get_userclass_list();
@@ -73,16 +79,14 @@
 			extract($row);
 			if (strpos($optlist, "matchclass") === FALSE || getperms("0") || check_class($userclass_id))
 			{
-				($userclass_id == $curval) ? $s = " selected='selected'" :
-				 $s = "";
+				$s = ($userclass_id == $curval) ? "selected='selected'" : "";
 				$text .= "<option value='$userclass_id' ".$s.">".$userclass_name ."</option>\n";
 			}
 		}
 	}
 	if (($mode != "off" && $mode != "admin") || strpos($optlist, "readonly") !== FALSE)
 	{
-		($curval == e_UC_READONLY) ? $s = " selected='selected'" :
-		 $s = "";
+		$s = ($curval == e_UC_READONLY) ? "selected='selected'" : "";
 		$text .= "<option  value='".e_UC_READONLY."' ".$s.">".UC_LAN_4."</option>\n";
 	}
 
@@ -200,7 +204,7 @@
 	}
 	else
 	{
-		$sql->db_Select('userclass_classes');
+		$sql->db_Select('userclass_classes', "*", "ORDER BY userclass_name", "nowhere");
 		$classList = $sql->db_getList();
 		cachevars('uclass_list', $classList);
 		return $classList;
@@ -218,7 +222,7 @@
 		$class_names[e_UC_MEMBER] = UC_LAN_3;
 		$class_names[e_UC_READONLY] = UC_LAN_4;
 		$class_names[e_UC_ADMIN] = UC_LAN_5;
-		if ($sql->db_Select("userclass_classes", "userclass_id, userclass_name"))
+		if ($sql->db_Select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere"))
 		{
 			while($row = $sql->db_Fetch())
 			{
diff -ruN 0.7.5/e107_handlers/usersession_class.php 0.7.7/e107_handlers/usersession_class.php
--- 0.7.5/e107_handlers/usersession_class.php	2005-12-28 08:03:36.000000000 -0600
+++ 0.7.7/e107_handlers/usersession_class.php	2006-11-09 03:28:58.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/usersession_class.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/28 14:03:36 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/11/09 09:28:58 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -57,13 +57,13 @@
 		define('LOGINRESULT_NOTLOGGEDIN', 5);
 
 		// Session handler options - adjust to taste
-		ini_set('session.auto_start', 0);
-		ini_set('session.serialize_handler', 'php');
-		ini_set('session.cookie_lifetime', 0);
-		ini_set('session.use_cookies', 1);
-		ini_set('session.use_only_cookies', 1);
-		ini_set('url_rewriter.tags', '');
-		ini_set('session.use_trans_sid', 0);
+		e107_ini_set('session.auto_start', 0);
+		e107_ini_set('session.serialize_handler', 'php');
+		e107_ini_set('session.cookie_lifetime', 0);
+		e107_ini_set('session.use_cookies', 1);
+		e107_ini_set('session.use_only_cookies', 1);
+		e107_ini_set('url_rewriter.tags', '');
+		e107_ini_set('session.use_trans_sid', 0);
 
 		$this->_SessionName = session_name();
 		$this->_UserTrackingType = $pref['user_tracking'];
Binary files 0.7.5/e107_images/generic/bbcode/emotes.png and 0.7.7/e107_images/generic/bbcode/emotes.png differ
Binary files 0.7.5/e107_images/generic/bbcode/flash.png and 0.7.7/e107_images/generic/bbcode/flash.png differ
Binary files 0.7.5/e107_images/generic/bbcode/shortcode.png and 0.7.7/e107_images/generic/bbcode/shortcode.png differ
Binary files 0.7.5/e107_images/generic/valid-xhtml11_small.png and 0.7.7/e107_images/generic/valid-xhtml11_small.png differ
Binary files 0.7.5/e107_images/generic/vcss_small.png and 0.7.7/e107_images/generic/vcss_small.png differ
diff -ruN 0.7.5/e107_languages/English/English.php 0.7.7/e107_languages/English/English.php
--- 0.7.5/e107_languages/English/English.php	2006-04-17 20:33:36.000000000 -0500
+++ 0.7.7/e107_languages/English/English.php	2006-11-09 12:58:19.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/English.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/04/18 01:33:36 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/11/09 18:58:19 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 setlocale(LC_ALL, 'en');
@@ -23,4 +23,17 @@
 //v0.7+
 define("CORE_LAN4", "Please delete install.php from your server");
 define("CORE_LAN5", "if you do not there is a potential security risk to your website");
+
+// v0.7.6
+define("CORE_LAN6", "The flood protection on this site has been activated and you are warned that if you carry on requesting pages you could be banned.");
+define("CORE_LAN7", "Core is attempting to restore prefs from automatic backup.");
+define("CORE_LAN8", "Core Prefs Error");
+define("CORE_LAN9", "Core could not restore from automatic backup. Execution halted.");
+define("CORE_LAN10", "Corrupted cookie detected - logged out.");
+
+
+define("LAN_WARNING", "Warning!");
+define("LAN_ERROR", "Error");
+define("LAN_ANONYMOUS", "Anonymous");
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/help/article.php 0.7.7/e107_languages/English/admin/help/article.php
--- 0.7.5/e107_languages/English/admin/help/article.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/article.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/article.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $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 seperate each page with the text [newpage], ie <br /><code>Test1 [newpage] Test2</code><br /> would create a two page article with 'Test1' on page 1 and 'Test2' on page 2.
+ 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);
diff -ruN 0.7.5/e107_languages/English/admin/help/content.php 0.7.7/e107_languages/English/admin/help/content.php
--- 0.7.5/e107_languages/English/admin/help/content.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/content.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/content.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $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 />
+$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 -ruN 0.7.5/e107_languages/English/admin/help/cpage.php 0.7.7/e107_languages/English/admin/help/cpage.php
--- 0.7.5/e107_languages/English/admin/help/cpage.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/cpage.php	2006-06-29 17:15:28.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/cpage.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/06/29 22:15:28 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "From this screen you can create custom menus or custom pages with your own content in them.<br /><br />
-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.";
+$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);
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/help/db.php 0.7.7/e107_languages/English/admin/help/db.php
--- 0.7.5/e107_languages/English/admin/help/db.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/db.php	2006-09-20 09:04:31.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/db.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/09/20 14:04:31 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "This collection of tools allows you to manage your database.";
+$text = "These collection of tools allow you to manage your database.";
 $ns -> tablerender("Database Tools", $text);
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/admin/help/fileinspector.php 0.7.7/e107_languages/English/admin/help/fileinspector.php
--- 0.7.5/e107_languages/English/admin/help/fileinspector.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/fileinspector.php	2006-09-20 09:04:31.000000000 -0500
@@ -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.8 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/09/20 14:04:31 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,7 +28,7 @@
 <div style='margin-left: 0px; margin-bottom: 1px; margin-top: 2px; vertical-align: top; white-space: nowrap'>
 <img src='".e_IMAGE."fileinspector/file_fail.png' alt='".$dir."' style='margin-left: 3px; width: 16px; height: 16px' />&nbsp;Core File (Integrity Fail)</div>
 <div style='margin-left: 0px; margin-bottom: 1px; margin-top: 2px; vertical-align: top; white-space: nowrap'>
-<img src='".e_IMAGE."fileinspector/file_uncalc.png' alt='".$dir."' style='margin-left: 3px; width: 16px; height: 16px' />&nbsp;Core File (Uncalculable)</div>
+<img src='".e_IMAGE."fileinspector/file_uncalc.png' alt='".$dir."' style='margin-left: 3px; width: 16px; height: 16px' />&nbsp;Core File (Incalculable)</div>
 <div style='margin-left: 0px; margin-bottom: 1px; margin-top: 2px; vertical-align: top; white-space: nowrap'>
 <img src='".e_IMAGE."fileinspector/file_missing.png' alt='".$dir."' style='margin-left: 3px; width: 16px; height: 16px' />&nbsp;Missing Core File</div>
 <div style='margin-left: 0px; margin-bottom: 1px; margin-top: 2px; vertical-align: top; white-space: nowrap'>
@@ -37,15 +37,15 @@
 <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 
-an e107 core file it checks it for file consistency to make sure it isnt corrupted.";
+$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']) {
 $text .= "<br /><br />
-The additional string matching tool (developer mode only) enables you to scan the files on your server for text strings 
-using regular expressions. The regex engine in use is PHP's <a href='http://php.net/pcre'>PCRE</a> 
+The additional string matching tool (developer mode only) enables you to scan the files on your server for text strings
+using regular expressions. The regex engine in use is PHP's <a href='http://php.net/pcre'>PCRE</a>
 (the preg_* functions), so enter your query as #pattern#modifiers in the fields provided.";
 }
 
 $ns -> tablerender("File Inspector Help", $text);
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/admin/help/filemanager.php 0.7.7/e107_languages/English/admin/help/filemanager.php
--- 0.7.5/e107_languages/English/admin/help/filemanager.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/filemanager.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/filemanager.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "You are able to manage the files in your /files directory from this page. If you are getting error message about permissions when uploading please CHMOD the directory you are atempting to upload into to 777.";
+$text = "You are able to manage the files in your /files directory from this page. If you are getting an error message about permissions when uploading please CHMOD the directory you are attempting to upload into to 777.";
 $ns -> tablerender("File Manager Help", $text);
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/help/forum.php 0.7.7/e107_languages/English/admin/help/forum.php
--- 0.7.5/e107_languages/English/admin/help/forum.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/forum.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/forum.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -26,9 +26,9 @@
 <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>Accessability</b>
+<b>Accessibility</b>
 <br />
-You can set your forums to only be accessable to certain visitors. Once you have set the 'class' of the visitors you can tick the 
+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>
@@ -37,7 +37,7 @@
 <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 corrosponding rank image field is blank.<br />The threshold is the number of points the user needs to gain before his level changes.";
+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 -ruN 0.7.5/e107_languages/English/admin/help/link_category.php 0.7.7/e107_languages/English/admin/help/link_category.php
--- 0.7.5/e107_languages/English/admin/help/link_category.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/link_category.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/link_category.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "You can seperate 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.";
+$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 -ruN 0.7.5/e107_languages/English/admin/help/log.php 0.7.7/e107_languages/English/admin/help/log.php
--- 0.7.5/e107_languages/English/admin/help/log.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/log.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/log.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-
-if (!defined('e107_INIT')) { exit; }
-
-$text = "Activate site stats logging from this page. If you are short of server space tick the domain only box as referer logging, this will only log the domain as opposed to the whole url, ie 'jalist.com' instead of 'http://jalist.com/links.php' ";
-$ns -> tablerender("Logging Help", $text);
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/help/menus2.php 0.7.7/e107_languages/English/admin/help/menus2.php
--- 0.7.5/e107_languages/English/admin/help/menus2.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/menus2.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/menus2.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,7 +21,7 @@
 
 $caption = "Menu Help";
 $text .= "You can arrange where and in which order your menu items are displayed from here. Use the arrows to move the menus up and down until you are satisfied with their positioning.<br />
-The menu items in the middle of the screen are de-activated, you can activate these by choosing a location to put them in.
+The menu items in the middle of the screen are de-activated; you can activate these by choosing a location to put them in.
 ";
 
 $ns -> tablerender("Menus Help", $text);
diff -ruN 0.7.5/e107_languages/English/admin/help/news_category.php 0.7.7/e107_languages/English/admin/help/news_category.php
--- 0.7.5/e107_languages/English/admin/help/news_category.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/news_category.php	2006-08-26 21:24:44.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/news_category.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "You can seperate your news items into different categories, and allow visitors to display only the news items in those categories. <br /><br />Upload your news icon images either ".e_THEME."-yourtheme-/images/ or themes/shared/newsicons/.";
+$text = "You can separate your news items into different categories, and allow visitors to display only the news items in those categories. <br /><br />Upload your news icon images either ".e_THEME."-yourtheme-/images/ or themes/shared/newsicons/.";
 $ns -> tablerender("News Category Help", $text);
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/help/newspost.php 0.7.7/e107_languages/English/admin/help/newspost.php
--- 0.7.5/e107_languages/English/admin/help/newspost.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/newspost.php	2006-08-26 21:24:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/newspost.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,7 +21,7 @@
 
 $caption = "Newspost Help";
 $text = "<b>General</b><br />
-Body will be displayed on the main page, extended will be readable by clicking a 'Read More' link.
+Body will be displayed on the main page; extended will be readable by clicking a 'Read More' link.
 <br />
 <br />
 <b>Show title only</b>
diff -ruN 0.7.5/e107_languages/English/admin/help/review.php 0.7.7/e107_languages/English/admin/help/review.php
--- 0.7.5/e107_languages/English/admin/help/review.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/review.php	2006-08-26 21:24:45.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/review.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $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 seperate each page with the text [newpage], ie <br /><code>Test1 [newpage] Test2</code><br /> would create a two page review with 'Test1' on page 1 and 'Test2' on page 2.";
+ 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 -ruN 0.7.5/e107_languages/English/admin/help/search.php 0.7.7/e107_languages/English/admin/help/search.php
--- 0.7.5/e107_languages/English/admin/help/search.php	2006-01-16 09:06:30.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/search.php	2006-08-26 21:24:45.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/search.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/01/16 15:06:30 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2006/08/27 02:24:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "If your MySql server version supports it you can switch 
-to the MySql sort method which is faster than the PHP sort method. See preferences.<br /><br />
+$text = "If your MySQL server version supports it you can switch 
+to the MySQL sort method which is faster than the PHP sort method. See preferences.<br /><br />
 If your site includes Ideographic languages such as Chinese and Japanese you must 
 use the PHP sort method and switch whole word matching off.";
 $ns -> tablerender("Search Help", $text);
diff -ruN 0.7.5/e107_languages/English/admin/help/ugflag.php 0.7.7/e107_languages/English/admin/help/ugflag.php
--- 0.7.5/e107_languages/English/admin/help/ugflag.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/help/ugflag.php	2006-09-20 09:04:31.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/ugflag.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/09/20 14:04:31 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "If you are upgrading e107 or just need your site to be offline for a while just tick the maintainance box and your visitors will be redirected to a page explaining the site is down for repair. After you've finished untick the box to return site to normal.";
+$text = "If you are upgrading e107 or just need your site to be offline for a while just tick the maintenance box and your visitors will be redirected to a page explaining the site is down for repair. After you've finished un-tick the box to return site to normal.";
 
-$ns -> tablerender("Maintainance", $text);
-?>
\ No newline at end of file
+$ns -> tablerender("Maintenance", $text);
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_admin.php 0.7.7/e107_languages/English/admin/lan_admin.php
--- 0.7.5/e107_languages/English/admin/lan_admin.php	2006-05-13 13:18:43.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_admin.php	2006-10-31 15:16:29.000000000 -0600
@@ -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.43 $
-|     $Date: 2006/05/13 18:18:43 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.54 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("ADLAN_0", "News");
@@ -76,7 +76,7 @@
 define("ADLAN_66", "Meta Tags");
 define("ADLAN_67", "Add/Edit site meta tags");
 define("ADLAN_68", "PHP Info");
-define("ADLAN_69", "PHPInfo page");
+define("ADLAN_69", "PHP Info page");
 define("ADLAN_70", "Polls");
 define("ADLAN_71", "Add/Edit Polls");
 define("ADLAN_72", "Public Uploads");
@@ -101,7 +101,7 @@
 define("ADLAN_96", "None");
 define("ADLAN_97", "Click here for FAQ");
 define("ADLAN_98", "Plugin Manager");
-define("ADLAN_99", "Install/upgrade etc plugins");
+define("ADLAN_99", "Install/upgrade etc. plugins");
 define("ADLAN_100", "Theme Layout");
 define("ADLAN_101", "Template Creator");
 define("ADLAN_102", "It has been more than 30 days since you changed the main administrator password - ");
@@ -193,7 +193,11 @@
 
 define("ADLAN_ERR_1", "Warning!");
 define("ADLAN_ERR_2", "There are files on your server that are known to be exploitable. These must be removed <b>immediately</b>. The files are related to the older 0.6xx branch of e107. Please delete the following directories and all their contents:");
-define("ADLAN_ERR_3", "There are one or more files in your public upload directories that are not in your allowed upload filetypes list. These may have been placed here by an attacker and if so should be removed <b>immediately</b>. You should <b>not</b> open these files as this may execute any malicious code the file might contain. ie. do not open them with your browser.<br /><br />If you recognise these files as being legitimate, it is likely that due to the recent allowed filetypes changes, the filetype you allowed is no longer in the allowed filetypes list and you will need to re-add it (see admin => uploads). You should not allow the upload of .html, .txt, etc as an attacker may upload a file of this type which includes malicious javascript. You should also, of course, not allow the upload of .php files or any other type of executable script.<br /><br />Below is the list of files that could potentially be malicious:");
+define("ADLAN_ERR_3", "There are one or more files in your public upload directories that are not in your allowed upload filetypes list. These may have been placed here by an attacker and if so should be removed <b>immediately</b>. You should <b>not</b> open these files as this may execute any malicious code the file might contain; i.e. do not open them with your browser.<br /><br />If you recognise these files as being legitimate, it is likely that due to the recent allowed filetypes changes, the filetype you allowed is no longer in the allowed filetypes list and you will need to re-add it (see admin => uploads). You should not allow the upload of .html, .txt, etc as an attacker may upload a file of this type which includes malicious javascript. You should also, of course, not allow the upload of .php files or any other type of executable script.<br /><br />Below is the list of files that could potentially be malicious:");
+define("ADLAN_ERR_4", "Deprecated plugin file(s) found");
+define("ADLAN_ERR_5", "The following files need to be renamed to");
+define("ADLAN_ERR_6", "Then, click here to re-scan your plugin folders.");
+
 
 // Common Terms
 define("LAN_EDIT","Edit");
@@ -203,7 +207,6 @@
 define("LAN_SAVE","Save");
 define("LAN_SAVED","Saved");
 define("LAN_SETSAVED","Your settings have been saved");
-define("LAN_ERROR","Error");
 define("LAN_CONFIRMDEL","Please confirm you wish to delete");
 define("LAN_OPTIONS","Options");
 define("LAN_PREFS","Preferences");
@@ -222,9 +225,10 @@
 
 define("LAN_PRESET","Preset");
 define("LAN_PRESET_SAVED","Preset saved successfully");
+
 define("LAN_PRESET_DELETED","Preset successfully deleted");
 define("LAN_PRESET_CONFIRMDEL","Are you sure you want to delete this preset?");
-define("LAN_NOTWRITABLE"," is not writable, you need to CHMOD 777 the folder first.");
+define("LAN_NOTWRITABLE"," is not writable, you need to CHMOD 777 the file or folder first.");
 define("LAN_DATE","Date");
 define("LAN_TIME","Time");
 define("LAN_YES","Yes");
@@ -241,13 +245,28 @@
 define("LAN_ADMIN","Admin");
 define("LAN_DISPLAYOPT", "Edit Display Options");
 define("LAN_GOPAGE", "Go to page:");
-define("LAN_DATESTAMP","Datestamp");
+define("LAN_DATESTAMP","Date stamp");
 define("LAN_OPTIONAL", "optional");
 define("LAN_INACTIVE","Inactive");
 
 define("LAN_BAN","Ban");
 define("LAN_RATING", "Rating");
 
+define("LAN_UPLOAD_IMAGES","Upload Images");
+define("LAN_UPLOAD_FILES","Upload Files");
+define("LAN_UPLOAD_ADDFILE","Add Another File");
+define("LAN_UPLOAD_CONFIRM","Any unsaved changes to this page will be lost. Continue?");
+define("LAN_UPLOAD_777","Folder is missing or not writable, you need to CHMOD 777 the following folder before uploading:");
+define("LAN_UPLOAD_SERVEROFF", "This option is disabled as file uploading is not enabled on your server");
+
+define("LAN_DISABLED","Disabled");
+define("LAN_ENABLED", "Enabled");
+
+define("LAN_PRESET_CONFIRMSAVE","Save current form values as the default for this page?");
+define("LAN_CONFIGURE", "Configure");
+
+define("LAN_BACK","Back");
 
+define("LAN_CREDITS","Credits");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_admin_log.php 0.7.7/e107_languages/English/admin/lan_admin_log.php
--- 0.7.5/e107_languages/English/admin/lan_admin_log.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_admin_log.php	2006-06-05 15:02:15.000000000 -0500
@@ -0,0 +1,27 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system - Language File.
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_admin_log.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/06/05 20:02:15 $
+|     $Author: lisa_ 
++----------------------------------------------------------------------------+
+*/
+define("LAN_ADMINLOG_0", "Admin Log");
+define("LAN_ADMINLOG_1", "Date");
+define("LAN_ADMINLOG_2", "Title");
+define("LAN_ADMINLOG_3", "Description");
+define("LAN_ADMINLOG_4", "User IP");
+define("LAN_ADMINLOG_5", "User ID");
+define("LAN_ADMINLOG_6", "Informative Icon");
+define("LAN_ADMINLOG_7", "Informative Message");
+define("LAN_ADMINLOG_8", "Notice Icon");
+define("LAN_ADMINLOG_9", "Notice Message");
+define("LAN_ADMINLOG_10", "Warning Icon");
+define("LAN_ADMINLOG_11", "Warning Message");
+define("LAN_ADMINLOG_12", "Fatal Icon");
+define("LAN_ADMINLOG_13", "Fatal Error Message");
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_administrator.php 0.7.7/e107_languages/English/admin/lan_administrator.php
--- 0.7.5/e107_languages/English/admin/lan_administrator.php	2005-09-09 15:32:06.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_administrator.php	2006-11-10 09:59:14.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_administrator.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2005/09/09 20:32:06 $
-|     $Author: e107coders $
+|     $Revision: 1.16 $
+|     $Date: 2006/11/10 15:59:14 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("ADMSLAN_0", "New user/admin entry created for");
@@ -14,6 +14,7 @@
 define("ADMSLAN_2", "updated in database.");
 define("ADMSLAN_3", "is the main site administrator and cannot be edited.");
 define("ADMSLAN_4", "Continue");
+define("ADMSLAN_5", "Error!");
 define("ADMSLAN_6", "is the main site administrator and cannot be deleted.");
 
 define("ADMSLAN_13", "Existing Administrators");
@@ -24,7 +25,7 @@
 define("ADMSLAN_18", "Permissions");
 define("ADMSLAN_19", "Alter site preferences");
 define("ADMSLAN_20", "Alter Menus");
-define("ADMSLAN_21", "Add site administrators");
+define("ADMSLAN_21", "Modify administrator permissions");
 define("ADMSLAN_22", "Moderate users/bans etc");
 define("ADMSLAN_23", "Create/edit custom pages/menus");
 define("ADMSLAN_24", "Manage download categories");
@@ -39,7 +40,7 @@
 define("ADMSLAN_33", "Configure log/stats");
 define("ADMSLAN_34", "Configure meta tags");
 define("ADMSLAN_35", "Configure public file uploads");
-// define("ADMSLAN_36", "Moderate forums");
+define("ADMSLAN_36", "Configure Image Settings");
 define("ADMSLAN_37", "Moderate comments");
 // define("ADMSLAN_38", "Moderate/configure chatbox");
 define("ADMSLAN_39", "Post news");
@@ -77,6 +78,6 @@
 define("ADMSLAN_69", "is already an administrator and must be edited.");
 
 define("ADMSLAN_70", "Return to Administrator Listing");
-define("ADMSLAN_71", "Click here to display privelages");  
+define("ADMSLAN_71", "Click here to display privileges");  
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_banlist.php 0.7.7/e107_languages/English/admin/lan_banlist.php
--- 0.7.5/e107_languages/English/admin/lan_banlist.php	2005-06-17 01:49:46.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_banlist.php	2006-11-17 20:29:09.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.6 $
-|     $Date: 2005/06/17 06:49:46 $
-|     $Author: stevedunstan $
+|     $Revision: 1.7 $
+|     $Date: 2006/11/18 02:29:09 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("BANLAN_1", "Ban removed.");
@@ -19,5 +19,7 @@
 define("BANLAN_9", "Ban users from site");
 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.");
+
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_banner.php 0.7.7/e107_languages/English/admin/lan_banner.php
--- 0.7.5/e107_languages/English/admin/lan_banner.php	2005-06-22 17:21:37.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_banner.php	2006-06-14 17:12:07.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_banner.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/06/22 22:21:37 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/06/14 22:12:07 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 define("BNRLAN_1", "Banner deleted.");
@@ -58,8 +58,6 @@
 
 define("BANNER_MENU_L1", "Advertisement");
 define("BANNER_MENU_L2", "Banner menu configuration saved");
-
-//v.617
 define("BANNER_MENU_L3", "Caption");
 define("BANNER_MENU_L5", "Banner Configuration"); 
 define("BANNER_MENU_L6", "choose campaigns to show in menu");
@@ -70,5 +68,6 @@
 define("BANNER_MENU_L12", "plain");
 define("BANNER_MENU_L13", "in captioned box");
 define("BANNER_MENU_L18", "Update Menu Settings");
+define("BANNER_MENU_L19", "number of banners to show:<br />this is only used when multiple campaigns are selected");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_credits.php 0.7.7/e107_languages/English/admin/lan_credits.php
--- 0.7.5/e107_languages/English/admin/lan_credits.php	2005-06-10 10:40:55.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_credits.php	2006-10-31 15:16:29.000000000 -0600
@@ -4,19 +4,51 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_credits.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/06/10 15:40:55 $
-|     $Author: stevedunstan $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
+
+define("PAGE_NAME", "e107 Credits");
+
 define("CRELAN_1", "Credits");
 define("CRELAN_2", "Here is a list of third-party software / resources used in e107. The e107 development team would like to personally thank the developers of the following for allowing us to redistribute their code with e107, and for releasing their software under the GPL licence.");
-// define("CRELAN_3", "Resource");
-// define("CRELAN_4", "Description");
-// define("CRELAN_5", "Website");
-// define("CRELAN_6", "Permission");
+define("CRELAN_3", "all rights reserved");
+define("CRELAN_4", "Show e107 Dev Team");
+define("CRELAN_5", "Show third party scripts");
+define("CRELAN_6", "e107 v0.7 was brought to you by ...");
 define("CRELAN_7", "version");
+define("CRELAN_8", "permission granted");
+define("CRELAN_9", "Licence");
+
+// third party scripts
+
+define("CRELAN_10", "MagpieRSS provides an XML-based (expat) RSS parser in PHP.");
+define("CRELAN_11", "PclZip library offers compression and extraction functions for Zip formatted archives (WinZip, PKZIP).");
+define("CRELAN_12", "PclTar offer the ability to archive a list of files or directories with or without compression. The archives created by PclTar are readable by most of gzip/tar applications and by the Windows WinZip application.");
+define("CRELAN_13", "TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.");
+define("CRELAN_14", "Icons used in e107");
+define("CRELAN_15", "Full featured email transfer class for PHP");
+define("CRELAN_16", "Menu system used in Jayya theme");
+define("CRELAN_17", "Popup calendar widget");
+define("CRELAN_18", "PDF support");
+define("CRELAN_19", "UTF-8 PDF support");
+
+// end third party scripts
+
+// dev team
 
+define("CRELAN_20", ""); // asperon
+define("CRELAN_21", "Always a pressure..err..pleasure!"); // CaMer0n
+define("CRELAN_22", "\"MTVhNjMyZDgxN2QwM2Q3ZTI<br />5ODM2NDU3YWI0ZjM1NGILJT<br />yarrrrrr! wtf matey!\""); // jalist
+define("CRELAN_23", ""); // lisa
+define("CRELAN_24", ""); // McFly
+define("CRELAN_25", ""); // que
+define("CRELAN_26", ""); // streaky
+define("CRELAN_27", "\"Wot? No tea?? 0_0\""); // SweetAs
+define("CRELAN_28", ""); // MrPete
 
+// end dev team
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_db.php 0.7.7/e107_languages/English/admin/lan_db.php
--- 0.7.5/e107_languages/English/admin/lan_db.php	2005-11-24 10:29:02.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_db.php	2006-10-31 15:16:29.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.2 $
-|     $Date: 2005/11/24 16:29:02 $
-|     $Author: streaky $
+|     $Revision: 1.6 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("DBLAN_1", "Core settings backed up in database.");
@@ -25,5 +25,21 @@
 define("DBLAN_14", "Done");
 define("DBLAN_15", "Click button to check for any available db updates");
 define("DBLAN_16", "Check for Updates");
+define("DBLAN_17", "Pref. Name");
+define("DBLAN_18", "Pref. Value");
+define("DBLAN_19", "Click button to open the preferences editor (for advanced users only)");
+define("DBLAN_20", "Preferences Editor");
+define("DBLAN_21", "Delete Checked");
+define("DBLAN_22", "Plugin: View and Scan");
+define("DBLAN_23", "Scan Completed");
+define("DBLAN_24", "Name");
+define("DBLAN_25", "Directory");
+define("DBLAN_26", "Included add-ons");
+define("DBLAN_27", "Installed");
+define("DBLAN_28", "Click button to scan plugin directories for changes");
+define("DBLAN_29", "Scan plugin directories");
 
-?>
\ No newline at end of file
+
+
+
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_download.php 0.7.7/e107_languages/English/admin/lan_download.php
--- 0.7.5/e107_languages/English/admin/lan_download.php	2006-03-05 00:10:42.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_download.php	2006-08-26 21:24:44.000000000 -0500
@@ -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.13 $
-|     $Date: 2006/03/05 06:10:42 $
-|     $Author: e107coders $
+|     $Revision: 1.17 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("DOWLAN_1", "Download added to database.");
@@ -40,7 +40,7 @@
 define("DOWLAN_32", "Downloads Options");
 define("DOWLAN_33", "Are you sure you want to delete this download?");
 define("DOWLAN_34", "Are you sure you want to delete this download category?");
-define("DOWLAN_35", "Download");
+
 define("DOWLAN_36", "deleted");
 define("DOWLAN_37", "Parent");
 define("DOWLAN_38", "No existing categories");
@@ -65,7 +65,6 @@
 
 
 define("DOWLAN_59", "Filename");
-define("DOWLAN_60", "Author");
 
 define("DOWLAN_62", "Ascending");
 define("DOWLAN_63", "Descending");
@@ -128,9 +127,12 @@
 
 
 define("DOWLAN_147", "Icon for empty category");
-define("DOWLAN_148", "Check to update datestamp to current time");
+define("DOWLAN_148", "Check to update date stamp to current time");
 define("DOWLAN_149", "Or click here to use an external file");
 
 define("DOWLAN_150", "Email admin when broken download reported");
+define("DOWLAN_151", "Broken-download reporting available to");
 
+define("DOWLAN_152", "Couldn't move file");
+define("DOWLAN_153", "Move file into download folder");   
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_e107_update.php 0.7.7/e107_languages/English/admin/lan_e107_update.php
--- 0.7.5/e107_languages/English/admin/lan_e107_update.php	2005-11-21 10:15:28.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_e107_update.php	2006-07-08 22:43:42.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_e107_update.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/11/21 16:15:28 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/07/09 03:43:42 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -19,5 +19,7 @@
 define("LAN_UPDATE_9", "to");
 define("LAN_UPDATE_10", "Available Updates");
 define("LAN_UPDATE_11", ".617 to .7 Update Continued");
+define("LAN_UPDATE_12", "One of your tables contains duplicate entries.");
+
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_emoticon.php 0.7.7/e107_languages/English/admin/lan_emoticon.php
--- 0.7.5/e107_languages/English/admin/lan_emoticon.php	2006-01-14 19:08:03.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_emoticon.php	2006-06-13 11:16:13.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.7 $
-|     $Date: 2006/01/15 01:08:03 $
-|     $Author: streaky $
+|     $Revision: 1.8 $
+|     $Date: 2006/06/13 16:16:13 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 define("EMOLAN_1", "Emote activation");
@@ -29,11 +29,11 @@
 define("EMOLAN_14", "Save configuration");
 define("EMOLAN_15", "Edit / configure emotes");
 define("EMOLAN_16", "Emote configuration saved");
-define("EMOLAN_2", "Name");
-define("EMOLAN_2", "Name");
-define("EMOLAN_2", "Name");
-define("EMOLAN_2", "Name");
-define("EMOLAN_2", "Name");
-define("EMOLAN_2", "Name");
+define("EMOLAN_17", "You have an emoticon pack present that contains spaces, 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");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_fileinspector.php 0.7.7/e107_languages/English/admin/lan_fileinspector.php
--- 0.7.5/e107_languages/English/admin/lan_fileinspector.php	2006-01-14 19:08:03.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_fileinspector.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_fileinspector.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/01/15 01:08:03 $
-|     $Author: streaky $
+|     $Revision: 1.12 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -44,7 +44,7 @@
 define("FR_LAN_10", "Possible reasons for files to fail");
 define("FR_LAN_11", "The file is corrupted");
 define("FR_LAN_12", "This could be for a number of reasons such as the file being corrupted in the zip, got corrupted during 
-extraction or got corrupted during file upload via FTP. You should try reuploading the file to your server 
+extraction or got corrupted during file upload via FTP. You should try re-uploading the file to your server 
 and re-run the scan to see if this resolves the error.");
 define("FR_LAN_13", "The file is out of date");
 define("FR_LAN_14", "If the file is from an older release of e107 to the version you are 
@@ -64,7 +64,7 @@
 define("FR_LAN_22", "Missing core files");
 define("FR_LAN_23", "No matches found.");
 define("FR_LAN_24", "Old core files");
-define("FR_LAN_25", "Integrity uncalculable");
+define("FR_LAN_25", "Integrity incalculable");
 
 define("FR_LAN_26", "Warning! Known Insecurity Detected!");
 define("FR_LAN_27", "There are files on your server that are known to be exploitable and must be removed immediately.");
diff -ruN 0.7.5/e107_languages/English/admin/lan_header.php 0.7.7/e107_languages/English/admin/lan_header.php
--- 0.7.5/e107_languages/English/admin/lan_header.php	2004-10-25 11:11:40.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_header.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,13 +4,13 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_header.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2004/10/25 16:11:40 $
-|     $Author: loloirie $
+|     $Revision: 1.4 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("LAN_head_1", "Admin Navigation");
-define("LAN_head_2", "Your server does not allow HTTP file uploads so it will not be possible for your users to uploads avatars/files etc. To rectify this set file_uploads to On in your php.ini and restart your server. If you dont have access to your php.ini contact your hosts.");
+define("LAN_head_2", "Your server does not allow HTTP file uploads so it will not be possible for your users to upload avatars/files etc. To rectify this set file_uploads to On in your php.ini and restart your server. If you don't have access to your php.ini contact your hosts.");
 define("LAN_head_3", "Your server is running with a basedir restriction in effect. This disallows usage of any file outside of your home directory and as such could affect certain scripts such as the filemanager.");
 
 define("LAN_head_4", "Admin Area");
diff -ruN 0.7.5/e107_languages/English/admin/lan_image.php 0.7.7/e107_languages/English/admin/lan_image.php
--- 0.7.5/e107_languages/English/admin/lan_image.php	2005-05-19 15:41:08.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_image.php	2006-11-11 06:53:57.000000000 -0600
@@ -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.3 $
-|     $Date: 2005/05/19 20:41:08 $
-|     $Author: streaky $
+|     $Revision: 1.5 $
+|     $Date: 2006/11/11 12:53:57 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 define("IMALAN_1", "Enable image posting");
@@ -44,4 +44,22 @@
 define("IMALAN_34", "Enable Sleight");
 define("IMALAN_35", "Fixes transparent PNG-24's with alpha transparency in IE 5 / 6 (Applies Sitewide)");
 
+define("IMALAN_36", "Validate avatar size and access");
+define("IMALAN_37", "Avatar Validation");
+define("IMALAN_38", "Maximum allowable width");
+define("IMALAN_39", "Maximum allowable height");
+define("IMALAN_40", "Too wide");
+define("IMALAN_41", "Too high");
+define("IMALAN_42", "Not found");
+define("IMALAN_43", "Delete uploaded avatar");
+define("IMALAN_44", "Delete external reference");
+define("IMALAN_45", "Not found");
+define("IMALAN_46", "Too large");
+define("IMALAN_47", "Total uploaded avatars");
+define("IMALAN_48", "Total external avatars");
+define("IMALAN_49", "Users with avatars");
+define("IMALAN_50", "Total");
+define("IMALAN_51", "Avatar for ");
+
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_lancheck.php 0.7.7/e107_languages/English/admin/lan_lancheck.php
--- 0.7.5/e107_languages/English/admin/lan_lancheck.php	2004-10-10 16:31:57.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_lancheck.php	2006-11-04 21:50:19.000000000 -0600
@@ -4,25 +4,32 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_lancheck.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2004/10/10 21:31:57 $
-|     $Author: loloirie $
+|     $Revision: 1.7 $
+|     $Date: 2006/11/05 03:50:19 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-define("LAN_CHECK_1", "Select Language to verify");
+define("LAN_CHECK_1", "Verify/Edit Language Files"); // modified in 0.7.6
 define("LAN_CHECK_2", "Begin Verify");
 define("LAN_CHECK_3", "Verification of");
 define("LAN_CHECK_4", "File missing!");
 define("LAN_CHECK_5", "Phrase missing!");
-define("LAN_CHECK_6", "OK");
+
 define("LAN_CHECK_7", "phrase");
 
 define("LAN_CHECK_8", "A file is missing...");
 define("LAN_CHECK_9", " files are missing...");
 define("LAN_CHECK_10", "Critical error: ");
-define("LAN_CHECK_11", "No file missing !");
+define("LAN_CHECK_11", "No files missing !");
 define("LAN_CHECK_12", "A file is wrong...");
 define("LAN_CHECK_13", " files are wrong...");
 define("LAN_CHECK_14", "All existing files are valid !");
 
+define("LAN_CHECK_15", "Illegal characters found before '&lt;?php'");
+define("LAN_CHECK_16", "Original File");
+define("LAN_CHECK_17", "A write problem occured while trying to save the file.");
+define("LAN_CHECK_18", "Language files in the standard format are NOT available for this plugin/theme.");
+define("LAN_CHECK_19", "Non-UTF-8 characters found!");
+
+
 ?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_language.php 0.7.7/e107_languages/English/admin/lan_language.php
--- 0.7.5/e107_languages/English/admin/lan_language.php	2006-04-17 09:52:38.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_language.php	2006-10-24 21:31:29.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.9 $
-|     $Date: 2006/04/17 14:52:38 $
+|     $Revision: 1.14 $
+|     $Date: 2006/10/25 02:31:29 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -24,7 +24,15 @@
 define("LANG_LAN_12", "Enable Multi-Language Tables");
 define("LANG_LAN_13", "Language Preferences");
 define("LANG_LAN_14", "Default Site Language");
-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_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");
 
-?>
\ No newline at end of file
+define("LANG_LAN_21", "Language Tools");
+
+
+
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_links.php 0.7.7/e107_languages/English/admin/lan_links.php
--- 0.7.5/e107_languages/English/admin/lan_links.php	2005-11-23 12:08:28.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_links.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_links.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/11/23 18:08:28 $
+|     $Revision: 1.15 $
+|     $Date: 2006/08/27 02:24:44 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -23,7 +23,7 @@
 define("LCLAN_19", "Link Open Type");
 define("LCLAN_20", "Opens in same window");
 define("LCLAN_23", "Opens in new window");
-define("LCLAN_24", "Opens in 600x400 miniwindow");
+define("LCLAN_24", "Opens in 600x400 mini-window");
 define("LCLAN_25", "Link Class");
 define("LCLAN_26", "Ticking will make the link visible to only users in that class");
 define("LCLAN_27", "Update Link");
@@ -46,7 +46,7 @@
 define("LCLAN_83", "Submenus Generator");
 define("LCLAN_88", "Site Links Options");
 define("LCLAN_89", "Image");
-define("LCLAN_90", "Link Name");
+
 define("LCLAN_91", "Move");
 define("LCLAN_95", "Class");
 
diff -ruN 0.7.5/e107_languages/English/admin/lan_mailout.php 0.7.7/e107_languages/English/admin/lan_mailout.php
--- 0.7.5/e107_languages/English/admin/lan_mailout.php	2006-05-12 17:50:40.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_mailout.php	2006-08-10 11:11:50.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_mailout.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/05/12 22:50:40 $
+|     $Revision: 1.14 $
+|     $Date: 2006/08/10 16:11:50 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -61,5 +61,43 @@
 define("MAILAN_33", "Incoming Mail");
 define("MAILAN_34", "Account Name");
 define("MAILAN_35", "Password");
-define("MAILAN_36", "Delete Bounced Mails after checking");  
+define("MAILAN_36", "Delete Bounced Mails after checking");
+
+define("MAILAN_37", "Proceed");
+define("MAILAN_38", "Cancel");
+define("MAILAN_39", "Emailing");
+define("MAILAN_40", "You need to rename <b>e107.htaccess</b> to <b>.htaccess</b> in");
+define("MAILAN_41", "before sending mail from this page.");
+define("MAILAN_42", "Warning");
+define("MAILAN_43", "Username");
+define("MAILAN_44", "User Login");
+define("MAILAN_45", "User Email");
+define("MAILAN_46", "User-Match");
+define("MAILAN_47", "contains");
+define("MAILAN_48", "equals");
+define("MAILAN_49", "Id");
+define("MAILAN_50", "Author");
+define("MAILAN_51", "Subject");
+define("MAILAN_52", "Lastmod");
+define("MAILAN_53", "Admins");
+define("MAILAN_54", "Self");
+define("MAILAN_55", "Userclass");
+define("MAILAN_56", "Send Mail");
+define("MAILAN_57", "Keep SMTP session alive");
+define("MAILAN_58", "There is a problem with the attachment:");
+define("MAILAN_59", "Mailing Progress");
+define("MAILAN_60", "Sending...");
+define("MAILAN_61", "There are no remaining emails to be sent.");
+define("MAILAN_62", "Emails sent:");
+define("MAILAN_63", "Emails failed:");
+define("MAILAN_64", "Total time elapsed:");
+define("MAILAN_65", "seconds");
+define("MAILAN_66", "Cancelled Successfully");
+define("MAILAN_67", "Use 'POP before SMTP' authentication"); 
+
+
+
+
+
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_meta.php 0.7.7/e107_languages/English/admin/lan_meta.php
--- 0.7.5/e107_languages/English/admin/lan_meta.php	2005-09-06 14:34:04.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_meta.php	2006-06-07 00:04:58.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_meta.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/09/06 19:34:04 $
+|     $Revision: 1.5 $
+|     $Date: 2006/06/07 05:04:58 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -21,5 +21,7 @@
 define("METLAN_9", "Description");
 define("METLAN_10", "Keywords");
 define("METLAN_11", "Copyright");
+define("METLAN_12", "Use News title and summary as the meta-description on news pages.");
+define("METLAN_13", "Author");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_newspost.php 0.7.7/e107_languages/English/admin/lan_newspost.php
--- 0.7.5/e107_languages/English/admin/lan_newspost.php	2006-04-13 18:43:16.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_newspost.php	2006-11-10 00:54:18.000000000 -0600
@@ -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.26 $
-|     $Date: 2006/04/13 23:43:16 $
-|     $Author: sweetas $
+|     $Revision: 1.31 $
+|     $Date: 2006/11/10 06:54:18 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 define("NWSLAN_1", "News story deleted.");
@@ -23,8 +23,8 @@
 define("NWSLAN_13", "Body");
 define("NWSLAN_14", "Extended");
 define("NWSLAN_15", "Comments");
-define("NWSLAN_16", "Enabled");
-define("NWSLAN_17", "Disabled");
+// define("NWSLAN_16", "Enabled"); // deprecated see lan_admin.php
+// define("NWSLAN_17", "Disabled"); // deprecated see lan_admin.php
 define("NWSLAN_18", "Allow comments to be posted to this news item");
 define("NWSLAN_19", "Activation");
 
@@ -67,7 +67,7 @@
 define("NWSLAN_57", "Item");
 define("NWSLAN_58", "Post");
 define("NWSLAN_59", "No submitted news");
-define("NWSLAN_60", "Submitted News");
+// define("NWSLAN_60", "Submitted News"); //already defined above.
 
 define("NWSLAN_62", "Go to page: ");
 define("NWSLAN_63", "Search newsposts");
@@ -76,8 +76,8 @@
 define("NWSLAN_67", "Image");
 define("NWSLAN_68", "File");
 define("NWSLAN_69", "Upload an image or file for use in the news item");
-define("NWSLAN_70", "The ".e_FILE."downloads folder is not writable, you need to CHMOD 777 the folder before uploading and files.");
-define("NWSLAN_71", "The ".e_IMAGE."newspost_images folder is not writable.  You need to CHMOD 777 the folder before uploading any images.");
+// define("NWSLAN_70", "The ".e_FILE."downloads folder is not writable, you need to CHMOD 777 the folder before uploading and files.");  // deprecated see lan_admin.php
+// define("NWSLAN_71", "The ".e_IMAGE."newspost_images folder is not writable.  You need to CHMOD 777 the folder before uploading any images.");  // deprecated see lan_admin.php
 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");
@@ -85,7 +85,7 @@
 define("NWSLAN_76", "Title only - post to front 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");
+// define("NWSLAN_78", "This option is disabled as file uploading is not enabled on your server");  // deprecated see lan_admin.php
 define("NWSLAN_79","Clear Form");
 
 define("NWSLAN_83","Extended news post");
@@ -99,11 +99,12 @@
 define("NWSLAN_100", "Enable Image uploading on Submit News page");
 define("NWSLAN_101", "Automatic resizing of submitted image");
 define("NWSLAN_102", "width in pixels<br /> or leave blank to disable.");
-define("NWSLAN_103", "re-Post");
+define("NWSLAN_103", "re-post");
 define("NWSLAN_104", "by");
-define("NWSLAN_105", "Check box to update datestamp of news item to current time");
+define("NWSLAN_105", "Check box to update date stamp of news item to current time");
 define("NWSLAN_106", "Submit-News maybe accessed by:");
 define("NWSLAN_107", "Enable WYSIWYG editor on Submit-News page.");
+define("NWSLAN_108", "on");
 
 define("NWSLAN_111", "Show new date header");
 define("NWSLAN_112", "If this box is ticked, a box containing the date will be displayed above news items posted on a new day, useful for distinguishing posts on different days");
@@ -112,9 +113,9 @@
 define("NWSLAN_114", "if the theme you're using has a news layout template, use this instead of the generic layout");
 
 define("NWSLAN_115", "News posts to display in archive ?");
-define("NWSLAN_116", "First update the preferences with the changed display per page setting, then update again after setting the newsarchive preference. (0 is un-activated)");
-define("NWSLAN_117", "set the title for the newsarchive");
-define("NWSLAN_118", "View Images");
+define("NWSLAN_116", "First update the preferences with the changed display per page setting, then update again after setting the news archive preference. (0 is un-activated)");
+define("NWSLAN_117", "set the title for the news archive");
+// define("NWSLAN_118", "View Images"); already defined above.
 define("NWSLAN_119", "Settings Saved");
 define("NWSLAN_120", "Text to show at the top of Submit News");
 
@@ -145,28 +146,28 @@
 define("LAN_NEWS_29", "Select if news item will be sticky");
 define("LAN_NEWS_30", "If selected, news item will appear above all others");
 define("LAN_NEWS_31", "This news post is <b>sticky</b> (it will be shown above all other items). ");
-define("LAN_NEWS_32", "Datestamp");
-define("LAN_NEWS_33", "Set the datestamp for the current news item");
+define("LAN_NEWS_32", "Date stamp");
+define("LAN_NEWS_33", "Set the date stamp for the current news item");
 
 define("LAN_NEWS_34", "Trackback");
-define("LAN_NEWS_35", "Add trackback url's");
-define("LAN_NEWS_36", "<b>Pingback</b> (send a pingback to all url's in this post)");
-define("LAN_NEWS_37", "<b>Trackback url's:</b> (one url per line)");
+define("LAN_NEWS_35", "Add trackback URLs");
+define("LAN_NEWS_36", "<b>Pingback</b> (send a pingback to all URLs in this post)");
+define("LAN_NEWS_37", "<b>Trackback URLs:</b> (one URL per line)");
 define("LAN_NEWS_38", "Insert images");
 
 define("LAN_NEWS_39", "click on file to insert at cursor position");
 define("LAN_NEWS_40", "Insert download links");
 
 define("LAN_NEWS_42", "Files");
-define("LAN_NEWS_43", "(no images in /e107_images/newspost_images)");
+// define("LAN_NEWS_43", "(no images in /e107_images/newspost_images)");  // deprecated see lan_admin.php
 define("LAN_NEWS_44", "Trackback not enabled.");
 
 define("LAN_NEWS_45", "ID");
 
 define("LAN_NEWS_46", "News item not updated as no changes were made.");
-define("LAN_NEWS_47", "Image");
+// define("LAN_NEWS_47", "Image");  // already defined above.
 define("LAN_NEWS_48", "No Image");
 
 define("LAN_NEWS_49", "Render-type");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_notify.php 0.7.7/e107_languages/English/admin/lan_notify.php
--- 0.7.5/e107_languages/English/admin/lan_notify.php	2005-05-29 13:19:25.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_notify.php	2006-09-16 13:18:04.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_notify.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/05/29 18:19:25 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/09/16 18:18:04 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -18,7 +18,7 @@
 define("NT_LAN_6", "Email");
 
 define("NU_LAN_1", "User Events");
-define("NU_LAN_2", "User sign up");
+define("NU_LAN_2", "User signup");
 define("NU_LAN_3", "User account verification");
 define("NU_LAN_4", "User login");
 define("NU_LAN_5", "User logout");
@@ -32,4 +32,7 @@
 define("NN_LAN_4", "News item edited by admin");
 define("NN_LAN_5", "News item deleted by admin");
 
-?>
\ No newline at end of file
+define("NF_LAN_1", "File Events");
+define("NF_LAN_2", "File uploaded by user");
+
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_plugin.php 0.7.7/e107_languages/English/admin/lan_plugin.php
--- 0.7.5/e107_languages/English/admin/lan_plugin.php	2006-03-16 09:58:14.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_plugin.php	2006-08-26 21:24:44.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.16 $
-|     $Date: 2006/03/16 15:58:14 $
-|     $Author: lisa_ $
+|     $Revision: 1.21 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("EPL_ADLAN_0", "Install");
@@ -29,7 +29,7 @@
 define("EPL_ADLAN_17", "More info...");
 define("EPL_ADLAN_18", "Unable to successfully create table(s) for this plugin.");
 define("EPL_ADLAN_19", "Database tables successfully created.");
-define("EPL_ADLAN_20", "Preference settings successfully created.");
+// define("EPL_ADLAN_20", "Preference settings successfully created."); // duplicate of EPL_ADLAN_8;
 
 define("EPL_ADLAN_21", "Plugin is already installed.");
 define("EPL_ADLAN_22", "Installed");
@@ -50,7 +50,7 @@
 
 define("EPL_ADLAN_37", "Upload plugin (.zip or .tar.gz format)");
 define("EPL_ADLAN_38", "Upload Plugin");
-define("EPL_ADLAN_39", "The file could not be uploaded as the ".e_PLUGIN." folder does not have the correct permissions - please CHMOD to 777 and reupload the file.");
+define("EPL_ADLAN_39", "The file could not be uploaded as the ".e_PLUGIN." folder does not have the correct permissions - please CHMOD to 777 and re-upload the file.");
 define("EPL_ADLAN_40", "Admin Message");
 define("EPL_ADLAN_41", "That file does not appear to be a valid .zip or .tar archive.");
 define("EPL_ADLAN_42", "An error has occurred, unable to un-archive the file");
@@ -66,33 +66,23 @@
 define("EPL_DIRECTORY", "directory.");
 define("EPL_NOINSTALL_1", "No install required, to remove delete the ");
 define("EPL_UPGRADE", "Upgrade");
-define("EPL_CONFIGURE", "Configure");
-
-define("EPL_ADLAN_46", "RSS settings successfully created");
-define("EPL_ADLAN_47", "RSS settings successfully deleted");
-define("EPL_ADLAN_48", "Unable to successfully create RSS settings");
-define("EPL_ADLAN_49", "Unable to successfully delete RSS settings");
 
 define("EPL_ADLAN_50", "Comments successfully deleted");
 
-define("EPL_ADLAN_51", "No");
-define("EPL_ADLAN_52", "Yes");
 define("EPL_ADLAN_53", "Directory not writable");
 define("EPL_ADLAN_54", "Please select the option for uninstalling the plugin:");
 define("EPL_ADLAN_55", "Uninstall plugin");
-define("EPL_ADLAN_56", "Yes");
+
 define("EPL_ADLAN_57", "Delete plugin tables");
 define("EPL_ADLAN_58", "If the tables are not removed, the plugin can be reinstalled with no data loss.  The creation of tables during the reinstall will fail. Tables will have to be manually deleted to remove.");
 define("EPL_ADLAN_59", "Delete plugin files");
 define("EPL_ADLAN_60", "e107 will attempt to remove all plugin related files.");
-define("EPL_ADLAN_61", "Confirm uninstall");
+// define("EPL_ADLAN_61", "Confirm uninstall"); // duplicated. can be deleted.
 define("EPL_ADLAN_62", "Cancel uninstall");
 define("EPL_ADLAN_63", "Uninstall:");
-define("EPL_ADLAN_64", "");
-define("EPL_ADLAN_65", "");
-define("EPL_ADLAN_66", "");
-define("EPL_ADLAN_67", "");
-define("EPL_ADLAN_68", "");
-define("EPL_ADLAN_69", "");
+
+define("LAN_UPGRADE_SUCCESSFUL", "Upgrade Successful");
+define("LAN_INSTALL_SUCCESSFUL", "Installation Successful");
+
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_prefs.php 0.7.7/e107_languages/English/admin/lan_prefs.php
--- 0.7.5/e107_languages/English/admin/lan_prefs.php	2006-05-01 19:00:04.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_prefs.php	2006-11-20 06:52:37.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.53 $
-|     $Date: 2006/05/02 00:00:04 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.59 $
+|     $Date: 2006/11/20 12:52:37 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -57,7 +57,7 @@
 define("PRFLAN_41", "if checked swearing will be replaced with string below");
 define("PRFLAN_42", "Replace string");
 define("PRFLAN_43", "Filter words");
-define("PRFLAN_44", "words to censor, seperate with a comma");
+define("PRFLAN_44", "words to censor, separate with a comma");
 define("PRFLAN_45", "Use COPPA on signup page?");
 define("PRFLAN_46", "for more info on COPPA see");
 define("PRFLAN_47", "Security &amp; Protection");
@@ -98,7 +98,7 @@
 define("CUSTSIG_16", "Minimum Length for Passwords");
 define("CUSTSIG_17", "Subscribe to content/mailouts");
 define("CUSTSIG_18", "Disallow usernames");
-define("CUSTSIG_19", "usernames containing the following text will be rejected, seperate entries by commas");
+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_92", "Secure signup verification -- hide password in email?");
@@ -109,13 +109,13 @@
 define("PRFLAN_97", "Unique 'Plugins info' menu:");
 define("PRFLAN_98", "If unchecked, each plugin will display its own info in an individual menu. If checked all info will be displayed in one menu.");
 define("PRFLAN_101", "Text rendering");
-define("PRFLAN_102", "Replace links");
-define("PRFLAN_103", "If ticked, posted links will be replaced by the text entered in the textbox below, will stop very long links breaking layout");
-define("PRFLAN_104", "Link replace text");
-define("PRFLAN_105", "text to replace links with, image can be used by using &lt;img tag, with full path to image");
+define("PRFLAN_102", "Replace clickable URLs");
+define("PRFLAN_103", "If ticked, and 'Make Clickable' (above) is also ticked, posted URLs are displayed as a hyperlink using text from the textbox below. This keeps very long URLs from breaking layout.");
+define("PRFLAN_104", "URL replacement text");
+define("PRFLAN_105", "Replacement visible text for clickable URLs. Image can be used by using &lt;img&gt; tag, with full path to image");
 define("PRFLAN_106", "Core preferences saved to database.");
 define("PRFLAN_107", "Email link replace text");
-define("PRFLAN_108", "text to replace email links with, image can be used by using &lt;img tag, with full path to image");
+define("PRFLAN_108", "text to replace email links with, image can be used by using &lt;img&gt; tag, with full path to image");
 define("PRFLAN_109", "Wrap long words in main text");
 define("PRFLAN_110", "words longer than the length entered will be wrapped onto a new line");
 define("PRFLAN_111", "Wrap long words in menu text");
@@ -132,8 +132,8 @@
 define("PRFLAN_124", "Use 'classic' nextprev look");
 define("PRFLAN_125", "Turning this on will show the nextprev pages as 1 2 3 ... 21 22 23, instead of the new look with the dropdown.");
 define("PRFLAN_126", "Text to display on signup page");
-define("PRFLAN_127", "Make posted links clickable");
-define("PRFLAN_128", "Turning this on will convert posted links to hyperlinks");
+define("PRFLAN_127", "Make URLs clickable");
+define("PRFLAN_128", "Turning this on will convert posted URLs to hyperlinks");
 define("PRFLAN_129", "Disallow multiple logins");
 define("PRFLAN_130", "Activating this will prevent more than one person logging in with the same username/password (login detail sharing)");
 define("PRFLAN_131", "Activate use of [php] bbcode");
@@ -144,7 +144,7 @@
 define("PRFLAN_136", "Maximum Signups permitted from the same IP address.");
 define("PRFLAN_137", "Display Memory Usage");
 define("PRFLAN_138", "Enable Image-code verification during forgotten password.");
-define("PRFLAN_139", "Display warning when main administrator password hasnt changed for at least 30 days");
+define("PRFLAN_139", "Display warning when main administrator password hasn't changed for at least 30 days");
 define("PRFLAN_140", "Text to display after signup form has been submitted.");
 define("PRFLAN_141", "Allow registration using XML User Profiles");
 define("PRFLAN_142", "Flood Only");
@@ -173,8 +173,18 @@
 define("PRFLAN_161", "Disable all comments on the site");
 
 define("PRFLAN_162", "Site Contact Information");
-define("PRFLAN_163", "eg. Company Name, Address, Phone etc.");
+define("PRFLAN_163", "e.g. Company Name, Address, Phone, etc.");
 
 define("PRFLAN_164", "Allow users to email copy of contact email to self");
 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_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");
+
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_review.php 0.7.7/e107_languages/English/admin/lan_review.php
--- 0.7.5/e107_languages/English/admin/lan_review.php	2004-09-21 14:11:55.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_review.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,92 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system - Language File.
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_review.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:55 $
-|     $Author: e107coders $
-+----------------------------------------------------------------------------+
-*/
-define("REVLAN_1", "Review added to database.");
-define("REVLAN_2", "Fields left blank.");
-define("REVLAN_3", "Review updated in database.");
-define("REVLAN_4", "Review deleted.");
-define("REVLAN_5", "Please tick the confirm box to delete this review");
-define("REVLAN_6", "No reviews yet.");
-define("REVLAN_7", "Existing Reviews");
-define("REVLAN_8", "Edit");
-define("REVLAN_9", "Delete");
-define("REVLAN_10", "tick to confirm");
-define("REVLAN_11", "Open HTML Editor");
-define("REVLAN_12", "Heading");
-define("REVLAN_13", "Sub-Heading");
-define("REVLAN_14", "Summary");
-define("REVLAN_15", "Review");
-define("REVLAN_16", "Rating");
-define("REVLAN_17", "Please select rating");
-define("REVLAN_18", "Allow comments?");
-define("REVLAN_19", "On");
-define("REVLAN_20", "Off");
-define("REVLAN_21", "Visible to");
-define("REVLAN_22", "Update Review");
-define("REVLAN_23", "Submit Review");
-define("REVLAN_24", "Reviews");
-
-
-
-
-define("REVLAN_25", "Review Category Saved");
-define("REVLAN_26", "Review Category Updated");
-define("REVLAN_27", "Category deleted");
-define("REVLAN_28", "Category");
-define("REVLAN_29", "Options");
-define("REVLAN_30", "Edit");
-define("REVLAN_31", "Delete");
-define("REVLAN_32", "No review categories");
-define("REVLAN_33", "Existing Review Categories");
-define("REVLAN_34", "Category Name");
-define("REVLAN_35", "Category Icon");
-define("REVLAN_36", "View Images");
-define("REVLAN_37", "Category Summary");
-define("REVLAN_38", "Update Review Category");
-define("REVLAN_39", "Create Review Category");
-define("REVLAN_40", "No reviews");
-define("REVLAN_41", "Existing Reviews");
-define("REVLAN_42", "Open HTML Editor");
-define("REVLAN_43", "Category");
-define("REVLAN_44", "None");
-define("REVLAN_45", "Review Front Page");
-define("REVLAN_46", "Create new Review");
-define("REVLAN_47", "Categories");
-define("REVLAN_48", "Review Options");
-define("REVLAN_49", "Are you sure you want to delete this category?");
-define("REVLAN_50", "Are you sure you want to delete this review?");
-define("REVLAN_51", "Author Details");
-define("REVLAN_52", "leave if review written by you");
-define("REVLAN_53", "author name");
-define("REVLAN_54", "author email address");
-
-define("REVLAN_55", "Allow reviews to be submitted");
-define("REVLAN_56", "Allow visitors to submit reviews to your site");
-define("REVLAN_57", "Submit review class");
-define("REVLAN_58", "Select which users can submit reviews");
-define("REVLAN_59", "Update Options");
-define("REVLAN_60", "Review Options");
-define("REVLAN_61", "Review options updated");
-
-define("REVLAN_62", "Submitted Reviews");
-define("REVLAN_63", "No submitted reviews");
-define("REVLAN_64", "No email address supplied");
-define("REVLAN_65", "Review Heading");
-define("REVLAN_66", "Post");
-define("REVLAN_67", "Post User Submitted Article");
-define("REVLAN_68", "User submitted review saved in database");
-
-define("REVLAN_69", "Clear Form");
-define("REVLAN_70", "Click here to fill author fields");
-define("REVLAN_71", "Add email/print icons?");
-define("REVLAN_72", "Yes");
-define("REVLAN_73", "No");
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_search.php 0.7.7/e107_languages/English/admin/lan_search.php
--- 0.7.5/e107_languages/English/admin/lan_search.php	2006-01-16 09:06:30.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_search.php	2006-10-31 15:16:29.000000000 -0600
@@ -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.23 $
-|     $Date: 2006/01/16 15:06:30 $
-|     $Author: sweetas $
+|     $Revision: 1.25 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("SEALAN_1", "Search Configuration");
@@ -34,7 +34,7 @@
 define("SEALAN_30", "Highlight keywords on referred to page:");
 define("SEALAN_31", "PHP limited to");
 define("SEALAN_32", "results (leave blank for no limit)");
-define("SEALAN_33", "Could not switch to MySql sort method as this requires at least version 4.0.1 of MySql.");
+define("SEALAN_33", "Could not switch to MySQL sort method as this requires at least version 4.0.1 of MySQL.");
 define("SEALAN_34", "Your version is currently");
 define("SEALAN_35", "Searchable areas selection method:");
 define("SEALAN_36", "Dropdown");
@@ -57,7 +57,7 @@
 
 define("SEALAN_47", "Only match whole words:");
 define("SEALAN_48", "This setting only applies when the search sort method is PHP. If your site includes Ideographic languages such as Chinese and Japanese you must have this set to off.");
-define("SEALAN_49", "If your site includes Ideographic languages such as Chinese and Japanese you must use the PHP sort method.");
+define("SEALAN_49", "If your site includes Ideographic languages, such as Chinese and Japanese, you must use the PHP sort method.");
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/admin/lan_theme.php 0.7.7/e107_languages/English/admin/lan_theme.php
--- 0.7.5/e107_languages/English/admin/lan_theme.php	2005-03-15 06:09:30.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_theme.php	2006-08-26 21:24:44.000000000 -0500
@@ -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.7 $
-|     $Date: 2005/03/15 12:09:30 $
-|     $Author: stevedunstan $
+|     $Revision: 1.9 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 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>");
@@ -24,7 +24,7 @@
 
 define("TPVLAN_13", "Upload theme (.zip or .tar.gz format)");
 define("TPVLAN_14", "Upload Theme");
-define("TPVLAN_15", "The file could not be uploaded as the ".e_THEME." folder does not have the correct permissions - please CHMOD to 777 and reupload the file.");
+define("TPVLAN_15", "The file could not be uploaded as the ".e_THEME." folder does not have the correct permissions - please CHMOD to 777 and re-upload the file.");
 define("TPVLAN_16", "Admin Message");
 define("TPVLAN_17", "That file does not appear to be a valid .zip or .tar archive.");
 define("TPVLAN_18", "An error has occurred, unable to un-archive the file");
@@ -33,7 +33,7 @@
 
 define("TPVLAN_21", "This is the currently selected site theme");
 
-define("TPVLAN_22", "this theme has multiple stylesheets");
+define("TPVLAN_22", "This theme has multiple stylesheets");
 define("TPVLAN_23", "default stylesheet");
 define("TPVLAN_24", "no information");
 define("TPVLAN_25", "To choose which stylesheet to use, please go to <a href='".e_ADMIN."prefs.php'>preferences</a> and click on 'Theme'.");
diff -ruN 0.7.5/e107_languages/English/admin/lan_updateadmin.php 0.7.7/e107_languages/English/admin/lan_updateadmin.php
--- 0.7.5/e107_languages/English/admin/lan_updateadmin.php	2004-09-21 14:11:55.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_updateadmin.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,18 +4,18 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_updateadmin.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:55 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("UDALAN_1", "Error - please re-submit");
 define("UDALAN_2", "Settings updated");
-define("UDALAN_3", "Settings Updated for");
+define("UDALAN_3", "Settings updated for");
 define("UDALAN_4", "Name");
 define("UDALAN_5", "Password");
-define("UDALAN_6", "Re-type Password");
-define("UDALAN_7", "Change Password");
-define("UDALAN_8", "Password Update for");
+define("UDALAN_6", "Re-type password");
+define("UDALAN_7", "Change password");
+define("UDALAN_8", "Password updated for");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_upload.php 0.7.7/e107_languages/English/admin/lan_upload.php
--- 0.7.5/e107_languages/English/admin/lan_upload.php	2005-12-21 11:03:51.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_upload.php	2006-08-26 21:24:44.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.4 $
-|     $Date: 2005/12/21 17:03:51 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("UPLLAN_1", "Upload removed from list.");
@@ -64,8 +64,7 @@
 
 define("UPLLAN_48", "For security reasons allowed file types has been moved out of the database into a 
 flatfile located in your admin directory. To use, rename the file e107_admin/filetypes_.php to e107_admin/filetypes.php 
-and add a comma delimited list of file type extensions to it. You should not allow the upload of .html, .txt, etc 
-as an attacker may upload a file of this type which includes malicious javascript. You should also, of course, not allow 
+and add a comma delimited list of file type extensions to it. You should not allow the upload of .html, .txt, etc., as an attacker may upload a file of this type which includes malicious javascript. You should also, of course, not allow 
 the upload of .php files or any other type of executable script.");
 
 
diff -ruN 0.7.5/e107_languages/English/admin/lan_userinfo.php 0.7.7/e107_languages/English/admin/lan_userinfo.php
--- 0.7.5/e107_languages/English/admin/lan_userinfo.php	2005-04-02 15:08:06.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_userinfo.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_userinfo.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/04/02 21:08:06 $
-|     $Author: e107coders $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("USFLAN_1", "Unable to find poster's IP address - no information is available.");
@@ -14,7 +14,7 @@
 define("USFLAN_3", "Messages posted from IP address");
 define("USFLAN_4", "Host");
 define("USFLAN_5", "Click here to transfer IP address to admin ban page");
-define("USFLAN_6", "UserID");
+define("USFLAN_6", "User ID");
 define("USFLAN_7", "User Information");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/admin/lan_users.php 0.7.7/e107_languages/English/admin/lan_users.php
--- 0.7.5/e107_languages/English/admin/lan_users.php	2006-05-12 17:50:40.000000000 -0500
+++ 0.7.7/e107_languages/English/admin/lan_users.php	2006-10-31 15:16:29.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_users.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2006/05/12 22:50:40 $
+|     $Revision: 1.27 $
+|     $Date: 2006/10/31 21:16:29 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -38,7 +38,7 @@
 // define("USRLAN_28", "Sort");
 
 define("USRLAN_30", "Ban");
-// define("USRLAN_31", "Ban -unactivated-");
+// define("USRLAN_31", "Ban -inactivated-");
 define("USRLAN_32", "Activate");
 define("USRLAN_33", "Unban");
 define("USRLAN_34", "Remove admin status");
@@ -59,7 +59,7 @@
 define("USRLAN_51", "Update Options");
 define("USRLAN_52", "Member Options");
 define("USRLAN_53", "Allow members to upload a photograph?");
-define("USRLAN_54", "Click here to delete all un-activated users");
+define("USRLAN_54", "Click here to delete all inactivated users");
 define("USRLAN_55", "Prune");
 define("USRLAN_56", "Deleted");
 define("USRLAN_57", "Deleting un-activated members ...");
@@ -129,8 +129,8 @@
 define("USRLAN_133", "Force user to update settings");
 define("USRLAN_134", "Enabling this option will automatically send the user to their user-settings if a required user field is not filled.");
 
-define("USRLAN_135", "No IP address found in user's info, IP not banned");
-define("USRLAN_136", "Multiple users found with IP address of {IP}, IP not banned.");
+define("USRLAN_135", "No IP address found in user's info; IP not banned");
+define("USRLAN_136", "Multiple users found with IP address of {IP}; IP not banned.");
 define("USRLAN_137", "Users IP address of {IP} banned.");
 
 define("LAN_MAINADMIN","Main Admin");
@@ -186,5 +186,7 @@
 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 -ruN 0.7.5/e107_languages/English/admin/lan_users_extended.php 0.7.7/e107_languages/English/admin/lan_users_extended.php
--- 0.7.5/e107_languages/English/admin/lan_users_extended.php	2006-01-14 19:08:04.000000000 -0600
+++ 0.7.7/e107_languages/English/admin/lan_users_extended.php	2006-11-07 17:46:20.000000000 -0600
@@ -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.14 $
-|     $Date: 2006/01/15 01:08:04 $
-|     $Author: streaky $
+|     $Revision: 1.17 $
+|     $Date: 2006/11/07 23:46:20 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("EXTLAN_1", "Name");
@@ -80,9 +80,17 @@
 define("EXTLAN_66", "Yes - Will show on signup page");
 define("EXTLAN_67", "No - Show on signup page");
 
+define("EXTLAN_68", "Field:");
+define("EXTLAN_69", "has been activated");
+define("EXTLAN_70", "ERROR!! Field:");
+define("EXTLAN_71", "was not activated!");
+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.");
+
 
 //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 valiation code<br />regexfail - validation fail text");
+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");
 //dropdown
diff -ruN 0.7.5/e107_languages/English/lan_banner.php 0.7.7/e107_languages/English/lan_banner.php
--- 0.7.5/e107_languages/English/lan_banner.php	2005-01-14 06:57:27.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_banner.php	2006-06-02 08:59:40.000000000 -0500
@@ -4,35 +4,35 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_banner.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/01/14 12:57:27 $
+|     $Revision: 1.3 $
+|     $Date: 2006/06/02 13:59:40 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Banner");
 
-define("LAN_16", "Username: ");
-define("LAN_17", "Password: ");
-define("LAN_18", "Continue");
-define("LAN_19", "Please enter your client login and password to continue");
-define("LAN_20", "Sorry, unable to find those details in the database. Please contact the site administrator for details.");
-define("LAN_21", "Banners Statistics");
-define("LAN_22", "Client");
-define("LAN_23", "Banner ID");
-define("LAN_24", "Clickthroughs");
-define("LAN_25", "Click %");
-define("LAN_26", "Impressions");
-define("LAN_27", "Impressions Purchased");
-define("LAN_28", "Impressions Left");
-define("LAN_29", "No banners");
-define("LAN_30", "Unlimited");
-define("LAN_31", "Not applicable");
-define("LAN_32", "Yes");
-define("LAN_33", "No");
-define("LAN_34", "Ends:");
-define("LAN_35", "Clickthrough IP addresses");
-define("LAN_36", "Active:");
-define("LAN_37", "Starts:");
-define("LAN_38", "Error");
+define("BANNERLAN_16", "Username: ");
+define("BANNERLAN_17", "Password: ");
+define("BANNERLAN_18", "Continue");
+define("BANNERLAN_19", "Please enter your client login and password to continue");
+define("BANNERLAN_20", "Sorry, unable to find those details in the database. Please contact the site administrator for details.");
+define("BANNERLAN_21", "Banners Statistics");
+define("BANNERLAN_22", "Client");
+define("BANNERLAN_23", "Banner ID");
+define("BANNERLAN_24", "Clickthroughs");
+define("BANNERLAN_25", "Click %");
+define("BANNERLAN_26", "Impressions");
+define("BANNERLAN_27", "Impressions Purchased");
+define("BANNERLAN_28", "Impressions Left");
+define("BANNERLAN_29", "No banners");
+define("BANNERLAN_30", "Unlimited");
+define("BANNERLAN_31", "Not applicable");
+define("BANNERLAN_32", "Yes");
+define("BANNERLAN_33", "No");
+define("BANNERLAN_34", "Ends:");
+define("BANNERLAN_35", "Clickthrough IP addresses");
+define("BANNERLAN_36", "Active:");
+define("BANNERLAN_37", "Starts:");
+define("BANNERLAN_38", "Error");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_comment.php 0.7.7/e107_languages/English/lan_comment.php
--- 0.7.5/e107_languages/English/lan_comment.php	2005-06-30 09:18:21.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_comment.php	2006-07-18 15:57:22.000000000 -0500
@@ -4,41 +4,46 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_comment.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/06/30 14:18:21 $
-|     $Author: lisa_ $
+|     $Revision: 1.10 $
+|     $Date: 2006/07/18 20:57:22 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
-define("PAGE_NAME", "Comments");
-
-define("LAN_0", "[blocked by admin]");
-define("LAN_1", "Unblock");
-define("LAN_2", "Block");
-define("LAN_3", "Delete");
-define("LAN_4", "Info");
-define("LAN_5", "Comments ...");
-define("LAN_6", "You must be logged in to post comments on this site - please either log in or if you are not registered click");
-define("LAN_7", "Main site administrator");
-define("LAN_8", "Comment");
-define("LAN_9", "Submit comment");
-define("LAN_10", "Administrator");
-define("LAN_11", "Was unable to enter your comment into the database - please retype leaving out any non-standard characters.");
-define("LAN_16", "Username: ");
-define("LAN_99", "Comments");
-define("LAN_100", "News");
-define("LAN_101", "Poll");
-define("LAN_102", "Replying to: ");
-define("LAN_103", "Article");
-define("LAN_104", "Review");
-define("LAN_105", "Content");
-define("LAN_145", "Registered: ");
-define("LAN_194", "Guest");
-define("LAN_195", "Registered member");
-define("LAN_310", "Unable to accept post as that username is registered - if it is your username please login to post.");
-define("LAN_312", "Duplicate post - unable to accept.");
-define("LAN_313", "Location");
-define("LAN_314", "moderate comments");
+define("COMLAN_0", "[blocked by admin]");
+define("COMLAN_1", "Unblock");
+define("COMLAN_2", "Block");
+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_7", "Main site administrator");
+define("COMLAN_8", "Comment");
+define("COMLAN_9", "Submit comment");
+define("COMLAN_10", "Administrator");
+define("COMLAN_11", "Was unable to enter your comment into the database - please retype leaving out any non-standard characters.");
+define("COMLAN_16", "Username: ");
+define("COMLAN_99", "Comments");
+define("COMLAN_100", "News");
+define("COMLAN_101", "Poll");
+define("COMLAN_102", "Replying to: ");
+define("COMLAN_103", "Article");
+define("COMLAN_104", "Review");
+define("COMLAN_105", "Content");
+define("COMLAN_145", "Registered: ");
+define("COMLAN_194", "Guest");
+define("COMLAN_195", "Registered member");
+define("COMLAN_310", "Unable to accept post as that username is registered - if it is your username please login to post.");
+define("COMLAN_312", "Duplicate post - unable to accept.");
+define("COMLAN_313", "Location");
+define("COMLAN_314", "moderate comments");
+define("COMLAN_315", "Trackbacks");
+define("COMLAN_316", "No trackbacks for this newspost.");
+define("COMLAN_317", "Moderate trackbacks");
+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!");
@@ -47,13 +52,26 @@
 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!");
+define("COMLAN_324", 'Subject');
+define("COMLAN_325", 'Re:');
+define("COMLAN_326", 'Reply to this');
+define("COMLAN_327", 'Rating');
+define("COMLAN_328", 'Comments are locked');
+define("COMLAN_329", 'Unauthorized');
+define("COMLAN_330", 'IP:');
 
-define("LAN_315", "Trackbacks");
-define("LAN_316", "No trackbacks for this newspost.");
-define("LAN_317", "Moderate trackbacks");
-
-define("LAN_318", "Edit comment");
-define("LAN_319", "edited");
-define("LAN_320", "Update comment");
+define("COMLAN_TYPE_1", "news");
+define("COMLAN_TYPE_2", "download");
+define("COMLAN_TYPE_3", "faq");
+define("COMLAN_TYPE_4", "poll");
+define("COMLAN_TYPE_5", "docs");
+define("COMLAN_TYPE_6", "bugtrack");
+define("COMLAN_TYPE_7", "ideas");
+define("COMLAN_TYPE_8", "userprofile");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_contact.php 0.7.7/e107_languages/English/lan_contact.php
--- 0.7.5/e107_languages/English/lan_contact.php	2006-04-25 13:01:18.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_contact.php	2006-08-11 11:50:41.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_contact.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/04/25 18:01:18 $
+|     $Revision: 1.4 $
+|     $Date: 2006/08/11 16:50:41 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -22,8 +22,11 @@
 define("LANCONTACT_10", "There was a problem sending your message.");
 define("LANCONTACT_11", "Your email address doesn't appear to be valid.\\nPlease check it and try again.");
 define("LANCONTACT_12", "Your message is too short.");
-define("LANCONTACT_13", "Please include a subject."); 
+define("LANCONTACT_13", "Please include a subject.");
 
+define("LANCONTACT_14", "Send message to:");
+define("LANCONTACT_15", "Incorrect code entered");
+define("LANCONTACT_16", "Enter Code");
 
 
 
diff -ruN 0.7.5/e107_languages/English/lan_download.php 0.7.7/e107_languages/English/lan_download.php
--- 0.7.5/e107_languages/English/lan_download.php	2006-01-15 20:37:30.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_download.php	2006-09-20 09:04:31.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_download.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/01/16 02:37:30 $
+|     $Revision: 1.15 $
+|     $Date: 2006/09/20 14:04:31 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -62,7 +62,7 @@
 define("LAN_dl_46", "click here to download");
 
 define("LAN_dl_47", "Post has been reported");
-define("LAN_dl_48", "Download has been reported to administrator.<br />Thank You.");
+define("LAN_dl_48", "Download has been reported to administrator.<br />Thank you.");
 define("LAN_dl_49", "Click here to return to download");
 define("LAN_dl_50", "Report broken download to an administrator");
 define("LAN_dl_51", "Reporting download: ");
@@ -70,17 +70,17 @@
 define("LAN_dl_53", "Click to view download");
 define("LAN_dl_54", "An administrator will be made aware of this download, please leave a message if you feel it necessary.");
 define("LAN_dl_55", "<b>Do not</b> use this form to contact the admin for any other reason.");
-define("LAN_dl_56", "Report broken download");
+// define("LAN_dl_56", "Report broken download");  already defined above.
 define("LAN_dl_57", "reported by");
 define("LAN_dl_58", "The following download has been reported as broken from site");
 define("LAN_dl_59", "Reported by: ");
 define("LAN_dl_60", "Broken download report from");
 
 define("LAN_dl_61", "Download Error");
-define("LAN_dl_62", "You have been prevented from downloading this file, you have exceeded your download quota");
+define("LAN_dl_62", "You have been prevented from downloading this file; you have exceeded your download quota");
 define("LAN_dl_63", "You do not have the correct permissions to download this file.");
 define("LAN_dl_64", "Back");
-define("LAN_dl_65", "Not Found");
+define("LAN_dl_65", "File Not Found");
 
 define("LAN_dl_66", "Select download mirror");
 
@@ -97,4 +97,4 @@
 define("LAN_dl_75", "no image available ");
 define("LAN_dl_76", "Go to page");
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_languages/English/lan_email.php 0.7.7/e107_languages/English/lan_email.php
--- 0.7.5/e107_languages/English/lan_email.php	2006-02-17 17:49:04.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_email.php	2006-10-21 06:20:27.000000000 -0500
@@ -4,36 +4,34 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_email.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/02/17 23:49:04 $
-|     $Author: lisa_ $
+|     $Revision: 1.6 $
+|     $Date: 2006/10/21 11:20:27 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
-define("PAGE_NAME", "Email");
-
-define("LAN_5", "Email article to a friend");
-define("LAN_6", "Email news_item to a friend");
-define("LAN_7", "Login Name: ");
-define("LAN_8", "Comment");
-define("LAN_9", "Sorry - unable to send email");
-define("LAN_10", "Mail sent to");
-define("LAN_11", "Email sent");
-define("LAN_12", "Error");
-define("LAN_106", "That doesn't appear to be a valid email address");
-define("LAN_185", "Send Article");
-define("LAN_186", "Send News Item");
-define("LAN_187", "Email address to send to");
-define("LAN_188", "I thought you might be interested in this news story from");
-define("LAN_189", "I thought you might be interested in this article from");
-
-define("LAN_email_1", "From:");
-define("LAN_email_2", "IP address of sender:");
-define("LAN_email_3", "Emailed item from ");
-define("LAN_email_4", "Send Email");
-define("LAN_email_5", "Email item to a friend");
-define("LAN_email_6", "I thought you might be interested in this item from");
-define("LAN_email_7", "email to someone");
-
+if (!defined("PAGE_NAME")) { define("PAGE_NAME", "Email"); }
 
+define("LAN_EMAIL_1", "From:");
+define("LAN_EMAIL_2", "IP address of sender:");
+define("LAN_EMAIL_3", "Emailed item from ");
+define("LAN_EMAIL_4", "Send Email");
+define("LAN_EMAIL_5", "Email item to a friend");
+define("LAN_EMAIL_6", "I thought you might be interested in this item from");
+define("LAN_EMAIL_7", "email to someone");
+define("LAN_EMAIL_8", "Comment");
+define("LAN_EMAIL_9", "Sorry - unable to send email");
+define("LAN_EMAIL_10", "Mail sent to");
+define("LAN_EMAIL_11", "Email sent");
+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_106", "That doesn't appear to be a valid email address");
+define("LAN_EMAIL_185", "Send Article");
+define("LAN_EMAIL_186", "Send News Item");
+define("LAN_EMAIL_187", "Email address to send to");
+define("LAN_EMAIL_188", "I thought you might be interested in this news story from");
+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 -ruN 0.7.5/e107_languages/English/lan_equery_secure.php 0.7.7/e107_languages/English/lan_equery_secure.php
--- 0.7.5/e107_languages/English/lan_equery_secure.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_equery_secure.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,14 +4,14 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_equery_secure.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
-|     $Author: e107coders $
+|     $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 referer");
+define("EQSEC_LAN3", "No referrer");
 define("EQSEC_LAN4", "Action from:");
 define("EQSEC_LAN5", "Action to:");
 define("EQSEC_LAN6", "Confirm action");
diff -ruN 0.7.5/e107_languages/English/lan_error.php 0.7.7/e107_languages/English/lan_error.php
--- 0.7.5/e107_languages/English/lan_error.php	2005-06-28 07:10:30.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_error.php	2006-10-31 15:16:29.000000000 -0600
@@ -4,36 +4,46 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_error.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/06/28 12:10:30 $
-|     $Author: streaky $
+|     $Revision: 1.7 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Error");
 
-define("LAN_1", "Error 401 - Permission Denied");
-define("LAN_2", "You do not have permission to retrieve the URL or link you requested.");
-define("LAN_3", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
-define("LAN_4", "Error 403 - Authentication Failed");
-define("LAN_5", "The URL you've requested requires a correct username and password. Either you entered an incorrect username/password, or your browser doesn't support this feature.");
-define("LAN_6", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
-define("LAN_7", "Error 404 - Document Not Found");
-define("LAN_9", "Please inform the administrator of the referring page if you think this error message has been shown by mistake.");
-define("LAN_10", "Error 500 - Malformed Header");
-define("LAN_11", "The server encountered an internal error or misconfiguration and was unable to complete your request");
-define("LAN_12", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
-define("LAN_13", "Error - Unknown");
-define("LAN_14", "The server encountered an error");
-define("LAN_15", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
-define("LAN_16", "Your unsuccessful attempt to access");
-define("LAN_17", "has been recorded.");
-define("LAN_18", "Apparently, you were referred here by");
-define("LAN_19", "Unfortunately, there's an obsolete link at that address.");
-define("LAN_20", "Please click here to go to this site's home page");
+define("LAN_ERROR_1", "Error 401 - Permission Denied");
+define("LAN_ERROR_2", "You do not have permission to retrieve the URL or link you requested.");
+define("LAN_ERROR_3", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
+define("LAN_ERROR_4", "Error 403 - Authentication Failed");
+define("LAN_ERROR_5", "The URL you've requested requires a correct username and password. Either you entered an incorrect username/password, or your browser doesn't support this feature.");
+define("LAN_ERROR_6", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
+define("LAN_ERROR_7", "Error 404 - Document Not Found");
+define("LAN_ERROR_9", "Please inform the administrator of the referring page if you think this error message has been shown by mistake.");
+define("LAN_ERROR_10", "Error 500 - Malformed Header");
+define("LAN_ERROR_11", "The server encountered an internal error or misconfiguration and was unable to complete your request");
+define("LAN_ERROR_12", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
+define("LAN_ERROR_13", "Error - Unknown");
+define("LAN_ERROR_14", "The server encountered an error");
+define("LAN_ERROR_15", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
+define("LAN_ERROR_16", "Your unsuccessful attempt to access");
+define("LAN_ERROR_17", "has been recorded.");
+define("LAN_ERROR_18", "Apparently, you were referred here by");
+define("LAN_ERROR_19", "Unfortunately, there's an obsolete link at that address.");
+define("LAN_ERROR_20", "Please click here to go to this site's home page");
+define("LAN_ERROR_21", "The requested URL could not be found on this server. The link you followed is probably outdated.");
+define("LAN_ERROR_22", "Please click here to go to this site's search page");
+define("LAN_ERROR_23", "Your attempt to access ");
+define("LAN_ERROR_24", " was unsuccessful.");
 
-define("LAN_ERROR_01", "The requested URL could not be found on this server. The link you followed is probably outdated.");
-define("LAN_ERROR_02", "Please click here to go to this site's search page");
-define("LAN_ERROR_03", "Your attempt to access ");
-define("LAN_ERROR_04", " was unsuccessful.");
+// 0.7.6
+define("LAN_ERROR_25", "[1]: Unable to read core settings from database - Core settings exist but cannot be unserialized. Attempting to restore core backup ...");
+define("LAN_ERROR_26", "[2]: Unable to read core settings from database - non-existent core settings.");
+define("LAN_ERROR_27", "[3]: Core settings saved - backup made active.");
+define("LAN_ERROR_28", "[4]: No core backup found. Please run the <a href='".e_FILE."resetcore/resetcore.php'>Reset_Core</a> utility to rebuild your core settings. <br />After rebuilding your core please save a backup from the admin/sql screen.");
+define("LAN_ERROR_29", "[5]: Field(s) have been left blank. Please resubmit the form and fill in the required fields.");
+define("LAN_ERROR_30", "[6]: Unable to form a valid connection to mySQL. Please check that your e107_config.php contains the correct information.");
+define("LAN_ERROR_31", "[7]: mySQL is running but database ({$mySQLdefaultdb}) couldn't be connected to.<br />Please check it exists and that your e107_config.php contains the correct information.");
+define("LAN_ERROR_32", "To complete the upgrade, copy the following text into your e107_config.php file:");
 
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_languages/English/lan_fpw.php 0.7.7/e107_languages/English/lan_fpw.php
--- 0.7.5/e107_languages/English/lan_fpw.php	2006-03-26 23:01:53.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_fpw.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_fpw.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/03/27 05:01:53 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Password Reset");
@@ -15,7 +15,7 @@
 define("LAN_03", "Password Reset");
 define("LAN_05", "To reset your password please enter the following information");
 define("LAN_06", "Attempted password reset");
-define("LAN_07", "Someone with ip address ");
+define("LAN_07", "Someone with IP address ");
 define("LAN_08", "attempted to reset the main admin password.");
 define("LAN_09", "Password reset from ");
 define("LAN_112", "Email address used when signing up");
diff -ruN 0.7.5/e107_languages/English/lan_installer.php 0.7.7/e107_languages/English/lan_installer.php
--- 0.7.5/e107_languages/English/lan_installer.php	2006-02-09 09:05:51.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_installer.php	2006-11-09 16:52:52.000000000 -0600
@@ -85,9 +85,9 @@
 
 [b]Downloads[/b]
 Plugins: [link=http://e107coders.org]http://e107coders.org[/link]
-Themes: [link=http://e107styles.org]http://e107styles.org[/link] | [link=http://e107themes.org]http://e107themes.org[/link]
+Themes: [link=http://e107themes.org]http://e107themes.org[/link]
 
-Thankyou for trying e107, we hope it fulfills your website needs.
+Thank you for trying e107, we hope it fulfils your website needs.
 (You can delete this message from your admin section.)");
 
 define("LANINS_063", "Welcome to e107");
@@ -96,7 +96,7 @@
 
 For security reasons you should now set the file permissions on the <b>e107_config.php</b> file back to 644.
 
-Also please delete install.php and the e107_install directory from your server after you have clicked the button below
+Also please delete install.php from your server after you have clicked the button below.
 ");
 define("LANINS_070", "e107 was unable to save the main config file to your server.
 
@@ -121,4 +121,4 @@
 define("LANINS_084", "The installer could not establish a connection to the database");
 define("LANINS_085", "The installer could not select database:");
 
-?>
\ No newline at end of file
+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.");
diff -ruN 0.7.5/e107_languages/English/lan_links.php 0.7.7/e107_languages/English/lan_links.php
--- 0.7.5/e107_languages/English/lan_links.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_links.php	2006-07-04 11:33:32.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_links.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
+|     $Revision: 1.2 $
+|     $Date: 2006/07/04 16:33:32 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -34,7 +34,7 @@
 define("LAN_97", "URL to link button:");
 define("LAN_98", "Submit Link");
 
-define("LAN_99", "Thankyou");
+define("LAN_99", "Thank you");
 define("LAN_100", "Your link has been saved and will be reviewed by a site administrator.");
 define("LAN_101", "Please click here to submit a link");
 
diff -ruN 0.7.5/e107_languages/English/lan_mail_handler.php 0.7.7/e107_languages/English/lan_mail_handler.php
--- 0.7.5/e107_languages/English/lan_mail_handler.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_mail_handler.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,12 +4,12 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_mail_handler.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
-define("LANMAILH_1", "Produced By e107 website system");
+define("LANMAILH_1", "Produced by e107 website system");
 define("LANMAILH_2", "This is a multi-part message in MIME format.");
 define("LANMAILH_3", " is not properly formatted");
 define("LANMAILH_4", "Server rejected address");
diff -ruN 0.7.5/e107_languages/English/lan_news.php 0.7.7/e107_languages/English/lan_news.php
--- 0.7.5/e107_languages/English/lan_news.php	2006-04-17 20:33:36.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_news.php	2006-11-20 01:58:27.000000000 -0600
@@ -4,28 +4,21 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_news.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/04/18 01:33:36 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/20 07:58:27 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "News");
 
-define("LAN_82", "News - Category");
-define("LAN_83", "No news items at the moment - please check back soon.");
-define("LAN_84", "News Items");
-define("LAN_99", "Comments");
-define("LAN_100", "On");
-define("LAN_307", "Total posts in this category: ");
 
 define("LAN_NEWS_1", "News for specific members only");
 define("LAN_NEWS_2", "You are not allowed to see this news");
 //define("LAN_NEWS_3", "Please delete install.php from your server");
 //define("LAN_NEWS_4", "if you do not there is a potential security risk to your website");
-
-define("LAN_NEWS_5", "<b>Error!</b> Was unable to update news item into database!</b>");
+define("LAN_NEWS_5", "Error! Was unable to update news item into database!");
 define("LAN_NEWS_6", "News entered into database.");
-define("LAN_NEWS_7", "<b>Error!</b> Was unable to enter news item into database!</b>");
+define("LAN_NEWS_7", "Error! Was unable to enter news item into database!");
 define("LAN_NEWS_8", "News entered into database for all languages. ID: ");
 define("LAN_NEWS_9", "Title only is set - <b>only the news title will be shown</b><br />");
 define("LAN_NEWS_10", "This news post is <b>inactive</b> (It will be not shown on front page). ");
@@ -43,6 +36,13 @@
 // define("LAN_NEWS_22", "Go to page: ");
 define("LAN_NEWS_23", "News Categories");
 define("LAN_NEWS_24", "create pdf of this news item");
-define("LAN_462", "No news items for specified month");
+
+define("LAN_NEWS_82", "News - Category");
+define("LAN_NEWS_83", "No news items at the moment - please check back soon.");
+define("LAN_NEWS_84", "News Items");
+define("LAN_NEWS_99", "Comments");
+define("LAN_NEWS_100", "On");
+define("LAN_NEWS_307", "Total posts in this category: ");
+define("LAN_NEWS_462", "No news items for specified month");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_page.php 0.7.7/e107_languages/English/lan_page.php
--- 0.7.5/e107_languages/English/lan_page.php	2006-02-28 17:02:59.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_page.php	2006-11-06 18:15:58.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_page.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/02/28 23:02:59 $
-|     $Author: whoisrich $
+|     $Revision: 1.4 $
+|     $Date: 2006/11/07 00:15:58 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -14,12 +14,14 @@
 define("LAN_PAGE_2", "There are no pages");
 define("LAN_PAGE_3", "Requested page does not exist");
 define("LAN_PAGE_4", "Rate this page");
-define("LAN_PAGE_5", "Thankyou for rating this page");
+define("LAN_PAGE_5", "Thank you for rating this page");
 define("LAN_PAGE_6", "You do not have permission to view this page");
 define("LAN_PAGE_7", "Incorrect password");
 define("LAN_PAGE_8", "Password Protected Page");
 define("LAN_PAGE_9", "Password");
 define("LAN_PAGE_10", "Submit");
 define("LAN_PAGE_11", "Page List");
+define("LAN_PAGE_12", "Invalid page");
+define("LAN_PAGE_13", "Page");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_parser_functions.php 0.7.7/e107_languages/English/lan_parser_functions.php
--- 0.7.5/e107_languages/English/lan_parser_functions.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_parser_functions.php	2006-10-25 11:39:41.000000000 -0500
@@ -4,11 +4,13 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_parser_functions.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
+|     $Revision: 1.2 $
+|     $Date: 2006/10/25 16:39:41 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("LAN_GUEST", "Guest");
+define("LAN_WROTE", "wrote"); // as in John wrote.."  ";
 
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_languages/English/lan_print.php 0.7.7/e107_languages/English/lan_print.php
--- 0.7.5/e107_languages/English/lan_print.php	2006-02-17 17:49:04.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_print.php	2006-10-21 06:20:27.000000000 -0500
@@ -4,22 +4,22 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_print.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/02/17 23:49:04 $
-|     $Author: lisa_ $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/21 11:20:27 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
-define("PAGE_NAME", "Printer Friendly");
+if (!defined("PAGE_NAME")) { define("PAGE_NAME", "Printer Friendly"); }
 
-define("LAN_86", "Category:");
-define("LAN_87", "by ");
-define("LAN_94", "Posted by");
-define("LAN_135", "News Item: ");
-define("LAN_303", "This news item is from ");
-define("LAN_304", "Title: ");
-define("LAN_305", "Subheading: ");
-define("LAN_306", "This is from: ");
-define("LAN_307", "Print this page");
+define("LAN_PRINT_86", "Category:");
+define("LAN_PRINT_87", "by ");
+define("LAN_PRINT_94", "Posted by");
+define("LAN_PRINT_135", "News Item: ");
+define("LAN_PRINT_303", "This news item is from ");
+define("LAN_PRINT_304", "Title: ");
+define("LAN_PRINT_305", "Subheading: ");
+define("LAN_PRINT_306", "This is from: ");
+define("LAN_PRINT_307", "Print this page");
 
 define("LAN_PRINT_1", "printer friendly");
 
diff -ruN 0.7.5/e107_languages/English/lan_ren_help.php 0.7.7/e107_languages/English/lan_ren_help.php
--- 0.7.5/e107_languages/English/lan_ren_help.php	2006-04-13 18:43:16.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_ren_help.php	2006-08-26 21:24:44.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_ren_help.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/04/13 23:43:16 $
-|     $Author: sweetas $
+|     $Revision: 1.13 $
+|     $Date: 2006/08/27 02:24:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("LANHELP_1", "Black");
@@ -58,5 +58,9 @@
 define("LANHELP_41", "Font Size...");
 define("LANHELP_42", "Select Image...");
 define("LANHELP_43", "Select Download File...");
+define("LANHELP_44", "Click to open/close emoticon dialog ...");
+define("LANHELP_45", "Insert image from directory: ");
+define("LANHELP_46", "* No files found in: ");
 
+define("LANHELP_47", "Insert flash: [flash=width,height]http://www.example.com/file.swf[/flash]");
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_request.php 0.7.7/e107_languages/English/lan_request.php
--- 0.7.5/e107_languages/English/lan_request.php	2005-06-09 10:38:12.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_request.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_request.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/06/09 15:38:12 $
-|     $Author: e107coders $
-+----------------------------------------------------------------------------+
-*/
-
-define("LAN_dl_61", "Download Error");
-define("LAN_dl_62", "You have been prevented from downloading this file, you have exceeded your download quota");
-define("LAN_dl_63", "You do not have the correct permissions to download this file.");
-define("LAN_dl_64", "Back");
-define("LAN_dl_65", "File Not Found");
-
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_signup.php 0.7.7/e107_languages/English/lan_signup.php
--- 0.7.5/e107_languages/English/lan_signup.php	2006-01-05 10:21:07.000000000 -0600
+++ 0.7.7/e107_languages/English/lan_signup.php	2006-11-16 13:50:45.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_signup.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/01/05 16:21:07 $
-|     $Author: e107coders $
+|     $Revision: 1.23 $
+|     $Date: 2006/11/16 19:50:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Register");
@@ -15,11 +15,11 @@
 define("LAN_9", "Login Name: ");
 define("LAN_10", "the name that you use to login");
 define("LAN_17", "Password: ");
-define("LAN_103", "That user name cannot be accepted as valid, please choose a different user name");
+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_105", "The two passwords do not match");
 define("LAN_106", "That doesn't appear to be a valid email address");
-define("LAN_107", "Thankyou! You are now a registered member of");
+define("LAN_107", "Thank you! You are now a registered member of");
 define("LAN_108", "Registration complete");
 define("LAN_109", "This site complies with The Children's Online Privacy Protection Act of 1998 (COPPA) and as such cannot accept registrations from users under the age of 13 without a written permission document from their parent or guardian. For more information you can read the legislation");
 define("LAN_110", "Registration");
@@ -31,16 +31,16 @@
 define("LAN_185", "You left required field(s) blank");
 define("LAN_201", "Yes");
 define("LAN_200", "No");
-define("LAN_202", "You already have an account. If you have forgotten your password, please click the \'forgot password\' link.");
+define("LAN_202", "You already have an account. If you have forgotten your password, please click the 'forgot password' link.");
 define("LAN_309", "Please enter your details below.");
 define("LAN_399", "Continue");
-define("LAN_400", "Usernames and passwords are <b>case-sensitive</b>");
+define("LAN_400", "Usernames and passwords are <b>case-sensitive</b>.");
 define("LAN_401", "Your account has now been activated, please");
 define("LAN_402", "Registration activated");
 define("LAN_403", "Welcome to");
 define("LAN_404", "Registration details for");
-define("LAN_405", "This stage of registation is complete. You will receive a confirmation email containing your login details. Please follow the link in the email to complete the signup process and activate your account.");
-define("LAN_406", "Thankyou!");
+define("LAN_405", "This stage of registration is complete. You will receive a confirmation email containing your login details. Please follow the link in the email to complete the signup process and activate your account.");
+define("LAN_406", "Thank you!");
 define("LAN_407", "Please keep this email for your own information. Your password has been encrypted and cannot be retrieved if you misplace or forget it. You can however request a new password if this happens.\n\nThanks for your registration.\n\nFrom");
 define("LAN_408", "A user with that email address already exists. Please use the 'forgot password' screen to retrieve your password.");
 define("LAN_SIGNUP_1", "Min.");
@@ -50,7 +50,7 @@
 define("LAN_SIGNUP_5", " characters long.");
 define("LAN_SIGNUP_6", "Your ");
 define("LAN_SIGNUP_7", " is required");
-define("LAN_SIGNUP_8", "Thankyou!");
+define("LAN_SIGNUP_8", "Thank you!");
 define("LAN_SIGNUP_9", "Unable to proceed.");
 define("LAN_SIGNUP_10", "Yes");
 define("LAN_SIGNUP_11", ".");
@@ -72,7 +72,7 @@
 define("LAN_SIGNUP_21", "Your account is currently marked as being inactive, to activate your account please go to the following link ...");
 define("LAN_SIGNUP_22", "click here");
 define("LAN_SIGNUP_23", "to login.");
-define("LAN_SIGNUP_24", "Thankyou for registering at");
+define("LAN_SIGNUP_24", "Thank you for registering at");
 define("LAN_SIGNUP_25", "Upload your avatar");
 define("LAN_SIGNUP_26", "Upload your photograph");
 define("LAN_SIGNUP_27", "Show");
@@ -85,7 +85,7 @@
 define("LAN_SIGNUP_33", "Type path or choose avatar");
 define("LAN_SIGNUP_34", "Please note: Any image uploaded to this server that is deemed inappropriate by the administrators will be deleted immediately.");
 define("LAN_SIGNUP_35", "Click here to register using an XUP file");
-define("LAN_SIGNUP_36", "An error has occured creating your user information, please contact the site admin");
+define("LAN_SIGNUP_36", "An error has occurred creating your user information, please contact the site admin");
 
 define("LAN_LOGINNAME", "Login Name");
 define("LAN_PASSWORD", "Password");
@@ -95,7 +95,25 @@
 define("LAN_EMAIL_05", "Your password has been encrypted and cannot be retrieved if you misplace or forget it. You can however request a new password if this happens.");
 define("LAN_EMAIL_06", "Thanks for your registration.");
 
-define("LAN_SIGNUP_37", "This stage of registation is complete. The site admin will need to approve your membership.  Once this has been done you will receive a confirmation email alerting you that your membership has been approved.");
+define("LAN_SIGNUP_37", "This stage of registration is complete. The site admin will need to approve your membership.  Once this has been done you will receive a confirmation email alerting you that your membership has been approved.");
 define("LAN_SIGNUP_38", "You entered two different email addresses. Please enter a valid email address in the two fields provided");
 define("LAN_SIGNUP_39", "Re-type Email Address:");
-?>
\ No newline at end of file
+
+// 0.7.6
+define("LAN_SIGNUP_40", "Activation not necessary");
+define("LAN_SIGNUP_41", "Your account is already activated.");
+define("LAN_SIGNUP_42", "There was a problem, the registration mail was not sent, please contact the website administrator.");
+define("LAN_SIGNUP_43", "Email Sent");
+define("LAN_SIGNUP_44", "Activation email sent to:");
+define("LAN_SIGNUP_45", "Please check your inbox.");
+define("LAN_SIGNUP_47", "Resend Activation Email");
+define("LAN_SIGNUP_48", "Username or Email");
+define("LAN_SIGNUP_49", "If you registered with the wrong email address, type a new one and your password here:");
+define("LAN_SIGNUP_50", "New Email");
+define("LAN_SIGNUP_51", "Old Password");
+define("LAN_SIGNUP_52", "Incorrect Password");
+define("LAN_SIGNUP_53", "field failed validation test");
+
+
+
+?>
diff -ruN 0.7.5/e107_languages/English/lan_sitedown.php 0.7.7/e107_languages/English/lan_sitedown.php
--- 0.7.5/e107_languages/English/lan_sitedown.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_sitedown.php	2006-10-31 15:16:29.000000000 -0600
@@ -4,12 +4,12 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_sitedown.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
+|     $Revision: 1.3 $
+|     $Date: 2006/10/31 21:16:29 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Site temporarily closed");
-define("LAN_00", "is temporarily closed");
-define("LAN_01", "We have temporarily closed the site for some essential maintainance. This shouldn't take too long - please check back soon, apologies for the inconvenience.");
-?>
\ No newline at end of file
+define("LAN_SITEDOWN_00", "is temporarily closed");
+define("LAN_SITEDOWN_01", "We have temporarily closed the site for some essential maintenance. This shouldn't take too long - please check back soon, apologies for the inconvenience.");
+?>
diff -ruN 0.7.5/e107_languages/English/lan_sitelinks.php 0.7.7/e107_languages/English/lan_sitelinks.php
--- 0.7.5/e107_languages/English/lan_sitelinks.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_sitelinks.php	2006-06-02 08:59:40.000000000 -0500
@@ -4,12 +4,12 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_sitelinks.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2006/06/02 13:59:40 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
-define("LAN_183", "Main Menu");
-define("LAN_502", "Admin Area");
+define("LAN_SITELINKS_183", "Main Menu");
+define("LAN_SITELINKS_502", "Admin Area");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_subcontent.php 0.7.7/e107_languages/English/lan_subcontent.php
--- 0.7.5/e107_languages/English/lan_subcontent.php	2004-10-08 22:32:07.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_subcontent.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,62 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system - Language File.
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_subcontent.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2004/10/09 03:32:07 $
-|     $Author: chavo $
-+----------------------------------------------------------------------------+
-*/
-define("ARLAN_0", "Thank you, your article has been saved and will be reviewed by a site administrator in due course.");
-define("ARLAN_1", "Fields left blank.");
-define("ARLAN_2", "Thankyou, your review has been saved and will be reviewed by a site administrator in due course.");
-define("ARLAN_15", "Submit Article");
-define("ARLAN_17", "Heading");
-define("ARLAN_18", "Sub-Heading");
-define("ARLAN_19", "Summary");
-define("ARLAN_20", "Article");
-define("ARLAN_21", "Allow comments?");
-define("ARLAN_22", "On");
-define("ARLAN_23", "Off");
-define("ARLAN_24", "Add email/print icons?");
-define("ARLAN_25", "Yes");
-define("ARLAN_26", "No");
-define("ARLAN_27", "Submit Article");
-define("ARLAN_28", "Preview");
-define("ARLAN_55", "Visible to");
-define("ARLAN_73", "Open HTML Editor");
-define("ARLAN_74", "Category");
-define("ARLAN_75", "None");
-define("ARLAN_82", "Author Details");
-define("ARLAN_84", "author name");
-define("ARLAN_85", "author email address");
-define("ARLAN_86", "Review");
-define("ARLAN_87", "Rating");
-define("ARLAN_88", "Please select rating");
-define("ARLAN_89", "Submit Review");
-
-define("ARLAN_90", "Fields left blank, please press the back button in your browser and confirm all fields are filled in.");
-define("ARLAN_91", "Preview again");
-define("ARLAN_92", "Please enter your name/email address");
-
-
-define("ARLAN_93", "article");
-define("ARLAN_94", "review");
-define("ARLAN_95", "User submission of Articles is currently disabled");
-define("ARLAN_96", "User submission of Reviews is currently disabled");
-define("ARLAN_97", "You do not have enough privileges to Submit Articles");
-define("ARLAN_98", "You do not have enough privileges to Submit Reviews");
-
-
-define("ARLAN_99", "What would you like to submit?");
-define("ARLAN_100", "News");
-define("ARLAN_101", " Event");
-define("ARLAN_102", "Article");
-define("ARLAN_103", "Review");
-define("ARLAN_104", "Link");
-define("ARLAN_105", "Download");
-define("ARLAN_106", "Submit Item");
-
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_submitnews.php 0.7.7/e107_languages/English/lan_submitnews.php
--- 0.7.5/e107_languages/English/lan_submitnews.php	2004-09-21 14:11:56.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_submitnews.php	2006-07-04 11:33:32.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_submitnews.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:56 $
+|     $Revision: 1.2 $
+|     $Date: 2006/07/04 16:33:32 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -13,7 +13,7 @@
 define("LAN_7", "Login Name: ");
 define("LAN_62", "Subject: ");
 define("LAN_112", "Email Address: ");
-define("LAN_133", "Thankyou");
+define("LAN_133", "Thank you");
 define("LAN_134", "Your item has been submitted and will be reviewed by one of the site administrators in due course.");
 define("LAN_135", "News Item: ");
 define("LAN_136", "Submit News Item");
diff -ruN 0.7.5/e107_languages/English/lan_user.php 0.7.7/e107_languages/English/lan_user.php
--- 0.7.5/e107_languages/English/lan_user.php	2005-04-05 22:53:00.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_user.php	2006-07-25 14:56:01.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_user.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/04/06 03:53:00 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.5 $
+|     $Date: 2006/07/25 19:56:01 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Members");
@@ -62,5 +62,6 @@
 define("LAN_426", "ago");
 
 define("USERLAN_1", "Peer Rating");
+define("USERLAN_2", "You do not have access to view this page.");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_languages/English/lan_userclass.php 0.7.7/e107_languages/English/lan_userclass.php
--- 0.7.5/e107_languages/English/lan_userclass.php	2005-05-12 20:03:35.000000000 -0500
+++ 0.7.7/e107_languages/English/lan_userclass.php	2006-06-29 01:53:06.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_userclass.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/05/13 01:03:35 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.3 $
+|     $Date: 2006/06/29 06:53:06 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("UC_LAN_0", "Everyone (public)");
@@ -15,4 +15,5 @@
 define("UC_LAN_3", "Members");
 define("UC_LAN_4", "Read Only");
 define("UC_LAN_5", "Admin");
+define("UC_LAN_6", "Main Admin");
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/admin_menu/admin_menu.php 0.7.7/e107_plugins/admin_menu/admin_menu.php
--- 0.7.5/e107_plugins/admin_menu/admin_menu.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_plugins/admin_menu/admin_menu.php	2006-11-23 03:46:33.000000000 -0600
@@ -11,29 +11,29 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/admin_menu/admin_menu.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/23 09:46:33 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
-
+global $tp;
 if (ADMIN == TRUE) {
-	@include(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
-	@include(e_LANGUAGEDIR."English/admin/lan_admin.php");
-	
+	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
+	@include_once(e_LANGUAGEDIR."English/admin/lan_admin.php");
+
 	require_once(e_HANDLER."userclass_class.php");
 	require_once(e_ADMIN."ad_links.php");
 	require_once(e_HANDLER.'admin_handler.php');
-	
-	$array_functions[] = array(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z");
-	
+
+	$array_functions[] = array(e_ADMIN."plugin.php", ADLAN_98, "Z");
+
 	if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) {
 		while ($row = $sql->db_Fetch()) {
 			include(e_PLUGIN.$row['plugin_path']."/plugin.php");
 			if ($eplug_conffile) {
-				$array_functions[] = array(e_PLUGIN.$row['plugin_path']."/".$eplug_conffile, $eplug_name, "P".$row['plugin_id']);
+				$array_functions[] = array(e_PLUGIN.$row['plugin_path']."/".$eplug_conffile, $tp->toHtml($eplug_name,"","defs,emotes_off, no_make_clickable"), "P".$row['plugin_id']);
 			}
 			unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small);
 		}
@@ -45,7 +45,7 @@
 	<select name='activate' onchange='urljump(this.options[selectedIndex].value)' class='tbox'>
 	<option>".LAN_SELECT."</option>\n";
 	foreach ($array_functions as $link_value) {
-		$amtext .= render_admin_links($link_value[0], $link_value[1], $link_value[3]);
+		$amtext .= render_admin_links($link_value[0], $link_value[1], $link_value[2]);
 	}
 
 	$amtext .= "</select>
@@ -58,4 +58,4 @@
 		return "<option value='".$link."'>".$title."</option>";
 	}
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/alt_auth/alt_auth_adminmenu.php 0.7.7/e107_plugins/alt_auth/alt_auth_adminmenu.php
--- 0.7.5/e107_plugins/alt_auth/alt_auth_adminmenu.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/alt_auth_adminmenu.php	2006-11-22 06:23:28.000000000 -0600
@@ -0,0 +1,42 @@
+<?php
+
+function alt_auth_get_authlist()
+{
+	$authlist = array("e107");
+	$handle=opendir(e_PLUGIN."alt_auth");
+	while ($file = readdir($handle))
+	{
+		if(preg_match("/^(.*)_auth\.php/",$file,$match))
+		{
+			$authlist[] = $match[1];
+		}
+	}
+	closedir($handle);
+	return $authlist;
+}
+
+function alt_auth_adminmenu()
+{
+	global $authlist;
+	echo " ";
+	if(!is_array($authlist))
+	{
+		$authlist = alt_auth_get_authlist();
+	}
+	define("ALT_AUTH_ACTION", "main");
+
+	$var['main']['text'] = "Main config";
+	$var['main']['link'] = e_PLUGIN."alt_auth/alt_auth_conf.php";
+	show_admin_menu("alt auth", ALT_AUTH_ACTION, $var);
+	$var = array();
+	foreach($authlist as $a)
+	{
+		if($a != 'e107')
+		{
+			$var[$a]['text'] = "Config {$a}";
+			$var[$a]['link'] = e_PLUGIN."alt_auth/{$a}_conf.php";
+		}
+	}
+	show_admin_menu("Auth methods", ALT_AUTH_ACTION, $var);
+}
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/alt_auth/alt_auth_conf.php 0.7.7/e107_plugins/alt_auth/alt_auth_conf.php
--- 0.7.5/e107_plugins/alt_auth/alt_auth_conf.php	2006-02-11 15:17:11.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/alt_auth_conf.php	2006-10-18 11:34:48.000000000 -0500
@@ -1,10 +1,29 @@
 <?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/alt_auth/alt_auth_conf.php,v $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/18 16:34:48 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
 $eplug_admin = true;
 require_once("../../class2.php");
 if(!getperms("P")){header("location:".e_BASE."index.php"); exit; }
 require_once(e_HANDLER."form_handler.php");
 require_once(e_ADMIN."auth.php");
 include_lan(e_PLUGIN."alt_auth/languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
+define("ALT_AUTH_ACTION", "main");
+require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
 
 if(isset($_POST['updateprefs']))
 {
@@ -16,22 +35,13 @@
 	exit;
 }
 
-$authlist[] = "e107";
-$handle=opendir(e_PLUGIN."alt_auth");
-while ($file = readdir($handle))
-{
-	if(preg_match("/^(.*)_auth\.php/",$file,$match))
-	{
-		$authlist[] = $match[1];
-	}
-}
-closedir($handle);
+$authlist = alt_auth_get_authlist();
 
 $auth_dropdown = "<select class='tbox' name='auth_method'>\n";
 foreach($authlist as $a)
 {
-	$s = ($pref['auth_method'] == $a) ? " SELECTED" : "";
-	$auth_dropdown .= "<option {$s}>".$a."</option>\n";
+	$s = ($pref['auth_method'] == $a) ? "selected='selected'" : "";
+	$auth_dropdown .= "<option value='{$a}' {$s}>".$a."</option>\n";
 }
 $auth_dropdown .= "</select>\n";
 
@@ -93,14 +103,13 @@
 
 $ns -> tablerender("<div style='text-align:center'>".LAN_ALT_3."</div>", $text);
 
-$text="";
-foreach($authlist as $a){
-	if($a != 'e107'){
-		$text .= LAN_ALT_4." <a href='".e_PLUGIN."alt_auth/{$a}_conf.php'>{$a}</a><br />";
-	}
+
+require_once(e_ADMIN."footer.php");
+
+function alt_auth_conf_adminmenu()
+{
+	alt_auth_adminmenu();
 }
 
-$ns -> tablerender("<div style='text-align:center'>".LAN_ALT_5."</div>", $text);
 
-require_once(e_ADMIN."footer.php");
 ?>	
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/alt_auth/alt_auth_login_class.php 0.7.7/e107_plugins/alt_auth/alt_auth_login_class.php
--- 0.7.5/e107_plugins/alt_auth/alt_auth_login_class.php	2006-03-20 15:02:15.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/alt_auth_login_class.php	2006-08-03 08:46:17.000000000 -0500
@@ -1,4 +1,21 @@
 <?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/alt_auth/alt_auth_login_class.php,v $
+|     $Revision: 1.4 $
+|     $Date: 2006/08/03 13:46:17 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
 class alt_login
 {
 	function alt_login($method, &$username, &$userpass)
diff -ruN 0.7.5/e107_plugins/alt_auth/alt_login_class.php 0.7.7/e107_plugins/alt_auth/alt_login_class.php
--- 0.7.5/e107_plugins/alt_auth/alt_login_class.php	2006-03-20 15:02:15.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/alt_login_class.php	2006-08-03 08:46:17.000000000 -0500
@@ -1,4 +1,21 @@
 <?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/alt_auth/alt_login_class.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/03 13:46:17 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
 
 class alt_login{
 	function alt_login($method,&$username,&$userpass){
diff -ruN 0.7.5/e107_plugins/alt_auth/languages/English/lan_alt_auth_conf.php 0.7.7/e107_plugins/alt_auth/languages/English/lan_alt_auth_conf.php
--- 0.7.5/e107_plugins/alt_auth/languages/English/lan_alt_auth_conf.php	2006-02-11 15:17:11.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/languages/English/lan_alt_auth_conf.php	2006-08-26 21:24:45.000000000 -0500
@@ -1,15 +1,15 @@
-<?php
-define("LAN_ALT_1", "Current authorization type");
-define("LAN_ALT_2", "Update settings");
-define("LAN_ALT_3", "Choose Alternate Authorizaion Type");
-define("LAN_ALT_4", "Configure parameters for");
-define("LAN_ALT_5", "Configure authorization parameters");
-define("LAN_ALT_6", "Failed connection action");
-define("LAN_ALT_7", "If connection to the alternate method fails, how should that be handled?");
-define("LAN_ALT_8", "User not found action");
-define("LAN_ALT_9", "If username is not found using alternate method, how should that be handled?");
-
-define("LAN_ALT_FALLBACK", "Use e107 user table");
-define("LAN_ALT_FAIL", "Failed login");
-
-?>
+<?php
+define("LAN_ALT_1", "Current authorization type");
+define("LAN_ALT_2", "Update settings");
+define("LAN_ALT_3", "Choose Alternate Authorization Type");
+define("LAN_ALT_4", "Configure parameters for");
+define("LAN_ALT_5", "Configure authorization parameters");
+define("LAN_ALT_6", "Failed connection action");
+define("LAN_ALT_7", "If connection to the alternate method fails, how should that be handled?");
+define("LAN_ALT_8", "User not found action");
+define("LAN_ALT_9", "If username is not found using alternate method, how should that be handled?");
+
+define("LAN_ALT_FALLBACK", "Use e107 user table");
+define("LAN_ALT_FAIL", "Failed login");
+
+?>
diff -ruN 0.7.5/e107_plugins/alt_auth/languages/English/lan_ldap_auth.php 0.7.7/e107_plugins/alt_auth/languages/English/lan_ldap_auth.php
--- 0.7.5/e107_plugins/alt_auth/languages/English/lan_ldap_auth.php	2006-02-11 15:17:11.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/languages/English/lan_ldap_auth.php	2006-10-18 10:24:06.000000000 -0500
@@ -1,8 +1,15 @@
-<?php
-define("LDAPLAN_1", "Server address");
-define("LDAPLAN_2", "Base DN or Domain<br />If LDAP - Enter BaseDN<br />If AD - Enter domain");
-define("LDAPLAN_3", "LDAP Browsing user<br />Full context of the user who is able to search the directory.");
-define("LDAPLAN_4", "LDAP Browsing password<br />Password for the LDAP Browsing user.");
-define("LDAPLAN_5", "LDAP Version");
-define("LDAPLAN_6", "Configure LDAP auth");
-?>
+<?php
+define("LDAPLAN_1", "Server address");
+define("LDAPLAN_2", "Base DN or Domain<br />If LDAP - Enter BaseDN<br />If AD - Enter domain");
+define("LDAPLAN_3", "LDAP Browsing user<br />Full context of the user who is able to search the directory.");
+define("LDAPLAN_4", "LDAP Browsing password<br />Password for the LDAP Browsing user.");
+define("LDAPLAN_5", "LDAP Version");
+define("LDAPLAN_6", "Configure LDAP auth");
+define("LDAPLAN_7", "eDirectory search filter:");
+define("LDAPLAN_8", "This will be used to ensure the username is in the correct tree, <br />ie '(objectclass=inetOrgPerson)'");
+define("LDAPLAN_9", "Current search filter will be:");
+define("LDAPLAN_10", "Settings Updated");
+define("LDAPLAN_11", "WARNING:  It appears as if the ldap module is not currently available, setting your auth method to LDAP will probably not work!");
+define("LDAPLAN_12", "Server Type");
+define("LDAPLAN_13", "Update settings");
+?>
diff -ruN 0.7.5/e107_plugins/alt_auth/languages/English/lan_otherdb_auth.php 0.7.7/e107_plugins/alt_auth/languages/English/lan_otherdb_auth.php
--- 0.7.5/e107_plugins/alt_auth/languages/English/lan_otherdb_auth.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/languages/English/lan_otherdb_auth.php	2006-10-18 11:58:28.000000000 -0500
@@ -0,0 +1,14 @@
+<?php
+define("OTHERDB_LAN_1", "Database Type:");
+define("OTHERDB_LAN_2", "Server:");
+define("OTHERDB_LAN_3", "Username:");
+define("OTHERDB_LAN_4", "Password:");
+define("OTHERDB_LAN_5", "Database");
+define("OTHERDB_LAN_6", "Table");
+define("OTHERDB_LAN_7", "Username Field:");
+define("OTHERDB_LAN_8", "Password Field:");
+define("OTHERDB_LAN_9", "Password Method:");
+define("OTHERDB_LAN_10", "Configure otherdb auth");
+define("OTHERDB_LAN_11", "** The following fields are not required if using an e107 database");
+
+?>
diff -ruN 0.7.5/e107_plugins/alt_auth/ldap_auth.php 0.7.7/e107_plugins/alt_auth/ldap_auth.php
--- 0.7.5/e107_plugins/alt_auth/ldap_auth.php	2006-02-11 15:17:11.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/ldap_auth.php	2006-08-03 08:46:17.000000000 -0500
@@ -1,165 +1,186 @@
-<?php
-
-class auth_login
-{
-
-	var $server;
-	var $dn;
-	var $usr;
-	var $pwd;
-	var $serverType;
-	var $ldapErrorCode;
-	var $ldapErrorText;
-	var $connection;
-	var $result;
-	var $ldapVersion;
-	var $Available;
-
-	function auth_login()
-	{
-		$sql = new db;
-		$sql -> db_Select("alt_auth", "*", "auth_type = 'ldap' ");
-		while($row = $sql -> db_Fetch())
-		{
-			$ldap[$row['auth_parmname']]=$row['auth_parmval'];
-		}
-
-		$this->server = explode(",", $ldap['ldap_server']);
-		$this->serverType = $ldap['ldap_servertype'];
-		$this->dn = $ldap['ldap_basedn'];
-		$this->usr = $ldap['ldap_user'];
-		$this->pwd = $ldap['ldap_passwd'];
-		$this->ldapVersion = $ldap['ldap_version'];
-
-		if(!function_exists('ldap_connect'))
-		{
-			$this->Available = FALSE;
-			return false;
-		}
-
-		if(!$this -> connect())
-		{
-			return AUTH_NOCONNECT;
-		}
-	}
-
-	function connect()
-	{
-		foreach ($this->server as $key => $host)
-		{
-			$this->connection = ldap_connect($host);
-			if ( $this->connection) {
-				if($this -> ldapVersion == 3 || $this->serverType == "ActiveDirectory")
-				{
-					@ldap_set_option( $this -> connection, LDAP_OPT_PROTOCOL_VERSION, 3 );
-				}
-				return true;
-			}
-		}
-		
-		$this->ldapErrorCode = -1;
-		$this->ldapErrorText = "Unable to connect to any server";
-		return false;
-	}
-
-	function close()
-	{
-		if ( !@ldap_close( $this->connection))
-		{
-			$this->ldapErrorCode = ldap_errno( $this->connection);
-			$this->ldapErrorText = ldap_error( $this->connection);
-			return false;
-		}
-		else
-		{
-			return true;
-		}
-	}
-
-	function login($uname, $pass)
-	{
-		/* Construct the full DN, eg:-
-		** "uid=username, ou=People, dc=orgname,dc=com"
-		*/
-		if ($this->serverType == "ActiveDirectory")
-		{
-			$checkDn = "$uname@$this->dn";
-		}
-		else
-		{
-			if ($this -> usr != '' && $this -> pwd != '')
-			{
-				$this -> result = ldap_bind($this -> connection, $this -> usr, $this -> pwd);
-			}
-			else
-			{
-				$this -> result = ldap_bind($this -> connection);
-			}
-			
-//			In ldap_auth.php, should look like this instead for eDirectory 
-//			$query = ldap_search($this -> connection, $this -> dn, "cn=".$uname);
-
-			if($this->serverType == "eDirectory")
-			{
-				$query = ldap_search($this->connection, $this->dn, "cn=".$uname);
-			}
-			else
-			{
-				$query = ldap_search($this->connection, $this->dn, "uid=".$uname);
-			}
-
-			if ($query == false)
-			{
-//				Could not perform query to LDAP directory
-				return AUTH_NOCONNECT;
-			}
-			else
-			{
-				$query_result = ldap_get_entries($this -> connection, $query);
-
-				if ($query_result["count"] != 1)
-				{
-					return AUTH_NOUSER;
-				}
-				else
-				{
-					$checkDn = $query_result[0]["dn"];
-					$this -> close();
-					$this -> connect();
-				}
-			}
-		}
-		// Try and connect...
-		$this->result = ldap_bind($this -> connection, $checkDn, $pass);
-		if ( $this->result)
-		{
-			// Connected OK - login credentials are fine!
-			return AUTH_SUCCESS;
-		}
-		else
-		{
-			/* Login failed. Return false, together with the error code and text from
-			** the LDAP server. The common error codes and reasons are listed below :
-			** (for iPlanet, other servers may differ)
-			** 19 - Account locked out (too many invalid login attempts)
-			** 32 - User does not exist
-			** 49 - Wrong password
-			** 53 - Account inactive (manually locked out by administrator)
-			*/
-			$this->ldapErrorCode = ldap_errno( $this->connection);
-			$this->ldapErrorText = ldap_error( $this->connection);
-
-			if($this -> ldapErrorCode == 32)
-			{
-				return AUTH_NOUSER;
-			}
-			if($this -> ldapErrorCode == 49)
-			{
-				return AUTH_BADPASSWORD;
-			}
-			// return error code as if it never connected, maybe change that in the future
-			return AUTH_NOCONNECT;  
-		}
-	}
-}
-?>
+<?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/alt_auth/ldap_auth.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/03 13:46:17 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
+
+class auth_login
+{
+
+	var $server;
+	var $dn;
+	var $usr;
+	var $pwd;
+	var $serverType;
+	var $ldapErrorCode;
+	var $ldapErrorText;
+	var $connection;
+	var $result;
+	var $ldapVersion;
+	var $Available;
+	var $filter;
+
+	function auth_login()
+	{
+		$sql = new db;
+		$sql -> db_Select("alt_auth", "*", "auth_type = 'ldap' ");
+		while($row = $sql -> db_Fetch())
+		{
+			$ldap[$row['auth_parmname']]=$row['auth_parmval'];
+		}
+
+		$this->server = explode(",", $ldap['ldap_server']);
+		$this->serverType = $ldap['ldap_servertype'];
+		$this->dn = $ldap['ldap_basedn'];
+		$this->usr = $ldap['ldap_user'];
+		$this->pwd = $ldap['ldap_passwd'];
+		$this->ldapVersion = $ldap['ldap_version'];
+		$this->filter = (isset($ldap['ldap_edirfilter']) ? $ldap['ldap_edirfilter'] : "");
+
+		if(!function_exists('ldap_connect'))
+		{
+			$this->Available = FALSE;
+			return false;
+		}
+
+		if(!$this -> connect())
+		{
+			return AUTH_NOCONNECT;
+		}
+	}
+
+	function connect()
+	{
+		foreach ($this->server as $key => $host)
+		{
+			$this->connection = ldap_connect($host);
+			if ( $this->connection) {
+				if($this -> ldapVersion == 3 || $this->serverType == "ActiveDirectory")
+				{
+					@ldap_set_option( $this -> connection, LDAP_OPT_PROTOCOL_VERSION, 3 );
+				}
+				return true;
+			}
+		}
+		
+		$this->ldapErrorCode = -1;
+		$this->ldapErrorText = "Unable to connect to any server";
+		return false;
+	}
+
+	function close()
+	{
+		if ( !@ldap_close( $this->connection))
+		{
+			$this->ldapErrorCode = ldap_errno( $this->connection);
+			$this->ldapErrorText = ldap_error( $this->connection);
+			return false;
+		}
+		else
+		{
+			return true;
+		}
+	}
+
+	function login($uname, $pass)
+	{
+		/* Construct the full DN, eg:-
+		** "uid=username, ou=People, dc=orgname,dc=com"
+		*/
+		if ($this->serverType == "ActiveDirectory")
+		{
+			$checkDn = "$uname@$this->dn";
+		}
+		else
+		{
+			if ($this -> usr != '' && $this -> pwd != '')
+			{
+				$this -> result = ldap_bind($this -> connection, $this -> usr, $this -> pwd);
+			}
+			else
+			{
+				$this -> result = ldap_bind($this -> connection);
+			}
+			
+//			In ldap_auth.php, should look like this instead for eDirectory 
+//			$query = ldap_search($this -> connection, $this -> dn, "cn=".$uname);
+
+			if($this->serverType == "eDirectory")
+			{
+				$_filter = (isset($ldap['ldap_edirfilter']) ? $ldap['ldap_edirfilter'] : "");
+				$current_filter = "(&(cn={$uname})".$this->filter.")";
+				$query = ldap_search($this->connection, $this->dn, $current_filter);
+			}
+			else
+			{
+				$query = ldap_search($this->connection, $this->dn, "uid=".$uname);
+			}
+
+			if ($query == false)
+			{
+//				Could not perform query to LDAP directory
+				return AUTH_NOCONNECT;
+			}
+			else
+			{
+				$query_result = ldap_get_entries($this -> connection, $query);
+
+				if ($query_result["count"] != 1)
+				{
+					return AUTH_NOUSER;
+				}
+				else
+				{
+					$checkDn = $query_result[0]["dn"];
+					$this -> close();
+					$this -> connect();
+				}
+			}
+		}
+		// Try and connect...
+		$this->result = ldap_bind($this -> connection, $checkDn, $pass);
+		if ( $this->result)
+		{
+			// Connected OK - login credentials are fine!
+			return AUTH_SUCCESS;
+		}
+		else
+		{
+			/* Login failed. Return false, together with the error code and text from
+			** the LDAP server. The common error codes and reasons are listed below :
+			** (for iPlanet, other servers may differ)
+			** 19 - Account locked out (too many invalid login attempts)
+			** 32 - User does not exist
+			** 49 - Wrong password
+			** 53 - Account inactive (manually locked out by administrator)
+			*/
+			$this->ldapErrorCode = ldap_errno( $this->connection);
+			$this->ldapErrorText = ldap_error( $this->connection);
+
+			if($this -> ldapErrorCode == 32)
+			{
+				return AUTH_NOUSER;
+			}
+			if($this -> ldapErrorCode == 49)
+			{
+				return AUTH_BADPASSWORD;
+			}
+			// return error code as if it never connected, maybe change that in the future
+			return AUTH_NOCONNECT;  
+		}
+	}
+}
+?>
diff -ruN 0.7.5/e107_plugins/alt_auth/ldap_conf.php 0.7.7/e107_plugins/alt_auth/ldap_conf.php
--- 0.7.5/e107_plugins/alt_auth/ldap_conf.php	2006-02-13 07:28:04.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/ldap_conf.php	2006-10-18 10:24:06.000000000 -0500
@@ -1,18 +1,29 @@
 <?php
 /*
-+---------------------------------------------------------------+
-|	e107 website system
-|	/ldap_conf.php
++ ----------------------------------------------------------------------------+
+|     e107 website system
 |
-|	Released under the terms and conditions of the
-|	GNU General Public License (http://gnu.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).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_plugins/alt_auth/ldap_conf.php,v $
+|     $Revision: 1.7 $
+|     $Date: 2006/10/18 15:24:06 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
 */
 $eplug_admin = true;
 require_once("../../class2.php");
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."form_handler.php");
 include_lan("languages/".e_LANGUAGE."/lan_ldap_auth.php");
+define("ALT_AUTH_ACTION", "ldap");
+require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
+
 
 $server_types[1]="LDAP";
 $server_types[2]="ActiveDirectory";
@@ -37,12 +48,12 @@
 			}
 		}
 	}
-	$message = "Settings Updated";
+	$message = LDAPLAN_10;
 }
 
 if(!function_exists('ldap_connect'))
 {
-	$message = "<div style='color:#f00; font-weight:bold'>WARNING:  It appears as if the ldap module is not currently available, setting your auth method to LDAP will probably not work!</div>";
+	$message = "<div style='color:#f00; font-weight:bold'>".LDAPLAN_11."</div>";
 }
 
 if($message)
@@ -50,16 +61,19 @@
 	$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
 }
 
+$ldap['ldap_edirfilter'] == "";
 $sql -> db_Select("alt_auth", "*", "auth_type = 'ldap' ");
 while($row = $sql->db_Fetch())
 {
 	$ldap[$row['auth_parmname']] = $row['auth_parmval'];
 }
 
+$current_filter = "(&(cn=[USERNAME]){$ldap['ldap_edirfilter']})";
+
 $frm = new form;
 $text = $frm -> form_open("POST",e_SELF);
 $text .= "<table style='width:96%'>";
-$text .= "<tr><td class='forumheader3'>Server Type</td><td class='forumheader3'>";
+$text .= "<tr><td class='forumheader3'>".LDAPLAN_12."</td><td class='forumheader3'>";
 $text .= $frm -> form_select_open("ldap_servertype");
 foreach($server_types as $v)
 {
@@ -70,19 +84,19 @@
 $text .= "</td></tr>";
 
 $text .= "<tr><td class='forumheader3'>".LDAPLAN_1."</td><td class='forumheader3'>";
-$text .= $frm -> form_text("ldap_server", 35, $ldap['ldap_server'], 60);
+$text .= $frm -> form_text("ldap_server", 35, $ldap['ldap_server'], 120);
 $text .= "</td></tr>";
 
 $text .= "<tr><td class='forumheader3'>".LDAPLAN_2."</td><td class='forumheader3'>";
-$text .= $frm -> form_text("ldap_basedn", 35, $ldap['ldap_basedn'], 60);
+$text .= $frm -> form_text("ldap_basedn", 35, $ldap['ldap_basedn'], 120);
 $text .= "</td></tr>";
 
 $text .= "<tr><td class='forumheader3'>".LDAPLAN_3."</td><td class='forumheader3'>";
-$text .= $frm -> form_text("ldap_user", 35, $ldap['ldap_user'], 60);
+$text .= $frm -> form_text("ldap_user", 35, $ldap['ldap_user'], 120);
 $text .= "</td></tr>";
 
 $text .= "<tr><td class='forumheader3'>".LDAPLAN_4."</td><td class='forumheader3'>";
-$text .= $frm -> form_text("ldap_passwd", 35, $ldap['ldap_passwd'], 60);
+$text .= $frm -> form_text("ldap_passwd", 35, $ldap['ldap_passwd'], 120);
 $text .= "</td></tr>";
 
 $text .= "<tr><td class='forumheader3'>".LDAPLAN_5."</td><td class='forumheader3'>";
@@ -97,14 +111,23 @@
 $text .= $frm -> form_select_close();
 $text .= "</td></tr>";
 
+$text .= "<tr><td class='forumheader3'>".LDAPLAN_7."<br /><span class='smalltext'>".LDAPLAN_8."</span></td><td class='forumheader3'>";
+$text .= $frm -> form_text("ldap_edirfilter", 35, $ldap['ldap_edirfilter'], 120);
+$text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />{$current_filter}</span></td></tr>";
+
 $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
-$text .= $frm -> form_button("submit", "update", "Update settings");
+$text .= $frm -> form_button("submit", "update", LDAPLAN_13);
 $text .= "</td></tr>";
 
 $text .= "</table>";
 $text .= $frm -> form_close();
 
 $ns -> tablerender(LDAPLAN_6,$text);
-$ns -> tablerender(" ","<div style='text-align:center'><a href='".e_PLUGIN."alt_auth/alt_auth_conf.php'>Return to main alt_auth config</a></div>");
 require_once(e_ADMIN."footer.php");
+
+function ldap_conf_adminmenu()
+{
+	alt_auth_adminmenu();
+}
+
 ?>
diff -ruN 0.7.5/e107_plugins/alt_auth/otherdb_auth.php 0.7.7/e107_plugins/alt_auth/otherdb_auth.php
--- 0.7.5/e107_plugins/alt_auth/otherdb_auth.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/otherdb_auth.php	2006-10-18 12:22:51.000000000 -0500
@@ -0,0 +1,147 @@
+<?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/alt_auth/otherdb_auth.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2006/10/18 17:22:51 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
+
+/* 
+	return values
+	AUTH_NOCONNECT 		= unable to connect to db
+	AUTH_NOUSER				= user not found	
+	AUTH_BADPASSWORD	= supplied password incorrect
+
+	AUTH_SUCCESS 			= valid login
+*/
+
+class auth_login
+{
+
+	var $od;
+	
+	function auth_login()
+	{
+		global $otherdb_conf, $sql;
+		$sql -> db_Select("alt_auth", "*", "auth_type = 'otherdb' ");
+		while($row = $sql -> db_Fetch())
+		{
+			$otherdb_conf[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
+		}
+		$class_name = "otherdb_".$otherdb_conf['otherdb_dbtype']."_class";
+
+		if($otherdb_conf['otherdb_dbtype'] == 'e107')
+		{
+			$class_name = "otherdb_mysql_class";
+		}
+				
+		if(class_exists($class_name))
+		{
+			$this->od = new $class_name;
+		}
+		else
+		{
+			return AUTH_NOCONNECT;
+		}
+	}
+
+	function login($uname, $pword, &$newvals)
+	{
+		global $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $sql;
+		$ret = $this->od->login($uname, $pword, $newvals);
+		$sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);
+		return $ret;
+	}
+
+}
+
+class otherdb_mysql_class
+{
+	
+	var $conf;
+	
+	function otherdb_mysql_class()
+	{
+		global $otherdb_conf;
+		$this->conf = $otherdb_conf;
+	}
+	
+	function login($uname, $pword, &$newvals)
+	{
+
+		//Attempt to open connection to sql database
+		if(!$res = mysql_connect($this->conf['otherdb_server'], $this->conf['otherdb_username'], $this->conf['otherdb_password']))
+		{
+			return AUTH_NOCONNECT;
+		}
+
+		//Select correct db
+		if(!mysql_select_db($this->conf['otherdb_database'], $res))
+		{
+			mysql_close($res);
+			return AUTH_NOCONNECT;
+		}
+
+		if($this->conf['otherdb_dbtype'] == 'mysql')
+		{
+			$sel_fields = $this->conf['otherdb_password_field'];
+			$user_field = $this->conf['otherdb_user_field'];
+		}
+		else
+		{
+			$sel_fields = 'user_password, user_email, user_join';
+			$user_field = "user_loginname";
+		}
+		
+
+		//Get record containing supplied login name
+		$qry = "SELECT {$sel_fields} FROM {$this->conf['otherdb_table']} WHERE {$user_field} = '{$uname}'";
+		if(!$r1 = mysql_query($qry))
+		{
+			mysql_close($res);
+			return AUTH_NOCONNECT;
+		}
+		if(!$row = mysql_fetch_array($r1))
+		{
+			mysql_close($res);
+			return AUTH_NOUSER;
+		}
+		
+		//Compare password in db to supplied password
+		if($this->conf['otherdb_password_method'] == 'md5' || $this->conf['otherdb_dbtype'] == 'e107')
+		{
+			$goodpw = md5($pword) == $row[0];
+		}
+		else
+		{
+			$goodpw = $pword == $row[0];
+		}
+		if($goodpw)
+		{
+			//Close newly opened mysql connection
+			mysql_close($res);
+			if($this->conf['otherdb_dbtype'] == 'e107')
+			{
+				$newvals['email'] = $row[1];
+				$newvals['join'] = $row[2];
+			}
+			return AUTH_SUCCESS;
+		}
+		
+		mysql_close($res);
+		return AUTH_BADPASSWORD;
+	}
+}
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/alt_auth/otherdb_conf.php 0.7.7/e107_plugins/alt_auth/otherdb_conf.php
--- 0.7.5/e107_plugins/alt_auth/otherdb_conf.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/otherdb_conf.php	2006-10-18 12:22:51.000000000 -0500
@@ -0,0 +1,143 @@
+<?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).
++----------------------------------------------------------------------------+
+*/
+$eplug_admin = true;
+require_once("../../class2.php");
+require_once(e_ADMIN."auth.php");
+require_once(e_HANDLER."form_handler.php");
+include_lan("languages/".e_LANGUAGE."/lan_otherdb_auth.php");
+define("ALT_AUTH_ACTION", "otherdb");
+require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
+
+if($_POST['update'])
+{
+	$message = update_otherdb_prefs();
+}
+
+if($message)
+{
+	$ns->tablerender("","<div style='text-align:center;'>".$message."</div>");
+}
+
+
+show_otherdb_form();
+
+function show_otherdb_form()
+{
+	global $sql, $tp, $ns;
+	
+	$password_methods = array("md5", "plaintext");
+	$db_types = array("e107" => "mysql - e107 database", "mysql" => "mysql - generic database");
+
+	$sql -> db_Select("alt_auth", "*", "auth_type = 'otherdb' ");
+	$parm = array();
+	while($row = $sql->db_Fetch())
+	{
+		$parm[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval']));
+	}
+
+	$frm = new form;
+	$text = $frm -> form_open("POST", e_SELF);
+	$text .= "<table style='width:96%'>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_1."</td><td class='forumheader3'>";
+	$text .= $frm -> form_select_open("otherdb_dbtype");
+	foreach($db_types as $k => $v)
+	{
+		$sel = ($parm['otherdb_dbtype'] == $k) ? " Selected" : "";
+		$text .= $frm -> form_option($v, $sel, $k);
+	}
+	$text .= $frm -> form_select_close();
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_2."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_server", 35, $parm['otherdb_server'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_3."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_username", 35, $parm['otherdb_username'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_4."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_password", 35, $parm['otherdb_password'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_5."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_database", 35, $parm['otherdb_database'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_6."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_table", 35, $parm['otherdb_table'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader2' colspan='2'>".OTHERDB_LAN_11."</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_7."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_user_field", 35, $parm['otherdb_user_field'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_8."</td><td class='forumheader3'>";
+	$text .= $frm -> form_text("otherdb_password_field", 35, $parm['otherdb_password_field'], 120);
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader3'>".OTHERDB_LAN_9."</td><td class='forumheader3'>";
+	$text .= $frm -> form_select_open("otherdb_password_method");
+	foreach($password_methods as $v)
+	{
+		$sel = ($parm['otherdb_password_method'] == $v) ? " Selected" : "";
+		$text .= $frm -> form_option($v, $sel, $v);
+	}
+	$text .= $frm -> form_select_close();
+	$text .= "</td></tr>";
+
+	$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";
+	$text .= $frm -> form_button("submit", "update", "Update settings");
+	$text .= "</td></tr>";
+
+	$text .= "</table>";
+	$text .= $frm -> form_close();
+
+	$ns -> tablerender(OTHERDB_LAN_10, $text);
+}
+
+require_once(e_ADMIN."footer.php");
+
+
+function update_otherdb_prefs()
+{
+	global $sql;
+	foreach($_POST as $k => $v)
+	{
+		$v = base64_encode(base64_encode($v));
+
+		if(preg_match("/otherdb_/", $k))
+		{
+			if($sql -> db_Select("alt_auth", "*", "auth_type='otherdb' AND auth_parmname='{$k}' "))
+			{
+				$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE  auth_type='otherdb' AND auth_parmname='{$k}' ");
+			}
+			else
+			{
+				$sql -> db_Insert("alt_auth", "'otherdb','{$k}','{$v}' ");
+			}
+		}
+	}
+	return "Settings Updated";
+}
+
+function otherdb_conf_adminmenu()
+{
+	alt_auth_adminmenu();
+}
+
+?>
diff -ruN 0.7.5/e107_plugins/alt_auth/plugin.php 0.7.7/e107_plugins/alt_auth/plugin.php
--- 0.7.5/e107_plugins/alt_auth/plugin.php	2006-02-07 09:13:53.000000000 -0600
+++ 0.7.7/e107_plugins/alt_auth/plugin.php	2006-08-03 08:46:17.000000000 -0500
@@ -1,69 +1,74 @@
-<?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).
-+---------------------------------------------------------------+
-*/
-
-
-// Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = "Alternate Authentication";
-$eplug_version = "0.3";
-$eplug_author = "McFly";
-$eplug_logo = "/images/icon_ldap.png";
-$eplug_url = "";
-$eplug_email = "mcfly@e107.org";
-$eplug_description = "This plugin allows for alternate authentication methods.";
-$eplug_compatible = "e107v7+";
-$eplug_readme = "";	// leave blank if no readme file
-
-// Name of the plugin's folder -------------------------------------------------------------------------------------
-$eplug_folder = "alt_auth";
-
-// Mane of menu item for plugin ----------------------------------------------------------------------------------
-$eplug_menu_name = "alt_auth";
-
-// Name of the admin configuration file --------------------------------------------------------------------------
-$eplug_conffile = "alt_auth_conf.php";
-
-// Icon image and caption text ------------------------------------------------------------------------------------
-$eplug_icon = $eplug_folder."/images/icon_ldap.png";
-$eplug_caption =  "Configure Alt auth";
-
-// List of preferences -----------------------------------------------------------------------------------------------
-$eplug_prefs = "";
-
-// List of table names -----------------------------------------------------------------------------------------------
-$eplug_table_names = array(
-	"alt_auth"
-);
-
-// List of sql requests to create tables -----------------------------------------------------------------------------
-
-
-$eplug_tables = array(
-"CREATE TABLE ".MPREFIX."alt_auth (
-  auth_type varchar(20) NOT NULL default '',
-  auth_parmname varchar(30) NOT NULL default '',
-  auth_parmval varchar(60) NOT NULL default ''
-) TYPE=MyISAM;");
-
-
-
-// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
-$eplug_link = FALSE;
-$eplug_link_name = "";
-$eplug_link_url = "";
-
-
-// Text to display after plugin successfully installed ------------------------------------------------------------------
-$eplug_done = "Alt auth service is now set up.  You will now need to configure your preferred method.";
-
-?>	
+<?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/alt_auth/plugin.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/03 13:46:17 $
+|     $Author: mcfly_e107 $
++----------------------------------------------------------------------------+
+*/
+
+
+// Plugin info -------------------------------------------------------------------------------------------------------
+$eplug_name = "Alternate Authentication";
+$eplug_version = "0.3";
+$eplug_author = "McFly";
+$eplug_logo = "/images/icon_ldap.png";
+$eplug_url = "";
+$eplug_email = "mcfly@e107.org";
+$eplug_description = "This plugin allows for alternate authentication methods.";
+$eplug_compatible = "e107v7+";
+$eplug_readme = "";	// leave blank if no readme file
+
+// Name of the plugin's folder -------------------------------------------------------------------------------------
+$eplug_folder = "alt_auth";
+
+// Mane of menu item for plugin ----------------------------------------------------------------------------------
+$eplug_menu_name = "alt_auth";
+
+// Name of the admin configuration file --------------------------------------------------------------------------
+$eplug_conffile = "alt_auth_conf.php";
+
+// Icon image and caption text ------------------------------------------------------------------------------------
+$eplug_icon = $eplug_folder."/images/icon_ldap.png";
+$eplug_caption =  "Configure Alt auth";
+
+// List of preferences -----------------------------------------------------------------------------------------------
+$eplug_prefs = "";
+
+// List of table names -----------------------------------------------------------------------------------------------
+$eplug_table_names = array(
+	"alt_auth"
+);
+
+// List of sql requests to create tables -----------------------------------------------------------------------------
+
+
+$eplug_tables = array(
+"CREATE TABLE ".MPREFIX."alt_auth (
+  auth_type varchar(20) NOT NULL default '',
+  auth_parmname varchar(30) NOT NULL default '',
+  auth_parmval varchar(120) NOT NULL default ''
+) TYPE=MyISAM;");
+
+
+
+// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
+$eplug_link = FALSE;
+$eplug_link_name = "";
+$eplug_link_url = "";
+
+
+// Text to display after plugin successfully installed ------------------------------------------------------------------
+$eplug_done = "Alt auth service is now set up.  You will now need to configure your preferred method.";
+
+?>	
diff -ruN 0.7.5/e107_plugins/alt_news/alt_news.php 0.7.7/e107_plugins/alt_news/alt_news.php
--- 0.7.5/e107_plugins/alt_news/alt_news.php	2005-12-28 10:12:59.000000000 -0600
+++ 0.7.7/e107_plugins/alt_news/alt_news.php	2006-06-02 08:59:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/alt_news/alt_news.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/28 16:12:59 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/06/02 13:59:40 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -56,7 +56,7 @@
 						$text .= "<a href='comment.php?comment.news.".$news_id."'>".$news_title."</a>";
 					}
 					$text .= "<br />
-						".LAN_100." ".$datestamp." (".LAN_99.": ";
+						".LAN_NEWS_100." ".$datestamp." (".LAN_NEWS_99.": ";
 					if ($news_allow_comments) {
 						$text .= COMMENTOFFSTRING.")";
 					} else {
@@ -66,9 +66,9 @@
 						".$news_body."
 						<br /><br />\n";
 				}
-				$text = "<img src='$category_icon' alt='' /><br />". LAN_307.$count."
+				$text = "<img src='$category_icon' alt='' /><br />". LAN_NEWS_307.$count."
 					<br /><br />".$text;
-				$ns->tablerender(LAN_82." '".$category_name."'", $text, 'alt_news');
+				$ns->tablerender(LAN_NEWS_82." '".$category_name."'", $text, 'alt_news');
 			}
 		}
 		return TRUE;
diff -ruN 0.7.5/e107_plugins/banner_menu/banner_menu.php 0.7.7/e107_plugins/banner_menu/banner_menu.php
--- 0.7.5/e107_plugins/banner_menu/banner_menu.php	2005-12-14 11:37:43.000000000 -0600
+++ 0.7.7/e107_plugins/banner_menu/banner_menu.php	2006-06-14 17:12:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/banner_menu/banner_menu.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2005/12/14 17:37:43 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2006/06/14 22:12:07 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -31,25 +31,51 @@
 */
 
 
-if(!isset($campaign))
-{
+global $THEMES_DIRECTORY;
+if (file_exists(THEME."banner_template.php")) {
+	require_once(THEME."banner_template.php");
+} else {
+	require_once(e_BASE.$THEMES_DIRECTORY."templates/banner_template.php");
+}
+
+if(isset($campaign)){
+	$parm = (isset($campaign) ? $campaign : "");
+	$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc");
+	$BANNER = eval($bannersccode);
+	$txt = $BANNER_MENU_START;
+	$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
+	$txt .= $BANNER_MENU_END;
+	
+}else{
 	if (isset($menu_pref['banner_campaign']) && $menu_pref['banner_campaign'])
 	{
 		if(strstr($menu_pref['banner_campaign'], "|"))
 		{
 			$campaignlist = explode("|", $menu_pref['banner_campaign']);
-			$campaignlist = array_slice($campaignlist, 0, -1);
-			$parm = $campaignlist[0];
+			$amount = ($menu_pref['banner_amount']<1 ? '1' : $menu_pref['banner_amount']);
+			$amount = ($amount > count($campaignlist) ? count($campaignlist) : $amount);
+			$keys = array_rand($campaignlist, $amount);
+			$parms = array();
+			foreach($keys as $k=>$v){
+				$parms[] = $campaignlist[$v];
+			}
 		}
 		else
 		{
-			$parm = $menu_pref['banner_campaign'];
+			$parms[] = $menu_pref['banner_campaign'];
 		}
 	}
+
+	$txt = $BANNER_MENU_START;
+	foreach($parms as $parm){
+		$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc");
+		$BANNER = eval($bannersccode);
+		$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
+	}
+	$txt .= $BANNER_MENU_END;
 }
 
-$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc");
-$text = eval($bannersccode);
+$text = $txt;
 
 if (isset($menu_pref['banner_rendertype']) && $menu_pref['banner_rendertype'] == 2)
 {
@@ -60,5 +86,4 @@
 	echo $text;
 }
 
-
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/banner_menu/config.php 0.7.7/e107_plugins/banner_menu/config.php
--- 0.7.5/e107_plugins/banner_menu/config.php	2005-10-30 07:58:48.000000000 -0600
+++ 0.7.7/e107_plugins/banner_menu/config.php	2006-10-24 08:41:21.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/banner_menu/config.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/10/30 13:58:48 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2006/10/24 13:41:21 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
@@ -115,7 +115,7 @@
 $catidvalues = substr($catidvalues, 0, -1);
 $text .= "</select><br /><br />
 	<input class='button' type='button' value='".BANNER_MENU_L9."' onclick='removeMe();' />
-	<input type='hidden' name='catid' id='catid' value='".$catidvalues."'>
+	<input type='hidden' name='catid' id='catid' value='".$catidvalues."' />
 	</td>
 	</tr>
 	</table>
diff -ruN 0.7.5/e107_plugins/banner_menu/languages/English.php 0.7.7/e107_plugins/banner_menu/languages/English.php
--- 0.7.5/e107_plugins/banner_menu/languages/English.php	2005-01-27 13:52:35.000000000 -0600
+++ 0.7.7/e107_plugins/banner_menu/languages/English.php	2006-06-22 14:49:56.000000000 -0500
@@ -4,15 +4,15 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/banner_menu/languages/English.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/01/27 19:52:35 $
-|     $Author: streaky $
+|     $Revision: 1.4 $
+|     $Date: 2006/06/22 19:49:56 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 define("BANNER_MENU_L1", "Advertisement");
 define("BANNER_MENU_L2", "Banner menu configuration saved");
-	
+
 //v.617
 define("BANNER_MENU_L3", "Caption");
 define("BANNER_MENU_L4", "Campaign");
@@ -25,10 +25,10 @@
 define("BANNER_MENU_L11", "choose render type ...");
 define("BANNER_MENU_L12", "one campaign in single menu");
 define("BANNER_MENU_L13", "all selected campaigns in single menu");
-define("BANNER_MENU_L14", "all selected campaigns in seperate menus");
+define("BANNER_MENU_L14", "all selected campaigns in separate menus");
 define("BANNER_MENU_L15", "how many banners should be shown ?");
 define("BANNER_MENU_L16", "this setting will only be used with options 2 and 3.<br />if less banners are present the maximum available amount will be used.");
 define("BANNER_MENU_L17", "set amount ...");
 define("BANNER_MENU_L18", "Update Menu Settings");
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/blogcalendar_menu/archive.php 0.7.7/e107_plugins/blogcalendar_menu/archive.php
--- 0.7.5/e107_plugins/blogcalendar_menu/archive.php	2005-12-28 10:12:59.000000000 -0600
+++ 0.7.7/e107_plugins/blogcalendar_menu/archive.php	2006-06-12 04:07:10.000000000 -0500
@@ -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.3 $
-|     $Date: 2005/12/28 16:12:59 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/06/12 09:07:10 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 | Based on code by: Thomas Bouve (crahan@gmx.net)
 */
@@ -72,28 +72,27 @@
 // ----------------------
 $year_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>";
 $year_selector .= "".BLOGCAL_ARCHIV1.": <select name='activate' onChange='urljump(this.options[selectedIndex].value)' class='tbox'>";
-	
+
 for($i = $start_year; $i <= $end_year; $i++) {
 	$start = mktime(0, 0, 0, 1, 1, intval($req_year));
 	$end = mktime(23, 59, 59, 12, 31, intval($req_year));
+	// create the option entry
+	$year_link = $prefix."/archive.php?year.".$i;
+	$year_selector .= "<option value='".$year_link."'";
+	if ($i == $req_year) {
+		$year_selector .= " selected";
+	}
 	if ($sql->db_Select("news", "news_id, news_datestamp, news_class", "news_datestamp > $start AND news_datestamp < $end")) {
-		// create the option entry
-		$year_link = $prefix."/archive.php?year.".$i;
-		$year_selector .= "<option value='".$year_link."'";
-		 
-		if ($i == $req_year) {
-			$year_selector .= " selected";
-			while ($news = $sql->db_Fetch()) {
-				if (check_class($news['news_class'])) {
-					list($xmonth, $xday) = explode(" ", date("n j", $news['news_datestamp']));
-					if (!$day_links[$xmonth][$xday]) {
-						$day_links[$xmonth][$xday] = e_BASE."news.php?day.".formatdate($req_year, $xmonth, $xday);
-					}
+		while ($news = $sql->db_Fetch()) {
+			if (check_class($news['news_class'])) {
+				list($xmonth, $xday) = explode(" ", date("n j", $news['news_datestamp']));
+				if (!$day_links[$xmonth][$xday]) {
+					$day_links[$xmonth][$xday] = e_BASE."news.php?day.".formatdate($req_year, $xmonth, $xday);
 				}
 			}
 		}
-		$year_selector .= ">".$i."</option>";
 	}
+	$year_selector .= ">".$i."</option>";
 }
 	
 $year_selector .= "</select>";
diff -ruN 0.7.5/e107_plugins/blogcalendar_menu/styles.php 0.7.7/e107_plugins/blogcalendar_menu/styles.php
--- 0.7.5/e107_plugins/blogcalendar_menu/styles.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/blogcalendar_menu/styles.php	2006-07-04 12:50:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/styles.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:43 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/07/04 17:50:19 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -21,29 +21,30 @@
 // -----------------------
 // blogcal menu style vars
 // -----------------------
-$bc_menu_wrapper = ;
-$menu_header = ;
-$menu_body = ;
-$menu_footer = ;
-	
-	
+$bc_menu_wrapper = "";
+$menu_header = "";
+$menu_body = "";
+$menu_footer = "";
+
+
 // --------------------------
 // calendar object style vars
 // --------------------------
-$cal_header_cell = ;
-$cal_blank_cell $cal_cell = ;
-$cal_linked_cell = ;
-$cal_hl_cell = ;
-$cal_hl_linked_cell = ;
-	
-	
+$cal_header_cell = "";
+$cal_blank_cell = "";
+$cal_cell = "";
+$cal_linked_cell = "";
+$cal_hl_cell = "";
+$cal_hl_linked_cell = "";
+
+
 // --------------------------
 // archive section style vars
 // --------------------------
-$arch_wrapper = ;
-$arch_header = ;
-$arch_cell = ;
-$arch_cell_header = ;
-$arch_cell_body = ;
-	
+$arch_wrapper = "";
+$arch_header = "";
+$arch_cell = "";
+$arch_cell_header = "";
+$arch_cell_body = "";
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/admin_config.php 0.7.7/e107_plugins/calendar_menu/admin_config.php
--- 0.7.5/e107_plugins/calendar_menu/admin_config.php	2006-04-07 10:31:47.000000000 -0500
+++ 0.7.7/e107_plugins/calendar_menu/admin_config.php	2006-11-16 04:24:14.000000000 -0600
@@ -11,86 +11,235 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/admin_config.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2006/04/07 15:31:47 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| 02.11.06 - Cache clear option added
+| 10.11.06 - Support for updated templates etc
+|
 +----------------------------------------------------------------------------+
 */
+$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");
 }
 	
-$lan_file = e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php");
+	
+include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+
+
+$message = "";
+$calendarmenu_text = '';	// Notice removal
+$calendarmenu_msg  = '';	// Notice removal
 
 if (isset($_POST['updatesettings'])) {
 	$pref['eventpost_admin'] = $_POST['eventpost_admin'];
-	$pref['eventpost_headercss'] = $_POST['eventpost_headercss'];
-	$pref['eventpost_daycss'] = $_POST['eventpost_daycss'];
-	$pref['eventpost_todaycss'] = $_POST['eventpost_todaycss'];
-	$pref['eventpost_evtoday'] = $_POST['eventpost_evtoday'];	
-	$pref['eventpost_addcat'] = $_POST['eventpost_addcat'];
+	$pref['eventpost_adminlog'] = $_POST['eventpost_adminlog'];
+	$pref['eventpost_showeventcount'] = $_POST['eventpost_showeventcount'];
 	$pref['eventpost_forum'] = $_POST['eventpost_forum'];	
+	$pref['eventpost_recentshow'] = $_POST['eventpost_recentshow'];
 	$pref['eventpost_super'] = $_POST['eventpost_super'];
+	$pref['eventpost_menulink'] = $_POST['eventpost_menulink'];
 	$pref['eventpost_dateformat'] = $_POST['eventpost_dateformat'];	
+	$pref['eventpost_fivemins'] = $_POST['eventpost_fivemins'];
 	$pref['eventpost_weekstart'] = $_POST['eventpost_weekstart'];
 	$pref['eventpost_lenday'] = $_POST['eventpost_lenday'];			
+	$pref['eventpost_caltime'] = $_POST['eventpost_caltime'];
+	$pref['eventpost_datedisplay'] = $_POST['eventpost_datedisplay'];
+	$pref['eventpost_timedisplay']	= $_POST['eventpost_timedisplay'];
+	$pref['eventpost_timecustom'] = $_POST['eventpost_timecustom'];
+	$pref['eventpost_dateevent'] = $_POST['eventpost_dateevent'];
+	$pref['eventpost_datenext'] = $_POST['eventpost_datenext'];
+	$pref['eventpost_eventdatecustom'] = $_POST['eventpost_eventdatecustom'];
+	$pref['eventpost_nextdatecustom'] = $_POST['eventpost_nextdatecustom'];
 	$pref['eventpost_mailsubject'] = $_POST['eventpost_mailsubject'];			
 	$pref['eventpost_mailfrom'] = $_POST['eventpost_mailfrom'];		
 	$pref['eventpost_mailaddress'] = $_POST['eventpost_mailaddress'];
 	$pref['eventpost_asubs'] = $_POST['eventpost_asubs'];
+	$pref['eventpost_emaillog'] = $_POST['eventpost_emaillog'];
 	save_prefs();
+	$e107cache->clear('nq_event_cal');		// Clear cache as well, in case displays changed
 	$message = EC_LAN_75; // "Calendar settings updated.";
 }
-	
+
+// ****************** FORTHCOMING EVENTS ******************
+if (isset($_POST['updateforthcoming']))
+{
+  $pref['eventpost_menuheading'] = $_POST['eventpost_fe_menuheading'];
+  $pref['eventpost_daysforward'] = $_POST['eventpost_fe_daysforward'];
+  $pref['eventpost_numevents'] = $_POST['eventpost_fe_numevents'];
+  $pref['eventpost_checkrecur'] = $_POST['eventpost_fe_checkrecur'];
+  $pref['eventpost_linkheader'] = $_POST['eventpost_fe_linkheader'];
+  $pref['eventpost_fe_set'] =  implode(",", $_POST['fe_eventclass']);
+  $pref['eventpost_showcaticon'] = $_POST['eventpost_showcaticon'];
+  $pref['eventpost_namelink'] = $_POST['eventpost_namelink'];
+  save_prefs();
+  $e107cache->clear('nq_event_cal');		// Clear cache as well, in case displays changed
+  $message = EC_ADLAN_A109; // "Forthcoming Events settings updated.";
+}
+
+if (e_QUERY) 
+{
+  $qs = explode(".", e_QUERY);
+}
+
+require_once('ecal_class.php');
+$ecal_class = new ecal_class;
+
+
+// ****************** MAINTENANCE ******************
+if (isset($_POST['deleteold']) && isset($_POST['eventpost_deleteoldmonths']))
+{
+  $back_count = $_POST['eventpost_deleteoldmonths'];
+  if (($back_count >= 1) && ($back_count <= 12))
+  {
+    $old_date = intval(mktime(0,0,0,$ecal_class->now_date['mon']-$back_count,1,$ecal_class->now_date['year']));
+	$old_string = strftime("%d %B %Y",$old_date);
+//	$message = "Back delete {$back_count} months. Oldest date = {$old_string}";
+	$qs[0] = "confdel";
+	$qs[1] = $old_date;
+  }
+  else
+    $message = EC_ADLAN_A148;
+}
+
+
+if (isset($_POST['cache_clear']))
+{
+  $qs[0] = "confcache";
+}
+
 require_once(e_ADMIN."auth.php");
 
-if (isset($message)) {
-	$ns->tablerender("", "<div style='text-align:center'><b>$message</b></div>");
+
+
+
+// Actually delete back events
+if (isset($_POST['confirmdeleteold']) && isset($qs[0]) && ($qs[0] == "backdel"))
+{
+  $old_date = $qs[1];
+  $old_string = strftime("%d %B %Y",$old_date);
+	// Check both start and end dates to avoid problems with events originally entered under 0.617
+  $qry = "event_start < {$old_date} AND event_end < {$old_date} AND event_recurring = 0";
+//  $message = "Back delete {$back_count} months. Oldest date = {$old_string}  Query = {$qry}";
+	if ($sql -> db_Delete("event",$qry))
+	{
+  // Add in a log event
+	  $ecal_class->cal_log(4,'db_Delete - earlier than {$old_string} (past {$back_count} months)',$qry);
+      $message = EC_ADLAN_A146.$old_string.EC_ADLAN_A147;
+	}
+	else
+	{
+	  $message = EC_ADLAN_A149." : ".$sql->mySQLresult;
+	}
+
+  $qs[0] = "maint";
+}
+
+
+// Actually empty cache
+if (isset($_POST['confirmdelcache']) && isset($qs[0]) &&($qs[0] == "cachedel"))
+{
+  $e107cache->clear('nq_event_cal');
+  $message = EC_ADLAN_A163;
+  $qs[0] = "maint";			// Re-display maintenance menu
+}
+
+
+// Prompt to delete back events
+if(isset($qs[0]) && ($qs[0] == "confdel"))
+{
+	$old_string = strftime("%d %B %Y",$qs[1]);
+	$text = "<div style='text-align:center'>
+	<form method='post' action='".e_SELF."?backdel.{$qs[1]}'>
+	<table style='width:97%' class='fborder'>
+	<tr>
+		<td class='forumheader3' style='width:100%;vertical-align:top;rext-align:center;'>".EC_ADLAN_A150.$old_string." </td>
+	</tr>
+	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='confirmdeleteold' value='".EC_LAN_50."' /></td></tr>
+	</table></form></div>";
+	
+	$ns->tablerender("<div style='text-align:center'>".EC_LAN_50."</div>", $text);
+}
+
+
+// Prompt to clear cache
+if (isset($qs[0]) && ($qs[0] == "confcache"))
+{
+	$text = "<div style='text-align:center'>
+	<form method='post' action='".e_SELF."?cachedel'>
+	<table style='width:97%' class='fborder'>
+	<tr>
+		<td class='forumheader3' style='width:100%;vertical-align:top;rext-align:center;'>".EC_ADLAN_A162." </td>
+	</tr>
+	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='confirmdelcache' value='".EC_LAN_50."' /></td></tr>
+	</table></form></div>";
+	
+	$ns->tablerender("<div style='text-align:center'>".EC_LAN_50."</div>", $text);
 }
 
-if (e_QUERY) {
-	$qs = explode(".", e_QUERY);
+
+if (isset($message)) 
+{
+  $ns->tablerender("", "<div style='text-align:center'><b>$message</b></div>");
 }
 
+
+
 //category
-if(isset($qs[0]) && $qs[0] == "cat"){
+if(isset($qs[0]) && $qs[0] == "cat")
+{
 	$calendarmenu_db = new DB;
-	$calendarmenu_action = $_POST['calendarmenu_action'];
+	$calendarmenu_action = '';
+	if (isset($_POST['calendarmenu_action'])) $calendarmenu_action = $_POST['calendarmenu_action'];
 	$calendarmenu_edit = FALSE;
 	// * If we are updating then update or insert the record
-	if ($calendarmenu_action == 'update'){
+	if ($calendarmenu_action == 'update')
+	{
 		$calendarmenu_id = $_POST['calendarmenu_id'];
-		if ($calendarmenu_id == 0){ 
+		if ($calendarmenu_id == 0)
+		{ 
 			// New record so add it
-			$calendarmenu_args = "
-			'0',
-			'".$_POST['event_cat_name']."',
-			'".$_POST['ne_new_category_icon']."',
-			'".intval($_POST['event_cat_class'])."',
-			'".intval($_POST['event_cat_subs'])."',
-			'".intval($_POST['event_cat_force'])."',
-			'".intval($_POST['event_cat_ahead'])."',
-			'".$_POST['event_cat_msg1']."',
-			'".$_POST['event_cat_msg2']."',
-			'".intval($_POST['event_cat_notify'])."',
-			'0','0','".time()."',
-			'".intval($_POST['event_cat_addclass'])."'";
-			if ($calendarmenu_db->db_Insert("event_cat", $calendarmenu_args)){
-				$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A26."</strong></td></tr>";
-			}else{
-				$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A27."</strong></td></tr>";
+			// Enumerate fields so it doesn't matter if they're in the wrong order.
+			// db_Insert can take an array of key => value pairs
+			$calendarmenu_args = array (
+			'event_cat_id'			=> 0,
+			'event_cat_name'		=> $_POST['event_cat_name'],
+			'event_cat_description'	=> $_POST['event_cat_description'],
+			'event_cat_icon'		=> $_POST['ne_new_category_icon'],
+			'event_cat_class'		=> intval($_POST['event_cat_class']),
+			'event_cat_subs'		=> intval($_POST['event_cat_subs']),
+			'event_cat_force_class'	=> intval($_POST['event_cat_force_class']),
+			'event_cat_ahead'		=> intval($_POST['event_cat_ahead']),
+			'event_cat_msg1'		=> $_POST['event_cat_msg1'],
+			'event_cat_msg2'		=> $_POST['event_cat_msg2'],
+			'event_cat_notify'		=> intval($_POST['event_cat_notify']),
+			'event_cat_lastupdate'	=> intval(time()),
+			'event_cat_addclass'	=>  intval($_POST['event_cat_addclass'])
+			);
+
+			if ($calendarmenu_db->db_Insert("event_cat", $calendarmenu_args))
+			{
+			  $calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A26."</strong></td></tr>";
+			}
+			else
+			{
+			  $calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A27."</strong></td></tr>";
 			} 
-		}else{ 
+		}
+		else
+		{ 
 			// Update existing
 			$calendarmenu_args = "
 			event_cat_name='".$_POST['event_cat_name']."',
+			event_cat_description='".$_POST['event_cat_description']."',
 			event_cat_class='".intval($_POST['event_cat_class'])."',
 			event_cat_icon='".$_POST['ne_new_category_icon']."',
 			event_cat_subs='".intval($_POST['event_cat_subs'])."',
-			event_cat_force='".intval($_POST['event_cat_force'])."',
+			event_cat_force_class='".intval($_POST['event_cat_force_class'])."',
 			event_cat_ahead='".intval($_POST['event_cat_ahead'])."',
 			event_cat_msg1='".$_POST['event_cat_msg1']."',
 			event_cat_msg2='".$_POST['event_cat_msg2']."',
@@ -107,12 +256,14 @@
 		} 
 	} 
 	// We are creating, editing or deleting a record
-	if ($calendarmenu_action == 'dothings'){
+	if ($calendarmenu_action == 'dothings')
+	{
 		$calendarmenu_id = $_POST['calendarmenu_selcat'];
 		$calendarmenu_do = $_POST['calendarmenu_recdel'];
 		$calendarmenu_dodel = false;
 
-		switch ($calendarmenu_do){
+		switch ($calendarmenu_do)
+		{
 			case '1': // Edit existing record
 				{
 					// We edit the record
@@ -155,7 +306,8 @@
 				} 
 		} 
 
-		if (!$calendarmenu_dodel){
+		if (!$calendarmenu_dodel)
+		{
 			require_once(e_HANDLER."file_class.php");
 			
 			
@@ -163,15 +315,19 @@
 			<form id='calformupdate' method='post' action='".e_SELF."?cat'>
 			<table style='width:97%;' class='fborder'>
 			<tr>
-				<td colspan='2' class='fcaption'>$calendarmenu_cap1
-					<input type='hidden' value='$calendarmenu_id' name='calendarmenu_id' />
+				<td colspan='2' class='fcaption'>{$calendarmenu_cap1}
+					<input type='hidden' value='{$calendarmenu_id}' name='calendarmenu_id' />
 					<input type='hidden' value='update' name='calendarmenu_action' />
 				</td>
 			</tr>
-			$calendarmenu_msg
+			{$calendarmenu_msg}
 			<tr>
 				<td style='width:20%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A21."</td>
-				<td class='forumheader3'><input type='text' class='tbox' name='event_cat_name' value='$event_cat_name' /></td>
+				<td class='forumheader3'><input type='text' style='width:150px' class='tbox' name='event_cat_name' value='{$event_cat_name}' /></td>
+			</tr>
+			<tr>
+				<td style='width:20%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A121."</td>
+				<td class='forumheader3'><textarea rows='5' cols='60' class='tbox' name='event_cat_description' >".$event_cat_description."</textarea></td>
 			</tr>
 			<tr>
 				<td style='width:20%' class='forumheader3'>".EC_ADLAN_A80."</td>
@@ -208,40 +364,47 @@
 				<option value='1' ".($event_cat_notify == 1?" selected='selected'":"")." >".EC_ADLAN_A88."</option>
 				<option value='2' ".($event_cat_notify == 2?" selected='selected'":"")." >".EC_ADLAN_A89."</option>
 				<option value='3' ".($event_cat_notify == 3?" selected='selected'":"")." >".EC_ADLAN_A90."</option>
+				<option value='4' ".($event_cat_notify == 4?" selected='selected'":"")." >".EC_ADLAN_A110."</option>
+				<option value='5' ".($event_cat_notify == 5?" selected='selected'":"")." >".EC_ADLAN_A111."</option>
 				</select>		
 				</td>
 			</tr>
 			<tr>
-				<td class='forumheader3' style='width:20%'>".EC_ADLAN_A82."</td>
-				<td class='forumheader3'><input type='checkbox' class='tbox' name='event_cat_force' value='1' ".($event_cat_force > 0?"checked='checked'":"")." />
-				<br /><em>".EC_ADLAN_A97."</em></td>
-			</tr>
+				<td style='width:20%' class='forumheader3'>".EC_ADLAN_A82."</td>
+				<td style='width:80%' class='forumheader3'>".r_userclass("event_cat_force_class", $event_cat_force_class, "off", 'nobody, member, admin, classes')."</td>
+			</tr>			
 			<tr>
 				<td class='forumheader3' style='width:20%'>".EC_ADLAN_A83."</td>
 				<td class='forumheader3'><input type='text' size='4' maxlength='5' class='tbox' name='event_cat_ahead' value='$event_cat_ahead'  /></td>
 			</tr>
 			<tr>
 				<td class='forumheader3' style='width:20%;vertical-align:top;'>".EC_ADLAN_A84."</td>
-				<td class='forumheader3'><textarea rows='5' cols='60' class='tbox' name='event_cat_msg1' >".$event_cat_msg1."</textarea></td>
+				<td class='forumheader3'><textarea rows='5' cols='80' class='tbox' name='event_cat_msg1' >".$event_cat_msg1."</textarea></td>
 			</tr>
 			<tr>
-				<td class='forumheader3' style='width:20%;vertical-align:top;'>".EC_ADLAN_A85."</td>
-				<td class='forumheader3'><textarea rows='5' cols='60' class='tbox' name='event_cat_msg2' >".$event_cat_msg2."</textarea></td>
+				<td class='forumheader3' style='width:20%;vertical-align:top;'>".EC_ADLAN_A117."</td>
+				<td class='forumheader3'><textarea rows='5' cols='80' class='tbox' name='event_cat_msg2' >".$event_cat_msg2."</textarea></td>
 			</tr>			
-			<tr><td colspan='2' class='fcaption'><input type='submit' name='submits' value='".EC_ADLAN_A25."' class='tbox' /></td></tr>
+			<tr><td colspan='2' style='text-align:center' class='fcaption'><input type='submit' name='submits' value='".EC_LAN_77."' class='tbox' /></td></tr>
 			</table>
 			</form>";
 		} 
 	} 
-	if (!$calendarmenu_edit){ 
+	if (!$calendarmenu_edit)
+	{ 
 		// Get the category names to display in combo box then display actions available
 		$calendarmenu2_db = new DB;
-		if ($calendarmenu2_db->db_Select("event_cat", "event_cat_id,event_cat_name", " order by event_cat_name", "nowhere")){
+		$calendarmenu_catopt = '';
+		if (!isset($calendarmenu_id)) $calendarmenu_id = -1;
+		if ($calendarmenu2_db->db_Select("event_cat", "event_cat_id,event_cat_name", " order by event_cat_name", "nowhere"))
+		{
 			while ($row = $calendarmenu2_db->db_Fetch()){
 				//extract($calendarmenu_row);
 				$calendarmenu_catopt .= "<option value='".$row['event_cat_id']."' ".($calendarmenu_id == $row['event_cat_id'] ?" selected='selected'":"")." >".$row['event_cat_name']."</option>";
 			} 
-		}else{
+		}
+		else
+		{
 			$calendarmenu_catopt .= "<option value=0'>".EC_ADLAN_A33."</option>";
 		} 
 
@@ -252,10 +415,10 @@
 		<tr>
 			<td colspan='2' class='fcaption'>".EC_ADLAN_A11."<input type='hidden' value='dothings' name='calendarmenu_action' /></td>
 		</tr>
-		$calendarmenu_msg
+		{$calendarmenu_msg}
 		<tr>
 			<td style='width:20%' class='forumheader3'>".EC_ADLAN_A11."</td>
-			<td class='forumheader3'><select name='calendarmenu_selcat' class='tbox'>$calendarmenu_catopt</select></td>
+			<td class='forumheader3'><select name='calendarmenu_selcat' class='tbox'>{$calendarmenu_catopt}</select></td>
 		</tr>
 		<tr>
 			<td style='width:20%' class='forumheader3'>".EC_ADLAN_A18."</td>
@@ -272,11 +435,157 @@
 		</table>
 		</form>";
 	}
-	if(isset($calendarmenu_text)){
-		$ns->tablerender(EC_ADLAN_A19, $calendarmenu_text);
+	if(isset($calendarmenu_text))
+	{
+	  $ns->tablerender(EC_ADLAN_A19, $calendarmenu_text);
+	}
+}
+
+// ====================================================
+//			FORTHCOMING EVENTS OPTIONS
+// ====================================================
+
+if((isset($qs[0]) && $qs[0] == "forthcoming"))
+{
+
+if (!isset($pref['eventpost_menuheading'])) $pref['eventpost_menuheading'] = EC_ADLAN_A100;
+if (!isset($pref['eventpost_daysforward'])) $pref['eventpost_daysforward'] = 30;
+if (!isset($pref['eventpost_numevents']))   $pref['eventpost_numevents'] = 3;
+if (!isset($pref['eventpost_checkrecur']))  $pref['eventpost_checkrecur'] = '1';
+if (!isset($pref['eventpost_linkheader']))  $pref['eventpost_linkheader'] = '0';
+if (!isset($pref['eventpost_namelink']))    $pref['eventpost_namelink'] = '1';
+
+	$text = "<div style='text-align:center'>
+	<form method='post' action='".e_SELF."?forthcoming'>
+	<table style='width:97%' class='fborder'>
+	<tr><td style='vertical-align:top;' colspan='2' class='fcaption'>".EC_ADLAN_A100." </td></tr>
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A108."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_fe_menuheading' size='35' value='".$pref['eventpost_menuheading']."' maxlength='30' />
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A101."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_fe_daysforward' size='20' value='".$pref['eventpost_daysforward']."' maxlength='10' />
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A102."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_fe_numevents' size='20' value='".$pref['eventpost_numevents']."' maxlength='10' />
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A103."<br /><span class='smalltext'><em>".EC_ADLAN_A107."</em></span></td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_fe_checkrecur' value='1' ".($pref['eventpost_checkrecur']==1?" checked='checked' ":"")." /></td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A130."<br /></td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_namelink' class='tbox'>
+			<option value='1' ".($pref['eventpost_namelink']=='1'?" selected='selected' ":"")." > ".EC_ADLAN_A131." </option>
+			<option value='2' ".($pref['eventpost_namelink']=='2'?" selected='selected' ":"")." > ".EC_ADLAN_A132." </option>
+			</select>
+		</td>
+	</tr>
+	
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A104."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_fe_linkheader' value='1' ".($pref['eventpost_linkheader']==1?" checked='checked' ":"")." />
+		</td>
+	</tr>
+	
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A120."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_showcaticon' value='1' ".($pref['eventpost_showcaticon']==1?" checked='checked' ":"")." />
+		</td>
+	</tr>
+	
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A118."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>";
+
+// Now display all the current categories as checkboxes
+	$cal_fe_prefs = array();
+    if (isset($pref['eventpost_fe_set'])) $cal_fe_prefs = array_flip(explode(",",$pref['eventpost_fe_set']));
+	if (!is_object($calendarmenu2_db)) $calendarmenu2_db = new DB;		// Possible notice here
+	if ($calendarmenu2_db->db_Select("event_cat", "event_cat_id,event_cat_name", " order by event_cat_name", "nowhere"))
+	{
+	  while ($row = $calendarmenu2_db->db_Fetch())
+	  {
+	    $selected = isset($cal_fe_prefs[$row['event_cat_id']]);
+		$text .= "<input type='checkbox' name='fe_eventclass[]' value='".$row['event_cat_id'].($selected == 1?"' checked='checked'":"'")." />".$row['event_cat_name']."<br /> ";
+	  } 
 	}
+	else
+	{
+	  $text .= EC_ADLAN_A119;		// No categories, or error
+	} 
+  
+	$text .= "</td>
+	</tr>
+	
+	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='updateforthcoming' value='".EC_LAN_77."' /></td></tr>
+	</table>
+	</form>
+	</div>";
+	
+	$ns->tablerender("<div style='text-align:center'>".EC_ADLAN_A100."</div>", $text);
+}   // End of Forthcoming Events Menu Options
+
+
+// ====================================================
+//			MAINTENANCE OPTIONS
+// ====================================================
+
+if((isset($qs[0]) && $qs[0] == "maint"))
+{
+	$text = "<div style='text-align:center'>
+	<form method='post' action='".e_SELF."?maint'>
+	<table style='width:97%' class='fborder'>
+	<tr><td style='vertical-align:top;' colspan='2' class='fcaption'>".EC_ADLAN_A144." </td></tr>
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A142." </td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_deleteoldmonths' class='tbox'>
+			<option value='12' selected='selected'>12</option>
+			<option value='11'>11</option>
+			<option value='10'>10</option>
+			<option value='9'>9</option>
+			<option value='8'>8</option>
+			<option value='7'>7</option>
+			<option value='6'>6</option>
+			<option value='5'>5</option>
+			<option value='4'>4</option>
+			<option value='3'>3</option>
+			<option value='2'>2</option>
+			<option value='1'>1</option>
+			</select>
+			<span class='smalltext'><em>".EC_ADLAN_A143."</em></span>
+		</td>
+	</tr>
+	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='deleteold' value='".EC_ADLAN_A145."' /></td></tr>
+	</table></form></div><br /><br />";
+	
+	$ns->tablerender("<div style='text-align:center'>".EC_ADLAN_A144."</div>", $text);
+
+	$text = "<div style='text-align:center'>
+	<form method='post' action='".e_SELF."?maint'>
+	<table style='width:97%' class='fborder'>
+	<tr><td style='vertical-align:top; text-align:center;' colspan='2' class='smalltext'><em>".EC_ADLAN_A160."</em> </td></tr>
+	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='cache_clear' value='".EC_ADLAN_A161."' /></td></tr>
+	</table></form></div>";
+	
+	$ns->tablerender("<div style='text-align:center'>".EC_ADLAN_A159."</div>", $text);
+
 }
 
+// ========================================================
+//				MAIN OPTIONS MENU
+// ========================================================
 
 
 if(!isset($qs[0]) || (isset($qs[0]) && $qs[0] == "config")){
@@ -289,45 +598,53 @@
 		<td style='width:60%;vertical-align:top;' class='forumheader3'>". r_userclass("eventpost_admin", $pref['eventpost_admin'], "off", 'public, nobody, member, admin, classes')."
 		</td>
 	</tr>
-	<tr>
-		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_100." </td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'>". r_userclass("eventpost_addcat", $pref['eventpost_addcat'], "off",  'public, nobody, member, admin, classes')."
-		<br /><em>".EC_LAN_101."</em>
-		</td>
-	</tr>
+	";
+$text .= "
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_104." </td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'>". r_userclass("eventpost_super", $pref['eventpost_super'], "off",  'public, nobody, member, admin, classes')."
 		</td>
 	</tr>
-	<tr>
-		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_84."<br /><span class='smalltext'><em>".EC_LAN_85."</em></span></td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_headercss' size='20' value='".$pref['eventpost_headercss']."' maxlength='100' />
-		</td>
-	</tr>
 
 	<tr>
-		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_86."<br /><span class='smalltext'><em>".EC_LAN_87."</em></span></td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_daycss' size='20' value='".$pref['eventpost_daycss']."' maxlength='100' />
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A134."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_adminlog' class='tbox'>
+			<option value='0' ".($pref['eventpost_adminlog']=='0'?" selected='selected' ":"")." >". EC_ADLAN_A87." </option>
+			<option value='1' ".($pref['eventpost_adminlog']=='1'?" selected='selected' ":"")." >".EC_ADLAN_A135." </option>
+			<option value='2' ".($pref['eventpost_adminlog']=='2'?" selected='selected' ":"")." >".EC_ADLAN_A136." </option>
+			</select>
+			<span class='smalltext'><em>".EC_ADLAN_A137."</em></span>
 		</td>
 	</tr>
 
 	<tr>
-		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_88."<br /><span class='smalltext'><em>".EC_LAN_89."</em></span></td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_todaycss' size='20' value='".$pref['eventpost_todaycss']."' maxlength='100' />
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A165."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_menulink' class='tbox'>
+			<option value='0' ".($pref['eventpost_menulink']=='0'?" selected='selected' ":"")." >".EC_LAN_80." </option>
+			<option value='1' ".($pref['eventpost_menulink']=='1'?" selected='selected' ":"")." >".EC_LAN_83." </option>
+			</select>
 		</td>
 	</tr>
 
 	<tr>
-		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_122."<br /><span class='smalltext'><em>".EC_LAN_89."</em></span></td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_evtoday' size='20' value='".$pref['eventpost_evtoday']."' maxlength='100' />
-		</td>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A140."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_showeventcount' value='1' ".($pref['eventpost_showeventcount']==1?" checked='checked' ":"")." /></td>
 	</tr>
 
 	<tr>
-		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_102."<br /><span class='smalltext'><em>".EC_LAN_103."</em></span></td>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_102."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_forum' value='1' ".($pref['eventpost_forum']==1?" checked='checked' ":"")." /></td>
 	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A171."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_recentshow' size='10' value='".$pref['eventpost_recentshow']."' maxlength='5' />
+		<span class='smalltext'><em>".EC_ADLAN_A172."</em></span>
+		</td>
+	</tr>  
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_114."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'>
@@ -347,6 +664,7 @@
 			</select>
 		</td>
 	</tr>
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_118."<br /></td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'>
@@ -356,32 +674,123 @@
 			</select>
 		</td>
 	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A133."<br /></td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_datedisplay' class='tbox'>
+			<option value='1' ".($pref['eventpost_datedisplay']=='1'?" selected='selected' ":"")." > yyyy-mm-dd </option>
+			<option value='2' ".($pref['eventpost_datedisplay']=='2'?" selected='selected' ":"")." > dd-mm-yyyy</option>
+			<option value='3' ".($pref['eventpost_datedisplay']=='3'?" selected='selected' ":"")." > mm-dd-yyyy</option>
+			</select>
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A138."</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_fivemins' value='1' ".($pref['eventpost_fivemins']==1?" checked='checked' ":"")." />&nbsp;&nbsp;<span class='smalltext'><em>".EC_ADLAN_A139."</em></span>
+		</td>
+	</tr>
 	
 	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A122."<br />
+		<span class='smalltext'><em>".EC_ADLAN_A124."</em></span>".$ecal_class->time_string($ecal_class->time_now)."<br />
+		<span class='smalltext'><em>".EC_ADLAN_A125."</em></span>".$ecal_class->time_string($ecal_class->site_timedate)."<br />
+		<span class='smalltext'><em>".EC_ADLAN_A126."</em></span>".$ecal_class->time_string($ecal_class->user_timedate)."
+		</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_caltime' class='tbox'>
+			<option value='1' ".($pref['eventpost_caltime']=='1'?" selected='selected' ":"")." > Server </option>
+			<option value='2' ".($pref['eventpost_caltime']=='2'?" selected='selected' ":"")." > Site </option>
+			<option value='3' ".($pref['eventpost_caltime']=='3'?" selected='selected' ":"")." > User </option>
+			</select><br /><span class='smalltext'><em>".EC_ADLAN_A129."</em></span>
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A123."<br />
+		<span class='smalltext'><em>".EC_ADLAN_A127."</em></span>
+		</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_timedisplay' class='tbox'>
+			<option value='1' ".($pref['eventpost_timedisplay']=='1'?" selected='selected' ":"")." > 24-hour </option>
+			<option value='2' ".($pref['eventpost_timedisplay']=='2'?" selected='selected' ":"")." > 12-hour </option>
+			<option value='3' ".($pref['eventpost_timedisplay']=='3'?" selected='selected' ":"")." > Custom </option>
+			</select>
+            <input class='tbox' type='text' name='eventpost_timecustom' size='20' value='".$pref['eventpost_timecustom']."' maxlength='30' />
+			<br /><span class='smalltext'><em>".EC_ADLAN_A128."</em></span>
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A166."<br />
+		<span class='smalltext'><em>".EC_ADLAN_A169."</em></span>
+		</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_dateevent' class='tbox'>
+			<option value='1' ".($pref['eventpost_dateevent']=='1'?" selected='selected' ":"")." > dayofweek day month yyyy </option>
+			<option value='2' ".($pref['eventpost_dateevent']=='2'?" selected='selected' ":"")." > dyofwk day mon yyyy </option>
+			<option value='3' ".($pref['eventpost_dateevent']=='3'?" selected='selected' ":"")." > dyofwk dd-mm-yy </option>
+			<option value='0' ".($pref['eventpost_dateevent']=='0'?" selected='selected' ":"")." > Custom </option>
+			</select>
+            <input class='tbox' type='text' name='eventpost_eventdatecustom' size='20' value='".$pref['eventpost_eventdatecustom']."' maxlength='30' />
+			<br /><span class='smalltext'><em>".EC_ADLAN_A168."</em></span>
+		</td>
+	</tr>
+
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A167."<br />
+		<span class='smalltext'><em>".EC_ADLAN_A170."</em></span>
+		</td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_datenext' class='tbox'>
+			<option value='1' ".($pref['eventpost_datenext']=='1'?" selected='selected' ":"")." > dd month </option>
+			<option value='2' ".($pref['eventpost_datenext']=='2'?" selected='selected' ":"")." > dd mon </option>
+			<option value='3' ".($pref['eventpost_datenext']=='3'?" selected='selected' ":"")." > month dd </option>
+			<option value='4' ".($pref['eventpost_datenext']=='4'?" selected='selected' ":"")." > mon dd </option>
+			<option value='0' ".($pref['eventpost_datenext']=='0'?" selected='selected' ":"")." > Custom </option>
+			</select>
+            <input class='tbox' type='text' name='eventpost_nextdatecustom' size='20' value='".$pref['eventpost_nextdatecustom']."' maxlength='30' />
+			<br /><span class='smalltext'><em>".EC_ADLAN_A168."</em></span>
+		</td>
+	</tr>
+
+	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A95."</td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_asubs' value='1' ".($pref['eventpost_asubs']==1?" checked='checked' ":"")." /><br /><span class='smalltext'><em>".EC_ADLAN_A96."</em></span>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_asubs' value='1' ".($pref['eventpost_asubs']==1?" checked='checked' ":"")." />&nbsp;&nbsp;<span class='smalltext'><em>".EC_ADLAN_A96."</em></span>
 		</td>
 	</tr>
 	
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A92."</td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailfrom' size='40' value='".$pref['eventpost_mailfrom']."' maxlength='100' />
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailfrom' size='60' value='".$pref['eventpost_mailfrom']."' maxlength='100' />
 		</td>
 	</tr>  
 
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A91."</td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailsubject' size='40' value='".$pref['eventpost_mailsubject']."' maxlength='100' />
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailsubject' size='60' value='".$pref['eventpost_mailsubject']."' maxlength='100' />
 		</td>
 	</tr>  
 
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A93."</td>
-		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailaddress' size='40' value='".$pref['eventpost_mailaddress']."' maxlength='100' />
+		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailaddress' size='60' value='".$pref['eventpost_mailaddress']."' maxlength='100' />
 		</td>
 	</tr>  
 
-	<tr><td colspan='2'  style='text-align:left' class='fcaption'><input class='button' type='submit' name='updatesettings' value='".EC_LAN_77."' /></td></tr>
+	<tr>
+		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A114."<br /></td>
+		<td style='width:60%;vertical-align:top;' class='forumheader3'>
+			<select name='eventpost_emaillog' class='tbox'>
+			<option value='0' ".($pref['eventpost_emaillog']=='0'?" selected='selected' ":"")." >". EC_ADLAN_A87." </option>
+			<option value='1' ".($pref['eventpost_emaillog']=='1'?" selected='selected' ":"")." >".EC_ADLAN_A115."  </option>
+			<option value='2' ".($pref['eventpost_emaillog']=='2'?" selected='selected' ":"")." >".EC_ADLAN_A116." </option>
+			</select>
+		</td>
+	</tr>
+
+	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='updatesettings' value='".EC_LAN_77."' /></td></tr>
 	</table>
 	</form>
 	</div>";
@@ -390,21 +799,28 @@
 }
 
 
-function admin_config_adminmenu(){
+function admin_config_adminmenu()
+{
 		if (e_QUERY) {
 			$tmp = explode(".", e_QUERY);
 			$action = $tmp[0];
 		}
-		if ($action == "") {
-			$action = "config";
+		if (!isset($action) || ($action == ""))
+		{
+		  $action = "config";
 		}
 		$var['config']['text'] = EC_ADLAN_A10;
 		$var['config']['link'] = "admin_config.php";
 			
 		$var['cat']['text'] = EC_ADLAN_A11;
-		//$var['cat']['link'] ="admin_cat.php?cat";
 		$var['cat']['link'] ="admin_config.php?cat";
+		
+		$var['forthcoming']['text'] = EC_ADLAN_A100;
+		$var['forthcoming']['link'] ="admin_config.php?forthcoming";
 
+		$var['maint']['text'] = EC_ADLAN_A141;
+		$var['maint']['link'] ="admin_config.php?maint";
+		
 		show_admin_menu(EC_ADLAN_A12, $action, $var);
 }
 
diff -ruN 0.7.5/e107_plugins/calendar_menu/calendar.php 0.7.7/e107_plugins/calendar_menu/calendar.php
--- 0.7.5/e107_plugins/calendar_menu/calendar.php	2006-01-14 06:02:10.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/calendar.php	2006-11-16 04:24:14.000000000 -0600
@@ -11,9 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/01/14 12:02:10 $
-|     $Author: lisa_ $
+|     $Revision: 1.19 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| 11.11.06 - steved - mods for next CVS release
+|
 +----------------------------------------------------------------------------+
 */ 
 
@@ -33,37 +36,46 @@
     Header("Location: " . e_PLUGIN . "calendar_menu/subscribe.php");
 } 
 
-$ec_dir		= e_PLUGIN . "calendar_menu/";
-$lan_file	= $ec_dir . "languages/" . e_LANGUAGE . ".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN . "calendar_menu/languages/English.php");
+@include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
 define("PAGE_NAME", EC_LAN_121);
 
-if (is_readable(THEME."calendar_template.php")) {
-	require_once(THEME."calendar_template.php");
-	} else {
-	require_once(e_PLUGIN."calendar_menu/calendar_template.php");
+require_once('ecal_class.php');
+$ecal_class = new ecal_class;
+
+if (is_readable(THEME."calendar_template.php")) 
+{
+  require(THEME."calendar_template.php");
+}
+else 
+{
+  require(e_PLUGIN."calendar_menu/calendar_template.php");
+}
+
+$num = (isset($_POST['num']) && $_POST['num'] ? $_POST['num'] : "");
+
+
+$category_filter = "";
+if  ((isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] != "all"))
+{
+  $category_filter = " AND (e.event_category = '".$_POST['event_cat_ids']."') ";
 }
 
-$cal_super	= check_class($pref['eventpost_super']);
-$num		= (isset($_POST['num']) && $_POST['num'] ? $_POST['num'] : "");
 
 require_once(HEADERF);
 
 // get current date information ---------------------------------------------------------------------
 $qs = explode(".", e_QUERY);
 if($qs[0] == "")
-{
-    $datearray	= getdate();
-    $month		= $datearray['mon'];
-    $year		= $datearray['year'];
-    $day		= $datearray['mday'];
+{	// Show current month
+  $datearray	= $ecal_class->cal_date;
 } 
 else
-{
-    $datearray	= getdate($qs[0]);
-    $month		= $datearray['mon'];
-    $year		= $datearray['year'];
+{	// Get date from query
+  $datearray	= getdate($qs[0]);
 }
+  $month	= $datearray['mon'];
+  $year		= $datearray['year'];
+
 
 // set up arrays for calender display ------------------------------------------------------------------
 if($pref['eventpost_weekstart'] == 'sun') {
@@ -77,10 +89,9 @@
 $days = array(EC_LAN_DAY_1, EC_LAN_DAY_2, EC_LAN_DAY_3, EC_LAN_DAY_4, EC_LAN_DAY_5, EC_LAN_DAY_6, EC_LAN_DAY_7, EC_LAN_DAY_8, EC_LAN_DAY_9, EC_LAN_DAY_10, EC_LAN_DAY_11, EC_LAN_DAY_12, EC_LAN_DAY_13, EC_LAN_DAY_14, EC_LAN_DAY_15, EC_LAN_DAY_16, EC_LAN_DAY_17, EC_LAN_DAY_18, EC_LAN_DAY_19, EC_LAN_DAY_20, EC_LAN_DAY_21, EC_LAN_DAY_22, EC_LAN_DAY_23, EC_LAN_DAY_24, EC_LAN_DAY_25, EC_LAN_DAY_26, EC_LAN_DAY_27, EC_LAN_DAY_28, EC_LAN_DAY_29, EC_LAN_DAY_30, EC_LAN_DAY_31);
 
 // show events-------------------------------------------------------------------------------------------
-$monthstart		= mktime(0, 0, 0, $month, 1, $year);
+$monthstart		= mktime(0, 0, 0, $month, 1, $year);		// Start of month to be shown
 $firstdayarray	= getdate($monthstart);
-$monthend		= mktime(0, 0, 0, $month + 1, 1, $year) - 1;
-$lastdayarray	= getdate($monthend);
+$monthend		= mktime(0, 0, 0, $month + 1, 1, $year) - 1;	// End of month to be shown
 
 $prevmonth		= ($month-1);
 $prevyear		= $year;
@@ -89,7 +100,7 @@
     $prevmonth	= 12;
     $prevyear	= ($year-1);
 } 
-$previous = mktime(0, 0, 0, $prevmonth, 1, $prevyear);
+$previous = mktime(0, 0, 0, $prevmonth, 1, $prevyear);		// Used by nav
 
 $nextmonth		= ($month + 1);
 $nextyear		= $year;
@@ -104,12 +115,10 @@
 $ny				= $year + 1;
 $nextlink		= mktime(0, 0, 0, $month, 1, $ny);
 
-$prop		= mktime(0, 0, 0, $month, 1, $year);
-$nowarray	= getdate();
-$nowmonth	= $nowarray['mon'];
-$nowyear	= $nowarray['year'];
-$nowday		= $nowarray['mday'];
-$current	= mktime(0, 0, 0, $nowmonth, 1, $nowyear); 
+$prop		= mktime(0, 0, 0, $month, 1, $year);		// Sets start date for new event entry
+$nowmonth	= $ecal_class->cal_date['mon'];
+$nowyear	= $ecal_class->cal_date['year'];
+$nowday		= $ecal_class->cal_date['mday'];
 
 // time switch buttons
 $cal_text = $tp -> parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calendar_shortcodes);
@@ -117,71 +126,90 @@
 // navigation buttons
 $nav_text = $tp -> parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calendar_shortcodes);
 
-// get events from current month
-if ($cal_super)
-{
+// get events from selected
     $qry = "SELECT e.*, ec.*
 			FROM #event as e
 			LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-			WHERE e.event_id != ''
+			WHERE e.event_id != '' 
+			AND ((e.event_start >= ".intval($monthstart)." AND e.event_start <= ".intval($monthend).") 
+			OR   (e.event_end >= ".intval($monthstart)." AND e.event_end <= ".intval($monthend).")
+			OR	 (e.event_start <= ".intval($monthstart)." AND e.event_end >= ".intval($monthend).")
+			OR 	 (e.event_recurring = '1' AND e.event_rec_y = ".intval($month).")) {$category_filter}
+			{$ecal_class->extra_query}
 			ORDER BY e.event_start";
-} 
-else
+
+if ($sql->db_Select_gen($qry))
 {
-    $qry = "SELECT e.*, ec.*
-			FROM #event as e
-			LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-			WHERE e.event_id != ''
-			AND find_in_set(event_cat_class,'".USERCLASS_LIST."') 
-			ORDER BY e.event_start";
-} 
+    while ($row = $sql->db_Fetch())
+	{
+		// check for recurring events in this month
+		if($row['event_recurring']=='1')
+		{
+		  if ($month == $row['event_rec_y'])
+		  {	// Change it into an event that happens today
+			$row['event_start'] = mktime(0,0,0,$row['event_rec_y'],$row['event_rec_m'],$year);
+			$row['event_end'] = $row['event_start'];    
+		  }
+		  else
+		  {  // Effectively create a null event
+		    $row['event_start'] = 0;
+			$row['event_end'] = 0;
+		  }
+		}
 
-if ($sql->db_Select_gen($qry)){
-    while ($row = $sql->db_Fetch()){
 		$evf	= getdate($row['event_start']);
-		$tmp	= $evf['mday'];
+		$tmp	= $evf['mday'];		// Day of month for start
 		$eve	= getdate($row['event_end']);
-		$tmp2	= $eve['mday'];
+		$tmp2	= $eve['mday'];		// Day of month for end
 		$tmp3	= date("t", $monthstart); // number of days in this month
-
-		// check for recurring events in this month
-		if($row['event_recurring']=='1' && $month == $row['event_rec_y']){
-			$row['event_start'] = mktime(0,0,0,$row['event_rec_y'],$row['event_rec_m'],$year);
-		}
+		if ((($ecal_class->max_recent_show != 0) && (time() - $row['event_datestamp']) <= $ecal_class->max_recent_show)) $row['is_recent'] = TRUE; 
 
 		//1) start in month, end in month
-		if(($row['event_start']>=$monthstart && $row['event_start']<=$monthend) && $row['event_end']<=$monthend){
+		if(($row['event_start']>=$monthstart && $row['event_start']<=$monthend) && $row['event_end']<=$monthend)
+		{
 			$events[$tmp][] = $row;
-			for ($c=($tmp+1); $c<($tmp2+1); $c++) {
-				$event_true_end[$c][] = ($c!=$tmp2 ? 1 : 2);
+			for ($c=($tmp+1); $c<($tmp2+1); $c++) 
+			{
+				$row['event_true_end'][$c] = ($c!=$tmp2 ? 1 : 2);
 				$events[$c][] = $row;
 			}
 
 		//2) start in month, end after month
-		}elseif(($row['event_start']>=$monthstart && $row['event_start']<=$monthend) && $row['event_end']>=$monthend){
+		}
+		elseif(($row['event_start']>=$monthstart && $row['event_start']<=$monthend) && $row['event_end']>=$monthend)
+		{
 			$events[$tmp][] = $row;
-			for ($c=($tmp+1); $c<=$tmp3; $c++){
-				$row['event_true_end'] = 1;
+			for ($c=($tmp+1); $c<=$tmp3; $c++)
+			{
+				$row['event_true_end'][$c] = 1;
 				$events[$c][] = $row;
 			}
 
 		//3) start before month, end in month
-		}elseif($row['event_start']<=$monthstart && ($row['event_end']>=$monthstart && $row['event_end']<=$monthend)){
-			for ($c=1; $c<=$tmp2; $c++){
-				$row['event_true_end'] = ($c!=$tmp2 ? 1 : 2);
+		}
+		elseif($row['event_start']<=$monthstart && ($row['event_end']>=$monthstart && $row['event_end']<=$monthend))
+		{
+			for ($c=1; $c<=$tmp2; $c++)
+			{
+				$row['event_true_end'][$c] = ($c!=$tmp2 ? 1 : 2);
 				$events[$c][] = $row;
 			}
 
 		//4) start before month, end after month
-		}elseif($row['event_start']<=$monthstart && $row['event_end']>=$monthend){
+		}
+		elseif($row['event_start']<=$monthstart && $row['event_end']>=$monthend)
+		{
 			for ($c=1; $c<=$tmp3; $c++){
-				$row['event_true_end'] = 1;
+				$row['event_true_end'][$c] = 1;
 				$events[$c][] = $row;
 			}
 		}
 	}
 }
 
+
+// ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference!
+
 $start		= $monthstart;
 $numberdays	= date("t", $start); // number of days in this month
 
@@ -198,13 +226,17 @@
 $calday		= $datearray['mday'];
 $calyear	= $datearray['year'];
 
-if ($pref['eventpost_weekstart'] == 'mon') {
-	$firstdayoffset = ($firstdayarray['wday'] == 0 ? $firstdayarray['wday']+6 : $firstdayarray['wday']-1);
-	} else {
-	$firstdayoffset = $firstdayarray['wday'] ;
+if ($pref['eventpost_weekstart'] == 'mon') 
+{
+  $firstdayoffset = ($firstdayarray['wday'] == 0 ? $firstdayarray['wday']+6 : $firstdayarray['wday']-1);
 }
-for ($c=0; $c<$firstdayoffset; $c++) {
-	$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calendar_shortcodes);
+else 
+{
+  $firstdayoffset = $firstdayarray['wday'] ;
+}
+for ($c=0; $c<$firstdayoffset; $c++) 
+{
+  $text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calendar_shortcodes);
 }
 $loop = $firstdayoffset;
 
@@ -213,15 +245,16 @@
     $dayarray	= getdate($start + (($c-1) * 86400));
     $stopp		= mktime(24, 0, 0, $calmonth, $c, $calyear);
     $startt		= mktime(0, 0, 0, $calmonth, $c, $calyear); 
-    // Highlight the current day.
+   // Highlight the current day.
     if ($dayarray['mon'] == $calmonth)
     {
         if ($nowday == $c && $calmonth == $nowmonth && $calyear == $nowyear)
         {
         	//today
 			$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_TODAY, FALSE, $calendar_shortcodes);
-        //}elseif (array_key_exists($c, $events)){
-		}elseif(isset($events[$c]) && is_array($events[$c]) && !empty($events[$c]) && count($events[$c]) > 0){
+		}
+		elseif(isset($events[$c]) && is_array($events[$c]) && !empty($events[$c]) && count($events[$c]) > 0)
+		{
 			//day has events
 			$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_EVENT, FALSE, $calendar_shortcodes);
         } 
@@ -231,26 +264,27 @@
 			$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_EMPTY, FALSE, $calendar_shortcodes);
         } 
         // if there are events then list them
-        if (array_key_exists($c, $events)){
+        if (array_key_exists($c, $events))
+		{
             foreach($events[$c] as $ev)
             {
 				//if ($event_true_end[$c][$a]){
-				if(isset($ev['event_true_end']) && $ev['event_true_end']){
+				if(isset($ev['event_true_end']) && $ev['event_true_end'])
+				{
 					//$ev['indicat'] = ($ev['event_true_end']==1 ? "->" : "|");
 					$ev['indicat'] = "";
 					$ev['imagesize'] = "4";
 					$ev['fulltopic'] = FALSE;
 					$ev['startofevent'] = FALSE;
-				}else{
+				}
+				else
+				{
 					$ev['indicat'] = "";
 					$ev['imagesize'] = "8";
 					$ev['fulltopic'] = TRUE;
 					$ev['startofevent'] = TRUE;
 				}
-				
-				if ( ( !isset($_POST['do']) || (isset($_POST['do']) && $_POST['do'] == null)) || (isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] == "all") || (isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] == $ev['event_cat_id']) ){
-					$text .= $tp -> parseTemplate($CALENDAR_SHOWEVENT, FALSE, $calendar_shortcodes);
-				} 
+				$text .= $tp -> parseTemplate($CALENDAR_SHOWEVENT, FALSE, $calendar_shortcodes);
 			} 
         } 
 		$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_END, FALSE, $calendar_shortcodes);
@@ -259,15 +293,18 @@
     if ($loop == 7)
     {
         $loop = 0;
-		if($numberdays!=$totaldays){
+		if($c != $numberdays)
+		{
 			$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_WEEKSWITCH, FALSE, $calendar_shortcodes);
 		}
     } 
 }
 //remainder cells to end the row properly with empty cells
-if($loop!=0){
+if($loop!=0)
+{
 	$remainder = 7-$loop;
-	for ($c=0; $c<$remainder; $c++) {
+	for ($c=0; $c<$remainder; $c++) 
+	{
 		$text .= $tp -> parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calendar_shortcodes);
 	}
 }
Binary files 0.7.5/e107_plugins/calendar_menu/calendar_menu.crc.gz and 0.7.7/e107_plugins/calendar_menu/calendar_menu.crc.gz differ
diff -ruN 0.7.5/e107_plugins/calendar_menu/calendar_menu.php 0.7.7/e107_plugins/calendar_menu/calendar_menu.php
--- 0.7.5/e107_plugins/calendar_menu/calendar_menu.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/calendar_menu.php	2006-11-24 16:27:18.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,205 +11,247 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar_menu.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2005/12/14 19:28:43 $
-|     $Author: sweetas $
+|     $Revision: 1.25 $
+|     $Date: 2006/11/24 22:27:18 $
+|     $Author: e107coders $
+|
+| 22.10.06 steved - Various tidying up, additional options supported
+| 24.10.06 steved - templated, various cleaning up
+| 06.11.06 steved - template file integrated with other calendar files
+| 09.11.06 steved - Caching added, other mods to templates etc
 +----------------------------------------------------------------------------+
 */
 
+
 if (!defined('e107_INIT')) { exit; }
 
-$ec_dir		= e_PLUGIN . "calendar_menu/";
-$lan_file	= e_PLUGIN . "calendar_menu/languages/" . e_LANGUAGE . ".php";
-require_once((file_exists($lan_file) ? $lan_file : e_PLUGIN . "calendar_menu/languages/English.php"));
+$ecal_dir	= e_PLUGIN . "calendar_menu/";
+require_once($ecal_dir.'ecal_class.php');
+$ecal_class = new ecal_class;
+
+$cache_tag = "nq_event_cal_cal";
+
+
+// See if the page is already in the cache
+	if($cacheData = $e107cache->retrieve($cache_tag, $ecal_class->max_cache_time))
+	{
+		echo $cacheData;
+		return;
+	}
+
+include_lan($ecal_dir."languages/".e_LANGUAGE.".php");
+
+global $ecal_dir, $tp;
+
 
-$cal_datearray		= getdate();
-$cal_current_day	= $cal_datearray['mday'];
+if (is_readable(THEME."calendar_template.php"))
+{
+  require(THEME."calendar_template.php");
+}
+else
+{  // Needs to be require - otherwise not loaded if two menus use it
+  require($ecal_dir."calendar_template.php");
+}
+
+$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
+
 
-$cal_monthstart		= mktime(0, 0, 0, $cal_current_month, 1, $cal_current_year);
+$cal_monthstart		= mktime(0, 0, 0, $cal_current_month, 1, $cal_current_year);			// Time stamp for first day of month
 $cal_firstdayarray	= getdate($cal_monthstart);
-$cal_monthend		= mktime(0, 0, 0, $cal_current_month + 1, 1, $cal_current_year) -1;
-$cal_lastdayarray	= getdate($cal_monthend); 
+$cal_monthend		= mktime(0, 0, 0, $cal_current_month + 1, 1, $cal_current_year) -1;		// Time stamp for last day of month
 
-if (USER)
-{
-    $cal_class = "0,253," . USERCLASS;
-} 
-else
-{
-    $cal_class = "0,252";
-} 
 
-if (check_class($pref['eventpost_super']))
-{ 
-    $cal_qry = "SELECT e.event_rec_m, e.event_rec_y, e.event_start, e.event_end, ec.*
+    $cal_qry = "SELECT e.event_rec_m, e.event_rec_y, e.event_start, e.event_end, e.event_datestamp, ec.*
 	FROM #event as e LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-	WHERE (e.event_start >= {$cal_monthstart} AND e.event_start <= {$cal_monthend}) OR (e.event_end >= {$cal_monthstart} AND e.event_end <= {$cal_monthend}) OR e.event_rec_y = {$cal_current_month} order by e.event_start";
-} 
-else
-{ 
-    $cal_qry = "SELECT e.event_rec_m, e.event_rec_y, e.event_start, e.event_end, ec.*
-	FROM #event as e LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-	WHERE (e.event_start >= {$cal_monthstart} AND e.event_start <= {$cal_monthend}) OR (e.event_end >= {$cal_monthstart} AND e.event_end <= {$cal_monthend}) OR e.event_rec_y = {$cal_current_month}
-	and find_in_set(event_cat_class,'" . $cal_class . "') order by e.event_start";
-} 
+	WHERE ((e.event_start >= {$cal_monthstart} AND e.event_start <= {$cal_monthend}) OR (e.event_rec_y = {$cal_current_month}))
+	{$ecal_class->extra_query} order by e.event_start";
 
-$cal_events = array();
 
+$cal_events = array();
 $cal_totev = 0;
 if ($cal_totev = $sql->db_Select_gen($cal_qry))
 {
-    while ($cal_row = $sql->db_Fetch())
-    {
-        if ($cal_row['event_rec_y'] == $cal_current_month)
-        {
-            $cal_events[$cal_row['event_rec_m']][] = $cal_row;
-        } 
-        else
-        {
-            $cal_tmp = getdate($cal_row['event_start']);
-            if ($cal_tmp['year'] == $cal_current_year)
-            {
-                $cal_start_day = $cal_tmp['mday'];
-            } 
-            else
-            {
-                $cal_start_day = 1;
-            } 
-            $cal_tmp = getdate($cal_row['event_end']);
-            if ($cal_tmp['year'] == $cal_current_year)
-            {
-                $cal_end_day = $cal_tmp['mday'];
-            } 
-            else
-            {
-                $cal_end_day = 31;
-            } 
-            // Mark each day the event occurs
-			$cal_events[$cal_start_day] = $cal_row['event_cat_icon'];
-        }
-    } 
-} 
+  while ($cal_row = $sql->db_Fetch())
+  {
+    if ($cal_row['event_rec_y'] == $cal_current_month)
+    {	// Recurring events
+	  $cal_start_day = $cal_row['event_rec_m'];
+    }
+    else
+    {	// 'normal' events
+      $cal_tmp = getdate($cal_row['event_start']);
+      if ($cal_tmp['mon'] == $cal_current_month)
+      {
+        $cal_start_day = $cal_tmp['mday'];
+      }
+      else
+      {
+        $cal_start_day = 1;
+      }
+    }
+    // Mark start day of each event
+	$cal_events[$cal_start_day][] = $cal_row['event_cat_icon'];	// Will be overwritten if several events on same day
+	if ((($ecal_class->max_recent_show != 0) && (time() - $cal_row['event_datestamp']) <= $ecal_class->max_recent_show)) $cal_events[$cal_start_day]['is_recent'] = TRUE;
+  }
+}
 
 
-if ($pref['eventpost_weekstart'] == 'sun'){
-    $cal_week	= Array(EC_LAN_25, EC_LAN_19, EC_LAN_20, EC_LAN_21, EC_LAN_22, EC_LAN_23, EC_LAN_24);
-	}else{
-    $cal_week	= Array(EC_LAN_19, EC_LAN_20, EC_LAN_21, EC_LAN_22, EC_LAN_23, EC_LAN_24, EC_LAN_25);
-} 
-
-$cal_months		= Array(EC_LAN_0, EC_LAN_1, EC_LAN_2, EC_LAN_3, EC_LAN_4, EC_LAN_5, EC_LAN_6, EC_LAN_7, EC_LAN_8, EC_LAN_9, EC_LAN_10, EC_LAN_11); 
-if ($pref['eventpost_dateformat'] == 'my'){
-    $calendar_title = "<a class='forumlink' href='" . e_PLUGIN . "calendar_menu/event.php' >" . $cal_months[$cal_datearray['mon']-1] . " " . $cal_current_year . "</a>";
-	}else{
-    $calendar_title = "<a class='forumlink' href='" . e_PLUGIN . "calendar_menu/event.php' >" . $cal_current_year . " " . $cal_months[$cal_datearray['mon']-1] . "</a>";
-} 
+if ($pref['eventpost_weekstart'] == 'sun')
+{
+  $cal_week	= array(EC_LAN_25, EC_LAN_19, EC_LAN_20, EC_LAN_21, EC_LAN_22, EC_LAN_23, EC_LAN_24);
+}
+else
+{
+  $cal_week	= array(EC_LAN_19, EC_LAN_20, EC_LAN_21, EC_LAN_22, EC_LAN_23, EC_LAN_24, EC_LAN_25);
+}
+
+$cal_months	= array(EC_LAN_0, EC_LAN_1, EC_LAN_2, EC_LAN_3, EC_LAN_4, EC_LAN_5, EC_LAN_6, EC_LAN_7, EC_LAN_8, EC_LAN_9, EC_LAN_10, EC_LAN_11);
 
-$cal_text = "<div style='text-align:center'>"; 
 
-if ($cal_totev){
+$calendar_title = "<a class='forumlink' href='".e_PLUGIN."calendar_menu/";
+if ($pref['eventpost_menulink'] == 1)
+{
+  $calendar_title .= "calendar.php' >";
+}
+else
+{
+  $calendar_title .= "event.php' >";
+}
+if ($pref['eventpost_dateformat'] == 'my')
+{
+    $calendar_title .= $cal_months[$cal_datearray['mon']-1] ." ". $cal_current_year . "</a>";
+}
+else
+{
+    $calendar_title .= $cal_current_year ." ". $cal_months[$cal_datearray['mon']-1] . "</a>";
+}
+
+
+$cal_text = $CALENDAR_MENU_START;
+
+
+if ($pref['eventpost_showeventcount']=='1')
+{
+  if ($cal_totev)
+  {
     $cal_text .= EC_LAN_26 . ": " . $cal_totev;
-	}else{
+  }
+  else
+  {
     $cal_text .= EC_LAN_27;
-} 
+  }
+  $cal_text .= "<br /><br />";
+}
+
+$cal_start	= $cal_monthstart;		// First day of month as time stamp
+
 
-$cal_headercss	= (isset($pref['eventpost_headercss']) && $pref['eventpost_headercss']) ? $pref['eventpost_headercss'] : "forumheader";
-$cal_daycss		= (isset($pref['eventpost_daycss']) && $pref['eventpost_daycss']) ? $pref['eventpost_daycss'] : "forumheader3";
-$cal_todaycss	= (isset($pref['eventpost_todaycss']) && $pref['eventpost_todaycss']) ? $pref['eventpost_todaycss'] : "indent";
-$cal_evtoday	= (isset($pref['eventpost_evtoday']) && $pref['eventpost_evtoday']) ? $pref['eventpost_evtoday'] : "indent";
-$cal_start		= $cal_monthstart;
-//added hardcoded padding
-//cause eg. indent uses a large padding in standard themes
-//which caused overflow
-$padding		= "padding:1px;";
+// Start the table
+$cal_text .= $CALENDAR_MENU_TABLE_START;
+// Open header row
+$cal_text .= $CALENDAR_MENU_HEADER_START;
+// Now do the headings
 
-$cal_text .= "<br /><br />
-<table cellpadding='0' cellspacing='1' style='width:100%' class='fborder'><tr>";
 foreach($cal_week as $cal_day)
 {
-    $cal_text .= "<td class='$cal_headercss' style='text-align:center'><span class='smalltext'>" . substr($cal_day, 0, $pref['eventpost_lenday']) . "</span></td>";
-} 
-$cal_text .= "</tr><tr >";
+    $cal_text .= $CALENDAR_MENU_HEADER_FRONT;
+	$cal_text .= substr($cal_day, 0, $pref['eventpost_lenday']);
+    $cal_text .= $CALENDAR_MENU_HEADER_BACK;
+}
+$cal_text .= $CALENDAR_MENU_HEADER_END;  // Close off header row, open first date row
+
 
 $cal_thismonth	= $cal_datearray['mon'];
-$cal_thisday	= $cal_datearray['mday']; 
+$cal_thisday	= $cal_datearray['mday'];	// Today
+
 
-if ($pref['eventpost_weekstart'] == 'mon'){
+if ($pref['eventpost_weekstart'] == 'mon')
+{
     $firstdayoffset = ($cal_firstdayarray['wday'] == 0 ? $cal_firstdayarray['wday'] + 6 : $cal_firstdayarray['wday']-1);
-	}else{
-    $firstdayoffset = $cal_firstdayarray['wday'] ;
-} 
-for($cal_c = 0; $cal_c < $firstdayoffset; $cal_c++){
-    $cal_text .= "<td class='$cal_daycss' style='".$padding." text-align:center'><br /></td>";
-} 
-$cal_loop = $firstdayoffset; 
+}
+else
+{
+    $firstdayoffset = $cal_firstdayarray['wday'];
+}
 
-for($cal_c = 1; $cal_c <= 31; $cal_c++)
+
+for ($cal_c = 0; $cal_c < $firstdayoffset; $cal_c++)
 {
+	$cal_text .= $CALENDAR_MENU_DAY_NON;
+}
+$cal_loop = $firstdayoffset;
+
+// Now do the days of the month
+for($cal_c = 1; $cal_c <= 31; $cal_c++)
+{   // Four cases to decode:
+	//     	1 - Today, no events
+	//		2 - Some other day, no events (or no icon defined)
+	//		3 - Today with events (and icon defined)
+	//		4 - Some other day with events (and icon defined)
     $cal_dayarray = getdate($cal_start + (($cal_c-1) * 86400));
+	$cal_css = 2;		// The default - not today, no events
     if ($cal_dayarray['mon'] == $cal_thismonth)
-    {
-        if ($cal_thisday == $cal_c)
-        {
-            $cal_text .= "<td class='$cal_todaycss' style='".$padding." width: 14.28%; text-align:center; '>";
-        } 
-        else
-        {
-			$cal_text .= "<td class='".(array_key_exists($cal_c, $cal_events) ? $cal_evtoday : $cal_daycss)."' style='".$padding." width: 14.28%; text-align:center; '>";
-        } 
-
+    {  // Dates match for this month
+      $cal_img = $cal_c;		// Default 'image' is the day of the month
+      $cal_event_count = 0;
+      $title = "";
+      if ($cal_thisday == $cal_c) $cal_css = 1;
+        $cal_linkut = mktime(0 , 0 , 0 , $cal_dayarray['mon'], $cal_c, $cal_datearray['year']).".one";  // ALways need "one"
         if (array_key_exists($cal_c, $cal_events))
         {
-            $cal_event_icon = e_PLUGIN . "calendar_menu/images/" . $cal_events[$cal_c];
-            $cal_event_count = count($cal_events[$cal_c]); 
-            // *BK* Check if empty because file_exist will return true if icon name is blank, because it finds that the directory exists
-            // *BK* It then tries to put in the icon which doesn't exist
-            if (!empty($cal_events[$cal_c]) && file_exists($cal_event_icon))
-            {
-                $cal_img = "<img style='border:0' src='{$cal_event_icon}' alt='' />";
+            $cal_event_icon = e_PLUGIN . "calendar_menu/images/" . $cal_events[$cal_c]['0'];
+            $cal_event_count = count($cal_events[$cal_c]);		// See how many events today
+            if (!empty($cal_events[$cal_c]) && is_file($cal_event_icon))
+            {   // Show icon if it exists
+			  $cal_css += 2;		// Gives 3 for today, 4 for other day
+			  if ($cal_event_count == 1)
+			  {
+                $title = " title='1 ".EC_LAN_135."' ";
+			  }
+			  else
+			  {
+                $title = " title='{$cal_event_count} " . EC_LAN_106 . "' ";
+			  }
+              $cal_img = "<img style='border:0' src='{$cal_event_icon}' alt='' />";
 				//height='10' width='10'
-            } 
-            else
-            {
-                $cal_img = $cal_c;
-            } 
-        } 
-        else
-        {
-            $cal_img = $cal_c;
-            $cal_event_count = 0;
-        } 
-
-        $cal_linkut = mktime(0 , 0 , 0 , $cal_dayarray['mon'], $cal_c, $cal_datearray['year']);
-        if ($cal_event_count > 0)
-        {
-            $title = " title='{$cal_event_count} " . EC_LAN_106 . "' ";
-        } 
-        else
-        { 
-            // *BK* Set title to blank (or you can set to 0 events if you wish otherwise it remembers the last value
-            $title = "";
-        } 
-        $cal_text .= "<a {$title} href='" . $ec_dir . "event.php?" . $cal_linkut . ".one'>$cal_img</a>";
-        $cal_text .= "</td>\n";
+			  if (isset($cal_events[$cal_c]['is_recent']) && $cal_events[$cal_c]['is_recent'])
+			  {
+			    $cal_css += 2;
+			  }
+            }
+		}
+        $cal_text .= $CALENDAR_MENU_DAY_START[$cal_css]."<a {$title} href='" . e_PLUGIN . "calendar_menu/event.php?{$cal_linkut}'>{$cal_img}</a>";
+        $cal_text .= $CALENDAR_MENU_DAY_END[$cal_css];
         $cal_loop++;
         if ($cal_loop == 7)
-        {
+        {  // Start next row
             $cal_loop = 0;
-            $cal_text .= "</tr><tr>";
-        } 
-    } 
-} 
+			if ($cal_c != $numberdays)
+			{
+              $cal_text .= $CALENDAR_MENU_WEEKSWITCH;
+			}
+        }
+    }
+}
 
+if ($cal_loop != 0)
+{
 for($cal_a = ($cal_loop + 1); $cal_a <= 7; $cal_a++)
-{ 
-    // *BK* Add class so that empty cells display in the menu
-    $cal_text .= "<td class='$cal_daycss' >&nbsp;</td>";
-} 
+{
+	$cal_text .= $CALENDAR_MENU_DAY_NON;
+}
+}
+// Close table
+$cal_text .= $CALENDAR_MENU_END;
+
+// Now handle the data, cache as well
+ob_start();					// Set up a new output buffer
+$ns->tablerender($calendar_title, $cal_text, 'calendar_menu');
+$cache_data = ob_get_flush();			// Get the page content, and display it
+$e107cache->set($cache_tag, $cache_data);	// Save to cache
 
-$cal_text .= "</tr></table></div>";
-$ns->tablerender($calendar_title, $cal_text, 'calender_menu');
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/calendar_menu/calendar_shortcodes.php 0.7.7/e107_plugins/calendar_menu/calendar_shortcodes.php
--- 0.7.5/e107_plugins/calendar_menu/calendar_shortcodes.php	2006-04-11 06:53:30.000000000 -0500
+++ 0.7.7/e107_plugins/calendar_menu/calendar_shortcodes.php	2006-11-16 04:24:14.000000000 -0600
@@ -1,4 +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_plugins/calendar_menu/calendar_shortcodes.php,v $
+|     $Revision: 1.13 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| 10.11.06 - mods for next CVS release
++----------------------------------------------------------------------------+
+*/
+
 if (!defined('e107_INIT')) { exit; }
 include_once(e_HANDLER.'shortcode_handler.php');
 $calendar_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
@@ -63,7 +83,8 @@
 
 SC_BEGIN NAV_BUT_SUBSCRIPTION
 	global $NAV_BUT_SUBSCRIPTION, $pref;
-	if ($pref['eventpost_asubs']>0) {
+	if (($pref['eventpost_asubs']>0) && USER)
+	{
 		$NAV_BUT_SUBSCRIPTION = "<input class='button' type='submit' style='width:140px;' name='subs' value='".EC_LAN_123."' />";
 	}
 	return $NAV_BUT_SUBSCRIPTION;
@@ -80,9 +101,9 @@
 SC_END
 
 SC_BEGIN NAV_LINKCURRENTMONTH
-	global $NAV_LINKCURRENTMONTH, $month, $nowmonth, $year, $nowyear, $current;
+	global $NAV_LINKCURRENTMONTH, $month, $nowmonth, $year, $nowyear, $current, $ds;
 	$NAV_LINKCURRENTMONTH = "";
-	if ($month != $nowmonth || $year != $nowyear){
+	if ($month != $nowmonth || $year != $nowyear || $ds == 'one'){
 		$NAV_LINKCURRENTMONTH = "<input class='button' type='button' style='width:140px;' name='cur' value='".EC_LAN_40."' onclick=\"javascript:document.location='".e_SELF."?$current'\" />";
 	}
 	return $NAV_LINKCURRENTMONTH;
@@ -128,20 +149,48 @@
 SC_BEGIN SHOWEVENT_HEADING
 	global $SHOWEVENT_HEADING, $ev, $datearray, $c;
 	$linkut = mktime(0 , 0 , 0 , $datearray['mon'], $c, $datearray['year']);
-	if(isset($ev['fulltopic']) && $ev['fulltopic']){
+	if(isset($ev['fulltopic']) && $ev['fulltopic'])
+	{  // Used on first day
 		$show_title = $ev['event_title'];
-	}else{
-		if (strlen($ev['event_title']) > 10){
-			$show_title = substr($ev['event_title'], 0, 10) . "...";
-		}else{
-			$show_title = $ev['event_title'];
+	}
+	else
+	{
+		if (strlen($ev['event_title']) > 10)
+		{
+		  $show_title = substr($ev['event_title'], 0, 10) . "...";
+		}
+		else
+		{
+		  $show_title = $ev['event_title'];
 		}
 	}
-	if($ev['startofevent']){
-		return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
-	}else{
-		return "<a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='smalltext'>".$show_title."</span></a>";
+	if($ev['startofevent'])
+	{
+	  if (isset($ev['is_recent']))
+	  {
+	    return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
+	  }
+	  else
+	  {
+	    return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
+	  }
+	}
+	else
+	{
+	  return "<a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='smalltext'>".$show_title."</span></a>";
+	}
+SC_END
+
+SC_BEGIN CALENDAR_CALENDAR_RECENT_ICON
+  global $ev;
+  if (!isset($ev['is_recent'])) return "";
+//  $recent_icon = e_PLUGIN."calendar_menu/images/recent_icon.png";
+  $recent_icon = e_IMAGE."generic/".IMODE."/new.png";
+  if (file_exists($recent_icon))
+	{
+	  return "<img style='border:0' src='".$recent_icon."' alt='' /> ";
 	}
+  return "R";
 SC_END
 
 
@@ -149,28 +198,28 @@
 // CALENDAR CALENDAR ------------------------------------------------------------
 SC_BEGIN CALENDAR_CALENDAR_HEADER_DAY
 	global $CALENDAR_CALENDAR_HEADER_DAY, $day, $pref, $week;
-	if(isset($pref['eventpost_lenday']) && $pref['eventpost_lenday']){
-		return "<strong>".substr($day,0,$pref['eventpost_lenday'])."</strong>";
-	}else{
- 		return "<strong>".$day."</strong>";
+	if(isset($pref['eventpost_lenday']) && $pref['eventpost_lenday'])
+	{
+	  return "<strong>".substr($day,0,$pref['eventpost_lenday'])."</strong>";
+	}
+	else
+	{
+ 	  return "<strong>".$day."</strong>";
 	}
 SC_END
 
 SC_BEGIN CALENDAR_CALENDAR_DAY_TODAY_HEADING
 	global $CALENDAR_CALENDAR_DAY_TODAY_HEADING, $startt, $c, $days;
-	//return "<b><a href='".e_PLUGIN."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a></b> <span class='smalltext'>[".EC_LAN_TODAY."]</span>";
 	return "<b><a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a></b> <span class='smalltext'>[".EC_LAN_TODAY."]</span>";
 SC_END
 
 SC_BEGIN CALENDAR_CALENDAR_DAY_EVENT_HEADING
 	global $CALENDAR_CALENDAR_DAY_EVENT_HEADING, $startt, $c, $days;
-	//return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a>";
-	return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a>";
+	return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a>";
 SC_END
 
 SC_BEGIN CALENDAR_CALENDAR_DAY_EMPTY_HEADING
 	global $CALENDAR_CALENDAR_DAY_EMPTY_HEADING, $startt, $c, $days;
-	//return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a>";
 	return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a>";
 SC_END
 
@@ -178,9 +227,12 @@
 // EVENT LIST ------------------------------------------------
 SC_BEGIN EVENTLIST_CAPTION
 	global $EVENTLIST_CAPTION, $ds, $months, $selected_mon, $dayslo, $selected_day, $monthstart;
-	if ($ds == 'one'){
-		$EVENTLIST_CAPTION = EC_LAN_111.$months[$selected_mon-1]." ".$dayslo[$selected_day-1];
-	} elseif ($ds != 'event'){
+	if ($ds == 'one')
+	{
+		$EVENTLIST_CAPTION = EC_LAN_111.$months[$selected_mon-1]." ".$selected_day;
+	}
+    elseif ($ds != 'event')
+    {
 		$EVENTLIST_CAPTION = EC_LAN_112.$months[date("m", $monthstart)-1];
 	}
 	return $EVENTLIST_CAPTION;
@@ -191,26 +243,28 @@
 // EVENT ARCHIVE ------------------------------------------------------------
 SC_BEGIN EVENTARCHIVE_CAPTION
 	global $EVENTARCHIVE_CAPTION, $num;
-	if($num == 0){
-		$EVENTARCHIVE_CAPTION = str_replace("-NUM-", "", EC_LAN_62);
-	}else{
+	if ($num == 0) 
+	{
+		$EVENTARCHIVE_CAPTION = EC_LAN_137;
+	}
+	else
+	{
 		$EVENTARCHIVE_CAPTION = str_replace("-NUM-", $num, EC_LAN_62);
 	}
 	return $EVENTARCHIVE_CAPTION;
 SC_END
 
 SC_BEGIN EVENTARCHIVE_DATE
-	global $EVENTARCHIVE_DATE, $gen, $events;
-	$startds = cal_landate($events['event_start'], $recurring = false, $allday = false);
-	//$startds = $gen->convert_date($events['event_start'], "long");
-	$EVENTARCHIVE_DATE = "<a href='event.php?".$events['event_start'].".event.".$events['event_id']."'>".$startds."</a>";
+	global $EVENTARCHIVE_DATE, $thisevent, $ecal_class;
+	$startds = $ecal_class->event_date_string($thisevent['event_start']);
+	$EVENTARCHIVE_DATE = "<a href='event.php?".$thisevent['event_start'].".event.".$thisevent['event_id']."'>".$startds."</a>";
 	return $EVENTARCHIVE_DATE;
 SC_END
 
 SC_BEGIN EVENTARCHIVE_DETAILS
-	global $EVENTARCHIVE_DETAILS, $events, $tp;
+	global $EVENTARCHIVE_DETAILS, $thisevent, $tp;
 	$number = 40;
-	$rowtext = $tp->toHTML($events['event_details'], TRUE, "nobreak");
+	$rowtext = $tp->toHTML($thisevent['event_details'], TRUE, "nobreak");
 	$rowtext = strip_tags($rowtext);
 	$words = explode(" ", $rowtext);
 	$EVENTARCHIVE_DETAILS = implode(" ", array_slice($words, 0, $number));
@@ -218,7 +272,6 @@
 		$EVENTARCHIVE_DETAILS .= " ".EC_LAN_133." ";
 	}
 	return $EVENTARCHIVE_DETAILS;
-	//return $events['event_details'];
 SC_END
 
 SC_BEGIN EVENTARCHIVE_EMPTY
@@ -227,9 +280,8 @@
 SC_END
 
 SC_BEGIN EVENTARCHIVE_HEADING
-	global $EVENTARCHIVE_HEADING, $events;
-	$EVENTARCHIVE_HEADING = "";
-	$EVENTARCHIVE_HEADING = $events['event_title'];
+	global $EVENTARCHIVE_HEADING, $thisevent;
+	$EVENTARCHIVE_HEADING = $thisevent['event_title'];
 	return $EVENTARCHIVE_HEADING;
 SC_END
 
@@ -237,61 +289,78 @@
 
 
 // EVENT SHOWEVENT ------------------------------------------------------------
-SC_BEGIN EVENT_HEADING
-	global $EVENT_HEADING, $thisevent;
-	$EVENT_HEADING = "";
-	if ($thisevent['event_cat_icon'] && file_exists(e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon'])){
-		$EVENT_HEADING = "<img style='border:0' src='".e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon']."' alt='' /> ".$thisevent['event_title'] ;
-	}else{
-		//$EVENT_HEADING = EC_LAN_57." ".$thisevent['event_title'];
-		$EVENT_HEADING = $thisevent['event_title'];
+
+SC_BEGIN EVENT_RECENT_ICON
+  global $thisevent, $ecal_class;
+  if (($ecal_class->max_recent_show == 0) || (time() - $thisevent['event_datestamp']) > $ecal_class->max_recent_show) return "";
+// Can use the generic icon, or a calendar-specific one  
+  $recent_icon = e_IMAGE."generic/".IMODE."/new.png";
+//  $recent_icon = e_PLUGIN."calendar_menu/images/recent_icon.png";
+  if (file_exists($recent_icon))
+	{
+	  return "<img style='border:0' src='".$recent_icon."' alt='' /> ";
 	}
-	return $EVENT_HEADING;
-	//return $thisevent['event_title'];
+  return "";
+SC_END
+
+SC_BEGIN EVENT_HEADING_DATE
+	global $thisevent, $ecal_class;
+	$startds = $ecal_class->event_date_string($thisevent['event_start']);
+    return $startds;
 SC_END
 
 SC_BEGIN EVENT_DATE_START
-	global $EVENT_DATE_START, $thisevent;
-	if ($thisevent['event_allday'] == 0){
-	if ($thisevent['event_start'] > $thisevent['event_end']){
-	$thisevent['event_end'] = $thisevent['event_start'];
-	}
-	}
-	$startds	= cal_landate($thisevent['event_start'], $thisevent['event_recurring'], $thisevent['event_allday']);
-	$endds		= cal_landate($thisevent['event_end'], $thisevent['event_recurring'], $thisevent['event_allday']);
-	if ($thisevent['event_allday']){
-		$EVENT_DATE_START = "<b>".EC_LAN_68."</b> ".$startds;
-	}else{
-		$EVENT_DATE_START = "<b>".EC_LAN_29."</b> ".$startds;
-	}
-	return $EVENT_DATE_START;
+	global $thisevent, $ecal_class;
+	$startds = $ecal_class->event_date_string($thisevent['event_start']);
+    return $startds;
+SC_END
+
+SC_BEGIN EVENT_TIME_START
+	global $thisevent, $ecal_class;
+	if ($thisevent['event_allday'] == 1) return "";
+	$startds = $ecal_class->time_string($thisevent['event_start']);
+    return $startds;
 SC_END
 
 SC_BEGIN EVENT_DATE_END
-	global $EVENT_DATE_END, $thisevent;
-	if ($thisevent['event_allday'] == 0){
-	if ($thisevent['event_start'] > $thisevent['event_end']){
-	$thisevent['event_end'] = $thisevent['event_start'];
-	}
+	global $thisevent, $ecal_class;
+	if ($thisevent['event_allday'] ||($thisevent['event_end'] == $thisevent['event_start'])) return "";
+	$endds = $ecal_class->event_date_string($thisevent['event_end']);
+	return $endds;
+SC_END
+
+SC_BEGIN EVENT_TIME_END
+	global $thisevent, $ecal_class;
+	if ($thisevent['event_allday'] ||($thisevent['event_end'] == $thisevent['event_start'])) return "";
+	$endds = $ecal_class->time_string($thisevent['event_end']);
+	return $endds;
+SC_END
+
+SC_BEGIN EVENT_TITLE
+	global $thisevent;
+	return $thisevent['event_title'];
+SC_END
+
+SC_BEGIN EVENT_CAT_ICON
+  global $thisevent;
+  if ($thisevent['event_cat_icon'] && file_exists(e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon']))
+	{
+	  return "<img style='border:0' src='".e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon']."' alt='' /> ";
 	}
-	$startds	= cal_landate($thisevent['event_start'], $thisevent['event_recurring'], $thisevent['event_allday']);
-	$endds		= cal_landate($thisevent['event_end'], $thisevent['event_recurring'], $thisevent['event_allday']);
-	if ($thisevent['event_allday'] || $startds == $endds){
-		$EVENT_DATE_END = "";
-	}else{
-		$EVENT_DATE_END = "<b>".EC_LAN_69."</b> ".$endds;
+	else
+	{
+		return "";
 	}
-	return $EVENT_DATE_END;
 SC_END
 
 SC_BEGIN EVENT_ID
-	global $EVENT_ID, $thisevent;
+	global $thisevent;
 	return "calevent".$thisevent['event_id'];
 SC_END
 
 SC_BEGIN EVENT_DISPLAYSTYLE
 	global $EVENT_DISPLAYSTYLE, $ds;
-	if ($ds=="event"){
+	if (($ds=="event") || ($ds=="one")){
 		$EVENT_DISPLAYSTYLE = "show";
 	}else{
 		$EVENT_DISPLAYSTYLE = "none";
@@ -305,19 +374,14 @@
 SC_END
 
 SC_BEGIN EVENT_CATEGORY
-	global $EVENT_CATEGORY, $thisevent, $tp;
-	if ($thisevent['event_cat_icon'] && file_exists(e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon'])){
-		$EVENT_CATEGORY = "<img style='border:0' src='".e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon']."' alt='' /> ".$thisevent['event_cat_name'];
-	}else{
+	global $EVENT_CATEGORY, $thisevent;
 		$EVENT_CATEGORY = $thisevent['event_cat_name'];
-	}
 	return $EVENT_CATEGORY;
 SC_END
 
 SC_BEGIN EVENT_LOCATION
 	global $EVENT_LOCATION, $thisevent;
 	if ($thisevent['event_location'] == ""){
-		//$EVENT_LOCATION = EC_LAN_38;
 		$EVENT_LOCATION = "";
 	}else{
 		$EVENT_LOCATION = $thisevent['event_location'];
@@ -341,14 +405,14 @@
 		//$EVENT_CONTACT = EC_LAN_38; // Not Specified ;
 	$EVENT_CONTACT = "";
 	}else{
-		$EVENT_CONTACT = $tp->toHTML($thisevent['event_contact'],"noreplace");
+		$EVENT_CONTACT = $tp->toHTML($thisevent['event_contact'],TRUE);
 	}
 	return $EVENT_CONTACT;
 SC_END
 
 SC_BEGIN EVENT_THREAD
-	global $EVENT_THREAD, $thisevent;
-	return ($thisevent['event_thread'] ? "<a href='{$thisevent['event_thread']}'><img src='".e_PLUGIN."forum/images/e.png' alt='' style='border:0; vertical-align:middle;' width='16' height='16' /> ".EC_LAN_39."</a>" : "");
+  global $EVENT_THREAD, $thisevent;
+  return (isset($thisevent['event_thread']) && ($thisevent['event_thread'] != "")) ? "<a href='{$thisevent['event_thread']}'><img src='".e_PLUGIN."forum/images/".IMODE."/e.png' alt='' style='border:0; vertical-align:middle;' width='16' height='16' /></a> <a href='{$thisevent['event_thread']}'>".EC_LAN_39."</a>" : "";
 SC_END
 
 SC_BEGIN EVENT_OPTIONS
@@ -359,5 +423,55 @@
 	return $EVENT_OPTIONS;
 SC_END
 
+
+
+
+SC_BEGIN NEXT_EVENT_TIME
+  global $cal_row, $ecal_class;
+  if ($cal_row['event_allday'] != 1) return $ecal_class->time_string($cal_row['event_start']); else return '';
+SC_END
+
+SC_BEGIN NEXT_EVENT_DATE
+  global $cal_row, $ecal_class;
+  return $ecal_class->next_date_string($cal_row['event_start']);
+SC_END
+
+SC_BEGIN NEXT_EVENT_TITLE
+  global $pref, $cal_row;
+  if (isset($pref['eventpost_namelink']) && ($pref['eventpost_namelink'] == '2') && (isset($cal_row['event_thread']) && ($cal_row['event_thread'] != "")))
+	  {
+	    $fe_event_title = "<a href='".$cal_row['event_thread']."'>";
+	  }
+	  else
+	  { 
+	    $fe_event_title = "<a href='".e_PLUGIN."calendar_menu/event.php?".$cal_row['event_start'].".event.".$cal_row['event_id']."'>";
+	  }
+	$fe_event_title .= $cal_row['event_title']."</a>";
+  return $fe_event_title;
+SC_END
+
+SC_BEGIN NEXT_EVENT_ICON
+  global $pref, $cal_row, $ecal_dir;
+  $fe_icon_file = "";
+  if ($pref['eventpost_showcaticon'] == 1)
+  {
+	if($cal_row['event_cat_icon'] && file_exists($ecal_dir."images/".$cal_row['event_cat_icon']))
+	{
+	  $fe_icon_file = $ecal_dir."images/".$cal_row['event_cat_icon'];
+	}
+	else
+	{
+	  $fe_icon_file = THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif");
+	}
+  }
+  return $fe_icon_file;
+SC_END
+
+SC_BEGIN NEXT_EVENT_GAP
+  global $cal_totev;
+  if ($cal_totev) return "<br /><br />"; else return "";
+SC_END
+
+
 */
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/calendar_sql.php 0.7.7/e107_plugins/calendar_menu/calendar_sql.php
--- 0.7.5/e107_plugins/calendar_menu/calendar_sql.php	2005-04-30 23:37:02.000000000 -0500
+++ 0.7.7/e107_plugins/calendar_menu/calendar_sql.php	2006-11-06 16:30:22.000000000 -0600
@@ -22,7 +22,6 @@
 	event_cat_icon varchar(100) NOT NULL default '',
 	event_cat_class int(10) unsigned NOT NULL default '0',
 	event_cat_subs tinyint(3) unsigned NOT NULL default '0',
-	event_cat_force tinyint(3) unsigned NOT NULL default '0',
 	event_cat_ahead tinyint(3) unsigned NOT NULL default '0',
 	event_cat_msg1 text,
 	event_cat_msg2 text,
@@ -31,6 +30,8 @@
 	event_cat_today int(10) unsigned NOT NULL default '0',
 	event_cat_lastupdate int(10) unsigned NOT NULL default '0',
 	event_cat_addclass int(10) unsigned NOT NULL default '0',
+	event_cat_description text,
+	event_cat_force_class int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_cat_id)
 	) TYPE=MyISAM;,
 	CREATE TABLE event_subs (
diff -ruN 0.7.5/e107_plugins/calendar_menu/calendar_template.php 0.7.7/e107_plugins/calendar_menu/calendar_template.php
--- 0.7.5/e107_plugins/calendar_menu/calendar_template.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/calendar_template.php	2006-11-16 04:24:14.000000000 -0600
@@ -1,5 +1,23 @@
 <?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/calendar_menu/calendar_template.php,v $
+|     $Revision: 1.9 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| 10.11.06 steved - mods for next CVS release
++----------------------------------------------------------------------------+
+*/
 if (!defined('e107_INIT')) { exit; }
 
 // TIME SWITCH BUTTONS ------------------------------------------------------------
@@ -29,12 +47,12 @@
 	<td class='forumheader' style='width:18%; text-align:left'>{PREV_MONTH}</td>
 	<td class='fcaption' style='width:64%; text-align:center'>{CURRENT_MONTH}</td>
 	<td class='forumheader' style='width:18%; text-align:right'>{NEXT_MONTH}</td>
-</tr>
+</tr>\n
 <tr>
 	<td class='forumheader3' style='text-align:left'>{PREV_YEAR}</td>
 	<td class='fcaption' style='text-align:center; vertical-align:middle'>{MONTH_LIST}</td>
 	<td class='forumheader3' style='text-align:right'>{NEXT_YEAR}</td>
-</tr>
+</tr>\n
 </table>";
 
 
@@ -51,30 +69,16 @@
 <table border='0' cellpadding='0' cellspacing='0' style='width:100%;'>
 <tr>
 	<td style='text-align:center;'>{NAV_CATEGORIES} {NAV_BUT_ALLEVENTS} {NAV_BUT_VIEWCAT} {NAV_BUT_ENTEREVENT} {NAV_BUT_SUBSCRIPTION} {NAV_LINKCURRENTMONTH}</td>
-</tr>
+</tr>\n
 </table>
 </form>
 </div>";
-/*
-	<table border='0' cellpadding='2' cellspacing='3' class='forumheader3' style='width:100%;'>
-	<tr>
-		<td style='text-align:right;'>{NAV_CATEGORIES}</td>
-		<td style='text-align:center;'>{NAV_BUT_ALLEVENTS}</td>
-	</tr>
-	<tr>
-		<td style='text-align:right;'>{NAV_BUT_VIEWCAT}</td>
-		<td style='text-align:center;'>{NAV_BUT_ENTEREVENT}</td>
-	</tr>
-	<tr>
-		<td style='text-align:center;' colspan='2'>{NAV_BUT_SUBSCRIPTION}</td>
-	</tr>
-	</table>
-	*/
+
 
 
 // EVENT LIST ------------------------------------------------------------
 $sc_style['EVENTLIST_CAPTION']['pre'] = "<tr><td class='fcaption' colspan='2'>";
-$sc_style['EVENTLIST_CAPTION']['post'] = ":<br /><br /></td></tr>";
+$sc_style['EVENTLIST_CAPTION']['post'] = ":<br /><br /></td></tr>\n";
 
 $EVENT_EVENTLIST_TABLE_START = "<table style='width:100%' class='fborder'>{EVENTLIST_CAPTION}";
 $EVENT_EVENTLIST_TABLE_END = "</table>";
@@ -83,16 +87,16 @@
 
 // EVENT ARCHIVE ------------------------------------------------------------
 $sc_style['EVENTARCHIVE_CAPTION']['pre'] = "<tr><td colspan='2' class='fcaption'>";
-$sc_style['EVENTARCHIVE_CAPTION']['post'] = "</td></tr>";
+$sc_style['EVENTARCHIVE_CAPTION']['post'] = "</td></tr>\n";
 
 $EVENT_ARCHIVE_TABLE_START = "<br /><table style='width:100%' class='fborder'>{EVENTARCHIVE_CAPTION}";
 $EVENT_ARCHIVE_TABLE = "
 <tr>
-	<td style='width:35%; vertical-align:top' class='forumheader3'>{EVENTARCHIVE_DATE}</td>
+	<td style='width:35%; vertical-align:top' class='forumheader3'>{EVENT_RECENT_ICON}{EVENTARCHIVE_DATE}</td>
 	<td style='width:65%' class='forumheader3'>{EVENTARCHIVE_HEADING}</td>
-</tr>";
+</tr>\n";
 //<br />{EVENTARCHIVE_DETAILS}
-$EVENT_ARCHIVE_TABLE_EMPTY = "<tr><td colspan='2' class='forumheader3'>{EVENTARCHIVE_EMPTY}</td></tr>";
+$EVENT_ARCHIVE_TABLE_EMPTY = "<tr><td colspan='2' class='forumheader3'>{EVENTARCHIVE_EMPTY}</td></tr>\n";
 $EVENT_ARCHIVE_TABLE_END = "</table>";
 
 
@@ -101,8 +105,11 @@
 $EVENT_EVENT_TABLE_START = "<table style='width:100%' class='fborder' cellspacing='0' cellpadding='0'>";
 $EVENT_EVENT_TABLE_END = "</table>";
 
+$sc_style['EVENT_HEADING_DATE']['pre'] = "";
+$sc_style['EVENT_HEADING_DATE']['post'] = "";
+
 $sc_style['EVENT_DETAILS']['pre'] = "<tr><td colspan='2' class='forumheader3'>";
-$sc_style['EVENT_DETAILS']['post'] = "</td></tr>";
+$sc_style['EVENT_DETAILS']['post'] = "</td></tr>\n";
 
 $sc_style['EVENT_LOCATION']['pre'] = "<b>".EC_LAN_32."</b> ";
 $sc_style['EVENT_LOCATION']['post'] = "";
@@ -114,37 +121,45 @@
 $sc_style['EVENT_CONTACT']['post'] = "&nbsp;";
 
 $sc_style['EVENT_THREAD']['pre'] = "<tr><td colspan='2' class='forumheader3'><span class='smalltext'>";
-$sc_style['EVENT_THREAD']['post'] = "</span></td></tr>";
+$sc_style['EVENT_THREAD']['post'] = "</span></td></tr>\n";
 
 $sc_style['EVENT_CATEGORY']['pre'] = "<b>".EC_LAN_30."</b> ";
 $sc_style['EVENT_CATEGORY']['post'] = "&nbsp;";
 
-$sc_style['EVENT_DATE_START']['pre'] = "";
+$sc_style['EVENT_DATE_START']['pre'] = (isset($thisevent['event_allday']) && $thisevent['event_allday']) ? "<b>".EC_LAN_68."</b> " : "<b>".EC_LAN_29."</b> ";
 $sc_style['EVENT_DATE_START']['post'] = "";
 
-$sc_style['EVENT_DATE_END']['pre'] = "";
+$sc_style['EVENT_TIME_START']['pre'] = EC_LAN_144;
+$sc_style['EVENT_TIME_START']['post'] = "";
+
+$sc_style['EVENT_DATE_END']['pre'] = "<b>".EC_LAN_69."</b> ";
 $sc_style['EVENT_DATE_END']['post'] = "";
 
+$sc_style['EVENT_TIME_END']['pre'] = EC_LAN_144;
+$sc_style['EVENT_TIME_END']['post'] = "";
+
 $EVENT_EVENT_TABLE = "
 <tr>
 	<td >
-		<div title='".EC_LAN_132."' class='fcaption' style='cursor:pointer; text-align:left; border:0px solid #000;' onclick=\"expandit('{EVENT_ID}')\">{EVENT_HEADING}</div>
+		<div title='".EC_LAN_132."' class='fcaption' style='cursor:pointer; text-align:left; border:0px solid #000;' onclick=\"expandit('{EVENT_ID}')\">{EVENT_RECENT_ICON}{EVENT_CAT_ICON}{EVENT_HEADING_DATE}{EVENT_TIME_START}&nbsp;-&nbsp;{EVENT_TITLE}</div>
 		<div id='{EVENT_ID}' style='display:{EVENT_DISPLAYSTYLE}; padding-top:10px; padding-bottom:10px; text-align:left;'>
 			<table style='width:100%;'  cellspacing='0' cellpadding='0'>
-				<tr><td colspan='2' class='forumheader3'>{EVENT_AUTHOR} {EVENT_CATEGORY} {EVENT_CONTACT} {EVENT_OPTIONS}</td></tr>
-				<tr><td colspan='2' class='forumheader3'>{EVENT_DATE_START} {EVENT_DATE_END}</td></tr>
+				<tr><td colspan='2' class='forumheader3'>{EVENT_AUTHOR} {EVENT_CAT_ICON} {EVENT_CATEGORY} {EVENT_CONTACT} {EVENT_OPTIONS}</td></tr>
+				<tr><td colspan='2' class='forumheader3'>{EVENT_DATE_START}{EVENT_TIME_START} {EVENT_DATE_END}{EVENT_TIME_END}</td></tr>\n
 				<tr><td colspan='2' class='forumheader3'>{EVENT_LOCATION}</td></tr>
 				{EVENT_DETAILS}
 				{EVENT_THREAD}
 			</table>
 		</div>
 	</td>
-</tr>
+</tr>\n
 ";
 
 
 // CALENDAR SHOW EVENT ------------------------------------------------------------
-$CALENDAR_SHOWEVENT = "<table cellspacing='0' cellpadding='0' style='width:100%;'><tr><td style='vertical-align:top; width:10px;'>{SHOWEVENT_IMAGE}</td><td style='vertical-align:top; width:2%;'>{SHOWEVENT_INDICAT}</td><td style='vertical-align:top;'>{SHOWEVENT_HEADING}</td></tr></table>";
+$sc_style['CALENDAR_CALENDAR_RECENT_ICON']['pre'] = "<td style='vertical-align:top; color: #0; background-color: #ff00; width:10px;'>";
+$sc_style['CALENDAR_CALENDAR_RECENT_ICON']['post'] = "</td>";
+$CALENDAR_SHOWEVENT = "<table cellspacing='0' cellpadding='0' style='width:100%;'><tr>{CALENDAR_CALENDAR_RECENT_ICON}<td style='vertical-align:top; width:10px;'>{SHOWEVENT_IMAGE}</td><td style='vertical-align:top; width:2%;'>{SHOWEVENT_INDICAT}</td><td style='vertical-align:top;'>{SHOWEVENT_HEADING}</td></tr>\n</table>";
 
 
 
@@ -154,17 +169,17 @@
 <table cellpadding='0' cellspacing='1' class='fborder' style='background-color:#DDDDDD; width:100%'>";
 
 $CALENDAR_CALENDAR_END = "
-</tr></table></div>";
+</tr>\n</table></div>";
 
 $CALENDAR_CALENDAR_DAY_NON = "<td style='width:12%;height:60px;'></td>";
 
 //header row
 $CALENDAR_CALENDAR_HEADER_START = "<tr>";
 $CALENDAR_CALENDAR_HEADER = "<td class='fcaption' style='z-index: -1; background-color:#000; color:#FFF; width:90px; height:20px; text-align:center; vertical-align:middle;'>{CALENDAR_CALENDAR_HEADER_DAY}</td>";
-$CALENDAR_CALENDAR_HEADER_END = "</tr><tr>";
+$CALENDAR_CALENDAR_HEADER_END = "</tr>\n<tr>";
 
 
-$CALENDAR_CALENDAR_WEEKSWITCH = "</tr><tr>";
+$CALENDAR_CALENDAR_WEEKSWITCH = "</tr>\n<tr>";
 
 //today
 $CALENDAR_CALENDAR_DAY_TODAY = "
@@ -183,5 +198,72 @@
 
 $CALENDAR_CALENDAR_DAY_END = "</td>";
 
+//====================================================================
+// Calendar menu templates
+$CALENDAR_MENU_START = "<div style='text-align:center'>";
+$CALENDAR_MENU_TABLE_START =   "<table cellpadding='0' cellspacing='1' style='width:100%' class='fborder'>";
+
+$CALENDAR_MENU_END = "</tr></table></div>";
+
+// Blank cells at beginning and end
+$CALENDAR_MENU_DAY_NON = "<td class='forumheader3' style='padding:1px; text-align:center'><br /></td>";
+
+//header row
+$CALENDAR_MENU_HEADER_START = "<tr>\n";
+$CALENDAR_MENU_HEADER_FRONT = "<td class='forumheader' style='text-align:center; vertical-align:middle;'><span class='smalltext'>";
+$CALENDAR_MENU_HEADER_BACK = "</span></td>";
+$CALENDAR_MENU_HEADER_END = "</tr>\n<tr>";
+
+
+$CALENDAR_MENU_WEEKSWITCH = "</tr>\n<tr>";
+
+// Start and end CSS for date cells - six cases to decode, determined by array index:
+//     	1 - Today, no events
+//		2 - Some other day, no events (or no icon defined)
+//		3 - Today with events (and icon defined)
+//		4 - Some other day with events (and icon defined)
+//		5 - today with events, one or more of which has recently been added/updated (and icon defined)
+//		6 - Some other day with events, one or more of which has recently been added/updated (and icon defined)
+ 
+//today, no events
+$CALENDAR_MENU_DAY_START['1'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center; '>";
+
+// no events and not today
+$CALENDAR_MENU_DAY_START['2'] = "<td class='forumheader3' style='width:14.28%; padding:1px; text-align:center; '>";
+
+//day has events - same whether its today or not
+$CALENDAR_MENU_DAY_START['3'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center; '>";
+$CALENDAR_MENU_DAY_START['4'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center;'>";
+// day has events, one which is recently added/updated
+$CALENDAR_MENU_DAY_START['5'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center; '>";
+$CALENDAR_MENU_DAY_START['6'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center;'>";
+// Example highlight using background colour:
+//$CALENDAR_MENU_DAY_START['5'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center; background-color: #FF8000;'>";
+//$CALENDAR_MENU_DAY_START['6'] = "<td class='indent' style='width:14.28%; padding:1px; text-align:center; background-color: #FF0000; '>";
+
+$CALENDAR_MENU_DAY_END['1'] = "</td>";
+$CALENDAR_MENU_DAY_END['2'] = "</td>";
+$CALENDAR_MENU_DAY_END['3'] = "</td>";
+$CALENDAR_MENU_DAY_END['4'] = "</td>";
+$CALENDAR_MENU_DAY_END['5'] = "</td>";
+$CALENDAR_MENU_DAY_END['6'] = "</td>";
+
+//============================================================================
+// Next event menu template
+$sc_style['NEXT_EVENT_TIME']['pre'] = EC_LAN_144;
+$sc_style['NEXT_EVENT_TIME']['post'] = "";
+// Following are original styles
+//$sc_style['NEXT_EVENT_ICON']['pre'] = "<img style='border:0px' src='";
+//$sc_style['NEXT_EVENT_ICON']['post'] = "' alt='' />&nbsp;";
+// Following to 'float right' on a larger icon
+$sc_style['NEXT_EVENT_ICON']['pre'] = "<img style='clear: right; float: left; margin: 0px 3px 0px 0px; padding:1px; border: 0px;' src='";
+$sc_style['NEXT_EVENT_ICON']['post'] = "' alt='' />";
+
+
+if (!isset($EVENT_CAL_FE_LINE))
+{  
+  $EVENT_CAL_FE_LINE = "{NEXT_EVENT_ICON}{NEXT_EVENT_DATE}{NEXT_EVENT_TIME}<br /><strong>{NEXT_EVENT_TITLE}</strong>{NEXT_EVENT_GAP}";
+}
+
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/config.php 0.7.7/e107_plugins/calendar_menu/config.php
--- 0.7.5/e107_plugins/calendar_menu/config.php	2005-03-17 20:13:57.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/config.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_plugins/calendar_menu/config.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/03/18 02:13:57 $
-|     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
-*/
-// *BK* This relocates to admin_config.php.  This is because to recognise an admin theme the script has to contain the 
-// *BK* word admin in the filename.  However if you do that then the menu manager doesn't recognise the config file 
-// *BK* which has to be called config.php otherwise there is no config option in the menu's combo
-require_once("../../class2.php");
-header("location:".e_PLUGIN."calendar_menu/admin_config.php");
-
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/e_list.php 0.7.7/e107_plugins/calendar_menu/e_list.php
--- 0.7.5/e107_plugins/calendar_menu/e_list.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/e_list.php	2006-11-06 16:30:22.000000000 -0600
@@ -2,17 +2,21 @@
 
 if (!defined('e107_INIT')) { exit; }
 
-	if(!$calendar_install = $sql -> db_Select("plugin", "*", "plugin_path = 'calendar_menu' AND plugin_installflag = '1' ")){
+	if(!$calendar_install = $sql -> db_Select("plugin", "*", "plugin_path = 'calendar_menu' AND plugin_installflag = '1' "))
+	{
 		return;
 	}
 
 	$LIST_CAPTION = $arr[0];
 	$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
 
-	$todayarray		= getdate();
-	$current_day	= $todayarray['mday'];
-	$current_month	= $todayarray['mon'];
-	$current_year	= $todayarray['year'];
+require_once('ecal_class.php');
+$ecal_class = new ecal_class;
+
+$current_day	= $ecal_class->cal_date['mday'];
+$current_month	= $ecal_class->cal_date['mon'];
+$current_year	= $ecal_class->cal_date['year'];
+
 	$current		= mktime(0,0,0,$current_month, $current_day, $current_year);
 
 	if($mode == "new_page" || $mode == "new_menu" ){
diff -ruN 0.7.5/e107_plugins/calendar_menu/e_notify.php 0.7.7/e107_plugins/calendar_menu/e_notify.php
--- 0.7.5/e107_plugins/calendar_menu/e_notify.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/e_notify.php	2006-11-16 04:24:15.000000000 -0600
@@ -0,0 +1,53 @@
+<?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/calendar_menu/e_notify.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/11/16 10:24:15 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+
+if (!defined('e107_INIT')) { exit; }
+
+if(defined('ADMIN_PAGE') && ADMIN_PAGE === true)
+{
+	include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+	$config_category = NT_LAN_EC_1;
+	$config_events = array('ecalnew' => NT_LAN_EC_7, 'ecaledit' => NT_LAN_EC_2);
+}
+
+if (!function_exists('notify_ecalnew'))
+{
+	function notify_ecalnew($data) {
+		global $nt;
+		include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+		$message = NT_LAN_EC_3.': '.USERNAME.' ('.NT_LAN_EC_4.': '.$data['ip'].' )<br />';
+		$message .= NT_LAN_EC_5.':<br />'.$data['cmessage'].'<br /><br />';
+		$nt -> send('ecaledit', NT_LAN_EC_6, $message);
+	}
+}
+
+if (!function_exists('notify_ecaledit')) {
+	function notify_ecaledit($data) {
+		global $nt;
+		include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+		$message = NT_LAN_EC_3.': '.USERNAME.' ('.NT_LAN_EC_4.': '.$data['ip'].' )<br />';
+		$message .= NT_LAN_EC_5.':<br />'.$data['cmessage'].'<br /><br />';
+		$nt -> send('ecaledit', NT_LAN_EC_8, $message);
+	}
+}
+
+
+
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/e_rss.php 0.7.7/e107_plugins/calendar_menu/e_rss.php
--- 0.7.5/e107_plugins/calendar_menu/e_rss.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/e_rss.php	2006-11-06 16:30:22.000000000 -0600
@@ -0,0 +1,59 @@
+<?php
+
+// Reflects updates to CVS version 1.3 made 29.10.2006
+
+if (!defined('e107_INIT')) { exit; }
+
+//##### create feed for admin, return array $eplug_rss_feed --------------------------------
+$feed['name']		= EC_ADLAN_A12;
+$feed['url']		= 'calendar';			//the identifier for the rss feed url
+$feed['topic_id']	= '';					//the topic_id, empty on default (to select a certain category)
+$feed['path']		= 'calendar_menu';		//this is the plugin path location
+$feed['text']		= EC_ADLAN_A157;
+$feed['class']		= '0';
+$feed['limit']		= '9';
+//##### ------------------------------------------------------------------------------------
+
+require_once('ecal_class.php');
+$ecal_class = new ecal_class;
+
+//##### create rss data, return as array $eplug_rss_data -----------------------------------
+$current_day	= $ecal_class->cal_date['mday'];
+$current_month	= $ecal_class->cal_date['mon'];
+$current_year	= $ecal_class->cal_date['year'];
+$current		= mktime(0,0,0,$current_month, $current_day, $current_year);
+
+$qry = "
+SELECT e.*, c.event_cat_name
+FROM #event AS e
+LEFT JOIN #event_cat AS c ON c.event_cat_id = e.event_category
+WHERE e.event_start>='$current' AND c.event_cat_class REGEXP '".e_CLASS_REGEXP."'
+ORDER BY e.event_start ASC LIMIT 0,".$this->limit;
+
+$rss = array();
+$sqlrss = new db;
+if($items = $sqlrss->db_Select_gen($qry)){
+	$i=0;
+	while($rowrss = $sqlrss -> db_Fetch()){
+		$tmp						= explode(".", $rowrss['event_author']);
+		$rss[$i]['author']			= $tmp[1];
+		$rss[$i]['author_email']	= '';
+		$rss[$i]['link']			= $e107->base_path.$PLUGINS_DIRECTORY."calendar_menu/event.php?".$rowrss['event_start'].".event.".$rowrss['event_id'];
+		$rss[$i]['linkid']			= $rowrss['event_id'];
+		$rss[$i]['title']			= $rowrss['event_title'];
+		$rss[$i]['description']		= '';
+		$rss[$i]['category_name']	= $rowrss['event_cat_name'];
+		$rss[$i]['category_link']	= '';
+		$rss[$i]['datestamp']		= $rowrss['event_start'];
+		$rss[$i]['enc_url']			= "";
+		$rss[$i]['enc_leng']		= "";
+		$rss[$i]['enc_type']		= "";
+		$i++;
+	}
+}
+//##### ------------------------------------------------------------------------------------
+
+$eplug_rss_feed[] = $feed;
+$eplug_rss_data[] = $rss;
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/ecal_class.php 0.7.7/e107_plugins/calendar_menu/ecal_class.php
--- 0.7.5/e107_plugins/calendar_menu/ecal_class.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/ecal_class.php	2006-11-16 04:24:14.000000000 -0600
@@ -0,0 +1,245 @@
+<?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/calendar_menu/ecal_class.php,v $
+|     $Revision: 1.2 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| Event calendar class for gradual enhancement
+| (Some bits may be usefully transferred to common code later)
+|
+| 11.11.06 	- Add date formatting options
+|			- Add notify
+|
++----------------------------------------------------------------------------+
+*/
+
+/*
+Preferences used:
+  eventpost_caltime			1 = server, 2 = site, 3 = user
+  eventpost_timedisplay		1 = 24 hour, 2 = 12 hour default, 3 = custom
+  eventpost_timecustom		String for custom time display
+
+  date() returns formatted date/time string
+*/
+  class ecal_class
+  {
+  // Useful time/date variables - set up on creation, and available externally
+  // (All the times and dates are consistent, being derived from $time_now, which is the time the constructor was
+  // called - probably doesn't matter, but may help someone.
+	var $time_now;						// Current time/date stamp
+	var $site_timedate;					// Site time/date stamp - adjusted for time zone
+	var $user_timedate;					// Time/date based on user's time zone
+	var $cal_timedate;					// Time/date stamp used by event calendar (user set)
+	var $now_date;						// Time/date array from $time_now
+	var $site_date;						// Time/date array from $site_timedate
+	var $cal_date ;						// Time/date array from $cal_timedate
+	
+	var $cal_super;						// True if current user is a calendar supervisor
+	var $extra_query;					// Extra bit of mysql query used for non-supervisor (read) queries
+	
+	var $time_format_string;			// String to format times on the site
+	var $cal_format_string;				// String to format the displayed date on event entry ("Y-m-d" or "d-m-Y")
+	var $dcal_format_string;			// Format string to pass to DHTML calendar
+	var $java_format_code;				// Code to pass to Javascript re date format
+	
+	var $event_date_format_string;		// String to format the date in the event calendar
+	var $next_date_format_string;		// String to format the date in the 'forthcoming event' menu
+	
+	var $max_cache_time;				// Oldest permissible age of any cached pages relating to event calendar
+	var $max_recent_show;				// Time in seconds for showing 'recent events'
+	
+    function ecal_class()
+	{  // Constructor
+	  global $pref;
+	  
+	  $this->time_now = time();
+	  $this->site_timedate = $this->time_now + ($pref['time_offset'] * 3600);			// Check sign of offset
+	  $this->user_timedate = $this->time_now + TIMEOFFSET;
+	  switch ($pref['eventpost_caltime'])
+	  {
+	    case 1 :
+	      $this->cal_timedate  = $this->site_timedate;		// Site time
+		  break;
+		case 2 :
+	      $this->cal_timedate  = $this->user_timedate;		// User
+		  break;
+		default :
+	      $this->cal_timedate = $this->time_now;			// Server time - default
+	  }
+	  $this->now_date  = getdate($this->time_now);
+	  $this->site_date = getdate($this->site_timedate);	// Array with h,m,s, day, month year etc
+	  $this->cal_date  = getdate($this->cal_timedate);
+	  
+	  $this->max_cache_time = $this->site_date['minutes'] + 60*$this->site_date['hours'];
+	  
+	  $this->cal_super = check_class($pref['eventpost_super']);
+	  if ($this->cal_super) $this->extra_query = ""; else $this->extra_query = " AND find_in_set(event_cat_class,'".USERCLASS_LIST."')";
+
+	  if (isset($pref['eventpost_recentshow']) && ($pref['eventpost_recentshow'] != 0))
+	  {
+	    $this->max_recent_show = 3600 * $pref['eventpost_recentshow'];
+	  }
+	  else
+	  {
+	    $this->max_recent_show = 0;
+	  }
+	  switch ($pref['eventpost_timedisplay'])
+	  {
+	    case 2 : 
+		  $this->time_format_string = "%I:%M %p";      // 12-hour display
+		  break;
+		case 3 :
+		  $this->time_format_string = $pref['eventpost_timecustom'];      // custom display
+		  if (isset($this->time_format_string)) break;
+		default :
+		  $this->time_format_string = "%H%M";      // default to 24-hour display
+	  }
+	  
+	  switch ($pref['eventpost_datedisplay'])
+	  {  // Event entry calendar
+	    case 2 :
+	      $this->cal_format_string = "d-m-Y";
+		  $this->dcal_format_string = "%d-%m-%Y";
+		  $this->java_format_code = 2;
+		  break;
+	    case 3 :
+	      $this->cal_format_string = "m-d-Y";
+		  $this->dcal_format_string = "%m-%d-%Y";
+		  $this->java_format_code = 3;
+		  break;
+	    default :  // 'original' defaults
+	      $this->cal_format_string = "Y-m-d";
+		  $this->dcal_format_string = "%Y-%m-%d";
+		  $this->java_format_code = 1;
+	  }
+	  
+	  switch ($pref['eventpost_dateevent'])
+	  {  // Event list date display
+		case 0 :
+		  $this->event_date_format_string = $pref['eventpost_eventdatecustom'];
+		  break;
+	    case 2 : 
+		  $this->event_date_format_string = "%a %d %b %Y";
+		  break;
+	    case 3 : 
+		  $this->event_date_format_string = "%a %d-%m-%y";
+		  break;
+	    default : 
+		  $this->event_date_format_string = "%A %d %B %Y";
+	  }
+	  
+	  switch ($pref['eventpost_datenext'])
+	  {  // Forthcoming event date display
+	    case 0 : 
+		  $this->next_date_format_string = $pref['eventpost_nextdatecustom'];
+		  break;
+	    case 2 : 
+		  $this->next_date_format_string = "%d %b";
+		  break;
+	    case 3 : 
+		  $this->next_date_format_string = "%B %d";
+		  break;
+	    case 4 : 
+		  $this->next_date_format_string = "%b %d";
+		  break;
+	    default : 
+		  $this->next_date_format_string = "%d %B";
+	  }
+	}
+	
+	function time_string($convtime)
+	{  // Returns a time string from a time stamp, formatted as 24-hour, 12-hour or custom as set in prefs
+	  return strftime($this->time_format_string, $convtime);
+	}
+
+	function event_date_string($convdate)
+	{  // Returns a date string from a date stamp, formatted for display in event list
+	  return strftime($this->event_date_format_string,$convdate);
+	}
+	
+	
+	function next_date_string($convdate)
+	{  // Returns a date string from a date stamp, formatted for display in forthcoming event menu
+	  return strftime($this->next_date_format_string,$convdate);
+	}
+	
+	
+	function full_date($convdate)
+	{  // Returns a date as dd-mm-yyyy or yyyy-mm-dd according to prefs (for event entry)
+	  return date($this->cal_format_string, $convdate);
+	}
+	
+	function make_date($new_hour, $new_minute, $date_string)
+	{   // Turns a date as entered in the calendar into a time stamp (for event entry)
+	  global $pref;
+      $tmp = explode("-", $date_string);
+	  switch ($pref['eventpost_datedisplay'])
+	  {
+	    case 2 :
+          return  mktime($new_hour, $new_minute, 0, $tmp[1], $tmp[0], $tmp[2]);    // dd-mm-yyyy
+		case 3 :
+          return  mktime($new_hour, $new_minute, 0, $tmp[0], $tmp[1], $tmp[2]);		// mm-dd-yyyy
+		default :
+          return  mktime($new_hour, $new_minute, 0, $tmp[1], $tmp[2], $tmp[0]);		// yyyy-mm-dd
+	  }
+	}
+	
+	function cal_log($event_type, $event_title = '', $event_string='', $event_start=0)
+	{  // All calendar-related logging intentionally passed through a single point to maintain control
+	   // (so we could also add other info if we wanted)
+	   // Event types:
+	   //   1 - add event
+	   //	2 - edit event
+	   //	3 - delete event
+	   // 	4 - Bulk delete
+	  global $pref, $admin_log, $e_event;
+	  
+	  $log_titles = array(	'1' => 'Event Calendar - add event',
+							'2' => 'Event Calendar - edit event',
+							'3' => 'Event Calendar - delete event',
+							'4' => 'Event Calendar - Bulk Delete'
+							);
+// Do the notifies first
+	  $cmessage = $log_titles[$event_type]."<br />";
+	  if ($event_start > 0)
+	    $cmessage .= "Event Start: ".strftime("%d-%B-%Y",$event_start)."<br />";
+	  else
+	    $cmessage .= "Event Start unknown<br />";
+	  $edata_ec = array("cmessage" => $cmessage, "ip" => getip());
+	  switch ($event_type)
+	  {
+	    case 1 : $e_event -> trigger("ecalnew", $edata_ec);
+				 break;
+	    case 2 :
+		case 3 :
+		case 4 : $e_event -> trigger("ecaledit", $edata_ec);
+				 break;
+	  }
+
+	  switch ($pref['eventpost_adminlog'])
+	  {
+	    case 1 : if ($event_type == '1') return;
+		case 2 : break;   // Continue
+		default : return;   // Invalid or undefined option
+	  }
+	  $log_titles = array(	'1' => 'Event Calendar - add event',
+							'2' => 'Event Calendar - edit event',
+							'3' => 'Event Calendar - delete event',
+							'4' => 'Event Calendar - Bulk Delete'
+							);
+	  $admin_log->log_event($log_titles[$event_type],$event_title."&nbsp;\n".$event_string,4);
+	}
+  }
+
+?>
diff -ruN 0.7.5/e107_plugins/calendar_menu/event.php 0.7.7/e107_plugins/calendar_menu/event.php
--- 0.7.5/e107_plugins/calendar_menu/event.php	2006-01-12 16:18:29.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/event.php	2006-11-16 04:24:14.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dun.an 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jali.@e107.org
 |
@@ -11,37 +11,49 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/event.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2006/01/12 22:18:29 $
-|     $Author: lisa_ $
+|     $Revision: 1.30 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| 09.11.06 - Started next batch of mods
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 require_once(e_PLUGIN."calendar_menu/calendar_shortcodes.php");
+
 if (isset($_POST['viewallevents']))
-{
+{  // Triggered from NAV_BUT_ALLEVENTS
     Header("Location: ".e_PLUGIN."calendar_menu/calendar.php?".$_POST['enter_new_val']);
-} 
+}
 
 if (isset($_POST['doit']))
-{
+{  // Triggered from NAV_BUT_ENTEREVENT
     Header("Location: ".e_PLUGIN."calendar_menu/event.php?ne.".$_POST['enter_new_val']);
-} 
+}
+
 if (isset($_POST['subs']))
 {
     Header("Location: ".e_PLUGIN."calendar_menu/subscribe.php");
-} 
+}
 
-$ec_dir		= e_PLUGIN."calendar_menu/";
-$lan_file	= $ec_dir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php");
+@include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
 define("PAGE_NAME", EC_LAN_80);
 
-$cal_super	= check_class($pref['eventpost_super']);
+require_once(e_PLUGIN.'calendar_menu/ecal_class.php');
+global $ecal_class;
+$ecal_class = new ecal_class;
+$cal_super = $ecal_class->cal_super;
 
 require_once(e_HANDLER."calendar/calendar_class.php");
 $cal = new DHTML_Calendar(true);
 
+$category_filter = "";
+if  ((isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] != "all"))
+{
+  $category_filter = " AND (e.event_category = '".$_POST['event_cat_ids']."') ";
+}
+
+/*
 // enter new category into db
 if (isset($_POST['ne_cat_create']))
 {
@@ -49,114 +61,114 @@
     {
         $sql->db_Insert("event_cat", "0, '".$tp->toDB($_POST['ne_new_category'])."', '".$tp->toDB($_POST['ne_new_category_icon'])."', '0', '0', '0', '0', '', '', '0', '0', '0', '".time()."', '0'  ");
         header("location:event.php?".$_POST['qs'].".m1");
-    } 
+    }
     else
     {
         header("location:event.php?".$_POST['qs'].".m3");
-    } 
-} 
-// enter new event into db
-if (isset($_POST['ne_insert']) && USER == true)
-{
-    if ($_POST['ne_event'] == ""){
-		header("location:event.php?".$ev_start.".m3");
-	}else{
-        $tmp			= explode("-", $_POST['start_date']);
-        $ev_start		= mktime($_POST['ne_hour'], $_POST['ne_minute'], 0, $tmp[1], $tmp[2], $tmp[0]);
-        $tmp			= explode("-", $_POST['end_date']);
-        $ev_end			= mktime($_POST['end_hour'], $_POST['end_minute'], 0, $tmp[1], $tmp[2], $tmp[0]);
-        $ev_title		= $tp->toDB($_POST['ne_title']);
-        $ev_location	= $tp->toDB($_POST['ne_location']);
-        $ev_event		= $tp->toDB($_POST['ne_event']);
-
-        if ($_POST['recurring'] == 1){
-			$rec_m = substr($_POST['start_date'], 8,2);
-            $rec_y = substr($_POST['start_date'], 5,2);
-        }else{
-            $rec_m = "";
-            $rec_y = "";
-        } 
-
-        $sql->db_Insert("event", " 0, '".intval($ev_start)."', '".intval($ev_end)."', '".intval($_POST['allday'])."', '".intval($_POST['recurring'])."', '".time()."', '$ev_title', '$ev_location', '$ev_event', '".USERID.".".USERNAME."', '".$tp -> toDB($_POST['ne_email'])."', '".intval($_POST['ne_category'])."', '".$tp -> toDB($_POST['ne_thread'])."', '".intval($rec_m)."', '".intval($rec_y)."' ");
-        $qs = preg_replace("/ne./i", "", $_POST['qs']);
-        header("location:event.php?".$qs.".m4");
-    }
-} 
-
-// update event in db
-if (isset($_POST['ne_update']) && USER == true)
-{
-    if ($_POST['ne_event'] == ""){
-		header("location:event.php?".$_POST['qs'].".m3");
-	}else{
-        $tmp			= explode("-", $_REQUEST['start_date']);
-        $ev_start		= mktime($_POST['ne_hour'], $_POST['ne_minute'], 0, $tmp[1], $tmp[2], $tmp[0]);
-        $tmp			= explode("-", $_POST['end_date']);
-        $ev_end			= mktime($_POST['end_hour'], $_POST['end_minute'], 0, $tmp[1], $tmp[2], $tmp[0]);
-        $ev_title		= $tp->toDB($_POST['ne_title']);
-        $ev_location	= $tp->toDB($_POST['ne_location']);
-        $ev_event		= $tp->toDB($_POST['ne_event']);
-
-        if ($_POST['recurring'] == 1){
-			$rec_m = substr($_POST['start_date'], 8,2);
-            $rec_y = substr($_POST['start_date'], 5,2);
-        }else{
-            $rec_m = "";
-            $rec_y = "";
-        } 
-
-        $sql->db_Update("event", "event_start='".intval($ev_start)."', event_end='".intval($ev_end)."', event_allday='".intval($_POST['allday'])."', event_recurring='".intval($_POST['recurring'])."', event_datestamp= '".time()."', event_title= '$ev_title', event_location='$ev_location', event_details='$ev_event', event_contact='".$tp -> toDB($_POST['ne_email'])."', event_category='".intval($_POST['ne_category'])."', event_thread='".$tp -> toDB($_POST['ne_thread'])."', event_rec_m='".intval($rec_m)."', event_rec_y='".intval($rec_y)."' WHERE event_id='".intval($_POST['id'])."' ");
-        $qs = preg_replace("/ed./i", "", $_POST['qs']);
-
-        header("location:event.php?".$ev_start.".".$qs.".m5");
     }
-} 
+}
+*/
+// Event to add or update
+if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && USER == true)
+{  
+  if (($_POST['ne_event'] == "") || !isset($_POST['qs']))
+  {	// Problem - tell user to go away
+	header("location:event.php?".$ev_start.".m3");
+  }
+  else
+  {
+	$ev_start		= $ecal_class->make_date($_POST['ne_hour'], $_POST['ne_minute'],$_POST['start_date']);
+	$ev_end			= $ecal_class->make_date($_POST['end_hour'], $_POST['end_minute'],$_POST['end_date']);
+    $ev_title		= $tp->toDB($_POST['ne_title']);
+    $ev_location	= $tp->toDB($_POST['ne_location']);
+    $ev_event		= $tp->toDB($_POST['ne_event']);
+	$temp_date 		= getdate($ecal_class->make_date(0,0,$_POST['start_date']));
+    if ($_POST['recurring'] == 1)
+	{
+	  $rec_m = $temp_date['mday'];		// Day of month
+      $rec_y = $temp_date['mon'];			// Month number
+    }
+	else
+	{
+      $rec_m = "";
+      $rec_y = "";
+    }
+	
+	$report_msg = '.m3';
+    if (isset($_POST['ne_insert']))
+	{  // Bits specific to inserting a new event
+		$qry = " 0, '".intval($ev_start)."', '".intval($ev_end)."', '".intval($_POST['allday'])."', '".intval($_POST['recurring'])."', '".time()."', '$ev_title', '$ev_location', '$ev_event', '".USERID.".".USERNAME."', '".$tp -> toDB($_POST['ne_email'])."', '".intval($_POST['ne_category'])."', '".$tp -> toDB($_POST['ne_thread'])."', '".intval($rec_m)."', '".intval($rec_y)."' ";
+        $sql->db_Insert("event", $qry);
+		$ecal_class->cal_log(1,'db_Insert',$qry, $ev_start);
+        $qs = preg_replace("/ne./i", "", $_POST['qs']);	
+		$report_msg = '.m4';
+	}
+	
+	if (isset($_POST['ne_update']))
+	{  // Bits specific to updating an existing event
+		$qry = "event_start='".intval($ev_start)."', event_end='".intval($ev_end)."', event_allday='".intval($_POST['allday'])."', event_recurring='".intval($_POST['recurring'])."', event_datestamp= '".time()."', event_title= '$ev_title', event_location='$ev_location', event_details='$ev_event', event_contact='".$tp -> toDB($_POST['ne_email'])."', event_category='".intval($_POST['ne_category'])."', event_thread='".$tp -> toDB($_POST['ne_thread'])."', event_rec_m='".intval($rec_m)."', event_rec_y='".intval($rec_y)."' WHERE event_id='".intval($_POST['id'])."' ";
+        $sql->db_Update("event", $qry);
+		$ecal_class->cal_log(2,'db_Update',$qry, $ev_start);
+        $qs = preg_replace("/ed./i", "", $_POST['qs']);
+		$report_msg = '.m5';
+	}
+	// Now clear cache  - just do the lot for now - get clever later
+	$e107cache->clear('nq_event_cal');
+    header("location:event.php?".$ev_start.".".$qs.$report_msg);
+  }
+}
 
+$action = "";		// Remove notice
 
 require_once(HEADERF);
 
 if (isset($_POST['jump']))
 {
-		$smarray	= getdate(mktime(0, 0, 0, $_POST['jumpmonth'], 1, $_POST['jumpyear']));
-		$month		= $smarray['mon'];
-		$year		= $smarray['year'];
-} 
+  $smarray	= getdate(mktime(0, 0, 0, $_POST['jumpmonth'], 1, $_POST['jumpyear']));
+  $month	= $smarray['mon'];
+  $year		= $smarray['year'];
+}
 else
 {
-    if(e_QUERY){
+    if(e_QUERY)
+	{
 		$qs			= explode(".", e_QUERY);
-		$action		= $qs[0];
+		$action		= $qs[0];			// Often a date if just viewing
 		$ds			= (isset($qs[1]) ? $qs[1] : "");
 		$eveid		= (isset($qs[2]) ? $qs[2] : "");
 	}
+	
     if ($action == "")
     {
-        $nowarray	= getdate();
-        $month		= $nowarray['mon'];
-        $year		= $nowarray['year'];
-    } 
+        $month		= $ecal_class->cal_date['mon'];
+        $year		= $ecal_class->cal_date['year'];
+    }
     else
     {
         $smarray	= getdate($action);
         $month		= $smarray['mon'];
         $year		= $smarray['year'];
-    } 
-} 
+    }
+}
+
 
 if (isset($_POST['confirm']))
 {
-    if ($sql->db_Delete("event", "event_id='".intval($_POST['existing'])."' "))
+	$qry = "event_id='".intval($_POST['existing'])."' ";
+    if ($sql->db_Delete("event", $qry))
     {
         $message = EC_LAN_51; //Event Deleted
-    } 
+		$ecal_class->cal_log(3,'db_Delete',$qry,$ev_start);
+    }
     else
     {
-        $message = EC_LAN_109; //Unable to Delete event for some my.erious reason
-    } 
-} 
+        $message = EC_LAN_109; //Unable to Delete event for some mysterious reason
+    }
+}
+
 
 if ($action == "de")
-{
+{  // Delete event - show confirmation form
     $text = "<div style='text-align:center'>
 	<b>".EC_LAN_48."</b>
 	<br /><br />
@@ -170,92 +182,121 @@
     $ns->tablerender(EC_LAN_46, $text); // Confirm Delete Event
     require_once(FOOTERF);
     exit;
-} 
+}
+
+
+
 if (isset($_POST['cancel']))
-{
-    $message = EC_LAN_47; 
-    // Delete Cancelled
+{    // Delete Cancelled
+    $message = EC_LAN_47;
 }
 
+
 // set up data arrays ----------------------------------------------------------------------------------
+// (some of these are only used in the shortcodes)
 if ($pref['eventpost_weekstart'] == 'sun')
 {
     $days	= Array(EC_LAN_25, EC_LAN_19, EC_LAN_20, EC_LAN_21, EC_LAN_22, EC_LAN_23, EC_LAN_24);
-} 
+}
 else
 {
     $days	= Array(EC_LAN_19, EC_LAN_20, EC_LAN_21, EC_LAN_22, EC_LAN_23, EC_LAN_24, EC_LAN_25);
-} 
+}
 $dayslo		= array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.', '14.', '15.', '16.', '17.', '18.', '19.', '20.', '21.', '22.', '23.', '24.', '25.', '26.', '27.', '28.', '29.', '30.', '31.');
 $monthabb	= Array(EC_LAN_JAN, EC_LAN_FEB, EC_LAN_MAR, EC_LAN_APR, EC_LAN_MAY, EC_LAN_JUN, EC_LAN_JUL, EC_LAN_AUG, EC_LAN_SEP, EC_LAN_OCT, EC_LAN_NOV, EC_LAN_DEC);
 $months		= array(EC_LAN_0, EC_LAN_1, EC_LAN_2, EC_LAN_3, EC_LAN_4, EC_LAN_5, EC_LAN_6, EC_LAN_7, EC_LAN_8, EC_LAN_9, EC_LAN_10, EC_LAN_11);
 // ----------------------------------------------------------------------------------------------------------
 
-if (isset($qs[2]) && $qs[2] == "m1")
-{
-    $message = EC_LAN_41; //"New category created.";
-} 
-else if (isset($qs[2]) && $qs[2] == "m2")
-{
-    $message = EC_LAN_42; //"Event cannot end before it starts.";
-} 
-else if (isset($qs[2]) && $qs[2] == "m3")
-{
-    $message = EC_LAN_43; //"You left required field(s) blank.";
-} 
-else if (isset($qs[2]) && $qs[2] == "m4")
-{
-    $message = EC_LAN_44; //"New event created and entered into database.";
-} elseif (isset($qs[2]) && $qs[2] == "m5")
-{
-    $message = EC_LAN_45; //"Event updated in database.";
-} 
+// Messages acknowledging actions
+$poss_message = array('m1' => EC_LAN_41, 'm2' => EC_LAN_42, 'm3' => EC_LAN_43, 'm4' => EC_LAN_44, 'm5' => EC_LAN_45);
+if (isset($qs[2])) if (isset($poss_message[$qs[2]])) $message = $poss_message[$qs[2]];
 
 if (isset($message))
 {
     $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
 
+
 // enter new event form
 if ($action == "ne" || $action == "ed")
 {
-    if ($cal_super || check_class($pref['eventpost_admin']))
+    if ($ecal_class->cal_super || check_class($pref['eventpost_admin']))
     {
+function make_calendar($boxname, $boxvalue)
+{
+	global $ecal_class, $cal;
+	
+        unset($cal_options);
+        unset($cal_attrib);
+        $cal_options['firstDay'] = 0;
+        $cal_options['showsTime'] = false;
+        $cal_options['showOthers'] = true;
+        $cal_options['weekNumbers'] = false;
+        $cal_options['ifFormat'] = $ecal_class->dcal_format_string;
+        $cal_attrib['class'] = "tbox";
+        $cal_attrib['size'] = "12";
+        $cal_attrib['name'] = $boxname;
+        $cal_attrib['value'] = $boxvalue;
+        return $cal->make_input_field($cal_options, $cal_attrib);
+}
+
+
+function make_hourmin($boxname,$cur_hour,$cur_minute)
+{
+  global $pref;
+  if (isset($pref['eventpost_fivemins'])) $incval = 5; else $incval = 1;
+  $retval = " <select name='{$boxname}hour' id='{$boxname}hour' class='tbox'>\n";
+  for($count = "00"; $count <= "23"; $count++)
+  {
+    $val = sprintf("%02d", $count);
+    $retval .= "<option value='{$val}' ".(isset($cur_hour) && $count == $cur_hour ? "selected='selected'" :"")." >".$val."</option>\n";
+  }
+  $retval .= "</select>\n
+		<select name='{$boxname}minute' class='tbox'>\n";
+  for($count = "00"; $count <= "59"; $count+= $incval)
+  {
+    $val = sprintf("%02d", $count);
+    $retval .= "<option ".(isset($cur_minute) && $count == $cur_minute ? "selected='selected'" :"")." value='{$val}'>".$val."</option>\n";
+  }
+  $retval .= "</select>\n";
+  return $retval;
+}
+
+
         if ($action == "ed")
-        {
+        {	// Editing existing event - read from database
             $sql->db_Select("event", "*", "event_id='".intval($qs[1])."' ");
             list($null, $ne_start, $ne_end, $allday, $recurring, $ne_datestamp, $ne_title, $ne_location, $ne_event, $ne_author, $ne_email, $ne_category, $ne_thread) = $sql->db_Fetch();
 
             $smarray = getdate($ne_start);
             $ne_hour = $smarray['hours'];
             $ne_minute = $smarray['minutes'];
-            $ne_startdate = date("Y-m-d", $ne_start);
+            $ne_startdate = $ecal_class->full_date($ne_start);
 
             $smarray = getdate($ne_end);
             $end_hour = $smarray['hours'];
             $end_minute = $smarray['minutes'];
-            $ne_enddate = date("Y-m-d", $ne_end);
-        } 
+            $ne_enddate = $ecal_class->full_date($ne_end);
+        }
         else
-        {
+        {	// New event - initialise everything
             $smarray = getdate($qs[1]);
             $month = $smarray['mon'];
             $year = $smarray['year'];
-            $ne_startdate = date("Y-m-d", $qs[1]);
+            $ne_startdate = $ecal_class->full_date($qs[1]);
 
             $ne_hour = $smarray['hours'];
             $ne_minute = $smarray['minutes'];
 
             $end_hour = $smarray['hours'];
             $end_minute = $smarray['minutes'];
-            $ne_enddate = date("Y-m-d", $qs[1]);
-        } 
+            $ne_enddate = $ecal_class->full_date($qs[1]);
+        }
 
-        
 		$text = "
 		<script type=\"text/javascript\">
 		<!--
-		function calcheckform(thisform, submitted)
+		function calcheckform(thisform, submitted,arrstr)
 		{
 			var testresults=true;
 
@@ -269,13 +310,30 @@
 				}
 			}
 
-			//event check
-			var temp;
-			temp = thisform.start_date.value.split(\"-\");
-			var sdate = temp[0] + temp[1] + temp[2] + thisform.ne_hour.options[thisform.ne_hour.selectedIndex].value + thisform.ne_minute.options[thisform.ne_minute.selectedIndex].value
-			temp = thisform.end_date.value.split(\"-\");
-			var edate = temp[0] + temp[1] + temp[2] + thisform.end_hour.options[thisform.end_hour.selectedIndex].value + thisform.end_minute.options[thisform.end_minute.selectedIndex].value
-
+			function calcdate(thisval)
+			{
+			  var temp1;
+			  temp1 = thisval.split(\"-\");
+			  switch (arrstr)
+			  {
+			    case 2 : return temp1[2]+temp1[1]+temp1[0];
+			    case 3 : return temp1[2]+temp1[0]+temp1[1];
+			    default : return temp1[0]+temp1[1]+temp1[2];
+			  }
+			  return 'Error';
+			}
+			//event check - dates are text strings
+			var sdate = calcdate(thisform.start_date.value);
+			var edate = calcdate(thisform.end_date.value);
+			if (edate < sdate)
+			{  // Update end date if its before start date
+			  thisform.end_date.value = thisform.start_date.value;
+//			  alert('End date changed');
+			}
+			sdate = calcdate(thisform.start_date.value) + thisform.ne_hour.options[thisform.ne_hour.selectedIndex].value + thisform.ne_minute.options[thisform.ne_minute.selectedIndex].value;
+			edate = calcdate(thisform.end_date.value) + thisform.end_hour.options[thisform.end_hour.selectedIndex].value + thisform.end_minute.options[thisform.end_minute.selectedIndex].value;
+//			alert('Format: ' + arrstr + '    Start date: '+ sdate + '    End date: ' + edate);
+			
 			testresults=true;
 
 			if (edate <= sdate && !thisform.allday.checked && testresults )
@@ -293,7 +351,7 @@
 			{
 				if (thisform.subbed.value=='no')
 				{
-					thisformm.subbed.value='yes';
+					thisform.subbed.value='yes';
 					testresults=true;
 				}
 			else
@@ -306,90 +364,41 @@
 		}
 		-->
 		</script>";
-		
+
 		$text .= "
-		<form method='post' action='".e_SELF."' id='linkform' onsubmit='return calcheckform(this, submitted)'>
+		<form method='post' action='".e_SELF."' id='linkform' onsubmit='return calcheckform(this, submitted,{$ecal_class->java_format_code})'>
 		<table style='width:98%' class='fborder' >";
 
         if ($action == "ed")
         {
-            $caption = EC_LAN_66; // edit Event 
-            
+            $caption = EC_LAN_66; // edit Event
+
         } elseif ($action == "ne")
         {
             $caption = EC_LAN_28; // Enter New Event
-        } 
+        }
         else
         {
             $caption = EC_LAN_83;
-        } 
+        }
 
         $text .= "
 		<tr>
 		<td class='forumheader3' style='width:20%'>".EC_LAN_72." </td>
 		<td class='forumheader3' style='width:80%'> ".EC_LAN_67." ";
 
-        unset($cal_options);
-        unset($cal_attrib);
-        $cal_options['firstDay'] = 0;
-        $cal_options['showsTime'] = false;
-        $cal_options['showOthers'] = true;
-        $cal_options['weekNumbers'] = false;
-        $cal_options['ifFormat'] = "%Y-%m-%d";
-        $cal_attrib['class'] = "tbox";
-        $cal_attrib['size'] = "12";
-        $cal_attrib['name'] = "start_date";
-        $cal_attrib['value'] = $ne_startdate;
-        $text .= $cal->make_input_field($cal_options, $cal_attrib);
 
-        $text .= "&nbsp;&nbsp;&nbsp;".EC_LAN_73." ";
-        unset($cal_options);
-        unset($cal_attrib);
-        $cal_options['firstDay'] = 0;
-        $cal_options['showsTime'] = false;
-        $cal_options['showOthers'] = true;
-        $cal_options['weekNumbers'] = false;
-        $cal_options['ifFormat'] = "%Y-%m-%d";
-        $cal_attrib['class'] = "tbox";
-        $cal_attrib['size'] = "12";
-        $cal_attrib['name'] = "end_date";
-        $cal_attrib['value'] = $ne_enddate;
-        $text .= $cal->make_input_field($cal_options, $cal_attrib);
-        $text .= "		
+        $text .= make_calendar("start_date",$ne_startdate)."&nbsp;&nbsp;&nbsp;".EC_LAN_73." ".make_calendar("end_date",$ne_enddate);
+        $text .= "
 		</td>
 		</tr>
 		<tr>
 		<td class='forumheader3' style='width:20%'>".EC_LAN_71." </td>
 		<td class='forumheader3' style='width:80%'>
-		".EC_LAN_67." <select name='ne_hour' id='ne_hour' class='tbox'>";
-        for($count = "00"; $count <= "23"; $count++)
-        {
-            $val = sprintf("%02d", $count);
-            $text .= "<option value='{$val}' ".(isset($ne_hour) && $count == $ne_hour ? "selected='selected'" :"")." >".$val."</option>";
-        } 
-        $text .= "</select>
-		<select name='ne_minute' class='tbox'>";
-        for($count = "00"; $count <= "59"; $count++)
-        {
-            $val = sprintf("%02d", $count);
-            $text .= "<option ".(isset($ne_minute) && $count == $ne_minute ? "selected='selected'" :"")." value='{$val}'>".$val."</option>";
-        } 
-        $text .= "</select>
+		".EC_LAN_67;
+		
 
-		&nbsp;&nbsp;".EC_LAN_73." <select name='end_hour' class='tbox'>";
-        for($count = "00"; $count <= "23"; $count++)
-        {
-            $val = sprintf("%02d", $count);
-            $text .= "<option ".(isset($end_hour) && $count == $end_hour ? "selected='selected'" :"")." value='{$val}'>".$val."</option>";
-        } 
-        $text .= "</select>
-		<select name='end_minute' class='tbox'>";
-        for($count = "00"; $count <= "59"; $count++)
-        {
-            $val = sprintf("%02d", $count);
-            $text .= "<option ".(isset($end_minute) && $count == $end_minute ? "selected='selected'" :"")." value='{$val}'>".$val."</option>";
-        } 
-        $text .= "</select>";
+	$text .= make_hourmin("ne_",$ne_hour,$ne_minute)."&nbsp;&nbsp;".EC_LAN_73.make_hourmin('end_',$end_hour,$end_minute);
 		$text .= "<br /><input type='checkbox' name='allday' value='1' ".(isset($allday) && $allday == 1 ? "checked='checked'" :"")." />";
         $text .= EC_LAN_64."
 		</td>
@@ -410,23 +419,27 @@
 		<tr>
 		<td class='forumheader3' style='width:20%'>".EC_LAN_52." </td>
 		<td class='forumheader3' style='width:80%'>
-		<select name='ne_category' class='tbox'>"; 
-        // Check if supervisor, if so get all categories, otherwise ju. get those the user is allowed to see
-		$cal_arg = ($cal_super ? "" : "find_in_set(event_cat_addclass,'".USERCLASS_LIST."')");
-        if ($sql->db_Select("event_cat", "*", $cal_arg)){
-            while ($row = $sql->db_Fetch()){
+		<select name='ne_category' class='tbox'>";
+        // Check if supervisor, if so get all categories, otherwise just get those the user is allowed to see
+		$cal_arg = ($ecal_class->cal_super ? "" : "find_in_set(event_cat_addclass,'".USERCLASS_LIST."')");
+        if ($sql->db_Select("event_cat", "*", $cal_arg))
+		{
+            while ($row = $sql->db_Fetch())
+			{
 				$text .= "<option value='{$row['event_cat_id']}' ".(isset($ne_category) && $ne_category == $row['event_cat_id'] ? "selected='selected'" :"")." >".$row['event_cat_name']."</option>";
-            } 
-        }else{
+            }
+        }
+		else
+		{
             $text .= "<option value=''>".EC_LAN_91."</option>";
-        } 
+        }
         $text .= "</select>
 		</td>
-		</tr>"; 
+		</tr>";
         // * *BK* Check if the add class is appropriate for adding new categories
         // * *BK* It will default to everybody class when created.  Need to go in to admin categories if
         // * *BK* you want to change read class.
-        if (check_class($pref['eventpost_addcat']) && $action != "ed")
+        if (FALSE && check_class($pref['eventpost_addcat']) && $action != "ed")
         {
             require_once(e_HANDLER."file_class.php");
             $fi = new e_file;
@@ -444,14 +457,14 @@
             foreach($imagelist as $img){
                 if ($img['fname']){
                     $text .= "<a href=\"javascript:insertext('".$img['fname']."','ne_new_category_icon','cat_icons')\"><img src='".e_PLUGIN."calendar_menu/images/".$img['fname']."' style='border:0px' alt='' /></a> ";
-                } 
-            } 
+                }
+            }
             $text .= "</div>";
             $text .= "<div style='text-align:center'>
 			<input class='button' type='submit' name='ne_cat_create' value='".EC_LAN_56."' onclick='submitted=this.name' /></div>
 			</td>
 			</tr>";
-        } 
+        }
 
         $text .= "
 		<tr>
@@ -466,7 +479,7 @@
 		<td class='forumheader3' style='width:80%'>
 		<textarea class='tbox' name='ne_event' cols='59' rows='8' style='width:95%'>".(isset($ne_event) ? $ne_event : "")."</textarea>
 		</td>
-		</tr>"; 
+		</tr>";
         // * *BK*
         // * *BK* Only display for forum thread if it is required.  No point in being in if not wanted
         // * *BK* or if forums are inactive
@@ -480,14 +493,14 @@
 			<input class='tbox' type='text' name='ne_thread' size='60' value='".(isset($ne_thread) ? $ne_thread : "")."' maxlength='100' style='width:95%' />
 			</td>
 			</tr>";
-        } 
+        }
         // * *BK*
         // * *BK* If the user is logged in and has their email set plus the field is empty then put in
         // * *BK* their email address.  They can always take it out if they want, its not a required field
-        if (empty($ne_email) && defined('USEREMAIL'))
+        if (empty($ne_email) && ($action == "ne") && defined('USEREMAIL'))
         {
             $ne_email = USEREMAIL;
-        } 
+        }
         $text .= "
 		<tr>
 		<td class='forumheader3' style='width:20%'>".EC_LAN_59." </td>
@@ -500,12 +513,15 @@
 
 		<tr>
 		<td class='forumheader' colspan='2' style='text-align:center'>";
-        if ($action == "ed"){
+        if ($action == "ed")
+		{
             $text .= "<input class='button' type='submit' name='ne_update' value='".EC_LAN_60."' onclick='submitted=this.name' />
 			<input type='hidden' name='id' value='".$qs[1]."' />";
-        }else{
+        }
+		else
+		{
             $text .= "<input class='button' type='submit' name='ne_insert' value='".EC_LAN_28."' onclick='submitted=this.name' />";
-        } 
+        }
         $text .= "<input type='hidden' name='qs' value='".e_QUERY."' /></td>
 		</tr>
 		</table>
@@ -514,15 +530,18 @@
         $ns->tablerender($caption, $text);
         require_once(FOOTERF);
         exit;
-    } 
+    }
     else
     {
         header("location:".e_PLUGIN."calendar_menu/event.php");
         exit;
-    } 
-} 
+    }
+}   // End of "Enter New Event
 
+//-----------------------------------------------
 // show events
+// $month, $year have the month required
+//-----------------------------------------------
 $monthstart		= mktime(0, 0, 0, $month, 1, $year);
 $firstdayarray	= getdate($monthstart);
 $monthend		= mktime(0, 0, 0, $month + 1, 1, $year) -1 ;
@@ -534,7 +553,7 @@
 {
     $prevmonth	= 12;
     $prevyear	= ($year-1);
-} 
+}
 $previous		= mktime(0, 0, 0, $prevmonth, 1, $prevyear);
 
 $nextmonth		= ($month + 1);
@@ -543,31 +562,26 @@
 {
     $nextmonth	= 1;
     $nextyear	= ($year + 1);
-} 
-$next			= mktime(0, 0, 0, $nextmonth, 1, $nextyear);
+}
+
+$prop		= mktime(0, 0, 0, $month, 1, $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'];
 
-//$todayarray		= getdate();
-//$current_month	= $todayarray['mon'];
-//$current_year	= $todayarray['year'];
-//$current		= mktime(0, 0, 0, $current_month, 1, $current_year);
-
-$nowarray		= getdate();
-$nowmonth		= $nowarray['mon'];
-$nowyear		= $nowarray['year'];
-$nowday			= $nowarray['mday'];
-$current		= mktime(0, 0, 0, $nowmonth, 1, $nowyear); 
 
-$prop			= mktime(0, 0, 0, $month, 1, $year);
-$next			= mktime(0, 0, 0, $nextmonth, 1, $nextyear);
 $py				= $year-1;
 $prevlink		= mktime(0, 0, 0, $month, 1, $py);
 $ny				= $year + 1;
 $nextlink		= mktime(0, 0, 0, $month, 1, $ny);
 
-if (is_readable(THEME."calendar_template.php")) {
-	require_once(THEME."calendar_template.php");
-	} else {
-	require_once(e_PLUGIN."calendar_menu/calendar_template.php");
+if (is_readable(THEME."calendar_template.php")) 
+{  // Has to be require
+  require(THEME."calendar_template.php");
+}
+else 
+{
+  require(e_PLUGIN."calendar_menu/calendar_template.php");
 }
 
 $text2 = "";
@@ -577,132 +591,184 @@
 // navigation buttons
 $text2 .= $tp -> parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calendar_shortcodes);
 
-//$sql2 = new db;
-if ($ds == "event"){ 
+
+// ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference!
+
+$event = array();
+$extra = '';
+
+if ($ds == "event")
+{		// Show single event
 	$qry = "
 	SELECT e.*, ec.*
 	FROM #event as e
 	LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-	WHERE e.event_id='".intval($eveid)."' 
+	WHERE e.event_id='".intval($eveid)."'
+	{$ecal_class->extra_query} 
 	";
 	$sql2->db_Select_gen($qry);
     $row = $sql2->db_Fetch();
+    if ($row['event_recurring']=='1')			// Single event, selected by ID. So day/month must match
+    {
+	  $row['event_start'] = mktime(0,0,0,$row['event_rec_y'],$row['event_rec_m'],$year);
+	  $row['event_end'] = $row['event_start'];   
+    }
     $event[] = $row;
     $next10_start = $event[0]['event_start'];
 	$text2 .= $tp -> parseTemplate($EVENT_EVENT_TABLE_START, FALSE, $calendar_shortcodes);
 	$text2 .= show_event($event);
 	$text2 .= $tp -> parseTemplate($EVENT_EVENT_TABLE_END, FALSE, $calendar_shortcodes);
 
-}else{
-    //$sql2->db_Select("event_cat", "*", "event_cat_id='".intval($event_true[($c)])."' ");
-    //$event_cat = $sql2->db_Fetch();
-    //extract($event_cat);
-
-    if ($ds == 'one'){
-        $tmp			= getdate($action);
-        $selected_day	= $tmp['mday'];
-        $selected_mon	= $tmp['mon'];
-        $start_time		= $action;
-        $end_time		= $action + 86399;
-        $cap_title		= " - ".$months[$selected_mon-1]." ".$selected_day;
-    }else{
+}
+else
+{
+  if ($ds == 'one')
+  {  // Show events from one day
+    $tmp			= getdate($action);
+    $selected_day	= $tmp['mday'];
+    $selected_mon	= $tmp['mon'];
+    $start_time		= $action;
+    $end_time		= $action + 86399;
+	$next10_start   = $end_time + 1;
+    $cap_title		= " - ".$months[$selected_mon-1]." ".$selected_day;
+    $extra = " OR (e.event_rec_y = ".intval($selected_mon)." AND e.event_rec_m = ".intval($selected_day).") ";
+  }
+  else
+  {  // Display whole of selected month
         $start_time		= $monthstart;
         $end_time		= $monthend;
+		$next10_start   = $end_time + 1;
         $cap_title		= '';
-    } 
-    $extra = " OR e.event_rec_y = ".intval($month)." ";
-
-    if ($cal_super) {
-        $qry = "
-		SELECT e.*, ec.*
-		FROM #event as e
-		LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-		WHERE (e.event_start >= ".intval($start_time)." AND e.event_start <= ".intval($end_time).")
-		OR (e.event_end >= ".intval($start_time)." AND e.event_end <= ".intval($end_time).")
-		OR (e.event_start <= ".intval($start_time)." AND e.event_end >= ".intval($end_time).")
-		{$extra}
-		ORDER BY e.event_start ASC";
-    } else {
-        $qry = "
-		SELECT e.*, ec.*
-		FROM #event as e
-		LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
-		WHERE find_in_set(event_cat_class,'".USERCLASS_LIST."') AND
-		((e.event_start >= ".intval($start_time)." AND e.event_start <= ".intval($end_time).")
-		OR (e.event_end >= ".intval($start_time)." AND e.event_end <= ".intval($end_time).")
-		OR (e.event_start <= ".intval($start_time)." AND e.event_end >= ".intval($end_time).")
-		{$extra})
-		ORDER BY e.event_start ASC
-		";
-    }
-
-    if ($sql->db_Select_gen($qry)){
-        while ($row = $sql->db_Fetch()){
-            if ($row['event_rec_y'] == $month){
-                if (!in_array($row['event_id'], $idArray)){
-                    $events[$row['event_rec_m']][] = $row;
-                    $idArray[] = $row['event_id'];
-                } 
-            }else{
-                if ($ds == 'one'){
-                    if (!isset($idArray) || !is_array($idArray) || !in_array($row['event_id'], $idArray)){
-                        $events[$selected_day][] = $row;
-                        $idArray[] = $row['event_id'];
-                    } 
-                }else{
-                    $tmp		= getdate($row['event_start']);
-					$start_day	= ($tmp['year'] == $year ? $tmp['mday'] : "1");
-                    $tmp		= getdate($row['event_end']);
-					$end_day	= ($tmp['year'] == $year ? $tmp['mday'] : "31");
-                    for ($i = $start_day; $i <= $end_day; $i++){
-                        if (!isset($idArray) || !is_array($idArray) || !in_array($row['event_id'], $idArray)){
-                            $events[$i][] = $row;
-                            $idArray[] = $row['event_id'];
-                        } 
-                    } 
-                } 
-            } 
-        } 
-    } 
-} 
+  $extra = " OR e.event_rec_y = ".intval($month)." ";
+  }
 
 
-// event list
-if(isset($events) && is_array($events)){
+    $qry = "
+	SELECT e.*, ec.*
+	FROM #event as e
+	LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id WHERE (e.event_recurring = '0' AND 
+	((e.event_start >= ".intval($start_time)." AND e.event_start <= ".intval($end_time).")
+	OR (e.event_end >= ".intval($start_time)." AND e.event_end <= ".intval($end_time).")
+	OR (e.event_start <= ".intval($start_time)." AND e.event_end >= ".intval($end_time).") )
+	{$extra})
+	{$category_filter} 
+	{$ecal_class->extra_query} 
+	ORDER BY e.event_start ASC
+	";
 
+// Query generates a list of event IDs in $idarray which meet the criteria.
+// $idarray has one primary index location for each day of month, then secondary for events.
+  if ($cal_count=$sql->db_Select_gen($qry))
+  {
+    while ($row = $sql->db_Fetch())
+    {
+      if ($row['event_recurring']=='1')	// Recurring events
+      {
+	    if  (($row['event_rec_y'] == $month) && (!in_array($row['event_id'], $idArray)))		// Only allow one instance of each recurring event
+        {
+		  $tmp = getdate($row['event_start']);
+		  $row['event_start'] = mktime($tmp['hours'],$tmp['minutes'],0,$row['event_rec_y'],$row['event_rec_m'],$year);
+		  $row['event_end'] = $row['event_start']; 
+          $events[$row['event_rec_m']][] = $row;
+          $idArray[] = $row['event_id'];
+        }
+      }
+      else
+      {
+        if ($ds == 'one')
+        {
+          if (!isset($idArray) || !is_array($idArray) || !in_array($row['event_id'], $idArray))
+          {
+            $events[$selected_day][] = $row;
+            $idArray[] = $row['event_id'];
+          }
+        }
+        else
+        {  // Multiple events
+            if ($row['event_start'] < intval($start_time))
+            {
+              $start_day = "1";		// Event starts before this month
+            }
+            else
+            {
+              $tmp		= getdate($row['event_start']);
+			  $start_day	= $tmp['mday'];
+			}
+            if ($row['event_end'] < $row['event_start'])
+            {  // End date before start date
+              $end_day = $start_day;
+            }
+            else
+            {
+              if ($row['event_end'] > intval($end_time))
+              {
+                $end_day = "31";	// Event ends after this month
+              }
+              else
+              {
+                $tmp = getdate($row['event_end']);
+                $end_day	= $tmp['mday'];
+              }
+            }
+            for ($i = $start_day; $i <= $end_day; $i++)
+            {
+              if (!isset($idArray) || !is_array($idArray) || !in_array($row['event_id'], $idArray))
+              {
+                $events[$i][] = $row;
+                $idArray[] = $row['event_id'];
+              }
+        	}
+      	}
+      }
+    }
+  }
+}
 
-//echo "<pre>"; print_r($events); echo "</pre>";
 
+// event list
+if(isset($events) && is_array($events))
+{
 	$text2 .= $tp -> parseTemplate($EVENT_EVENTLIST_TABLE_START, FALSE, $calendar_shortcodes);
 	foreach ($events as $dom => $event){
 		$text2 .= show_event($event);
-	} 
+	}
 	$text2 .= $tp -> parseTemplate($EVENT_EVENTLIST_TABLE_END, FALSE, $calendar_shortcodes);
 }
 
-// event archive
+
+/*
 $nextmonth = mktime(0, 0, 0, $month + 1, 1, $year)-1;
-if (!isset($next10_start)){
+if (!isset($next10_start))
+{
     $next10_start = $nextmonth;
-} 
+}
+*/
 
+// Show next 10 events after current event/day/month (doesn't show recurring events)
 $qry = "
 SELECT e.* FROM #event AS e
 LEFT JOIN #event_cat AS ec ON e.event_category = ec.event_cat_id
-WHERE e.event_start > '".intval($next10_start)."' AND ec.event_cat_class IN (".USERCLASS_LIST.")
-ORDER BY e.event_start ASC 
+WHERE e.event_start > '".intval($next10_start)."' {$ecal_class->extra_query} {$category_filter}
+ORDER BY e.event_start ASC
 LIMIT 0, 10
 ";
+
 $num = $sql->db_Select_gen($qry);
-if ($num != 0){
+if ($num != 0)
+{
 	$gen = new convert;
 	$archive_events = "";
-	while ($events = $sql->db_Fetch()){
+//	while ($events = $sql->db_Fetch())
+	while ($thisevent = $sql->db_Fetch())
+	{
 		$archive_events .= $tp -> parseTemplate($EVENT_ARCHIVE_TABLE, FALSE, $calendar_shortcodes);
-	} 
-}else{
+	}
+}
+else
+{
 	$archive_events = $tp -> parseTemplate($EVENT_ARCHIVE_TABLE_EMPTY, FALSE, $calendar_shortcodes);
-} 
+}
+
 $text2 .= $tp -> parseTemplate($EVENT_ARCHIVE_TABLE_START, FALSE, $calendar_shortcodes);
 $text2 .= $archive_events;
 $text2 .= $tp -> parseTemplate($EVENT_ARCHIVE_TABLE_END, FALSE, $calendar_shortcodes);
@@ -713,6 +779,7 @@
 require_once(FOOTERF);
 
 
+// Display one event in a form which can be expanded.
 function show_event($day_events)
 {
 	global $tp, $cal_super, $_POST, $ds, $thisevent, $EVENT_ID, $EVENT_EVENT_TABLE, $calendar_shortcodes, $event_author_id, $event_author_name;
@@ -721,48 +788,17 @@
     {
 		$thisevent = $event;
         $gen = new convert;
-        if ( ( !isset($_POST['do']) || (isset($_POST['do']) && $_POST['do'] == null)) || (isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] == "all") || (isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] == $thisevent['event_cat_id']) ){
-			
-		//if (($_POST['do'] == null || $_POST['event_cat_ids'] == "all") || ($_POST['event_cat_ids'] == $thisevent['event_cat_id'])){
-            $lp = explode(".", $thisevent['event_author']);
+            $lp = explode(".", $thisevent['event_author'],2);
             if (preg_match("/[0-9]+/", $lp[0]))
             {
                 $event_author_id = $lp[0];
                 $event_author_name = $lp[1];
             }
 			$text2 .= $tp -> parseTemplate($EVENT_EVENT_TABLE, FALSE, $calendar_shortcodes);
-        } 
     }
     return $text2;
-} 
+}
 
-function cal_landate($dstamp, $recurring = false, $allday = false)
-{
-    $long_month_start = 0;
-    $long_day_start = 12;
-    $now = getdate($dstamp);
-
-    if ($now['wday'] == 0){
-        $now['wday'] = 7;
-    } 
-    $dow = constant("EC_LAN_".($long_day_start + $now['wday']-1));
-    $moy = constant("EC_LAN_".($long_month_start + $now['mon']-1));
-
-    if ($recurring == TRUE){
-        $today = getdate();
-        $now['year'] = $today['year'];
-    } 
-
-    if ($allday == TRUE){
-        return sprintf("%s %02d %s %d", $dow, $now['mday'], $moy, $now['year']);
-    }else{
-		if($now['hours'] == 0 && $now['minutes'] == 0){
-			return sprintf("%s %02d %s %d", $dow, $now['mday'], $moy, $now['year'], 0, 0);
-		}else{
-	        return sprintf("%s %02d %s %d - %02d:%02d", $dow, $now['mday'], $moy, $now['year'], $now['hours'], $now['minutes']);
-		}
-    } 
-} 
 
 function headerjs()
 {
@@ -813,6 +849,6 @@
 	</script>";
 */
 	return $script;
-} 
+}
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/calendar_menu/languages/English.php 0.7.7/e107_plugins/calendar_menu/languages/English.php
--- 0.7.5/e107_plugins/calendar_menu/languages/English.php	2005-07-06 05:04:18.000000000 -0500
+++ 0.7.7/e107_plugins/calendar_menu/languages/English.php	2006-11-16 04:24:15.000000000 -0600
@@ -1,6 +1,25 @@
 <?php
-// e107 Language File.
-// $Id: English.php,v 1.11 2005/07/06 10:04:18 lisa_ Exp $
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     ?Steve Dun.an 2001-2002
+|     http://e107.org
+|     jali.@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/calendar_menu/languages/English.php,v $
+|     $Revision: 1.18 $
+|     $Date: 2006/11/16 10:24:15 $
+|     $Author: e107coders $
+|
+| Various mods by steved:
+|	a) To reflect updates
+|	b) To reflect CVS update to version 1.14 made 29.10.06
++----------------------------------------------------------------------------+
+*/
 	
 	
 define('EC_ADLAN_1', "Event Calendar");
@@ -40,39 +59,7 @@
 define('EC_LAN_DAY_29', "29");
 define('EC_LAN_DAY_30', "30");
 define('EC_LAN_DAY_31', "31");
-/*
-define('EC_LAN_DAY_1', "1st");
-define('EC_LAN_DAY_2', "2nd");
-define('EC_LAN_DAY_3', "3rd");
-define('EC_LAN_DAY_4', "4th");
-define('EC_LAN_DAY_5', "5th");
-define('EC_LAN_DAY_6', "6th");
-define('EC_LAN_DAY_7', "7th");
-define('EC_LAN_DAY_8', "8th");
-define('EC_LAN_DAY_9', "9th");
-define('EC_LAN_DAY_10', "10th");
-define('EC_LAN_DAY_11', "11th");
-define('EC_LAN_DAY_12', "12th");
-define('EC_LAN_DAY_13', "13th");
-define('EC_LAN_DAY_14', "14th");
-define('EC_LAN_DAY_15', "15th");
-define('EC_LAN_DAY_16', "16th");
-define('EC_LAN_DAY_17', "17th");
-define('EC_LAN_DAY_18', "18th");
-define('EC_LAN_DAY_19', "19th");
-define('EC_LAN_DAY_20', "20th");
-define('EC_LAN_DAY_21', "21st");
-define('EC_LAN_DAY_22', "22nd");
-define('EC_LAN_DAY_23', "23rd");
-define('EC_LAN_DAY_24', "24th");
-define('EC_LAN_DAY_25', "25th");
-define('EC_LAN_DAY_26', "26th");
-define('EC_LAN_DAY_27', "27th");
-define('EC_LAN_DAY_28', "28th");
-define('EC_LAN_DAY_29', "29th");
-define('EC_LAN_DAY_30', "30th");
-define('EC_LAN_DAY_31', "31st");
-*/
+
 define('EC_LAN_0', "January");
 define('EC_LAN_1', "February");
 define('EC_LAN_2', "March");
@@ -148,28 +135,28 @@
 define('EC_LAN_60', "Update Event");
 define('EC_LAN_61', "Go");
 define('EC_LAN_62', "Next -NUM- Events ...");
-define('EC_LAN_63', "Check this if event happens on same day every year, ie birthday");
+define('EC_LAN_63', "Check this if event happens on same day every year, e.g. birthday");
 define('EC_LAN_64', "Check for an all-day event");
 define('EC_LAN_65', "Recurring:");
 define('EC_LAN_66', "Edit Event");
 define('EC_LAN_67', "Start:");
-define('EC_LAN_68', "All day event");
-define('EC_LAN_69', "Ends");
+define('EC_LAN_68', "All day event:");
+define('EC_LAN_69', "Ends:");
 define('EC_LAN_70', "Event Title:");
 define('EC_LAN_71', "Event Time:");
 define('EC_LAN_72', "Event Date:");
 define('EC_LAN_73', "End:");
-define('edesc_LAN_0', "Count Down");
-define('edesc_LAN_1', "Still ");
-define('edesc_LAN_2', "before event on ".SITENAME);
-define('edesc_LAN_3', "sec");
-define('edesc_LAN_4', "secs");
-define('edesc_LAN_5', "min");
-define('edesc_LAN_6', "mins");
-define('edesc_LAN_7', "h");
-define('edesc_LAN_8', "h");
-define('edesc_LAN_9', "day");
-define('edesc_LAN_10', "days");
+//define('edesc_LAN_0', "Count Down");
+//define('edesc_LAN_1', "Still ");
+//define('edesc_LAN_2', "before event on ".SITENAME);
+//define('edesc_LAN_3', "sec");
+//define('edesc_LAN_4', "secs");
+//define('edesc_LAN_5', "min");
+//define('edesc_LAN_6', "mins");
+//define('edesc_LAN_7', "h");
+//define('edesc_LAN_8', "h");
+//define('edesc_LAN_9', "day");
+//define('edesc_LAN_10', "days");
 define('EC_LAN_VIEWCALENDAR', "View Calendar");
 define('EC_LAN_VIEWALLEVENTS', "View all events");
 define('EC_LAN_ALLEVENTS', "All events");
@@ -185,13 +172,12 @@
 define('EC_LAN_82', "To activate please go to your menus screen and select the calendar_menu into one of your menu areas.");
 define('EC_LAN_83', "Calendar");
 	
-	
-define('EC_LAN_84', "Css element to use for day header");
-define('EC_LAN_85', "Default is 'forumheader'");
-define('EC_LAN_86', "Css element to use for day list");
-define('EC_LAN_87', "Default is 'forumheader3'");
-define('EC_LAN_88', "Css element to use for selected day");
-define('EC_LAN_89', "Default is 'indent'");
+//define('EC_LAN_84', "Css element to use for day header");
+//define('EC_LAN_85', "Default is 'forumheader'");
+//define('EC_LAN_86', "Css element to use for day list");
+//define('EC_LAN_87', "Default is 'forumheader3'");
+//define('EC_LAN_88', "Css element to use for selected day");
+//define('EC_LAN_89', "Default is 'indent'");
 
 //  *BK* Corrections to hard coding by Barry 
 define('EC_LAN_90', "Choose");	
@@ -204,15 +190,15 @@
 define('EC_LAN_97', "All");		
 define('EC_LAN_98', "Required fields left blank");		
 define('EC_LAN_99', "Event must either be an all day event or finish after it starts");			
-define('EC_LAN_100', "Categories can be added by");			
-define('EC_LAN_101', "Set to inactive to disable on the new event form.");	
-define('EC_LAN_102', "Show link to forum thread");	
-define('EC_LAN_103', "On new event entry form.");	
+//define('EC_LAN_100', "Categories can be added by");			
+//define('EC_LAN_101', "Set to inactive to disable on the new event form.");	
+define('EC_LAN_102', "Show link to 'more information' with events");
+//define('EC_LAN_103', "On new event entry form.");	
 define('EC_LAN_104', "Calendar Administrator Class");		
 define('EC_LAN_105', "* Required Field");		
 define('EC_LAN_106', "Events");		
 define('EC_LAN_107', "This plugin is a fully featured event calendar with calendar menu.");		
-define('EC_LAN_108', "Event Calendar Upgraded.  Now check the new options.");	
+define('EC_LAN_108', "Event Calendar Upgraded.  See the 'readme.pdf' file for detailed information.");	
 define('EC_LAN_109', "Unable to delete this event.");	
 define('EC_LAN_110', "Event Number ");	
 define('EC_LAN_111', "All the events on ");	
@@ -222,11 +208,11 @@
 define('EC_LAN_115', "Sunday");
 define('EC_LAN_116', "Monday");
 define('EC_LAN_117', "Length of daynames (characters)");
-define('EC_LAN_118', "Date format in calendar header.");
+define('EC_LAN_118', "Date format in calendar header:");
 define('EC_LAN_119', "month/year");
 define('EC_LAN_120', "year/month");
 define('EC_LAN_121', "Show Calendar");	
-define('EC_LAN_122', "Css element to show events on this day (menu)");	
+//define('EC_LAN_122', "Css element to show events on this day (menu)");	
 define('EC_LAN_123', "Subscriptions");
 define('EC_LAN_124', "Calendar Subscriptions");
 define('EC_LAN_125', "Categories available for subscription");
@@ -239,6 +225,17 @@
 define('EC_LAN_132', "Expand details");
 define('EC_LAN_133', "[read more]");
 define('EC_LAN_134', "You have to provide a category name");
+define('EC_LAN_135', "Event");
+define('EC_LAN_136', "Category Description");
+define('EC_LAN_137', "Future Events");
+
+// Added 12.07.06 for next_event_menu.php
+define('EC_LAN_140', "Forthcoming Events");
+define('EC_LAN_141', "No forthcoming events");
+define('EC_LAN_142', "Only registered and logged in users can subscribe to events");
+define('EC_LAN_143', "Facility not available");
+define('EC_LAN_144', " at ");
+
 
 define('EC_ADLAN_A10', "Configuration");
 define('EC_ADLAN_A11', "Categories");
@@ -271,7 +268,7 @@
 
 define('EC_ADLAN_A80', "Visible to");
 define('EC_ADLAN_A81', "Allow subscription");
-define('EC_ADLAN_A82', "Force notification to this class");
+define('EC_ADLAN_A82', "Forced notification class");
 define('EC_ADLAN_A83', "Days ahead to notify of event");
 define('EC_ADLAN_A84', "Advanced message");
 define('EC_ADLAN_A85', "Message on the day");
@@ -284,8 +281,100 @@
 define('EC_ADLAN_A92', "Email from (name)");
 define('EC_ADLAN_A93', "Email from email address");
 define('EC_ADLAN_A94', "Add new event class");
-define('EC_ADLAN_A95', "Enable subscriptions");
-define('EC_ADLAN_A96', "Disabling this removes the subscriptions button and overrides the category subscription setting.");
-define('EC_ADLAN_A97', "If set to force subscriptions this category will not be displayed in the available subscription list for the user.");
+define('EC_ADLAN_A95', "Enable manual subscriptions");
+define('EC_ADLAN_A96', "Disabling this removes the subscriptions button and overrides the category manual subscription setting.");
+//define('EC_ADLAN_A97', "If set to force subscriptions this category will not be displayed in the available subscription list for the user.");
+
+// Added from here 12.07.06 for forthcoming events and mailout upgrades
+define('EC_ADLAN_A100', "Forthcoming Events");
+define('EC_ADLAN_A101', "Days to look forward:");
+define('EC_ADLAN_A102', "Number of events to display:");
+define('EC_ADLAN_A103', "Include recurring events:");
+define('EC_ADLAN_A104', "Title is link to events list:");
+define('EC_ADLAN_A105', "Configure Forthcoming Events Menu");
+define('EC_ADLAN_A106', "Menu has to be enabled on the 'Menu' page");
+define('EC_ADLAN_A107', "Will not work reliably if looking forward more than 59 days");
+define('EC_ADLAN_A108', "Menu Heading");
+define('EC_ADLAN_A109', "Forthcoming Events preferences updated");
+
+define('EC_ADLAN_A110', "Only on previous day");
+define('EC_ADLAN_A111', "Advanced and previous day");
+define('EC_ADLAN_A112', "Previous day and on the day");
+define('EC_ADLAN_A113', "Advanced, previous day and on the day");
+
+define('EC_ADLAN_A114', "Logging of Emails");
+define('EC_ADLAN_A115', "Summary");
+define('EC_ADLAN_A116', "Detailed");
+define('EC_ADLAN_A117', "Message on the day or the previous day");
+define('EC_ADLAN_A118', "Categories to display");
+define('EC_ADLAN_A119', "No categories defined, or error reading database");
+define('EC_ADLAN_A120', "Show category icon in menu");
+define('EC_ADLAN_A121', "Category Description");
+define('EC_ADLAN_A122', "Calendar time reference");
+define('EC_ADLAN_A123', "Calendar time format");
+define('EC_ADLAN_A124', "Current server time: ");
+define('EC_ADLAN_A125', "Current site time: ");
+define('EC_ADLAN_A126', "Current user time: ");
+define('EC_ADLAN_A127', "Determines time display format throughout event calendar.");
+define('EC_ADLAN_A128', "Custom time uses the format in the box on the right");
+define('EC_ADLAN_A129', '"Site Time" uses the offset defined in preferences');
+define('EC_ADLAN_A130', "Event name is link to:");
+define('EC_ADLAN_A131', "Calendar Event");
+define('EC_ADLAN_A132', "Source Info URL");
+define('EC_ADLAN_A133', "Date format for event entry: ");
+define('EC_ADLAN_A134', "Level of logging to main admin log:");
+define('EC_ADLAN_A135', "Edit/delete");
+define('EC_ADLAN_A136', "All changes");
+define('EC_ADLAN_A137', "Can cover additions, updates to and deletions from the event list");
+define('EC_ADLAN_A138', "Event start/end times on 5-minute boundaries");
+define('EC_ADLAN_A139', "(Reduces number of entries in drop-down list)");
+define('EC_ADLAN_A140', "Show number of events for this month in Calendar Menu");
+define('EC_ADLAN_A141', "Maintenance");
+define('EC_ADLAN_A142', "Remove past events ending more than x months ago");
+define('EC_ADLAN_A143', "timed from beginning of current month");
+define('EC_ADLAN_A144', "Event Calendar Maintenance");
+define('EC_ADLAN_A145', "Delete old entries");
+define('EC_ADLAN_A146', "Events older than ");
+define('EC_ADLAN_A147', " deleted");
+define('EC_ADLAN_A148', "Parameter error - nothing deleted");
+define('EC_ADLAN_A149', "No old events to delete, or delete of past events failed");
+define('EC_ADLAN_A150', "Confirm delete events older than ");
+
+define('EC_ADLAN_A151', "e107 Web Site");
+define('EC_ADLAN_A152', "calendar@yoursite.com");
+define('EC_ADLAN_A153', "Log directory must be created manually - create a subdirectory 'log' off your event calendar plugin directory, with '666' access rights");
+define('EC_ADLAN_A154', "Could not change log directory permissions");
+define('EC_ADLAN_A155', "Log directory permissions may require manual update to 0666 or 0766, although depending on your server setup they may work");
+define('EC_ADLAN_A156', "Database upgraded");
+define('EC_ADLAN_A157', "this is the rss feed for the calendar entries");
+define('EC_ADLAN_A158', "Could not create log directory");
+
+define('EC_ADLAN_A159', "Cache Management");
+define('EC_ADLAN_A160', "(Only relevant if cache enabled)");
+define('EC_ADLAN_A161', "Empty Calendar Cache");
+define('EC_ADLAN_A162', "Confirm Empty Cache");
+define('EC_ADLAN_A163', "Cache emptied");
+
+define('EC_ADLAN_A164', "Update completed");
+define('EC_ADLAN_A165', "Calendar menu header links to:");
+define('EC_ADLAN_A166', "Date display in Event List:");
+define('EC_ADLAN_A167', "Date display in Forthcoming Events:");
+define('EC_ADLAN_A168', "Custom date uses the format in the box on the right");
+define('EC_ADLAN_A169', "Determines date display format for event listings");
+define('EC_ADLAN_A170', "Determines date display format for forthcoming events menu");
+define('EC_ADLAN_A171', "Flag recently added/updated events");
+define('EC_ADLAN_A172', "Value is time from update in hours; zero to disable");
+
+
+// Notify
+define("NT_LAN_EC_1", "Event Calendar Events");
+define("NT_LAN_EC_2", "Event Updated");
+define("NT_LAN_EC_3", "Update by");
+define("NT_LAN_EC_4", "IP Address");
+define("NT_LAN_EC_5", "Message");
+define("NT_LAN_EC_6", "Event Calendar - Event added");
+define("NT_LAN_EC_7", "New event posted");
+define("NT_LAN_EC_8", "Event Calendar - Event modified");
+
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/next_event_menu.php 0.7.7/e107_plugins/calendar_menu/next_event_menu.php
--- 0.7.5/e107_plugins/calendar_menu/next_event_menu.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/next_event_menu.php	2006-11-16 04:24:14.000000000 -0600
@@ -0,0 +1,153 @@
+<?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/calendar_menu/next_event_menu.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2006/11/16 10:24:14 $
+|     $Author: e107coders $
+|
+| 09.11.06 - Cache support added, templating/shortcode tweaks
++----------------------------------------------------------------------------+
+*/
+
+
+if (!defined('e107_INIT')) { exit; }
+
+global $ecal_dir, $tp;
+$ecal_dir	= e_PLUGIN . "calendar_menu/";
+
+global $ecal_class;
+require_once($ecal_dir."ecal_class.php");
+$ecal_class = new ecal_class;
+
+	$cache_tag = "nq_event_cal_next";
+
+// See if the page is already in the cache
+	if($cacheData = $e107cache->retrieve($cache_tag, $ecal_class->max_cache_time))
+	{
+		echo $cacheData;
+		return;
+	}
+
+include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+
+// Values defined through admin pages
+$menu_title = $pref['eventpost_menuheading'];
+$days_ahead = $pref['eventpost_daysforward'];
+$show_count = $pref['eventpost_numevents'];
+$show_recurring = $pref['eventpost_checkrecur'];
+$link_in_heading = $pref['eventpost_linkheader'];
+
+// Now set defaults for anything not defined
+if (!$menu_title) $menu_title = EC_LAN_140;
+if (!$days_ahead) $days_ahead = 30;		// Number of days ahead to go
+if (!$show_count) $show_count = 3;		// Number of events to show
+if (!$show_recurring) $show_recurring = 1;	// Zero to exclude recurring events
+if (!$link_in_heading) $link_in_heading = 0;	// Zero for simple heading, 1 to have clickable link
+
+
+require($ecal_dir."calendar_shortcodes.php");
+if (is_readable(THEME."calendar_template.php")) 
+{  // Needs to be require in case second
+  require(THEME."calendar_template.php");
+}
+else 
+{
+  require($ecal_dir."calendar_template.php");
+}
+
+$site_time = $ecal_class->cal_timedate;
+$end_time = $site_time + (86400 * $days_ahead);
+
+
+// Build up query bit by bit
+    $cal_qry = "SELECT e.event_id, e.event_rec_m, e.event_rec_y, e.event_start, e.event_thread, e.event_title, e.event_recurring, e.event_allday, ec.*
+	FROM #event as e LEFT JOIN #event_cat as ec ON e.event_category = ec.event_cat_id
+	WHERE (((e.event_start >= {$site_time} AND e.event_start < {$end_time}))";
+
+if ($show_recurring > 0)
+{  // This won't work properly under some circumstances if $days_ahead is greater than the number of days in the current month plus next month.
+   // If that matters, need another test on event_rec_y (which is actually the month) - plus the calculation to generate the values
+	$cal_datearray		= $ecal_class->cal_date;
+	$first_day			= $cal_datearray['mday'];
+	$first_month		= $cal_datearray['mon'];
+
+	$end_date	= mktime(0,0,0,$first_month,$first_day,0) + (86400 * $days_ahead);
+	$end_datearray = getdate($end_date);
+	$last_month = $end_datearray['mon'];
+	$last_day	= $end_datearray['mday'];
+	$cal_qry .= " OR ((e.event_recurring = '1') 
+				 AND ";
+	if ($first_month == $last_month)
+	{   // All dates within current month
+	  $cal_qry .= "(((e.event_rec_y = {$first_month})    
+	             AND  (e.event_rec_m >= {$first_day}) AND (e.event_rec_m < {$last_day})  ) ))";
+	}
+	else
+	{	// Dates overlap one or more months
+	$cal_qry .= "(((e.event_rec_y = {$first_month})    AND  (e.event_rec_m >= {$first_day})) 
+				  OR ((e.event_rec_y  = {$last_month}) AND  (e.event_rec_m < {$last_day}))";
+	$first_month++;
+	if ($first_month > 12) $first_month = 1;
+	if ($first_month <> $last_month)
+	{  // Add a whole month in the middle
+	  $cal_qry .= " OR (e.event_rec_y = {$first_month}) ";
+	}
+	$cal_qry .= "))";
+	}
+}
+
+$cal_qry .= ')'.$ecal_class->extra_query;	   // Puts in class filter if not calendar admin
+
+if (isset($pref['eventpost_fe_set']))
+{
+   $cal_qry .= " AND find_in_set(ec.event_cat_id,'".$pref['eventpost_fe_set']."')";
+}
+	
+$cal_qry .= " order by e.event_start LIMIT {$show_count}";
+
+
+$cal_totev = 0;
+$cal_text = '';
+$cal_row = array();
+global $cal_row, $cal_totev;
+
+$cal_totev = $sql->db_Select_gen($cal_qry);
+
+
+if ($cal_totev > 0)
+{
+    while ($cal_row = $sql->db_Fetch())
+    {
+	  $cal_totev --;    // Can use this to modify inter-event gap
+	  $cal_text .= $tp->parseTemplate($EVENT_CAL_FE_LINE,FALSE,$calendar_shortcodes);
+	}
+}
+else
+{
+  $cal_text.= EC_LAN_141;
+}
+
+$calendar_title = $menu_title;
+if ($link_in_heading == 1)
+{
+  $calendar_title = "<a class='forumlink' href='" . e_PLUGIN . "calendar_menu/event.php' >" . $menu_title . "</a>";
+}
+
+// Now handle the data, cache as well
+ob_start();					// Set up a new output buffer
+$ns->tablerender($calendar_title, $cal_text, 'next_event_menu');
+$cache_data = ob_get_flush();			// Get the page content, and display it
+$e107cache->set($cache_tag, $cache_data);	// Save to cache
+	
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/plugin.php 0.7.7/e107_plugins/calendar_menu/plugin.php
--- 0.7.5/e107_plugins/calendar_menu/plugin.php	2006-01-22 13:53:06.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/plugin.php	2006-11-16 04:24:15.000000000 -0600
@@ -11,9 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/plugin.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/01/22 19:53:06 $
+|     $Revision: 1.17 $ - with mods to hopefully trigger upgrade to new version
+|     $Date: 2006/11/16 10:24:15 $
 |     $Author: e107coders $
+|
+| 22.07.06 - Mods for V3.6 upgrade, including log directory
+| 02.08.06 - Support for category icon display added
+| 29.09.06 - prefs, db field added for next batch of mods
+| 03.10.06 - forced subs fields changed
+| 04.10.06 - db field order changed to avoid confusing update routines
+| 29.10.06 - Language mods to reflect CVS update to V1.14
+| 10.11.06 - Mods for next release to CVS
 +----------------------------------------------------------------------------+
 */
 
@@ -22,21 +30,21 @@
 // Plugin info -------------------------------------------------------------------------------------------------------
 $lan_file = e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php";
 @require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php");
-$eplug_name = "Event Calendar";
-$eplug_version = "3.5";
-$eplug_author = "jalist / cameron / McFly / Barry / Lisa_";
+$eplug_name = EC_ADLAN_1;
+$eplug_version = "3.6";
+$eplug_author = "jalist / cameron / McFly / Barry / Lisa_ / steved";
 $eplug_url = "http://e107.org";
 $eplug_email = "jalist@e107.org";
 $eplug_description = EC_LAN_107;
 $eplug_compatible = "e107v7";
-$eplug_readme = "readme.rtf";
+$eplug_readme = "readme.pdf";
 // leave blank if no readme file
 $eplug_compliant = TRUE;
 
 // Name of the plugin's folder -------------------------------------------------------------------------------------
 $eplug_folder = "calendar_menu";
 
-// Mane of menu item for plugin ----------------------------------------------------------------------------------
+// Name of menu item for plugin ----------------------------------------------------------------------------------
 $eplug_menu_name = "calendar_menu";
 
 // Name of the admin configuration file --------------------------------------------------------------------------
@@ -47,21 +55,45 @@
 $eplug_icon_small = $eplug_folder."/images/calendar_16.png";
 $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");
+list($ecalVer) = $ecalSQL->db_Fetch();
+$ecalVer = preg_replace("/[a-zA-z\s]/", '', $ecalVer);
+
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array(
 "eventpost_admin" => 0,
-"eventpost_headercss" => "forumheader",
-"eventpost_daycss" => "forumheader3",
-"eventpost_todaycss" => "indent",
-"eventpost_addcat" => 0,
+"eventpost_adminlog" => 0,
+"eventpost_showeventcount" => 1,
 "eventpost_forum" => 1,
-"eventpost_evtoday" => "indent",
-"eventpost_mailsubject" => "Calendar",
-"eventpost_mailfrom" => "e107 Web Site",
-"eventpost_mailaddress" => "calendar@yoursite.com",
+"eventpost_recentshow" => 0,
+"eventpost_super" => 0,
+"eventpost_menulink" => 0,
+"eventpost_dateformat" => 1,
+"eventpost_fivemins" => 0,
+"eventpost_weekstart" => "sun",
 "eventpost_lenday" => 1,
+"eventpost_caltime" => 0,
+"eventpost_datedisplay" => 1,
+"eventpost_timedisplay" => 0,
+"eventpost_timecustom" => "%H%M",
+"eventpost_dateevent"  => 1,
+"eventpost_datenext"   => 1,
+"eventpost_eventdatecustom" => "&A %d %B %Y",
+"eventpost_nextdatecustom"   => "%d %b",
+"eventpost_mailsubject" => EC_ADLAN_12,
+"eventpost_mailfrom" => EC_ADLAN_A151,
+"eventpost_mailaddress" => EC_ADLAN_A152,
 "eventpost_asubs" => 1,
-"eventpost_weekstart" => "sun" );
+"eventpost_emaillog" => 1,
+"eventpost_menuheading" => EC_LAN_140,
+"eventpost_daysforward" => 30,
+"eventpost_numevents" => 3,
+"eventpost_checkrecur" => 1,
+"eventpost_linkheader" => 0,
+"eventpost_fe_set" => "",
+"eventpost_showcaticon" => 0,
+"eventpost_namelink" => 1 );
 
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array("event","event_cat","event_subs" );
@@ -92,7 +124,6 @@
 	event_cat_icon varchar(100) NOT NULL default '',
 	event_cat_class int(10) unsigned NOT NULL default '0',
 	event_cat_subs tinyint(3) unsigned NOT NULL default '0',
-	event_cat_force tinyint(3) unsigned NOT NULL default '0',
 	event_cat_ahead tinyint(3) unsigned NOT NULL default '0',
 	event_cat_msg1 text,
 	event_cat_msg2 text,
@@ -101,6 +132,8 @@
 	event_cat_today int(10) unsigned NOT NULL default '0',
 	event_cat_lastupdate int(10) unsigned NOT NULL default '0',
 	event_cat_addclass int(10) unsigned NOT NULL default '0',
+	event_cat_description text,
+	event_cat_force_class int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_cat_id)
 	) TYPE=MyISAM;"
 	,
@@ -124,11 +157,55 @@
 $eplug_done = EC_LAN_82; // "To activate please go to your menus screen and select the calendar_menu into one of your menu areas.";
 
 
-// upgrading ... //
 
+// upgrading ... //
 $upgrade_add_prefs = "";
-
 $upgrade_remove_prefs = "";
+$upgrade_alter_tables = array();
+$version_notes = "";
+
+
+if (!function_exists('create_ec_log_dir'))
+{
+function create_ec_log_dir()
+{
+global $eplug_folder;
+
+$response = "";
+$cal_log_dir = e_PLUGIN.$eplug_folder.'/log';
+  if (!is_dir($cal_log_dir))
+  {  // Need to create log directory
+    if (!mkdir($cal_log_dir,0666))
+	{
+	  $response = EC_ADLAN_A158."<br />";
+	}
+  }
+  if (!is_dir($cal_log_dir))
+  {
+    $response .= EC_ADLAN_A153;
+	return $response;
+  }
+  
+// Now check directory permissions
+  if (!is_writable($cal_log_dir."/"))
+  {
+    if (!chmod($cal_log_dir,0666))
+	{
+	  $response = EC_ADLAN_A154."<br />";
+	}
+    if (!is_writable($cal_log_dir."/"))
+    {
+      $response .= EC_ADLAN_A155;
+    }
+  }
+  return $response;
+}
+}
+
+
+if ($ecalVer < 3.5)
+{
+// To version 3.5
 
 $upgrade_alter_tables = array(
 "ALTER TABLE ".MPREFIX."event_cat ADD event_cat_class int(10) unsigned NOT NULL default '0'",
@@ -149,11 +226,55 @@
 	PRIMARY KEY  (event_subid)
 	) TYPE=MyISAM;"
 );
-
-$eplug_upgrade_done = EC_LAN_108;
-
+$version_notes .= "<u>3.5</u><br />".EC_ADLAN_A156."<br />";
+}
+// To version 3.6 - fair number of tweaks overall
+if ($ecalVer < 3.6)
+{
+$upgrade_alter_tables = array(
+"ALTER TABLE ".MPREFIX."event_cat DROP event_cat_force",
+"ALTER TABLE ".MPREFIX."event_cat ADD event_cat_description text",
+"ALTER TABLE ".MPREFIX."event_cat ADD event_cat_force_class int(10) unsigned NOT NULL default '0'"
+);
+  $verprefs = array(
+	"eventpost_adminlog" => 0,
+	"eventpost_showeventcount" => 1,
+	"eventpost_menuheading" => EC_LAN_140,
+	"eventpost_daysforward" => 30,
+	"eventpost_numevents" => 3,
+	"eventpost_checkrecur" => 1,
+	"eventpost_linkheader" => 0,
+	"eventpost_showcaticon" => 0,
+	"eventpost_dateformat" => 1,
+	"eventpost_fivemins" => 0,
+	"eventpost_emaillog" => 1,
+	"eventpost_caltime" => 0,
+	"eventpost_datedisplay" => 1,
+	"eventpost_timedisplay" => 0,
+	"eventpost_timecustom" => "%H%M",
+	"eventpost_fe_set" => "",
+	"eventpost_namelink" => 1,
+	"eventpost_recentshow" => 0,
+	"eventpost_dateevent"  => 1,
+	"eventpost_datenext"   => 1,
+	"eventpost_eventdatecustom" => "&A %d %B %Y",
+	"eventpost_nextdatecustom"   => "%d %b",
+    "eventpost_menulink" => 0 );
+	$upgrade_add_prefs .= $verprefs;
+	$version_notes .= "<u>3.6</u><br />".EC_ADLAN_A156."<br />".create_ec_log_dir()."<br />
+	                   <a href='".e_PLUGIN_ABS.$eplug_folder."/".$eplug_conffile."'>Configure</a><br />";
+					   
+  $upgrade_remove_prefs = array(
+    "eventpost_addcat",
+	"eventpost_evtoday",
+	"eventpost_headercss",
+	"eventpost_daycss",
+	"eventpost_todaycss"
+	);
+}
 
 
+$eplug_upgrade_done = EC_LAN_108."<br />".$version_notes;
 
 
 ?>
\ No newline at end of file
Binary files 0.7.5/e107_plugins/calendar_menu/readme.pdf and 0.7.7/e107_plugins/calendar_menu/readme.pdf differ
diff -ruN 0.7.5/e107_plugins/calendar_menu/readme.rtf 0.7.7/e107_plugins/calendar_menu/readme.rtf
--- 0.7.5/e107_plugins/calendar_menu/readme.rtf	2005-04-30 23:37:02.000000000 -0500
+++ 0.7.7/e107_plugins/calendar_menu/readme.rtf	1969-12-31 18:00:00.000000000 -0600
@@ -1,104 +0,0 @@
-{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
-{\f36\froman\fcharset238\fprq2 Times New Roman CE;}{\f37\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f39\froman\fcharset161\fprq2 Times New Roman Greek;}{\f40\froman\fcharset162\fprq2 Times New Roman Tur;}
-{\f41\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f42\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f43\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f44\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
-{\f46\fswiss\fcharset238\fprq2 Arial CE;}{\f47\fswiss\fcharset204\fprq2 Arial Cyr;}{\f49\fswiss\fcharset161\fprq2 Arial Greek;}{\f50\fswiss\fcharset162\fprq2 Arial Tur;}{\f51\fswiss\fcharset177\fprq2 Arial (Hebrew);}
-{\f52\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f53\fswiss\fcharset186\fprq2 Arial Baltic;}{\f54\fswiss\fcharset163\fprq2 Arial (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
-\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
-\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
-\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
-\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\rsidtbl \rsid2174356\rsid3212090\rsid3477726\rsid6832128\rsid8085253\rsid9705426
-\rsid10102401\rsid11629344\rsid12982990}{\*\generator Microsoft Word 10.0.4219;}{\info{\author pssuser}{\operator pssuser}{\creatim\yr2005\mo4\dy26\hr14\min25}{\revtim\yr2005\mo4\dy27\hr9\min20}{\version7}{\edmins38}{\nofpages3}{\nofwords910}
-{\nofchars5193}{\*\company PSS}{\nofcharsws6091}{\vern16469}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3
-\jcompress\viewkind4\viewscale100\nolnhtadjtbl\rsidroot6832128 \fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3
-\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
-{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain 
-\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\f1\fs20\insrsid2174356 *******************************************************************
-\par *
-\par *\tab }{\b\f1\fs20\insrsid2174356 Calendar Menu
-\par }{\f1\fs20\insrsid2174356 *
-\par *\tab By jalist with extras from Cameron, McFly and Barry and others
-\par *
-\par *\tab Version\tab \tab 3.5
-\par *
-\par *\tab e107 version\tab 0.7+
-\par *
-\par *\tab Compliance\tab XHTML 1.1
-\par *
-\par *******************************************************************
-\par 
-\par }{\b\i\f1\fs20\ul\insrsid2174356 Introduction}{\i\f1\fs20\ul\insrsid2174356 
-\par }{\f1\fs20\insrsid2174356 This is a calendar/event plugin for the e107CMS.  This is provided as a core plugin distributed with the e107.
-\par 
-\par }{\b\i\f1\fs20\ul\insrsid2174356 Upgrading}{\f1\fs20\insrsid2174356 
-\par Copy the contents of this folder to your e107plugins calendar_menu folder.  Go to the plugin manager and run the upgrade.  Then check that the database is correct by running a database validity check from the main admin menu - databases option.
-\par }{\f1\fs20\insrsid6832128 
-\par }{\b\f1\fs20\insrsid10102401 Subscriptions
-\par }{\f1\fs20\insrsid10102401 \line Version 3.5 introduces the facility for a membe
-r to be able to subscribe to event categories though not to individual events.  If they subscribe they will receive email notification to the address they used when registering.  The admin can decide if it is to be an email sent x days before the event or
- on the day of the event or both.  
-\par 
-\par If you wish to allow them to subscribe to notifications then you need some way of getting your server to }{\f1\fs20\insrsid11629344 check to see if an email is due to be sent.  There are three ways of doing this 
-\par 
-\par 1) as an admin function.  This means that you have to remember to go and run an admin function everyday \endash  not very good.  
-\par }{\f1\fs20\insrsid3477726 
-\par }{\f1\fs20\insrsid11629344 2) as a menu that runs everytime your site is accessed.  We can make this an \'93invisible\'94 menu ie there is not output displayed on the screen and have it check if it 
-is time to send an email.  This is better than the first option but requires that you have at least one site hit per day.  It also adds an extra burden on to the server going and running the menu\rquote s script and a small bit of code to check.}{
-\f1\fs20\insrsid3477726   If you use this method then enable the subs menu but remember you won\rquote t see anything on the screen}{\f1\fs20\insrsid10102401 
-\par }{\f1\fs20\insrsid3477726 
-\par }{\f1\fs20\insrsid11629344 3) as a cron or Windows scheduled task.  This is the best method.  It will run everyday at the same time and so won\rquote t get forgotten.  It is only run once and so doesn\rquote 
-t place unnecessary loads on the server (important if it\rquote s a busy site) but requires that you have access to CRON or Windows scheduler.
-\par 
-\par So which to go for?  Option 3 is the best job and if not that then option 2.  To set up the cron job you should copy th
-e file calcron.php into the top level of your e107 directory (I found that this is the most reliable place to run it from) and create your cron job in the usual manner.  It is beyond the scope of this readme to tell you how to do it or how to trouble shoo
-t it.
-\par 
-\par On my server it is a case of running c:\\php\\cli\\php \endash f  calcron.php in the top level of your e107 site.  I also needed to copy php.ini to the php\\cli directory}{\f1\fs20\insrsid3212090 
-.  You may have to play around with paths to get it to work.}{\f1\fs20\insrsid11629344 
-\par }{\f1\fs20\insrsid12982990 
-\par There are some limitations, people logged in can\rquote t subscribe and you can\rquote t force email standard groups like Admin Only class or Members Only class.}{\f1\fs20\insrsid12982990\charrsid10102401 
-\par }{\b\f1\fs20\insrsid10102401 
-\par }{\b\f1\fs20\insrsid6832128\charrsid6832128 Version 3.5
-\par }{\f1\fs20\insrsid6832128 
-\par This version brings the opportunity to allow members to subscribe to event categories.  Admin can determine if a category is allowed to have subscriptions and if it does then when the user is notified.  For example an email can be sent x days before the e
-vent (with a tailored message) or on the day of the event (again with a message) or on both occasions.  
-\par 
-\par Admin can also configure the calendar to force notifications to a particular user class.  Subscription by the user is not possible in this case they ar
-e automatically included in the mail shot.  This might be useful when it is used in an intranet system and you have a reports deadline userclass.  All the members of that userclass will then be notified when the report is due, they can\rquote 
-t unsubscribe from the emails and so can\rquote t argue they didn\rquote t get notified the report was due.
-\par 
-\par There is a new table created in this version }{\f1\fs20\insrsid2174356 plus changes to one other table so you must run upgrade plug-in from the plug-in manager.  You will also need to set the new settings fo
-r each of the categories you have to allow or disallow subscriptions.}{\f1\fs20\insrsid6832128 
-\par }{\f1\fs20\insrsid10102401 
-\par }{\f1\fs20\insrsid9705426 C}{\f1\fs20\insrsid9705426\charrsid9705426 ategori}{\f1\fs20\insrsid9705426 es can now be made visible to one }{\f1\fs20\insrsid9705426\charrsid9705426 userclass }{\f1\fs20\insrsid9705426 but re
-stricted in who can add events.  This is the add new event class field.  So a whole department can view and subscribe to a category but only department managers can add events.
-\par }{\f1\fs20\insrsid9705426\charrsid9705426 
-\par }{\b\f1\fs20\insrsid6832128\charrsid6832128 Version 3.4
-\par }{\f1\fs20\insrsid6832128 
-\par Some bug fixes and a nice calendar added.
-\par }{\f1\fs20\insrsid2174356 
-\par }{\b\i\f1\fs20\insrsid2174356 Version 3.3
-\par }{\f1\fs20\insrsid2174356 
-\par Enhancements have been made by various people and now is version 0.7+ and xhtml1.1 compatible.  Also added are integrity check file and database validity check file.
-\par 
-\par This version brings userclasses to the categories.  Admin now can control the editing of categories and the userclasses that can access them.  
-\par 
-\par The calendar menu block also respects userclasses; only those events in categories to which the user is entitled to see are displayed.  
-\par 
-\par Validation is now made before submitting the form.  Required fields left empty or incorrect start and end times are flagged with Javascript alert.  
-\par 
-\par If a new event is being created and an email address is available (user logged in for example) then this is prompted in the email adress field.  This can be over ridden by the user.
-\par 
-\par Admin can define if the create new category is shown on create event form
-.  If you don't want users creating new categories then this can be turned off.  Likewise, admin can hide the field for forum link, if you don't want these links ion the events then they can be turned off.
-\par 
-\par Admin can define a "Calendar Supervisor" userclas
-s.  Members of this class can see all categories and events and can edit and delete events from  the event list.  Event administrators don't actually have to be made admins to be able to look after events though normally they would be.  This is more appro
-priate for corporate users using e107 as an intranet.
-\par 
-\par Clicking on an event in calendar view displays just that event, not all the events on that day.  Click on the day number to list all on that day.
-\par 
-\par Javascript to hide the email from spam bots when displaying an event.
-\par 
-\par }{\b\i\f1\fs20\insrsid2174356 Version 3.2 and prior}{\f1\fs20\insrsid2174356 
-\par Substantial rewrite of the code to make it more efficient and to give admin control of the css for the look and feel of the calendar.
-\par }}
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/subs_menu.php 0.7.7/e107_plugins/calendar_menu/subs_menu.php
--- 0.7.5/e107_plugins/calendar_menu/subs_menu.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/subs_menu.php	2006-11-06 16:30:22.000000000 -0600
@@ -11,122 +11,241 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/subs_menu.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/11/06 22:30:22 $
+|     $Author: e107coders $
+|
+| 09.07.06 - Mods by steved:
+|	General restructuring to use common routines
+| 	Support for sending emails on previous day.
+|	Logging capability
+| 	Debugging option
+|
+| 11.07.06 - Adjustment to logging messages
+| 12.07.06 - More adjustment to logging messages
+| 15.07.06 - Adjustment to 'tomorrow' query
+| 17.07.06 - More adjustment to 'tomorrow' query
+|
+| 04.10.06 - Mods to mailout to allow mix of voluntary and forced subs to the same event
+| 24.10.06 - Change DB names so works as a menu
+| 25.10.06 - Logging selectively disabled when run as menu
+| 27.10.06 - Update queries to new structure, don't email banned users
+| 31.10.06 - Attempt to optimise query better
+| 01.11.06 - More refinements on query
+| 05.11.06 - More refinement on query - ignores midnight at end of day.   **** BANG ****
+|
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // This menu can be called from a cron job - see readme.rtf
+$run_from_menu = function_exists("parseheader");		// Use this to suppress logging in 'through' path
 $ec_dir = e_PLUGIN . "calendar_menu/";
-$caldb = new DB;
-$cal_emaildb = new DB;
 // Check if we are going to do the notify
 
+$debug_level = 0;			// Set to 1 or 2 to suppress actual sending of emails
+
+if (($debug_level > 0) && e_QUERY)
+{  // Run with query of ?dd-mm[-yy] to test specific date
+  list($day,$month,$year) = explode("-",e_QUERY);
+  if (!isset($year) || ($year == 0)) $year = date("Y");
+  $cal_starttime = mktime(0,0,0,$month,$day,$year);
+  echo "Debug run for {$day}-{$month}-{$year}<br />";
+}
+else
+{  // Normal operation
 $cal_starttime = mktime(0, 0, 0, date("n"), date("d"), date("Y"));
-// Firstly for dates ahead
-// Do future events
-$cal_args = "select * from " . MPREFIX . "event left join " . MPREFIX . "event_cat on event_category=event_cat_id where event_cat_subs>0 and 
-event_cat_last < " . $cal_starttime . " and 
-event_cat_ahead > 0 and 
-event_start >= (" . $cal_starttime . "+(86400*(event_cat_ahead))) and
-event_start <= (" . $cal_starttime . "+(86400*(event_cat_ahead+1))) and
-find_in_set(event_cat_notify,'1,3')";
-#print $cal_args;
-if ($caldb->db_Select_gen($cal_args))
+}
+
+$log_requirement = 0;		// Logging required 0=none, 1=summary, 2=detailed
+if (isset($pref['eventpost_emaillog'])) $log_requirement = $pref['eventpost_emaillog'];
+if ($debug_level >= 2) $log_requirement = 2;	// Force full logging if debug
+
+if ($log_requirement > 0)
 {
-    require_once(e_HANDLER . "mail.php");
+  $log_filename = $ec_dir.'log/calendar_mail.txt';
+  if (!$run_from_menu)
+  {
+    if (!($handle = fopen($log_filename, 'a'))) $log_requirement = 0;
+    if (fwrite($handle,"\r\n\r\nMail subscriptions run started at ".date("D j M Y G:i:s")) === false)  $log_requirement = 0;
+    fclose($handle);
+  }
+}
+
+// Start with the 'in advance' emails
+$cal_args = "select * from #event left join #event_cat on event_category=event_cat_id where (event_cat_subs>0 OR event_cat_force_class != '') and 
+event_cat_last < " . intval($cal_starttime) . " and 
+event_cat_ahead > 0 and 
+event_start >= (" . intval($cal_starttime) . "+(86400*(event_cat_ahead))) and
+event_start <  (" . intval($cal_starttime) . "+(86400*(event_cat_ahead+1))) and
+find_in_set(event_cat_notify,'1,3,5,7')";
+
+send_mailshot($cal_args, 'Advance',1);
 
-    while ($cal_row = $caldb->db_Fetch())
-    {
-        extract($cal_row);
-        $cal_emaildb->db_Update("event_cat", "event_cat_last=" . time() . " where event_cat_id=" . intval($event_cat_id)); 
 
-        if ($event_cat_force > 0)
-        { 
-            // Force email to members of this class
-
-            $cal_emilargs = "select * from " . MPREFIX . "user where user_class regexp '^".intval($event_cat_class).",' or user_class regexp ',".intval($event_cat_class).",'  or user_class regexp ',".intval($event_cat_class)."'"; 
-
-            if ($cal_emaildb->db_Select_gen($cal_emilargs)) 
-                {
-                    while ($cal_emrow = $cal_emaildb->db_Fetch())
-                {
-                    extract($cal_emrow);
-                    $cal_msg = $event_title . "\n\n" . $event_cat_msg1;
-                    sendemail($user_email, $pref['eventpost_mailsubject'], $cal_msg, $user_name, $pref['eventpost_mailaddress'], $pref['eventpost_mailfrom']); 
 
-                } 
-            } 
-        } 
-        else
-        { 
-            // only subscribers
-            $cal_emilargs = "select * from " . MPREFIX . "user left join " . MPREFIX . "event_subs on user_id=event_userid where " . MPREFIX . "event_subs.event_cat='".intval($event_category)."'";
-#print $cal_emilargs;
-            if ($cal_emaildb->db_Select_gen($cal_emilargs))
-            {
-                while ($cal_emrow = $cal_emaildb->db_Fetch())
-                {
-                    extract($cal_emrow);
-                    $cal_msg = $event_title . "\n\n" . $event_cat_msg1;
-                    sendemail($user_email, $pref['eventpost_mailsubject'], $cal_msg, $user_name, $pref['eventpost_mailaddress'], $pref['eventpost_mailfrom']);
-                } 
-            } 
-        } 
-    } // while    
-} 
 // then for today
-// Check if we are going to do the notify
-// Firstly for dates ahead
-$cal_starttime = mktime(0, 0, 0, date("n"), date("d"), date("Y"));
-$cal_args = "select * from " . MPREFIX . "event left join " . MPREFIX . "event_cat on event_category=event_cat_id where event_cat_subs>0 and 
+//$cal_starttime = mktime(0, 0, 0, date("n"), date("d"), date("Y"));
+$cal_args = "select * from #event left join #event_cat on event_category=event_cat_id where (event_cat_subs>0 OR event_cat_force_class != '') and 
 event_cat_today < " . intval($cal_starttime) . " and 
 event_start >= (" . intval($cal_starttime) . ") and
-event_start <= (86400+" . intval($cal_starttime) . ") and
-find_in_set(event_cat_notify,'2,3')";
-if ($caldb->db_Select_gen($cal_args))
+event_start <  (86400+" . intval($cal_starttime) . ") and
+find_in_set(event_cat_notify,'2,3,6,7')";
+
+send_mailshot($cal_args, 'today',2);
+
+
+// Finally do 'day before' emails
+$cal_args = "select * from #event left join #event_cat on event_category=event_cat_id where (event_cat_subs>0 OR event_cat_force_class != '') and 
+event_cat_today < " . intval($cal_starttime) . " and 
+event_start >= (" . intval($cal_starttime) ." + 86400 ) and
+event_start <  (" . intval($cal_starttime) ." + 172800) and
+find_in_set(event_cat_notify,'4,5,6,7')";
+
+send_mailshot($cal_args, 'tomorrow',2);
+
+
+if (($log_requirement > 0) && (!$run_from_menu))
 {
-    require_once(e_HANDLER . "mail.php");
-    while ($cal_row = $caldb->db_Fetch())
-    {
-        extract($cal_row);
-        $cal_emaildb->db_Update("event_cat", "event_cat_today=" . time() . " where event_cat_id=" . intval($event_cat_id));
-        if ($event_cat_force > 0)
-        { 
-            // Force email to members of this class
-
-            $cal_emilargs = "select * from " . MPREFIX . "user where user_class regexp '^".intval($event_cat_class).",' or user_class regexp ',".intval($event_cat_class).",'  or user_class regexp ',".intval($event_cat_class)."'"; 
-
-            if ($cal_emaildb->db_Select_gen($cal_emilargs))
-                {
-                    while ($cal_emrow = $cal_emaildb->db_Fetch())
-                {
-                    extract($cal_emrow);
-                    $cal_msg = $event_title . "\n\n" . $event_cat_msg2;
-                    sendemail($user_email, $pref['eventpost_mailsubject'], $cal_msg, $user_name, $pref['eventpost_mailaddress'], $pref['eventpost_mailfrom']); 
+  if (!($handle = fopen($log_filename, 'a'))) $log_requirement = 0;
+  if (fwrite($handle," .. completed at ".date("D j M Y G:i:s")."\r\n") === false) $log_requirement = 0;
+  fclose($handle);
+}
 
-                } 
-            } 
-        } 
-        else
-        { 
-            // only subscribers
-            $cal_emilargs = "select * from " . MPREFIX . "user left join " . MPREFIX . "event_subs on user_id=event_userid where " . MPREFIX . "event_subs.event_cat='".intval($event_category)."'";
-            if ($cal_emaildb->db_Select_gen($cal_emilargs))
-            {
-                while ($cal_emrow = $cal_emaildb->db_Fetch())
-                {
-                    extract($cal_emrow);
-                    $cal_msg = $event_title . "\n\n" . $event_cat_msg2;
-                    sendemail($user_email, $pref['eventpost_mailsubject'], $cal_msg, $user_name, $pref['eventpost_mailaddress'], $pref['eventpost_mailfrom']); 
+// Done
 
-                } 
+
+/*
+  Function to actually send a mailshot
+*/
+function send_mailshot($cal_query, $shot_type, $msg_num)
+{
+  global $sql, $sql2;
+  global $log_requirement, $log_filename, $debug_level;
+  global $pref;
+  global $run_from_menu;
+  
+  if (($log_requirement > 1)  && (!$run_from_menu))
+  {
+    if (!$handle = fopen($log_filename, 'a')) $log_requirement = 0;
+    if (fwrite($handle,"\r\n  Starting emails for ".$shot_type." at ".date("D j M Y G:i:s")) === false)  $log_requirement = 0;
+    if ($debug_level >= 2)
+    {
+      if (fwrite($handle,"\r\n    Query is: ".$cal_query."\r\n") === false) $log_requirement = 0;
+    }
+  }
+
+if ($num_cat_proc = $sql->db_Select_gen($cal_query))
+  {  // Got at least one event to process here
+    if ($log_requirement > 1)
+    {
+      if ($run_from_menu) if (!($handle = fopen($log_filename, 'a'))) $log_requirement = 0;
+      if (fwrite($handle," - ".$num_cat_proc." categories found to process\r\n") === false)  $log_requirement = 0;
+    }
+    require_once(e_HANDLER . "mail.php");
+    while ($cal_row = $sql->db_Fetch())
+    {  // Process one event at a time
+      extract($cal_row);
+		
+      if ($log_requirement > 1)
+	  {
+		  if (fwrite($handle,"    Processing event: ".$event_title." \r\n") === false)  $log_requirement = 0;
+	  }
+		
+	  if ($msg_num == 1)
+        $sql2->db_Update("event_cat", "event_cat_last=" . time() . " where event_cat_id=" . intval($event_cat_id));
+	  else
+        $sql2->db_Update("event_cat", "event_cat_today=" . time() . " where event_cat_id=" . intval($event_cat_id));
+
+
+// Start of next try on query
+// Four cases for the query:
+//	1. No forced mailshots - based on event_subs table only									Need INNER JOIN
+//	2. Forced mailshot to members - send to all users (don't care about subscriptions)		Don't need JOIN
+// 	3. Forced mailshot to group of members - based on user table only						Don't need JOIN
+//	4. Forced mailshot to group, plus optional subscriptions - use the lot!    				Need LEFT JOIN
+// (Always block sent to banned members)
+	  $manual_subs = (isset($pref['eventpost_asubs']) && ($pref['eventpost_asubs'] == '1'));
+	  $subs_fields = '';
+	  $subs_join = '';
+	  $where_clause = '';
+	  $group_clause = '';
+	  
+	  
+	  if ($event_cat_force_class != e_UC_MEMBER)
+	  {  // Cases 1, 3, 4 (basic query does for case 2)
+	  
+	    if ((!$event_cat_force_class) || ($manual_subs))
+	    {  // Cases 1 & 4 - need to join with event_subs database
+	      $subs_fields = ", es.* ";
+		  if ($event_cat_force_class) $subs_join = "LEFT"; else $subs_join = "INNER";
+	      $subs_join   .= " join #event_subs AS es on u.user_id=es.event_userid ";
+		  $where_clause = " es.event_cat='".intval($event_category)."' ";
+		  $group_clause = " GROUP BY u.user_id";
+	    }
+
+	    if ($event_cat_force_class)
+		{  // cases 3 and 4 - ... and check for involuntary subscribers
+		    if ($where_clause) $where_clause .= " OR ";
+		    if ($event_cat_force_class == e_UC_ADMIN)
+		    {
+		      $where_clause .= "(u.user_admin = '1' )";
+		    }
+		    else
+		    {
+	          $where_clause .= "find_in_set('".intval($event_cat_force_class)."', u.user_class)";
+		    }
+		}
+
+	    if ($where_clause) $where_clause = ' AND ('.$where_clause.' ) ';
+	  }   // End of cases 1, 3, 4
+	  
+	  $cal_emilargs = "SELECT u.user_id, u.user_class, u.user_email, u.user_name, u.user_ban, u.user_admin{$subs_fields}
+		  from #user AS u {$subs_join}
+		  WHERE u.user_ban = '0' {$where_clause} {$group_clause}";
+		  
+
+        if ($debug_level >= 2)
+		{
+		  if (fwrite($handle,"\r\n    Email selection query is: ".$cal_emilargs."\r\n") === false) $log_requirement = 0;
+		}
+        if ($num_shots = $sql2->db_Select_gen($cal_emilargs))
+        {
+            if ($log_requirement > 1)
+			{
+			  if (fwrite($handle," - ".$num_shots." emails found to send\r\n") === false)  $log_requirement = 0;
+			}
+            while ($cal_emrow = $sql2->db_Fetch())
+            {
+              extract($cal_emrow);
+			  if ($msg_num == 1)
+                $cal_msg = $event_title . "\n\n" . $event_cat_msg1;
+			  else
+                $cal_msg = $event_title . "\n\n" . $event_cat_msg2;
+              if ($debug_level == 0) $send_result = sendemail($user_email, $pref['eventpost_mailsubject'], $cal_msg, $user_name, $pref['eventpost_mailaddress'], $pref['eventpost_mailfrom']); 
+			  if ($log_requirement > 1)
+			  {
+			    $log_string = "      Send to: ".$user_email." Name: ".$user_name;
+				if ($debug_level > 0) 
+				  { $log_string .= " *DEBUG*
+"; 					} 
+				else 
+				  { $log_string .= " Result = ".$send_result."
+"; 					}
+			    if (fwrite($handle,$log_string) === false) $log_requirement = 0;
+			  }
             } 
         } 
     } // while    
+    if ($log_requirement > 1)
+    {
+	  if (fwrite($handle,"  Completed emails for ".$shot_type." at ".date("D j M Y G:i:s")."\r\n") === false)  $log_requirement = 0;
+	  fclose($handle);
+	}
+  }
 } 
-#print "done";
+
+
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/calendar_menu/subscribe.php 0.7.7/e107_plugins/calendar_menu/subscribe.php
--- 0.7.5/e107_plugins/calendar_menu/subscribe.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/calendar_menu/subscribe.php	2006-11-06 16:30:22.000000000 -0600
@@ -11,26 +11,36 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/subscribe.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/11/06 22:30:22 $
+|     $Author: e107coders $
+|
+| 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");
-$ec_dir = e_PLUGIN . "calendar_menu/";
-$lan_file = $ec_dir . "languages/" . e_LANGUAGE . ".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN . "calendar_menu/languages/English.php");
+@include_lan(e_PLUGIN . "calendar_menu/languages/English.php");
+
 define("PAGE_NAME", EC_LAN_80);
 require_once(HEADERF);
-$cal_db = new DB;
+
+
+if ((USER) && (isset($pref['eventpost_asubs']) && ($pref['eventpost_asubs'] == '1')))
+{
+$cal_db = new db;			// Probably best to keep this
 
 if (isset($_POST['upsubs']))
 {
-    $cal_cats = $tp -> toDB($_POST['event_list']);
-    $cal_subs =  $tp -> toDB($_POST['event_subd']);
-    $cal_db->db_Delete("event_subs", "event_userid='" . USERID . "'");
+    $cal_cats = $tp -> toDB($_POST['event_list']);		// IDs of allowed categories
+    $cal_subs =  $tp -> toDB($_POST['event_subd']);		// Checkbox results
+    $cal_db->db_Delete("event_subs", "event_userid='" . USERID . "'");		// Delete all for this user to start
     foreach($cal_cats as $cal_row)
-    {
+    {	// Now add in a subscription for each allowed category
         if ($cal_subs[$cal_row])
         {
             $cal_inargs = "0,'" . USERID . "','" . $cal_row . "'";
@@ -47,35 +57,52 @@
 {
     $caltext = "<form id='calsubs' action='" . e_SELF . "' method='post' >
 <table class='fborder' width='97%'>
-<tr><td class='fcaption' colspan='2'>" . EC_LAN_125 . "</td></tr>
-<tr><td class='forumheader2' >" . EC_LAN_126 . "</td><td class='forumheader2' >" . EC_LAN_127 . "</td></tr>"; 
+<tr><td class='fcaption' colspan='3'>" . EC_LAN_125 . "</td></tr>
+<tr><td class='forumheader2' >" . EC_LAN_126 . "</td><td class='forumheader2' >" . EC_LAN_127 . "</td><td class='forumheader2' >" . EC_LAN_136 . "</td></tr>"; 
     // Get list of currently subscribed
-    $cal_db->db_Select("event_subs", "event_cat", "where event_userid='" . USERID . "'", "nowhere");
-    while ($cal_s = $cal_db->db_Fetch())
-    {
-        extract($cal_s);
-        $cal_array[] = $event_cat;
-    } // while 
+  $cal_db->db_Select("event_subs", "event_cat", "where event_userid='" . USERID . "'", "nowhere");
+  while ($cal_s = $cal_db->db_Fetch())
+  {
+    extract($cal_s);
+    $cal_array[] = $event_cat;
+  } // while 
+
     // Get list of categories that have subscriptions and are visible to this member
-    $cal_args = "select * from " . MPREFIX . "event_cat where event_cat_subs>0 and event_cat_force = 0 and find_in_set(event_cat_class,'".USERCLASS_LIST."') ";
-    if ($cal_db->db_Select_gen($cal_args))
-    { 
-        // print $cal_args;
-        while ($cal_row = $cal_db->db_Fetch())
-        {
-            extract($cal_row);
-            $caltext .= "<tr>
-	<td class='forumheader3' style='width:10%;'><input type='hidden' name='event_list[]' value='" . $event_cat_id . "' />
-	<input type='checkbox' class='tbox' value='1' name='event_subd[$event_cat_id]' " . (in_array($event_cat_id, $cal_array)?"checked='checked' ":"") . " /> </td>
-	<td class='forumheader3'>$event_cat_name</td></tr>";
-        } 
-    } 
-    else
+  $cal_args = "select * from #event_cat 
+	where event_cat_subs>0  and (find_in_set(event_cat_class,'".USERCLASS_LIST."')  OR find_in_set(event_cat_force_class,'".USERCLASS_LIST."'))";
+  if ($cal_db->db_Select_gen($cal_args))
+  { 
+	// echo $cal_args."<br />";
+    while ($cal_row = $cal_db->db_Fetch())
     {
-        $caltext .= "<tr><td class='forumheader3' colspan='2'>" . EC_LAN_128 . "</td></tr>";
+      extract($cal_row);
+      $caltext .= "<tr><td class='forumheader3' style='width:10%;'>";
+	  if (check_class($event_cat_force_class))
+	  {
+	    $caltext .= EC_LAN_126;
+	  }
+	  else
+	  {
+	    $caltext .= "<input type='hidden' name='event_list[]' value='" . $event_cat_id . "' />
+	    <input type='checkbox' class='tbox' value='1' name='event_subd[$event_cat_id]' " . (in_array($event_cat_id, $cal_array)?"checked='checked' ":"") . " /> </td>";
+	  }
+	  $caltext .= "<td class='forumheader3'>{$event_cat_name}</td><td class='forumheader3'>{$event_cat_description}</td></tr>";
     } 
-    $caltext .= "<tr><td class='forumheader3' colspan='2'><input class='tbox' type='submit' value='" . EC_LAN_129 . "' name='upsubs' /></td></tr>";
-    $caltext .= "</table></form>";
+  } 
+  else
+  {
+    $caltext .= "<tr><td class='forumheader3' colspan='3'>" . EC_LAN_128 . "</td></tr>";
+  } 
+  $caltext .= "<tr><td class='forumheader3' colspan='3'><input class='tbox' type='submit' value='" . EC_LAN_129 . "' name='upsubs' /></td></tr>";
+  $caltext .= "</table></form>";
+}
+}
+else
+{
+  if (isset($pref['eventpost_asubs']) && ($pref['eventpost_asubs'] == '1'))
+  $caltext = EC_LAN_142;	// Register or log in 
+  else
+  $caltext = EC_LAN_143;	// No facility
 } 
 $ns->tablerender(EC_LAN_124, $caltext);
 require_once(FOOTERF);
diff -ruN 0.7.5/e107_plugins/chatbox_menu/admin_chatbox.php 0.7.7/e107_plugins/chatbox_menu/admin_chatbox.php
--- 0.7.5/e107_plugins/chatbox_menu/admin_chatbox.php	2006-05-19 17:02:22.000000000 -0500
+++ 0.7.7/e107_plugins/chatbox_menu/admin_chatbox.php	2006-11-20 06:49:40.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.16 $
-|     $Date: 2006/05/19 22:02:22 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.18 $
+|     $Date: 2006/11/20 12:49:40 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -29,8 +29,6 @@
 if (isset($_POST['updatesettings'])) {
 
 	$pref['chatbox_posts'] = $_POST['chatbox_posts'];
-	$pref['cb_linkc'] = $tp->toDB($_POST['cb_linkc']);
-	$pref['cb_linkreplace'] = $_POST['cb_linkreplace'];
 	$pref['cb_layer'] = $_POST['cb_layer'];
 	$pref['cb_layer_height'] = ($_POST['cb_layer_height'] ? $_POST['cb_layer_height'] : 200);
 	$pref['cb_emote'] = $_POST['cb_emote'];
@@ -52,7 +50,7 @@
 if (isset($_POST['recalculate'])) {
 	$sql->db_Update("user", "user_chats = 0");
 	$qry = "SELECT u.user_id AS uid, count(c.cb_nick) AS count FROM #chatbox AS c
-		LEFT JOIN #user AS u on FLOOR(c.cb_nick) = u.user_id
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(c.cb_nick,'.',1) = u.user_id
 		WHERE u.user_id > 0
 		GROUP BY uid";
 
@@ -60,7 +58,7 @@
 			$ret = array();
 			while($row = $sql -> db_Fetch())
 			{
-				$list[$row['uid']] = $row['count'];	
+				$list[$row['uid']] = $row['count'];
 			}
 		}
 
@@ -76,8 +74,6 @@
 }
 
 $chatbox_posts = $pref['chatbox_posts'];
-$cb_linkreplace = $pref['cb_linkreplace'];
-$cb_linkc = $pref['cb_linkc'];
 
 $text = "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."' id='cbform'>
@@ -127,7 +123,7 @@
 	</tr>
 
 	<tr><td class='forumheader3' style='width:40%'>".CHBLAN_36."</td>
-	<td class='forumheader3' style='width:60%'>". 
+	<td class='forumheader3' style='width:60%'>".
 	($pref['cb_layer'] == 0 ? "<input type='radio' name='cb_layer' value='0' checked='checked' />" : "<input type='radio' name='cb_layer' value='0' />")."&nbsp;&nbsp;". CHBLAN_37."<br />".
 	($pref['cb_layer'] == 1 ? "<input type='radio' name='cb_layer' value='1' checked='checked' />" : "<input type='radio' name='cb_layer' value='1' />")."&nbsp;".CHBLAN_29."&nbsp;--&nbsp;". CHBLAN_30.": <input class='tbox' type='text' name='cb_layer_height' size='8' value='".$pref['cb_layer_height']."' maxlength='3' /><br />".
 	($pref['cb_layer'] == 2 ? "<input type='radio' name='cb_layer' value='2' checked='checked' />" : "<input type='radio' name='cb_layer' value='2' />")."&nbsp;&nbsp;". CHBLAN_38."
@@ -157,8 +153,8 @@
 	<input class='button' type='submit' name='prune' value='".CHBLAN_21."' />
 	</td>
 	</tr>";
-	
-	
+
+
 	$text .= "<tr>
 	<td class='forumheader3' style='width:40%'>".CHBLAN_34.":</td>
 	<td class='forumheader3' style='width:60%'>
diff -ruN 0.7.5/e107_plugins/chatbox_menu/chat.php 0.7.7/e107_plugins/chatbox_menu/chat.php
--- 0.7.5/e107_plugins/chatbox_menu/chat.php	2006-01-19 18:26:53.000000000 -0600
+++ 0.7.7/e107_plugins/chatbox_menu/chat.php	2006-07-04 03:42:17.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.18 $
-|     $Date: 2006/01/20 00:26:53 $
-|     $Author: lisa_ $
+|     $Revision: 1.19 $
+|     $Date: 2006/07/04 08:42:17 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -54,12 +54,12 @@
 		$unblocklist = implode(",", $kk);
 		$sql->db_Select_gen("UPDATE #chatbox SET cb_blocked=0 WHERE cb_id IN ({$unblocklist})");
 	}
-	
+
 	if(isset($_POST['delete']))
 	{
 		$deletelist = implode(",", array_keys($_POST['delete']));
-		$sql -> db_Select_gen("SELECT c.cb_id, u.user_id FROM #chatbox AS c 
-		LEFT JOIN #user AS u ON FLOOR(c.cb_nick) = u.user_id 
+		$sql -> db_Select_gen("SELECT c.cb_id, u.user_id FROM #chatbox AS c
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(c.cb_nick,'.',1) = u.user_id
 		WHERE c.cb_id IN (".$deletelist.")");
 		$rowlist = $sql -> db_getList();
 		foreach ($rowlist as $row) {
@@ -128,7 +128,7 @@
 			$cb_message .= "&nbsp;&nbsp;&nbsp;<input type='checkbox' name='block[{$row['cb_id']}]' value='1' />".CHATBOX_L9;
 		}
 	}
-	
+
 	$CHAT_TABLE_MESSAGE = $cb_message;
 	$CHAT_TABLE_FLAG = ($flag ? "forumheader3" : "forumheader4");
 
@@ -157,7 +157,7 @@
 {
 	$ns->tablerender("", $message);
 }
-	
+
 $ns->tablerender(CHATBOX_L20, $text);
 
 
diff -ruN 0.7.5/e107_plugins/chatbox_menu/chatbox_menu.php 0.7.7/e107_plugins/chatbox_menu/chatbox_menu.php
--- 0.7.5/e107_plugins/chatbox_menu/chatbox_menu.php	2006-02-27 06:32:24.000000000 -0600
+++ 0.7.7/e107_plugins/chatbox_menu/chatbox_menu.php	2006-11-22 20:09:47.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/chatbox_menu.php,v $
-|     $Revision: 1.65 $
-|     $Date: 2006/02/27 12:32:24 $
-|     $Author: whoisrich $
+|     $Revision: 1.73 $
+|     $Date: 2006/11/23 02:09:47 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -55,7 +55,7 @@
 		{
 			if((strlen(trim($cmessage)) < 1000) && trim($cmessage) != "")
 			{
-				$cmessage = $tp -> toDB($cmessage);
+				$cmessage = $tp -> toDB($cmessage, false, true);
 				if($sql -> db_Select("chatbox", "*", "cb_message='$cmessage' AND cb_datestamp+84600>".time()))
 				{
 					$emessage = CHATBOX_L17;
@@ -88,7 +88,7 @@
 						$sql -> db_Insert("chatbox", "0, '$nick', '$cmessage', '".time()."', '0' , '$ip' ");
 						$edata_cb = array("cmessage" => $cmessage, "ip" => $ip);
 						$e_event -> trigger("cboxpost", $edata_cb);
-						$e107cache->clear("chatbox");
+						$e107cache->clear("nq_chatbox");
 					}
 				}
 			}
@@ -104,7 +104,6 @@
 	}
 }
 
-$pref['cb_linkc'] = str_replace("e107_images/", e_IMAGE, $pref['cb_linkc']);
 if(!USER && !$pref['anon_post']){
 	if($pref['user_reg'])
 	{
@@ -113,7 +112,7 @@
 }
 else
 {
-	$cb_width = (defined("CBWIDTH") ? CBWIDTH : "100%");
+	$cb_width = (defined("CBWIDTH") ? CBWIDTH : "");
 
 	if($pref['cb_layer'] == 2)
 	{
@@ -129,7 +128,7 @@
 
 	if(($pref['anon_post'] == "1" && USER == FALSE))
 	{
-		$texta .= "\n<input class='tbox' type='text' id='nick' name='nick' value='' maxlength='50' style='width: ".$cb_width.";' /><br />";
+		$texta .= "\n<input class='tbox chatbox' type='text' id='nick' name='nick' value='' maxlength='50' ".($cb_width ? "style='width: ".$cb_width.";'" : '')." /><br />";
 	}
 
 	if($pref['cb_layer'] == 2)
@@ -142,7 +141,7 @@
 		$oc = "";
 	}
 	$texta .= "
-	<textarea class='tbox chatbox' id='cmessage' name='cmessage' cols='20' rows='5' style='width:".$cb_width."; overflow: auto' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
+	<textarea class='tbox chatbox' id='cmessage' name='cmessage' cols='20' rows='5' style='".($cb_width ? "width:".$cb_width.";" : '')." overflow: auto' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
 	<br />
 	<input class='button' type='submit' id='chat_submit' name='chat_submit' value='".CHATBOX_L4."' {$oc}/>
 	<input class='button' type='reset' name='reset' value='".CHATBOX_L5."' />";
@@ -161,7 +160,7 @@
 	$texta .= "<div style='text-align:center'><b>".$emessage."</b></div>";
 }
 
-if(!$text = $e107cache->retrieve("chatbox"))
+if(!$text = $e107cache->retrieve("nq_chatbox"))
 {
 	global $pref,$tp;
 	$pref['chatbox_posts'] = ($pref['chatbox_posts'] ? $pref['chatbox_posts'] : 10);
@@ -174,7 +173,7 @@
 
 	$qry = "
 	SELECT c.*, u.user_name FROM #chatbox AS c
-	LEFT JOIN #user AS u ON FLOOR(c.cb_nick) = u.user_id
+	LEFT JOIN #user AS u ON SUBSTRING_INDEX(c.cb_nick,'.',1) = u.user_id
 	ORDER BY c.cb_datestamp DESC LIMIT 0, ".intval($chatbox_posts);
 
 	if($sql -> db_Select_gen($qry))
@@ -191,14 +190,15 @@
 			}
 			else
 			{
-				$cb_nick = $tp -> toHTML($cb_nick);
+				$cb_nick = $tp -> toHTML($cb_nick,FALSE,'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';
 
-			$cb_message = $tp -> toHTML($cb['cb_message'], FALSE, $emotes_active, $cb['cb_uid'], $pref['menu_wordwrap']);
+			$cb_message = $tp -> toHTML($cb['cb_message'], FALSE, $emotes_active, $cb_uid, $pref['menu_wordwrap']);
 
 			$replace[0] = "["; $replace[1] = "]";
 			$search[0] = "&lsqb;"; $search[1] =  "&rsqb;";
@@ -233,7 +233,7 @@
 	{
 		$text .= "<br /><div style='text-align:center'><a href='".e_PLUGIN."chatbox_menu/chat.php'>".(CB_MOD ? CHATBOX_L13 : CHATBOX_L12)."</a> (".$total_chats.")</div>";
 	}
-	$e107cache->set("chatbox", $text);
+	$e107cache->set("nq_chatbox", $text);
 }
 
 $caption = (file_exists(THEME."images/chatbox_menu.png") ? "<img src='".THEME_ABS."images/chatbox_menu.png' alt='' /> ".CHATBOX_L2 : CHATBOX_L2);
diff -ruN 0.7.5/e107_plugins/chatbox_menu/e_rss.php 0.7.7/e107_plugins/chatbox_menu/e_rss.php
--- 0.7.5/e107_plugins/chatbox_menu/e_rss.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/chatbox_menu/e_rss.php	2006-06-20 02:22:46.000000000 -0500
@@ -0,0 +1,44 @@
+<?php
+
+if (!defined('e107_INIT')) { exit; }
+
+//##### create feed for admin, return array $eplug_rss_feed --------------------------------
+$feed['name']		= 'Chatbox';
+$feed['url']		= 'chatbox';			//the identifier for the rss feed url
+$feed['topic_id']	= '';					//the topic_id, empty on default (to select a certain category)
+$feed['path']		= 'chatbox_menu';		//this is the plugin path location
+$feed['text']		= 'this is the rss feed for the chatbox entries';
+$feed['class']		= '0';
+$feed['limit']		= '9';
+
+// ------------------------------------------------------------------------------------
+
+
+//##### create rss data, return as array $eplug_rss_data -----------------------------------
+$rss = array();
+if($items = $sql -> db_Select('chatbox', "*", "cb_blocked=0 ORDER BY cb_datestamp DESC LIMIT 0,".$this -> limit)){
+	$i=0;
+	while($rowrss = $sql -> db_Fetch()){
+		$tmp						= explode(".", $rowrss['cb_nick']);
+		$rss[$i]['author']			= $tmp[1];
+		$rss[$i]['author_email']	= '';
+		$rss[$i]['link']			= $e107->base_path.$PLUGINS_DIRECTORY."chatbox_menu/chat.php?".$rowrss['cb_id'];
+		$rss[$i]['linkid']			= $rowrss['cb_id'];
+		$rss[$i]['title']			= '';
+		$rss[$i]['description']		= $rowrss['cb_message'];
+		$rss[$i]['category_name']	= '';
+		$rss[$i]['category_link']	= '';
+		$rss[$i]['datestamp']		= $rowrss['cb_datestamp'];
+		$rss[$i]['enc_url']			= "";
+		$rss[$i]['enc_leng']		= "";
+		$rss[$i]['enc_type']		= "";
+		$i++;
+	}
+}
+
+
+//##### ------------------------------------------------------------------------------------
+
+$eplug_rss_data[] = $rss;
+$eplug_rss_feed[] = $feed;
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/chatbox_menu/languages/English/English.php 0.7.7/e107_plugins/chatbox_menu/languages/English/English.php
--- 0.7.5/e107_plugins/chatbox_menu/languages/English/English.php	2005-10-17 23:42:12.000000000 -0500
+++ 0.7.7/e107_plugins/chatbox_menu/languages/English/English.php	2006-10-21 06:22:03.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/languages/English/English.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/10/18 04:42:12 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/10/21 11:22:03 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -35,7 +35,7 @@
 define("CHATBOX_L16", "Anonymous");
 define("CHATBOX_L17", "Duplicate post");
 define("CHATBOX_L18", "Chatbox messages moderated");
-define("CHATBOX_L19", "You may only post once every ".FLOODTIMEOUT." seconds");
+define("CHATBOX_L19", "You may only post once every ".(FLOODPROTECT ? FLOODTIMEOUT : 'n/a')." seconds");
 
 define("CHATBOX_L20", "Chatbox (all posts)");
 define("CHATBOX_L21", "Chat Posts");
diff -ruN 0.7.5/e107_plugins/chatbox_menu/plugin.php 0.7.7/e107_plugins/chatbox_menu/plugin.php
--- 0.7.5/e107_plugins/chatbox_menu/plugin.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/chatbox_menu/plugin.php	2006-11-20 06:49:40.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/plugin.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2006/11/20 12:49:40 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -42,22 +42,19 @@
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/chatbox_32.png";
 $eplug_icon_small = $eplug_folder."/images/chatbox_16.png";
-$eplug_caption = "Configure Chatbox";
+
+$eplug_caption = LAN_CONFIGURE; // e107 generic term.
 
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array(
 	'chatbox_posts' => '10',
-	'cb_linkc' => ' -link- ',
 	'cb_wordwrap' => '20',
-	'cb_linkreplace' => '1',
 	'cb_layer' => '0',
 	'cb_layer_height' => '200',
 	'cb_emote' => '0',
 	'cb_mod' => e_UC_ADMIN
 );
 
-
-
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
 	"chatbox"
@@ -76,40 +73,17 @@
 	) TYPE=MyISAM;"
 );
 
-$eplug_rss['chatbox'] = array(
-	"id" => "chatbox",
-	"author" => "cb_nick",
-	"link" => $eplug_folder."/chat.php?#",
-	"linkid" => "cb_id",
-	"title" => "",
-	"description" => "cb_message",
-	"query" => "SELECT * FROM #chatbox WHERE cb_blocked=0 ORDER BY cb_datestamp DESC LIMIT 0, 9",
-	"category" => "1",
-	"datestamp" => "cb_datestamp",
-	"enc_url" => "0",
-	"enc_leng" => "0",
-	"enc_type" => "0"
-);
-
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
 $eplug_link_name = '';
 $eplug_link_url = '';
 
 
-// Text to display after plugin successfully installed ------------------------------------------------------------------
-$eplug_done = "Chatbox has successfully installed. To configure, click on the link on the admin front page.";
-
-
 // upgrading ... //
-
 $upgrade_add_prefs = "";
-
 $upgrade_remove_prefs = "";
-
 $upgrade_alter_tables = "";
 
-$eplug_upgrade_done = "";
 
 if (!function_exists('chatbox_menu_uninstall')) {
 	function chatbox_menu_uninstall() {
@@ -125,4 +99,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/clock_menu/languages/admin/English.php 0.7.7/e107_plugins/clock_menu/languages/admin/English.php
--- 0.7.5/e107_plugins/clock_menu/languages/admin/English.php	2005-01-27 13:52:39.000000000 -0600
+++ 0.7.7/e107_plugins/clock_menu/languages/admin/English.php	2006-10-31 15:16:29.000000000 -0600
@@ -11,12 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/clock_menu/languages/admin/English.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/01/27 19:52:39 $
-|     $Author: streaky $
+|     $Revision: 1.4 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 define("CLOCK_AD_L1", "Clock menu configuration saved");
 define("CLOCK_AD_L2", "Caption");
 define("CLOCK_AD_L3", "Update Menu Settings");
@@ -24,12 +24,12 @@
 define("CLOCK_AD_L5", "AM/PM");
 define("CLOCK_AD_L6", "If checked, you will display time with US format (0-12 AM/PM format). Unchecked you will display a 'military' format 0-24 format");
 define("CLOCK_AD_L7", "Date Prefix");
-define("CLOCK_AD_L8", "If your language requires a short word before the date (Example 'le' for french or 'den' for german...), use this field. If not required, let empty.");
+define("CLOCK_AD_L8", "If your language requires a short word before the date (e.g. 'le' for French or 'den' for German...), use this field. If not required, leave blank.");
 define("CLOCK_AD_L9", "Suffix 1");
 define("CLOCK_AD_L10", "Suffix 2");
 define("CLOCK_AD_L11", "Suffix 3");
 define("CLOCK_AD_L12", "Suffix 4 and more");
-define("CLOCK_AD_L13", "If your language requires to display a suffix just after numbers for date, fill these fields with suffix only (Example: 'st' for 1, 'nd' for 2, 'rd' for 3 and 'th' for 4 and more for english users). If not required let empty.");
+define("CLOCK_AD_L13", "If your language requires to display a suffix just after numbers for date, fill these fields with suffix only (Example: 'st' for 1, 'nd' for 2, 'rd' for 3 and 'th' for 4 and more - for English users). If not required leave blank.");
 define("CLOCK_AD_L14", "");
 define("CLOCK_AD_L15", "");
 define("CLOCK_AD_L16", "");
@@ -41,4 +41,4 @@
 define("CLOCK_AD_L22", "");
 define("CLOCK_AD_L23", "");
 define("CLOCK_AD_L24", "");
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/comment_menu/comment_menu.php 0.7.7/e107_plugins/comment_menu/comment_menu.php
--- 0.7.5/e107_plugins/comment_menu/comment_menu.php	2006-04-05 07:19:18.000000000 -0500
+++ 0.7.7/e107_plugins/comment_menu/comment_menu.php	2006-06-22 14:13:41.000000000 -0500
@@ -11,81 +11,37 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/comment_menu/comment_menu.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/04/05 12:19:18 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.20 $
+|     $Date: 2006/06/22 19:13:41 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-global $tp, $e107;
-$gen = new convert;
+require_once(e_PLUGIN."comment_menu/comment_menu_shortcodes.php");
+require_once(e_HANDLER."comment_class.php");
+$cobj = new comment;
+
+if (file_exists(THEME."comment_menu_template.php")){
+	require_once(THEME."comment_menu_template.php");
+}else{
+	require_once(e_PLUGIN."comment_menu/comment_menu_template.php");
+}
+
+$data = $cobj->getCommentData(intval($menu_pref['comment_display']));
 
-$query = "
-SELECT c.*, u.user_id, u.user_name FROM #comments AS c
-LEFT JOIN #user AS u ON FLOOR(c.comment_author) = u.user_id 
-ORDER BY c.comment_datestamp DESC LIMIT 0, ".intval($menu_pref['comment_display']);
-
-$results = $sql->db_Select_gen($query);
-$commentArray = $sql->db_getList();
-
-if(!$results)
-{
-	// no posts yet ..
+$text = '';
+// no posts yet ..
+if(empty($data) || !is_array($data)){
 	$text = CM_L1;
 }
-else
-{
-	$text = "";
-
-	$bullet_img = THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif");
-	foreach($commentArray as $c)
-	{
-		$datestamp = $gen->convert_date($c['comment_datestamp'], "short");
-		$poster = substr($c['comment_author'], (strpos($c['comment_author'], ".")+1));
-		$comment = strip_tags(preg_replace("/\[.*\]/", "", $c['comment_comment'])); // remove bbcode
-		$comment = $tp->toHTML($comment, FALSE, "", "", $pref['menu_wordwrap']);
-		
-		if (strlen($comment) > $menu_pref['comment_characters'])
-		{
-			$comment = substr($comment, 0, $menu_pref['comment_characters']).$menu_pref['comment_postfix'];
-		}
-
-		$link = "";
-		switch ($c['comment_type']) {
-			case "0":
-				$link = "<img src='{$bullet_img}' alt='' /> <a href='".$e107->base_path."comment.php?comment.news.{$c['comment_item_id']}'><b>".$poster."</b> on ".$datestamp."</a><br />";
-				break;
-			case "4":
-				$link = "<img src='{$bullet_img}' alt='' /> <a href='".$e107->base_path."comment.php?comment.poll.{$c['comment_item_id']}'><b>".$poster."</b> on ".$datestamp."</a><br />";
-				break;
-			case "profile":
-				if(USER)
-				{
-					$link = "<img src='{$bullet_img}' alt='' /> <a href='".$e107->base_path."user.php?id.{$c['comment_item_id']}'><b>".$poster."</b> on ".$datestamp."</a><br />";
-				}
-				break;
-
-			default:
-				// It's probably from a 3rd party plugin so load in the e_comment file to get the URL to use
-				$ecomment = e_PLUGIN.$c['comment_type']."/e_comment.php";
-				if(is_readable($ecomment))
-				{
-					$nid = $c['comment_item_id'];
-					include($ecomment);
-					$link = "<img src='{$bullet_img}' alt='' /> <a href='$reply_location'><b>".$poster."</b> on ".$datestamp."</a><br />";
-				}
-				break;
-		}
-
-		if($link)
-		{
-			$heading = ($menu_pref['comment_title'] ? " [ Re: <i>{$c['comment_subject']}</i> ]<br />" : "");
-			$text .= $link.$heading.$comment."<br /><br />";
-		}
-	}
+
+global $row;
+foreach($data as $row){
+	$text .= $tp->parseTemplate($COMMENT_MENU_TEMPLATE, true, $comment_menu_shortcodes);
 }
 
 $ns->tablerender($menu_pref['comment_caption'], $text, 'comment');
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/comment_menu/comment_menu_shortcodes.php 0.7.7/e107_plugins/comment_menu/comment_menu_shortcodes.php
--- 0.7.5/e107_plugins/comment_menu/comment_menu_shortcodes.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/comment_menu/comment_menu_shortcodes.php	2006-07-04 12:30:38.000000000 -0500
@@ -0,0 +1,73 @@
+<?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/comment_menu/comment_menu_shortcodes.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/07/04 17:30:38 $
+|     $Author: lisa_ $
++----------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+global $tp;
+$comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+
+/*
+SC_BEGIN CM_ICON
+return (defined("BULLET") ? "<img src='".THEME_ABS."images/".BULLET."' alt='' style='border:0; vertical-align: middle;' />" : "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='border:0; vertical-align: middle;' />");
+SC_END
+
+SC_BEGIN CM_DATESTAMP
+global $row;
+$gen = new convert;
+return $gen->convert_date($row['comment_datestamp'], "short");
+SC_END
+
+SC_BEGIN CM_HEADING
+global $row;
+return $row['comment_title'];
+SC_END
+
+SC_BEGIN CM_URL_PRE
+global $row;
+return ($row['comment_url'] ? "<a href='".$row['comment_url']."'>" : "");
+SC_END
+
+SC_BEGIN CM_URL_POST
+global $row;
+return ($row['comment_url'] ? "</a>" : "");
+SC_END
+
+SC_BEGIN CM_TYPE
+global $row;
+return $row['comment_type'];
+SC_END
+
+SC_BEGIN CM_AUTHOR
+global $row;
+return $row['comment_author'];
+SC_END
+
+SC_BEGIN CM_COMMENT
+global $row, $menu_pref;
+$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'];
+	}
+}
+return $COMMENT;
+SC_END
+
+*/
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/comment_menu/comment_menu_template.php 0.7.7/e107_plugins/comment_menu/comment_menu_template.php
--- 0.7.5/e107_plugins/comment_menu/comment_menu_template.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/comment_menu/comment_menu_template.php	2006-07-04 12:30:39.000000000 -0500
@@ -0,0 +1,38 @@
+<?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/comment_menu/comment_menu_template.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/07/04 17:30:39 $
+|     $Author: lisa_ $
++----------------------------------------------------------------------------+
+*/
+
+$sc_style['CM_TYPE']['pre'] = "[";
+$sc_style['CM_TYPE']['post'] = "]";
+
+$sc_style['CM_AUTHOR']['pre'] = CM_L13." <b>";
+$sc_style['CM_AUTHOR']['post'] = "</b>";
+
+$sc_style['CM_DATESTAMP']['pre'] = " ".CM_L11." ";
+$sc_style['CM_DATESTAMP']['post'] = "";
+
+$sc_style['CM_COMMENT']['pre'] = "";
+$sc_style['CM_COMMENT']['post'] = "<br /><br />";
+
+if (!isset($COMMENT_MENU_TEMPLATE)){
+	$COMMENT_MENU_TEMPLATE = "
+	{CM_ICON} {CM_URL_PRE}{CM_TYPE} {CM_HEADING}{CM_URL_POST}<br />
+	{CM_AUTHOR} {CM_DATESTAMP}<br />
+	{CM_COMMENT}";
+}
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/comment_menu/config.php 0.7.7/e107_plugins/comment_menu/config.php
--- 0.7.5/e107_plugins/comment_menu/config.php	2005-05-25 04:43:25.000000000 -0500
+++ 0.7.7/e107_plugins/comment_menu/config.php	2006-10-24 08:41:56.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/comment_menu/config.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/05/25 09:43:25 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/24 13:41:56 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
@@ -85,7 +85,7 @@
 if ($menu_pref['comment_title']) {
 	$text .= " checked ";
 }
-$text .= ">
+$text .= " />
 	</td>
 	</tr>
 	 
diff -ruN 0.7.5/e107_plugins/comment_menu/languages/English.php 0.7.7/e107_plugins/comment_menu/languages/English.php
--- 0.7.5/e107_plugins/comment_menu/languages/English.php	2005-01-27 13:52:40.000000000 -0600
+++ 0.7.7/e107_plugins/comment_menu/languages/English.php	2006-10-28 20:00:21.000000000 -0500
@@ -11,7 +11,7 @@
 | GNU General Public License (http://gnu.org).
 +---------------------------------------------------------------+
 */
-	
+
 define("CM_L1", "No comments yet.");
 define("CM_L2", "");
 define("CM_L3", "Caption");
@@ -22,6 +22,8 @@
 define("CM_L8", "New Comments Menu Configuration");
 define("CM_L9", "Update Menu Settings");
 define("CM_L10", "Comments menu configuration saved");
-	
-	
-?>
\ No newline at end of file
+define("CM_L11", "on");
+define("CM_L12", "Re:");
+define("CM_L13", "Posted by");
+
+?>
diff -ruN 0.7.5/e107_plugins/compliance_menu/compliance_menu.php 0.7.7/e107_plugins/compliance_menu/compliance_menu.php
--- 0.7.5/e107_plugins/compliance_menu/compliance_menu.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/compliance_menu/compliance_menu.php	2006-06-28 14:03:06.000000000 -0500
@@ -3,8 +3,7 @@
 if (!defined('e107_INIT')) { exit; }
 
 $text = "<div style='text-align:center'>
-	<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://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);
diff -ruN 0.7.5/e107_plugins/content/admin_content_config.php 0.7.7/e107_plugins/content/admin_content_config.php
--- 0.7.5/e107_plugins/content/admin_content_config.php	2006-02-13 04:13:22.000000000 -0600
+++ 0.7.7/e107_plugins/content/admin_content_config.php	2006-07-30 08:14:09.000000000 -0500
@@ -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.60 $
-|		$Date: 2006/02/13 10:13:22 $
+|		$Revision: 1.63 $
+|		$Date: 2006/07/30 13:14:09 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -116,6 +116,7 @@
 	}
 }
 
+//update options
 if(isset($_POST['updateoptions'])){
 	$content_pref	= $aa -> UpdateContentPref($_POST['options_type']);
 	$message		= CONTENT_ADMIN_CAT_LAN_22."<br /><br />";
@@ -125,6 +126,41 @@
 	$e107cache->clear($plugintable);
 }
 
+//update the inheritance of options
+if(isset($_POST['updateinherit'])){
+	foreach($_POST['id'] as $k=>$v){
+		//get current
+		$sql -> db_Select($plugintable, "content_pref", "content_id='".intval($k)."' ");
+		$row = $sql -> db_Fetch();
+		$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
+		//assign or remove inherit option
+		if(isset($_POST['content_inherit']) && isset($_POST['content_inherit'][$k]) ){
+			$content_pref['content_inherit'] = "1";
+		}else{
+			unset($content_pref['content_inherit']);
+		}
+		//update
+		$tmp = $eArrayStorage->WriteArray($content_pref);
+		$sql2 -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($k)."' ");
+	}
+	$message		= CONTENT_ADMIN_CAT_LAN_22."<br /><br />";
+	$e107cache->clear($plugintable);
+}
+
+//update manager classes into preferences
+if(isset($_POST['update_manager'])){
+	$content_pref	= $aa -> UpdateContentPref($_POST['options_type']);
+	$message		= CONTENT_ADMIN_CAT_LAN_22."<br /><br />";
+	$e107cache->clear($plugintable);
+}
+
+//update page restriction classes into preferences
+if(isset($_POST['update_restrict'])){
+	$content_pref	= $aa -> UpdateContentPref($_POST['options_type']);
+	$message		= CONTENT_ADMIN_CAT_LAN_22."<br /><br />";
+	$e107cache->clear($plugintable);
+}
+
 
 //pre-upload a new category icon in the create/edit category form
 if(isset($_POST['uploadcaticon'])){
@@ -329,7 +365,7 @@
 	}elseif($qs[0] == "manager" && !isset($qs[1]) ){
 		if(!getperms("0")){ header("location:".e_SELF); exit; }
 		//$aform -> show_admin_contentmanager();
-		$aform -> show_manage("manager");
+		$aform -> manager();
 	
 	//category content manager : view contentmanager
 	}elseif($qs[0] == "manager" && isset($qs[1]) && is_numeric($qs[1]) ){
@@ -338,14 +374,14 @@
 			$message = $adb -> dbAssignAdmins("admin", intval($qs[1]), $qs[2]);
 			$ns -> tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 		}
-		$aform -> show_admin_contentmanager_category();
+		$aform -> manager_category();
 
 
 
 
 	//overview all categories
 	}elseif($qs[0] == "cat" && !isset($qs[1]) ){
-		$aform -> show_manage("category");
+		$aform -> manage_cat();
 
 	//create category
 	}elseif($qs[0] == "cat" && $qs[1] == "create" ){
@@ -377,7 +413,18 @@
 		$aform -> show_create_category();
 
 
+
+	//restrict : choose category
+	}elseif($qs[0] == "restrict" && !isset($qs[1]) ){
+		//if(!getperms("0")){ header("location:".e_SELF); exit; }
+		$aform -> restrict();
+	
+	//restrict : view restrict for main parent
+	}elseif($qs[0] == "restrict" && isset($qs[1]) && is_numeric($qs[1]) ){
+		//if(!getperms("0")){ header("location:".e_SELF); exit; }
+		$aform -> restrict_category();
 	}
+
 }
 
 // ##### End --------------------------------------------------------------------------------------
@@ -388,6 +435,9 @@
 
                 global $sql, $plugintable, $aa;
 
+				//toggle to show categories in admin right hand menu
+				$showadmincat = TRUE;
+
 				if(e_QUERY){
 					$qs		=	explode(".", e_QUERY);
 				}
@@ -422,8 +472,10 @@
 				$var['option']['text']			= CONTENT_ADMIN_MENU_LAN_6;
                 $var['option']['link']			= e_SELF."?option";
 
-				$var['manager']['text']			= CONTENT_ADMIN_MENU_LAN_17;
-                $var['manager']['link']			= e_SELF."?manager";
+				if(getperms("0")){ 
+					$var['manager']['text']			= CONTENT_ADMIN_MENU_LAN_17;
+					$var['manager']['link']			= e_SELF."?manager";
+				}
 
                 if($submittedcontents = $sql -> db_Count($plugintable, "(*)", "WHERE content_refer ='sa' ")){
                         $var['submitted']['text']	= CONTENT_ADMIN_MENU_LAN_4." (".$submittedcontents.")";
@@ -436,10 +488,10 @@
 					unset($var);
 					$var=array();
 					$var['creation']['text']		= CONTENT_ADMIN_MENU_LAN_7;
+					$var['catcreation']['text']		= CONTENT_ADMIN_MENU_LAN_23;
 					$var['submission']['text']		= CONTENT_ADMIN_MENU_LAN_8;
 					$var['paththeme']['text']		= CONTENT_ADMIN_MENU_LAN_9;
 					$var['general']['text']			= CONTENT_ADMIN_MENU_LAN_10;
-					$var['contentmanager']['text']	= CONTENT_ADMIN_MENU_LAN_19;
 					$var['menu']['text']			= CONTENT_ADMIN_MENU_LAN_14;
 
 					$sql = new db;
@@ -460,45 +512,48 @@
 					show_admin_menu(CONTENT_ADMIN_MENU_LAN_21.": ".$content_heading."", $act, $var, TRUE);
 				
 				}else{
-						$sql2 = new db;
-						if($category_total = $sql2 -> db_Select($plugintable, "content_id, content_heading", "content_parent='0' ")){
-							while($row = $sql2 -> db_Fetch()){
-
-								unset($var);
-								$var=array();
-
-								$array		= $aa -> getCategoryTree("", $row['content_id'], FALSE);	//get all categories from each main parent
-								$newarray	= array_merge_recursive($array);
-
-								$newparent=array();
-								for($a=0;$a<count($newarray);$a++){
-									for($b=0;$b<count($newarray[$a]);$b++){
-										$newparent[$newarray[$a][$b]] = $newarray[$a][$b+1];
-										$b++;
+						
+						if($showadmincat){
+							$sql2 = new db;
+							if($category_total = $sql2 -> db_Select($plugintable, "content_id, content_heading", "content_parent='0' ")){
+								while($row = $sql2 -> db_Fetch()){
+
+									unset($var);
+									$var=array();
+
+									$array		= $aa -> getCategoryTree("", $row['content_id'], FALSE);	//get all categories from each main parent
+									$newarray	= array_merge_recursive($array);
+
+									$newparent=array();
+									for($a=0;$a<count($newarray);$a++){
+										for($b=0;$b<count($newarray[$a]);$b++){
+											$newparent[$newarray[$a][$b]] = $newarray[$a][$b+1];
+											$b++;
+										}
 									}
-								}
 
-								foreach($newparent as $key => $value){
-									$var['c'.$key]['text']	= $value;
-									$var['c'.$key]['link']	= e_SELF."?content.".$key;
-								}
-								if( isset($qs[0]) && $qs[0] == "content" && isset($qs[1]) && $qs[1] == "create"){
-									$act = "";
-								}elseif( isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && ($qs[1] == "create" || $qs[1] == "edit") ){
-									$act = "";
-								}elseif( isset($qs[0]) && $qs[0] == "order" ){
-									$act = "";
-								}elseif( isset($qs[0]) && $qs[0] == "manager" ){
-									$act = "";
-								}else{
-									if(isset($qs[0]) && isset($qs[1]) ){
-										$act = "c".$qs[1];
+									foreach($newparent as $key => $value){
+										$var['c'.$key]['text']	= $value;
+										$var['c'.$key]['link']	= e_SELF."?content.".$key;
+									}
+									if( isset($qs[0]) && $qs[0] == "content" && isset($qs[1]) && $qs[1] == "create"){
+										$act = "";
+									}elseif( isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && ($qs[1] == "create" || $qs[1] == "edit") ){
+										$act = "";
+									}elseif( isset($qs[0]) && $qs[0] == "order" ){
+										$act = "";
+									}elseif( isset($qs[0]) && $qs[0] == "manager" ){
+										$act = "";
 									}else{
-										$act = "c";
+										if(isset($qs[0]) && isset($qs[1]) ){
+											$act = "c".$qs[1];
+										}else{
+											$act = "c";
+										}
 									}
-								}
 
-								show_admin_menu(CONTENT_ADMIN_MENU_LAN_5." : ".$row['content_heading']."", $act, $var);
+									show_admin_menu(CONTENT_ADMIN_MENU_LAN_5." : ".$row['content_heading']."", $act, $var);
+								}
 							}
 						}
 				}
@@ -506,135 +561,6 @@
 }
 // ##### End --------------------------------------------------------------------------------------
 
-
 require_once(e_ADMIN."footer.php");
 
-function headerjs(){
-	global $tp, $plugindir;
-
-	$script = "
-	<script type='text/javascript' src='".$plugindir."content.js'></script>\n
-	<script type=\"text/javascript\">
-
-	function confirm2_(mode, number, name){
-	if(mode == 'image'){
-	var x=confirm(\"".CONTENT_ADMIN_JS_LAN_2." [".CONTENT_ADMIN_JS_LAN_4.": \" + name + \"] \");
-	}
-	if(mode == 'icon'){
-	var x=confirm(\"".CONTENT_ADMIN_JS_LAN_7." [".CONTENT_ADMIN_JS_LAN_8.": \" + name + \"] \");
-	}
-	if(mode == 'file'){
-	var x=confirm(\"".CONTENT_ADMIN_JS_LAN_3." [".CONTENT_ADMIN_JS_LAN_5.": \" + name + \"] \");
-	}
-	var i;
-	var imagemax = 10;
-	if(x){
-	if(mode == 'image'){
-	for (i = 0; i < imagemax; i++){
-	if(number == i){
-	document.getElementById('content_images' + i).value = '';
-	}
-	}
-	}
-	if(mode == 'icon'){
-	document.getElementById('content_icon').value = '';
-	}
-	if(mode == 'file'){
-	for (i = 0; i < imagemax; i++){
-	if(number == i){
-	document.getElementById('content_files' + i).value = '';
-	}
-	}
-	}
-	}
-	}
-	//<![CDATA[
-	// Adapted from original:  Kathi O'Shea (Kathi.O'Shea@internet.com)
-	function moveOver() {
-	var boxLength = document.getElementById('assignclass2').length;
-	var selectedItem = document.getElementById('assignclass1').selectedIndex;
-	var selectedText = document.getElementById('assignclass1').options[selectedItem].text;
-	var selectedValue = document.getElementById('assignclass1').options[selectedItem].value;
-	var i;
-	//var newvalues;
-	var isNew = true;
-	if (boxLength != 0) {
-	for (i = 0; i < boxLength; i++) {
-	thisitem = document.getElementById('assignclass2').options[i].text;
-	if (thisitem == selectedText) {
-	isNew = false;
-	break;
-	}
-	}
-	}
-	if (isNew) {
-	newoption = new Option(selectedText, selectedValue, false, false);
-	document.getElementById('assignclass2').options[boxLength] = newoption;
-	document.getElementById('assignclass1').options[selectedItem].text = '';
-	}
-	document.getElementById('assignclass1').selectedIndex=-1;
-	}
-
-
-	function removeMe() {
-	var boxLength = document.getElementById('assignclass2').length;
-	var boxLength2 = document.getElementById('assignclass1').length;
-	arrSelected = new Array();
-	var count = 0;
-	for (i = 0; i < boxLength; i++) {
-	if (document.getElementById('assignclass2').options[i].selected) {
-	arrSelected[count] = document.getElementById('assignclass2').options[i].value;
-	var valname = document.getElementById('assignclass2').options[i].text;
-	for (j = 0; j < boxLength2; j++) {
-	if (document.getElementById('assignclass1').options[j].value == arrSelected[count]){
-	document.getElementById('assignclass1').options[j].text = valname;
-	}
-	}
-
-	// document.getElementById('assignclass1').options[i].text = valname;
-	}
-	count++;
-	}
-	var x;
-	for (i = 0; i < boxLength; i++) {
-	for (x = 0; x < arrSelected.length; x++) {
-	if (document.getElementById('assignclass2').options[i].value == arrSelected[x]) {
-	document.getElementById('assignclass2').options[i] = null;
-	}
-	}
-	boxLength = document.getElementById('assignclass2').length;
-	}
-	}
-
-	function clearMe(clid) {
-	location.href = document.location + \".clear\";
-	}
-
-	function saveMe(clid) {
-	var strValues = \"\";
-	var boxLength = document.getElementById('assignclass2').length;
-	var count = 0;
-	if (boxLength != 0) {
-	for (i = 0; i < boxLength; i++) {
-	if (count == 0) {
-	strValues = document.getElementById('assignclass2').options[i].value;
-	} else {
-	strValues = strValues + \",\" + document.getElementById('assignclass2').options[i].value;
-	}
-	count++;
-	}
-	}
-	if (strValues.length == 0) {
-	//alert(\"You have not made any selections\");
-	}
-	else {
-	location.href = document.location + \".\" + strValues;
-	}
-	}
-	//]]>
-	</script>";
-
-	return $script;
-}
-
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/content.php 0.7.7/e107_plugins/content/content.php
--- 0.7.5/e107_plugins/content/content.php	2006-02-27 15:04:14.000000000 -0600
+++ 0.7.7/e107_plugins/content/content.php	2006-11-07 16:09:43.000000000 -0600
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content.php,v $
-|		$Revision: 1.91 $
-|		$Date: 2006/02/27 21:04:14 $
+|		$Revision: 1.109 $
+|		$Date: 2006/11/07 22:09:43 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -50,44 +50,6 @@
 
 require_once(HEADERF);
 
-//core_head function to prepare the meta tags
-function core_head(){
-	global $qs, $sql, $tp, $pref, $plugintable, $eArrayStorage;
-
-	if($qs[0] == "content" && isset($qs[1]) && is_numeric($qs[1]) ){
-		if($sql -> db_Select($plugintable, "content_meta", "content_id='".intval($qs[1])."'")){
-			list($row['content_meta']) = $sql -> db_Fetch();
-
-			$exmeta = $row['content_meta'];
-			if($exmeta != ""){
-				$exmeta = str_replace(", ", ",", $exmeta);
-				$exmeta = str_replace(" ", ",", $exmeta);
-				$exmeta = str_replace(",", ", ", $exmeta);
-				$newmeta = "";
-				$checkmeta = preg_match_all("/\<meta name=&#039;(.*?)&#039; content=&#039;(.*?)&#039;>/si", $pref['meta_tag'], $matches);
-
-				if(empty($matches[1])){
-					$newmeta = "<meta name=&#039;keywords&#039; content=&#039;".$exmeta."&#039; />";
-				}else{
-					for($i=0;$i<count($matches[1]);$i++){
-						if($matches[1][$i] == "keywords"){
-							$newmeta .= "<meta name=&#039;".$matches[1][$i]."&#039; content=&#039;".$matches[2][$i].", ".$exmeta."&#039; />";
-						}else{
-							$newmeta .= "<meta name=&#039;".$matches[1][$i]."&#039; content=&#039;".$matches[2][$i]."&#039; />";
-						}
-					}
-				}
-				$pref['meta_tag'] = $tp -> toHTML($newmeta, "admin");
-			}
-		}
-	}
-}
-
-//include js
-function headerjs(){
-	echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
-}
-
 //post comment
 if(isset($_POST['commentsubmit'])){
 	if(!is_object($sql)){ $sql = new db; }
@@ -142,49 +104,52 @@
 if(!e_QUERY){
 	show_content();
 }else{
-	//recent of parent='2'
-	if( $qs[0] == "recent" && is_numeric($qs[1]) && ( !isset($qs[2]) || substr($qs[2],0,5) == "order" ) ){
+	//recent of parent='X'
+	if( $qs[0] == "recent" && is_numeric($qs[1]) && intval($qs[1])>0 && ( !isset($qs[2]) || substr($qs[2],0,5) == "order" ) ){
 		show_content_recent();
 
 	//item
-	}elseif( $qs[0] == "content" && is_numeric($qs[1]) ){
+	}elseif( $qs[0] == "content" && is_numeric($qs[1]) && intval($qs[1])>0 ){
 		show_content_item();
 
-	//all categories of parent='2'
-	}elseif( $qs[0] == "cat" && $qs[1] == "list" && is_numeric($qs[2]) && !isset($qs[3]) ){
+	//all categories of parent='X'
+	}elseif( $qs[0] == "cat" && $qs[1] == "list" && is_numeric($qs[2]) && intval($qs[2])>0 && !isset($qs[3]) ){
 		show_content_cat_all();
 
-	//category of parent='2' and content_id='5'
-	}elseif( $qs[0] == "cat" && is_numeric($qs[1]) && (!isset($qs[2]) || $qs[2] == "comment" || substr($qs[2],0,5) == "order") ){
+	//category of parent='X'
+	}elseif( $qs[0] == "cat" && is_numeric($qs[1]) && intval($qs[1])>0 && (!isset($qs[2]) || $qs[2] == "view" || $qs[2] == "comment" || substr($qs[2],0,5) == "order") ){
 		
 		if( isset($qs[2]) && $qs[2] == "comment" ){
 			show_content_cat("comment");
+		}elseif( isset($qs[2]) && $qs[2] == "view" ){
+			show_content_cat('view');
 		}else{
 			show_content_cat();
 		}
 
-	//top rated of parent='2'
-	}elseif( $qs[0] == "top" && is_numeric($qs[1]) && !isset($qs[2]) ){
+	//top rated of parent='X'
+	}elseif( $qs[0] == "top" && is_numeric($qs[1]) && intval($qs[1])>0 && !isset($qs[2]) ){
 		show_content_top();
 
-	//top score of parent='2'
-	}elseif( $qs[0] == "score" && is_numeric($qs[1]) ){
+	//top score of parent='X'
+	}elseif( $qs[0] == "score" && is_numeric($qs[1]) && intval($qs[1])>0 ){
 		// && !isset($qs[2])
 		show_content_score();
 
-	//authorlist of parent='2'
-	}elseif( $qs[0] == "author" && $qs[1] == "list" && is_numeric($qs[2]) && ( !isset($qs[3]) || substr($qs[3],0,5) == "order" ) ){
+	//authorlist of parent='X'
+	}elseif( $qs[0] == "author" && $qs[1] == "list" && is_numeric($qs[2]) && intval($qs[2])>0 && ( !isset($qs[3]) || substr($qs[3],0,5) == "order" ) ){
 		show_content_author_all();
 
-	//authorlist of parent='2' and content_id='5'
-	}elseif( $qs[0] == "author" && is_numeric($qs[1]) && (!isset($qs[2]) || substr($qs[2],0,5) == "order")  ){
+	//authorlist of content_id='X'
+	}elseif( $qs[0] == "author" && is_numeric($qs[1]) && intval($qs[1])>0 && (!isset($qs[2]) || substr($qs[2],0,5) == "order")  ){
 		show_content_author();
 
-	//archive of parent='2'
-	}elseif( $qs[0] == "list" && is_numeric($qs[1])  ){
+	//archive of parent='X'
+	}elseif( $qs[0] == "list" && is_numeric($qs[1]) && intval($qs[1])>0  ){
 		show_content_archive();
 	}else{
-		js_location(e_SELF);
+		//js_location(e_SELF);
+		header("location:".e_SELF);
 	}
 }
 // ##### ------------------------------------------------------------------------------
@@ -195,32 +160,32 @@
 		global $plugintable, $gen, $content_pref;
 		global $CONTENT_SEARCH_TABLE_SELECT, $CONTENT_SEARCH_TABLE_ORDER, $CONTENT_SEARCH_TABLE_KEYWORD;
 
-		if( (isset($content_pref["content_navigator_{$mode}_{$mainparent}"]) && $content_pref["content_navigator_{$mode}_{$mainparent}"]) || (isset($content_pref["content_search_{$mode}_{$mainparent}"]) && $content_pref["content_search_{$mode}_{$mainparent}"]) || (isset($content_pref["content_ordering_{$mode}_{$mainparent}"]) && $content_pref["content_ordering_{$mode}_{$mainparent}"]) ){
+		if( (isset($content_pref["content_navigator_{$mode}"]) && $content_pref["content_navigator_{$mode}"]) || (isset($content_pref["content_search_{$mode}"]) && $content_pref["content_search_{$mode}"]) || (isset($content_pref["content_ordering_{$mode}"]) && $content_pref["content_ordering_{$mode}"]) ){
 
 			if(!isset($CONTENT_SEARCH_TABLE)){
-				if(!$content_pref["content_theme_{$mainparent}"]){
+				if(!$content_pref["content_theme"]){
 					require_once($plugindir."templates/default/content_search_template.php");
 				}else{
-					if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_search_template.php")){
-						require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_search_template.php");
+					if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_search_template.php")){
+						require_once($tp->replaceConstants($content_pref["content_theme"])."content_search_template.php");
 					}else{
 						require_once($plugindir."templates/default/content_search_template.php");
 					}
 				}
 			}
-			if(isset($content_pref["content_navigator_{$mode}_{$mainparent}"]) && $content_pref["content_navigator_{$mode}_{$mainparent}"]){
+			if(isset($content_pref["content_navigator_{$mode}"]) && $content_pref["content_navigator_{$mode}"]){
 				$CONTENT_SEARCH_TABLE_SELECT = $aa -> showOptionsSelect("page", $mainparent);
 			}
-			if(isset($content_pref["content_search_{$mode}_{$mainparent}"]) && $content_pref["content_search_{$mode}_{$mainparent}"]){
+			if(isset($content_pref["content_search_{$mode}"]) && $content_pref["content_search_{$mode}"]){
 				$CONTENT_SEARCH_TABLE_KEYWORD = $aa -> showOptionsSearch("page", $mainparent);
 			}
-			if(isset($content_pref["content_ordering_{$mode}_{$mainparent}"]) && $content_pref["content_ordering_{$mode}_{$mainparent}"]){
+			if(isset($content_pref["content_ordering_{$mode}"]) && $content_pref["content_ordering_{$mode}"]){
 				$CONTENT_SEARCH_TABLE_ORDER = $aa -> showOptionsOrder("page", $mainparent);
 			}
 
 			$text = $tp -> parseTemplate($CONTENT_SEARCH_TABLE, FALSE, $content_shortcodes);
 
-			if($content_pref["content_searchmenu_rendertype_{$mainparent}"] == "2"){
+			if($content_pref["content_searchmenu_rendertype"] == "2"){
 				$caption = CONTENT_LAN_77;
 				$ns -> tablerender($caption, $text);
 			}else{
@@ -241,7 +206,7 @@
 		$qry				= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
 		$searchkeyword		= $tp -> toDB($searchkeyword);
 		$qry				.= " AND (content_heading REGEXP '".$searchkeyword."' OR content_subheading REGEXP '".$searchkeyword."' OR content_summary REGEXP '".$searchkeyword."' OR content_text REGEXP '".$searchkeyword."' ) ";
-		$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
+		$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path"]);
 
 		$sqlsr = "";
 		if(!is_object($sqlsr)){ $sqlsr = new db; }
@@ -249,11 +214,11 @@
 			$textsr = "<div style='text-align:center;'>".CONTENT_SEARCH_LAN_0."</div>";
 		}else{
 			if(!isset($CONTENT_SEARCHRESULT_TABLE)){
-				if(!$content_pref["content_theme_{$mainparent}"]){
+				if(!$content_pref["content_theme"]){
 					require_once($plugindir."templates/default/content_searchresult_template.php");
 				}else{
-					if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_searchresult_template.php")){
-						require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_searchresult_template.php");
+					if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_searchresult_template.php")){
+						require_once($tp->replaceConstants($content_pref["content_theme"])."content_searchresult_template.php");
 					}else{
 						require_once($plugindir."templates/default/content_searchresult_template.php");
 					}
@@ -294,114 +259,120 @@
 		return($text);
 }
 
+// ##### CONTENT CACHE PRE ------------------------------
+function CachePre($cachestring=''){
+	global $e107cache;
+	if($cache = $e107cache->retrieve($cachestring)){
+		return $cache;
+	}else{
+		ob_start();
+	}
+}
+// ##### CONTENT CACHE POST ------------------------------
+function CachePost($cachestring=''){
+	global $pref, $e107cache;
+	if($pref['cachestatus']){
+		$cache = ob_get_contents();
+		$e107cache->set($cachestring, $cache);
+	}
+	ob_end_flush(); // dump collected data
+}
+
 // ##### CONTENT TYPE LIST ------------------------------
 function show_content(){
 		global $qs, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $content_cat_icon_path_large, $content_cat_icon_path_small, $datequery, $content_icon_path, $eArrayStorage, $contenttotal, $row;
 
-		if(!isset($CONTENT_TYPE_TABLE)){
+		if(is_readable(e_THEME.$pref['sitetheme']."/content/content_type_template.php")){
+			require_once(e_THEME.$pref['sitetheme']."/content/content_type_template.php");
+		}else{
 			require_once(e_PLUGIN."content/templates/content_type_template.php");
 		}
 
 		$cachestr = "$plugintable.typelist";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		if(!is_object($sql)){ $sql = new db; }
+		if(!$sql -> db_Select($plugintable, "*", "content_parent = '0' AND content_class REGEXP '".e_CLASS_REGEXP."' ".$datequery." ORDER BY round(content_order)")){
+			$text .= "<div style='text-align:center;'>".CONTENT_LAN_21."</div>";
 		}else{
-			ob_start();
-			if(!is_object($sql)){ $sql = new db; }
-			if(!$sql -> db_Select($plugintable, "*", "content_parent = '0' AND content_class REGEXP '".e_CLASS_REGEXP."' ".$datequery." ORDER BY content_heading")){
-				$text .= "<div style='text-align:center;'>".CONTENT_LAN_21."</div>";
-			}else{
 
-				$sql2 = "";
-				$content_type_table_string = "";
-				$plist = $sql->db_getList();
-				foreach($plist as $row)
-				{
-					if(!is_object($sql2)){ $sql2 = new db; }
-
-					//$content_pref = unserialize(stripslashes($row['content_pref']));
-					$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-					$content_pref["content_cat_icon_path_large_{$row['content_id']}"] = ($content_pref["content_cat_icon_path_large_{$row['content_id']}"] ? $content_pref["content_cat_icon_path_large_{$row['content_id']}"] : "{e_PLUGIN}content/images/cat/48/" );
-					$content_pref["content_cat_icon_path_small_{$row['content_id']}"] = ($content_pref["content_cat_icon_path_small_{$row['content_id']}"] ? $content_pref["content_cat_icon_path_small_{$row['content_id']}"] : "{e_PLUGIN}content/images/cat/16/" );
-					$content_cat_icon_path_large	= $tp->replaceConstants($content_pref["content_cat_icon_path_large_{$row['content_id']}"]);
-					$content_cat_icon_path_small	= $tp->replaceConstants($content_pref["content_cat_icon_path_small_{$row['content_id']}"]);
-					$content_icon_path				= $tp->replaceConstants($content_pref["content_icon_path_{$row['content_id']}"]);
-
-					$array			= $aa -> getCategoryTree("", $row['content_id'], TRUE);
-					$validparent	= implode(",", array_keys($array));
-					$qry			= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
-					$contenttotal	= $sql2 -> db_Count($plugintable, "(*)", "WHERE content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."'" );
-					$content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE, FALSE, $content_shortcodes);
-				}
-
-				$SUBMIT_LINE = FALSE;
-				$submit = FALSE;
-				$sql3 = "";
-				if(!is_object($sql3)){ $sql3 = new db; }
-				if($sql3 -> db_Select($plugintable, "content_id, content_pref", "content_parent = '0' ".$datequery." ORDER BY content_parent")){
-					while($row = $sql3 -> db_Fetch()){
+			$sql2 = "";
+			$content_type_table_string = "";
+			$plist = $sql->db_getList();
+			foreach($plist as $row)
+			{
+				if(!is_object($sql2)){ $sql2 = new db; }
+
+				$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
+				$content_pref["content_cat_icon_path_large"] = ($content_pref["content_cat_icon_path_large"] ? $content_pref["content_cat_icon_path_large"] : "{e_PLUGIN}content/images/cat/48/" );
+				$content_pref["content_cat_icon_path_small"] = ($content_pref["content_cat_icon_path_small"] ? $content_pref["content_cat_icon_path_small"] : "{e_PLUGIN}content/images/cat/16/" );
+				$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"]);
+				$content_icon_path				= $tp->replaceConstants($content_pref["content_icon_path"]);
+
+				$array			= $aa -> getCategoryTree("", $row['content_id'], TRUE);
+				$validparent	= implode(",", array_keys($array));
+				$qry			= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+				$contenttotal	= $sql2 -> db_Count($plugintable, "(*)", "WHERE content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."'" );
+				$content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE, FALSE, $content_shortcodes);
+			}
+
+			$SUBMIT_LINE = FALSE;
+			$submit = FALSE;
+			$sql3 = "";
+			if(!is_object($sql3)){ $sql3 = new db; }
+			if($sql3 -> db_Select($plugintable, "content_id, content_pref", "content_parent = '0' ".$datequery." ORDER BY content_parent")){
+				while($row = $sql3 -> db_Fetch()){
+					if(isset($row['content_pref']) && $row['content_pref']){
+						$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
+					}
+					if($content_pref["content_submit"] && check_class($content_pref["content_submit_class"])){
+						$submit = TRUE;
+						break;
+					}
+				}
+				if($submit === TRUE){
+					$content_type_table_string .= $CONTENT_TYPE_TABLE_LINE;
+					$content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE_SUBMIT, FALSE, $content_shortcodes);
+					$SUBMIT_LINE = TRUE;
+				}
+			}
+
+			if(USERID){
+				$personalmanagercheck = FALSE;
+				$array = $aa -> getCategoryTree("", "", TRUE);
+				$catarray = array_keys($array);
+				$qry = "";
+				foreach($catarray as $catid){
+					$qry .= " content_id='".$catid."' || ";
+				}
+				$qry = substr($qry,0,-3);
+				if($sql -> db_Select($plugintable, "content_id, content_heading, content_pref", " ".$qry." ")){
+					while($row = $sql -> db_Fetch()){
 						if(isset($row['content_pref']) && $row['content_pref']){
 							$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
 						}
-						if($content_pref["content_submit_{$row['content_id']}"] && check_class($content_pref["content_submit_class_{$row['content_id']}"])){
-							$submit = TRUE;
+						if( (isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])) || (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
+							$personalmanagercheck = TRUE;
 							break;
 						}
 					}
-					if($submit === TRUE){
-						$content_type_table_string .= $CONTENT_TYPE_TABLE_LINE;
-						$content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE_SUBMIT, FALSE, $content_shortcodes);
-						$SUBMIT_LINE = TRUE;
-					}
 				}
-
-				if(USERID){
-					$personalmanagercheck = FALSE;
-					$array = $aa -> getCategoryTree("", "", TRUE);
-					$catarray = array_keys($array);
-					$qry = "";
-					foreach($catarray as $catid){
-						$qry .= " content_id='".$catid."' || ";
-					}
-					$qry = substr($qry,0,-3);
-					if($sql -> db_Select($plugintable, "content_id, content_heading, content_pref", " ".$qry." ")){
-						while($row = $sql -> db_Fetch()){
-							if(isset($row['content_pref']) && $row['content_pref']){
-								$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-							}
-							//assign new preferences
-							if(getperms("0") ){
-								$personalmanagercheck = TRUE;
-								break;
-							}
-							$contentid = $row['content_id'];
-							if(isset($content_pref["content_manager_allowed_{$row['content_id']}"]) ){
-								$pcm = explode(",", $content_pref["content_manager_allowed_{$row['content_id']}"]);
-								if(in_array(USERID, $pcm)){
-									$personalmanagercheck = TRUE;
-									break;
-								}
-							}
-						}
-					}
-					if($personalmanagercheck == TRUE){
-						if($SUBMIT_LINE != TRUE){
-							$content_type_table_string .= $CONTENT_TYPE_TABLE_LINE;
-						}
-						$content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE_MANAGER, FALSE, $content_shortcodes);
+				if($personalmanagercheck == TRUE){
+					if($SUBMIT_LINE != TRUE){
+						$content_type_table_string .= $CONTENT_TYPE_TABLE_LINE;
 					}
+					$content_type_table_string .= $tp -> parseTemplate($CONTENT_TYPE_TABLE_MANAGER, FALSE, $content_shortcodes);
 				}
-				$text = $CONTENT_TYPE_TABLE_START.$content_type_table_string.$CONTENT_TYPE_TABLE_END;
 			}
-			$caption = CONTENT_LAN_22;
-			$ns -> tablerender($caption, $text);
-
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
-			}
-			ob_end_flush(); // dump collected data
+			$text = $CONTENT_TYPE_TABLE_START.$content_type_table_string.$CONTENT_TYPE_TABLE_END;
 		}
+		$caption = CONTENT_LAN_22;
+		$ns -> tablerender($caption, $text);
+		$cachecheck = CachePost($cachestr);
 }
 
 // ##### CONTENT ARCHIVE ------------------------------------------
@@ -413,15 +384,15 @@
 
 		$mainparent		= $aa -> getMainParent(intval($qs[1]));
 		$content_pref	= $aa -> getContentPref($mainparent);
-
+		
 		show_content_search_menu("archive", $mainparent);		//show navigator/search/order menu
 
 		if(!isset($CONTENT_ARCHIVE_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_archive_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_archive_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_archive_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_archive_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_archive_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_archive_template.php");
 				}
@@ -429,72 +400,98 @@
 		}
 
 		$cachestr = "$plugintable.archive.$qs[1]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
-		}else{
-			ob_start();
-			
-			$text = "";
-			$array			= $aa -> getCategoryTree("", $mainparent, TRUE);
-			$validparent	= implode(",", array_keys($array));
-			$qry			= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
-			$number			= (isset($content_pref["content_archive_nextprev_number_{$mainparent}"]) && $content_pref["content_archive_nextprev_number_{$mainparent}"] ? $content_pref["content_archive_nextprev_number_{$mainparent}"] : "30");
-			$order			= $aa -> getOrder();
-			$nextprevquery	= (isset($content_pref["content_archive_nextprev_{$mainparent}"]) && $content_pref["content_archive_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-			$sql1 = new db;
-			
-			if(isset($content_pref["content_archive_letterindex_{$mainparent}"]) && $content_pref["content_archive_letterindex_{$mainparent}"]){
-				$distinctfirstletter = $sql -> db_Select($plugintable, " DISTINCT(content_heading) ", "content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ORDER BY content_heading ASC ");
-				while($row = $sql -> db_Fetch()){
-					$head = $tp->toHTML($row['content_heading'], TRUE);
-					if(ord($head) < 128) {
-						$head_sub = strtoupper(substr($head,0,1));
-					}else{
-						$head_sub = substr($head,0,2);
-					}
-					$arrletters[] = $head_sub;
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$text = "";
+		$array			= $aa -> getCategoryTree("", $mainparent, TRUE);
+		$validparent	= implode(",", array_keys($array));
+		$qry			= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+		$number			= (isset($content_pref["content_archive_nextprev_number"]) && $content_pref["content_archive_nextprev_number"] ? $content_pref["content_archive_nextprev_number"] : "30");
+		$order			= $aa -> getOrder();
+		$nextprevquery	= (isset($content_pref["content_archive_nextprev"]) && $content_pref["content_archive_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+		$sql1 = new db;
+		
+		if(isset($content_pref["content_archive_letterindex"]) && $content_pref["content_archive_letterindex"]){
+			$distinctfirstletter = $sql -> db_Select($plugintable, " DISTINCT(content_heading) ", "content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ORDER BY content_heading ASC ");
+			while($row = $sql -> db_Fetch()){
+				$head = $tp->toHTML($row['content_heading'], TRUE);
+				if(ord($head) < 128) {
+					$head_sub = strtoupper(substr($head,0,1));
+				}else{
+					$head_sub = substr($head,0,2);
 				}
-				$arrletters = array_unique($arrletters);
-				$arrletters = array_values($arrletters);
-				sort($arrletters);
-
-				if ($distinctfirstletter > 1){
-					$CONTENT_ARCHIVE_TABLE_LETTERS = "<form method='post' action='".e_SELF."?list.".$mainparent."'>";
-					for($i=0;$i<count($arrletters);$i++){
-						if($arrletters[$i]!= ""){
-							$CONTENT_ARCHIVE_TABLE_LETTERS .= "<input class='button' style='width:20px' type='submit' name='letter' value='".strtoupper($arrletters[$i])."' onclick=\"document.location='".e_SELF."?list.".$mainparent.".".strtoupper($arrletters[$i])."'\" /> ";
+				$arrletters[] = $head_sub;
+			}
+			$arrletters = array_unique($arrletters);
+			$arrletters = array_values($arrletters);
+			sort($arrletters);
+
+			if ($distinctfirstletter > 1){
+				$CONTENT_ARCHIVE_TABLE_LETTERS = "<form method='post' action='".e_SELF."?list.".$mainparent."'>";
+				$int=TRUE;
+				for($i=0;$i<count($arrletters);$i++){
+					if(is_numeric($arrletters[$i])){
+						if($int===TRUE){
+							if(isset($qs[2]) && is_numeric($qs[2])){
+								$class = 'nextprev_current';
+							}else{
+								$class = 'nextprev_link';
+							}
+							$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent.".0'>0-9</a> ";
+						}
+						$int=FALSE;
+					}else{
+						if(isset($qs[2]) && strtoupper($qs[2]) == strtoupper($arrletters[$i])){
+							$class = 'nextprev_current';
+						}else{
+							$class = 'nextprev_link';
 						}
+						$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent.".".strtoupper($arrletters[$i])."'>".strtoupper($arrletters[$i])."</a> ";
 					}
-					$CONTENT_ARCHIVE_TABLE_LETTERS .= "<input class='button' style='width:20' type='submit' name='letter' value='all' />";
-					$CONTENT_ARCHIVE_TABLE_LETTERS .= "</form>";
 				}
-				//check posted letter
-				$letter=(isset($_POST['letter']) ? $_POST['letter'] : "");
-				if ($letter != "" && $letter != "all" ) { $qry .= " AND content_heading LIKE '".$tp->toDB($letter)."%' "; }else{ $qry .= ""; }
-			}
-			$CONTENT_ARCHIVE_TABLE_START = $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE_START, FALSE, $content_shortcodes);
-
-			$contenttotal = $sql1 -> db_Count($plugintable, "(*)", "WHERE content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ");
-			if($from > $contenttotal-1){ header("location:".e_SELF); exit; }
-
-			if($item = $sql1 -> db_Select($plugintable, "*", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery )){
-				$content_archive_table_string = "";
-				while($row = $sql1 -> db_Fetch()){
-					$CONTENT_ARCHIVE_TABLE_AUTHOR	= $aa -> prepareAuthor("archive", $row['content_author'], $row['content_id']);
-					$content_archive_table_string .= $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE, FALSE, $content_shortcodes);
-				}
-				$text .= $CONTENT_ARCHIVE_TABLE_START.$content_archive_table_string.$CONTENT_ARCHIVE_TABLE_END;
-			}
-			$text		= $aa -> getCrumbPage("archive", $array, $mainparent).$text;
-			$caption	= CONTENT_LAN_84;
-			$ns->tablerender($caption, $text);
-			$aa -> ShowNextPrev("archive", $from, $number, $contenttotal);
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
+				if(!isset($qs[2]) || (isset($qs[2]) && strtolower($qs[2])=='all') ){
+					$class = 'nextprev_current';
+				}else{
+					$class = 'nextprev_link';
+				}
+				$CONTENT_ARCHIVE_TABLE_LETTERS .= "<a class='".$class."' href='".e_SELF."?list.".$mainparent."'>ALL</a> ";
+				$CONTENT_ARCHIVE_TABLE_LETTERS .= "</form>";
+			}
+			//check letter
+			if(isset($qs[2])){
+				if($qs[2] == 'all'){
+					$qry .= '';
+				}elseif(strlen($qs[2]) == 1 && $qs[2] == '0'){
+					$qry .= " AND content_heading NOT REGEXP '^[[:alpha:]]' ";
+				}elseif(strlen($qs[2]) == 1 && !is_numeric($qs[2]) ){
+					$qry .= " AND content_heading LIKE '".$tp->toDB($qs[2])."%' ";
+				}else{
+					$qry .= '';
+				}
+			}
+		}
+		$CONTENT_ARCHIVE_TABLE_START = $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE_START, FALSE, $content_shortcodes);
+
+		$contenttotal = $sql1 -> db_Count($plugintable, "(*)", "WHERE content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ");
+		if($from > $contenttotal-1){ header("location:".e_SELF); exit; }
+
+		if($item = $sql1 -> db_Select($plugintable, "*", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery )){
+			$content_archive_table_string = "";
+			while($row = $sql1 -> db_Fetch()){
+				$CONTENT_ARCHIVE_TABLE_AUTHOR	= $aa -> prepareAuthor("archive", $row['content_author'], $row['content_id']);
+				$content_archive_table_string .= $tp -> parseTemplate($CONTENT_ARCHIVE_TABLE, FALSE, $content_shortcodes);
 			}
-			ob_end_flush(); // dump collected data
+			$text .= $CONTENT_ARCHIVE_TABLE_START.$content_archive_table_string.$CONTENT_ARCHIVE_TABLE_END;
 		}
+		$text		= $aa -> getCrumbPage("archive", $array, $mainparent).$text;
+		//$caption	= CONTENT_LAN_84;
+		$caption	= $content_pref['content_archive_caption'];
+		$ns->tablerender($caption, $text);
+		$aa -> ShowNextPrev("archive", $from, $number, $contenttotal);
+		$cachecheck = CachePost($cachestr);
 }
 
 //this function renders the preview of a content_item
@@ -504,11 +501,11 @@
 		global $CONTENT_RECENT_TABLE_START, $CONTENT_RECENT_TABLE_END, $CONTENT_RECENT_TABLE, $CONTENT_RECENT_TABLE_INFOPRE, $CONTENT_RECENT_TABLE_INFOPOST;
 
 		if(!isset($CONTENT_RECENT_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_recent_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_recent_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_recent_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_recent_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_recent_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_recent_template.php");
 				}
@@ -517,6 +514,7 @@
 		if($resultitem = $sql2 -> db_Select($plugintable, "*", $qry )){
 			$content_recent_table_string = "";
 			while($row = $sql2 -> db_Fetch()){
+				$CONTENT_RECENT_TABLE_AUTHORDETAILS = $aa -> prepareAuthor("list", $row['content_author'], $row['content_id']);
 				$rdate	= $tp -> parseTemplate('{CONTENT_RECENT_TABLE_DATE}', FALSE, $content_shortcodes);
 				$rauth	= $tp -> parseTemplate('{CONTENT_RECENT_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
 				$rep	= $tp -> parseTemplate('{CONTENT_RECENT_TABLE_EPICONS}', FALSE, $content_shortcodes);
@@ -528,7 +526,7 @@
 					$CONTENT_RECENT_TABLE_INFOPRE = TRUE;
 					$CONTENT_RECENT_TABLE_INFOPOST = TRUE;
 				}
-				$CONTENT_RECENT_TABLE_AUTHORDETAILS = $aa -> prepareAuthor("list", $row['content_author'], $row['content_id']);
+				
 				$content_recent_table_string .= $tp -> parseTemplate($CONTENT_RECENT_TABLE, FALSE, $content_shortcodes);
 			}
 		}
@@ -544,38 +542,37 @@
 
 		$mainparent		= $aa -> getMainParent(intval($qs[1]));
 		$content_pref	= $aa -> getContentPref($mainparent);
+		
 		show_content_search_menu("recent", $mainparent);		//show navigator/search/order menu
 
 		$cachestr = "$plugintable.recent.$qs[1]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
-		}else{
-			ob_start();
-
-			$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$array				= $aa -> getCategoryTree("", intval($qs[1]), TRUE);
-			$validparent		= implode(",", array_keys($array));
-			$order				= $aa -> getOrder();
-			$number				= ($content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "5");
-			$nextprevquery		= ($content_pref["content_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-			$qry				= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path"]);
+		$array				= $aa -> getCategoryTree("", intval($qs[1]), TRUE);
+		$validparent		= implode(",", array_keys($array));
+		$order				= $aa -> getOrder();
+		$number				= ($content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5");
+		$nextprevquery		= ($content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+		$qry				= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
 
-			$contenttotal = $sql2 -> db_Count($plugintable, "(*)", "WHERE content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' " );
+		$contenttotal = $sql2 -> db_Count($plugintable, "(*)", "WHERE content_refer != 'sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' " );
 
-			if($from > $contenttotal-1){ js_location(e_SELF); }
-			
-			$recentqry			= "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery;
-			$text				= displayPreview($recentqry);
-			$text				= $aa -> getCrumbPage("recent", $array, $mainparent).$text;
-			$caption			= CONTENT_LAN_23;
-			$ns -> tablerender($caption, $text);
-			$aa -> ShowNextPrev("", $from, $number, $contenttotal);
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
-			}
-			ob_end_flush(); // dump collected data
-		}
+		if($from > $contenttotal-1){ js_location(e_SELF); }
+		
+		$recentqry			= "content_refer !='sa' AND ".$qry." ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ".$order." ".$nextprevquery;
+		$text				= displayPreview($recentqry);
+		$text				= $aa -> getCrumbPage("recent", $array, $mainparent).$text;
+		$caption			= $content_pref['content_list_caption'];
+		if(isset($content_pref['content_list_caption_append_name']) && $content_pref['content_list_caption_append_name']){
+			$caption .= " ".$array[intval($qs[1])][1];
+		}
+		$ns -> tablerender($caption, $text);
+		$aa -> ShowNextPrev("", $from, $number, $contenttotal);
+		$cachecheck = CachePost($cachestr);
 }
 
 // ##### CATEGORY LIST ------------------------------------
@@ -589,14 +586,15 @@
 
 		$mainparent		= $aa -> getMainParent(intval($qs[2]));
 		$content_pref	= $aa -> getContentPref($mainparent);
+		
 		show_content_search_menu("catall", $mainparent);		//show navigator/search/order menu
 
 		if(!isset($CONTENT_CAT_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_cat_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_cat_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_cat_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_cat_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_cat_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_cat_template.php");
 				}
@@ -604,58 +602,52 @@
 		}
 
 		$cachestr = "$plugintable.cat.list.$qs[2]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
-		}else{
-			ob_start();
-
-			$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$array							= $aa -> getCategoryTree("", $mainparent, TRUE);
-			$validparent					= implode(",", array_keys($array));
-			$order							= $aa -> getOrder();
-			$number							= (isset($content_pref["content_nextprev_number_{$mainparent}"]) && $content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "5");
-			$nextprevquery					= (isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-			$qry							= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
-
-			$content_cat_table_string = "";
-			$newarray = array_merge_recursive($array);
-			for($a=0;$a<count($newarray);$a++){
-				for($b=0;$b<count($newarray[$a]);$b++){
-					$newparent[$newarray[$a][$b]] = $newarray[$a][$b+1];
-					$b++;
-				}
-			}
-			foreach($newparent as $key => $value){
-				$totalitems = $aa -> countCatItems($key);
-				$sql -> db_Select($plugintable, "*", "content_id = '".$key."' ");
-				$row = $sql -> db_Fetch();
-				
-				$date	= $tp -> parseTemplate('{CONTENT_CAT_TABLE_DATE}', FALSE, $content_shortcodes);
-				$auth	= $tp -> parseTemplate('{CONTENT_CAT_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
-				$ep		= $tp -> parseTemplate('{CONTENT_CAT_TABLE_EPICONS}', FALSE, $content_shortcodes);
-				$com	= $tp -> parseTemplate('{CONTENT_CAT_TABLE_COMMENT}', FALSE, $content_shortcodes);
-				$CONTENT_CAT_TABLE_INFO_PRE = FALSE;
-				$CONTENT_CAT_TABLE_INFO_POST = FALSE;
-				if ($date!="" || $auth!="" || $ep!="" || $com!="" ) {
-					$CONTENT_CAT_TABLE_INFO_PRE = TRUE;
-					$CONTENT_CAT_TABLE_INFO_POST = TRUE;
-				}
-				$CONTENT_CAT_TABLE_AUTHORDETAILS = $aa -> prepareAuthor("catall", $row['content_author'], $row['content_id']);
-				$content_cat_table_string .= $tp -> parseTemplate($CONTENT_CAT_TABLE, FALSE, $content_shortcodes);
-
-			}
-			$text		= $CONTENT_CAT_TABLE_START.$content_cat_table_string.$CONTENT_CAT_TABLE_END;
-			$text		= $aa -> getCrumbPage("catall", $array, $mainparent).$text;
-			$caption	= CONTENT_LAN_25;
-			$ns -> tablerender($caption, $text);
-
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
+		$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+		$array							= $aa -> getCategoryTree("", $mainparent, TRUE);
+		$validparent					= implode(",", array_keys($array));
+		$order							= $aa -> getOrder();
+		$number							= (isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5");
+		$nextprevquery					= (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+		$qry							= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+
+		$content_cat_table_string = "";
+		$newarray = array_merge_recursive($array);
+		for($a=0;$a<count($newarray);$a++){
+			for($b=0;$b<count($newarray[$a]);$b++){
+				$newparent[$newarray[$a][$b]] = $newarray[$a][$b+1];
+				$b++;
 			}
-			ob_end_flush(); // dump collected data
 		}
+		foreach($newparent as $key => $value){
+			$totalitems = $aa -> countCatItems($key);
+			$sql -> db_Select($plugintable, "*", "content_id = '".$key."' ");
+			$row = $sql -> db_Fetch();
+			
+			$date	= $tp -> parseTemplate('{CONTENT_CAT_TABLE_DATE}', FALSE, $content_shortcodes);
+			$auth	= $tp -> parseTemplate('{CONTENT_CAT_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
+			$ep		= $tp -> parseTemplate('{CONTENT_CAT_TABLE_EPICONS}', FALSE, $content_shortcodes);
+			$com	= $tp -> parseTemplate('{CONTENT_CAT_TABLE_COMMENT}', FALSE, $content_shortcodes);
+			$CONTENT_CAT_TABLE_INFO_PRE = FALSE;
+			$CONTENT_CAT_TABLE_INFO_POST = FALSE;
+			if ($date!="" || $auth!="" || $ep!="" || $com!="" ) {
+				$CONTENT_CAT_TABLE_INFO_PRE = TRUE;
+				$CONTENT_CAT_TABLE_INFO_POST = TRUE;
+			}
+			$CONTENT_CAT_TABLE_AUTHORDETAILS = $aa -> prepareAuthor("catall", $row['content_author'], $row['content_id']);
+			$content_cat_table_string .= $tp -> parseTemplate($CONTENT_CAT_TABLE, FALSE, $content_shortcodes);
+
+		}
+		$text		= $CONTENT_CAT_TABLE_START.$content_cat_table_string.$CONTENT_CAT_TABLE_END;
+		$text		= $aa -> getCrumbPage("catall", $array, $mainparent).$text;
+		$caption	= $content_pref['content_catall_caption'];
+		$ns -> tablerender($caption, $text);
+		$cachecheck = CachePost($cachestr);
 }
 
 function show_content_cat($mode=""){
@@ -666,6 +658,7 @@
 
 		$mainparent		= $aa -> getMainParent(intval($qs[1]));
 		$content_pref	= $aa -> getContentPref($mainparent);
+		
 		$array			= $aa -> getCategoryTree("", $mainparent, TRUE);
 		$validparent	= "0,0.".implode(",0.", array_keys($array));
 		$qry			= " content_id = '".intval($qs[1])."' AND content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
@@ -673,31 +666,38 @@
 		show_content_search_menu("cat", $mainparent);		//show navigator/search/order menu
 
 		if(!isset($CONTENT_CAT_LIST_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_cat_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_cat_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_cat_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_cat_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_cat_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_cat_template.php");
 				}
 			}
 		}
 
-		$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-		$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-		$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$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"]);
+		$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);					
 		$order							= $aa -> getOrder();
-		$number							= (isset($content_pref["content_nextprev_number_{$mainparent}"]) && $content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "5");
-		$nextprevquery					= (isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-		$capqs							= array_reverse($array[$qs[1]]);
-		$caption						= CONTENT_LAN_26." : ".$capqs[0];
+		$number							= (isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5");
+		$nextprevquery					= (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+		$capqs							= array_reverse($array[intval($qs[1])]);
+		$caption	= $content_pref['content_cat_caption'];
+		if(isset($content_pref['content_cat_caption_append_name']) && $content_pref['content_cat_caption_append_name']){
+			$caption .= " ".$capqs[0];
+		}
 
 		// parent article
-		if(isset($content_pref["content_cat_showparent_{$mainparent}"]) && $content_pref["content_cat_showparent_{$mainparent}"]){
+		if(isset($content_pref["content_cat_showparent"]) && $content_pref["content_cat_showparent"]){
 			if(!$resultparent = $sql -> db_Select($plugintable, "*", $qry )){
 				header("location:".e_SELF."?cat.list.".$mainparent); exit;
 			}else{
+				//if 'view' override the items pref to show only limited text adn show full catetgory text instead
+				if($mode=='view' || $mode=='comment'){
+					$content_pref['content_cat_text_char'] = 'all';
+				}
 				$row = $sql -> db_Fetch();
 				$date	= $tp -> parseTemplate('{CONTENT_CAT_LIST_TABLE_DATE}', FALSE, $content_shortcodes);
 				$auth	= $tp -> parseTemplate('{CONTENT_CAT_LIST_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
@@ -714,128 +714,126 @@
 		}
 
 		$cachestr = "$plugintable.cat.$qs[1]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
-		}else{
-			ob_start();
-
-			if(!$mode || $mode == ""){
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
 
-				$check			= (isset($qs[1]) && is_numeric($qs[1]) ? intval($qs[1]) : intval($mainparent));
-				$array1			= $aa -> getCategoryTree("", $check, TRUE);
-				$newarray		= array_merge_recursive($array1);
+		if(!$mode || $mode == "" || $mode=='view'){
+			$check			= (isset($qs[1]) && is_numeric($qs[1]) ? intval($qs[1]) : intval($mainparent));
+			$array1			= $aa -> getCategoryTree("", $check, TRUE);
+			$newarray		= array_merge_recursive($array1);
+			$levels = 0;
+			if(isset($content_pref['content_cat_levels']) && is_numeric($content_pref['content_cat_levels']) && $content_pref['content_cat_levels']>0){
+				$levels = intval($content_pref['content_cat_levels']) + 1;
+			}
+			if($levels>0){
 				for($a=0;$a<count($newarray);$a++){
-					for($b=0;$b<count($newarray[$a]);$b++){
-						$subparent[$newarray[$a][$b]] = $newarray[$a][$b+1];
-						$b++;
-					}
-				}
-				$subparent		= array_keys($subparent);
-				$validsub		= "0.".implode(",0.", $subparent);
-				$subqry			= " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validsub)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
-
-				//list subcategories
-				if(isset($content_pref["content_cat_showparentsub_{$mainparent}"]) && $content_pref["content_cat_showparentsub_{$mainparent}"]){
-
-					$content_cat_listsub_table_string = "";
-					for($i=0;$i<count($subparent);$i++){
-						if($resultsubparent = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_parent", " content_id = '".$subparent[$i]."' AND ".$subqry." " )){
-							while($row = $sql -> db_Fetch()){
-								$totalsubcat = $aa -> countCatItems($row['content_id']);
-								$content_cat_listsub_table_string .= $tp -> parseTemplate($CONTENT_CAT_LISTSUB_TABLE, FALSE, $content_shortcodes);
-							}
-							$textsubparent = $CONTENT_CAT_LISTSUB_TABLE_START.$content_cat_listsub_table_string.$CONTENT_CAT_LISTSUB_TABLE_END;
-							$captionsubparent = CONTENT_LAN_28;
+					if( count($newarray[$a]) <= (2*$levels) ){
+						$newarray2[] = $newarray[$a];
+					}
+				}
+				$newarray = $newarray2;
+			}
+			for($a=0;$a<count($newarray);$a++){
+				for($b=0;$b<count($newarray[$a]);$b++){
+					$subparent[$newarray[$a][$b]] = $newarray[$a][$b+1];
+					$b++;
+				}
+			}
+			$subparent		= array_keys($subparent);
+			$validsub		= "0.".implode(",0.", $subparent);
+			$subqry			= " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validsub)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
+
+			//list subcategories
+			if(isset($content_pref["content_cat_showparentsub"]) && $content_pref["content_cat_showparentsub"]){
+
+				$content_cat_listsub_table_string = "";
+				for($i=0;$i<count($subparent);$i++){
+					if($resultsubparent = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_parent", " content_id = '".$subparent[$i]."' AND ".$subqry." " )){
+						while($row = $sql -> db_Fetch()){
+							$totalsubcat = $aa -> countCatItems($row['content_id']);
+							$content_cat_listsub_table_string .= $tp -> parseTemplate($CONTENT_CAT_LISTSUB_TABLE, FALSE, $content_shortcodes);
 						}
+						$textsubparent = $CONTENT_CAT_LISTSUB_TABLE_START.$content_cat_listsub_table_string.$CONTENT_CAT_LISTSUB_TABLE_END;
+						$captionsubparent = $content_pref['content_cat_sub_caption'];
 					}
 				}
+			}
 
-				//list all contents within this category
-				unset($text);
+			//list all contents within this category
+			unset($text);
 
-				//also show content items of subcategories of this category ?
-				if(isset($content_pref["content_cat_listtype_{$mainparent}"]) && $content_pref["content_cat_listtype_{$mainparent}"]){
-					$validitem		= implode(",", $subparent);
-					$qrycat			= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validitem)."' ";
+			//also show content items of subcategories of this category ?
+			if(isset($content_pref["content_cat_listtype"]) && $content_pref["content_cat_listtype"]){
+				$validitem		= implode(",", $subparent);
+				$qrycat			= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validitem)."' ";
+			}else{
+				$qrycat			= " content_parent = '".intval($qs[1])."' ";
+			}
+			$qrycat				= " content_refer !='sa' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND ".$qrycat." ";
+			$contenttotal		= $sql -> db_Count($plugintable, "(*)", "WHERE ".$qrycat);
+			$childqry			= $qrycat." ".$order." ".$nextprevquery;
+			$textchild			= displayPreview($childqry);
+			$captionchild		= $content_pref['content_cat_item_caption'];
+
+			$crumbpage = $aa -> getCrumbPage("cat", $array, $qs[1]);
+			if(isset($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); }
 				}else{
-					$qrycat			= " content_parent = '".intval($qs[1])."' ";
+					$ns -> tablerender($caption, (isset($textparent) ? $textparent : "").(isset($textsubparent) ? $textsubparent : "").$textchild);
 				}
-				$qrycat				= " content_refer !='sa' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND ".$qrycat." ";
-				$contenttotal		= $sql -> db_Count($plugintable, "(*)", "WHERE ".$qrycat);
-				$childqry			= $qrycat." ".$order." ".$nextprevquery;
-				$textchild			= displayPreview($childqry);
-				$captionchild		= CONTENT_LAN_31;
-
-				if(isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"]){
-					require_once(e_HANDLER."np_class.php");
-					$np_querystring = (isset($qs[0]) ? $qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
-				}
-				$crumbpage = $aa -> getCrumbPage("cat", $array, $qs[1]);
-				if(isset($textparent)){ 
-					$textparent = $crumbpage.$textparent;
-				}else{
-					$textchild = $crumbpage.$textchild;
+				if(isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"]){
+					$aa->ShowNextPrev(FALSE, $from, $number, $contenttotal);
 				}
-				if(isset($content_pref["content_cat_menuorder_{$mainparent}"]) && $content_pref["content_cat_menuorder_{$mainparent}"] == "1"){
-					if(isset($content_pref["content_cat_rendertype_{$mainparent}"]) && $content_pref["content_cat_rendertype_{$mainparent}"] == "1"){
-						if(isset($textparent)){		$ns -> tablerender($caption, $textparent); }
-						if(isset($textsubparent)){	$ns -> tablerender($captionsubparent, $textsubparent); }
-						if(isset($textchild)){		$ns -> tablerender($captionchild, $textchild); }
-					}else{
-						$ns -> tablerender($caption, (isset($textparent) ? $textparent : "").(isset($textsubparent) ? $textsubparent : "").$textchild);
-					}
-					if(isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"]){
-						$ix = new nextprev("content.php", $from, $number, $contenttotal, NP_3, ($np_querystring ? $np_querystring : ""));
+			}else{
+				if(isset($content_pref["content_cat_rendertype"]) && $content_pref["content_cat_rendertype"] == "1"){
+					if(isset($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); }
 				}else{
-					if(isset($content_pref["content_cat_rendertype_{$mainparent}"]) && $content_pref["content_cat_rendertype_{$mainparent}"] == "1"){
-						if(isset($textchild)){		$ns -> tablerender($captionchild, $textchild); }
-						if(isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"]){
-							$ix = new nextprev("content.php", $from, $number, $contenttotal, NP_3, ($np_querystring ? $np_querystring : ""));
-						}
-						if(isset($textparent)){		$ns -> tablerender($caption, $textparent); }
-						if(isset($textsubparent)){	$ns -> tablerender($captionsubparent, $textsubparent); }
-					}else{
-						if(isset($textchild)){		$ns -> tablerender($captionchild, $textchild); }
-						if(isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"]){
-							$ix = new nextprev("content.php", $from, $number, $contenttotal, NP_3, ($np_querystring ? $np_querystring : ""));
-						}
-						$ns -> tablerender($caption, (isset($textparent) ? $textparent : "").(isset($textsubparent) ? $textsubparent : ""));
+					if(isset($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 : ""));
 				}
 			}
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
-			}
-			ob_end_flush(); // dump collected data
 		}
+		$cachecheck = CachePost($cachestr);
 
 		if($mode == "comment"){
 			$textparent = $aa -> getCrumbPage("cat", $array, $mainparent).$textparent;
-			if(isset($textparent)){ $ns -> tablerender($captionparent, $textparent); }
+			if(isset($textparent)){ $ns -> tablerender($caption, $textparent); }
 
 			if($resultitem = $sql -> db_Select($plugintable, "*", $qry )){
 				$row = $sql -> db_Fetch();
 				if($row['content_comment']){
 					$cachestr = "comment.$plugintable.$qs[1]";
-					if($cache = $e107cache->retrieve($cachestr)){
-						echo $cache;
+					$cachecheck = CachePre($cachestr);
+					if($cachecheck){
+						echo $cachecheck;
+						return;
+					}
+					if( (isset($content_pref["content_cat_rating_all"]) && $content_pref["content_cat_rating_all"]) || (isset($content_pref["content_cat_rating"]) && $content_pref["content_cat_rating"] && $row['content_rate'])){
+						$showrate = TRUE;
 					}else{
-						ob_start();
-						if( (isset($content_pref["content_cat_rating_all_{$mainparent}"]) && $content_pref["content_cat_rating_all_{$mainparent}"]) || (isset($content_pref["content_cat_rating_{$mainparent}"]) && $content_pref["content_cat_rating_{$mainparent}"] && $row['content_rate'])){
-							$showrate = TRUE;
-						}else{
-							$showrate = FALSE;
-						}
-						$cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate);
-
-						if($pref['cachestatus']){
-							$cache = ob_get_contents();
-							$e107cache->set($cachestr, $cache);
-						}
-						ob_end_flush(); // dump collected data
+						$showrate = FALSE;
 					}
+					$cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate);
+					$cachecheck = CachePost($cachestr);
 				}
 			}
 		}
@@ -843,19 +841,19 @@
 
 // ##### AUTHOR LIST --------------------------------------
 function show_content_author_all(){
-		global $qs, $plugindir, $ix, $content_shortcodes, $ns, $plugintable, $from, $sql, $aa, $e107cache, $tp, $pref, $mainparent, $content_pref, $cobj, $datequery;
-		global $authordetails, $i, $gen, $totalcontent, $row, $CONTENT_AUTHOR_TABLE, $CONTENT_AUTHOR_TABLE_START, $CONTENT_AUTHOR_TABLE_END, $CONTENT_AUTHOR_TABLE_DATE, $CONTENT_AUTHOR_TABLE_HEADING;
+		global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $from, $sql, $aa, $e107cache, $tp, $pref, $mainparent, $content_pref, $cobj, $datequery, $authordetails, $i, $gen, $totalcontent, $row, $CONTENT_AUTHOR_TABLE, $CONTENT_AUTHOR_TABLE_START, $CONTENT_AUTHOR_TABLE_END, $CONTENT_AUTHOR_TABLE_DATE, $CONTENT_AUTHOR_TABLE_HEADING;
 
 		$mainparent		= $aa -> getMainParent(intval($qs[2]));
 		$content_pref	= $aa -> getContentPref($mainparent);
+		
 		show_content_search_menu("authorall", $mainparent);		//show navigator/search/order menu
 
 		if(!isset($CONTENT_AUTHOR_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_author_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_author_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_author_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_author_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_author_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_author_template.php");
 				}
@@ -863,112 +861,121 @@
 		}
 
 		$cachestr = "$plugintable.author.list.$qs[2]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$array			= $aa -> getCategoryTree("", $mainparent, TRUE);
+		$validparent	= implode(",", array_keys($array));
+		$number			= (isset($content_pref["content_author_nextprev_number"]) && $content_pref["content_author_nextprev_number"] ? $content_pref["content_author_nextprev_number"] : "5");
+		$nextprevquery	= (isset($content_pref["content_author_nextprev"]) && $content_pref["content_author_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+		$qry			= " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+		$dateqry		= "AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().")";
+
+		$sql1 = new db; $sql2 = new db;
+		$contenttotal = $sql1 -> db_Select($plugintable." AS p", "DISTINCT(p.content_author)", "p.content_refer !='sa' AND ".$qry." ".$datequery." AND p.content_class REGEXP '".e_CLASS_REGEXP."'");					
+
+		$query = "
+		SELECT DISTINCT(p.content_author)
+		FROM #$plugintable AS p
+		WHERE p.content_refer !='sa' AND ".$qry." ".$dateqry." AND p.content_class REGEXP '".e_CLASS_REGEXP."' 
+		ORDER BY p.content_author";
+
+		$arr = array();
+		$arr2 = array();
+		if (!$sql1->db_Select_gen($query)){
+			$text = CONTENT_LAN_15;
 		}else{
-			ob_start();
-
-			$array			= $aa -> getCategoryTree("", $mainparent, TRUE);
-			$validparent	= implode(",", array_keys($array));
-			$number			= (isset($content_pref["content_author_nextprev_number_{$mainparent}"]) && $content_pref["content_author_nextprev_number_{$mainparent}"] ? $content_pref["content_author_nextprev_number_{$mainparent}"] : "5");
-			$nextprevquery	= (isset($content_pref["content_author_nextprev_{$mainparent}"]) && $content_pref["content_author_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-			$qry			= " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
-			$dateqry		= "AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().")";
+			while($row1 = $sql1 -> db_Fetch()){
+				//parse db field and retrieve user info -> array($author_id, $author_name, $author_email, $content_author);
+				$arr[] = $aa->getAuthor($row1['content_author']);
+			}
+			//combine unique authors
+			for($i=0;$i<count($arr);$i++){
+				$arr2[$arr[$i][1]][] = $arr[$i];
+			}
 
-			$sql1 = new db; $sql2 = new db;
-			$contenttotal = $sql1 -> db_Select($plugintable." AS p", "DISTINCT(p.content_author)", "p.content_refer !='sa' AND ".$qry." ".$datequery." AND p.content_class REGEXP '".e_CLASS_REGEXP."'");					
-			
-			$qry = "
-			SELECT DISTINCT(p.content_author), p.content_heading, p.content_datestamp, p.content_id, u.user_id, u.user_name, u.user_email, SUBSTRING_INDEX(p.content_author, '^', 0) AS user_name2, COUNT(i.content_id) as amount 
-			FROM #$plugintable AS p
-			LEFT JOIN #$plugintable AS i ON i.content_author = p.content_author  
-			LEFT JOIN #user AS u ON (u.user_id = p.content_author || p.content_author = u.user_name || SUBSTRING_INDEX(p.content_author, '^', 1) REGEXP 'u.user_name') 
-			WHERE p.content_refer !='sa' AND ".$qry." ".$dateqry." AND p.content_class REGEXP '".e_CLASS_REGEXP."' AND i.content_class REGEXP '".e_CLASS_REGEXP."'
-			GROUP BY i.content_id
-			ORDER BY p.content_datestamp ASC, p.content_author
-			";
-
-			$author = array();
-			$options = "";
-			if ($sql1->db_Select_gen($qry)){
-				while($row1 = $sql1 -> db_Fetch()){
-					$row = $row1;
-					
-					if(is_numeric($row['content_author'])){
-						$name = ($row['user_name'] ? $row['user_name'] : CONTENT_LAN_29);
-					}else{
-						if(strpos($row['content_author'], "^")){
-							$tmp = explode("^", $row['content_author']);
-							if(is_numeric($tmp[0])){
-								$name = $tmp[1];
-							}else{
-								$name = $tmp[0];
-							}
-						}else{
-							$name = $row['content_author'];
-						}
-						$name = ($name ? $name : CONTENT_LAN_29);
+			$arr3 = array();
+			foreach($arr2 as $key=>$value){
+				$db='';
+				//prepare db field for author comparison
+				if(count($arr2[$key])==1){
+					$db = " p.content_author='".$arr2[$key][0][3]."' ";
+				}else{
+					for($k=0;$k<count($arr2[$key]);$k++){
+						$db[] = " p.content_author='".$arr2[$key][$k][3]."' ";
 					}
-					if(is_array($author)){
-						if(!in_array($name, $author)){
-
-							$display = (strlen($name) > 29 ? substr($name,0,29)."..." : $name);
-							$arrData[] = array($name, $row['content_id'], $row['content_heading'], $row['content_datestamp'], $row['amount']);
-							$author[] = $name;
-						}
+					if($db!=''){
+						$db = implode(" || ", $db);
 					}
 				}
+				if($db!=''){
+					//count items
+					$amount = $sql2->db_Count($plugintable." as p", "(*)", "WHERE ".$db );
 
-				function cmp($a, $b)
-				{
-					$posa = strrpos($a[0], " ");
-					if($posa == TRUE){
-						$la = substr($a[0], $posa);
-					}elseif($posa == FALSE){
-						$la = $a[0];
-					}
+					$query = "
+					SELECT p.content_id, p.content_heading, p.content_datestamp
+					FROM #$plugintable AS p
+					WHERE (".$db.") AND p.content_refer !='sa' AND ".$qry." ".$dateqry." AND p.content_class REGEXP '".e_CLASS_REGEXP."'
+					ORDER BY p.content_datestamp ASC, p.content_author LIMIT 0,1";
 
-					$posb = strrpos($b[0], " ");
-					if($posb == TRUE){
-						$lb = substr($b[0], $posb);
-					}elseif($posb == FALSE){
-						$lb = $b[0];
+					//query to retrieve last created item for each author
+					if ($sql2->db_Select_gen($query)){
+						while($row2 = $sql2 -> db_Fetch()){
+							$arr3[] = array($key, $row2['content_id'], $row2['content_heading'], $row2['content_datestamp'], $amount);
+						}
 					}
+				}
+			}
 
-					if ($la == $lb) {
-						return 0;
-					}
-					return strcasecmp ($la, $lb);
+			function cmp($a, $b)
+			{
+				$posa = strrpos($a[0], " ");
+				if($posa == TRUE){
+					$la = substr($a[0], $posa);
+				}elseif($posa == FALSE){
+					$la = $a[0];
 				}
-				usort($arrData, "cmp");
 
-				$content_author_table_string = "";
-				$max = $from+$number;
-				for($i=$from;$i<$max;$i++){
-					if(is_array($arrData[$i])){
-						$authordetails[$i][1] = $arrData[$i][0];
-						$row['content_id'] = $arrData[$i][1];
-						$row['content_heading'] = $arrData[$i][2];
-						$row['content_datestamp'] = $arrData[$i][3];
-						$totalcontent = $arrData[$i][4];
-						$content_author_table_string .= $tp -> parseTemplate($CONTENT_AUTHOR_TABLE, FALSE, $content_shortcodes);
-					}
+				$posb = strrpos($b[0], " ");
+				if($posb == TRUE){
+					$lb = substr($b[0], $posb);
+				}elseif($posb == FALSE){
+					$lb = $b[0];
+				}
+
+				if ($la == $lb) {
+					return 0;
 				}
-				$text = $CONTENT_AUTHOR_TABLE_START.$content_author_table_string.$CONTENT_AUTHOR_TABLE_END;
-				$text = $aa -> getCrumbPage("authorall", $array, $mainparent).$text;
+				return strcasecmp ($la, $lb);
 			}
+			//do an alpha ordering on the author (if 'firstname lastname', lastname is the comparison factor)
+			usort($arr3, "cmp");
 
-			$caption = CONTENT_LAN_32;
-			$ns -> tablerender($caption, $text);
-			$aa -> ShowNextPrev("author", $from, $number, $contenttotal);
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
+			$string = "";
+			//only display number of records for nextprev
+			$max = $from+$number;
+			for($i=$from;$i<$max;$i++){
+				if(is_array($arr3[$i])){
+					$authordetails[$i][1] = $arr3[$i][0];
+					$row['content_id'] = $arr3[$i][1];
+					$row['content_heading'] = $arr3[$i][2];
+					$row['content_datestamp'] = $arr3[$i][3];
+					$totalcontent = $arr3[$i][4];
+					$string .= $tp -> parseTemplate($CONTENT_AUTHOR_TABLE, FALSE, $content_shortcodes);
+				}
 			}
-			ob_end_flush(); // dump collected data
+			$text = $CONTENT_AUTHOR_TABLE_START.$string.$CONTENT_AUTHOR_TABLE_END;
+			$text = $aa -> getCrumbPage("authorall", $array, $mainparent).$text;
 		}
+		$caption	= $content_pref['content_author_index_caption'];
+		$ns -> tablerender($caption, $text);
+		$aa -> ShowNextPrev("author", $from, $number, $contenttotal);
+		$cachecheck = CachePost($cachestr);
 }
 
+
 function show_content_author(){
 		global $qs, $plugindir, $content_shortcodes, $ns, $plugintable, $sql, $aa, $e107cache, $tp, $pref, $content_pref, $cobj;
 		global $nextprevquery, $from, $number, $content_icon_path;
@@ -976,50 +983,49 @@
 
 		$mainparent		= $aa -> getMainParent(intval($qs[1]));
 		$content_pref	= $aa -> getContentPref($mainparent);
+		
 		show_content_search_menu("author", $mainparent);		//show navigator/search/order menu
 
 		$cachestr = "$plugintable.author.$qs[1]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path"]);
+		$array				= $aa -> getCategoryTree("", $mainparent, TRUE);
+		if(array_key_exists($qs[1], $array)){
+			$validparent	= "0,0.".implode(",0.", array_keys($array));
 		}else{
-			ob_start();
-
-			$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$array				= $aa -> getCategoryTree("", $mainparent, TRUE);
-			if(array_key_exists($qs[1], $array)){
-				$validparent	= "0,0.".implode(",0.", array_keys($array));
-			}else{
-				$validparent	= implode(",", array_keys($array));
-			}
-			$order				= $aa -> getOrder();
-			$number				= (isset($content_pref["content_nextprev_number_{$mainparent}"]) && $content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "5");
-			$nextprevquery		= (isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-			$qry				= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
-			$sqla = "";
-			if(!is_object($sqla)){ $sqla = new db; }
-			if(!$author = $sqla -> db_Select($plugintable, "content_author", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_id = '".intval($qs[1])."' AND content_class REGEXP '".e_CLASS_REGEXP."' ")){
-				header("location:".e_SELF."?author.list.".$mainparent); exit;
-			}else{
-				list($content_author)	= $sqla -> db_Fetch();
-				$sqlb = new db;
-				$authordetails	= $aa -> getAuthor($content_author);						
-				$query			= " content_author = '".$authordetails[3]."' || content_author REGEXP '^".$authordetails[1]."^' ".(is_numeric($content_author) ? " || content_author = '".$authordetails[0]."' " : "")." ";
-				$validparent	= implode(",", array_keys($array));
-				$qry			= " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND (".$query.") ";
-				$contenttotal	= $sqlb -> db_Count($plugintable, "(*)", "WHERE ".$qry." ");
-				$authorqry		= $qry." ".$order." ".$nextprevquery;
-				$text			= displayPreview($authorqry);
-				$text			= $aa -> getCrumbPage("author", $array, $mainparent).$text;
-				$caption		= CONTENT_LAN_32." : ".$authordetails[1];
-				$ns -> tablerender($caption, $text);
-				$aa -> ShowNextPrev("", $from, $number, $contenttotal);
-			}
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
+			$validparent	= implode(",", array_keys($array));
+		}
+		$order				= $aa -> getOrder();
+		$number				= (isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5");
+		$nextprevquery		= (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+		$qry				= " content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+		$sqla = "";
+		if(!is_object($sqla)){ $sqla = new db; }
+		if(!$author = $sqla -> db_Select($plugintable, "content_author", "content_refer !='sa' AND ".$qry." ".$datequery." AND content_id = '".intval($qs[1])."' AND content_class REGEXP '".e_CLASS_REGEXP."' ")){
+			header("location:".e_SELF."?author.list.".$mainparent); exit;
+		}else{
+			list($content_author)	= $sqla -> db_Fetch();
+			$sqlb = new db;
+			$authordetails	= $aa -> getAuthor($content_author);						
+			$query			= " content_author = '".$authordetails[3]."' || content_author REGEXP '^".$authordetails[1]."^' ".(is_numeric($content_author) ? " || content_author = '".$authordetails[0]."' " : "")." ";
+			$validparent	= implode(",", array_keys($array));
+			$qry			= " content_refer !='sa' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND (".$query.") ";
+			$contenttotal	= $sqlb -> db_Count($plugintable, "(*)", "WHERE ".$qry." ");
+			$authorqry		= $qry." ".$order." ".$nextprevquery;
+			$text			= displayPreview($authorqry);
+			$text			= $aa -> getCrumbPage("author", $array, $mainparent).$text;
+			$caption		= $content_pref['content_author_caption'];
+			if(isset($content_pref['content_author_caption_append_name']) && $content_pref['content_author_caption_append_name']){
+				$caption .= " ".$authordetails[1];
 			}
-			ob_end_flush(); // dump collected data
+			$ns -> tablerender($caption, $text);
+			$aa -> ShowNextPrev("", $from, $number, $contenttotal);
 		}
+		$cachecheck = CachePost($cachestr);
 }
 
 // ##### TOP RATED LIST -----------------------------------
@@ -1030,59 +1036,59 @@
 
 		$mainparent		= $aa -> getMainParent(intval($qs[1]));
 		$content_pref	= $aa -> getContentPref($mainparent);
+		
 		show_content_search_menu("top", $mainparent);		//show navigator/search/order menu
 
 		if(!isset($CONTENT_TOP_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_top_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_top_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_top_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_top_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_top_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_top_template.php");
 				}
 			}
 		}
 		$cachestr = "$plugintable.top.$qs[1]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
-		}else{
-			ob_start();
-			$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$array				= $aa -> getCategoryTree("", intval($qs[1]), TRUE);
-			$validparent		= implode(",", array_keys($array));
-			$datequery1			= " AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().") ";
-			$qry				= " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
-			$number				= (isset($content_pref["content_nextprev_number_{$mainparent}"]) && $content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "");
-			$np					= ($number ? " LIMIT ".intval($from).", ".intval($number) : "");
-
-			$qry1 = "
-			SELECT p.*, r.*, (r.rate_rating / r.rate_votes) as rate_avg
-			FROM #rate AS r
-			LEFT JOIN #pcontent AS p ON p.content_id = r.rate_itemid 
-			WHERE p.content_refer !='sa' AND ".$qry." ".$datequery1." AND p.content_class REGEXP '".e_CLASS_REGEXP."' AND r.rate_table='pcontent'
-			ORDER BY rate_avg DESC ";
-			$qry2 = $qry1." ".$np;
-
-			if(!is_object($sql)){ $sql = new db; }
-			$total = $sql -> db_Select_gen($qry1);
-			if($sql->db_Select_gen($qry2)){
-				while($row = $sql -> db_Fetch()){
-					$CONTENT_TOP_TABLE_AUTHOR	= $aa -> prepareAuthor("top", $row['content_author'], $row['content_id']);
-					$content_top_table_string	.= $tp -> parseTemplate($CONTENT_TOP_TABLE, FALSE, $content_shortcodes);
-				}
-				$content_top_table_string		= $aa -> getCrumbPage("top", $array, $mainparent).$content_top_table_string;
-				$text		= $CONTENT_TOP_TABLE_START.$content_top_table_string.$CONTENT_TOP_TABLE_END;
-				$caption	= CONTENT_LAN_38;
-				$ns -> tablerender($caption, $text);
-				$aa -> ShowNextPrev("", $from, $number, $total);
-			}
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path"]);
+		$array				= $aa -> getCategoryTree("", intval($qs[1]), TRUE);
+		$validparent		= implode(",", array_keys($array));
+		$datequery1			= " AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().") ";
+		$qry				= " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
+		$number				= (isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "");
+		$np					= ($number ? " LIMIT ".intval($from).", ".intval($number) : "");
+
+		$qry1 = "
+		SELECT p.*, r.*, (r.rate_rating / r.rate_votes) as rate_avg
+		FROM #rate AS r
+		LEFT JOIN #pcontent AS p ON p.content_id = r.rate_itemid 
+		WHERE p.content_refer !='sa' AND ".$qry." ".$datequery1." AND p.content_class REGEXP '".e_CLASS_REGEXP."' AND r.rate_table='pcontent'
+		ORDER BY rate_avg DESC ";
+		$qry2 = $qry1." ".$np;
+
+		if(!is_object($sql)){ $sql = new db; }
+		$total = $sql -> db_Select_gen($qry1);
+		if($sql->db_Select_gen($qry2)){
+			while($row = $sql -> db_Fetch()){
+				$CONTENT_TOP_TABLE_AUTHOR	= $aa -> prepareAuthor("top", $row['content_author'], $row['content_id']);
+				$content_top_table_string	.= $tp -> parseTemplate($CONTENT_TOP_TABLE, FALSE, $content_shortcodes);
+			}
+			$content_top_table_string		= $aa -> getCrumbPage("top", $array, $mainparent).$content_top_table_string;
+			$text		= $CONTENT_TOP_TABLE_START.$content_top_table_string.$CONTENT_TOP_TABLE_END;
+			$caption	= $content_pref['content_top_caption'];
+			if(isset($content_pref['content_top_caption_append_name']) && $content_pref['content_top_caption_append_name']){
+				$caption .= " ".$array[intval($qs[1])][1];
 			}
-			ob_end_flush(); // dump collected data
+			$ns -> tablerender($caption, $text);
+			$aa -> ShowNextPrev("", $from, $number, $total);
 		}
+		$cachecheck = CachePost($cachestr);
 		unset($qry, $qry1, $qry2, $array, $validparent, $datequery);
 }
 
@@ -1097,11 +1103,11 @@
 		show_content_search_menu("score", $mainparent);		//show navigator/search/order menu
 
 		if(!isset($CONTENT_SCORE_TABLE)){
-			if(!$content_pref["content_theme_{$mainparent}"]){
+			if(!$content_pref["content_theme"]){
 				require_once($plugindir."templates/default/content_score_template.php");
 			}else{
-				if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_score_template.php")){
-					require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_score_template.php");
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_score_template.php")){
+					require_once($tp->replaceConstants($content_pref["content_theme"])."content_score_template.php");
 				}else{
 					require_once($plugindir."templates/default/content_score_template.php");
 				}
@@ -1109,47 +1115,47 @@
 		}
 
 		$cachestr = "$plugintable.score.$qs[1]";
-		if($cache = $e107cache->retrieve($cachestr)){
-			echo $cache;
-		}else{
-			ob_start();
+		$cachecheck = CachePre($cachestr);
+		if($cachecheck){
+			echo $cachecheck;
+			return;
+		}
+		$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path"]);
+		$array				= $aa -> getCategoryTree("", intval($qs[1]), TRUE);
+		$validparent		= implode(",", array_keys($array));
+		$qry				= " content_score != '0' AND content_score != '' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
+		$number				= (isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5");
 
-			$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$array				= $aa -> getCategoryTree("", intval($qs[1]), TRUE);
-			$validparent		= implode(",", array_keys($array));
-			$qry				= " content_score != '0' AND content_score != '' AND content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' ";
-			$number				= (isset($content_pref["content_nextprev_number_{$mainparent}"]) && $content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "5");
-
-			if(!is_object($sql)){ $sql = new db; }
-			$contenttotal = $sql -> db_Count($plugintable, "(*)", "WHERE ".$qry." ");
-			if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_author, content_icon, content_score", " ".$qry." ORDER BY content_score DESC LIMIT ".$from.",".$number." ")){
-				$content_score_table_string = CONTENT_LAN_88;
-			}else{
-				while($row = $sql -> db_Fetch()){
-					$CONTENT_SCORE_TABLE_AUTHOR	= $aa -> prepareAuthor("score", $row['content_author'], $row['content_id']);
-					$content_score_table_string	.= $tp -> parseTemplate($CONTENT_SCORE_TABLE, FALSE, $content_shortcodes);
-				}
-			}
-			$content_score_table_string = $aa -> getCrumbPage("score", $array, $mainparent).$content_score_table_string;
-			$text		= $CONTENT_SCORE_TABLE_START.$content_score_table_string.$CONTENT_SCORE_TABLE_END;
-			$caption	= CONTENT_LAN_87;
-			$ns -> tablerender($caption, $text);
-			$aa -> ShowNextPrev("", $from, $number, $contenttotal);
-			if($pref['cachestatus']){
-				$cache = ob_get_contents();
-				$e107cache->set($cachestr, $cache);
+		if(!is_object($sql)){ $sql = new db; }
+		$contenttotal = $sql -> db_Count($plugintable, "(*)", "WHERE ".$qry." ");
+		if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_author, content_icon, content_score", " ".$qry." ORDER BY content_score DESC LIMIT ".$from.",".$number." ")){
+			$content_score_table_string = CONTENT_LAN_88;
+		}else{
+			while($row = $sql -> db_Fetch()){
+				$CONTENT_SCORE_TABLE_AUTHOR	= $aa -> prepareAuthor("score", $row['content_author'], $row['content_id']);
+				$content_score_table_string	.= $tp -> parseTemplate($CONTENT_SCORE_TABLE, FALSE, $content_shortcodes);
 			}
-			ob_end_flush(); // dump collected data
 		}
+		$content_score_table_string = $aa -> getCrumbPage("score", $array, $mainparent).$content_score_table_string;
+		$text		= $CONTENT_SCORE_TABLE_START.$content_score_table_string.$CONTENT_SCORE_TABLE_END;
+		$caption	= $content_pref['content_score_caption'];
+		if(isset($content_pref['content_score_caption_append_name']) && $content_pref['content_score_caption_append_name']){
+			$caption .= " ".$array[intval($qs[1])][1];
+		}
+		$ns -> tablerender($caption, $text);
+		$aa -> ShowNextPrev("", $from, $number, $contenttotal);
+		$cachecheck = CachePost($cachestr);
 }
 
 // ##### CONTENT ITEM ------------------------------------------
 function show_content_item(){
 		global $pref, $content_pref, $content_icon_path, $content_image_path, $content_file_path, $custom, $plugindir, $plugintable, $array, $content_shortcodes, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $eArrayStorage, $ns, $rater, $ep, $row, $authordetails, $mainparent; 
 		global $CONTENT_CONTENT_TABLE_TEXT, $CONTENT_CONTENT_TABLE_PAGENAMES, $CONTENT_CONTENT_TABLE_SUMMARY, $CONTENT_CONTENT_TABLE_CUSTOM_TAGS, $CONTENT_CONTENT_TABLE_PARENT, $CONTENT_CONTENT_TABLE_INFO_PRE, $CONTENT_CONTENT_TABLE_INFO_POST, $CONTENT_CONTENT_TABLE_AUTHORDETAILS, $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA, $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA;
+		global $CONTENT_CONTENT_TABLE_PREV_PAGE, $CONTENT_CONTENT_TABLE_NEXT_PAGE;
 
 		$mainparent			= $aa -> getMainParent(intval($qs[1]));
 		$content_pref		= $aa -> getContentPref($mainparent);
+		
 		show_content_search_menu("item", $mainparent);		//show navigator/search/order menu
 		$array				= $aa -> getCategoryTree("", $mainparent, TRUE);
 		$validparent		= implode(",", array_keys($array));
@@ -1161,7 +1167,7 @@
 			$row = $sql -> db_Fetch();
 
 			//update refer count outside of cache (count visits ^ count unique ips)
-			if(isset($content_pref["content_log_{$mainparent}"]) && $content_pref["content_log_{$mainparent}"]){
+			if(isset($content_pref["content_log"]) && $content_pref["content_log"]){
 				$ip			= $e107->getip();
 				$self		= e_SELF;
 				$refertmp	= explode("^", $row['content_refer']);
@@ -1186,209 +1192,249 @@
 
 			if(!isset($qs[2])){ $cacheid = 1; }else{ $cacheid = $qs[2]; }
 			$cachestr = "$plugintable.content.$qs[1].$cacheid";
-			if($cache = $e107cache->retrieve($cachestr)){
-				echo $cache;
-			}else{
-				ob_start();
-					$content_pref["content_cat_icon_path_large_{$mainparent}"] = ($content_pref["content_cat_icon_path_large_{$mainparent}"] ? $content_pref["content_cat_icon_path_large_{$mainparent}"] : "{e_PLUGIN}content/images/cat/48/" );
-					$content_pref["content_cat_icon_path_small_{$mainparent}"] = ($content_pref["content_cat_icon_path_small_{$mainparent}"] ? $content_pref["content_cat_icon_path_small_{$mainparent}"] : "{e_PLUGIN}content/images/cat/16/" );
-					$content_pref["content_icon_path_{$mainparent}"] = ($content_pref["content_icon_path_{$mainparent}"] ? $content_pref["content_icon_path_{$mainparent}"] : "{e_PLUGIN}content/images/icon/" );
-					$content_pref["content_image_path_{$mainparent}"] = ($content_pref["content_image_path_{$mainparent}"] ? $content_pref["content_image_path_{$mainparent}"] : "{e_PLUGIN}content/images/image/" );
-					$content_pref["content_file_path_{$mainparent}"] = ($content_pref["content_file_path_{$mainparent}"] ? $content_pref["content_file_path_{$mainparent}"] : "{e_PLUGIN}content/images/file/" );
-					$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-					$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-					$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-					$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
-					$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path_{$mainparent}"]);
-					$number							= (isset($content_pref["content_nextprev_number_{$mainparent}"]) && $content_pref["content_nextprev_number_{$mainparent}"] ? $content_pref["content_nextprev_number_{$mainparent}"] : "5");
-					$nextprevquery					= (isset($content_pref["content_nextprev_{$mainparent}"]) && $content_pref["content_nextprev_{$mainparent}"] ? "LIMIT ".intval($from).",".intval($number) : "");
-
-					$CONTENT_CONTENT_TABLE_AUTHORDETAILS = $aa -> prepareAuthor("content", $row['content_author'], $row['content_id']);
-					$CONTENT_CONTENT_TABLE_TEXT = $row['content_text'];
-
-					$lastpage = FALSE;		//boolean whether or not the current page is the last page
-					if(preg_match_all("/\[newpage.*?]/si", $row['content_text'], $matches)){
-						$pages = preg_split("/\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY);
-						$pages = array_values($pages);
-
-						if(count($pages) == count($matches[0])){
-						}elseif(count($pages) > count($matches[0])){
-							$matches[0] = array_pad($matches[0], -count($pages), "[newpage]");
-						}elseif(count($pages) < count($matches[0])){
-						}
-
-						$CONTENT_CONTENT_TABLE_TEXT = $pages[(!$qs[2] ? 0 : $qs[2]-1)];
-						$options = "";
-						for ($i=0; $i < count($pages); $i++) {
-							if(!isset($qs[2])){ $idp = 1; }else{ $idp = $qs[2]; }
-							if($idp == $i+1){ $pre = " - current"; }else{ $pre = ""; }
-							if($matches[0][$i] == "[newpage]"){
-								$pagename[$i] = CONTENT_LAN_78;
+			$cachecheck = CachePre($cachestr);
+			if($cachecheck){
+				echo $cachecheck;
+				return;
+			}
+			$content_pref["content_cat_icon_path_large"] = ($content_pref["content_cat_icon_path_large"] ? $content_pref["content_cat_icon_path_large"] : "{e_PLUGIN}content/images/cat/48/" );
+			$content_pref["content_cat_icon_path_small"] = ($content_pref["content_cat_icon_path_small"] ? $content_pref["content_cat_icon_path_small"] : "{e_PLUGIN}content/images/cat/16/" );
+			$content_pref["content_icon_path"] = ($content_pref["content_icon_path"] ? $content_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/" );
+			$content_pref["content_image_path"] = ($content_pref["content_image_path"] ? $content_pref["content_image_path"] : "{e_PLUGIN}content/images/image/" );
+			$content_pref["content_file_path"] = ($content_pref["content_file_path"] ? $content_pref["content_file_path"] : "{e_PLUGIN}content/images/file/" );
+			$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"]);
+			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+			$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path"]);
+			$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path"]);
+			$number							= (isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5");
+			$nextprevquery					= (isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
+
+			$CONTENT_CONTENT_TABLE_AUTHORDETAILS = $aa -> prepareAuthor("content", $row['content_author'], $row['content_id']);
+			$CONTENT_CONTENT_TABLE_TEXT = $row['content_text'];
+
+			$CONTENT_CONTENT_TABLE_PREV_PAGE = FALSE;
+			$CONTENT_CONTENT_TABLE_NEXT_PAGE = FALSE;
+			$lastpage = FALSE;		//boolean whether or not the current page is the last page
+			if(preg_match_all("/\[newpage.*?]/si", $row['content_text'], $matches)){
+				//remove html bbcode (since we're splitting the text, the html bbcode would not be parsed)
+				$row['content_text'] = preg_replace("/\\[html\](.*?)\[\/html\]/si", '\1', $row['content_text']);
+				//split newpage
+				$pages = preg_split("/\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY);
+				$pages = array_values($pages);
+
+				//remove empty values
+				if(trim($pages[0]) == ""){
+					unset($pages[0]);
+				}
+				$pages = array_values($pages);
+
+				if(count($pages) == count($matches[0])){
+				}elseif(count($pages) > count($matches[0])){
+					$matches[0] = array_pad($matches[0], -count($pages), "[newpage]");
+				}elseif(count($pages) < count($matches[0])){
+				}
+
+				$CONTENT_CONTENT_TABLE_TEXT = $pages[(!$qs[2] ? 0 : $qs[2]-1)];
+				$options = "";
+				for ($i=0; $i < count($pages); $i++) {
+					if(!isset($qs[2])){ $idp = 1; }else{ $idp = $qs[2]; }
+					if($idp == $i+1){ $pre = CONTENT_LAN_92; }else{ $pre = ""; }
+					if($matches[0][$i] == "[newpage]"){
+						$pagename[$i] = CONTENT_LAN_78;
+					}else{
+						$arrpagename = explode("[newpage=", $matches[0][$i]);
+						$pagename[$i] = substr($arrpagename[1],0,-1);
+					}
+					if(isset($content_pref["content_content_pagenames_nextprev"]) && $content_pref["content_content_pagenames_nextprev"]){
+						if($idp>1){
+							if(isset($content_pref["content_content_pagenames_nextprev_prevhead"]) && $content_pref["content_content_pagenames_nextprev_prevhead"]){
+								$cap = $content_pref["content_content_pagenames_nextprev_prevhead"];
+								$cap = str_replace("{PAGETITLE}", $pagename[$idp-2], $cap);
 							}else{
-								$arrpagename = explode("[newpage=", $matches[0][$i]);
-								$pagename[$i] = substr($arrpagename[1],0,-1);
+								$cap = CONTENT_LAN_90;
 							}
-							//0:normal links, 1:selectbox
-							//$content_pref["content_content_pagenames_rendertype_{$mainparent}"] = "1";
-							if(isset($content_pref["content_content_pagenames_rendertype_{$mainparent}"]) && $content_pref["content_content_pagenames_rendertype_{$mainparent}"] == "1"){
-								$page = CONTENT_LAN_79." ".($i+1)." ".$pre." ".$pagename[$i];
-								$url = e_SELF."?".$qs[0].".".$qs[1].".".($i+1);
-								$options .= $rs -> form_option($page, ($idp == ($i+1) ? "1" : "0"), $url , "");
+							$CONTENT_CONTENT_TABLE_PREV_PAGE = "<a href='".e_SELF."?".$qs[0].".".$qs[1].".".($idp-1)."'>".$cap."</a>";
+						}else{
+							$CONTENT_CONTENT_TABLE_PREV_PAGE = ' ';
+						}
+						if($idp<count($pages)){
+							if(isset($content_pref["content_content_pagenames_nextprev_nexthead"]) && $content_pref["content_content_pagenames_nextprev_nexthead"]){
+								$cap = $content_pref["content_content_pagenames_nextprev_nexthead"];
+								$cap = str_replace("{PAGETITLE}", $pagename[$idp], $cap);
 							}else{
-								$options .= CONTENT_LAN_79." ".($i+1)." ".$pre." : <a href='".e_SELF."?".$qs[0].".".$qs[1].".".($i+1)."'>".$pagename[$i]."</a><br />";
+								$cap = CONTENT_LAN_91;
 							}
+							$CONTENT_CONTENT_TABLE_NEXT_PAGE = "<a href='".e_SELF."?".$qs[0].".".$qs[1].".".($idp+1)."'>".$cap."</a>";
+						}else{
+							$CONTENT_CONTENT_TABLE_NEXT_PAGE = ' ';
+						}
+					}
+					
+					//0:normal links, 1:selectbox
+					//$content_pref["content_content_pagenames_rendertype"] = "1";
+					if(isset($content_pref["content_content_pagenames_rendertype"]) && $content_pref["content_content_pagenames_rendertype"] == "1"){
+						$page = CONTENT_LAN_79." ".($i+1)." ".$pre." ".$pagename[$i];
+						$url = e_SELF."?".$qs[0].".".$qs[1].".".($i+1);
+						$options .= $rs -> form_option($page, ($idp == ($i+1) ? "1" : "0"), $url , "");
+					}else{
+						$options .= CONTENT_LAN_79." ".($i+1)." ".$pre." : <a href='".e_SELF."?".$qs[0].".".$qs[1].".".($i+1)."'>".$pagename[$i]."</a><br />";
+					}
 
-							if($idp==1){
-								$CONTENT_CONTENT_TABLE_SUMMARY = (isset($content_pref["content_content_summary_{$mainparent}"]) && $content_pref["content_content_summary_{$mainparent}"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "") : "");
-								$CONTENT_CONTENT_TABLE_SUMMARY = $tp -> replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY);
-							}else{
-								$CONTENT_CONTENT_TABLE_SUMMARY = "";
-							}
-							if($idp == count($pages)){
-								$lastpage = TRUE;
-							}
+					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 = $tp -> replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY);
+					}else{
+						$CONTENT_CONTENT_TABLE_SUMMARY = "";
+					}
+					//render custom/preset on first page
+					if(isset($content_pref['content_content_multipage_preset']) && $content_pref['content_content_multipage_preset']){
+						if($idp == '1'){
+							$lastpage = TRUE;
 						}
-						if($content_pref["content_content_pagenames_rendertype_{$mainparent}"] == "1"){
-							$selectjs	= "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\"";
-							$CONTENT_CONTENT_TABLE_PAGENAMES = $rs -> form_select_open("pagenames", $selectjs).$rs -> form_option("select page", "1", "none" , "").$options.$rs -> form_select_close();
-						}else{
-							$CONTENT_CONTENT_TABLE_PAGENAMES = $options;
+					//render custom/preset on last page
+					}else{
+						if($idp == count($pages)){
+							$lastpage = TRUE;
 						}
+					}
+				}
+				if($content_pref["content_content_pagenames_rendertype"] == "1"){
+					$selectjs	= "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\"";
+					$CONTENT_CONTENT_TABLE_PAGENAMES = $rs -> form_select_open("pagenames", $selectjs).$rs -> form_option(CONTENT_LAN_89, "1", "none" , "").$options.$rs -> form_select_close();
+				}else{
+					$CONTENT_CONTENT_TABLE_PAGENAMES = $options;
+				}
+
+			}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	= $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, "");
 
+			$custom							= $eArrayStorage->ReadArray($row['content_pref']);
+
+			$date	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_DATE}', FALSE, $content_shortcodes);
+			$auth	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
+			$ep		= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_EPICONS}', FALSE, $content_shortcodes);
+			$edit	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_EDITICON}', FALSE, $content_shortcodes);
+			$par	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_PARENT}', FALSE, $content_shortcodes);
+			$com	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_COMMENT}', FALSE, $content_shortcodes);
+			$score	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_SCORE}', FALSE, $content_shortcodes);
+			$ref	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_REFER}', FALSE, $content_shortcodes);
+			$ico	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_ICON}', FALSE, $content_shortcodes);
+			$sub	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_SUBHEADING}', FALSE, $content_shortcodes);
+			$rat	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_RATING}', FALSE, $content_shortcodes);
+			$fil	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_FILE}', FALSE, $content_shortcodes);
+
+			$CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = FALSE;
+			$CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = FALSE;
+			$CONTENT_CONTENT_TABLE_INFO_PRE = FALSE;
+			$CONTENT_CONTENT_TABLE_INFO_POST = FALSE;
+			
+			if ($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;
+			}
+
+			if(!isset($CONTENT_CONTENT_TABLE)){
+				//if no theme has been set, use default theme
+				if(!$content_pref["content_theme"]){
+
+					//if custom layout is set
+					if($row['content_layout']){
+						//if custom layout file exists
+						if(is_readable($plugindir."templates/default/".$row['content_layout'])){
+							require_once($plugindir."templates/default/".$row['content_layout']);
+						}else{
+							require_once($plugindir."templates/default/content_content_template.php");
+						}
 					}else{
-						$CONTENT_CONTENT_TABLE_SUMMARY	= (isset($content_pref["content_content_summary_{$mainparent}"]) && $content_pref["content_content_summary_{$mainparent}"] && $row['content_summary'] ? $tp -> toHTML($row['content_summary'], TRUE, "") : "");
-						$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, "");
-					$custom							= $eArrayStorage->ReadArray($row['content_pref']);
-
-					$date	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_DATE}', FALSE, $content_shortcodes);
-					$auth	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_AUTHORDETAILS}', FALSE, $content_shortcodes);
-					$ep		= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_EPICONS}', FALSE, $content_shortcodes);
-					$edit	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_EDITICON}', FALSE, $content_shortcodes);
-					$par	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_PARENT}', FALSE, $content_shortcodes);
-					$com	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_COMMENT}', FALSE, $content_shortcodes);
-					$score	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_SCORE}', FALSE, $content_shortcodes);
-					$ref	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_REFER}', FALSE, $content_shortcodes);
-					$ico	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_ICON}', FALSE, $content_shortcodes);
-					$sub	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_SUBHEADING}', FALSE, $content_shortcodes);
-					$rat	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_RATING}', FALSE, $content_shortcodes);
-					$fil	= $tp -> parseTemplate('{CONTENT_CONTENT_TABLE_FILE}', FALSE, $content_shortcodes);
-
-					$CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = FALSE;
-					$CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = FALSE;
-					$CONTENT_CONTENT_TABLE_INFO_PRE = FALSE;
-					$CONTENT_CONTENT_TABLE_INFO_POST = FALSE;
-					
-					if ($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;
-					}
-
-					if(!isset($CONTENT_CONTENT_TABLE)){
-						//if no theme has been set, use default theme
-						if(!$content_pref["content_theme_{$mainparent}"]){
-
-							//if custom layout is set
-							if($row['content_layout']){
-								//if custom layout file exists
-								if(is_readable($plugindir."templates/default/".$row['content_layout'])){
-									require_once($plugindir."templates/default/".$row['content_layout']);
-								}else{
-									require_once($plugindir."templates/default/content_content_template.php");
-								}
+						require_once($plugindir."templates/default/content_content_template.php");
+					}
+				}else{
+					//if custom layout is set
+					if($row['content_layout']){
+						//if custom layout file exists
+						if(is_readable($tp->replaceConstants($content_pref["content_theme"]).$row['content_layout'])){
+							require_once($tp->replaceConstants($content_pref["content_theme"]).$row['content_layout']);
+						}else{
+							//if default layout from the set theme exists
+							if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
+								require_once($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php");
+							//else use default theme, default layout
 							}else{
 								require_once($plugindir."templates/default/content_content_template.php");
 							}
+						}
+					//if no custom layout is set
+					}else{
+						//if default layout from the set theme exists
+						if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
+							require_once($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php");
+						//else use default theme, default layout
 						}else{
-							//if custom layout is set
-							if($row['content_layout']){
-								//if custom layout file exists
-								if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/".$row['content_layout'])){
-									require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/".$row['content_layout']);
-								}else{
-									//if default layout from the set theme exists
-									if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_content_template.php")){
-										require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_content_template.php");
-									//else use default theme, default layout
-									}else{
-										require_once($plugindir."templates/default/content_content_template.php");
-									}
-								}
-							//if no custom layout is set
-							}else{
-								//if default layout from the set theme exists
-								if(is_readable($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_content_template.php")){
-									require_once($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_content_template.php");
-								//else use default theme, default layout
-								}else{
-									require_once($plugindir."templates/default/content_content_template.php");
-								}
-							}
+							require_once($plugindir."templates/default/content_content_template.php");
 						}
 					}
+				}
+			}
 
-					$months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
+			$months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
 
-					$CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
-					$CUSTOM_TAGS = FALSE;
-					if($lastpage === TRUE && !empty($custom)){
-						$CONTENT_CONTENT_TABLE_CUSTOM_PRE = "";
-						$CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
-						//ksort($custom);
-						foreach($custom as $k => $v){
-							if($k == "content_custom_presettags"){
-								if(isset($content_pref["content_content_presettags_{$mainparent}"]) && $content_pref["content_content_presettags_{$mainparent}"]){
-									foreach($v as $ck => $cv){
-										if(is_array($cv)){	//date
-											if(!($cv['day']=="" && $cv['month']=="" && $cv['year']=="")){
-												$vv = $cv['day']." ".$months[($cv['month']-1)]." ".$cv['year'];
-											}
-										}else{
-											$vv = $cv;
-										}
-										if( isset($ck) && $ck != "" && isset($vv) && $vv!="" ){
-											$CUSTOM_TAGS = TRUE;
-											$CONTENT_CONTENT_TABLE_CUSTOM_KEY		= $tp->toHTML($ck, true);
-											$CONTENT_CONTENT_TABLE_CUSTOM_VALUE		= $tp->toHTML($vv, true);
-											$CONTENT_CONTENT_TABLE_CUSTOM_TAGS		.= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_TABLE_CUSTOM);
-										}
+			$CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
+			$CUSTOM_TAGS = FALSE;
+			if($lastpage === TRUE && !empty($custom)){
+				$CONTENT_CONTENT_TABLE_CUSTOM_PRE = "";
+				$CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
+				//ksort($custom);
+				foreach($custom as $k => $v){
+					if($k == "content_custom_presettags"){
+						if(isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]){
+							foreach($v as $ck => $cv){
+								if(is_array($cv)){	//date
+									if(!($cv['day']=="" && $cv['month']=="" && $cv['year']=="")){
+										$vv = $cv['day']." ".$months[($cv['month']-1)]." ".$cv['year'];
 									}
+								}else{
+									$vv = $cv;
 								}
-							}else{
-								if(isset($content_pref["content_content_customtags_{$mainparent}"]) && $content_pref["content_content_customtags_{$mainparent}"]){
-									$key = substr($k,15);
-									if( isset($key) && $key != "" && isset($v) && $v!="" ){
-										$CUSTOM_TAGS = TRUE;
-										$CONTENT_CONTENT_TABLE_CUSTOM_KEY		= $tp->toHTML($key, true);
-										$CONTENT_CONTENT_TABLE_CUSTOM_VALUE		= $tp->toHTML($v, true);
-										$CONTENT_CONTENT_TABLE_CUSTOM_TAGS		.= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_TABLE_CUSTOM);
-									}
+								if( isset($ck) && $ck != "" && isset($vv) && $vv!="" ){
+									$CUSTOM_TAGS = TRUE;
+									$CONTENT_CONTENT_TABLE_CUSTOM_KEY		= $tp->toHTML($ck, true);
+									$CONTENT_CONTENT_TABLE_CUSTOM_VALUE		= $tp->toHTML($vv, true);
+									$CONTENT_CONTENT_TABLE_CUSTOM_TAGS		.= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_TABLE_CUSTOM);
 								}
 							}
 						}
-						if($CUSTOM_TAGS === TRUE){
-							$CONTENT_CONTENT_TABLE_CUSTOM_TAGS = $CONTENT_CONTENT_TABLE_CUSTOM_START.$CONTENT_CONTENT_TABLE_CUSTOM_TAGS.$CONTENT_CONTENT_TABLE_CUSTOM_END;
+					}else{
+						if(isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]){
+							$key = substr($k,15);
+							if( isset($key) && $key != "" && isset($v) && $v!="" ){
+								$CUSTOM_TAGS = TRUE;
+								$CONTENT_CONTENT_TABLE_CUSTOM_KEY		= $tp->toHTML($key, true);
+								$CONTENT_CONTENT_TABLE_CUSTOM_VALUE		= $tp->toHTML($v, true);
+								$CONTENT_CONTENT_TABLE_CUSTOM_TAGS		.= preg_replace("/\{(.*?)\}/e", '$\1', $CONTENT_CONTENT_TABLE_CUSTOM);
+							}
 						}
 					}
-					$text		= $tp -> parseTemplate($CONTENT_CONTENT_TABLE, FALSE, $content_shortcodes);
-					$text		= $aa -> getCrumbPage("item", $array, $row['content_parent']).$text;
-					$caption	= $row['content_heading'];
-					$ns -> tablerender($caption, $text);
-
-					if($pref['cachestatus']){
-						$cache = ob_get_contents();
-						$e107cache->set($cachestr, $cache);
-					}
-				ob_end_flush(); // dump collected data
+				}
+				if($CUSTOM_TAGS === TRUE){
+					$CONTENT_CONTENT_TABLE_CUSTOM_TAGS = $CONTENT_CONTENT_TABLE_CUSTOM_START.$CONTENT_CONTENT_TABLE_CUSTOM_TAGS.$CONTENT_CONTENT_TABLE_CUSTOM_END;
+				}
 			}
+			$text		= $tp -> parseTemplate($CONTENT_CONTENT_TABLE, FALSE, $content_shortcodes);
+			$text		= $aa -> getCrumbPage("item", $array, $row['content_parent']).$text;
+			$caption	= $row['content_heading'];
+			$ns -> tablerender($caption, $text);
+			$cachecheck = CachePost($cachestr);
 
 			//recheck some thing when caching is enabled
 			$pages = preg_split("/\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY);
@@ -1401,25 +1447,20 @@
 					$lastpage = TRUE;
 				}
 			}
-			if($lastpage && ($row['content_comment'] || (isset($content_pref["content_content_comment_all_{$mainparent}"]) && $content_pref["content_content_comment_all_{$mainparent}"]))){
-				if($cache = $e107cache->retrieve($cachestr)){
-					echo $cache;
+			if($lastpage && ($row['content_comment'] || (isset($content_pref["content_content_comment_all"]) && $content_pref["content_content_comment_all"]))){
+				$cachecheck = CachePre($cachestr);
+				if($cachecheck){
+					echo $cachecheck;
+					return;
+				}
+				if((isset($content_pref["content_content_rating"]) && $content_pref["content_content_rating"] && $row['content_rate']) || (isset($content_pref["content_content_rating_all"]) && $content_pref["content_content_rating_all"]) ){
+					$showrate = TRUE;
 				}else{
-					ob_start();
-						if((isset($content_pref["content_content_rating_{$mainparent}"]) && $content_pref["content_content_rating_{$mainparent}"] && $row['content_rate']) || (isset($content_pref["content_content_rating_all_{$mainparent}"]) && $content_pref["content_content_rating_all_{$mainparent}"]) ){
-							$showrate = TRUE;
-						}else{
-							$showrate = FALSE;
-						}
-						$width = 0;
-						$cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate);
-
-						if($pref['cachestatus']){
-							$cache = ob_get_contents();
-							$e107cache->set($cachestr, $cache);
-						}
-					ob_end_flush(); // dump collected data
+					$showrate = FALSE;
 				}
+				$width = 0;
+				$cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate);
+				$cachecheck = CachePost($cachestr);
 			}
 		} //close sql
 }
diff -ruN 0.7.5/e107_plugins/content/content_manager.php 0.7.7/e107_plugins/content/content_manager.php
--- 0.7.5/e107_plugins/content/content_manager.php	2006-02-13 04:13:22.000000000 -0600
+++ 0.7.7/e107_plugins/content/content_manager.php	2006-09-18 02:40:00.000000000 -0500
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_manager.php,v $
-|		$Revision: 1.17 $
-|		$Date: 2006/02/13 10:13:22 $
+|		$Revision: 1.23 $
+|		$Date: 2006/09/18 07:40:00 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -53,24 +53,36 @@
 // define e_pagetitle
 $aa -> setPageTitle();
 
-if(preg_match("#(.*?)_delete_(\d+)#",$deltest[$tp->toJS("delete")],$matches)){
-	$delete = $matches[1];
-	$del_id = $matches[2];
+//if(preg_match("#(.*?)_delete_(\d+)#",$deltest[$tp->toJS("delete")],$matches)){
+//	$delete = $matches[1];
+//	$del_id = $matches[2];
+//}
+
+if(isset($_POST['delete'])){
+	$tmp = array_pop(array_flip($_POST['delete']));
+	list($delete, $del_id) = explode("_", $tmp);
 }
 
-//these have to be set for the tiny_mce wysiwyg
-$WYSIWYG	= true;
+//these have to be set for the tinymce wysiwyg
 $e_wysiwyg	= "content_text";
-
-// ##### DB ---------------------------------------------------------------------------------------
-
-require_once(HEADERF);
+//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 ---------------------------------------------------------------------------------------
 
+require_once(HEADERF);
 
 if(isset($_POST['create_content'])){
 	if($_POST['content_text'] && $_POST['content_heading'] && $_POST['parent'] != "none"){
@@ -133,6 +145,27 @@
 	}elseif($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2])){
 		$aform -> show_create_content("contentmanager", USERID, USERNAME);
 
+	//manage submitted
+	}elseif($qs[0] == "content" && $qs[1] == "submitted" && is_numeric($qs[2])){
+		//$aform -> show_submitted("contentmanager", USERID, USERNAME, $qs[2]);
+		$aform -> show_submitted($qs[2]);
+
+		//post submitted content item
+	}elseif($qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2]) ){
+		$newqs = array_reverse($qs);
+		if($newqs[0] == "cu"){										//item; submit post / update redirect
+			$mainparent = $aa -> getMainParent($qs[2]);
+			$message = CONTENT_ADMIN_ITEM_LAN_117."<br /><br />";
+			$message .= CONTENT_ADMIN_ITEM_LAN_88." <a href='".e_SELF."?content.create.".$mainparent."'>".CONTENT_ADMIN_ITEM_LAN_90."</a><br />";
+			$message .= CONTENT_ADMIN_ITEM_LAN_89." <a href='".e_SELF."?content.".$mainparent."'>".CONTENT_ADMIN_ITEM_LAN_90."</a><br />";
+			$message .= CONTENT_ADMIN_ITEM_LAN_91." <a href='".e_SELF."?content.edit.".$qs[2]."'>".CONTENT_ADMIN_ITEM_LAN_90."</a><br />";
+			$message .= CONTENT_ADMIN_ITEM_LAN_124." <a href='".e_PLUGIN."content/content.php?content.".$qs[2]."'>".CONTENT_ADMIN_ITEM_LAN_90."</a>";
+			$ns -> tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
+			require_once(e_ADMIN."footer.php");
+			exit;
+		}
+		$aform -> show_create_content("sa", USERID, USERNAME);
+
 	}else{
 		header("location:".e_SELF); exit;
 	}
diff -ruN 0.7.5/e107_plugins/content/content_shortcodes.php 0.7.7/e107_plugins/content/content_shortcodes.php
--- 0.7.5/e107_plugins/content/content_shortcodes.php	2006-02-13 04:13:22.000000000 -0600
+++ 0.7.7/e107_plugins/content/content_shortcodes.php	2006-11-11 22:15:30.000000000 -0600
@@ -3,6 +3,12 @@
 include_once(e_HANDLER.'shortcode_handler.php');
 $content_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
 /*
+
+SC_BEGIN CONTENT_NEXTPREV
+global $CONTENT_NEXTPREV;
+return $CONTENT_NEXTPREV;
+SC_END
+
 // CONTENT_TYPE_TABLE ------------------------------------------------
 SC_BEGIN CONTENT_TYPE_TABLE_TOTAL
 global $contenttotal;
@@ -11,22 +17,35 @@
 
 SC_BEGIN CONTENT_TYPE_TABLE_HEADING
 global $CONTENT_TYPE_TABLE_HEADING, $contenttotal, $row, $tp;
-$row['content_heading'] = $tp -> toHTML($row['content_heading'], TRUE, "");
-return ($contenttotal != "0" ? "<a href='".e_SELF."?recent.".$row['content_id']."'>".$row['content_heading']."</a>" : $row['content_heading'] );
+$row['content_heading'] = $tp -> toHTML($row['content_heading'], TRUE, "emotes_off, no_make_clickable");
+return ($contenttotal != "0" ? "<a href='".e_SELF."?cat.".$row['content_id']."'>".$row['content_heading']."</a>" : $row['content_heading'] );
 SC_END
 
+SC_BEGIN CONTENT_TYPE_TABLE_LINK
+global $row, $tp;
+$text = "
+[<a href='".e_PLUGIN."content/content.php?cat.list.".$row['content_id']."'>".CONTENT_TYPE_LAN_0."</a>] 
+[<a href='".e_PLUGIN."content/content.php?author.list.".$row['content_id']."'>".CONTENT_TYPE_LAN_1."</a>] 
+[<a href='".e_PLUGIN."content/content.php?list.".$row['content_id']."'>".CONTENT_TYPE_LAN_2."</a>] 
+[<a href='".e_PLUGIN."content/content.php?top.".$row['content_id']."'>".CONTENT_TYPE_LAN_3."</a>] 
+[<a href='".e_PLUGIN."content/content.php?score.".$row['content_id']."'>".CONTENT_TYPE_LAN_4."</a>] 
+[<a href='".e_PLUGIN."content/content.php?recent.".$row['content_id']."'>".CONTENT_TYPE_LAN_5."</a>]";
+return $text;
+SC_END
+
+
 SC_BEGIN CONTENT_TYPE_TABLE_SUBHEADING
 global $CONTENT_TYPE_TABLE_SUBHEADING, $contenttotal, $row, $tp;
-$row['content_subheading'] = $tp -> toHTML($row['content_subheading'], TRUE, "");
+$row['content_subheading'] = $tp -> toHTML($row['content_subheading'], TRUE, "emotes_off, no_make_clickable");
 return ($row['content_subheading'] ? $row['content_subheading'] : "");
 SC_END
 
 SC_BEGIN CONTENT_TYPE_TABLE_ICON
 global $CONTENT_TYPE_TABLE_ICON, $contenttotal, $row, $aa, $content_cat_icon_path_large, $content_pref;
 if($contenttotal != "0"){
-	$CONTENT_TYPE_TABLE_ICON = $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "recent.".$row['content_id'], "", $content_pref["content_blank_caticon_{$row['content_id']}"]);
+	$CONTENT_TYPE_TABLE_ICON = $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "cat.".$row['content_id'], "", $content_pref["content_blank_caticon"]);
 }else{
-	$CONTENT_TYPE_TABLE_ICON = $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "", "", $content_pref["content_blank_caticon_{$row['content_id']}"]);
+	$CONTENT_TYPE_TABLE_ICON = $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "", "", $content_pref["content_blank_caticon"]);
 }
 return $CONTENT_TYPE_TABLE_ICON;
 SC_END
@@ -71,9 +90,10 @@
 
 SC_BEGIN CONTENT_TOP_TABLE_ICON
 global $CONTENT_TOP_TABLE_ICON, $aa, $row, $content_pref, $content_icon_path, $qs, $mainparent;
-if($content_pref["content_top_icon_{$mainparent}"]){
-$width = (isset($content_pref["content_upload_icon_size_{$mainparent}"]) && $content_pref["content_upload_icon_size_{$mainparent}"] ? $content_pref["content_upload_icon_size_{$mainparent}"] : "100");
-return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon_{$mainparent}"]);
+if($content_pref["content_top_icon"]){
+$width = (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
+$width = (isset($content_pref["content_top_icon_width"]) && $content_pref["content_top_icon_width"] ? $content_pref["content_top_icon_width"] : $width);
+return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
 }
 SC_END
 
@@ -90,14 +110,14 @@
 $rating = "";
 $rating .= $row['rate_avg']." ";
 for($c=1; $c<= $tmp[0]; $c++){
-	$rating .= "<img src='".e_IMAGE."rate/box.png' alt='' style='height:8px; vertical-align:middle' />";
+	$rating .= "<img src='".e_IMAGE."rate/box.png' alt='' style='border:0; height:8px; vertical-align:middle' />";
 }
 if($tmp[0] < 10){
 	for($c=9; $c>=$tmp[0]; $c--){
-		$rating .= "<img src='".e_IMAGE."rate/empty.png' alt='' style='height:8px; vertical-align:middle' />";
+		$rating .= "<img src='".e_IMAGE."rate/empty.png' alt='' style='border:0; height:8px; vertical-align:middle' />";
 	}
 }
-$rating .= "<img src='".e_IMAGE."rate/boxend.png' alt='' style='height:8px; vertical-align:middle' />";
+$rating .= "<img src='".e_IMAGE."rate/boxend.png' alt='' style='border:0; height:8px; vertical-align:middle' />";
 return $rating;
 SC_END
 
@@ -109,9 +129,10 @@
 
 SC_BEGIN CONTENT_SCORE_TABLE_ICON
 global $CONTENT_SCORE_TABLE_ICON, $aa, $row, $content_pref, $content_icon_path, $qs, $mainparent;
-if(isset($content_pref["content_score_icon_{$mainparent}"]) && $content_pref["content_score_icon_{$mainparent}"]){
-$width = (isset($content_pref["content_upload_icon_size_{$mainparent}"]) && $content_pref["content_upload_icon_size_{$mainparent}"] ? $content_pref["content_upload_icon_size_{$mainparent}"] : "100");
-return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon_{$mainparent}"]);
+if(isset($content_pref["content_score_icon"]) && $content_pref["content_score_icon"]){
+$width = (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
+$width = (isset($content_pref["content_score_icon_width"]) && $content_pref["content_score_icon_width"] ? $content_pref["content_score_icon_width"] : $width);
+return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
 }
 SC_END
 
@@ -149,25 +170,45 @@
 
 SC_BEGIN CONTENT_SUBMIT_TYPE_TABLE_ICON
 global $CONTENT_SUBMIT_TYPE_TABLE_ICON, $aa, $row, $content_cat_icon_path_large, $content_pref;
-return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "content.submit.".$row['content_id'], "", $content_pref["content_blank_caticon_{$row['content_id']}"]);
+return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "content.submit.".$row['content_id'], "", $content_pref["content_blank_caticon"]);
 SC_END
 
 // CONTENT_CONTENT_TABLEMANAGER ------------------------------------------------
-SC_BEGIN CONTENT_CONTENTMANAGER_ICONNEW
-global $CONTENT_CONTENTMANAGER_ICONNEW, $row;
-return "<a href='".e_SELF."?content.create.".$row['content_id']."'>".CONTENT_ICON_NEW."</a>";
-SC_END
-
 SC_BEGIN CONTENT_CONTENTMANAGER_CATEGORY
-global $CONTENT_CONTENTMANAGER_CATEGORY, $row;
+global $CONTENT_CONTENTMANAGER_CATEGORY, $row, $content_pref;
+if( (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) || (isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])) ){
 return "<a href='".e_SELF."?content.".$row['content_id']."'>".$row['content_heading']."</a>";
+}
+SC_END
+
+SC_BEGIN CONTENT_CONTENTMANAGER_ICONNEW
+global $CONTENT_CONTENTMANAGER_ICONNEW, $row, $content_pref;
+if( (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
+return "<a href='".e_SELF."?content.create.".$row['content_id']."'>".CONTENT_ICON_NEW."</a>";
+//return "<input type='button' onclick=\"document.location='".e_SELF."?content.create.".$row['content_id']."'\" value='new' title='new' />";
+}
 SC_END
 
 SC_BEGIN CONTENT_CONTENTMANAGER_ICONEDIT
-global $CONTENT_CONTENTMANAGER_ICONEDIT, $row;
+global $CONTENT_CONTENTMANAGER_ICONEDIT, $row, $content_pref;
+if( (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
 return "<a href='".e_SELF."?content.".$row['content_id']."'>".CONTENT_ICON_EDIT."</a>";
+//return "<input type='button' onclick=\"document.location='".e_SELF."?content.".$row['content_id']."'\" value='edit' title='edit' />";
+}
+SC_END
+
+SC_BEGIN CONTENT_CONTENTMANAGER_ICONSUBM
+global $CONTENT_CONTENTMANAGER_ICONSUBM, $row, $content_pref, $plugintable;
+if(isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])){
+	if(!is_object($sqls)){ $sqls = new db; }
+	$num = $sqls -> db_Count($plugintable, "(*)", "WHERE content_refer = 'sa' AND content_parent='".intval($row['content_id'])."' ");
+	if($num>0){
+		return "<a href='".e_SELF."?content.submitted.".$row['content_id']."'>".CONTENT_ICON_SUBMIT_SMALL."</a>";
+	}
+}
 SC_END
 
+
 // CONTENT_AUTHOR_TABLE ------------------------------------------------
 SC_BEGIN CONTENT_AUTHOR_TABLE_NAME
 global $CONTENT_AUTHOR_TABLE_NAME, $authordetails, $i, $qs, $row;
@@ -183,7 +224,7 @@
 
 SC_BEGIN CONTENT_AUTHOR_TABLE_TOTAL
 global $CONTENT_AUTHOR_TABLE_TOTAL, $totalcontent, $mainparent, $content_pref;
-if($content_pref["content_author_amount_{$mainparent}"]){
+if($content_pref["content_author_amount"]){
 $CONTENT_AUTHOR_TABLE_TOTAL = $totalcontent." ".($totalcontent==1 ? CONTENT_LAN_53 : CONTENT_LAN_54);
 return $CONTENT_AUTHOR_TABLE_TOTAL;
 }
@@ -191,7 +232,7 @@
 
 SC_BEGIN CONTENT_AUTHOR_TABLE_LASTITEM
 global $CONTENT_AUTHOR_TABLE_LASTITEM, $gen, $row, $mainparent, $content_pref;
-if($content_pref["content_author_lastitem_{$mainparent}"]){
+if($content_pref["content_author_lastitem"]){
 if(!is_object($gen)){ $gen = new convert; }
 $CONTENT_AUTHOR_TABLE_LASTITEM = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "short"));
 $CONTENT_AUTHOR_TABLE_LASTITEM .= " : <a href='".e_SELF."?content.".$row['content_id']."'>".$row['content_heading']."</a>";
@@ -217,10 +258,10 @@
 
 SC_BEGIN CONTENT_CAT_TABLE_ICON
 global $CONTENT_CAT_TABLE_ICON, $aa, $totalitems, $row, $content_pref, $qs, $content_cat_icon_path_large, $mainparent;
-if(isset($content_pref["content_catall_icon_{$mainparent}"]) && $content_pref["content_catall_icon_{$mainparent}"]){
+if(isset($content_pref["content_catall_icon"]) && $content_pref["content_catall_icon"]){
 	//$qry = ($totalitems > 0 ? "cat.".$row['content_id'] : "");
 	$qry = "cat.".$row['content_id'];
-	return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, $qry, "", $content_pref["content_blank_caticon_{$mainparent}"]);
+	return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, $qry, "", $content_pref["content_blank_caticon"]);
 }
 SC_END
 
@@ -232,7 +273,7 @@
 
 SC_BEGIN CONTENT_CAT_TABLE_AMOUNT
 global $CONTENT_CAT_TABLE_AMOUNT, $aa, $row, $totalitems, $mainparent, $content_pref;
-if(isset($content_pref["content_catall_amount_{$mainparent}"]) && $content_pref["content_catall_amount_{$mainparent}"]){
+if(isset($content_pref["content_catall_amount"]) && $content_pref["content_catall_amount"]){
 $n = $totalitems;
 $CONTENT_CAT_TABLE_AMOUNT = $n." ".($n == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54);
 return $CONTENT_CAT_TABLE_AMOUNT;
@@ -241,14 +282,14 @@
 
 SC_BEGIN CONTENT_CAT_TABLE_SUBHEADING
 global $CONTENT_CAT_TABLE_SUBHEADING, $row, $tp, $mainparent, $content_pref;
-if(isset($content_pref["content_catall_subheading_{$mainparent}"]) && $content_pref["content_catall_subheading_{$mainparent}"]){
+if(isset($content_pref["content_catall_subheading"]) && $content_pref["content_catall_subheading"]){
 return ($row['content_subheading'] ? $tp -> toHTML($row['content_subheading'], TRUE, "") : "");
 }
 SC_END
 
 SC_BEGIN CONTENT_CAT_TABLE_DATE
 global $CONTENT_CAT_TABLE_DATE, $gen, $row, $mainparent, $content_pref, $gen;
-if(isset($content_pref["content_catall_date_{$mainparent}"]) && $content_pref["content_catall_date_{$mainparent}"]){
+if(isset($content_pref["content_catall_date"]) && $content_pref["content_catall_date"]){
 if(!is_object($gen)){ $gen = new convert; }
 $datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
 $DATE = ($datestamp != "" ? $datestamp : "");
@@ -264,7 +305,7 @@
 SC_BEGIN CONTENT_CAT_TABLE_EPICONS
 global $CONTENT_CAT_TABLE_EPICONS, $row, $tp, $mainparent, $content_pref;
 $EPICONS = "";
-if($row['content_pe'] && isset($content_pref["content_catall_peicon_{$mainparent}"]) && $content_pref["content_catall_peicon_{$mainparent}"]){
+if($row['content_pe'] && isset($content_pref["content_catall_peicon"]) && $content_pref["content_catall_peicon"]){
 	$EPICONS = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
 	$EPICONS .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
 	$EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
@@ -274,7 +315,7 @@
 
 SC_BEGIN CONTENT_CAT_TABLE_COMMENT
 global $CONTENT_CAT_TABLE_COMMENT, $row, $qs, $comment_total, $mainparent, $content_pref, $plugintable;
-if($row['content_comment'] && isset($content_pref["content_catall_comment_{$mainparent}"]) && $content_pref["content_catall_comment_{$mainparent}"]){
+if($row['content_comment'] && isset($content_pref["content_catall_comment"]) && $content_pref["content_catall_comment"]){
 $sqlc = new db;
 $comment_total = $sqlc -> db_Select("comments", "*",  "comment_item_id='".$row['content_id']."' AND comment_type='".$plugintable."' AND comment_pid='0' ");
 return "<a style='text-decoration:none;' href='".e_SELF."?cat.".$row['content_id'].".comment'>".CONTENT_LAN_57." ".$comment_total."</a>";
@@ -283,8 +324,8 @@
 
 SC_BEGIN CONTENT_CAT_TABLE_TEXT
 global $CONTENT_CAT_TABLE_TEXT, $row, $tp, $mainparent, $content_pref;
-if($row['content_text'] && isset($content_pref["content_catall_text_{$mainparent}"]) && $content_pref["content_catall_text_{$mainparent}"] && ($content_pref["content_catall_text_char_{$mainparent}"] > 0 || $content_pref["content_catall_text_char_{$mainparent}"] == 'all')){
-	if($content_pref["content_catall_text_char_{$mainparent}"] == 'all'){
+if($row['content_text'] && isset($content_pref["content_catall_text"]) && $content_pref["content_catall_text"] && ($content_pref["content_catall_text_char"] > 0 || $content_pref["content_catall_text_char"] == 'all')){
+	if($content_pref["content_catall_text_char"] == 'all'){
 		$CONTENT_CAT_TABLE_TEXT = $row['content_text'];
 	}else{
 		$rowtext = preg_replace("/\[newpage.*?]/si", " ", $row['content_text']);
@@ -292,11 +333,11 @@
 		
 		$rowtext = strip_tags($rowtext);
 		$words = explode(" ", $rowtext);
-		$CONTENT_CAT_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_catall_text_char_{$mainparent}"]));
-		if($content_pref["content_catall_text_link_{$mainparent}"]){
-			$CONTENT_CAT_TABLE_TEXT .= " <a href='".e_SELF."?cat.".$row['content_id']."'>".$content_pref["content_catall_text_post_{$mainparent}"]."</a>";
+		$CONTENT_CAT_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_catall_text_char"]));
+		if($content_pref["content_catall_text_link"]){
+			$CONTENT_CAT_TABLE_TEXT .= " <a href='".e_SELF."?cat.".$row['content_id']."'>".$content_pref["content_catall_text_post"]."</a>";
 		}else{
-			$CONTENT_CAT_TABLE_TEXT .= " ".$content_pref["content_catall_text_post_{$mainparent}"];
+			$CONTENT_CAT_TABLE_TEXT .= " ".$content_pref["content_catall_text_post"];
 		}
 	}
 return $CONTENT_CAT_TABLE_TEXT;
@@ -306,7 +347,7 @@
 SC_BEGIN CONTENT_CAT_TABLE_RATING
 global $CONTENT_CAT_TABLE_RATING, $row, $rater, $mainparent, $content_pref, $plugintable;
 $RATING = "";
-if($row['content_rate'] && isset($content_pref["content_catall_rating_{$mainparent}"]) && $content_pref["content_catall_rating_{$mainparent}"]){
+if($row['content_rate'] && isset($content_pref["content_catall_rating"]) && $content_pref["content_catall_rating"]){
 return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
 }
 return $RATING;
@@ -330,14 +371,14 @@
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_ICON
 global $CONTENT_CAT_LIST_TABLE_ICON, $aa, $row, $qs, $content_pref, $content_cat_icon_path_large, $mainparent;
-if(isset($content_pref["content_cat_icon_{$mainparent}"]) && $content_pref["content_cat_icon_{$mainparent}"]){
-return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "", "", $content_pref["content_blank_caticon_{$mainparent}"]);;
+if(isset($content_pref["content_cat_icon"]) && $content_pref["content_cat_icon"]){
+return $aa -> getIcon("catlarge", $row['content_icon'], $content_cat_icon_path_large, "", "", $content_pref["content_blank_caticon"]);;
 }
 SC_END
 
 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']."'>".$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, "") );
 SC_END
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_SUMMARY
@@ -347,8 +388,8 @@
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_TEXT
 global $CONTENT_CAT_LIST_TABLE_TEXT, $tp, $row, $mainparent, $content_pref;
-if($row['content_text'] && isset($content_pref["content_cat_text_{$mainparent}"]) && $content_pref["content_cat_text_{$mainparent}"] && ($content_pref["content_cat_text_char_{$mainparent}"] > 0 || $content_pref["content_cat_text_char_{$mainparent}"] == 'all')){
-	if($content_pref["content_cat_text_char_{$mainparent}"] == 'all'){
+if($row['content_text'] && isset($content_pref["content_cat_text"]) && $content_pref["content_cat_text"] && ($content_pref["content_cat_text_char"] > 0 || $content_pref["content_cat_text_char"] == 'all')){
+	if($content_pref["content_cat_text_char"] == 'all'){
 		//$CONTENT_CAT_LIST_TABLE_TEXT = $row['content_text'];
 		$CONTENT_CAT_LIST_TABLE_TEXT = $tp->toHTML($row['content_text'], TRUE, "constants");
 	}else{
@@ -357,11 +398,11 @@
 		
 		$rowtext = strip_tags($rowtext);
 		$words = explode(" ", $rowtext);
-		$CONTENT_CAT_LIST_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_cat_text_char_{$mainparent}"]));
-		if($content_pref["content_cat_text_link_{$mainparent}"]){
-			$CONTENT_CAT_LIST_TABLE_TEXT .= " <a href='".e_SELF."?cat.".$row['content_id']."'>".$content_pref["content_cat_text_post_{$mainparent}"]."</a>";
+		$CONTENT_CAT_LIST_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_cat_text_char"]));
+		if($content_pref["content_cat_text_link"]){
+			$CONTENT_CAT_LIST_TABLE_TEXT .= " <a href='".e_SELF."?cat.".$row['content_id'].".view'>".$content_pref["content_cat_text_post"]."</a>";
 		}else{
-			$CONTENT_CAT_LIST_TABLE_TEXT .= " ".$content_pref["content_cat_text_post_{$mainparent}"];
+			$CONTENT_CAT_LIST_TABLE_TEXT .= " ".$content_pref["content_cat_text_post"];
 		}
 	}
 return $CONTENT_CAT_LIST_TABLE_TEXT;
@@ -370,7 +411,7 @@
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_AMOUNT
 global $CONTENT_CAT_LIST_TABLE_AMOUNT, $aa, $row, $mainparent, $content_pref, $totalparent;
-if(isset($content_pref["content_cat_amount_{$mainparent}"]) && $content_pref["content_cat_amount_{$mainparent}"]){
+if(isset($content_pref["content_cat_amount"]) && $content_pref["content_cat_amount"]){
 $n = $totalparent;
 $n = $n." ".($n == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54);
 return $n;
@@ -379,14 +420,14 @@
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_SUBHEADING
 global $CONTENT_CAT_LIST_TABLE_SUBHEADING, $tp, $row, $mainparent, $content_pref;
-if(isset($content_pref["content_cat_subheading_{$mainparent}"]) && $content_pref["content_cat_subheading_{$mainparent}"]){
+if(isset($content_pref["content_cat_subheading"]) && $content_pref["content_cat_subheading"]){
 return ($row['content_subheading'] ? $tp -> toHTML($row['content_subheading'], TRUE, "") : "");
 }
 SC_END
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_DATE
 global $CONTENT_CAT_LIST_TABLE_DATE, $row, $gen, $mainparent, $content_pref, $gen;
-if(isset($content_pref["content_cat_date_{$mainparent}"]) && $content_pref["content_cat_date_{$mainparent}"]){
+if(isset($content_pref["content_cat_date"]) && $content_pref["content_cat_date"]){
 if(!is_object($gen)){ $gen = new convert; }
 $datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
 return ($datestamp != "" ? $datestamp : "");
@@ -401,7 +442,7 @@
 SC_BEGIN CONTENT_CAT_LIST_TABLE_EPICONS
 global $CONTENT_CAT_LIST_TABLE_EPICONS, $row, $tp, $qs, $mainparent, $content_pref;
 $EPICONS = "";
-if( (isset($content_pref["content_cat_peicon_{$mainparent}"]) && $content_pref["content_cat_peicon_{$mainparent}"] && $row['content_pe']) || (isset($content_pref["content_cat_peicon_all_{$mainparent}"]) && $content_pref["content_cat_peicon_all_{$mainparent}"])){
+if( (isset($content_pref["content_cat_peicon"]) && $content_pref["content_cat_peicon"] && $row['content_pe']) || (isset($content_pref["content_cat_peicon_all"]) && $content_pref["content_cat_peicon_all"])){
 	$EPICONS = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
 	$EPICONS .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
 	$EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.$qs[1]}");
@@ -411,7 +452,7 @@
 
 SC_BEGIN CONTENT_CAT_LIST_TABLE_COMMENT
 global $CONTENT_CAT_LIST_TABLE_COMMENT, $qs, $row, $comment_total, $mainparent, $content_pref, $sql, $plugintable;
-if($row['content_comment'] && isset($content_pref["content_cat_comment_{$mainparent}"]) && $content_pref["content_cat_comment_{$mainparent}"]){
+if($row['content_comment'] && isset($content_pref["content_cat_comment"]) && $content_pref["content_cat_comment"]){
 	$comment_total = $sql -> db_Count("comments", "(*)",  "WHERE comment_item_id='".intval($qs[1])."' AND comment_type='".$plugintable."' AND comment_pid='0' ");
 	return "<a style='text-decoration:none;' href='".e_SELF."?cat.".$qs[1].".comment'>".CONTENT_LAN_57." ".$comment_total."</a>";
 }
@@ -420,7 +461,7 @@
 SC_BEGIN CONTENT_CAT_LIST_TABLE_RATING
 global $CONTENT_CAT_LIST_TABLE_RATING, $row, $rater, $content_pref, $mainparent, $plugintable;
 $RATING = "";
-if( (isset($content_pref["content_cat_rating_all_{$mainparent}"]) && $content_pref["content_cat_rating_all_{$mainparent}"]) || (isset($content_pref["content_cat_rating_{$mainparent}"]) && $content_pref["content_cat_rating_{$mainparent}"] && $row['content_rate'])){
+if( (isset($content_pref["content_cat_rating_all"]) && $content_pref["content_cat_rating_all"]) || (isset($content_pref["content_cat_rating"]) && $content_pref["content_cat_rating"] && $row['content_rate'])){
 	return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
 }
 return $RATING;
@@ -429,8 +470,8 @@
 // CONTENT_CAT_LISTSUB ------------------------------------------------
 SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_ICON
 global $CONTENT_CAT_LISTSUB_TABLE_ICON, $aa, $row, $content_pref, $qs, $mainparent, $content_cat_icon_path_small;
-if(isset($content_pref["content_catsub_icon_{$mainparent}"]) && $content_pref["content_catsub_icon_{$mainparent}"]){
-return $aa -> getIcon("catsmall", $row['content_icon'], $content_cat_icon_path_small, "cat.".$row['content_id'], "", $content_pref["content_blank_caticon_{$mainparent}"]);
+if(isset($content_pref["content_catsub_icon"]) && $content_pref["content_catsub_icon"]){
+return $aa -> getIcon("catsmall", $row['content_icon'], $content_cat_icon_path_small, "cat.".$row['content_id'], "", $content_pref["content_blank_caticon"]);
 }
 SC_END
 
@@ -441,7 +482,7 @@
 
 SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_AMOUNT
 global $CONTENT_CAT_LISTSUB_TABLE_AMOUNT, $aa, $row, $content_pref, $mainparent, $totalsubcat;
-if(isset($content_pref["content_catsub_amount_{$mainparent}"]) && $content_pref["content_catsub_amount_{$mainparent}"]){
+if(isset($content_pref["content_catsub_amount"]) && $content_pref["content_catsub_amount"]){
 $n = $totalsubcat;
 $n = $n." ".($n == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54);
 return $n;
@@ -450,7 +491,7 @@
 
 SC_BEGIN CONTENT_CAT_LISTSUB_TABLE_SUBHEADING
 global $CONTENT_CAT_LISTSUB_TABLE_SUBHEADING, $row, $tp, $content_pref, $mainparent;
-if(isset($content_pref["content_catsub_subheading_{$mainparent}"]) && $content_pref["content_catsub_subheading_{$mainparent}"]){
+if(isset($content_pref["content_catsub_subheading"]) && $content_pref["content_catsub_subheading"]){
 return ($row['content_subheading'] ? $tp -> toHTML($row['content_subheading'], TRUE, "") : "");
 }
 SC_END
@@ -474,8 +515,8 @@
 // CONTENT_SEARCHRESULT_TABLE ------------------------------------------------
 SC_BEGIN CONTENT_SEARCHRESULT_TABLE_ICON
 global $CONTENT_SEARCHRESULT_TABLE_ICON, $aa, $row, $content_icon_path, $qs, $content_pref, $mainparent;
-$width = (isset($content_pref["content_upload_icon_size_{$mainparent}"]) && $content_pref["content_upload_icon_size_{$mainparent}"] ? $content_pref["content_upload_icon_size_{$mainparent}"] : "100");
-return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon_{$mainparent}"]);
+$width = (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
+return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
 SC_END
 
 SC_BEGIN CONTENT_SEARCHRESULT_TABLE_HEADING
@@ -534,9 +575,9 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_ICON
 global $CONTENT_RECENT_TABLE_ICON, $aa, $row, $content_icon_path, $content_pref, $mainparent;
-if(isset($content_pref["content_list_icon_{$mainparent}"]) && $content_pref["content_list_icon_{$mainparent}"]){
-$width = (isset($content_pref["content_upload_icon_size_{$mainparent}"]) && $content_pref["content_upload_icon_size_{$mainparent}"] ? $content_pref["content_upload_icon_size_{$mainparent}"] : "100");
-return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon_{$mainparent}"]);
+if(isset($content_pref["content_list_icon"]) && $content_pref["content_list_icon"]){
+$width = (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
+return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "content.".$row['content_id'], $width, $content_pref["content_blank_icon"]);
 }
 SC_END
 
@@ -547,9 +588,9 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_SUBHEADING
 global $CONTENT_RECENT_TABLE_SUBHEADING, $tp, $content_pref, $qs, $row, $mainparent;
-if (isset($content_pref["content_list_subheading_{$mainparent}"]) && $content_pref["content_list_subheading_{$mainparent}"] && $row['content_subheading'] && $content_pref["content_list_subheading_char_{$mainparent}"] && $content_pref["content_list_subheading_char_{$mainparent}"] != "" && $content_pref["content_list_subheading_char_{$mainparent}"] != "0"){
-	if(strlen($row['content_subheading']) > $content_pref["content_list_subheading_char_{$mainparent}"]) {
-		$row['content_subheading'] = substr($row['content_subheading'], 0, $content_pref["content_list_subheading_char_{$mainparent}"]).$content_pref["content_list_subheading_post_{$mainparent}"];
+if (isset($content_pref["content_list_subheading"]) && $content_pref["content_list_subheading"] && $row['content_subheading'] && $content_pref["content_list_subheading_char"] && $content_pref["content_list_subheading_char"] != "" && $content_pref["content_list_subheading_char"] != "0"){
+	if(strlen($row['content_subheading']) > $content_pref["content_list_subheading_char"]) {
+		$row['content_subheading'] = substr($row['content_subheading'], 0, $content_pref["content_list_subheading_char"]).$content_pref["content_list_subheading_post"];
 	}
 	$CONTENT_RECENT_TABLE_SUBHEADING = ($row['content_subheading'] != "" && $row['content_subheading'] != " " ? $row['content_subheading'] : "");
 }else{
@@ -560,10 +601,10 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_SUMMARY
 global $CONTENT_RECENT_TABLE_SUMMARY, $content_pref, $tp, $qs, $row, $mainparent;
-if (isset($content_pref["content_list_summary_{$mainparent}"]) && $content_pref["content_list_summary_{$mainparent}"]){
-	if($row['content_summary'] && $content_pref["content_list_summary_char_{$mainparent}"] && $content_pref["content_list_summary_char_{$mainparent}"] != "" && $content_pref["content_list_summary_char_{$mainparent}"] != "0"){
-		if(strlen($row['content_summary']) > $content_pref["content_list_summary_char_{$mainparent}"]) {
-			$row['content_summary'] = substr($row['content_summary'], 0, $content_pref["content_list_summary_char_{$mainparent}"]).$content_pref["content_list_summary_post_{$mainparent}"];
+if (isset($content_pref["content_list_summary"]) && $content_pref["content_list_summary"]){
+	if($row['content_summary'] && $content_pref["content_list_summary_char"] && $content_pref["content_list_summary_char"] != "" && $content_pref["content_list_summary_char"] != "0"){
+		if(strlen($row['content_summary']) > $content_pref["content_list_summary_char"]) {
+			$row['content_summary'] = substr($row['content_summary'], 0, $content_pref["content_list_summary_char"]).$content_pref["content_list_summary_post"];
 		}
 		$CONTENT_RECENT_TABLE_SUMMARY = ($row['content_summary'] != "" && $row['content_summary'] != " " ? $row['content_summary'] : "");
 	}else{
@@ -575,18 +616,18 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_TEXT
 global $CONTENT_RECENT_TABLE_TEXT, $content_pref, $qs, $row, $mainparent, $tp;
-if(isset($content_pref["content_list_text_{$mainparent}"]) && $content_pref["content_list_text_{$mainparent}"] && $content_pref["content_list_text_char_{$mainparent}"] > 0){
+if(isset($content_pref["content_list_text"]) && $content_pref["content_list_text"] && $content_pref["content_list_text_char"] > 0){
 	$rowtext = preg_replace("/\[newpage.*?]/si", " ", $row['content_text']);
 	//$rowtext = str_replace ("<br />", " ", $rowtext);
 	$rowtext = $tp->toHTML($rowtext, TRUE, "nobreak");
 	$rowtext = strip_tags($rowtext);
 	$words = explode(" ", $rowtext);
-	$CONTENT_RECENT_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_list_text_char_{$mainparent}"]));
+	$CONTENT_RECENT_TABLE_TEXT = implode(" ", array_slice($words, 0, $content_pref["content_list_text_char"]));
 	if($CONTENT_RECENT_TABLE_TEXT){
-		if($content_pref["content_list_text_link_{$mainparent}"]){
-			$CONTENT_RECENT_TABLE_TEXT .= " <a href='".e_SELF."?content.".$row['content_id']."'>".$content_pref["content_list_text_post_{$mainparent}"]."</a>";
+		if($content_pref["content_list_text_link"]){
+			$CONTENT_RECENT_TABLE_TEXT .= " <a href='".e_SELF."?content.".$row['content_id']."'>".$content_pref["content_list_text_post"]."</a>";
 		}else{
-			$CONTENT_RECENT_TABLE_TEXT .= " ".$content_pref["content_list_text_post_{$mainparent}"];
+			$CONTENT_RECENT_TABLE_TEXT .= " ".$content_pref["content_list_text_post"];
 		}
 	}
 }
@@ -595,8 +636,8 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_DATE
 global $CONTENT_RECENT_TABLE_DATE, $content_pref, $qs, $row, $mainparent;
-if(isset($content_pref["content_list_date_{$mainparent}"]) && $content_pref["content_list_date_{$mainparent}"]){
-$datestyle = ($content_pref["content_list_datestyle_{$mainparent}"] ? $content_pref["content_list_datestyle_{$mainparent}"] : "%d %b %Y");
+if(isset($content_pref["content_list_date"]) && $content_pref["content_list_date"]){
+$datestyle = ($content_pref["content_list_datestyle"] ? $content_pref["content_list_datestyle"] : "%d %b %Y");
 return strftime($datestyle, $row['content_datestamp']);
 }
 SC_END
@@ -604,8 +645,8 @@
 SC_BEGIN CONTENT_RECENT_TABLE_EPICONS
 global $CONTENT_RECENT_TABLE_EPICONS, $tp, $content_pref, $qs, $row, $mainparent;
 $CONTENT_RECENT_TABLE_EPICONS = "";
-if(isset($content_pref["content_list_peicon_{$mainparent}"]) && $content_pref["content_list_peicon_{$mainparent}"]){
-	if($row['content_pe'] || isset($content_pref["content_list_peicon_all_{$mainparent}"]) && $content_pref["content_list_peicon_all_{$mainparent}"]){
+if(isset($content_pref["content_list_peicon"]) && $content_pref["content_list_peicon"]){
+	if($row['content_pe'] || isset($content_pref["content_list_peicon_all"]) && $content_pref["content_list_peicon_all"]){
 		$CONTENT_RECENT_TABLE_EPICONS = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
 		$CONTENT_RECENT_TABLE_EPICONS .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
 		$CONTENT_RECENT_TABLE_EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
@@ -621,14 +662,14 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_EDITICON
 global $CONTENT_RECENT_TABLE_EDITICON, $content_pref, $qs, $row, $mainparent, $plugindir;
-if(ADMIN && getperms("P") && isset($content_pref["content_list_editicon_{$mainparent}"]) && $content_pref["content_list_editicon_{$mainparent}"]){
+if(ADMIN && getperms("P") && isset($content_pref["content_list_editicon"]) && $content_pref["content_list_editicon"]){
 return $CONTENT_RECENT_TABLE_EDITICON = "<a href='".$plugindir."admin_content_config.php?content.edit.".$row['content_id']."'>".CONTENT_ICON_EDIT."</a>";
 }
 SC_END
 
 SC_BEGIN CONTENT_RECENT_TABLE_REFER
 global $CONTENT_RECENT_TABLE_REFER, $content_pref, $qs, $row, $mainparent;
-if($content_pref["content_log_{$mainparent}"] && $content_pref["content_list_refer_{$mainparent}"]){
+if($content_pref["content_log"] && $content_pref["content_list_refer"]){
 	$refercounttmp = explode("^", $row['content_refer']);
 	$CONTENT_RECENT_TABLE_REFER = ($refercounttmp[0] ? $refercounttmp[0] : "0");
 	if($CONTENT_RECENT_TABLE_REFER > 0){
@@ -639,8 +680,8 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_RATING
 global $CONTENT_RECENT_TABLE_RATING, $rater, $row, $qs, $content_pref, $plugintable, $mainparent;
-if($content_pref["content_list_rating_{$mainparent}"]){
-	if($content_pref["content_list_rating_all_{$mainparent}"] || $row['content_rate']){
+if($content_pref["content_list_rating"]){
+	if($content_pref["content_list_rating_all"] || $row['content_rate']){
 		return $rater->composerating($plugintable, $row['content_id'], $enter=FALSE, $userid=FALSE);
 	}
 }
@@ -648,7 +689,7 @@
 
 SC_BEGIN CONTENT_RECENT_TABLE_PARENT
 global $CONTENT_RECENT_TABLE_PARENT, $content_pref, $mainparent, $row, $array, $aa;
-if(isset($content_pref["content_list_parent_{$mainparent}"]) && $content_pref["content_list_parent_{$mainparent}"]){
+if(isset($content_pref["content_list_parent"]) && $content_pref["content_list_parent"]){
 return $aa -> getCrumbItem($row['content_parent'], $array);
 }
 SC_END
@@ -656,7 +697,7 @@
 // CONTENT_ARCHIVE_TABLE ------------------------------------------------
 SC_BEGIN CONTENT_ARCHIVE_TABLE_LETTERS
 global $CONTENT_ARCHIVE_TABLE_LETTERS, $content_pref, $mainparent;
-if($content_pref["content_archive_letterindex_{$mainparent}"]){
+if($content_pref["content_archive_letterindex"]){
 return $CONTENT_ARCHIVE_TABLE_LETTERS;
 }
 SC_END
@@ -668,8 +709,8 @@
 
 SC_BEGIN CONTENT_ARCHIVE_TABLE_DATE
 global $CONTENT_ARCHIVE_TABLE_DATE, $row, $content_pref, $qs, $mainparent;
-if(isset($content_pref["content_archive_date_{$mainparent}"]) && $content_pref["content_archive_date_{$mainparent}"]){
-$datestyle = ($content_pref["content_archive_datestyle_{$mainparent}"] ? $content_pref["content_archive_datestyle_{$mainparent}"] : "%d %b %Y");
+if(isset($content_pref["content_archive_date"]) && $content_pref["content_archive_date"]){
+$datestyle = ($content_pref["content_archive_datestyle"] ? $content_pref["content_archive_datestyle"] : "%d %b %Y");
 return strftime($datestyle, $row['content_datestamp']);
 }
 SC_END
@@ -712,16 +753,16 @@
 
 SC_BEGIN CONTENT_CONTENT_TABLE_PARENT
 global $CONTENT_CONTENT_TABLE_PARENT, $aa, $array, $row, $content_pref, $mainparent;
-if(isset($content_pref["content_content_parent_{$mainparent}"]) && $content_pref["content_content_parent_{$mainparent}"]){
+if(isset($content_pref["content_content_parent"]) && $content_pref["content_content_parent"]){
 return $aa -> getCrumbItem($row['content_parent'], $array);
 }
 SC_END
 
 SC_BEGIN CONTENT_CONTENT_TABLE_ICON
 global $CONTENT_CONTENT_TABLE_ICON, $qs, $row, $aa, $content_pref, $content_icon_path, $mainparent;
-if(isset($content_pref["content_content_icon_{$mainparent}"]) && $content_pref["content_content_icon_{$mainparent}"]){
-$width = (isset($content_pref["content_upload_icon_size_{$mainparent}"]) && $content_pref["content_upload_icon_size_{$mainparent}"] ? $content_pref["content_upload_icon_size_{$mainparent}"] : "100");
-return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "", $width, $content_pref["content_blank_icon_{$mainparent}"]);
+if(isset($content_pref["content_content_icon"]) && $content_pref["content_content_icon"]){
+$width = (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
+return $aa -> getIcon("item", $row['content_icon'], $content_icon_path, "", $width, $content_pref["content_blank_icon"]);
 }
 SC_END
 
@@ -733,7 +774,7 @@
 
 SC_BEGIN CONTENT_CONTENT_TABLE_REFER
 global $CONTENT_CONTENT_TABLE_REFER, $sql, $qs, $content_pref, $plugintable, $mainparent;
-if(isset($content_pref["content_content_refer_{$mainparent}"]) && $content_pref["content_content_refer_{$mainparent}"]){
+if(isset($content_pref["content_content_refer"]) && $content_pref["content_content_refer"]){
 	$sql -> db_Select($plugintable, "content_refer", "content_id='".intval($qs[1])."' ");
 	list($content_refer) = $sql -> db_Fetch();
 	$refercounttmp = explode("^", $content_refer);
@@ -744,20 +785,20 @@
 
 SC_BEGIN CONTENT_CONTENT_TABLE_SUBHEADING
 global $CONTENT_CONTENT_TABLE_SUBHEADING, $row, $tp, $content_pref, $qs, $mainparent;
-$CONTENT_CONTENT_TABLE_SUBHEADING = ($content_pref["content_content_subheading_{$mainparent}"] && $row['content_subheading'] ? $tp -> toHTML($row['content_subheading'], TRUE, "") : "");
+$CONTENT_CONTENT_TABLE_SUBHEADING = ($content_pref["content_content_subheading"] && $row['content_subheading'] ? $tp -> toHTML($row['content_subheading'], TRUE, "") : "");
 return $CONTENT_CONTENT_TABLE_SUBHEADING;
 SC_END
 
 SC_BEGIN CONTENT_CONTENT_TABLE_COMMENT
 global $CONTENT_CONTENT_TABLE_COMMENT, $cobj, $qs, $content_pref, $mainparent, $row, $plugintable;
-if((isset($content_pref["content_content_comment_{$mainparent}"]) && $content_pref["content_content_comment_{$mainparent}"] && $row['content_comment']) || $content_pref["content_content_comment_all_{$mainparent}"] ){
+if((isset($content_pref["content_content_comment"]) && $content_pref["content_content_comment"] && $row['content_comment']) || $content_pref["content_content_comment_all"] ){
 return $cobj -> count_comments($plugintable, $qs[1]);
 }
 SC_END
 
 SC_BEGIN CONTENT_CONTENT_TABLE_DATE
 global $CONTENT_CONTENT_TABLE_DATE, $gen, $row, $qs, $content_pref, $mainparent;
-if(isset($content_pref["content_content_date_{$mainparent}"]) && $content_pref["content_content_date_{$mainparent}"]){
+if(isset($content_pref["content_content_date"]) && $content_pref["content_content_date"]){
 	$gen = new convert;
 	$datestamp = preg_replace("# -.*#", "", $gen -> convert_date($row['content_datestamp'], "long"));
 	$CONTENT_CONTENT_TABLE_DATE = ($datestamp != "" ? $datestamp : "");
@@ -773,7 +814,7 @@
 SC_BEGIN CONTENT_CONTENT_TABLE_EPICONS
 global $CONTENT_CONTENT_TABLE_EPICONS, $content_pref, $qs, $row, $tp, $mainparent;
 $CONTENT_CONTENT_TABLE_EPICONS = "";
-if(($content_pref["content_content_peicon_{$mainparent}"] && $row['content_pe']) || $content_pref["content_content_peicon_all_{$mainparent}"]){
+if(($content_pref["content_content_peicon"] && $row['content_pe']) || $content_pref["content_content_peicon_all"]){
 	$CONTENT_CONTENT_TABLE_EPICONS = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
 	$CONTENT_CONTENT_TABLE_EPICONS .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
 	$CONTENT_CONTENT_TABLE_EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
@@ -783,7 +824,7 @@
 
 SC_BEGIN CONTENT_CONTENT_TABLE_EDITICON
 global $CONTENT_CONTENT_TABLE_EDITICON, $content_pref, $qs, $row, $plugindir, $mainparent;
-if(ADMIN && getperms("P") && isset($content_pref["content_content_editicon_{$mainparent}"])){
+if(ADMIN && getperms("P") && isset($content_pref["content_content_editicon"])){
 	$CONTENT_CONTENT_TABLE_EDITICON = "<a href='".$plugindir."admin_content_config.php?content.edit.".$row['content_id']."'>".CONTENT_ICON_EDIT."</a>";
 return $CONTENT_CONTENT_TABLE_EDITICON;
 }
@@ -791,14 +832,14 @@
 
 SC_BEGIN CONTENT_CONTENT_TABLE_RATING
 global $CONTENT_CONTENT_TABLE_RATING, $content_pref, $qs, $row, $rater, $plugintable, $mainparent;
-if(($content_pref["content_content_rating_{$mainparent}"] && $row['content_rate']) || $content_pref["content_content_rating_all_{$mainparent}"] ){
+if(($content_pref["content_content_rating"] && $row['content_rate']) || $content_pref["content_content_rating_all"] ){
 return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
 }
 SC_END
 
 SC_BEGIN CONTENT_CONTENT_TABLE_FILE
 global $CONTENT_CONTENT_TABLE_FILE, $row, $content_file_path, $content_pref, $mainparent;
-if($content_pref["content_content_attach_{$mainparent}"]){
+if($content_pref["content_content_attach"]){
 $filestmp = explode("[file]", $row['content_file']);
 foreach($filestmp as $key => $value) { 
 	if($value == "") { 
@@ -852,7 +893,7 @@
 
 SC_BEGIN CONTENT_CONTENT_TABLE_IMAGES
 global $CONTENT_CONTENT_TABLE_IMAGES, $row, $content_image_path, $aa, $tp, $authordetails, $content_pref, $mainparent;
-if($content_pref["content_content_images_{$mainparent}"]){
+if($content_pref["content_content_images"]){
 $authordetails = $aa -> getAuthor($row['content_author']);
 $imagestmp = explode("[img]", $row['content_image']);
 foreach($imagestmp as $key => $value) { 
@@ -871,9 +912,9 @@
 	$oSrc = $content_image_path.$images[$i];
 	$oSrcThumb = $content_image_path."thumb_".$images[$i];
 
-	$oIconWidth = (isset($content_pref["content_upload_image_size_thumb_{$mainparent}"]) && $content_pref["content_upload_image_size_thumb_{$mainparent}"] ? $content_pref["content_upload_image_size_thumb_{$mainparent}"] : "100");
+	$oIconWidth = (isset($content_pref["content_upload_image_size_thumb"]) && $content_pref["content_upload_image_size_thumb"] ? $content_pref["content_upload_image_size_thumb"] : "100");
 	
-	$oMaxWidth = (isset($content_pref["content_upload_image_size_{$mainparent}"]) && $content_pref["content_upload_image_size_{$mainparent}"] ? $content_pref["content_upload_image_size_{$mainparent}"] : "500");
+	$oMaxWidth = (isset($content_pref["content_upload_image_size"]) && $content_pref["content_upload_image_size"] ? $content_pref["content_upload_image_size"] : "500");
 	
 	$subheading	= $tp -> toHTML($row['content_subheading'], TRUE);
 	$popupname	= $tp -> toHTML($content_image_popup_name, TRUE);
@@ -896,6 +937,15 @@
 return $CONTENT_CONTENT_TABLE_PAGENAMES;
 SC_END
 
+SC_BEGIN CONTENT_CONTENT_TABLE_NEXT_PAGE
+global $CONTENT_CONTENT_TABLE_NEXT_PAGE;
+return $CONTENT_CONTENT_TABLE_NEXT_PAGE;
+SC_END
+
+SC_BEGIN CONTENT_CONTENT_TABLE_PREV_PAGE
+global $CONTENT_CONTENT_TABLE_PREV_PAGE;
+return $CONTENT_CONTENT_TABLE_PREV_PAGE;
+SC_END
 
 
 
@@ -905,7 +955,7 @@
 //content images (from uploaded area) used in the print page
 SC_BEGIN CONTENT_PRINT_IMAGES
 global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $tp, $content_pref, $mainparent;
-if($content_pref["content_content_images_{$mainparent}"]){
+if($content_pref["content_content_images"]){
 $imagestmp = explode("[img]", $row['content_image']);
 foreach($imagestmp as $key => $value) { 
 	if($value == "") { 
@@ -918,9 +968,9 @@
 	$oSrc = $content_image_path.$images[$i];
 	$oSrcThumb = $content_image_path."thumb_".$images[$i];
 
-	$iconwidth = (isset($content_pref["content_upload_image_size_thumb_{$mainparent}"]) && $content_pref["content_upload_image_size_thumb_{$mainparent}"] ? $content_pref["content_upload_image_size_thumb_{$mainparent}"] : "100");
+	$iconwidth = (isset($content_pref["content_upload_image_size_thumb"]) && $content_pref["content_upload_image_size_thumb"] ? $content_pref["content_upload_image_size_thumb"] : "100");
 	if($iconwidth){
-		$iconwidth = "width:".$iconwidth."px;";
+		$style = "style='width:".$iconwidth."px;'";
 	}
 	
 	//use $image if $thumb doesn't exist
@@ -930,7 +980,7 @@
 		}else{
 			$thumb = $oSrcThumb;
 		}
-		$CONTENT_PRINT_IMAGES .= "<img src='".$thumb."' style='border:1px solid #000; ".$iconwidth."' alt='' /><br /><br />";
+		$CONTENT_PRINT_IMAGES .= "<img src='".$thumb."' ".$style." alt='' /><br /><br />";
 	}
 }
 return $CONTENT_PRINT_IMAGES;
@@ -943,7 +993,7 @@
 //content images (from uploaded area) used in the pdf creation
 SC_BEGIN CONTENT_PDF_IMAGES
 global $CONTENT_PDF_IMAGES, $row, $content_image_path, $tp, $content_pref, $mainparent;
-if($content_pref["content_content_images_{$mainparent}"]){
+if($content_pref["content_content_images"]){
 $imagestmp = explode("[img]", $row['content_image']);
 foreach($imagestmp as $key => $value) { 
 	if($value == "") { 
@@ -956,9 +1006,9 @@
 	$oSrc = $content_image_path.$images[$i];
 	$oSrcThumb = $content_image_path."thumb_".$images[$i];
 
-	$iconwidth = (isset($content_pref["content_upload_image_size_thumb_{$mainparent}"]) && $content_pref["content_upload_image_size_thumb_{$mainparent}"] ? $content_pref["content_upload_image_size_thumb_{$mainparent}"] : "100");
+	$iconwidth = (isset($content_pref["content_upload_image_size_thumb"]) && $content_pref["content_upload_image_size_thumb"] ? $content_pref["content_upload_image_size_thumb"] : "100");
 	if($iconwidth){
-		$iconwidth = "width:".$iconwidth."px;";
+		$style = "style='width:".$iconwidth."px;'";
 	}
 	
 	//use $image if $thumb doesn't exist
@@ -969,7 +1019,7 @@
 			$thumb = $oSrcThumb;
 		}
 		$thumb = $oSrc;
-		$CONTENT_PDF_IMAGES .= "<img src='".$thumb."' style='border:1px solid #000; ".$iconwidth."' alt='' />";
+		$CONTENT_PDF_IMAGES .= "<img src='".$thumb."' ".$style." alt='' />";
 	}
 }
 return $CONTENT_PDF_IMAGES;
diff -ruN 0.7.5/e107_plugins/content/content_submit.php 0.7.7/e107_plugins/content/content_submit.php
--- 0.7.5/e107_plugins/content/content_submit.php	2006-02-13 04:13:22.000000000 -0600
+++ 0.7.7/e107_plugins/content/content_submit.php	2006-07-28 09:07:14.000000000 -0500
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_submit.php,v $
-|		$Revision: 1.20 $
-|		$Date: 2006/02/13 10:13:22 $
+|		$Revision: 1.24 $
+|		$Date: 2006/07/28 14:07:14 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -39,7 +39,19 @@
 
 //these have to be set for the tinymce wysiwyg
 $e_wysiwyg	= "content_text";
-$WYSIWYG	= true;
+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;
 
@@ -53,10 +65,6 @@
 // define e_pagetitle
 $aa -> setPageTitle();
 
-//include js
-//function headerjs(){
-//}
-
 require_once(HEADERF);
 
 if(isset($_POST['create_content'])){
@@ -88,9 +96,12 @@
 	if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_icon, content_pref", "content_parent = '0' AND content_class REGEXP '".e_CLASS_REGEXP."' ORDER BY content_heading")){
 		$text .= "<div style='text-align:center;'>".CONTENT_ADMIN_SUBMIT_LAN_0."</div>";
 	}else{
-		
 		if(!isset($CONTENT_SUBMIT_TYPE_TABLE)){
-			require_once($plugindir."templates/content_submit_type_template.php");
+			if(is_readable(e_THEME.$pref['sitetheme']."/content/content_submit_type_template.php")){
+				require_once(e_THEME.$pref['sitetheme']."/content/content_submit_type_template.php");
+			}else{
+				require_once(e_PLUGIN."content/templates/content_submit_type_template.php");
+			}
 		}
 		$sql2 = "";
 		$content_submit_type_table_string = "";
@@ -99,12 +110,12 @@
 			if(!is_object($sql2)){ $sql2 = new db; }
 
 			$content_pref					= $eArrayStorage->ReadArray($row['content_pref']);
-			$content_pref["content_cat_icon_path_large_{$row['content_id']}"] = ($content_pref["content_cat_icon_path_large_{$row['content_id']}"] ? $content_pref["content_cat_icon_path_large_{$row['content_id']}"] : "{e_PLUGIN}content/images/cat/48/" );
-			$content_pref["content_cat_icon_path_small_{$row['content_id']}"] = ($content_pref["content_cat_icon_path_small_{$row['content_id']}"] ? $content_pref["content_cat_icon_path_small_{$row['content_id']}"] : "{e_PLUGIN}content/images/cat/16/" );
-			$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$row['content_id']}"]);
-			$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$row['content_id']}"]);
-			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$row['content_id']}"]);
-			if($content_pref["content_submit_{$row['content_id']}"] && check_class($content_pref["content_submit_class_{$row['content_id']}"])){
+			$content_pref["content_cat_icon_path_large"] = ($content_pref["content_cat_icon_path_large"] ? $content_pref["content_cat_icon_path_large"] : "{e_PLUGIN}content/images/cat/48/" );
+			$content_pref["content_cat_icon_path_small"] = ($content_pref["content_cat_icon_path_small"] ? $content_pref["content_cat_icon_path_small"] : "{e_PLUGIN}content/images/cat/16/" );
+			$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"]);
+			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+			if($content_pref["content_submit"] && check_class($content_pref["content_submit_class"])){
 				$content_submit_type_table_string .= $tp -> parseTemplate($CONTENT_SUBMIT_TYPE_TABLE, FALSE, $content_shortcodes);
 				$count = $count + 1;
 			}
diff -ruN 0.7.5/e107_plugins/content/content_update.php 0.7.7/e107_plugins/content/content_update.php
--- 0.7.5/e107_plugins/content/content_update.php	2006-01-09 03:56:57.000000000 -0600
+++ 0.7.7/e107_plugins/content/content_update.php	2006-07-28 09:07:14.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_update.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/01/09 09:56:57 $
+|     $Revision: 1.17 $
+|     $Date: 2006/07/28 14:07:14 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -271,6 +271,15 @@
 //upgrade to 1.21 (update content_author fields)
 $text .= $ac -> upgrade_1_21();
 
+//upgrade to 1.22 (update preference storage method)
+$text .= $ac -> upgrade_1_22();
+
+//upgrade to 1.23 (update preference storage method)
+$text .= $ac -> upgrade_1_23();
+
+//upgrade to 1.24 (update custom theme)
+$text .= $ac -> upgrade_1_24();
+
 //render message
 if(isset($text)){
 	//only output detailed information if developer mode is set
@@ -346,7 +355,7 @@
 function set_content_version()
 {
 	global $sql, $pref;
-	$new_version = "1.21";
+	$new_version = "1.24";
 	$sql->db_Update('plugin',"plugin_version = '{$new_version}' WHERE plugin_path='content'");
 	$text = '';
 	//only output detailed information if developer mode is set
diff -ruN 0.7.5/e107_plugins/content/content_update_check.php 0.7.7/e107_plugins/content/content_update_check.php
--- 0.7.5/e107_plugins/content/content_update_check.php	2005-12-29 16:19:37.000000000 -0600
+++ 0.7.7/e107_plugins/content/content_update_check.php	2006-07-28 09:07:14.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_update_check.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/29 22:19:37 $
+|     $Revision: 1.10 $
+|     $Date: 2006/07/28 14:07:14 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -40,8 +40,8 @@
 		}else{
 			$row = $sql->db_Fetch();
 			
-			//if version < 1.21, return FALSE = needed
-			if($row['plugin_version'] < 1.21){
+			//if version < 1.23, return FALSE = needed
+			if($row['plugin_version'] < 1.24){
 				return FALSE; //needed
 			}
 
diff -ruN 0.7.5/e107_plugins/content/e_comment.php 0.7.7/e107_plugins/content/e_comment.php
--- 0.7.5/e107_plugins/content/e_comment.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_comment.php	2006-06-22 14:13:41.000000000 -0500
@@ -2,11 +2,30 @@
 
 if (!defined('e107_INIT')) { exit; }
 
-$e_plug_table = "pcontent"; //This is set to the table name you have decided to use.
-$reply_location= e_PLUGIN."content/content.php?content.$nid"; //This is set to the location you'd like the user to return to after replying to a comment.
-$db_table = "pcontent"; //This is the name of your plugins database table.
-$link_name = "content_heading"; //This is the name of the field in your plugin's db table that corresponds to it's name or title.
-$db_id = "content_id"; // This is the name of the field in your plugin's db table that correspond to it's unique id number.
-$plugin_name = "Content"; // A name for your plugin. It will be used in links to comments, in list_new/new.php.
+/*
+$e_plug_table	= "pcontent"; //This is set to the table name you have decided to use.
+$reply_location	= e_PLUGIN."content/content.php?content.$nid"; //This is set to the location you'd like the user to return to after replying to a comment.
+$db_table		= "pcontent"; //This is the name of your plugins database table.
+$link_name		= "content_heading"; //This is the name of the field in your plugin's db table that corresponds to it's name or title.
+$db_id			= "content_id"; // This is the name of the field in your plugin's db table that correspond to it's unique id number.
+$plugin_name	= "Content"; // A name for your plugin. It will be used in links to comments, in list_new/new.php.
+*/
+
+$e_comment['eplug_comment_ids'] = "pcontent"; //This is set to the table name you have decided to use.
+$e_comment['plugin_path'] = "content"; //The path of your plugin.
+$e_comment['plugin_name'] = "content"; //A name for your plugin. It will be used in links to comments, in list_new/new.php.
+//This is set to the location you'd like the user to return to after replying to a comment.
+$e_comment['reply_location'] = e_PLUGIN."content/content.php?content.{NID}"; 
+$e_comment['db_title'] = "content_heading"; //This is the name of the field in your plugin's db table that corresponds to it's name or title.
+$e_comment['db_id'] = "content_id"; // This is the name of the field in your plugin's db table that correspond to it's unique id number.
+
+//qry must be set with a select_gen query.
+//the main reason would be to check if a category from another table has a class restriction
+//the id of the item should be provided as {NID}
+//returned fields should at least contain the 'link_id' and 'db_id' fields set above
+$e_comment['qry']				= "
+SELECT c.*
+FROM #pcontent as c
+WHERE c.content_id='{NID}' AND c.content_refer !='sa' AND c.content_datestamp < ".time()." AND (c.content_enddate=0 || c.content_enddate>".time().") AND c.content_class REGEXP '".e_CLASS_REGEXP."' ";
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/e_emailprint.php 0.7.7/e107_plugins/content/e_emailprint.php
--- 0.7.5/e107_plugins/content/e_emailprint.php	2006-01-16 04:55:14.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_emailprint.php	2006-05-31 16:29:59.000000000 -0500
@@ -32,8 +32,8 @@
 
 		$mainparent					= $aa -> getMainParent($id);
 		$content_pref				= $aa -> getContentPref($mainparent);
-		$content_icon_path			= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-		$content_image_path			= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
+		$content_icon_path			= $tp -> replaceConstants($content_pref["content_icon_path"]);
+		$content_image_path			= $tp -> replaceConstants($content_pref["content_image_path"]);
 		$img						= $tp -> parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes);
 
 		$text = "
@@ -100,8 +100,8 @@
 
 	$mainparent					= $aa -> getMainParent(intval($id));
 	$content_pref				= $aa -> getContentPref($mainparent);
-	$content_icon_path			= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-	$content_image_path			= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
+	$content_icon_path			= $tp -> replaceConstants($content_pref["content_icon_path"]);
+	$content_image_path			= $tp -> replaceConstants($content_pref["content_image_path"]);
 	$img						= $tp -> parseTemplate('{CONTENT_PDF_IMAGES}', FALSE, $content_shortcodes);
 
 	//add custom and preset tags if present
@@ -112,7 +112,7 @@
 	if(!empty($custom)){
 		foreach($custom as $k => $v){
 			if($k == "content_custom_presettags"){
-				if(isset($content_pref["content_content_presettags_{$mainparent}"]) && $content_pref["content_content_presettags_{$mainparent}"]){
+				if(isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]){
 					foreach($v as $ck => $cv){
 						if(is_array($cv)){	//date
 							if(!($cv['day']=="" && $cv['month']=="" && $cv['year']=="")){
@@ -130,7 +130,7 @@
 					}
 				}
 			}else{
-				if(isset($content_pref["content_content_customtags_{$mainparent}"]) && $content_pref["content_content_customtags_{$mainparent}"]){
+				if(isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]){
 					$key = substr($k,15);
 					if( isset($key) && $key != "" && isset($v) && $v!="" ){
 						$CUSTOM_TAGS = TRUE;
diff -ruN 0.7.5/e107_plugins/content/e_latest.php 0.7.7/e107_plugins/content/e_latest.php
--- 0.7.5/e107_plugins/content/e_latest.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_latest.php	2006-06-11 11:20:25.000000000 -0500
@@ -1,6 +1,9 @@
 <?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');
+
 $plugintable = "pcontent";
 $reported_content = $sql -> db_Count($plugintable, '(*)', "WHERE content_refer='sa' ");
 $text .= "
@@ -8,9 +11,10 @@
 <img src='".e_PLUGIN."content/images/content_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' />
 ";
 if($reported_content) {
-	$text .= " <a href='".e_PLUGIN."content/admin_content_config.php?submitted'>Submitted Content Items: $reported_content</a>";
+	$text .= " <a href='".e_PLUGIN."content/admin_content_config.php?submitted'>".CONTENT_LATEST_LAN_1." $reported_content</a>";
 } else {
-	$text .= "Submitted Content Items: ".$reported_content;
+	$text .= CONTENT_LATEST_LAN_1." ".$reported_content;
 }
 $text .= "</div>";
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/e_list.php 0.7.7/e107_plugins/content/e_list.php
--- 0.7.5/e107_plugins/content/e_list.php	2006-01-06 19:37:26.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_list.php	2006-05-31 16:29:59.000000000 -0500
@@ -38,8 +38,8 @@
 
 			//get path variables
 			$content_recent_pref = $aa -> getContentPref($mainparent);
-			$content_recent_pref["content_icon_path_{$mainparent}"] = ($content_recent_pref["content_icon_path_{$mainparent}"] ? $content_recent_pref["content_icon_path_{$mainparent}"] : "{e_PLUGIN}content/images/icon/" );
-			$content_icon_path = $tp -> replaceConstants($content_recent_pref["content_icon_path_{$mainparent}"]);
+			$content_recent_pref["content_icon_path"] = ($content_recent_pref["content_icon_path"] ? $content_recent_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/" );
+			$content_icon_path = $tp -> replaceConstants($content_recent_pref["content_icon_path"]);
 
 			//prepare query string
 			$array = $aa -> getCategoryTree("", $mainparent, TRUE);
@@ -78,7 +78,14 @@
 						}
 
 						$DATE = ($arr[5] ? $this -> getListDate($rowi['content_datestamp'], $mode) : "");
-						$ICON = $this -> getBullet($arr[6], $mode);
+						//$ICON = $this -> getBullet($arr[6], $mode);
+
+						$image_link_append = "<a href='".e_PLUGIN."content/content.php?content.".$rowi['content_id']."'>";
+						if($rowi['content_icon'] && file_exists(e_PLUGIN."content/images/icon/".$rowi['content_icon'])){
+							$ICON = $image_link_append."<img src='".e_PLUGIN."content/images/icon/".$rowi['content_icon']."' style='width:50px; border:1px solid #000;' alt='' /></a>";
+						}else{
+							$ICON = "";
+						}
 
 						//get author details
 						if($arr[3]){
diff -ruN 0.7.5/e107_plugins/content/e_meta.php 0.7.7/e107_plugins/content/e_meta.php
--- 0.7.5/e107_plugins/content/e_meta.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_meta.php	2006-11-06 04:43:35.000000000 -0600
@@ -0,0 +1,52 @@
+<?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/content/e_meta.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/11/06 10:43:35 $
+|     $Author: lisa_ $
++----------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+
+echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
+
+if(e_QUERY){
+	$qs = explode(".", e_QUERY);
+
+	if(is_numeric($qs[0])){
+		$from = array_shift($qs);
+	}else{
+		$from = "0";
+	}
+}
+if(isset($qs[0]) && $qs[0] == "content" && isset($qs[1]) && is_numeric($qs[1]) ){
+	$add_meta_keywords = '';
+	//meta keywords from content item
+	if($sql -> db_Select('pcontent', "content_meta", "content_id='".intval($qs[1])."'")){
+		list($row['content_meta']) = $sql -> db_Fetch();
+		$exmeta = $row['content_meta'];
+		if($exmeta != ""){
+			$exmeta = str_replace(", ", ",", $exmeta);
+			$exmeta = str_replace(" ", ",", $exmeta);
+			$exmeta = str_replace(",", ", ", $exmeta);
+			$add_meta_keywords = $exmeta;
+		}
+	}
+	if($add_meta_keywords){
+		define("META_MERGE", TRUE);
+		define("META_KEYWORDS", " ".$add_meta_keywords);
+	}
+}
+
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/e_notify.php 0.7.7/e107_plugins/content/e_notify.php
--- 0.7.5/e107_plugins/content/e_notify.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_notify.php	2006-06-07 08:37:21.000000000 -0500
@@ -0,0 +1,36 @@
+<?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/content/e_notify.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/06/07 13:37:21 $
+|     $Author: lisa_ $
++----------------------------------------------------------------------------+
+*/
+
+$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");
+
+$config_category = CONTENT_NOTIFY_LAN_1;
+$config_events = array('content' => CONTENT_NOTIFY_LAN_2);
+
+if (!function_exists('notify_content')) {
+	function notify_content($data) {
+		global $nt;
+		foreach ($data as $key => $value) {
+			$message .= $key.': '.$value.'<br />';
+		}
+		$nt -> send('content', CONTENT_NOTIFY_LAN_3, $message);
+	}
+}
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/e_rss.php 0.7.7/e107_plugins/content/e_rss.php
--- 0.7.5/e107_plugins/content/e_rss.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/content/e_rss.php	2006-06-20 02:22:46.000000000 -0500
@@ -0,0 +1,76 @@
+<?php
+
+if (!defined('e107_INIT')) { exit; }
+
+
+
+require_once(e_PLUGIN."content/handlers/content_class.php");
+$aa = new content;
+
+//##### create feed for admin, return array $eplug_rss_feed --------------------------------
+$feed = get_rss();
+foreach($feed as $k=>$v){
+	$eplug_rss_feed[] = $v;
+}
+
+function get_rss(){
+	global $aa;
+
+	require_once(e_PLUGIN."content/handlers/content_class.php");
+	$aa = new content;
+	$rss = array();
+	$array = $aa -> getCategoryTree('', '', FALSE);
+	foreach($array as $k=>$v){
+		$name = '';
+		for($i=0;$i<count($array[$k]);$i++){
+			$name .= $array[$k][$i+1]." > ";
+			$i++;
+		}
+		$name = substr($name,0,-3);
+		$feed['name']			= $name;
+		$feed['url']			= 'content';		//the identifier for the rss feed url
+		$feed['topic_id']		= $k;				//the topic_id, empty on default (to select a certain category)
+		$feed['path']			= 'content';		//this is the plugin path location
+		$feed['text']			= 'this is the rss feed for content category : '.$name;
+		$feed['class']			= '0';
+		$feed['limit']			= '9';
+		$rss[] = $feed;
+	}
+	return $rss;
+}
+//##### ------------------------------------------------------------------------------------
+
+
+//##### create rss data, return as array $eplug_rss_data -----------------------------------
+$mainparent		= $aa -> getMainParent($this->topicid);
+$content_pref	= $aa -> getContentPref($mainparent);
+$array			= $aa -> getCategoryTree("", $mainparent, TRUE);
+$datequery		= " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
+$qry			= " content_refer !='sa' ".$datequery." AND content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '".$this->topicid."' ORDER BY content_datestamp DESC LIMIT 0,".$this -> limit;
+
+$rss = array();
+$sqlrss = new db;
+if($items = $sqlrss -> db_Select('pcontent', "*", $qry )){
+	$i=0;
+	while($rowrss = $sqlrss -> db_Fetch()){
+		//$author = array($author_id, $author_name, $author_email, $content_author);
+		$author = $aa -> getAuthor($rowrss['content_author']);
+		$rss[$i]['author']			= $author[1];
+		$rss[$i]['author_email']	= $author[2];
+		$rss[$i]['link']			= $e107->base_path.$PLUGINS_DIRECTORY."content/content.php?content.".$rowrss['content_id'];
+		$rss[$i]['linkid']			= $rowrss['content_id'];
+		$rss[$i]['title']			= $rowrss['content_heading'];
+		$rss[$i]['description']		= $rowrss['content_subheading'];
+		$rss[$i]['category_name']	= $array[$rowrss['content_parent']][count($array[$rowrss['content_parent']])-1];
+		$rss[$i]['category_link']	= $e107->base_path.$PLUGINS_DIRECTORY."content/content.php?cat.".$rowrss['content_parent'];
+		$rss[$i]['datestamp']		= $rowrss['content_datestamp'];
+		$rss[$i]['enc_url']			= "";
+		$rss[$i]['enc_leng']		= "";
+		$rss[$i]['enc_type']		= "";
+		$i++;
+	}
+}
+$eplug_rss_data[] = $rss;
+//##### ------------------------------------------------------------------------------------
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/handlers/content_class.php 0.7.7/e107_plugins/content/handlers/content_class.php
--- 0.7.5/e107_plugins/content/handlers/content_class.php	2006-01-23 08:17:04.000000000 -0600
+++ 0.7.7/e107_plugins/content/handlers/content_class.php	2006-10-23 10:55:19.000000000 -0500
@@ -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.88 $
-|		$Date: 2006/01/23 14:17:04 $
+|		$Revision: 1.107 $
+|		$Date: 2006/10/23 15:55:19 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -31,281 +31,340 @@
 
 class content{
 
-		function ContentDefaultPrefs($id){
+		function ContentDefaultPrefs(){
 			global $tp;
 
-			if(!$id){ $id="0"; }
-
 			//ADMIN CREATE FORM
-			$content_pref["content_admin_icon_{$id}"] = "0";						//should icon be available to add when creating an item
-			$content_pref["content_admin_attach_{$id}"] = "0";						//should file be available to add when creating an item
-			$content_pref["content_admin_images_{$id}"] = "0";						//should image be available to add when creating an item
-			$content_pref["content_admin_comment_{$id}"] = "1";						//should comment be available to add when creating an item
-			$content_pref["content_admin_rating_{$id}"] = "1";						//should rating be available to add when creating an item
-			$content_pref["content_admin_score_{$id}"] = "1";						//should score be available to add when creating an item
-			$content_pref["content_admin_pe_{$id}"] = "1";							//should printemailicons be available to add when creating an item
-			$content_pref["content_admin_visibility_{$id}"] = "1";					//should visibility be available to add when creating an item
-			$content_pref["content_admin_meta_{$id}"] = "0";						//should metatags be available to add when creating an item
-			$content_pref["content_admin_custom_number_{$id}"] = "0";				//how many customtags should be available to add when creating an item
-			$content_pref["content_admin_images_number_{$id}"] = "0";				//how many images should be available to add when creating an item
-			$content_pref["content_admin_files_number_{$id}"] = "0";				//how many files should be available to add when creating an item
-			$content_pref["content_admin_layout_{$id}"] = "0";						//should the option for choosing a layout template be shown
-			$content_pref["content_admin_customtags_{$id}"] = "0";					//should options for adding additional data be shown
-			$content_pref["content_admin_presettags_{$id}"] = "0";					//should preset data tags be shown
+			$content_pref['content_admin_subheading'] = "1";				//should subheading be available
+			$content_pref['content_admin_summary'] = "1";					//should summary be available
+			$content_pref['content_admin_startdate'] = "1";					//should start date be available
+			$content_pref['content_admin_enddate'] = "1";					//should end date be available
+			$content_pref['content_admin_icon'] = "0";						//should icon be available to add when creating an item
+			$content_pref['content_admin_attach'] = "0";					//should file be available to add when creating an item
+			$content_pref['content_admin_images'] = "0";					//should image be available to add when creating an item
+			$content_pref['content_admin_comment'] = "1";					//should comment be available to add when creating an item
+			$content_pref['content_admin_rating'] = "1";					//should rating be available to add when creating an item
+			$content_pref['content_admin_score'] = "1";						//should score be available to add when creating an item
+			$content_pref['content_admin_pe'] = "1";						//should printemailicons be available to add when creating an item
+			$content_pref['content_admin_visibility'] = "1";				//should visibility be available to add when creating an item
+			$content_pref['content_admin_meta'] = "0";						//should metatags be available to add when creating an item
+			$content_pref['content_admin_custom_number'] = "0";				//how many customtags should be available to add when creating an item
+			$content_pref['content_admin_images_number'] = "0";				//how many images should be available to add when creating an item
+			$content_pref['content_admin_files_number'] = "0";				//how many files should be available to add when creating an item
+			$content_pref['content_admin_layout'] = "0";					//should the option for choosing a layout template be shown
+			$content_pref['content_admin_customtags'] = "0";				//should options for adding additional data be shown
+			$content_pref['content_admin_presettags'] = "0";				//should preset data tags be shown
+
+			//ADMIN CREATE CATEGORY FORM
+			$content_pref['content_admincat_subheading'] = '1';				//should subheading be available
+			$content_pref['content_admincat_startdate'] = '1';				//should startdate be available
+			$content_pref['content_admincat_enddate'] = '1';				//should enddate be available
+			$content_pref['content_admincat_uploadicon'] = '1';				//should uploadicon be available
+			$content_pref['content_admincat_selecticon'] = '1';				//should selecticon be available
+			$content_pref['content_admincat_comment'] = '1';				//should comment be available
+			$content_pref['content_admincat_rating'] = '1';					//should rating be available
+			$content_pref['content_admincat_pe'] = '1';						//should print email icons be available
+			$content_pref['content_admincat_visibility'] = '1';				//should visibility be available
 
 			//SUBMIT FORM
-			$content_pref["content_submit_{$id}"] = "0";							//should users be able to submit an item
-			$content_pref["content_submit_class_{$id}"] = "0";						//define which userclass is able to submit an item
-			$content_pref["content_submit_directpost_{$id}"] ="0";					//should submission be direclty posted as an item, or have them validated by admins
-			$content_pref["content_submit_icon_{$id}"] = "0";						//should icon be available to add when submitting an item
-			$content_pref["content_submit_attach_{$id}"] = "0";						//should file be available to add when submitting an item
-			$content_pref["content_submit_images_{$id}"] = "0";						//should image be available to add when submitting an item
-			$content_pref["content_submit_comment_{$id}"] = "0";					//should comment be available to add when submitting an item
-			$content_pref["content_submit_rating_{$id}"] = "0";						//should rating be available to add when submitting an item
-			$content_pref["content_submit_score_{$id}"] = "0";						//should score be available to add when submitting an item
-			$content_pref["content_submit_pe_{$id}"] = "0";							//should printemailicons be available to add when submitting an item
-			$content_pref["content_submit_visibility_{$id}"] = "0";					//should visibility be available to add when submitting an item
-			$content_pref["content_submit_meta_{$id}"] = "0";						//should metatags be available to add when submitting an item
-			$content_pref["content_submit_custom_number_{$id}"] = "0";				//how many customtags should be available to add when submitting an item
-			$content_pref["content_submit_images_number_{$id}"] = "0";				//how many images should be available to add when submitting an item
-			$content_pref["content_submit_files_number_{$id}"] = "0";				//how many files should be available to add when submitting an item
-			$content_pref["content_submit_layout_{$id}"] = "0";						//should the option for choosing a layout template be shown
-			$content_pref["content_submit_customtags_{$id}"] = "0";					//should options for adding additional data be shown
-			$content_pref["content_submit_presettags_{$id}"] = "0";					//should preset data tags be shown
+			$content_pref['content_submit'] = "0";							//should users be able to submit an item
+			$content_pref['content_submit_class'] = "0";					//define which userclass is able to submit an item
+			$content_pref['content_submit_directpost'] ="0";				//should submission be direclty posted as an item, or have them validated by admins
+			$content_pref['content_submit_subheading'] = '1';				//should subheading be available
+			$content_pref['content_submit_summary'] = '1';					//should summary be available
+			$content_pref['content_submit_startdate'] = '1';				//should startdate be available
+			$content_pref['content_submit_enddate'] = '1';					//should enddate be available
+			$content_pref['content_submit_icon'] = "0";						//should icon be available to add when submitting an item
+			$content_pref['content_submit_attach'] = "0";					//should file be available to add when submitting an item
+			$content_pref['content_submit_images'] = "0";					//should image be available to add when submitting an item
+			$content_pref['content_submit_comment'] = "0";					//should comment be available to add when submitting an item
+			$content_pref['content_submit_rating'] = "0";					//should rating be available to add when submitting an item
+			$content_pref['content_submit_score'] = "0";					//should score be available to add when submitting an item
+			$content_pref['content_submit_pe'] = "0";						//should printemailicons be available to add when submitting an item
+			$content_pref['content_submit_visibility'] = "0";				//should visibility be available to add when submitting an item
+			$content_pref['content_submit_meta'] = "0";						//should metatags be available to add when submitting an item
+			$content_pref['content_submit_custom_number'] = "0";			//how many customtags should be available to add when submitting an item
+			$content_pref['content_submit_images_number'] = "0";			//how many images should be available to add when submitting an item
+			$content_pref['content_submit_files_number'] = "0";				//how many files should be available to add when submitting an item
+			$content_pref['content_submit_layout'] = "0";					//should the option for choosing a layout template be shown
+			$content_pref['content_submit_customtags'] = "0";				//should options for adding additional data be shown
+			$content_pref['content_submit_presettags'] = "0";				//should preset data tags be shown
 
 			//PATH THEME CSS
-			$content_pref["content_cat_icon_path_large_{$id}"] = "{e_PLUGIN}content/images/cat/48/";	//default path to large categry icons
-			$content_pref["content_cat_icon_path_small_{$id}"] = "{e_PLUGIN}content/images/cat/16/";	//default path to small category icons
+			$content_pref['content_cat_icon_path_large'] = "{e_PLUGIN}content/images/cat/48/";	//default path to large categry icons
+			$content_pref['content_cat_icon_path_small'] = "{e_PLUGIN}content/images/cat/16/";	//default path to small category icons
 
-			$content_pref["content_icon_path_{$id}"] = "{e_PLUGIN}content/images/icon/";				//default path to item icons
-			$content_pref["content_icon_path_tmp_{$id}"] = "{e_PLUGIN}content/images/icon/tmp/";		//default tmp path to item icons
+			$content_pref['content_icon_path'] = "{e_PLUGIN}content/images/icon/";				//default path to item icons
+			$content_pref['content_icon_path_tmp'] = "{e_PLUGIN}content/images/icon/tmp/";		//default tmp path to item icons
 			
-			$content_pref["content_image_path_{$id}"] = "{e_PLUGIN}content/images/image/";				//default path to item images
-			$content_pref["content_image_path_tmp_{$id}"] = "{e_PLUGIN}content/images/image/tmp/";		//default tmp path to item images
+			$content_pref['content_image_path'] = "{e_PLUGIN}content/images/image/";			//default path to item images
+			$content_pref['content_image_path_tmp'] = "{e_PLUGIN}content/images/image/tmp/";	//default tmp path to item images
 			
-			$content_pref["content_file_path_{$id}"] = "{e_PLUGIN}content/images/file/";				//default path to item file attachments
-			$content_pref["content_file_path_tmp_{$id}"] = "{e_PLUGIN}content/images/file/tmp/";		//default tmp path to item file attachments
+			$content_pref['content_file_path'] = "{e_PLUGIN}content/images/file/";				//default path to item file attachments
+			$content_pref['content_file_path_tmp'] = "{e_PLUGIN}content/images/file/tmp/";		//default tmp path to item file attachments
 			
-			$content_pref["content_theme_{$id}"] = "default";											//choose theme for main parent
-			$content_pref["content_layout_{$id}"] = "content_content_template.php";						//choose default layout scheme
+			$content_pref['content_theme'] = "{e_PLUGIN}content/templates/default/";			//choose theme for main parent
+			$content_pref['content_layout'] = "content_content_template.php";					//choose default layout scheme
 
 			//GENERAL
-			$content_pref["content_log_{$id}"] = "0";								//activate log
-			$content_pref["content_blank_icon_{$id}"] = "0";						//use blank icon if no icon present
-			$content_pref["content_blank_caticon_{$id}"] = "0";						//use blank caticon if no caticon present
-			$content_pref["content_breadcrumb_catall_{$id}"] = "0";					//show breadcrumb on all categories page
-			$content_pref["content_breadcrumb_cat_{$id}"] = "0";					//show breadcrumb on single category page
-			$content_pref["content_breadcrumb_authorall_{$id}"] = "0";				//show breadcrumb on all author page
-			$content_pref["content_breadcrumb_author_{$id}"] = "0";					//show breadcrumb on single author page
-			$content_pref["content_breadcrumb_recent_{$id}"] = "0";					//show breadcrumb on recent page
-			$content_pref["content_breadcrumb_item_{$id}"] = "0";					//show breadcrumb on content item page
-			$content_pref["content_breadcrumb_top_{$id}"] = "0";					//show breadcrumb on top rated page
-			$content_pref["content_breadcrumb_archive_{$id}"] = "0";				//show breadcrumb on archive page
-			$content_pref["content_breadcrumb_seperator{$id}"] = ">";				//seperator character between breadcrumb
-			$content_pref["content_breadcrumb_rendertype_{$id}"] = "2";				//how to render the breadcrumb
-			$content_pref["content_navigator_catall_{$id}"] = "0";					//show navigator on all categories page
-			$content_pref["content_navigator_cat_{$id}"] = "0";						//show navigator on single category page
-			$content_pref["content_navigator_authorall_{$id}"] = "0";				//show navigator on all author page
-			$content_pref["content_navigator_author_{$id}"] = "0";					//show navigator on single author page
-			$content_pref["content_navigator_recent_{$id}"] = "0";					//show navigator on recent page
-			$content_pref["content_navigator_item_{$id}"] = "0";					//show navigator on content item page
-			$content_pref["content_navigator_top_{$id}"] = "0";						//show navigator on top rated page
-			$content_pref["content_navigator_archive_{$id}"] = "0";					//show navigator on archive page
-			$content_pref["content_search_catall_{$id}"] = "0";						//show search keyword on all categories page
-			$content_pref["content_search_cat_{$id}"] = "0";						//show search keyword on single category page
-			$content_pref["content_search_authorall_{$id}"] = "0";					//show search keyword on all author page
-			$content_pref["content_search_author_{$id}"] = "0";						//show search keyword on single author page
-			$content_pref["content_search_recent_{$id}"] = "0";						//show search keyword on recent page
-			$content_pref["content_search_item_{$id}"] = "0";						//show search keyword on content item page
-			$content_pref["content_search_top_{$id}"] = "0";						//show search keyword on top rated page
-			$content_pref["content_search_archive_{$id}"] = "0";					//show search keyword on archive page
-			$content_pref["content_ordering_catall_{$id}"] = "0";					//show ordering on all categories page
-			$content_pref["content_ordering_cat_{$id}"] = "0";						//show ordering on single category page
-			$content_pref["content_ordering_authorall_{$id}"] = "0";				//show ordering on all author page
-			$content_pref["content_ordering_author_{$id}"] = "0";					//show ordering on single author page
-			$content_pref["content_ordering_recent_{$id}"] = "0";					//show ordering on recent page
-			$content_pref["content_ordering_item_{$id}"] = "0";						//show ordering on content item page
-			$content_pref["content_ordering_top_{$id}"] = "0";						//show ordering on top rated page
-			$content_pref["content_ordering_archive_{$id}"] = "0";					//show ordering on archive page
-			$content_pref["content_searchmenu_rendertype_{$id}"] = "1";				//rendertype for searchmenu (1=echo, 2=in seperate menu)
-			$content_pref["content_nextprev_{$id}"] = "1";							//use nextprev buttons
-			$content_pref["content_nextprev_number_{$id}"] = "10";					//how many items on a page
-			$content_pref["content_defaultorder_{$id}"] = "orderddate";				//default sort and order method
+			$content_pref['content_log'] = "0";								//activate log
+			$content_pref['content_blank_icon'] = "0";						//use blank icon if no icon present
+			$content_pref['content_blank_caticon'] = "0";					//use blank caticon if no caticon present
+			$content_pref['content_breadcrumb_catall'] = "0";				//show breadcrumb on all categories page
+			$content_pref['content_breadcrumb_cat'] = "0";					//show breadcrumb on single category page
+			$content_pref['content_breadcrumb_authorall'] = "0";			//show breadcrumb on all author page
+			$content_pref['content_breadcrumb_author'] = "0";				//show breadcrumb on single author page
+			$content_pref['content_breadcrumb_recent'] = "0";				//show breadcrumb on recent page
+			$content_pref['content_breadcrumb_item'] = "0";					//show breadcrumb on content item page
+			$content_pref['content_breadcrumb_top'] = "0";					//show breadcrumb on top rated page
+			$content_pref['content_breadcrumb_archive'] = "0";				//show breadcrumb on archive page
+			$content_pref['content_breadcrumb_seperator{$id}'] = ">";		//seperator character between breadcrumb
+			$content_pref['content_breadcrumb_rendertype'] = "2";			//how to render the breadcrumb
+			$content_pref['content_navigator_catall'] = "0";				//show navigator on all categories page
+			$content_pref['content_navigator_cat'] = "0";					//show navigator on single category page
+			$content_pref['content_navigator_authorall'] = "0";				//show navigator on all author page
+			$content_pref['content_navigator_author'] = "0";				//show navigator on single author page
+			$content_pref['content_navigator_recent'] = "0";				//show navigator on recent page
+			$content_pref['content_navigator_item'] = "0";					//show navigator on content item page
+			$content_pref['content_navigator_top'] = "0";					//show navigator on top rated page
+			$content_pref['content_navigator_archive'] = "0";				//show navigator on archive page
+			$content_pref['content_search_catall'] = "0";					//show search keyword on all categories page
+			$content_pref['content_search_cat'] = "0";						//show search keyword on single category page
+			$content_pref['content_search_authorall'] = "0";				//show search keyword on all author page
+			$content_pref['content_search_author'] = "0";					//show search keyword on single author page
+			$content_pref['content_search_recent'] = "0";					//show search keyword on recent page
+			$content_pref['content_search_item'] = "0";						//show search keyword on content item page
+			$content_pref['content_search_top'] = "0";						//show search keyword on top rated page
+			$content_pref['content_search_archive'] = "0";					//show search keyword on archive page
+			$content_pref['content_ordering_catall'] = "0";					//show ordering on all categories page
+			$content_pref['content_ordering_cat'] = "0";					//show ordering on single category page
+			$content_pref['content_ordering_authorall'] = "0";				//show ordering on all author page
+			$content_pref['content_ordering_author'] = "0";					//show ordering on single author page
+			$content_pref['content_ordering_recent'] = "0";					//show ordering on recent page
+			$content_pref['content_ordering_item'] = "0";					//show ordering on content item page
+			$content_pref['content_ordering_top'] = "0";					//show ordering on top rated page
+			$content_pref['content_ordering_archive'] = "0";				//show ordering on archive page
+			$content_pref['content_searchmenu_rendertype'] = "1";			//rendertype for searchmenu (1=echo, 2=in separate menu)
+			$content_pref['content_nextprev'] = "1";						//use nextprev buttons
+			$content_pref['content_nextprev_number'] = "10";				//how many items on a page
+			$content_pref['content_defaultorder'] = "orderddate";			//default sort and order method
 			//upload icon/image size handling
-			$content_pref["content_upload_image_size_{$id}"] = "500";				//resize size of uploaded image
-			$content_pref["content_upload_image_size_thumb_{$id}"] = "100";			//resize size of created thumb on uploaded image
-			$content_pref["content_upload_icon_size_{$id}"] = "100";				//resize size of uploaded icon
+			$content_pref['content_upload_image_size'] = "500";				//resize size of uploaded image
+			$content_pref['content_upload_image_size_thumb'] = "100";		//resize size of created thumb on uploaded image
+			$content_pref['content_upload_icon_size'] = "100";				//resize size of uploaded icon
 
 			//CONTENT ITEM PREVIEW
-			$content_pref["content_list_icon_{$id}"] = "0";							//show icon
-			$content_pref["content_list_subheading_{$id}"] = "1";					//show subheading
-			$content_pref["content_list_summary_{$id}"] = "1";						//show summary
-			$content_pref["content_list_text_{$id}"] = "0";							//show (part of) text
-			$content_pref["content_list_date_{$id}"] = "0";							//show date
-			$content_pref["content_list_authorname_{$id}"] = "0";					//show authorname
-			$content_pref["content_list_authorprofile_{$id}"] = "0";				//show link to author profile
-			$content_pref["content_list_authoremail_{$id}"] = "0";					//show authoremail
-			$content_pref["content_list_authoricon_{$id}"] = "0";					//show link to author list
-			$content_pref["content_list_rating_{$id}"] = "1";						//show rating system
-			$content_pref["content_list_peicon_{$id}"] = "1";						//show printemailicons
-			$content_pref["content_list_parent_{$id}"] = "0";						//show parent cat
-			$content_pref["content_list_refer_{$id}"] = "0";						//show refer count
-			$content_pref["content_list_subheading_char_{$id}"] = "100";			//how many subheading characters
-			$content_pref["content_list_subheading_post_{$id}"] = "[...]";			//use a postfix for too long subheadings
-			$content_pref["content_list_summary_char_{$id}"] = "100";				//how many summary characters
-			$content_pref["content_list_summary_post_{$id}"] = "[...]";				//use a postfix for too long summary
-			$content_pref["content_list_text_char_{$id}"] = "60";					//how many text words
-			$content_pref["content_list_text_post_{$id}"] = "[read more]";			//use a postfix for too long text
-			$content_pref["content_list_text_link_{$id}"] = "1";					//show link to content item on postfix
-			$content_pref["content_list_authoremail_nonmember_{$id}"] = "0";		//show email non member author
-			$content_pref["content_list_peicon_all_{$id}"] = "0";					//override printemail icons
-			$content_pref["content_list_rating_all_{$id}"] = "0";					//override rating system
-			$content_pref["content_list_editicon_{$id}"] = "0";						//show link to admin edit item
-			$content_pref["content_list_datestyle_{$id}"] = "%d %b %Y";				//choose datestyle for given date
+			$content_pref['content_list_icon'] = "0";						//show icon
+			$content_pref['content_list_subheading'] = "1";					//show subheading
+			$content_pref['content_list_summary'] = "1";					//show summary
+			$content_pref['content_list_text'] = "0";						//show (part of) text
+			$content_pref['content_list_date'] = "0";						//show date
+			$content_pref['content_list_authorname'] = "0";					//show authorname
+			$content_pref['content_list_authorprofile'] = "0";				//show link to author profile
+			$content_pref['content_list_authoremail'] = "0";				//show authoremail
+			$content_pref['content_list_authoricon'] = "0";					//show link to author list
+			$content_pref['content_list_rating'] = "1";						//show rating system
+			$content_pref['content_list_peicon'] = "1";						//show printemailicons
+			$content_pref['content_list_parent'] = "0";						//show parent cat
+			$content_pref['content_list_refer'] = "0";						//show refer count
+			$content_pref['content_list_subheading_char'] = "100";			//how many subheading characters
+			$content_pref['content_list_subheading_post'] = "[...]";		//use a postfix for too long subheadings
+			$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_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
+			$content_pref['content_list_rating_all'] = "0";					//override rating system
+			$content_pref['content_list_editicon'] = "0";					//show link to admin edit item
+			$content_pref['content_list_datestyle'] = "%d %b %Y";			//choose datestyle for given date
+			$content_pref['content_list_caption'] = CONTENT_LAN_23;			//caption for recent list
+			$content_pref['content_list_caption_append_name'] = '1';		//append category heading to caption
 
 			//CATEGORY PAGES
 			//sections of content category in 'view all categories page'
-			$content_pref["content_catall_icon_{$id}"] = "1";						//show icon
-			$content_pref["content_catall_subheading_{$id}"] = "1";					//show subheading
-			$content_pref["content_catall_text_{$id}"] = "0";						//show text
-			$content_pref["content_catall_date_{$id}"] = "0";						//show date
-			$content_pref["content_catall_rating_{$id}"] = "1";						//show rating
-			$content_pref["content_catall_authorname_{$id}"] = "0";					//show author name
-			$content_pref["content_catall_authoremail_{$id}"] = "0";				//show author email
-			$content_pref["content_catall_authorprofile_{$id}"] = "0";				//show link to author profile
-			$content_pref["content_catall_authoricon_{$id}"] = "0";					//show link to author list
-			$content_pref["content_catall_peicon_{$id}"] = "1";						//show pe icons
-			$content_pref["content_catall_comment_{$id}"] = "1";					//show amount of comments
-			$content_pref["content_catall_amount_{$id}"] = "0";						//show amount of items
-			$content_pref["content_catall_text_char_{$id}"] = "65";					//define amount of words of text to display
-			$content_pref["content_catall_text_post_{$id}"] = "[read more]";		//define postfix is text is too long
-			$content_pref["content_catall_text_link_{$id}"] = "1";					//define if link to category should be added on postfix
+			$content_pref['content_catall_icon'] = "1";						//show icon
+			$content_pref['content_catall_subheading'] = "1";				//show subheading
+			$content_pref['content_catall_text'] = "0";						//show text
+			$content_pref['content_catall_date'] = "0";						//show date
+			$content_pref['content_catall_rating'] = "1";					//show rating
+			$content_pref['content_catall_authorname'] = "0";				//show author name
+			$content_pref['content_catall_authoremail'] = "0";				//show author email
+			$content_pref['content_catall_authorprofile'] = "0";			//show link to author profile
+			$content_pref['content_catall_authoricon'] = "0";				//show link to author list
+			$content_pref['content_catall_peicon'] = "1";					//show pe icons
+			$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_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
-			$content_pref["content_cat_icon_{$id}"] = "1";							//show icon
-			$content_pref["content_cat_subheading_{$id}"] = "1";					//show subheading
-			$content_pref["content_cat_text_{$id}"] = "0";							//show text
-			$content_pref["content_cat_date_{$id}"] = "0";							//show date
-			$content_pref["content_cat_authorname_{$id}"] = "0";					//show author name
-			$content_pref["content_cat_authoremail_{$id}"] = "0";					//show author email
-			$content_pref["content_cat_authorprofile_{$id}"] = "0";					//show link to author profile
-			$content_pref["content_cat_authoricon_{$id}"] = "0";					//show link to author list
-			$content_pref["content_cat_rating_{$id}"] = "1";						//show rating
-			$content_pref["content_cat_peicon_{$id}"] = "1";						//show pe icons
-			$content_pref["content_cat_comment_{$id}"] = "1";						//show amount of comments
-			$content_pref["content_cat_amount_{$id}"] = "1";						//show amount of items
+			$content_pref['content_cat_icon'] = "1";						//show icon
+			$content_pref['content_cat_subheading'] = "1";					//show subheading
+			$content_pref['content_cat_text'] = "0";						//show text
+			$content_pref['content_cat_date'] = "0";						//show date
+			$content_pref['content_cat_authorname'] = "0";					//show author name
+			$content_pref['content_cat_authoremail'] = "0";					//show author email
+			$content_pref['content_cat_authorprofile'] = "0";				//show link to author profile
+			$content_pref['content_cat_authoricon'] = "0";					//show link to author list
+			$content_pref['content_cat_rating'] = "1";						//show rating
+			$content_pref['content_cat_peicon'] = "1";						//show pe icons
+			$content_pref['content_cat_comment'] = "1";						//show amount of comments
+			$content_pref['content_cat_amount'] = "1";						//show amount of items
+			$content_pref['content_cat_caption'] = CONTENT_LAN_26;			//caption for single category page
+			$content_pref['content_cat_caption_append_name'] = '1';			//append category heading to caption
+			$content_pref['content_cat_sub_caption'] = CONTENT_LAN_28;		//caption for subcategories
+			$content_pref['content_cat_item_caption'] = CONTENT_LAN_31;		//caption for items in category
 
 			//sections of subcategories in 'view category page'
-			$content_pref["content_catsub_icon_{$id}"] = "1";						//show icon
-			$content_pref["content_catsub_subheading_{$id}"] = "1";					//show subheading
-			$content_pref["content_catsub_amount_{$id}"] = "1";						//show amount of items
-			$content_pref["content_cat_showparent_{$id}"] = "1";					//show parent item in category page
-			$content_pref["content_cat_showparentsub_{$id}"] = "1";					//show subcategories in category page
-			$content_pref["content_cat_listtype_{$id}"] = "0";						//also show items from subategories
-			$content_pref["content_cat_menuorder_{$id}"] = "1";						//order of parent and child items
-			$content_pref["content_cat_rendertype_{$id}"] = "2";					//render method of the menus
-			$content_pref["content_cat_text_char_{$id}"] = "65";					//define amount of words of text to display
-			$content_pref["content_cat_text_post_{$id}"] = "[read more]";			//define postfix is text is too long
-			$content_pref["content_cat_text_link_{$id}"] = "1";						//define if link to category should be added on postfix
-			$content_pref["content_cat_authoremail_nonmember_{$id}"] = "0";			//define if the email of a non-member will be displayed
-			$content_pref["content_cat_peicon_all_{$id}"] = "0";					//override printemail icons
-			$content_pref["content_cat_rating_all_{$id}"] = "0";					//override rating system
+			$content_pref['content_catsub_icon'] = "1";						//show icon
+			$content_pref['content_catsub_subheading'] = "1";				//show subheading
+			$content_pref['content_catsub_amount'] = "1";					//show amount of items
+			$content_pref['content_cat_showparent'] = "1";					//show parent item in category page
+			$content_pref['content_cat_showparentsub'] = "1";				//show subcategories in category page
+			$content_pref['content_cat_listtype'] = "0";					//also show items from subategories
+			$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_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
+			$content_pref['content_cat_rating_all'] = "0";					//override rating system
 
 			//CONTENT PAGE
-			$content_pref["content_content_icon_{$id}"] = "0";						//show icon
-			$content_pref["content_content_subheading_{$id}"] = "1";				//show subheading
-			$content_pref["content_content_summary_{$id}"] = "1";					//show summary
-			$content_pref["content_content_date_{$id}"] = "0";						//show date
-			$content_pref["content_content_authorname_{$id}"] = "1";				//show authorname
-			$content_pref["content_content_authorprofile_{$id}"] = "0";				//show link to author profile
-			$content_pref["content_content_authoremail_{$id}"] = "0";				//show suthoremail
-			$content_pref["content_content_authoricon_{$id}"] = "0";				//show link to author list
-			$content_pref["content_content_parent_{$id}"] = "0";					//show parent category
-			$content_pref["content_content_rating_{$id}"] = "1";					//show rating system
-			$content_pref["content_content_peicon_{$id}"] = "1";					//show printemailicons
-			$content_pref["content_content_refer_{$id}"] = "0";						//show refer count
-			$content_pref["content_content_comment_{$id}"] = "0";					//show amount of comments
-			$content_pref["content_content_authoremail_nonmember_{$id}"] = "0";		//show email non member
-			$content_pref["content_content_peicon_all_{$id}"] = "0";				//override printemail icons
-			$content_pref["content_content_rating_all_{$id}"] = "0";				//override rating system
-			$content_pref["content_content_comment_all_{$id}"] = "0";				//override comment system				
-			$content_pref["content_content_editicon_{$id}"] = "0";					//show link in content page to admin edit item
-			$content_pref["content_content_customtags_{$id}"] = "0";				//should additional data be shown
-			$content_pref["content_content_presettags_{$id}"] = "0";				//should preset data tags be shown
-			$content_pref["content_content_attach_{$id}"] = "0";					//show attachments
-			$content_pref["content_content_images_{$id}"] = "0";					//show images
-			$content_pref["content_content_pagenames_rendertype_{$id}"] = "0";		//rendertype for articleindex on multipage content items
+			$content_pref['content_content_icon'] = "0";					//show icon
+			$content_pref['content_content_subheading'] = "1";				//show subheading
+			$content_pref['content_content_summary'] = "1";					//show summary
+			$content_pref['content_content_date'] = "0";					//show date
+			$content_pref['content_content_authorname'] = "1";				//show authorname
+			$content_pref['content_content_authorprofile'] = "0";			//show link to author profile
+			$content_pref['content_content_authoremail'] = "0";				//show suthoremail
+			$content_pref['content_content_authoricon'] = "0";				//show link to author list
+			$content_pref['content_content_parent'] = "0";					//show parent category
+			$content_pref['content_content_rating'] = "1";					//show rating system
+			$content_pref['content_content_peicon'] = "1";					//show printemailicons
+			$content_pref['content_content_refer'] = "0";					//show refer count
+			$content_pref['content_content_comment'] = "0";					//show amount of comments
+			$content_pref['content_content_authoremail_nonmember'] = "0";	//show email non member
+			$content_pref['content_content_peicon_all'] = "0";				//override printemail icons
+			$content_pref['content_content_rating_all'] = "0";				//override rating system
+			$content_pref['content_content_comment_all'] = "0";				//override comment system				
+			$content_pref['content_content_editicon'] = "0";				//show link in content page to admin edit item
+			$content_pref['content_content_customtags'] = "0";				//should additional data be shown
+			$content_pref['content_content_presettags'] = "0";				//should preset data tags be shown
+			$content_pref['content_content_attach'] = "0";					//show attachments
+			$content_pref['content_content_images'] = "0";					//show images
+			$content_pref['content_content_pagenames_rendertype'] = "0";	//rendertype for articleindex on multipage content items
+			$content_pref['content_content_multipage_preset'] = "0";		//render custom/preset in multipage item first/last page
 
 			//AUTHOR PAGE
-			$content_pref["content_author_lastitem_{$id}"] = "0";					//show last item reference
-			$content_pref["content_author_amount_{$id}"] = "1";						//show amount of items from this author
-			$content_pref["content_author_nextprev_{$id}"] = "1";					//use next prev buttons
-			$content_pref["content_author_nextprev_number_{$id}"] = "20";			//amount of items per page
+			$content_pref['content_author_lastitem'] = "0";					//show last item reference
+			$content_pref['content_author_amount'] = "1";					//show amount of items from this author
+			$content_pref['content_author_nextprev'] = "1";					//use next prev buttons
+			$content_pref['content_author_nextprev_number'] = "20";			//amount of items per page
+			$content_pref['content_author_index_caption'] = CONTENT_LAN_32;	//caption for author index page
+			$content_pref['content_author_caption'] = CONTENT_LAN_32;		//caption for single author page
+			$content_pref['content_author_caption_append_name'] = '1';		//append author name to caption
 
 			//ARCHIVE PAGE
-			$content_pref["content_archive_nextprev_{$id}"] = "1";					//archive : choose to show next/prev links
-			$content_pref["content_archive_nextprev_number_{$id}"] = "30";			//archive : choose amount to use in next/prev
-			$content_pref["content_archive_letterindex_{$id}"] = "0";				//archive : letter index
-			$content_pref["content_archive_datestyle_{$id}"] = "%d %b %Y";			//archive : choose datestyle for given date
-			$content_pref["content_archive_date_{$id}"] = "1";						//archive : section: show date
-			$content_pref["content_archive_authorname_{$id}"] = "0";				//archive : section: show authorname
-			$content_pref["content_archive_authorprofile_{$id}"] = "0";				//archive : section: show link to author profile
-			$content_pref["content_archive_authoricon_{$id}"] = "0";				//archive : section: show link to author list
-			$content_pref["content_archive_authoremail_{$id}"] = "0";				//archive : section: show author email
-			$content_pref["content_archive_authoremail_nonmember_{$id}"] = "0";		//archive : show link to email of non-member author
+			$content_pref['content_archive_nextprev'] = "1";				//archive : choose to show next/prev links
+			$content_pref['content_archive_nextprev_number'] = "30";		//archive : choose amount to use in next/prev
+			$content_pref['content_archive_letterindex'] = "0";				//archive : letter index
+			$content_pref['content_archive_datestyle'] = "%d %b %Y";		//archive : choose datestyle for given date
+			$content_pref['content_archive_date'] = "1";					//archive : section: show date
+			$content_pref['content_archive_authorname'] = "0";				//archive : section: show authorname
+			$content_pref['content_archive_authorprofile'] = "0";			//archive : section: show link to author profile
+			$content_pref['content_archive_authoricon'] = "0";				//archive : section: show link to author list
+			$content_pref['content_archive_authoremail'] = "0";				//archive : section: show author email
+			$content_pref['content_archive_authoremail_nonmember'] = "0";	//archive : show link to email of non-member author
+			$content_pref['content_archive_caption'] = CONTENT_LAN_84;		//caption for archive page
 
 			//TOP RATED PAGE
-			$content_pref["content_top_icon_{$id}"] = "0";							//top : section: show icon
-			$content_pref["content_top_authorname_{$id}"] = "0";					//top : section: show authorname
-			$content_pref["content_top_authorprofile_{$id}"] = "0";					//top : section: show link to author profile
-			$content_pref["content_top_authoricon_{$id}"] = "0";					//top : section: show link to author list
-			$content_pref["content_top_authoremail_{$id}"] = "0";					//top : section: show author email
-			$content_pref["content_top_authoremail_nonmember_{$id}"] = "0";			//top : show link to email of non-member author
+			$content_pref['content_top_icon'] = "0";						//top : section: show icon
+			$content_pref['content_top_authorname'] = "0";					//top : section: show authorname
+			$content_pref['content_top_authorprofile'] = "0";				//top : section: show link to author profile
+			$content_pref['content_top_authoricon'] = "0";					//top : section: show link to author list
+			$content_pref['content_top_authoremail'] = "0";					//top : section: show author email
+			$content_pref['content_top_authoremail_nonmember'] = "0";		//top : show link to email of non-member author
+			$content_pref['content_top_icon_width'] = '';					//use this size for icon
+			$content_pref['content_top_caption'] = CONTENT_LAN_38;			//caption for top rated page
+			$content_pref['content_top_caption_append_name'] = '1';			//append category heading to caption
 
 			//TOP SCORE PAGE
-			$content_pref["content_score_icon_{$id}"] = "0";						//score : section: show icon
-			$content_pref["content_score_authorname_{$id}"] = "0";					//score : section: show authorname
-			$content_pref["content_score_authorprofile_{$id}"] = "0";				//score : section: show link to author profile
-			$content_pref["content_score_authoricon_{$id}"] = "0";					//score : section: show link to author list
-			$content_pref["content_score_authoremail_{$id}"] = "0";					//score : section: show author email
-			$content_pref["content_score_authoremail_nonmember_{$id}"] = "0";		//score : show link to email of non-member author
-
-			//CONTENT MANAGER
-			$content_pref["content_manager_class_{$id}"] = "0";						//contentmanager: class to narrow down the userlist
+			$content_pref['content_score_icon'] = "0";						//score : section: show icon
+			$content_pref['content_score_authorname'] = "0";				//score : section: show authorname
+			$content_pref['content_score_authorprofile'] = "0";				//score : section: show link to author profile
+			$content_pref['content_score_authoricon'] = "0";				//score : section: show link to author list
+			$content_pref['content_score_authoremail'] = "0";				//score : section: show author email
+			$content_pref['content_score_authoremail_nonmember'] = "0";		//score : show link to email of non-member author
+			$content_pref['content_score_icon_width'] = '';					//use this size for icon
+			$content_pref['content_score_caption'] = CONTENT_LAN_87;		//caption for top score page
+			$content_pref['content_score_caption_append_name'] = '1';		//append category heading to caption
 
 			//MENU OPTIONS
-			$content_pref["content_menu_caption_{$id}"] = CONTENT_MENU_LAN_0;		//caption of menu
-			$content_pref["content_menu_search_{$id}"] = "0";						//show search keyword
-			$content_pref["content_menu_sort_{$id}"] = "0";							//show sorting methods
-			$content_pref["content_menu_links_{$id}"] = "1";						//show content links
-			$content_pref["content_menu_links_dropdown_{$id}"] = "0";				//rendertype of content links (in dropdown or as normal links)
-			$content_pref["content_menu_links_icon_{$id}"] = "0";					//define icon for content links (only with normallinks)
-			$content_pref["content_menu_links_caption_{$id}"] = CONTENT_MENU_LAN_4;	//define caption for link list (only is normallinks is selected)
-			$content_pref["content_menu_viewallcat_{$id}"] = "1";					//menu: view link to all categories
-			$content_pref["content_menu_viewallauthor_{$id}"] = "1";				//menu: view link to all authors
-			$content_pref["content_menu_viewallitems_{$id}"] = "1";					//menu: view link to all items (archive)
-			$content_pref["content_menu_viewtoprated_{$id}"] = "0";					//menu: view link to top rated items
-			$content_pref["content_menu_viewtopscore_{$id}"] = "0";					//menu: view link to top score items
-			$content_pref["content_menu_viewrecent_{$id}"] = "1";					//menu: view link to recent items
-			$content_pref["content_menu_viewsubmit_{$id}"] = "0";					//view link to submit content item (only if it is allowed)
-			$content_pref["content_menu_viewicon_{$id}"] = "0";						//choose icon to display for links
-			$content_pref["content_menu_cat_{$id}"] = "1";							//view categories
-			$content_pref["content_menu_cat_main_{$id}"] = "1";						//show main parent in the category list				
-			$content_pref["content_menu_cat_number_{$id}"] = "1";					//show number of items in category				
-			$content_pref["content_menu_cat_icon_{$id}"] = "0";						//choose icon to display for categories
-			$content_pref["content_menu_cat_icon_default_{$id}"] = "0";				//choose default icon is no icon present (only if category_icon is selected)
-			$content_pref["content_menu_cat_caption_{$id}"] = CONTENT_MENU_LAN_3;	//define caption for category list
-			$content_pref["content_menu_cat_dropdown_{$id}"] = "0";					//rendertype of categories (in dropdown or as normal links)
-			$content_pref["content_menu_recent_{$id}"] = "1";						//view recent list
-			$content_pref["content_menu_recent_caption_{$id}"] = CONTENT_MENU_LAN_2;	//caption of recent list
-			$content_pref["content_menu_recent_number_{$id}"] = "5";				//number of recent items to show
-			$content_pref["content_menu_recent_date_{$id}"] = "0";					//show date in recent list
-			$content_pref["content_menu_recent_datestyle_{$id}"] = "%d %b %Y";		//choose datestyle for given date
-			$content_pref["content_menu_recent_author_{$id}"] = "0";				//show author in recent list
-			$content_pref["content_menu_recent_subheading_{$id}"] = "0";			//show subheading in recent list
-			$content_pref["content_menu_recent_subheading_char_{$id}"] = "80";		//number of characters of subheading to show
-			$content_pref["content_menu_recent_subheading_post_{$id}"] = "[...]";	//postfix for too long subheadings
-			$content_pref["content_menu_recent_icon_{$id}"] = "0";					//choose icon to display for recent items
-			$content_pref["content_menu_recent_icon_width_{$id}"] = "50";			//specify width of icon (only if content_icon is set)
+			$content_pref['content_menu_caption'] = CONTENT_MENU_LAN_0;		//caption of menu
+			$content_pref['content_menu_search'] = "0";						//show search keyword
+			$content_pref['content_menu_sort'] = "0";						//show sorting methods
+			$content_pref['content_menu_links'] = "1";						//show content links
+			$content_pref['content_menu_links_dropdown'] = "0";				//rendertype of content links (in dropdown or as normal links)
+			$content_pref['content_menu_links_icon'] = "0";					//define icon for content links (only with normallinks)
+			$content_pref['content_menu_links_caption'] = CONTENT_MENU_LAN_4;	//define caption for link list (only is normallinks is selected)
+			$content_pref['content_menu_viewallcat'] = "1";					//menu: view link to all categories
+			$content_pref['content_menu_viewallauthor'] = "1";				//menu: view link to all authors
+			$content_pref['content_menu_viewallitems'] = "1";				//menu: view link to all items (archive)
+			$content_pref['content_menu_viewtoprated'] = "0";				//menu: view link to top rated items
+			$content_pref['content_menu_viewtopscore'] = "0";				//menu: view link to top score items
+			$content_pref['content_menu_viewrecent'] = "1";					//menu: view link to recent items
+			$content_pref['content_menu_viewsubmit'] = "0";					//view link to submit content item (only if it is allowed)
+			$content_pref['content_menu_viewicon'] = "0";					//choose icon to display for links
+			$content_pref['content_menu_cat'] = "1";						//view categories
+			$content_pref['content_menu_cat_main'] = "1";					//show main parent in the category list				
+			$content_pref['content_menu_cat_number'] = "1";					//show number of items in category				
+			$content_pref['content_menu_cat_icon'] = "0";					//choose icon to display for categories
+			$content_pref['content_menu_cat_icon_default'] = "0";			//choose default icon is no icon present (only if category_icon is selected)
+			$content_pref['content_menu_cat_caption'] = CONTENT_MENU_LAN_3;	//define caption for category list
+			$content_pref['content_menu_cat_dropdown'] = "0";				//rendertype of categories (in dropdown or as normal links)
+			$content_pref['content_menu_recent'] = "1";						//view recent list
+			$content_pref['content_menu_recent_caption'] = CONTENT_MENU_LAN_2;	//caption of recent list
+			$content_pref['content_menu_recent_number'] = "5";				//number of recent items to show
+			$content_pref['content_menu_recent_date'] = "0";				//show date in recent list
+			$content_pref['content_menu_recent_datestyle'] = "%d %b %Y";	//choose datestyle for given date
+			$content_pref['content_menu_recent_author'] = "0";				//show author in recent list
+			$content_pref['content_menu_recent_subheading'] = "0";			//show subheading in recent list
+			$content_pref['content_menu_recent_subheading_char'] = "80";	//number of characters of subheading to show
+			$content_pref['content_menu_recent_subheading_post'] = "[...]";	//postfix for too long subheadings
+			$content_pref['content_menu_recent_icon'] = "0";				//choose icon to display for recent items
+			$content_pref['content_menu_recent_icon_width'] = "50";			//specify width of icon (only if content_icon is set)
+
+			$content_pref['content_inherit'] = '0';							//inherit options from default preferences
+
+			//CONTENT MANAGER
+			$content_pref['content_manager_approve'] = '0';					//class for managers who can approve submitted items
+			$content_pref['content_manager_personal'] = '0';				//class for managers who can manage personal items
+			$content_pref['content_manager_category'] = '0';				//class for managers who can manage all items in a category
+
+			//PAGE RESTRICTION (NOT YET IN USE)
+			$content_pref['content_restrict_managecontent'] = '0';
+			$content_pref['content_restrict_createcontent'] = '0';
+			$content_pref['content_restrict_managecat'] = '0';
+			$content_pref['content_restrict_createcat'] = '0';
+			$content_pref['content_restrict_order'] = '0';
+			$content_pref['content_restrict_options'] = '0';
+			$content_pref['content_restrict_adminmanager'] = '0';
+			$content_pref['content_restrict_restrict'] = '0';
+			$content_pref['content_restrict_recent'] = '0';
+			$content_pref['content_restrict_allcat'] = '0';
+			$content_pref['content_restrict_onecat'] = '0';
+			$content_pref['content_restrict_contentitem'] = '0';
+			$content_pref['content_restrict_author'] = '0';
+			$content_pref['content_restrict_archive'] = '0';
+			$content_pref['content_restrict_toprated'] = '0';
+			$content_pref['content_restrict_topscore'] = '0';
+			$content_pref['content_restrict_submit'] = '0';
+			$content_pref['content_restrict_frontmanager'] = '0';
 
 			return $content_pref;
 		}
@@ -313,46 +372,41 @@
 
 
 		function getContentPref($id="") {
-			global $sql, $plugintable, $tp, $eArrayStorage;
+			global $sql, $plugintable, $qs, $tp, $eArrayStorage;
 
 			$plugintable = "pcontent";
 
+//echo "get content pref : ".$id."<br />";
+
 			if($id && $id!="0"){	//if $id; use prefs from content table
 				$id = intval($id);
 				$num_rows = $sql -> db_Select($plugintable, "content_pref", "content_id='$id' ");
 				$row = $sql -> db_Fetch();
 				if (empty($row['content_pref'])) {
-					
 					//if no prefs present yet, get them from core (default preferences)
 					$num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' ");
 					//if those are not present, insert the default ones given in this file
 					if ($num_rows == 0) {
-						$content_pref = $this -> ContentDefaultPrefs("0");
+						$content_pref = $this -> ContentDefaultPrefs();
 						$tmp = $eArrayStorage->WriteArray($content_pref);
 						$sql -> db_Insert("core", "'$plugintable', '{$tmp}' ");
 						$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
 					}
 					$row = $sql -> db_Fetch();
-					$tmp = $eArrayStorage->ReadArray($row['e107_value']);
+					$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
 					
 					//create array of custom preset tags
-					foreach($tmp['content_custom_preset_key'] as $ck => $cv){
+					foreach($content_pref['content_custom_preset_key'] as $ck => $cv){
 						if(!empty($cv)){
 							$string[] = $cv;
 						}
 					}
 					if($string){
 						$content_pref['content_custom_preset_key'] = $string;
+					}else{
+						unset($content_pref['content_custom_preset_key']);
 					}
-					//replace the id value for the content_pref
-					foreach($tmp as $k=>$v){
-						if(substr($k,-2) == "_0"){
-							$k = str_replace("_0", "_{$id}", $k);
-						}
-						if(strpos($k, "content_") === 0){
-							$content_pref[$k] = $tp->toDB($v);
-						}
-					}
+
 					//finally we can store the new default prefs into the db
 					$tmp1 = $eArrayStorage->WriteArray($content_pref);
 					$sql -> db_Update($plugintable, "content_pref='{$tmp1}' WHERE content_id='$id' ");
@@ -361,10 +415,20 @@
 				}
 				$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
 
+				if(e_PAGE == "admin_content_config.php" && isset($qs[0]) && $qs[0] == 'option'){
+				}else{
+					//check inheritance, if set, get core prefs (default prefs)
+					if(isset($content_pref['content_inherit']) && $content_pref['content_inherit']!=''){
+						$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
+						$row = $sql -> db_Fetch();
+						$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
+					}
+				}
+
 			}else{					//if not $id; use prefs from default core table
 				$num_rows = $sql -> db_Select("core", "*", "e107_name='$plugintable' ");
 				if ($num_rows == 0) {
-					$content_pref = $this -> ContentDefaultPrefs("0");
+					$content_pref = $this -> ContentDefaultPrefs();
 					$tmp = $eArrayStorage->WriteArray($content_pref);
 					$sql -> db_Insert("core", "'$plugintable', '{$tmp}' ");
 					$sql -> db_Select("core", "*", "e107_name='$plugintable' ");
@@ -377,10 +441,12 @@
 
 		//admin
 		function UpdateContentPref($id){
-			global $plugintable, $sql, $tp, $eArrayStorage;
+			global $qs, $plugintable, $sql, $tp, $eArrayStorage;
 
 			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' ");
@@ -394,6 +460,18 @@
 			}else{
 				$sql -> db_Select($plugintable, "content_pref", "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' ){
+						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);
+						}
+					}
+				}
 			}
 
 			//create array of custom preset tags
@@ -404,6 +482,8 @@
 			}
 			$_POST['content_custom_preset_key'] = $string;
 
+			//echo "<pre>"; print_r($_POST); echo "</pre>";
+
 			foreach($_POST as $k => $v){
 				if(strpos($k, "content_") === 0){
 					$content_pref[$k] = $tp->toDB($v);
@@ -417,6 +497,7 @@
 			}else{
 				$sql -> db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='".intval($id)."' ");
 			}
+
 			return $content_pref;
 		}
 
@@ -443,10 +524,11 @@
 				$qrygc .= " AND content_class REGEXP '".e_CLASS_REGEXP."' ";
 			}
 
+			$datequery		= " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
+
 			$sqlgetcat = new db;
 			if($sqlgetcat -> db_Select($plugintable, "content_id, content_heading, content_parent", " ".$qrygc." ".$datequery." " )){
 				while($row = $sqlgetcat -> db_Fetch()){
-
 					if($agc){
 						if($row['content_parent'] != "0"){
 							if(array_key_exists(substr($row['content_parent'],2), $agc)){
@@ -490,52 +572,92 @@
 		}
 
 		function ShowNextPrev($mode='', $from='0', $number, $total){
-			global $content_pref, $mainparent, $qs;
-			$modepref = ($mode ? "content_{$mode}_nextprev_{$mainparent}" : "content_nextprev_{$mainparent}");
+			global $content_pref, $qs, $tp, $plugindir, $content_shortcodes, $CONTENT_NEXTPREV;
+
+			if($total<=$number){
+				return;
+			}
+
+			$modepref = ($mode ? "content_{$mode}_nextprev" : "content_nextprev");
 			if(isset($content_pref[$modepref]) && $content_pref[$modepref]){
-				require_once(e_HANDLER."np_class.php");
-				$np_querystring = (isset($qs[0]) ? $qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
-				$ix = new nextprev(e_SELF, $from, $number, $total, NP_3, ($np_querystring ? $np_querystring : ""));
+				$np_querystring = e_SELF."?[FROM]".(isset($qs[0]) ? ".".$qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
+				$parms = $total.",".$number.",".$from.",".$np_querystring."";
+				
+				$CONTENT_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
+
+				if(!isset($CONTENT_NP_TABLE)){
+					if(!$content_pref["content_theme"]){
+						require_once($plugindir."templates/default/content_np_template.php");
+					}else{
+						if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_np_template.php")){
+							require_once($tp->replaceConstants($content_pref["content_theme"])."content_np_template.php");
+						}else{
+							require_once($plugindir."templates/default/content_np_template.php");
+						}
+					}
+				}
+				echo $tp -> parseTemplate($CONTENT_NP_TABLE, FALSE, $content_shortcodes);
 			}
 		}
 
 		function getCrumbPage($mode, $arr, $parent){
-			global $qs, $ns, $content_pref, $mainparent;
+			global $qs, $ns, $content_pref, $plugintable;
 
-			if(isset($content_pref["content_breadcrumb_{$mode}_{$mainparent}"]) && $content_pref["content_breadcrumb_{$mode}_{$mainparent}"]){
+			if(isset($content_pref["content_breadcrumb_{$mode}"]) && $content_pref["content_breadcrumb_{$mode}"]){
+				$crumb = '';
 				if(array_key_exists($parent, $arr)){
-					$sep = (isset($content_pref["content_breadcrumb_seperator_{$mainparent}"]) ? $content_pref["content_breadcrumb_seperator_{$mainparent}"] : ">");
-					$crumb = "<a href='".e_BASE."'>".CONTENT_LAN_58."</a> ".$sep." <a href='".e_SELF."'>".CONTENT_LAN_59."</a>";
+					$sep = (isset($content_pref["content_breadcrumb_seperator"]) ? $content_pref["content_breadcrumb_seperator"] : ">");
+					if($content_pref["content_breadcrumb_base"] && isset($content_pref["content_breadcrumb_base"])){
+						$crumb .= "<a href='".e_BASE."'>".CONTENT_LAN_58."</a> ".$sep." ";
+					}
+					if($content_pref["content_breadcrumb_self"] && isset($content_pref["content_breadcrumb_self"])){
+						$crumb .= "<a href='".e_SELF."'>".CONTENT_LAN_59."</a> ".$sep." ";
+					}
 					for($i=0;$i<count($arr[$parent]);$i++){
-						$crumb .= " ".$sep." <a href='".e_SELF."?cat.".$arr[$parent][$i]."'>".$arr[$parent][$i+1]."</a>";
+						$crumb .= "<a href='".e_SELF."?cat.".$arr[$parent][$i]."'>".$arr[$parent][$i+1]."</a> ".$sep." ";
 						$i++;
 					}
 				}
 				if($qs[0] == "recent"){
-					$crumb .= " ".$sep." <a href='".e_SELF."?recent.".$arr[$parent][0]."'>".CONTENT_LAN_60."</a>";
+					$crumb .= "<a href='".e_SELF."?recent.".$arr[$parent][0]."'>".CONTENT_LAN_60."</a>";
 				}
 				if($qs[0] == "author"){
-					$crumb .= " ".$sep." <a href='".e_SELF."?author.list.".$arr[$parent][0]."'>".CONTENT_LAN_85."</a>";
+					$crumb .= "<a href='".e_SELF."?author.list.".$arr[$parent][0]."'>".CONTENT_LAN_85."</a>";
+					if(is_numeric($qs[1])){
+						global $sql;
+						$sql->db_Select($plugintable, "content_author","content_id='".intval($qs[1])."'");
+						$row=$sql->db_Fetch();
+						$au = $this->getAuthor($row['content_author']);
+						$crumb .= " ".$sep." <a href='".e_SELF."?author.".$qs[1]."'>".$au[1]."</a>";
+					}
 				}
 				if($qs[0] == "list"){
-					$crumb .= " ".$sep." <a href='".e_SELF."?list.".$arr[$parent][0]."'>list</a>";
+					$crumb .= "<a href='".e_SELF."?list.".$arr[$parent][0]."'>".CONTENT_LAN_13."</a>";
 				}
 				if($qs[0] == "top"){
-					$crumb .= " ".$sep." <a href='".e_SELF."?top.".$arr[$parent][0]."'>".CONTENT_LAN_8."</a>";
+					$crumb .= "<a href='".e_SELF."?top.".$arr[$parent][0]."'>".CONTENT_LAN_8."</a>";
 				}
 				if($qs[0] == "score"){
-					$crumb .= " ".$sep." <a href='".e_SELF."?score.".$arr[$parent][0]."'>".CONTENT_LAN_12."</a>";
+					$crumb .= "<a href='".e_SELF."?score.".$arr[$parent][0]."'>".CONTENT_LAN_12."</a>";
+				}
+				if($qs[0] == "content"){
+					global $row;
+					$crumb .= $row['content_heading'];
+				}
+				$crumb = trim($crumb);
+				if(substr($crumb,-strlen(trim($sep))) == trim($sep)){
+					$crumb = substr($crumb,0,-strlen(trim($sep)));
 				}
 
-				$margin = "<br /><br />";
-				if(isset($content_pref["content_breadcrumb_rendertype_{$mainparent}"]) && $content_pref["content_breadcrumb_rendertype_{$mainparent}"] == "1"){
-					echo $crumb.$margin;
+				$crumb = "<div class='breadcrumb'>".$crumb."</div>";
+				if(isset($content_pref["content_breadcrumb_rendertype"]) && $content_pref["content_breadcrumb_rendertype"] == "1"){
+					echo $crumb;
 					return "";
-				}elseif(isset($content_pref["content_breadcrumb_rendertype_{$mainparent}"]) && $content_pref["content_breadcrumb_rendertype_{$mainparent}"] == "2"){
-					$ns -> tablerender(CONTENT_LAN_24, $crumb.$margin);
+				}elseif(isset($content_pref["content_breadcrumb_rendertype"]) && $content_pref["content_breadcrumb_rendertype"] == "2"){
+					$ns -> tablerender(CONTENT_LAN_24, $crumb);
 					return "";
 				}else{
-					return $crumb.$margin;
+					return $crumb;
 				}
 			}else{
 				return "";
@@ -555,6 +677,17 @@
 		}
 
 
+		function getCategoryHeading($id){
+			global $plugintable, $sql;
+			$qry = "
+			SELECT c.*, p.*
+			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();
+			return $row2['content_heading'];
+		}
 		function getPageHeading($id){
 			global $plugintable, $sql;
 			$sql -> db_Select($plugintable, "content_heading", "content_id='".intval($id)."' ");
@@ -581,14 +714,14 @@
 
 					//item
 					}elseif($qs[0] == "content" && isset($qs[1]) && is_numeric($qs[1]) ){
-						$page .= " / ".$this -> getPageHeading($qs[1]);
+						$page .= " / ".$this -> getCategoryHeading($qs[1])." / ".$this -> getPageHeading($qs[1]);
 
 					//all categories of parent='2'
 					}elseif($qs[0] == "cat" && $qs[1] == "list" && is_numeric($qs[2])){
 						$page .= " / ".$this -> getPageHeading($qs[2])." / ".CONTENT_PAGETITLE_LAN_13;
 
 					//category of parent='2' and content_id='5'
-					}elseif($qs[0] == "cat" && is_numeric($qs[1]) && !isset($qs[2])){
+					}elseif($qs[0] == "cat" && is_numeric($qs[1]) && (!isset($qs[2]) || isset($qs[2]) && $qs[2]=='view') ){
 						$page .= " / ".CONTENT_PAGETITLE_LAN_3." / ".$row['content_heading'];
 
 					//top rated of parent='2'
@@ -650,7 +783,7 @@
 					}
 				}
 			}
-			define("e_PAGETITLE", strtolower($page));
+			define("e_PAGETITLE", $page);
 
 		}
 
@@ -817,9 +950,7 @@
 			}elseif(isset($qs[3]) && substr($qs[3],0,5) == "order"){
 				$orderstring	= $qs[3];
 			}else{
-				$checkmi		= (is_numeric($qs[1]) ? $qs[1] : intval($qs[2]));
-				$checkmp		= $this -> getMainParent($checkmi);
-				$orderstring	= ($content_pref["content_defaultorder_{$checkmp}"] ? $content_pref["content_defaultorder_{$checkmp}"] : "orderddate" );
+				$orderstring	= ($content_pref["content_defaultorder"] ? $content_pref["content_defaultorder"] : "orderddate" );
 			}
 
 			if(substr($orderstring,6) == "heading"){
@@ -865,7 +996,8 @@
 			if($mode == "item"){
 				$path		= (!$path ? $content_icon_path : $path);
 				$width		= ($width ? "width:".$width."px;" : "");
-				$border		= "border:1px solid #000;";
+				//$border		= "border:1px solid #000;";
+				$border		= '';
 				$icon		= ($icon ? $path.$icon : ($blank ? $content_icon_path."blank.gif" : ""));
 
 			}elseif($mode == "catsmall"){
@@ -902,31 +1034,35 @@
 		}
 
 		function prepareAuthor($mode, $author, $id){
-			global $aa, $mainparent, $content_pref;
+			global $aa, $content_pref;
 			if($mode == ''){return;}
 
 			$authorinfo = "";
-			if( (isset($content_pref["content_{$mode}_authorname_{$mainparent}"]) && $content_pref["content_{$mode}_authorname_{$mainparent}"]) || (isset($content_pref["content_{$mode}_authoremail_{$mainparent}"]) && $content_pref["content_{$mode}_authoremail_{$mainparent}"]) || (isset($content_pref["content_{$mode}_authoricon_{$mainparent}"]) && $content_pref["content_{$mode}_authoricon_{$mainparent}"]) || (isset($content_pref["content_{$mode}_authorprofile_{$mainparent}"]) && $content_pref["content_{$mode}_authorprofile_{$mainparent}"]) ){
+			if( (isset($content_pref["content_{$mode}_authorname"]) && $content_pref["content_{$mode}_authorname"]) || (isset($content_pref["content_{$mode}_authoremail"]) && $content_pref["content_{$mode}_authoremail"]) || (isset($content_pref["content_{$mode}_authoricon"]) && $content_pref["content_{$mode}_authoricon"]) || (isset($content_pref["content_{$mode}_authorprofile"]) && $content_pref["content_{$mode}_authorprofile"]) ){
 				$authordetails = $this -> getAuthor($author);
-				if(isset($content_pref["content_{$mode}_authorname_{$mainparent}"]) && $content_pref["content_{$mode}_authorname_{$mainparent}"]){
-					if(isset($content_pref["content_{$mode}_authoremail_{$mainparent}"]) && $authordetails[2]){
+				if(isset($content_pref["content_{$mode}_authorname"]) && $content_pref["content_{$mode}_authorname"]){
+					if(isset($content_pref["content_{$mode}_authoremail"]) && $authordetails[2]){
 						if($authordetails[0] == "0"){
-							if(isset($content_pref["content_{$mode}_authoremail_nonmember_{$mainparent}"]) && $content_pref["content_{$mode}_authoremail_nonmember_{$mainparent}"] && strpos($authordetails[2], "@") ){
-								$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>";
+							if(isset($content_pref["content_{$mode}_authoremail_nonmember"]) && $content_pref["content_{$mode}_authoremail_nonmember"] && strpos($authordetails[2], "@") ){
+								//$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>";
+								
+								$authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]);
 							}else{
 								$authorinfo = $authordetails[1];
 							}
 						}else{
-							$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>";
+							//$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>";
+
+							$authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]);
 						}
 					}else{
 						$authorinfo = $authordetails[1];
 					}
-					if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0" && isset($content_pref["content_{$mode}_authorprofile_{$mainparent}"]) && $content_pref["content_{$mode}_authorprofile_{$mainparent}"]){
+					if(USER && is_numeric($authordetails[0]) && $authordetails[0] != "0" && isset($content_pref["content_{$mode}_authorprofile"]) && $content_pref["content_{$mode}_authorprofile"]){
 						$authorinfo .= " <a href='".e_BASE."user.php?id.".$authordetails[0]."' title='".CONTENT_LAN_40."'>".CONTENT_ICON_USER."</a>";
 					}
 				}
-				if(isset($content_pref["content_{$mode}_authoricon_{$mainparent}"]) && $content_pref["content_{$mode}_authoricon_{$mainparent}"]){
+				if(isset($content_pref["content_{$mode}_authoricon"]) && $content_pref["content_{$mode}_authoricon"]){
 					$authorinfo .= " <a href='".e_SELF."?author.".$id."' title='".CONTENT_LAN_39."'>".CONTENT_ICON_AUTHORLIST."</a>";
 				}
 			}
@@ -967,12 +1103,12 @@
 			}
 
 			if($mode == "menu"){
-				$CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearchmenu_{$mode}", "", "enctype='multipart/form-data'")."<input class='tbox' size='20' type='text' id='searchfieldmenu_{$mode}' name='searchfieldmenu_{$mode}' value='".(isset($_POST['searchfieldmenu_{$mode}']) ? $_POST['searchfieldmenu_{$mode}'] : CONTENT_LAN_18)."' maxlength='100' onfocus=\"document.forms['contentsearchmenu_{$mode}'].searchfieldmenu_$mode.value='';\" /> <input class='button' type='submit' name='searchsubmit' value='".CONTENT_LAN_19."' />".$rs -> form_close();
+				$CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearchmenu_{$mode}", "", "enctype='multipart/form-data'")."<div><input class='tbox' size='20' type='text' id='searchfieldmenu_{$mode}' name='searchfieldmenu_{$mode}' value='".(isset($_POST['searchfieldmenu_{$mode}']) ? $_POST['searchfieldmenu_{$mode}'] : CONTENT_LAN_18)."' maxlength='100' onfocus=\"document.forms['contentsearchmenu_{$mode}'].searchfieldmenu_$mode.value='';\" /> <input class='button' type='submit' name='searchsubmit' value='".CONTENT_LAN_19."' /></div>".$rs -> form_close();
 			}else{
 				$searchfieldname = "searchfield_{$mode}";
-				$CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearch_{$mode}", "", "enctype='multipart/form-data'")."
+				$CONTENT_SEARCH_TABLE_KEYWORD = $rs -> form_open("post", $plugindir."content.php?recent.$searchtypeid", "contentsearch_{$mode}", "", "enctype='multipart/form-data'")."<div>
 				<input class='tbox' size='27' type='text' id='$searchfieldname' name='$searchfieldname' value='".(isset($_POST[$searchfieldname]) ? $_POST[$searchfieldname] : CONTENT_LAN_18)."' maxlength='100' onfocus=\"document.forms['contentsearch_{$mode}'].$searchfieldname.value='';\" />
-				<input class='button' type='submit' name='searchsubmit' value='".CONTENT_LAN_19."' />
+				<input class='button' type='submit' name='searchsubmit' value='".CONTENT_LAN_19."' /></div>
 				".$rs -> form_close();
 			}
 			return $CONTENT_SEARCH_TABLE_KEYWORD;
@@ -1003,59 +1139,57 @@
 				}
 			}
 			if($newparent){
-				$emptystring = "-- categories --";
+				$emptystring = CONTENT_LAN_14;
 				$catarray = $rs -> form_option($emptystring, "0", "none");
 			}
 			foreach($newparent as $key => $value){
 				$n = "";
-				if($mode == "page" || ($mode == "menu" && isset($content_pref["content_menu_cat_number_{$mainparent}"])) ){
+				if($mode == "page" || ($mode == "menu" && isset($content_pref["content_menu_cat_number"])) ){
 					$n = $this -> countCatItems($key);
 					$n = " (".$n." ".($n == "1" ? CONTENT_LAN_53 : CONTENT_LAN_54).")";
 				}
-				if( ($content_pref["content_menu_cat_main_$mainparent"] && $key == $mainparent) || $key != $mainparent ){
+				if( ($content_pref["content_menu_cat_main"] && $key == $mainparent) || $key != $mainparent ){
 					$value = (strlen($value) > 25 ? substr($value,0,25)."..." : $value);
 					$catarray .= $rs -> form_option($value.$n, 0, $plugindir."content.php?cat.".$key);
 				}
 			}
 
-			if($mode == "page" || ($mode == "menu" && ($content_pref["content_menu_links_$mainparent"] && $content_pref["content_menu_links_dropdown_$mainparent"]) || ($content_pref["content_menu_cat_$mainparent"] && $content_pref["content_menu_cat_dropdown_$mainparent"]) ) ){
+			if($mode == "page" || ($mode == "menu" && ($content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) || ($content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"]) ) ){
 				if($mode == "menu"){ $style = "style='width:100%;' "; }else{ $style = ""; }
 				$CONTENT_SEARCH_TABLE_SELECT = "
 				".$rs -> form_open("post", $plugindir."content.php".(e_QUERY ? "?".e_QUERY : ""), "contentredirect".$mode, "", "enctype='multipart/form-data'")."				
-				<select id='{$mode}value' name='{$mode}value' class='tbox' $style onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">";					
+				<div><select id='{$mode}value' name='{$mode}value' class='tbox' $style onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">";					
 
-				if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_links_$mainparent"] && $content_pref["content_menu_links_dropdown_$mainparent"]) ){
+				if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_links"] && $content_pref["content_menu_links_dropdown"]) ){
 					$CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_56, 1, "none").$rs -> form_option("&nbsp;", "0", "none");
 
-					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallcat_$mainparent"])){
+					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallcat"])){
 					   $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_6, 0, $plugindir."content.php?cat.list.".$mainparent);
 					}
-					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallauthor_$mainparent"])){
+					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallauthor"])){
 					   $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_7, 0, $plugindir."content.php?author.list.".$mainparent);
 					}
-					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallitems_$mainparent"])){
+					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewallitems"])){
 					   $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_83, 0, $plugindir."content.php?list.".$mainparent);
 					}
-					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtoprated_$mainparent"])){
+					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtoprated"])){
 					   $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_8, 0, $plugindir."content.php?top.".$mainparent);
 					}
-					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtopscore_$mainparent"])){
+					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewtopscore"])){
 					   $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_12, 0, $plugindir."content.php?score.".$mainparent);
 					}
-					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewrecent_$mainparent"])){
+					if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewrecent"])){
 					   $CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_61, 0, $plugindir."content.php?recent.".$mainparent);
 					}
-					if( ($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewsubmit_$mainparent"]) && $content_pref["content_submit_$mainparent"] && check_class($content_pref["content_submit_class_$mainparent"]) ) ){
+					if( ($mode == "page" || ($mode == "menu" && $content_pref["content_menu_viewsubmit"]) && $content_pref["content_submit"] && check_class($content_pref["content_submit_class"]) ) ){
 						$CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option(CONTENT_LAN_75, 0, $plugindir."content_submit.php");
 					}
 					$CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_option("&nbsp;", "0", "none");
 				}
-				if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_cat_$mainparent"] && $content_pref["content_menu_cat_dropdown_$mainparent"])){
+				if($mode == "page" || ($mode == "menu" && $content_pref["content_menu_cat"] && $content_pref["content_menu_cat_dropdown"])){
 					$CONTENT_SEARCH_TABLE_SELECT .= $catarray;
 				}
-				$CONTENT_SEARCH_TABLE_SELECT .= "
-				".$rs -> form_select_close()."
-				".$rs -> form_close();
+				$CONTENT_SEARCH_TABLE_SELECT .= $rs -> form_select_close()."</div>".$rs -> form_close();
 			}
 			return $CONTENT_SEARCH_TABLE_SELECT;
 		}
@@ -1087,7 +1221,7 @@
 					$baseurl = $plugindir."content.php";
 					$qry = (isset($qs[0]) && substr($qs[0],0,5) != "order" ? $qs[0] : "").(isset($qs[1]) && substr($qs[1],0,5) != "order" ? ".".$qs[1] : "").(isset($qs[2]) && substr($qs[2],0,5) != "order" ? ".".$qs[2] : "").(isset($qs[3]) && substr($qs[3],0,5) != "order" ? ".".$qs[3] : "");
 					$text = $rs -> form_open("post", $baseurl."?$qs[0].$ordertypeid", "contentsearchorder{$mode}", "", "enctype='multipart/form-data'");
-					$text .= "<select id='ordervalue{$mode}' name='ordervalue{$mode}' class='tbox' onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">";
+					$text .= "<div><select id='ordervalue{$mode}' name='ordervalue{$mode}' class='tbox' onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\">";
 					$text .= $rs -> form_option(CONTENT_ORDER_LAN_0, 1, "none");
 
 					if($qs[0] == "author" && $qs[1] == "list"){
@@ -1106,6 +1240,7 @@
 						$text .= $rs -> form_option(CONTENT_ORDER_LAN_10, ($check == "orderdorder" ? "1" : "0"), $baseurl."?".$qry.".orderdorder" );
 					}
 					$text .= $rs -> form_select_close();
+					$text .= "</div>";
 					$text .= $rs -> form_close();
 				}
 			}
@@ -1135,226 +1270,228 @@
 
 			$data = chr(60)."?php\n". chr(47)."*\n+---------------------------------------------------------------+\n|        e107 website system\n|        ".e_PLUGIN."content/menus/".$menufile."_menu.php\n|\n|        Steve Dunstan 2001-2002\n|        http://e107.org\n|        jalist@e107.org\n|\n|        Released under the terms and conditions of the\n|        GNU General Public License (http://gnu.org).\n+---------------------------------------------------------------+\n\nThis file has been generated by ".e_PLUGIN."content/handlers/content_class.php.\n\n*". chr(47)."\n\n";
 			$data .= "\n";
-			$data .= "unset(".chr(36)."text);\n";
-			$data .= chr(36)."text = \"\";\n";
-			$data .= chr(36)."menutypeid		= \"$parentid\";\n";
-			$data .= chr(36)."menuname		= \"$menuname\";\n";
-			$data .= "\n";
-			$data .= chr(36)."plugindir		= e_PLUGIN.'content/';\n";
-			$data .= chr(36)."plugintable	= \"pcontent\";		//name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)\n";
-			$data .= chr(36)."datequery		= \" AND content_datestamp < \".time().\" AND (content_enddate=0 || content_enddate>\".time().\") \";\n";
+			$data .= "unset(\$text);\n";
+			$data .= "\$text = \"\";\n";
+			$data .= "\$menutypeid		= \"$parentid\";\n";
+			$data .= "\$menuname		= \"$menuname\";\n";
+			$data .= "\n";
+			$data .= "\$plugindir		= e_PLUGIN.'content/';\n";
+			$data .= "\$plugintable	= \"pcontent\";		//name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)\n";
+			$data .= "\$datequery		= \" AND content_datestamp < \".time().\" AND (content_enddate=0 || content_enddate>\".time().\") \";\n";
 			$data .= "\n";
 			$data .= "require_once(e_PLUGIN.'content/handlers/content_class.php');\n";
-			$data .= chr(36)."aa = new content;\n";
+			$data .= "\$aa = new content;\n";
 			$data .= "require_once(e_HANDLER.'form_handler.php');\n";
-			$data .= chr(36)."rs = new form;\n";
-			$data .= chr(36)."gen = new convert;\n";
-			$data .= "global ".chr(36)."tp;\n";
-			$data .= "\n";
-			$data .= chr(36)."lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php';\n";
-			$data .= "include_once(file_exists(".chr(36)."lan_file) ? ".chr(36)."lan_file : e_PLUGIN.'content/languages/English/lan_content.php');\n";
-			$data .= "\n";
-			$data .= chr(36)."content_pref					= ".chr(36)."aa -> getContentPref(".chr(36)."menutypeid);\n";
-			$data .= chr(36)."content_icon_path				= ".chr(36)."tp -> replaceConstants(".chr(36)."content_pref[\"content_icon_path_".chr(36)."menutypeid\"]);\n";
-			$data .= chr(36)."content_cat_icon_path_small	= ".chr(36)."tp -> replaceConstants(".chr(36)."content_pref[\"content_cat_icon_path_small_".chr(36)."menutypeid\"]);\n";
+			$data .= "\$rs = new form;\n";
+			$data .= "\$gen = new convert;\n";
+			$data .= "global \$tp;\n";
 			$data .= "\n";
-			$data .= "	".chr(36)."break = FALSE;\n";
+			$data .= "\$lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php';\n";
+			$data .= "include_once(file_exists(\$lan_file) ? \$lan_file : e_PLUGIN.'content/languages/English/lan_content.php');\n";
+			$data .= "\n";
+			$data .= "\$bullet = (defined('BULLET') ? \"<img src='\".THEME_ABS.\"images/\".BULLET.\"' alt='' style='border:0;vertical-align: middle;' />\" : \"<img src='\".THEME_ABS.\"images/bullet2.gif' alt='bullet' style='border:0;vertical-align: middle;' />\");\n";
+			$data .= "\n";
+			$data .= "\$content_pref					= \$aa -> getContentPref(\$menutypeid);\n";
+			$data .= "\$content_icon_path				= \$tp -> replaceConstants(\$content_pref[\"content_icon_path\"]);\n";
+			$data .= "\$content_cat_icon_path_small	= \$tp -> replaceConstants(\$content_pref[\"content_cat_icon_path_small\"]);\n";
+			$data .= "\n";
+			$data .= "	\$break = FALSE;\n";
 			$data .= "//##### SEARCH SELECT ORDER --------------------------------------------------\n";
 			$data .= "//show search box\n";
-			$data .= "if(".chr(36)."content_pref[\"content_menu_search_".chr(36)."menutypeid\"]){\n";
-			$data .= "	".chr(36)."text .= ".chr(36)."aa -> showOptionsSearch(\"menu\", ".chr(36)."menutypeid);\n";
-			$data .= "	".chr(36)."break = TRUE;\n";
+			$data .= "if(\$content_pref[\"content_menu_search\"]){\n";
+			$data .= "	\$text .= \$aa -> showOptionsSearch(\"menu\", \$menutypeid);\n";
+			$data .= "	\$break = TRUE;\n";
 			$data .= "}\n";
 			$data .= "//show select box (with either links to other content pages, to categories, to both, or don't show at all)\n";
-			$data .= "if( (".chr(36)."content_pref[\"content_menu_links_".chr(36)."menutypeid\"] && ".chr(36)."content_pref[\"content_menu_links_dropdown_".chr(36)."menutypeid\"]) || (".chr(36)."content_pref[\"content_menu_cat_".chr(36)."menutypeid\"] && ".chr(36)."content_pref[\"content_menu_cat_dropdown_".chr(36)."menutypeid\"]) ){\n";
-			$data .= "	".chr(36)."text .= ".chr(36)."aa -> showOptionsSelect(\"menu\", ".chr(36)."menutypeid);\n";
-			$data .= "	".chr(36)."break = TRUE;\n";
+			$data .= "if( (\$content_pref[\"content_menu_links\"] && \$content_pref[\"content_menu_links_dropdown\"]) || (\$content_pref[\"content_menu_cat\"] && \$content_pref[\"content_menu_cat_dropdown\"]) ){\n";
+			$data .= "	\$text .= \$aa -> showOptionsSelect(\"menu\", \$menutypeid);\n";
+			$data .= "	\$break = TRUE;\n";
 			$data .= "}\n";
 			$data .= "//show order box\n";
-			$data .= "if(".chr(36)."content_pref[\"content_menu_sort_".chr(36)."menutypeid\"]){\n";
-			$data .= "	".chr(36)."text .= ".chr(36)."aa -> showOptionsOrder(\"menu\", ".chr(36)."menutypeid);\n";
-			$data .= "	".chr(36)."break = TRUE;\n";
+			$data .= "if(\$content_pref[\"content_menu_sort\"]){\n";
+			$data .= "	\$text .= \$aa -> showOptionsOrder(\"menu\", \$menutypeid);\n";
+			$data .= "	\$break = TRUE;\n";
 			$data .= "}\n";
 			$data .= "\n";
 			$data .= "//show links list if chosen so\n";
-			$data .= "if(".chr(36)."content_pref[\"content_menu_links_".chr(36)."menutypeid\"] && !".chr(36)."content_pref[\"content_menu_links_dropdown_".chr(36)."menutypeid\"]){\n";
-			$data .= "	if(".chr(36)."break === TRUE){\n";
-			$data .= "	   ".chr(36)."text .= \"<br />\";\n";
+			$data .= "if(\$content_pref[\"content_menu_links\"] && !\$content_pref[\"content_menu_links_dropdown\"]){\n";
+			$data .= "	if(\$break === TRUE){\n";
+			$data .= "	   \$text .= \"<br />\";\n";
 			$data .= "	}\n";
-			$data .= "	".chr(36)."text .= (".chr(36)."content_pref[\"content_menu_links_caption_".chr(36)."menutypeid\"] != \"\" ? ".chr(36)."content_pref[\"content_menu_links_caption_".chr(36)."menutypeid\"] : CONTENT_MENU_LAN_4).\"<br />\";\n";
+			$data .= "	\$text .= (\$content_pref[\"content_menu_links_caption\"] != \"\" ? \$content_pref[\"content_menu_links_caption\"] : CONTENT_MENU_LAN_4).\"<br />\";\n";
 			$data .= "\n";
 			$data .= "	//define icon\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_links_icon_".chr(36)."menutypeid\"] == \"0\"){ ".chr(36)."linksicon = \"\";\n";
-			$data .= "	}elseif(".chr(36)."content_pref[\"content_menu_links_icon_".chr(36)."menutypeid\"] == \"1\"){ ".chr(36)."linksicon = \"<img src='\".THEME.\"images/bullet2.gif' alt='' />\";\n";
-			$data .= "	}elseif(".chr(36)."content_pref[\"content_menu_links_icon_".chr(36)."menutypeid\"] == \"2\"){ ".chr(36)."linksicon = \"&middot\";\n";
-			$data .= "	}elseif(".chr(36)."content_pref[\"content_menu_links_icon_".chr(36)."menutypeid\"] == \"3\"){ ".chr(36)."linksicon = \"&ordm;\";\n";
-			$data .= "	}elseif(".chr(36)."content_pref[\"content_menu_links_icon_".chr(36)."menutypeid\"] == \"4\"){ ".chr(36)."linksicon = \"&raquo;\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_links_icon\"] == \"0\"){ \$linksicon = \"\";\n";
+			$data .= "	}elseif(\$content_pref[\"content_menu_links_icon\"] == \"1\"){ \$linksicon = \$bullet;\n";
+			$data .= "	}elseif(\$content_pref[\"content_menu_links_icon\"] == \"2\"){ \$linksicon = \"&middot\";\n";
+			$data .= "	}elseif(\$content_pref[\"content_menu_links_icon\"] == \"3\"){ \$linksicon = \"&ordm;\";\n";
+			$data .= "	}elseif(\$content_pref[\"content_menu_links_icon\"] == \"4\"){ \$linksicon = \"&raquo;\";\n";
 			$data .= "	}\n";
 			$data .= "\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_viewallcat_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content.php?cat.list.\".".chr(36)."menutypeid.\"'>\".CONTENT_LAN_6.\"</a><br />\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_viewallcat\"]){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?cat.list.\".\$menutypeid.\"'>\".CONTENT_LAN_6.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_viewallauthor_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content.php?author.list.\".".chr(36)."menutypeid.\"'>\".CONTENT_LAN_7.\"</a><br />\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_viewallauthor\"]){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?author.list.\".\$menutypeid.\"'>\".CONTENT_LAN_7.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_viewallitems_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content.php?list.\".".chr(36)."menutypeid.\"'>\".CONTENT_LAN_83.\"</a><br />\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_viewallitems\"]){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?list.\".\$menutypeid.\"'>\".CONTENT_LAN_83.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_viewtoprated_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content.php?top.\".".chr(36)."menutypeid.\"'>\".CONTENT_LAN_8.\"</a><br />\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_viewtoprated\"]){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?top.\".\$menutypeid.\"'>\".CONTENT_LAN_8.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_viewtopscore_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content.php?score.\".".chr(36)."menutypeid.\"'>\".CONTENT_LAN_12.\"</a><br />\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_viewtopscore\"]){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?score.\".\$menutypeid.\"'>\".CONTENT_LAN_12.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_viewrecent_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content.php?recent.\".".chr(36)."menutypeid.\"'>\".CONTENT_LAN_61.\"</a><br />\";\n";
+			$data .= "	if(\$content_pref[\"content_menu_viewrecent\"]){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content.php?recent.\".\$menutypeid.\"'>\".CONTENT_LAN_61.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	if( ".chr(36)."content_pref[\"content_menu_viewsubmit_".chr(36)."menutypeid\"] && ".chr(36)."content_pref[\"content_submit_".chr(36)."menutypeid\"] && check_class(".chr(36)."content_pref[\"content_submit_class_".chr(36)."menutypeid\"]) ){\n";
-			$data .= "		".chr(36)."text .= ".chr(36)."linksicon.\" <a href='\".".chr(36)."plugindir.\"content_submit.php'>\".CONTENT_LAN_75.\"</a><br />\";\n";
+			$data .= "	if( \$content_pref[\"content_menu_viewsubmit\"] && \$content_pref[\"content_submit\"] && check_class(\$content_pref[\"content_submit_class\"]) ){\n";
+			$data .= "		\$text .= \$linksicon.\" <a href='\".\$plugindir.\"content_submit.php'>\".CONTENT_LAN_75.\"</a><br />\";\n";
 			$data .= "	}\n";
-			$data .= "	".chr(36)."text .= \"<br />\";\n";
+			$data .= "	\$text .= \"<br />\";\n";
 			$data .= "}\n";
 			$data .= "\n";
 			$data .= "//get category array\n";
-			$data .= chr(36)."array = ".chr(36)."aa -> getCategoryTree(\"\", intval(".chr(36)."menutypeid), TRUE);\n";
+			$data .= "\$array = \$aa -> getCategoryTree(\"\", intval(\$menutypeid), TRUE);\n";
 			$data .= "\n";
 			$data .= "//##### CATEGORY LIST --------------------------------------------------\n";
-			$data .= "if(!".chr(36)."content_pref[\"content_menu_cat_dropdown_".chr(36)."menutypeid\"]){\n";
-			$data .= "	if(".chr(36)."content_pref[\"content_menu_cat_".chr(36)."menutypeid\"]){\n";
-			$data .= "		".chr(36)."text .= (".chr(36)."content_pref[\"content_menu_cat_caption_".chr(36)."menutypeid\"] != \"\" ? ".chr(36)."content_pref[\"content_menu_cat_caption_".chr(36)."menutypeid\"] : CONTENT_MENU_LAN_3).\"<br />\";\n";
-			$data .= "\n";
-			$data .= "		".chr(36)."newparent = \"\";\n";
-			$data .= "		".chr(36)."checkid = \"\";\n";
-			$data .= "		".chr(36)."newarray = array_merge_recursive(".chr(36)."array);\n";
-			$data .= "		for(".chr(36)."a=0;".chr(36)."a<count(".chr(36)."newarray);".chr(36)."a++){\n";
-			$data .= "			for(".chr(36)."b=0;".chr(36)."b<count(".chr(36)."newarray[".chr(36)."a]);".chr(36)."b++){\n";
-			$data .= "				".chr(36)."newparent[".chr(36)."newarray[".chr(36)."a][".chr(36)."b]] = ".chr(36)."newarray[".chr(36)."a][".chr(36)."b+1];\n";
-			$data .= "				if( (".chr(36)."content_pref[\"content_menu_cat_main_".chr(36)."menutypeid\"] && ".chr(36)."newarray[".chr(36)."a][".chr(36)."b] == ".chr(36)."menutypeid) || ".chr(36)."newarray[".chr(36)."a][".chr(36)."b] != ".chr(36)."menutypeid ){\n";
-			$data .= "					".chr(36)."checkid .= \" content_id = '\".".chr(36)."newarray[".chr(36)."a][".chr(36)."b].\"' OR \";\n";
+			$data .= "if(!\$content_pref[\"content_menu_cat_dropdown\"]){\n";
+			$data .= "	if(\$content_pref[\"content_menu_cat\"]){\n";
+			$data .= "		\$text .= (\$content_pref[\"content_menu_cat_caption\"] != \"\" ? \$content_pref[\"content_menu_cat_caption\"] : CONTENT_MENU_LAN_3).\"<br />\";\n";
+			$data .= "\n";
+			$data .= "		\$newparent = \"\";\n";
+			$data .= "		\$checkid = \"\";\n";
+			$data .= "		\$newarray = array_merge_recursive(\$array);\n";
+			$data .= "		for(\$a=0;\$a<count(\$newarray);\$a++){\n";
+			$data .= "			for(\$b=0;\$b<count(\$newarray[\$a]);\$b++){\n";
+			$data .= "				\$newparent[\$newarray[\$a][\$b]] = \$newarray[\$a][\$b+1];\n";
+			$data .= "				if( (\$content_pref[\"content_menu_cat_main\"] && \$newarray[\$a][\$b] == \$menutypeid) || \$newarray[\$a][\$b] != \$menutypeid ){\n";
+			$data .= "					\$checkid .= \" content_id = '\".\$newarray[\$a][\$b].\"' OR \";\n";
 			$data .= "				}\n";
-			$data .= "				".chr(36)."b++;\n";
+			$data .= "				\$b++;\n";
 			$data .= "			}\n";
 			$data .= "		}\n";
-			$data .= "		".chr(36)."checkid = substr(".chr(36)."checkid,0,-3);\n";
-			$data .= "		if(!is_object(".chr(36)."sql)){ ".chr(36)."sql = new db; }\n";
+			$data .= "		\$checkid = substr(\$checkid,0,-3);\n";
+			$data .= "		if(!is_object(\$sql)){ \$sql = new db; }\n";
 			
-			$data .= "		if(".chr(36)."sql -> db_Select(".chr(36)."plugintable, \"*\", \" \".".chr(36)."checkid.\" ORDER BY content_order \")){\n";
-			$data .= "			while(".chr(36)."row = ".chr(36)."sql -> db_Fetch()){\n";
+			$data .= "		if(\$sql -> db_Select(\$plugintable, \"*\", \" \".\$checkid.\" ORDER BY SUBSTRING_INDEX(content_order, '.', 1)+0 \")){\n";
+			$data .= "			while(\$row = \$sql -> db_Fetch()){\n";
 			$data .= "\n";
 			$data .= "				//define icon\n";
-			$data .= "				".chr(36)."ICON = \"\";\n";
-			$data .= "				if(".chr(36)."content_pref[\"content_menu_cat_icon_".chr(36)."menutypeid\"] == \"0\"){ ".chr(36)."ICON = \"\";\n";
-			$data .= "				}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_".chr(36)."menutypeid\"] == \"1\"){ ".chr(36)."ICON = \"<img src='\".THEME.\"images/bullet2.gif' alt='' style='border:0;' />\";\n";
-			$data .= "				}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_".chr(36)."menutypeid\"] == \"2\"){ ".chr(36)."ICON = \"&middot\";\n";
-			$data .= "				}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_".chr(36)."menutypeid\"] == \"3\"){ ".chr(36)."ICON = \"&ordm;\";\n";
-			$data .= "				}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_".chr(36)."menutypeid\"] == \"4\"){ ".chr(36)."ICON = \"&raquo;\";\n";
-			$data .= "				}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_".chr(36)."menutypeid\"] == \"5\"){\n";
-			$data .= "					if(".chr(36)."row['content_icon'] != \"\" && file_exists(".chr(36)."content_cat_icon_path_small.".chr(36)."row['content_icon']) ){\n";
-			$data .= "						".chr(36)."ICON = \"<img src='\".".chr(36)."content_cat_icon_path_small.".chr(36)."row['content_icon'].\"' alt='' style='border:0;' />\";\n";
+			$data .= "				\$ICON = \"\";\n";
+			$data .= "				if(\$content_pref[\"content_menu_cat_icon\"] == \"0\"){ \$ICON = \"\";\n";
+			$data .= "				}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"1\"){ \$ICON = \$bullet;\n";
+			$data .= "				}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"2\"){ \$ICON = \"&middot\";\n";
+			$data .= "				}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"3\"){ \$ICON = \"&ordm;\";\n";
+			$data .= "				}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"4\"){ \$ICON = \"&raquo;\";\n";
+			$data .= "				}elseif(\$content_pref[\"content_menu_cat_icon\"] == \"5\"){\n";
+			$data .= "					if(\$row['content_icon'] != \"\" && file_exists(\$content_cat_icon_path_small.\$row['content_icon']) ){\n";
+			$data .= "						\$ICON = \"<img src='\".\$content_cat_icon_path_small.\$row['content_icon'].\"' alt='' style='border:0;' />\";\n";
 			$data .= "					}else{\n";
 			$data .= "						//default category icon\n";
-			$data .= "						if(".chr(36)."content_pref[\"content_menu_cat_icon_default_".chr(36)."menutypeid\"] == \"0\"){ ".chr(36)."ICON = \"\";\n";
-			$data .= "						}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_default_".chr(36)."menutypeid\"] == \"1\"){ ".chr(36)."ICON = \"<img src='\".THEME.\"images/bullet2.gif' alt='' style='border:0;' />\";\n";
-			$data .= "						}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_default_".chr(36)."menutypeid\"] == \"2\"){ ".chr(36)."ICON = \"&middot\";\n";
-			$data .= "						}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_default_".chr(36)."menutypeid\"] == \"3\"){ ".chr(36)."ICON = \"&ordm;\";\n";
-			$data .= "						}elseif(".chr(36)."content_pref[\"content_menu_cat_icon_default_".chr(36)."menutypeid\"] == \"4\"){ ".chr(36)."ICON = \"&raquo;\";\n";
+			$data .= "						if(\$content_pref[\"content_menu_cat_icon_default\"] == \"0\"){ \$ICON = \"\";\n";
+			$data .= "						}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"1\"){ \$ICON = \$bullet;\n";
+			$data .= "						}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"2\"){ \$ICON = \"&middot\";\n";
+			$data .= "						}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"3\"){ \$ICON = \"&ordm;\";\n";
+			$data .= "						}elseif(\$content_pref[\"content_menu_cat_icon_default\"] == \"4\"){ \$ICON = \"&raquo;\";\n";
 			$data .= "						}\n";
 			$data .= "					}\n";
 			$data .= "				}\n";
 			$data .= "				//display category list\n";
-			$data .= "				".chr(36)."text .= \"<table style='width:100%; text-align:left; border:0;' cellpadding='0' cellspacing='0'>\";\n";
-			$data .= "				".chr(36)."text .= \"<tr>\";\n";
-			$data .= "				".chr(36)."text .= (".chr(36)."ICON ? \"<td style='width:1%; white-space:nowrap; text-align:left; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?cat.\".".chr(36)."row['content_id'].\"'>\".".chr(36)."ICON.\"</a></td>\" : \"\");\n";
-			$data .= "				".chr(36)."text .= \"<td colspan='2'>\";\n";
-			$data .= "				".chr(36)."text .= \"<a href='\".e_PLUGIN.\"content/content.php?cat.\".".chr(36)."row['content_id'].\"'>\".".chr(36)."row['content_heading'].\"</a>\";\n";
-			$data .= "				".chr(36)."text .= (".chr(36)."content_pref[\"content_menu_cat_number_".chr(36)."menutypeid\"] ? \" <span class='smalltext'>(\".".chr(36)."aa -> countCatItems(".chr(36)."row['content_id']).\")</span>\" : \"\");\n";
-			$data .= "				".chr(36)."text .= \"</td>\";\n";
-			$data .= "				".chr(36)."text .= \"</tr>\";\n";
-			$data .= "				".chr(36)."text .= \"</table>\";\n";
+			$data .= "				\$text .= \"<table style='width:100%; text-align:left; border:0;' cellpadding='0' cellspacing='0'>\";\n";
+			$data .= "				\$text .= \"<tr>\";\n";
+			$data .= "				\$text .= (\$ICON ? \"<td style='width:1%; white-space:nowrap; text-align:left; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?cat.\".\$row['content_id'].\"'>\".\$ICON.\"</a></td>\" : \"\");\n";
+			$data .= "				\$text .= \"<td colspan='2'>\";\n";
+			$data .= "				\$text .= \"<a href='\".e_PLUGIN.\"content/content.php?cat.\".\$row['content_id'].\"'>\".\$row['content_heading'].\"</a>\";\n";
+			$data .= "				\$text .= (\$content_pref[\"content_menu_cat_number\"] ? \" <span class='smalltext'>(\".\$aa -> countCatItems(\$row['content_id']).\")</span>\" : \"\");\n";
+			$data .= "				\$text .= \"</td>\";\n";
+			$data .= "				\$text .= \"</tr>\";\n";
+			$data .= "				\$text .= \"</table>\";\n";
 			$data .= "			}\n";
 			$data .= "		}\n";
 			$data .= "	}\n";
 			$data .= "}\n";
 			$data .= "\n";
 			$data .= "//##### RECENT --------------------------------------------------\n";
-			$data .= "if(".chr(36)."content_pref[\"content_menu_recent_".chr(36)."menutypeid\"]){\n";
-			$data .= chr(36)."text .= \"<br />\";\n";
+			$data .= "if(\$content_pref[\"content_menu_recent\"]){\n";
+			$data .= "	\$text .= \"<br />\";\n";
 			$data .= "\n";
-			$data .= "//prepare query paramaters\n";
-			$data .= chr(36)."validparent = implode(\",\", array_keys(".chr(36)."array));\n";
-			$data .= chr(36)."qry = \" content_parent REGEXP '\".".chr(36)."aa -> CONTENTREGEXP(".chr(36)."validparent).\"' \";\n";
+			$data .= "	//prepare query paramaters\n";
+			$data .= "	\$validparent = implode(\",\", array_keys(\$array));\n";
+			$data .= "	\$qry = \" content_parent REGEXP '\".\$aa -> CONTENTREGEXP(\$validparent).\"' \";\n";
 			$data .= "\n";
-			$data .= chr(36)."sql1 = new db;\n";
-			$data .= chr(36)."contenttotal = ".chr(36)."sql1 -> db_Count(".chr(36)."plugintable, \"(*)\", \"WHERE content_refer != 'sa' AND \".".chr(36)."qry.\" \".".chr(36)."datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' \" );\n";
+			$data .= "	\$sql1 = new db;\n";
+			$data .= "	\$contenttotal = \$sql1 -> db_Count(\$plugintable, \"(*)\", \"WHERE content_refer != 'sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' \" );\n";
 			$data .= "\n";
-			$data .= "if(".chr(36)."resultitem = ".chr(36)."sql1 -> db_Select(".chr(36)."plugintable, \"*\", \"content_refer !='sa' AND \".".chr(36)."qry.\" \".".chr(36)."datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".".chr(36)."content_pref[\"content_menu_recent_number_".chr(36)."menutypeid\"] )){\n";
+			$data .= "	if(\$resultitem = \$sql1 -> db_Select(\$plugintable, \"*\", \"content_refer !='sa' AND \".\$qry.\" \".\$datequery.\" AND content_class REGEXP '\".e_CLASS_REGEXP.\"' ORDER BY content_datestamp DESC LIMIT 0,\".\$content_pref[\"content_menu_recent_number\"] )){\n";
 			$data .= "\n";
-			$data .= "	".chr(36)."text .= (".chr(36)."content_pref[\"content_menu_recent_caption_".chr(36)."menutypeid\"] != \"\" ? ".chr(36)."content_pref[\"content_menu_recent_caption_".chr(36)."menutypeid\"] : CONTENT_MENU_LAN_2).\"<br />\";\n";
-			$data .= "	while(".chr(36)."row = ".chr(36)."sql1 -> db_Fetch()){\n";
+			$data .= "		\$text .= (\$content_pref[\"content_menu_recent_caption\"] != \"\" ? \$content_pref[\"content_menu_recent_caption\"] : CONTENT_MENU_LAN_2).\"<br />\";\n";
+			$data .= "		while(\$row = \$sql1 -> db_Fetch()){\n";
 			$data .= "\n";
-			$data .= "		".chr(36)."ICON = \"\";\n";
-			$data .= "		".chr(36)."DATE = \"\";\n";
-			$data .= "		".chr(36)."AUTHOR = \"\";\n";
-			$data .= "		".chr(36)."SUBHEADING = \"\";\n";
+			$data .= "			\$ICON = \"\";\n";
+			$data .= "			\$DATE = \"\";\n";
+			$data .= "			\$AUTHOR = \"\";\n";
+			$data .= "			\$SUBHEADING = \"\";\n";
 			$data .= "\n";
-			$data .= "		if(".chr(36)."content_pref[\"content_menu_recent_date_".chr(36)."menutypeid\"]){\n";
-			$data .= "			".chr(36)."datestyle = (".chr(36)."content_pref[\"content_archive_datestyle_".chr(36)."menutypeid\"] ? ".chr(36)."content_pref[\"content_archive_datestyle_".chr(36)."menutypeid\"] : \"%d %b %Y\");\n";
-			$data .= "			".chr(36)."DATE = strftime(".chr(36)."datestyle, ".chr(36)."row['content_datestamp']);\n";
-			$data .= "		}\n";
-			$data .= "		if(".chr(36)."content_pref[\"content_menu_recent_author_".chr(36)."menutypeid\"]){\n";
-			$data .= "			".chr(36)."authordetails = ".chr(36)."aa -> getAuthor(".chr(36)."row['content_author']);\n";
-			$data .= "			".chr(36)."AUTHOR = ".chr(36)."authordetails[1];\n";
-			$data .= "		}\n";
+			$data .= "			if(\$content_pref[\"content_menu_recent_date\"]){\n";
+			$data .= "				\$datestyle = (\$content_pref[\"content_archive_datestyle\"] ? \$content_pref[\"content_archive_datestyle\"] : \"%d %b %Y\");\n";
+			$data .= "				\$DATE = strftime(\$datestyle, \$row['content_datestamp']);\n";
+			$data .= "			}\n";
+			$data .= "			if(\$content_pref[\"content_menu_recent_author\"]){\n";
+			$data .= "				\$authordetails = \$aa -> getAuthor(\$row['content_author']);\n";
+			$data .= "				\$AUTHOR = \$authordetails[1];\n";
+			$data .= "			}\n";
 			$data .= "\n";
-			$data .= "		//subheading\n";
-			$data .= "		if(".chr(36)."content_pref[\"content_menu_recent_subheading_".chr(36)."menutypeid\"] && ".chr(36)."row['content_subheading']){\n";
-			$data .= "			if(".chr(36)."content_pref[\"content_menu_recent_subheading_char_".chr(36)."menutypeid\"] && ".chr(36)."content_pref[\"content_menu_recent_subheading_char_".chr(36)."menutypeid\"] != \"\" && ".chr(36)."content_pref[\"content_menu_recent_subheading_char_".chr(36)."menutypeid\"] != \"0\"){\n";
-			$data .= "				if(strlen(".chr(36)."row['content_subheading']) > ".chr(36)."content_pref[\"content_menu_recent_subheading_char_".chr(36)."menutypeid\"]) {\n";
-			$data .= "					".chr(36)."row['content_subheading'] = substr(".chr(36)."row['content_subheading'], 0, ".chr(36)."content_pref[\"content_menu_recent_subheading_char_".chr(36)."menutypeid\"]).".chr(36)."content_pref[\"content_menu_recent_subheading_post_".chr(36)."menutypeid\"];\n";
+			$data .= "			//subheading\n";
+			$data .= "			if(\$content_pref[\"content_menu_recent_subheading\"] && \$row['content_subheading']){\n";
+			$data .= "				if(\$content_pref[\"content_menu_recent_subheading_char\"] && \$content_pref[\"content_menu_recent_subheading_char\"] != \"\" && \$content_pref[\"content_menu_recent_subheading_char\"] != \"0\"){\n";
+			$data .= "					if(strlen(\$row['content_subheading']) > \$content_pref[\"content_menu_recent_subheading_char\"]) {\n";
+			$data .= "						\$row['content_subheading'] = substr(\$row['content_subheading'], 0, \$content_pref[\"content_menu_recent_subheading_char\"]).\$content_pref[\"content_menu_recent_subheading_post\"];\n";
+			$data .= "					}\n";
 			$data .= "				}\n";
+			$data .= "				\$SUBHEADING = \$row['content_subheading'];\n";
 			$data .= "			}\n";
-			$data .= "			".chr(36)."SUBHEADING = ".chr(36)."row['content_subheading'];\n";
-			$data .= "		}\n";
 			$data .= "\n";
-			$data .= "		//define icon\n";
-			$data .= "		".chr(36)."recenticonwidth = \"\";\n";
-			$data .= "		if(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"0\"){ ".chr(36)."ICON = \"\";\n";
-			$data .= "		}elseif(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"1\"){ ".chr(36)."ICON = \"<img src='\".THEME.\"images/bullet2.gif' alt='' style='border:0;' />\";\n";
-			$data .= "		}elseif(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"2\"){ ".chr(36)."ICON = \"&middot\";\n";
-			$data .= "		}elseif(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"3\"){ ".chr(36)."ICON = \"&ordm;\";\n";
-			$data .= "		}elseif(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"4\"){ ".chr(36)."ICON = \"&raquo;\";\n";
-			$data .= "		}elseif(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"5\"){\n";
-			$data .= "			if(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"5\"){\n";
-			$data .= "				if(".chr(36)."content_pref[\"content_menu_recent_icon_width_".chr(36)."menutypeid\"]){\n";
-			$data .= "					".chr(36)."recenticonwidth = \" width:\".".chr(36)."content_pref[\"content_menu_recent_icon_width_".chr(36)."menutypeid\"].\"px; \";\n";
-			$data .= "				}else{\n";
-			$data .= "					".chr(36)."recenticonwidth = \" width:50px; \";\n";
+			$data .= "			//define icon\n";
+			$data .= "			\$recenticonwidth = \"\";\n";
+			$data .= "			if(\$content_pref[\"content_menu_recent_icon\"] == \"0\"){ \$ICON = \"\";\n";
+			$data .= "			}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"1\"){ \$ICON = \$bullet;\n";
+			$data .= "			}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"2\"){ \$ICON = \"&middot\";\n";
+			$data .= "			}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"3\"){ \$ICON = \"&ordm;\";\n";
+			$data .= "			}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"4\"){ \$ICON = \"&raquo;\";\n";
+			$data .= "			}elseif(\$content_pref[\"content_menu_recent_icon\"] == \"5\"){\n";
+			$data .= "				if(\$content_pref[\"content_menu_recent_icon\"] == \"5\"){\n";
+			$data .= "					if(\$content_pref[\"content_menu_recent_icon_width\"]){\n";
+			$data .= "						\$recenticonwidth = \" width:\".\$content_pref[\"content_menu_recent_icon_width\"].\"px; \";\n";
+			$data .= "					}else{\n";
+			$data .= "						\$recenticonwidth = \" width:50px; \";\n";
+			$data .= "					}\n";
+			$data .= "				}\n";
+			$data .= "				if(\$content_pref[\"content_menu_recent_icon\"] == \"5\" && \$row['content_icon'] != \"\" && file_exists(\$content_icon_path.\$row['content_icon'])){\n";
+			$data .= "					\$ICON = \"<img src='\".\$content_icon_path.\$row['content_icon'].\"' alt='' style='\".\$recenticonwidth.\" border:0;' />\";\n";
 			$data .= "				}\n";
 			$data .= "			}\n";
-			$data .= "			if(".chr(36)."content_pref[\"content_menu_recent_icon_".chr(36)."menutypeid\"] == \"5\" && ".chr(36)."row['content_icon'] != \"\" && file_exists(".chr(36)."content_icon_path.".chr(36)."row['content_icon'])){\n";
-			$data .= "				".chr(36)."ICON = \"<img src='\".".chr(36)."content_icon_path.".chr(36)."row['content_icon'].\"' alt='' style='\".".chr(36)."recenticonwidth.\" border:0;' />\";\n";
-			$data .= "			}\n";
-			$data .= "		}\n";
 			$data .= "\n";
-			$data .= "		//display recent list\n";
-			$data .= "		".chr(36)."text .= \"<table style='width:100%; text-align:left; border:0; margin-bottom:10px;' cellpadding='0' cellspacing='0'>\";\n";
-			$data .= "		".chr(36)."text .= \"<tr>\";\n";
-			$data .= "		".chr(36)."text .= (".chr(36)."ICON ? \"<td style='width:1%; white-space:nowrap; vertical-align:top; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?content.\".".chr(36)."row['content_id'].\"'>\".".chr(36)."ICON.\"</a></td>\" : \"\");\n";
-			$data .= "		".chr(36)."text .= \"<td style='width:99%; vertical-align:top;'>\";\n";
-			$data .= "		".chr(36)."text .= \"<a href='\".e_PLUGIN.\"content/content.php?content.\".".chr(36)."row['content_id'].\"'>\".".chr(36)."row['content_heading'].\"</a><br />\";\n";
-			$data .= "		".chr(36)."text .= (".chr(36)."DATE ? ".chr(36)."DATE.\"<br />\" : \"\" );\n";
-			$data .= "		".chr(36)."text .= (".chr(36)."AUTHOR ? ".chr(36)."AUTHOR.\"<br />\" : \"\" );\n";
-			$data .= "		".chr(36)."text .= (".chr(36)."SUBHEADING ? ".chr(36)."SUBHEADING.\"<br />\" : \"\" );\n";
-			$data .= "		".chr(36)."text .= \"</td>\";\n";
-			$data .= "		".chr(36)."text .= \"</tr>\";\n";
-			$data .= "		".chr(36)."text .= \"</table>\";\n";
+			$data .= "			//display recent list\n";
+			$data .= "			\$text .= \"<table style='width:100%; text-align:left; border:0; margin-bottom:10px;' cellpadding='0' cellspacing='0'>\";\n";
+			$data .= "			\$text .= \"<tr>\";\n";
+			$data .= "			\$text .= (\$ICON ? \"<td style='width:1%; white-space:nowrap; vertical-align:top; padding-right:5px;'><a href='\".e_PLUGIN.\"content/content.php?content.\".\$row['content_id'].\"'>\".\$ICON.\"</a></td>\" : \"\");\n";
+			$data .= "			\$text .= \"<td style='width:99%; vertical-align:top;'>\";\n";
+			$data .= "			\$text .= \"<a href='\".e_PLUGIN.\"content/content.php?content.\".\$row['content_id'].\"'>\".\$row['content_heading'].\"</a><br />\";\n";
+			$data .= "			\$text .= (\$DATE ? \$DATE.\"<br />\" : \"\" );\n";
+			$data .= "			\$text .= (\$AUTHOR ? \$AUTHOR.\"<br />\" : \"\" );\n";
+			$data .= "			\$text .= (\$SUBHEADING ? \$SUBHEADING.\"<br />\" : \"\" );\n";
+			$data .= "			\$text .= \"</td>\";\n";
+			$data .= "			\$text .= \"</tr>\";\n";
+			$data .= "			\$text .= \"</table>\";\n";
+			$data .= "		}\n";
 			$data .= "	}\n";
 			$data .= "}\n";
-			$data .= "}\n";
 			$data .= "\n";				
-			$data .= "if(!isset(".chr(36)."text)){ ".chr(36)."text = CONTENT_MENU_LAN_1; }\n";
-			$data .= chr(36)."caption = (".chr(36)."content_pref[\"content_menu_caption_".chr(36)."menutypeid\"] != \"\" ? ".chr(36)."content_pref[\"content_menu_caption_".chr(36)."menutypeid\"] : CONTENT_MENU_LAN_0.\" \".".chr(36)."menuname);\n";
-			$data .= chr(36)."ns -> tablerender(".chr(36)."caption, ".chr(36)."text, '$menufile');\n";
+			$data .= "if(!isset(\$text)){ \$text = CONTENT_MENU_LAN_1; }\n";
+			$data .= "\$caption = (\$content_pref[\"content_menu_caption\"] != \"\" ? \$content_pref[\"content_menu_caption\"] : CONTENT_MENU_LAN_0.\" \".\$menuname);\n";
+			$data .= "\$ns -> tablerender(\$caption, \$text, '$menufile');\n";
 			$data .= "\n";
 			$data .= "?".chr(62);
 				 
diff -ruN 0.7.5/e107_plugins/content/handlers/content_convert_class.php 0.7.7/e107_plugins/content/handlers/content_convert_class.php
--- 0.7.5/e107_plugins/content/handlers/content_convert_class.php	2005-12-29 16:19:37.000000000 -0600
+++ 0.7.7/e107_plugins/content/handlers/content_convert_class.php	2006-07-28 09:07:15.000000000 -0500
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_convert_class.php,v $
-|		$Revision: 1.16 $
-|		$Date: 2005/12/29 22:19:37 $
+|		$Revision: 1.21 $
+|		$Date: 2006/07/28 14:07:15 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -26,6 +26,8 @@
 
 $lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content.php';
 include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content.php');
+$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');
 
 require_once($plugindir."handlers/content_class.php");
 $aa = new content;
@@ -45,7 +47,7 @@
 				mysql_query("ALTER TABLE ".MPREFIX."pcontent ADD content_score TINYINT ( 3 ) UNSIGNED NOT NULL DEFAULT '0';");
 				mysql_query("ALTER TABLE ".MPREFIX."pcontent ADD content_meta TEXT NOT NULL;");
 				mysql_query("ALTER TABLE ".MPREFIX."pcontent ADD content_layout VARCHAR ( 255 ) NOT NULL DEFAULT '';");
-				$text = "Content Management Plugin table structure updated<br />";
+				$text = CONTENT_ADMIN_CONVERSION_LAN_64."<br />";
 			}
 			return $text;
 		}
@@ -59,9 +61,9 @@
 				while($row = $sql -> db_Fetch()){
 					if(is_numeric($row['content_author'])){
 					}else{
-						$upgrade = TRUE;
 						$tmp = explode("^", $row['content_author']);
 						if($tmp[0] == "0"){
+							$upgrade = TRUE;
 							$newauthor = $tmp[1].($tmp[2] ? "^".$tmp[2] : "");
 							$sql1 -> db_Update("pcontent", " content_author = '".$newauthor."' WHERE content_id='".$row['content_id']."' ");
 						}
@@ -69,20 +71,255 @@
 				}
 			}
 			if($upgrade){
-				return "Content Management Plugin : content_author updated<br />";
+				return CONTENT_ADMIN_CONVERSION_LAN_65."<br />";
 			}else{
 				return FALSE;
 			}
 		}
 
+		//update preferences storage method
+		function upgrade_1_22(){
+			global $sql, $sql2, $eArrayStorage, $tp, $aa;
+
+			$upgrade = TRUE;
+
+			$sqlc = new db;
+			$sqld = new db;
+
+			//convert preferences for core default preferences
+			if($sqlc -> db_Select("core", "*", "e107_name='pcontent' ")){
+				$row = $sqlc -> db_Fetch();
+
+				$tmp = $eArrayStorage->ReadArray($row['e107_value']);
+
+				//replace the id value for the content_pref
+				$content_pref = array();
+				foreach($tmp as $k=>$v){
+					if(substr($k,-2) == "_0"){
+						$k = str_replace("_0", "", $k);
+					}
+					if(strpos($k, "content_") === 0){
+						$content_pref[$k] = $tp->toDB($v);
+					}
+				}
+				if(!isset($content_pref['content_admin_subheading'])){
+					//add new options to the preferences
+					$content_pref = $this->upgrade_1_22_prefs($content_pref);
+
+					$tmp1 = $eArrayStorage->WriteArray($content_pref);
+					$sqld -> db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
+				}else{
+					$upgrade=FALSE;
+				}
+			}
+
+			//convert preferences for all main parents
+			if($sqlc -> db_Select("pcontent", "content_id, content_heading, content_pref", "LEFT(content_parent, 1) = '0' ")){
+				while($row=$sqlc->db_Fetch()){
+
+					$id = $row['content_id'];
+					$tmp = $eArrayStorage->ReadArray($row['content_pref']);
+
+					//replace the id value for the content_pref
+					$l = strlen($id);
+					$content_pref = array();
+					foreach($tmp as $k=>$v){
+						if(substr($k,-($l+1)) == "_".$id){
+							$k = str_replace("_".$id, "", $k);
+						}
+						if(strpos($k, "content_") === 0){
+							$content_pref[$k] = $tp->toDB($v);
+						}
+					}
+					//add new options to the preferences
+					if(!isset($content_pref['content_admin_subheading'])){
+						$content_pref = $this->upgrade_1_22_prefs($content_pref);
+
+						$tmp1 = $eArrayStorage->WriteArray($content_pref);
+						$sqld -> db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='$id' ");
+					}else{
+						$upgrade=FALSE;
+					}
+
+					//update menus
+					$plugintable	= "pcontent";
+					$plugindir		= e_PLUGIN."content/";
+					if(!is_object($aa)){
+						require_once($plugindir."handlers/content_class.php");
+						$aa = new content;
+					}
+					if($row['content_parent']==0){
+						//remove menu
+						@unlink(e_PLUGIN."content/menus/content_".$row['content_heading']."_menu.php");
+						//create menu
+						$aa -> CreateParentMenu($id);
+					}
+				}
+			}
+
+			if($upgrade===TRUE){
+				return CONTENT_ADMIN_CONVERSION_LAN_66."<br />";
+			}
+		}
+
+		//add new preferences that come with this upgrade
+		function upgrade_1_22_prefs($content_pref){
+
+			//create : item page
+			$content_pref['content_admin_subheading'] = '1';
+			$content_pref['content_admin_summary'] = '1';
+			$content_pref['content_admin_startdate'] = '1';
+			$content_pref['content_admin_enddate'] = '1';
+
+			//create : category page
+			$content_pref['content_admincat_subheading'] = '1';
+			$content_pref['content_admincat_comment'] = '1';
+			$content_pref['content_admincat_rating'] = '1';
+			$content_pref['content_admincat_pe'] = '1';
+			$content_pref['content_admincat_visibility'] = '1';
+			$content_pref['content_admincat_startdate'] = '1';
+			$content_pref['content_admincat_enddate'] = '1';
+			$content_pref['content_admincat_uploadicon'] = '1';
+			$content_pref['content_admincat_selecticon'] = '1';
+
+			//create : submit page
+			$content_pref['content_submit_subheading'] = '1';
+			$content_pref['content_submit_summary'] = '1';
+			$content_pref['content_submit_startdate'] = '1';
+			$content_pref['content_submit_enddate'] = '1';
+
+			//content manager
+			$content_pref['content_manager_approve'] = '255';
+			$content_pref['content_manager_personal'] = '255';
+			$content_pref['content_manager_category'] = '255';
+
+			return $content_pref;
+		}
+
+
+		//update preferences storage method
+		function upgrade_1_23(){
+			global $sql, $sql2, $eArrayStorage, $tp, $aa;
+
+			$upgrade = TRUE;
+
+			$sqlc = new db;
+			$sqld = new db;
+			//add new preferences in core
+			if($sqlc -> db_Select("core", "*", "e107_name='pcontent' ")){
+				$row = $sqlc -> db_Fetch();
+
+				$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
+
+				//add new options to the preferences
+				if(!isset($content_pref['content_admin_subheading'])){
+					$content_pref = $this->upgrade_1_23_prefs($content_pref);
+
+					$tmp1 = $eArrayStorage->WriteArray($content_pref);
+					$sqld -> db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
+				}else{
+					$upgrade=FALSE;
+				}
+			}
+
+			//add new preferences for each main parent
+			if($sqlc -> db_Select("pcontent", "content_id, content_heading, content_pref", "content_parent = '0' ")){
+				while($row=$sqlc->db_Fetch()){
+
+					$id = $row['content_id'];
+					$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
+
+					if(!isset($content_pref['content_admin_subheading'])){
+						//add new options to the preferences
+						$content_pref = $this->upgrade_1_23_prefs($content_pref);
+
+						$tmp1 = $eArrayStorage->WriteArray($content_pref);
+						$sqld -> db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='$id' ");
+					}else{
+						$upgrade=FALSE;
+					}
+				}
+			}
+			if($upgrade===TRUE){
+				return CONTENT_ADMIN_CONVERSION_LAN_67."<br />";
+			}
+		}
+		//add new preferences that come with this upgrade
+		function upgrade_1_23_prefs($content_pref){
+
+			$content_pref['content_list_caption'] = CONTENT_LAN_23;			//caption for recent list
+			$content_pref['content_list_caption_append_name'] = '1';		//append category heading to caption
+			$content_pref['content_catall_caption'] = CONTENT_LAN_25;		//caption for all categories page
+			$content_pref['content_cat_caption'] = CONTENT_LAN_26;			//caption for single category page
+			$content_pref['content_cat_caption_append_name'] = '1';			//append category heading to caption
+			$content_pref['content_cat_sub_caption'] = CONTENT_LAN_28;		//caption for subcategories
+			$content_pref['content_cat_item_caption'] = CONTENT_LAN_31;		//caption for items in category
+			$content_pref['content_author_index_caption'] = CONTENT_LAN_32;	//caption for author index page
+			$content_pref['content_author_caption'] = CONTENT_LAN_32;		//caption for single author page
+			$content_pref['content_author_caption_append_name'] = '1';		//append author name to caption
+			$content_pref['content_archive_caption'] = CONTENT_LAN_84;		//caption for archive page
+			$content_pref['content_top_icon_width'] = '';					//use this size for icon
+			$content_pref['content_top_caption'] = CONTENT_LAN_38;			//caption for top rated page
+			$content_pref['content_top_caption_append_name'] = '1';			//append category heading to caption
+			$content_pref['content_score_icon_width'] = '';					//use this size for icon
+			$content_pref['content_score_caption'] = CONTENT_LAN_87;		//caption for top score page
+			$content_pref['content_score_caption_append_name'] = '1';		//append category heading to caption
+
+			return $content_pref;
+		}
+
+		//update custom theme
+		function upgrade_1_24(){
+			global $sql, $sql2, $eArrayStorage, $tp, $aa;
+
+			$upgrade = TRUE;
+
+			$sqlc = new db;
+			$sqld = new db;
+			//add new preferences in core
+			if($sqlc -> db_Select("core", "*", "e107_name='pcontent' ")){
+				$row = $sqlc -> db_Fetch();
+
+				$content_pref = $eArrayStorage->ReadArray($row['e107_value']);
+
+				//update theme
+				if(strpos($content_pref['content_theme'], "{e_")!==FALSE){
+				}else{
+					$content_pref['content_theme'] = "{e_PLUGIN}content/templates/".$content_pref['content_theme']."/";
+				}
+
+				$tmp1 = $eArrayStorage->WriteArray($content_pref);
+				$sqld -> db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
+			}
+
+			//add new preferences for each main parent
+			if($sqlc -> db_Select("pcontent", "content_id, content_heading, content_pref", "content_parent = '0' ")){
+				while($row=$sqlc->db_Fetch()){
+
+					$id = $row['content_id'];
+					$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
+
+					//update theme
+					if(strpos($content_pref['content_theme'], "{e_")!==FALSE){
+					}else{
+						$content_pref['content_theme'] = "{e_PLUGIN}content/templates/".$content_pref['content_theme']."/";
+					}
+
+					$tmp1 = $eArrayStorage->WriteArray($content_pref);
+					$sqld -> db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='$id' ");
+				}
+			}
+			return CONTENT_ADMIN_CONVERSION_LAN_68."<br />";
+		}
+
 		//convert rows
 		function upgrade_1_1(){
-				global $sql, $tp, $plugintable, $eArrayStorage;
+				global $sql, $sql2, $tp, $plugintable, $eArrayStorage;
 				$plugintable	= "pcontent";
 
 				$count = "0";
 				$sql = new db;
-				$thiscount = $sql -> db_Count("pcontent", "(*)");
+				$thiscount = $sql -> db_Select("pcontent", "*", "ORDER BY content_id ", "mode=no_where" );
 				if($thiscount > 0){
 					while($row = $sql -> db_Fetch()){
 
@@ -99,7 +336,7 @@
 							$newparent = substr(strrchr($row['content_parent'], "."),1);
 						}
 
-						$sql -> db_Update("pcontent", " content_parent = '".$newparent."', content_pref='' WHERE content_id='".$row['content_id']."' ");
+						$sql2 -> db_Update("pcontent", " content_parent = '".$newparent."', content_pref='' WHERE content_id='".$row['content_id']."' ");
 					}
 				}
 				return CONTENT_ADMIN_CONVERSION_LAN_58."<br /><br />".CONTENT_ADMIN_CONVERSION_LAN_46."<br />";
diff -ruN 0.7.5/e107_plugins/content/handlers/content_db_class.php 0.7.7/e107_plugins/content/handlers/content_db_class.php
--- 0.7.5/e107_plugins/content/handlers/content_db_class.php	2006-02-13 04:13:22.000000000 -0600
+++ 0.7.7/e107_plugins/content/handlers/content_db_class.php	2006-08-02 16:38:31.000000000 -0500
@@ -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.43 $
-|		$Date: 2006/02/13 10:13:22 $
+|		$Revision: 1.50 $
+|		$Date: 2006/08/02 21:38:31 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -52,7 +52,7 @@
 		$new = "";
 		if($uploaded){
 			$uporg		= $uploaded[0]['name'];
-			$resize		= (isset($content_pref["content_upload_icon_size_{$mainparent}"]) && $content_pref["content_upload_icon_size_{$mainparent}"] ? $content_pref["content_upload_icon_size_{$mainparent}"] : "100");
+			$resize		= (isset($content_pref["content_upload_icon_size"]) && $content_pref["content_upload_icon_size"] ? $content_pref["content_upload_icon_size"] : "100");
 			if($uporg){
 				$new = $newpid."_".$uporg;
 				rename($pathtmp.$uporg, $pathtmp.$new);
@@ -85,8 +85,8 @@
 		$new = "";
 		if($uploaded){
 			$uporg		= $uploaded[0]['name'];
-			$resize		= (isset($content_pref["content_upload_image_size_{$mainparent}"]) && $content_pref["content_upload_image_size_{$mainparent}"] ? $content_pref["content_upload_image_size_{$mainparent}"] : "500");
-			$resizethumb	= (isset($content_pref["content_upload_image_size_thumb_{$mainparent}"]) && $content_pref["content_upload_image_size_thumb_{$mainparent}"] ? $content_pref["content_upload_image_size_thumb_{$mainparent}"] : "100");
+			$resize		= (isset($content_pref["content_upload_image_size"]) && $content_pref["content_upload_image_size"] ? $content_pref["content_upload_image_size"] : "500");
+			$resizethumb	= (isset($content_pref["content_upload_image_size_thumb"]) && $content_pref["content_upload_image_size_thumb"] ? $content_pref["content_upload_image_size_thumb"] : "100");
 			if($uporg){
 				$new = $newpid."_".$uporg;
 				rename($pathtmp.$uporg, $pathtmp.$new);
@@ -105,14 +105,21 @@
 		function dbContent($mode, $type){
 			//$mode		: create or update
 			//$type		: none(=admin), submit, contentmanager
-			global $pref, $qs, $sql, $ns, $rs, $aa, $tp, $plugintable, $e107cache, $eArrayStorage;
+			global $pref, $qs, $sql, $ns, $rs, $aa, $tp, $plugintable, $e107cache, $eArrayStorage, $e_event;
 
-			$_POST['content_heading']		= $tp -> toDB($_POST['content_heading']);
+			$_POST['content_heading']		= $tp -> toDB(trim($_POST['content_heading']));
 			$_POST['content_subheading']	= $tp -> toDB($_POST['content_subheading']);
 			$_POST['content_summary']		= $tp -> toDB($_POST['content_summary']);
+
 			if(e_WYSIWYG){
 				$_POST['content_text']		= $tp->createConstants($_POST['content_text']); // convert e107_images/ to {e_IMAGE} etc.
 			}
+			//the problem with tiny_mce is it's storing e_HTTP with an image path, while it should only use the {e_xxx} variables
+			//this small check resolves this, and stores the paths correctly
+			if(strstr($_POST['content_text'],e_HTTP."{e_")){
+				$_POST['content_text'] = str_replace(e_HTTP."{e_", "{e_", $_POST['content_text']);
+			}
+			
 			$_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");
@@ -150,18 +157,18 @@
 			$mainparent						= $aa -> getMainParent(intval($_POST['parent']));
 			$content_pref					= $aa -> getContentPref($mainparent);
 			
-			$content_pref["content_icon_path_tmp_{$mainparent}"] = ($content_pref["content_icon_path_tmp_{$mainparent}"] ? $content_pref["content_icon_path_tmp_{$mainparent}"] : $content_pref["content_icon_path_{$mainparent}"]."tmp/");
-			$content_pref["content_file_path_tmp_{$mainparent}"] = ($content_pref["content_file_path_tmp_{$mainparent}"] ? $content_pref["content_file_path_tmp_{$mainparent}"] : $content_pref["content_file_path_{$mainparent}"]."tmp/");
-			$content_pref["content_image_path_tmp_{$mainparent}"] = ($content_pref["content_image_path_tmp_{$mainparent}"] ? $content_pref["content_image_path_tmp_{$mainparent}"] : $content_pref["content_image_path_{$mainparent}"]."tmp/");
+			$content_pref["content_icon_path_tmp"] = ($content_pref["content_icon_path_tmp"] ? $content_pref["content_icon_path_tmp"] : $content_pref["content_icon_path"]."tmp/");
+			$content_pref["content_file_path_tmp"] = ($content_pref["content_file_path_tmp"] ? $content_pref["content_file_path_tmp"] : $content_pref["content_file_path"]."tmp/");
+			$content_pref["content_image_path_tmp"] = ($content_pref["content_image_path_tmp"] ? $content_pref["content_image_path_tmp"] : $content_pref["content_image_path"]."tmp/");
 			
-			$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-			$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
-			$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path_{$mainparent}"]);
-			$content_tmppath_icon			= $tp -> replaceConstants($content_pref["content_icon_path_tmp_{$mainparent}"]);
-			$content_tmppath_file			= $tp -> replaceConstants($content_pref["content_file_path_tmp_{$mainparent}"]);
-			$content_tmppath_image			= $tp -> replaceConstants($content_pref["content_image_path_tmp_{$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"]);
+			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+			$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path"]);
+			$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path"]);
+			$content_tmppath_icon			= $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
+			$content_tmppath_file			= $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
+			$content_tmppath_image			= $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
 
 			//move icon to correct folder
 			if($_POST['content_icon']){
@@ -210,7 +217,7 @@
 			if($_POST['update_datestamp']){
 				$starttime = time();
 			}else{
-				if($_POST['ne_day'] != "none" && $_POST['ne_month'] != "none" && $_POST['ne_year'] != "none"){
+				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"){
 					$newstarttime = mktime( 0, 0, 0, intval($_POST['ne_month']), intval($_POST['ne_day']), intval($_POST['ne_year']));
 				}else{
 					$newstarttime = time();
@@ -226,14 +233,14 @@
 				}
 			}
 
-			if($_POST['end_day'] != "none" && $_POST['end_month'] != "none" && $_POST['end_year'] != "none"){
+			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"){
 				$endtime = mktime( 0, 0, 0, intval($_POST['end_month']), intval($_POST['end_day']), intval($_POST['end_year']));
 			}else{
 				$endtime = "0";
 			}
 
 			//custom additional data tags
-			for($i=0;$i<$content_pref["content_admin_custom_number_{$mainparent}"];$i++){
+			for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
 				if(isset($_POST["content_custom_key_{$i}"]) && isset($_POST["content_custom_value_{$i}"]) && $_POST["content_custom_value_{$i}"] != ""){
 					$keystring = $tp->toDB($_POST["content_custom_key_{$i}"]);
 					$custom["content_custom_{$keystring}"] = $tp->toDB($_POST["content_custom_value_{$i}"]);
@@ -242,6 +249,8 @@
 			//preset additional data tags
 			if(isset($_POST['content_custom_preset_key']) && $_POST['content_custom_preset_key']){
 				$custom['content_custom_presettags'] = $tp->toDB($_POST['content_custom_preset_key']);
+			}
+			if($custom){
 				$contentprefvalue = $eArrayStorage->WriteArray($custom);
 			}else{
 				$contentprefvalue = "";
@@ -255,19 +264,24 @@
 
 			if($mode == "create"){
 				if($type == "submit"){
-					$refer = ($content_pref["content_submit_directpost_{$mainparent}"] ? "" : "sa");
+					$refer = ($content_pref["content_submit_directpost"] ? "" : "sa");
 				}else{
 					$refer = "";
 				}
 				$sql -> db_Insert($plugintable, "'0', '".$_POST['content_heading']."', '".$_POST['content_subheading']."', '".$_POST['content_summary']."', '".$_POST['content_text']."', '".$tp->toDB($author)."', '".$icon."', '".$totalattach."', '".$totalimages."', '".$_POST['parent']."', '".intval($_POST['content_comment'])."', '".intval($_POST['content_rate'])."', '".intval($_POST['content_pe'])."', '".$refer."', '".$starttime."', '".$endtime."', '".$_POST['content_class']."', '".$contentprefvalue."', '0', '".intval($_POST['content_score'])."', '".$_POST['content_meta']."', '".$_POST['content_layout']."' ");
 
 				$e107cache->clear("$plugintable");
+
+				//trigger event for notify
+				$edata_cs = array("content_heading" => $_POST['content_heading'], "content_subheading" => $_POST['content_subheading'], "content_author" => $_POST['content_author_name']);
+				$e_event->trigger("content", $edata_cs);
+
 				if(!$type || $type == "admin"){
 					js_location(e_SELF."?".e_QUERY.".cc");
 				}elseif($type == "contentmanager"){
 					js_location(e_SELF."?c");
 				}elseif($type == "submit"){
-					if($content_pref["content_submit_directpost_{$mainparent}"]){
+					if($content_pref["content_submit_directpost"]){
 						js_location(e_SELF."?s");
 					}else{
 						js_location(e_SELF."?d");
@@ -312,7 +326,7 @@
 				$_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" ? "0" : "0.".intval($_POST['parent']));
+			$_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"){
@@ -331,10 +345,9 @@
 
 				// check and insert default pref values if new main parent + create menu file
 				if($_POST['parent'] == "0"){
-					$sql -> db_Select($plugintable, "content_id", "content_parent = '0' ORDER BY content_datestamp DESC LIMIT 1");
-					list($parent_id) = $sql -> db_Fetch();
-					$content_pref = $aa -> getContentPref($parent_id);
-					$aa -> CreateParentMenu($parent_id);
+					$iid = mysql_insert_id();
+					$content_pref = $aa -> getContentPref($iid);
+					$aa -> CreateParentMenu($iid);
 				}
 				$e107cache->clear("$plugintable");
 				js_location(e_SELF."?".e_QUERY.".pc");
@@ -367,9 +380,9 @@
 
 				//assign new preferences
 				if($value == "clear"){
-					$content_pref["content_manager_allowed_{$id}"] = "";
+					$content_pref["content_manager_allowed"] = "";
 				}else{
-					$content_pref["content_manager_allowed_{$id}"] = $value;
+					$content_pref["content_manager_allowed"] = $value;
 				}
 				
 				//create new array of preferences
diff -ruN 0.7.5/e107_plugins/content/handlers/content_defines.php 0.7.7/e107_plugins/content/handlers/content_defines.php
--- 0.7.5/e107_plugins/content/handlers/content_defines.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/content/handlers/content_defines.php	2006-07-13 05:01:10.000000000 -0500
@@ -9,24 +9,25 @@
 $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');
 
-if (!defined('CONTENT_ICON_EDIT')) { define("CONTENT_ICON_EDIT", "<img src='".$imagedir."maintain_16.png' alt='".CONTENT_ICON_LAN_0."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_LINK')) { define("CONTENT_ICON_LINK", "<img src='".$imagedir."leave_16.png' alt='".CONTENT_ICON_LAN_15."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_DELETE')) { define("CONTENT_ICON_DELETE", "<img src='".$imagedir."delete_16.png' alt='".CONTENT_ICON_LAN_1."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_EDIT')) { define("CONTENT_ICON_EDIT", "<img src='".$imagedir."maintain_16.png' alt='".CONTENT_ICON_LAN_0."' title='".CONTENT_ICON_LAN_0."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_LINK')) { define("CONTENT_ICON_LINK", "<img src='".$imagedir."leave_16.png' alt='".CONTENT_ICON_LAN_15."' title='".CONTENT_ICON_LAN_15."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_DELETE')) { define("CONTENT_ICON_DELETE", "<img src='".$imagedir."delete_16.png' alt='".CONTENT_ICON_LAN_1."' title='".CONTENT_ICON_LAN_1."' style='border:0; cursor:pointer;' />"); }
 if (!defined('CONTENT_ICON_DELETE_BASE')) { define("CONTENT_ICON_DELETE_BASE", $imagedir."delete_16.png"); }
-if (!defined('CONTENT_ICON_OPTIONS')) { define("CONTENT_ICON_OPTIONS", "<img src='".$imagedir."cat_settings_16.png' alt='".CONTENT_ICON_LAN_2."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_USER')) { define("CONTENT_ICON_USER", "<img src='".$imagedir."users_16.png' alt='".CONTENT_ICON_LAN_3."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_FILE')) { define("CONTENT_ICON_FILE", "<img src='".$plugindir."images/file_16.png' alt='".CONTENT_ICON_LAN_4."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_NEW')) { define("CONTENT_ICON_NEW", "<img src='".$imagedir."articles_16.png' alt='".CONTENT_ICON_LAN_5."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_SUBMIT')) { define("CONTENT_ICON_SUBMIT", "<img src='".$plugindir."images/redo.png' alt='".CONTENT_ICON_LAN_6."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_AUTHORLIST')) { define("CONTENT_ICON_AUTHORLIST", "<img src='".$plugindir."images/personal.png' alt='".CONTENT_ICON_LAN_7."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_WARNING')) { define("CONTENT_ICON_WARNING", "<img src='".$plugindir."images/warning_16.png' alt='".CONTENT_ICON_LAN_8."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_OK')) { define("CONTENT_ICON_OK", "<img src='".$plugindir."images/ok_16.png' alt='".CONTENT_ICON_LAN_9."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_ERROR')) { define("CONTENT_ICON_ERROR", "<img src='".$plugindir."images/error_16.png' alt='".CONTENT_ICON_LAN_10."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_ORDERCAT')) { define("CONTENT_ICON_ORDERCAT", "<img src='".$plugindir."images/view_remove.png' alt='".CONTENT_ICON_LAN_11."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_ORDERALL')) { define("CONTENT_ICON_ORDERALL", "<img src='".$plugindir."images/window_new.png' alt='".CONTENT_ICON_LAN_12."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_CONTENTMANAGER')) { define("CONTENT_ICON_CONTENTMANAGER", "<img src='".$plugindir."images/manager_48.png' alt='".CONTENT_ICON_LAN_14."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_CONTENTMANAGER_SMALL')) { define("CONTENT_ICON_CONTENTMANAGER_SMALL", "<img src='".$plugindir."images/manager_16.png' alt='".CONTENT_ICON_LAN_13."' style='border:0; cursor:pointer;' />"); }
-if (!defined('CONTENT_ICON_ORDER_UP')) { define("CONTENT_ICON_ORDER_UP", "<img src='".$imagedir."up.png' alt='".CONTENT_ADMIN_ITEM_LAN_63."' />"); }
-if (!defined('CONTENT_ICON_ORDER_DOWN')) { define("CONTENT_ICON_ORDER_DOWN", "<img src='".$imagedir."down.png' alt='".CONTENT_ADMIN_ITEM_LAN_64."' />"); }
+if (!defined('CONTENT_ICON_OPTIONS')) { define("CONTENT_ICON_OPTIONS", "<img src='".$imagedir."cat_settings_16.png' alt='".CONTENT_ICON_LAN_2."' title='".CONTENT_ICON_LAN_2."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_USER')) { define("CONTENT_ICON_USER", "<img src='".$imagedir."users_16.png' alt='".CONTENT_ICON_LAN_3."' title='".CONTENT_ICON_LAN_3."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_FILE')) { define("CONTENT_ICON_FILE", "<img src='".$plugindir."images/file_16.png' alt='".CONTENT_ICON_LAN_4."' title='".CONTENT_ICON_LAN_4."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_NEW')) { define("CONTENT_ICON_NEW", "<img src='".$imagedir."articles_16.png' alt='".CONTENT_ICON_LAN_5."' title='".CONTENT_ICON_LAN_5."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_SUBMIT')) { define("CONTENT_ICON_SUBMIT", "<img src='".$plugindir."images/submit_32.png' alt='".CONTENT_ICON_LAN_6."' title='".CONTENT_ICON_LAN_6."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_SUBMIT_SMALL')) { define("CONTENT_ICON_SUBMIT_SMALL", "<img src='".$plugindir."images/submit_16.png' alt='".CONTENT_ICON_LAN_6."' title='".CONTENT_ICON_LAN_6."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_AUTHORLIST')) { define("CONTENT_ICON_AUTHORLIST", "<img src='".$plugindir."images/personal.png' alt='".CONTENT_ICON_LAN_7."' title='".CONTENT_ICON_LAN_7."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_WARNING')) { define("CONTENT_ICON_WARNING", "<img src='".$plugindir."images/warning_16.png' alt='".CONTENT_ICON_LAN_8."' title='".CONTENT_ICON_LAN_8."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_OK')) { define("CONTENT_ICON_OK", "<img src='".$plugindir."images/ok_16.png' alt='".CONTENT_ICON_LAN_9."' title='".CONTENT_ICON_LAN_9."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_ERROR')) { define("CONTENT_ICON_ERROR", "<img src='".$plugindir."images/error_16.png' alt='".CONTENT_ICON_LAN_10."' title='".CONTENT_ICON_LAN_10."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_ORDERCAT')) { define("CONTENT_ICON_ORDERCAT", "<img src='".$plugindir."images/view_remove.png' alt='".CONTENT_ICON_LAN_11."' title='".CONTENT_ICON_LAN_11."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_ORDERALL')) { define("CONTENT_ICON_ORDERALL", "<img src='".$plugindir."images/window_new.png' alt='".CONTENT_ICON_LAN_12."' title='".CONTENT_ICON_LAN_12."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_CONTENTMANAGER')) { define("CONTENT_ICON_CONTENTMANAGER", "<img src='".$plugindir."images/manager_48.png' alt='".CONTENT_ICON_LAN_14."' title='".CONTENT_ICON_LAN_14."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_CONTENTMANAGER_SMALL')) { define("CONTENT_ICON_CONTENTMANAGER_SMALL", "<img src='".$plugindir."images/manager_16.png' alt='".CONTENT_ICON_LAN_13."' title='".CONTENT_ICON_LAN_13."' style='border:0; cursor:pointer;' />"); }
+if (!defined('CONTENT_ICON_ORDER_UP')) { define("CONTENT_ICON_ORDER_UP", "<img src='".$imagedir."up.png' alt='".CONTENT_ADMIN_ITEM_LAN_63."' title='".CONTENT_ADMIN_ITEM_LAN_63."' />"); }
+if (!defined('CONTENT_ICON_ORDER_DOWN')) { define("CONTENT_ICON_ORDER_DOWN", "<img src='".$imagedir."down.png' alt='".CONTENT_ADMIN_ITEM_LAN_64."' title='".CONTENT_ADMIN_ITEM_LAN_64."' />"); }
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/handlers/content_form_class.php 0.7.7/e107_plugins/content/handlers/content_form_class.php
--- 0.7.5/e107_plugins/content/handlers/content_form_class.php	2006-02-27 10:27:42.000000000 -0600
+++ 0.7.7/e107_plugins/content/handlers/content_form_class.php	2006-11-21 13:26:18.000000000 -0600
@@ -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.103 $
-|		$Date: 2006/02/27 16:27:42 $
+|		$Revision: 1.123 $
+|		$Date: 2006/11/21 19:26:18 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -33,14 +33,14 @@
 //only used in admin pages, for normal rows (+ in content_submit.php creation form)
 $TOPIC_ROW_NOEXPAND = "
 <tr>
-	<td class='forumheader3' style='width:20%; white-space:nowrap; vertical-align:top;'>{TOPIC_TOPIC}</td>
+	<td class='forumheader3' style='width:20%; vertical-align:top;'>{TOPIC_TOPIC}</td>
 	<td class='forumheader3'>{TOPIC_FIELD}</td>
 </tr>
 ";
 //only used in admin pages, for expanding rows (+ in content_submit.php creation form)
 $TOPIC_ROW = "
 <tr>
-	<td class='forumheader3' style='width:20%; white-space:nowrap; vertical-align:top;'>{TOPIC_TOPIC}</td>
+	<td class='forumheader3' style='width:20%; vertical-align:top;'>{TOPIC_TOPIC}</td>
 	<td class='forumheader3' style='vertical-align:top;'>
 		<a style='cursor: pointer;' onclick='expandit(this);'>{TOPIC_HEADING}</a>
 		<div style='display: none;'>
@@ -56,12 +56,12 @@
 
 class contentform{
 
-		function ContentItemPreview($_POST){
+		function ContentItemPreview(){
 				global $ns, $sql, $aa, $qs, $tp, $mainparent;
 
 				$TRPRE = "<tr>";
 				$TRPOST = "</tr>";
-				$TDPRE1 = "<td class='forumheader3' style='white-space:nowrap;vertical-align:top;'>";
+				$TDPRE1 = "<td class='forumheader3' style='vertical-align:top;'>";
 				$TDPRE2 = "<td class='forumheader3' style='vertical-align:top;'>";
 				$TDPOST = "</td>";
 				$CONTENT_CONTENT_PREVIEW = "
@@ -94,19 +94,19 @@
 				$_POST['parent'] = intval($_POST['parent']);
 				$mainparent						= $aa -> getMainParent( $_POST['parent'] );
 				$content_pref					= $aa -> getContentPref($mainparent);
-				$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-				$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-				$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-				$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
-				$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path_{$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"]);
+				$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+				$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path"]);
+				$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path"]);
 				
-				$content_pref["content_icon_path_tmp_{$mainparent}"] = ($content_pref["content_icon_path_tmp_{$mainparent}"] ? $content_pref["content_icon_path_tmp_{$mainparent}"] : $content_pref["content_icon_path_{$mainparent}"]."tmp/");
-				$content_pref["content_file_path_tmp_{$mainparent}"] = ($content_pref["content_file_path_tmp_{$mainparent}"] ? $content_pref["content_file_path_tmp_{$mainparent}"] : $content_pref["content_file_path_{$mainparent}"]."tmp/");
-				$content_pref["content_image_path_tmp_{$mainparent}"] = ($content_pref["content_image_path_tmp_{$mainparent}"] ? $content_pref["content_image_path_tmp_{$mainparent}"] : $content_pref["content_image_path_{$mainparent}"]."tmp/");
+				$content_pref["content_icon_path_tmp"] = ($content_pref["content_icon_path_tmp"] ? $content_pref["content_icon_path_tmp"] : $content_pref["content_icon_path"]."tmp/");
+				$content_pref["content_file_path_tmp"] = ($content_pref["content_file_path_tmp"] ? $content_pref["content_file_path_tmp"] : $content_pref["content_file_path"]."tmp/");
+				$content_pref["content_image_path_tmp"] = ($content_pref["content_image_path_tmp"] ? $content_pref["content_image_path_tmp"] : $content_pref["content_image_path"]."tmp/");
 						
-				$content_tmppath_icon			= $tp -> replaceConstants($content_pref["content_icon_path_tmp_{$mainparent}"]);
-				$content_tmppath_file			= $tp -> replaceConstants($content_pref["content_file_path_tmp_{$mainparent}"]);
-				$content_tmppath_image			= $tp -> replaceConstants($content_pref["content_image_path_tmp_{$mainparent}"]);
+				$content_tmppath_icon			= $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
+				$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']."' ")){
 					$row = $sql -> db_Fetch();
@@ -115,10 +115,17 @@
 				$content_heading	= $tp -> post_toHTML($_POST['content_heading']);
 				$content_subheading	= $tp -> post_toHTML($_POST['content_subheading']);
 				$content_summary	= $tp -> post_toHTML($_POST['content_summary']);
+				$content_text		= $_POST['content_text'];
 				if(e_WYSIWYG){
-					$_POST['content_text'] = $tp->createConstants($_POST['content_text']); // convert e107_images/ to {e_IMAGE} etc.
+					$content_text = $tp->createConstants($content_text); // convert e107_images/ to {e_IMAGE} etc.
 				}
-				$content_text = $tp->post_toHTML($_POST['content_text'],TRUE);
+
+				//the problem with tiny_mce is it's storing e_HTTP with an image path, while it should only use the {e_xxx} variables
+				//this small check resolves this, and stores the paths correctly
+				if(strstr($content_text,e_HTTP."{e_")){
+					$content_text = str_replace(e_HTTP."{e_", "{e_", $content_text);
+				}
+				$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_HEADING = ($content_heading ? $TRPRE.$TDPRE1.CONTENT_ADMIN_ITEM_LAN_11.$TDPOST.$TDPRE2.$content_heading.$TDPOST.$TRPOST : "");
@@ -150,7 +157,7 @@
 				$CONTENT_CONTENT_PREVIEW_CUSTOM = "";
 				
 				//custom tags
-				for($i=0;$i<$content_pref["content_admin_custom_number_{$mainparent}"];$i++){
+				for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
 				if($_POST["content_custom_key_{$i}"] != "" && $_POST["content_custom_value_{$i}"] != ""){
 				$CONTENT_CONTENT_PREVIEW_CUSTOM .= $TRPRE.$TDPRE1.$_POST["content_custom_key_{$i}"].$TDPOST.$TDPRE2.$_POST["content_custom_value_{$i}"].$TDPOST.$TRPOST;
 				}
@@ -234,19 +241,19 @@
 							return;
 						}
 
-						if($mode == 'submit' || $mode=='contentmanager'){
+						if($mode == 'submit' || $mode=='contentmanager' || ($mode=='sa' && e_PAGE=='content_manager.php') ){
 							$border = "border:1px solid #5d6e75;";
 							$padding = "padding:6px;";
 							$tableprop = "border-collapse: collapse; border-spacing:0px;";
 							$TOPIC_ROW_NOEXPAND = "
 							<tr>
-								<td class='forumheader3' style='".$padding." ".$border." width:30%; white-space:nowrap; vertical-align:top;'>{TOPIC_TOPIC}</td>
+								<td class='forumheader3' style='".$padding." ".$border." width:30%; vertical-align:top;'>{TOPIC_TOPIC}</td>
 								<td class='forumheader3' style='".$padding." ".$border."'>{TOPIC_FIELD}</td>
 							</tr>";
 
 							$TOPIC_ROW = "
 							<tr>
-								<td class='forumheader3' style='".$padding." ".$border." width:30%; white-space:nowrap; vertical-align:top;'>{TOPIC_TOPIC}</td>
+								<td class='forumheader3' style='".$padding." ".$border." width:30%; vertical-align:top;'>{TOPIC_TOPIC}</td>
 								<td class='forumheader3' style='".$padding." ".$border." vertical-align:top;'>
 									<a style='cursor: pointer;' onclick='expandit(this);'>{TOPIC_HEADING}</a>
 									<div style='display: none;'>
@@ -273,57 +280,78 @@
 						
 						$content_pref					= $aa -> getContentPref($mainparent);
 						
-						$content_pref["content_icon_path_tmp_{$mainparent}"] = ($content_pref["content_icon_path_tmp_{$mainparent}"] ? $content_pref["content_icon_path_tmp_{$mainparent}"] : $content_pref["content_icon_path_{$mainparent}"]."tmp/");
-						$content_pref["content_file_path_tmp_{$mainparent}"] = ($content_pref["content_file_path_tmp_{$mainparent}"] ? $content_pref["content_file_path_tmp_{$mainparent}"] : $content_pref["content_file_path_{$mainparent}"]."tmp/");
-						$content_pref["content_image_path_tmp_{$mainparent}"] = ($content_pref["content_image_path_tmp_{$mainparent}"] ? $content_pref["content_image_path_tmp_{$mainparent}"] : $content_pref["content_image_path_{$mainparent}"]."tmp/");
-						$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-						$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-						$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-						$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
-						$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path_{$mainparent}"]);
-						$content_tmppath_icon			= $tp -> replaceConstants($content_pref["content_icon_path_tmp_{$mainparent}"]);
-						$content_tmppath_file			= $tp -> replaceConstants($content_pref["content_file_path_tmp_{$mainparent}"]);
-						$content_tmppath_image			= $tp -> replaceConstants($content_pref["content_image_path_tmp_{$mainparent}"]);
+						$content_pref["content_icon_path_tmp"] = ($content_pref["content_icon_path_tmp"] ? $content_pref["content_icon_path_tmp"] : $content_pref["content_icon_path"]."tmp/");
+						$content_pref["content_file_path_tmp"] = ($content_pref["content_file_path_tmp"] ? $content_pref["content_file_path_tmp"] : $content_pref["content_file_path"]."tmp/");
+						$content_pref["content_image_path_tmp"] = ($content_pref["content_image_path_tmp"] ? $content_pref["content_image_path_tmp"] : $content_pref["content_image_path"]."tmp/");
+						$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"]);
+						$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+						$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path"]);
+						$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path"]);
+						$content_tmppath_icon			= $tp -> replaceConstants($content_pref["content_icon_path_tmp"]);
+						$content_tmppath_file			= $tp -> replaceConstants($content_pref["content_file_path_tmp"]);
+						$content_tmppath_image			= $tp -> replaceConstants($content_pref["content_image_path_tmp"]);
 
 						if(!is_object($sql)){ $sql = new db; }
 						$sql2 = new db;
+						
+						//check submit permissions
+						if($mode == 'submit'){
+							//check if current item exists (item is a (sub)category)
+							if($sql -> db_Select($plugintable, "content_id, content_heading, content_parent, content_pref", " content_id='".intval($qs[2])."' ")){
+								//check submit perms from main parent
+								if($content_pref["content_submit"] && check_class($content_pref["content_submit_class"])){
+								}else{
+									header("location:".$plugindir."content_submit.php"); exit;
+								}
+							}else{
+								header("location:".$plugindir."content_submit.php"); exit;
+							}
+						}
+						
+						//check manager permissions
 						if($mode == "contentmanager"){
-
-							$personalmanagercheck = FALSE;
+							//get current item
 							if($sql -> db_Select($plugintable, "content_id, content_heading, content_parent, content_pref", " content_id='".intval($qs[2])."' ")){
 								$rowpcm = $sql -> db_Fetch();
 								
+								//if edit item (query holds item id)
 								if( isset($qs[1]) && $qs[1] == "edit" && is_numeric($qs[2]) ){
+									//get parent
 									$sql2 -> db_Select($plugintable, "content_id, content_heading, content_parent, content_pref", " content_id='".$rowpcm['content_parent']."' ");
 									$rowpcm2 = $sql2 -> db_Fetch();
 									$pcmcheckpref = $rowpcm2['content_pref'];
 									$p = $rowpcm['content_parent'];
+								//create item (query holds category id)
 								}else{
 									$pcmcheckpref = $rowpcm['content_pref'];
 									$p = $qs[2];
 								}
 
-								$pcmcontent_pref = $eArrayStorage->ReadArray($pcmcheckpref);
+								$pcm_pref = $eArrayStorage->ReadArray($pcmcheckpref);
 
-								//assign new preferences
-								$pcm = explode(",", $pcmcontent_pref["content_manager_allowed_{$p}"]);
-								if(in_array($userid, $pcm) || getperms("0")){
-									$personalmanagercheck = TRUE;
-								}
-							}
-							if($personalmanagercheck == TRUE){
-								if($qs[1] == "edit"){
-									//use user restriction (personal admin)
-									if(isset($userid) && isset($username) ){
-										$userid = intval($userid);
-										$userquery = " AND (content_author = '".$userid."' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' OR SUBSTRING_INDEX(content_author, '^', 2) = '".$userid."^".$username."' OR content_author REGEXP '".$username."' )";
-									}else{
-										$userquery = "";
+								//user is allowed to work here
+								if( (isset($pcm_pref["content_manager_personal"]) && check_class($pcm_pref["content_manager_personal"])) || (isset($pcm_pref["content_manager_category"]) && check_class($pcm_pref["content_manager_category"])) ){
+									if($qs[1] == "edit"){
+										//if personal manager, assign author query
+										if( isset($pcm_pref["content_manager_personal"]) && check_class($pcm_pref["content_manager_personal"]) ){
+											if(isset($userid) && isset($username) ){
+												$userid = intval($userid);
+												$l = strlen($userid)+1;
+												$userquery = " AND (content_author = '".$userid."' || LEFT(content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' || content_author REGEXP '\\\^".$username."' ) ";
+											}else{
+												$userquery = "";
+											}
+										}
+										//if category manager, no author query is needed
+										if( isset($pcm_pref["content_manager_category"]) && check_class($pcm_pref["content_manager_category"]) ){
+											$userquery = "";
+										}
 									}
+								//user is not allowed to work here
+								}else{
+									header("location:".$plugindir."content_manager.php"); exit;
 								}
-								
-							}else{
-								header("location:".$plugindir."content_manager.php"); exit;
 							}
 
 						}else{
@@ -332,73 +360,90 @@
 
 						//get preferences for submit page
 						if($mode == "submit"){
-							$checkicon			= (isset($content_pref["content_submit_icon_{$mainparent}"]) ? $content_pref["content_submit_icon_{$mainparent}"] : "");
-							$checkattach		= (isset($content_pref["content_submit_attach_{$mainparent}"]) ? $content_pref["content_submit_attach_{$mainparent}"] : "");
-							$checkattachnumber	= (isset($content_pref["content_submit_files_number_{$mainparent}"]) ? $content_pref["content_submit_files_number_{$mainparent}"] : "");
-							$checkimages		= (isset($content_pref["content_submit_images_{$mainparent}"]) ? $content_pref["content_submit_images_{$mainparent}"] : "");
-							$checkimagesnumber	= (isset($content_pref["content_submit_images_number_{$mainparent}"]) ? $content_pref["content_submit_images_number_{$mainparent}"] : "");
-							$checkcomment		= (isset($content_pref["content_submit_comment_{$mainparent}"]) ? $content_pref["content_submit_comment_{$mainparent}"] : "");
-							$checkrating		= (isset($content_pref["content_submit_rating_{$mainparent}"]) ? $content_pref["content_submit_rating_{$mainparent}"] : "");
-							$checkscore			= (isset($content_pref["content_submit_score_{$mainparent}"]) ? $content_pref["content_submit_score_{$mainparent}"] : "");
-							$checkpe			= (isset($content_pref["content_submit_pe_{$mainparent}"]) ? $content_pref["content_submit_pe_{$mainparent}"] : "");
-							$checkvisibility	= (isset($content_pref["content_submit_visibility_{$mainparent}"]) ? $content_pref["content_submit_visibility_{$mainparent}"] : "");
-							$checkmeta			= (isset($content_pref["content_submit_meta_{$mainparent}"]) ? $content_pref["content_submit_meta_{$mainparent}"] : "");
-							$checkcustom		= (isset($content_pref["content_submit_customtags_{$mainparent}"]) ? $content_pref["content_submit_customtags_{$mainparent}"] : "");
-							$checkcustomnumber	= (isset($content_pref["content_submit_custom_number_{$mainparent}"]) ? $content_pref["content_submit_custom_number_{$mainparent}"] : "");
-							$checklayout		= (isset($content_pref["content_submit_layout_{$mainparent}"]) ? $content_pref["content_submit_layout_{$mainparent}"] : "");
-							$checkpreset		= (isset($content_pref["content_submit_presettags_{$mainparent}"]) ? $content_pref["content_submit_presettags_{$mainparent}"] : "");
+							$checksubheading	= (isset($content_pref["content_submit_subheading"]) ? $content_pref["content_submit_subheading"] : "");
+							$checksummary		= (isset($content_pref["content_submit_summary"]) ? $content_pref["content_submit_summary"] : "");
+							$checkstartdate		= (isset($content_pref["content_submit_startdate"]) ? $content_pref["content_submit_startdate"] : "");
+							$checkenddate		= (isset($content_pref["content_submit_enddate"]) ? $content_pref["content_submit_enddate"] : "");
+							$checkicon			= (isset($content_pref["content_submit_icon"]) ? $content_pref["content_submit_icon"] : "");
+							$checkattach		= (isset($content_pref["content_submit_attach"]) ? $content_pref["content_submit_attach"] : "");
+							$checkattachnumber	= (isset($content_pref["content_submit_files_number"]) ? $content_pref["content_submit_files_number"] : "");
+							$checkimages		= (isset($content_pref["content_submit_images"]) ? $content_pref["content_submit_images"] : "");
+							$checkimagesnumber	= (isset($content_pref["content_submit_images_number"]) ? $content_pref["content_submit_images_number"] : "");
+							$checkcomment		= (isset($content_pref["content_submit_comment"]) ? $content_pref["content_submit_comment"] : "");
+							$checkrating		= (isset($content_pref["content_submit_rating"]) ? $content_pref["content_submit_rating"] : "");
+							$checkscore			= (isset($content_pref["content_submit_score"]) ? $content_pref["content_submit_score"] : "");
+							$checkpe			= (isset($content_pref["content_submit_pe"]) ? $content_pref["content_submit_pe"] : "");
+							$checkvisibility	= (isset($content_pref["content_submit_visibility"]) ? $content_pref["content_submit_visibility"] : "");
+							$checkmeta			= (isset($content_pref["content_submit_meta"]) ? $content_pref["content_submit_meta"] : "");
+							$checkcustom		= (isset($content_pref["content_submit_customtags"]) ? $content_pref["content_submit_customtags"] : "");
+							$checkcustomnumber	= (isset($content_pref["content_submit_custom_number"]) ? $content_pref["content_submit_custom_number"] : "");
+							$checklayout		= (isset($content_pref["content_submit_layout"]) ? $content_pref["content_submit_layout"] : "");
+							$checkpreset		= (isset($content_pref["content_submit_presettags"]) ? $content_pref["content_submit_presettags"] : "");
 						
 						//get preferences for admin area; posted submitted item.
 						}elseif($mode == "sa"){
 
 							//show all preferences from the submit options. if submit pref is not set, check if create prefs are set and use those
-							$checkicon = (isset($content_pref["content_submit_icon_{$mainparent}"]) ? $content_pref["content_submit_icon_{$mainparent}"] : (isset($content_pref["content_admin_icon_{$mainparent}"]) ? $content_pref["content_admin_icon_{$mainparent}"] : ""));
+							$checksubheading = (isset($content_pref["content_submit_subheading"]) ? $content_pref["content_submit_subheading"] : (isset($content_pref["content_admin_subheading"]) ? $content_pref["content_admin_subheading"] : ""));
+
+							$checksummary	= (isset($content_pref["content_submit_summary"]) ? $content_pref["content_submit_summary"] : (isset($content_pref["content_admin_summary"]) ? $content_pref["content_admin_summary"] : ""));
+
+							$checkstartdate = (isset($content_pref["content_submit_startdate"]) ? $content_pref["content_submit_startdate"] : (isset($content_pref["content_admin_startdate"]) ? $content_pref["content_admin_startdate"] : ""));
+							
+							$checkenddate = (isset($content_pref["content_submit_enddate"]) ? $content_pref["content_submit_enddate"] : (isset($content_pref["content_admin_enddate"]) ? $content_pref["content_admin_enddate"] : ""));
 							
-							$checkattach = (isset($content_pref["content_submit_attach_{$mainparent}"]) ? $content_pref["content_submit_attach_{$mainparent}"] : (isset($content_pref["content_admin_attach_{$mainparent}"]) ? $content_pref["content_admin_attach_{$mainparent}"] : ""));
+							$checkicon = (isset($content_pref["content_submit_icon"]) ? $content_pref["content_submit_icon"] : (isset($content_pref["content_admin_icon"]) ? $content_pref["content_admin_icon"] : ""));
 							
-							$checkattachnumber = (isset($content_pref["content_submit_files_number_{$mainparent}"]) ? $content_pref["content_submit_files_number_{$mainparent}"] : (isset($content_pref["content_admin_files_number_{$mainparent}"]) ? $content_pref["content_admin_files_number_{$mainparent}"] : ""));
+							$checkattach = (isset($content_pref["content_submit_attach"]) ? $content_pref["content_submit_attach"] : (isset($content_pref["content_admin_attach"]) ? $content_pref["content_admin_attach"] : ""));
 							
-							$checkimages = (isset($content_pref["content_submit_images_{$mainparent}"]) ? $content_pref["content_submit_images_{$mainparent}"] : (isset($content_pref["content_admin_images_{$mainparent}"]) ? $content_pref["content_admin_images_{$mainparent}"] : ""));
+							$checkattachnumber = (isset($content_pref["content_submit_files_number"]) ? $content_pref["content_submit_files_number"] : (isset($content_pref["content_admin_files_number"]) ? $content_pref["content_admin_files_number"] : ""));
 							
-							$checkimagesnumber = (isset($content_pref["content_submit_images_number_{$mainparent}"]) ? $content_pref["content_submit_images_number_{$mainparent}"] : (isset($content_pref["content_admin_images_number_{$mainparent}"]) ? $content_pref["content_admin_images_number_{$mainparent}"] : ""));
+							$checkimages = (isset($content_pref["content_submit_images"]) ? $content_pref["content_submit_images"] : (isset($content_pref["content_admin_images"]) ? $content_pref["content_admin_images"] : ""));
 							
-							$checkcomment = (isset($content_pref["content_submit_comment_{$mainparent}"]) ? $content_pref["content_submit_comment_{$mainparent}"] : (isset($content_pref["content_admin_comment_{$mainparent}"]) ? $content_pref["content_admin_comment_{$mainparent}"] : ""));
+							$checkimagesnumber = (isset($content_pref["content_submit_images_number"]) ? $content_pref["content_submit_images_number"] : (isset($content_pref["content_admin_images_number"]) ? $content_pref["content_admin_images_number"] : ""));
 							
-							$checkrating = (isset($content_pref["content_submit_rating_{$mainparent}"]) ? $content_pref["content_submit_rating_{$mainparent}"] : (isset($content_pref["content_admin_rating_{$mainparent}"]) ? $content_pref["content_admin_rating_{$mainparent}"] : ""));
+							$checkcomment = (isset($content_pref["content_submit_comment"]) ? $content_pref["content_submit_comment"] : (isset($content_pref["content_admin_comment"]) ? $content_pref["content_admin_comment"] : ""));
 							
-							$checkscore = (isset($content_pref["content_submit_score_{$mainparent}"]) ? $content_pref["content_submit_score_{$mainparent}"] : (isset($content_pref["content_admin_score_{$mainparent}"]) ? $content_pref["content_admin_score_{$mainparent}"] : ""));
+							$checkrating = (isset($content_pref["content_submit_rating"]) ? $content_pref["content_submit_rating"] : (isset($content_pref["content_admin_rating"]) ? $content_pref["content_admin_rating"] : ""));
 							
-							$checkpe = (isset($content_pref["content_submit_pe_{$mainparent}"]) ? $content_pref["content_submit_pe_{$mainparent}"] : (isset($content_pref["content_admin_pe_{$mainparent}"]) ? $content_pref["content_admin_pe_{$mainparent}"] : ""));
+							$checkscore = (isset($content_pref["content_submit_score"]) ? $content_pref["content_submit_score"] : (isset($content_pref["content_admin_score"]) ? $content_pref["content_admin_score"] : ""));
 							
-							$checkvisibility = (isset($content_pref["content_submit_visibility_{$mainparent}"]) ? $content_pref["content_submit_visibility_{$mainparent}"] : (isset($content_pref["content_admin_visibility_{$mainparent}"]) ? $content_pref["content_admin_visibility_{$mainparent}"] : ""));
+							$checkpe = (isset($content_pref["content_submit_pe"]) ? $content_pref["content_submit_pe"] : (isset($content_pref["content_admin_pe"]) ? $content_pref["content_admin_pe"] : ""));
 							
-							$checkmeta = (isset($content_pref["content_submit_meta_{$mainparent}"]) ? $content_pref["content_submit_meta_{$mainparent}"] : (isset($content_pref["content_admin_meta_{$mainparent}"]) ? $content_pref["content_admin_meta_{$mainparent}"] : ""));
+							$checkvisibility = (isset($content_pref["content_submit_visibility"]) ? $content_pref["content_submit_visibility"] : (isset($content_pref["content_admin_visibility"]) ? $content_pref["content_admin_visibility"] : ""));
 							
-							$checkcustom = (isset($content_pref["content_submit_customtags_{$mainparent}"]) ? $content_pref["content_submit_customtags_{$mainparent}"] : (isset($content_pref["content_admin_customtags_{$mainparent}"]) ? $content_pref["content_admin_customtags_{$mainparent}"] : ""));
+							$checkmeta = (isset($content_pref["content_submit_meta"]) ? $content_pref["content_submit_meta"] : (isset($content_pref["content_admin_meta"]) ? $content_pref["content_admin_meta"] : ""));
 							
-							$checkcustomnumber = (isset($content_pref["content_submit_custom_number_{$mainparent}"]) && $content_pref["content_submit_custom_number_{$mainparent}"] != "0" ? $content_pref["content_submit_custom_number_{$mainparent}"] : (isset($content_pref["content_admin_custom_number_{$mainparent}"]) ? $content_pref["content_admin_custom_number_{$mainparent}"] : ""));
+							$checkcustom = (isset($content_pref["content_submit_customtags"]) ? $content_pref["content_submit_customtags"] : (isset($content_pref["content_admin_customtags"]) ? $content_pref["content_admin_customtags"] : ""));
 							
-							$checklayout = (isset($content_pref["content_submit_layout_{$mainparent}"]) ? $content_pref["content_submit_layout_{$mainparent}"] : (isset($content_pref["content_admin_layout_{$mainparent}"]) ? $content_pref["content_admin_layout_{$mainparent}"] : ""));
+							$checkcustomnumber = (isset($content_pref["content_submit_custom_number"]) && $content_pref["content_submit_custom_number"] != "0" ? $content_pref["content_submit_custom_number"] : (isset($content_pref["content_admin_custom_number"]) ? $content_pref["content_admin_custom_number"] : ""));
+							
+							$checklayout = (isset($content_pref["content_submit_layout"]) ? $content_pref["content_submit_layout"] : (isset($content_pref["content_admin_layout"]) ? $content_pref["content_admin_layout"] : ""));
 
-							$checkpreset = (isset($content_pref["content_submit_presettags_{$mainparent}"]) ? $content_pref["content_submit_presettags_{$mainparent}"] : (isset($content_pref["content_admin_presettags_{$mainparent}"]) ? $content_pref["content_admin_presettags_{$mainparent}"] : ""));
+							$checkpreset = (isset($content_pref["content_submit_presettags"]) ? $content_pref["content_submit_presettags"] : (isset($content_pref["content_admin_presettags"]) ? $content_pref["content_admin_presettags"] : ""));
 
 						//normal admin content create preferences
 						}else{
-							$checkicon			= (isset($content_pref["content_admin_icon_{$mainparent}"]) ? $content_pref["content_admin_icon_{$mainparent}"] : "");
-							$checkattach		= (isset($content_pref["content_admin_attach_{$mainparent}"]) ? $content_pref["content_admin_attach_{$mainparent}"] : "");
-							$checkattachnumber	= (isset($content_pref["content_admin_files_number_{$mainparent}"]) ? $content_pref["content_admin_files_number_{$mainparent}"] : "");
-							$checkimages		= (isset($content_pref["content_admin_images_{$mainparent}"]) ? $content_pref["content_admin_images_{$mainparent}"] : "");
-							$checkimagesnumber	= (isset($content_pref["content_admin_images_number_{$mainparent}"]) ? $content_pref["content_admin_images_number_{$mainparent}"] : "");
-							$checkcomment		= (isset($content_pref["content_admin_comment_{$mainparent}"]) ? $content_pref["content_admin_comment_{$mainparent}"] : "");
-							$checkrating		= (isset($content_pref["content_admin_rating_{$mainparent}"]) ? $content_pref["content_admin_rating_{$mainparent}"] : "");
-							$checkscore			= (isset($content_pref["content_admin_score_{$mainparent}"]) ? $content_pref["content_admin_score_{$mainparent}"] : "");
-							$checkpe			= (isset($content_pref["content_admin_pe_{$mainparent}"]) ? $content_pref["content_admin_pe_{$mainparent}"] : "");
-							$checkvisibility	= (isset($content_pref["content_admin_visibility_{$mainparent}"]) ? $content_pref["content_admin_visibility_{$mainparent}"] : "");
-							$checkmeta			= (isset($content_pref["content_admin_meta_{$mainparent}"]) ? $content_pref["content_admin_meta_{$mainparent}"] : "");
-							$checkcustom		= (isset($content_pref["content_admin_customtags_{$mainparent}"]) ? $content_pref["content_admin_customtags_{$mainparent}"] : "");
-							$checkcustomnumber	= (isset($content_pref["content_admin_custom_number_{$mainparent}"]) ? $content_pref["content_admin_custom_number_{$mainparent}"] : "");
-							$checklayout		= (isset($content_pref["content_admin_layout_{$mainparent}"]) ? $content_pref["content_admin_layout_{$mainparent}"] : "");
-							$checkpreset		= (isset($content_pref["content_admin_presettags_{$mainparent}"]) ? $content_pref["content_admin_presettags_{$mainparent}"] : "");
+
+							$checksubheading	= (isset($content_pref["content_admin_subheading"]) ? $content_pref["content_admin_subheading"] : "");
+							$checksummary		= (isset($content_pref["content_admin_summary"]) ? $content_pref["content_admin_summary"] : "");
+							$checkstartdate		= (isset($content_pref["content_admin_startdate"]) ? $content_pref["content_admin_startdate"] : "");
+							$checkenddate		= (isset($content_pref["content_admin_enddate"]) ? $content_pref["content_admin_enddate"] : "");
+							$checkicon			= (isset($content_pref["content_admin_icon"]) ? $content_pref["content_admin_icon"] : "");
+							$checkattach		= (isset($content_pref["content_admin_attach"]) ? $content_pref["content_admin_attach"] : "");
+							$checkattachnumber	= (isset($content_pref["content_admin_files_number"]) ? $content_pref["content_admin_files_number"] : "");
+							$checkimages		= (isset($content_pref["content_admin_images"]) ? $content_pref["content_admin_images"] : "");
+							$checkimagesnumber	= (isset($content_pref["content_admin_images_number"]) ? $content_pref["content_admin_images_number"] : "");
+							$checkcomment		= (isset($content_pref["content_admin_comment"]) ? $content_pref["content_admin_comment"] : "");
+							$checkrating		= (isset($content_pref["content_admin_rating"]) ? $content_pref["content_admin_rating"] : "");
+							$checkscore			= (isset($content_pref["content_admin_score"]) ? $content_pref["content_admin_score"] : "");
+							$checkpe			= (isset($content_pref["content_admin_pe"]) ? $content_pref["content_admin_pe"] : "");
+							$checkvisibility	= (isset($content_pref["content_admin_visibility"]) ? $content_pref["content_admin_visibility"] : "");
+							$checkmeta			= (isset($content_pref["content_admin_meta"]) ? $content_pref["content_admin_meta"] : "");
+							$checkcustom		= (isset($content_pref["content_admin_customtags"]) ? $content_pref["content_admin_customtags"] : "");
+							$checkcustomnumber	= (isset($content_pref["content_admin_custom_number"]) ? $content_pref["content_admin_custom_number"] : "");
+							$checklayout		= (isset($content_pref["content_admin_layout"]) ? $content_pref["content_admin_layout"] : "");
+							$checkpreset		= (isset($content_pref["content_admin_presettags"]) ? $content_pref["content_admin_presettags"] : "");
 						}
 						if($mode == "contentmanager"){ // used in contentmanager
 							$authordetails = $aa -> getAuthor(USERID);
@@ -408,27 +453,26 @@
 						}
 
 						if( ($qs[1] == "edit" || $qs[1] == "sa") && is_numeric($qs[2]) && !isset($_POST['preview_content']) && !isset($message)){
-							if(!$sql -> db_Select($plugintable, "*", "content_id='".intval($qs[2])."' ")){
-								header("location:".e_SELF."?content"); exit;
+							if(!$sql -> db_Select($plugintable, "*", "content_id='".intval($qs[2])."' ".$userquery." ")){
+								if($mode == "contentmanager"){
+									header("location:".$plugindir."content_manager.php"); exit;
+								}else{
+									header("location:".e_SELF."?content"); exit;
+								}
 							}else{
 								$row = $sql -> db_Fetch();
 
 								$row['content_heading']		= $tp -> toForm($row['content_heading']);
 								$row['content_subheading']	= $tp -> toForm($row['content_subheading']);
 								$row['content_summary']		= $tp -> toForm($row['content_summary']);
-								if(e_WYSIWYG){
-									$row['content_text']	= $tp->toHTML($row['content_text'],$parseBB = TRUE); // parse the bbcodes to we can edit as html.
-									$row['content_text']	= $tp->replaceConstants($row['content_text'],TRUE); // eg. replace {e_IMAGE} with e107_images/ and NOT ../e107_images
-								}else{
-									$row['content_text']	= $tp -> toForm($row['content_text']);
-								}
+								$row['content_text']		= $tp -> toForm($row['content_text']);
 								$row['content_meta']		= $tp -> toForm($row['content_meta']);
 								$authordetails				= $aa -> getAuthor($row['content_author']);
 							}
 						}
 
 						if(isset($_POST['preview_content'])){
-							$this -> ContentItemPreview($_POST);
+							$this -> ContentItemPreview();
 						}
 
 						//re-prepare the posted fields for the form (after preview)
@@ -438,12 +482,7 @@
 								$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']);
-								if(e_WYSIWYG){
-									$row['content_text'] = $tp->toHTML($_POST['content_text'],$parseBB = TRUE); // parse the bbcodes to we can edit as html.
-									$row['content_text'] = $tp->replaceConstants($_POST['content_text'],TRUE); // eg. replace {e_IMAGE} with e107_images/ and NOT ../e107_images
-								}else{
-									$row['content_text'] = $_POST['content_text'];
-								}
+								$row['content_text']				= $tp -> post_toForm($_POST['content_text']);
 								$authordetails[0]					= $_POST['content_author_id'];
 								$authordetails[1]					= $_POST['content_author_name'];
 								$authordetails[2]					= $_POST['content_author_email'];
@@ -474,7 +513,7 @@
 									}
 								}
 								//custom tags
-								for($i=0;$i<$content_pref["content_admin_custom_number_{$mainparent}"];$i++){
+								for($i=0;$i<$content_pref["content_admin_custom_number"];$i++){
 									$keystring = $tp -> post_toForm($_POST["content_custom_key_{$i}"]);
 									$custom["content_custom_{$keystring}"] = $tp -> post_toForm($_POST["content_custom_value_{$i}"]);
 								}
@@ -498,9 +537,9 @@
 						$hidden = "";
 						if($mode == "contentmanager"){
 							if($qs[1] == "edit"){
-								$hidden = $rs -> form_hidden("parent", $row['content_parent']);
+								$hidden .= $rs -> form_hidden("parent", $row['content_parent']);
 							}else{
-								$hidden = $rs -> form_hidden("parent", intval($qs[2]));
+								$hidden .= $rs -> form_hidden("parent", intval($qs[2]));
 							}
 						}else{
 							if($mode == "submit"){
@@ -518,37 +557,40 @@
 						//heading
 						$row['content_heading'] = (isset($row['content_heading']) ? $row['content_heading'] : "");
 						$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_11;
-						$TOPIC_FIELD = $rs -> form_text("content_heading", 74, $row['content_heading'], 250).$hidden;
+						$TOPIC_FIELD = $rs -> form_text("content_heading", 74, $row['content_heading'], 250);
 						$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
-						//subheading
-						$row['content_subheading'] = (isset($row['content_subheading']) ? $row['content_subheading'] : "");
-						$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_16;
-						$TOPIC_FIELD = $rs -> form_text("content_subheading", 74, $row['content_subheading'], 250);
-						$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						if($checksubheading){
+							//subheading
+							$row['content_subheading'] = (isset($row['content_subheading']) ? $row['content_subheading'] : "");
+							$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_16;
+							$TOPIC_FIELD = $rs -> form_text("content_subheading", 74, $row['content_subheading'], 250);
+							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_subheading", $row['content_subheading']);
+						}
 						
-						//summary
-						$row['content_summary'] = (isset($row['content_summary']) ? $row['content_summary'] : "");
-						$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_17;
-						$TOPIC_FIELD = $rs -> form_textarea("content_summary", 74, 5, $row['content_summary']);
-						$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						if($checksummary){
+							//summary
+							$row['content_summary'] = (isset($row['content_summary']) ? $row['content_summary'] : "");
+							$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_17;
+							$TOPIC_FIELD = $rs -> form_textarea("content_summary", 74, 5, $row['content_summary']);
+							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_summary", $row['content_summary']);
+						}
 
 						//text
-						
-						$row['content_text'] = (isset($row['content_text']) ? $row['content_text'] : "");
+						if(e_WYSIWYG){
+							$row['content_text'] = $tp->replaceConstants($row['content_text'], true);
+						}
 						require_once(e_HANDLER."ren_help.php");
 						$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_18;
-						$insertjs = (!$pref['wysiwyg'] ? "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'" : "");
-						
-						//$row['content_text'] = str_replace("&#039;", "'", $row['content_text']);
+						$insertjs = (!e_WYSIWYG) ? "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'": "";
 						$TOPIC_FIELD = $rs -> form_textarea("content_text", 74, 20, $row['content_text'], $insertjs)."<br />";
-						//$TOPIC_FIELD = "<textarea class='tbox' name='content_text' cols='70' rows='10' ".$insertjs." >".$row['content_text']."</textarea>";
-							
 						if (!$pref['wysiwyg']) { $TOPIC_FIELD .= $rs -> form_text("helpb", 90, '', '', "helpbox")."<br />".display_help("helpb"); }
 						$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
-						//$text .= $TOPIC_ROW_SPACER;
-
 						//author
 						$content_author_name_value	= ($content_author_name ? $content_author_name : CONTENT_ADMIN_ITEM_LAN_14);
 						$content_author_name_js		= ($content_author_name ? "" : "onfocus=\"if(document.getElementById('dataform').content_author_name.value=='".CONTENT_ADMIN_ITEM_LAN_14."'){document.getElementById('dataform').content_author_name.value='';}\"");
@@ -578,31 +620,37 @@
 						$smarray = getdate();
 						$current_year = $smarray['year'];
 
-						//start date
-						$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_15;
-						$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_73;
-						$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_17;
-						$TOPIC_FIELD = "
-							".$rs -> form_select_open("ne_day")."
-							".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
-							for($count=1; $count<=31; $count++){
-								$TOPIC_FIELD .= $rs -> form_option($count, (isset($ne_day) && $ne_day == $count ? "1" : "0"), $count);
-							}
-							$TOPIC_FIELD .= $rs -> form_select_close()."
-							".$rs -> form_select_open("ne_month")."
-							".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
-							for($count=1; $count<=12; $count++){
-								$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], (isset($ne_month) && $ne_month == $count ? "1" : "0"), $count);
-							}
-							$TOPIC_FIELD .= $rs -> form_select_close()."
-							".$rs -> form_select_open("ne_year")."
-							".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
-							for($count=($current_year-5); $count<=($current_year+1); $count++){
-								$TOPIC_FIELD .= $rs -> form_option($count, (isset($ne_year) && $ne_year == $count ? "1" : "0"), $count);
-							}
-							$TOPIC_FIELD .= $rs -> form_select_close()."
-						";
-						$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						if($checkstartdate){
+							//start date
+							$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_15;
+							$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_73;
+							$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_17;
+							$TOPIC_FIELD = "
+								".$rs -> form_select_open("ne_day")."
+								".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
+								for($count=1; $count<=31; $count++){
+									$TOPIC_FIELD .= $rs -> form_option($count, (isset($ne_day) && $ne_day == $count ? "1" : "0"), $count);
+								}
+								$TOPIC_FIELD .= $rs -> form_select_close()."
+								".$rs -> form_select_open("ne_month")."
+								".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
+								for($count=1; $count<=12; $count++){
+									$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], (isset($ne_month) && $ne_month == $count ? "1" : "0"), $count);
+								}
+								$TOPIC_FIELD .= $rs -> form_select_close()."
+								".$rs -> form_select_open("ne_year")."
+								".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
+								for($count=($current_year-5); $count<=($current_year+1); $count++){
+									$TOPIC_FIELD .= $rs -> form_option($count, (isset($ne_year) && $ne_year == $count ? "1" : "0"), $count);
+								}
+								$TOPIC_FIELD .= $rs -> form_select_close()."
+							";
+							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						}else{
+							$hidden .= $rs -> form_hidden("ne_day", $ne_day);
+							$hidden .= $rs -> form_hidden("ne_month", $ne_month);
+							$hidden .= $rs -> form_hidden("ne_year", $ne_year);
+						}
 
 
 						if(isset($row['content_enddate']) && $row['content_enddate'] != "0" && $row['content_enddate'] != ""){
@@ -616,31 +664,37 @@
 							$end_year	= (isset($end_year) ? $end_year : "0");
 						}
 
-						//end date
-						$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_16;
-						$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_74;
-						$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_18;
-						$TOPIC_FIELD = "
-							".$rs -> form_select_open("end_day")."
-							".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
-							for($count=1; $count<=31; $count++){
-								$TOPIC_FIELD .= $rs -> form_option($count, (isset($end_day) && $end_day == $count ? "1" : "0"), $count);
-							}
-							$TOPIC_FIELD .= $rs -> form_select_close()."
-							".$rs -> form_select_open("end_month")."
-							".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
-							for($count=1; $count<=12; $count++){
-								$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], (isset($end_month) && $end_month == $count ? "1" : "0"), $count);
-							}
-							$TOPIC_FIELD .= $rs -> form_select_close()."
-							".$rs -> form_select_open("end_year")."
-							".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
-							for($count=($current_year-5); $count<=($current_year+1); $count++){
-								$TOPIC_FIELD .= $rs -> form_option($count, (isset($end_year) && $end_year == $count ? "1" : "0"), $count);
-							}
-							$TOPIC_FIELD .= $rs -> form_select_close()."
-						";
-						$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						if($checkenddate){
+							//end date
+							$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_16;
+							$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_74;
+							$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_18;
+							$TOPIC_FIELD = "
+								".$rs -> form_select_open("end_day")."
+								".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
+								for($count=1; $count<=31; $count++){
+									$TOPIC_FIELD .= $rs -> form_option($count, (isset($end_day) && $end_day == $count ? "1" : "0"), $count);
+								}
+								$TOPIC_FIELD .= $rs -> form_select_close()."
+								".$rs -> form_select_open("end_month")."
+								".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
+								for($count=1; $count<=12; $count++){
+									$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], (isset($end_month) && $end_month == $count ? "1" : "0"), $count);
+								}
+								$TOPIC_FIELD .= $rs -> form_select_close()."
+								".$rs -> form_select_open("end_year")."
+								".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
+								for($count=($current_year-5); $count<=($current_year+1); $count++){
+									$TOPIC_FIELD .= $rs -> form_option($count, (isset($end_year) && $end_year == $count ? "1" : "0"), $count);
+								}
+								$TOPIC_FIELD .= $rs -> form_select_close()."
+							";
+							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						}else{
+							$hidden .= $rs -> form_hidden("end_day", $end_day);
+							$hidden .= $rs -> form_hidden("end_month", $end_month);
+							$hidden .= $rs -> form_hidden("end_year", $end_year);
+						}
 
 						//$text .= $TOPIC_ROW_SPACER;
 						if( $checkicon || $checkattach || $checkimages ){
@@ -657,31 +711,31 @@
 							$imagelist			= $fl->get_files($content_tmppath_image,"",$rejectlist);
 
 							$TOPIC_FIELD = "";
-								if(!FILE_UPLOADS){
-									$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_21."</b>";
-								}else{
-									if(!is_writable($content_tmppath_icon)){
-										$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_icon." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
-									}
-									if(!is_writable($content_tmppath_file)){
-										$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_file." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
-									}
-									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")."
-										".$rs -> form_option(CONTENT_ADMIN_ITEM_LAN_114, "0", "1")."
-										".$rs -> form_option(CONTENT_ADMIN_ITEM_LAN_115, "0", "2")."
-										".$rs -> form_option(CONTENT_ADMIN_ITEM_LAN_116, "0", "3")."
-										".$rs -> form_select_close()."
-									<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 />";
+							if(!FILE_UPLOADS){
+								$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_21."</b>";
+							}else{
+								if(!is_writable($content_tmppath_icon)){
+									$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_icon." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
+								}
+								if(!is_writable($content_tmppath_file)){
+									$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_tmppath_file." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
 								}
+								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")."
+									".($checkicon ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_114, "0", "1") : '')."
+									".($checkattach ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_115, "0", "2") : '')."
+									".($checkimages ? $rs -> form_option(CONTENT_ADMIN_ITEM_LAN_116, "0", "3") : '')."
+									".$rs -> form_select_close()."
+								<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 />";
+							}
 							$TOPIC_FIELD .= "<br />";
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
 						}
@@ -711,6 +765,8 @@
 								$TOPIC_FIELD .= "</div>";
 
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						}else{
+							$hidden .= $rs -> form_hidden("content_icon", $row['content_icon']);
 						}
 
 						if($checkattach){
@@ -747,6 +803,8 @@
 								$TOPIC_FIELD .= "</div></div>";
 							}
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						}else{
+							$hidden .= $rs -> form_hidden("content_file", $row['content_file']);
 						}
 
 						if($checkimages){
@@ -788,6 +846,8 @@
 								$TOPIC_FIELD .= "</div></div>";								
 							}
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+						}else{
+							$hidden .= $rs -> form_hidden("content_image", $row['content_image']);
 						}
 
 						if($checkcomment || $checkrating || $checkpe || $checkvisibility || $checkscore || $checkmeta || $checklayout ){
@@ -802,6 +862,8 @@
 							".$rs -> form_radio("content_comment", "0", ($row['content_comment'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86."
 							";
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_comment", $row['content_comment']);
 						}
 
 						if($checkrating){
@@ -813,6 +875,8 @@
 							".$rs -> form_radio("content_rate", "0", ($row['content_rate'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86."
 							";
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_rate", $row['content_rate']);
 						}
 
 						if($checkpe){
@@ -824,6 +888,8 @@
 							".$rs -> form_radio("content_pe", "0", ($row['content_pe'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86."
 							";
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_pe", $row['content_pe']);
 						}
 
 						if($checkvisibility){
@@ -832,6 +898,8 @@
 							$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_39;
 							$TOPIC_FIELD = r_userclass("content_class",$row['content_class'], "CLASSES");
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_class", $row['content_class']);
 						}
 
 						if($checkscore){
@@ -845,6 +913,8 @@
 								}
 								$TOPIC_FIELD .= $rs -> form_select_close();
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_score", $row['content_score']);
 						}
 
 						if($checkmeta){
@@ -852,16 +922,18 @@
 							$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_53;
 							$TOPIC_FIELD = CONTENT_ADMIN_ITEM_LAN_70."<br />".$rs -> form_text("content_meta", 74, $row['content_meta'], 250);
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+						}else{
+							$hidden .= $rs -> form_hidden("content_meta", $row['content_meta']);
 						}
 
 						if($checklayout){
 							global $fl;
 
-							if(!isset($content_pref["content_theme_{$mainparent}"])){
+							if(!isset($content_pref["content_theme"])){
 								$dir = $plugindir."templates/default";
 							}else{
-								if(file_exists($plugindir."templates/".$content_pref["content_theme_{$mainparent}"]."/content_content_template.php")){
-									$dir = $plugindir."templates/".$content_pref["content_theme_{$mainparent}"];
+								if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
+									$dir = $tp->replaceConstants($content_pref["content_theme"]);
 								}else{
 									$dir = $plugindir."templates/default";
 								}
@@ -875,8 +947,8 @@
 							if(isset($row['content_layout']) && $row['content_layout'] != ""){
 								$check = $row['content_layout'];
 							}else{
-								if(isset($content_pref["content_layout_{$mainparent}"])){
-									$check = $content_pref["content_layout_{$mainparent}"];
+								if(isset($content_pref["content_layout"])){
+									$check = $content_pref["content_layout"];
 								}
 							}
 							$TOPIC_TOPIC = CONTENT_ADMIN_ITEM_LAN_92;
@@ -891,7 +963,7 @@
 							$TOPIC_FIELD .= $rs -> form_select_close();
 							$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 						}else{
-							$hiddenlayout = $rs -> form_hidden("content_layout", $content_pref["content_layout_{$mainparent}"]);
+							$hidden .= $rs -> form_hidden("content_layout", $row['content_layout']);
 						}
 
 						if( $checkcustom && $checkcustomnumber ){
@@ -954,7 +1026,7 @@
 						if(count($content_pref["content_custom_preset_key"]) > 0){
 							//$text .= $TOPIC_ROW_SPACER;
 						}
-						$hidden = "";
+
 						for($i=0;$i<count($content_pref["content_custom_preset_key"]);$i++){
 							$value = "";
 							if(!empty($content_pref["content_custom_preset_key"][$i])){
@@ -977,7 +1049,7 @@
 
 						$text .= $TOPIC_ROW_SPACER."
 						<tr>
-							<td colspan='2' style='text-align:center' class='forumheader'>".($hidden ? $hidden : "").($hiddenlayout ? $hiddenlayout : "");
+							<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']) ){
@@ -1091,25 +1163,32 @@
 
 			$mainparent						= $aa -> getMainParent($qs[1]);
 			$content_pref					= $aa -> getContentPref($mainparent);
-			$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
-			$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path_{$mainparent}"]);
-			$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path_{$mainparent}"]);
-			$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path_{$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"]);
+			$content_icon_path				= $tp -> replaceConstants($content_pref["content_icon_path"]);
+			$content_image_path				= $tp -> replaceConstants($content_pref["content_image_path"]);
+			$content_file_path				= $tp -> replaceConstants($content_pref["content_file_path"]);
 
 			if($mode == "contentmanager"){
 				$personalmanagercheck = FALSE;
 				if($sql -> db_Select($plugintable, "content_id, content_heading, content_pref", " content_id='".intval($qs[1])."' ")){
 					$rowpcm = $sql -> db_Fetch();
-					$pcmcontent_pref = $eArrayStorage->ReadArray($rowpcm['content_pref']);
+					$curpref = $eArrayStorage->ReadArray($rowpcm['content_pref']);
 
-					//assign new preferences
-					$pcm = explode(",", $pcmcontent_pref["content_manager_allowed_{$rowpcm['content_id']}"]);
-					if(in_array($userid, $pcm) || getperms("0")){
+					//only show personal items
+					if( isset($curpref["content_manager_personal"]) && check_class($curpref["content_manager_personal"]) ){
+						$l = strlen($userid)+1;
+						$qryuser = " AND (content_author = '".$userid."' || LEFT(content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' || content_author REGEXP '\\\^".$username."' ) ";
+						$personalmanagercheck = TRUE;
+					}
+					//show all items in this category
+					if(isset($curpref["content_manager_category"]) && check_class($curpref["content_manager_category"]) ){
+						$qryuser = '';
 						$personalmanagercheck = TRUE;
 					}
 				}
 				if($personalmanagercheck == TRUE){
+					/*
 					$qryuser = "";
 					if(getperms("0")){
 						$userid = USERID;
@@ -1119,8 +1198,11 @@
 						if(isset($userid) && isset($username) ){
 							$userid = intval($userid);
 							$qryuser = " AND (content_author = '".$userid."' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' OR SUBSTRING_INDEX(content_author, '^', 2) = '".$userid."^".$username."' OR content_author REGEXP '".$username."' )";
+
+							//$qryuser = " AND (content_author = '".$userid."' || LEFT(content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(content_author, '^', 1) = '".$userid."' || content_author REGEXP '\\\^".$username."' ) ";
 						}
 					}
+					*/
 					$formtarget	= $plugindir."content_manager.php?content.".intval($qs[1]);
 					$qrycat		= " content_parent = '".intval($qs[1])."' ";
 					$qryfirst	= " content_parent = '".intval($qs[1])."' ";
@@ -1197,7 +1279,7 @@
 			if(!$content_total = $sql2 -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_author, content_icon", $qryitem)){
 				$text .= "<div style='text-align:center'>".CONTENT_ADMIN_ITEM_LAN_4."</div>";
 			}else{
-				if($content_total < 50 || isset($letter)){
+				if($content_total < 50 || (isset($letter) && $letter!='') ){
 					$text .= "
 					<div style='text-align:center'>
 					".$rs -> form_open("post", e_SELF."?".e_QUERY, "deletecontentform","","", "")."
@@ -1243,11 +1325,16 @@
 
 
 
-		function show_submitted(){
+		//show_submitted("contentmanager", USERID, USERNAME, $qs[2]);
+		function show_submitted($cat=''){
 			global $qs, $rs, $ns, $aa, $plugintable, $tp;
 
+			$catqry = '';
+			if($cat && is_numeric($cat)){
+				$catqry = " AND content_parent='".intval($cat)."' ";
+			}
 			if(!is_object($sql)){ $sql = new db; }
-			if(!$content_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_author, content_icon, content_parent", "content_refer = 'sa' ")){
+			if(!$content_total = $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_author, content_icon, content_parent", "content_refer = 'sa' ".$catqry." ")){
 				$text .= "<div style='text-align:center'>".CONTENT_ADMIN_ITEM_LAN_50."</div>";
 			}else{
 				$array = $aa -> getCategoryTree("", "", FALSE);
@@ -1270,7 +1357,7 @@
 						$mainparent			= $array[$row['content_parent']][0];
 						$mainparentheading	= $array[$row['content_parent']][1]." [".$array[$row['content_parent']][count($array[$row['content_parent']])-1]."]";
 						$content_pref		= $aa -> getContentPref($mainparent);
-						$iconpath			= ($content_pref["content_icon_path_{$mainparent}"] ? $content_pref["content_icon_path_{$mainparent}"] : "{e_PLUGIN}content/images/icon/" );
+						$iconpath			= ($content_pref["content_icon_path"] ? $content_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/" );
 						$content_icon_path	= $tp -> replaceConstants($iconpath);
 						$icon				= $content_icon_path.$row['content_icon'];
 					}
@@ -1308,8 +1395,7 @@
 		}
 
 
-
-		function show_manage($mode){
+		function manage_cat(){
 			global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $stylespacer, $eArrayStorage;
 
 			$catarray	= $aa -> getCategoryTree("", "", FALSE);
@@ -1338,8 +1424,8 @@
 						$row = $sql -> db_Fetch();
 
 						$content_pref					= $aa -> getContentPref($catarray[$catid][0]);
-						$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$catarray[$catid][0]}"]);
-						$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$catarray[$catid][0]}"]);
+						$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"]);
 						$delete_heading					= str_replace("&#39;", "\'", $row['content_heading']);
 						$authordetails					= $aa -> getAuthor($row['content_author']);
 						$caticon						= $content_cat_icon_path_large.$row['content_icon'];
@@ -1355,23 +1441,9 @@
 							}
 						}
 
-						$pcmusers = "";
-						if($mode == "category"){
-							$options = "<a href='".e_SELF."?cat.edit.".$catid."'>".CONTENT_ICON_EDIT."</a>
-							<input type='image' title='".CONTENT_ICON_LAN_1."' name='delete[cat_{$catid}]' src='".CONTENT_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(CONTENT_ADMIN_JS_LAN_9."\\n\\n".CONTENT_ADMIN_JS_LAN_0."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$catid." : ".$delete_heading."]\\n\\n")."')\"/>";
+						$options = "<a href='".e_SELF."?cat.edit.".$catid."'>".CONTENT_ICON_EDIT."</a>
+						<input type='image' title='".CONTENT_ICON_LAN_1."' name='delete[cat_{$catid}]' src='".CONTENT_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(CONTENT_ADMIN_JS_LAN_9."\\n\\n".CONTENT_ADMIN_JS_LAN_0."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$catid." : ".$delete_heading."]\\n\\n")."')\"/>";
 						
-						}elseif($mode == "manager"){
-							$options = "<a href='".e_SELF."?manager.".intval($catid)."'>".CONTENT_ICON_CONTENTMANAGER_SMALL."</a>";
-							if(isset($row['content_pref'])){
-								$pcmcontent_pref = $eArrayStorage->ReadArray($row['content_pref']);
-							}
-							if(isset($pcmcontent_pref["content_manager_allowed_{$catid}"])){
-								$pcm		= explode(",", $pcmcontent_pref["content_manager_allowed_{$catid}"]);
-								if($pcm[0]==""){ unset($pcm[0]); }
-								$pcmusers	= count($pcm);
-								$options	.= " ".($pcmusers ? "(".$pcmusers." ".($pcmusers == 1 ? CONTENT_ADMIN_CAT_LAN_54 : CONTENT_ADMIN_CAT_LAN_55).")" : "");
-							}
-						}
 						$row['content_heading']		= $tp->toHTML($row['content_heading'], TRUE, "");
 						$row['content_subheading']	= $tp->toHTML($row['content_subheading'], TRUE, "");
 
@@ -1381,9 +1453,9 @@
 						<td class='".$class."' style='width:5%; text-align:left'>".$catid."</td>
 						<td class='".$class."' style='width:5%; text-align:center'>".($row['content_icon'] ? "<img src='".$caticon."' alt='' style='vertical-align:middle' />" : "&nbsp;")."</td>
 						<td class='".$class."' style='width:15%'>".($authordetails[0] != "0" ? "<a href='".e_BASE."user.php?id.".$authordetails[0]."'>".CONTENT_ICON_USER."</a>" : "")." ".$authordetails[1]."</td>
-						<td class='".$class."' style='width:65%; white-space:nowrap;'>
+						<td class='".$class."' style='width:65%;'>
 							 <a href='".$plugindir."content.php?cat.".$row['content_id']."'>".CONTENT_ICON_LINK."</a> 
-							".$pre.$row['content_heading']." ".($row['content_subheading'] ? "[".$row['content_subheading']."]" : "")."											
+							".$pre.$row['content_heading']." ".($row['content_subheading'] ? "[".$row['content_subheading']."]" : "")."
 						</td>
 						<td class='".$class."' style='width:10%; text-align:left; white-space:nowrap;'>
 							".$options."
@@ -1400,7 +1472,147 @@
 			unset($row['content_id'], $row['content_heading'], $row['content_subheading'], $row['content_text'], $row['content_icon']);
 		}
 
+		function manager(){
+			global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $stylespacer, $eArrayStorage;
+
+			$catarray	= $aa -> getCategoryTree("", "", FALSE);
+			$array		= array_keys($catarray);
+
+			if(!is_array($array)){
+				$text = "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
+			}else{
+				$text = "
+				<div style='text-align:center'>
+				".$rs -> form_open("post", e_SELF."?".$qs[0], "catform","","", "")."
+				<table style='".ADMIN_WIDTH."' class='fborder'>
+				<tr>
+					<td class='fcaption' style='width:5%'>".CONTENT_ADMIN_CAT_LAN_24."</td>
+					<td class='fcaption' style='width:65%'>".CONTENT_ADMIN_CAT_LAN_19."</td>
+					<td class='fcaption' style='width:10%; text-align:center'>".CONTENT_ADMIN_CAT_LAN_20."</td>
+				</tr>";
+
+				if(!is_object($sql)){ $sql = new db; }
+				foreach($array as $catid){
+					if(!$category_total = $sql -> db_Select($plugintable, "*", "content_id='".intval($catid)."' ")){
+						$text .= "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
+					}else{
+						$row = $sql -> db_Fetch();
 
+						$content_pref					= $eArrayStorage->ReadArray($row['content_pref']);
+						$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"]);
+						$delete_heading					= str_replace("&#39;", "\'", $row['content_heading']);
+						$authordetails					= $aa -> getAuthor($row['content_author']);
+						$caticon						= $content_cat_icon_path_large.$row['content_icon'];
+
+						$pre = "";
+						if($row['content_parent'] == "0"){		//main parent level
+							$class			= "forumheader3";
+							$mainparentid	= $row['content_id'];
+						}else{									//sub level
+							$class = "forumheader3";
+							for($b=0;$b<(count($catarray[$catid])/2)-1;$b++){
+								$pre .= "_";
+							}
+						}
+
+						//$pcmusers = "";
+						$options = "<a href='".e_SELF."?manager.".intval($catid)."'>".CONTENT_ICON_CONTENTMANAGER_SMALL."</a>";
+						/*
+						if(isset($row['content_pref'])){
+							$pcmcontent_pref = $eArrayStorage->ReadArray($row['content_pref']);
+						}
+						if(isset($pcmcontent_pref["content_manager_allowed_{$catid}"])){
+							$pcm		= explode(",", $pcmcontent_pref["content_manager_allowed_{$catid}"]);
+							if($pcm[0]==""){ unset($pcm[0]); }
+							$pcmusers	= count($pcm);
+							$options	.= " ".($pcmusers ? "(".$pcmusers." ".($pcmusers == 1 ? CONTENT_ADMIN_CAT_LAN_54 : CONTENT_ADMIN_CAT_LAN_55).")" : "");
+						}
+						*/
+
+						$row['content_heading']		= $tp->toHTML($row['content_heading'], TRUE, "");
+						$row['content_subheading']	= $tp->toHTML($row['content_subheading'], TRUE, "");
+
+						$text .= "
+						".($row['content_parent'] == 0 ? "<tr><td colspan='3' $stylespacer></td></tr>" : "")."
+						<tr>
+							<td class='".$class."' style='width:5%; text-align:left'>".$catid."</td>
+							<td class='forumheader' style='width:65%;'>
+								 <a href='".$plugindir."content.php?cat.".$row['content_id']."'>".CONTENT_ICON_LINK."</a> 
+								".$pre.$row['content_heading']." ".($row['content_subheading'] ? "[".$row['content_subheading']."]" : "")."
+							</td>
+							<td class='".$class."' style='width:10%; text-align:left; white-space:nowrap;'>
+								".$options."
+							</td>
+						</tr>";
+					}
+				}
+				$text .= "
+				</table>
+				".$rs -> form_close()."
+				</div>";
+			}
+			$ns -> tablerender(CONTENT_ADMIN_CAT_LAN_10, $text);
+			unset($row['content_id'], $row['content_heading'], $row['content_subheading'], $row['content_text'], $row['content_icon']);
+		}
+
+
+		function manager_category(){
+			global $plugintable, $qs, $sql, $ns, $rs, $aa, $eArrayStorage;
+
+			if(!getperms("0")){ js_location(e_SELF); }
+			if(!is_numeric($qs[1])){ js_location(e_SELF); }
+
+			if(!is_object($sql)){ $sql = new db; }
+			if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_pref", "content_id='".intval($qs[1])."' ")){
+				js_location(e_SELF."?manager");
+			}else{
+				$row = $sql -> db_Fetch();
+				$caption = CONTENT_ADMIN_CAT_LAN_30." : ".$row['content_heading'];
+			}
+			$content_pref	= $eArrayStorage->ReadArray($row['content_pref']);
+			$qs[1] = intval($qs[1]);
+
+			$text = "
+			<div style='text-align:center'>
+			".$rs -> form_open("post", e_SELF."?".e_QUERY, "managerform", "", "enctype='multipart/form-data'")."
+			<table class='fborder' style='".ADMIN_WIDTH."'>
+			<tr>
+				<td class='forumheader3' style='text-align:left'>
+					".CONTENT_ADMIN_MANAGER_LAN_0."<br />".CONTENT_ADMIN_MANAGER_LAN_1."<br />
+				</td>
+				<td class='forumheader3' style='text-align:left'>
+					".r_userclass("content_manager_approve", $content_pref["content_manager_approve"], 'off', "public,guest,nobody,member,admin,classes")."
+				</td>
+			</tr>
+			<tr>
+				<td class='forumheader3' style='text-align:left'>
+					".CONTENT_ADMIN_MANAGER_LAN_2."<br />".CONTENT_ADMIN_MANAGER_LAN_3."<br />
+				</td>
+				<td class='forumheader3' style='text-align:left'>
+					".r_userclass("content_manager_personal", $content_pref["content_manager_personal"], 'off', "public,guest,nobody,member,admin,classes")."
+				</td>
+			</tr>
+			<tr>
+				<td class='forumheader3' style='text-align:left'>
+					".CONTENT_ADMIN_MANAGER_LAN_4."<br />".CONTENT_ADMIN_MANAGER_LAN_5."<br />
+				</td>
+				<td class='forumheader3' style='text-align:left'>
+					".r_userclass("content_manager_category", $content_pref["content_manager_category"], 'off', "public,guest,nobody,member,admin,classes")."
+				</td>
+			</tr>
+			<tr>
+				<td colspan='2' class='fcaption' style='text-align:center'>
+					".$rs -> form_button("submit", "update_manager", LAN_SAVE)."
+					".$rs -> form_hidden("options_type", $qs[1])."
+				</td>
+			</tr>
+			</table>
+			".$rs -> form_close()."
+			</div>";
+
+			$ns -> tablerender($caption, $text);
+		}
 
 		function show_create_category(){
 			global $qs, $plugintable, $plugindir, $sql, $ns, $rs, $aa, $fl, $pref, $tp;
@@ -1414,8 +1626,8 @@
 			$array							= $aa -> getCategoryTree("", "", FALSE);
 			$mainparent						= $aa -> getMainParent( (isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "0") ) );
 			$content_pref					= $aa -> getContentPref($mainparent);
-			$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$mainparent}"]);
-			$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$mainparent}"]);
+			$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small"]);
+			$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large"]);
 
 			if( $qs[0] == "cat" && $qs[1] == "create" && isset($qs[2]) && is_numeric($qs[2]) ){
 				if(!$sql -> db_Select($plugintable, "*", "content_id='".intval($qs[2])."' ")){
@@ -1450,7 +1662,7 @@
 				<div style='text-align:center'>
 				<table class='fborder' style='".ADMIN_WIDTH."' border='0'>
 				<tr>
-					<td class='forumheader3' rowspan='3' style='width:5%; white-space:nowrap; vertical-align:top;'><img src='".$content_cat_icon_path_large.$_POST['cat_icon']."' style='border:0' alt='' /></td>
+					<td class='forumheader3' rowspan='3' style='width:5%; vertical-align:top;'><img src='".$content_cat_icon_path_large.$_POST['cat_icon']."' style='border:0' alt='' /></td>
 					<td class='fcaption'>".$cat_heading."</td>
 				</tr>
 				<tr><td class='forumheader3'>".$cat_subheading."</td></tr>
@@ -1498,6 +1710,25 @@
 				}
 			}
 
+			//check which areas should be visible (dependent on options in admin:create category)
+			$checksubheading = (isset($content_pref["content_admincat_subheading"]) ? $content_pref["content_admincat_subheading"] : (isset($content_pref["content_admincat_subheading"]) ? $content_pref["content_admincat_subheading"] : ""));
+
+			$checkstartdate = (isset($content_pref["content_admincat_startdate"]) ? $content_pref["content_admincat_startdate"] : (isset($content_pref["content_admincat_startdate"]) ? $content_pref["content_admincat_startdate"] : ""));
+
+			$checkenddate = (isset($content_pref["content_admincat_enddate"]) ? $content_pref["content_admincat_enddate"] : (isset($content_pref["content_admincat_enddate"]) ? $content_pref["content_admincat_enddate"] : ""));
+
+			$checkuploadicon = (isset($content_pref["content_admincat_uploadicon"]) ? $content_pref["content_admincat_uploadicon"] : (isset($content_pref["content_admincat_uploadicon"]) ? $content_pref["content_admincat_uploadicon"] : ""));
+
+			$checkselecticon = (isset($content_pref["content_admincat_selecticon"]) ? $content_pref["content_admincat_selecticon"] : (isset($content_pref["content_admincat_selecticon"]) ? $content_pref["content_admincat_selecticon"] : ""));
+
+			$checkcomment = (isset($content_pref["content_admincat_comment"]) ? $content_pref["content_admincat_comment"] : (isset($content_pref["content_admincat_comment"]) ? $content_pref["content_admincat_comment"] : ""));
+
+			$checkrating = (isset($content_pref["content_admincat_rating"]) ? $content_pref["content_admincat_rating"] : (isset($content_pref["content_admincat_rating"]) ? $content_pref["content_admincat_rating"] : ""));
+
+			$checkpe = (isset($content_pref["content_admincat_pe"]) ? $content_pref["content_admincat_pe"] : (isset($content_pref["content_admincat_pe"]) ? $content_pref["content_admincat_pe"] : ""));
+
+			$checkvisibility = (isset($content_pref["content_admincat_visibility"]) ? $content_pref["content_admincat_visibility"] : (isset($content_pref["content_admincat_visibility"]) ? $content_pref["content_admincat_visibility"] : ""));
+
 			$text = "
 			<div style='text-align:center'>
 			".$rs -> form_open("post", $formurl, "dataform", "", "enctype='multipart/form-data'")."
@@ -1523,10 +1754,14 @@
 			$TOPIC_FIELD = $rs -> form_text("cat_heading", 90, $row['content_heading'], 250);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
-			$row['content_subheading'] = (isset($row['content_subheading']) ? $row['content_subheading'] : "");
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_3;
-			$TOPIC_FIELD = $rs -> form_text("cat_subheading", 90, $row['content_subheading'], 250);
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			if($checksubheading){
+				$row['content_subheading'] = (isset($row['content_subheading']) ? $row['content_subheading'] : "");
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_3;
+				$TOPIC_FIELD = $rs -> form_text("cat_subheading", 90, $row['content_subheading'], 250);
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			}else{
+				$hidden .= $rs -> form_hidden("cat_subheading", $row['content_subheading']);
+			}
 
 			$row['content_text'] = (isset($row['content_text']) ? $row['content_text'] : "");
 			require_once(e_HANDLER."ren_help.php");
@@ -1562,117 +1797,151 @@
 
 			$text .= $TOPIC_ROW_SPACER;
 
-			$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_15;
-			$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_73;
-			$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_17;
-			$TOPIC_FIELD = "
-				".$rs -> form_select_open("ne_day")."
-				".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
-				for($count=1; $count<=31; $count++){
-					$TOPIC_FIELD .= $rs -> form_option($count, ($ne_day == $count ? "1" : "0"), $count);
-				}
-				$TOPIC_FIELD .= $rs -> form_select_close()."
-				".$rs -> form_select_open("ne_month")."
-				".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
-				for($count=1; $count<=12; $count++){
-					$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], ($ne_month == $count ? "1" : "0"), $count);
-				}
-				$TOPIC_FIELD .= $rs -> form_select_close()."
-				".$rs -> form_select_open("ne_year")."
-				".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
-				for($count=($current_year-5); $count<=$current_year; $count++){
-					$TOPIC_FIELD .= $rs -> form_option($count, ($ne_year == $count ? "1" : "0"), $count);
-				}
-				$TOPIC_FIELD .= $rs -> form_select_close();
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+			if($checkstartdate){
+				$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_15;
+				$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_73;
+				$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_17;
+				$TOPIC_FIELD = "
+					".$rs -> form_select_open("ne_day")."
+					".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 0, "none");
+					for($count=1; $count<=31; $count++){
+						$TOPIC_FIELD .= $rs -> form_option($count, ($ne_day == $count ? "1" : "0"), $count);
+					}
+					$TOPIC_FIELD .= $rs -> form_select_close()."
+					".$rs -> form_select_open("ne_month")."
+					".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 0, "none");
+					for($count=1; $count<=12; $count++){
+						$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], ($ne_month == $count ? "1" : "0"), $count);
+					}
+					$TOPIC_FIELD .= $rs -> form_select_close()."
+					".$rs -> form_select_open("ne_year")."
+					".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 0, "none");
+					for($count=($current_year-5); $count<=$current_year; $count++){
+						$TOPIC_FIELD .= $rs -> form_option($count, ($ne_year == $count ? "1" : "0"), $count);
+					}
+					$TOPIC_FIELD .= $rs -> form_select_close();
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+			}else{
+				$hidden .= $rs -> form_hidden("ne_day", $ne_day);
+				$hidden .= $rs -> form_hidden("ne_month", $ne_month);
+				$hidden .= $rs -> form_hidden("ne_year", $ne_year);
+			}
 
-			$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_16;
-			$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_74;
-			$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_18;
-			$TOPIC_FIELD = "
-				".$rs -> form_select_open("end_day")."
-				".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 1, "none");
-				for($count=1; $count<=31; $count++){
-					$TOPIC_FIELD .= $rs -> form_option($count, ($end_day == $count ? "1" : "0"), $count);
-				}
-				$TOPIC_FIELD .= $rs -> form_select_close()."
-				".$rs -> form_select_open("end_month")."
-				".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 1, "none");
-				for($count=1; $count<=12; $count++){
-					$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], ($end_month == $count ? "1" : "0"), $count);
-				}
-				$TOPIC_FIELD .= $rs -> form_select_close()."
-				".$rs -> form_select_open("end_year")."
-				".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 1, "none");
-				for($count=($current_year-5); $count<=$current_year; $count++){
-					$TOPIC_FIELD .= $rs -> form_option($count, ($end_year == $count ? "1" : "0"), $count);
-				}
-				$TOPIC_FIELD .= $rs -> form_select_close();
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+			if($checkenddate){
+				$TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_16;
+				$TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_74;
+				$TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_18;
+				$TOPIC_FIELD = "
+					".$rs -> form_select_open("end_day")."
+					".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_12, 1, "none");
+					for($count=1; $count<=31; $count++){
+						$TOPIC_FIELD .= $rs -> form_option($count, ($end_day == $count ? "1" : "0"), $count);
+					}
+					$TOPIC_FIELD .= $rs -> form_select_close()."
+					".$rs -> form_select_open("end_month")."
+					".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_13, 1, "none");
+					for($count=1; $count<=12; $count++){
+						$TOPIC_FIELD .= $rs -> form_option($months[($count-1)], ($end_month == $count ? "1" : "0"), $count);
+					}
+					$TOPIC_FIELD .= $rs -> form_select_close()."
+					".$rs -> form_select_open("end_year")."
+					".$rs -> form_option(CONTENT_ADMIN_DATE_LAN_14, 1, "none");
+					for($count=($current_year-5); $count<=$current_year; $count++){
+						$TOPIC_FIELD .= $rs -> form_option($count, ($end_year == $count ? "1" : "0"), $count);
+					}
+					$TOPIC_FIELD .= $rs -> form_select_close();
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+			}else{
+				$hidden .= $rs -> form_hidden("end_day", $end_day);
+				$hidden .= $rs -> form_hidden("end_month", $end_month);
+				$hidden .= $rs -> form_hidden("end_year", $end_year);
+			}
 
 			$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
 			$iconlist = $fl->get_files($content_cat_icon_path_large,"",$rejectlist);
 
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_63;
-			$TOPIC_HEADING = CONTENT_ADMIN_CAT_LAN_61;
-			$TOPIC_HELP = "";
-			$TOPIC_FIELD = "";
-				if(!FILE_UPLOADS){
-					$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_21."</b>";
-				}else{
-					if(!is_writable($content_cat_icon_path_large)){
-						$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_cat_icon_path_large." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
+			if($checkuploadicon){
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_63;
+				$TOPIC_HEADING = CONTENT_ADMIN_CAT_LAN_61;
+				$TOPIC_HELP = "";
+				$TOPIC_FIELD = "";
+					if(!FILE_UPLOADS){
+						$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_21."</b>";
+					}else{
+						if(!is_writable($content_cat_icon_path_large)){
+							$TOPIC_FIELD .= "<b>".CONTENT_ADMIN_ITEM_LAN_22." ".$content_cat_icon_path_large." ".CONTENT_ADMIN_ITEM_LAN_23."</b><br />";
+						}
+						$TOPIC_FIELD .= CONTENT_ADMIN_CAT_LAN_62."
+						<input class='tbox' type='file' name='file_userfile[]'  size='58' /> 
+						<input type='hidden' name='iconpathlarge' value='".$content_cat_icon_path_large."' />
+						<input type='hidden' name='iconpathsmall' value='".$content_cat_icon_path_small."' />
+						<input class='button' type='submit' name='uploadcaticon' value='".CONTENT_ADMIN_CAT_LAN_63."' />";
 					}
-					$TOPIC_FIELD .= CONTENT_ADMIN_CAT_LAN_62."
-					<input class='tbox' type='file' name='file_userfile[]'  size='58' /> 
-					<input type='hidden' name='iconpathlarge' value='".$content_cat_icon_path_large."' />
-					<input type='hidden' name='iconpathsmall' value='".$content_cat_icon_path_small."' />
-					<input class='button' type='submit' name='uploadcaticon' value='".CONTENT_ADMIN_CAT_LAN_63."' />";
-				}
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+			}
 
-			$row['content_icon'] = (isset($row['content_icon']) ? $row['content_icon'] : "");
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_5;
-			$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'>";
-				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> ";
-				}
-				$TOPIC_FIELD .= "</div>";
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			if($checkselecticon){
+				$row['content_icon'] = (isset($row['content_icon']) ? $row['content_icon'] : "");
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_5;
+				$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'>";
+					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> ";
+					}
+					$TOPIC_FIELD .= "</div>";
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			}else{
+				$hidden .= $rs -> form_hidden("cat_icon", $row['content_icon']);
+			}
 
-			$row['content_comment'] = (isset($row['content_comment']) ? $row['content_comment'] : "");
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_14;
-			$TOPIC_FIELD = "
-			".$rs -> form_radio("cat_comment", "1", ($row['content_comment'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85."
-			".$rs -> form_radio("cat_comment", "0", ($row['content_comment'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			if($checkcomment){
+				$row['content_comment'] = (isset($row['content_comment']) ? $row['content_comment'] : "");
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_14;
+				$TOPIC_FIELD = "
+				".$rs -> form_radio("cat_comment", "1", ($row['content_comment'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85."
+				".$rs -> form_radio("cat_comment", "0", ($row['content_comment'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			}else{
+				$hidden .= $rs -> form_hidden("cat_comment", $row['content_comment']);
+			}
 
-			$row['content_rate'] = (isset($row['content_rate']) ? $row['content_rate'] : "");
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_15;
-			$TOPIC_FIELD = "
-			".$rs -> form_radio("cat_rate", "1", ($row['content_rate'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85."
-			".$rs -> form_radio("cat_rate", "0", ($row['content_rate'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			if($checkrating){
+				$row['content_rate'] = (isset($row['content_rate']) ? $row['content_rate'] : "");
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_15;
+				$TOPIC_FIELD = "
+				".$rs -> form_radio("cat_rate", "1", ($row['content_rate'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85."
+				".$rs -> form_radio("cat_rate", "0", ($row['content_rate'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			}else{
+				$hidden .= $rs -> form_hidden("cat_rate", $row['content_rate']);
+			}
 
-			$row['content_pe'] = (isset($row['content_pe']) ? $row['content_pe'] : "");
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_16;
-			$TOPIC_FIELD = "
-			".$rs -> form_radio("cat_pe", "1", ($row['content_pe'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85."
-			".$rs -> form_radio("cat_pe", "0", ($row['content_pe'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			if($checkpe){
+				$row['content_pe'] = (isset($row['content_pe']) ? $row['content_pe'] : "");
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_16;
+				$TOPIC_FIELD = "
+				".$rs -> form_radio("cat_pe", "1", ($row['content_pe'] ? "1" : "0"), "", "").CONTENT_ADMIN_ITEM_LAN_85."
+				".$rs -> form_radio("cat_pe", "0", ($row['content_pe'] ? "0" : "1"), "", "").CONTENT_ADMIN_ITEM_LAN_86;
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			}else{
+				$hidden .= $rs -> form_hidden("cat_pe", $row['content_pe']);
+			}
 
-			$row['content_class'] = (isset($row['content_class']) ? $row['content_class'] : "");
-			$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_17;
-			$TOPIC_FIELD = r_userclass("cat_class",$row['content_class'], "CLASSES");
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			if($checkvisibility){
+				$row['content_class'] = (isset($row['content_class']) ? $row['content_class'] : "");
+				$TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_17;
+				$TOPIC_FIELD = r_userclass("cat_class",$row['content_class'], "CLASSES");
+				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			}else{
+				$hidden .= $rs -> form_hidden("cat_class", $row['content_class']);
+			}
 
 			$text .= $TOPIC_ROW_SPACER;
 			$text .= "
 			<tr>
-				<td class='forumheader' style='text-align:center' colspan='2'>";
+				<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);
@@ -1699,11 +1968,15 @@
 
 		function show_contentmanager($mode, $userid="", $username=""){
 			global $content_shortcodes, $row, $tp, $sql, $ns, $rs, $plugintable, $plugindir, $aa, $eArrayStorage;
-			global $CONTENT_CONTENTMANAGER_CATEGORY, $CONTENT_CONTENTMANAGER_TABLE, $CONTENT_CONTENTMANAGER_TABLE_START, $CONTENT_CONTENTMANAGER_TABLE_END;
+			global $CONTENT_CONTENTMANAGER_CATEGORY, $CONTENT_CONTENTMANAGER_TABLE, $CONTENT_CONTENTMANAGER_TABLE_START, $CONTENT_CONTENTMANAGER_TABLE_END, $content_pref, $pref;
 			$personalmanagercheck = FALSE;
 
-			if(!$CONTENT_CONTENTMANAGER_TABLE){
-				require_once($plugindir."templates/content_manager_template.php");
+			if(!isset($CONTENT_CONTENTMANAGER_TABLE)){
+				if(is_readable(e_THEME.$pref['sitetheme']."/content/content_manager_template.php")){
+					require_once(e_THEME.$pref['sitetheme']."/content/content_manager_template.php");
+				}else{
+					require_once(e_PLUGIN."content/templates/content_manager_template.php");
+				}
 			}
 			$array		= $aa -> getCategoryTree("", "", TRUE);
 			$catarray	= array_keys($array);
@@ -1712,13 +1985,7 @@
 				if($sql -> db_Select($plugintable, "content_id, content_heading, content_pref", " content_id='".intval($catid)."' ")){
 					$row = $sql -> db_Fetch();
 					$content_pref = $eArrayStorage->ReadArray($row['content_pref']);
-
-					if(isset($content_pref["content_manager_allowed_{$row['content_id']}"])){
-						$pcm = explode(",", $content_pref["content_manager_allowed_{$row['content_id']}"]);
-					}else{
-						$pcm = array();
-					}
-					if(in_array($userid, $pcm) || getperms("0")){
+					if( (isset($content_pref["content_manager_approve"]) && check_class($content_pref["content_manager_approve"])) || (isset($content_pref["content_manager_personal"]) && check_class($content_pref["content_manager_personal"])) || (isset($content_pref["content_manager_category"]) && check_class($content_pref["content_manager_category"])) ){
 						$personalmanagercheck = TRUE;
 						$content_contentmanager_table_string .= $tp -> parseTemplate($CONTENT_CONTENTMANAGER_TABLE, FALSE, $content_shortcodes);
 					}
@@ -1742,6 +2009,9 @@
 			$catarray	= $aa -> getCategoryTree("", "", FALSE);
 			$array		= array_keys($catarray);
 
+			//number of main parents
+			$mp = $sql -> db_Count($plugintable, "(*)", "WHERE content_parent='0' AND content_refer != 'sa' ");
+
 			if(!is_array($array)){
 				$text = "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
 			}else{
@@ -1767,8 +2037,8 @@
 						$row = $sql -> db_Fetch();
 
 						$content_pref					= $aa -> getContentPref($catarray[$catid][0]);
-						$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$catarray[$catid][0]}"]);
-						$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$catarray[$catid][0]}"]);
+						$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"]);
 						$authordetails					= $aa -> getAuthor($row['content_author']);
 						$caticon						= $content_cat_icon_path_large.$row['content_icon'];
 
@@ -1782,9 +2052,13 @@
 							}
 						}
 
+						//count subcategories for a main parent
 						if($row['content_parent'] == 0){
-							$subs		= $aa -> getCategoryTree("", $row['content_id'], FALSE);
-							$ordermax	= count($subs);
+							$ordermax	= $mp;
+						}else{
+							$mainparent	= $aa -> getMainParent($row['content_id']);
+							$subs		= $aa -> getCategoryTree("", $mainparent, FALSE);
+							$ordermax	= count($subs)-1;
 						}
 
 						//count items in category
@@ -1802,7 +2076,7 @@
 						}
 						$amount = "(".($n == 1 ? $n." ".CONTENT_ADMIN_CAT_LAN_56 : $n." ".CONTENT_ADMIN_CAT_LAN_57).")";
 						
-						if($ordermax > 1){
+						//if($ordermax > 1){
 							//up arrow
 							if($row['content_order'] != 1 && $row['content_order'] != 0){
 								$up = "<a href='".e_SELF."?order.inc.".$catid."-".$row['content_order']."'>".CONTENT_ICON_ORDER_UP."</a> ";
@@ -1816,15 +2090,16 @@
 								$down = "&nbsp;&nbsp;&nbsp;";
 							}
 							//select box
-							if($ordermax > 1){
+							//if($ordermax > 1){
+
 								$selectorder = "
 								<select name='order[]' class='tbox'>";
 								for($k=1;$k<=$ordermax;$k++){
 									$selectorder .= $rs -> form_option($k, ($row['content_order'] == $k ? "1" : "0"), $catid.".".$k.".cat");
 								}
 								$selectorder .= "</select>";
-							}
-						}
+							//}
+						//}
 						$row['content_heading']		= $tp->toHTML($row['content_heading'], TRUE, "");
 						$row['content_subheading']	= $tp->toHTML($row['content_subheading'], TRUE, "");
 
@@ -1834,7 +2109,7 @@
 							<td class='".$class."' style='width:5%; text-align:left'>".$catid."</td>
 							<td class='".$class."' style='width:5%; text-align:center'>".($row['content_icon'] ? "<img src='".$caticon."' alt='' style='vertical-align:middle' />" : "&nbsp;")."</td>
 							<td class='".$class."' style='width:15%'>".($authordetails[0] != "0" ? "<a href='".e_BASE."user.php?id.".$authordetails[0]."'>".CONTENT_ICON_USER."</a>" : "")." ".$authordetails[1]."</td>
-							<td class='".$class."' style='width:50%; white-space:nowrap;'>
+							<td class='".$class."' style='width:50%;'>
 								<a href='".$plugindir."content.php?cat.".$row['content_id']."'>".CONTENT_ICON_LINK."</a> 
 								".$pre.$row['content_heading']." ".($row['content_subheading'] ? "[".$row['content_subheading']."]" : "")." ".$amount."
 							</td>
@@ -1885,8 +2160,8 @@
 				$formtarget		= e_SELF."?order.".$qs[1];
 				$order			= "SUBSTRING_INDEX(content_order, '.', -1)+0";
 			}
-			$content_pref		= $aa -> getContentPref($qs[1]);
-			$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path_{$qs[1]}"]);
+			$content_pref		= $aa -> getContentPref(intval($qs[1]));
+			$content_icon_path	= $tp -> replaceConstants($content_pref["content_icon_path"]);
 
 			$sqlo = new db;
 			if(!$content_total = $sqlo -> db_Select($plugintable, "content_id, content_heading, content_author, content_parent, content_order", "content_refer != 'sa' AND ".$qry." ORDER BY ".$order." ASC, content_heading DESC ")){
@@ -1981,154 +2256,50 @@
 			return;
 		}
 
-
-
-		function show_admin_contentmanager_category(){
-			global $plugintable, $qs, $sql, $ns, $rs, $aa, $eArrayStorage;
-
-			if(!getperms("0")){ js_location(e_SELF); }
-			if(!is_numeric($qs[1])){ js_location(e_SELF); }
-
-			if(!is_object($sql)){ $sql = new db; }
-			if(!$sql -> db_Select($plugintable, "content_id, content_heading, content_pref", "content_id='".intval($qs[1])."' ")){
-				js_location(e_SELF."?manager");
-			}else{
-				$row = $sql -> db_Fetch();
-				$caption = CONTENT_ADMIN_CAT_LAN_30." : ".$row['content_heading'];
-			}
-			
-			//get current preferences
-			$mainparent			= $aa -> getMainParent( intval($qs[1]) );						
-			if($qs[1] == $mainparent){
-				$content_pref	= $aa -> getContentPref($mainparent);
-			}else{							
-				$content_pref	= $eArrayStorage->ReadArray($row['content_pref']);
-			}
-			$qs[1] = intval($qs[1]);
-			if(isset($content_pref["content_manager_allowed_{$qs[1]}"]) && $content_pref["content_manager_allowed_{$qs[1]}"]){
-				$pcm				= explode(",", $content_pref["content_manager_allowed_{$qs[1]}"]);
-			}else{
-				$pcm = array();
-			}
-
-			$classtocheck = $content_pref["content_manager_class_{$mainparent}"];
-			if($classtocheck==e_UC_PUBLIC || !$content_pref["content_manager_class_{$mainparent}"]){
-				$classqry = '';
-			}else{
-				$classqry = " AND (user_class = '{$classtocheck}' OR user_class REGEXP('^{$classtocheck},') OR user_class REGEXP(',{$classtocheck},') OR user_class REGEXP(',{$classtocheck}$'))";
-			}
-			$sql2 = new db;
-			$c = 0;
-			$d = 0;
-			$sql2->db_Select("user", "user_id, user_name, user_class, user_login", " user_perms != '0' ".$classqry." ORDER BY user_name");
-			while ($row2 = $sql2->db_Fetch()) {
-				if(in_array($row2['user_id'], $pcm)){
-					$in_userid[$c]		= $row2['user_id'];
-					$in_username[$c]	= $row2['user_name'];
-					$in_userlogin[$c]	= $row2['user_login'] ? "(".$row2['user_login'].")" : "";
-					$c++;
-				} else {
-					$out_userid[$d]		= $row2['user_id'];
-					$out_username[$d]	= $row2['user_name'];
-					$out_userlogin[$d]	= $row2['user_login'] ? "(".$row2['user_login'].")" : "";
-					$d++;
-				}
-			}
-			
-			$optionout = "";
-			for ($a = 0; $a <= ($d-1); $a++) {
-				$optionout .= "<option value=".$out_userid[$a].">".$out_username[$a]." ".$out_userlogin[$a]."</option>";
-			}
-			$optionin = "";
-			$class_id = "";
-			for($a = 0; $a <= ($c-1); $a++) {
-				$optionin .= "<option value=".$in_userid[$a].">".$in_username[$a]." ".$in_userlogin[$a]."</option>";
-				$class_id .= $in_userid[$a].".";
-			}
-			
-			$text = "
-			<div style='text-align:center'>
-			".$rs -> form_open("post", e_SELF."?".e_QUERY, "managerform", "", "enctype='multipart/form-data'")."
-			<table class='fborder' style='".ADMIN_WIDTH."'>
-			<tr><td class='forumheader' style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_28."</td></tr>
-			<tr><td class='forumheader3' style='text-align:center'>
-				<table style='width:98%;'>
-				<tr>
-				<td style='width:50%; vertical-align:top'>".CONTENT_ADMIN_CAT_LAN_29."<br />
-				<select class='tbox' id='assignclass1' name='assignclass1' size='10' style='width:220px' multiple='multiple' onchange='moveOver();'>
-				".$optionout."				 
-				</select>
-				</td>
-				<td style='width:50%; vertical-align:top'>".CONTENT_ADMIN_CAT_LAN_30."<br />
-				<select class='tbox' id='assignclass2' name='assignclass2' size='10' style='width:220px' multiple='multiple'>
-				".$optionin."
-				</select><br /><br />
-				<input class='button' type='button' value='".CONTENT_ADMIN_CAT_LAN_31."' onclick='removeMe();' />
-				<input class='button' type='button' value='".CONTENT_ADMIN_CAT_LAN_32."' onclick='clearMe($qs[1]);' />
-				<input type='hidden' name='class_id' value='".$class_id."' />
-				</td>
-				</tr>
-				</table>
-			</td></tr>
-			<tr><td style='text-align:center' class='forumheader'>						
-			".$rs -> form_button("button", "assign_admins", CONTENT_ADMIN_CAT_LAN_33, "onclick='saveMe($qs[1]);'")."
-			".$rs -> form_hidden("cat_id", $qs[1])."
-			</td>
-			</tr>
-			</table>
-			".$rs -> form_close()."
-			</div>";
-
-			$ns -> tablerender($caption, $text);
-		}
-
-
-
 		function show_options(){
 			global $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $stylespacer;
 
 			$lan_file = $plugindir."languages/".e_LANGUAGE."/lan_content_options.php";
 			include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English/lan_content_options.php");
 
-			$sqlo = new db;
-			if(!$category_total = $sqlo -> db_Select($plugintable, "*", "content_parent='0' ")){
-				$text = "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
-			}else{
-
-				$text = "
-				<div style='text-align:center'>
-				".$rs -> form_open("post", e_SELF."?options", "optionsform","","", "")."
-				<table style='".ADMIN_WIDTH."' class='fborder'>
-				<tr>
-				<td class='fcaption' style='width:5%'>".CONTENT_ADMIN_CAT_LAN_24."</td>
-				<td class='fcaption' style='width:5%'>".CONTENT_ADMIN_CAT_LAN_25."</td>
-				<td class='fcaption' style='width:15%'>".CONTENT_ADMIN_CAT_LAN_18."</td>
-				<td class='fcaption' style='width:65%'>".CONTENT_ADMIN_CAT_LAN_19."</td>
-				<td class='fcaption' style='width:10%; text-align:center'>".CONTENT_ADMIN_CAT_LAN_20."</td>
-				</tr>";
+			$text = "
+			<div style='text-align:center'>
+			".$rs -> form_open("post", e_SELF."?option", "optionsform","","", "")."
+			<table style='".ADMIN_WIDTH."' class='fborder'>
+			<tr>
+			<td class='fcaption' style='width:5%'>".CONTENT_ADMIN_CAT_LAN_24."</td>
+			<td class='fcaption' style='width:5%'>".CONTENT_ADMIN_CAT_LAN_25."</td>
+			<td class='fcaption' style='width:15%'>".CONTENT_ADMIN_CAT_LAN_18."</td>
+			<td class='fcaption' style='width:65%'>".CONTENT_ADMIN_CAT_LAN_19."</td>
+			<td class='fcaption' style='width:10%; text-align:center'>".CONTENT_ADMIN_CAT_LAN_20."</td>
+			<td class='fcaption' style='width:10%'>".CONTENT_ADMIN_OPT_LAN_167."</td>
+			</tr>";
 
-				$content_pref					= $aa -> getContentPref(0);
-				$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_0"]);
-				$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_0"]);
-				
-				$text .= "
-				<tr><td colspan='5' $stylespacer></td></tr>
-				<tr>
-					<td class='forumheader3' style='width:5%; text-align:left'></td>
-					<td class='forumheader3' style='width:5%; text-align:center'></td>
-					<td class='forumheader3' style='width:15%'></td>
-					<td class='forumheader3' style='width:65%; white-space:nowrap;'>".CONTENT_ADMIN_OPT_LAN_1."</td>
-					<td class='forumheader3' style='width:10%; text-align:center; white-space:nowrap;'>
-						<a href='".e_SELF."?option.default'>".CONTENT_ICON_OPTIONS."</a>
-					</td>
-				</tr>
-				<tr><td colspan='5' $stylespacer></td></tr>";
+			$content_pref					= $aa -> getContentPref(0);
+			$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"]);
+			
+			$text .= "
+			<tr><td colspan='5' $stylespacer></td></tr>
+			<tr>
+				<td class='forumheader3' style='width:5%; text-align:left'></td>
+				<td class='forumheader3' style='width:5%; text-align:center'></td>
+				<td class='forumheader3' style='width:15%'></td>
+				<td class='forumheader3' style='width:65%; white-space:nowrap;'>".CONTENT_ADMIN_OPT_LAN_1."</td>
+				<td class='forumheader3' style='width:10%; text-align:center; white-space:nowrap;'>
+					<a href='".e_SELF."?option.default'>".CONTENT_ICON_OPTIONS."</a>
+				</td>
+				<td class='forumheader3' style='width:10%'></td>
+			</tr>
+			<tr><td colspan='6' $stylespacer></td></tr>";
 
+			$sqlo = new db;
+			if($category_total = $sqlo -> db_Select($plugintable, "*", "content_parent='0' ")){
 				while($row = $sqlo -> db_Fetch()){
 
 					$content_pref					= $aa -> getContentPref($row['content_id']);
-					$content_cat_icon_path_large	= $tp -> replaceConstants($content_pref["content_cat_icon_path_large_{$row['content_id']}"]);
-					$content_cat_icon_path_small	= $tp -> replaceConstants($content_pref["content_cat_icon_path_small_{$row['content_id']}"]);
+					$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"]);
 					$authordetails					= $aa -> getAuthor($row['content_author']);
 					$caticon						= $content_cat_icon_path_large.$row['content_icon'];
 
@@ -2137,20 +2308,33 @@
 						<td class='forumheader3' style='width:5%; text-align:left'>".$row['content_id']."</td>
 						<td class='forumheader3' style='width:5%; text-align:center'>".($row['content_icon'] ? "<img src='".$caticon."' alt='' style='vertical-align:middle' />" : "&nbsp;")."</td>
 						<td class='forumheader3' style='width:15%'>".($authordetails[0] != "0" ? "<a href='".e_BASE."user.php?id.".$authordetails[0]."'>".CONTENT_ICON_USER."</a>" : "")." ".$authordetails[1]."</td>
-						<td class='forumheader3' style='width:65%; white-space:nowrap;'>
+						<td class='forumheader3' style='width:65%;'>
 							<a href='".$plugindir."content.php?cat.".$row['content_id']."'>".CONTENT_ICON_LINK."</a> 
 							".$row['content_heading']." ".($row['content_subheading'] ? "[".$row['content_subheading']."]" : "")."
 						</td>
 						<td class='forumheader3' style='width:10%; text-align:center; white-space:nowrap;'>
 							<a href='".e_SELF."?option.".$row['content_id']."'>".CONTENT_ICON_OPTIONS."</a>
 						</td>
+						<td class='forumheader3' style='width:10%; text-align:center; white-space:nowrap;'>
+							<input type='checkbox' value='1' name='content_inherit[".$row['content_id']."]' ".(isset($content_pref['content_inherit']) && $content_pref['content_inherit']=='1' ? "checked='checked'" : "")." />
+							<input type='hidden' name='id[".$row['content_id']."]' value='1' />
+						</td>
 					</tr>";
+					//".$rs -> form_checkbox("content_inherit[".$row['content_id']."]", 1, (isset($content_pref['content_inherit']) ? "1" : "0"))."
 				}
-				$text .= "
-				</table>
-				".$rs -> form_close()."
-				</div>";
 			}
+
+			$text .= "
+			<tr>
+				<td class='forumheader3' colspan='5'></td>
+				<td class='forumheader3'>
+					<input class='button' type='submit' name='updateinherit' value='".CONTENT_ADMIN_CAT_LAN_7."' />
+				</td>
+			</tr>
+			</table>
+			".$rs -> form_close()."
+			</div>";
+
 			$ns -> tablerender(CONTENT_ADMIN_MENU_LAN_6, $text);
 		}
 
@@ -2194,7 +2378,7 @@
 
 			$TOPIC_ROW = "
 			<tr>
-				<td class='forumheader3' style='width:20%; white-space:nowrap; vertical-align:top;'>{TOPIC_TOPIC}</td>
+				<td class='forumheader3' style='width:20%; vertical-align:top;'>{TOPIC_TOPIC}</td>
 				<td class='forumheader3' style='vertical-align:top;'>
 					<a style='cursor: pointer;' onclick='expandit(this);'>{TOPIC_HEADING}</a>
 					<div style='display: none;'>
@@ -2239,19 +2423,23 @@
 			//content_admin_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_admin_icon_{$id}", 1, (isset($content_pref["content_admin_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_admin_attach_{$id}", 1, (isset($content_pref["content_admin_attach_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."<br />
-			".$rs -> form_checkbox("content_admin_images_{$id}", 1, (isset($content_pref["content_admin_images_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."<br />
-			".$rs -> form_checkbox("content_admin_comment_{$id}", 1, (isset($content_pref["content_admin_comment_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
-			".$rs -> form_checkbox("content_admin_rating_{$id}", 1, (isset($content_pref["content_admin_rating_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
-			".$rs -> form_checkbox("content_admin_score_{$id}", 1, (isset($content_pref["content_admin_score_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_6."<br />
-			</td><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_admin_pe_{$id}", 1, (isset($content_pref["content_admin_pe_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
-			".$rs -> form_checkbox("content_admin_visibility_{$id}", 1, (isset($content_pref["content_admin_visibility_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."<br />
-			".$rs -> form_checkbox("content_admin_meta_{$id}", 1, (isset($content_pref["content_admin_meta_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_8."<br />
-			".$rs -> form_checkbox("content_admin_layout_{$id}", 1, (isset($content_pref["content_admin_layout_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_9."<br />
-			".$rs -> form_checkbox("content_admin_customtags_{$id}", 1, (isset($content_pref["content_admin_customtags_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."<br />
-			".$rs -> form_checkbox("content_admin_presettags_{$id}", 1, (isset($content_pref["content_admin_presettags_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."<br />
+			".$rs -> form_checkbox("content_admin_subheading", 1, (isset($content_pref['content_admin_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_32."<br />
+			".$rs -> form_checkbox("content_admin_summary", 1, (isset($content_pref['content_admin_summary']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_38."<br />	
+			".$rs -> form_checkbox("content_admin_startdate", 1, (isset($content_pref['content_admin_startdate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_33."<br />				
+			".$rs -> form_checkbox("content_admin_enddate", 1, (isset($content_pref['content_admin_enddate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_34."<br />
+			".$rs -> form_checkbox("content_admin_icon", 1, (isset($content_pref['content_admin_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_admin_attach", 1, (isset($content_pref['content_admin_attach']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."<br />
+			".$rs -> form_checkbox("content_admin_images", 1, (isset($content_pref['content_admin_images']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."<br />
+			".$rs -> form_checkbox("content_admin_comment", 1, (isset($content_pref['content_admin_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
+			</td><td style='white-space:nowrap; vertical-align:top;'>
+			".$rs -> form_checkbox("content_admin_rating", 1, (isset($content_pref['content_admin_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_admin_score", 1, (isset($content_pref['content_admin_score']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_6."<br />
+			".$rs -> form_checkbox("content_admin_pe", 1, (isset($content_pref['content_admin_pe']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_admin_visibility", 1, (isset($content_pref['content_admin_visibility']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."<br />
+			".$rs -> form_checkbox("content_admin_meta", 1, (isset($content_pref['content_admin_meta']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_8."<br />
+			".$rs -> form_checkbox("content_admin_layout", 1, (isset($content_pref['content_admin_layout']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_9."<br />
+			".$rs -> form_checkbox("content_admin_customtags", 1, (isset($content_pref['content_admin_customtags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."<br />
+			".$rs -> form_checkbox("content_admin_presettags", 1, (isset($content_pref['content_admin_presettags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."<br />
 			</td></tr></table>
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2259,11 +2447,11 @@
 			//content_admin_images_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_3;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_admin_images_number_{$id}");
-			$content_pref["content_admin_images_number_{$id}"] = ($content_pref["content_admin_images_number_{$id}"] ? $content_pref["content_admin_images_number_{$id}"] : "10");
+			".$rs -> form_select_open("content_admin_images_number");
+			$content_pref['content_admin_images_number'] = ($content_pref['content_admin_images_number'] ? $content_pref['content_admin_images_number'] : "10");
 			for($i=1;$i<16;$i++){
 				$k=$i*2;
-				$TOPIC_FIELD .= $rs -> form_option($k, ($content_pref["content_admin_images_number_{$id}"] == $k ? "1" : "0"), $k);
+				$TOPIC_FIELD .= $rs -> form_option($k, ($content_pref['content_admin_images_number'] == $k ? "1" : "0"), $k);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2271,10 +2459,10 @@
 			//content_admin_files_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_4;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_admin_files_number_{$id}");
-			$content_pref["content_admin_files_number_{$id}"] = ($content_pref["content_admin_files_number_{$id}"] ? $content_pref["content_admin_files_number_{$id}"] : "1");
+			".$rs -> form_select_open("content_admin_files_number");
+			$content_pref['content_admin_files_number'] = ($content_pref['content_admin_files_number'] ? $content_pref['content_admin_files_number'] : "1");
 			for($i=1;$i<6;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_admin_files_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_admin_files_number'] == $i ? "1" : "0"), $i);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2282,9 +2470,9 @@
 			//content_admin_custom_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_5;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_admin_custom_number_{$id}");
+			".$rs -> form_select_open("content_admin_custom_number");
 			for($i=0;$i<11;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_admin_custom_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_admin_custom_number'] == $i ? "1" : "0"), $i);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2297,11 +2485,11 @@
 			$existing = 0;
 			$TOPIC_FIELD = "
 			<div id='div_content_custom_preset' style='width:80%;'>";						
-			for($i=0;$i<count($content_pref["content_custom_preset_key"]);$i++){
-				if(!empty($content_pref["content_custom_preset_key"][$i])){
+			for($i=0;$i<count($content_pref['content_custom_preset_key']);$i++){
+				if(!empty($content_pref['content_custom_preset_key'][$i])){
 					$TOPIC_FIELD .= "
 					<span style='white-space:nowrap;'>
-					".$rs -> form_text("content_custom_preset_key[$existing]", 50, $content_pref["content_custom_preset_key"][$existing], 100)."
+					".$rs -> form_text("content_custom_preset_key[$existing]", 50, $content_pref['content_custom_preset_key'][$existing], 100)."
 					".$rs -> form_button("button", "x", "x", "onclick=\"document.getElementById('content_custom_preset_key[$existing]').value='';\"", "", "")."	
 					</span>";
 					$existing++;
@@ -2330,6 +2518,33 @@
 
 			$text .= $TOPIC_TABLE_END;
 
+
+			$text .= "
+			<div id='catcreation' style='display:none; text-align:center'>
+			<table style='".ADMIN_WIDTH."' class='fborder'>";						
+			
+			$TOPIC_CAPTION = CONTENT_ADMIN_OPT_LAN_MENU_21;
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
+
+			//content_admin_sections_category
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
+			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
+			".$rs -> form_checkbox("content_admincat_subheading", 1, (isset($content_pref['content_admincat_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_32."<br />	
+			".$rs -> form_checkbox("content_admincat_startdate", 1, (isset($content_pref['content_admincat_startdate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_33."<br />				
+			".$rs -> form_checkbox("content_admincat_enddate", 1, (isset($content_pref['content_admincat_enddate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_34."<br />
+			".$rs -> form_checkbox("content_admincat_uploadicon", 1, (isset($content_pref['content_admincat_uploadicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_35."<br />
+			".$rs -> form_checkbox("content_admincat_selecticon", 1, (isset($content_pref['content_admincat_selecticon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_36."<br />
+			</td><td style='white-space:nowrap; vertical-align:top;'>
+			".$rs -> form_checkbox("content_admincat_comment", 1, (isset($content_pref['content_admincat_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
+			".$rs -> form_checkbox("content_admincat_rating", 1, (isset($content_pref['content_admincat_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_admincat_pe", 1, (isset($content_pref['content_admincat_pe']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_admincat_visibility", 1, (isset($content_pref['content_admincat_visibility']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."<br />
+			</td></tr></table>
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			$text .= $TOPIC_TABLE_END;
+
 			$text .= "
 			<div id='submission' style='display:none; text-align:center'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>";
@@ -2340,40 +2555,44 @@
 			//content_submit_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_9;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_submit_{$id}", "1", ($content_pref["content_submit_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_submit_{$id}", "0", ($content_pref["content_submit_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_submit", "1", ($content_pref['content_submit'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_submit", "0", ($content_pref['content_submit'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_submit_class_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_10;
-			$TOPIC_FIELD = r_userclass("content_submit_class_{$id}", $content_pref["content_submit_class_{$id}"], "CLASSES");
+			$TOPIC_FIELD = r_userclass("content_submit_class", $content_pref['content_submit_class'], "CLASSES");
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_submit_directpost_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_11;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_submit_directpost_{$id}", "1", ($content_pref["content_submit_directpost_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_submit_directpost_{$id}", "0", ($content_pref["content_submit_directpost_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_submit_directpost", "1", ($content_pref['content_submit_directpost'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_submit_directpost", "0", ($content_pref['content_submit_directpost'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_submit_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_submit_icon_{$id}", 1, (isset($content_pref["content_submit_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_submit_attach_{$id}", 1, (isset($content_pref["content_submit_attach_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."<br />
-			".$rs -> form_checkbox("content_submit_images_{$id}", 1, (isset($content_pref["content_submit_images_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."<br />
-			".$rs -> form_checkbox("content_submit_comment_{$id}", 1, (isset($content_pref["content_submit_comment_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
-			".$rs -> form_checkbox("content_submit_rating_{$id}", 1, (isset($content_pref["content_submit_rating_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
-			".$rs -> form_checkbox("content_submit_score_{$id}", 1, (isset($content_pref["content_submit_score_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_6."<br />
-			</td><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_submit_pe_{$id}", 1, (isset($content_pref["content_submit_pe_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
-			".$rs -> form_checkbox("content_submit_visibility_{$id}", 1, (isset($content_pref["content_submit_visibility_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."<br />
-			".$rs -> form_checkbox("content_submit_meta_{$id}", 1, (isset($content_pref["content_submit_meta_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_8."<br />
-			".$rs -> form_checkbox("content_submit_layout_{$id}", 1, (isset($content_pref["content_submit_layout_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_9."<br />
-			".$rs -> form_checkbox("content_submit_customtags_{$id}", 1, (isset($content_pref["content_submit_customtags_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."<br />
-			".$rs -> form_checkbox("content_submit_presettags_{$id}", 1, (isset($content_pref["content_submit_presettags_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."<br />
+			".$rs -> form_checkbox("content_submit_subheading", 1, (isset($content_pref['content_submit_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_32."<br />
+			".$rs -> form_checkbox("content_submit_summary", 1, (isset($content_pref['content_submit_summary']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_38."<br />	
+			".$rs -> form_checkbox("content_submit_startdate", 1, (isset($content_pref['content_submit_startdate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_33."<br />				
+			".$rs -> form_checkbox("content_submit_enddate", 1, (isset($content_pref['content_submit_enddate']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_34."<br />
+			".$rs -> form_checkbox("content_submit_icon", 1, (isset($content_pref['content_submit_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_submit_attach", 1, (isset($content_pref['content_submit_attach']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."<br />
+			".$rs -> form_checkbox("content_submit_images", 1, (isset($content_pref['content_submit_images']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."<br />
+			".$rs -> form_checkbox("content_submit_comment", 1, (isset($content_pref['content_submit_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
+			</td><td style='white-space:nowrap; vertical-align:top;'>
+			".$rs -> form_checkbox("content_submit_rating", 1, (isset($content_pref['content_submit_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_submit_score", 1, (isset($content_pref['content_submit_score']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_6."<br />
+			".$rs -> form_checkbox("content_submit_pe", 1, (isset($content_pref['content_submit_pe']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_submit_visibility", 1, (isset($content_pref['content_submit_visibility']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_7."<br />
+			".$rs -> form_checkbox("content_submit_meta", 1, (isset($content_pref['content_submit_meta']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_8."<br />
+			".$rs -> form_checkbox("content_submit_layout", 1, (isset($content_pref['content_submit_layout']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_9."<br />
+			".$rs -> form_checkbox("content_submit_customtags", 1, (isset($content_pref['content_submit_customtags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."<br />
+			".$rs -> form_checkbox("content_submit_presettags", 1, (isset($content_pref['content_submit_presettags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."<br />
 			</td></tr></table>
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2381,9 +2600,9 @@
 			//content_submit_custom_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_5;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_submit_custom_number_{$id}");
+			".$rs -> form_select_open("content_submit_custom_number");
 			for($i=0;$i<11;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_submit_custom_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_submit_custom_number'] == $i ? "1" : "0"), $i);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2391,10 +2610,10 @@
 			//content_submit_images_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_3;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_submit_images_number_{$id}");
+			".$rs -> form_select_open("content_submit_images_number");
 			for($i=1;$i<16;$i++){
 				$k=$i*2;
-				$TOPIC_FIELD .= $rs -> form_option($k, ($content_pref["content_submit_images_number_{$id}"] == $k ? "1" : "0"), $k);
+				$TOPIC_FIELD .= $rs -> form_option($k, ($content_pref['content_submit_images_number'] == $k ? "1" : "0"), $k);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2402,9 +2621,9 @@
 			//content_submit_files_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_4;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_submit_files_number_{$id}");
+			".$rs -> form_select_open("content_submit_files_number");
 			for($i=1;$i<6;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_submit_files_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_submit_files_number'] == $i ? "1" : "0"), $i);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2423,48 +2642,48 @@
 
 			//content_cat_icon_path_large_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_15;
-			$TOPIC_FIELD = $rs -> form_text("content_cat_icon_path_large_{$id}", 60, $content_pref["content_cat_icon_path_large_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_cat_icon_path_large", 60, $content_pref['content_cat_icon_path_large'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_icon_path_small_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_16;
-			$TOPIC_FIELD = $rs -> form_text("content_cat_icon_path_small_{$id}", 60, $content_pref["content_cat_icon_path_small_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_cat_icon_path_small", 60, $content_pref['content_cat_icon_path_small'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= "<tr><td style='border:0; height:20px;' colspan='2'></td></tr>";
 			
 			//content_icon_path_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_17;
-			$TOPIC_FIELD = $rs -> form_text("content_icon_path_{$id}", 60, $content_pref["content_icon_path_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_icon_path", 60, $content_pref['content_icon_path'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_icon_path_tmp_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_38." ".CONTENT_ADMIN_OPT_LAN_17;
-			$TOPIC_FIELD = $rs -> form_text("content_icon_path_tmp_{$id}", 60, $content_pref["content_icon_path_tmp_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_icon_path_tmp", 60, $content_pref['content_icon_path_tmp'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= "<tr><td style='border:0; height:20px;' colspan='2'></td></tr>";
 			
 			//content_image_path_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_18;
-			$TOPIC_FIELD = $rs -> form_text("content_image_path_{$id}", 60, $content_pref["content_image_path_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_image_path", 60, $content_pref['content_image_path'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_image_path_tmp_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_38." ".CONTENT_ADMIN_OPT_LAN_18;
-			$TOPIC_FIELD = $rs -> form_text("content_image_path_tmp_{$id}", 60, $content_pref["content_image_path_tmp_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_image_path_tmp", 60, $content_pref['content_image_path_tmp'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= "<tr><td style='border:0; height:20px;' colspan='2'></td></tr>";
 			
 			//content_file_path_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_19;
-			$TOPIC_FIELD = $rs -> form_text("content_file_path_{$id}", 60, $content_pref["content_file_path_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_file_path", 60, $content_pref['content_file_path'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_file_path_tmp_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_38." ".CONTENT_ADMIN_OPT_LAN_19;
-			$TOPIC_FIELD = $rs -> form_text("content_file_path_tmp_{$id}", 60, $content_pref["content_file_path_tmp_{$id}"], 100);
+			$TOPIC_FIELD = $rs -> form_text("content_file_path_tmp", 60, $content_pref['content_file_path_tmp'], 100);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= "<tr><td style='border:0; height:20px;' colspan='2'></td></tr>";
@@ -2473,21 +2692,28 @@
 			$dirlist = $fl->get_dirs($plugindir."templates/");
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_20;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_theme_{$id}");
+			".$rs -> form_select_open("content_theme");
 			$counter = 0;
 			foreach($dirlist as $themedir){
-				$TOPIC_FIELD .= $rs -> form_option($themedir, ($themedir == $content_pref["content_theme_{$id}"] ? "1" : "0"), $themedir);
+				$path = "{e_PLUGIN}content/templates/".$themedir."/";
+				$TOPIC_FIELD .= $rs -> form_option($path, ($path == $content_pref['content_theme'] ? "1" : "0"), $path);
+				$counter++;
+			}
+			global $THEMES_DIRECTORY, $pref;
+			if(is_readable(e_THEME.$pref['sitetheme']."/content/")){
+				$path = "{e_THEME}".$pref['sitetheme']."/content/";
+				$TOPIC_FIELD .= $rs -> form_option($path, ($path == $content_pref['content_theme'] ? "1" : "0"), $path);
 				$counter++;
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_layoutscheme_
-			if(!isset($content_pref["content_theme_{$id}"])){
+			if(!isset($content_pref['content_theme'])){
 				$dir = $plugindir."templates/default";
 			}else{
-				if(file_exists($plugindir."templates/".$content_pref["content_theme_{$id}"]."/content_content_template.php")){
-					$dir = $plugindir."templates/".$content_pref["content_theme_{$id}"];
+				if(is_readable($tp->replaceConstants($content_pref["content_theme"])."content_content_template.php")){
+					$dir = $tp->replaceConstants($content_pref["content_theme"]);
 				}else{
 					$dir = $plugindir."templates/default";
 				}
@@ -2498,12 +2724,12 @@
 
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_21;
 			$TOPIC_FIELD = "
-				".$rs -> form_select_open("content_layout_{$id}")."
+				".$rs -> form_select_open("content_layout")."
 				".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_25, 0, "none");
 				foreach($templatelist as $template){
 					$templatename = substr($template['fname'], 25, -4);
 					$templatename = ($template['fname'] == "content_content_template.php" ? "default" : $templatename);
-					$TOPIC_FIELD .= $rs -> form_option($templatename, ($content_pref["content_layout_{$id}"] == $template['fname'] ? "1" : "0"), $template['fname']);
+					$TOPIC_FIELD .= $rs -> form_option($templatename, ($content_pref['content_layout'] == $template['fname'] ? "1" : "0"), $template['fname']);
 				}
 				$TOPIC_FIELD .= $rs -> form_select_close()."
 			";
@@ -2521,125 +2747,139 @@
 			//content_log_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_22;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_log_{$id}", "1", ($content_pref["content_log_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_log_{$id}", "0", ($content_pref["content_log_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_log", "1", ($content_pref['content_log'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_log", "0", ($content_pref['content_log'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_blank_icon_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_23;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_blank_icon_{$id}", "1", ($content_pref["content_blank_icon_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_blank_icon_{$id}", "0", ($content_pref["content_blank_icon_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_blank_icon", "1", ($content_pref['content_blank_icon'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_blank_icon", "0", ($content_pref['content_blank_icon'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_blank_caticon_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_24;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_blank_caticon_{$id}", "1", ($content_pref["content_blank_caticon_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_blank_caticon_{$id}", "0", ($content_pref["content_blank_caticon_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_blank_caticon", "1", ($content_pref['content_blank_caticon'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_blank_caticon", "0", ($content_pref['content_blank_caticon'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_breadcrumb_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_26;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_breadcrumb_catall_{$id}", 1, ($content_pref["content_breadcrumb_catall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_27."<br />
-			".$rs -> form_checkbox("content_breadcrumb_cat_{$id}", 1, ($content_pref["content_breadcrumb_cat_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
-			".$rs -> form_checkbox("content_breadcrumb_authorall_{$id}", 1, ($content_pref["content_breadcrumb_authorall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
-			".$rs -> form_checkbox("content_breadcrumb_author_{$id}", 1, ($content_pref["content_breadcrumb_author_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
-			".$rs -> form_checkbox("content_breadcrumb_recent_{$id}", 1, ($content_pref["content_breadcrumb_recent_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
+			".$rs -> form_checkbox("content_breadcrumb_catall", 1, ($content_pref['content_breadcrumb_catall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_27."<br />
+			".$rs -> form_checkbox("content_breadcrumb_cat", 1, ($content_pref['content_breadcrumb_cat'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
+			".$rs -> form_checkbox("content_breadcrumb_authorall", 1, ($content_pref['content_breadcrumb_authorall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
+			".$rs -> form_checkbox("content_breadcrumb_author", 1, ($content_pref['content_breadcrumb_author'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
+			".$rs -> form_checkbox("content_breadcrumb_recent", 1, ($content_pref['content_breadcrumb_recent'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
 			</td><td style='white-space:nowrap; vertical-align:top;'>
-			".$rs -> form_checkbox("content_breadcrumb_item_{$id}", 1, ($content_pref["content_breadcrumb_item_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
-			".$rs -> form_checkbox("content_breadcrumb_archive_{$id}", 1, ($content_pref["content_breadcrumb_archive_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />
-			".$rs -> form_checkbox("content_breadcrumb_top_{$id}", 1, ($content_pref["content_breadcrumb_top_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_33."<br />
-			".$rs -> form_checkbox("content_breadcrumb_score_{$id}", 1, ($content_pref["content_breadcrumb_score_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_35."<br />
+			".$rs -> form_checkbox("content_breadcrumb_item", 1, ($content_pref['content_breadcrumb_item'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
+			".$rs -> form_checkbox("content_breadcrumb_archive", 1, ($content_pref['content_breadcrumb_archive'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />
+			".$rs -> form_checkbox("content_breadcrumb_top", 1, ($content_pref['content_breadcrumb_top'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_33."<br />
+			".$rs -> form_checkbox("content_breadcrumb_score", 1, ($content_pref['content_breadcrumb_score'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_35."<br />
 			</td></tr></table>";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_breadcrumb_seperator
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_36;
-			$TOPIC_FIELD = $rs -> form_text("content_breadcrumb_seperator{$id}", 10, $content_pref["content_breadcrumb_seperator{$id}"], 3);
+			$TOPIC_FIELD = $rs -> form_text("content_breadcrumb_seperator", 10, $content_pref['content_breadcrumb_seperator'], 3);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_breadcrumb_base
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_173;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_breadcrumb_base", "1", ($content_pref['content_breadcrumb_base'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_breadcrumb_base", "0", ($content_pref['content_breadcrumb_base'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_breadcrumb_self
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_174;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_breadcrumb_self", "1", ($content_pref['content_breadcrumb_self'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_breadcrumb_self", "0", ($content_pref['content_breadcrumb_self'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_breadcrumb_rendertype_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_37;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_breadcrumb_rendertype_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_39, ($content_pref["content_breadcrumb_rendertype_{$id}"] == "1" ? "1" : "0"), "1")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_40, ($content_pref["content_breadcrumb_rendertype_{$id}"] == "2" ? "1" : "0"), "2")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_41, ($content_pref["content_breadcrumb_rendertype_{$id}"] == "3" ? "1" : "0"), "3")."
+			".$rs -> form_select_open("content_breadcrumb_rendertype")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_39, ($content_pref['content_breadcrumb_rendertype'] == "1" ? "1" : "0"), "1")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_40, ($content_pref['content_breadcrumb_rendertype'] == "2" ? "1" : "0"), "2")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_41, ($content_pref['content_breadcrumb_rendertype'] == "3" ? "1" : "0"), "3")."
 			".$rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_navigator_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_43;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_navigator_catall_{$id}", 1, ($content_pref["content_navigator_catall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_27."<br />
-			".$rs -> form_checkbox("content_navigator_cat_{$id}", 1, ($content_pref["content_navigator_cat_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
-			".$rs -> form_checkbox("content_navigator_authorall_{$id}", 1, ($content_pref["content_navigator_authorall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
-			".$rs -> form_checkbox("content_navigator_author_{$id}", 1, ($content_pref["content_navigator_author_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
-			".$rs -> form_checkbox("content_navigator_recent_{$id}", 1, ($content_pref["content_navigator_recent_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
+			".$rs -> form_checkbox("content_navigator_catall", 1, ($content_pref['content_navigator_catall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_27."<br />
+			".$rs -> form_checkbox("content_navigator_cat", 1, ($content_pref['content_navigator_cat'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
+			".$rs -> form_checkbox("content_navigator_authorall", 1, ($content_pref['content_navigator_authorall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
+			".$rs -> form_checkbox("content_navigator_author", 1, ($content_pref['content_navigator_author'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
+			".$rs -> form_checkbox("content_navigator_recent", 1, ($content_pref['content_navigator_recent'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
 			</td><td style='white-space:nowrap; vertical-align:top;'>
-			".$rs -> form_checkbox("content_navigator_item_{$id}", 1, ($content_pref["content_navigator_item_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
-			".$rs -> form_checkbox("content_navigator_archive_{$id}", 1, ($content_pref["content_navigator_archive_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />
-			".$rs -> form_checkbox("content_navigator_top_{$id}", 1, ($content_pref["content_navigator_top_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_33."<br />
-			".$rs -> form_checkbox("content_navigator_score_{$id}", 1, ($content_pref["content_navigator_score_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_35."<br />
+			".$rs -> form_checkbox("content_navigator_item", 1, ($content_pref['content_navigator_item'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
+			".$rs -> form_checkbox("content_navigator_archive", 1, ($content_pref['content_navigator_archive'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />
+			".$rs -> form_checkbox("content_navigator_top", 1, ($content_pref['content_navigator_top'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_33."<br />
+			".$rs -> form_checkbox("content_navigator_score", 1, ($content_pref['content_navigator_score'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_35."<br />
 			</td></tr></table>";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_search_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_44;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_search_catall_{$id}", 1, ($content_pref["content_search_catall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_27."<br />
-			".$rs -> form_checkbox("content_search_cat_{$id}", 1, ($content_pref["content_search_cat_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
-			".$rs -> form_checkbox("content_search_authorall_{$id}", 1, ($content_pref["content_search_authorall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
-			".$rs -> form_checkbox("content_search_author_{$id}", 1, ($content_pref["content_search_author_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
-			".$rs -> form_checkbox("content_search_recent_{$id}", 1, ($content_pref["content_search_recent_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
+			".$rs -> form_checkbox("content_search_catall", 1, ($content_pref['content_search_catall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_27."<br />
+			".$rs -> form_checkbox("content_search_cat", 1, ($content_pref['content_search_cat'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
+			".$rs -> form_checkbox("content_search_authorall", 1, ($content_pref['content_search_authorall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
+			".$rs -> form_checkbox("content_search_author", 1, ($content_pref['content_search_author'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
+			".$rs -> form_checkbox("content_search_recent", 1, ($content_pref['content_search_recent'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
 			</td><td style='white-space:nowrap; vertical-align:top;'>
-			".$rs -> form_checkbox("content_search_item_{$id}", 1, ($content_pref["content_search_item_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
-			".$rs -> form_checkbox("content_search_archive_{$id}", 1, ($content_pref["content_search_archive_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />
-			".$rs -> form_checkbox("content_search_top_{$id}", 1, ($content_pref["content_search_top_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_33."<br />
-			".$rs -> form_checkbox("content_search_score_{$id}", 1, ($content_pref["content_search_score_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_35."<br />
+			".$rs -> form_checkbox("content_search_item", 1, ($content_pref['content_search_item'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
+			".$rs -> form_checkbox("content_search_archive", 1, ($content_pref['content_search_archive'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />
+			".$rs -> form_checkbox("content_search_top", 1, ($content_pref['content_search_top'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_33."<br />
+			".$rs -> form_checkbox("content_search_score", 1, ($content_pref['content_search_score'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_35."<br />
 			</td></tr></table>";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_ordering_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_46;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_ordering_cat_{$id}", 1, ($content_pref["content_ordering_cat_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
-			".$rs -> form_checkbox("content_ordering_authorall_{$id}", 1, ($content_pref["content_ordering_authorall_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
-			".$rs -> form_checkbox("content_ordering_author_{$id}", 1, ($content_pref["content_ordering_author_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
+			".$rs -> form_checkbox("content_ordering_cat", 1, ($content_pref['content_ordering_cat'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_28."<br />
+			".$rs -> form_checkbox("content_ordering_authorall", 1, ($content_pref['content_ordering_authorall'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_29."<br />
+			".$rs -> form_checkbox("content_ordering_author", 1, ($content_pref['content_ordering_author'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_30."<br />
 			</td><td style='white-space:nowrap; vertical-align:top;'>
-			".$rs -> form_checkbox("content_ordering_recent_{$id}", 1, ($content_pref["content_ordering_recent_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
-			".$rs -> form_checkbox("content_ordering_item_{$id}", 1, ($content_pref["content_ordering_item_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
-			".$rs -> form_checkbox("content_ordering_archive_{$id}", 1, ($content_pref["content_ordering_archive_{$id}"] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />			</td></tr></table>
+			".$rs -> form_checkbox("content_ordering_recent", 1, ($content_pref['content_ordering_recent'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_31."<br />
+			".$rs -> form_checkbox("content_ordering_item", 1, ($content_pref['content_ordering_item'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_32."<br />
+			".$rs -> form_checkbox("content_ordering_archive", 1, ($content_pref['content_ordering_archive'] ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_34."<br />			</td></tr></table>
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_searchmenu_rendertype_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_48;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_searchmenu_rendertype_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_39, ($content_pref["content_searchmenu_rendertype_{$id}"] == "1" ? "1" : "0"), "1")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_40, ($content_pref["content_searchmenu_rendertype_{$id}"] == "2" ? "1" : "0"), "2")."
+			".$rs -> form_select_open("content_searchmenu_rendertype")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_39, ($content_pref['content_searchmenu_rendertype'] == "1" ? "1" : "0"), "1")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_40, ($content_pref['content_searchmenu_rendertype'] == "2" ? "1" : "0"), "2")."
 			".$rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_nextprev_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_49;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_nextprev_{$id}", "1", ($content_pref["content_nextprev_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_nextprev_{$id}", "0", ($content_pref["content_nextprev_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_nextprev", "1", ($content_pref['content_nextprev'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_nextprev", "0", ($content_pref['content_nextprev'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_nextprev_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_50;
-			$TOPIC_FIELD = $rs -> form_select_open("content_nextprev_number_{$id}");
+			$TOPIC_FIELD = $rs -> form_select_open("content_nextprev_number");
 			for($i=1;$i<21;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_nextprev_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_nextprev_number'] == $i ? "1" : "0"), $i);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2647,17 +2887,17 @@
 			//content_defaultorder_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_51;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_defaultorder_{$id}")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_1, ($content_pref["content_defaultorder_{$id}"] == "orderaheading" ? "1" : "0"), "orderaheading")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_2, ($content_pref["content_defaultorder_{$id}"] == "orderdheading" ? "1" : "0"), "orderdheading")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_3, ($content_pref["content_defaultorder_{$id}"] == "orderadate" ? "1" : "0"), "orderadate")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_4, ($content_pref["content_defaultorder_{$id}"] == "orderddate" ? "1" : "0"), "orderddate")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_5, ($content_pref["content_defaultorder_{$id}"] == "orderarefer" ? "1" : "0"), "orderarefer")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_6, ($content_pref["content_defaultorder_{$id}"] == "orderdrefer" ? "1" : "0"), "orderdrefer")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_7, ($content_pref["content_defaultorder_{$id}"] == "orderaparent" ? "1" : "0"), "orderaparent")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_8, ($content_pref["content_defaultorder_{$id}"] == "orderdparent" ? "1" : "0"), "orderdparent")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_9, ($content_pref["content_defaultorder_{$id}"] == "orderaorder" ? "1" : "0"), "orderaorder")."
-			".$rs -> form_option(CONTENT_ORDER_LAN_10, ($content_pref["content_defaultorder_{$id}"] == "orderdorder" ? "1" : "0"), "orderdorder")."
+			".$rs -> form_select_open("content_defaultorder")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_1, ($content_pref['content_defaultorder'] == "orderaheading" ? "1" : "0"), "orderaheading")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_2, ($content_pref['content_defaultorder'] == "orderdheading" ? "1" : "0"), "orderdheading")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_3, ($content_pref['content_defaultorder'] == "orderadate" ? "1" : "0"), "orderadate")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_4, ($content_pref['content_defaultorder'] == "orderddate" ? "1" : "0"), "orderddate")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_5, ($content_pref['content_defaultorder'] == "orderarefer" ? "1" : "0"), "orderarefer")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_6, ($content_pref['content_defaultorder'] == "orderdrefer" ? "1" : "0"), "orderdrefer")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_7, ($content_pref['content_defaultorder'] == "orderaparent" ? "1" : "0"), "orderaparent")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_8, ($content_pref['content_defaultorder'] == "orderdparent" ? "1" : "0"), "orderdparent")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_9, ($content_pref['content_defaultorder'] == "orderaorder" ? "1" : "0"), "orderaorder")."
+			".$rs -> form_option(CONTENT_ORDER_LAN_10, ($content_pref['content_defaultorder'] == "orderdorder" ? "1" : "0"), "orderdorder")."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2666,40 +2906,26 @@
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_52;
 			$TOPIC_HEADING = CONTENT_ADMIN_OPT_LAN_53;
 			$TOPIC_HELP = CONTENT_ADMIN_OPT_LAN_54;
-			$TOPIC_FIELD = $rs -> form_text("content_upload_image_size_{$id}", 10, $content_pref["content_upload_image_size_{$id}"], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
+			$TOPIC_FIELD = $rs -> form_text("content_upload_image_size", 10, $content_pref['content_upload_image_size'], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
 
 			//content_upload_image_size_thumb_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_55;
 			$TOPIC_HEADING = CONTENT_ADMIN_OPT_LAN_56;
 			$TOPIC_HELP = CONTENT_ADMIN_OPT_LAN_57;
-			$TOPIC_FIELD = $rs -> form_text("content_upload_image_size_thumb_{$id}", 10, $content_pref["content_upload_image_size_thumb_{$id}"], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
+			$TOPIC_FIELD = $rs -> form_text("content_upload_image_size_thumb", 10, $content_pref['content_upload_image_size_thumb'], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
 
 			//content_upload_icon_size_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_58;
 			$TOPIC_HEADING = CONTENT_ADMIN_OPT_LAN_59;
 			$TOPIC_HELP = CONTENT_ADMIN_OPT_LAN_60;
-			$TOPIC_FIELD = $rs -> form_text("content_upload_icon_size_{$id}", 10, $content_pref["content_upload_icon_size_{$id}"], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
+			$TOPIC_FIELD = $rs -> form_text("content_upload_icon_size", 10, $content_pref['content_upload_icon_size'], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
 
 			$text .= $TOPIC_TABLE_END;
 
 			$text .= "
-			<div id='contentmanager' style='display:none; text-align:center'>
-			<table style='".ADMIN_WIDTH."' class='fborder'>";
-
-			$TOPIC_CAPTION = CONTENT_ADMIN_OPT_LAN_MENU_7;
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_TITLE_ROW);
-			
-			//content_manager_class_
-			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_62;
-			$TOPIC_FIELD = r_userclass("content_manager_class_{$id}", $content_pref["content_manager_class_{$id}"], 'off', "public,classes").$rs -> form_hidden("content_manager_allowed_{$id}", $content_pref["content_manager_allowed_{$id}"]);
-			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
-
-			$text .= $TOPIC_TABLE_END;
-
-			$text .= "
 			<div id='recentpages' style='display:none; text-align:center'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>";
 
@@ -2709,90 +2935,103 @@
 			//content_list sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_list_icon_{$id}", 1, (isset($content_pref["content_list_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_list_subheading_{$id}", 1, (isset($content_pref["content_list_subheading_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
-			".$rs -> form_checkbox("content_list_summary_{$id}", 1, (isset($content_pref["content_list_summary_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_13."<br />
-			".$rs -> form_checkbox("content_list_text_{$id}", 1, (isset($content_pref["content_list_text_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_14."<br />
-			".$rs -> form_checkbox("content_list_date_{$id}", 1, (isset($content_pref["content_list_date_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
-			".$rs -> form_checkbox("content_list_parent_{$id}", 1, (isset($content_pref["content_list_parent_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_21."<br />
-			".$rs -> form_checkbox("content_list_refer_{$id}", 1, (isset($content_pref["content_list_refer_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_22."<br />
+			".$rs -> form_checkbox("content_list_icon", 1, (isset($content_pref['content_list_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_list_subheading", 1, (isset($content_pref['content_list_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
+			".$rs -> form_checkbox("content_list_summary", 1, (isset($content_pref['content_list_summary']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_13."<br />
+			".$rs -> form_checkbox("content_list_text", 1, (isset($content_pref['content_list_text']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_14."<br />
+			".$rs -> form_checkbox("content_list_date", 1, (isset($content_pref['content_list_date']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
+			".$rs -> form_checkbox("content_list_parent", 1, (isset($content_pref['content_list_parent']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_21."<br />
+			".$rs -> form_checkbox("content_list_refer", 1, (isset($content_pref['content_list_refer']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_22."<br />
 			</td><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_list_authorname_{$id}", 1, (isset($content_pref["content_list_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_list_authoremail_{$id}", 1, (isset($content_pref["content_list_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_list_authorprofile_{$id}", 1, (isset($content_pref["content_list_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_list_authoricon_{$id}", 1, (isset($content_pref["content_list_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
-			".$rs -> form_checkbox("content_list_rating_{$id}", 1, (isset($content_pref["content_list_rating_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
-			".$rs -> form_checkbox("content_list_peicon_{$id}", 1, (isset($content_pref["content_list_peicon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
-			".$rs -> form_checkbox("content_list_editicon_{$id}", 1, (isset($content_pref["content_list_editicon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_26."<br />
+			".$rs -> form_checkbox("content_list_authorname", 1, (isset($content_pref['content_list_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_list_authoremail", 1, (isset($content_pref['content_list_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_list_authorprofile", 1, (isset($content_pref['content_list_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_list_authoricon", 1, (isset($content_pref['content_list_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_list_rating", 1, (isset($content_pref['content_list_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_list_peicon", 1, (isset($content_pref['content_list_peicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_list_editicon", 1, (isset($content_pref['content_list_editicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_26."<br />
 			</td></tr></table>
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_subheading_char_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />".CONTENT_ADMIN_OPT_LAN_77;
-			$TOPIC_FIELD = $rs -> form_text("content_list_subheading_char_{$id}", 10, $content_pref["content_list_subheading_char_{$id}"], 3)." (".CONTENT_ADMIN_OPT_LAN_79.")";
+			$TOPIC_FIELD = $rs -> form_text("content_list_subheading_char", 10, $content_pref['content_list_subheading_char'], 3)." (".CONTENT_ADMIN_OPT_LAN_79.")";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_subheading_post_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />".CONTENT_ADMIN_OPT_LAN_78;
-			$TOPIC_FIELD = $rs -> form_text("content_list_subheading_post_{$id}", 10, $tp->toHTML($content_pref["content_list_subheading_post_{$id}"],"","defs"), 20);
+			$TOPIC_FIELD = $rs -> form_text("content_list_subheading_post", 10, $tp->toHTML($content_pref['content_list_subheading_post'],"","defs"), 20);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_summary_char_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_13."<br />".CONTENT_ADMIN_OPT_LAN_77;
-			$TOPIC_FIELD = $rs -> form_text("content_list_summary_char_{$id}", 10, $content_pref["content_list_summary_char_{$id}"], 3)." (".CONTENT_ADMIN_OPT_LAN_79.")";
+			$TOPIC_FIELD = $rs -> form_text("content_list_summary_char", 10, $content_pref['content_list_summary_char'], 3)." (".CONTENT_ADMIN_OPT_LAN_79.")";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_summary_post_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_13."<br />".CONTENT_ADMIN_OPT_LAN_78;
-			$TOPIC_FIELD = $rs -> form_text("content_list_summary_post_{$id}", 10, $tp->toHTML($content_pref["content_list_summary_post_{$id}"],"","defs"), 20);
+			$TOPIC_FIELD = $rs -> form_text("content_list_summary_post", 10, $tp->toHTML($content_pref['content_list_summary_post'],"","defs"), 20);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_text_char_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_81;
-			$TOPIC_FIELD = $rs -> form_text("content_list_text_char_{$id}", 10, $content_pref["content_list_text_char_{$id}"], 3)." (".CONTENT_ADMIN_OPT_LAN_80.")";
+			$TOPIC_FIELD = $rs -> form_text("content_list_text_char", 10, $content_pref['content_list_text_char'], 3)." (".CONTENT_ADMIN_OPT_LAN_80.")";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_text_post_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_78;
-			$TOPIC_FIELD = $rs -> form_text("content_list_text_post_{$id}", 10, $tp->toHTML($content_pref["content_list_text_post_{$id}"],"","defs"), 20);
+			$TOPIC_FIELD = $rs -> form_text("content_list_text_post", 10, $tp->toHTML($content_pref['content_list_text_post'],"","defs"), 20);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_text_link_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_83;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_list_text_link_{$id}", "1", ($content_pref["content_list_text_link_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_list_text_link_{$id}", "0", ($content_pref["content_list_text_link_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_list_text_link", "1", ($content_pref['content_list_text_link'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_list_text_link", "0", ($content_pref['content_list_text_link'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			
 			//content_list_authoremail_nonmember_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_64;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_list_authoremail_nonmember_{$id}", "1", ($content_pref["content_list_authoremail_nonmember_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_list_authoremail_nonmember_{$id}", "0", ($content_pref["content_list_authoremail_nonmember_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_list_authoremail_nonmember", "1", ($content_pref['content_list_authoremail_nonmember'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_list_authoremail_nonmember", "0", ($content_pref['content_list_authoremail_nonmember'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_peicon_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_69;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_list_peicon_all_{$id}", "1", ($content_pref["content_list_peicon_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_list_peicon_all_{$id}", "0", ($content_pref["content_list_peicon_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_list_peicon_all", "1", ($content_pref['content_list_peicon_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_list_peicon_all", "0", ($content_pref['content_list_peicon_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_rating_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_70;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_list_rating_all_{$id}", "1", ($content_pref["content_list_rating_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_list_rating_all_{$id}", "0", ($content_pref["content_list_rating_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_list_rating_all", "1", ($content_pref['content_list_rating_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_list_rating_all", "0", ($content_pref['content_list_rating_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			
 			//content_list_datestyle_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_67;
-			$TOPIC_FIELD = $rs -> form_text("content_list_datestyle_{$id}", 15, $content_pref["content_list_datestyle_{$id}"], 50);
+			$TOPIC_FIELD = $rs -> form_text("content_list_datestyle", 15, $content_pref['content_list_datestyle'], 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_list_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_155;
+			$TOPIC_FIELD = $rs -> form_text("content_list_caption", 25, $tp->toHTML($content_pref['content_list_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_list_caption_append_name
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_160;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_list_caption_append_name", "1", ($content_pref['content_list_caption_append_name'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_list_caption_append_name", "0", ($content_pref['content_list_caption_append_name'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= $TOPIC_TABLE_END;
@@ -2812,40 +3051,45 @@
 			//content_cat_sections_allcats (view all categories)
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_catall_icon_{$id}", 1, (isset($content_pref["content_catall_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_catall_subheading_{$id}", 1, (isset($content_pref["content_catall_subheading_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
-			".$rs -> form_checkbox("content_catall_text_{$id}", 1, (isset($content_pref["content_catall_text_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_14."<br />
-			".$rs -> form_checkbox("content_catall_date_{$id}", 1, (isset($content_pref["content_catall_date_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
-			".$rs -> form_checkbox("content_catall_rating_{$id}", 1, (isset($content_pref["content_catall_rating_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
-			".$rs -> form_checkbox("content_catall_peicon_{$id}", 1, (isset($content_pref["content_catall_peicon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_catall_icon", 1, (isset($content_pref['content_catall_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_catall_subheading", 1, (isset($content_pref['content_catall_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
+			".$rs -> form_checkbox("content_catall_text", 1, (isset($content_pref['content_catall_text']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_14."<br />
+			".$rs -> form_checkbox("content_catall_date", 1, (isset($content_pref['content_catall_date']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
+			".$rs -> form_checkbox("content_catall_rating", 1, (isset($content_pref['content_catall_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_catall_peicon", 1, (isset($content_pref['content_catall_peicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
 			</td><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_catall_authorname_{$id}", 1, (isset($content_pref["content_catall_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_catall_authoremail_{$id}", 1, (isset($content_pref["content_catall_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_catall_authorprofile_{$id}", 1, (isset($content_pref["content_catall_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_catall_authoricon_{$id}", 1, (isset($content_pref["content_catall_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
-			".$rs -> form_checkbox("content_catall_comment_{$id}", 1, (isset($content_pref["content_catall_comment_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
-			".$rs -> form_checkbox("content_catall_amount_{$id}", 1, (isset($content_pref["content_catall_amount_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_23."<br />
+			".$rs -> form_checkbox("content_catall_authorname", 1, (isset($content_pref['content_catall_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_catall_authoremail", 1, (isset($content_pref['content_catall_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_catall_authorprofile", 1, (isset($content_pref['content_catall_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_catall_authoricon", 1, (isset($content_pref['content_catall_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_catall_comment", 1, (isset($content_pref['content_catall_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
+			".$rs -> form_checkbox("content_catall_amount", 1, (isset($content_pref['content_catall_amount']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_23."<br />
 			</td></tr></table>";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_text_char_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_81;
-			$TOPIC_FIELD = $rs -> form_text("content_catall_text_char_{$id}", 10, $content_pref["content_catall_text_char_{$id}"], 3)." (".CONTENT_ADMIN_OPT_LAN_80.")";
+			$TOPIC_FIELD = $rs -> form_text("content_catall_text_char", 10, $content_pref['content_catall_text_char'], 3)." (".CONTENT_ADMIN_OPT_LAN_80.")";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_text_post_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_78;
-			$TOPIC_FIELD = $rs -> form_text("content_catall_text_post_{$id}", 10, $tp->toHTML($content_pref["content_catall_text_post_{$id}"],"","defs"), 20);
+			$TOPIC_FIELD = $rs -> form_text("content_catall_text_post", 10, $tp->toHTML($content_pref['content_catall_text_post'],"","defs"), 20);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_text_link_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_83;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_catall_text_link_{$id}", "1", ($content_pref["content_catall_text_link_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_catall_text_link_{$id}", "0", ($content_pref["content_catall_text_link_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_catall_text_link", "1", ($content_pref['content_catall_text_link'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_catall_text_link", "0", ($content_pref['content_catall_text_link'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
+			//content_catall_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_155;
+			$TOPIC_FIELD = $rs -> form_text("content_catall_caption", 25, $tp->toHTML($content_pref['content_catall_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
 			$text .= $TOPIC_ROW_SPACER;
 
 			$TOPIC_CAPTION = CONTENT_ADMIN_OPT_LAN_MENU_17;
@@ -2854,103 +3098,103 @@
 			//content_cat_sections (view category)
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1." ".CONTENT_ADMIN_OPT_LAN_SECTION_28;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_cat_icon_{$id}", 1, (isset($content_pref["content_cat_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_cat_subheading_{$id}", 1, (isset($content_pref["content_cat_subheading_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
-			".$rs -> form_checkbox("content_cat_text_{$id}", 1, (isset($content_pref["content_cat_text_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_14."<br />
-			".$rs -> form_checkbox("content_cat_date_{$id}", 1, (isset($content_pref["content_cat_date_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
-			".$rs -> form_checkbox("content_cat_rating_{$id}", 1, (isset($content_pref["content_cat_rating_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
-			".$rs -> form_checkbox("content_cat_peicon_{$id}", 1, (isset($content_pref["content_cat_peicon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_cat_icon", 1, (isset($content_pref['content_cat_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_cat_subheading", 1, (isset($content_pref['content_cat_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
+			".$rs -> form_checkbox("content_cat_text", 1, (isset($content_pref['content_cat_text']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_14."<br />
+			".$rs -> form_checkbox("content_cat_date", 1, (isset($content_pref['content_cat_date']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
+			".$rs -> form_checkbox("content_cat_rating", 1, (isset($content_pref['content_cat_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_cat_peicon", 1, (isset($content_pref['content_cat_peicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
 			</td><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_cat_authorname_{$id}", 1, (isset($content_pref["content_cat_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_cat_authoremail_{$id}", 1, (isset($content_pref["content_cat_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_cat_authorprofile_{$id}", 1, (isset($content_pref["content_cat_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_cat_authoricon_{$id}", 1, (isset($content_pref["content_cat_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
-			".$rs -> form_checkbox("content_cat_comment_{$id}", 1, (isset($content_pref["content_cat_comment_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
-			".$rs -> form_checkbox("content_cat_amount_{$id}", 1, (isset($content_pref["content_cat_amount_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_23."<br />
+			".$rs -> form_checkbox("content_cat_authorname", 1, (isset($content_pref['content_cat_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_cat_authoremail", 1, (isset($content_pref['content_cat_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_cat_authorprofile", 1, (isset($content_pref['content_cat_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_cat_authoricon", 1, (isset($content_pref['content_cat_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_cat_comment", 1, (isset($content_pref['content_cat_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
+			".$rs -> form_checkbox("content_cat_amount", 1, (isset($content_pref['content_cat_amount']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_23."<br />
 			</td></tr></table>";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_sections_subcategory_list (view category)
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1." ".CONTENT_ADMIN_OPT_LAN_SECTION_29;
 			$TOPIC_FIELD = "
-			".$rs -> form_checkbox("content_catsub_icon_{$id}", 1, (isset($content_pref["content_catsub_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_catsub_subheading_{$id}", 1, (isset($content_pref["content_catsub_subheading_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
-			".$rs -> form_checkbox("content_catsub_amount_{$id}", 1, (isset($content_pref["content_catsub_amount_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_23."<br />
+			".$rs -> form_checkbox("content_catsub_icon", 1, (isset($content_pref['content_catsub_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_catsub_subheading", 1, (isset($content_pref['content_catsub_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
+			".$rs -> form_checkbox("content_catsub_amount", 1, (isset($content_pref['content_catsub_amount']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_23."<br />
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_text_char_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_81;
-			$TOPIC_FIELD = $rs -> form_text("content_cat_text_char_{$id}", 10, $content_pref["content_cat_text_char_{$id}"], 3)." (".CONTENT_ADMIN_OPT_LAN_80.")";
+			$TOPIC_FIELD = $rs -> form_text("content_cat_text_char", 10, $content_pref['content_cat_text_char'], 3)." <br />(".CONTENT_ADMIN_OPT_LAN_80.", ".CONTENT_ADMIN_OPT_LAN_166.")";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_text_post_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_78;
-			$TOPIC_FIELD = $rs -> form_text("content_cat_text_post_{$id}", 10, $tp->toHTML($content_pref["content_cat_text_post_{$id}"],"","defs"), 20);
+			$TOPIC_FIELD = $rs -> form_text("content_cat_text_post", 10, $tp->toHTML($content_pref['content_cat_text_post'],"","defs"), 20);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_text_link_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_82." : ".CONTENT_ADMIN_OPT_LAN_83;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_cat_text_link_{$id}", "1", ($content_pref["content_cat_text_link_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_text_link_{$id}", "0", ($content_pref["content_cat_text_link_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_text_link", "1", ($content_pref['content_cat_text_link'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_text_link", "0", ($content_pref['content_cat_text_link'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			
 			//content_cat_authoremail_nonmember_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_64;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_cat_authoremail_nonmember_{$id}", "1", ($content_pref["content_cat_authoremail_nonmember_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_authoremail_nonmember_{$id}", "0", ($content_pref["content_cat_authoremail_nonmember_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_authoremail_nonmember", "1", ($content_pref['content_cat_authoremail_nonmember'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_authoremail_nonmember", "0", ($content_pref['content_cat_authoremail_nonmember'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_peicon_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_69;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_cat_peicon_all_{$id}", "1", ($content_pref["content_cat_peicon_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_peicon_all_{$id}", "0", ($content_pref["content_cat_peicon_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_peicon_all", "1", ($content_pref['content_cat_peicon_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_peicon_all", "0", ($content_pref['content_cat_peicon_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_list_rating_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_70;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_cat_rating_all_{$id}", "1", ($content_pref["content_cat_rating_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_rating_all_{$id}", "0", ($content_pref["content_cat_rating_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_rating_all", "1", ($content_pref['content_cat_rating_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_rating_all", "0", ($content_pref['content_cat_rating_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_showparent_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_84;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_cat_showparent_{$id}", "1", ($content_pref["content_cat_showparent_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_showparent_{$id}", "0", ($content_pref["content_cat_showparent_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_showparent", "1", ($content_pref['content_cat_showparent'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_showparent", "0", ($content_pref['content_cat_showparent'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_showparentsub_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_85;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_cat_showparentsub_{$id}", "1", ($content_pref["content_cat_showparentsub_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_showparentsub_{$id}", "0", ($content_pref["content_cat_showparentsub_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_showparentsub", "1", ($content_pref['content_cat_showparentsub'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_showparentsub", "0", ($content_pref['content_cat_showparentsub'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_listtype_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_86;
 			$TOPIC_FIELD = CONTENT_ADMIN_OPT_LAN_87."<br /><br />
-			".$rs -> form_radio("content_cat_listtype_{$id}", "1", ($content_pref["content_cat_listtype_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_cat_listtype_{$id}", "0", ($content_pref["content_cat_listtype_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_cat_listtype", "1", ($content_pref['content_cat_listtype'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_listtype", "0", ($content_pref['content_cat_listtype'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_cat_menuorder_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_88;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_cat_menuorder_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_89, ($content_pref["content_cat_menuorder_{$id}"] == "1" ? "1" : "0"), "1")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_90, ($content_pref["content_cat_menuorder_{$id}"] == "2" ? "1" : "0"), "2")."
+			".$rs -> form_select_open("content_cat_menuorder")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_89, ($content_pref['content_cat_menuorder'] == "1" ? "1" : "0"), "1")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_90, ($content_pref['content_cat_menuorder'] == "2" ? "1" : "0"), "2")."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -2958,13 +3202,41 @@
 			//content_cat_rendertype_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_91;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_cat_rendertype_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_92, ($content_pref["content_cat_rendertype_{$id}"] == "1" ? "1" : "0"), "1")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_41, ($content_pref["content_cat_rendertype_{$id}"] == "2" ? "1" : "0"), "2")."
+			".$rs -> form_select_open("content_cat_rendertype")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_92, ($content_pref['content_cat_rendertype'] == "1" ? "1" : "0"), "1")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_41, ($content_pref['content_cat_rendertype'] == "2" ? "1" : "0"), "2")."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
+			//content_cat_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_159;
+			$TOPIC_FIELD = $rs -> form_text("content_cat_caption", 25, $tp->toHTML($content_pref['content_cat_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			
+			//content_cat_caption_append_name
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_160;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_cat_caption_append_name", "1", ($content_pref['content_cat_caption_append_name'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_cat_caption_append_name", "0", ($content_pref['content_cat_caption_append_name'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_cat_sub_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_161;
+			$TOPIC_FIELD = $rs -> form_text("content_cat_sub_caption", 25, $tp->toHTML($content_pref['content_cat_sub_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_cat_item_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_162;
+			$TOPIC_FIELD = $rs -> form_text("content_cat_item_caption", 25, $tp->toHTML($content_pref['content_cat_item_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_subcat_levels_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_171;
+			$TOPIC_FIELD = CONTENT_ADMIN_OPT_LAN_172."<br />".$rs -> form_text("content_cat_levels", 10, $content_pref['content_cat_levels'], 3);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
 			$text .= $TOPIC_TABLE_END;
 
 			$text .= "
@@ -2977,25 +3249,25 @@
 			//content_content_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "<table style='width:100%;' cellpadding='0' cellspacing='0'><tr><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_content_icon_{$id}", 1, (isset($content_pref["content_content_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_content_attach_{$id}", 1, (isset($content_pref["content_content_attach_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."<br />
-			".$rs -> form_checkbox("content_content_images_{$id}", 1, (isset($content_pref["content_content_images_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."<br />
-			".$rs -> form_checkbox("content_content_subheading_{$id}", 1, (isset($content_pref["content_content_subheading_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
-			".$rs -> form_checkbox("content_content_summary_{$id}", 1, (isset($content_pref["content_content_summary_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_13."<br />
-			".$rs -> form_checkbox("content_content_authorname_{$id}", 1, (isset($content_pref["content_content_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_content_authoremail_{$id}", 1, (isset($content_pref["content_content_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_content_authorprofile_{$id}", 1, (isset($content_pref["content_content_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_content_authoricon_{$id}", 1, (isset($content_pref["content_content_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_content_icon", 1, (isset($content_pref['content_content_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_content_attach", 1, (isset($content_pref['content_content_attach']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_2."<br />
+			".$rs -> form_checkbox("content_content_images", 1, (isset($content_pref['content_content_images']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_3."<br />
+			".$rs -> form_checkbox("content_content_subheading", 1, (isset($content_pref['content_content_subheading']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_12."<br />
+			".$rs -> form_checkbox("content_content_summary", 1, (isset($content_pref['content_content_summary']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_13."<br />
+			".$rs -> form_checkbox("content_content_authorname", 1, (isset($content_pref['content_content_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_content_authoremail", 1, (isset($content_pref['content_content_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_content_authorprofile", 1, (isset($content_pref['content_content_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_content_authoricon", 1, (isset($content_pref['content_content_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
 			</td><td style='white-space:nowrap;'>
-			".$rs -> form_checkbox("content_content_date_{$id}", 1, (isset($content_pref["content_content_date_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
-			".$rs -> form_checkbox("content_content_parent_{$id}", 1, (isset($content_pref["content_content_parent_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_21."<br />
-			".$rs -> form_checkbox("content_content_refer_{$id}", 1, (isset($content_pref["content_content_refer_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_22."<br />
-			".$rs -> form_checkbox("content_content_rating_{$id}", 1, (isset($content_pref["content_content_rating_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
-			".$rs -> form_checkbox("content_content_peicon_{$id}", 1, (isset($content_pref["content_content_peicon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
-			".$rs -> form_checkbox("content_content_comment_{$id}", 1, (isset($content_pref["content_content_comment_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
-			".$rs -> form_checkbox("content_content_editicon_{$id}", 1, (isset($content_pref["content_content_editicon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_26."<br />
-			".$rs -> form_checkbox("content_content_customtags_{$id}", 1, (isset($content_pref["content_content_customtags_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."<br />
-			".$rs -> form_checkbox("content_content_presettags_{$id}", 1, (isset($content_pref["content_content_presettags_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."<br />
+			".$rs -> form_checkbox("content_content_date", 1, (isset($content_pref['content_content_date']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
+			".$rs -> form_checkbox("content_content_parent", 1, (isset($content_pref['content_content_parent']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_21."<br />
+			".$rs -> form_checkbox("content_content_refer", 1, (isset($content_pref['content_content_refer']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_22."<br />
+			".$rs -> form_checkbox("content_content_rating", 1, (isset($content_pref['content_content_rating']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_5."<br />
+			".$rs -> form_checkbox("content_content_peicon", 1, (isset($content_pref['content_content_peicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_20."<br />
+			".$rs -> form_checkbox("content_content_comment", 1, (isset($content_pref['content_content_comment']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_4."<br />
+			".$rs -> form_checkbox("content_content_editicon", 1, (isset($content_pref['content_content_editicon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_26."<br />
+			".$rs -> form_checkbox("content_content_customtags", 1, (isset($content_pref['content_content_customtags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_10."<br />
+			".$rs -> form_checkbox("content_content_presettags", 1, (isset($content_pref['content_content_presettags']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_11."<br />
 			</td></tr></table>
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -3003,43 +3275,69 @@
 			//content_content_authoremail_nonmember_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_64;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_content_authoremail_nonmember_{$id}", "1", ($content_pref["content_content_authoremail_nonmember_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_content_authoremail_nonmember_{$id}", "0", ($content_pref["content_content_authoremail_nonmember_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_content_authoremail_nonmember", "1", ($content_pref['content_content_authoremail_nonmember'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_content_authoremail_nonmember", "0", ($content_pref['content_content_authoremail_nonmember'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_content_peicon_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_69;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_content_peicon_all_{$id}", "1", ($content_pref["content_content_peicon_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_content_peicon_all_{$id}", "0", ($content_pref["content_content_peicon_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_content_peicon_all", "1", ($content_pref['content_content_peicon_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_content_peicon_all", "0", ($content_pref['content_content_peicon_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_content_rating_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_70;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_content_rating_all_{$id}", "1", ($content_pref["content_content_rating_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_content_rating_all_{$id}", "0", ($content_pref["content_content_rating_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_content_rating_all", "1", ($content_pref['content_content_rating_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_content_rating_all", "0", ($content_pref['content_content_rating_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_content_comment_all_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_71;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_content_comment_all_{$id}", "1", ($content_pref["content_content_comment_all_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_content_comment_all_{$id}", "0", ($content_pref["content_content_comment_all_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_content_comment_all", "1", ($content_pref['content_content_comment_all'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_content_comment_all", "0", ($content_pref['content_content_comment_all'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_content_pagenames_rendertype_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_73;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_content_pagenames_rendertype_{$id}", "0", ($content_pref["content_content_pagenames_rendertype_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_75."
-			".$rs -> form_radio("content_content_pagenames_rendertype_{$id}", "1", ($content_pref["content_content_pagenames_rendertype_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_76."
+			".$rs -> form_radio("content_content_pagenames_rendertype", "0", ($content_pref['content_content_pagenames_rendertype'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_75."
+			".$rs -> form_radio("content_content_pagenames_rendertype", "1", ($content_pref['content_content_pagenames_rendertype'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_76."
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_content_multipage_preset
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_170;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_content_multipage_preset", "1", ($content_pref['content_content_multipage_preset'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_168."
+			".$rs -> form_radio("content_content_multipage_preset", "0", ($content_pref['content_content_multipage_preset'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_169."
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_content_pagenames_nextprev
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_163;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_content_pagenames_nextprev", "1", ($content_pref['content_content_pagenames_nextprev'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_content_pagenames_nextprev", "0", ($content_pref['content_content_pagenames_nextprev'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
+			//content_content_pagenames_nextprev_prevhead
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_164;
+			$TOPIC_FIELD = $rs -> form_text("content_content_pagenames_nextprev_prevhead", 25, $tp->toHTML($content_pref['content_content_pagenames_nextprev_prevhead'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_content_pagenames_nextprev_nexthead
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_165;
+			$TOPIC_FIELD = $rs -> form_text("content_content_pagenames_nextprev_nexthead", 25, $tp->toHTML($content_pref['content_content_pagenames_nextprev_nexthead'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
 			$text .= $TOPIC_TABLE_END;
 
 			$text .= "
@@ -3052,29 +3350,47 @@
 			//content_author_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "
-			".$rs -> form_checkbox("content_author_lastitem_{$id}", 1, (isset($content_pref["content_author_lastitem_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_24."<br />
-			".$rs -> form_checkbox("content_author_amount_{$id}", 1, (isset($content_pref["content_author_amount_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_25."<br />
+			".$rs -> form_checkbox("content_author_lastitem", 1, (isset($content_pref['content_author_lastitem']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_24."<br />
+			".$rs -> form_checkbox("content_author_amount", 1, (isset($content_pref['content_author_amount']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_25."<br />
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			
 			//content_author_nextprev_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_49;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_author_nextprev_{$id}", "1", ($content_pref["content_author_nextprev_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_author_nextprev_{$id}", "0", ($content_pref["content_author_nextprev_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_author_nextprev", "1", ($content_pref['content_author_nextprev'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_author_nextprev", "0", ($content_pref['content_author_nextprev'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_author_nextprev_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_50;
-			$TOPIC_FIELD = $rs -> form_select_open("content_author_nextprev_number_{$id}");
+			$TOPIC_FIELD = $rs -> form_select_open("content_author_nextprev_number");
 			for($i=2;$i<63;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_author_nextprev_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_author_nextprev_number'] == $i ? "1" : "0"), $i);
 				$i++;
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
+			//content_author_index_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_156;
+			$TOPIC_FIELD = $rs -> form_text("content_author_index_caption", 25, $tp->toHTML($content_pref['content_author_index_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_author_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_157;
+			$TOPIC_FIELD = $rs -> form_text("content_author_caption", 25, $tp->toHTML($content_pref['content_author_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			
+			//content_author_caption_append_name
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_158;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_author_caption_append_name", "1", ($content_pref['content_author_caption_append_name'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_author_caption_append_name", "0", ($content_pref['content_author_caption_append_name'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
 			$text .= $TOPIC_TABLE_END;
 
 			$text .= "
@@ -3087,35 +3403,35 @@
 			//content_archive_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "
-			".$rs -> form_checkbox("content_archive_date_{$id}", 1, (isset($content_pref["content_archive_date_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
-			".$rs -> form_checkbox("content_archive_authorname_{$id}", 1, (isset($content_pref["content_archive_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_archive_authoremail_{$id}", 1, (isset($content_pref["content_archive_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_archive_authorprofile_{$id}", 1, (isset($content_pref["content_archive_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_archive_authoricon_{$id}", 1, (isset($content_pref["content_archive_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_archive_date", 1, (isset($content_pref['content_archive_date']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_15."<br />
+			".$rs -> form_checkbox("content_archive_authorname", 1, (isset($content_pref['content_archive_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_archive_authoremail", 1, (isset($content_pref['content_archive_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_archive_authorprofile", 1, (isset($content_pref['content_archive_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_archive_authoricon", 1, (isset($content_pref['content_archive_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_archive_authoremail_nonmember_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_64;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_archive_authoremail_nonmember_{$id}", "1", ($content_pref["content_archive_authoremail_nonmember_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_archive_authoremail_nonmember_{$id}", "0", ($content_pref["content_archive_authoremail_nonmember_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_archive_authoremail_nonmember", "1", ($content_pref['content_archive_authoremail_nonmember'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_archive_authoremail_nonmember", "0", ($content_pref['content_archive_authoremail_nonmember'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			
 			//content_archive_nextprev_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_49;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_archive_nextprev_{$id}", "1", ($content_pref["content_archive_nextprev_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_archive_nextprev_{$id}", "0", ($content_pref["content_archive_nextprev_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_archive_nextprev", "1", ($content_pref['content_archive_nextprev'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_archive_nextprev", "0", ($content_pref['content_archive_nextprev'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_nextprev_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_50;
-			$TOPIC_FIELD = $rs -> form_select_open("content_archive_nextprev_number_{$id}");
+			$TOPIC_FIELD = $rs -> form_select_open("content_archive_nextprev_number");
 			for($i=2;$i<63;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_archive_nextprev_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_archive_nextprev_number'] == $i ? "1" : "0"), $i);
 				$i++;
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
@@ -3124,13 +3440,18 @@
 			//content_archive_letterindex_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_65;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_archive_letterindex_{$id}", "1", ($content_pref["content_archive_letterindex_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_archive_letterindex_{$id}", "0", ($content_pref["content_archive_letterindex_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31;
+			".$rs -> form_radio("content_archive_letterindex", "1", ($content_pref['content_archive_letterindex'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_archive_letterindex", "0", ($content_pref['content_archive_letterindex'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31;
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_archive_datestyle_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_67;
-			$TOPIC_FIELD = $rs -> form_text("content_archive_datestyle_{$id}", 15, $content_pref["content_archive_datestyle_{$id}"], 50);
+			$TOPIC_FIELD = $rs -> form_text("content_archive_datestyle", 15, $content_pref['content_archive_datestyle'], 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_archive_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_155;
+			$TOPIC_FIELD = $rs -> form_text("content_archive_caption", 25, $tp->toHTML($content_pref['content_archive_caption'],"","defs"), 50);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= $TOPIC_TABLE_END;
@@ -3145,19 +3466,37 @@
 			//content_top_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "
-			".$rs -> form_checkbox("content_top_icon_{$id}", 1, (isset($content_pref["content_top_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_top_authorname_{$id}", 1, (isset($content_pref["content_top_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_top_authoremail_{$id}", 1, (isset($content_pref["content_top_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_top_authorprofile_{$id}", 1, (isset($content_pref["content_top_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_top_authoricon_{$id}", 1, (isset($content_pref["content_top_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_top_icon", 1, (isset($content_pref['content_top_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_top_authorname", 1, (isset($content_pref['content_top_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_top_authoremail", 1, (isset($content_pref['content_top_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_top_authorprofile", 1, (isset($content_pref['content_top_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_top_authoricon", 1, (isset($content_pref['content_top_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_top_authoremail_nonmember_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_64;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_top_authoremail_nonmember_{$id}", "1", ($content_pref["content_top_authoremail_nonmember_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_top_authoremail_nonmember_{$id}", "0", ($content_pref["content_top_authoremail_nonmember_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_top_authoremail_nonmember", "1", ($content_pref['content_top_authoremail_nonmember'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_top_authoremail_nonmember", "0", ($content_pref['content_top_authoremail_nonmember'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_top_icon_width_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_133;
+			$TOPIC_FIELD = $rs -> form_text("content_top_icon_width", 10, $content_pref['content_top_icon_width'], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			
+			//content_top_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_155;
+			$TOPIC_FIELD = $rs -> form_text("content_top_caption", 25, $tp->toHTML($content_pref['content_top_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_top_caption_append_name
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_160;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_top_caption_append_name", "1", ($content_pref['content_top_caption_append_name'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_top_caption_append_name", "0", ($content_pref['content_top_caption_append_name'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
@@ -3173,19 +3512,37 @@
 			//content_score_sections
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_SECTION_1;
 			$TOPIC_FIELD = "
-			".$rs -> form_checkbox("content_score_icon_{$id}", 1, (isset($content_pref["content_score_icon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
-			".$rs -> form_checkbox("content_score_authorname_{$id}", 1, (isset($content_pref["content_score_authorname_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
-			".$rs -> form_checkbox("content_score_authoremail_{$id}", 1, (isset($content_pref["content_score_authoremail_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
-			".$rs -> form_checkbox("content_score_authorprofile_{$id}", 1, (isset($content_pref["content_score_authorprofile_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
-			".$rs -> form_checkbox("content_score_authoricon_{$id}", 1, (isset($content_pref["content_score_authoricon_{$id}"]) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
+			".$rs -> form_checkbox("content_score_icon", 1, (isset($content_pref['content_score_icon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_27."<br />
+			".$rs -> form_checkbox("content_score_authorname", 1, (isset($content_pref['content_score_authorname']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_16."<br />
+			".$rs -> form_checkbox("content_score_authoremail", 1, (isset($content_pref['content_score_authoremail']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_17."<br />
+			".$rs -> form_checkbox("content_score_authorprofile", 1, (isset($content_pref['content_score_authorprofile']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_18."<br />
+			".$rs -> form_checkbox("content_score_authoricon", 1, (isset($content_pref['content_score_authoricon']) ? "1" : "0"))." ".CONTENT_ADMIN_OPT_LAN_SECTION_19."<br />
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_score_authoremail_nonmember_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_64;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_score_authoremail_nonmember_{$id}", "1", ($content_pref["content_score_authoremail_nonmember_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_score_authoremail_nonmember_{$id}", "0", ($content_pref["content_score_authoremail_nonmember_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_score_authoremail_nonmember", "1", ($content_pref['content_score_authoremail_nonmember'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_score_authoremail_nonmember", "0", ($content_pref['content_score_authoremail_nonmember'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			";
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_score_icon_width_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_133;
+			$TOPIC_FIELD = $rs -> form_text("content_score_icon_width", 10, $content_pref['content_score_icon_width'], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+			
+			//content_score_caption_
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_155;
+			$TOPIC_FIELD = $rs -> form_text("content_score_caption", 25, $tp->toHTML($content_pref['content_score_caption'],"","defs"), 50);
+			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
+
+			//content_score_caption_append_name
+			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_160;
+			$TOPIC_FIELD = "
+			".$rs -> form_radio("content_score_caption_append_name", "1", ($content_pref['content_score_caption_append_name'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_score_caption_append_name", "0", ($content_pref['content_score_caption_append_name'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
@@ -3200,22 +3557,22 @@
 
 			//content_menu_caption_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_93;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_caption_{$id}", 15, $tp->toHTML($content_pref["content_menu_caption_{$id}"],"","defs"), 50);
+			$TOPIC_FIELD = $rs -> form_text("content_menu_caption", 25, $tp->toHTML($content_pref['content_menu_caption'],"","defs"), 50);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_search_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_94;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_search_{$id}", "1", ($content_pref["content_menu_search_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_search_{$id}", "0", ($content_pref["content_menu_search_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_search", "1", ($content_pref['content_menu_search'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_search", "0", ($content_pref['content_menu_search'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_sort_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_95;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_sort_{$id}", "1", ($content_pref["content_menu_sort_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_sort_{$id}", "0", ($content_pref["content_menu_sort_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_sort", "1", ($content_pref['content_menu_sort'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_sort", "0", ($content_pref['content_menu_sort'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
@@ -3227,76 +3584,76 @@
 			//content_menu_links_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_96;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_links_{$id}", "1", ($content_pref["content_menu_links_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_links_{$id}", "0", ($content_pref["content_menu_links_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31." (".CONTENT_ADMIN_OPT_LAN_97.")
+			".$rs -> form_radio("content_menu_links", "1", ($content_pref['content_menu_links'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_links", "0", ($content_pref['content_menu_links'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31." (".CONTENT_ADMIN_OPT_LAN_97.")
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 			
 			//content_menu_viewallcat_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_98;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewallcat_{$id}", "1", ($content_pref["content_menu_viewallcat_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewallcat_{$id}", "0", ($content_pref["content_menu_viewallcat_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewallcat", "1", ($content_pref['content_menu_viewallcat'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewallcat", "0", ($content_pref['content_menu_viewallcat'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_viewallauthor_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_99;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewallauthor_{$id}", "1", ($content_pref["content_menu_viewallauthor_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewallauthor_{$id}", "0", ($content_pref["content_menu_viewallauthor_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewallauthor", "1", ($content_pref['content_menu_viewallauthor'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewallauthor", "0", ($content_pref['content_menu_viewallauthor'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_viewallitems_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_100;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewallitems_{$id}", "1", ($content_pref["content_menu_viewallitems_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewallitems_{$id}", "0", ($content_pref["content_menu_viewallitems_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewallitems", "1", ($content_pref['content_menu_viewallitems'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewallitems", "0", ($content_pref['content_menu_viewallitems'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_viewtoprated_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_101;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewtoprated_{$id}", "1", ($content_pref["content_menu_viewtoprated_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewtoprated_{$id}", "0", ($content_pref["content_menu_viewtoprated_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewtoprated", "1", ($content_pref['content_menu_viewtoprated'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewtoprated", "0", ($content_pref['content_menu_viewtoprated'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_viewtopscore_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_102;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewtopscore_{$id}", "1", ($content_pref["content_menu_viewtopscore_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewtopscore_{$id}", "0", ($content_pref["content_menu_viewtopscore_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewtopscore", "1", ($content_pref['content_menu_viewtopscore'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewtopscore", "0", ($content_pref['content_menu_viewtopscore'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_viewrecent_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_103;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewrecent_{$id}", "1", ($content_pref["content_menu_viewrecent_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewrecent_{$id}", "0", ($content_pref["content_menu_viewrecent_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewrecent", "1", ($content_pref['content_menu_viewrecent'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewrecent", "0", ($content_pref['content_menu_viewrecent'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_viewsubmit_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_104;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_viewsubmit_{$id}", "1", ($content_pref["content_menu_viewsubmit_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_viewsubmit_{$id}", "0", ($content_pref["content_menu_viewsubmit_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_viewsubmit", "1", ($content_pref['content_menu_viewsubmit'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_viewsubmit", "0", ($content_pref['content_menu_viewsubmit'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_links_icon_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_105;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_menu_links_icon_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref["content_menu_links_icon_{$id}"] == "0" ? "1" : "0"), 0)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref["content_menu_links_icon_{$id}"] == "1" ? "1" : "0"), 1)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref["content_menu_links_icon_{$id}"] == "2" ? "1" : "0"), 2)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref["content_menu_links_icon_{$id}"] == "3" ? "1" : "0"), 3)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref["content_menu_links_icon_{$id}"] == "4" ? "1" : "0"), 4)."
+			".$rs -> form_select_open("content_menu_links_icon")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref['content_menu_links_icon'] == "0" ? "1" : "0"), 0)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref['content_menu_links_icon'] == "1" ? "1" : "0"), 1)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref['content_menu_links_icon'] == "2" ? "1" : "0"), 2)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref['content_menu_links_icon'] == "3" ? "1" : "0"), 3)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref['content_menu_links_icon'] == "4" ? "1" : "0"), 4)."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -3304,14 +3661,14 @@
 			//content_menu_links_dropdown_ (rendertype)
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_114;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_links_dropdown_{$id}", "1", ($content_pref["content_menu_links_dropdown_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_76."
-			".$rs -> form_radio("content_menu_links_dropdown_{$id}", "0", ($content_pref["content_menu_links_dropdown_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_75."
+			".$rs -> form_radio("content_menu_links_dropdown", "1", ($content_pref['content_menu_links_dropdown'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_76."
+			".$rs -> form_radio("content_menu_links_dropdown", "0", ($content_pref['content_menu_links_dropdown'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_75."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_links_caption_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_115;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_links_caption_{$id}", 15, $tp->toHTML($content_pref["content_menu_links_caption_{$id}"],"","defs"), 50)." (".CONTENT_ADMIN_OPT_LAN_116.")";
+			$TOPIC_FIELD = $rs -> form_text("content_menu_links_caption", 25, $tp->toHTML($content_pref['content_menu_links_caption'],"","defs"), 50)." (".CONTENT_ADMIN_OPT_LAN_116.")";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= $TOPIC_ROW_SPACER;
@@ -3322,37 +3679,37 @@
 			//content_menu_cat_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_117;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_cat_{$id}", "1", ($content_pref["content_menu_cat_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_cat_{$id}", "0", ($content_pref["content_menu_cat_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_cat", "1", ($content_pref['content_menu_cat'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_cat", "0", ($content_pref['content_menu_cat'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_cat_main_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_118;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_cat_main_{$id}", "1", ($content_pref["content_menu_cat_main_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_cat_main_{$id}", "0", ($content_pref["content_menu_cat_main_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_cat_main", "1", ($content_pref['content_menu_cat_main'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_cat_main", "0", ($content_pref['content_menu_cat_main'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_cat_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_120;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_cat_number_{$id}", "1", ($content_pref["content_menu_cat_number_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_cat_number_{$id}", "0", ($content_pref["content_menu_cat_number_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_cat_number", "1", ($content_pref['content_menu_cat_number'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_cat_number", "0", ($content_pref['content_menu_cat_number'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_cat_icon_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_121;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_menu_cat_icon_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref["content_menu_cat_icon_{$id}"] == "0" ? "1" : "0"), 0)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref["content_menu_cat_icon_{$id}"] == "1" ? "1" : "0"), 1)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref["content_menu_cat_icon_{$id}"] == "2" ? "1" : "0"), 2)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref["content_menu_cat_icon_{$id}"] == "3" ? "1" : "0"), 3)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref["content_menu_cat_icon_{$id}"] == "4" ? "1" : "0"), 4)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_112, ($content_pref["content_menu_cat_icon_{$id}"] == "5" ? "1" : "0"), 5)."
+			".$rs -> form_select_open("content_menu_cat_icon")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref['content_menu_cat_icon'] == "0" ? "1" : "0"), 0)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref['content_menu_cat_icon'] == "1" ? "1" : "0"), 1)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref['content_menu_cat_icon'] == "2" ? "1" : "0"), 2)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref['content_menu_cat_icon'] == "3" ? "1" : "0"), 3)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref['content_menu_cat_icon'] == "4" ? "1" : "0"), 4)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_112, ($content_pref['content_menu_cat_icon'] == "5" ? "1" : "0"), 5)."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -3360,12 +3717,12 @@
 			//content_menu_cat_icon_default_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_122;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_menu_cat_icon_default_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref["content_menu_cat_icon_default_{$id}"] == "0" ? "1" : "0"), 0)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref["content_menu_cat_icon_default_{$id}"] == "1" ? "1" : "0"), 1)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref["content_menu_cat_icon_default_{$id}"] == "2" ? "1" : "0"), 2)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref["content_menu_cat_icon_default_{$id}"] == "3" ? "1" : "0"), 3)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref["content_menu_cat_icon_default_{$id}"] == "4" ? "1" : "0"), 4)."
+			".$rs -> form_select_open("content_menu_cat_icon_default")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref['content_menu_cat_icon_default'] == "0" ? "1" : "0"), 0)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref['content_menu_cat_icon_default'] == "1" ? "1" : "0"), 1)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref['content_menu_cat_icon_default'] == "2" ? "1" : "0"), 2)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref['content_menu_cat_icon_default'] == "3" ? "1" : "0"), 3)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref['content_menu_cat_icon_default'] == "4" ? "1" : "0"), 4)."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -3373,14 +3730,14 @@
 			//content_menu_cat_dropdown_ (rendertype)
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_123;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_cat_dropdown_{$id}", "1", ($content_pref["content_menu_cat_dropdown_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_76."
-			".$rs -> form_radio("content_menu_cat_dropdown_{$id}", "0", ($content_pref["content_menu_cat_dropdown_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_75."
+			".$rs -> form_radio("content_menu_cat_dropdown", "1", ($content_pref['content_menu_cat_dropdown'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_76."
+			".$rs -> form_radio("content_menu_cat_dropdown", "0", ($content_pref['content_menu_cat_dropdown'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_75."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_cat_caption_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_124;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_cat_caption_{$id}", 15, $tp->toHTML($content_pref["content_menu_cat_caption_{$id}"],"","defs"), 50);
+			$TOPIC_FIELD = $rs -> form_text("content_menu_cat_caption", 25, $tp->toHTML($content_pref['content_menu_cat_caption'],"","defs"), 50);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= $TOPIC_ROW_SPACER;
@@ -3391,55 +3748,55 @@
 			//content_menu_recent_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_125;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_recent_{$id}", "1", ($content_pref["content_menu_recent_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_recent_{$id}", "0", ($content_pref["content_menu_recent_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_recent", "1", ($content_pref['content_menu_recent'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_recent", "0", ($content_pref['content_menu_recent'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_date_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_126;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_recent_date_{$id}", "1", ($content_pref["content_menu_recent_date_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_recent_date_{$id}", "0", ($content_pref["content_menu_recent_date_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_recent_date", "1", ($content_pref['content_menu_recent_date'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_recent_date", "0", ($content_pref['content_menu_recent_date'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_datestyle_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_67;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_datestyle_{$id}", 15, $content_pref["content_menu_recent_datestyle_{$id}"], 50);
+			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_datestyle", 15, $content_pref['content_menu_recent_datestyle'], 50);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_author_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_127;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_recent_author_{$id}", "1", ($content_pref["content_menu_recent_author_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_recent_author_{$id}", "0", ($content_pref["content_menu_recent_author_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_recent_author", "1", ($content_pref['content_menu_recent_author'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_recent_author", "0", ($content_pref['content_menu_recent_author'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_subheading_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_128;
 			$TOPIC_FIELD = "
-			".$rs -> form_radio("content_menu_recent_subheading_{$id}", "1", ($content_pref["content_menu_recent_subheading_{$id}"] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
-			".$rs -> form_radio("content_menu_recent_subheading_{$id}", "0", ($content_pref["content_menu_recent_subheading_{$id}"] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
+			".$rs -> form_radio("content_menu_recent_subheading", "1", ($content_pref['content_menu_recent_subheading'] ? "1" : "0"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_30."
+			".$rs -> form_radio("content_menu_recent_subheading", "0", ($content_pref['content_menu_recent_subheading'] ? "0" : "1"), "", "").CONTENT_ADMIN_OPT_LAN_SECTION_31."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_subheading_char_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_129;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_subheading_char_{$id}", 10, $content_pref["content_menu_recent_subheading_char_{$id}"], 3);
+			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_subheading_char", 10, $content_pref['content_menu_recent_subheading_char'], 3);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_subheading_post_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_130;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_subheading_post_{$id}", 10, $tp->toHTML($content_pref["content_menu_recent_subheading_post_{$id}"],"","defs"), 30);
+			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_subheading_post", 10, $tp->toHTML($content_pref['content_menu_recent_subheading_post'],"","defs"), 30);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_number_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_131;
-			$TOPIC_FIELD = $rs -> form_select_open("content_menu_recent_number_{$id}");
+			$TOPIC_FIELD = $rs -> form_select_open("content_menu_recent_number");
 			for($i=1;$i<16;$i++){
-				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref["content_menu_recent_number_{$id}"] == $i ? "1" : "0"), $i);
+				$TOPIC_FIELD .= $rs -> form_option($i, ($content_pref['content_menu_recent_number'] == $i ? "1" : "0"), $i);
 			}
 			$TOPIC_FIELD .= $rs -> form_select_close();
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
@@ -3447,32 +3804,36 @@
 			//content_menu_recent_icon_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_132;
 			$TOPIC_FIELD = "
-			".$rs -> form_select_open("content_menu_recent_icon_{$id}")."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref["content_menu_recent_icon_{$id}"] == "0" ? "1" : "0"), 0)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref["content_menu_recent_icon_{$id}"] == "1" ? "1" : "0"), 1)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref["content_menu_recent_icon_{$id}"] == "2" ? "1" : "0"), 2)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref["content_menu_recent_icon_{$id}"] == "3" ? "1" : "0"), 3)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref["content_menu_recent_icon_{$id}"] == "4" ? "1" : "0"), 4)."
-			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_113, ($content_pref["content_menu_recent_icon_{$id}"] == "5" ? "1" : "0"), 5)."
+			".$rs -> form_select_open("content_menu_recent_icon")."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_107, ($content_pref['content_menu_recent_icon'] == "0" ? "1" : "0"), 0)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_108, ($content_pref['content_menu_recent_icon'] == "1" ? "1" : "0"), 1)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_109, ($content_pref['content_menu_recent_icon'] == "2" ? "1" : "0"), 2)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_110, ($content_pref['content_menu_recent_icon'] == "3" ? "1" : "0"), 3)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_111, ($content_pref['content_menu_recent_icon'] == "4" ? "1" : "0"), 4)."
+			".$rs -> form_option(CONTENT_ADMIN_OPT_LAN_113, ($content_pref['content_menu_recent_icon'] == "5" ? "1" : "0"), 5)."
 			".$rs -> form_select_close()."
 			";
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_icon_width_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_133;
-			$TOPIC_FIELD = CONTENT_ADMIN_OPT_LAN_134."<br /><br />".$rs -> form_text("content_menu_recent_icon_width_{$id}", 10, $content_pref["content_menu_recent_icon_width_{$id}"], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
+			$TOPIC_FIELD = CONTENT_ADMIN_OPT_LAN_134."<br /><br />".$rs -> form_text("content_menu_recent_icon_width", 10, $content_pref['content_menu_recent_icon_width'], 3)." ".CONTENT_ADMIN_OPT_LAN_61;
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			//content_menu_recent_caption_
 			$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_135;
-			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_caption_{$id}", 15, $tp->toHTML($content_pref["content_menu_recent_caption_{$id}"],"","defs"), 50);
+			$TOPIC_FIELD = $rs -> form_text("content_menu_recent_caption", 25, $tp->toHTML($content_pref['content_menu_recent_caption'],"","defs"), 50);
 			$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND);
 
 			$text .= $TOPIC_TABLE_END;
 
+			if($qs[1] != "default"){
+				$text .= "<input type='hidden' name='content_inherit' value='".$content_pref['content_inherit']."' />";
+			}
 			$text .= "
 			</form>
 			</div>";
+			//echo "<pre>"; print_r($content_pref); echo "</pre>";
 
 			$ns -> tablerender($caption, $text);
 		}
@@ -3482,7 +3843,8 @@
 			$text = "
 			<tr>
 			<td colspan='2' style='text-align:center' class='forumheader'>
-				<input class='button' type='submit' name='updateoptions' value='".CONTENT_ADMIN_OPT_LAN_2."' /> <input type='hidden' name='options_type' value='".$id."' />
+				<input class='button' type='submit' name='updateoptions' value='".CONTENT_ADMIN_OPT_LAN_2."' />
+				<input type='hidden' name='options_type' value='".$id."' />
 			</td>
 			</tr>";
 
diff -ruN 0.7.5/e107_plugins/content/handlers/content_preset.php 0.7.7/e107_plugins/content/handlers/content_preset.php
--- 0.7.5/e107_plugins/content/handlers/content_preset.php	2006-01-16 04:26:35.000000000 -0600
+++ 0.7.7/e107_plugins/content/handlers/content_preset.php	2006-07-21 04:48:54.000000000 -0500
@@ -184,7 +184,7 @@
 	<tr><td class='leftcell'>".CONTENT_PRESET_LAN_10."</td><td>".$rs -> form_text("text_size", 3, $_POST['text_size'], 3)."</td></tr>
 	<tr><td class='leftcell'>".CONTENT_PRESET_LAN_11."</td><td>".$rs -> form_text("text_maxsize", 3, $_POST['text_maxsize'], 3)."</td></tr>
 	";
-	$example = CONTENT_PRESET_LAN_32."<br /><br />".$rs -> form_text("extext", 40, "".CONTENT_PRESET_LAN_9."=".CONTENT_PRESET_LAN_32.", ".CONTENT_PRESET_LAN_10."=40, ".CONTENT_PRESET_LAN_11."=10", 10);
+	$example = CONTENT_PRESET_LAN_32."<br /><br />".$rs -> form_text("extext", 40, CONTENT_PRESET_LAN_9."=".CONTENT_PRESET_LAN_32.", ".CONTENT_PRESET_LAN_10."=40, ".CONTENT_PRESET_LAN_11."=10", 100);
 }
 
 if($qs[0] == "area"){
diff -ruN 0.7.5/e107_plugins/content/help.php 0.7.7/e107_plugins/content/help.php
--- 0.7.5/e107_plugins/content/help.php	2005-12-14 13:28:43.000000000 -0600
+++ 0.7.7/e107_plugins/content/help.php	2006-07-29 18:04:12.000000000 -0500
@@ -66,10 +66,10 @@
 			//$text = CONTENT_ADMIN_HELP_OPTION_2;
 			$text .= "
 			<div id='creationhelp'>".CONTENT_ADMIN_HELP_OPTION_DIV_1."</div>
+			<div id='catcreationhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_14."</div>
 			<div id='submissionhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_2."</div>
 			<div id='paththemehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_3."</div>
 			<div id='generalhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_4."</div>
-			<div id='contentmanagerhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_5."</div>
 			<div id='menuhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_6."</div>
 			<div id='recentpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_7."</div>
 			<div id='catpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_8."</div>
Binary files 0.7.5/e107_plugins/content/images/redo.png and 0.7.7/e107_plugins/content/images/redo.png differ
Binary files 0.7.5/e107_plugins/content/images/submit_16.png and 0.7.7/e107_plugins/content/images/submit_16.png differ
Binary files 0.7.5/e107_plugins/content/images/submit_32.png and 0.7.7/e107_plugins/content/images/submit_32.png differ
diff -ruN 0.7.5/e107_plugins/content/languages/English/lan_content.php 0.7.7/e107_plugins/content/languages/English/lan_content.php
--- 0.7.5/e107_plugins/content/languages/English/lan_content.php	2005-06-29 11:38:23.000000000 -0500
+++ 0.7.7/e107_plugins/content/languages/English/lan_content.php	2006-11-09 12:58:19.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.66 $
-|     $Date: 2005/06/29 16:38:23 $
+|     $Revision: 1.74 $
+|     $Date: 2006/11/09 18:58:19 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -13,6 +13,19 @@
 
 define("CONTENT_EMAILPRINT_LAN_1", "this content item is from");
 
+define("POPUP_LAN_1", "click to enlarge image");
+
+define("CONTENT_NOTIFY_LAN_1", "Content Events");
+define("CONTENT_NOTIFY_LAN_2", "Content item submitted by user");
+define("CONTENT_NOTIFY_LAN_3", "Content Submitted");
+
+define("CONTENT_TYPE_LAN_0", "categories");
+define("CONTENT_TYPE_LAN_1", "authors");
+define("CONTENT_TYPE_LAN_2", "archive");
+define("CONTENT_TYPE_LAN_3", "top rated");
+define("CONTENT_TYPE_LAN_4", "top score");
+define("CONTENT_TYPE_LAN_5", "recent");
+
 define("CONTENT_ICON_LAN_0", "edit");
 define("CONTENT_ICON_LAN_1", "delete");
 define("CONTENT_ICON_LAN_2", "options");
@@ -27,7 +40,7 @@
 define("CONTENT_ICON_LAN_11", "order items in category");
 define("CONTENT_ICON_LAN_12", "order items in main parent");
 define("CONTENT_ICON_LAN_13", "personal admin");
-define("CONTENT_ICON_LAN_14", "personal contentmanager");
+define("CONTENT_ICON_LAN_14", "personal content manager");
 define("CONTENT_ICON_LAN_15", "view");
 
 define("CONTENT_ADMIN_DATE_LAN_0", "January");
@@ -96,9 +109,9 @@
 define("CONTENT_LAN_10", "on");
 define("CONTENT_LAN_11", "by");
 define("CONTENT_LAN_12", "top score items");
-define("CONTENT_LAN_13", "");
-define("CONTENT_LAN_14", "");
-define("CONTENT_LAN_15", "");
+define("CONTENT_LAN_13", "list");
+define("CONTENT_LAN_14", "-- categories --");
+define("CONTENT_LAN_15", "no authors yet");
 define("CONTENT_LAN_16", "");
 define("CONTENT_LAN_17", "");
 define("CONTENT_LAN_18", "search by keyword");
@@ -173,6 +186,9 @@
 define("CONTENT_LAN_87", "Top Score Content");
 define("CONTENT_LAN_88", "no content items have a score yet");
 define("CONTENT_LAN_89", "select page");
+define("CONTENT_LAN_90", "previous page");
+define("CONTENT_LAN_91", "next page");
+define("CONTENT_LAN_92", " - current");
 
 define("CONTENT_MENU_LAN_0", "content Menu :");
 define("CONTENT_MENU_LAN_1", "no content items yet");
diff -ruN 0.7.5/e107_plugins/content/languages/English/lan_content_admin.php 0.7.7/e107_plugins/content/languages/English/lan_content_admin.php
--- 0.7.5/e107_plugins/content/languages/English/lan_content_admin.php	2006-02-13 04:48:25.000000000 -0600
+++ 0.7.7/e107_plugins/content/languages/English/lan_content_admin.php	2006-10-11 16:21:43.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.7 $
-|     $Date: 2006/02/13 10:48:25 $
+|     $Revision: 1.19 $
+|     $Date: 2006/10/11 21:21:43 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -18,6 +18,8 @@
 define("CONTENT_PLUGIN_LAN_5", "Content");
 define("CONTENT_PLUGIN_LAN_6", "Content Management Plugin table structure updated");
 
+define("CONTENT_LATEST_LAN_1", "Submitted Content Items:");
+
 define("CONTENT_ADMIN_CAT_LAN_0", "create content category");
 define("CONTENT_ADMIN_CAT_LAN_1", "edit content category");
 define("CONTENT_ADMIN_CAT_LAN_2", "heading");
@@ -52,15 +54,15 @@
 define("CONTENT_ADMIN_CAT_LAN_31", "remove");
 define("CONTENT_ADMIN_CAT_LAN_32", "clear managers");
 define("CONTENT_ADMIN_CAT_LAN_33", "assign personal content managers");
-define("CONTENT_ADMIN_CAT_LAN_34", "admins succesfully assigned to the category");
+define("CONTENT_ADMIN_CAT_LAN_34", "admins successfully assigned to the category");
 define("CONTENT_ADMIN_CAT_LAN_35", "content sub category deleted");
-define("CONTENT_ADMIN_CAT_LAN_36", "category check: there are still subcategories present, the category will NOT be deleted. first remove all subcategories and then try again.");
-define("CONTENT_ADMIN_CAT_LAN_37", "content items check: there are still content items present, the category will NOT be deleted. first remove all content items and then try again.");
+define("CONTENT_ADMIN_CAT_LAN_36", "Category check: there are still subcategories present, the category will NOT be deleted. First remove all subcategories and then try again.");
+define("CONTENT_ADMIN_CAT_LAN_37", "content items check: there are still content items present, the category will NOT be deleted. First remove all content items and then try again.");
 define("CONTENT_ADMIN_CAT_LAN_38", "content items check: no items found");
 define("CONTENT_ADMIN_CAT_LAN_39", "category check: no subcategories found");
 define("CONTENT_ADMIN_CAT_LAN_40", "Below you see a list of the main category and all subcategories if present.<br />");
 
-define("CONTENT_ADMIN_CAT_LAN_41", "The personal manager of content categories allows you to assign certain other admins to a category. With this privilige these admins can manage their own and only their own personal content items in this specified category, without the need to have control over the full content manager plugin. From the normal content page outside of the admin area they will see a personalmanager icon which redirects them to the personal manager page.");
+define("CONTENT_ADMIN_CAT_LAN_41", "The personal manager of content categories allows you to assign certain other admins to a category. With this privilege these admins can manage their own, and only their own, personal content items in this specified category, without the need to have control over the full content manager plugin. From the normal content page outside of the admin area they will see a personal manager icon which redirects them to the personal manager page.");
 define("CONTENT_ADMIN_CAT_LAN_42", "to re-edit the same category");
 
 define("CONTENT_ADMIN_CAT_LAN_43", "click here");
@@ -83,14 +85,19 @@
 define("CONTENT_ADMIN_CAT_LAN_55", "users");
 define("CONTENT_ADMIN_CAT_LAN_56", "item");
 define("CONTENT_ADMIN_CAT_LAN_57", "items");
-define("CONTENT_ADMIN_CAT_LAN_58", "category icon succesfully uploaded<br />notice: you still need to assign the icon to this category in the icon>choose existing icon area !<br />and of course after that you still need to submit the form to create/update this category");
+define("CONTENT_ADMIN_CAT_LAN_58", "category icon successfully uploaded<br />notice: you still need to assign the icon to this category in the icon>choose existing icon area !<br />and of course after that you still need to submit the form to create/update this category");
 define("CONTENT_ADMIN_CAT_LAN_59", "category icon not uploaded");
 define("CONTENT_ADMIN_CAT_LAN_60", "assign an icon");
 define("CONTENT_ADMIN_CAT_LAN_61", "upload a new icon");
 define("CONTENT_ADMIN_CAT_LAN_62", "After you have uploaded a new category icon, you can assign this icon in the below 'icon' area<br />If you upload a new icon, this icon will be scaled to 48 pixels, and additionally a small 16 pixels icon will be created as well<br /><br />");
 define("CONTENT_ADMIN_CAT_LAN_63", "upload icon");
 
-
+define("CONTENT_ADMIN_MANAGER_LAN_0", "approve submitted");
+define("CONTENT_ADMIN_MANAGER_LAN_1", "users with this class are able to approve submitted content items");
+define("CONTENT_ADMIN_MANAGER_LAN_2", "personal manager");
+define("CONTENT_ADMIN_MANAGER_LAN_3", "users with this class are able to manage only their personal content items");
+define("CONTENT_ADMIN_MANAGER_LAN_4", "category manager");
+define("CONTENT_ADMIN_MANAGER_LAN_5", "users with this class are able to manage all content items in this category");
 
 define("CONTENT_ADMIN_ITEM_LAN_0", "required field(s) left blank");
 define("CONTENT_ADMIN_ITEM_LAN_1", "content item created");
@@ -147,7 +154,7 @@
 define("CONTENT_ADMIN_ITEM_LAN_52", "submit content item");
 define("CONTENT_ADMIN_ITEM_LAN_53", "meta keywords");
 define("CONTENT_ADMIN_ITEM_LAN_54", "additional data");
-define("CONTENT_ADMIN_ITEM_LAN_55", "Go back to the <a href='".e_SELF."'>main contentmanager page</a> to manage more of your personal content<br />or<br />Go to the <a href='".e_PLUGIN."content/content.php'>content main page</a> to view content items.");
+define("CONTENT_ADMIN_ITEM_LAN_55", "Go back to the <a href='".e_SELF."'>main content manager page</a> to manage more of your personal content<br />or<br />Go to the <a href='".e_PLUGIN."content/content.php'>content main page</a> to view content items.");
 define("CONTENT_ADMIN_ITEM_LAN_56", "personal content manager");
 define("CONTENT_ADMIN_ITEM_LAN_57", "category");
 define("CONTENT_ADMIN_ITEM_LAN_58", "items");
@@ -162,7 +169,7 @@
 define("CONTENT_ADMIN_ITEM_LAN_67", "Below you see the content items listed for the selected category or narrowed down with a selected letter.<br />You can edit or delete an item by clicking the appropriate buttons on the right.");
 define("CONTENT_ADMIN_ITEM_LAN_68", "Below you have the ability to add custom data for this content item. Each custom data needs to have both a key and a value data present. You can specify the key in the left field and the corresponding value in the right field.<br />(for instance, key='photography' and value='all photos are made by me'.");
 define("CONTENT_ADMIN_ITEM_LAN_69", "Here you can upload icons, attachments and/or images to go with the content item. The allowed filetypes are : ");
-define("CONTENT_ADMIN_ITEM_LAN_70", "Seperate each word with commas, no spaces are allowed !");
+define("CONTENT_ADMIN_ITEM_LAN_70", "Separate each word with commas, no spaces are allowed !");
 define("CONTENT_ADMIN_ITEM_LAN_71", "leave if item written by you");
 define("CONTENT_ADMIN_ITEM_LAN_72", "define author details");
 define("CONTENT_ADMIN_ITEM_LAN_73", "define a start date for this item (leave if none needed)");
@@ -203,13 +210,13 @@
 define("CONTENT_ADMIN_ITEM_LAN_104", "upload");
 define("CONTENT_ADMIN_ITEM_LAN_105", "view");
 
-define("CONTENT_ADMIN_ITEM_LAN_106", "icon succesfully uploaded<br />notice: you still need to assign the icon to this content item in the 'choose an existing icon' area !<br />and of course after that you still need to submit the form to create/update the content item");
+define("CONTENT_ADMIN_ITEM_LAN_106", "icon successfully uploaded<br />notice: you still need to assign the icon to this content item in the 'choose an existing icon' area !<br />and of course after that you still need to submit the form to create/update the content item");
 define("CONTENT_ADMIN_ITEM_LAN_107", "icon not uploaded");
 
-define("CONTENT_ADMIN_ITEM_LAN_108", "attachment succesfully uploaded<br />notice: you still need to assign the attachment to this content item in the 'choose an existing attachment' area !<br />and of course after that you still need to submit the form to create/update the content item");
+define("CONTENT_ADMIN_ITEM_LAN_108", "attachment successfully uploaded<br />notice: you still need to assign the attachment to this content item in the 'choose an existing attachment' area !<br />and of course after that you still need to submit the form to create/update the content item");
 define("CONTENT_ADMIN_ITEM_LAN_109", "attachment not uploaded");
 
-define("CONTENT_ADMIN_ITEM_LAN_110", "image succesfully uploaded<br />notice: you still need to assign the image to this content item in the 'choose an existing image' area !<br />and of course after that you still need to submit the form to create/update the content item");
+define("CONTENT_ADMIN_ITEM_LAN_110", "image successfully uploaded<br />notice: you still need to assign the image to this content item in the 'choose an existing image' area !<br />and of course after that you still need to submit the form to create/update the content item");
 define("CONTENT_ADMIN_ITEM_LAN_111", "image not uploaded");
 
 define("CONTENT_ADMIN_ITEM_LAN_112", "upload an icon, attachment or image");
@@ -250,14 +257,14 @@
 define("CONTENT_ADMIN_MAIN_LAN_12", "");
 define("CONTENT_ADMIN_MAIN_LAN_13", "You can create new content items on this page. First decide the category you would like to manage content for. Click on the button of the main parents listed below to create new content in that main category.");
 define("CONTENT_ADMIN_MAIN_LAN_14", "You can set the order for content items on this page. Click on the button of the main parents listed below to start ordering content items or categories for the selected main category.");
-define("CONTENT_ADMIN_MAIN_LAN_15", "You can manage categories on this page. Choose the main category from the buttons listed below to show an overview of alle categories and subcategories within that main category.");
+define("CONTENT_ADMIN_MAIN_LAN_15", "You can manage categories on this page. Choose the main category from the buttons listed below to show an overview of all categories and subcategories within that main category.");
 define("CONTENT_ADMIN_MAIN_LAN_16", "You can create new categories on this page. By default the creation form for a new main category is shown. If you would like to create a subcategory for an existing main category, please click on one of the buttons listed below to show the creation form for a subcategory within the selected main category.");
 define("CONTENT_ADMIN_MAIN_LAN_17", "please create a new category on the <a href='".e_SELF."?type.0.cat.create'>Create New Category</a> page");
 
 define("CONTENT_ADMIN_MAIN_LAN_18", "Convert records");
 define("CONTENT_ADMIN_MAIN_LAN_19", "
 The first thing you need to do is create a backup of your existing content table as well as your comments and rate table.<br />
-Use a program to backup your content table, like phpmyadmin.<br />
+Use a program to backup your content table, like phpMyAdmin.<br />
 After you have created a backup of your old content table, you can start converting the records to the new Content Management Plugin.<br />
 After you have converted your old content, you should no longer see this information, and be able to manage your existing content.<br />
 ");
@@ -308,8 +315,7 @@
 define("CONTENT_ADMIN_MENU_LAN_20", "Top Rated Page");
 define("CONTENT_ADMIN_MENU_LAN_21", "Pages");
 define("CONTENT_ADMIN_MENU_LAN_22", "Top Score Page");
-
-
+define("CONTENT_ADMIN_MENU_LAN_23", "Admin : Create Category");
 
 define("CONTENT_ADMIN_JS_LAN_0", "Are you sure you want to delete this category?");
 define("CONTENT_ADMIN_JS_LAN_1", "Are you sure you want to delete this content?");
@@ -327,7 +333,7 @@
 
 define("CONTENT_ADMIN_SUBMIT_LAN_0", "no content categories allow user submission at this point");
 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_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.");
 define("CONTENT_ADMIN_SUBMIT_LAN_4", "required field(s) left blank");
 define("CONTENT_ADMIN_SUBMIT_LAN_5", "Go back to the <a href='".e_SELF."'>main submission page</a> to submit more content<br />or<br />Go to the <a href='".e_PLUGIN."content/content.php'>content main page</a> to view content items.");
@@ -392,7 +398,7 @@
 define("CONTENT_ADMIN_CONVERSION_LAN_41", "warning");
 define("CONTENT_ADMIN_CONVERSION_LAN_42", "conversion results of the old content table to the new content plugin table");
 define("CONTENT_ADMIN_CONVERSION_LAN_43", "press the button to convert the old content table");
-define("CONTENT_ADMIN_CONVERSION_LAN_44", "the new content table already contains data !<br />are you sure you want to convert the old content table to the new content table ?<br /><br />if you still would like to convert the table, the old content data will be added to the already existing new content table, but no garantee can be made to assure that all items will be added to already existing new categories in a correct manner !");
+define("CONTENT_ADMIN_CONVERSION_LAN_44", "the new content table already contains data !<br />are you sure you want to convert the old content table to the new content table ?<br /><br />if you still would like to convert the table, the old content data will be added to the already existing new content table, but no guarantee can be made to assure that all items will be added to already existing new categories in a correct manner !");
 define("CONTENT_ADMIN_CONVERSION_LAN_45", "insertion failed: main parent not inserted");
 define("CONTENT_ADMIN_CONVERSION_LAN_46", "Start managing your content by going to the <a href='".e_PLUGIN."content/admin_content_config.php'>Content Manager Plugin Frontpage</a> !");
 define("CONTENT_ADMIN_CONVERSION_LAN_47", "conversion completed");
@@ -406,17 +412,20 @@
 define("CONTENT_ADMIN_CONVERSION_LAN_55", "content management plugin : conversion options");
 define("CONTENT_ADMIN_CONVERSION_LAN_56", "click the button to go to the Content Create New Category page.");
 define("CONTENT_ADMIN_CONVERSION_LAN_57", "choose parent");
-define("CONTENT_ADMIN_CONVERSION_LAN_58", "upgrade succesfull<br /><br /><b>Please note:<br />you need to reconfigure the options for each main parent<br />and you need to delete the menus you've created in your content/menus folder, and recreate them by updating the options for the specific main parents you want to use menus for.</b>");
+define("CONTENT_ADMIN_CONVERSION_LAN_58", "upgrade successful<br /><br /><b>Please note:<br />you need to reconfigure the options for each main parent<br />and you need to delete the menus you've created in your content/menus folder, and recreate them by updating the options for the specific main parents you want to use menus for.</b>");
 
 define("CONTENT_ADMIN_CONVERSION_LAN_59", "convert table");
 define("CONTENT_ADMIN_CONVERSION_LAN_60", "create defaults");
 define("CONTENT_ADMIN_CONVERSION_LAN_61", "create new category");
 define("CONTENT_ADMIN_CONVERSION_LAN_62", "Content Management Plugin Version updated to version:");
 define("CONTENT_ADMIN_CONVERSION_LAN_63", "upgrade");
-define("CONTENT_ADMIN_CONVERSION_LAN_64", "");
-define("CONTENT_ADMIN_CONVERSION_LAN_65", "");
-
-
+define("CONTENT_ADMIN_CONVERSION_LAN_64", "Content Management Plugin table structure updated");
+define("CONTENT_ADMIN_CONVERSION_LAN_65", "Content Management Plugin : content_author updated");
+define("CONTENT_ADMIN_CONVERSION_LAN_66", "Content Management Plugin : content_preferences and menus updated");
+define("CONTENT_ADMIN_CONVERSION_LAN_67", "Content Management Plugin : content_preferences updated");
+define("CONTENT_ADMIN_CONVERSION_LAN_68", "Content Management Plugin : content_theme updated");
+define("CONTENT_ADMIN_CONVERSION_LAN_69", "");
+define("CONTENT_ADMIN_CONVERSION_LAN_70", "");
 
 define("CONTENT_ADMIN_OPT_LAN_MENU_1", "Options:");
 define("CONTENT_ADMIN_OPT_LAN_MENU_2", "Pages:");
@@ -438,7 +447,7 @@
 define("CONTENT_ADMIN_OPT_LAN_MENU_18", "categories");
 define("CONTENT_ADMIN_OPT_LAN_MENU_19", "recent items list");
 define("CONTENT_ADMIN_OPT_LAN_MENU_20", "links to pages");
-
+define("CONTENT_ADMIN_OPT_LAN_MENU_21", "Admin : Create Category");
 
 
 define("CONTENT_ADMIN_OPT_LAN_SECTION_0", "sections");
@@ -473,7 +482,14 @@
 define("CONTENT_ADMIN_OPT_LAN_SECTION_29", "of the list of subcategories");
 define("CONTENT_ADMIN_OPT_LAN_SECTION_30", "enabled");
 define("CONTENT_ADMIN_OPT_LAN_SECTION_31", "disabled");
-
+define("CONTENT_ADMIN_OPT_LAN_SECTION_32", "subheading");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_33", "start date");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_34", "end date");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_35", "upload icon");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_36", "assign icon");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_37", "Admin : Create Category");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_38", "summary");
+define("CONTENT_ADMIN_OPT_LAN_SECTION_39", "");
 
 
 define("CONTENT_PRESET_LAN_0", "error : fieldname not filled in");
@@ -520,12 +536,12 @@
 define("CONTENT_ADMIN_OPT_LAN_5", "number of custom data tags available");
 define("CONTENT_ADMIN_OPT_LAN_6", "preset data tags");
 define("CONTENT_ADMIN_OPT_LAN_7", "define default preset data tags");
-//define("CONTENT_ADMIN_OPT_LAN_8", "Here you can provide additional preset data tags. The fields you provide here are the keys of the key=>value data tags. They will have a input element for the value to be set in the admin creation form. You can choose from the pulldown menu which type of element you want the preset data tag to be. Note: these are not part of the amount of custom data tags you have specified above, and will be used additionally.These Preset Tags are very usefull if you want to have a certain custom tag available standard for each new item. for instance, if you always want to be able to define a value for 'photographer' you can create such a preset tag, which will always be displayed for each new item in this main parent.");
+//define("CONTENT_ADMIN_OPT_LAN_8", "Here you can provide additional preset data tags. The fields you provide here are the keys of the key=>value data tags. They will have a input element for the value to be set in the admin creation form. You can choose from the pull-down menu which type of element you want the preset data tag to be. Note: these are not part of the amount of custom data tags you have specified above, and will be used additionally. These Preset Tags are very useful if you want to have a certain custom tag available standard for each new item. For instance, if you always want to be able to define a value for 'photographer' you can create such a preset tag, which will always be displayed for each new item in this main parent.");
 define("CONTENT_ADMIN_OPT_LAN_9", "allow submit items ?");
 define("CONTENT_ADMIN_OPT_LAN_10", "who can submit items ?");
 define("CONTENT_ADMIN_OPT_LAN_11", "direct posting");
 define("CONTENT_ADMIN_OPT_LAN_12", "if enabled, a submitted item is directly added in the database and will be immediately visible, else a site admin needs to approve the item.");
-define("CONTENT_ADMIN_OPT_LAN_13", "here you can define where your images are or will be stored. use braces ( { } ) for the general e107 related path variables (like ( {e_PLUGIN} or {e_IMAGE} ). for the content category icons two versions are needed, one small and one large set of icons. The TMP paths are needed for upload, you must create these !");
+define("CONTENT_ADMIN_OPT_LAN_13", "here you can define where your images are or will be stored. use braces ( { } ) for the general e107 related path variables (like ( {e_PLUGIN} or {e_IMAGE} ). for the content category icons two versions are needed, one small and one large set of icons. The TMP paths are needed for upload, you must create these!");
 define("CONTENT_ADMIN_OPT_LAN_15", "path to content cat icons (large)");
 define("CONTENT_ADMIN_OPT_LAN_16", "path to content cat icons (small)");
 define("CONTENT_ADMIN_OPT_LAN_17", "path to content item icons");
@@ -548,11 +564,11 @@
 define("CONTENT_ADMIN_OPT_LAN_33", "top rated");
 define("CONTENT_ADMIN_OPT_LAN_34", "archive");
 define("CONTENT_ADMIN_OPT_LAN_35", "score");
-define("CONTENT_ADMIN_OPT_LAN_36", "breadcrumb seperator character");
+define("CONTENT_ADMIN_OPT_LAN_36", "breadcrumb separator character");
 define("CONTENT_ADMIN_OPT_LAN_37", "define how to render the breadcrumb information");
 define("CONTENT_ADMIN_OPT_LAN_38", "tmp");
 define("CONTENT_ADMIN_OPT_LAN_39", "echo");
-define("CONTENT_ADMIN_OPT_LAN_40", "use a seperate menu");
+define("CONTENT_ADMIN_OPT_LAN_40", "use a separate menu");
 define("CONTENT_ADMIN_OPT_LAN_41", "combine into one menu");
 define("CONTENT_ADMIN_OPT_LAN_42", "");
 define("CONTENT_ADMIN_OPT_LAN_43", "display navigator on these pages:");
@@ -575,7 +591,7 @@
 define("CONTENT_ADMIN_OPT_LAN_60", "if the uploaded icon is greater than the given value, the icon will be resized to this value.<br />the icon will also be displayed with this value.");
 define("CONTENT_ADMIN_OPT_LAN_61", "px");
 define("CONTENT_ADMIN_OPT_LAN_62", "choose managers from this userclass");
-define("CONTENT_ADMIN_OPT_LAN_63", "The userlist in the admin content manager area will consist of only the users in the defined class. You still need to assign users to each category! This class will just narrow down the list of users to choose from");
+define("CONTENT_ADMIN_OPT_LAN_63", "For several areas you can define which userclass is able to actually view the page. With these options, you can limit certain areas and certain pages from view for certain userclasses.");
 define("CONTENT_ADMIN_OPT_LAN_64", "display email of non-member author");
 define("CONTENT_ADMIN_OPT_LAN_65", "display a letter index");
 define("CONTENT_ADMIN_OPT_LAN_66", "the letterindex is a list of buttons with all the first letters of the content heading fields. you can narrow down the archive list by clicking a certain letter so only content items starting with that letter will be displayed on the screen.");
@@ -604,7 +620,7 @@
 define("CONTENT_ADMIN_OPT_LAN_89", "parents first, then items");
 define("CONTENT_ADMIN_OPT_LAN_90", "items first, then parents");
 define("CONTENT_ADMIN_OPT_LAN_91", "rendertype for parent, sub and items");
-define("CONTENT_ADMIN_OPT_LAN_92", "each in a seperate menu");
+define("CONTENT_ADMIN_OPT_LAN_92", "each in a separate menu");
 define("CONTENT_ADMIN_OPT_LAN_93", "caption");
 define("CONTENT_ADMIN_OPT_LAN_94", "add search box");
 define("CONTENT_ADMIN_OPT_LAN_95", "add sort and order box");
@@ -648,9 +664,43 @@
 define("CONTENT_ADMIN_OPT_LAN_133", "icon : width");
 define("CONTENT_ADMIN_OPT_LAN_134", "if chosen 'content icon', define the width of the icon to use");
 define("CONTENT_ADMIN_OPT_LAN_135", "caption recent item list");
-define("CONTENT_ADMIN_OPT_LAN_136", "");
-define("CONTENT_ADMIN_OPT_LAN_137", "");
-define("CONTENT_ADMIN_OPT_LAN_138", "");
-define("CONTENT_ADMIN_OPT_LAN_139", "");
-
+define("CONTENT_ADMIN_OPT_LAN_136", "Back End");
+define("CONTENT_ADMIN_OPT_LAN_137", "Front End");
+define("CONTENT_ADMIN_OPT_LAN_138", "Manage Content");
+define("CONTENT_ADMIN_OPT_LAN_139", "Create Content");
+define("CONTENT_ADMIN_OPT_LAN_140", "Manage Category");
+define("CONTENT_ADMIN_OPT_LAN_141", "Create Category");
+define("CONTENT_ADMIN_OPT_LAN_142", "Order");
+define("CONTENT_ADMIN_OPT_LAN_143", "Options");
+define("CONTENT_ADMIN_OPT_LAN_144", "Personal Content Manager");
+define("CONTENT_ADMIN_OPT_LAN_145", "Recent");
+define("CONTENT_ADMIN_OPT_LAN_146", "All Categories");
+define("CONTENT_ADMIN_OPT_LAN_147", "One Category");
+define("CONTENT_ADMIN_OPT_LAN_148", "Content Item");
+define("CONTENT_ADMIN_OPT_LAN_149", "Author Page");
+define("CONTENT_ADMIN_OPT_LAN_150", "Archive Page");
+define("CONTENT_ADMIN_OPT_LAN_151", "Top Rated Page");
+define("CONTENT_ADMIN_OPT_LAN_152", "Top Score Page");
+define("CONTENT_ADMIN_OPT_LAN_153", "Submit Page");
+define("CONTENT_ADMIN_OPT_LAN_154", "Manager Page");
+define("CONTENT_ADMIN_OPT_LAN_155", "caption");
+define("CONTENT_ADMIN_OPT_LAN_156", "caption index page");
+define("CONTENT_ADMIN_OPT_LAN_157", "caption author page");
+define("CONTENT_ADMIN_OPT_LAN_158", "append author name to caption");
+define("CONTENT_ADMIN_OPT_LAN_159", "caption category page");
+define("CONTENT_ADMIN_OPT_LAN_160", "append category heading to caption");
+define("CONTENT_ADMIN_OPT_LAN_161", "caption parent subcategories (only used if rendertype is set to separate menus)");
+define("CONTENT_ADMIN_OPT_LAN_162", "caption content items (only used if rendertype is set to separate menus)");
+define("CONTENT_ADMIN_OPT_LAN_163", "show next and previous page links");
+define("CONTENT_ADMIN_OPT_LAN_164", "caption for previous page link<br />(use {PAGETITLE} to add the title of the previous page)");
+define("CONTENT_ADMIN_OPT_LAN_165", "caption for next page link<br />(use {PAGETITLE} to add the title of the next page)");
+define("CONTENT_ADMIN_OPT_LAN_166", "use 'all' to show full text");
+define("CONTENT_ADMIN_OPT_LAN_167", "inherit");
+define("CONTENT_ADMIN_OPT_LAN_168", "first page");
+define("CONTENT_ADMIN_OPT_LAN_169", "last page");
+define("CONTENT_ADMIN_OPT_LAN_170", "where should custom and preset tags be rendered in a multipage content item ?");
+define("CONTENT_ADMIN_OPT_LAN_171", "amount of levels");
+define("CONTENT_ADMIN_OPT_LAN_172", "numeric value to show that amount of levels of subcategories of the category tree. leave blank to show all levels.");
+define("CONTENT_ADMIN_OPT_LAN_173", "include 'home' in the breadcrumb");
+define("CONTENT_ADMIN_OPT_LAN_174", "include the content start page in the breadcrumb");
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/languages/English/lan_content_help.php 0.7.7/e107_plugins/content/languages/English/lan_content_help.php
--- 0.7.5/e107_plugins/content/languages/English/lan_content_help.php	2005-06-29 18:01:57.000000000 -0500
+++ 0.7.7/e107_plugins/content/languages/English/lan_content_help.php	2006-06-22 14:49:57.000000000 -0500
@@ -4,23 +4,23 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/languages/English/lan_content_help.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2005/06/29 23:01:57 $
-|     $Author: lisa_ $
+|     $Revision: 1.16 $
+|     $Date: 2006/06/22 19:49:57 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 define("CONTENT_ADMIN_HELP_1", "Content Management Help Area");
 
-define("CONTENT_ADMIN_HELP_ITEM_1", "<i>if you have not yet added main parent categories, please do so at the <a href='".e_SELF."?cat.create'>Create New Category</a> page.</i><br /><br /><b>category</b><br />select a category from the pulldown menu to manage content for that category.<br /><br />Selecting a main parent from the pulldown menu will show all content items in that main category.<br />Selecting a subcategory will show only those content items in the specified subcategory.<br /><br />You can also use the menu on the right to view all content items for a specified category.");
+define("CONTENT_ADMIN_HELP_ITEM_1", "<i>if you have not yet added main parent categories, please do so at the <a href='".e_SELF."?cat.create'>Create New Category</a> page.</i><br /><br /><b>category</b><br />select a category from the pull-down menu to manage content for that category.<br /><br />Selecting a main parent from the pull-down menu will show all content items in that main category.<br />Selecting a subcategory will show only those content items in the specified subcategory.<br /><br />You can also use the menu on the right to view all content items for a specified category.");
 
 define("CONTENT_ADMIN_HELP_ITEM_2", "<b>first letters</b><br />if multiple content item starting letters of the content_heading are present, you will see buttons to select only those content items starting with that letter. Selecting the 'all' button will show a list containing all content items in this category.<br /><br /><b>detailed list</b><br />You see a list of all content items with their id, icon, author, heading [subheading] and options.<br /><br /><b>explanation of icons</b><br />".CONTENT_ICON_USER." : link to the author profile<br />".CONTENT_ICON_LINK." : link to the content item<br />".CONTENT_ICON_EDIT." : edit the content item<br />".CONTENT_ICON_DELETE." : delete the content item<br />");
 
-define("CONTENT_ADMIN_HELP_ITEMEDIT_1", "<b>edit form</b><br />you can now edit all information for this content item and submit your changes.<br /><br />If you need to change the category for this content item, please do so first. After you have selectd the correct category, change or add any fields present, before you submit the changes.");
+define("CONTENT_ADMIN_HELP_ITEMEDIT_1", "<b>edit form</b><br />you can now edit all information for this content item and submit your changes.<br /><br />If you need to change the category for this content item, please do so first. After you have selected the correct category, change or add any fields present, before you submit the changes.");
 
 define("CONTENT_ADMIN_HELP_ITEMCREATE_1", "<b>category</b><br />please select a category from the select box to create your content item for.<br />");
 
-define("CONTENT_ADMIN_HELP_ITEMCREATE_2", "<b>creation form</b><br />you can now provide all information for this content item and submit it.<br /><br />Be aware of the fact that diffenent main parent categories can have a different set of preferences; different fields can be available for you to fill in. Therefore you always need to select a category first before you fill in other fields !");
+define("CONTENT_ADMIN_HELP_ITEMCREATE_2", "<b>creation form</b><br />you can now provide all information for this content item and submit it.<br /><br />Be aware of the fact that different main parent categories can have a different set of preferences; different fields can be available for you to fill in. Therefore you always need to select a category first before you fill in other fields!");
 
 define("CONTENT_ADMIN_HELP_CAT_1", "<i>this page shows all categories and subcategories present.</i><br /><br /><b>detailed list</b><br />You see a list of all subcategories with their id, icon, author, category [subheading] and options.<br /><br /><b>explanation of icons</b><br />".CONTENT_ICON_USER." : link to the author profile<br />".CONTENT_ICON_LINK." : link to the category<br />".CONTENT_ICON_EDIT." : edit the category<br />".CONTENT_ICON_DELETE." : delete the category<br />");
 
@@ -37,13 +37,15 @@
 define("CONTENT_ADMIN_HELP_OPTION_1", "On this page you can select a main parent category to set options for, or you can choose to edit the default preferences.<br /><br /><b>explanation of icons</b><br />".CONTENT_ICON_USER." : link to the author profile<br />".CONTENT_ICON_LINK." : link to the category<br />".CONTENT_ICON_OPTIONS." : edit the options<br /><br /><br />
 The default preferences are only used when you create a new main parent. So when you create a new main parent these default preferences will be stored. You can change these to make sure newly created main parents already have a certain set of features present.
 <br /><br />
-Each main parent has its own set of options, which are unique to that specific main parent category");
+Each main parent has its own set of options, which are unique to that specific main parent category<br /><br />
+<b>inherit</b><br />The inherit checkboxes allow you to override the main parents individual options, and use the default preferences for the checked main parents.");
 
 //define("CONTENT_ADMIN_HELP_OPTION_2", "<i>this page shows the options you can set for this main parent. Each main parent has their own specific set of options, so be sure to set them all correctly.</i><br /><br />");
 //<b>default values</b><br />By default all values are present and already updated in the preferences when you view this page, but change any setting to your own standards.<br /><br />
-define("CONTENT_ADMIN_HELP_MANAGER_1", "On this page you see a list of all categories. You can manage the 'personal content manager' for each category by clicking the icon.<br /><br /><b>explanation of icons</b><br />".CONTENT_ICON_USER." : link to the author profile<br />".CONTENT_ICON_LINK." : link to the category<br />".CONTENT_ICON_CONTENTMANAGER_SMALL." : edit the personal content managers<br />");
+define("CONTENT_ADMIN_HELP_MANAGER_1", "On this page you see a list of all categories. You can manage the 'personal content manager' for each category by clicking the icon.<br /><br /><b>explanation of icons</b><br />".CONTENT_ICON_LINK." : link to the category<br />".CONTENT_ICON_CONTENTMANAGER_SMALL." : edit the personal content managers<br />");
+
+define("CONTENT_ADMIN_HELP_MANAGER_2", "<i>on this page you can assign the userclasses to the selected category you have clicked</i><br /><br /><b>personal manager</b><br />You can define classes for the different types of personal managers. currently there are three types of managers you can define:<br /><br />approve submitted: users with this class are able to approve submitted content items<br /><br />personal manager: users with this class are able to manage only their personal content items<br /><br />category manager: users with this class are able to manage all content items in this category<br />");
 
-define("CONTENT_ADMIN_HELP_MANAGER_2", "<i>on this page you can assign users to the selected category you have clicked</i><br /><br /><b>personal manager</b><br />you can assign users to certain categories. In doing so, these users can manage their personal content items within these categories from outside of the admin page (content_manager.php).<br /><br />Assign users from the left colomn by clicking their name. you will see these names move to the right colomn. After clicking the assign button the users in the right colomn are assigned to this category.");
 
 define("CONTENT_ADMIN_HELP_SUBMIT_1", "<i>On this page you see a list of all content items that were submitted by users.</i><br /><br /><b>detailed list</b><br />You see a list of these content items with their id, icon, main parent, heading [subheading], author and options.<br /><br /><b>options</b><br />you can post or delete a content item using the buttons shown.");
 
@@ -57,7 +59,7 @@
 
 define("CONTENT_ADMIN_HELP_OPTION_DIV_4", "The General Options are options that are used throughout the content pages of the content management plugin.");
 
-define("CONTENT_ADMIN_HELP_OPTION_DIV_5", "These options have affect on the Personal Content Manager area on the content management admin area.<br /><br />".CONTENT_ADMIN_OPT_LAN_63."");
+define("CONTENT_ADMIN_HELP_OPTION_DIV_5", "");
 
 define("CONTENT_ADMIN_HELP_OPTION_DIV_6", "These Options are used in the Menu for this main parent if you have activated the menu.<br /><br />".CONTENT_ADMIN_OPT_LAN_68."<br /><br />".CONTENT_ADMIN_OPT_LAN_118.":<br />".CONTENT_ADMIN_OPT_LAN_119."<br /><br />");
 
@@ -65,14 +67,15 @@
 
 define("CONTENT_ADMIN_HELP_OPTION_DIV_8", "The Category Pages show information on the content categories in this main parent.<br /><br />There are two distinct areas present:<br /><br />all categories page:<br />this page shows all the categories in this main parent<br /><br />view category page:<br />this page shows the category item, optionally the subcategories in that category and the content items in that category or those categories<br />");
 
-define("CONTENT_ADMIN_HELP_OPTION_DIV_9", "The Content Page shows the Content Item.<br /><br />you can define which sections to show by checking/unchecking the boxes.<br /><br />you can show the emailaddress of a non-member author.<br /><br />you can override the email/print/pdf icons, the rating system and the comments.<br /><br />".CONTENT_ADMIN_OPT_LAN_74."");
+define("CONTENT_ADMIN_HELP_OPTION_DIV_9", "The Content Page shows the Content Item.<br /><br />you can define which sections to show by checking/unchecking the boxes.<br /><br />you can show the email address of a non-member author.<br /><br />you can override the email/print/pdf icons, the rating system and the comments.<br /><br />".CONTENT_ADMIN_OPT_LAN_74."");
 
 define("CONTENT_ADMIN_HELP_OPTION_DIV_10", "The Author Page shows a list of all unique authors of the content items in this main parent.<br /><br />you can define which sections to show by checking/unchecking the boxes.<br /><br />You can limit the number of items to show per page.<br />");
 
-define("CONTENT_ADMIN_HELP_OPTION_DIV_11", "The Archive Page shows all content items in the main parent.<br /><br />you can define which sections to show by checking/unchecking the boxes.<br /><br />you can show the emailaddress of a non-member author.<br /><br />You can limit the number of items to show per page.<br /><br />".CONTENT_ADMIN_OPT_LAN_66."<br /><br />".CONTENT_ADMIN_OPT_LAN_68."");
+define("CONTENT_ADMIN_HELP_OPTION_DIV_11", "The Archive Page shows all content items in the main parent.<br /><br />you can define which sections to show by checking/unchecking the boxes.<br /><br />you can show the email address of a non-member author.<br /><br />You can limit the number of items to show per page.<br /><br />".CONTENT_ADMIN_OPT_LAN_66."<br /><br />".CONTENT_ADMIN_OPT_LAN_68."");
 
-define("CONTENT_ADMIN_HELP_OPTION_DIV_12", "The Top Rated Page shows all content items that have been rated by users.<br /><br />You can choose the sections to display by checking the boxes.<br /><br />Also you can define if the emailaddress of a non-member author will be displayed.");
+define("CONTENT_ADMIN_HELP_OPTION_DIV_12", "The Top Rated Page shows all content items that have been rated by users.<br /><br />You can choose the sections to display by checking the boxes.<br /><br />Also you can define if the email address of a non-member author will be displayed.");
 
-define("CONTENT_ADMIN_HELP_OPTION_DIV_13", "The Top Score Page shows all content items that have been given a score by the author of the content item.<br /><br />You can choose the sections to display by checking the boxes.<br /><br />Also you can define if the emailaddress of a non-member author will be displayed.");
+define("CONTENT_ADMIN_HELP_OPTION_DIV_13", "The Top Score Page shows all content items that have been given a score by the author of the content item.<br /><br />You can choose the sections to display by checking the boxes.<br /><br />Also you can define if the email address of a non-member author will be displayed.");
 
+define("CONTENT_ADMIN_HELP_OPTION_DIV_14", "this page allows you to set options for the admin create category page.<br /><br />You can define which sections are available when an admin (or personal content manager) creates a new content category.");
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/languages/English/lan_content_search.php 0.7.7/e107_plugins/content/languages/English/lan_content_search.php
--- 0.7.5/e107_plugins/content/languages/English/lan_content_search.php	2005-06-15 10:18:40.000000000 -0500
+++ 0.7.7/e107_plugins/content/languages/English/lan_content_search.php	2006-09-18 03:57:42.000000000 -0500
@@ -4,14 +4,15 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/languages/English/lan_content_search.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/06/15 15:18:40 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/09/18 08:57:42 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 define("CONT_SCH_LAN_1", "Content");
 define("CONT_SCH_LAN_2", "All Content Categories");
 define("CONT_SCH_LAN_3", "Posted in reply to item");
+define("CONT_SCH_LAN_4", "in");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/plugin.php 0.7.7/e107_plugins/content/plugin.php
--- 0.7.5/e107_plugins/content/plugin.php	2006-02-13 04:48:25.000000000 -0600
+++ 0.7.7/e107_plugins/content/plugin.php	2006-08-25 10:37:54.000000000 -0500
@@ -16,12 +16,12 @@
 if (!defined('e107_INIT')) { exit; }
 
 global $PLUGINS_DIRECTORY;
-$lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content_admin.php");
+@include_once(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content_admin.php');
+@include_once(e_PLUGIN.'content/languages/English/lan_content_admin.php');
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = CONTENT_PLUGIN_LAN_1;
-$eplug_version = "1.21";
+$eplug_name = "CONTENT_PLUGIN_LAN_1";
+$eplug_version = "1.24";
 $eplug_author = "Eric Vanderfeesten (lisa)";
 $eplug_logo = "";
 $eplug_url = "http://eindhovenseschool.net";
@@ -49,11 +49,6 @@
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array();
 
-// List of comment_type ids used by this plugin. ----------------------------- 
-$eplug_comment_ids = array("pcontent");
-
-// List of bbcode -----------------------------------------------------------------------------------------------
-//$eplug_bb = array('pcontent');
 
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
@@ -87,8 +82,8 @@
 	content_layout varchar(255) NOT NULL default '',
 	PRIMARY KEY  (content_id)
 	) TYPE=MyISAM;",
-	"INSERT INTO ".MPREFIX."pcontent VALUES (1, 'content', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '1', '0', '', '')", 
-	"INSERT INTO ".MPREFIX."pcontent VALUES (2, 'article', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '2', '0', '', '')", 
+	"INSERT INTO ".MPREFIX."pcontent VALUES (1, 'content', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '1', '0', '', '')",
+	"INSERT INTO ".MPREFIX."pcontent VALUES (2, 'article', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '2', '0', '', '')",
 	"INSERT INTO ".MPREFIX."pcontent VALUES (3, 'review', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '3', '0', '', '')"
 );
 
diff -ruN 0.7.5/e107_plugins/content/search/search_parser.php 0.7.7/e107_plugins/content/search/search_parser.php
--- 0.7.5/e107_plugins/content/search/search_parser.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/search/search_parser.php	2006-09-18 03:57:42.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/search/search_parser.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/09/18 08:57:42 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -46,13 +46,38 @@
 $text .= $ps['text'];
 $results = $ps['results'];
 
+
 function search_content($row) {
-	global $con;
+	global $con, $sql;
 	$res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
 	$res['pre_title'] = "";
 	$res['title'] = $row['content_heading'];
 	$res['summary'] = $row['content_summary'].' '.$row['content_text'];
-	$res['detail'] = LAN_SEARCH_3.$con -> convert_date($row['content_datestamp'], "long");
+	
+	//get category heading
+	if($row['content_parent'] == '0'){
+		$qry = "
+		SELECT c.content_heading
+		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
+		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
+		WHERE c.content_id = '".$row['content_id']."' ";
+	}
+	
+	$sql -> db_Select_gen($qry);
+	$cat = $sql -> db_Fetch();
+
+	$res['detail'] = LAN_SEARCH_3.$con -> convert_date($row['content_datestamp'], "long")." ".CONT_SCH_LAN_4." ".$cat['content_heading'];
 	return $res;
 }
 
diff -ruN 0.7.5/e107_plugins/content/templates/content_manager_template.php 0.7.7/e107_plugins/content/templates/content_manager_template.php
--- 0.7.5/e107_plugins/content/templates/content_manager_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/content_manager_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,13 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/content_manager_template.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 // ##### CONTENT CONTENTMANAGER LIST --------------------------------------------------
@@ -33,9 +31,10 @@
 	$CONTENT_CONTENTMANAGER_TABLE = "
 	<tr>
 		<td class='forumheader3'>{CONTENT_CONTENTMANAGER_CATEGORY}</td>
-		<td class='forumheader3' style='width:10%;'>{CONTENT_CONTENTMANAGER_ICONEDIT} {CONTENT_CONTENTMANAGER_ICONNEW}</td>
+		<td class='forumheader3' style='width:10%;white-space:nowrap;'>{CONTENT_CONTENTMANAGER_ICONEDIT} {CONTENT_CONTENTMANAGER_ICONNEW} {CONTENT_CONTENTMANAGER_ICONSUBM}</td>
 	</tr>";
 }
+
 if(!isset($CONTENT_CONTENTMANAGER_TABLE_END)){
 	$CONTENT_CONTENTMANAGER_TABLE_END = "
 	</table>";
diff -ruN 0.7.5/e107_plugins/content/templates/content_submit_type_template.php 0.7.7/e107_plugins/content/templates/content_submit_type_template.php
--- 0.7.5/e107_plugins/content/templates/content_submit_type_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/content_submit_type_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,13 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/content_submit_type_template.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_SUBMIT_TYPE_TABLE_ICON']['pre'] = "";
diff -ruN 0.7.5/e107_plugins/content/templates/content_type_template.php 0.7.7/e107_plugins/content/templates/content_type_template.php
--- 0.7.5/e107_plugins/content/templates/content_type_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/content_type_template.php	2006-08-08 02:09:35.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/content_type_template.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/08/08 07:09:35 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_TYPE_TABLE_TOTAL']['pre'] = "";
@@ -30,6 +28,9 @@
 $sc_style['CONTENT_TYPE_TABLE_SUBHEADING']['pre'] = "";
 $sc_style['CONTENT_TYPE_TABLE_SUBHEADING']['post'] = "";
 
+$sc_style['CONTENT_TYPE_TABLE_LINK']['pre'] = "<br /><span class='smalltext'>";
+$sc_style['CONTENT_TYPE_TABLE_LINK']['post'] = "</span>";
+
 // ##### CONTENT TYPE LIST --------------------------------------------------
 if(!isset($CONTENT_TYPE_TABLE_START)){
 	$CONTENT_TYPE_TABLE_START = "
@@ -39,7 +40,7 @@
 	$CONTENT_TYPE_TABLE = "
 	<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}</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>
 	</tr>
 	<tr><td class='forumheader2' colspan='2'>{CONTENT_TYPE_TABLE_SUBHEADING}<br /></td></tr>\n";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_archive_template.php 0.7.7/e107_plugins/content/templates/default/content_archive_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_archive_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_archive_template.php	2006-06-03 05:27:54.000000000 -0500
@@ -11,27 +11,25 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_archive_template.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/06/03 10:27:54 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_ARCHIVE_TABLE_AUTHOR']['pre'] = "<tr><td class='forumheader3' colspan='2' style='white-space:nowrap; text-align:left;'>".CONTENT_LAN_11." ";
 $sc_style['CONTENT_ARCHIVE_TABLE_AUTHOR']['post'] = "</td></tr>";
 
-$sc_style['CONTENT_ARCHIVE_TABLE_LETTERS']['pre'] = "<tr><td class='forumheader3' colspan='2'>";
-$sc_style['CONTENT_ARCHIVE_TABLE_LETTERS']['post'] = "</td></tr>";
+$sc_style['CONTENT_ARCHIVE_TABLE_LETTERS']['pre'] = "<div style='margin-bottom:20px;'>";
+$sc_style['CONTENT_ARCHIVE_TABLE_LETTERS']['post'] = "</div>";
 
 // ##### CONTENT ARCHIVE --------------------------------------------------
 if(!isset($CONTENT_ARCHIVE_TABLE_START)){
 	$CONTENT_ARCHIVE_TABLE_START = "
-	<table class='fborder'>
 	{CONTENT_ARCHIVE_TABLE_LETTERS}
+	<table class='fborder'>
 	";
 }
 if(!isset($CONTENT_ARCHIVE_TABLE)){
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_author_template.php 0.7.7/e107_plugins/content/templates/default/content_author_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_author_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_author_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,13 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_author_template.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_AUTHOR_TABLE_LASTITEM']['pre'] = "<tr><td class='forumheader3'>".CONTENT_LAN_55." ";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_cat_template.php 0.7.7/e107_plugins/content/templates/default/content_cat_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_cat_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_cat_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_cat_template.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.19 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_CAT_TABLE_ICON']['pre'] = "<td class='forumheader3' rowspan='5' style='width:5%; white-space:nowrap; padding-right:5px;'>";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_content_template.php 0.7.7/e107_plugins/content/templates/default/content_content_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_content_template.php	2006-01-13 14:03:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_content_template.php	2006-06-05 06:27:57.000000000 -0500
@@ -11,14 +11,12 @@
 |     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.23 $
-|     $Date: 2006/01/13 20:03:44 $
+|     $Revision: 1.25 $
+|     $Date: 2006/06/05 11:27:57 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 // ##### CONTENT CONTENT ------------------------------------------------------
 global $sc_style, $content_shortcodes;
 
@@ -75,34 +73,36 @@
 $sc_style['CONTENT_CONTENT_TABLE_ICON']['pre'] = "<td style='width:10%; white-space:nowrap; vertical-align:top; padding-right:10px;'>";
 $sc_style['CONTENT_CONTENT_TABLE_ICON']['post'] = "</td>";
 
-$sc_style['CONTENT_CONTENT_TABLE_INFO_PRE']['pre'] = "<table cellpadding='0' cellspacing='0' style='width:100%; margin-bottom:10px;'><tr>";
+$sc_style['CONTENT_CONTENT_TABLE_INFO_PRE']['pre'] = "<table cellpadding='0' cellspacing='0' style='width:100%; margin-bottom:20px;'><tr>";
 $sc_style['CONTENT_CONTENT_TABLE_INFO_PRE']['post'] = "";
 $sc_style['CONTENT_CONTENT_TABLE_INFO_POST']['pre'] = "";
-$sc_style['CONTENT_CONTENT_TABLE_INFO_POST']['post'] = "</tr></table><div style='clear:both;'><br /></div>";
-
-$sc_style['CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA']['pre'] = "<td style='vertical-align:top;' class='forumheader3'>";
-$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>";
+$sc_style['CONTENT_CONTENT_TABLE_INFO_POST']['post'] = "</tr></table>";
 
+$sc_style['CONTENT_CONTENT_TABLE_PREV_PAGE']['pre'] = "<div style='clear:both; padding-bottom:20px; padding-top:20px;'><div style='float:left;'>";
+$sc_style['CONTENT_CONTENT_TABLE_PREV_PAGE']['post'] = "</div>";
+$sc_style['CONTENT_CONTENT_TABLE_NEXT_PAGE']['pre'] = "<div style='float:right;'>";
+$sc_style['CONTENT_CONTENT_TABLE_NEXT_PAGE']['post'] = "</div></div>";
 
-$CONTENT_CONTENT_TABLE = "<table class='fborder' cellpadding='0' cellspacing='0' style='margin-bottom:20px;'><tr><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}
-		{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}
+		<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_POST}
-	<table cellpadding='0' cellspacing='0' style='width:100%;'><tr><td class='forumheader3'>
+	<div style='clear:both;'><br /></div>
+	<table class='fborder' cellpadding='0' cellspacing='0' style='width:100%;'><tr><td class='forumheader3'>
 		{CONTENT_CONTENT_TABLE_IMAGES}
 		{CONTENT_CONTENT_TABLE_SUMMARY}
 		{CONTENT_CONTENT_TABLE_TEXT}
 		{CONTENT_CONTENT_TABLE_CUSTOM_TAGS}
 		{CONTENT_CONTENT_TABLE_PAGENAMES}
+		{CONTENT_CONTENT_TABLE_PREV_PAGE}{CONTENT_CONTENT_TABLE_NEXT_PAGE}
 	</td></tr></table>
 </div>
 </td></tr></table>\n";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_content_template_bigtext.php 0.7.7/e107_plugins/content/templates/default/content_content_template_bigtext.php
--- 0.7.5/e107_plugins/content/templates/default/content_content_template_bigtext.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_content_template_bigtext.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_content_template_bigtext.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 // ##### CONTENT CONTENT ------------------------------------------------------
 global $sc_style, $content_shortcodes;
 
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_content_template_blackonwhite.php 0.7.7/e107_plugins/content/templates/default/content_content_template_blackonwhite.php
--- 0.7.5/e107_plugins/content/templates/default/content_content_template_blackonwhite.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_content_template_blackonwhite.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_content_template_blackonwhite.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 // ##### CONTENT CONTENT ------------------------------------------------------
 global $sc_style, $content_shortcodes;
 
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_content_template_whiteonblack.php 0.7.7/e107_plugins/content/templates/default/content_content_template_whiteonblack.php
--- 0.7.5/e107_plugins/content/templates/default/content_content_template_whiteonblack.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_content_template_whiteonblack.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_content_template_whiteonblack.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 // ##### CONTENT CONTENT ------------------------------------------------------
 global $sc_style, $content_shortcodes;
 
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_np_template.php 0.7.7/e107_plugins/content/templates/default/content_np_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_np_template.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_np_template.php	2006-06-02 07:25:36.000000000 -0500
@@ -0,0 +1,28 @@
+<?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/content/templates/default/content_np_template.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/06/02 12:25:36 $
+|     $Author: lisa_ $
++----------------------------------------------------------------------------+
+*/
+
+global $sc_style, $content_shortcodes;
+
+// ##### CONTENT NEXT PREV --------------------------------------------------
+if(!isset($CONTENT_NP_TABLE)){
+	$CONTENT_NP_TABLE = "<div class='nextprev'>{CONTENT_NEXTPREV}</div>";
+}
+// ##### ----------------------------------------------------------------------
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_recent_template.php 0.7.7/e107_plugins/content/templates/default/content_recent_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_recent_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_recent_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     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.19 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.20 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 // ##### CONTENT RECENT LIST --------------------------------------------------
 
 
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_score_template.php 0.7.7/e107_plugins/content/templates/default/content_score_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_score_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_score_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_score_template.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_SCORE_TABLE_ICON']['pre'] = "<td class='forumheader3' rowspan='3' style='width:5%; white-space:nowrap;'>";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_search_template.php 0.7.7/e107_plugins/content/templates/default/content_search_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_search_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_search_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,13 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_search_template.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_SEARCH_TABLE_SELECT']['pre'] = "<td style='width:10%; white-space:nowrap; padding-right:10px;'>";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_searchresult_template.php 0.7.7/e107_plugins/content/templates/default/content_searchresult_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_searchresult_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_searchresult_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_searchresult_template.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_SEARCHRESULT_TABLE_ICON']['pre'] = "<td class='forumheader3'>";
diff -ruN 0.7.5/e107_plugins/content/templates/default/content_top_template.php 0.7.7/e107_plugins/content/templates/default/content_top_template.php
--- 0.7.5/e107_plugins/content/templates/default/content_top_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/content/templates/default/content_top_template.php	2006-05-31 16:29:59.000000000 -0500
@@ -11,14 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/templates/default/content_top_template.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2006/05/31 21:29:59 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
-
 global $sc_style, $content_shortcodes;
 
 $sc_style['CONTENT_TOP_TABLE_ICON']['pre'] = "<td class='forumheader3' rowspan='3' style='width:5%; white-space:nowrap;'>";
diff -ruN 0.7.5/e107_plugins/featurebox/e_rss.php 0.7.7/e107_plugins/featurebox/e_rss.php
--- 0.7.5/e107_plugins/featurebox/e_rss.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/featurebox/e_rss.php	2006-07-07 22:18:25.000000000 -0500
@@ -0,0 +1,43 @@
+<?php
+
+if (!defined('e107_INIT')) { exit; }
+
+
+
+//##### create feed for admin, return array $eplug_rss_feed --------------------------------
+$feed['name']		= 'Featurebox';
+$feed['url']		= 'featurebox';			//the identifier for the rss feed url
+$feed['topic_id']	= '';					//the topic_id, empty on default (to select a certain category)
+$feed['path']		= 'featurebox';			//this is the plugin path location
+$feed['text']		= 'this is the rss feed for the featurebox entries';
+$feed['class']		= '0';
+$feed['limit']		= '9';
+$eplug_rss_feed[] = $feed;
+//##### ------------------------------------------------------------------------------------
+
+
+//##### create rss data, return as array $eplug_rss_data -----------------------------------
+$rss = array();
+$sqlrss = new db;
+if($items = $sqlrss -> db_Select('featurebox', "*", "fb_class = 0 DESC LIMIT 0,".$this->limit )){
+	$i=0;
+	while($rowrss = $sqlrss -> db_Fetch()){
+		$rss[$i]['author']			= '';
+		$rss[$i]['author_email']	= '';
+		$rss[$i]['link']			= '';
+		$rss[$i]['linkid']			= '';
+		$rss[$i]['title']			= $rowrss['fb_title'];
+		$rss[$i]['description']		= $rowrss['fb_text'];
+		$rss[$i]['category_name']	= '';
+		$rss[$i]['category_link']	= '';
+		$rss[$i]['datestamp']		= '';
+		$rss[$i]['enc_url']			= '';
+		$rss[$i]['enc_leng']		= '';
+		$rss[$i]['enc_type']		= '';
+		$i++;
+	}
+}
+$eplug_rss_data[] = $rss;
+//##### ------------------------------------------------------------------------------------
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/featurebox/plugin.php 0.7.7/e107_plugins/featurebox/plugin.php
--- 0.7.5/e107_plugins/featurebox/plugin.php	2006-01-22 01:08:15.000000000 -0600
+++ 0.7.7/e107_plugins/featurebox/plugin.php	2006-07-13 16:14:05.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/featurebox/plugin.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/01/22 07:08:15 $
+|     $Revision: 1.7 $
+|     $Date: 2006/07/13 21:14:05 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -41,7 +41,6 @@
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "admin_config.php";
 
-$eplug_sc = array("");
 
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/featurebox_32.png";
@@ -67,22 +66,6 @@
   PRIMARY KEY  (fb_id)
 ) TYPE=MyISAM AUTO_INCREMENT=1 ;");
 
-$eplug_rss['featurebox'] = array(
-	"query" => "SELECT * FROM #featurebox WHERE fb_class = 0",
-	"author" => "",
-	"link" => "",
-	"itemid" => "",
-	"title" => "fb_title",
-	"description" => "fb_text",
-	"categoryid" => "",
-	"categoryname" => "",
-	"categorylink" => "",
-	"datestamp" => "",
-	"enc_url" => "",
-	"enc_leng" => "",
-	"enc_type" => ""
-);
-
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
 $eplug_link_name = "";
diff -ruN 0.7.5/e107_plugins/forum/e_emailprint.php 0.7.7/e107_plugins/forum/e_emailprint.php
--- 0.7.5/e107_plugins/forum/e_emailprint.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/forum/e_emailprint.php	2006-11-14 06:50:10.000000000 -0600
@@ -31,11 +31,27 @@
 
 function email_item($thread_id)
 {
+	global $tp;
+	$gen = new convert;
 	include_once(e_PLUGIN.'forum/forum_class.php');
 	$forum = new e107forum;
 	$thread_info = $forum->thread_get($thread_id,0,999);
-	
-	return "<pre>".print_r($thread_info,TRUE)."</pre>";
+
+	$thread_name = $tp -> toHTML($thread_info[0]['thread_name'], TRUE);
+	$text = "<b>".$thread_name."</b><br />
+	".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."<br /><br />
+	".$tp -> toHTML($thread_info[0]['thread_thread'], TRUE);
+
+	$count = 1;
+
+	unset($thread_info[0], $thread_info['head']);
+	foreach($thread_info as $reply)
+	{
+		$text .= "<br /><br />Re: <b>".$thread_name."</b><br />
+		".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."<br /><br />
+		".$tp -> toHTML($reply['thread_thread'], TRUE);
+	}
+	return $text;
 }
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/forum/e_latest.php 0.7.7/e107_plugins/forum/e_latest.php
--- 0.7.5/e107_plugins/forum/e_latest.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/forum/e_latest.php	2006-10-25 12:05:15.000000000 -0500
@@ -6,10 +6,10 @@
 <img src='".e_PLUGIN."forum/images/forums_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ";
 
 if ($reported_posts) {
-	$text .= "<a href='".e_PLUGIN."forum/forum_admin.php?sr'>Reported forum posts: ".$reported_posts."</a>";
+	$text .= "<a href='".e_PLUGIN."forum/forum_admin.php?sr'>".ADLAN_LAT_6.": ".$reported_posts."</a>";
 } else {
-	$text .= 'Reported forum posts: '.$reported_posts;
+	$text .= ADLAN_LAT_6.": ".$reported_posts;
 }
 
 $text .= '</div>';
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/forum/e_rss.php 0.7.7/e107_plugins/forum/e_rss.php
--- 0.7.5/e107_plugins/forum/e_rss.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/forum/e_rss.php	2006-07-07 22:18:25.000000000 -0500
@@ -0,0 +1,276 @@
+<?php
+
+if (!defined('e107_INIT')) { exit; }
+
+
+
+//##### create feed for admin, return array $eplug_rss_feed --------------------------------
+$feed = get_forum_rss();
+foreach($feed as $k=>$v){
+	$eplug_rss_feed[] = $v;
+}
+
+function get_forum_rss(){
+	$rss = array();
+
+	//forum threads (old url)
+	$feed['name']			= "Forum / threads";
+	$feed['url']			= '6';
+	$feed['topic_id']		= '';
+	$feed['path']			= 'forum|threads';
+	$feed['text']			= 'this is the rss feed for the forum_threads entries';
+	$feed['class']			= '1';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum threads (new url)
+	$feed['name']			= "Forum / threads";
+	$feed['url']			= 'forumthreads';
+	$feed['topic_id']		= '';
+	$feed['path']			= 'forum|threads';
+	$feed['text']			= 'this is the rss feed for the forum_threads entries';
+	$feed['class']			= '0';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum posts (old url)
+	$feed['name']			= "Forum / posts";
+	$feed['url']			= '7';
+	$feed['topic_id']		= '';
+	$feed['path']			= 'forum|posts';
+	$feed['text']			= 'this is the rss feed for the forum_posts entries';
+	$feed['class']			= '1';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum posts (new url)
+	$feed['name']			= "Forum / posts";
+	$feed['url']			= 'forumposts';
+	$feed['topic_id']		= '';
+	$feed['path']			= 'forum|posts';
+	$feed['text']			= 'this is the rss feed for the forum_posts entries';
+	$feed['class']			= '0';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum topic (old url)
+	$feed['name']			= "Forum / topic";
+	$feed['url']			= '8';
+	$feed['topic_id']		= '*';
+	$feed['path']			= 'forum|topic';
+	$feed['text']			= 'this is the rss feed for the forum_topic entries';
+	$feed['class']			= '1';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum topic (new url)
+	$feed['name']			= "Forum / topic";
+	$feed['url']			= 'forumtopic';
+	$feed['topic_id']		= '*';
+	$feed['path']			= 'forum|topic';
+	$feed['text']			= 'this is the rss feed for the forum_topic entries';
+	$feed['class']			= '0';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum name (old url)
+	$feed['name']			= "Forum / name";
+	$feed['url']			= '11';
+	$feed['topic_id']		= '*';
+	$feed['path']			= 'forum|name';
+	$feed['text']			= 'this is the rss feed for the forum_name entries';
+	$feed['class']			= '1';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	//forum name (new url)
+	$feed['name']			= "Forum / name";
+	$feed['url']			= 'forumname';
+	$feed['topic_id']		= '*';
+	$feed['path']			= 'forum|name';
+	$feed['text']			= 'this is the rss feed for the forum_name entries';
+	$feed['class']			= '0';
+	$feed['limit']			= '9';
+	$rss[] = $feed;
+
+	return $rss;
+}
+//##### ------------------------------------------------------------------------------------
+
+
+//##### create rss data, return as array $eplug_rss_data -----------------------------------
+$sqlrss = new db;
+
+switch($this->parm){
+
+	case threads:
+	case 6:
+		$this -> rssQuery =
+		"SELECT t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, u.user_name, u.user_email FROM #forum_t AS t
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+		LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
+		WHERE f.forum_class IN (0, 251, 252) AND t.thread_parent=0
+		ORDER BY t.thread_datestamp DESC LIMIT 0,".$this -> limit;
+		$sqlrss->db_Select_gen($this -> rssQuery);
+		$tmp = $sqlrss->db_getList();
+
+		$rss = array();
+		$i=0;
+		foreach($tmp as $value) {
+
+			if($value['user_name']) {
+				$rss[$i]['author'] = $value['user_name'];
+				$rss[$i]['author_email'] = $value['user_email'];  // must include an email address to be valid.
+		} else {
+				$tmp=explode(".", $value['thread_user'], 2);
+				list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]);
+			}
+
+			$rss[$i]['title'] = $value['thread_name'];
+			$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'];
+			$rss[$i]['description'] = $value['thread_thread'];
+			$rss[$i]['datestamp'] = $value['thread_datestamp'];
+
+			$i++;
+		}
+	break;
+
+	case posts:
+	case 7:
+		$this -> rssQuery = "SELECT tp.thread_name AS parent_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, u.user_email FROM #forum_t AS t
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = 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
+		WHERE f.forum_class  IN (0, 251, 252)
+		ORDER BY t.thread_datestamp DESC LIMIT 0,".$this -> limit;
+		$sqlrss->db_Select_gen($this -> rssQuery);
+		$tmp = $sqlrss->db_getList();
+		$rss = array();
+		$i=0;
+		foreach($tmp as $value) {
+
+			if($value['user_name']) {
+				$rss[$i]['author'] = $value['user_name'];
+				$rss[$i]['author_email'] = $value['user_email'];  // must include an email address to be valid.
+			} else {
+				$tmp=explode(".", $value['thread_user'], 2);
+				list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]);
+			}
+
+			if($value['parent_name']) {
+				$rss[$i]['title'] = "Re: ".$value['parent_name'];
+				$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_parent'];
+			} else {
+				$rss[$i]['title'] = $value['thread_name'];
+				$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'];
+			}
+
+			$rss[$i]['description'] = $value['thread_thread'];
+			$rss[$i]['datestamp'] = $value['thread_datestamp'];
+
+			$i++;
+		}
+	break;
+
+	case topic:
+	case 8:
+		if(!$this -> topicid) {
+			return FALSE;
+		}
+
+		/* get thread ...  */
+		$this -> rssQuery = "SELECT t.thread_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, f.forum_id, f.forum_name, f.forum_class, u.user_name
+		FROM #forum_t AS t
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+		LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
+		WHERE f.forum_class  IN (0, 251, 255) AND t.thread_id=".intval($this -> topicid);
+		$sqlrss->db_Select_gen($this -> rssQuery);
+		$topic = $sqlrss->db_Fetch();
+
+		/* get replies ...  */
+		$this -> rssQuery = "SELECT t.thread_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, f.forum_id, f.forum_name, f.forum_class, u.user_name, u.user_email
+		FROM #forum_t AS t
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+		LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
+		WHERE f.forum_class  IN (0, 251, 255) AND t.thread_parent=".intval($this -> topicid);
+		$sqlrss->db_Select_gen($this -> rssQuery);
+		$replies = $sqlrss->db_getList();
+
+		$rss = array();
+		$i = 0;
+
+		if($value['user_name']) {
+			$rss[$i]['author'] = $value['user_name'] . " ( ".$e107->base_path."user.php?id.".intval($value['thread_user'])." )";
+		} else {
+			$tmp=explode(".", $value['thread_user'], 2);
+			list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]);
+		}
+
+		$rss[$i]['title'] = $topic['thread_name'];
+		$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$topic['thread_id'];
+		$rss[$i]['description'] = $topic['thread_thread'];
+		$rss[$i]['datestamp'] = $topic['thread_datestamp'];
+		$i ++;
+		foreach($replies as $value) {
+			if($value['user_name']) {
+				$rss[$i]['author'] = $value['user_name'];
+				$rss[$i]['author_email'] = $value['user_email'];  // must include an email address to be valid.
+			} else {
+				$tmp=explode(".", $value['thread_user'], 2);
+				list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]);
+			}
+			$rss[$i]['title'] = "Re: ".$topic['thread_name'];
+			$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$this -> topicid;
+			$rss[$i]['description'] = $value['thread_thread'];
+			$rss[$i]['datestamp'] = $value['thread_datestamp'];
+			$i++;
+		}
+	break;
+
+	case name:
+	case 11:
+		if(!$this -> topicid) {
+			return FALSE;
+		}
+
+		$this -> rssQuery = "
+		SELECT f.forum_id, f.forum_name, f.forum_class, tp.thread_name AS parent_name, t.*, u.user_name, u.user_email
+		FROM #forum_t as t
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = 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
+		WHERE t.thread_forum_id = ".intval($this->topicid)." AND f.forum_class IN (0, 251, 255)
+		ORDER BY t.thread_datestamp DESC LIMIT 0,".$this -> limit;
+
+		$sqlrss->db_Select_gen($this -> rssQuery);
+		$tmp = $sqlrss->db_getList();
+		$this -> contentType = $this -> contentType." : ".$tmp[1]['forum_name'];
+		$rss = array();
+		$i=0;
+		foreach($tmp as $value) {
+			if($value['user_name']) {
+				$rss[$i]['author'] = $value['user_name'];
+				$rss[$i]['author_email'] = $value['user_email'];
+			} else {
+				$tmp=explode(".", $value['thread_user'], 2);
+				list($rss[$i]['author'], $ip) = explode(chr(1), $tmp[1]);
+			}
+
+			if($value['parent_name']) {
+				$rss[$i]['title'] = "Re: ".$value['parent_name'];
+				$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'].".post";
+			} else {
+				$rss[$i]['title'] = $value['thread_name'];
+				$rss[$i]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'];
+			}
+			$rss[$i]['description'] = $value['thread_thread'];
+			$rss[$i]['datestamp'] = $value['thread_datestamp'];
+			$i++;
+		}
+	break;
+}
+
+$eplug_rss_data[] = $rss;
+//##### ------------------------------------------------------------------------------------
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/forum/forum.php 0.7.7/e107_plugins/forum/forum.php
--- 0.7.5/e107_plugins/forum/forum.php	2006-01-15 13:07:40.000000000 -0600
+++ 0.7.7/e107_plugins/forum/forum.php	2006-11-07 10:19:10.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     �Steve Dunstan 2001-2002
+|     ?Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,17 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum.php,v $
-|     $Revision: 1.38 $
-|     $Date: 2006/01/15 19:07:40 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.39 $
+|     $Date: 2006/11/07 16:19:10 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 if(!defined("e107_INIT")) {
 	require_once("../../class2.php");
 }
 
-@include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php';
-@include_once e_PLUGIN.'forum/languages/English/lan_forum.php';
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
 
 require_once(e_PLUGIN.'forum/forum_class.php');
 $forum = new e107forum;
diff -ruN 0.7.5/e107_plugins/forum/forum_admin.php 0.7.7/e107_plugins/forum/forum_admin.php
--- 0.7.5/e107_plugins/forum/forum_admin.php	2006-04-29 15:34:37.000000000 -0500
+++ 0.7.7/e107_plugins/forum/forum_admin.php	2006-11-14 19:06:16.000000000 -0600
@@ -11,11 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_admin.php,v $
-|     $Revision: 1.39 $
-|     $Date: 2006/04/29 20:34:37 $
-|     $Author: e107coders $
+|     $Revision: 1.44 $
+|     $Date: 2006/11/15 01:06:16 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
+$eplug_admin = true;
 require_once("../../class2.php");
 @include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php';
 @include_once e_PLUGIN.'forum/languages/English/lan_forum_admin.php';
@@ -82,7 +83,7 @@
 	{
 		if(isset($_POST['counts']))
 		{
-			$for->forum_update_counts($fid);
+			$for->forum_update_counts($fid, $_POST['counts_threads']);
 			$msg .= FORLAN_167.": $fid <br />";
 		}
 		if(isset($_POST['lastpost']))
@@ -376,18 +377,18 @@
 function headerjs()
 {
 	global $tp;
-// These functions need to be removed and replaced with the generic jsconfirm() function.
+	// These functions need to be removed and replaced with the generic jsconfirm() function.
 	$headerjs = "<script type=\"text/javascript\">
-		function confirm_(mode, forum_id, forum_name) {
+	function confirm_(mode, forum_id, forum_name) {
 		if (mode == 'sr') {
-		return confirm(\"".$tp->toJS(FORLAN_117)."\");
+			return confirm(\"".$tp->toJS(FORLAN_117)."\");
 		} else if(mode == 'parent') {
-		return confirm(\"".$tp->toJS(FORLAN_81)." [ID: \" + forum_name + \"]\");
+			return confirm(\"".$tp->toJS(FORLAN_81)." [ID: \" + forum_name + \"]\");
 		} else {
-		return confirm(\"".$tp->toJS(FORLAN_82)." [ID: \" + forum_name + \"]\");
+			return confirm(\"".$tp->toJS(FORLAN_82)." [ID: \" + forum_name + \"]\");
 		}
-		}
-		</script>";
+	}
+	</script>";
 	return $headerjs;
 }
 
@@ -568,11 +569,11 @@
 		<form method='post' action='".e_SELF."?".e_QUERY."'>
 		<table style='width:100%'>
 		<tr>
-			<td class='fcaption'>".FORLAN_151."</td>
-			<td class='fcaption'>".FORLAN_31."</td>
-			<td class='fcaption'>".FORLAN_32."</td>
-			<td class='fcaption'>".FORLAN_37."</td>
-			<td class='fcaption'>".FORLAN_20."</td>
+		<td class='fcaption'>".FORLAN_151."</td>
+		<td class='fcaption'>".FORLAN_31."</td>
+		<td class='fcaption'>".FORLAN_32."</td>
+		<td class='fcaption'>".FORLAN_37."</td>
+		<td class='fcaption'>".FORLAN_20."</td>
 		</tr>
 		";
 		if($sql->db_Select('forum', 'forum_id, forum_name, forum_description, forum_order', "forum_sub = {$id} ORDER by forum_order ASC"))
@@ -609,11 +610,11 @@
 
 		$txt .= "
 		<tr>
-			<td class='fcaption'>".FORLAN_151."</td>
-			<td class='fcaption'>".FORLAN_31."</td>
-			<td class='fcaption'>".FORLAN_32."</td>
-			<td class='fcaption'>".FORLAN_37."</td>
-			<td class='fcaption'>&nbsp;</td>
+		<td class='fcaption'>".FORLAN_151."</td>
+		<td class='fcaption'>".FORLAN_31."</td>
+		<td class='fcaption'>".FORLAN_32."</td>
+		<td class='fcaption'>".FORLAN_37."</td>
+		<td class='fcaption'>&nbsp;</td>
 		</tr>
 		<tr>
 		<td class='forumheader2' style='vertical-align:top'>&nbsp;</td>
@@ -651,11 +652,11 @@
 			$text = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
 		}
 		$text .= "
-			<table style='".ADMIN_WIDTH."' class='fborder'>
-			<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_80."</td>
-			</tr>";
+		<table style='".ADMIN_WIDTH."' class='fborder'>
+		<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_80."</td>
+		</tr>";
 
 		if (!$parent_amount = $sql->db_Select("forum", "*", "forum_parent='0' ORDER BY forum_order ASC"))
 		{
@@ -671,9 +672,9 @@
 				$parent_id = $forum_id;
 				$text .= "
 				<tr>
-					<td colspan='2' class='forumheader'>".$forum_name."
-					<br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum_class)."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".r_userclass_name($forum_postclass)."
-					</td>";
+				<td colspan='2' class='forumheader'>".$forum_name."
+				<br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum_class)."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".r_userclass_name($forum_postclass)."
+				</td>";
 
 				$text .= "<td class='forumheader' style='text-align:center'>";
 
@@ -690,11 +691,11 @@
 				{
 					$forum_heading = str_replace("&#39;", "\'", $forum_name);
 					$text .= "
-						<div style='text-align:left; padding-left: 30px'>
-						<a href='".e_SELF."?cat.edit.{$forum_id}'>".ADMIN_EDIT_ICON."</a>
-						<a href='".e_SELF."?delete.{$forum_id}'>".ADMIN_DELETE_ICON."</a>
-						</div>
-						";
+					<div style='text-align:left; padding-left: 30px'>
+					<a href='".e_SELF."?cat.edit.{$forum_id}'>".ADMIN_EDIT_ICON."</a>
+					<a href='".e_SELF."?delete.{$forum_id}'>".ADMIN_DELETE_ICON."</a>
+					</div>
+					";
 				}
 				$text .= "</td></tr>";
 
@@ -711,15 +712,15 @@
 
 						$text .= "
 						<tr>
-							<td style='width:5%; text-align:center' class='forumheader3'>".IMAGE_new."</td>\n<td style='width:55%' class='forumheader3'><a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".$forum_name."</a>" ;
+						<td style='width:5%; text-align:center' class='forumheader3'>".IMAGE_new."</td>\n<td style='width:55%' class='forumheader3'><a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>".$forum_name."</a>" ;
 
 						$text .= "
-							<br /><span class='smallblacktext'>".$forum_description."&nbsp;</span>
-							<br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum_class)."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".r_userclass_name($forum_postclass)."
+						<br /><span class='smallblacktext'>".$forum_description."&nbsp;</span>
+						<br /><b>".FORLAN_140.":</b> ".r_userclass_name($forum_class)."&nbsp;&nbsp;<b>".FORLAN_141.":</b> ".r_userclass_name($forum_postclass)."
 
 						</td>
 
-							<td colspan='2' class='forumheader3' style='text-align:center'>";
+						<td colspan='2' class='forumheader3' style='text-align:center'>";
 
 						if ($mode)
 						{
@@ -735,12 +736,12 @@
 							$forum_heading = str_replace("&#39;", "\'", $forum_name);
 							$sub_img = count($subList[$parent_id][$forum_id]) ? IMAGE_sub : IMAGE_nosub;
 							$text .= "
-									<div style='text-align:left; padding-left: 30px'>
-									<a href='".e_SELF."?create.edit.{$forum_id}'>".ADMIN_EDIT_ICON."</a>
-									<a href='".e_SELF."?delete.{$forum_id}'>".ADMIN_DELETE_ICON."</a>
-									&nbsp;&nbsp;<a href='".e_SELF."?subs.{$forum_id}'>".$sub_img."</a>
-									</div>
-								";
+							<div style='text-align:left; padding-left: 30px'>
+							<a href='".e_SELF."?create.edit.{$forum_id}'>".ADMIN_EDIT_ICON."</a>
+							<a href='".e_SELF."?delete.{$forum_id}'>".ADMIN_DELETE_ICON."</a>
+							&nbsp;&nbsp;<a href='".e_SELF."?subs.{$forum_id}'>".$sub_img."</a>
+							</div>
+							";
 						}
 						$text .= "</td>\n</tr>";
 					}
@@ -770,32 +771,32 @@
 			if ($sql->db_Select("forum", "*", "forum_id=$id"))
 			{
 				$row = $sql->db_Fetch();
-				 extract($row);
+				extract($row);
 			}
 		}
 		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."?".e_QUERY."'>\n
-			<table style='".ADMIN_WIDTH."' class='fborder'>
+		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
+		<table style='".ADMIN_WIDTH."' class='fborder'>
 
-			<tr>
-				<td style='width:40%' class='forumheader3'>".FORLAN_31.":</td>
-				<td style='width:60%' class='forumheader3'>
-					<input class='tbox' type='text' name='forum_name' size='60' value='$forum_name' maxlength='250' />
-				</td>
-			</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_31.":</td>
+		<td style='width:60%' class='forumheader3'>
+		<input class='tbox' type='text' name='forum_name' size='60' value='$forum_name' maxlength='250' />
+		</td>
+		</tr>
 
-			<tr>
-				<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
-				<td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."</td>
-			</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
+		<td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."</td>
+		</tr>
 
-			<tr>
-				<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
-				<td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."</td>
-			</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
+		<td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."</td>
+		</tr>
 
-			<tr style='vertical-align:top'>
-			<td colspan='2'  style='text-align:center' class='forumheader'>";
+		<tr style='vertical-align:top'>
+		<td colspan='2'  style='text-align:center' class='forumheader'>";
 
 		if ($sub_action == "edit")
 		{
@@ -807,10 +808,10 @@
 		}
 
 		$text .= "</td>
-			</tr>
-			</table>
-			</form>
-			</div>";
+		</tr>
+		</table>
+		</form>
+		</div>";
 
 		$ns->tablerender(FORLAN_75, $text);
 	}
@@ -824,16 +825,16 @@
 			if ($sql->db_Select("forum", "*", "forum_id=$id"))
 			{
 				$row = $sql->db_Fetch();
-				 extract($row);
+				extract($row);
 			}
 		}
 
 		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."?".e_QUERY."'>\n
-			<table style='".ADMIN_WIDTH."' class='fborder'>
-			<tr>
-			<td style='width:40%' class='forumheader3'>".FORLAN_22.":</td>
-			<td style='width:60%' class='forumheader3'>";
+		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
+		<table style='".ADMIN_WIDTH."' class='fborder'>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_22.":</td>
+		<td style='width:60%' class='forumheader3'>";
 
 		$sql->db_Select("forum", "*", "forum_parent=0");
 		$text .= "<select name='forum_parent' class='tbox'>\n";
@@ -850,56 +851,56 @@
 			}
 		}
 		$text .= "</select>
-			</td>
-			</tr>
+		</td>
+		</tr>
 
-			<tr>
-			<td style='width:40%' class='forumheader3'>".FORLAN_31.":
-			<div class='smalltext'>".FORLAN_179."</div>
-			</td>
-			<td style='width:60%' class='forumheader3'>
-			<input class='tbox' type='text' name='forum_name' size='60' value='$forum_name' maxlength='250' />
-			</td>
-			</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_31.":
+		<div class='smalltext'>".FORLAN_179."</div>
+		</td>
+		<td style='width:60%' class='forumheader3'>
+		<input class='tbox' type='text' name='forum_name' size='60' value='$forum_name' maxlength='250' />
+		</td>
+		</tr>
 
-			<tr>
-			<td style='width:40%' class='forumheader3'>".FORLAN_32.": </td>
-			<td style='width:60%' class='forumheader3'>
-			<textarea class='tbox' name='forum_description' cols='50' rows='5'>$forum_description</textarea>
-			</td>
-			</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_32.": </td>
+		<td style='width:60%' class='forumheader3'>
+		<textarea class='tbox' name='forum_description' cols='50' rows='5'>$forum_description</textarea>
+		</td>
+		</tr>
 
-			<tr>
-			<td style='width:40%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td>
-			<td style='width:60%' class='forumheader3'>";
-			$text .= r_userclass("forum_moderators", $forum_moderators, 'off', 'admin,classes');
-
-//		$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 (preg_match('/'.preg_quote($user_name).'/', $forum_moderators))
-//			{
-//				$text .= " checked";
-//			}
-//			$text .= "/> ".$user_name ."<br />";
-//		}
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_33.":<br /><span class='smalltext'>(".FORLAN_34.")</span></td>
+		<td style='width:60%' class='forumheader3'>";
+		$text .= r_userclass("forum_moderators", $forum_moderators, 'off', 'admin,classes');
+
+		//		$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 (preg_match('/'.preg_quote($user_name).'/', $forum_moderators))
+		//			{
+		//				$text .= " checked";
+		//			}
+		//			$text .= "/> ".$user_name ."<br />";
+		//		}
 
 		$text .= "</td>
-			</tr>
-			<tr>
-				<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
-				<td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."</td>
-			</tr>
+		</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_23.":<br /><span class='smalltext'>(".FORLAN_24.")</span></td>
+		<td style='width:60%' class='forumheader3'>".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."</td>
+		</tr>
 
-			<tr>
-				<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
-				<td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."</td>
-			</tr>
+		<tr>
+		<td style='width:40%' class='forumheader3'>".FORLAN_142.":<br /><span class='smalltext'>(".FORLAN_143.")</span></td>
+		<td style='width:60%' class='forumheader3'>".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."</td>
+		</tr>
 
 		<tr style='vertical-align:top'>
-			<td colspan='2'  style='text-align:center' class='forumheader'>";
+		<td colspan='2'  style='text-align:center' class='forumheader'>";
 		if ($sub_action == "edit")
 		{
 			$text .= "<input class='button' type='submit' name='update_forum' value='".FORLAN_35."' />";
@@ -909,10 +910,10 @@
 			$text .= "<input class='button' type='submit' name='submit_forum' value='".FORLAN_36."' />";
 		}
 		$text .= "</td>
-			</tr>
-			</table>
-			</form>
-			</div>";
+		</tr>
+		</table>
+		</form>
+		</div>";
 		$ns->tablerender(FORLAN_28, $text);
 	}
 
@@ -941,7 +942,7 @@
 			{
 				$txt .= "<input type='checkbox' name='forumlist[{$f['forum_id']}]' value='1' /> ".$tp->toHTML($f['forum_name'])."<br />";
 			}
-			$txt .= "<input type='checkbox' name='forum_all' value='1' /> ".FORLAN_157;
+			$txt .= "<input type='checkbox' name='forum_all' value='1' /> <strong>".FORLAN_157."</strong>";
 		}
 		$txt .= "
 		</td>
@@ -951,8 +952,8 @@
 		</tr>
 		<tr>
 		<td class='forumheader3'>
-			<input type='checkbox' name='lastpost' value='1' /> ".FORLAN_159." <br />&nbsp;&nbsp;&nbsp;&nbsp;
-			<input type='checkbox' name='lastpost_nothread' value='1' checked='checked' /> ".FORLAN_160."
+		<input type='checkbox' name='lastpost' value='1' /> ".FORLAN_159." <br />&nbsp;&nbsp;&nbsp;&nbsp;
+		<input type='checkbox' name='lastpost_nothread' value='1' checked='checked' /> ".FORLAN_160."
 		</td>
 		</tr>
 		<tr>
@@ -961,6 +962,7 @@
 		<tr>
 		<td class='forumheader3'>
 			<input type='checkbox' name='counts' value='1' /> ".FORLAN_162."<br />
+			&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='counts_threads' value='1' /><span style='text-align: center'> ".FORLAN_182."<br />".FORLAN_183."</span><br />
 		</td>
 		</tr>
 		<tr>
@@ -968,12 +970,12 @@
 		</tr>
 		<tr>
 		<td class='forumheader3'>
-			<input type='checkbox' name='userpostcounts' value='1' /> ".FORLAN_164."<br />
+		<input type='checkbox' name='userpostcounts' value='1' /> ".FORLAN_164."<br />
 		</td>
 		</tr>
 		<tr>
 		<td class='forumheader3' style='text-align:center'>
-			<input class='button' type='submit' name='tools' value='".FORLAN_165."' />
+		<input class='button' type='submit' name='tools' value='".FORLAN_165."' />
 		</td>
 		</tr>
 		</table>
@@ -986,116 +988,116 @@
 	{
 		global $pref, $ns;
 		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."?".e_QUERY."'>\n
-			<table style='".ADMIN_WIDTH."' class='fborder'>
+		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
+		<table style='".ADMIN_WIDTH."' class='fborder'>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_44."<br /><span class='smalltext'>".FORLAN_45."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_enclose'] ? "<input type='checkbox' name='forum_enclose' value='1' checked='checked' />" : "<input type='checkbox' name='forum_enclose' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_44."<br /><span class='smalltext'>".FORLAN_45."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_enclose'] ? "<input type='checkbox' name='forum_enclose' value='1' checked='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%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_title' size='15' value='".$pref['forum_title']."' maxlength='100' /></td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_65."<br /><span class='smalltext'>".FORLAN_46."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_title' size='15' value='".$pref['forum_title']."' maxlength='100' /></td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_47."<br /><span class='smalltext'>".FORLAN_48."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['email_notify'] ? "<input type='checkbox' name='email_notify' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_47."<br /><span class='smalltext'>".FORLAN_48."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['email_notify'] ? "<input type='checkbox' name='email_notify' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_177."<br /><span class='smalltext'>".FORLAN_178."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['email_notify_on'] ? "<input type='checkbox' name='email_notify_on' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify_on' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_177."<br /><span class='smalltext'>".FORLAN_178."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['email_notify_on'] ? "<input type='checkbox' name='email_notify_on' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify_on' 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%;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>
-			</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>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_70."<br /><span class='smalltext'>".FORLAN_71." <a href='".e_ADMIN."upload.php'>".FORLAN_130."</a> ". FORLAN_131."</span>";
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_70."<br /><span class='smalltext'>".FORLAN_71." <a href='".e_ADMIN."upload.php'>".FORLAN_130."</a> ". FORLAN_131."</span>";
 
-			if(!$pref['image_post'])
-			{
-				$text .= "<br /><b>".FORLAN_139."</b>";
-			}
+		if(!$pref['image_post'])
+		{
+			$text .= "<br /><b>".FORLAN_139."</b>";
+		}
 
-			$text .= "</td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_attach'] ? "<input type='checkbox' name='forum_attach' value='1' checked='checked' />" : "<input type='checkbox' name='forum_attach' value='1' />")."</td>
-			</tr>
+		$text .= "</td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_attach'] ? "<input type='checkbox' name='forum_attach' value='1' checked='checked' />" : "<input type='checkbox' name='forum_attach' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_134."<br /><span class='smalltext'>".FORLAN_135."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' size='3' maxlength='5' name='forum_maxwidth' value='{$pref['forum_maxwidth']}' /></td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_134."<br /><span class='smalltext'>".FORLAN_135."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' size='3' maxlength='5' name='forum_maxwidth' value='{$pref['forum_maxwidth']}' /></td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_136."<br /><span class='smalltext'>".FORLAN_137."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_linkimg'] ? "<input type='checkbox' name='forum_linkimg' value='1' checked='checked' />" : "<input type='checkbox' name='forum_linkimg' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_136."<br /><span class='smalltext'>".FORLAN_137."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_linkimg'] ? "<input type='checkbox' name='forum_linkimg' value='1' checked='checked' />" : "<input type='checkbox' name='forum_linkimg' 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%;text-align:center' class='forumheader3' >".($pref['forum_track'] ? "<input type='checkbox' name='forum_track' value='1' checked='checked' />" : "<input type='checkbox' name='forum_track' 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%;text-align:center' class='forumheader3' >".($pref['forum_track'] ? "<input type='checkbox' name='forum_track' value='1' checked='checked' />" : "<input type='checkbox' name='forum_track' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_112."<br /><span class='smalltext'>".FORLAN_113."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_redirect'] ? "<input type='checkbox' name='forum_redirect' value='1' checked='checked' />" : "<input type='checkbox' name='forum_redirect' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_112."<br /><span class='smalltext'>".FORLAN_113."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_redirect'] ? "<input type='checkbox' name='forum_redirect' value='1' checked='checked' />" : "<input type='checkbox' name='forum_redirect' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_114."<br /><span class='smalltext'>".FORLAN_115."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_user_customtitle'] ? "<input type='checkbox' name='forum_user_customtitle' value='1' checked='checked' />" : "<input type='checkbox' name='forum_user_customtitle' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_114."<br /><span class='smalltext'>".FORLAN_115."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_user_customtitle'] ? "<input type='checkbox' name='forum_user_customtitle' value='1' checked='checked' />" : "<input type='checkbox' name='forum_user_customtitle' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_116."<br /><span class='smalltext'>".FORLAN_122."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['reported_post_email'] ? "<input type='checkbox' name='reported_post_email' value='1' checked='checked' />" : "<input type='checkbox' name='reported_post_email' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_116."<br /><span class='smalltext'>".FORLAN_122."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['reported_post_email'] ? "<input type='checkbox' name='reported_post_email' value='1' checked='checked' />" : "<input type='checkbox' name='reported_post_email' value='1' />")."</td>
+		</tr>
 
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_126."<br /><span class='smalltext'>".FORLAN_127."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_tooltip'] ? "<input type='checkbox' name='forum_tooltip' value='1' checked='checked' />" : "<input type='checkbox' name='forum_tooltip' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_126."<br /><span class='smalltext'>".FORLAN_127."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_tooltip'] ? "<input type='checkbox' name='forum_tooltip' value='1' checked='checked' />" : "<input type='checkbox' name='forum_tooltip' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_128."<br /><span class='smalltext'>".FORLAN_129."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_tiplength' size='15' value='".$pref['forum_tiplength']."' maxlength='20' /></td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_128."<br /><span class='smalltext'>".FORLAN_129."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_tiplength' size='15' value='".$pref['forum_tiplength']."' maxlength='20' /></td>
+		</tr>
 
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_53."<br /><span class='smalltext'>".FORLAN_54."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_eprefix' size='15' value='".$pref['forum_eprefix']."' maxlength='20' /></td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_53."<br /><span class='smalltext'>".FORLAN_54."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_eprefix' size='15' value='".$pref['forum_eprefix']."' maxlength='20' /></td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_55."<br /><span class='smalltext'>".FORLAN_56."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_popular' size='3' value='".$pref['forum_popular']."' maxlength='3' /></td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_55."<br /><span class='smalltext'>".FORLAN_56."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_popular' size='3' value='".$pref['forum_popular']."' maxlength='3' /></td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_57."<br /><span class='smalltext'>".FORLAN_58."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_postspage' size='3' value='".$pref['forum_postspage']."' maxlength='3' /></td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_57."<br /><span class='smalltext'>".FORLAN_58."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_postspage' size='3' value='".$pref['forum_postspage']."' maxlength='3' /></td>
+		</tr>
 
-			<tr>
-			<td style='width:75%' class='forumheader3'>".FORLAN_132."<br /><span class='smalltext'>".FORLAN_133."</span></td>
-			<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_hilightsticky'] ? "<input type='checkbox' name='forum_hilightsticky' value='1' checked='checked' />" : "<input type='checkbox' name='forum_hilightsticky' value='1' />")."</td>
-			</tr>
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_132."<br /><span class='smalltext'>".FORLAN_133."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >".($pref['forum_hilightsticky'] ? "<input type='checkbox' name='forum_hilightsticky' value='1' checked='checked' />" : "<input type='checkbox' name='forum_hilightsticky' value='1' />")."</td>
+		</tr>
 
-			<tr>
-			<td colspan='2'  style='text-align:center' class='forumheader'>
-			<input class='button' type='submit' name='updateoptions' value='".FORLAN_61."' />
-			</td>
-			</tr>
-			</table>
-			</form>
-			</div>";
+		<tr>
+		<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);
 	}
 
@@ -1164,20 +1166,20 @@
 			if ($reported_total = $sql->db_Select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'"))
 			{
 				$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
-					<tr>
-					<td style='width:80%' class='fcaption'>".FORLAN_170."</td>
-					<td style='width:20%; text-align:center' class='fcaption'>".FORLAN_80."</td>
-					</tr>";
+				<tr>
+				<td style='width:80%' class='fcaption'>".FORLAN_170."</td>
+				<td style='width:20%; text-align:center' class='fcaption'>".FORLAN_80."</td>
+				</tr>";
 				while ($row = $sql->db_Fetch())
 				{
 					$text .= "<tr>
-						<td style='width:80%' class='forumheader3'><a href='".e_SELF."?sr.".$row['gen_id']."'>".FORLAN_171." #".$row['gen_intdata']."</a></td>
-						<td style='width:20%; text-align:center; vertical-align:top; white-space: nowrap' class='forumheader3'>
-						".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")."
-						".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)."
-						".$rs->form_close()."
-						</td>
-						</tr>\n";
+					<td style='width:80%' class='forumheader3'><a href='".e_SELF."?sr.".$row['gen_id']."'>".FORLAN_171." #".$row['gen_intdata']."</a></td>
+					<td style='width:20%; text-align:center; vertical-align:top; white-space: nowrap' class='forumheader3'>
+					".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")."
+					".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)."
+					".$rs->form_close()."
+					</td>
+					</tr>\n";
 				}
 				$text .= "</table>";
 			}
@@ -1194,7 +1196,7 @@
 	{
 		global $ns, $sql;
 
-//		$sql -> db_Select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC");
+		//		$sql -> db_Select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC");
 		$qry = "
 		SELECT f.forum_id, f.forum_name, sp.forum_name AS sub_parent, fp.forum_name AS forum_parent
 		FROM #forum AS f
@@ -1207,45 +1209,45 @@
 		$forums = $sql -> db_getList();
 
 		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."?".e_QUERY."'>\n
-			<table style='".ADMIN_WIDTH."' class='fborder'>
-			<tr>
-			<td style='text-align:center' class='forumheader3'>".FORLAN_60."</td>
-			</tr>
-			<tr>
+		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
+		<table style='".ADMIN_WIDTH."' class='fborder'>
+		<tr>
+		<td style='text-align:center' class='forumheader3'>".FORLAN_60."</td>
+		</tr>
+		<tr>
 
-			<td style='text-align:center' class='forumheader3'>".FORLAN_87."
-			<input class='tbox' type='text' name='prune_days' size='6' value='' maxlength='3' />
-			</td>
-			</tr>
+		<td style='text-align:center' class='forumheader3'>".FORLAN_87."
+		<input class='tbox' type='text' name='prune_days' size='6' value='' maxlength='3' />
+		</td>
+		</tr>
 
-			<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' />
-			</td>
-			</tr>
+		<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' />
+		</td>
+		</tr>
 
-			<tr>
-			<td class='forumheader3'>".FORLAN_138.": <br />";
+		<tr>
+		<td class='forumheader3'>".FORLAN_138.": <br />";
 
-			foreach($forums as $forum)
-			{
-				$for_name = $forum['forum_parent']." -> ";
-				$for_name .= ($forum['sub_parent'] ? $forum['sub_parent']." -> " : "");
-				$for_name .= $forum['forum_name'];
-				$text .= "<input type='checkbox' name='pruneForum[]' value='".$forum['forum_id']."' /> ".$for_name."<br />";
-			}
+		foreach($forums as $forum)
+		{
+			$for_name = $forum['forum_parent']." -> ";
+			$for_name .= ($forum['sub_parent'] ? $forum['sub_parent']." -> " : "");
+			$for_name .= $forum['forum_name'];
+			$text .= "<input type='checkbox' name='pruneForum[]' value='".$forum['forum_id']."' /> ".$for_name."<br />";
+		}
 
 
-			$text .= "<tr>
-			<td colspan='2'  style='text-align:center' class='forumheader'>
-			<input class='button' type='submit' name='do_prune' value='".FORLAN_5."' />
-			</td>
-			</tr>
-			</table>
-			</form>
-			</div>";
+		$text .= "<tr>
+		<td colspan='2'  style='text-align:center' class='forumheader'>
+		<input class='button' type='submit' name='do_prune' value='".FORLAN_5."' />
+		</td>
+		</tr>
+		</table>
+		</form>
+		</div>";
 		$ns->tablerender(FORLAN_59, $text);
 	}
 
@@ -1258,167 +1260,179 @@
 		$rank_images = ($pref['forum_images'] ? explode(",", $pref['forum_images']) : array("lev1.png", "lev2.png", "lev3.png", "lev4.png", "lev5.png", "lev6.png", "lev7.png", "lev8.png", "lev9.png", "lev10.png"));
 
 		$text = "<div style='text-align:center'>
-			<form method='post' action='".e_SELF."?".e_QUERY."'>\n
-			<table style='".ADMIN_WIDTH."' class='fborder'>
+		<form method='post' action='".e_SELF."?".e_QUERY."'>\n
+		<table style='".ADMIN_WIDTH."' class='fborder'>
 
-			<tr>
-			<td class='fcaption' style='width:40%'>".FORLAN_98."</td>
-			<td class='fcaption' style='width:20%'>".FORLAN_102."<br /></td>
-			<td class='fcaption' style='width:40%'>".FORLAN_104."<br /></td>
-			</tr>
+		<tr>
+		<td class='fcaption' style='width:40%'>".FORLAN_98."</td>
+		<td class='fcaption' style='width:20%'>".FORLAN_102."<br /></td>
+		<td class='fcaption' style='width:40%'>".FORLAN_104."<br /></td>
+		</tr>
 
-			<tr>
-			<td class='forumheader3' style='width:40%'>&nbsp;</td>
-			<td class='forumheader3' style='width:20%'><span class='smalltext'>".FORLAN_99."</span></td>
-			<td class='forumheader3' style='width:40%'><span class='smalltext'>".FORLAN_100."</span></td>
-			</tr>";
+		<tr>
+		<td class='forumheader3' style='width:40%'>&nbsp;</td>
+		<td class='forumheader3' style='width:20%'><span class='smalltext'>".FORLAN_99."</span></td>
+		<td class='forumheader3' style='width:40%'><span class='smalltext'>".FORLAN_100."</span></td>
+		</tr>";
 
 		$text .= "<tr>
-			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_main_admin' size='30' value='".($pref['rank_main_admin'] ? $pref['rank_main_admin'] : FORLAN_101)."' maxlength='30' /></td>
-			<td class='forumheader3' style='width:40%'>&nbsp;</td>
-			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_main_admin_image' size='30' value='".($pref['rank_main_admin_image'] ? $pref['rank_main_admin_image'] : "main_admin.png")."' maxlength='30' /></td>
-			</tr>
+		<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_main_admin' size='30' value='".($pref['rank_main_admin'] ? $pref['rank_main_admin'] : FORLAN_101)."' maxlength='30' /></td>
+		<td class='forumheader3' style='width:40%'>&nbsp;</td>
+		<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_main_admin_image' size='30' value='".($pref['rank_main_admin_image'] ? $pref['rank_main_admin_image'] : e_LANGUAGE."_main_admin.png")."' maxlength='30' /></td>
+		</tr>
 
-			<tr>
-			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_admin' size='30' value='".($pref['rank_admin'] ? $pref['rank_admin'] : FORLAN_103)."' maxlength='30' /></td>
-			<td class='forumheader3' style='width:40%'>&nbsp;</td>
-			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_admin_image' size='30' value='".($pref['rank_admin_image'] ? $pref['rank_admin_image'] : "admin.png")."' maxlength='30' /></td>
-			</tr>
+		<tr>
+		<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_admin' size='30' value='".($pref['rank_admin'] ? $pref['rank_admin'] : FORLAN_103)."' maxlength='30' /></td>
+		<td class='forumheader3' style='width:40%'>&nbsp;</td>
+		<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_admin_image' size='30' value='".($pref['rank_admin_image'] ? $pref['rank_admin_image'] : e_LANGUAGE."_admin.png")."' maxlength='30' /></td>
+		</tr>
 
-			<tr>
-			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_moderator' size='30' value='".($pref['rank_moderator'] ? $pref['rank_moderator'] : FORLAN_105)."' maxlength='30' /></td>
-			<td class='forumheader3' style='width:40%'>&nbsp;</td>
-			<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_moderator_image' size='30' value='".($pref['rank_moderator_image'] ? $pref['rank_moderator_image'] : "moderator.png")."' maxlength='30' /></td>
-			</tr>";
+		<tr>
+		<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_moderator' size='30' value='".($pref['rank_moderator'] ? $pref['rank_moderator'] : FORLAN_105)."' maxlength='30' /></td>
+		<td class='forumheader3' style='width:40%'>&nbsp;</td>
+		<td class='forumheader3' style='width:40%; text-align:center'><input class='tbox' type='text' name='rank_moderator_image' size='30' value='".($pref['rank_moderator_image'] ? $pref['rank_moderator_image'] : e_LANGUAGE."_moderator.png")."' maxlength='30' /></td>
+		</tr>";
 
 		for($a = 0; $a <= 9; $a++)
 		{
 			$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: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>";
+			<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: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>";
 		}
 
 		$text .= "<tr>
-			<td colspan='3'  style='text-align:center' class='forumheader'>
-			<input class='button' type='submit' name='set_ranks' value='".FORLAN_94."' />
-			</td>
-			</tr>
-			</table>\n</form>\n</div>";
+		<td colspan='3'  style='text-align:center' class='forumheader'>
+		<input class='button' type='submit' name='set_ranks' value='".FORLAN_94."' />
+		</td>
+		</tr>
+		</table>\n</form>\n</div>";
 		$ns->tablerender("Ranks", $text);
 	}
 
 	function show_mods()
 	{
-		global $sql, $ns, $for;
-		$forumList = $for->forum_getforums('list');
+		global $sql, $ns, $for, $tp;
+		$forumList = $for->forum_getforums('all');
+		$parentList = $for->forum_getparents('list');
 		$subList   = $for->forum_getsubs('bysub');
-		$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'><table class='fborder'><tr><td> &nbsp; </td>";
-		foreach($forumList as $f)
+
+		$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'><table class='fborder' style='width:100%'><tr><td> &nbsp; </td>";
+
+		foreach($parentList as $p)
 		{
 			$txt .= "
 			<tr>
-				<td class='forumheader'>{$f['forum_name']}</td>
-				<td class='forumheader'>".r_userclass("mods[{$f['forum_id']}]", $f['forum_moderators'], 'off', 'admin,classes')."</td>
+			<td colspan='2' class='fcaption'><strong>".$tp->toHTML($p['forum_name'])."</strong></td>
 			</tr>
 			";
-			foreach($subList[$f['forum_id']] as $s)
+
+			foreach($forumList[$p['forum_id']] as $f)
 			{
 				$txt .= "
 				<tr>
-					<td class='forumheader3'>&nbsp;&nbsp;&nbsp;&nbsp;{$s['forum_name']}</td>
-					<td class='forumheader3'>".r_userclass("mods[{$s['forum_id']}]", $s['forum_moderators'], 'off', 'admin,classes')."</td>
+				<td class='forumheader'>{$f['forum_name']}</td>
+				<td class='forumheader'>".r_userclass("mods[{$f['forum_id']}]", $f['forum_moderators'], 'off', 'admin,classes')."</td>
 				</tr>
 				";
+				foreach($subList[$f['forum_id']] as $s)
+				{
+					$txt .= "
+					<tr>
+					<td class='forumheader3'>&nbsp;&nbsp;&nbsp;&nbsp;{$s['forum_name']}</td>
+					<td class='forumheader3'>".r_userclass("mods[{$s['forum_id']}]", $s['forum_moderators'], 'off', 'admin,classes')."</td>
+					</tr>
+					";
+				}
 			}
 		}
-		$txt .= "
-		<tr>
-		<td colspan='2' class='fcaption' style='text-align:center'>
+			$txt .= "
+			<tr>
+			<td colspan='2' class='fcaption' style='text-align:center'>
 			<input class='button' type='submit' name='setMods' value='".WMGLAN_4." ".FORLAN_33."' />
-		</td>
-		</tr>
+			</td>
+			</tr>
 
-		</table></form>";
-		$ns->tablerender(FORLAN_33, $txt);
-	}
+			</table></form>";
+			$ns->tablerender(FORLAN_33, $txt);
+		}
 
-	function show_rules()
-	{
-		global $sql, $pref, $ns, $tp;
+		function show_rules()
+		{
+			global $sql, $pref, $ns, $tp;
 
-		$sql->db_Select("wmessage");
-		list($null) = $sql->db_Fetch();
-		list($null) = $sql->db_Fetch();
-		list($null) = $sql->db_Fetch();
-		list($id, $guestrules, $wm_active4) = $sql->db_Fetch();
-		list($id, $memberrules, $wm_active5) = $sql->db_Fetch();
-		list($id, $adminrules, $wm_active6) = $sql->db_Fetch();
+			$sql->db_Select("wmessage");
+			list($null) = $sql->db_Fetch();
+			list($null) = $sql->db_Fetch();
+			list($null) = $sql->db_Fetch();
+			list($id, $guestrules, $wm_active4) = $sql->db_Fetch();
+			list($id, $memberrules, $wm_active5) = $sql->db_Fetch();
+			list($id, $adminrules, $wm_active6) = $sql->db_Fetch();
 
-		if($sql->db_Select('generic','*',"gen_type='forum_rules_guest'"))
-		{
-			$guest_rules = $sql->db_Fetch();
-		}
-		if($sql->db_Select('generic','*',"gen_type='forum_rules_member'"))
-		{
-			$member_rules = $sql->db_Fetch();
-		}
-		if($sql->db_Select('generic','*',"gen_type='forum_rules_admin'"))
-		{
-			$admin_rules = $sql->db_Fetch();
-		}
+			if($sql->db_Select('generic','*',"gen_type='forum_rules_guest'"))
+			{
+				$guest_rules = $sql->db_Fetch();
+			}
+			if($sql->db_Select('generic','*',"gen_type='forum_rules_member'"))
+			{
+				$member_rules = $sql->db_Fetch();
+			}
+			if($sql->db_Select('generic','*',"gen_type='forum_rules_admin'"))
+			{
+				$admin_rules = $sql->db_Fetch();
+			}
 
-		$guesttext = $tp->toFORM($guest_rules['gen_chardata']);
-		$membertext = $tp->toFORM($member_rules['gen_chardata']);
-		$admintext = $tp->toFORM($admin_rules['gen_chardata']);
+			$guesttext = $tp->toFORM($guest_rules['gen_chardata']);
+			$membertext = $tp->toFORM($member_rules['gen_chardata']);
+			$admintext = $tp->toFORM($admin_rules['gen_chardata']);
 
-		$text = "
+			$text = "
 			<div style='text-align:center'>
 			<form method='post' action='".e_SELF."?rules'  id='wmform'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>";
 
-		$text .= "
+			$text .= "
 
 			<td style='width:20%' class='forumheader3'>".WMGLAN_1.": <br />
 			".WMGLAN_6.":";
-		if ($guest_rules['gen_intdata'])
-		{
-			$text .= "<input type='checkbox' name='guest_active' value='1'  checked='checked' />";
-		}
-		else
-		{
-			$text .= "<input type='checkbox' name='guest_active' value='1' />";
-		}
-		$text .= "</td>
+			if ($guest_rules['gen_intdata'])
+			{
+				$text .= "<input type='checkbox' name='guest_active' value='1'  checked='checked' />";
+			}
+			else
+			{
+				$text .= "<input type='checkbox' name='guest_active' value='1' />";
+			}
+			$text .= "</td>
 			<td style='width:60%' class='forumheader3'>
 			<textarea class='tbox' name='guestrules' cols='70' rows='10'>$guesttext</textarea>
 			<br />
 			<input class='helpbox' type='text' name='helpguest' size='100' />
 			<br />
-			".ren_help(1, "addtext1", "help1")."
+			".display_help('helpb', 1, 'addtext1', 'help1')."
 			</td>
 			</tr>
 
 			<tr>
 			<td style='width:20%' class='forumheader3'>".WMGLAN_2.": <br />
 			".WMGLAN_6.":";
-		if ($member_rules['gen_intdata'])
-		{
-			$text .= "<input type='checkbox' name='member_active' value='1'  checked='checked' />";
-		}
-		else
-		{
-			$text .= "<input type='checkbox' name='member_active' value='1' />";
-		}
-		$text .= "</td>
+			if ($member_rules['gen_intdata'])
+			{
+				$text .= "<input type='checkbox' name='member_active' value='1'  checked='checked' />";
+			}
+			else
+			{
+				$text .= "<input type='checkbox' name='member_active' value='1' />";
+			}
+			$text .= "</td>
 			<td style='width:60%' class='forumheader3'>
 			<textarea class='tbox' name='memberrules' cols='70' rows='10'>$membertext</textarea>
 			<br />
 			<input class='helpbox' type='text' name='helpmember' size='100' />
 			<br />
-			".ren_help(1, "addtext2", "help2")."
+			".display_help('helpb', 1, 'addtext2', 'help2')."
 			</td>
 			</tr>
 
@@ -1426,22 +1440,22 @@
 			<td style='width:20%' class='forumheader3'>".WMGLAN_3.": <br />
 			".WMGLAN_6.": ";
 
-		if ($admin_rules['gen_intdata'])
-		{
-			$text .= "<input type='checkbox' name='admin_active' value='1'  checked='checked' />";
-		}
-		else
-		{
-			$text .= "<input type='checkbox' name='admin_active' value='1' />";
-		}
+			if ($admin_rules['gen_intdata'])
+			{
+				$text .= "<input type='checkbox' name='admin_active' value='1'  checked='checked' />";
+			}
+			else
+			{
+				$text .= "<input type='checkbox' name='admin_active' value='1' />";
+			}
 
-		$text .= "</td>
+			$text .= "</td>
 			<td style='width:60%' class='forumheader3'>
 			<textarea class='tbox' name='adminrules' cols='70' rows='10'>$admintext</textarea>
 			<br />
 			<input class='helpbox' type='text' name='helpadmin' size='100' />
 			<br />
-			".ren_help(1, "addtext3", "help3")."
+			".display_help('helpb', 1, 'addtext3', 'help3')."
 			</td>
 			</tr>
 
@@ -1455,38 +1469,38 @@
 			</form>
 			</div>";
 
-		$ns->tablerender(WMGLAN_5, $text);
+			$ns->tablerender(WMGLAN_5, $text);
 
-		echo "
+			echo "
 			<script type=\"text/javascript\">
 			function addtext1(sc){
-			document.getElementById('wmform').guestrules.value += sc;
+				document.getElementById('wmform').guestrules.value += sc;
 			}
 			function addtext2(sc){
-			document.getElementById('wmform').memberrules.value += sc;
+				document.getElementById('wmform').memberrules.value += sc;
 			}
 			function addtext3(sc){
-			document.getElementById('wmform').adminrules.value += sc;
+				document.getElementById('wmform').adminrules.value += sc;
 			}
 			function help1(help){
-			document.getElementById('wmform').helpguest.value = help;
+				document.getElementById('wmform').helpguest.value = help;
 			}
 			function help2(help){
-			document.getElementById('wmform').helpmember.value = help;
+				document.getElementById('wmform').helpmember.value = help;
 			}
 			function help3(help){
-			document.getElementById('wmform').helpadmin.value = help;
+				document.getElementById('wmform').helpadmin.value = help;
 			}
 			</script>
 			";
 
+		}
 	}
-}
 
-function forum_admin_adminmenu()
-{
-	global $forum;
-	global $action;
-	$forum->show_options($action);
-}
-?>
\ No newline at end of file
+	function forum_admin_adminmenu()
+	{
+		global $forum;
+		global $action;
+		$forum->show_options($action);
+	}
+	?>
diff -ruN 0.7.5/e107_plugins/forum/forum_class.php 0.7.7/e107_plugins/forum/forum_class.php
--- 0.7.5/e107_plugins/forum/forum_class.php	2006-05-16 12:29:51.000000000 -0500
+++ 0.7.7/e107_plugins/forum/forum_class.php	2006-11-15 06:57:18.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.52 $
-|     $Date: 2006/05/16 17:29:51 $
+|     $Revision: 1.65 $
+|     $Date: 2006/11/15 12:57:18 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -85,7 +85,8 @@
 			else
 			{
 				$id = intval($id);
-				$forum_lpinfo = "";
+				$forum_lp_user = '';
+				$forum_lp_info = '';
 				if($update_threads == TRUE)
 				{
 					if ($sql2->db_Select('forum_t', 'thread_id', "thread_forum_id = $id AND thread_parent = 0"))
@@ -103,8 +104,8 @@
 					$forum_lp_user = $tmp[0];
 					$last_id = $row['thread_parent'] ? $row['thread_parent'] : $row['thread_id'];
 					$forum_lp_info = $row['thread_datestamp'].".".$last_id;
-					$sql->db_Update('forum', "forum_lastpost_user = '{$forum_lp_user}', forum_lastpost_info = '{$forum_lp_info}' WHERE forum_id={$id}");
 				}
+				$sql->db_Update('forum', "forum_lastpost_user = '{$forum_lp_user}', forum_lastpost_info = '{$forum_lp_info}' WHERE forum_id={$id}");
 			}
 		}
 	}
@@ -148,10 +149,10 @@
 		return FALSE;
 	}
 
-	function forum_getmods($uclass)
+	function forum_getmods($uclass = e_UC_ADMIN)
 	{
 		global $sql;
-		if($uclass == e_UC_ADMIN)
+		if($uclass == e_UC_ADMIN || trim($uclass) == '')
 		{
 			$sql->db_Select('user', 'user_id, user_name',"user_admin = 1");
 		}
@@ -172,7 +173,7 @@
 		global $sql;
 		$qry = "
 		SELECT f.*, u.user_name FROM #forum AS f
-		LEFT JOIN #user AS u ON FLOOR(f.forum_lastpost_user) = u.user_id
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(f.forum_lastpost_user,'.',1) = u.user_id
 		WHERE forum_parent != 0 AND forum_sub = 0
 		ORDER BY f.forum_order ASC
 		";
@@ -200,7 +201,7 @@
 		$where = ($forum_id != "" && $forum_id != 'bysub' ? "AND forum_sub = ".intval($forum_id) : "");
 		$qry = "
 		SELECT f.*, u.user_name FROM #forum AS f
-		LEFT JOIN #user AS u ON FLOOR(f.forum_lastpost_user) = u.user_id
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(f.forum_lastpost_user,'.',1) = u.user_id
 		WHERE forum_sub != 0 {$where}
 		ORDER BY f.forum_order ASC
 		";
@@ -327,11 +328,11 @@
 			{
 				$ret[$row['forum_id']] = $row['forum_name'];
 			}
-		
+
 		}
 		return $ret;
 	}
-	
+
 	function thread_update($thread_id, $newvals)
 	{
 		global $sql, $tp;
@@ -351,8 +352,8 @@
 		global $sql;
 		$qry = "
 		SELECT t.*, u.user_name, lpu.user_name AS lastpost_username from #forum_t as t
-		LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
-		LEFT JOIN #user AS lpu ON FLOOR(t.thread_lastuser) = lpu.user_id
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+		LEFT JOIN #user AS lpu ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lpu.user_id
 		WHERE t.thread_forum_id = $forum_id AND t.thread_parent = 0
 		ORDER BY
 		t.thread_s DESC,
@@ -385,7 +386,7 @@
 		}
 		$qry = "
 		SELECT t.thread_user, t.thread_datestamp, u.user_name FROM #forum_t AS t
-		LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
+		LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
 		{$where}
 		ORDER BY t.thread_datestamp DESC	LIMIT 0,1
 		";
@@ -521,9 +522,11 @@
 		$sortdir = "ASC";
 
 		$qry = "
-		SELECT t.*, u.* FROM #forum_t as t
+		SELECT t.*, u.*, ue.* FROM #forum_t as t
 		LEFT JOIN #user AS u
-		ON FLOOR(t.thread_user) = u.user_id
+		ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+		LEFT JOIN #user_extended AS ue
+		ON SUBSTRING_INDEX(t.thread_user,'.',1) = ue.user_extended_id
 		WHERE t.thread_parent = $thread_id
 		ORDER by t.thread_datestamp {$sortdir}
 		LIMIT ".intval($start).",".intval($limit);
@@ -538,9 +541,11 @@
 			}
 		}
 		$qry = "
-		SELECT t.*,u.* from #forum_t AS t
+		SELECT t.*,u.*,ue.* from #forum_t AS t
 		LEFT JOIN #user AS u
-		ON FLOOR(t.thread_user) = u.user_id
+		ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+		LEFT JOIN #user_extended AS ue
+		ON SUBSTRING_INDEX(t.thread_user,'.',1) = ue.user_extended_id
 		WHERE t.thread_id = $thread_id
 		LIMIT 0,1
 		";
@@ -599,7 +604,7 @@
 		$qry = "
 		SELECT t.*, u.user_name, u.user_id, u.user_email from #forum_t AS t
 		LEFT JOIN #user AS u
-		ON FLOOR(t.thread_user) = u.user_id
+		ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
 		WHERE t.thread_id = $thread_id
 		LIMIT 0,1
 		";
@@ -625,7 +630,7 @@
 			$qry = "
 			SELECT t.*, u.user_name, u.user_id from #forum_t AS t
 			LEFT JOIN #user AS u
-			ON FLOOR(t.thread_user) = u.user_id
+			ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
 			WHERE t.thread_id = ".intval($parent_id)."
 			LIMIT 0,1
 			";
@@ -660,7 +665,7 @@
 		{
 			return -1;
 		}
-		
+
 		$post_user = $thread_poster['post_userid'].".".$thread_poster['post_user_name'];
 		$thread_post_user = $post_user;
 		if($thread_poster['post_userid'] == 0)
@@ -759,7 +764,7 @@
 		SELECT ft.*, fp.thread_name as post_subject, fp.thread_total_replies as replies, u.user_id, u.user_name, f.forum_class
 		FROM #forum_t AS ft
 		LEFT JOIN #forum_t as fp ON fp.thread_id = ft.thread_parent
-		LEFT JOIN #user as u ON u.user_id = FLOOR(ft.thread_user) 
+		LEFT JOIN #user as u ON u.user_id = SUBSTRING_INDEX(ft.thread_user,'.',1)
 		LEFT JOIN #forum as f ON f.forum_id = ft.thread_forum_id
 		WHERE ft.thread_datestamp > ".USERLV. "
 		AND f.forum_class IN (".USERCLASS_LIST.")
@@ -812,7 +817,7 @@
 		}
 	}
 
-	function forum_update_counts($forumID)
+	function forum_update_counts($forumID, $recalc_threads = false)
 	{
 		global $sql;
 		if($forumID == 'all')
@@ -829,14 +834,25 @@
 		$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'");
+		if($recalc_threads == true)
+		{
+			$sql->db_Select("forum_t", "thread_parent, count(*) as replies", "thread_forum_id = $forumID GROUP BY thread_parent");
+			$tlist = $sql->db_getList();
+			foreach($tlist as $t)
+			{
+				$tid = $t['thread_parent'];
+				$replies = intval($t['replies']);
+				$sql->db_Update("forum_t", "thread_total_replies='$replies' WHERE thread_id='$tid'");
+			}
+		}
 	}
-	
+
 	function get_user_counts()
 	{
 		global $sql;
 		$qry = "
 		SELECT u.user_id AS uid, count(t.thread_user) AS cnt FROM #forum_t AS t
-		LEFT JOIN #user AS u on FLOOR(t.thread_user) = u.user_id
+		LEFT JOIN #user AS u on SUBSTRING_INDEX(t.thread_user,'.',1)  = u.user_id
 		WHERE u.user_id > 0
 		GROUP BY uid
 		";
@@ -846,12 +862,97 @@
 			$ret = array();
 			while($row = $sql->db_Fetch())
 			{
-				$ret[$row['uid']] = $row['cnt'];	
+				$ret[$row['uid']] = $row['cnt'];
 			}
 			return $ret;
 		}
 		return FALSE;
 	}
+	
+	/*
+	 * set bread crumb
+	 * $forum_href override ONLY applies when template is missing FORUM_CRUMB
+	 * $thread_title is needed for post-related breadcrumbs
+	 */
+	function set_crumb($forum_href=FALSE,$thread_title="")
+	{
+		global $FORUM_CRUMB,$forum_info,$thread_info,$tp;
+		global $BREADCRUMB,$BACKLINK;  // Eventually we should deprecate BACKLINK
+		
+		if(is_array($FORUM_CRUMB))
+		{
+			$search 	= array("{SITENAME}", "{SITENAME_HREF}");
+			$replace 	= array(SITENAME, "href='".e_BASE."index.php'");
+			$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
+		
+			$search 	= array("{FORUMS_TITLE}", "{FORUMS_HREF}");
+			$replace 	= array(LAN_01, "href='".e_PLUGIN."forum/forum.php'");
+			$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
+		
+			$search 	= "{PARENT_TITLE}";
+			$replace 	= $tp->toHTML($forum_info['parent_name']);
+			$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
+
+			if($forum_info['sub_parent'])
+			{
+				$search 	= array("{SUBPARENT_TITLE}", "{SUBPARENT_HREF}");
+				$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
+				$replace 	= array($forum_sub_parent, "href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'");
+				$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
+			}
+			else
+			{
+				$FORUM_CRUMB['subparent']['value'] = "";
+			}
+
+			$search 	= array("{FORUM_TITLE}", "{FORUM_HREF}");
+			$tmpFname = $forum_info['forum_name'];
+			if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
+			$replace 	= array($tmpFname,"href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_id']}'");
+			$FORUM_CRUMB['forum']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forum']['value']);
+
+			if(strlen($thread_title))
+			{
+				$search 	= array("{THREAD_TITLE}");
+				$replace 	= array($thread_title);
+				$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
+			}
+			else
+			{
+				$FORUM_CRUMB['thread']['value'] = "";
+			}
+
+			$FORUM_CRUMB['fieldlist'] = "sitename,forums,parent,subparent,forum,thread";
+			$BREADCRUMB = $tp->parseTemplate("{BREADCRUMB=FORUM_CRUMB}", true);
+
+		}
+		else
+		{
+			$dfltsep = " :: ";
+			$BREADCRUMB = "<a class='forumlink' href='".e_BASE."index.php'>".SITENAME."</a>".$dfltsep."<a class='forumlink' href='".e_PLUGIN."forum/forum.php'>".LAN_01."</a>".$dfltsep;
+			if($forum_info['sub_parent'])
+			{
+				$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
+				$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep;
+			}
+			
+			$tmpFname = $forum_info['forum_name'];
+			if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
+			if ($forum_href)
+			{
+				$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_id']}'>".$tp->toHTML($tmpFname, TRUE, 'no_hook,emotes_off')."</a>";
+			} else
+			{
+				$BREADCRUMB .= $tmpFname;
+			}
+
+			if(strlen($thread_title))
+			{
+				$BREADCRUMB .= $dfltsep.$thread_title;
+			}
+		}
+		$BACKLINK = $BREADCRUMB;
+	}
 }
 
 
@@ -872,50 +973,49 @@
 *
 * @access public
 */
-function img_path($filename, $eMLANG_folder = FALSE, $eMLANG_pref = FALSE)
+function img_path($filename)
 {
 	global $pref;
-	if ($eMLANG_folder)
-	{
-		return eMLANG_path($filename, $eMLANG_folder);
-	}
-	else
-	{
-		if(file_exists(THEME.'forum/'.$filename))
+
+	$multilang = array("reply.png","newthread.png","moderator.png","main_admin.png","admin.png");
+	$ML = (in_array($filename,$multilang)) ? TRUE : FALSE;
+
+		if(file_exists(THEME.'forum/'.$filename) || is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename))
 		{
-			$image = THEME.'forum/'.$filename;
+			$image = ($ML && is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename)) ? THEME.'forum/'.e_LANGUAGE."_".$filename :  THEME.'forum/'.$filename;
 		}
 		else
 		{
 			if(defined("IMODE"))
 			{
-				$image = e_PLUGIN."forum/images/".IMODE."/".$filename;
+				if($ML)
+				{
+                	$image = (is_readable(e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename)) ? e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename : e_PLUGIN."forum/images/".IMODE."/English_".$filename;
+				}
+				else
+				{
+                	$image = e_PLUGIN."forum/images/".IMODE."/".$filename;
+				}
 			}
 			else
 			{
-				$image = e_PLUGIN."forum/images/lite/".$filename;
+				if($ML)
+				{
+					$image = (is_readable(e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename)) ? e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename : e_PLUGIN."forum/images/lite/English_".$filename;
+				}
+				else
+                {
+           			$image = e_PLUGIN."forum/images/lite/".$filename;
+				}
+
 			}
 		}
-	}
+
 	return $image;
 }
 
-function eMLANG_path($file_name, $sub_folder)
-{
-	if (file_exists(THEME.$sub_folder."/".e_LANGUAGE."/".$file_name))
-	{
-		return THEME.$sub_folder."/".e_LANGUAGE."/".$file_name;
-	}
-	if (file_exists(THEME.$sub_folder."/".$file_name))
-	{
-		return THEME.$sub_folder."/".$file_name;
-	}
-	if (file_exists(e_IMAGE.$sub_folder."/".e_LANGUAGE."/".$file_name))
-	{
-		return e_IMAGE.$sub_folder."/".e_LANGUAGE."/".$file_name;
-	}
-	return e_PLUGIN.$sub_folder."/images/".$file_name;
-}
+
+
 
 if (file_exists(THEME.'forum/forum_icons_template.php'))
 {
@@ -929,4 +1029,4 @@
 {
 	require_once(e_PLUGIN.'forum/templates/forum_icons_template.php');
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/forum/forum_post.php 0.7.7/e107_plugins/forum/forum_post.php
--- 0.7.5/e107_plugins/forum/forum_post.php	2006-02-20 08:18:17.000000000 -0600
+++ 0.7.7/e107_plugins/forum/forum_post.php	2006-11-27 07:37:26.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_post.php,v $
-|     $Revision: 1.65 $
-|     $Date: 2006/02/20 14:18:17 $
+|     $Revision: 1.70 $
+|     $Date: 2006/11/27 13:37:26 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -186,14 +186,15 @@
 	}
 	$ns->tablerender(LAN_323, $text);
 	$anonname = $tp->post_toHTML($_POST['anonname'], FALSE);
-	$post = $tp->post_toHTML($_POST['post'], false);
+
+  	$post = $tp->post_toForm($_POST['post']); 
 	$subject = $tp->post_toHTML($_POST['subject'], false);
 
 	if ($action == "edit")
 	{
 		if ($_POST['subject'])
 		{
-			$action = "nt";
+			$action = "edit";
 		}
 		else
 		{
@@ -330,10 +331,14 @@
 			require_once(FOOTERF);
 			exit;
 		}
+
 		$newvals['thread_edit_datestamp'] = time();
 		$newvals['thread_thread'] = $_POST['post'];
 		$newvals['thread_name'] = $_POST['subject'];
-		$newvals['thread_active'] = ($_POST['email_notify']) ? '99' : '1';
+		if(isset($_POST['email_notify']))
+		{
+			$newvals['thread_active'] = '99';
+		}
 		if (isset($_POST['threadtype']) && MODERATOR)
 		{
 			$newvals['thread_s'] = $_POST['threadtype'];
@@ -396,10 +401,13 @@
 	}
 
 	$thread_info[0]['user_name'] = $forum->thread_user($thread_info[0]);
-	$subject = $thread_info['0']['thread_name'];
-	$post = $tp->toForm($thread_info[0]['thread_thread']);
+	if (!isset($_POST['fpreview']))
+	{
+		$subject = $thread_info['0']['thread_name'];
+		$post = $tp->toForm($thread_info[0]['thread_thread']);
+	}
 	$post = preg_replace("/&lt;span class=&#39;smallblacktext&#39;.*\span\>/", "", $post);
-	
+
 	if ($action == 'quote') {
 		$post = preg_replace("#\[hide].*?\[/hide]#s", "", $post);
 		$tmp = explode(chr(1), $thread_info[0]['user_name']);
@@ -559,7 +567,7 @@
 function process_upload()
 {
 	global $pref, $forum_info, $thread_info;
-	
+
 	if(isset($thread_info['head']['thread_id']))
 	{
 		$tid = $thread_info['head']['thread_id'];
@@ -568,7 +576,7 @@
 	{
 		$tid = 0;
 	}
-	
+
 	if (isset($_FILES['file_userfile']['error']) && $_FILES['file_userfile']['error'] != 4)
 	{
 		require_once(e_HANDLER."upload_handler.php");
@@ -603,7 +611,7 @@
 						}
 						else
 						{
-							//resize failed, show original 
+							//resize failed, show original
 							$parms = image_getsize(e_FILE."public/".$upload['name']);
 							$_POST['post'] .= "[br][img{$parms}]".e_FILE."public/".$upload['name']."[/img]";
 						}
@@ -621,7 +629,7 @@
 					//echo "<pre>"; print_r($upload); echo "</pre>";
 					$_POST['post'] .= "[br][file=".e_FILE."public/".$upload['name']."]".$upload['name']."[/file]";
 				}
-				
+
 			}
 		}
 	}
diff -ruN 0.7.5/e107_plugins/forum/forum_post_shortcodes.php 0.7.7/e107_plugins/forum/forum_post_shortcodes.php
--- 0.7.5/e107_plugins/forum/forum_post_shortcodes.php	2006-03-19 21:34:50.000000000 -0600
+++ 0.7.7/e107_plugins/forum/forum_post_shortcodes.php	2006-11-09 10:55:31.000000000 -0600
@@ -2,11 +2,11 @@
 if (!defined('e107_INIT')) { exit; }
 include_once(e_HANDLER.'shortcode_handler.php');
 $forum_post_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-	
+
 /*
 SC_BEGIN LATESTPOSTS
 global $thread_info, $action, $gen, $tp, $forum_shortcodes, $post_info;
-global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST; 
+global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST;
 $txt = $tp->parseTemplate($LATESTPOSTS_START, TRUE, $forum_shortcodes);
 for($i = count($thread_info)-2; $i>0; $i--)
 {
@@ -16,7 +16,7 @@
 $txt .= $tp->parseTemplate($LATESTPOSTS_END, TRUE, $forum_shortcodes);
 return $txt;
 SC_END
-	
+
 SC_BEGIN THREADTOPIC
 global $thread_info, $action, $gen, $tp, $post_info, $forum_shortcodes, $THREADTOPIC_REPLY;
 $post_info = $thread_info['head'];
@@ -52,10 +52,11 @@
 
 SC_BEGIN POSTBOX
 global $post, $pref;
-$ret = "<textarea class='tbox' name='post' cols='70' rows='10' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$post</textarea>\n<br />\n";
-if(!$pref['wysiwyg'] || !check_class($pref['post_html']))
+$rows = (e_WYSIWYG) ? 15 : 10;
+$ret = "<textarea class='tbox' id='post' name='post' cols='70' rows='{$rows}' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$post</textarea>\n<br />\n";
+if(!e_WYSIWYG)
 {
-	$ret .= ren_help(2);
+	$ret .= display_help('helpb', 'forum');
 }
 return $ret;
 SC_END
@@ -74,22 +75,6 @@
 return $ret;
 SC_END
 
-SC_BEGIN EMOTES
-global $pref;
-if(!$pref['wysiwyg'] || !check_class($pref['post_html']))
-{
-	require_once(e_HANDLER."emote.php");
-	if($pref['smiley_activate'])
-	{
-		return r_emote();
-	}
-	else
-	{
-		return "";
-	}
-}
-SC_END
-
 SC_BEGIN FILEATTACH
 global $pref, $fileattach, $fileattach_alert;
 
@@ -125,9 +110,9 @@
 SC_END
 
 SC_BEGIN BACKLINK
-global $forum_info, $thread_info, $eaction, $action;
-return "<a class='forumlink' href='".e_PLUGIN."forum/forum.php'>".LAN_405."</a>-><a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_info['forum_id']."'>".$forum_info['forum_name']."</a>->".
-($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406." ".$thread_info['head']['thread_name']));
+global $forum, $thread_info,$eaction, $action,$BREADCRUMB;
+$forum->set_crumb(TRUE,($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406." ".$thread_info['head']['thread_name'])));
+return $BREADCRUMB;
 SC_END
 
 SC_BEGIN EMAILNOTIFY
@@ -139,7 +124,7 @@
 		$chk = ($_POST['email_notify'] ? "checked = 'checked'" : "");
 	}
 	else
-	{ 
+	{
 		if(isset($thread_info))
 		{
 			$chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : "");
diff -ruN 0.7.5/e107_plugins/forum/forum_shortcodes.php 0.7.7/e107_plugins/forum/forum_shortcodes.php
--- 0.7.5/e107_plugins/forum/forum_shortcodes.php	2006-02-20 10:42:33.000000000 -0600
+++ 0.7.7/e107_plugins/forum/forum_shortcodes.php	2006-11-17 06:55:40.000000000 -0600
@@ -31,7 +31,9 @@
 	
 SC_BEGIN PRIVMESSAGE
 global $post_info, $tp;
-return $tp->parseTemplate("{SENDPM={$post_info['user_id']}}");
+if($post_info['user_id'] > 0){
+	return $tp->parseTemplate("{SENDPM={$post_info['user_id']}}");
+}
 SC_END
 	
 SC_BEGIN AVATAR
@@ -151,7 +153,7 @@
 SC_BEGIN WEBSITE
 global $post_info, $tp;
 if ($post_info['user_homepage']) {
-return LAN_08.": ".$post_info['user_homeapage']."<br />";
+return LAN_08.": ".$post_info['user_homepage']."<br />";
 }
 SC_END
 	
@@ -241,6 +243,7 @@
 if ($post_info['thread_edit_datestamp']) {
 return $gen->convert_date($post_info['thread_edit_datestamp'],'forum');
 }
+return "";
 SC_END
 
 SC_BEGIN POLL
diff -ruN 0.7.5/e107_plugins/forum/forum_stats.php 0.7.7/e107_plugins/forum/forum_stats.php
--- 0.7.5/e107_plugins/forum/forum_stats.php	2005-11-30 21:18:30.000000000 -0600
+++ 0.7.7/e107_plugins/forum/forum_stats.php	2006-10-26 08:10:01.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_stats.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/12/01 03:18:30 $
+|     $Revision: 1.13 $
+|     $Date: 2006/10/26 13:10:01 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -35,13 +35,14 @@
 $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");
 
-$firstpost = $sql -> db_Select("forum_t", "thread_datestamp", "ORDER BY thread_datestamp ASC LIMIT 0,1", "nowhere");
+$firstpost = $sql -> db_Select("forum_t", "thread_datestamp", "thread_datestamp > 0 ORDER BY thread_datestamp ASC LIMIT 0,1");
 $fp = $sql -> db_Fetch();
 
 $open_ds = $fp['thread_datestamp'];
 $open_date = $gen->convert_date($open_ds, "long");
 $open_since = $gen -> computeLapse($open_ds);
-$postsperday = round($total_posts / ((time()-$open_ds) / 86400));
+$open_days = floor((time()-$open_ds) / 86400);
+$postsperday = ($open_days < 1 ? $total_posts : round($total_posts / $open_days));
 
 $query = "SHOW TABLE STATUS FROM $mySQLdefaultdb";
 $sql -> db_Select_gen($query);
@@ -58,12 +59,12 @@
 
 
 $query = "
-SELECT ft.thread_id, ft.thread_user, ft.thread_name, ft.thread_total_replies, ft.thread_datestamp, f.forum_class, u.user_name FROM #forum_t as ft 
-LEFT JOIN #user AS u ON ft.thread_user = u.user_id 
-LEFT JOIN #forum AS f ON f.forum_id = ft.thread_forum_id 
-WHERE ft.thread_parent = 0 
-AND ft.thread_active != 0 
-AND f.forum_class IN (".USERCLASS_LIST.") 
+SELECT ft.thread_id, ft.thread_user, ft.thread_name, ft.thread_total_replies, ft.thread_datestamp, f.forum_class, u.user_name FROM #forum_t as ft
+LEFT JOIN #user AS u ON ft.thread_user = u.user_id
+LEFT JOIN #forum AS f ON f.forum_id = ft.thread_forum_id
+WHERE ft.thread_parent = 0
+AND ft.thread_active != 0
+AND f.forum_class IN (".USERCLASS_LIST.")
 ORDER BY thread_total_replies DESC LIMIT 0,10";
 $sql -> db_Select_gen($query);
 $most_activeArray = $sql -> db_getList();
@@ -89,10 +90,10 @@
 }
 
 $query = "
-SELECT FLOOR(thread_user) as t_user, COUNT(FLOOR(ft.thread_user)) AS ucount, u.user_name, u.user_id FROM #forum_t as ft 
-LEFT JOIN #user AS u ON FLOOR(ft.thread_user) = u.user_id 
+SELECT SUBSTRING_INDEX(thread_user,'.',1) AS t_user, COUNT(SUBSTRING_INDEX(ft.thread_user,'.',1)) AS ucount, u.user_name, u.user_id FROM #forum_t as ft
+LEFT JOIN #user AS u ON SUBSTRING_INDEX(ft.thread_user,'.',1) = u.user_id
 WHERE ft.thread_parent=0
-GROUP BY t_user 
+GROUP BY t_user
 ORDER BY ucount DESC
 LIMIT 0,10";
 $sql -> db_Select_gen($query);
@@ -105,8 +106,8 @@
 }
 
 $query = "
-SELECT FLOOR(thread_user) as t_user, COUNT(FLOOR(ft.thread_user)) AS ucount, u.user_name, u.user_id FROM #forum_t as ft 
-LEFT JOIN #user AS u ON FLOOR(ft.thread_user) = u.user_id 
+SELECT SUBSTRING_INDEX(thread_user,'.',1) AS t_user, COUNT(SUBSTRING_INDEX(ft.thread_user,'.',1)) AS ucount, u.user_name, u.user_id FROM #forum_t as ft
+LEFT JOIN #user AS u ON SUBSTRING_INDEX(ft.thread_user,'.',1) = u.user_id
 WHERE ft.thread_parent!=0
 GROUP BY t_user
 ORDER BY ucount DESC
@@ -176,7 +177,7 @@
 		$tmp = explode(chr(1), $ma['thread_anon']);
 		$uinfo = $tp->toHTML($tmp[0]);
 	}
-		
+
 	$text .= "<tr>
 	<td style='width: 10%; text-align: center;' class='forumheader3'>$count</td>
 	<td style='width: 40%;' class='forumheader3'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$ma['thread_id']}'>{$ma['thread_name']}</a></td>
@@ -287,7 +288,7 @@
 	<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div>
 	<div style='background-image: url($bar); width: ".intval($percentage)."%; height: 14px; float: left;'></div>
 	<div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div>
-	
+
 	</td>
 	</tr>
 	";
@@ -321,11 +322,11 @@
 	<td style='width: 10%; text-align: center;' class='forumheader3'>$user_forums</td>
 	<td style='width: 10%; text-align: center;' class='forumheader3'>$percentage%</td>
 	<td style='width: 50%; text-align: center;' class='forumheader3'>
-	
+
 	<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div>
 	<div style='background-image: url($bar); width: ".intval($percentage)."%; height: 14px; float: left;'></div>
 	<div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div>
-	
+
 	</td>
 	</tr>
 	";
diff -ruN 0.7.5/e107_plugins/forum/forum_uploads.php 0.7.7/e107_plugins/forum/forum_uploads.php
--- 0.7.5/e107_plugins/forum/forum_uploads.php	2005-02-24 21:35:30.000000000 -0600
+++ 0.7.7/e107_plugins/forum/forum_uploads.php	2006-10-21 06:22:30.000000000 -0500
@@ -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.2 $
-|     $Date: 2005/02/25 03:35:30 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.3 $
+|     $Date: 2006/10/21 11:22:30 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -24,7 +24,7 @@
 	exit;
 }
 $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_uploads.php';
-include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_uploads.php');
+include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_uploads.php');
 
 if(is_array($_POST['delete']))
 {
diff -ruN 0.7.5/e107_plugins/forum/forum_viewforum.php 0.7.7/e107_plugins/forum/forum_viewforum.php
--- 0.7.5/e107_plugins/forum/forum_viewforum.php	2006-05-16 12:29:51.000000000 -0500
+++ 0.7.7/e107_plugins/forum/forum_viewforum.php	2006-11-11 23:47:19.000000000 -0600
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_viewforum.php,v $
-|     $Revision: 1.54 $
-|     $Date: 2006/05/16 17:29:51 $
+|     $Revision: 1.61 $
+|     $Date: 2006/11/12 05:47:19 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../../class2.php");
 $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php';
-include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
+include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
 
 if (isset($_POST['fjsubmit'])) {
 	header("location:".e_PLUGIN."forum/forum_viewforum.php?".$_POST['forumjump']);
@@ -35,17 +35,13 @@
 {
 	$tmp = explode(".", e_QUERY);
 	$forum_id = intval($tmp[0]);
-	$from = intval($tmp[1]);
-	if (!$from)
-	{
-		$from = 0;
-	}
+	$thread_from = (isset($tmp[1]) ? intval($tmp[1]) : 0);
 }
 $view = 25;
 
 if(is_numeric(e_MENU))
 {
-	$from = (intval(e_MENU)-1)*$view;
+	$thread_from = (intval(e_MENU)-1)*$view;
 }
 require_once(e_PLUGIN.'forum/forum_class.php');
 $forum = new e107forum;
@@ -81,10 +77,11 @@
 }
 
 
-$forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook');
+$forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook, emotes_off');
 $forum_info['forum_description'] = $tp->toHTML($forum_info['forum_description'], TRUE, 'no_hook');
 
-define("e_PAGETITLE", LAN_01." / ".$forum_info['forum_name']);
+$_forum_name = (substr($forum_info['forum_name'], 0, 1) == "*" ? substr($forum_info['forum_name'], 1) : $forum_info['forum_name']);
+define("e_PAGETITLE", LAN_01." / ".$_forum_name);
 define("MODERATOR", $forum_info['forum_moderators'] != "" && check_class($forum_info['forum_moderators']));
 $modArray = $forum->forum_getmods($forum_info['forum_moderators']);
 $message = "";
@@ -123,7 +120,7 @@
 {
 	if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== FALSE || strpos($FORUM_VIEW_END, 'THREADPAGES') !== FALSE)
 	{
-		$parms = "{$topics},{$view},{$from},".e_SELF.'?'.$forum_id.'.[FROM],off';
+		$parms = "{$topics},{$view},{$thread_from},".e_SELF.'?'.$forum_id.'.[FROM],off';
 		$THREADPAGES = LAN_316." ".$tp->parseTemplate("{NEXTPREV={$parms}}");
 	}
 }
@@ -148,49 +145,7 @@
 	$forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
 }
 
-if(is_array($FORUM_CRUMB))
-{
-	$search 	= array("{SITENAME}", "{SITENAME_HREF}");
-	$replace 	= array(SITENAME, "href='".e_BASE."index.php'");
-	$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
-
-	$search 	= array("{FORUMS_TITLE}", "{FORUMS_HREF}");
-	$replace 	= array(LAN_01, "href='".e_PLUGIN."forum/forum.php'");
-	$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
-
-	$search 	= array("{PARENT_TITLE}");
-	$replace 	= array($tp->toHTML($forum_info['parent_name']));
-	$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
-
-	if($forum_info['sub_parent'])
-	{
-		$search 	= array("{SUBPARENT_TITLE}", "{SUBPARENT_HREF}");
-		$replace 	= array($forum_info['sub_parent'], "href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'");
-		$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
-	}
-	else
-	{
-		$FORUM_CRUMB['subparent']['value'] = "";
-	}
-
-	$search 	= array("{FORUM_TITLE}");
-	$replace 	= array($forum_info['forum_name']);
-	$FORUM_CRUMB['forum']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forum']['value']);
-	$FORUM_CRUMB['fieldlist'] = "sitename,forums,parent,subparent,forum";
-
-	$BREADCRUMB = $tp->parseTemplate("{BREADCRUMB=FORUM_CRUMB}", true);
-
-}
-else
-{
-	$BREADCRUMB = "<a class='forumlink' href='".e_BASE."index.php'>".SITENAME."</a> -> <a class='forumlink' href='".e_PLUGIN."forum/forum.php'>".LAN_01."</a> -> ";
-	if($forum_info['sub_parent'])
-	{
-		$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_info['sub_parent']}</a> -> ";
-	}
-	$BREADCRUMB .= $forum_info['forum_name']."</b>";
-}
-
+$forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK)
 
 $FORUMTITLE = $forum_info['forum_name'];
 //$MODERATORS = LAN_404.": ".$forum_info['forum_moderators'];
@@ -245,7 +200,7 @@
 $reg_threads = 0;
 $unstuck = FALSE;
 
-$thread_list = $forum->forum_get_topics($forum_id, $from, $view);
+$thread_list = $forum->forum_get_topics($forum_id, $thread_from, $view);
 $sub_list = $forum->forum_getsubs($forum_id);
 //print_a($sub_list);
 $gen = new convert;
@@ -409,7 +364,7 @@
 		$ICON = IMAGE_closed;
 	}
 
-	$thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook'));
+	$thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
 	if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE)))) {
 		$thread_name = substr($thread_name, strlen($THREADTYPE));
 	}
@@ -429,10 +384,27 @@
 	$pages = ceil(($REPLIES+1)/$pref['forum_postspage']);
 	if ($pages > 1)
 	{
-		for($a = 0; $a <= ($pages-1); $a++)
+		if($pages > 6)
 		{
-			$PAGES .= $PAGES ? " " : "";
-			$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
+			for($a = 0; $a <= 2; $a++)
+			{
+				$PAGES .= $PAGES ? " " : "";
+				$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
+			}
+			$PAGES .= " ... ";
+			for($a = $pages-3; $a <= $pages-1; $a++)
+			{
+				$PAGES .= $PAGES ? " " : "";
+				$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
+			}
+		}
+		else
+		{
+			for($a = 0; $a <= ($pages-1); $a++)
+			{
+				$PAGES .= $PAGES ? " " : "";
+				$PAGES .= "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$thread_info['thread_id'].".".($a * $pref['forum_postspage'])."'>".($a+1)."</a>";
+			}
 		}
 		$PAGES = LAN_316." [&nbsp;".$PAGES."&nbsp;]";
 	}
diff -ruN 0.7.5/e107_plugins/forum/forum_viewtopic.php 0.7.7/e107_plugins/forum/forum_viewtopic.php
--- 0.7.5/e107_plugins/forum/forum_viewtopic.php	2006-05-16 12:29:51.000000000 -0500
+++ 0.7.7/e107_plugins/forum/forum_viewtopic.php	2006-11-19 16:41:55.000000000 -0600
@@ -11,26 +11,26 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_viewtopic.php,v $
-|     $Revision: 1.63 $
-|     $Date: 2006/05/16 17:29:51 $
+|     $Revision: 1.72 $
+|     $Date: 2006/11/19 22:41:55 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 require_once('../../class2.php');
 
-@include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php';
-@include_once e_PLUGIN.'forum/languages/English/lan_forum_viewtopic.php';
-@require_once(e_PLUGIN.'forum/forum_class.php');
-global $FORUM_CRUMB;
+include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php';
+include_once e_PLUGIN.'forum/languages/English/lan_forum_viewtopic.php';
+include_once(e_PLUGIN.'forum/forum_class.php');
+
 
 if (file_exists(THEME.'forum_design.php'))
 {
-	@include_once(THEME.'forum_design.php');
+	include_once(THEME.'forum_design.php');
 }
 
 $forum = new e107forum;
-if (IsSet($_POST['fjsubmit']))
+if (isset($_POST['fjsubmit']))
 {
 	header("location:".e_PLUGIN."forum/forum_viewforum.php?".$_POST['forumjump']);
 	exit;
@@ -50,13 +50,9 @@
 else
 {
 	$tmp = explode(".", e_QUERY);
-	$thread_id = $tmp[0];
-	$from = $tmp[1];
-	$action = $tmp[2];
-	if (!$from)
-	{
-		$from = 0;
-	}
+	$thread_id = varset($tmp[0]);
+	$topic_from = varset($tmp[1], 0);
+	$action = varset($tmp[2]);
 	if (!$thread_id || !is_numeric($thread_id))
 	{
 		header("Location:".e_PLUGIN."forum/forum.php");
@@ -64,16 +60,16 @@
 	}
 }
 
-if($from === 'post')
+if($topic_from === 'post')
 {
 	if($thread_id)
 	{
 		$post_num = $forum->thread_postnum($thread_id);
 		$pages = ceil(($post_num['post_num']+1)/$pref['forum_postspage']);
-		$from = ($pages-1) * $pref['forum_postspage'];
+		$topic_from = ($pages-1) * $pref['forum_postspage'];
 		if($post_num['parent'] != $thread_id)
 		{
-			header("location: ".e_SELF."?{$post_num['parent']}.{$from}#post_{$thread_id}");
+			header("location: ".e_SELF."?{$post_num['parent']}.{$topic_from}#post_{$thread_id}");
 			exit;
 		}
 	}
@@ -86,24 +82,23 @@
 
 require_once(e_PLUGIN.'forum/forum_shortcodes.php');
 
-
 if ($action == "track" && USER)
 {
 	$forum->track($thread_id);
-	header("location:".e_SELF."?{$thread_id}.{$from}");
+	header("location:".e_SELF."?{$thread_id}.{$topic_from}");
 	exit;
 }
 
 if ($action == "untrack" && USER)
 {
 	$forum->untrack($thread_id);
-	header("location:".e_SELF."?{$thread_id}.{$from}");
+	header("location:".e_SELF."?{$thread_id}.{$topic_from}");
 	exit;
 }
 
 if ($action == "next")
 {
-	$next = $forum->thread_getnext($thread_id, $from);
+	$next = $forum->thread_getnext($thread_id, $topic_from);
 	if ($next)
 	{
 		header("location:".e_SELF."?{$next}");
@@ -119,7 +114,7 @@
 }
 
 if ($action == "prev") {
-	$prev = $forum->thread_getprev($thread_id, $from);
+	$prev = $forum->thread_getprev($thread_id, $topic_from);
 	if ($prev) {
 		header("location:".e_SELF."?{$prev}");
 		exit;
@@ -149,7 +144,7 @@
 		$text = LAN_424."<br /><br /><a href='forum_viewtopic.php?".$thread_id.".post'>".LAN_429."</a";
 		$ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'));
 	} else {
-		$thread_name = $tp -> toHTML($thread_info['head']['thread_name'], TRUE);
+		$thread_name = $tp -> toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off');
 		define("e_PAGETITLE", LAN_01." / ".LAN_426." ".$thread_name);
 		require_once(HEADERF);
 		$text = "<form action='".e_PLUGIN."forum/forum_viewtopic.php?".e_QUERY."' method='post'> <table style='width:100%'>
@@ -182,14 +177,15 @@
 $pm_installed = ($pref['pm_title'] ? TRUE : FALSE);
 
 $replies = $forum->thread_count($thread_id)-1;
-if ($from === 'last') {
+if ($topic_from === 'last') {
 	$pref['forum_postspage'] = ($pref['forum_postspage'] ? $pref['forum_postspage'] : 10);
 	$pages = ceil(($replies+1)/$pref['forum_postspage']);
-	$from = ($pages-1) * $pref['forum_postspage'];
+	$topic_from = ($pages-1) * $pref['forum_postspage'];
 }
 $gen = new convert;
-$thread_info = $forum->thread_get($thread_id, $from-1, $pref['forum_postspage']);
-if($thread_info['head']['thread_forum_id'] == "")
+$thread_info = $forum->thread_get($thread_id, $topic_from-1, $pref['forum_postspage']);
+
+if(intval($thread_info['head']['thread_forum_id']) == 0)
 {
 	require_once(HEADERF);
 	$ns->tablerender(LAN_01, FORLAN_104, array('forum_viewtopic', '104'));
@@ -206,7 +202,7 @@
 
 $forum->thread_incview($thread_id);
 
-define("e_PAGETITLE", LAN_01." / ".$tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook')." / ".$tp->toHTML($thread_info['head']['thread_name'], TRUE));
+define("e_PAGETITLE", LAN_01." / ".$tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook, emotes_off')." / ".$tp->toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off'));
 //define("MODERATOR", (preg_match("/".preg_quote(ADMINNAME)."/", $forum_info['forum_moderators']) && getperms('A') ? TRUE : FALSE));
 define("MODERATOR", $forum_info['forum_moderators'] != "" && check_class($forum_info['forum_moderators']));
 $modArray = $forum->forum_getmods($forum_info['forum_moderators']);
@@ -218,7 +214,7 @@
 	{
 		require_once(e_PLUGIN.'forum/forum_mod.php');
 		$message = forum_thread_moderate($_POST);
-		$thread_info = $forum->thread_get($thread_id, $from-1, $pref['forum_postspage']);
+		$thread_info = $forum->thread_get($thread_id, $topic_from-1, $pref['forum_postspage']);
 	}
 }
 
@@ -229,41 +225,6 @@
 	$ns->tablerender("", $message, array('forum_viewtopic', 'msg'));
 }
 
-if (isset($_POST['pollvote']))
-{
-	if ($_POST['votea'])
-	{
-		if($sql -> db_Select("polls", "*", "poll_datestamp=$thread_id"))
-		{
-			$row = $sql -> db_Fetch();
-			extract($row);
-			$votes = explode(chr(1), $poll_votes);
-			if(is_array($_POST['votea']))
-			{
-				/* multiple choice vote */
-				foreach($_POST['votea'] as $vote)
-				{
-					$vote = intval($vote);
-					$votes[($vote-1)] ++;
-				}
-			}
-			else
-			{
-				$_POST['votea'] = intval($_POST['votea']);
-				$votes[($_POST['votea']-1)] ++;
-			}
-
-			$votep = implode(chr(1), $votes);
-
-			$sql->db_Update("polls", "poll_votes = '$votep' WHERE poll_id=".intval($poll_id));
-			$POLLMODE = "voted";
-			js_location(e_SELF.(e_QUERY ? "?".e_QUERY : ''));
-
-		}
-	}
-}
-
-
 if (stristr($thread_info['head']['thread_name'], "[".LAN_430."]"))
 {
 	if(!defined("POLLCLASS"))
@@ -291,55 +252,12 @@
 	}
 }
 
-$forum_info['forum_name'] = $tp -> toHTML($forum_info['forum_name'], TRUE);
+$forum_info['forum_name'] = $tp -> toHTML($forum_info['forum_name'], TRUE,'no_hook,emotes_off');
 
 // get info for main thread -------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
-if(is_array($FORUM_CRUMB))
-{
-	$search 	= array("{SITENAME}", "{SITENAME_HREF}");
-	$replace 	= array(SITENAME, "href='".e_BASE."index.php'");
-	$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
-
-	$search 	= array("{FORUMS_TITLE}", "{FORUMS_HREF}");
-	$replace 	= array(LAN_01, "href='".e_PLUGIN."forum/forum.php'");
-	$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
-	
-	$search 	= array("{PARENT_TITLE}");
-	$replace 	= array($tp->toHTML($forum_info['parent_name']));
-	$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
-
-	if($forum_info['sub_parent'])
-	{
-		$search 	= array("{SUBPARENT_TITLE}", "{SUBPARENT_HREF}");
-		$replace 	= array($forum_info['sub_parent'], "href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'");
-		$FORUM_CRUMB['subparent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['subparent']['value']);
-	}
-	else
-	{
-		$FORUM_CRUMB['subparent']['value'] = "";
-	}
-
-	$search 	= array("{FORUM_TITLE}", "{FORUM_HREF}");
-	$replace 	= array($forum_info['forum_name'],"href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_id']}'");
-	$FORUM_CRUMB['forum']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forum']['value']);
-	$FORUM_CRUMB['fieldlist'] = "sitename,forums,parent,subparent,forum";
-
-	$BREADCRUMB = $tp->parseTemplate("{BREADCRUMB=FORUM_CRUMB}", true);
-
-}
-else
-{
-	$BREADCRUMB = "<a class='forumlink' href='".e_BASE."index.php'>".SITENAME."</a> -> <a class='forumlink' href='".e_PLUGIN."forum/forum.php'>".LAN_01."</a> -> ";
-	if($forum_info['sub_parent'])
-	{
-		$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_info['sub_parent']}</a> -> ";
-	}
-	$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_id']}'>".$tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook')."</a></b>";
-}
-
-$BACKLINK = $BREADCRUMB;
-$THREADNAME = $tp->toHTML($thread_info['head']['thread_name'], TRUE);
+$forum->set_crumb(TRUE); // Set $BREADCRUMB (and BACKLINK)
+$THREADNAME = $tp->toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off');
 $NEXTPREV = "&lt;&lt; <a href='".e_SELF."?{$thread_id}.{$forum_info['forum_id']}.prev'>".LAN_389."</a>";
 $NEXTPREV .= " | ";
 $NEXTPREV .= "<a href='".e_SELF."?{$thread_id}.{$forum_info['forum_id']}.next'>".LAN_390."</a> &gt;&gt;";
@@ -357,7 +275,7 @@
 $pages = ceil(($replies+1)/$pref['forum_postspage']);
 if ($pages > 1)
 {
-	$parms = ($replies+1).",{$pref['forum_postspage']},{$from},".e_SELF.'?'.$thread_id.'.[FROM],off';
+	$parms = ($replies+1).",{$pref['forum_postspage']},{$topic_from},".e_SELF.'?'.$thread_id.'.[FROM],off';
 	$GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
 }
 
@@ -397,7 +315,7 @@
 	{
 		$post_info['anon'] = FALSE;
 	}
-	$e_hide_query = "SELECT thread_id FROM #forum_t WHERE (`thread_parent` = {$thread_id} OR `thread_id` = {$thread_id}) AND FLOOR(thread_user) = ".USERID;
+	$e_hide_query = "SELECT thread_id FROM #forum_t WHERE (`thread_parent` = {$thread_id} OR `thread_id` = {$thread_id}) AND SUBSTRING_INDEX(thread_user,'.',1) = ".USERID;
 	$e_hide_hidden = FORLAN_HIDDEN;
 	$e_hide_allowed = USER;
 
@@ -480,7 +398,7 @@
 
 	$ret .= "
 		<div>
-		<a href='".e_PLUGIN."forum/forum_post.php?edit.{$post_info['thread_id']}.{$from}'>".IMAGE_admin_edit."</a>
+		<a href='".e_PLUGIN."forum/forum_post.php?edit.{$post_info['thread_id']}.{$topic_from}'>".IMAGE_admin_edit."</a>
 		<input type='image' ".IMAGE_admin_delete." name='delete_{$post_info['thread_id']}' value='thread_action' onclick=\"return confirm_('{$type}', {$forum_id}, {$thread_id}, '{$post_info['user_name']}')\" />
 		";
 	if ($type == 'thread')
@@ -581,7 +499,7 @@
 	{
 		$bar_image = e_PLUGIN."forum/images/".IMODE."/bar.jpg";
 	}
-		
+
 	$rpg_info .= "<div style='padding:2px; white-space:nowrap'>";
 	$rpg_info .= "<b>Level = ".$lvl_level."</b><br />";
 	$rpg_info .= "HP = ".$lvl_hp."<br /><img src='{$bar_image}' alt='' style='border:#345487 1px solid; height:10px; width:".$lvl_hp_percent."%'><br />";
Binary files 0.7.5/e107_plugins/forum/images/dark/English_admin.png and 0.7.7/e107_plugins/forum/images/dark/English_admin.png differ
Binary files 0.7.5/e107_plugins/forum/images/dark/English_main_admin.png and 0.7.7/e107_plugins/forum/images/dark/English_main_admin.png differ
Binary files 0.7.5/e107_plugins/forum/images/dark/English_moderator.png and 0.7.7/e107_plugins/forum/images/dark/English_moderator.png differ
Binary files 0.7.5/e107_plugins/forum/images/dark/English_newthread.png and 0.7.7/e107_plugins/forum/images/dark/English_newthread.png differ
Binary files 0.7.5/e107_plugins/forum/images/dark/English_reply.png and 0.7.7/e107_plugins/forum/images/dark/English_reply.png differ
Binary files 0.7.5/e107_plugins/forum/images/lite/English_admin.png and 0.7.7/e107_plugins/forum/images/lite/English_admin.png differ
Binary files 0.7.5/e107_plugins/forum/images/lite/English_main_admin.png and 0.7.7/e107_plugins/forum/images/lite/English_main_admin.png differ
Binary files 0.7.5/e107_plugins/forum/images/lite/English_moderator.png and 0.7.7/e107_plugins/forum/images/lite/English_moderator.png differ
Binary files 0.7.5/e107_plugins/forum/images/lite/English_newthread.png and 0.7.7/e107_plugins/forum/images/lite/English_newthread.png differ
Binary files 0.7.5/e107_plugins/forum/images/lite/English_reply.png and 0.7.7/e107_plugins/forum/images/lite/English_reply.png differ
diff -ruN 0.7.5/e107_plugins/forum/languages/English/lan_forum_admin.php 0.7.7/e107_plugins/forum/languages/English/lan_forum_admin.php
--- 0.7.5/e107_plugins/forum/languages/English/lan_forum_admin.php	2006-03-18 14:53:53.000000000 -0600
+++ 0.7.7/e107_plugins/forum/languages/English/lan_forum_admin.php	2006-11-14 19:06:17.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.19 $
-|     $Date: 2006/03/18 20:53:53 $
+|     $Revision: 1.22 $
+|     $Date: 2006/11/15 01:06:17 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -32,7 +32,7 @@
 define("FORLAN_21", "tick to confirm");
 define("FORLAN_22", "Parent");
 define("FORLAN_23", "Viewable by");
-define("FORLAN_24", "Indicates who can can view the forum");
+define("FORLAN_24", "Indicates who can view the forum");
 define("FORLAN_25", "Update Parent");
 define("FORLAN_26", "Create Parent");
 define("FORLAN_27", "You need to define at least one forum parent before creating a forum.");
@@ -55,7 +55,7 @@
 define("FORLAN_44", "Enclose tables");
 define("FORLAN_45", "Tick this to render the forum within theme table");
 define("FORLAN_46", "Title displayed in caption if enclose tables is ticked");
-define("FORLAN_47", "Enable email nofication");
+define("FORLAN_47", "Enable email notification");
 define("FORLAN_48", "Tick this to allow your users to have the option of receiving an email when somebody replies to their post");
 define("FORLAN_49", "Enable polls");
 define("FORLAN_50", "Tick this to allow your users to set polls in the forums - the Polls plugin must be installed to use this feature");
@@ -72,7 +72,7 @@
 define("FORLAN_61", "Update Options");
 define("FORLAN_62", "Forum Options");
 define("FORLAN_63", "Ranks");
-define("FORLAN_64", "Enter your levels here, if left blank generic stars will be used to denote level. Seperate levels with comma. Maximum of 10 levels, lowest first.");
+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_70", "Enable file / image attachments");
@@ -160,7 +160,7 @@
 define("FORLAN_140", "View");
 define("FORLAN_141", "Post");
 define("FORLAN_142", "Post permission");
-define("FORLAN_143", "Indicates who can can post to the forum");
+define("FORLAN_143", "Indicates who can post to the forum");
 define("FORLAN_144", "Moderators set");
 define("FORLAN_145", "Configure sub-forums");
 define("FORLAN_146", "No sub-forums yet");
@@ -196,11 +196,13 @@
 define("FORLAN_175", "Report submitted");
 define("FORLAN_176", "Report");
 
-define("FORLAN_177", "email nofication ON by default");
+define("FORLAN_177", "email notification ON by default");
 define("FORLAN_178", "Tick this to allow make the email notification checkbox be on by default");
 
-define("FORLAN_179", "(Adding a * to the beginning of the forum name will make this forum a container for subforums only.  The forum theme must support this option also.)");
+define("FORLAN_179", "(Adding a * to the beginning of the forum name will make this forum a container for sub-forums only.  The forum theme must support this option also.)");
 define("FORLAN_180", "Confirm delete operation");
 define("FORLAN_181", "Confirm Delete");
+define("FORLAN_182", "also recalculate replies for all threads in selected forum");
+define("FORLAN_183", "(this function is not allowed when selecting 'all forums' due to the number of queries it will generate)");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/forum/languages/English/lan_forum_conf.php 0.7.7/e107_plugins/forum/languages/English/lan_forum_conf.php
--- 0.7.5/e107_plugins/forum/languages/English/lan_forum_conf.php	2006-02-06 21:28:40.000000000 -0600
+++ 0.7.7/e107_plugins/forum/languages/English/lan_forum_conf.php	2006-06-22 14:49:58.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_conf.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/02/07 03:28:40 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.4 $
+|     $Date: 2006/06/22 19:49:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("FORLAN_5", "Poll deleted.");
@@ -17,7 +17,7 @@
 define("FORLAN_10", "Move cancelled.");
 define("FORLAN_11", "Back To Forums");
 define("FORLAN_12", "Forum Configuration");
-define("FORLAN_13", "Are you absolutely certain you want to delete this poll?<br />Once deleted it <b><u>cannot</u></b> be retreived.");
+define("FORLAN_13", "Are you absolutely certain you want to delete this poll?<br />Once deleted it <b><u>cannot</u></b> be retrieved.");
 define("FORLAN_14", "Cancel");
 define("FORLAN_15", "Confirm Delete Forum Post");
 define("FORLAN_16", "Confirm Delete Poll");
@@ -27,11 +27,11 @@
 define("FORLAN_20", "the poll will also be deleted");
 define("FORLAN_21", "Once deleted they");
 define("FORLAN_22", "post?<br />Once deleted it");
-define("FORLAN_23", "cannot</u></b> be retreived");
+define("FORLAN_23", "cannot</u></b> be retrieved");
 define("FORLAN_24", "Move thread  to forum");
 define("FORLAN_25", "Move Thread");
 define("FORLAN_26", "Reply deleted");
-	
+
 define("FORLAN_27", "moved");
 
 define("FORLAN_28", "Do not rename thread title");
@@ -40,5 +40,5 @@
 define("FORLAN_31", "Rename to:");
 define("FORLAN_32", "Rename thread options:");
 
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/forum/languages/English/lan_forum_post.php 0.7.7/e107_plugins/forum/languages/English/lan_forum_post.php
--- 0.7.5/e107_plugins/forum/languages/English/lan_forum_post.php	2005-05-22 11:05:56.000000000 -0500
+++ 0.7.7/e107_plugins/forum/languages/English/lan_forum_post.php	2006-08-26 21:24:45.000000000 -0500
@@ -4,13 +4,13 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_post.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/05/22 16:05:56 $
-|     $Author: stevedunstan $
+|     $Revision: 1.11 $
+|     $Date: 2006/08/27 02:24:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Forum");
-	
+
 define("LAN_01", "Forums");
 define("LAN_02", "Replying to: ");
 define("LAN_03", "New Thread");
@@ -48,7 +48,7 @@
 define("LAN_101", "Latest ");
 define("LAN_102", " replies");
 define("LAN_103", "Review complete thread. (Will open a new window.)");
-define("LAN_133", "Thankyou");
+define("LAN_133", "Thank you");
 define("LAN_174", "Signup");
 define("LAN_175", "Login");
 define("LAN_212", "Forgot password?");
@@ -73,8 +73,8 @@
 define("LAN_390", "Attach file / image");
 define("LAN_391", "Options");
 define("LAN_392", "File to attach");
-define("LAN_393", "<b>Please note</b><br />Allowed filetypes:");
-define("LAN_394", "Any other filetypes uploaded will be instantly deleted.");
+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_397", "This thread is locked.");
@@ -82,13 +82,13 @@
 define("LAN_399", "You are not authorized to post to this forum.");
 define("LAN_400", "post thread as");
 define("LAN_401", "Jump");
-	
+
 define("LAN_402", "poll");
 define("LAN_403", "announcement");
 define("LAN_404", "sticky");
 define("LAN_405", "Forums");
 define("LAN_406", "Re:");
-	
+
 //v.616
 define("LAN_407", "Redirect");
 define("LAN_408", "If your browser does not support meta redirection please click");
@@ -96,7 +96,7 @@
 define("LAN_410", "to be redirected");
 define("LAN_411", "here");
 define("LAN_412", "to go to the registration page.");
-	
+
 define("LAN_413", "Your poll has been successfully posted.");
 define("LAN_414", "Click Here to view your poll");
 define("LAN_415", "Your reply has been successfully posted.");
diff -ruN 0.7.5/e107_plugins/forum/languages/English/lan_forum_viewtopic.php 0.7.7/e107_plugins/forum/languages/English/lan_forum_viewtopic.php
--- 0.7.5/e107_plugins/forum/languages/English/lan_forum_viewtopic.php	2006-02-03 13:57:51.000000000 -0600
+++ 0.7.7/e107_plugins/forum/languages/English/lan_forum_viewtopic.php	2006-10-31 15:16:29.000000000 -0600
@@ -4,13 +4,13 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_viewtopic.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/02/03 19:57:51 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.12 $
+|     $Date: 2006/10/31 21:16:29 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Forum");
-	
+
 define("LAN_01", "Forums");
 define("LAN_02", "Go to page");
 define("LAN_03", "Go");
@@ -23,7 +23,7 @@
 define("LAN_10", "Back to top");
 define("LAN_65", "Jump");
 define("LAN_66", "This thread is now closed");
-define("LAN_67", "posts");
+define("LAN_67", "Posts");
 define("LAN_194", "Guest");
 define("LAN_195", "Registered Member");
 define("LAN_321", "Moderators: ");
@@ -40,19 +40,19 @@
 define("LAN_399", "Private Message");
 define("LAN_400", "Edit");
 define("LAN_401", "Quote");
-	
+
 define("LAN_402", "Author");
 define("LAN_403", "Post");
 define("LAN_404", "No previous thread");
 define("LAN_405", "No next thread");
-	
+
 define("LAN_406", "Moderator: Edit");
 define("LAN_435", "Moderator: Delete");
 define("LAN_408", "Moderator: Move");
 define("LAN_409", "Are you sure you want to delete this thread and any replies?");
 define("LAN_410", "Are you sure you want to delete this reply?");
 define("LAN_411", "posted by ");
-	
+
 //v.616
 define("LAN_412", "Title");
 define("LAN_413", "Report");
@@ -80,10 +80,10 @@
 define("LAN_431", "Syndicate this thread: rss 0.92");
 define("LAN_432", "Syndicate this thread: rss 2.0");
 define("LAN_433", "Syndicate this thread: RDF");
-	
+
 define("FORLAN_101", "Email Thread");
 define("FORLAN_102", "Print View");
 define('FORLAN_103', '[user deleted]');
 define('FORLAN_104', 'Thread not found');
 define("FORLAN_HIDDEN", "HIDDEN - LOGIN AND REPLY TO REVEAL");
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/forum/newforumposts_menu.php 0.7.7/e107_plugins/forum/newforumposts_menu.php
--- 0.7.5/e107_plugins/forum/newforumposts_menu.php	2006-01-14 21:01:08.000000000 -0600
+++ 0.7.7/e107_plugins/forum/newforumposts_menu.php	2006-08-26 21:24:45.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/newforumposts_menu.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/01/15 03:01:08 $
+|     $Revision: 1.17 $
+|     $Date: 2006/08/27 02:24:45 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -29,16 +29,15 @@
 {
 	include_once(e_PLUGIN."forum/languages/English/lan_newforumposts_menu.php");
 }
-$_chars = max($menu_pref['newforumposts_characters'] * 3, 200);
 
 $query2 = "
-SELECT tp.thread_name AS parent_name, t.thread_datestamp , left(t.thread_thread, {$_chars}) as 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 
-LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id 
-WHERE f.forum_class  IN (".USERCLASS_LIST.") 
-AND fp.forum_class IN (".USERCLASS_LIST.") 
+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 fp ON f.forum_parent = fp.forum_id
+WHERE fp.forum_class IN (".USERCLASS_LIST.")
 ORDER BY t.thread_datestamp DESC LIMIT 0, ".$menu_pref['newforumposts_display'];
 
 $results = $sql->db_Select_gen($query2);
@@ -55,7 +54,7 @@
 	foreach($forumArray as $fi)
 	{
 		$datestamp = $gen->convert_date($fi['thread_datestamp'], "short");
-		$topic = ($fi['parent_name'] ? "re: <i>{$fi['parent_name']}</i>" : "<i>{$fi['thread_name']}</i>");
+		$topic = ($fi['parent_name'] ? "Re: <i>{$fi['parent_name']}</i>" : "<i>{$fi['thread_name']}</i>");
 		$topic = strip_tags($tp->toHTML($topic, TRUE, "emotes_off, no_make_clickable, parse_bb", "", $pref['menu_wordwrap']));
 		$id = $fi['thread_id'];
 
@@ -77,21 +76,24 @@
 			}
 		}
 
-		$fi['thread_thread'] = strip_tags($tp->toHTML($fi['thread_thread'], TRUE, "emotes_off, no_make_clickable, parse_bb", "", $pref['menu_wordwrap']));
+		$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'];
 		}
 
-		if ($menu_pref['newforumposts_title']) {
+		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 />";
-		} else {
+		}
+		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 />";
 		}
 	}
 }
 
 $ns->tablerender($menu_pref['newforumposts_caption'], $text, 'nfp_menu');
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/forum/search/search_parser.php 0.7.7/e107_plugins/forum/search/search_parser.php
--- 0.7.5/e107_plugins/forum/search/search_parser.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/forum/search/search_parser.php	2006-07-04 03:42:17.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/search/search_parser.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/07/04 08:42:17 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-// advanced 
+// advanced
 $advanced_where = "";
 if (isset($_GET['forum']) && is_numeric($_GET['forum'])) {
 	$advanced_where .= " f.forum_id='".$_GET['forum']."' AND";
@@ -46,7 +46,7 @@
 
 $where = "f.forum_class REGEXP '".e_CLASS_REGEXP."' AND fp.forum_class REGEXP '".e_CLASS_REGEXP."' AND".$advanced_where;
 $order = array('thread_datestamp' => DESC);
-$table = "forum_t AS t LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
+$table = "forum_t AS t LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
 		LEFT JOIN #forum AS f ON t.thread_forum_id = f.forum_id
 		LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
 		LEFT JOIN #forum_t AS tp ON t.thread_parent = tp.thread_id";
diff -ruN 0.7.5/e107_plugins/forum/templates/forum_post_template.php 0.7.7/e107_plugins/forum/templates/forum_post_template.php
--- 0.7.5/e107_plugins/forum/templates/forum_post_template.php	2006-04-04 18:19:05.000000000 -0500
+++ 0.7.7/e107_plugins/forum/templates/forum_post_template.php	2006-11-09 10:56:30.000000000 -0600
@@ -11,13 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_post_template.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/04/04 23:19:05 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.22 $
+|     $Date: 2006/11/09 16:56:30 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
 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.
 
@@ -93,7 +94,7 @@
 <div style='text-align:center'>
 <div class='spacer'>
 {FORMSTART}
-<table style='width:95%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td colspan='2' class='fcaption'>{BACKLINK}
 </td>
@@ -103,7 +104,7 @@
 <tr>
 <td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
 <td class='forumheader2' style='width:80%'>
-{POSTBOX}<br />{EMOTES}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
+{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
 </td>
 </tr>
 
@@ -119,7 +120,7 @@
 </table>
 {FORMEND}
 
-<table style='width:95%'>
+<table style='".USER_WIDTH."'>
 <tr>
 <td>
 {FORUMJUMP}
@@ -136,7 +137,7 @@
 <div style='text-align:center'>
 <div class='spacer'>
 {FORMSTART}
-<table style='width:95%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td colspan='2' class='fcaption'>{BACKLINK}
 </td>
@@ -146,7 +147,7 @@
 <tr>
 <td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
 <td class='forumheader2' style='width:80%'>
-{POSTBOX}<br />{EMOTES}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
+{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
 </td>
 </tr>
 
@@ -162,7 +163,7 @@
 </table>
 {FORMEND}
 
-<table style='width:95%'>
+<table style='".USER_WIDTH."'>
 <tr>
 <td>
 {FORUMJUMP}
@@ -180,7 +181,7 @@
 if(!$LATESTPOSTS_START)
 {
 $LATESTPOSTS_START = "
-<table style='width:100%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td colspan='2' class='fcaption' style='vertical-align:top'>".
 LAN_101."{LATESTPOSTSCOUNT}".LAN_102."
@@ -211,7 +212,7 @@
 if(!$THREADTOPIC_REPLY)
 {
 $THREADTOPIC_REPLY = "
-<table style='width:100%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 	<td colspan='2' class='fcaption' style='vertical-align:top'>".LAN_100."</td>
 </tr>
@@ -225,4 +226,21 @@
 ";
 }
 
+$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 -ruN 0.7.5/e107_plugins/forum/templates/forum_posted_template.php 0.7.7/e107_plugins/forum/templates/forum_posted_template.php
--- 0.7.5/e107_plugins/forum/templates/forum_posted_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/forum/templates/forum_posted_template.php	2006-07-16 16:57:03.000000000 -0500
@@ -14,9 +14,10 @@
 */
 
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 $FORUMPOLLPOSTED =
-"<table style='width:95%' class='fborder'>
+"<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
@@ -28,7 +29,7 @@
 </td></tr></table>";
 
 $FORUMTHREADPOSTED = "
-<table style='width:95%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
@@ -42,7 +43,7 @@
 
 
 $FORUMREPLYPOSTED = "
-<table style='width:95%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td class='fcaption' colspan='2'>".LAN_133."</td>
 </tr><tr>
diff -ruN 0.7.5/e107_plugins/forum/templates/forum_preview_template.php 0.7.7/e107_plugins/forum/templates/forum_preview_template.php
--- 0.7.5/e107_plugins/forum/templates/forum_preview_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/forum/templates/forum_preview_template.php	2006-07-21 05:05:19.000000000 -0500
@@ -11,25 +11,26 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_preview_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/07/21 10:05:19 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%;margin-left:auto;margin-right:auto"); }
 
 $FORUM_PREVIEW = "<div style='text-align:center'>
-<table style='width:100%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 <td colspan='2' class='fcaption' style='vertical-align:top'>".LAN_323.
 ($action != "nt" ? "</td>" : " ( ".LAN_62.$tsubject." )</td>")."
 <tr>
-<td class='forumheader3' style='width:20%' style='vertical-align:top'><b>".$poster."</b></td>
+<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.$postdate."</div>".$tpost."</td>
 </tr>
 </table>
 </div>";
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/forum/templates/forum_template.php 0.7.7/e107_plugins/forum/templates/forum_template.php
--- 0.7.5/e107_plugins/forum/templates/forum_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/forum/templates/forum_template.php	2006-07-16 16:57:03.000000000 -0500
@@ -11,16 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_template.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/07/16 21:57:03 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 if (!isset($FORUM_MAIN_START))
 {
-	$FORUM_MAIN_START = "<div style='text-align:center'>\n<div class='spacer'>\n<table style='width:95%' class='fborder'>\n<tr>\n<td colspan='2' style='width:60%; text-align:center' class='fcaption'>{FORUMTITLE}</td>\n<td style='width:10%; text-align:center' class='fcaption'>{THREADTITLE}</td>\n<td style='width:10%; text-align:center' class='fcaption'>{REPLYTITLE}</td>\n<td style='width:20%; text-align:center' class='fcaption'>{LASTPOSTITLE}</td>\n</tr>";
+	$FORUM_MAIN_START = "<div style='text-align:center'>\n<div class='spacer'>\n<table style='".USER_WIDTH."' class='fborder'>\n<tr>\n<td colspan='2' style='width:60%; text-align:center' class='fcaption'>{FORUMTITLE}</td>\n<td style='width:10%; text-align:center' class='fcaption'>{THREADTITLE}</td>\n<td style='width:10%; text-align:center' class='fcaption'>{REPLYTITLE}</td>\n<td style='width:20%; text-align:center' class='fcaption'>{LASTPOSTITLE}</td>\n</tr>";
 }
 if (!isset($FORUM_MAIN_PARENT))
 {
@@ -32,12 +33,12 @@
 }
 if (!isset($FORUM_MAIN_END))
 {
-	$FORUM_MAIN_END = "</table></div>\n<div class='spacer'>\n<table style='width:95%' class='fborder'>\n<tr>\n<td colspan='2' style='width:60%' class='fcaption'>{INFOTITLE}</td>\n</tr>\n<tr>\n<td rowspan='4' style='width:5%; text-align:center' class='forumheader3'>{LOGO}</td>\n<td style='width:auto' class='forumheader3'>{USERINFO}</td>\n</tr>\n<tr>\n<td style='width:95%' class='forumheader3'>{INFO}</td>\n</tr><tr>\n<td style='width:95%' class='forumheader3'>{FORUMINFO}</td>\n</tr>\n<tr>\n<td style='width:95%' class='forumheader3'>{USERLIST}<br />{STATLINK}</td>\n</tr>\n</table>\n</div>\n<div class='spacer'>\n<table class='fborder' style='width:95%'>\n<tr>\n<td class='forumheader3' style='text-align:center; width:33%'>{ICONKEY}</td>\n<td style='text-align:center; width:33%' class='forumheader3'>{SEARCH}</td>\n<td style='width:33%; text-align:center; vertical-align:middle' class='forumheader3'><span class='smallblacktext'>{PERMS}</span>\n</td>\n</tr>\n</table>\n</div>\n</div>";
+	$FORUM_MAIN_END = "</table></div>\n<div class='spacer'>\n<table style='".USER_WIDTH."' class='fborder'>\n<tr>\n<td colspan='2' style='width:60%' class='fcaption'>{INFOTITLE}</td>\n</tr>\n<tr>\n<td rowspan='4' style='width:5%; text-align:center' class='forumheader3'>{LOGO}</td>\n<td style='width:auto' class='forumheader3'>{USERINFO}</td>\n</tr>\n<tr>\n<td style='width:95%' class='forumheader3'>{INFO}</td>\n</tr><tr>\n<td style='width:95%' class='forumheader3'>{FORUMINFO}</td>\n</tr>\n<tr>\n<td style='width:95%' class='forumheader3'>{USERLIST}<br />{STATLINK}</td>\n</tr>\n</table>\n</div>\n<div class='spacer'>\n<table class='fborder' style='".USER_WIDTH."'>\n<tr>\n<td class='forumheader3' style='text-align:center; width:33%'>{ICONKEY}</td>\n<td style='text-align:center; width:33%' class='forumheader3'>{SEARCH}</td>\n<td style='width:33%; text-align:center; vertical-align:middle' class='forumheader3'><span class='smallblacktext'>{PERMS}</span>\n</td>\n</tr>\n</table>\n</div>\n</div>";
 }
 
 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>";
+	$FORUM_NEWPOSTS_START = "<div style='text-align:center'>\n<div class='spacer'>\n<table style='".USER_WIDTH."' 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 (!isset($FORUM_NEWPOSTS_MAIN))
@@ -52,7 +53,7 @@
 
 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";
+	$FORUM_TRACK_START = "<div style='text-align:center'>\n<div class='spacer'>\n<table style='".USER_WIDTH."' class='fborder'>\n<tr>\n<td colspan='3' style='width:60%' class='fcaption'>{TRACKTITLE}</td>\n</tr>\n";
 
 	if (!isset($FORUM_TRACK_MAIN))
 	{
diff -ruN 0.7.5/e107_plugins/forum/templates/forum_viewforum_template.php 0.7.7/e107_plugins/forum/templates/forum_viewforum_template.php
--- 0.7.5/e107_plugins/forum/templates/forum_viewforum_template.php	2006-05-16 12:29:51.000000000 -0500
+++ 0.7.7/e107_plugins/forum/templates/forum_viewforum_template.php	2006-08-09 08:46:16.000000000 -0500
@@ -11,12 +11,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_viewforum_template.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/05/16 17:29:51 $
+|     $Revision: 1.17 $
+|     $Date: 2006/08/09 13:46:16 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 if (!$FORUM_VIEW_START)
 {
@@ -24,7 +25,7 @@
 
 	<div style='text-align:center'>
 	<div class='spacer'>
-	<table style='width:95%' class='fborder' >
+	<table style='".USER_WIDTH."' class='fborder' >
 	<tr>
 	<td class='fcaption'>{BREADCRUMB}</td>
 	</tr>
@@ -35,8 +36,8 @@
 	</tr>
 	</table>
 	</div>
-	
-	<table style='width: 95%'>
+
+	<table style='".USER_WIDTH."'>
 	<tr>
 	<td style='width:80%'>
 	<span class='mediumtext'>{THREADPAGES}</span>
@@ -48,7 +49,7 @@
 	</table>
 
 	<div class='spacer'>
-	<table style='width:95%' class='fborder'>
+	<table style='".USER_WIDTH."' class='fborder'>
 	<tr>
 	<td style='width:3%' class='fcaption'>&nbsp;</td>
 	<td style='width:47%' class='fcaption'>{THREADTITLE}</td>
@@ -64,7 +65,7 @@
 	$FORUM_VIEW_START_CONTAINER = "
 	<div style='text-align:center'>
 	<div class='spacer'>
-	<table style='width:95%' class='fborder' >
+	<table style='".USER_WIDTH."' class='fborder' >
 	<tr>
 	<td class='fcaption'>{BREADCRUMB}</td>
 	</tr>
@@ -72,7 +73,7 @@
 	</table>
 	</div>
 	";
-}	
+}
 
 
 if (!$FORUM_VIEW_FORUM) {
@@ -83,7 +84,7 @@
 
 		<table style='width:100%'>
 		<tr>
-		<td style='width:90%'><span class='mediumtext'><b>{THREADTYPE}{THREADNAME}</b></span> <span class='smalltext'>{PAGES}</span></td>
+		<td style='width:90%'><span class='mediumtext'><b>{THREADTYPE}{THREADNAME}</b></span><br /><span class='smalltext'>{PAGES}</span></td>
 		<td style='width:10%; white-space:nowrap;'>{ADMIN_ICONS}</td>
 		</tr>
 		</table>
@@ -145,8 +146,8 @@
 	$FORUM_VIEW_END = "
 		</table>
 		</div>
-		
-		<table style='width:95%'>
+
+		<table style='".USER_WIDTH."'>
 		<tr>
 		<td style='width:80%'><span class='mediumtext'>{THREADPAGES}</span>
 		</td>
@@ -162,16 +163,16 @@
 		</table>
 
 		<div class='spacer'>
-		<table class='fborder' style='width:95%'>
+		<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>
 		</tr>
 		</table>
 		</div>
-		
+
 		<div class='spacer'>
-		<table class='fborder' style='width:95%'>
+		<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}
@@ -182,8 +183,8 @@
 		</div>
 		<div class='spacer'>
 		<div style='text-align:center;'>
-		<a href='".e_PLUGIN."rss_menu/rss.php?11.1.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss1.png' alt='".LAN_431."' style='vertical-align: middle; border: 0;' /></a> 
-		<a href='".e_PLUGIN."rss_menu/rss.php?11.2.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss2.png' alt='".LAN_432."' style='vertical-align: middle; border: 0;' /></a> 
+		<a href='".e_PLUGIN."rss_menu/rss.php?11.1.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss1.png' alt='".LAN_431."' style='vertical-align: middle; border: 0;' /></a>
+		<a href='".e_PLUGIN."rss_menu/rss.php?11.2.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss2.png' alt='".LAN_432."' style='vertical-align: middle; border: 0;' /></a>
 		<a href='".e_PLUGIN."rss_menu/rss.php?11.3.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss3.png' alt='".LAN_433."' style='vertical-align: middle; border: 0;' /></a>
 		</div>
 		<div class='nforumdisclaimer' style='text-align:center'>Powered by <b>e107 Forum System</b></div></div>
@@ -194,7 +195,7 @@
 if(!$FORUM_VIEW_END_CONTAINER)
 {
 	$FORUM_VIEW_END_CONTAINER = "
-		<table style='width:95%'>
+		<table style='".USER_WIDTH."'>
 		<tr>
 		<td colspan ='2'>
 		{FORUMJUMP}
@@ -203,7 +204,7 @@
 		</table>
 		<div class='nforumdisclaimer' style='text-align:center'>Powered by <b>e107 Forum System</b></div></div>
 ";
-}	
+}
 
 
 if (!$FORUM_VIEW_SUB_START)
diff -ruN 0.7.5/e107_plugins/forum/templates/forum_viewtopic_template.php 0.7.7/e107_plugins/forum/templates/forum_viewtopic_template.php
--- 0.7.5/e107_plugins/forum/templates/forum_viewtopic_template.php	2006-05-16 12:29:51.000000000 -0500
+++ 0.7.7/e107_plugins/forum/templates/forum_viewtopic_template.php	2006-11-09 12:19:47.000000000 -0600
@@ -11,34 +11,38 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_viewtopic_template.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/05/16 17:29:51 $
+|     $Revision: 1.25 $
+|     $Date: 2006/11/09 18:19:47 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%;margin-left:auto;margin-right:auto"); }
+
 
 $sc_style['LASTEDIT']['pre'] = "<br /><br /><span class='smallblacktext'>[ ".LAN_29." ";
 $sc_style['LASTEDIT']['post'] = " ]</span>";
-	
+
 $sc_style['LEVEL']['pre'] = "<div class='spacer'>";
 $sc_style['LEVEL']['post'] = "</div>";
 
-$sc_style['ANON_IP']['pre'] = "<br /><span class='smalltext'>";
-$sc_style['ANON_IP']['post'] = "</span>";
+$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}" : "");
 
 $FORUMSTART = "<a id='top'></a><div style='text-align:center'>
 	<div class='spacer'>
-	<table style='width:95%' class='fborder'>
+	<table style='".USER_WIDTH."' class='fborder'>
 	<tr>
 	<td class='fcaption'>
 	{BACKLINK}
 	</td>
 	<td class='fcaption' style='text-align: right'>
-	<span class='smalltext'>&nbsp;
+	<div class='smalltext'>&nbsp;
 	{TRACK}
-	</span>
+	</div>
 	</td>
 	<td class='fcaption' style='text-align: right'>
 	<span class='smalltext'>
@@ -53,8 +57,8 @@
 	</tr>
 	</table>
 	</div>
-	
-	<table style='width:95%'>
+
+	<table style='".USER_WIDTH."'>
 	<tr>
 	<td style='width:60%; text-align: left'>
 	{GOTOPAGES}
@@ -74,9 +78,9 @@
 	</td>
 	</tr>
 	</table>
-	
+
 	<div class='spacer'>
-	<table style='width:95%' class='fborder'>
+	<table style='".USER_WIDTH."' class='fborder'>
 	<tr>
 	<td style='width:20%; text-align:center' class='fcaption'>
 	".LAN_402."
@@ -109,14 +113,14 @@
 	<td class='forumheader3' style='vertical-align:top'>
 	{CUSTOMTITLE}
 	{AVATAR}
-	<span class='smalltext'>
+	<div class='smalltext'>
 	{LEVEL=special}
 	{LEVEL=pic}
 	{LEVEL=userid}
 	{JOINED}
-	{EXTENDED=location.text}: {EXTENDED=location.value}<br />
+	{$location_tpl}<br />
 	{POSTS}
-	</span>
+	</div>
 	</td>
 	<td class='forumheader3' style='vertical-align:top'>{POLL}
 	{POST}
@@ -153,9 +157,9 @@
 
 $FORUMEND = "<tr><td colspan='2' class='forumheader3' style='text-align:center'>{QUICKREPLY}</td></tr></table></div>
 
-	<table style='width:95%'>
+	<table style='".USER_WIDTH."'>
 	<tr>
-	<td style='width:80%'><span class='mediumtext'>{GOTOPAGES}</span>
+	<td style='width:80%'><span class='mediumtext'>{GOTOPAGES}&nbsp;</span>
 	</td>
 	<td style='width:20%; text-align: right; white-space: nowrap'>
 	{BUTTONS}
@@ -168,7 +172,7 @@
 	</tr>
 	</table>
 	</div>
-	
+
 	<div style='text-align:center' class='spacer'>
 	<a href='".e_PLUGIN."rss_menu/rss.php?8.1.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss1.png' alt='".LAN_431."' style='vertical-align: middle; border: 0;' /></a> <a href='".e_PLUGIN."rss_menu/rss.php?8.2.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss2.png' alt='".LAN_432."' style='vertical-align: middle; border: 0;' /></a> <a href='".e_PLUGIN."rss_menu/rss.php?8.3.".e_QUERY."'><img src='".e_PLUGIN."rss_menu/images/rss3.png' alt='".LAN_433."' style='vertical-align: middle; border: 0;' /></a></div><div class='nforumdisclaimer' style='text-align:center'>Powered by <b>e107 Forum System</b></div>";
 
@@ -195,14 +199,14 @@
 	<td class='forumheader3' style='vertical-align:top'>
 	{CUSTOMTITLE}
 	{AVATAR}
-	<span class='smalltext'>
+	<div class='smalltext'>
 	{LEVEL=special}
 	{LEVEL=pic}
 	{LEVEL=userid}
 	{JOINED}
-	{EXTENDED=location.text}: {EXTENDED=location.value}<br />
+	{$location_tpl}<br />
 	{POSTS}
-	</span>
+	</div>
 	</td>
 	<td class='forumheader3' style='vertical-align:top'>{POST}
 	{LASTEDIT}
@@ -249,5 +253,5 @@
 $FORUM_CRUMB['subparent']['sep'] = " :: ";
 
 $FORUM_CRUMB['forum']['value'] = "<a class='forumlink' {FORUM_HREF}>{FORUM_TITLE}</a>";
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/gsitemap/admin_config.php 0.7.7/e107_plugins/gsitemap/admin_config.php
--- 0.7.5/e107_plugins/gsitemap/admin_config.php	2006-04-15 12:43:12.000000000 -0500
+++ 0.7.7/e107_plugins/gsitemap/admin_config.php	2006-11-07 08:59:18.000000000 -0600
@@ -11,19 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/gsitemap/admin_config.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/04/15 17:43:12 $
-|     $Author: e107coders $
+|     $Revision: 1.14 $
+|     $Date: 2006/11/07 14:59:18 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 if(!getperms("P")){ header("location:".e_BASE."index.php"); }
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."userclass_class.php");
-
-$ec_dir = e_PLUGIN."gsitemap/";
-$lan_file = $ec_dir."languages/gsitemap_".e_LANGUAGE.".php";
-e107_include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."gsitemap/languages/gsitemap_English.php");
+include_lan(e_PLUGIN."gsitemap/languages/gsitemap_".e_LANGUAGE.".php");
 
 $gsm = new gsitemap;
 
@@ -33,6 +30,7 @@
 {
 
 	var $message;
+    var $freq_list = array();
 
 /*+----------------------#######################################################################################---------------------+*/
 
@@ -40,6 +38,17 @@
 	{
 		/* constructor */
 
+		$this->freq_list = array
+		(
+			"always"	=>	GSLAN_11,
+			"hourly"	=>	GSLAN_12,
+			"daily"		=>	GSLAN_13,
+			"weekly"	=>	GSLAN_14,
+			"monthly"	=>	GSLAN_15,
+			"yearly"	=>	GSLAN_16,
+			"never"		=>	GSLAN_17
+		);
+
 		if(isset($_POST['edit']))
 		{
 			$this -> editSme();
@@ -91,7 +100,7 @@
 	{
 		global $sql,$ns,$tp;
 		$gen = new convert;
-		$count = $sql -> db_Select("gsitemap", "*", "gsitemap_id !=0 ORDER BY gsitemap_id ASC");
+		$count = $sql -> db_Select("gsitemap", "*", "gsitemap_id !=0 ORDER BY gsitemap_order ASC");
 
 		$text = "<div style='text-align:center'>
 
@@ -110,7 +119,6 @@
 		}
 		else
 		{
-
 			$text .= "
 
 			<form action='".e_SELF."' id='display' method='post'>
@@ -130,15 +138,14 @@
 			$glArray = $sql -> db_getList();
 			foreach($glArray as $row2)
 			{
-
-				$datestamp = $gen->convert_date($row2['GSLAN_astmod'], "short");
+				$datestamp = $gen->convert_date($row2['gsitemap_lastmod'], "short");
 
 				$text .= "<tr>
 				<td class='forumheader3' style='; text-align: center;'>".$row2['gsitemap_id'] ."</td>
-				<td class='forumheader3'>".$row2['gsitemap_name']."</td>
-				<td class='forumheader3'>".str_replace(SITEURL,"",$row2['gsitemap_url'])."</td>
+				<td class='forumheader3'>".$tp->toHTML($row2['gsitemap_name'],"","defs")."</td>
+				<td class='forumheader3'>".$row2['gsitemap_url']."</td>
 				<td class='forumheader3' style='; text-align: center;'>".$datestamp."</td>
-				<td class='forumheader3' style='; text-align: center;'>".$row2['gsitemap_freq'] ."</td>
+				<td class='forumheader3' style='; text-align: center;'>".$this->freq_list[($row2['gsitemap_freq'])]."</td>
 				<td class='forumheader3' style='; text-align: center;'>".$row2['gsitemap_priority'] ."</td>
 
 				<td style='width:50px;white-space:nowrap' class='forumheader3'>
@@ -196,16 +203,10 @@
 		<span class='smalltext'>&nbsp;</span></td>
 		<td class='forumheader3'>
 		<input class='tbox' type='text' style='width:90%' name='gsitemap_url' size='40' value='".$editArray['gsitemap_url']."' maxlength='100' />
+		<input class='tbox' type='hidden'  name='gsitemap_lastmod' size='40' value='".time()."' maxlength='100' />
 		</td>
 		</tr>
 
-		<tr>
-		<td style='width:25%' class='forumheader3'>".GSLAN_27."
-		<span class='smalltext'>&nbsp;</span></td>
-		<td class='forumheader3'>
-		<input class='tbox' type='text'  name='GSLAN_astmod' size='40' value='".$editArray['GSLAN_astmod']."' maxlength='100' />
-		</td>
-		</tr>
 
 		<tr>
 		<td style='width:25%' class='forumheader3'>".GSLAN_10."
@@ -213,11 +214,9 @@
 		<td class='forumheader3'>
 		<select class='tbox' name='gsitemap_freq' >\n";
 
-		$freq_list = array(GSLAN_11, GSLAN_12, GSLAN_13,GSLAN_14,GSLAN_15,GSLAN_16,GSLAN_17);
-
-		foreach($freq_list as $fq){
-			$sel = ($editArray['gsitemap_freq'] == $fq)? "selected='selected'" : "";
-			$text .= "<option value='$fq' $sel>$fq</option>\n";
+		foreach($this->freq_list as $k=>$fq){
+			$sel = ($editArray['gsitemap_freq'] == $k)? "selected='selected'" : "";
+			$text .= "<option value='$k' $sel>".$fq."</option>\n";
 		}
 
 		$text.="</select>
@@ -245,7 +244,7 @@
 		<td class='forumheader3'><select name='gsitemap_order' class='tbox'>";
 
 		for($i=0;$i<$count;$i++){
-			$text .= $meet_order == $i ? "<option value='".$i."' selected='selected'>".$i."</option>" : "<option value='".$i."'>".$i."</option>";
+			$text .= $editArray['gsitemap_order'] == $i ? "<option value='".$i."' selected='selected'>".$i."</option>" : "<option value='".$i."'>".$i."</option>";
 		}
 		$text .="
 		</select>
@@ -292,17 +291,14 @@
 		global $sql, $tp;
 		$gsitemap_name = $tp -> toDB($_POST['gsitemap_name']);
 		$gsitemap_url = $tp -> toDB($_POST['gsitemap_url']);
-		if(!strstr($gsitemap_url, "http"))
-		{
-			$gsitemap_url = SITEURL.$gsitemap_url;
-		}
+
 		if(isset($_POST['gsitemap_id']))
 		{
-			$this -> message = $sql -> db_Update("gsitemap", "gsitemap_name='$gsitemap_name', gsitemap_url='$gsitemap_url', gsitemap_priority='".$_POST['gsitemap_priority']."', GSLAN_astmod='".$_POST['GSLAN_astmod']."', gsitemap_freq= '".$_POST['gsitemap_freq']."', gsitemap_order='".$_POST['gsitemap_order']."', gsitemap_active='".$_POST['gsitemap_active']."' WHERE gsitemap_id='".$_POST['gsitemap_id']."' ") ? LAN_UPDATED : LAN_UPDATED_FAILED;
+			$this -> message = $sql -> db_Update("gsitemap", "gsitemap_name='$gsitemap_name', gsitemap_url='$gsitemap_url', gsitemap_priority='".$_POST['gsitemap_priority']."', gsitemap_lastmod='".$_POST['gsitemap_lastmod']."', gsitemap_freq= '".$_POST['gsitemap_freq']."', gsitemap_order='".$_POST['gsitemap_order']."', gsitemap_active='".$_POST['gsitemap_active']."' WHERE gsitemap_id='".$_POST['gsitemap_id']."' ") ? LAN_UPDATED : LAN_UPDATED_FAILED;
 		}
 		else
 		{
-			$this -> message = ($sql -> db_Insert("gsitemap", "0, '".$_POST['gsitemap_name']."', '".$_POST['gsitemap_url']."', '".$_POST['GSLAN_astmod']."', '".$_POST['gsitemap_freq']."', '".$_POST['gsitemap_priority']."', '".$_POST['gsitemap_cat']."', '".$_POST['gsitemap_order']."', '".$_POST['gsitemap_img']."', '".$_POST['gsitemap_active']."' ")) ? LAN_CREATED : LAN_CREATED_FAILED;
+			$this -> message = ($sql -> db_Insert("gsitemap", "0, '".$_POST['gsitemap_name']."', '".$gsitemap_url."', '".$_POST['gsitemap_lastmod']."', '".$_POST['gsitemap_freq']."', '".$_POST['gsitemap_priority']."', '".$_POST['gsitemap_cat']."', '".$_POST['gsitemap_order']."', '".$_POST['gsitemap_img']."', '".$_POST['gsitemap_active']."' ")) ? LAN_CREATED : LAN_CREATED_FAILED;
 		}
 	}
 
@@ -329,7 +325,7 @@
 		{
 			if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row['link_name']."' "))
 			{
-				$importArray[] = array('name' => $row['link_name'], 'url' => SITEURL.$row['link_url'], 'type' => GSLAN_1);
+				$importArray[] = array('name' => $row['link_name'], 'url' => $row['link_url'], 'type' => GSLAN_1);
 			}
 		}
 
@@ -340,7 +336,7 @@
 		{
 			if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row['page_title']."' "))
 			{
-				$importArray[] = array('name' => $row['page_title'], 'url' => SITEURL."page.php?".$row['page_id'],'type' => "Custom Page");
+				$importArray[] = array('name' => $row['page_title'], 'url' => "page.php?".$row['page_id'],'type' => "Custom Page");
 			}
 		}
 
@@ -353,7 +349,7 @@
 		{
 			if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row['forum_name']."' "))
 			{
-				$importArray[] = array('name' => $row['forum_name'], 'url' => SITEURL.$PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$row['forum_id'], 'type' => "Forum");
+				$importArray[] = array('name' => $row['forum_name'], 'url' => $PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$row['forum_id'], 'type' => "Forum");
 			}
 		}
 
@@ -369,7 +365,7 @@
 			{
 				if(!$sql -> db_Select("gsitemap", "*", "gsitemap_name='".$row2['content_heading']."' "))
 				{
-					$importArray[] = array('name' => $row2['content_heading'], 'url' => SITEURL.$PLUGINS_DIRECTORY."content/content.php?content.".$row2['content_id'], 'type' => $row['content_heading']);
+					$importArray[] = array('name' => $row2['content_heading'], 'url' => $PLUGINS_DIRECTORY."content/content.php?content.".$row2['content_id'], 'type' => $row['content_heading']);
 				}
 			}
 
@@ -428,11 +424,9 @@
 
 		<select class='tbox' name='import_freq' >\n";
 
-		$freq_list = array(GSLAN_11, GSLAN_12, GSLAN_13,GSLAN_14,GSLAN_15,GSLAN_16,GSLAN_17);
-
-		foreach($freq_list as $fq){
-			$sel = ($editArray['gsitemap_freq'] == $fq)? "selected='selected'" : "";
-			$text .= "<option value='$fq' $sel>$fq</option>\n";
+		foreach($this->freq_list as $k=>$fq){
+			$sel = ($editArray['gsitemap_freq'] == $k)? "selected='selected'" : "";
+			$text .= "<option value='$k' $sel>$fq</option>\n";
 		}
 
 		$text.="</select> <br /><br />
@@ -509,4 +503,4 @@
 	show_admin_menu(GSLAN_19, $action, $var);
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/gsitemap/gsitemap_sql.php 0.7.7/e107_plugins/gsitemap/gsitemap_sql.php
--- 0.7.5/e107_plugins/gsitemap/gsitemap_sql.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/gsitemap/gsitemap_sql.php	2006-06-01 20:04:10.000000000 -0500
@@ -0,0 +1,13 @@
+CREATE TABLE gsitemap (
+	gsitemap_id int(11) unsigned NOT NULL auto_increment,
+	gsitemap_name varchar(200) NOT NULL default '',
+	gsitemap_url varchar(200) NOT NULL default '',
+	gsitemap_lastmod varchar(15) NOT NULL default '',
+	gsitemap_freq varchar(10) NOT NULL default '',
+	gsitemap_priority char(3) NOT NULL default '',
+	gsitemap_cat varchar(100) NOT NULL default '',
+	gsitemap_order int(3) NOT NULL default '0',
+	gsitemap_img varchar(50) NOT NULL default '',
+	gsitemap_active int(3) NOT NULL default '0',
+	PRIMARY KEY  (gsitemap_id)
+) TYPE=MyISAM;
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/gsitemap/plugin.php 0.7.7/e107_plugins/gsitemap/plugin.php
--- 0.7.5/e107_plugins/gsitemap/plugin.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/gsitemap/plugin.php	2006-06-01 20:04:10.000000000 -0500
@@ -10,9 +10,9 @@
 |       Released under the terms and conditions of the
 |       GNU General Public License (http://gnu.org).
 |     	$Source: /cvsroot/e107/e107_0.7/e107_plugins/gsitemap/plugin.php,v $
-|     	$Revision: 1.7 $
-|     	$Date: 2005/12/14 19:28:44 $
-|     	$Author: sweetas $
+|     	$Revision: 1.8 $
+|     	$Date: 2006/06/02 01:04:10 $
+|     	$Author: e107coders $
 +---------------------------------------------------------------+
 */
 
@@ -40,7 +40,7 @@
 
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/icon.png";
-$eplug_icon_small = $eplug_folder."/images/icon_16.png";   
+$eplug_icon_small = $eplug_folder."/images/icon_16.png";
 $eplug_logo = $eplug_folder."/images/icon.png";
 
 $eplug_caption =  "Configure Sitemap";
@@ -59,11 +59,11 @@
 	gsitemap_url varchar(200) NOT NULL default '',
 	gsitemap_lastmod varchar(15) NOT NULL default '',
 	gsitemap_freq varchar(10) NOT NULL default '',
-	gsitemap_priority varchar(3) NOT NULL default '',
+	gsitemap_priority char(3) NOT NULL default '',
 	gsitemap_cat varchar(100) NOT NULL default '',
-	gsitemap_order int(3) NOT NULL default '',
+	gsitemap_order int(3) NOT NULL default '0',
 	gsitemap_img varchar(50) NOT NULL default '',
-	gsitemap_active int(3) NOT NULL default '',
+	gsitemap_active int(3) NOT NULL default '0',
 	PRIMARY KEY  (gsitemap_id)
 ) TYPE=MyISAM;"
 );
diff -ruN 0.7.5/e107_plugins/integrity_check/admin_integrity_check.php 0.7.7/e107_plugins/integrity_check/admin_integrity_check.php
--- 0.7.5/e107_plugins/integrity_check/admin_integrity_check.php	2006-04-18 03:37:54.000000000 -0500
+++ 0.7.7/e107_plugins/integrity_check/admin_integrity_check.php	2006-10-24 08:43:34.000000000 -0500
@@ -406,7 +406,7 @@
 	$text .= "<b><u>".Integ_19.":</u></b><br />";
 	reset($core_array);
 	foreach($core_array as $v) {
-		$text .= "<input type='radio' name='input_files' value='".$v."' >".str_replace(array(e_BASE, e_PLUGIN, $o_path), array("", "", ""), $v)."<br />";
+		$text .= "<input type='radio' name='input_files' value='".$v."' />".str_replace(array(e_BASE, e_PLUGIN, $o_path), array("", "", ""), $v)."<br />";
 	}
 } else {
 	$text .= "<b>".Integ_16."</b><br />";
@@ -415,14 +415,14 @@
 	$text .= "<hr><b><u>".Integ_20.":</u></b><br />";
 	reset($file_array);
 	foreach($file_array as $v) {
-		$text .= "<input type='radio' name='input_files' value='".$v."' >".str_replace(array(e_BASE, e_PLUGIN, $PLUGINS_DIRECTORY), array("", "", ""), $v)."<br />";
+		$text .= "<input type='radio' name='input_files' value='".$v."' />".str_replace(array(e_BASE, e_PLUGIN, $PLUGINS_DIRECTORY), array("", "", ""), $v)."<br />";
 	}
 } else {
 	$text .= "<b>".Integ_17."</b><br />";
 }
 if ($core_array[0]) {
 	$text .= "<br /><hr>
-		<input type='checkbox' name='theme_folders' value='on'>".Integ_23."<br />";
+		<input type='checkbox' name='theme_folders' value='on' />".Integ_23."<br />";
 }
 if ($err_1 || $err_2 || !is_writeable($o_path)) {
 	$err_m = Integ_35."<br />";
diff -ruN 0.7.5/e107_plugins/integrity_check/languages/English.php 0.7.7/e107_plugins/integrity_check/languages/English.php
--- 0.7.5/e107_plugins/integrity_check/languages/English.php	2006-02-15 09:00:07.000000000 -0600
+++ 0.7.7/e107_plugins/integrity_check/languages/English.php	2006-06-22 14:49:58.000000000 -0500
@@ -4,12 +4,12 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/integrity_check/languages/English.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/02/15 15:00:07 $
-|     $Author: whoisrich $
+|     $Revision: 1.6 $
+|     $Date: 2006/06/22 19:49:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 define("Integ_01", "Saving successful");
 define("Integ_02", "Saving failed");
 define("Integ_03", "Missing Files:");
@@ -37,9 +37,9 @@
 define("Integ_25", "Leave Admin Area");
 define("Integ_26", "Load Site with normal header");
 define("Integ_27", "USE THE FILE INSPECTOR FOR CHECKING CORE FILES");
-	
-// define("Integ_29", "<br /><br /><b>*<u>CRC-ERRORS:</u></b><br />These are checksum errors and there are two possible reasons for this:<br />-You changed something within the mentioned file, so it isn't longer the same as the original.<br />-The mentioned file is corrupt, you should reupload it!");
-// language file should contain NO html. 
+
+// define("Integ_29", "<br /><br /><b>*<u>CRC-ERRORS:</u></b><br />These are checksum errors and there are two possible reasons for this:<br />-You changed something within the mentioned file, so it isn't longer the same as the original.<br />-The mentioned file is corrupt, you should re-upload it!");
+// language file should contain NO html.
 
 define("Integ_30", "For less cpu-usage , you can do the checking in 1 - 10 steps.");
 define("Integ_31", "Steps: ");
@@ -51,5 +51,5 @@
 define("Integ_37", "Click me");
 define("Integ_38", "Another <u><i>{counts}</i></u> lines to do...");
 define("Integ_39", "Please delete the file:<br />".e_PLUGIN."integrity_check/<u><i>do_core_file.php</i></u>!<br />It is outdated and never meant for public release...");
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/links_page/admin_linkspage_config.php 0.7.7/e107_plugins/links_page/admin_linkspage_config.php
--- 0.7.5/e107_plugins/links_page/admin_linkspage_config.php	2005-07-13 04:51:41.000000000 -0500
+++ 0.7.7/e107_plugins/links_page/admin_linkspage_config.php	2006-11-01 12:48:46.000000000 -0600
@@ -11,8 +11,8 @@
 |    GNU    General Public  License (http://gnu.org).
 |
 |    $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/admin_linkspage_config.php,v $
-|    $Revision: 1.5 $
-|    $Date: 2005/07/13 09:51:41 $
+|    $Revision: 1.8 $
+|    $Date: 2006/11/01 18:48:46 $
 |    $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -21,6 +21,7 @@
 if (!getperms("P")) {
 	header("location:".e_BASE."index.php");
 }
+require_once(e_PLUGIN.'links_page/link_shortcodes.php');
 require_once(e_PLUGIN.'links_page/link_defines.php');
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."userclass_class.php");
@@ -31,7 +32,7 @@
 e107_require_once(e_HANDLER.'arraystorage_class.php');
 $eArrayStorage = new ArrayData();
 require_once(e_PLUGIN.'links_page/link_class.php');
-$lc = new linkclass();
+$lc = new linkclass;
 
 $lan_file = $plugindir."languages/".e_LANGUAGE.".php";
 include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
@@ -53,17 +54,17 @@
 	}
 }
 if(isset($_POST['delete'])){
-	$tmp = array_pop(array_flip($_POST['delete']));
+	$tmp = array_pop($tmp = array_flip($_POST['delete']));
 	list($delete, $del_id) = explode("_", $tmp);
 }
 if (isset($_POST['create_category'])) {
-	$lc -> dbCategoryCreate($_POST);
+	$lc -> dbCategoryCreate();
 }
 if (isset($_POST['update_category'])) {
-	$lc -> dbCategoryUpdate($_POST);
+	$lc -> dbCategoryUpdate();
 }
 if (isset($_POST['updateoptions'])) {
-	$linkspage_pref = $lc -> UpdateLinksPagePref($_POST);
+	$linkspage_pref = $lc -> UpdateLinksPagePref();
 	$lc -> show_message(LCLAN_ADMIN_6);
 }
 if (isset($_POST['add_link'])) {
@@ -71,11 +72,11 @@
 }
 //upload link icon
 if(isset($_POST['uploadlinkicon'])){
-	$lc -> uploadLinkIcon($_POST);
+	$lc -> uploadLinkIcon();
 }
 //upload category icon
 if(isset($_POST['uploadcatlinkicon'])){
-	$lc -> uploadCatLinkIcon($_POST);
+	$lc -> uploadCatLinkIcon();
 }
 //update link order
 if (isset($_POST['update_order'])) {
@@ -106,9 +107,15 @@
 }
 //delete category
 if (isset($delete) && $delete == 'category') {
-	if ($sql->db_Delete("links_page_cat", "link_category_id='$del_id' ")) {
-		$lc->show_message(LCLAN_ADMIN_12." #".$del_id." ".LCLAN_ADMIN_11);
-		unset($id);
+	//check if links are present for this category
+	if($sql->db_Select("links_page", "*", "link_category='$del_id' ")) {
+		$lc->show_message(LCLAN_ADMIN_12." #".$del_id." ".LAN_DELETED_FAILED."<br />".LCLAN_ADMIN_15);
+	//no? then we can safely remove this category
+	}else{
+		if ($sql->db_Delete("links_page_cat", "link_category_id='$del_id' ")) {
+			$lc->show_message(LCLAN_ADMIN_12." #".$del_id." ".LCLAN_ADMIN_11);
+			unset($id);
+		}
 	}
 }
 //delete submitted link
@@ -119,7 +126,6 @@
 }
 
 
-
 //show link categories (cat edit)
 if (!e_QUERY) {
 	$lc->show_categories("cat");
diff -ruN 0.7.5/e107_plugins/links_page/e_comment.php 0.7.7/e107_plugins/links_page/e_comment.php
--- 0.7.5/e107_plugins/links_page/e_comment.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/e_comment.php	2006-06-22 14:13:41.000000000 -0500
@@ -1,12 +1,41 @@
 <?php
 
 if (!defined('e107_INIT')) { exit; }
-
+/*
 $e_plug_table = "links_page"; //This is set to the table name you have decided to use.
 $reply_location= e_PLUGIN."links_page/links.php?comment.$nid"; //This is set to the location you'd like the user to return to after replying to a comment.
 $db_table = "links_page"; //This is the name of your plugins database table.
 $link_name = "link_name"; //This is the name of the field in your plugin's db table that corresponds to it's name or title.
 $db_id = "link_id"; // This is the name of the field in your plugin's db table that correspond to it's unique id number.
 $plugin_name = "Links"; // A name for your plugin. It will be used in links to comments, in list_new/new.php.
+*/
+
+//This is set to the table name you have decided to use.
+$e_comment['eplug_comment_ids'] = "links_page";
+
+//This is set to the location you'd like the user to return to after replying to a comment.
+$e_comment['reply_location'] = e_PLUGIN."links_page/links.php?comment.{NID}";
+
+//A name for your plugin. It will be used in links to comments, in list_new/new.php.
+$e_comment['plugin_name'] = "links_page";
+
+//The path of the plugin folder
+$e_comment['plugin_path'] = "links_page";
+
+//This is the name of the field in your plugin's db table that corresponds to it's name or title.
+$e_comment['db_title'] = "link_name";
+
+//This is the name of the field in your plugin's db table that correspond to it's unique id number.
+$e_comment['db_id'] = "link_id";
+
+//qry must be set with a select_gen query.
+//the main reason would be to check if a category from another table has a class restriction
+//the id of the item should be provided as {NID}
+//returned fields should at least contain the 'link_id' and 'db_id' fields set above
+$e_comment['qry'] = "
+SELECT l.*,c.*
+FROM #links_page as l
+LEFT JOIN #links_page_cat AS c ON l.link_category = c.link_category_id
+WHERE l.link_id='{NID}' AND l.link_class REGEXP '".e_CLASS_REGEXP."' AND c.link_category_class REGEXP '".e_CLASS_REGEXP."' ";
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/links_page/e_rss.php 0.7.7/e107_plugins/links_page/e_rss.php
--- 0.7.5/e107_plugins/links_page/e_rss.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/e_rss.php	2006-06-20 02:22:46.000000000 -0500
@@ -0,0 +1,50 @@
+<?php
+
+if (!defined('e107_INIT')) { exit; }
+
+
+//------  create feed for admin, return array $eplug_rss_feed ------------------
+
+$feed['name']		= 'Links Page';
+$feed['url']		= 'links';			//the identifier for the rss feed url
+$feed['topic_id']	= '';					//the topic_id, empty on default (to select a certain category)
+$feed['path']		= 'links_page';		//this is the plugin path location
+$feed['text']		= 'this is the rss feed for the links_page entries';
+$feed['class']		= '0';
+$feed['limit']		= '9';
+
+//------ create rss data, return as array $eplug_rss_data -----------------------
+
+$qry = "
+SELECT l.*, c.link_category_id, c.link_category_name
+FROM #links_page AS l
+LEFT JOIN #links_page_cat AS c ON c.link_category_id = l.link_category
+WHERE l.link_class REGEXP '".e_CLASS_REGEXP."' AND c.link_category_class REGEXP '".e_CLASS_REGEXP."'
+ORDER BY l.link_datestamp DESC LIMIT 0,".$this->limit;
+
+$rss = array();
+$sqlrss = new db;
+if($items = $sqlrss->db_Select_gen($qry)){
+	$i=0;
+	while($rowrss = $sqlrss -> db_Fetch()){
+		$tmp						= '';
+		$rss[$i]['author']			= $tmp[1];
+		$rss[$i]['author_email']	= $tmp[2];
+		$rss[$i]['link']			= $rowrss['link_url'];
+		$rss[$i]['linkid']			= $rowrss['link_id'];
+		$rss[$i]['title']			= $rowrss['link_name'];
+		$rss[$i]['description']		= '';
+		$rss[$i]['category_name']	= $rowrss['link_category_name'];
+		$rss[$i]['category_link']	= $e107->base_path.$PLUGINS_DIRECTORY."links_page/links.php?cat.".$rowrss['link_category_id'];
+		$rss[$i]['datestamp']		= $rowrss['link_datestamp'];
+		$rss[$i]['enc_url']			= "";
+		$rss[$i]['enc_leng']		= "";
+		$rss[$i]['enc_type']		= "";
+		$i++;
+	}
+}
+
+//##### ------------------------------------------------------------------------------------
+$eplug_rss_data[] = $rss;
+$eplug_rss_feed[] = $feed;
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/links_page/e_status.php 0.7.7/e107_plugins/links_page/e_status.php
--- 0.7.5/e107_plugins/links_page/e_status.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/e_status.php	2006-07-07 22:38:17.000000000 -0500
@@ -1,12 +1,7 @@
 <?php
 if (!defined('e107_INIT')) { exit; }
+include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
 
-if (file_exists(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php")) {
-	include_once(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
-	} else {
-	include_once(e_PLUGIN."links_page/languages/English.php");
-}
-$sql2 = new db;
-$count = $sql2 -> db_Count("links_page", "(*)");
+$count = $sql -> db_Count("links_page", "(*)");
 $text .= "<div style='padding-bottom: 2px;'><img src='".e_PLUGIN."links_page/images/linkspage_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ".LCLAN_ADMIN_14.": ".$count."</div>";
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/links_page/languages/English.php 0.7.7/e107_plugins/links_page/languages/English.php
--- 0.7.5/e107_plugins/links_page/languages/English.php	2006-02-13 02:35:00.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/languages/English.php	2006-10-28 15:22:18.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/languages/English.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2006/02/13 08:35:00 $
+|     $Revision: 1.28 $
+|     $Date: 2006/10/28 20:22:18 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
@@ -57,7 +57,7 @@
 define("LCLAN_OPT_14", "icon");
 define("LCLAN_OPT_15", "description");
 define("LCLAN_OPT_16", "amount");
-define("LCLAN_OPT_17", "referal");
+define("LCLAN_OPT_17", "referral");
 define("LCLAN_OPT_18", "url");
 define("LCLAN_OPT_19", "total category info line");
 define("LCLAN_OPT_20", "link to top refer");
@@ -85,7 +85,7 @@
 define("LCLAN_OPT_42", "use individual link setting");
 define("LCLAN_OPT_43", "Opens in same window");
 define("LCLAN_OPT_44", "Opens in new window");
-define("LCLAN_OPT_45", "Opens in 600x400 miniwindow");
+define("LCLAN_OPT_45", "Opens in 600x400 mini-window");
 define("LCLAN_OPT_46", "who can manage links");
 define("LCLAN_OPT_47", "these users can add/edit their own personal links");
 define("LCLAN_OPT_48", "allow direct posting");
@@ -130,20 +130,21 @@
 define("LCLAN_OPT_86", "link menu");
 define("LCLAN_OPT_87", "show amount of links");
 
-define("LCLAN_ADMIN_1", "update");
+define("LCLAN_ADMIN_1", "update");  // deprecated
 define("LCLAN_ADMIN_2", "Link saved to database.");
 define("LCLAN_ADMIN_3", "Link updated in database.");
 define("LCLAN_ADMIN_4", "Link Category Saved");
 define("LCLAN_ADMIN_5", "Link Category Updated");
 define("LCLAN_ADMIN_6", "Options Saved");
-define("LCLAN_ADMIN_7", "link icon was uploaded succefully !");
+define("LCLAN_ADMIN_7", "link icon was uploaded successfully !");
 define("LCLAN_ADMIN_8", "link icon was not uploaded !");
 define("LCLAN_ADMIN_9", "Order updated");
 define("LCLAN_ADMIN_10", "Link");
-define("LCLAN_ADMIN_11", "deleted");
+define("LCLAN_ADMIN_11", "deleted"); // deprecated
 define("LCLAN_ADMIN_12", "Link Category");
 define("LCLAN_ADMIN_13", "Submitted link deleted");
 define("LCLAN_ADMIN_14", "Links");
+define("LCLAN_ADMIN_15", "This category still contains links, please (re)move them first");
 
 define("LCLAN_SL_1", "Submitted Links");
 define("LCLAN_SL_2", "No submitted links");
@@ -212,7 +213,7 @@
 define("LCLAN_ITEM_16", "Open Type:");
 define("LCLAN_ITEM_17", "Opens in same window");
 define("LCLAN_ITEM_18", "Opens in new window");
-define("LCLAN_ITEM_19", "Opens in 600x400 miniwindow");
+define("LCLAN_ITEM_19", "Opens in 600x400 mini-window");
 define("LCLAN_ITEM_20", "Visible for:");
 define("LCLAN_ITEM_21", "tick to update timestamp to current time");
 define("LCLAN_ITEM_22", "Update Link");
@@ -232,7 +233,7 @@
 define("LCLAN_ITEM_36", "go");
 define("LCLAN_ITEM_37", "view all links");
 define("LCLAN_ITEM_38", "All Links");
-define("LCLAN_ITEM_39", "");
+define("LCLAN_ITEM_39", "Rating");
 
 define("LCLAN_ADMINMENU_1", "Link Options");
 define("LCLAN_ADMINMENU_2", "Manage Link Categories");
@@ -286,9 +287,9 @@
 define("LAN_LINKS_23", "are");
 define("LAN_LINKS_24", "total in");
 define("LAN_LINKS_25", "show all links");
-define("LAN_LINKS_26", "Referrals:");
+define("LAN_LINKS_26", "Referrals");
 define("LAN_LINKS_27", "submit a link");
-define("LAN_LINKS_28", "Thankyou");
+define("LAN_LINKS_28", "Thank you");
 define("LAN_LINKS_29", "Your link has been saved and will be reviewed by a site administrator.");
 define("LAN_LINKS_30", "Link Categories");
 define("LAN_LINKS_31", "submit a link");
@@ -297,7 +298,7 @@
 define("LAN_LINKS_34", "There are currently no links");
 define("LAN_LINKS_35", "personal links manager");
 define("LAN_LINKS_36", "link comments");
-define("LAN_LINKS_37", "comments:");
+define("LAN_LINKS_37", "Comments");
 define("LAN_LINKS_38", "date");
 define("LAN_LINKS_39", "Links");
 define("LAN_LINKS_40", "Category");
@@ -308,7 +309,7 @@
 define("LAN_LINKS_45", "Link Category");
 define("LAN_LINKS_46", "Link Subcategories");
 define("LAN_LINKS_47", "link navigator...");
-define("LAN_LINKS_48", "");
+define("LAN_LINKS_48", "-- view category --");
 define("LAN_LINKS_49", "");
 
 define("LAN_ADMIN_HELP_0", "linkspage help area");
@@ -331,9 +332,9 @@
 ");
 define("LAN_ADMIN_HELP_6", "<i>the options page allows you to change the behaviour of the links_page plugin</i><br /><br />
 general options<br />
-these options are generally used thoughout the link pages.<br /><br />
+these options are generally used throughout the link pages.<br /><br />
 personal link managers<br />
-the personal link managers are priviliged users who can manage their own personally added links.<br /><br />
+the personal link managers are privileged users who can manage their own personally added links.<br /><br />
 category page<br />
 here you can change options for the category page.<br /><br />
 links page<br />
diff -ruN 0.7.5/e107_plugins/links_page/link_class.php 0.7.7/e107_plugins/links_page/link_class.php
--- 0.7.5/e107_plugins/links_page/link_class.php	2006-03-09 17:08:58.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/link_class.php	2006-11-29 18:24:42.000000000 -0600
@@ -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.27 $
-|    $Date: 2006/03/09 23:08:58 $
-|    $Author: whoisrich $
+|    $Revision: 1.39 $
+|    $Date: 2006/11/30 00:24:42 $
+|    $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -32,14 +32,14 @@
         $linkspage_pref['link_comment'] = "";
         $linkspage_pref['link_rating'] = "";
 
-        $linkspage_pref['link_navigator_frontpage'] = "1";
+        $linkspage_pref['link_navigator_frontpage'] = "";
         $linkspage_pref['link_navigator_submit'] = "";
         $linkspage_pref['link_navigator_manager'] = "";
         $linkspage_pref['link_navigator_refer'] = "";
         $linkspage_pref['link_navigator_rated'] = "";
-        $linkspage_pref['link_navigator_allcat'] = "1";
-        $linkspage_pref['link_navigator_links'] = "1";
-        $linkspage_pref['link_navigator_category'] = "1";
+        $linkspage_pref['link_navigator_allcat'] = "";
+        $linkspage_pref['link_navigator_links'] = "";
+        $linkspage_pref['link_navigator_category'] = "";
 
         $linkspage_pref['link_cat_icon'] = "1";
         $linkspage_pref['link_cat_desc'] = "1";
@@ -111,7 +111,7 @@
         return $linkspage_pref;
     }
 
-    function UpdateLinksPagePref($_POST){
+    function UpdateLinksPagePref(){
         global $sql, $eArrayStorage, $tp;
 
         $num_rows = $sql -> db_Select("core", "*", "e107_name='links_page' ");
@@ -135,6 +135,30 @@
         return $linkspage_pref;
     }
 
+	function ShowNextPrev($from='0', $number, $total){
+		global $linkspage_pref, $qs, $tp, $link_shortcodes, $LINK_NEXTPREV, $LINK_NP_TABLE, $pref;
+
+		$number = (e_PAGE == 'admin_linkspage_config.php' ? '20' : $number);
+		if($total<=$number){
+			return;
+		}
+		if(e_PAGE == 'admin_linkspage_config.php' || (isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"])){
+			$np_querystring = e_SELF."?[FROM]".(isset($qs[0]) ? ".".$qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
+			$parms = $total.",".$number.",".$from.",".$np_querystring."";
+			$LINK_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
+
+			if(!isset($LINK_NP_TABLE)){
+				$template = (e_PAGE == 'admin_linkspage_config.php' ? e_THEME.$pref['sitetheme']."/" : THEME)."links_template.php";
+				if(is_readable($template)){
+					require_once($template);
+				}else{
+					require_once(e_PLUGIN."links_page/links_template.php");
+				}
+			}
+			echo $tp -> parseTemplate($LINK_NP_TABLE, FALSE, $link_shortcodes);
+		}
+	}
+
     function setPageTitle(){
         global $sql, $qs, $linkspage_pref;
 
@@ -180,32 +204,43 @@
         define("e_PAGETITLE", $page);
     }
 
-    function parse_link_append($open, $id){
-        global $linkspage_pref;
+
+
+
+    function parse_link_append($rowl){
+
+        global $tp;
+
+        global $linkspage_pref, $rowl;
         if($linkspage_pref['link_open_all'] && $linkspage_pref['link_open_all'] == "5"){
-            $link_open_type = $open;
+            $link_open_type = $rowl['link_open'];
         }else{
             $link_open_type = $linkspage_pref['link_open_all'];
         }
+
         switch ($link_open_type) {
             case 1:
-            $link_append = "<a href='".e_PLUGIN."links_page/links.php?view.".$id."' rel='external'>";
+            $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"open_window('".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."','full');return false;\" >"; // Googlebot won't see it any other way.
             break;
             case 2:
-            $link_append = "<a href='".e_PLUGIN."links_page/links.php?view.".$id."'>";
+            $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"location.href='".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."';return false\" >";  // Googlebot won't see it any other way.
             break;
             case 3:
-            $link_append = "<a href='".e_PLUGIN."links_page/links.php?view.".$id."'>";
+            $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"location.href='".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."';return false\" >";  // Googlebot won't see it any other way.
             break;
             case 4:
-            $link_append = "<a href=\"javascript:open_window('".e_PLUGIN."links_page/links.php?view.".$id."')\">";
+            $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"open_window('".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."');return false\">"; // Googlebot won't see it any other way.
             break;
             default:
-            $link_append = "<a href='".e_PLUGIN."links_page/links.php?view.".$id."'>";
+            $lappend = "<a class='linkspage_url' href='".$rowl['link_url']."' onclick=\"location.href='".e_PLUGIN."links_page/links.php?view.".$rowl['link_id']."';return false\" >";  // Googlebot won't see it any other way.
         }
-        return $link_append;
+        return $lappend;
     }
 
+
+
+
+
     function showLinkSort($mode=''){
         global $rs, $ns, $qs, $linkspage_pref;
 
@@ -231,7 +266,7 @@
 
         $sotext = "
         ".$rs -> form_open("post", e_SELF, "linkorder", "", "enctype='multipart/form-data'")."
-            ".LAN_LINKS_15." 
+            ".LAN_LINKS_15."
             ".$rs -> form_select_open("link_sort");
             if($mode == "cat"){
                 $sotext .= "
@@ -248,7 +283,7 @@
             }
             $sotext .= "
             ".$rs -> form_select_close()."
-            ".LAN_LINKS_6." 
+            ".LAN_LINKS_6."
             ".$rs -> form_select_open("link_order")."
             ".$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", "")."
@@ -317,7 +352,7 @@
                 $orderstring    = "order".($linkspage_pref["link_cat_order"] == "ASC" ? "a" : "d" ).($linkspage_pref["link_cat_sort"] ? $linkspage_pref["link_cat_sort"] : "date" );
             }else{
                 $orderstringcat = "order".($linkspage_pref["link_cat_order"] == "ASC" ? "a" : "d" ).($linkspage_pref["link_cat_sort"] ? $linkspage_pref["link_cat_sort"] : "date" );
-                
+
                 $orderstring    = "order".($linkspage_pref["link_order"] == "ASC" ? "a" : "d" ).($linkspage_pref["link_sort"] ? $linkspage_pref["link_sort"] : "date" );
             }
         }
@@ -342,7 +377,7 @@
         $ns->tablerender($caption, "<div style='text-align:center'><b>".$message."</b></div>");
     }
 
-    function uploadLinkIcon($_POST){
+    function uploadLinkIcon(){
         global $ns, $pref;
         $pref['upload_storagetype'] = "1";
         require_once(e_HANDLER."upload_handler.php");
@@ -361,7 +396,7 @@
         $this -> show_message($msg);
     }
 
-    function uploadCatLinkIcon($_POST){
+    function uploadCatLinkIcon(){
         global $ns, $pref;
         $pref['upload_storagetype'] = "1";
         require_once(e_HANDLER."upload_handler.php");
@@ -380,13 +415,13 @@
         $this -> show_message($msg);
     }
 
-    function dbCategoryCreate($_POST) {
+    function dbCategoryCreate() {
         global $sql, $tp;
         $link_t = $sql->db_Count("links_page_cat", "(*)");
         $sql->db_Insert("links_page_cat", " '0', '".$tp -> toDB($_POST['link_category_name'])."', '".$tp -> toDB($_POST['link_category_description'])."', '".$tp -> toDB($_POST['link_category_icon'])."', '".($link_t+1)."', '".$tp -> toDB($_POST['link_category_class'])."', '".time()."' ");
         $this->show_message(LCLAN_ADMIN_4);
     }
-    function dbCategoryUpdate($_POST) {
+    function dbCategoryUpdate() {
         global $sql, $tp;
         $time = ($_POST['update_datestamp'] ? time() : ($_POST['link_category_datestamp'] != "0" ? $_POST['link_category_datestamp'] : time()) );
         $sql->db_Update("links_page_cat", "link_category_name ='".$tp -> toDB($_POST['link_category_name'])."', link_category_description='".$tp -> toDB($_POST['link_category_description'])."', link_category_icon='".$tp -> toDB($_POST['link_category_icon'])."', link_category_order='".$tp -> toDB($_POST['link_category_order'])."', link_category_class='".$tp -> toDB($_POST['link_category_class'])."', link_category_datestamp='".intval($time)."'   WHERE link_category_id='".intval($_POST['link_category_id'])."'");
@@ -450,49 +485,51 @@
         $link_url           = $tp->toDB($_POST['link_url']);
         $link_description   = $tp->toDB($_POST['link_description']);
         $link_button        = $tp->toDB($_POST['link_but']);
-        
+
         if (!strstr($link_url, "http")) {
             $link_url = "http://".$link_url;
         }
-            
-        if(isset($mode) && $mode == "submit"){
-            if ($_POST['link_name'] && $_POST['link_url'] && $_POST['link_description']) {
+
+        //create link, submit area, tmp table
+		if(isset($mode) && $mode == "submit"){
+			if (!$_POST['link_name'] || !$_POST['link_url'] || !$_POST['link_description']) {
+				 message_handler("ALERT", 5);
+			} else {
                 $username           = (defined('USERNAME')) ? USERNAME : LAN_LINKS_3;
 
                 $submitted_link     = intval($_POST['cat_id'])."^".$link_name."^".$link_url."^".$link_description."^".$link_button."^".$username;
                 $sql->db_Insert("tmp", "'submitted_link', '".time()."', '$submitted_link' ");
-                
+
                 $edata_ls = array("link_category" => $_POST['cat_id'], "link_name" => $link_name, "link_url" => $link_url, "link_description" => $link_description, "link_button" => $link_button, "username" => $username, "submitted_link" => $submitted_link);
                 $e_event->trigger("linksub", $edata_ls);
                 //header("location:".e_SELF."?s");
                 js_location(e_SELF."?s");
-            } else {
-                message_handler("ALERT", 5);
             }
         }else{
             $link_t = $sql->db_Count("links_page", "(*)", "WHERE link_category='".intval($_POST['cat_id'])."'");
             $time   = ($_POST['update_datestamp'] ? time() : ($_POST['link_datestamp'] != "0" ? $_POST['link_datestamp'] : time()) );
 
-            if (is_numeric($qs[2]) && $qs[1] != "sn") {
-                if($qs[1] == "manage"){
+            //update link
+			if (is_numeric($qs[2]) && $qs[1] != "sn") {
+				$link_class = $_POST['link_class'];
+				if($qs[1] == "manage"){
                     $link_author = USERID;
-                    //$link_class = ($linkspage_pref['link_directpost'] ? $_POST['link_class'] : "255");
-                    $link_class = $_POST['link_class'];
                 }else{
-                    $link_author = ($_POST['link_author'] ? $tp -> toDB($_POST['link_author']) : USERID);
-                    $link_class = $_POST['link_class'];
+                    $link_author = ($_POST['link_author'] && $_POST['link_author']!='' ? $tp -> toDB($_POST['link_author']) : USERID);
                 }
 
                 $sql->db_Update("links_page", "link_name='$link_name', link_url='$link_url', link_description='$link_description', link_button= '$link_button', link_category='".intval($_POST['cat_id'])."', link_open='".intval($_POST['linkopentype'])."', link_class='".intval($link_class)."', link_datestamp='".intval($time)."', link_author='".$link_author."' WHERE link_id='".intval($qs[2])."'");
                 $e107cache->clear("sitelinks");
                 $this->show_message(LCLAN_ADMIN_3);
-            } else {
+            //create link
+			} else {
 
                 $sql->db_Insert("links_page", "0, '$link_name', '$link_url', '$link_description', '$link_button', '".intval($_POST['cat_id'])."', '".($link_t+1)."', '0', '".intval($_POST['linkopentype'])."', '".intval($_POST['link_class'])."', '".time()."', '".USERID."' ");
                 $e107cache->clear("sitelinks");
                 $this->show_message(LCLAN_ADMIN_2);
             }
-            if (is_numeric($qs[2]) && $qs[1] == "sn") {
+            //delete from tmp table after approval
+			if (is_numeric($qs[2]) && $qs[1] == "sn") {
                 $sql->db_Delete("tmp", "tmp_time='".intval($qs[2])."' ");
             }
         }
@@ -525,7 +562,7 @@
                 $row['link_url']            = $submitted[2];
                 $row['link_description']    = $submitted[3]."\n[i]".LCLAN_ITEM_1." ".$submitted[5]."[/i]";
                 $row['link_button']         = $submitted[4];
-                
+
             }
         }
 
@@ -651,7 +688,8 @@
         if (isset($qs[2]) && $qs[2] && $qs[1] == "edit") {
             $text .= $rs -> form_hidden("link_datestamp", $row['link_datestamp']);
             $text .= $rs -> form_checkbox("update_datestamp", 1, 0)." ".LCLAN_ITEM_21."<br /><br />";
-            $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_22, "", "", "").$rs -> form_hidden("link_id", $row['link_id']);
+            $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_22, "", "", "").$rs -> form_hidden("link_id", $row['link_id']).$rs -> form_hidden("link_author", $row['link_author']);
+
         } else {
             $text .= $rs -> form_button("submit", "add_link", LCLAN_ITEM_23, "", "", "");
         }
@@ -752,10 +790,7 @@
             ".$rs->form_close();
         }
         $ns->tablerender($caption, $text);
-
-        require_once(e_HANDLER."np_class.php");
-        $np_querystring = (isset($qs[0]) ? $qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "");
-        $ix = new nextprev(e_SELF, $from, $number, $link_total, NP_3, ($np_querystring ? $np_querystring : ""));
+		$this->ShowNextPrev($from, $number, $link_total);
     }
 
     function show_cat_create() {
@@ -991,12 +1026,12 @@
                 hide=document.getElementById(hideid).style;
                 show.display=\"\";
                 hide.display=\"none\";
-                
+
                 //showh=document.getElementById(showid+'help').style;
                 //hideh=document.getElementById(hideid+'help').style;
                 //showh.display=\"\";
                 //hideh.display=\"none\";
-                
+
                 hideid = showid;
             }
         }
@@ -1103,7 +1138,7 @@
         ".$rs -> form_radio("link_manager", "1", ($linkspage_pref['link_manager'] ? "1" : "0"), "", "").LCLAN_OPT_3."
         ".$rs -> form_radio("link_manager", "0", ($linkspage_pref['link_manager'] ? "0" : "1"), "", "").LCLAN_OPT_4;
         $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
-        
+
         $TOPIC_TOPIC = LCLAN_OPT_46;
         $TOPIC_FIELD = r_userclass("link_manager_class", $linkspage_pref['link_manager_class'])."<br />".LCLAN_OPT_47;
         $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
@@ -1305,7 +1340,7 @@
         $TOPIC_TOPIC = LCLAN_OPT_79;
         $TOPIC_FIELD = $rs -> form_text("link_menu_navigator_caption", "15", $linkspage_pref['link_menu_navigator_caption'], "100", "tbox", "", "", "");
         $text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
-        
+
         $TOPIC_TOPIC = LCLAN_OPT_69;
         $TOPIC_FIELD = "
         ".$rs -> form_radio("link_menu_navigator_rendertype", "1", ($linkspage_pref['link_menu_navigator_rendertype'] ? "1" : "0"), "", "").LCLAN_OPT_76."
diff -ruN 0.7.5/e107_plugins/links_page/link_defines.php 0.7.7/e107_plugins/links_page/link_defines.php
--- 0.7.5/e107_plugins/links_page/link_defines.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/link_defines.php	2006-07-12 11:14:55.000000000 -0500
@@ -11,17 +11,17 @@
 |    GNU    General Public  License (http://gnu.org).
 |
 |    $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/link_defines.php,v $
-|    $Revision: 1.2 $
-|    $Date: 2005/12/14 19:28:44 $
-|    $Author: sweetas $
+|    $Revision: 1.5 $
+|    $Date: 2006/07/12 16:14:55 $
+|    $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$imagedir = e_IMAGE."/admin_images/";
-if (!defined("IMAGE_NEW")){ define("IMAGE_NEW", (file_exists(THEME."generic/new.png") ? THEME."generic/new.png" : e_IMAGE."generic/".IMODE."/new.png")); }
-if (!defined('LINK_ICON_EDIT')) { define("LINK_ICON_EDIT", "<img src='".$imagedir."maintain_16.png' alt='' style='border:0; cursor:pointer;' />"); }
+$imagedir = e_IMAGE."admin_images/";
+if (!defined("IMAGE_NEW")){ define("IMAGE_NEW", (file_exists(THEME."images/new.png") ? THEME."images/new.png" : e_IMAGE."generic/".IMODE."/new.png")); }
+if (!defined('LINK_ICON_EDIT')) { define("LINK_ICON_EDIT", "<img src='".$imagedir."edit_16.png' alt='' style='border:0; cursor:pointer;' />"); }
 if (!defined('LINK_ICON_DELETE')) { define("LINK_ICON_DELETE", "<img src='".$imagedir."delete_16.png' alt='' style='border:0; cursor:pointer;' />"); }
 if (!defined('LINK_ICON_DELETE_BASE')) { define("LINK_ICON_DELETE_BASE", $imagedir."delete_16.png"); }
 if (!defined('LINK_ICON_LINK')) { define("LINK_ICON_LINK", "<img src='".$imagedir."leave_16.png' alt='' style='border:0; cursor:pointer;' />"); }
diff -ruN 0.7.5/e107_plugins/links_page/link_shortcodes.php 0.7.7/e107_plugins/links_page/link_shortcodes.php
--- 0.7.5/e107_plugins/links_page/link_shortcodes.php	2006-02-13 02:35:00.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/link_shortcodes.php	2006-11-19 23:25:40.000000000 -0600
@@ -57,7 +57,7 @@
 	$sqlc = new db;
 	if ($sqlc->db_Select("links_page_cat", "link_category_id, link_category_name", "link_category_class REGEXP '".e_CLASS_REGEXP."' ORDER BY link_category_name")){
 		$mains .= $rs -> form_option("&nbsp;", "0", "", "");
-		$mains .= $rs -> form_option("-- view category --", "0", "", "");
+		$mains .= $rs -> form_option(LAN_LINKS_48, "0", "", "");
 		while ($rowc = $sqlc->db_Fetch()){
 			$mains .= $rs -> form_option($rowc['link_category_name'], "0", $baseurl."?cat.".$rowc['link_category_id'], "");
 		}
@@ -67,7 +67,7 @@
 if($mains){
 	$main = "";
 
-	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value.indexOf('-') && this.options[this.selectedIndex].value != '' && this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
+	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value.indexOf('-') &amp;&amp; this.options[this.selectedIndex].value != '' &amp;&amp; this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
 
 //	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value != '-- view category --' || this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
 	$main .= $rs -> form_select_open("navigator", $selectjs);
@@ -83,8 +83,6 @@
 return $LINK_SORTORDER;
 SC_END
 
-
-
 SC_BEGIN LINK_NAVIGATOR_TABLE_PRE
 global $LINK_NAVIGATOR_TABLE_PRE;
 if($LINK_NAVIGATOR_TABLE_PRE === TRUE){
@@ -102,6 +100,10 @@
 
 
 
+SC_BEGIN LINK_NEXTPREV
+global $LINK_NEXTPREV;
+return $LINK_NEXTPREV;
+SC_END
 
 
 
@@ -229,43 +231,52 @@
 // LINK_TABLE ------------------------------------------------
 SC_BEGIN LINK_BUTTON
 global $LINK_BUTTON, $linkspage_pref, $rowl, $LINK_NAME, $LINK_APPEND;
-$LINK_BUTTON = "";
+
+if(!$linkspage_pref['link_icon']){
+	return "";
+}
+$LINK_BUTTON = "&nbsp;";
 if(isset($linkspage_pref['link_icon']) && $linkspage_pref['link_icon']){
 	if ($rowl['link_button']) {
 		if (strpos($rowl['link_button'], "http://") !== FALSE) {
-			$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000;' src='".$rowl['link_button']."' alt='' /></a>";
+			$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".$rowl['link_button']."' alt='' /></a>";
 		} else {
 			if(strstr($rowl['link_button'], "/")){
 				if(file_exists(e_BASE.$rowl['link_button'])){
-					$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000;' src='".e_BASE.$rowl['link_button']."' alt='' /></a>";
+					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".e_BASE.$rowl['link_button']."' alt='' /></a>";
 				} else {
 					if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-						$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000; width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
+						$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
 					}
 				}
 			}else{
 				if(file_exists(e_PLUGIN."links_page/link_images/".$rowl['link_button'])){
-				$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000' src='".e_PLUGIN."links_page/link_images/".$rowl['link_button']."' alt='' /></a>";
+					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".e_PLUGIN."links_page/link_images/".$rowl['link_button']."' alt='' /></a>";
 				}else{
 					if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-					$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000; width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
+					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
 					}
 				}
 			}
 		}
 	} else {
 		if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-			$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000; width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
+			$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
 		}
 	}
 }else{
 	if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-		$LINK_BUTTON = $LINK_APPEND."\n<img style='border:1px solid #000; width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
+		$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='' /></a>";
 	}
 }
 return $LINK_BUTTON;
 SC_END
 
+SC_BEGIN BUTTON_COLUMN
+global $linkbutton_count,$linkspage_pref;
+return ($linkbutton_count >0 && $linkspage_pref['link_icon']) ? 2 : 1;
+SC_END
+
 SC_BEGIN LINK_APPEND
 global $LINK_APPEND;
 return $LINK_APPEND;
@@ -278,17 +289,21 @@
 
 SC_BEGIN LINK_URL
 global $LINK_URL, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_url']) && $linkspage_pref['link_url'] ? $rowl['link_url'] : "");
+if(!$linkspage_pref['link_url'])
+{
+	return "";
+}
+return ($parm == "link") ? "<a class='linkspage_url' href=\"".$rowl['link_url']."\" rel='external' title=\"".$rowl['link_description']."\">".$rowl['link_url']."</a>" : $rowl['link_url'];
 SC_END
 
 SC_BEGIN LINK_REFER
 global $LINK_REFER, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? LAN_LINKS_26." ".$rowl['link_refer'] : "");
+return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? $rowl['link_refer'] : "");
 SC_END
 
 SC_BEGIN LINK_COMMENT
 global $LINK_COMMENT, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? "<a href='".e_SELF."?comment.".$rowl['link_id']."'>".LAN_LINKS_37." ".($rowl['link_comment'] ? $rowl['link_comment'] : "0")."</a>" : "");
+return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? "<a href='".e_SELF."?comment.".$rowl['link_id']."'>".($rowl['link_comment'] ? $rowl['link_comment'] : "0")."</a>" : "");
 SC_END
 
 SC_BEGIN LINK_DESC
@@ -309,11 +324,48 @@
 global $LINK_NEW, $linkspage_pref, $qs, $rowl;
 $LINK_NEW = "";
 if(USER && $rowl['link_datestamp'] > USERLV){
-$LINK_NEW = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
+$LINK_NEW = "<img class='linkspage_new' src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
 }
 return $LINK_NEW;
 SC_END
 
+SC_BEGIN LINK_CAT_NAME
+global $rowl;
+return $rowl['link_category_name'];
+SC_END
+
+SC_BEGIN LINK_CAT_DESC
+global $rowl;
+return $rowl['link_category_description'];
+SC_END
+
+SC_BEGIN LINK_CAT_TOTAL
+global $link_category_total;
+return " (<span title='".(ADMIN ? LAN_LINKS_2 : LAN_LINKS_1)."' >".$link_category_total."</span>".(ADMIN ? "/<span title='".(ADMIN ? LAN_LINKS_1 : "" )."' >".$link_category_total."</span>" : "").") ";
+SC_END
+
+SC_BEGIN LINK_REFER_LAN
+global $linkspage_pref;
+return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? LAN_LINKS_26 : "");
+SC_END
+
+SC_BEGIN LINK_COMMENT_LAN
+global $linkspage_pref;
+return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? LAN_LINKS_37 : "");
+SC_END
+
+SC_BEGIN LINK_RATING_LAN
+global $linkspage_pref;
+if(isset($linkspage_pref['link_rating']) && $linkspage_pref['link_rating']){
+    return LCLAN_ITEM_39;
+}
+return "";
+SC_END
+
+SC_BEGIN NAVIGATOR
+return displayNavigator('');
+SC_END
+
 
 // LINK_TOP_TABLE ------------------------------------------------
 
@@ -363,7 +415,7 @@
 		$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0; width: 88px; height: 31px;' src='".e_PLUGIN."links_page/images/generic.png' alt='".$LINK_RATED_NAME."' /></a>";
 	}else{
 		$LINK_RATED_BUTTON = "";
-	}	
+	}
 }
 return $LINK_RATED_BUTTON;
 SC_END
diff -ruN 0.7.5/e107_plugins/links_page/links.php 0.7.7/e107_plugins/links_page/links.php
--- 0.7.5/e107_plugins/links_page/links.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/links.php	2006-10-28 04:29:29.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.33 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.42 $
+|     $Date: 2006/10/28 09:29:29 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once('../../class2.php');
@@ -106,7 +106,11 @@
 	}
 	if($qs[0] == "manage"){
 		if(check_class($linkspage_pref['link_manager_class'])){
-			$lc -> dbLinkCreate();
+			if(isset($linkspage_pref['link_directpost']) && $linkspage_pref['link_directpost']){
+				$lc -> dbLinkCreate();
+			}else{
+				$lc -> dbLinkCreate("submit");
+			}
 		}else{
 			js_location(e_SELF);
 		}
@@ -122,47 +126,47 @@
 }
 //show all categories
 if((!isset($qs[0]) || $qsorder) && $linkspage_pref['link_page_categories']){
-	displayNavigator('cat');
+  	echo displayNavigator('cat');
 	displayCategory();
 }
 //show all categories
 if(isset($qs[0]) && $qs[0] == "cat" && !isset($qs[1]) ){
-	displayNavigator('cat');
+   echo displayNavigator('cat');
 	displayCategory();
 }
 //show all links in all categories
 if( ((!isset($qs[0]) || $qsorder) && !$linkspage_pref['link_page_categories']) || (isset($qs[0]) && $qs[0] == "all") ){
-	displayNavigator('');
+  //	displayNavigator('');
 	displayCategoryLinks();
 }
 //show all links in one categories
 if(isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && is_numeric($qs[1])){
-	displayNavigator('');
+	echo displayNavigator('');
 	displayCategoryLinks($qs[1]);
 }
 //view top rated
 if(isset($qs[0]) && $qs[0] == "rated"){
-	displayNavigator('');
+	echo displayNavigator('');
 	displayTopRated();
 }
 //view top refer
 if(isset($qs[0]) && $qs[0] == "top"){
-	displayNavigator('');
+	echo displayNavigator('');
 	displayTopRefer();
 }
 //personal link managers
 if (isset($qs[0]) && $qs[0] == "manage"){
-	displayNavigator('');
+	echo displayNavigator('');
 	displayPersonalManager();
 }
 //comments on links
 if (isset($qs[0]) && $qs[0] == "comment" && isset($qs[1]) && is_numeric($qs[1]) ){
-	displayNavigator('');
+	echo displayNavigator('');
 	displayLinkComment();
 }
 //submit link
 if (isset($qs[0]) && $qs[0] == "submit" && check_class($linkspage_pref['link_submit_class'])) {
-	displayNavigator('');
+	echo displayNavigator('');
 	displayLinkSubmit();
 }
 
@@ -170,7 +174,7 @@
 function displayTopRated(){
 	global $qs, $sql, $lc, $tp, $rowl, $link_shortcodes, $from, $ns, $linkspage_pref;
 	global $LINK_RATED_TABLE_START, $LINK_RATED_TABLE, $LINK_RATED_TABLE_END, $LINK_RATED_RATING, $LINK_RATED_APPEND;
-	
+
 	$number		= (isset($linkspage_pref["link_nextprev_number"]) && $linkspage_pref["link_nextprev_number"] ? $linkspage_pref["link_nextprev_number"] : "20");
 	$np			= ($linkspage_pref["link_nextprev"] ? "LIMIT ".intval($from).",".intval($number) : "");
 	$catrate	= (isset($qs[1]) && is_numeric($qs[1]) ? " AND l.link_category='".$qs[1]."' " : "");
@@ -195,7 +199,7 @@
   	    foreach($list as $rowl) {
 			if( ($rowl['rate_avg'] > $ratemin) ){
 			$cat = $rowl['link_category_name'];
-			$LINK_RATED_APPEND			= $lc -> parse_link_append($rowl['link_open'], $rowl['link_id']);
+			$LINK_RATED_APPEND			= $lc -> parse_link_append($rowl);
 			$LINK_RATED_RATING			= $tp -> parseTemplate('{LINK_RATED_RATING}', FALSE, $link_shortcodes);
 			$link_rated_table_string	.= $tp -> parseTemplate($LINK_RATED_TABLE, FALSE, $link_shortcodes);
 			}
@@ -208,14 +212,9 @@
 		}
 		$caption = LAN_LINKS_11." ".(isset($captioncat) ? $captioncat : "");
 		$text = $link_rated_table_start.$link_rated_table_string.$link_rated_table_end;
-		
-		$ns->tablerender($caption, $text);
 
-		if(isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"]){
-			require_once(e_HANDLER."np_class.php");
-			$np_querystring = (isset($qs[0]) ? $qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
-			$ix = new nextprev(e_SELF, $from, $number, $linktotalrated, NP_3, ($np_querystring ? $np_querystring : ""));
-		}
+		$ns->tablerender($caption, $text);
+		$lc->ShowNextPrev($from, $number, $linktotalrated);
 	}
 }
 
@@ -247,7 +246,7 @@
 		$list = $sql2 -> db_getList();
   	    foreach($list as $rowl) {
 			$category				= $rowl['link_category_id'];
-			$LINK_APPEND			= $lc -> parse_link_append($rowl['link_open'], $rowl['link_id']);
+			$LINK_APPEND			= $lc -> parse_link_append($rowl);
 			$link_top_table_string .= $tp -> parseTemplate($LINK_TABLE, FALSE, $link_shortcodes);
 		}
 		$link_top_table_start		= $tp -> parseTemplate($LINK_TABLE_START, FALSE, $link_shortcodes);
@@ -256,12 +255,7 @@
 		$text = $link_top_table_start.$link_top_table_string.$link_top_table_end;
 		$caption = LAN_LINKS_10;
 		$ns->tablerender($caption, $text);
-
-		if(isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"]){
-			require_once(e_HANDLER."np_class.php");
-			$np_querystring = (isset($qs[0]) ? $qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
-			$ix = new nextprev(e_SELF, $from, $number, $link_total, NP_3, ($np_querystring ? $np_querystring : ""));
-		}
+		$lc->ShowNextPrev($from, $number, $link_total);
 	}
 }
 
@@ -293,7 +287,7 @@
 	}
 	//upload link icon
 	if(isset($_POST['uploadlinkicon'])){
-		$lc -> uploadLinkIcon($_POST);
+		$lc -> uploadLinkIcon();
 	}
 
 	//show existing links
@@ -328,7 +322,7 @@
 
 //comments on links
 function displayLinkComment(){
-	global $qs, $cobj, $tp, $sql, $lc, $rowl, $link_shortcodes, $ns, $linkspage_pref, $LINK_TABLE_START, $LINK_TABLE, $LINK_TABLE_END, $LINK_APPEND;
+	global $qs, $cobj, $tp, $sql, $linkbutton_count, $lc, $rowl, $link_shortcodes, $ns, $linkspage_pref, $LINK_TABLE_START, $LINK_TABLE, $LINK_TABLE_END, $LINK_APPEND;
 	if(!(isset($linkspage_pref["link_comment"]) && $linkspage_pref["link_comment"])){
 		js_location(e_SELF);
 	}else{
@@ -336,16 +330,19 @@
 		SELECT l.*, lc.*
 		FROM #links_page AS l
 		LEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category
-		WHERE l.link_id = '".intval($qs[1])."' AND lc.link_category_class REGEXP '".e_CLASS_REGEXP."' AND l.link_class REGEXP '".e_CLASS_REGEXP."' 
+		WHERE l.link_id = '".intval($qs[1])."' AND lc.link_category_class REGEXP '".e_CLASS_REGEXP."' AND l.link_class REGEXP '".e_CLASS_REGEXP."'
 		";
 		$link_comment_table_string = "";
 		if(!$linkcomment = $sql -> db_Select_gen($qry)){
 			js_location(e_SELF);
 		}else{
 			$rowl = $sql->db_Fetch();
-			$LINK_APPEND	= $lc -> parse_link_append($rowl['link_open'], $rowl['link_id']);
+			$linkbutton_count   = ($rowl['link_button']) ?  $linkbutton_count + 1 : $linkbutton_count;
+			$LINK_APPEND	= $lc -> parse_link_append($rowl);
 			$subject		= $rowl['link_name'];
-			$text = $tp -> parseTemplate($LINK_TABLE, FALSE, $link_shortcodes);
+			$text = $tp -> parseTemplate($LINK_TABLE_START, FALSE, $link_shortcodes);
+			$text .= $tp -> parseTemplate($LINK_TABLE, FALSE, $link_shortcodes);
+			$text .= $tp -> parseTemplate($LINK_TABLE_END, FALSE, $link_shortcodes);
 			$ns->tablerender(LAN_LINKS_36, $text);
 
 			$cobj->compose_comment("links_page", "comment", $qs[1], $width, $subject, $showrate=FALSE);
@@ -378,7 +375,7 @@
 	$qry = "
 	SELECT lc.*
 	FROM #links_page_cat AS lc
-	WHERE lc.link_category_class REGEXP '".e_CLASS_REGEXP."' 
+	WHERE lc.link_category_class REGEXP '".e_CLASS_REGEXP."'
 	".$order."
 	";
 
@@ -413,7 +410,7 @@
 	if($mode == "cat"){
 		if(isset($linkspage_pref['link_cat_sortorder']) && $linkspage_pref['link_cat_sortorder']){
 			$LINK_SORTORDER = $lc->showLinkSort('cat');
-		}	
+		}
 	}else{
 		if(isset($linkspage_pref['link_sortorder']) && $linkspage_pref['link_sortorder']){
 			$LINK_SORTORDER = $lc->showLinkSort();
@@ -428,12 +425,12 @@
 		$LINK_NAVIGATOR_TABLE_POST = TRUE;
 	}
 	$text = $tp -> parseTemplate($LINK_NAVIGATOR_TABLE, FALSE, $link_shortcodes);
-	echo $text;
+	return $text;
 }
 
 function displayCategoryLinks($mode=''){
-	global $sql2, $ns, $lc, $tp, $cobj, $rowl, $qs, $linkspage_pref, $from, $link_shortcodes;
-	global $LINK_TABLE_START, $LINK_TABLE, $LINK_TABLE_END, $LINK_APPEND;
+	global $sql2, $ns, $lc, $tp, $cobj, $rowl, $qs, $linkspage_pref, $from, $link_shortcodes, $link_category_total;
+	global $LINK_TABLE_START,$linkbutton_count, $LINK_TABLE,$link_category_total, $LINK_TABLE_CAPTION, $LINK_TABLE_END, $LINK_APPEND;
 
 	$order			= $lc -> getOrder();
 	$number			= ($linkspage_pref["link_nextprev_number"] ? $linkspage_pref["link_nextprev_number"] : "20");
@@ -444,7 +441,7 @@
 	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_class REGEXP '".e_CLASS_REGEXP."' AND lc.link_category_class REGEXP '".e_CLASS_REGEXP."' ".$cat." 
+	WHERE l.link_class REGEXP '".e_CLASS_REGEXP."' AND lc.link_category_class REGEXP '".e_CLASS_REGEXP."' ".$cat."
 	GROUP BY l.link_id
 	".$order."
 	".$nextprevquery."
@@ -456,18 +453,21 @@
 	if (!$sql2->db_Select_gen($qry)){
 		$lc -> show_message(LAN_LINKS_34, LAN_LINKS_39);
 	}else{
+		$linkbutton_count = 0;
 		$list = $sql2 -> db_getList();
   	    foreach($list as $rowl) {
+			$linkbutton_count   = ($rowl['link_button']) ?  $linkbutton_count + 1 : $linkbutton_count;
 			if($mode){
 				$cat_name			= $rowl['link_category_name'];
 				$cat_desc			= $rowl['link_category_description'];
-				$LINK_APPEND		= $lc -> parse_link_append($rowl['link_open'], $rowl['link_id']);
-				$link_table_string .= $tp -> parseTemplate($LINK_TABLE, FALSE, $link_shortcodes);			
+				$LINK_APPEND		= $lc -> parse_link_append($rowl);
+				$link_table_string .= $tp -> parseTemplate($LINK_TABLE, FALSE, $link_shortcodes);
 			}else{
 				$arr[$rowl['link_category_id']][] = $rowl;
 			}
 		}
 		if($mode){
+			$link_category_total	= $link_total;
 			$link_table_start		= $tp -> parseTemplate($LINK_TABLE_START, FALSE, $link_shortcodes);
 			$link_table_end			= $tp -> parseTemplate($LINK_TABLE_END, FALSE, $link_shortcodes);
 			$text = $link_table_start.$link_table_string.$link_table_end;
@@ -476,31 +476,33 @@
 			$caption .= " (<b title='".(ADMIN ? LAN_LINKS_2 : LAN_LINKS_1)."' >".$link_total."</b>".(ADMIN ? "/<b title='".(ADMIN ? LAN_LINKS_1 : "" )."' >".$link_total."</b>" : "").") ";
 			$ns->tablerender($caption, $text);
 
-			if(is_numeric($mode) && isset($linkspage_pref["link_nextprev"]) && $linkspage_pref["link_nextprev"]){
-				require_once(e_HANDLER."np_class.php");
-				$np_querystring = (isset($qs[0]) ? $qs[0] : "").(isset($qs[1]) ? ".".$qs[1] : "").(isset($qs[2]) ? ".".$qs[2] : "").(isset($qs[3]) ? ".".$qs[3] : "").(isset($qs[4]) ? ".".$qs[4] : "");
-				$ix = new nextprev(e_SELF, $from, $number, $link_total, NP_3, ($np_querystring ? $np_querystring : ""));
+			if(is_numeric($mode)){
+				$lc->ShowNextPrev($from, $number, $link_total);
 			}
 		}else{
 			foreach($arr as $key => $value){
 				$link_table_string = "";
+				$linkbutton_count = 0;
 				$i=0;
 				for($i=0;$i<count($value);$i++){
 					$rowl				= $value[$i];
+
+					$linkbutton_count   = ($rowl['link_button']) ?  $linkbutton_count + 1 : $linkbutton_count;
 					$cat_name			= $rowl['link_category_name'];
 					$cat_desc			= $rowl['link_category_description'];
-					$LINK_APPEND		= $lc -> parse_link_append($rowl['link_open'], $rowl['link_id']);
+				 	$LINK_APPEND		= $lc -> parse_link_append($rowl);
 					$link_table_string .= $tp -> parseTemplate($LINK_TABLE, FALSE, $link_shortcodes);
 				}
-				$caption = LAN_LINKS_32." ".$cat_name." ".($cat_desc ? " <i>[".$cat_desc."]</i>" : "");
-				//number of links
-				$caption .= " (<b title='".(ADMIN ? LAN_LINKS_2 : LAN_LINKS_1)."' >".count($value)."</b>".(ADMIN ? "/<b title='".(ADMIN ? LAN_LINKS_1 : "" )."' >".count($value)."</b>" : "").") ";
 
+				$link_category_total = count($value);
+				$link_table_caption 	= $tp -> parseTemplate($LINK_TABLE_CAPTION, FALSE, $link_shortcodes);
 				$link_table_start		= $tp -> parseTemplate($LINK_TABLE_START, FALSE, $link_shortcodes);
 				$link_table_end			= $tp -> parseTemplate($LINK_TABLE_END, FALSE, $link_shortcodes);
-				$text = $link_table_start.$link_table_string.$link_table_end;
-				$ns->tablerender($caption, $text);
+				$text .= $link_table_start.$link_table_string.$link_table_end;
+
 			}
+
+				$ns->tablerender($link_table_caption, $text);
 		}
 	}
 	return;
diff -ruN 0.7.5/e107_plugins/links_page/links_template.php 0.7.7/e107_plugins/links_page/links_template.php
--- 0.7.5/e107_plugins/links_page/links_template.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/links_template.php	2006-08-24 09:50:28.000000000 -0500
@@ -11,15 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/links_template.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.24 $
+|     $Date: 2006/08/24 14:50:28 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 global $sc_style, $link_shortcodes;
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
+
+// ##### NEXT PREV --------------------------------------------------
+if(!isset($LINK_NP_TABLE)){
+	$LINK_NP_TABLE = "<div class='nextprev'>{LINK_NEXTPREV}</div>";
+}
+// ##### ----------------------------------------------------------------------
 
 //general : backlink to link frontpage
 $sc_style['LINK_NAVIGATOR']['pre'] = "<td style='text-align:right;'>";
@@ -45,7 +52,7 @@
 $sc_style['LINK_MANAGE_NEWLINK']['post'] = " >></div>";
 
 $LINK_TABLE_MANAGE_START = "
-	".$rs -> form_open("post", e_SELF."?".e_QUERY, "linkmanagerform", "", "enctype='multipart/form-data'", "")."
+	<form method='post' action='".e_SELF."?".e_QUERY."' id='linkmanagerform' enctype='multipart/form-data'>
 	<table class='fborder' style='width:100%;' cellspacing='0' cellpadding='0'>
 	<tr>
 	<td style='width:15%' class='fcaption'>".LAN_LINKS_MANAGER_5."</td>
@@ -60,7 +67,7 @@
 	<td style='width:10%; padding-bottom:5px; text-align:center; vertical-align:top;' class='forumheader3'>{LINK_MANAGE_OPTIONS}</td>
 	</tr>";
 
-$LINK_TABLE_MANAGE_END = "</table>".$rs -> form_close()."<br />{LINK_MANAGE_NEWLINK}";
+$LINK_TABLE_MANAGE_END = "</table></form><br />{LINK_MANAGE_NEWLINK}";
 
 
 
@@ -110,37 +117,70 @@
 
 // LINKS ITEM ----------------------------------------------------------------------------
 
-$sc_style['LINK_BUTTON']['pre'] = "<td rowspan='2' class='forumheader3' style='width:10%; text-align:center'>";
+$sc_style['LINK_BUTTON']['pre'] = "<td class='forumheader3' style='width:5%; text-align:center'>";
 $sc_style['LINK_BUTTON']['post'] = "</td>";
 
-$sc_style['LINK_URL']['pre'] = "<i>";
-$sc_style['LINK_URL']['post'] = "</i><br />";
+$sc_style['LINK_COMMENT']['pre'] = "<td class='forumheader3' style='width:5%; text-align:center'>";
+$sc_style['LINK_COMMENT']['post'] = "</td>";
+
+$sc_style['LINK_RATING']['pre'] = "<td class='forumheader3' style='width:5%; text-align:center'>";
+$sc_style['LINK_RATING']['post'] = "</td>";
+
+$sc_style['LINK_REFER']['pre'] = "<td class='forumheader3' style='width:5%; text-align:center'>";
+$sc_style['LINK_REFER']['post'] = "</td>";
+
+$sc_style['LINK_URL']['pre'] = "<span class='smalltext'>";
+$sc_style['LINK_URL']['post'] = "</span>";
+
+$sc_style['LINK_DESC']['pre'] = "<span class='smalltext'>";
+$sc_style['LINK_DESC']['post'] = "</span>";
+
+$sc_style['LINK_REFER_LAN']['pre'] = "<td class='fcaption' style='text-align:center;width:5%'>";
+$sc_style['LINK_REFER_LAN']['post'] = "</td>";
 
-$sc_style['LINK_DESC']['post'] = "<br />";
+$sc_style['LINK_COMMENT_LAN']['pre'] = "<td class='fcaption' style='width:5%'>";
+$sc_style['LINK_COMMENT_LAN']['post'] = "</td>";
+
+$sc_style['LINK_RATING_LAN']['pre'] = "<td class='fcaption' style='width:5%'>";
+$sc_style['LINK_RATING_LAN']['post'] = "</td>";
+
+$sc_style['LINK_BUTTON_LAN']['pre'] = "<td class='fcaption' style='width:5%'>";
+$sc_style['LINK_BUTTON_LAN']['post'] = "</td>";
+
+$sc_style['LINK_CAT_DESC']['pre'] = "<br /><span class='smalltext'><i>";
+$sc_style['LINK_CAT_DESC']['post'] = "</i></span>";
+
+$LINK_TABLE_CAPTION = LCLAN_ITEM_24."{NAVIGATOR}" ;
 
 $LINK_TABLE_START = "
-	<div style='text-align:center'>";
+	<div style='text-align:center'>
+	<table class='fborder' style='".USER_WIDTH.";margin-bottom:20px;'>
+	<tr>
+	<td colspan='{BUTTON_COLUMN}' class='fcaption'>".LAN_LINKS_32." {LINK_CAT_NAME} {LINK_CAT_TOTAL} {LINK_CAT_DESC} </td>
+   	{LINK_RATING_LAN}
+	{LINK_COMMENT_LAN}
+	{LINK_REFER_LAN}
+	</tr>";
+
+$LINK_TABLE = "
 
-$LINK_TABLE = "<div style='text-align:center'>
-	<table class='fborder' style='width:95%; margin-bottom:20px;'>
 	<tr>
 		{LINK_BUTTON}
-		<td class='fcaption' style='width:90%'>
-			{LINK_NEW} {LINK_APPEND} {LINK_NAME} </a>
-		</td>
-		<td class='fcaption' style='white-space:nowrap'>
-		{LINK_COMMENT}&nbsp;{LINK_REFER}
+		<td class='forumheader3' style='width:60%'>
+			{LINK_NEW} {LINK_APPEND} {LINK_NAME} </a><br />
+    {LINK_URL=link}
+	{LINK_DESC}
+
 		</td>
+    	{LINK_RATING}
+	{LINK_COMMENT}
+	{LINK_REFER}
+
 	</tr>
-	<tr><td colspan='2' class='forumheader3'>
-	{LINK_URL}
-	{LINK_DESC}
-	{LINK_RATING}
-	</td></tr>
-	</table></div>";
+	";
 
 $LINK_TABLE_END = "
-	</div>";
+	</table></div>";
 
 
 
@@ -181,7 +221,7 @@
 	</tr>
 	{LINK_RATED_URL}
 	{LINK_RATED_CATEGORY}
-	{LINK_RATED_DESC}		
+	{LINK_RATED_DESC}
 	</table>";
 
 $LINK_RATED_TABLE_END = "
@@ -194,7 +234,7 @@
 // SUBMIT -----------------------------------------------------------------------------------
 $LINK_SUBMIT_TABLE = "
 	<div style='text-align:center'>
-	<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>	
+	<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>
 	<table class='fborder' style='width:100%' cellspacing='0' cellpadding='0'>
 	{LINK_SUBMIT_PRETEXT}
 	<tr>
@@ -215,7 +255,7 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:30%'>".LCLAN_SL_14."</td>
-		<td class='forumheader3' style='width:30%'><input class='tbox' type='text' name='link_button' size='60' value='' maxlength='200' /></td>
+		<td class='forumheader3' style='width:30%'><input class='tbox' type='text' name='link_but' size='60' value='' maxlength='200' /></td>
 	</tr>
 	<tr>
 		<td colspan='2' style='text-align:center' class='forumheader3'><span class='smalltext'>".LCLAN_SL_15."</span></td>
diff -ruN 0.7.5/e107_plugins/links_page/plugin.php 0.7.7/e107_plugins/links_page/plugin.php
--- 0.7.5/e107_plugins/links_page/plugin.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/links_page/plugin.php	2006-10-21 06:22:57.000000000 -0500
@@ -11,23 +11,24 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/plugin.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.21 $
+|     $Date: 2006/10/21 11:22:57 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$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");
+@include_once(e_PLUGIN.'links_page/link_defines.php');
+@include_once(e_PLUGIN.'links_page/languages/'.e_LANGUAGE.'.php');
+@include_once(e_PLUGIN.'links_page/languages/English.php');
 
-$eplug_name = LCLAN_PLUGIN_LAN_1;
+$eplug_name = "LCLAN_PLUGIN_LAN_1";
 $eplug_version = "1.12";
-$eplug_author = "Eric Vanderfeesten (lisa)";
+$eplug_author = "e107devs";
 $eplug_url = "http://e107.org";
-$eplug_email = "lisa@eindhovenseschool.net";
+$eplug_email = "";
 $eplug_description = LCLAN_PLUGIN_LAN_2;
 $eplug_compatible = "e107v0.7+";
 $eplug_readme = "";
@@ -51,10 +52,6 @@
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array();
 
-// List of comment_type ids used by this plugin. -----------------------------
-$eplug_comment_ids = array("links_page");
-
-
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
 "links_page_cat",
diff -ruN 0.7.5/e107_plugins/linkwords/linkwords.php 0.7.7/e107_plugins/linkwords/linkwords.php
--- 0.7.5/e107_plugins/linkwords/linkwords.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/linkwords/linkwords.php	2006-11-09 18:44:24.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/linkwords.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/11/10 00:44:24 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,6 +22,7 @@
 class e_linkwords
 {
 	var $linkwords = array();
+	var $linkhold  = array();  // Placeholders in case url's contain linkwords
 	var $linkurls = array();
 
 	function e_linkwords()
@@ -31,13 +32,17 @@
 		if($sql -> db_Select("linkwords", "*", "linkword_active=0"))
 		{
 			$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>";
 
 			}
@@ -50,7 +55,14 @@
 		$ptext = "";
 		foreach($content as $cont)
 		{
-			$ptext .= (strstr($cont, "<") ? $cont : str_replace($this -> linkwords, $this -> linkurls, $cont));
+			if (strstr($cont, "<"))
+			{
+				$ptext .= $cont;
+			} else {
+				$cont2=str_replace($this -> linkwords, $this -> linkhold, $cont);
+				$cont2=str_replace($this -> linkhold, $this -> linkurls, $cont2);
+				$ptext .= $cont2;
+			}
 		}
 		return $ptext;
 	}
diff -ruN 0.7.5/e107_plugins/linkwords/plugin.php 0.7.7/e107_plugins/linkwords/plugin.php
--- 0.7.5/e107_plugins/linkwords/plugin.php	2005-12-14 13:28:44.000000000 -0600
+++ 0.7.7/e107_plugins/linkwords/plugin.php	2006-08-25 10:37:54.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.3 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/08/25 15:37:54 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,7 +23,7 @@
 @include_once(e_PLUGIN."linkwords/languages/English.php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = LWLANINS_1;
+$eplug_name = "LWLANINS_1";
 $eplug_version = "1.0";
 $eplug_author = "jalist";
 $eplug_url = "http://e107.org";
@@ -32,32 +32,32 @@
 $eplug_compatible = "e107v7+";
 $eplug_readme = "";
 // leave blank if no readme file
-	
+
 // Name of the plugin's folder -------------------------------------------------------------------------------------
 $eplug_folder = "linkwords";
-	
+
 // Mane of menu item for plugin ----------------------------------------------------------------------------------
 $eplug_menu_name = "";
-	
+
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "admin_config.php";
-	
+
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/linkwords_32.png";
 $eplug_icon_small = $eplug_folder."/images/linkwords_16.png";
 $eplug_caption = LWLANINS_3;
-	
+
 // List of preferences -----------------------------------------------------------------------------------------------
 
 $eplug_array_pref = array(
 	'tohtml_hook' => 'linkwords'
 	);
-	
+
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
 	"linkwords"
 );
-	
+
 // List of sql requests to create tables -----------------------------------------------------------------------------
 $eplug_tables = array(
 	"CREATE TABLE ".MPREFIX."linkwords (
@@ -68,31 +68,31 @@
 	PRIMARY KEY ( linkword_id )
 	) TYPE=MyISAM AUTO_INCREMENT=1;"
 );
-	
-	
+
+
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
 $eplug_link_name = "";
 $ec_dir = e_PLUGIN."";
 $eplug_link_url = "";
-	
-	
+
+
 // Text to display after plugin successfully installed ------------------------------------------------------------------
 $eplug_done = LWLANINS_4;
-	
-	
+
+
 // upgrading ... //
-	
+
 $upgrade_add_prefs = "";
-	
+
 $upgrade_remove_prefs = "";
-	
+
 $upgrade_alter_tables = "";
-	
+
 $eplug_upgrade_done = "";
-	
-	
-	
-	
-	
+
+
+
+
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/list_new/admin_list_config.php 0.7.7/e107_plugins/list_new/admin_list_config.php
--- 0.7.5/e107_plugins/list_new/admin_list_config.php	2005-09-15 03:16:00.000000000 -0500
+++ 0.7.7/e107_plugins/list_new/admin_list_config.php	2006-10-28 04:02:43.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.6 $
-|		$Date: 2005/09/15 08:16:00 $
+|		$Revision: 1.7 $
+|		$Date: 2006/10/28 09:02:43 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -358,6 +358,16 @@
 	";
 	$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
 
+	//menu preference : open section if content exists? this will override the individual setting of the section
+	$TOPIC_TOPIC = LIST_ADMIN_LAN_39;
+	$TOPIC_HEADING = LIST_ADMIN_LAN_40;
+	$TOPIC_HELP = LIST_ADMIN_LAN_41;
+	$TOPIC_FIELD = "
+		".$rs -> form_radio($type."_openifrecords", "1", ($list_pref[$type."_openifrecords"] ? "1" : "0"), "", "").LIST_ADMIN_7."
+		".$rs -> form_radio($type."_openifrecords", "0", ($list_pref[$type."_openifrecords"] ? "0" : "1"), "", "").LIST_ADMIN_8."
+	";
+	$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+
 	$text .= $TOPIC_ROW_SPACER;
 	$text .= $TOPIC_TABLE_END;
 
@@ -490,6 +500,16 @@
 		$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
 	}
 
+	//page preference : open section if content exists? this will override the individual setting of the section
+	$TOPIC_TOPIC = LIST_ADMIN_LAN_39;
+	$TOPIC_HEADING = LIST_ADMIN_LAN_40;
+	$TOPIC_HELP = LIST_ADMIN_LAN_41;
+	$TOPIC_FIELD = "
+		".$rs -> form_radio($type."_openifrecords", "1", ($list_pref[$type."_openifrecords"] ? "1" : "0"), "", "").LIST_ADMIN_7."
+		".$rs -> form_radio($type."_openifrecords", "0", ($list_pref[$type."_openifrecords"] ? "0" : "1"), "", "").LIST_ADMIN_8."
+	";
+	$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW);
+
 	$text .= $TOPIC_ROW_SPACER;
 	$text .= $TOPIC_TABLE_END;
 
diff -ruN 0.7.5/e107_plugins/list_new/languages/English.php 0.7.7/e107_plugins/list_new/languages/English.php
--- 0.7.5/e107_plugins/list_new/languages/English.php	2005-12-30 09:26:25.000000000 -0600
+++ 0.7.7/e107_plugins/list_new/languages/English.php	2006-10-28 04:02:43.000000000 -0500
@@ -11,13 +11,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/languages/English.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/12/30 15:26:25 $
+|     $Revision: 1.16 $
+|     $Date: 2006/10/28 09:02:43 $
 |     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
-define("PAGE_NAME", "List New Items");
+if (!defined("PAGE_NAME")) { define("PAGE_NAME", "List New Items"); }
 
 define("LIST_PLUGIN_1", "List");
 define("LIST_PLUGIN_2", "This plugin allows you to view a list of recent additions in all e107 categories. You can either view the list with data since your last visit, or view a general latest additions list. Besides the page a menu is also present. Every section is configurable in the admin area.");
@@ -116,7 +116,7 @@
 
 define("LIST_ADMIN_LAN_20", "columns");
 define("LIST_ADMIN_LAN_21", "choose an amount of columns");
-define("LIST_ADMIN_LAN_22", "define how many columns you want to use. the number you specify will seperate the page into an equal amount of columns");
+define("LIST_ADMIN_LAN_22", "define how many columns you want to use. the number you specify will separate the page into an equal amount of columns");
 
 define("LIST_ADMIN_LAN_23", "welcome text");
 define("LIST_ADMIN_LAN_24", "define a welcome text that will be rendered at the top of the page");
@@ -139,6 +139,10 @@
 define("LIST_ADMIN_LAN_37", "display a select box with number of days to look back?");
 define("LIST_ADMIN_LAN_38", "");
 
+define("LIST_ADMIN_LAN_39", "open if records exist");
+define("LIST_ADMIN_LAN_40", "should sections that contain records be opened by default?");
+define("LIST_ADMIN_LAN_41", "");
+
 define("LIST_MENU_1", "recent additions");
 define("LIST_MENU_2", "by");
 define("LIST_MENU_3", "on");
diff -ruN 0.7.5/e107_plugins/list_new/list.php 0.7.7/e107_plugins/list_new/list.php
--- 0.7.5/e107_plugins/list_new/list.php	2006-02-20 02:52:46.000000000 -0600
+++ 0.7.7/e107_plugins/list_new/list.php	2006-11-11 09:29:16.000000000 -0600
@@ -11,8 +11,8 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list.php,v $
-|		$Revision: 1.10 $
-|		$Date: 2006/02/20 08:52:46 $
+|		$Revision: 1.12 $
+|		$Date: 2006/11/11 15:29:16 $
 |		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
@@ -75,7 +75,7 @@
 		$selectjs	= "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\"";
 
 		$LIST_TIMELAPSE = LIST_MENU_6;
-		$LIST_TIMELAPSE .= $rs -> form_select_open("timelapse", $selectjs).$rs -> form_option(LIST_MENU_5, 0);
+		$LIST_TIMELAPSE .= $rs -> form_select_open("timelapse", $selectjs).$rs -> form_option(LIST_MENU_5, 0, $url);
 		for($a=1; $a<=$days; $a++){
 			$LIST_TIMELAPSE .= $rs -> form_option($a, ($timelapse == $a ? "1" : "0"), $url.".".$a);
 		}
diff -ruN 0.7.5/e107_plugins/list_new/list_class.php 0.7.7/e107_plugins/list_new/list_class.php
--- 0.7.5/e107_plugins/list_new/list_class.php	2006-05-13 23:05:13.000000000 -0500
+++ 0.7.7/e107_plugins/list_new/list_class.php	2006-10-28 04:02:43.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.11 $
-|		$Date: 2006/05/14 04:05:13 $
-|		$Author: mcfly_e107 $
+|		$Revision: 1.13 $
+|		$Date: 2006/10/28 09:02:43 $
+|		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -115,7 +115,7 @@
 		return;
 	}
 
-	//content needs this to split each main parent into seperate sections
+	//content needs this to split each main parent into separate sections
 	function getContentSections($mode)
 	{
 		global $sql, $sections, $titles, $content_types, $content_name;
@@ -257,6 +257,7 @@
 		$list_pref['new_menu_datestyle']			= "%d %b";
 		$list_pref['new_menu_datestyletoday']		= "%H:%M";
 		$list_pref['new_menu_showempty']			= "1";
+		$list_pref['new_menu_openifrecords']		= "";
 
 		//new page preferences
 		$list_pref['new_page_caption']				= LIST_ADMIN_15;
@@ -271,6 +272,7 @@
 		$list_pref['new_page_welcometext']			= LIST_ADMIN_16;
 		$list_pref['new_page_timelapse']			= "1";
 		$list_pref['new_page_timelapse_days']		= "30";
+		$list_pref['new_page_openifrecords']		= "";
 
 		//recent menu preferences
 		$list_pref['recent_menu_caption']			= LIST_ADMIN_14;
@@ -281,6 +283,7 @@
 		$list_pref['recent_menu_datestyle']			= "%d %b";
 		$list_pref['recent_menu_datestyletoday']	= "%H:%M";
 		$list_pref['recent_menu_showempty']			= "";
+		$list_pref['recent_menu_openifrecords']		= "";
 
 		//recent page preferences
 		$list_pref['recent_page_caption']			= LIST_ADMIN_14;
@@ -293,6 +296,7 @@
 		$list_pref['recent_page_showempty']			= "";
 		$list_pref['recent_page_colomn']			= "1";
 		$list_pref['recent_page_welcometext']		= LIST_ADMIN_13;
+		$list_pref['recent_page_openifrecords']		= "";
 
 		return $list_pref;
 	}
@@ -402,6 +406,10 @@
 		}
 
 		if($LIST_DATA != ""){
+
+			//open sections if content exists ? yes if true, else use individual setting of section
+			$LIST_DISPLAYSTYLE = ($list_pref[$mode."_openifrecords"] ? "" : $LIST_DISPLAYSTYLE);
+
 			if($mode == "recent_menu"){
 				if($list_pref[$mode."_showempty"] || $menutext){
 					$start = preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT_START);
diff -ruN 0.7.5/e107_plugins/list_new/section/list_comment.php 0.7.7/e107_plugins/list_new/section/list_comment.php
--- 0.7.5/e107_plugins/list_new/section/list_comment.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/list_new/section/list_comment.php	2006-06-22 14:13:41.000000000 -0500
@@ -1,142 +1,43 @@
 <?php
 
 if (!defined('e107_INIT')) { exit; }
+require_once(e_HANDLER."comment_class.php");
+$cobj = new comment;
 
-	$LIST_CAPTION = $arr[0];
-	$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
+$LIST_CAPTION = $arr[0];
+$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
 
-	$bullet = $this -> getBullet($arr[6], $mode);
+$bullet = $this -> getBullet($arr[6], $mode);
 
-	if($mode == "new_page" || $mode == "new_menu" ){
-		$lvisit = $this -> getlvisit();
-		$qry = "comment_datestamp>".$lvisit;
+$qry = '';
+if($mode == "new_page" || $mode == "new_menu" ){
+	$lvisit = $this -> getlvisit();
+	$qry = "comment_datestamp>".$lvisit;
+}
+
+$data = $cobj->getCommentData(intval($arr[7]), '0', $qry);
+
+foreach($data as $row){
+	$rowheading	= $this -> parse_heading($row['comment_title'], $mode);
+	if($row['comment_url']){
+		$HEADING	= "<a href='".$row['comment_url']."' title='".$row['comment_title']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
 	}else{
-		$qry = "comment_id != '0' ";
+		$HEADING	= $tp -> toHTML($rowheading, TRUE);
 	}
-	$qry .= " ORDER BY comment_datestamp DESC LIMIT 0,".intval($arr[7]);
-
-	$sql2 = new db;
-	if(!$sql -> db_Select("comments", "*", $qry )){
-		$LIST_DATA = LIST_COMMENT_2;
-	}else{		
-		while($row = $sql -> db_Fetch()){
-
-			if($arr[3]){
-				$comment_author_id = substr($row['comment_author'] , 0, strpos($row['comment_author'] , "."));
-				$comment_author_name = substr($row['comment_author'] , (strpos($row['comment_author'] , ".")+1));
-				$AUTHOR = (USERID ? "<a href='".e_BASE."user.php?id.".$comment_author_id."'>".$comment_author_name."</a>" : $comment_author_name);
-			}else{
-				$AUTHOR = "";
-			}
-
-			$DATE	= ($arr[5] ? $this -> getListDate($row['comment_datestamp'], $mode) : "");
-			$ICON	= $bullet;
-			$INFO	= "";
-
-			// news
-			if($row['comment_type'] == "0"){	
-					$sql2 -> db_Select("news", "*", "news_id='".$row['comment_item_id']."' AND news_class REGEXP '".e_CLASS_REGEXP."' ");
-					$row2 = $sql2 -> db_Fetch();
-					$rowheading	= $this -> parse_heading($row2['news_title'], $mode);
-					$HEADING	= "<a href='".e_BASE."comment.php?comment.news.".$row['comment_item_id']."' title='".$row2['news_title']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					$CATEGORY	= ($arr[4] ? "<a href='".e_BASE."news.php'>".LIST_COMMENT_3."</a>" : "");
-
-			//	article, review or content page
-			}elseif($row['comment_type'] == "1"){	
-
-			//	downloads
-			}elseif($row['comment_type'] == "2"){	
-					$mp = MPREFIX;
-					$qry = "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."' ";
-					$sql2->db_Select_gen($qry);
-					$row2 = $sql2->db_Fetch();
-					$rowheading	= $this -> parse_heading($row2['download_name'], $mode);
-					$HEADING	= "<a href='".e_BASE."download.php?view.".$row['comment_item_id']."' title='".$row2['download_name']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					$CATEGORY	= ($arr[4] ? "<a href='".e_BASE."download.php?list.".$row2['download_category_id']."'>".$row2['download_category_name']."</a>" : "");
-
-			//	faq
-			}elseif($row['comment_type'] == "3"){	
-					$sql2 -> db_Select("faq", "faq_question", "faq_id='".$row['comment_item_id']."' ");
-					$row2 = $sql2 -> db_Fetch();
-					$rowheading	= $this -> parse_heading($row2['faq_question'], $mode);
-					$HEADING	= "<a href='".e_PLUGIN."faq/faq.php?view.".$row2['comment_item_id']."' title='".$row2['faq_question']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					$CATEGORY	= ($arr[4] ? "<a href='".e_PLUGIN."faq/faq.php'>".LIST_COMMENT_4."</a>" : "");
-
-			//	poll comment
-			}elseif($row['comment_type'] == "4"){	
-					$sql2 -> db_Select("polls", "*", "poll_id='".$row['comment_item_id']."' ");
-					$row2 = $sql2 -> db_Fetch();
-					$rowheading	= $this -> parse_heading($row2['poll_title'], $mode);
-					$HEADING	= "<a href='".e_BASE."comment.php?comment.poll.".$row['comment_item_id']."' title='".$row2['poll_title']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					$CATEGORY	= ($arr[4] ? LIST_COMMENT_5 : "");
-
-			//	docs
-			}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
-			}elseif($row['comment_type'] == "6"){	
-					$sql2 -> db_Select("bugtrack2_bugs", "bugtrack2_bugs_summary", "bugtrack2_bugs_id='".$row['comment_item_id']."' ");
-					$row2 = $sql2 -> db_Fetch();
-					$rowheading	= $this -> parse_heading($row2['bugtrack2_bugs_summary'], $mode);
-					$HEADING	= "<a href='".e_PLUGIN."bugtracker2/bugtracker2.php?0.bug.".$row['comment_item_id']."' title='".$row2['bugtrack2_bugs_summary']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					$CATEGORY	= ($arr[4] ? LIST_COMMENT_7 : "");
-
-			//	ideas
-			}elseif($row['comment_type'] == "ideas"){	
-					$sql2 -> db_Select("ideas", "ideas_summary", "ideas_id='".$row['comment_item_id']."' ");
-					$row2 = $sql2 -> db_Fetch();
-					$rowheading	= $this -> parse_heading($row2['ideas_summary'], $mode);
-					$HEADING	= "<a href='".e_PLUGIN."ideas/ideas.php?show.".$row['comment_item_id']."' title='".$row2['ideas_summary']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					$CATEGORY	= ($arr[4] ? LIST_COMMENT_10 : "");
-
-			//	pcontent
-			}elseif($row['comment_type'] == "pcontent"){	
-					$sql2 -> db_Select("pcontent", "content_heading, content_parent, content_class", "content_id='".$row['comment_item_id']."' AND content_class REGEXP '".e_CLASS_REGEXP."' ");
-					$row2 = $sql2 -> db_Fetch();
-					$rowheading = $this -> parse_heading($row2['content_heading'], $mode);
-					$HEADING = "<a href='".e_PLUGIN."content/content.php?content.".$row['comment_item_id']."' title='".$row2['content_heading']."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-					if($row2['content_parent'] == "0"){
-						$catid = $row['comment_item_id'];
-					}elseif(strpos($row2['content_parent'], ".")){
-						$catid = substr($row2['content_parent'], 2);
-					}else{
-						$catid = $row2['content_parent'];
-					}
-					$CATEGORY = ($arr[4] ? "<a href='".e_PLUGIN."content/content.php?cat.".$catid."'>".LIST_COMMENT_8."</a>" : "");
-
-			}else{
-
-				$handle=opendir(e_PLUGIN);
-				while(false !== ($file = readdir($handle))){
-					if($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)){
-						$plugin_handle=opendir(e_PLUGIN.$file."/");
-						while(false !== ($file2 = readdir($plugin_handle))){
-
-							if ($file2 == "e_comment.php") {
-								$nid = $row['comment_item_id'];
-								include(e_PLUGIN.$file."/".$file2);
-								if ($row['comment_type'] == $e_plug_table) {
-
-									$sql2 -> db_Select("".$db_table."", "".$link_name."", "".$db_id." = '".$row['comment_item_id']."' ");
-									$row2 = $sql2 -> db_Fetch();								
-									$rowheading	= $this -> parse_heading($row2[0], $mode);									
-									$HEADING	= "<a href='".$reply_location."' title='".$row2[0]."'>".$tp -> toHTML($rowheading, TRUE)."</a>";
-									$CATEGORY	= ($arr[4] ? $plugin_name : "");
-
-									break 2;
-								}
-							}
-						}
-					}
-				}
-			}
-			$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
+	$CATEGORY = '';
+	if($arr[4]){
+		if($row['comment_category_url']){
+			$CATEGORY = "<a href='".$row['comment_category_url']."'>".$row['comment_category_heading']."</a>";
+		}else{
+			$CATEGORY = $row['comment_category_heading'];
 		}
 	}
-
+	$AUTHOR		= ($arr[3] ? $row['comment_author'] : '');
+	$DATE		= ($arr[5] ? $this -> getListDate($row['comment_datestamp'], $mode) : "");
+	$ICON		= $bullet;
+	$INFO		= '';
+	
+	$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
+}
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/log/admin_config.php 0.7.7/e107_plugins/log/admin_config.php
--- 0.7.5/e107_plugins/log/admin_config.php	2005-11-10 14:35:17.000000000 -0600
+++ 0.7.7/e107_plugins/log/admin_config.php	2006-10-30 07:46:31.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/admin_config.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2005/11/10 20:35:17 $
-|     $Author: sweetas $
+|     $Revision: 1.17 $
+|     $Date: 2006/10/30 13:46:31 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -32,15 +32,15 @@
 require_once(e_HANDLER."userclass_class.php");
 
 define("LOGPATH", e_PLUGIN."log/");
-	
-@include_once(LOGPATH."languages/admin/".e_LANGUAGE.".php");
-@include_once(LOGPATH."languages/admin/English.php");
 
-if(IsSet($_POST['openRemPageD']))
+include_lan(LOGPATH."languages/admin/".e_LANGUAGE.".php");
+
+
+if(isset($_POST['openRemPageD']))
 {
 	rempage();
 }
-if(IsSet($_POST['remSelP']))
+if(isset($_POST['remSelP']))
 {
 	rempagego();
 }
@@ -85,7 +85,7 @@
 if(!is_writable(LOGPATH."logs")) {
 	$message = "<b>You must set the permissions of the e107_plugins/log/logs folder to 777 (chmod 777)</b>";
 }
-	
+
 if (isset($_POST['updatesettings'])) {
 	$pref['statActivate'] = $_POST['statActivate'];
 	$pref['statCountAdmin'] = $_POST['statCountAdmin'];
@@ -102,11 +102,11 @@
 	$message = ADSTAT_L17;
 }
 
-	
+
 if (isset($message)) {
 	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
-	
+
 $text = "<div style='text-align:center'>
 	<form method='post' action='".e_SELF."'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>
@@ -131,7 +131,7 @@
 	<input type='radio' name='statCountAdmin' value='0'".(!$pref['statCountAdmin'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."
 	</td>
 	</tr>
-	 
+
 	<tr>
 	<td style='width:50%' class='forumheader3'>".ADSTAT_L21."</td>
 	<td style='width:50%; text-align: right;' class='forumheader3'>
@@ -173,9 +173,9 @@
 
 	</td>
 	</tr>
-	
+
 	<tr>
-	<td style='width:50%' class='forumheader3'>".ADSTAT_L12."<br /><span class='smalltext'>".ADSTAT_L13."</td>
+	<td style='width:50%' class='forumheader3'>".ADSTAT_L12."<br /><span class='smalltext'>".ADSTAT_L13."</span></td>
 	<td style='width:50%; text-align: right;' class='forumheader3'>
 	".ADSTAT_L14."<input type='checkbox' name='wipe[statWipePage]' value='1' /><br />
 	".ADSTAT_L6."<input type='checkbox' name='wipe[statWipeBrowser]' value='1' /><br />
@@ -189,17 +189,17 @@
 	</tr>
 
 	<tr>
-	<td style='width:50%' class='forumheader3'>".ADSTAT_L26."<br /><span class='smalltext'>".ADSTAT_L27."</td>
+	<td style='width:50%' class='forumheader3'>".ADSTAT_L26."<br /><span class='smalltext'>".ADSTAT_L27."</span></td>
 	<td style='width:50%; text-align: right;' class='forumheader3'><input class='button' type='submit' name='openRemPageD' value='".ADSTAT_L28."' />
 	</td>
 	</tr>
-	
+
 	";
 
 	$text .= "
-	
 
-	 
+
+
 	<tr>
 	<td colspan='2'  style='text-align:center' class='forumheader'>
 	<input class='button' type='submit' name='updatesettings' value='".ADSTAT_L15."' />
@@ -208,7 +208,7 @@
 	</table>
 	</form>
 	</div>";
-	
+
 $ns->tablerender(ADSTAT_L16, $text);
 require_once(e_ADMIN."footer.php");
 
@@ -298,7 +298,7 @@
 	{
 		$sql -> db_Insert("logstats", "0, 'pageTotal', '$pagetotal' ");
 	}
-	
+
 	$varStart = chr(36);
 	$quote = chr(34);
 
@@ -326,11 +326,11 @@
 
 	$data .= "\n);\n\n?".  chr(62);
 
-	if ($handle = fopen($logfile, 'w')) { 
+	if ($handle = fopen($logfile, 'w')) {
 		fwrite($handle, $data);
 	}
 	fclose($handle);
 
 
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/log/e_meta.php 0.7.7/e107_plugins/log/e_meta.php
--- 0.7.5/e107_plugins/log/e_meta.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/log/e_meta.php	2006-07-09 14:40:43.000000000 -0500
@@ -0,0 +1,35 @@
+<?php
+/*
++ ----------------------------------------------------------------------------------------------+
+|     e107 website system  : http://e107.org
+|     Steve Dunstan 2001-2002 : 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/log/e_meta.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/07/09 19:40:43 $
+|     $Author: e107coders $
++-----------------------------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+
+if (isset($pref['statActivate']) && $pref['statActivate'])
+{
+	if(!$pref['statCountAdmin'] && ADMIN)
+	{
+		/* don't count admin visits */
+	}
+	else
+	{
+		require_once(e_PLUGIN."log/consolidate.php");
+		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 "// -->\n";
+		echo "</script>";
+	}
+}
+
+
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/log/languages/English.php 0.7.7/e107_plugins/log/languages/English.php
--- 0.7.5/e107_plugins/log/languages/English.php	2005-06-21 16:02:24.000000000 -0500
+++ 0.7.7/e107_plugins/log/languages/English.php	2006-06-22 14:49:58.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/languages/English.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/06/21 21:02:24 $
-|     $Author: stevedunstan $
+|     $Revision: 1.7 $
+|     $Date: 2006/06/22 19:49:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 define("PAGE_NAME", "Statistics");
-	
+
 define("ADSTAT_L1", "This plugin will log all visits to your site, and build detailed statistic screens based on the information gathered.");
 define("ADSTAT_L2", "The statistics logger has been successfully installed. To convert your existing stats to the new system, please <a href='".e_PLUGIN."log/update_routine.php'>click here to run update routine</a>.");
 define("ADSTAT_L3", "Statistic Logging");
@@ -27,7 +27,7 @@
 define("ADSTAT_L6", "Site Statistics");
 define("ADSTAT_L7", "Statistics for this type is not being gathered.");
 define("ADSTAT_L8", "Today's Stats");
-define("ADSTAT_L9", "Alltime Stats");
+define("ADSTAT_L9", "All-time Stats");
 define("ADSTAT_L10", "Daily Stats");
 define("ADSTAT_L11", "Monthly Stats");
 define("ADSTAT_L12", "Browser Stats");
diff -ruN 0.7.5/e107_plugins/log/languages/admin/English.php 0.7.7/e107_plugins/log/languages/admin/English.php
--- 0.7.5/e107_plugins/log/languages/admin/English.php	2005-06-24 12:36:38.000000000 -0500
+++ 0.7.7/e107_plugins/log/languages/admin/English.php	2006-10-21 06:24:08.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.10 $
-|     $Date: 2005/06/24 17:36:38 $
-|     $Author: stevedunstan $
+|     $Revision: 1.11 $
+|     $Date: 2006/10/21 11:24:08 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 	
@@ -53,8 +53,8 @@
 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_L10", "Referrers");
+//define("ADSTAT_L10", "Referrers");
 
 
 
diff -ruN 0.7.5/e107_plugins/log/loginfo.php 0.7.7/e107_plugins/log/loginfo.php
--- 0.7.5/e107_plugins/log/loginfo.php	2006-02-19 10:08:44.000000000 -0600
+++ 0.7.7/e107_plugins/log/loginfo.php	2006-11-09 16:03:18.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/loginfo.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/02/19 16:08:44 $
-|     $Author: lisa_ $
+|     $Revision: 1.15 $
+|     $Date: 2006/11/09 22:03:18 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -115,17 +115,17 @@
 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.
+	//(But #1997)
+	//
 	$browsers = array(
 		"netcaptor"    => array('name' => 'Netcaptor',         'rule' => 'netcaptor[ /]([0-9.]{1,10})'),
-		"explorer"     => array('name' => 'Internet Explorer', 'rule' => '\(compatible; MSIE[ /]([0-9.]{1,10})'),
-		"firefox"      => array('name' => 'Firefox',           'rule' => 'Firefox/([0-9.+]{1,10})'),
 		"opera"        => array('name' => 'Opera',             'rule' => 'opera[ /]([0-9.]{1,10})'),
 		"aol"          => array('name' => 'AOL',               'rule' => 'aol[ /\-]([0-9.]{1,10})'),
 		"aol2"         => array('name' => 'AOL',               'rule' => 'aol[ /\-]?browser'),
-		"netscape"     => array('name' => 'Netscape',          'rule' => 'netscape[0-9]?/([0-9.]{1,10})'),
-		"netscape2"    => array('name' => 'Netscape',          'rule' => '^mozilla/([0-4]\.[0-9.]{1,10})'),
-		"mozilla"      => array('name' => 'Mozilla',           'rule' => '^mozilla/[5-9]\.[0-9.]{1,10}.+rv:([0-9a-z.+]{1,10})'),
-		"mozilla2"     => array('name' => 'Mozilla',           'rule' => '^mozilla/([5-9]\.[0-9a-z.]{1,10})'),
 		"mosaic"       => array('name' => 'Mosaic',            'rule' => 'mosaic[ /]([0-9.]{1,10})'),
 		"k-meleon"     => array('name' => 'K-Meleon',          'rule' => 'K-Meleon[ /]([0-9.]{1,10})'),
 		"konqueror"    => array('name' => 'Konqueror',         'rule' => 'konqueror/([0-9.]{1,10})'),
@@ -152,7 +152,6 @@
 		"doris"        => array('name' => 'Doris',             'rule' => 'Doris/([0-9.]{1,10})'),
 		"elinks"       => array('name' => 'ELinks',            'rule' => 'ELinks[ /][(]*([0-9.]{1,10})'),
 		"epiphany"     => array('name' => 'Epiphany',          'rule' => 'Epiphany/([0-9.]{1,10})'),
-		"firebird"     => array('name' => 'Firebird',          'rule' => 'Firebird/([0-9.+]{1,10})'),
 		"ibrowse"      => array('name' => 'IBrowse',           'rule' => 'ibrowse[ /]([0-9.]{1,10})'),
 		"icab"         => array('name' => 'iCab',              'rule' => 'icab[/ ]([0-9.]{1,10})'),
 		"ice"          => array('name' => 'ICEbrowser',        'rule' => 'ICEbrowser/v?([0-9._]{1,10})'),
@@ -180,6 +179,13 @@
 		"w3m"          => array('name' => 'w3m',               'rule' => 'w3m/([0-9.]{1,10})'),
 		"webtv"        => array('name' => 'Webtv',             'rule' => 'webtv[ /]([0-9.]{1,10})'),
 		"xiino"        => array('name' => 'Xiino',             'rule' => '^Xiino[ /]([0-9a-z.]{1,10})'),
+		"explorer"     => array('name' => 'Internet Explorer', 'rule' => '\(compatible; MSIE[ /]([0-9.]{1,10})'),
+		"firefox"      => array('name' => 'Firefox',           'rule' => 'Firefox/([0-9.+]{1,10})'),
+		"netscape"     => array('name' => 'Netscape',          'rule' => 'netscape[0-9]?/([0-9.]{1,10})'),
+		"netscape2"    => array('name' => 'Netscape',          'rule' => '^mozilla/([0-4]\.[0-9.]{1,10})'),
+		"mozilla"      => array('name' => 'Mozilla',           'rule' => '^mozilla/[5-9]\.[0-9.]{1,10}.+rv:([0-9a-z.+]{1,10})'),
+		"mozilla2"     => array('name' => 'Mozilla',           'rule' => '^mozilla/([5-9]\.[0-9a-z.]{1,10})'),
+		"firebird"     => array('name' => 'Firebird',          'rule' => 'Firebird/([0-9.+]{1,10})'),
 	);
 	$browser = "";
 	foreach($browsers as $info) {
diff -ruN 0.7.5/e107_plugins/login_menu/config.php 0.7.7/e107_plugins/login_menu/config.php
--- 0.7.5/e107_plugins/login_menu/config.php	2005-05-03 21:17:58.000000000 -0500
+++ 0.7.7/e107_plugins/login_menu/config.php	2006-11-04 13:09:24.000000000 -0600
@@ -1,5 +1,5 @@
 <?php
-	
+
 /*
 + ----------------------------------------------------------------------------+
 |     e107 website system
@@ -12,92 +12,85 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/config.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/05/04 02:17:58 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.4 $
+|     $Date: 2006/11/04 19:09:24 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 $eplug_admin = TRUE;
 require_once("../../class2.php");
-$lan_file = e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php";
-if (file_exists($lan_file)) {
-	require_once($lan_file);
-} else {
-	require_once(e_PLUGIN."login_menu/languages/English.php");
-}
-if (!getperms("4")) {
-	header("location:".e_BASE."index.php");
-	 exit ;
-}
+if (!getperms("4")) { header("location:".e_BASE."index.php"); exit ;}
+
+include_lan(e_PLUGIN."login_menu/languages/".e_LANGUAGE.".php");
 require_once(e_ADMIN."auth.php");
-	
+
 if ($_POST['update_menu']) {
 	unset($menu_pref['login_menu']);
 	$menu_pref['login_menu'] = $_POST['pref'];
 	$tmp = addslashes(serialize($menu_pref));
 	$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' ");
-	$ns->tablerender("", '<div style=\'text-align:center\'><b>'.LOGIN_MENU_L38.'</b></div>');
+	$ns->tablerender("", '<div style=\'text-align:center\'><b>'.LAN_SETSAVED.'</b></div>');
 }
-	
+
 $text = '
 	<div style="text-align:center">
 	<form action="'.e_SELF.'?'.e_QUERY.'" method="post">
 	<table style="width:85%" class="fborder" >
-	 
+
 	<tr>
 	<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L31.'</td>
 	<td style="width:70%" class="forumheader3">
 	<input type="checkbox" name="pref[new_news]" value="1"'.($menu_pref['login_menu']['new_news'] == 1 ? ' checked="checked"' : '').' />
 	</td>
 	</tr>
-	 
+
 	<tr>
 	<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L32.'</td>
 	<td style="width:70%" class="forumheader3">
 	<input type="checkbox" name="pref[new_articles]" value="1"'.($menu_pref['login_menu']['new_articles'] == 1 ? ' checked="checked"' : '').' />
 	</td>
 	</tr>
-	 
+
 	<tr>
 	<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L33.'</td>
 	<td style="width:70%" class="forumheader3">
 	<input type="checkbox" name="pref[new_chatbox]" value="1"'.($menu_pref['login_menu']['new_chatbox'] == 1 ? ' checked="checked"' : '').' />
 	</td>
 	</tr>
-	 
+
 	<tr>
 	<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L34.'</td>
 	<td style="width:70%" class="forumheader3">
 	<input type="checkbox" name="pref[new_comments]" value="1"'.($menu_pref['login_menu']['new_comments'] == 1 ? ' checked="checked"' : '').' />
 	</td>
 	</tr>
-	 
-	 
+
+
 	<tr>
 	<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L35.'</td>
 	<td style="width:70%" class="forumheader3">
 	<input type="checkbox" name="pref[new_forum]" value="1"'.($menu_pref['login_menu']['new_forum'] == 1 ? ' checked="checked"' : '').' />
 	</td>
 	</tr>
-	 
+
 	<tr>
 	<td style="width:30%" class="forumheader3">'.LOGIN_MENU_L36.'</td>
 	<td style="width:70%" class="forumheader3">
 	<input type="checkbox" name="pref[new_members]" value="1"'.($menu_pref['login_menu']['new_members'] == 1 ? ' checked="checked"' : '').' />
 	</td>
 	</tr>
-	 
+
 	<tr>
-	<td colspan="2" class="forumheader" style="text-align: center;"><input class="button" type="submit" name="update_menu" value="'.LOGIN_MENU_L37.'" /></td>
+	<td colspan="2" class="forumheader" style="text-align: center;"><input class="button" type="submit" name="update_menu" value="'.LAN_SAVE.'" /></td>
 	</tr>
 	</table>
 	</form>
 	</div>
 	';
-	
-$ns->tablerender('Login Menu Settings', $text);
-	
+
+$ns->tablerender(LOGIN_MENU_L41, $text);
+
 require_once(e_ADMIN."footer.php");
-	
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_plugins/login_menu/languages/English.php 0.7.7/e107_plugins/login_menu/languages/English.php
--- 0.7.5/e107_plugins/login_menu/languages/English.php	2006-04-27 01:02:46.000000000 -0500
+++ 0.7.7/e107_plugins/login_menu/languages/English.php	2006-11-04 13:09:24.000000000 -0600
@@ -11,19 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/languages/English.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/04/27 06:02:46 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/11/04 19:09:24 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 define("LOGIN_MENU_L1", "Username: ");
 define("LOGIN_MENU_L2", "Password: ");
 define("LOGIN_MENU_L3", "Signup");
 define("LOGIN_MENU_L4", "Forgot password?");
 define("LOGIN_MENU_L5", "Welcome");
 define("LOGIN_MENU_L6", "Remember me");
-define("LOGIN_MENU_L7", "Unique user id not recognised (possible corrupted cookie).<br />Please <a href=\"".e_BASE."index.php?logout\">click here</a> to destroy cookie.");
+define("LOGIN_MENU_L7", "Unique user ID not recognised (possible corrupted cookie).<br />Please <a href=\"".e_BASE."index.php?logout\">click here</a> to destroy cookie.");
 define("LOGIN_MENU_L8", "Logout");
 define("LOGIN_MENU_L9", "Login Error");
 define("LOGIN_MENU_L10", "The maintenance flag is true - this means normal visitors are being redirected to sitedown.php. To reset the flag go to admin/maintenance.");
@@ -45,10 +45,10 @@
 define("LOGIN_MENU_L26", "no");
 define("LOGIN_MENU_L27", "and");
 define("LOGIN_MENU_L28", "Login");
-	
+
 define("LOGIN_MENU_L29", "new article");
 define("LOGIN_MENU_L30", "new articles");
-	
+
 // New config options
 define('LOGIN_MENU_L31', 'Show New News Posts');
 define('LOGIN_MENU_L32', 'Show New Article Posts');
@@ -56,10 +56,10 @@
 define('LOGIN_MENU_L34', 'Show New Comment Posts');
 define('LOGIN_MENU_L35', 'Show New Forum Posts');
 define('LOGIN_MENU_L36', 'Show New Members');
-define('LOGIN_MENU_L37', 'Update Settings');
-define('LOGIN_MENU_L38', 'Settings Updated');
 
 
 define('LOGIN_MENU_L39', 'Leave Admin');
-	
-?>
\ No newline at end of file
+define("LOGIN_MENU_L40", "Resend Activation Email");
+define("LOGIN_MENU_L41", "Login Menu Settings");
+
+?>
diff -ruN 0.7.5/e107_plugins/login_menu/login_menu.php 0.7.7/e107_plugins/login_menu/login_menu.php
--- 0.7.5/e107_plugins/login_menu/login_menu.php	2006-05-13 23:05:13.000000000 -0500
+++ 0.7.7/e107_plugins/login_menu/login_menu.php	2006-11-28 19:48:21.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu.php,v $
-|     $Revision: 1.46 $
-|     $Date: 2006/05/14 04:05:13 $
+|     $Revision: 1.49 $
+|     $Date: 2006/11/29 01:48:21 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -24,11 +24,22 @@
 	return;      // prevent failed login attempts when fpw.php is loaded before this menu.
 }
 
-global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY;
+global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY,$bullet;
 require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php");
 $ip = $e107->getip();
 
-$bullet = (defined("BULLET") ? "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />" : "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />");
+	if(defined("BULLET"))
+	{
+   		$bullet = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />";
+	}
+	elseif(file_exists(THEME."images/bullet2.gif"))
+	{
+		$bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
+	}
+	else
+	{
+		$bullet = "";
+	}
 
 if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
 {
@@ -47,24 +58,19 @@
 $text = '';
 if (USER == TRUE || ADMIN == TRUE)
 {
-	if (ADMIN == TRUE)
-	{
-		$text = ($pref['maintainance_flag'] == 1 ? '<div style="text-align:center"><strong>'.LOGIN_MENU_L10.'</strong></div><br />' : '' );
-		if (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE) 
-		{
-			$text .= $bullet.' <a class="login_menu_link" href="'.e_ADMIN_ABS.'admin.php">'.LOGIN_MENU_L11.'</a><br />';
-		}
-		else
-		{
-			$text .= $bullet.' <a class="login_menu_link" href="'.e_BASE.'index.php">'.LOGIN_MENU_L39.'</a><br />';
+	if (!isset($LOGIN_MENU_LOGGED)) {
+		if (file_exists(THEME."login_menu_template.php")){
+	   		require(THEME."login_menu_template.php");
+		}else{
+			require(e_PLUGIN."login_menu/login_menu_template.php");
 		}
-			
 	}
-	$text .= $bullet.' <a class="login_menu_link" href="'.e_HTTP.'usersettings.php">'.LOGIN_MENU_L12.'</a>
-	<br />
-	'.$bullet.' <a class="login_menu_link" href="'.e_HTTP.'user.php?id.'.USERID.'">'.LOGIN_MENU_L13.'</a>
-	<br />
-	'.$bullet.' <a class="login_menu_link" href="'.e_HTTP.'index.php?logout">'.LOGIN_MENU_L8.'</a>';
+
+	if(!$LOGIN_MENU_LOGGED){ // if still doesn't exist in the user template.
+    	require(e_PLUGIN."login_menu/login_menu_template.php");
+	}
+
+    $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' "))
 	{
@@ -87,34 +93,13 @@
 			$NewItems[] = $new_news.' '.($new_news == 1 ? LOGIN_MENU_L14 : LOGIN_MENU_L15);
 		}
 
-		// ------------ Article Stats -----------
+		// ------------ Comments Stats -----------
 
-		if (isset($menu_pref['login_menu']) && $menu_pref['login_menu']['new_comments'] == true)
+		if (varset($menu_pref['login_menu']['new_comments'], false, true) == true)
 		{
 			$new_comments = 0;
-			$new_comments = $sql->db_Select('comments', '*', '`comment_datestamp` > '.$time);
+			$new_comments = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
 
-			$handle = opendir(e_PLUGIN);
-			while (false !== ($file = readdir($handle)))
-			{
-				if ($file != '.' && $file != '..' && is_dir(e_PLUGIN.$file))
-				{
-					$plugin_handle = opendir(e_PLUGIN.$file."/");
-					while (false !== ($file2 = readdir($plugin_handle)))
-					{
-						if ($file2 == 'e_comment.php')
-						{
-							require_once(e_PLUGIN.$file.'/'.$file2);
-							if ($comment_type == $e_plug_table)
-							{
-								$new_comments++;
-								break 2;
-							}
-						}
-					}
-				}
-			}
-			$new_total += $new_comments;
 			if (!$new_comments)
 			{
 				$new_comments = LOGIN_MENU_L26;
@@ -190,17 +175,22 @@
 	}
 	$ns->tablerender($caption, $text, 'login');
 } else {
-	if (!$LOGIN_MENU_FORM) {
+	if (!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE) {
 		if (file_exists(THEME."login_menu_template.php")){
 	   		require_once(THEME."login_menu_template.php");
 		}else{
 			require_once(e_PLUGIN."login_menu/login_menu_template.php");
 		}
 	}
-	if (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE) 
+	if(!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE){
+    	require(e_PLUGIN."login_menu/login_menu_template.php");
+	}
+
+	if (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE)
 	{
+
 		if (LOGINMESSAGE != '') {
-			$text = '<div style="text-align: center;">'.LOGINMESSAGE.'</div>';
+			$text = $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes);
 		}
 
 		$text .= '<form method="post" action="'.e_SELF.(e_QUERY ? '?'.e_QUERY : '').'">';
@@ -219,4 +209,4 @@
 	$ns->tablerender($caption, $text, 'login');
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/login_menu/login_menu_shortcodes.php 0.7.7/e107_plugins/login_menu/login_menu_shortcodes.php
--- 0.7.5/e107_plugins/login_menu/login_menu_shortcodes.php	2006-04-24 14:04:36.000000000 -0500
+++ 0.7.7/e107_plugins/login_menu/login_menu_shortcodes.php	2006-11-18 16:40:54.000000000 -0600
@@ -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.3 $
-|     $Date: 2006/04/24 19:04:36 $
-|     $Author: sweetas $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/18 22:40:54 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -45,25 +45,116 @@
 
 SC_BEGIN LM_REMEMBERME
 global $pref;
+if($parm == "hidden"){
+	return "<input type='hidden' name='autologin' value='1' />";
+}
 if($pref['user_tracking'] != "session")
 {
-	return "<br /><input type='checkbox' name='autologin' value='1' checked='checked' />".LOGIN_MENU_L6;
+	return "<input type='checkbox' name='autologin' value='1' checked='checked' />".LOGIN_MENU_L6;
 }
 SC_END
 
 SC_BEGIN LM_SIGNUP_LINK
 global $pref;
-if ($pref['user_reg']) {
+if ($pref['user_reg'])
+{
 	if (!$pref['auth_method'] || $pref['auth_method'] == 'e107')
 	{
-		return "<a class='login_menu_link' href='".e_SIGNUP."'>".LOGIN_MENU_L3."</a>";
+		return "<a class='login_menu_link signup' href='".e_SIGNUP."' title=\"".LOGIN_MENU_L3."\">".LOGIN_MENU_L3."</a>";
 	}
 }
+return "";
 SC_END
 
 SC_BEGIN LM_FPW_LINK
-return "<a class='login_menu_link' href='".e_BASE."fpw.php'>".LOGIN_MENU_L4."</a>";
+global $pref;
+if ($pref['user_reg'])
+{
+	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 "";
+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>";
+	}
+}
+return "";
+SC_END
+
+SC_BEGIN LM_MAINTENANCE
+global $pref;
+if(ADMIN == TRUE){
+	return ($pref['maintainance_flag'] == 1 ? '<div style="text-align:center"><strong>'.LOGIN_MENU_L10.'</strong></div><br />' : '' );
+}
+SC_END
+
+SC_BEGIN LM_ADMINLINK_BULLET
+global $bullet;
+if(ADMIN==TRUE && $bullet !='bullet'){
+	return $bullet;
+}
+SC_END
+
+SC_BEGIN LM_ADMINLINK
+global $ADMIN_DIRECTORY, $eplug_admin;
+
+//die(e_PAGE);
+
+if(ADMIN == TRUE) {
+		if (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE || $eplug_admin == true || substr(e_PAGE, 0, 6) == 'admin_')
+		{
+			return '<a class="login_menu_link" href="'.e_BASE.'index.php">'.LOGIN_MENU_L39.'</a>';
+		}
+		else
+		{
+			return '<a class="login_menu_link" href="'.e_ADMIN_ABS.'admin.php">'.LOGIN_MENU_L11.'</a>';
+		}
+}
+SC_END
+
+
+
+SC_BEGIN LM_BULLET
+global $bullet;
+return $bullet;
+
+SC_END
+
+SC_BEGIN LM_USERSETTINGS
+$text = ($parm) ? $parm : LOGIN_MENU_L12;
+return '<a class="login_menu_link" href="'.e_HTTP.'usersettings.php">'.$text.'</a>';
+SC_END
+
+SC_BEGIN LM_PROFILE
+$text = ($parm) ? $parm : LOGIN_MENU_L13;
+return '<a class="login_menu_link" href="'.e_HTTP.'user.php?id.'.USERID.'">'.$text.'</a>';
+SC_END
+
+SC_BEGIN LM_LOGOUT
+$text = ($parm) ? $parm : LOGIN_MENU_L8;
+return '<a class="login_menu_link" href="'.e_HTTP.'index.php?logout">'.$text.'</a>';
+SC_END
+
+SC_BEGIN LM_MESSAGE
+global $tp;
+if($parm == "popup"){
+	$srch = array("<br />","'");
+	$rep = array("\\n","\'");
+	return "<script type='text/javascript'>
+		alert('".$tp->toJS(LOGINMESSAGE)."');
+		</script>";
+}else{
+	return LOGINMESSAGE;
+}
 SC_END
 
 */
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/login_menu/login_menu_template.php 0.7.7/e107_plugins/login_menu/login_menu_template.php
--- 0.7.5/e107_plugins/login_menu/login_menu_template.php	2006-01-25 14:17:09.000000000 -0600
+++ 0.7.7/e107_plugins/login_menu/login_menu_template.php	2006-10-21 12:23:39.000000000 -0500
@@ -11,13 +11,23 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu_template.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/01/25 20:17:09 $
+|     $Revision: 1.6 $
+|     $Date: 2006/10/21 17:23:39 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 $sc_style['LM_SIGNUP_LINK']['pre'] = "<br />[ ";
 $sc_style['LM_SIGNUP_LINK']['post'] = " ]";
+
+$sc_style['LM_FPW_LINK']['pre'] = "<br />[ ";
+$sc_style['LM_FPW_LINK']['post'] = " ]";
+
+$sc_style['LM_RESEND_LINK']['pre'] = "<br />[ ";
+$sc_style['LM_RESEND_LINK']['post'] = " ]";
+
+$sc_style['LM_REMEMBERME']['pre'] = "<br />";
+$sc_style['LM_REMEMBERME']['post'] = "";
+
 if (!isset($LOGIN_MENU_FORM)){
 
 	$LOGIN_MENU_FORM = "
@@ -35,9 +45,26 @@
   {LM_REMEMBERME}
 	<br />
 	{LM_SIGNUP_LINK}
-	<br />
-	[ {LM_FPW_LINK} ]
+	{LM_FPW_LINK}
+	{LM_RESEND_LINK}
 	</div>
 	";
 }
-?>
\ No newline at end of file
+
+if (!isset($LOGIN_MENU_LOGGED)){
+    $sc_style['LM_ADMINLINK']['pre'] = "";
+	$sc_style['LM_ADMINLINK']['post'] = "<br />";
+
+	$LOGIN_MENU_LOGGED = "
+		{LM_MAINTENANCE}
+		{LM_ADMINLINK_BULLET} {LM_ADMINLINK}
+		{LM_BULLET} {LM_USERSETTINGS}<br />
+		{LM_BULLET}	{LM_PROFILE}<br />
+		{LM_BULLET} {LM_LOGOUT}
+	";
+}
+
+if (!isset($LOGIN_MENU_MESSAGE)){
+	$LOGIN_MENU_MESSAGE = '<div style="text-align: center;">{LM_MESSAGE}</div>';
+}
+?>
diff -ruN 0.7.5/e107_plugins/newforumposts_main/newforumposts.sc 0.7.7/e107_plugins/newforumposts_main/newforumposts.sc
--- 0.7.5/e107_plugins/newforumposts_main/newforumposts.sc	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/newforumposts_main/newforumposts.sc	2006-11-10 01:15:33.000000000 -0600
@@ -0,0 +1,10 @@
+// $Id: newforumposts.sc,v 1.1 2006/11/10 07:15:33 e107coders Exp $
+// use $parm to restrict visibility based on matching part of the URL
+if($parm && !strpos(e_SELF,$parm))
+{
+	return;
+}
+else
+{
+	include(e_PLUGIN."newforumposts_main/newforumposts_main.php");
+}
diff -ruN 0.7.5/e107_plugins/newforumposts_main/newforumposts_main.php 0.7.7/e107_plugins/newforumposts_main/newforumposts_main.php
--- 0.7.5/e107_plugins/newforumposts_main/newforumposts_main.php	2006-03-16 15:01:44.000000000 -0600
+++ 0.7.7/e107_plugins/newforumposts_main/newforumposts_main.php	2006-11-06 21:26:54.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.22 $
-|     $Date: 2006/03/16 21:01:44 $
-|     $Author: whoisrich $
+|     $Revision: 1.25 $
+|     $Date: 2006/11/07 03:26:54 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -25,11 +25,11 @@
 include_once((file_exists($lan_file) ? $lan_file : e_PLUGIN."newforumposts_main/languages/English.php"));
 global $sql, $ns;
 // get template ...
-	
+
 if (file_exists(THEME."newforumpost.php")) {
 	require_once(THEME."newforumpost.php");
 }
-else if(!$NEWFORUMPOSTSTYLE_HEADER) {
+else if(!isset($NEWFORUMPOSTSTYLE_HEADER)) {
 	// no template found - use default ...
 	$NEWFORUMPOSTSTYLE_HEADER = "
 		<!-- newforumposts -->
@@ -42,7 +42,7 @@
 		<td style='width:5%; text-align:center' class='forumheader'>".NFPM_LAN_4."</td>
 		<td style='width:25%; text-align:center' class='forumheader'>".NFPM_LAN_5."</td>
 		</tr>\n";
-	 
+
 	$NEWFORUMPOSTSTYLE_MAIN = "
 		<tr>
 		<td style='width:5%; text-align:center' class='forumheader3'>{ICON}</td>
@@ -50,31 +50,31 @@
 		<td style='width:15%; text-align:center' class='forumheader3'>{POSTER}</td>
 		<td style='width:5%; text-align:center' class='forumheader3'>{VIEWS}</td>
 		<td style='width:5%; text-align:center' class='forumheader3'>{REPLIES}</td>
-		<td style='width:25%; text-align:center' class='forumheader3'>{LASTPOST}<br /><span class='smalltext'>{LASTPOSTDATE}</span></td>
+		<td style='width:25%; text-align:center' class='forumheader3'>{LASTPOST}<br /><span class='smalltext'>{LASTPOSTDATE}&nbsp;</span></td>
 		</tr>\n";
-	 
+
 	$NEWFORUMPOSTSTYLE_FOOTER = "<tr>\n<td colspan='6' style='text-align:center' class='forumheader2'>
 		<span class='smalltext'>".NFPM_LAN_6.": <b>{TOTAL_TOPICS}</b> | ".NFPM_LAN_4.": <b>{TOTAL_REPLIES}</b> | ".NFPM_LAN_3.": <b>{TOTAL_VIEWS}</b></span>\n</td>\n</tr>\n</table>\n</div>";
-	 
+
 }
 
 $results = $sql->db_Select_gen("
 SELECT t.thread_id, t.thread_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class, lp.user_name AS lp_name
 FROM #forum_t AS t
-LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
-LEFT JOIN #user AS lp ON FLOOR(t.thread_lastuser) = lp.user_id  
+LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
 LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id 
-WHERE f.forum_id = t.thread_forum_id AND t.thread_parent=0 AND f.forum_class IN (".USERCLASS_LIST.") 
+LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
+WHERE f.forum_id = t.thread_forum_id AND t.thread_parent=0 AND f.forum_class IN (".USERCLASS_LIST.")
 AND fp.forum_class IN (".USERCLASS_LIST.")
 ORDER BY t.$query DESC LIMIT 0, ".$pref['nfp_amount']);
 
 $forumArray = $sql->db_getList();
-	
-if (!is_object($gen)) {
+
+if (!isset($gen) || !is_object($gen)) {
 	$gen = new convert;
 }
-	
+
 $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' ");
@@ -113,7 +113,7 @@
 		$LASTPOST = " - ";
 		$LASTPOSTDATE = "";
 	}
-		
+
 	$x = explode(chr(1), $thread_user);
 	$tmp = explode(".", $x[0], 2);
 	if($user_name)
@@ -134,14 +134,14 @@
 
 	$THREAD = "<a href='".$path."forum_viewtopic.php?{$thread_id}.last'>$thread_name</a>";
 	$FORUM = "<a href='".$path."forum_viewforum.php?{$forum_id}'>$forum_name</a>";
-	 
+
 	$VIEWS = $thread_views;
 	$REPLIES = $thread_total_replies;
 	$text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_MAIN);
-	 
+
 }
 $text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWFORUMPOSTSTYLE_FOOTER);
-	
+
 $text = ($pref['nfp_layer'] ? "<div style='border : 0; padding : 4px; width : auto; height : ".$pref['nfp_layer_height']."px; overflow : auto; '>".$text."</div>" : $text);
 
 if ($results)
@@ -149,4 +149,4 @@
 	$ns->tablerender($pref['nfp_caption'], $text, "nfp");
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsfeed/admin_config.php 0.7.7/e107_plugins/newsfeed/admin_config.php
--- 0.7.5/e107_plugins/newsfeed/admin_config.php	2006-04-14 09:09:53.000000000 -0500
+++ 0.7.7/e107_plugins/newsfeed/admin_config.php	2006-06-07 23:02:47.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/admin_config.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/04/14 14:09:53 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2006/06/08 04:02:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -79,29 +79,16 @@
 	<td class='forumheader' style='width: 10%; text-align: center;'>".NFLAN_27."</td>
 	</tr>\n";
 
+	$active = array(NFLAN_13,NFLAN_14,NFLAN_20,NFLAN_21);
+
 	foreach($nfArray as $newsfeed)
 	{
 		extract($newsfeed);
-		switch ($newsfeed_active)
-		{
-			case 0:
-				$active = NFLAN_13;
-			break;
-			case 1:
-				$active = NFLAN_14;
-			break;
-			case 2:
-				$active = NFLAN_20;
-			break;
-			case 3:
-				$active = NFLAN_21;
-			break;
-		}
 
 		$text .= "<tr><td class='forumheader3' style='width: 5%; text-align: center;'>$newsfeed_id</td>
 		<td class='forumheader3' style='width: 50%;'><a href='$newsfeed_url' rel='external'>$newsfeed_name</a></td>
 		<td class='forumheader3' style='width: 10%; text-align: center;'>".($newsfeed_updateint ? $newsfeed_updateint : "3600")."</td>
-		<td class='forumheader3' style='width: 25%; text-align: center;'>$active</td>
+		<td class='forumheader3' style='width: 25%; text-align: center;'>".$active[$newsfeed_active]."</td>
 		<td class='forumheader3' style='width: 10%; text-align: center;'><a href='".e_SELF."?edit.".$newsfeed_id."'>".ADMIN_EDIT_ICON."</a>&nbsp;<a href='".e_SELF."?delete.".$newsfeed_id."'>".ADMIN_DELETE_ICON."</a></td>
 		</tr>\n";
 	}
diff -ruN 0.7.5/e107_plugins/newsfeed/languages/English.php 0.7.7/e107_plugins/newsfeed/languages/English.php
--- 0.7.5/e107_plugins/newsfeed/languages/English.php	2006-04-14 09:09:53.000000000 -0500
+++ 0.7.7/e107_plugins/newsfeed/languages/English.php	2006-11-04 12:26:47.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/languages/English.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/04/14 14:09:53 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2006/11/04 18:26:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -61,7 +61,7 @@
 define("NFLAN_41", "No newsfeeds defined yet");
 
 define("NFLAN_42", "<b>&raquo;</b> <u>Feed Name:</u>
-	The identifying name of the feed, can be anything you like.
+	The identifying name of the feed can be anything you like.
 	<br /><br />
 	<b>&raquo;</b> <u>URL to rss feed:</u>
 	The address of the rss feed
@@ -76,7 +76,7 @@
 	The amount of seconds that elapse before the feed is updated, for example, 1800: 30 minutes, 3600: an hour.
 	<br /><br />
 	<b>&raquo;</b> <u>Activation:</u>
-	where you want the feed results to be displayed, to see menu feeds you will need to activate the newsfeeds menu on the <a href='".e_ADMIN."menus.php'>menus page</a>.
+	Where you want the feed results to be displayed, to see menu feeds you will need to activate the newsfeeds menu on the <a href='".e_ADMIN."menus.php'>menus page</a>.
 	<br /><br />For a good list of available feeds, see <a href='http://www.syndic8.com/' rel='external'>syndic8.com</a> or <a href='http://feedfinder.feedster.com/index.php' rel='external'>feedster.com</a>");
 define("NFLAN_43", "Newsfeed help");
 define("NFLAN_44", "click to view");
@@ -85,4 +85,7 @@
 define("NFLAN_46", "Number of items to show on main page");
 define("NFLAN_47", "0 or blank to show all");
 
-?>
\ No newline at end of file
+define("NFLAN_48", "Unable to save raw data in database.");
+define("NFLAN_49", "Unable to unserialize rss data - uses non-standard syntax");
+
+?>
diff -ruN 0.7.5/e107_plugins/newsfeed/newsfeed.php 0.7.7/e107_plugins/newsfeed/newsfeed.php
--- 0.7.5/e107_plugins/newsfeed/newsfeed.php	2006-04-14 09:09:53.000000000 -0500
+++ 0.7.7/e107_plugins/newsfeed/newsfeed.php	2006-11-04 12:26:47.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/newsfeed.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/04/14 14:09:53 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.13 $
+|     $Date: 2006/11/04 18:26:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -60,7 +60,7 @@
 
 		if(!is_object($rss))
 		{
-			$text = "Unable to unserialize rss data - uses non-standard syntax";
+			$text = NFLAN_49;
 			$ns->tablerender(NFLAN_01, $text);
 			require_once(FOOTERF);
 			exit;
@@ -165,4 +165,4 @@
 $ns->tablerender(NFLAN_29, $text);
 require_once(FOOTERF);
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsfeed/newsfeed_functions.php 0.7.7/e107_plugins/newsfeed/newsfeed_functions.php
--- 0.7.5/e107_plugins/newsfeed/newsfeed_functions.php	2006-04-14 09:09:53.000000000 -0500
+++ 0.7.7/e107_plugins/newsfeed/newsfeed_functions.php	2006-11-13 04:43:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/newsfeed_functions.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/04/14 14:09:53 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.17 $
+|     $Date: 2006/11/13 10:43:48 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -56,7 +56,7 @@
 
 						if(!$sql->db_Update('newsfeed', "newsfeed_data='{$serializedArray}', newsfeed_timestamp=".time().($newsfeed_des ? ", newsfeed_description='{$newsfeed_des}'": "")." WHERE newsfeed_id=".intval($newsfeed_id)))
 						{
-							echo "Unable to save raw data in database.<br /><br />".$serializedArray;
+							echo NFLAN_48."<br /><br />".$serializedArray;
 						}
 					}
 					else
@@ -100,11 +100,13 @@
 		{
 			while($row = $sql->db_Fetch())
 			{
+
 				extract ($row);
-				list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $newsfeed_image);				
+				list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $newsfeed_image);
 				$numtoshow = ($where == 'main' ? $newsfeed_showmain : $newsfeed_showmenu);
 				$numtoshow = (intval($numtoshow) > 0 ? $numtoshow : 999);
 				$rss = unserialize($newsfeed_data);
+
 				$FEEDNAME = "<a href='".e_SELF."?show.$newsfeed_id'>$newsfeed_name</a>";
 				$FEEDDESCRIPTION = $newsfeed_description;
 				if($newsfeed_image == "default")
@@ -158,7 +160,9 @@
 
 				$data = "";
 
-				$item_total = array_slice($rss->items, 0, $items);
+				$amount = ($items) ? $items :  $numtoshow;
+
+				$item_total = array_slice($rss->items, 0, $amount);
 
 				$i = 0;
 				while($i < $numtoshow && $item_total[$i])
@@ -180,11 +184,11 @@
 
 		if($which == 'all')
 		{
-			$ret['title'] = NFLAN_38;
+			$ret['title'] = $NEWSFEED_MENU_CAPTION;
 		}
 		else
 		{
-			$ret['title'] = $newsfeed_name." ".NFLAN_38;
+			$ret['title'] = $newsfeed_name." ".$NEWSFEED_MAIN_CAPTION;
 		}
 		$ret['text'] = $text;
 
@@ -193,4 +197,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsfeed/plugin.php 0.7.7/e107_plugins/newsfeed/plugin.php
--- 0.7.5/e107_plugins/newsfeed/plugin.php	2006-01-22 13:53:06.000000000 -0600
+++ 0.7.7/e107_plugins/newsfeed/plugin.php	2006-08-25 10:37:54.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/plugin.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/01/22 19:53:06 $
+|     $Revision: 1.6 $
+|     $Date: 2006/08/25 15:37:54 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -23,7 +23,7 @@
 @include_once(e_PLUGIN."newsfeed/languages/English.php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = NFLAN_01;
+$eplug_name = "NFLAN_01";
 $eplug_version = "2.0";
 $eplug_author = "Steve Dunstan (jalist)";
 $eplug_url = "http://e107.org";
@@ -41,8 +41,6 @@
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "admin_config.php";
 
-$eplug_sc = array("");
-
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/newsfeed_32.png";
 $eplug_icon_small = $eplug_folder."/images/newsfeed_16.png";
diff -ruN 0.7.5/e107_plugins/newsfeed/templates/newsfeed_menu_template.php 0.7.7/e107_plugins/newsfeed/templates/newsfeed_menu_template.php
--- 0.7.5/e107_plugins/newsfeed/templates/newsfeed_menu_template.php	2006-02-08 14:50:47.000000000 -0600
+++ 0.7.7/e107_plugins/newsfeed/templates/newsfeed_menu_template.php	2006-11-13 04:48:16.000000000 -0600
@@ -11,28 +11,32 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/templates/newsfeed_menu_template.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/02/08 20:50:47 $
-|     $Author: streaky $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/13 10:48:16 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 $truncate = 100;
-$truncate_string = " ...[more]";
-$items = 10;
+$truncate_string = " ...";
+// $items = 2;
 
-$NEWSFEED_MENU_START = "
-<div style='text-align: center; margin-left: auto; margin-right: auto;'>{FEEDIMAGE}<br /><b>{FEEDTITLE}</b></div>\n<br />\n";
+$NEWSFEED_MENU_CAPTION = NFLAN_38;
 
-$NEWSFEED_MENU = "
-<b>&raquo;</b>{FEEDITEMLINK}<br /><span class='smalltext'>{FEEDITEMTEXT}</span><br />\n";
+$NEWSFEED_MENU_START = "\n\n<!-- Start NewsFeed Menu -->
+<div style='text-align: center; margin-left: auto; margin-right: auto;'>{FEEDIMAGE}<br /><b>{FEEDTITLE}</b></div>\n<br />
+<table class='newsfeed_menu_table' style='width:100%'>
+";
 
+$NEWSFEED_MENU = "
+<tr><td style='vertical-align:top;width:5%'><b>&raquo;</b></td><td class='newsfeed_menu_cell' >{FEEDITEMLINK}<br /><span class='smalltext'>{FEEDITEMTEXT}</span></td></tr>\n";
 
-$NEWSFEED_MENU_END = "
+$NEWSFEED_MENU_END = "</table><br />
 
-<div style='text-align: right;'><span class='smalltext'>{FEEDLASTBUILDDATE}<br />{LINKTOMAIN}</span></div>\n<hr />";
+<div style='text-align: center;'><hr /><span class='smalltext'>{FEEDLASTBUILDDATE}<br />{LINKTOMAIN}</span></div>\n
+<!-- End News Feed Menu -->\n\n";
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsfeed/templates/newsfeed_template.php 0.7.7/e107_plugins/newsfeed/templates/newsfeed_template.php
--- 0.7.5/e107_plugins/newsfeed/templates/newsfeed_template.php	2005-12-14 13:28:51.000000000 -0600
+++ 0.7.7/e107_plugins/newsfeed/templates/newsfeed_template.php	2006-11-13 06:25:00.000000000 -0600
@@ -11,14 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/templates/newsfeed_template.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 19:28:51 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/11/13 12:25:00 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+$NEWSFEED_MAIN_CAPTION = NFLAN_38;
+
 $NEWSFEED_LIST_START = "
 <table style='width: 100%;' class='fborder'>\n";
 
@@ -59,4 +61,4 @@
 </table>\n";
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsletter/admin_config.php 0.7.7/e107_plugins/newsletter/admin_config.php
--- 0.7.5/e107_plugins/newsletter/admin_config.php	2006-02-20 09:13:15.000000000 -0600
+++ 0.7.7/e107_plugins/newsletter/admin_config.php	2006-11-04 12:28:51.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.7 $
-|     $Date: 2006/02/20 15:13:15 $
-|     $Author: whoisrich $
+|     $Revision: 1.8 $
+|     $Date: 2006/11/04 18:28:51 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -423,7 +423,7 @@
 
 				$mail->AddAddress($memail, $mname);
 
-				echo "<b>Sending</b> ".$mname." ( ".$memail." ) <br />";
+				echo "<b>".NLLAN_54."</b> ".$mname." ( ".$memail." ) <br />";
 
 				$mail->Send();
 				$sent_counter ++;
@@ -515,4 +515,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsletter/languages/English.php 0.7.7/e107_plugins/newsletter/languages/English.php
--- 0.7.5/e107_plugins/newsletter/languages/English.php	2005-05-25 12:23:35.000000000 -0500
+++ 0.7.7/e107_plugins/newsletter/languages/English.php	2006-11-04 12:28:51.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsletter/languages/English.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/05/25 17:23:35 $
-|     $Author: stevedunstan $
+|     $Revision: 1.4 $
+|     $Date: 2006/11/04 18:28:51 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,7 +22,7 @@
 define("NLLAN_01", "Newsletter");
 define("NLLAN_02", "Provides a quick and easy way to configure and send newsletters");
 define("NLLAN_03", "Configure Newsletters");
-define("NLLAN_04", "The newsletter plugin has been successfuly installed. To configure, return to your main admin page and click on 'Newsletter' in the plugin section.");
+define("NLLAN_04", "The newsletter plugin has been successfully installed. To configure, return to your main admin page and click on 'Newsletter' in the plugin section.");
 define("NLLAN_05", "No newsletters defined yet");
 
 define("NLLAN_06", "Name");
@@ -71,16 +71,16 @@
 define("NLLAN_46", "Create mailing");
 define("NLLAN_47", "Newsletter Options");
 
-define("NLLAN_48", "you are subscribed to this newsletter - if you wish to un-subscribe please click the button below.");
+define("NLLAN_48", "you are subscribed to this newsletter - if you wish to unsubscribe please click the button below.");
 define("NLLAN_49", "Are you sure you want to un-subscribe from this newsletter?");
 define("NLLAN_50", "Click button to subscribe ( your subscription address is");
 define("NLLAN_51", "Unsubscribe");
 define("NLLAN_52", "Subscribe");
 define("NLLAN_53", "Are you sure you want to subscribe to this newsletter?");
 
+define("NLLAN_54", "Sending");
 
 
 
 
-
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/newsletter/plugin.php 0.7.7/e107_plugins/newsletter/plugin.php
--- 0.7.5/e107_plugins/newsletter/plugin.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/newsletter/plugin.php	2006-08-25 10:37:54.000000000 -0500
@@ -11,19 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsletter/plugin.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/08/25 15:37:54 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
 @include_once(e_PLUGIN."newsletter/languages/".e_LANGUAGE.".php");
 @include_once(e_PLUGIN."newsletter/languages/English.php");
-	
+
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = NLLAN_01;
+$eplug_name = "NLLAN_01";
 $eplug_version = "1.0";
 $eplug_author = "Steve Dunstan (jalist)";
 $eplug_url = "http://e107.org";
@@ -31,29 +31,27 @@
 $eplug_description = NLLAN_02;
 $eplug_compatible = "e107v0.7+";
 $eplug_readme = "";
-	
+
 // Name of the plugin's folder -------------------------------------------------------------------------------------
 $eplug_folder = "newsletter";
-	
+
 // Name of menu item for plugin ----------------------------------------------------------------------------------
 $eplug_menu_name = "newsletter_menu";
-	
+
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "admin_config.php";
-	
-$eplug_sc = array("");
 
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/nl_32.png";
 $eplug_icon_small = $eplug_folder."/images/nl_16.png";
 $eplug_caption = NLLAN_03;
-	
+
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array();
-	
+
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array("newsletter");
-	
+
 // List of sql requests to create tables -----------------------------------------------------------------------------
 $eplug_tables = array(
 
@@ -71,13 +69,13 @@
   PRIMARY KEY  (newsletter_id)
   ) TYPE=MyISAM;");
 
-	
+
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
 $eplug_link_name = "";
 $eplug_link_url = "";
-	
+
 // Text to display after plugin successfully installed ------------------------------------------------------------------
 $eplug_done = NLLAN_04;
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/online_extended_menu/online_extended_menu.php 0.7.7/e107_plugins/online_extended_menu/online_extended_menu.php
--- 0.7.5/e107_plugins/online_extended_menu/online_extended_menu.php	2006-02-06 21:03:51.000000000 -0600
+++ 0.7.7/e107_plugins/online_extended_menu/online_extended_menu.php	2006-10-22 17:36:03.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.14 $
-|     $Date: 2006/02/07 03:03:51 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.16 $
+|     $Date: 2006/10/22 22:36:03 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -60,7 +60,7 @@
 		$tmp = addslashes(serialize($menu_pref));
 		$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' ");
 	}
-
+    global $gen;
 	if (!is_object($gen)) {
 		$gen = new convert;
 	}
@@ -69,10 +69,11 @@
 
 	$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");
-
+ 	$total_members = $sql->db_Count("user","(*)","where user_ban='0'"); // greatly optimizes the query below.
 	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");
+
+		$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");
+
 		$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>";
@@ -84,4 +85,4 @@
 
 $ns->tablerender(ONLINE_EL4, $text, 'online_extended');
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/online_menu/languages/English.php 0.7.7/e107_plugins/online_menu/languages/English.php
--- 0.7.5/e107_plugins/online_menu/languages/English.php	2005-10-13 08:12:13.000000000 -0500
+++ 0.7.7/e107_plugins/online_menu/languages/English.php	2006-11-16 13:50:45.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.4 $
-|     $Date: 2005/10/13 13:12:13 $
-|     $Author: e107coders $
+|     $Revision: 1.5 $
+|     $Date: 2006/11/16 19:50:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,6 +22,6 @@
 define("ONLINE_L3", "On this page: ");
 define("ONLINE_L4", "Online");
 define("ONLINE_L5", "Members");
-define("ONLINE_L6", "newest");
+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
diff -ruN 0.7.5/e107_plugins/other_news_menu/languages/English.php 0.7.7/e107_plugins/other_news_menu/languages/English.php
--- 0.7.5/e107_plugins/other_news_menu/languages/English.php	2005-01-27 13:53:12.000000000 -0600
+++ 0.7.7/e107_plugins/other_news_menu/languages/English.php	2006-11-23 08:53:38.000000000 -0600
@@ -4,12 +4,13 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/other_news_menu/languages/English.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/01/27 19:53:12 $
-|     $Author: streaky $
+|     $Revision: 1.3 $
+|     $Date: 2006/11/23 14:53:38 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 	
 define("TD_MENU_L1", "Other News");
+define("TD_MENU_L2", "Other News");
 	
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/other_news_menu/other_news2_menu.php 0.7.7/e107_plugins/other_news_menu/other_news2_menu.php
--- 0.7.5/e107_plugins/other_news_menu/other_news2_menu.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/other_news_menu/other_news2_menu.php	2006-11-23 08:53:38.000000000 -0600
@@ -11,20 +11,29 @@
 |     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.9 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/23 14:53:38 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-// require_once("othernews_parser.php");
+global $e107cache;
+
+// Load Data
+if($cacheData = $e107cache->retrieve("nq_othernews2"))
+{
+	echo $cacheData;
+	return;
+}
+
+
 require_once(e_HANDLER."news_class.php");
 unset($text);
 global $OTHERNEWS2_STYLE;
 $ix = new news;
 
-if(!$OTHERNEWS2_STYLE){
+if(!$OTHERNEWS2_STYLE) {
 	$OTHERNEWS2_STYLE = "
 	<table class='forumheader3' cellpadding='0' cellspacing='0' style='width:100%'>
 	<tr><td class='caption2' colspan='2' style='padding:3px;text-decoration:none;'>
@@ -82,40 +91,47 @@
 $nbr_cols = OTHERNEWS2_COLS;
 
 $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=3  ORDER BY n.news_datestamp DESC LIMIT 0,".OTHERNEWS2_LIMIT;
-
-	if ($sql->db_Select_gen($query)){
-    $text = "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS2_SPACING."'>";
-    $t = 0;
+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=3  ORDER BY n.news_datestamp DESC LIMIT 0,".OTHERNEWS2_LIMIT;
+
+if ($sql->db_Select_gen($query)) {
+	$text = "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS2_SPACING."'>";
+	$t = 0;
 	$wid = floor(100/$nbr_cols);
 	while ($row = $sql->db_Fetch()) {
 		$text .= ($t % $nbr_cols == 0) ? "<tr>" : "";
 		$text .= "\n<td style='$style ; width:$wid%;'>\n";
 
-
 		$text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS2_STYLE, $param);
 
-
-    	$text .= "\n</td>\n";
+		$text .= "\n</td>\n";
 		if (($t+1) % $nbr_cols == 0) {
 			$text .= "</tr>";
 			$t++;
-		} else {
+		}
+		else {
 			$t++;
 		}
 	}
 
-
-    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>";
 
-	$ns->tablerender(TD_MENU_L1, $text, 'other_news2');
+
+	// Save Data
+	ob_start();
+
+	$ns->tablerender(TD_MENU_L2, $text, 'other_news2');
+
+	$cache_data = ob_get_flush();
+	$e107cache->set("nq_othernews2", $cache_data);
+
 }
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/other_news_menu/other_news_menu.php 0.7.7/e107_plugins/other_news_menu/other_news_menu.php
--- 0.7.5/e107_plugins/other_news_menu/other_news_menu.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/other_news_menu/other_news_menu.php	2006-11-23 08:53:38.000000000 -0600
@@ -11,31 +11,43 @@
 |     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.16 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.18 $
+|     $Date: 2006/11/23 14:53:38 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-// require_once("othernews_parser.php");
+global $e107cache;
+
+// Load Data
+if($cacheData = $e107cache->retrieve("nq_othernews"))
+{
+	echo $cacheData;
+	return;
+}
+
+
 require_once(e_HANDLER."news_class.php");
 unset($text);
 global $OTHERNEWS_STYLE;
 $ix = new news;
 
- if(!$OTHERNEWS_STYLE){
-$OTHERNEWS_STYLE = "
-			<div style='padding:3px;width:100%'>
-			<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
-			<tr>
-			<td style='vertical-align:top;padding:3px;width:20px'>
-			{NEWSCATICON}
-			</td><td style='text-align:left;padding:3px;vertical-align:top'>
-			{NEWSTITLELINK}
-			</td></tr></table>
-			</div>\n";
- }
+if(!$OTHERNEWS_STYLE)
+{
+	$OTHERNEWS_STYLE = "
+	<div style='padding:3px;width:100%'>
+	<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
+	<tr>
+	<td style='vertical-align:top;padding:3px;width:20px'>
+	{NEWSCATICON}
+	</td><td style='text-align:left;padding:3px;vertical-align:top'>
+	{NEWSTITLELINK}
+	</td></tr></table>
+	</div>\n";
+}
+
+
 if(!defined("OTHERNEWS_LIMIT")){
 	define("OTHERNEWS_LIMIT",10);
 }
@@ -75,39 +87,47 @@
 $nbr_cols = OTHERNEWS_COLS;
 
 
-	$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)){
-    $text = "<table style='width:100%' cellpadding='0' cellspacing='".OTHERNEWS_SPACING."'>";
-    $t = 0;
+$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)){
+	$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 .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS_STYLE, $param);
 
-    	$text .= "\n</td>\n";
+		$text .= "\n</td>\n";
 		if (($t+1) % $nbr_cols == 0) {
 			$text .= "</tr>";
 			$t++;
-		} else {
+		}
+		else {
 			$t++;
 		}
 	}
 
 
-    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>";
 
-		$ns->tablerender(TD_MENU_L1, $text, 'other_news');
-	}
+
+	// Save Data
+	ob_start();
+
+	$ns->tablerender(TD_MENU_L1, $text, 'other_news');
+
+	$cache_data = ob_get_flush();
+	$e107cache->set("nq_othernews", $cache_data);
+}
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/pdf/e107pdf.php 0.7.7/e107_plugins/pdf/e107pdf.php
--- 0.7.5/e107_plugins/pdf/e107pdf.php	2006-04-06 08:50:26.000000000 -0500
+++ 0.7.7/e107_plugins/pdf/e107pdf.php	2006-11-24 16:28:14.000000000 -0600
@@ -2,7 +2,7 @@
 
 //extend fpdf class from package with custom functions
 class e107PDF extends UFPDF{
-	
+
 	//variables of html parser
 	var $B;
 	var $I;
@@ -18,7 +18,7 @@
 	var $issetfont;
 	var $issetcolor;
 	var $iminfo=array(0,0);
-	
+
 	function e107PDF($orientation='P',$unit='mm',$format='A4'){
 		global $pdfpref;
 		//Call parent constructor
@@ -120,7 +120,7 @@
 		foreach($text as $k=>$v){
 			$text[$k] = $tp->toHTML($v, TRUE);
 		}
-		
+
 		//set some variables
 		$this->SetMargins($pdfpref['pdf_margin_left'],$pdfpref['pdf_margin_top'],$pdfpref['pdf_margin_right']);
 		//$this->SetAutoPageBreak(true,25);
@@ -134,7 +134,7 @@
 		$this->SetAuthor($text[2]);					//name of author
 		$this->SetTitle($text[3]);					//title
 		$this->SetSubject($text[4]);				//subject
-		$this->SetKeywords($text[5]);				//space/comma seperated
+		$this->SetKeywords($text[5]);				//space/comma separated
 		$file = $text[3].".pdf";					//name of the file
 		$this->Output($file, 'D');					//Save PDF to file (D = output to download window)
 		return;
@@ -148,7 +148,7 @@
 		$this->SetY(15);
 		$y0 = $this->GetY();
 		if($pdfpref['pdf_show_logo']){
-			$this->SetFont($pdfpref['pdf_font_family'],'',$pdfpref['pdf_font_size']);			
+			$this->SetFont($pdfpref['pdf_font_family'],'',$pdfpref['pdf_font_size']);
 			$this->PutImage(PDFLOGO, '1');
 			$x1 = $this->GetX();
 			$y1 = $this->GetY();
@@ -440,7 +440,7 @@
 				$this->issetfont=true;
 				$this->SetStyle('B',true);
                 break;
-            
+
 		}
 	}
 
@@ -628,4 +628,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/pdf/font/makefont/makefont.php 0.7.7/e107_plugins/pdf/font/makefont/makefont.php
--- 0.7.5/e107_plugins/pdf/font/makefont/makefont.php	2005-08-22 19:44:23.000000000 -0500
+++ 0.7.7/e107_plugins/pdf/font/makefont/makefont.php	2006-11-09 03:28:58.000000000 -0600
@@ -299,7 +299,7 @@
 {
 	//Generate a font definition file
 	set_magic_quotes_runtime(0);
-	ini_set('auto_detect_line_endings','1');
+	e107_ini_set('auto_detect_line_endings','1');
 	if($enc)
 	{
 		$map=ReadMap($enc);
diff -ruN 0.7.5/e107_plugins/pdf/languages/English.php 0.7.7/e107_plugins/pdf/languages/English.php
--- 0.7.5/e107_plugins/pdf/languages/English.php	2006-01-16 04:36:59.000000000 -0600
+++ 0.7.7/e107_plugins/pdf/languages/English.php	2006-06-22 14:49:58.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pdf/languages/English.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2006/01/16 10:36:59 $
-|     $Author: lisa_ $
+|     $Revision: 1.3 $
+|     $Date: 2006/06/22 19:49:58 $
+|     $Author: e107coders $
 +-----------------------------------------------------------------------------+
 */
 
@@ -32,7 +32,7 @@
 define("PDF_LAN_15", "show creator page url on pdf?");
 define("PDF_LAN_16", "show page numbers on pdf?");
 define("PDF_LAN_17", "update");
-define("PDF_LAN_18", "PDF preferences succesfully updated");
+define("PDF_LAN_18", "PDF preferences successfully updated");
 define("PDF_LAN_19", "Page");
 define("PDF_LAN_20", "error reporting");
 
diff -ruN 0.7.5/e107_plugins/pdf/pdf.sc 0.7.7/e107_plugins/pdf/pdf.sc
--- 0.7.5/e107_plugins/pdf/pdf.sc	2005-02-10 08:10:08.000000000 -0600
+++ 0.7.7/e107_plugins/pdf/pdf.sc	2006-09-28 20:09:49.000000000 -0500
@@ -8,7 +8,7 @@
 }
 $parms = explode("^",$parm);
 
-//core		//return "<a href='".e_BASE."pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
-//plugin	//return "<a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
+//core		//return "<a href='".e_BASE."pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
+//plugin	//return "<a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
 
-return "<a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
+return " <a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
diff -ruN 0.7.5/e107_plugins/pdf/plugin.php 0.7.7/e107_plugins/pdf/plugin.php
--- 0.7.5/e107_plugins/pdf/plugin.php	2006-01-11 09:54:58.000000000 -0600
+++ 0.7.7/e107_plugins/pdf/plugin.php	2006-08-25 10:37:54.000000000 -0500
@@ -18,7 +18,7 @@
 include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."pdf/languages/English.php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = PDF_PLUGIN_LAN_1;
+$eplug_name = "PDF_PLUGIN_LAN_1";
 $eplug_version = "1.0";
 $eplug_author = "Eric Vanderfeesten (lisa)";
 $eplug_logo = "";
@@ -28,7 +28,6 @@
 $eplug_compatible = "e107v0.7+";
 $eplug_readme = "";        // leave blank if no readme file
 
-$eplug_sc = array('PDF');
 
 // Name of the plugin's folder -------------------------------------------------------------------------------------
 $eplug_folder = "pdf";
@@ -47,9 +46,6 @@
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = "";
 
-// List of bbcode -----------------------------------------------------------------------------------------------
-//$eplug_bb = array('pcontent');
-
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = "";
 
diff -ruN 0.7.5/e107_plugins/pm/languages/English.php 0.7.7/e107_plugins/pm/languages/English.php
--- 0.7.5/e107_plugins/pm/languages/English.php	2005-12-09 18:43:27.000000000 -0600
+++ 0.7.7/e107_plugins/pm/languages/English.php	2006-10-30 08:01:47.000000000 -0600
@@ -63,6 +63,7 @@
 define('LAN_PM_60', "You are not permitted to view this message");
 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_100", "New PM from ");
 define("LAN_PM_101", "You have received a new Private Message from ");
@@ -75,5 +76,5 @@
 define("LAN_PM_108", "Message sent on: ");
 define("LAN_PM_109", "New Message(s)");
 define("LAN_PM_110", "ok");
-
+define("LAN_PM_111", "Read");
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/pm/languages/admin/English.php 0.7.7/e107_plugins/pm/languages/admin/English.php
--- 0.7.5/e107_plugins/pm/languages/admin/English.php	2005-10-01 21:33:37.000000000 -0500
+++ 0.7.7/e107_plugins/pm/languages/admin/English.php	2006-11-19 16:52:16.000000000 -0600
@@ -20,7 +20,7 @@
 define('ADLAN_PM_18', "Show user dropdown");
 define('ADLAN_PM_19', "READ message timeout");
 define('ADLAN_PM_20', "UNREAD message timeout");
-define('ADLAN_PM_21', "popup notification on new PM");
+define('ADLAN_PM_21', "Popup notification on new PM");
 define('ADLAN_PM_22', "Popup delay timeout");
 define('ADLAN_PM_23', "Restrict PM use to");
 define('ADLAN_PM_24', "Number of PMs to show per page");
@@ -29,7 +29,7 @@
 define('ADLAN_PM_27', "Allow posting of attachments");
 define('ADLAN_PM_28', "Maximum attachment size");
 define('ADLAN_PM_29', "Allow sending to all members");
-define('ADLAN_PM_30', "Allow sending to multiple receipients");
+define('ADLAN_PM_30', "Allow sending to multiple recipients");
 define('ADLAN_PM_31', "Enable sending to userclass");
 define('ADLAN_PM_32', "Update Settings");
 define('ADLAN_PM_33', "Inactive (no limits)");
@@ -46,7 +46,7 @@
 define('ADLAN_PM_44', "seconds");
 define('ADLAN_PM_45', "Limit PM By: ");
 define('ADLAN_PM_46', "PM Conversion");
-define('ADLAN_PM_47', "You do not appear to have any old messages from previous vesions, it is safe to uninstall the old plugin");
+define('ADLAN_PM_47', "You do not appear to have any old messages from previous versions, it is safe to uninstall the old plugin");
 define('ADLAN_PM_48', "You have {OLDCOUNT} messages from the older version, please decide what you would like to do with these messages<br /><br />If converting messages, any message successfully converted will be removed from old system.");
 define('ADLAN_PM_49', "Convert to new PM");
 define('ADLAN_PM_50', "Discard old messages");
@@ -57,4 +57,7 @@
 define('ADLAN_PM_54', "Main settings");
 define('ADLAN_PM_55', "Limits");
 define('ADLAN_PM_56', "Conversion");
-?>
\ No newline at end of file
+
+define('ADLAN_PM_57', "This plugin is a fully featured Private Messaging system.");
+define('ADLAN_PM_58', "Private Messenger");
+?>
diff -ruN 0.7.5/e107_plugins/pm/plugin.php 0.7.7/e107_plugins/pm/plugin.php
--- 0.7.5/e107_plugins/pm/plugin.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/pm/plugin.php	2006-11-04 12:33:58.000000000 -0600
@@ -11,51 +11,48 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/plugin.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2006/11/04 18:33:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-	
+
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."pm/languages/admin/English.php");
-	
+include_lan(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
+
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = ADLAN_PM;
+$eplug_name = "ADLAN_PM";
 $eplug_version = "3.0";
 $eplug_author = "McFly";
 $eplug_url = "";
 $eplug_email = "mcfly@e107.org";
-$eplug_description = "This plugin is a fully featured Private Messaging system.";
+$eplug_description = ADLAN_PM_57;
 $eplug_compatible = "e107v.7+";
 // leave blank if no readme file
-	
+
 // Name of the plugin's folder -------------------------------------------------------------------------------------
 $eplug_folder = "pm";
-	
+
 // Mane of menu item for plugin ----------------------------------------------------------------------------------
 $eplug_menu_name = "pm";
-	
+
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "pm_conf.php";
-	
-$eplug_sc = array('SENDPM');
 
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/pvt_message_32.png";
 $eplug_icon_small = $eplug_folder."/images/pvt_message_16.png";
 $eplug_caption = ADLAN_PM_2; //"Configure Private Messager";
-	
+
 // List of preferences -----------------------------------------------------------------------------------------------
 
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
 "private_msg",
-"private_msg_block" 
+"private_msg_block"
 );
-	
+
 // List of sql requests to create tables -----------------------------------------------------------------------------
 $eplug_tables = array(
 "CREATE TABLE ".MPREFIX."private_msg (
@@ -82,12 +79,12 @@
   PRIMARY KEY  (pm_block_id)
 ) TYPE=MyISAM AUTO_INCREMENT=1 ;"
 );
-	
+
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
 $eplug_link_name = "";
 $eplug_link_url = "";
-	
+
 // Text to display after plugin successfully installed ------------------------------------------------------------------
 $eplug_done = ADLAN_PM_1;
 
@@ -102,4 +99,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/pm/pm.php 0.7.7/e107_plugins/pm/pm.php
--- 0.7.5/e107_plugins/pm/pm.php	2006-03-24 11:55:46.000000000 -0600
+++ 0.7.7/e107_plugins/pm/pm.php	2006-10-30 08:01:47.000000000 -0600
@@ -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.20 $
-|     $Date: 2006/03/24 17:55:46 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.21 $
+|     $Date: 2006/10/30 14:01:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -201,10 +201,10 @@
 	$tpl_file = THEME."pm_template.php";
 	include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
 	$enc = (check_class($pm_prefs['attach_class']) ? "enctype='multipart/form-data'" : "");
-	$text = "<form {$enc} method='post' action='".e_SELF."' id='dataform' name='frmPMSend'>
-	<input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />".
+	$text = "<form {$enc} method='post' action='".e_SELF."' id='dataform'>
+	<div><input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />".
 	$tp->parseTemplate($PM_SEND_PM, TRUE, $pm_shortcodes).
-	"</form>";
+	"</div></form>";
 	return $text;
 }
 
diff -ruN 0.7.5/e107_plugins/pm/pm_class.php 0.7.7/e107_plugins/pm/pm_class.php
--- 0.7.5/e107_plugins/pm/pm_class.php	2006-04-24 09:23:59.000000000 -0500
+++ 0.7.7/e107_plugins/pm/pm_class.php	2006-11-09 03:28:58.000000000 -0600
@@ -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.15 $
-|     $Date: 2006/04/24 14:23:59 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.16 $
+|     $Date: 2006/11/09 09:28:58 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -382,7 +382,7 @@
 			return FALSE;
 		}
 		@set_time_limit(10 * 60);
-		@ini_set("max_execution_time", 10 * 60);
+		@e107_ini_set("max_execution_time", 10 * 60);
 		while (@ob_end_clean()); // kill all output buffering else it eats server resources
 		if (connection_status() == 0)
 		{
diff -ruN 0.7.5/e107_plugins/pm/pm_conf.php 0.7.7/e107_plugins/pm/pm_conf.php
--- 0.7.5/e107_plugins/pm/pm_conf.php	2006-01-09 11:09:01.000000000 -0600
+++ 0.7.7/e107_plugins/pm/pm_conf.php	2006-11-04 12:33:58.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.6 $
-|     $Date: 2006/01/09 17:09:01 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/11/04 18:33:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 $retrieve_prefs[] = 'pm_prefs';
@@ -196,7 +196,7 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_28."</td>
-		<td class='forumheader3' style='width:25%'>".form::form_text('option[attach_size]', 8, $pm_prefs['attach_size'], 8)." kb</td>
+		<td class='forumheader3' style='width:25%'>".form::form_text('option[attach_size]', 8, $pm_prefs['attach_size'], 8)." kB</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_29."</td>
@@ -361,4 +361,4 @@
 	show_menu($action);
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/pm/pm_shortcodes.php 0.7.7/e107_plugins/pm/pm_shortcodes.php
--- 0.7.5/e107_plugins/pm/pm_shortcodes.php	2006-03-05 00:04:02.000000000 -0600
+++ 0.7.7/e107_plugins/pm/pm_shortcodes.php	2006-11-16 10:55:10.000000000 -0600
@@ -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.14 $
-|     $Date: 2006/03/05 06:04:02 $
-|     $Author: e107coders $
+|     $Revision: 1.16 $
+|     $Date: 2006/11/16 16:55:10 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -166,7 +166,7 @@
 
 SC_BEGIN INBOX_FILLED
 $pm_inbox = pm_getInfo('inbox');
-return $pm_inbox['inbox']['filled'];
+return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : "");
 SC_END
 
 SC_BEGIN OUTBOX_TOTAL
@@ -181,7 +181,7 @@
 
 SC_BEGIN OUTBOX_FILLED
 $pm_outbox = pm_getInfo('outbox');
-return $pm_outbox['outbox']['filled'];
+return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : "");
 SC_END
 
 SC_BEGIN PM_DATE
@@ -318,7 +318,7 @@
 }
 else
 {
-	return "class: ".$pm_info['pm_to'];
+	return LAN_PM_63." ".$pm_info['pm_to'];
 }
 SC_END
 
diff -ruN 0.7.5/e107_plugins/pm/pm_template.php 0.7.7/e107_plugins/pm/pm_template.php
--- 0.7.5/e107_plugins/pm/pm_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/pm/pm_template.php	2006-10-30 08:01:47.000000000 -0600
@@ -11,17 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_template.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.13 $
+|     $Date: 2006/10/30 14:01:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 global $sc_style;
 
-define("PM_READ_ICON", "<img src='".e_PLUGIN."/pm/images/read.png' style='height:16;width:16;border:0' />");
-define("PM_UNREAD_ICON", "<img src='".e_PLUGIN."/pm/images/unread.png' style='height:16;width:16;border:0' />");
+define("PM_READ_ICON", "<img src='".e_PLUGIN."/pm/images/read.png' style='height:16px; width:16px; border:0px' alt='".LAN_PM_111."' />");
+define("PM_UNREAD_ICON", "<img src='".e_PLUGIN."/pm/images/unread.png' style='height:16px; width:16px; border:0px' alt='".LAN_PM_27."' />");
 
 $sc_style['PM_ATTACHMENT_ICON']['pre'] = " ";
 
@@ -172,7 +172,7 @@
 	<td class='fcaption' colspan='2'>{PM_SUBJECT}</td>
 </tr>
 <tr>
-	<td class='forumheader3' style='width:20%;vertical-align:top'>
+	<td class='forumheader3' style='width:20%; vertical-align:top'>
 		{PM_FROM_TO}
 		<br />
 		<br />
@@ -184,7 +184,7 @@
 		<br />
 		{PM_DELETE}
 	</td>
-	<td class='forumheader3' style='width:80%;vertical-align:top'>{PM_MESSAGE}<br /><br />{PM_ATTACHMENTS}</td>
+	<td class='forumheader3' style='width:80%; vertical-align:top'>{PM_MESSAGE}<br /><br />{PM_ATTACHMENTS}</td>
 </tr>
 {PM_REPLY}
 </table>
diff -ruN 0.7.5/e107_plugins/pm/pm_update_check.php 0.7.7/e107_plugins/pm/pm_update_check.php
--- 0.7.5/e107_plugins/pm/pm_update_check.php	2006-01-09 11:02:16.000000000 -0600
+++ 0.7.7/e107_plugins/pm/pm_update_check.php	2006-11-19 16:52:16.000000000 -0600
@@ -11,14 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_update_check.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/01/09 17:02:16 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/11/19 22:52:16 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-$dbupdatep['pm_07'] =  LAN_UPDATE_8." .617 private messenger ".LAN_UPDATE_9." .7 private messenger";
+include_lan(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
+$dbupdatep['pm_07'] =  LAN_UPDATE_8." .617 ".ADLAN_PM_58." ".LAN_UPDATE_9." .7 ".ADLAN_PM_58;
 function update_pm_07($type) {
 	global $sql, $mySQLdefaultdb;
 	if ($type == 'do') {
@@ -36,4 +37,4 @@
 	}
 }
 
-?>		
\ No newline at end of file
+?>		
diff -ruN 0.7.5/e107_plugins/pm/private_msg_menu.php 0.7.7/e107_plugins/pm/private_msg_menu.php
--- 0.7.5/e107_plugins/pm/private_msg_menu.php	2006-01-22 09:38:08.000000000 -0600
+++ 0.7.7/e107_plugins/pm/private_msg_menu.php	2006-11-15 14:48:46.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/private_msg_menu.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/01/22 15:38:08 $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/15 20:48:46 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -26,8 +26,8 @@
 require_once(e_PLUGIN."pm/pm_func.php");
 pm_getInfo('clear');
 
-define("PM_INBOX_ICON", "<img src='".e_PLUGIN."pm/images/mail_get.png' style='height:16;width:16;border:0' alt='".LAN_PM_25."' title='".LAN_PM_25."' />");
-define("PM_OUTBOX_ICON", "<img src='".e_PLUGIN."pm/images/mail_send.png' style='height:16;width:16;border:0' alt='".LAN_PM_26."' title='".LAN_PM_26."' />");
+define("PM_INBOX_ICON", "<img src='".e_PLUGIN."pm/images/mail_get.png' style='height:16px; width:16px; border:0px;' alt='".LAN_PM_25."' title='".LAN_PM_25."' />");
+define("PM_OUTBOX_ICON", "<img src='".e_PLUGIN."pm/images/mail_send.png' style='height:16px; width:16px; border:0px;' alt='".LAN_PM_26."' title='".LAN_PM_26."' />");
 define("PM_SEND_LINK", LAN_PM_35);
 define("NEWPM_ANIMATION", "<img src='".e_PLUGIN."pm/images/newpm.gif' alt='' style='border:0' />");
 
@@ -85,8 +85,8 @@
 			<title>".$pm_inbox['inbox']['new']." ".LAN_PM_109."</title>
 			<link rel=stylesheet href=" . THEME . "style.css>
 		</head>
-		<body style=\'padding-left:2px;padding-right:2px;padding:2px;padding-bottom:2px;margin:0px;text-align:center\' marginheight=0 marginleft=0 topmargin=0 leftmargin=0>
-		<table style=\'width:100%;text-align:center;height:99%;padding-bottom:2px\' class=\'bodytable\'>
+		<body style=\'padding-left:2px;padding-right:2px; padding:2px; padding-bottom:2px; margin:0px; text-align:center\' marginheight=\'0\' marginleft=\'0\' topmargin=\'0\' leftmargin=\'0\'>
+		<table style=\'width:100%; text-align:center; height:99%; padding-bottom:2px\' class=\'bodytable\'>
 			<tr>
 				<td width=100% >
 					<center><b>--- ".LAN_PM." ---</b><br />".$pm_inbox['inbox']['new']." ".LAN_PM_109."<br />".$pm_inbox['inbox']['unread']." ".LAN_PM_37."<br /><br />
@@ -106,7 +106,7 @@
 	winl=(screen.width-200)/2;
 	wint = (screen.height-100)/2;
 	winProp = 'width=200,height=100,left='+winl+',top='+wint+',scrollbars=no';
-	window.open('javascript:document.write(\"".$popuptext."\");', \"pm_popup\", winProp);
+	window.open('javascript:document.write(\"".$popuptext."\");', 'pm_popup', winProp);
 	</script >";
 	return $text;
 }
diff -ruN 0.7.5/e107_plugins/poll/admin_config.php 0.7.7/e107_plugins/poll/admin_config.php
--- 0.7.5/e107_plugins/poll/admin_config.php	2005-12-18 12:12:46.000000000 -0600
+++ 0.7.7/e107_plugins/poll/admin_config.php	2006-11-11 22:14:44.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/admin_config.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2005/12/18 18:12:46 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.14 $
+|     $Date: 2006/11/12 04:14:44 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -67,7 +67,7 @@
 	}
 	else
 	{
-		$message = "Field(s) left blank";
+		$message = POLLAN_46;
 	}
 }
 
@@ -138,7 +138,7 @@
 		extract($row);
 		$text .= "<tr>
 			<td style='width:5%' class='forumheader3'>$poll_id</td>
-			<td style='width:75%' class='forumheader3'>".$tp -> toHTML($poll_title, TRUE,"emotes_off defs")."</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)\"")."
 			</div></td>
 			</tr>";
diff -ruN 0.7.5/e107_plugins/poll/languages/English.php 0.7.7/e107_plugins/poll/languages/English.php
--- 0.7.5/e107_plugins/poll/languages/English.php	2005-10-05 04:51:26.000000000 -0500
+++ 0.7.7/e107_plugins/poll/languages/English.php	2006-11-12 16:09:09.000000000 -0600
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/languages/English.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/10/05 09:51:26 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2006/11/12 22:09:09 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 define("POLL_ADLAN01", "Poll");
 define("POLL_ADLAN02", "The poll plugin allows you to define polls in either a menu or forum post.");
 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 remeber to activate the menu item from your menus page.");
+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("POLLAN_MENU_CAPTION", "Poll");
 
@@ -42,7 +42,7 @@
 define("POLLAN_16", "Vote storage method");
 define("POLLAN_17", "cookie");
 define("POLLAN_18", "IP address");
-define("POLLAN_19", "UserID (only members can vote)");
+define("POLLAN_19", "User ID (only members can vote)");
 define("POLLAN_20", "Allow comments to be posted to this poll?");
 define("POLLAN_21", "Preview again");
 define("POLLAN_22", "Update Poll");
@@ -50,11 +50,11 @@
 define("POLLAN_24", "Preview");
 define("POLLAN_25", "Clear form");
 define("POLLAN_26", "votes");
-define("POLLAN_27", "comments");
+define("POLLAN_27", "Comments");
 define("POLLAN_28", "Previous polls");
 define("POLLAN_29", "posted by");
 define("POLLAN_30", "Submit");
-define("POLLAN_31", "votes");
+define("POLLAN_31", "Votes");
 define("POLLAN_32", "Click here to see results");
 define("POLLAN_33", "No previous polls yet.");
 define("POLLAN_34", "Title");
@@ -62,15 +62,13 @@
 define("POLLAN_36", "Active");
 define("POLLAN_37", "active from");
 define("POLLAN_38", "to");
-define("POLLAN_39", "Thankyou for voting!");
+define("POLLAN_39", "Thank you for voting!");
 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_44", "Delete this poll?");
-
 define("POLLAN_45", "Poll successfully updated");
+define("POLLAN_46", "Field(s) left blank");
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/poll/oldpolls.php 0.7.7/e107_plugins/poll/oldpolls.php
--- 0.7.5/e107_plugins/poll/oldpolls.php	2006-01-05 03:06:46.000000000 -0600
+++ 0.7.7/e107_plugins/poll/oldpolls.php	2006-11-04 12:33:58.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.8 $
-|     $Date: 2006/01/05 09:06:46 $
-|     $Author: sweetas $
+|     $Revision: 1.12 $
+|     $Date: 2006/11/04 18:33:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -21,6 +21,8 @@
 require_once(e_HANDLER."comment_class.php");
 $cobj = new comment;
 $gen = new convert;
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
+
 
 @include(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 @include(e_PLUGIN."poll/languages/English.php");
@@ -28,7 +30,7 @@
 
 if(e_QUERY)
 {
-	$query = "SELECT p.*, u.user_name FROM #polls AS p 
+	$query = "SELECT p.*, 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);
 
@@ -39,7 +41,7 @@
 		extract($row);
 
 		$optionArray = explode(chr(1), $poll_options);
-		$optionArray = array_slice($optionArray, 0, -1);      
+		$optionArray = array_slice($optionArray, 0, -1);
 		$voteArray = explode(chr(1), $poll_votes);
 		$voteArray = array_slice($voteArray, 0, -1);
 
@@ -53,13 +55,13 @@
 		$start_datestamp = $gen->convert_date($poll_datestamp, "long");
 		$end_datestamp = $gen->convert_date($poll_end_datestamp, "long");
 
-		$text = "<table style='width:100%'>
+		$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>
 		<br />
-		 
+
 		</td>
 		</tr>";
 
@@ -74,16 +76,19 @@
 			$text .= "<tr>
 			<td style='width:40%; text-align: right' class='mediumtext'><b>".$tp -> toHTML($option)."</b>&nbsp;&nbsp;</td>
 			<td class='smalltext'>
-			
-		 
-			<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".(floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 95)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div>".$percentage[$count]."% [Votes: ".$voteArray[$count]."]</div>
+
+
+			<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".(floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 95)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div>".$percentage[$count]."% [".POLLAN_31.": ".$voteArray[$count]."]</div>
 			</td>
 			</tr>\n";
 			$count++;
 
 		}
-	
-		if($comment_total = $sql -> db_Select("comments", "*", "comment_item_id=".intval($poll_id)." AND comment_type=4 ORDER BY comment_datestamp"))
+
+		$query = "SELECT c.*, u.* FROM #comments AS c
+		LEFT JOIN #user AS u ON FLOOR(SUBSTR(c.comment_author,1,INSTR(c.comment_author,'.')-1))=u.user_id
+		WHERE comment_item_id=".intval($poll_id)." AND comment_type=4 ORDER BY comment_datestamp";
+		if ($comment_total = $sql->db_Select_gen($query) !== FALSE)
 		{
 			$text .= "<tr><td colspan='2'><br /><br />";
 			while ($row = $sql->db_Fetch()) {
@@ -91,15 +96,15 @@
 			}
 			$text .= "</td></tr>";
 		}
-	 
+
 		$text .= "</table>";
 		$ns->tablerender(POLL_ADLAN01." #".$poll_id, $text);
 	}
 }
 
-$query = "SELECT p.*, u.user_name FROM #polls AS p 
+$query = "SELECT p.*, 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 
+WHERE p.poll_type=1
 ORDER BY p.poll_datestamp DESC";
 
 if(!$sql->db_Select_gen($query))
@@ -119,7 +124,7 @@
 	exit;
 }
 
-$text = "<table class='fborder' style='width: 95%;'>
+$text = "<table class='fborder' style='".USER_WIDTH."'>
 <tr>
 <td class='fcaption' style='width: 55%;'>".POLLAN_34."</td>
 <td class='fcaption' style='width: 15%;'>".POLLAN_35."</td>
@@ -135,12 +140,12 @@
 	$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 to $to</td>
+	<td class='forumheader3' style='width: 30%;'>$from ".POLLAN_38." $to</td>
 	</tr>\n";
 }
-	
+
 $text .= "</table>";
 $ns->tablerender(POLLAN_28, $text);
 require_once(FOOTERF);
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/poll/plugin.php 0.7.7/e107_plugins/poll/plugin.php
--- 0.7.5/e107_plugins/poll/plugin.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/poll/plugin.php	2006-11-04 12:33:58.000000000 -0600
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/plugin.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2006/11/04 18:33:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."poll/languages/English.php");
+include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = POLL_ADLAN01;
@@ -41,7 +40,6 @@
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "admin_config.php";
 
-$eplug_sc = array("");
 
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/polls_32.png";
@@ -86,4 +84,4 @@
 // Text to display after plugin successfully installed ------------------------------------------------------------------
 $eplug_done = POLL_ADLAN04;
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/poll/poll.php 0.7.7/e107_plugins/poll/poll.php
--- 0.7.5/e107_plugins/poll/poll.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/poll/poll.php	2006-08-10 11:39:11.000000000 -0500
@@ -0,0 +1,28 @@
+<?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/poll/poll.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/08/10 16:39:11 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+require_once("../../class2.php");
+require_once(HEADERF);
+
+require_once(e_PLUGIN."poll/poll_menu.php");
+
+
+require_once(FOOTERF);
+exit;
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/poll/poll_class.php 0.7.7/e107_plugins/poll/poll_class.php
--- 0.7.5/e107_plugins/poll/poll_class.php	2006-05-17 10:37:36.000000000 -0500
+++ 0.7.7/e107_plugins/poll/poll_class.php	2006-11-11 08:35:59.000000000 -0600
@@ -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.43 $
-|     $Date: 2006/05/17 15:37:36 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.48 $
+|     $Date: 2006/11/11 14:35:59 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -21,12 +21,16 @@
 @include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 @include_once(e_PLUGIN."poll/languages/English.php");
 define("POLLCLASS", TRUE);
+define("POLL_MODE_COOKIE", 0);
+define("POLL_MODE_IP", 1);
+define("POLL_MODE_USERID", 2);
+
 class poll
 {
 
 	var $pollRow;
 	var $pollmode;
-	
+
 	function delete_poll($existing)
 	{
 		global $sql;
@@ -80,7 +84,7 @@
 				}
 				$sql -> db_Update("polls", "poll_votes='".$foo['poll_votes']."' WHERE poll_id='".intval(POLLID)."' ");
 			}
-	
+
 			$message = POLLAN_45;
 		} else {
 
@@ -105,7 +109,7 @@
 			}
 			else
 			{
-				$sql -> db_Insert("polls", "'0', ".intval($_POST['iid']).", '0', '0', ".USERID.", '$poll_title', '$poll_options', '$votes', '', '2', '0', '".intval($multipleChoice)."', '0', '0', '0'");
+				$sql -> db_Insert("polls", "'0', ".intval($_POST['iid']).", '0', '0', ".USERID.", '$poll_title', '$poll_options', '$votes', '', '2', '0', '".intval($multipleChoice)."', '0', '0', '".intval($storageMethod)."'");
 			}
 		}
 		return $message;
@@ -118,17 +122,17 @@
 		if ($sql->db_Select_gen($query))
 		{
 			$pollArray = $sql -> db_Fetch();
-		
+
 			if (!check_class($pollArray['poll_vote_userclass']))
 			{
 				$POLLMODE = "disallowed";
 			}
 			else
 			{
-		
+
 				switch($pollArray['poll_storage_method'])
 				{
-					case 0:
+					case POLL_MODE_COOKIE:
 						$userid = "";
 						$cookiename = "poll_".$pollArray['poll_id'];
 						if(isset($_COOKIE[$cookiename]))
@@ -140,8 +144,8 @@
 							$POLLMODE = "notvoted";
 						}
 					break;
-		
-					case 1:
+
+					case POLL_MODE_IP:
 						$userid = $e107->getip();
 						$voted_ids = explode("^", substr($pollArray['poll_ip'], 0, -1));
 						if (in_array($userid, $voted_ids))
@@ -153,8 +157,8 @@
 							$POLLMODE = "notvoted";
 						}
 					break;
-		
-					case 2:
+
+					case POLL_MODE_USERID:
 						if(!USER)
 						{
 							$POLLMODE = "disallowed";
@@ -174,9 +178,9 @@
 						}
 					break;
 				}
-			}		
+			}
 		}
-		if(isset($_POST['pollvote']) && $POLLMODE == "notvoted")
+		if(isset($_POST['pollvote']) && $POLLMODE == "notvoted" && ($POLLMODE != "disallowed"))
 		{
 				if ($_POST['votea'])
 				{
@@ -208,7 +212,7 @@
 					}
 					$votep = implode(chr(1), $votes);
 					$pollArray['poll_votes'] = $votep;
-	
+
 					$sql->db_Update("polls", "poll_votes = '$votep', poll_ip='".$poll_ip.$userid."^' WHERE poll_id=".$poll_id);
 					echo "
 				<script type='text/javascript'>
@@ -216,15 +220,15 @@
 				setcook({$poll_id});
 				//-->
 				</script>
-				";					
+				";
 					$POLLMODE = "voted";
-	
+
 			}
 		}
 		$this->pollRow = $pollArray;
 		$this->pollmode = $POLLMODE;
 	}
-			
+
 
 	function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMethod=FALSE)
 	{
@@ -254,9 +258,9 @@
 		{
 			@include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 			@include_once(e_PLUGIN."poll/languages/English.php");
-			$pollArray['poll_allow_multiple'] = $pollArray['multipleChoice'];
 			if(isset($_POST['fpreview']))
 			{
+				$pollArray['poll_allow_multiple'] = $pollArray['multipleChoice'];
 				$optionArray = $pollArray['poll_option'];
 			}
 			else
@@ -296,6 +300,7 @@
 		   	require(e_PLUGIN."poll/templates/poll_template.php");
 		}
 
+		$preview = FALSE;
 		if ($type == "preview")
 		{
 			$POLLMODE = "notvoted";
@@ -307,10 +312,10 @@
 		$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");
-		$VOTE_TOTAL = POLLAN_26.": ".$voteTotal;
+		$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>" : "");
-		$AUTHOR = POLLAN_29." ".($type == "preview" || $type == "forum" ? USERNAME : "<a href='".e_BASE."user.php?id.".$pollArray['poll_admin_id']."'>".$pollArray['user_name']."</a>");
+		$AUTHOR = POLLAN_35." ".($type == "preview" || $type == "forum" ? USERNAME : "<a href='".e_BASE."user.php?id.".$pollArray['poll_admin_id']."'>".$pollArray['user_name']."</a>");
 
 		switch ($POLLMODE)
 		{
@@ -322,7 +327,7 @@
 				//	$MODE = ($mode) ? $mode : "";		/* debug */
 					$OPTIONBUTTON = ($pollArray['poll_allow_multiple'] ? "<input type='checkbox' name='votea[]' value='$count' />" : "<input type='radio' name='votea' value='$count' />");
 					$OPTION = $tp->toHTML($option, TRUE);
-					if($POLL_NOTVOTED_LOOP_ALT && $type != "forum"){ // alternating style
+					if(isset($POLL_NOTVOTED_LOOP_ALT) && $POLL_NOTVOTED_LOOP_ALT && $type != "forum"){ // alternating style
 						$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($alt == 0 ? $POLL_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP_ALT));
 						$alt = ($alt ==0) ? 1 : 0;
 					}else{
@@ -443,8 +448,10 @@
 			<td style='width:80%' class='forumheader3'>
 			<div id='pollsection'>";
 
-			for($count = 1; $count <= $option_count; $count++) {
-				if($count != 1 && $_POST['poll_option'][($count-1)] ==""){
+			for($count = 1; $count <= $option_count; $count++)
+			{
+				if($count != 1 && $_POST['poll_option'][($count-1)] =="")
+				{
 					break;
 				}
 				$opt = ($count==1) ? "id='pollopt'" : "";
@@ -462,7 +469,16 @@
 			<input type='radio' name='multipleChoice' value='1'".($_POST['multipleChoice'] ? " checked='checked'" : "")." /> ".POLL_507."&nbsp;&nbsp;
 			<input type='radio' name='multipleChoice' value='0'".(!$_POST['multipleChoice'] ? " checked='checked'" : "")." /> ".POLL_508."
 			</td>
-			</tr>";
+			</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='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19."
+			</tr>
+			";
 
 
 			return $text;
@@ -485,8 +501,10 @@
 		<td style='width:70%' class='forumheader3'>
 		<div id='pollsection'>";
 
-		for($count = 1; $count <= $option_count; $count++) {
-			if($count != 1 && $_POST['poll_option'][($count-1)] ==""){
+		for($count = 1; $count <= $option_count; $count++)
+		{
+			if($count != 1 && $_POST['poll_option'][($count-1)] =="")
+			{
 				break;
 			}
 			$opt = ($count==1) ? "id='pollopt'" : "";
diff -ruN 0.7.5/e107_plugins/powered_by_menu/languages/English.php 0.7.7/e107_plugins/powered_by_menu/languages/English.php
--- 0.7.5/e107_plugins/powered_by_menu/languages/English.php	2005-01-27 13:53:15.000000000 -0600
+++ 0.7.7/e107_plugins/powered_by_menu/languages/English.php	2006-08-26 21:24:45.000000000 -0500
@@ -4,12 +4,12 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/powered_by_menu/languages/English.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/01/27 19:53:15 $
-|     $Author: streaky $
+|     $Revision: 1.3 $
+|     $Date: 2006/08/27 02:24:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 	
-define("POWEREDBY_L1", "Powered By");
+define("POWEREDBY_L1", "Powered by");
 	
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/rss_menu/admin_prefs.php 0.7.7/e107_plugins/rss_menu/admin_prefs.php
--- 0.7.5/e107_plugins/rss_menu/admin_prefs.php	2006-01-08 18:04:36.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/admin_prefs.php	2006-10-18 21:49:58.000000000 -0500
@@ -11,12 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/admin_prefs.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/01/09 00:04:36 $
+|     $Revision: 1.12 $
+|     $Date: 2006/10/19 02:49:58 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
+/*
+Notes:
 
+- array_flip method deprecated for delete item detection.
+- using form handler is deprecated and present only for backwards compatibility.
+- using generic terms like EDIT and DELETE in Language file is deprecated, use LAN_EDIT etc. instead.
+- using terms like created, update, options etc..deprecated should use built in terms.
+- generic admin icons used. ADMIN_ICON_EDIT etc.
+- using $caption = "whatever", is unneccessary.
+
+*/
 
 require_once("../../class2.php");
 if(!getperms("P")){ header("location:".e_BASE."index.php"); }
@@ -25,69 +35,378 @@
 
 require_once(e_ADMIN."auth.php");
 
-if(IsSet($_POST['updatesettings'])){
-	$pref['rss_feeds'] = implode(",",$_POST['feeds']);
-	$pref['rss_newscats'] = $_POST['rss_newscats'];
-	$pref['rss_dlcats'] = $_POST['rss_dlcats'];
-	save_prefs();
-	$message = LAN_SAVED;
+$imagedir = e_IMAGE."admin_images/";
+$lan_file = e_PLUGIN.'rss_menu/languages/'.e_LANGUAGE.'.php';
+include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'rss_menu/languages/English.php');
+require_once(e_PLUGIN.'rss_menu/rss_shortcodes.php');
+$rss = new rss;
+
+global $tp;
+
+//delete entry
+if(isset($_POST['delete'])){
+	$d_idt = array_keys($_POST['delete']);
+	$message = ($sql -> db_Delete("rss", "rss_id='".$d_idt[0]."'")) ? LAN_DELETED : LAN_DELETED_FAILED;
+    $e107cache->clear("rss");
+}
+
+//create rss feed
+if(isset($_POST['create_rss'])){
+	$message = $rss -> dbrss("create");
+}
+
+//update rss feed
+if(isset($_POST['update_rss'])){
+	$message = $rss -> dbrss("update");
+}
+
+//import rss feed
+if(isset($_POST['import_rss'])){
+	$message = $rss -> dbrssimport();
+}
+
+//update_limit
+if(isset($_POST['update_limit'])){
+	$message = $rss -> dbrsslimit();
+}
+//update options
+if(isset($_POST['updatesettings'])){
+	$message = $rss->dboptions();
+}
+
+//config check
+if($rss->file_check()){
+	$message = RSS_LAN_ERROR_2; // space found in file.
 }
 
+
+//render message
 if(isset($message)){
-	$ns -> tablerender("", "<div style='text-align:center'><b>$message</b></div>");
+	$rss->show_message('', $message);
 }
 
-$text = "<div style='text-align:center'>
-<form method='post' action='".e_SELF."'>
-<table class='fborder' style='width:94%' class='fborder'>
-<tr><td class='fcaption'>".BACKEND_MENU_L2."</td><td class='fcaption'>Enable</td></tr>";
-
-	$feedlist[1] = "News";
-	$feedlist[12] = "Downloads";
-	$feedlist[6] = "Forum Threads";
-	$feedlist[7] = "Forum Posts";
-    if($sql -> db_Select("plugin","plugin_rss","plugin_rss != '' ")){
-		while($row = $sql -> db_Fetch()){
-			$tmp = explode(",",$row['plugin_rss']);
-			foreach($tmp as $key){
-				$feedlist[$key] = ucfirst($key);
-			}
-		}
-    }
-	$preset = explode(",",$pref['rss_feeds']);
-
-	foreach($feedlist as $key=>$name){
-		$text .= "<tr><td class='forumheader3'><a rel='external' title='view $name feed' href='".e_PLUGIN."rss_menu/rss.php?$key.2'>$name</a></td>";
-		$text .= "<td class='forumheader3'>";
-		$selected = in_array($key,$preset) ? "checked='checked'" : "";
-		$text .= "<input type='checkbox'  name='feeds[]' value='$key' $selected />";
-
-	$text .="</td></tr>";
-	}
-
-	$text .= "<tr><td class='forumheader3'>".RSS_LAN01."</td>";
-	$text .= "<td class='forumheader3'>";
-	$sel = ($pref['rss_newscats'] == 1) ? " checked='checked' " : "";
-	$text .= "<input type='checkbox' $sel  name='rss_newscats' value='1' />
-				</td></tr>";
-
-	$text .= "<tr><td class='forumheader3'>".RSS_LAN02."</td>";
-	$text .= "<td class='forumheader3'>";
-	$sel = ($pref['rss_dlcats'] == 1) ? " checked='checked' " : "";
-	$text .= "<input type='checkbox' $sel name='rss_dlcats' value='1' />
-				</td></tr>";
-
-	$text .="<tr style='vertical-align:top'>
-	<td colspan='2'  style='text-align:center' class='forumheader'>
-	<input class='button' type='submit' name='updatesettings' value='".LAN_SAVE."' />
-	</td>
-	</tr>
-	</table>
-	</form>
-	</div>";
+//get template
+if (is_readable(THEME."rss_template.php")) {
+	require_once(THEME."rss_template.php");
+	} else {
+	require_once(e_PLUGIN."rss_menu/rss_template.php");
+}
+
+//listing
+if(e_QUERY){
+	$qs = explode(".", e_QUERY);
+	$field = (isset($qs[1])) ? $qs[1] : "";
+	$sort = (isset($qs[2])) ? $qs[2] : "";
+}
 
-$ns -> tablerender(BACKEND_MENU_L2, $text);
+	//create
+	if(isset($qs[0]) && $qs[0] == 'create' && !$_POST){
+		$rss -> rssadmincreate();
+
+	//import
+	}elseif(isset($qs[0]) && $qs[0] == 'import'){
+		$rss -> rssadminimport();
+
+	//options
+	}elseif(isset($qs[0]) && $qs[0] == 'options'){
+		$rss -> rssadminoptions();
+
+	//list
+	}else{
+
+		$rss -> rssadminlist();
+	}
 
 require_once(e_ADMIN."footer.php");
 
-?>
\ No newline at end of file
+// ##### Display options --------------------------------------------------------------------------
+function admin_prefs_adminmenu(){
+	global $sql, $qs;
+
+	$act = $qs[0];
+	if($act==""){$act="list";}
+
+	$var['list']['text']		= RSS_LAN_ADMINMENU_2;
+	$var['list']['link']		= e_SELF."?list";
+
+	$var['create']['text']		= LAN_CREATE;
+	$var['create']['link']		= e_SELF."?create";
+
+	$var['import']['text']		= RSS_LAN_ADMINMENU_4;
+	$var['import']['link']		= e_SELF."?import";
+
+	$var['options']['text']		= LAN_OPTIONS;
+	$var['options']['link']		= e_SELF."?options";
+
+	show_admin_menu(RSS_LAN_ADMINMENU_1, $act, $var);
+
+}
+// ##### End --------------------------------------------------------------------------------------
+
+
+
+
+
+
+class rss{
+
+	//check for config
+	function file_check(){
+		$arrays = file_get_contents(e_BASE."e107_config.php");
+		$arrays2 = file_get_contents(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
+		if($arrays[0] != "<" || $arrays2[0] != "<"){
+			return TRUE;
+		}
+	}
+
+
+	//admin : list : existing rss feeds
+	function rssadminlist(){
+		global $qs, $ns, $sql, $rs, $tp, $field, $sort, $rss_shortcodes, $row, $RSS_ADMIN_LIST_HEADER, $RSS_ADMIN_LIST_TABLE, $RSS_ADMIN_LIST_FOOTER;
+
+        $fieldstag = array('id'=>'rss_id','path'=>'rss_path','name'=>'rss_name','url'=>'rss_url','limit'=>'rss_limit');
+		$order = (isset($fieldstag[$field])) ? "ORDER BY ".$fieldstag[$field]." ".$sort : "ORDER BY rss_id";
+
+        $query = "SELECT * FROM #rss ".$order;
+		if(!$sql->db_Select_gen($query))
+		{
+			$this->show_message(LAN_ERROR, RSS_LAN_ERROR_3);
+		}
+		else
+		{
+			$text = $tp -> parseTemplate($RSS_ADMIN_LIST_HEADER, FALSE, $rss_shortcodes);
+			while($row=$sql->db_Fetch())
+			{
+				$text .= $tp -> parseTemplate($RSS_ADMIN_LIST_TABLE, FALSE, $rss_shortcodes);
+			}
+			$text .= $tp -> parseTemplate($RSS_ADMIN_LIST_FOOTER, FALSE, $rss_shortcodes);
+			$ns->tablerender(RSS_LAN_ADMIN_1, $text);
+		}
+	}
+
+	//create
+	function rssadmincreate(){
+		global $ns, $qs, $rs, $sql, $tp, $rss_shortcodes, $row, $RSS_ADMIN_CREATE_TABLE;
+
+		if( isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ){
+			if(!$sql -> db_Select("rss", "*", "rss_id='".intval($qs[2])."' ")){
+				$this->show_message(LAN_ERROR, RSS_LAN_ERROR_5);
+			}else{
+				$row = $sql -> db_Fetch();
+
+				$row['rss_name']	= $tp -> toForm($row['rss_name']);
+				$row['rss_path']	= $tp -> toForm($row['rss_path']);
+				$row['rss_url']		= $tp -> toForm($row['rss_url']);
+				$row['rss_text']	= $tp -> toForm($row['rss_text']);
+			}
+		}
+		$text = $tp -> parseTemplate($RSS_ADMIN_CREATE_TABLE, FALSE, $rss_shortcodes);
+		$ns->tablerender(RSS_LAN_ADMIN_10, $text);
+	}
+
+	//import
+	function rssadminimport(){
+		global $sql, $ns, $i, $qs, $rs, $tp, $rss_shortcodes, $feed, $pref;
+		global $RSS_ADMIN_IMPORT_HEADER, $RSS_ADMIN_IMPORT_TABLE, $RSS_ADMIN_IMPORT_FOOTER;
+
+		$sqli = new db;
+		$feedlist = array();
+
+		//news
+		$feed['name']		= ADLAN_0;
+		$feed['url']		= 'news';	//the identifier for the rss feed url
+		$feed['topic_id']	= '';		//the topic_id, empty on default (to select a certain category)
+		$feed['path']		= 'news';	//this is the plugin path location
+		$feed['text']		= RSS_PLUGIN_LAN_7;
+		$feed['class']		= '0';
+		$feed['limit']		= '9';
+		$feedlist[]			= $feed;
+
+		//news categories
+		if($sqli -> db_Select("news_category", "*","category_id!='' ORDER BY category_name ")){
+			while($rowi = $sqli -> db_Fetch()){
+				$feed['name']		= ADLAN_0.' > '.$rowi['category_name'];
+				$feed['url']		= 'news';
+				$feed['topic_id']	= $rowi['category_id'];
+				$feed['path']		= 'news';
+				$feed['text']		= RSS_PLUGIN_LAN_10.' '.$rowi['category_name'];
+				$feed['class']		= '0';
+				$feed['limit']		= '9';
+				$feedlist[]			= $feed;
+			}
+		}
+
+		//download
+		$feed['name']		= ADLAN_24;
+		$feed['url']		= 'download';
+		$feed['topic_id']	= '';
+		$feed['path']		= 'download';
+		$feed['text']		= RSS_PLUGIN_LAN_8;
+		$feed['class']		= '0';
+		$feed['limit']		= '9';
+		$feedlist[]			= $feed;
+
+		//download categories
+		if($sqli -> db_Select("download_category", "*","download_category_id!='' ORDER BY download_category_order ")){
+			while($rowi = $sqli -> db_Fetch()){
+				$feed['name']		= ADLAN_24.' > '.$rowi['download_category_name'];
+				$feed['url']		= 'download';
+				$feed['topic_id']	= $rowi['download_category_id'];
+				$feed['path']		= 'download';
+				$feed['text']		= RSS_PLUGIN_LAN_11.' '.$rowi['download_category_name'];
+				$feed['class']		= '0';
+				$feed['limit']		= '9';
+				$feedlist[]			= $feed;
+			}
+		}
+
+		//comments
+		$feed['name']		= RSS_PLUGIN_LAN_14;
+		$feed['url']		= 'comments';
+		$feed['topic_id']	= '';
+		$feed['path']		= 'comments';
+		$feed['text']		= RSS_PLUGIN_LAN_9;
+		$feed['class']		= '0';
+		$feed['limit']		= '9';
+		$feedlist[]			= $feed;
+
+		//plugin rss feed, using e_rss.php in plugin folder
+		$plugin_feedlist = array();
+		foreach($pref['e_rss_list'] as $val)
+		{
+			if (is_readable(e_PLUGIN.$val."/e_rss.php")) {
+				require_once(e_PLUGIN.$val."/e_rss.php");
+				$plugin_feedlist = $eplug_rss_feed;
+			}
+		}
+
+/*        if($sqli -> db_Select("plugin","plugin_path","plugin_installflag = '1' ORDER BY plugin_path ")){
+            while($rowi = $sqli -> db_Fetch()){
+                if (is_readable(e_PLUGIN.$rowi['plugin_path']."/e_rss.php")) {
+                    require_once(e_PLUGIN.$rowi['plugin_path']."/e_rss.php");
+                    $plugin_feedlist = $eplug_rss_feed;
+                }
+            }
+        }*/
+
+		$feedlist = array_merge($feedlist, $plugin_feedlist);
+
+		$render=FALSE;
+		$i=0;
+		$text = $RSS_ADMIN_IMPORT_HEADER;
+		foreach($feedlist as $k=>$feed){
+			$feed['topic_id']		= $tp -> toDB($feed['topic_id']);
+			$feed['url']			= $tp -> toDB($feed['url']);
+
+			//check if feed is not yet present
+			if(!$sql -> db_Select("rss", "*", "rss_path='".$feed['path']."' AND rss_url='".$feed['url']."' AND rss_topicid='".$feed['topic_id']."' "))
+			{
+				$render=TRUE;
+				$text .= $tp -> parseTemplate($RSS_ADMIN_IMPORT_TABLE, FALSE, $rss_shortcodes);
+				$i++;
+			}
+		}
+		$text .= $tp -> parseTemplate($RSS_ADMIN_IMPORT_FOOTER, FALSE, $rss_shortcodes);
+
+		if(!$render){
+			$this->show_message(RSS_LAN_ADMIN_11, RSS_LAN_ERROR_6);
+		}else{
+			$ns->tablerender(RSS_LAN_ADMIN_11, $text);
+		}
+	}
+
+	//options
+	function rssadminoptions(){
+		global $ns, $qs, $rs, $sql, $tp, $rss_shortcodes, $row, $RSS_ADMIN_OPTIONS_TABLE;
+
+		$text = $tp -> parseTemplate($RSS_ADMIN_OPTIONS_TABLE, FALSE, $rss_shortcodes);
+		$ns->tablerender(LAN_OPTIONS, $text);
+		return;
+	}
+
+	//render message
+	function show_message($caption='', $text=''){
+		global $ns;
+		$ns -> tablerender($caption, "<div style='text-align:center'><b>$text</b></div>");
+	}
+
+	//db:create/update
+	function dbrss($mode='create'){
+		global $qs, $sql, $ns, $rs, $tp, $e107cache;
+
+		if($_POST['rss_name'] && $_POST['rss_url'] && $_POST['rss_path']){
+
+			$_POST['rss_name']		= $tp -> toDB(trim($_POST['rss_name']));
+			$_POST['rss_url']		= $tp -> toDB($_POST['rss_url']);
+			$_POST['rss_topicid']	= $tp -> toDB($_POST['rss_topicid']);
+			$_POST['rss_path']		= $tp -> toDB($_POST['rss_path']);
+			$_POST['rss_text']		= $tp -> toDB($_POST['rss_text']);
+			$_POST['rss_class']		= (intval($_POST['rss_class']) ? intval($_POST['rss_class']) : '0');
+			$_POST['rss_limit']		= intval($_POST['rss_limit']);
+
+			if(isset($_POST['rss_datestamp']) && $_POST['rss_datestamp']!=''){
+				$datestamp = intval($_POST['rss_datestamp']);
+			}else{
+				$datestamp = time();
+			}
+
+			if($mode == 'create'){
+				$message = ($sql -> db_Insert("rss", "'0', '".$_POST['rss_name']."', '".$_POST['rss_url']."', '".$_POST['rss_topicid']."', '".$_POST['rss_path']."', '".$_POST['rss_text']."', '".$datestamp."', '".$_POST['rss_class']."', '".$_POST['rss_limit']."' ")) ? LAN_CREATED : LAN_CREATED_FAILED;
+				$e107cache->clear("rss");
+
+			}elseif($mode == 'update'){
+				$message = ($sql -> db_Update("rss", "rss_name = '".$_POST['rss_name']."', rss_url = '".$_POST['rss_url']."', rss_topicid = '".$_POST['rss_topicid']."', rss_path = '".$_POST['rss_path']."', rss_text = '".$_POST['rss_text']."', rss_datestamp = '".$datestamp."', rss_class = '".$_POST['rss_class']."', rss_limit = '".$_POST['rss_limit']."' WHERE rss_id = '".intval($_POST['rss_id'])."' ")) ? LAN_UPDATED : LAN_UPDATED_FAILED;
+				$e107cache->clear("rss");
+			}
+		}else{
+			$message = RSS_LAN_ERROR_7;
+		}
+		return $message;
+	}
+
+	//import rss feeds
+	function dbrssimport(){
+		global $sql, $tp;
+
+		foreach($_POST['importid'] as $key=>$value)
+		{
+			$rss_topcid		= ($_POST['topic_id'][$key] ? $tp -> toDB($_POST['topic_id'][$key]) : '');
+			$rss_url		= ($_POST['url'][$key] ? $tp -> toDB($_POST['url'][$key]) : '');
+			$rss_path		= ($_POST['path'][$key] ? $tp -> toDB($_POST['path'][$key]) : '');
+			$rss_name		= ($_POST['name'][$key] ? $tp -> toDB($_POST['name'][$key]) : '');
+			$rss_text		= ($_POST['text'][$key] ? $tp -> toDB($_POST['text'][$key]) : '');
+			$rss_datestamp	= time();
+			$rss_class		= ($_POST['class'][$key] ? intval($_POST['class'][$key]) : '0');
+			$rss_limit		= ($_POST['limit'][$key] ? intval($_POST['limit'][$key]) : '0');
+
+			$sql -> db_Insert("rss", "'0', '".$rss_name."', '".$rss_url."', '".$rss_topcid."', '".$rss_path."', '".$rss_text."', '".$rss_datestamp."', '".$rss_class."', '".$rss_limit."' ");
+		}
+		$message = count($_POST['importid'])." ".RSS_LAN_ADMIN_18;
+		return $message;
+
+	}
+
+	function dbrsslimit(){
+		global $sql, $tp;
+		foreach($_POST['limit'] as $key=>$value)
+		{
+			$sql -> db_Update("rss", "rss_limit = '".intval($value)."' WHERE rss_id = '".intval($key)."' ");
+		}
+		header("location:".e_SELF."?r3");
+	}
+
+	//update options
+	function dboptions(){
+		global $tp, $pref;
+
+		$pref['rss_othernews'] = $_POST['rss_othernews'];
+
+		save_prefs();
+		return LAN_SAVED;
+	}
+
+
+} //end class
+
+
+?>
diff -ruN 0.7.5/e107_plugins/rss_menu/e_meta.php 0.7.7/e107_plugins/rss_menu/e_meta.php
--- 0.7.5/e107_plugins/rss_menu/e_meta.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/e_meta.php	2006-11-07 23:43:14.000000000 -0600
@@ -0,0 +1,36 @@
+<?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/rss_menu/e_meta.php,v $
+|     $Revision: 1.4 $
+|     $Date: 2006/11/08 05:43:14 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+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")){
+   		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";
+		  		$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";
+			}
+		}
+	}
+}
+?>
Binary files 0.7.5/e107_plugins/rss_menu/images/rss1.png and 0.7.7/e107_plugins/rss_menu/images/rss1.png differ
Binary files 0.7.5/e107_plugins/rss_menu/images/rss2.png and 0.7.7/e107_plugins/rss_menu/images/rss2.png differ
Binary files 0.7.5/e107_plugins/rss_menu/images/rss3.png and 0.7.7/e107_plugins/rss_menu/images/rss3.png differ
Binary files 0.7.5/e107_plugins/rss_menu/images/rss4.png and 0.7.7/e107_plugins/rss_menu/images/rss4.png differ
diff -ruN 0.7.5/e107_plugins/rss_menu/languages/English.php 0.7.7/e107_plugins/rss_menu/languages/English.php
--- 0.7.5/e107_plugins/rss_menu/languages/English.php	2005-10-13 13:55:26.000000000 -0500
+++ 0.7.7/e107_plugins/rss_menu/languages/English.php	2006-11-09 13:04:19.000000000 -0600
@@ -4,35 +4,89 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/languages/English.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/10/13 18:55:26 $
+|     $Revision: 1.15 $
+|     $Date: 2006/11/09 19:04:19 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
-define("BACKEND_MENU_L1", " can be syndicated by using these rss feeds.");
-define("BACKEND_MENU_L2", "RSS Feeds");
+define("RSS_LAN05","Number of items (0=inactive)");
 
-define("BACKEND_MENU_L3", "Our news");
-define("BACKEND_MENU_L4", "Our comments");
-define("BACKEND_MENU_L5", "Our forum threads");
-define("BACKEND_MENU_L6", "Our forum posts");
-
-define("BACKEND_MENU_L7", "Our chatbox posts");
-define("BACKEND_MENU_L8", "Our bugtracker reports");
-define("BACKEND_MENU_L9", "Our downloads");
-
-define("RSS_LAN01", "Enable seperate feeds for each news category?");
-define("RSS_LAN02", "Enable seperate feeds for each download category?");
-
-define("RSS_NEWS","News");
-define("RSS_COM","Comments"); 
-define("RSS_ART","Articles");
+define("RSS_MENU_L1", " can be syndicated by using these rss feeds.");
+define("RSS_MENU_L2", "RSS Feeds");
+define("RSS_MENU_L3", "Our news");
+define("RSS_MENU_L4", "Our comments");
+define("RSS_MENU_L5", "Our forum threads");
+define("RSS_MENU_L6", "Our forum posts");
+define("RSS_MENU_L7", "Our chatbox posts");
+define("RSS_MENU_L8", "Our bugtracker reports");
+define("RSS_MENU_L9", "Our downloads");
+
+define("RSS_NEWS", "News");
+define("RSS_COM", "Comments");
+define("RSS_ART", "Articles");
 define("RSS_REV", "Reviews");
-define("RSS_FT","Forum Threads");
-define("RSS_FP","Forum Posts");
-define("RSS_FSP","Forum Specific Post");
-define("RSS_BUG","Bugtracker");
-define("RSS_FOR","Forum");
-define("RSS_DL","Downloads");
-?>
\ No newline at end of file
+define("RSS_FT", "Forum Threads");
+define("RSS_FP", "Forum Posts");
+define("RSS_FSP", "Forum Specific Post");
+define("RSS_BUG", "Bugtracker");
+define("RSS_FOR", "Forum");
+define("RSS_DL", "Downloads");
+
+define("RSS_PLUGIN_LAN_1", "RSS");
+
+define("RSS_PLUGIN_LAN_6", "Feed Links");
+define("RSS_PLUGIN_LAN_7", "The rss feed of the news");
+define("RSS_PLUGIN_LAN_8", "The rss feed of the downloads");
+define("RSS_PLUGIN_LAN_9", "The rss feed of the comments");
+define("RSS_PLUGIN_LAN_10", "The rss feed of news category:");
+define("RSS_PLUGIN_LAN_11", "The rss feed of download category:");
+
+define("RSS_PLUGIN_LAN_14", "Comments");
+
+define("RSS_LAN_ADMINMENU_1", "RSS Options");
+define("RSS_LAN_ADMINMENU_2", "Listing");
+define("RSS_LAN_ADMINMENU_4", "Import");
+
+define("RSS_LAN_ERROR_1", "This is not a valid rss feed<br /><br /><a href='".e_SELF."'><< return to rss feed list</a>");
+define("RSS_LAN_ERROR_2", "Your e107_config.php file or your language files contain spaces or ï»¿﻿ characters before the &lt;? characters. You should remove this with a non-utf8 text-editor if you wish to have a valid RSS feed.");
+define("RSS_LAN_ERROR_3", "No rss feeds are present yet<br />please use the import feature to import available rss feeds or create a rss feed manually.");
+define("RSS_LAN_ERROR_4", "No rss feeds are available yet");
+define("RSS_LAN_ERROR_5", "This rss entry does not exist");
+define("RSS_LAN_ERROR_6", "There are no rss feeds to import");
+define("RSS_LAN_ERROR_7", "Some required fields are missing.");
+
+define("RSS_LAN_ADMIN_1", "Existing RSS feeds");
+define("RSS_LAN_ADMIN_2", "Id");
+define("RSS_LAN_ADMIN_3", "Path");
+define("RSS_LAN_ADMIN_4", "Name");
+define("RSS_LAN_ADMIN_5", "Url");
+define("RSS_LAN_ADMIN_6", "Text");
+define("RSS_LAN_ADMIN_7", "Limit");
+define("RSS_LAN_ADMIN_8", "Visibility");
+define("RSS_LAN_ADMIN_9", "Type");
+define("RSS_LAN_ADMIN_10", "rss feed create entry");
+define("RSS_LAN_ADMIN_11", "rss feed import feeds");
+define("RSS_LAN_ADMIN_12", "Topic id");
+
+define("RSS_LAN_ADMIN_13", "Include Other-news items in News Feed?");
+define("RSS_LAN_ADMIN_14", "Enable");
+define("RSS_LAN_ADMIN_15", "Tick links to mark them for import ...");
+define("RSS_LAN_ADMIN_16", "import?");
+define("RSS_LAN_ADMIN_17", "import ticked links");
+define("RSS_LAN_ADMIN_18", "rss feed(s) imported.");
+
+define("RSS_LAN_ADMIN_21", "active and visible in rss feed list");
+define("RSS_LAN_ADMIN_22", "active and not visible in rss feed list");
+define("RSS_LAN_ADMIN_23", "inactive");
+
+define("RSS_LAN_ADMIN_26", "Check All");
+define("RSS_LAN_ADMIN_27", "Uncheck All");
+
+define("RSS_LAN_ADMIN_31", "rss entries limit updated");
+
+define("RSS_LAN_0", "RSS");
+define("RSS_LAN_2", "@nospam.com");
+define("RSS_LAN_3", "noauthor@nospam.com");
+
+?>
diff -ruN 0.7.5/e107_plugins/rss_menu/plugin.php 0.7.7/e107_plugins/rss_menu/plugin.php
--- 0.7.5/e107_plugins/rss_menu/plugin.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/plugin.php	2006-11-22 15:02:16.000000000 -0600
@@ -11,71 +11,101 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/plugin.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/11/22 21:02:16 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-// Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = "RSS";
-$eplug_version = "1.0";
-$eplug_author = "e107";
-$eplug_url = "http://e107.org";
-$eplug_email = "jalist@e107.org";
-$eplug_description = "RSS Feeds";
-$eplug_compatible = "e107v0.7+";
-$eplug_readme = "";
-$eplug_status = TRUE;
-
-// Name of the plugin's folder -------------------------------------------------------------------------------------
-$eplug_folder = "rss_menu";
-
-// Name of menu item for plugin ----------------------------------------------------------------------------------
-$eplug_menu_name = "rss_menu";
-
-// Name of the admin configuration file --------------------------------------------------------------------------
-$eplug_conffile = "admin_prefs.php";
-
-// Icon image and caption text ------------------------------------------------------------------------------------
-$eplug_icon = $eplug_folder."/images/rss_32.png";
-$eplug_icon_small = $eplug_folder."/images/rss_16.png";
-$eplug_caption = "Configure RSS Feeds";
-
-// List of preferences -----------------------------------------------------------------------------------------------
-$eplug_prefs = array(
-	'rss_feeds' => '1'
-);
-
-
-
-// List of table names -----------------------------------------------------------------------------------------------
-$eplug_table_names = "";
-
-// List of sql requests to create tables -----------------------------------------------------------------------------
-$eplug_tables = "";
-
-$eplug_rss = "";
-
-// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
-$eplug_link = FALSE;
-$eplug_link_name = '';
-$eplug_link_url = '';
+$lan_file = e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php";
+require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."rss_menu/languages/English.php");
 
+// Plugin info ----------------------------------------------------------------
+$eplug_name				= "RSS_PLUGIN_LAN_1";
+$eplug_version			= "1.1";
+$eplug_author			= "e107dev";
+$eplug_logo				= "";
+$eplug_url				= "http://e107.org";
+$eplug_email			= "";
+$eplug_description		= RSS_MENU_L2;
+$eplug_compatible		= "e107v0.7+";
+$eplug_readme			= "";		//leave blank if no readme file
+$eplug_latest			= FALSE;	//Show reported threads in admin (use latest.php)
+$eplug_status			= FALSE;	//Show post count in admin (use status.php)
+
+// Name of the plugin's folder ------------------------------------------------
+$eplug_folder			= "rss_menu";
+
+// Name of menu item for plugin -----------------------------------------------
+$eplug_menu_name		= "rss_menu";
+
+// Name of the admin configuration file ---------------------------------------
+$eplug_conffile			= "admin_prefs.php";
+
+// Icon image and caption text ------------------------------------------------
+$eplug_icon				= $eplug_folder."/images/rss_32.png";
+$eplug_icon_small		= $eplug_folder."/images/rss_16.png";
+$eplug_caption			= LAN_CONFIGURE;
+
+// List of preferences --------------------------------------------------------
+$eplug_prefs			= '';
+
+// List of table names --------------------------------------------------------
+$eplug_table_names		= array("rss");
+
+// List of sql requests to create tables --------------------------------------
+$eplug_tables = array(
+	"CREATE TABLE ".MPREFIX."rss (
+	rss_id int(10) unsigned NOT NULL auto_increment,
+	rss_name varchar(255) NOT NULL default '',
+	rss_url text NOT NULL,
+	rss_topicid varchar(255) NOT NULL default '',
+	rss_path varchar(255) NOT NULL default '',
+	rss_text longtext NOT NULL,
+	rss_datestamp int(10) unsigned NOT NULL default '0',
+	rss_class tinyint(1) unsigned NOT NULL default '0',
+	rss_limit tinyint(3) unsigned NOT NULL default '0',
+	PRIMARY KEY (rss_id)
+	) TYPE=MyISAM;",
+
+	"INSERT INTO ".MPREFIX."rss VALUES
+	(0, '".RSS_NEWS."', 'news', '', 'news', '".RSS_PLUGIN_LAN_7."', '".time()."', 0, 9),
+	(0, '".RSS_DL."', 'download', '', 'download', '".RSS_PLUGIN_LAN_8."', '".time()."', 0, 9),
+	(0, '".RSS_COM."', 'comments', '', 'comments', '".RSS_PLUGIN_LAN_9."', '".time()."', 0, 9)
+	"
+);
 
-// Text to display after plugin successfully installed ------------------------------------------------------------------
-$eplug_done = "RSS has successfully installed. ";
-
-
-// upgrading ... //
-
-$upgrade_add_prefs = "";
-
-$upgrade_remove_prefs = "";
-
-$upgrade_alter_tables = "";
+// Create a link in main menu (yes=TRUE, no=FALSE) ----------------------------
+$eplug_link				= FALSE;
+$eplug_link_name		= '';
+$eplug_link_url			= '';
+
+
+// upgrading ------------------------------------------------------------------
+$upgrade_add_prefs		= "";
+$upgrade_remove_prefs	= "";
+
+$upgrade_alter_tables	= array(
+	"CREATE TABLE ".MPREFIX."rss (
+	rss_id int(10) unsigned NOT NULL auto_increment,
+	rss_name varchar(255) NOT NULL default '',
+	rss_url text NOT NULL,
+	rss_topicid varchar(255) NOT NULL default '',
+	rss_path varchar(255) NOT NULL default '',
+	rss_text longtext NOT NULL,
+	rss_datestamp int(10) unsigned NOT NULL default '0',
+	rss_class tinyint(1) unsigned NOT NULL default '0',
+	rss_limit tinyint(3) unsigned NOT NULL default '0',
+	PRIMARY KEY (rss_id)
+	) TYPE=MyISAM;",
+
+	"INSERT INTO ".MPREFIX."rss VALUES
+	(0, '".RSS_NEWS."', 'news', '', 'news', '".RSS_PLUGIN_LAN_7."', '".time()."', 0, 9),
+	(0, '".RSS_DL."', 'download', '', 'download', '".RSS_PLUGIN_LAN_8."', '".time()."', 0, 9),
+	(0, '".RSS_COM."', 'comments', '', 'comments', '".RSS_PLUGIN_LAN_9."', '".time()."', 0, 9)
+	"
+);
 
-$eplug_upgrade_done = "";
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/rss_menu/rss.php 0.7.7/e107_plugins/rss_menu/rss.php
--- 0.7.5/e107_plugins/rss_menu/rss.php	2006-04-05 07:19:18.000000000 -0500
+++ 0.7.7/e107_plugins/rss_menu/rss.php	2006-11-08 00:51:13.000000000 -0600
@@ -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.47 $
-|     $Date: 2006/04/05 12:19:18 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.57 $
+|     $Date: 2006/11/08 06:51:13 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,52 +23,116 @@
 5: comments
 12: downloads (option: specify category)
 
-The following should be using $eplug_rss in their plugin.php file (see chatbox)
+Plugins should use an e_rss.php file in their plugin folder
 ----------------------------------------------------------------
-2: articles
-3: reviews
-4: content pages
-6: forum threads
-7: forum posts
-8: forum specific post (specify id)
-10: bugtracker
-11: forum
 */
 
 require_once("../../class2.php");
 
+global $tp;
+
+require_once(e_PLUGIN."rss_menu/rss_shortcodes.php");
+require_once(e_HANDLER."userclass_class.php");
+
 if (!is_object($tp->e_bb)) {
 	require_once(e_HANDLER.'bbcode_handler.php');
 	$tp->e_bb = new e_bbcode;
 }
 
+//get language file
 if (is_readable(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php")) {
 	include_once(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
 } else {
 	include_once(e_PLUGIN."rss_menu/languages/English.php");
 }
 
-$namearray[1] = RSS_NEWS;
-$namearray[2] = RSS_ART;
-$namearray[3] = RSS_REV;
-$namearray[5] = RSS_COM;
-$namearray[6] = RSS_FT;
-$namearray[7] = RSS_FP;
-$namearray[8] = RSS_FSP;
-$namearray[10] = RSS_BUG;
-$namearray[11] = RSS_FOR;
-$namearray[12] = RSS_DL;
+//get template
+if (is_readable(THEME."rss_template.php")) {
+	require_once(THEME."rss_template.php");
+	} else {
+	require_once(e_PLUGIN."rss_menu/rss_template.php");
+}
 
+//query handler
 list($content_type, $rss_type, $topic_id) = explode(".", e_QUERY);
+
+//list available rss feeds
 if (intval($rss_type) == false) {
-	echo "No type specified";
+	require_once(HEADERF);
+ 	require_once(e_PLUGIN."rss_menu/rss_template.php");
+
+	if(!$sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 AND rss_topicid NOT REGEXP ('\\\*') ORDER BY rss_name"))
+	{
+		$ns->tablerender(LAN_ERROR, RSS_LAN_ERROR_4);
+	}
+	else
+	{
+		$text = $RSS_LIST_HEADER;
+		while($row=$sql->db_Fetch())
+		{
+			$text .= $tp -> parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes);
+		}
+		$text .= $RSS_LIST_FOOTER;
+		$ns->tablerender(RSS_MENU_L2, $text);
+	}
+
+ 	require_once(FOOTERF);
 	exit;
 }
 
-if($rss = new rssCreate($content_type, $rss_type, $topic_id))
+//conversion table for old urls -------
+$conversion[1] = "news";
+$conversion[5] = "comments";
+$conversion[10] = "bugtracker";
+$conversion[12] = "download";
+//-------------------------------------
+
+//convert certain old urls so we can check the db entries ---------------------
+if($topic_id){
+	//rss.php?1.2.14 (news, rss-2, cat=14)
+	if(is_numeric($content_type) && isset($conversion[$content_type]) ){
+		$content_type = $conversion[$content_type];
+	}
+}else{
+	//rss.php?1.2 (news, rss-2) --> check = news (check conversion table)
+	if(is_numeric($content_type) && isset($conversion[$content_type]) ){
+		$content_type = $conversion[$content_type];
+	}
+}
+
+$check_topic = ($topic_id ? " AND rss_topicid = '".$topic_id."' " : "");
+
+if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
 {
-	$rss_title = (is_numeric($content_type) && $namearray[$content_type]) ? $namearray[$content_type] : ucfirst($content_type);
+	//check if wildcard present for topic_id
+	$check_topic = ($topic_id ? " AND rss_topicid = '".str_replace($topic_id, "*", $topic_id)."' " : "");
+	if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
+	{
+		require_once(HEADERF);
+		$ns->tablerender("", RSS_LAN_ERROR_1);
+		require_once(FOOTERF);
+		exit;
+	}else{
+		$row = $sql->db_Fetch();
+	}
+}else{
+	$row = $sql->db_Fetch();
+}
+
+//debugging
+//echo $check." - ".$content_type." - ".$rss_type." - ".$topic_id."<br />";
+//exit;
+
+// ----------------------------------------------------------------------------
+
+if($rss = new rssCreate($content_type, $rss_type, $topic_id, $row)){
+	$rss_title = ($rss->contentType ? $rss->contentType : ucfirst($content_type));
 	$rss->buildRss ($rss_title);
+}else{
+	require_once(HEADERF);
+	$ns->tablerender(RSS_LAN_ERROR_0, RSS_LAN_ERROR_1);
+	require_once(FOOTERF);
+	exit;
 }
 
 class rssCreate {
@@ -76,6 +140,7 @@
 	var $contentType;
 	var $rssType;
 	var $path;
+	var $parm;
 	var $rssItems;
 	var $rssQuery;
 	var $topicid;
@@ -83,32 +148,47 @@
 	var $rssNamespace;
 	var $rssCustomChannel;
 
-	function rssCreate($content_type, $rss_type, $topic_id) {
+	function rssCreate($content_type, $rss_type, $topic_id, $row) {
 		// constructor
 		$sql_rs = new db;
-		global $tp, $sql, $e107, $PLUGINS_DIRECTORY, $pref;
+		global $tp, $sql, $e107, $PLUGINS_DIRECTORY, $pref, $rssgen;
 		$this -> path = e_PLUGIN."rss_menu/";
 		$this -> rssType = $rss_type;
 		$this -> topicid = $topic_id;
 		$this -> offset = $pref['time_offset'] * 3600;
+		$this -> limit = $row['rss_limit'];
+		$this -> contentType = $row['rss_name'];
+
+		if(!is_numeric($content_type)){
+			$path = e_PLUGIN.$row['rss_path']."/e_rss.php";
+		}
+		if(strpos($row['rss_path'],'|')!==FALSE){
+			$tmp = explode("|", $row['rss_path']);
+			$path = e_PLUGIN.$tmp[0]."/e_rss.php";
+			$this -> parm = $tmp[1];	//parm is used in e_rss.php to define which feed you need to prepare
+		}
 
 		switch ($content_type) {
+			case news:
 			case 1:
-				$topic = (is_numeric($topic_id))? " AND news_category = ".intval($topic_id) : "";
-				$this -> contentType = "news";
+				if($topic_id && is_numeric($topic_id)){
+					$topic = " AND news_category = ".intval($topic_id);
+				}else{
+					$topic = '';
+				}
+				$path='';
+				$render = ($pref['rss_othernews'] != 1) ? "AND n.news_render_type < 2" : "";
+
 				$this -> rssQuery = "
 				SELECT n.*, u.user_id, u.user_name, u.user_email, 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 $topic ORDER BY news_datestamp DESC LIMIT 0,9";
+				WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY news_datestamp DESC LIMIT 0,".$this -> limit;
 				$sql->db_Select_gen($this -> rssQuery);
-
 				$tmp = $sql->db_getList();
-
 				$this -> rssItems = array();
 				$loop=0;
 				foreach($tmp as $value) {
-
 					$this -> rssItems[$loop]['title'] = $value['news_title'];
 					$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."news.php?item.".$value['news_id'].".".$value['news_category'];
                     if($value['news_summary']){
@@ -120,31 +200,32 @@
                     $this -> rssItems[$loop]['author_email'] = $value['user_email'];
 					$this -> rssItems[$loop]['category'] = "<category domain='".SITEURL."news.php?cat.".$value['news_category']."'>".$value['category_name']."</category>";
 
-					if($value['news_allow_comments']){
-						$this -> rssItems[$loop]['comment'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$news_id;
+					if($value['news_allow_comments'] && $pref['comments_disabled'] != 1){
+						$this -> rssItems[$loop]['comment'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['news_id'];
                     }
 					$this -> rssItems[$loop]['pubdate'] = $value['news_datestamp'];
 
 					$loop++;
 				}
-
 				break;
 			case 2:
+				$path='';
 				$this -> contentType = "articles";
 				break;
 			case 3:
+				$path='';
 				$this -> contentType = "reviews";
 				break;
 			case 4:
+				$path='';
 				$this -> contentType = "content";
 				break;
+			case comments:
 			case 5:
-				$this -> contentType = "comments";
-				$this -> rssQuery = "SELECT * FROM #comments ORDER BY comment_datestamp DESC LIMIT 0,9";
+				$path='';
+				$this -> rssQuery = "SELECT * FROM #comments ORDER BY comment_datestamp DESC LIMIT 0,".$this -> limit;
 				$sql->db_Select_gen($this -> rssQuery);
-
 				$tmp = $sql->db_getList();
-
 				$this -> rssItems = array();
 				$loop=0;
 				foreach($tmp as $value) {
@@ -163,134 +244,26 @@
 					$this -> rssItems[$loop]['author'] = substr($value['comment_author'], (strpos($value['comment_author'], ".")+1));
 					$loop++;
 				}
-
-				break;
-			case 6:
-				$this -> contentType = "forum threads";
-				$this -> rssQuery =
-				"SELECT t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, u.user_name, u.user_email FROM #forum_t AS t
-				LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
-				LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-				WHERE f.forum_class IN (0, 251, 252) AND t.thread_parent=0
-				ORDER BY t.thread_datestamp DESC LIMIT 0, 9
-				";
-				$sql->db_Select_gen($this -> rssQuery);
-				$tmp = $sql->db_getList();
-
-				$this -> rssItems = array();
-				$loop=0;
-				foreach($tmp as $value) {
-
-					if($value['user_name']) {
-						$this -> rssItems[$loop]['author'] = $value['user_name'];
-                       	$this -> rssItems[$loop]['author_email'] = $value['user_email'];  // must include an email address to be valid.
-				} else {
-						$tmp=explode(".", $value['thread_user'], 2);
-						list($this -> rssItems[$loop]['author'], $ip) = explode(chr(1), $tmp[1]);
-					}
-
-					$this -> rssItems[$loop]['title'] = $value['thread_name'];
-					$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'];
-
-					$this -> rssItems[$loop]['description'] = $value['thread_thread'];
-
-					$loop++;
-				}
 				break;
 
+			case 6:
 			case 7:
-				$this -> contentType = "forum posts";
-				$this -> rssQuery = "SELECT tp.thread_name AS parent_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, u.user_email FROM #forum_t AS t
-				LEFT JOIN #user AS u ON FLOOR(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
-				WHERE f.forum_class  IN (0, 251, 252)
-				ORDER BY t.thread_datestamp DESC LIMIT 0, 9";
-				$sql->db_Select_gen($this -> rssQuery);
-				$tmp = $sql->db_getList();
-				$this -> rssItems = array();
-				$loop=0;
-				foreach($tmp as $value) {
-
-					if($value['user_name']) {
-						$this -> rssItems[$loop]['author'] = $value['user_name'];
-						$this -> rssItems[$loop]['author_email'] = $value['user_email'];  // must include an email address to be valid.
-					} else {
-						$tmp=explode(".", $value['thread_user'], 2);
-						list($this -> rssItems[$loop]['author'], $ip) = explode(chr(1), $tmp[1]);
-					}
-
-					if($value['parent_name']) {
-						$this -> rssItems[$loop]['title'] = "Re: ".$value['parent_name'];
-						$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_parent'];
-					} else {
-						$this -> rssItems[$loop]['title'] = $value['thread_name'];
-						$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'];
-					}
-
-					$this -> rssItems[$loop]['description'] = $value['thread_thread'];
-
-					$loop++;
-				}
+				$path = e_PLUGIN."forum/e_rss.php";
 				break;
 
 			case 8:
 				if(!$this -> topicid) {
 					return FALSE;
 				}
-				$this -> contentType = "forum topic / replies";
-
-				/* get thread ...  */
-				$this -> rssQuery = "SELECT t.thread_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, f.forum_id, f.forum_name, f.forum_class, u.user_name
-				FROM #forum_t AS t
-				LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
-				LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-				WHERE f.forum_class  IN (0, 251, 255) AND t.thread_id=".intval($this -> topicid);
-				$sql->db_Select_gen($this -> rssQuery);
-				$topic = $sql->db_Fetch();
-
-				/* get replies ...  */
-				$this -> rssQuery = "SELECT t.thread_name, t.thread_thread, t.thread_id, t.thread_name, t.thread_datestamp, t.thread_parent, t.thread_user, t.thread_views, t.thread_lastpost, f.forum_id, f.forum_name, f.forum_class, u.user_name, u.user_email
-				FROM #forum_t AS t
-				LEFT JOIN #user AS u ON FLOOR(t.thread_user) = u.user_id
-				LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-				WHERE f.forum_class  IN (0, 251, 255) AND t.thread_parent=".intval($this -> topicid);
-				$sql->db_Select_gen($this -> rssQuery);
-				$replies = $sql->db_getList();
-
-				$this -> rssItems = array();
-				$loop = 0;
-
-				if($value['user_name']) {
-					$this -> rssItems[$loop]['author'] = $value['user_name'] . " ( ".$e107->base_path."user.php?id.".intval($value['thread_user'])." )";
-				} else {
-					$tmp=explode(".", $value['thread_user'], 2);
-					list($this -> rssItems[$loop]['author'], $ip) = explode(chr(1), $tmp[1]);
-				}
-
-				$this -> rssItems[$loop]['title'] = $topic['thread_name'];
-				$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$topic['thread_id'];
-				$this -> rssItems[$loop]['description'] = $topic['thread_thread'];
-				$loop ++;
-				foreach($replies as $value) {
-					if($value['user_name']) {
-						$this -> rssItems[$loop]['author'] = $value['user_name'];
-						$this -> rssItems[$loop]['author_email'] = $value['user_email'];  // must include an email address to be valid.
-					} else {
-						$tmp=explode(".", $value['thread_user'], 2);
-						list($this -> rssItems[$loop]['author'], $ip) = explode(chr(1), $tmp[1]);
-					}
-					$this -> rssItems[$loop]['title'] = "Re: ".$topic['thread_name'];
-					$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$this -> topicid;
-					$this -> rssItems[$loop]['description'] = $value['thread_thread'];
-					$loop++;
-				}
-			break;
-
+				$path = e_PLUGIN."forum/e_rss.php";
+				break;
 
+			/*
 			case 10:
+				$this -> limit = '9';
+				$path='';
 				$this -> contentType = "bugtracker reports";
-				$sql->db_Select("bugtrack2_bugs", "*", "bugtrack2_bugs_status=0 ORDER BY bugtrack2_bugs_datestamp");
+				$sql->db_Select("bugtrack2_bugs", "*", "bugtrack2_bugs_status=0 ORDER BY bugtrack2_bugs_datestamp LIMIT 0,".$this -> limit);
 				$tmp = $sql->db_getList();
 				$this -> rssItems = array();
 				$loop=0;
@@ -302,51 +275,29 @@
 					$this -> rssItems[$loop]['description'] = $value['bugtrack2_bugs_description'];
 					$loop++;
 				}
-			break;
+				break;
+			*/
 
 			case 11:
-				$this -> rssQuery = "
-				SELECT f.forum_id, f.forum_name, f.forum_class, tp.thread_name AS parent_name, t.*, u.user_name, u.user_email from #forum_t as t
-				LEFT JOIN #user AS u ON FLOOR(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
-				WHERE t.thread_forum_id = ".intval($this->topicid)."
-				AND f.forum_class IN (0, 251, 255)
-				ORDER BY
-				t.thread_datestamp DESC
-				LIMIT 0, 9
-				";
-				$sql->db_Select_gen($this -> rssQuery);
-				$tmp = $sql->db_getList();
-				$this -> contentType = "forum: ".$tmp[1]['forum_name'];
-				$this -> rssItems = array();
-				$loop=0;
-				foreach($tmp as $value) {
-					if($value['user_name']) {
-						$this -> rssItems[$loop]['author'] = $value['user_name'];
-						$this -> rssItems[$loop]['author_email'] = $value['user_email'];
-					} else {
-						$tmp=explode(".", $value['thread_user'], 2);
-						list($this -> rssItems[$loop]['author'], $ip) = explode(chr(1), $tmp[1]);
-					}
-
-					if($value['parent_name']) {
-						$this -> rssItems[$loop]['title'] = "Re: ".$value['parent_name'];
-						$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'].".post";
-					} else {
-						$this -> rssItems[$loop]['title'] = $value['thread_name'];
-						$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$value['thread_id'];
-					}
-					$this -> rssItems[$loop]['description'] = $value['thread_thread'];
-					$loop++;
+				if(!$this -> topicid) {
+					return FALSE;
 				}
-			break;
+				$path = e_PLUGIN."forum/e_rss.php";
+				break;
 
+			case download:
 			case 12:
-				$topic = ($topic_id) ? "download_category='".intval($topic_id)."' AND " : "";
-				$this -> contentType = "downloads";
+				if($topic_id && is_numeric($topic_id)){
+					$topic = "d.download_category='".intval($topic_id)."' AND ";
+				}else{
+					$topic = "";
+				}
+				$path='';
 				$class_list = "0,251,252,253";
-				$sql->db_Select("download", "*", "{$topic} download_active > 0 AND download_class IN (".$class_list.") ORDER BY download_datestamp DESC LIMIT 0,29");
+                $query = "SELECT d.*, dc.* FROM #download AS d LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id WHERE {$topic} d.download_active > 0 AND d.download_class IN (".$class_list.") ORDER BY d.download_datestamp DESC LIMIT 0,".$this -> limit;
+                $sql -> db_Select_gen($query);
+
+			 //	$sql->db_Select("download", "*", "{$topic} download_active > 0 AND download_class IN (".$class_list.") ORDER BY download_datestamp DESC LIMIT 0,".$this -> limit);
 				$tmp = $sql->db_getList();
 				$this -> rssItems = array();
 				$loop=0;
@@ -359,76 +310,69 @@
 					$this -> rssItems[$loop]['title'] = $value['download_name'];
 					$this -> rssItems[$loop]['link'] = $e107->base_path."download.php?view.".$value['download_id'];
 					$this -> rssItems[$loop]['description'] = ($rss_type == 3 ? $value['download_description'] : $value['download_description']);
+                    $this -> rssItems[$loop]['category_name'] = $value['download_category_name'];
+                    $this -> rssItems[$loop]['category_link'] = $e107->base_path."download.php?list.".$value['download_category_id'];
 					$this -> rssItems[$loop]['enc_url'] = $e107->base_path."request.php?".$value['download_id'];
 					$this -> rssItems[$loop]['enc_leng'] = $value['download_filesize'];
 					$this -> rssItems[$loop]['enc_type'] = $this->getmime($value['download_url']);
 					$this -> rssItems[$loop]['pubdate'] = $value['download_datestamp'];
-				$loop++;
+					$loop++;
 				}
-			break;
+				break;
 		}
 
-	// Get Plugin RSS feeds.
-	if($sql_rs->db_Select("plugin","*","plugin_rss REGEXP('".$tp -> toDB($content_type, true)."')")){
-		$row2 = $sql_rs -> db_Fetch();
-		require_once(e_PLUGIN.$row2['plugin_path']."/plugin.php");
-		foreach($eplug_rss as $key=>$rs){
-			extract($rs);  // id, author, link, linkid, title, description, query, category, datestamp, enc_url, enc_length, enc_type
-	// dear McFly, I remember why I used extract() now..  to avoid this: $row[($something['whatever'])]
-				if($sql -> db_Select_gen($query)){
-					$this -> contentType = $content_type;
-					$this -> rssNamespace = $namespace;
-					$this -> rssCustomChannel = $custom_channel;
-					$this -> rssItems = array();
-					$tmp = $sql->db_getList();
-					$loop=0;
-					foreach($tmp as $row) {
-
-						$this -> rssItems[$loop]['author'] = $row[$author];
-						$this -> rssItems[$loop]['author_email'] = $row[$author_email];
-						$this -> rssItems[$loop]['title'] = $row[$title];
-						$item = ($itemid) ? $row[$itemid] : "";
-						$link2 = str_replace("#",$item,$link);
-						if($link2){
-							if(eregi("http",$link2)){
-                                $this -> rssItems[$loop]['link'] = $link2;
+
+		if(isset($path) && $path!=''){
+
+			//new rss reader from e_rss.php in plugin folder
+			if (is_readable($path)) {
+				require_once($path);
+				foreach($eplug_rss_data as $key=>$rs){
+					foreach($rs as $k=>$row){
+						$this -> rssItems[$k]['author'] = $row['author'];
+						$this -> rssItems[$k]['author_email'] = $row['author_email'];
+						$this -> rssItems[$k]['title'] = $row['title'];
+						if($row['link']){
+							if(eregi("http",$row['link'])){
+								$this -> rssItems[$k]['link'] = $row['link'];
 							}else{
-                            	$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY.$link2;
+								$this -> rssItems[$k]['link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['link'];
 							}
-                                            }
-						$this -> rssItems[$loop]['description'] = $row[$description];
+						}
+						$this -> rssItems[$k]['description'] = $row['description'];
+						if($row['enc_url']){
+							$this -> rssItems[$k]['enc_url'] = $e107->base_path.$PLUGINS_DIRECTORY.$enc_url.$row['item_id'];
+						}
+						if($row['enc_leng']){
+							$this -> rssItems[$k]['enc_leng'] = $row['enc_leng'];
+						}
 
-						if($enc_url){ $this -> rssItems[$loop]['enc_url'] = $e107->base_path.$PLUGINS_DIRECTORY.$enc_url.$row[$item_id]; }
-               			if($enc_leng){ $this -> rssItems[$loop]['enc_leng'] = $row[$enc_leng]; }
-						if($row[$enc_type]){
-							$this -> rssItems[$loop]['enc_type'] = $this->getmime($row[$enc_type]);
-						}elseif($enc_type){
-							$this -> rssItems[$loop]['enc_type'] = $enc_type;
+						if($eplug_rss['enc_type']){
+							$this -> rssItems[$k]['enc_type'] = $this->getmime($eplug_rss['enc_type']);
+						}elseif($row['enc_type']){
+							$this -> rssItems[$k]['enc_type'] = $row['enc_type'];
 						}
 
-						$catid = ($categoryid) ? $row[$categoryid] : "";
-						$catlink = ($categorylink) ? str_replace("#",$catid,$categorylink) : "";
-						if($categoryname && $catlink){
-							$this -> rssItems[$loop]['category_name'] = $row[$categoryname];
-							$this -> rssItems[$loop]['category_link'] = $e107->base_path.$catlink;
+						$this -> rssItems[$k]['category_name'] = $row['category_name'];
+						if($row['category_link']){
+							if(eregi("http",$row['category_link'])){
+								$this -> rssItems[$k]['category_link'] = $row['category_link'];
+							}else{
+								$this -> rssItems[$k]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['category_link'];
+							}
 						}
-						if($datestamp){
-							$this -> rssItems[$loop]['pubdate'] = $row[$datestamp];
+						if($row['datestamp']){
+							$this -> rssItems[$k]['pubdate'] = $row['datestamp'];
 						}
-						$loop++;
 					}
 				}
 			}
 		}
-}
 
-	function striptags($text)
-	{
-   		return $text;
 	}
 
 	function buildRss($rss_title) {
-		global $sql, $pref, $tp;
+		global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY;
 		header('Content-type: application/xml', TRUE);
 
 		$rss_title = $tp->toRss($pref['sitename']." : ".$rss_title);
@@ -448,40 +392,43 @@
 						<lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate>
 						<docs>http://backend.userland.com/rss092</docs>\n";
 
-					foreach($this -> rssItems as $value) {
+					foreach($this -> rssItems as $value)
+					{
+
+                    	// Multi-language rss links.
+						$link 		= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+
 						echo "
 							<item>
 							<title>".$tp->toRss($value['title'])."</title>
 							<description>".$tp->toRss(substr($value['description'],0,150))."</description>
 							<author>".$value['author']."&lt;".$this->nospam($value['author_email'])."&gt;</author>
-							<link>".$value['link']."</link>
+							<link>".$link."</link>
 							</item>";
 					}
 					echo "
 						</channel>
 						</rss>";
-					break;
+			break;
 
-				case 2: // rss 2.0
-			$sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON);
-			echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>
+			case 2: // rss 2.0
+				$sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON);
+				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>
 				<!-- generator=\"e107\" -->
 				<!-- content type=\"".$this -> contentType."\" -->
-
 				<!-- test=\"".SITEDISCLAIMER."\" -->
-
 				<rss {$rss_namespace} version=\"2.0\">
 				<channel>
 				<title>".$tp->toRss($rss_title)."</title>
 				<link>".$pref['siteurl']."</link>
 				<description>".$tp->toRss($pref['sitedescription'])."</description>\n";
 
-			echo $tp->toRss($rss_custom_channel,TRUE)."\n";
+				echo $tp->toRss($rss_custom_channel,TRUE)."\n";
 
-			echo "<language>en-gb</language>
+				echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
 				<copyright>".preg_replace("#\<br \/\>|\n|\r#si", "", SITEDISCLAIMER)."</copyright>
-				<managingEditor>".$pref['siteadmin']." - ".$pref['siteadminemail']."</managingEditor>
-				<webMaster>".$pref['siteadminemail']."</webMaster>
+				<managingEditor>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</managingEditor>
+				<webMaster>".$this->nospam($pref['siteadminemail'])."</webMaster>
 				<pubDate>".date("r",($time + $this -> offset))."</pubDate>
 				<lastBuildDate>".date("r",($time + $this -> offset))."</lastBuildDate>
 				<docs>http://backend.userland.com/rss</docs>
@@ -501,49 +448,55 @@
 				<name>query</name>
 				<link>".SITEURL.(substr(SITEURL, -1) == "/" ? "" : "/")."search.php</link>
 				</textInput>";
-			foreach($this -> rssItems as $value) {
-				echo "
-					<item>
-					<title>".$tp->toRss($value['title'])."</title>\n";
+				foreach($this -> rssItems as $value)
+				{
+                    // Multi-language rss links.
+					$link 		= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+                    $catlink	= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['category_link']) : $value['category_link'];
 
-				if($value['link']){
-                	echo "<link>".$value['link']."</link>\n";
-				}
+					echo "
+						<item>
+						<title>".$tp->toRss($value['title'])."</title>\n";
 
-				echo "<description>".$tp->toRss($value['description'])."</description>\n";
+					if($link){
+						echo "<link>".$link."</link>\n";
+					}
 
-				if($value['category_name'] && $value['category_link']){
-                	echo "<category domain='".$value['category_link']."'>".$tp -> toRss($value['category_name'])."</category>\n";
-				}
+					echo "<description>".$tp->toRss($value['description'],TRUE)."</description>\n";
 
-				if($value['comment']){
-					echo "<comments>".$tp->toRss($value['comment'])."</comments>\n";
-				}
+					if($value['category_name'] && $catlink){
+						echo "<category domain='".$catlink."'>".$tp -> toRss($value['category_name'])."</category>\n";
+					}
 
-				if($value['author']){
-					echo "<author>".$value['author']."&lt;".$this->nospam($value['author_email'])."&gt;</author>\n";
-				}
+					if($value['comment']){
+						//echo "<comments>".$tp->toRss($value['comment'])."</comments>\n";
+						echo "<comments>".$value['comment']."</comments>\n";
+					}
 
-				// enclosure support for podcasting etc.
-		   		if($value['enc_url'] && $value['enc_leng'] && $value['enc_type']){
-					echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\"   />\n";
-		   	 	}
+					if($value['author']){
+						echo "<author>".$value['author']."&lt;".$this->nospam($value['author_email'])."&gt;</author>\n";
+					}
 
-				echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n";
+					// enclosure support for podcasting etc.
+					if($value['enc_url'] && $value['enc_leng'] && $value['enc_type']){
+						echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\"   />\n";
+					}
 
-				if($value['link']){
-					echo "<guid isPermaLink=\"true\">".$value['link']."</guid>\n";
-				}
+					echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n";
 
-				echo "</item>";
-			}
-			echo "
+					if($link){
+						echo "<guid isPermaLink=\"true\">".$link."</guid>\n";
+					}
+
+					echo "</item>";
+				}
+				echo "
 				</channel>
 				</rss>";
 			break;
 
 			case 3: // rdf
-			echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
+				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
 				<!-- generator=\"e107\" -->
 				<!-- content type=\"".$this -> contentType."\" -->
 				<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">
@@ -551,67 +504,166 @@
 				<title>".$tp->toRss($rss_title)."</title>
 				<link>".$pref['siteurl']."</link>
 				<description>".$tp->toRss($pref['sitedescription'])."</description>
-				<dc:language>en</dc:language>
+				<dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language>
 				<dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date>
-				<dc:creator>".$pref['siteadminemail']."</dc:creator>
+				<dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator>
 				<admin:generatorAgent rdf:resource=\"http://e107.org\" />
-				<admin:errorReportsTo rdf:resource=\"mailto:".$pref['siteadminemail']."\" />
+				<admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" />
 				<sy:updatePeriod>hourly</sy:updatePeriod>
 				<sy:updateFrequency>1</sy:updateFrequency>
 				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
 				<items>
 				<rdf:Seq>";
 
-			foreach($this -> rssItems as $value) {
-				echo "
-					<rdf:li rdf:resource=\"".$value['link']."\" />";
-			}
+				foreach($this -> rssItems as $value)
+				{
+
+                    // Multi-language rss links.
+					$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+
+					echo "
+						<rdf:li rdf:resource=\"".$link."\" />";
+				}
 
-			echo "
+				echo "
 				</rdf:Seq>
 				</items>
 				</channel>";
 
-			reset($this -> rssItems);
-			foreach($this -> rssItems as $value) {
+				reset($this -> rssItems);
+				unset($link);
+				foreach($this -> rssItems as $value)
+				{
+
+                    // Multi-language rss links.
+					$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+
+					echo "
+						<item rdf:about=\"".$link."\">
+						<title>".$tp->toRss($value['title'])."</title>
+						<link>".$link."</link>
+						<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date>
+						<dc:creator>".$value['author']."</dc:creator>
+						<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
+						<description>".$tp->toRss($value['description'])."</description>
+						</item>";
+				}
 				echo "
-					<item rdf:about=\"".$value['link']."\">
-					<title>".$tp->toRss($value['title'])."</title>
-					<link>".$value['link']."</link>
-					<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date>
-					<dc:creator>".$value['author']."</dc:creator>
-					<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
-					<description>".$tp->toRss($value['description'])."</description>
-					</item>";
-			}
-			echo "
 				</rdf:RDF>";
 			break;
+
+			//new feed for atom - still in development, and not yet tested
+			case 4:
+				echo "<?xml version='1.0' encoding='".CHARSET."'?>\n
+				<feed xmlns='http://www.w3.org/2005/Atom'>\n";
+				/*
+				<feed version='0.3'
+				  xmlns='http://purl.org/atom/ns#'
+				  xmlns:dc='http://purl.org/dc/elements/1.1/'
+				  xml:lang='".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."'>\n";
+				  */
+
+					//required
+					echo "
+					<id>".$pref['siteurl']."</id>\n
+					<title type='text'>".$tp->toRss($rss_title)."</title>\n
+					<updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n";
+
+					//recommended
+					echo "
+					<author>\n
+						<name>e107</name>\n";
+						//<email></email>\n
+						echo "
+						<uri>http://e107.org/</uri>\n
+					</author>\n
+					<link rel='self' href='".$e107->base_path.$PLUGINS_DIRECTORY."rss_menu/".e_PAGE."?".e_QUERY."' />\n";
+
+					//optional
+					include(e_ADMIN."ver.php");
+					echo "
+					<category term='e107'/>\n
+					<contributor>\n
+						<name>e107</name>\n
+					</contributor>\n
+					<generator uri='http://e107.org/' version='".$e107info['e107_version']."'>e107</generator>\n";
+					//<icon>/icon.jpg</icon>\n
+					echo "
+					<logo>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</logo>\n
+					<rights type='html'>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</rights>\n";
+					if($pref['sitedescription']){
+					echo "
+					<subtitle type='text'>".$pref['sitedescription']."</subtitle>\n";
+                    }
+					foreach($this -> rssItems as $value) {
+					echo "
+					<entry>\n";
+
+						//required
+						echo "
+						<id>".$value['link']."</id>\n
+						<title type='text'>".$tp->toRss($value['title'])."</title>\n
+						<updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n";
+
+						//recommended
+                        $author = ($value['author']) ? $value['author'] : "unknown";
+
+						echo "
+						<author>\n";
+						echo "
+						<name>".$author."</name>\n";
+						echo ($value['author_email']) ? "\t\t\t\t\t\t<email>".$this->nospam($value['author_email'])."</email>\n" : "";
+						echo "</author>\n";
+						//<content>complete story here</content>\n
+						echo "
+						<link rel='alternate' type='text/html' href='".$value['link']."' />\n
+						<summary type='text'>".$tp->toRss($value['description'])."</summary>\n";
+
+						//optional
+						if($value['category_name']){
+							echo "<category term='".$tp -> toRss($value['category_name'])."'/>\n";
+						}
+						//<contributor>
+						//	<name>Jane Doe</name>
+						//</contributor>
+						echo "<published>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</published>\n";
+						//<source>
+						//	<id>http://example.org/</id>
+						//	<title>Fourty-Two</title>
+						//	<updated>2003-12-13T18:30:02Z</updated>
+						//	<rights> 2005 Example, Inc.</rights>
+						//</source>
+						//<rights type='html'>&amp;copy; 2005 John Doe</rights>
+						echo "
+					</entry>\n";
+					}
+				echo "
+				</feed>\n";
+
+			break;
 		}
 	}
 
-
 	function getmime($file){
 		$ext = strtolower(str_replace(".","",strrchr(basename($file), ".")));
 		$mime["mp3"] = "audio/mpeg";
 		return $mime[$ext];
 	}
 
-
-    function get_iso_8601_date($int_date) {
-   //$int_date: current date in UNIX timestamp
-   		$date_mod = date('Y-m-d\TH:i:s', $int_date);
-   		$pre_timezone = date('O', $int_date);
-   		$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
-   		$date_mod .= $time_zone;
-   		return $date_mod;
+	function get_iso_8601_date($int_date) {
+		//$int_date: current date in UNIX timestamp
+		$date_mod = date('Y-m-d\TH:i:s', $int_date);
+		$pre_timezone = date('O', $int_date);
+		$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
+		$date_mod .= $time_zone;
+		return $date_mod;
 	}
 
 	function nospam($text){
 		$tmp = explode("@",$text);
-		return ($tmp[0] != "") ? $tmp[0]."@nospam.com" : "noauthor@nospam.com";
+		return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3;
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_plugins/rss_menu/rss_menu.php 0.7.7/e107_plugins/rss_menu/rss_menu.php
--- 0.7.5/e107_plugins/rss_menu/rss_menu.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/rss_menu.php	2006-10-21 08:06:21.000000000 -0500
@@ -11,52 +11,54 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/rss_menu.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2006/10/21 13:06:21 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-global $FILES_DIRECTORY,$pref;
+global $FILES_DIRECTORY,$pref,$sql;
 $path = e_PLUGIN."rss_menu/";
 
 $des = "";
+$topic = "";
 
-if(strstr(e_SELF, "comment.php")) {
+if(strstr(e_SELF, "comment.php") && $sql -> db_Select("rss", "rss_path", " rss_path = 'comments' LIMIT 1")) {
 	$type = 5;
-	$des = BACKEND_MENU_L4;
+	$des = RSS_MENU_L4;
 }
-if(strstr(e_SELF, "/forum")) {
+if(strstr(e_SELF, "/forum")&& $sql -> db_Select("rss", "rss_path", " rss_path = 'forum|name' LIMIT 1") ) {
 	$type = 6;
-	$des = BACKEND_MENU_L5;
+	$des = RSS_MENU_L5;
 }
-if(strstr(e_SELF, "forum_viewtopic")) {
+if(strstr(e_SELF, "forum_viewtopic") && $sql -> db_Select("rss", "rss_path", " rss_path = 'forum|topic' LIMIT 1")) {
 	$type = 7;
-	$des = BACKEND_MENU_L6;
+	$des = RSS_MENU_L6;
 }
-if(strstr(e_SELF, "chat.php")) {
+if(strstr(e_SELF, "chat.php")&& $sql -> db_Select("rss", "rss_path", " rss_path = 'chatbox_menu' LIMIT 1")) {
 	$type = 9;
-	$des = BACKEND_MENU_L7;
+	$des = RSS_MENU_L7;
 }
 
 if(strstr(e_SELF, "/bugtracker")) {
 	$type = 10;
-	$des = BACKEND_MENU_L8;
+	$des = RSS_MENU_L8;
 }
 
-if(strstr(e_SELF, "download.php")) {
+if(strstr(e_SELF, "download.php") && $sql -> db_Select("rss", "rss_path", " rss_path = 'download' LIMIT 1")) {
 	$type = 12;
-	$des = BACKEND_MENU_L9;
+	$des = RSS_MENU_L9;
 }
 
 if(!$des) {
 	$type = 1;
-	$des = BACKEND_MENU_L3;
+	$des = RSS_MENU_L3;
 }
 
 if(e_PAGE == "news.php" && $pref['rss_newscats'])
 {
+
 	$qry = explode(".",e_QUERY);
 	if($qry[0] == "cat" || $qry[0] == "list")
 	{
@@ -64,14 +66,16 @@
 	}
 }
 
-$text = "<div style='text-align:center' class='smalltext'>
-".$des.BACKEND_MENU_L1."<br />
-<div class='spacer'><a href='".$path."rss.php?$type.1.$topic'><img src='".$path."images/rss1.png' alt='rss1.0' style='border:0' /></a></div>
-<div class='spacer'><a href='".$path."rss.php?$type.2.$topic'><img src='".$path."images/rss2.png' alt='rss2.0' style='border:0' /></a></div>
-<div class='spacer'><a href='".$path."rss.php?$type.3.$topic'><img src='".$path."images/rss3.png' alt='rdf' style='border:0' /></a><br /></div>
+$text = "
+<div style='text-align:center' class='smalltext'>
+".$des.RSS_MENU_L1."<br />
+<div class='spacer'><a href='".$path."rss.php?$type.1".($topic ? ".".$topic : "")."'><img src='".$path."images/rss1.png' alt='rss1.0' style='border:0' /></a></div>
+<div class='spacer'><a href='".$path."rss.php?$type.2".($topic ? ".".$topic : "")."'><img src='".$path."images/rss2.png' alt='rss2.0' style='border:0' /></a></div>
+<div class='spacer'><a href='".$path."rss.php?$type.3".($topic ? ".".$topic : "")."'><img src='".$path."images/rss3.png' alt='rdf' style='border:0' /></a><br /></div>
 </div>";
 
-$caption = (file_exists(THEME."images/backend_menu.png") ? "<img src='".THEME_ABS."images/backend_menu.png' alt='' style='vertical-align:middle' /> ".BACKEND_MENU_L2 : BACKEND_MENU_L2);
+$caption = (file_exists(THEME."images/RSS_menu.png") ? "<img src='".THEME_ABS."images/RSS_menu.png' alt='' style='vertical-align:middle' /> ".RSS_MENU_L2 : RSS_MENU_L2);
 
 $ns->tablerender($caption, $text, 'backend');
-?>
\ No newline at end of file
+
+?>
diff -ruN 0.7.5/e107_plugins/rss_menu/rss_meta.php 0.7.7/e107_plugins/rss_menu/rss_meta.php
--- 0.7.5/e107_plugins/rss_menu/rss_meta.php	2006-01-25 14:17:09.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/rss_meta.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,50 +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_plugins/rss_menu/rss_meta.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/01/25 20:17:09 $
-|     $Author: e107coders $
-+----------------------------------------------------------------------------+
-*/
-if (!defined('e107_INIT')) { exit; }
-
-	$rss = explode(",",$pref['rss_feeds']);
-	$feedlist[1] = "News";
-	$feedlist[12] = "Downloads";
-	$feedlist[6] = "Forum Threads";
-	$feedlist[7] = "Forum Posts";
-
-foreach($rss as $rss_id){
-	if(!is_numeric($rss_id)){
-    	$feedlist[$rss_id] = ucfirst($rss_id);
-	}
-	echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)." ".$feedlist[$rss_id] ."' href='".SITEURLBASE.e_PLUGIN_ABS."rss_menu/rss.php?{$rss_id}.2' />\n";
-}
-
-if($pref['rss_newscats']){
-    $sql -> db_Select("news_category");
-        while($row = $sql-> db_Fetch()){
-		echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)." News - ".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)."' href='".SITEURLBASE.e_PLUGIN_ABS."rss_menu/rss.php?1.2.{$row['category_id']}' />\n";
-        }
-}
-
-if($pref['rss_dlcats']){
-	$class_list = "0,251,252,253";
-    $sql -> db_Select("download_category","*","download_category_class IN (".$class_list.") ORDER BY download_category_name");
-        while($row = $sql-> db_Fetch()){
-		echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)." Downloads - ".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)."' href='".SITEURLBASE.e_PLUGIN_ABS."rss_menu/rss.php?12.2.{$row['download_category_id']}' />\n";
-        }
-}
-
-
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/rss_menu/rss_shortcodes.php 0.7.7/e107_plugins/rss_menu/rss_shortcodes.php
--- 0.7.5/e107_plugins/rss_menu/rss_shortcodes.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/rss_shortcodes.php	2006-06-20 15:13:10.000000000 -0500
@@ -0,0 +1,192 @@
+<?php
+include_once(e_HANDLER.'shortcode_handler.php');
+$rss_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+/*
+
+SC_BEGIN RSS_FEED
+global $row, $tp;
+$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+return "<a href='".$url2."'>".$tp->toHTML($row['rss_name'], TRUE)."</a>";
+SC_END
+
+SC_BEGIN RSS_ICON
+global $row, $tp;
+$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+return "<a href='".$url2."'>".RSS_ICON."</a>";
+SC_END
+
+SC_BEGIN RSS_TEXT
+global $row, $tp;
+return $tp->toHTML($row['rss_text'], TRUE, "defs");
+SC_END
+
+SC_BEGIN RSS_TYPES
+global $row, $tp;
+$url1 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$url3 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$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>
+";
+return $text;
+SC_END
+
+
+//##### ADMIN --------------------------------------------------
+
+SC_BEGIN RSS_ADMIN_CAPTION
+global $sort;
+list($field,$txt) = explode(",",$parm);
+$txt = constant($txt);
+return "<a href='".e_SELF."?list.{$field}.".($sort == "desc" ? "asc" : "desc")."'>".$txt."</a>\n";
+SC_END
+
+SC_BEGIN RSS_ADMIN_ID
+global $row;
+return $row['rss_id'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_NAME
+global $row;
+return $row['rss_name'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_PATH
+global $row;
+return $row['rss_path'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_URL
+global $row;
+return "<a href='".e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$row['rss_url']."'>".$row['rss_url']."</a>";
+SC_END
+
+SC_BEGIN RSS_ADMIN_TOPICID
+global $row;
+return $row['rss_topicid'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_LIMIT
+global $row, $rs;
+$id = $row['rss_id'];
+return "<input class='tbox' type='text' name=\"limit[$id]\" title=\"".RSS_LAN05."\" value='".intval($row['rss_limit'])."' size='3' maxlength='3' />";
+SC_END
+
+SC_BEGIN RSS_ADMIN_LIMITBUTTON
+global $row;
+return "<input class='button' type='submit' name='update_limit' value=\"".LAN_UPDATE."\" />";
+SC_END
+
+SC_BEGIN RSS_ADMIN_OPTIONS
+global $row, $tp;
+$delname = $row['rss_name'];
+$delid = $row['rss_id'];
+$options = "
+<a href='".e_SELF."?create.edit.".$row['rss_id']."' >".ADMIN_EDIT_ICON."</a>
+<input type='image' title=\"".LAN_DELETE."\" name='delete[{$delid}]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL ." [".RSS_LAN_ADMIN_2.": ".$delid." : ".$delname."]\\n\\n")."')\"/>";
+return $options;
+SC_END
+
+
+
+SC_BEGIN RSS_ADMIN_FORM_NAME
+global $row;
+return "<input class='tbox' type='text' name='rss_name' size='74' value=\"".$row['rss_name']."\" />\n";
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_URL
+global $row,$PLUGINS_DIRECTORY;
+return SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".e_LANQRY." <input class='tbox' type='text' name='rss_url' size='10' value=\"".$row['rss_url']."\" maxlength='50' /> .{".RSS_LAN_ADMIN_9."}.{".RSS_LAN_ADMIN_12."}";
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_TOPICID
+global $row;
+return "<input class='tbox' type='text' name='rss_topicid' size='74' value=\"".$row['rss_topicid']."\" maxlength='250' />";
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_PATH
+global $row;
+return "<input class='tbox' type='text' name='rss_path' size='74' value=\"".$row['rss_path']."\" maxlength='250' />";
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_TEXT
+global $row;
+return "<textarea class='tbox' name='rss_text' cols='74' rows='5' >".$row['rss_text']."</textarea>\n";
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_CLASS
+global $row;
+$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";
+}
+$text .= "</select>";
+return $text;
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_LIMIT
+global $row;
+return "<input class='tbox' name='rss_limit' size='3' title=\"".RSS_LAN05."\" value='".intval($row['rss_limit'])."' maxlength='3' />";
+SC_END
+
+SC_BEGIN RSS_ADMIN_FORM_CREATEBUTTON
+global $row, $qs;
+if(isset($qs[1]) && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2]) ){
+	$text = "<input type='hidden' name='rss_datestamp' value='".$row['rss_datestamp']."' />
+	<input type='hidden' name='rss_id' value='".$row['rss_id']."' />
+	<input class='button' type='submit' name='update_rss' value=\"".LAN_UPDATE."\" />";
+}else{
+	$text = "<input class='button' type='submit' name='create_rss' value=\"".LAN_CREATE."\" />";
+}
+return $text;
+SC_END
+
+
+
+SC_BEGIN RSS_ADMIN_IMPORT_CHECK
+global $feed, $rs, $tp, $i;
+$text  = "<input type='checkbox' name='importid[$i]' value='1' />";
+$text .= "<input type='hidden' name='name[$i]' value='".$tp->toForm($feed['name'])."' />";
+$text .= "<input type='hidden' name='url[$i]' value='".$tp->toForm($feed['url'])."' />";
+$text .= "<input type='hidden' name='topic_id[$i]' value='".$tp->toForm($feed['topic_id'])."' />";
+$text .= "<input type='hidden' name='path[$i]' value='".$tp->toForm($feed['path'])."' />";
+$text .= "<input type='hidden' name='text[$i]' value='".$tp->toForm($feed['text'])."' />";
+$text .= "<input type='hidden' name='class[$i]' value='".$tp->toForm($feed['class'])."' />";
+$text .= "<input type='hidden' name='limit[$i]' value='".intval($feed['limit'])."' />";
+return $text;
+SC_END
+
+SC_BEGIN RSS_ADMIN_IMPORT_PATH
+global $feed;
+return $feed['path'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_IMPORT_NAME
+global $feed;
+return $feed['name'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_IMPORT_TEXT
+global $feed;
+return $feed['text'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_IMPORT_URL
+global $feed;
+return $feed['url'];
+SC_END
+
+SC_BEGIN RSS_ADMIN_IMPORT_TOPICID
+global $feed;
+return $feed['topic_id'];
+SC_END
+
+*/
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/rss_menu/rss_sql.php 0.7.7/e107_plugins/rss_menu/rss_sql.php
--- 0.7.5/e107_plugins/rss_menu/rss_sql.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/rss_sql.php	2006-06-20 01:50:09.000000000 -0500
@@ -0,0 +1,12 @@
+CREATE TABLE rss (
+	rss_id int(10) unsigned NOT NULL auto_increment,
+	rss_name varchar(255) NOT NULL default '',
+	rss_url text NOT NULL,
+	rss_topicid varchar(255) NOT NULL default '',
+	rss_path varchar(255) NOT NULL default '',
+	rss_text longtext NOT NULL,
+	rss_datestamp int(10) unsigned NOT NULL default '0',
+	rss_class tinyint(1) unsigned NOT NULL default '0',
+	rss_limit tinyint(3) unsigned NOT NULL default '0',
+	PRIMARY KEY  (rss_id)
+) TYPE=MyISAM;
diff -ruN 0.7.5/e107_plugins/rss_menu/rss_template.php 0.7.7/e107_plugins/rss_menu/rss_template.php
--- 0.7.5/e107_plugins/rss_menu/rss_template.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/rss_menu/rss_template.php	2006-07-16 18:01:20.000000000 -0500
@@ -0,0 +1,175 @@
+<?php
+
+if (!defined('ADMIN_WIDTH')) { define("ADMIN_WIDTH", "width:98%;"); }
+if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:100%"); }
+
+//rss listing
+if(!isset($RSS_LIST_HEADER)){
+	$RSS_LIST_HEADER = "<table class='fborder' style='".USER_WIDTH."'>
+		<tr>
+			<td class='fcaption' style='width:55%'>".RSS_LAN_ADMIN_4."</td>
+			<td class='fcaption' style='text-align:right'>".RSS_PLUGIN_LAN_6."</td>
+		</tr>";
+}
+if(!isset($RSS_LIST_TABLE)){
+	$RSS_LIST_TABLE = "
+	<tr>
+		<td class='forumheader3'>{RSS_FEED}<br />
+		<span class='smalltext' >{RSS_TEXT}</span>
+		</td>
+	<td class='forumheader3' style='text-align:right'>
+    	{RSS_TYPES}
+	</td>
+	</tr>";
+}
+if(!isset($RSS_LIST_FOOTER)){
+	$RSS_LIST_FOOTER = "</table>";
+}
+
+//admin : rss listing
+if(!isset($RSS_ADMIN_LIST_HEADER)){
+    $RSS_ADMIN_LIST_HEADER = "
+    <div style='text-align:center;'>
+    <form action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."' id='dataform' method='post' >
+    <table class='fborder' style='".ADMIN_WIDTH."'>
+    <tr>
+        <td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=id,RSS_LAN_ADMIN_2}</td>
+        <td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=name,RSS_LAN_ADMIN_4}</td>
+        <td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=path,RSS_LAN_ADMIN_3}</td>
+        <td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=url,RSS_LAN_ADMIN_5}</td>
+        <td class='fcaption' style='white-space:nowrap;'>".RSS_LAN_ADMIN_12."</td>
+        <td class='fcaption' style='white-space:nowrap;'>{RSS_ADMIN_CAPTION=limit,RSS_LAN_ADMIN_7}</td>
+        <td class='fcaption' style='white-space:nowrap;'>".LAN_OPTIONS."</td>
+    </tr>";
+}
+if(!isset($RSS_ADMIN_LIST_TABLE)){
+	$RSS_ADMIN_LIST_TABLE = "
+	<tr>
+		<td class='forumheader3'>{RSS_ADMIN_ID}</td>
+		<td class='forumheader3'>{RSS_ADMIN_NAME}</td>
+		<td class='forumheader3'>{RSS_ADMIN_PATH}</td>
+		<td class='forumheader3'>{RSS_ADMIN_URL}</td>
+		<td class='forumheader3'>{RSS_ADMIN_TOPICID}</td>
+		<td class='forumheader3'>{RSS_ADMIN_LIMIT}</td>
+		<td class='forumheader3' style='text-align:center'>{RSS_ADMIN_OPTIONS}</td>
+	</tr>";
+}
+if(!isset($RSS_ADMIN_LIST_FOOTER)){
+	$RSS_ADMIN_LIST_FOOTER = "
+	<tr>
+		<td class='forumheader' colspan='7' style='text-align:center'>
+			{RSS_ADMIN_LIMITBUTTON}
+		</td>
+	</tr>
+	</table>
+	</form>
+	</div>";
+}
+
+//admin : rss create/edit
+if(!isset($RSS_ADMIN_CREATE_TABLE)){
+	$RSS_ADMIN_CREATE_TABLE = "
+	<div style='text-align:center;'>
+	<form action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."' id='dataform' method='post' >
+	<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr>
+		<td class='forumheader3' style='width:12%'>".RSS_LAN_ADMIN_4."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_NAME}</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_5."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_URL}</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_12."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_TOPICID}</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_3."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_PATH}</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_6."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_TEXT}</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_7."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_LIMIT}</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_8."</td>
+		<td class='forumheader3'>{RSS_ADMIN_FORM_CLASS}</td>
+	</tr>
+	<tr>
+		<td class='forumheader' colspan='2' style='text-align:center;'>{RSS_ADMIN_FORM_CREATEBUTTON}</td>
+	</tr>
+	</table>
+	</form>
+	</div>";
+}
+
+//admin : rss options
+if(!isset($RSS_ADMIN_OPTIONS_TABLE)){
+	$RSS_ADMIN_OPTIONS_TABLE = "
+	<div style='text-align:center;'>
+	<form action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."' id='dataform' method='post' >
+	<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr>
+		<td class='fcaption'>".LAN_OPTIONS."</td>
+		<td class='fcaption'>".RSS_LAN_ADMIN_14."</td>
+	</tr>
+	<tr>
+		<td class='forumheader3'>".RSS_LAN_ADMIN_13."</td>
+		<td class='forumheader3'>
+			<input type='checkbox' name='rss_othernews' value='1' ".($pref['rss_othernews'] == 1 ? " checked='checked' " : "")." />
+		</td>
+	</tr>
+	<tr style='vertical-align:top'>
+		<td colspan='2' style='text-align:center' class='forumheader'>
+			<input class='button' type='submit' name='updatesettings' value='".LAN_SAVE."' />
+		</td>
+	</tr>
+	</table>
+	</form>
+	</div>";
+}
+
+//admin : rss import
+if(!isset($RSS_ADMIN_IMPORT_HEADER)){
+	$RSS_ADMIN_IMPORT_HEADER = "
+	<div style='text-align:center;'>
+	<form action='".e_SELF."' id='imlistform' method='post' >
+	<table class='fborder' style='".ADMIN_WIDTH."'>
+	<tr><td class='fcaption' colspan='5'>".RSS_LAN_ADMIN_15."</td></tr>
+	<tr>
+		<td class='fcaption'>".RSS_LAN_ADMIN_16."</td>
+		<td class='fcaption'>".RSS_LAN_ADMIN_3."</td>
+		<td class='fcaption'>".RSS_LAN_ADMIN_4."</td>
+		<td class='fcaption'>".RSS_LAN_ADMIN_5."</td>
+		<td class='fcaption'>".RSS_LAN_ADMIN_12."</td>
+	</tr>";
+}
+if(!isset($RSS_ADMIN_IMPORT_TABLE)){
+	$RSS_ADMIN_IMPORT_TABLE = "
+	<tr>
+		<td class='forumheader3'>{RSS_ADMIN_IMPORT_CHECK}</td>
+		<td class='forumheader3'>{RSS_ADMIN_IMPORT_PATH}</td>
+		<td class='forumheader3'><b>{RSS_ADMIN_IMPORT_NAME}</b><br />{RSS_ADMIN_IMPORT_TEXT}</td>
+		<td class='forumheader3'>{RSS_ADMIN_IMPORT_URL}</td>
+		<td class='forumheader3'>{RSS_ADMIN_IMPORT_TOPICID}</td>
+	</tr>";
+}
+
+if(!isset($RSS_ADMIN_IMPORT_FOOTER)){
+	$RSS_ADMIN_IMPORT_FOOTER = "
+	<tr style='vertical-align:top'>
+		<td colspan='5' style='text-align:center' class='forumheader'>
+			<input class='button' type='submit' name='import_rss' value='".RSS_LAN_ADMIN_17."' />
+		</td>
+	</tr>
+	</table>
+	</form>
+	</div>";
+}
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_plugins/trackback/admin_config.php 0.7.7/e107_plugins/trackback/admin_config.php
--- 0.7.5/e107_plugins/trackback/admin_config.php	2005-06-19 03:37:54.000000000 -0500
+++ 0.7.7/e107_plugins/trackback/admin_config.php	2006-10-24 08:44:55.000000000 -0500
@@ -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.2 $
-|     $Date: 2005/06/19 08:37:54 $
-|     $Author: stevedunstan $
+|     $Revision: 1.3 $
+|     $Date: 2006/10/24 13:44:55 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -55,7 +55,7 @@
 <tr>
 <td style='width:50%' class='forumheader3'>".TRACKBACK_L8."</td>
 <td style='width:50%; text-align:right' class='forumheader3'>
-<input  size='50' class='tbox' type='text' name='trackbackString' value='".$pref['trackbackString']."'>
+<input  size='50' class='tbox' type='text' name='trackbackString' value='".$pref['trackbackString']."' />
 </td>
 </tr>
 
diff -ruN 0.7.5/e107_plugins/trackback/e_meta.php 0.7.7/e107_plugins/trackback/e_meta.php
--- 0.7.5/e107_plugins/trackback/e_meta.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_plugins/trackback/e_meta.php	2006-07-09 14:40:43.000000000 -0500
@@ -0,0 +1,21 @@
+<?php
+/*
++ ----------------------------------------------------------------------------------------------+
+|     e107 website system  : http://e107.org
+|     Steve Dunstan 2001-2002 : 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/trackback/e_meta.php,v $
+|     $Revision: 1.1 $
+|     $Date: 2006/07/09 19:40:43 $
+|     $Author: e107coders $
++-----------------------------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+
+if(isset($pref['trackbackEnabled'])){
+	echo "<link rel='pingback' href='".SITEURLBASE.e_PLUGIN_ABS."trackback/xmlrpc.php' />";
+}
+
+?>
+
diff -ruN 0.7.5/e107_plugins/trackback/modtrackback.php 0.7.7/e107_plugins/trackback/modtrackback.php
--- 0.7.5/e107_plugins/trackback/modtrackback.php	2005-02-22 12:20:53.000000000 -0600
+++ 0.7.7/e107_plugins/trackback/modtrackback.php	2006-06-26 03:26:44.000000000 -0500
@@ -11,23 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/modtrackback.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/02/22 18:20:53 $
-|     $Author: stevedunstan $
+|     $Revision: 1.2 $
+|     $Date: 2006/06/26 08:26:44 $
+|     $Author: asperon $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 
-
-
 if (!getperms("P") || !$pref['trackbackEnabled'])
 {
 	header("location:".e_BASE."index.php");
 	exit;
 }
 require_once(e_ADMIN."auth.php");
-$id = intval(e_QUERY);
-
 if (IsSet($_POST['moderate'])) {
 	extract($_POST);
 
@@ -43,8 +39,13 @@
 <form method='post' action='".e_SELF."?".e_QUERY."'>
 <table style='".ADMIN_WIDTH."' class='fborder'>";
 
+if (e_QUERY=='all') {
+	$res=$sql->db_Select("trackback", "*");
+} else {
+	$res=$sql->db_Select("trackback", "*", "trackback_pid=".intval(e_QUERY));
+}
 
-if (!$sql->db_Select("trackback", "*", "trackback_pid=$id"))
+if (!$res)
 {
 	$text .= "<tr><td class='forumheader3' style='text-align:center'>".TRACKBACK_L12.".</td></tr></table></form></div>";
 } 
@@ -62,8 +63,6 @@
 		</tr>\n";
 	}
 	$text .= "<tr><td colspan='5' class='forumheader' style='text-align:center'><input class='button' type='submit' name='moderate' value='".TRACKBACK_L13."' /></td></tr></table></form></div>";
-	
-		 
 }
 	
 $ns->tablerender(TRACKBACK_L13, $text);
diff -ruN 0.7.5/e107_plugins/trackback/plugin.php 0.7.7/e107_plugins/trackback/plugin.php
--- 0.7.5/e107_plugins/trackback/plugin.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_plugins/trackback/plugin.php	2006-11-04 13:26:24.000000000 -0600
@@ -11,20 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/plugin.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.4 $
+|     $Date: 2006/11/04 19:26:24 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."trackback/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."trackback/languages/English.php");
+include_lan(e_PLUGIN."trackback/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "Trackback";
-$eplug_version = "1.0";
+$eplug_version = "1.1";
 $eplug_author = "jalist";
 $eplug_url = "http://e107.org";
 $eplug_email = "jalist@e107.org";
@@ -32,31 +31,31 @@
 $eplug_compatible = "e107v0.7+";
 $eplug_readme = "";
 // leave blank if no readme file
-	
+
 // Name of the plugin's folder -------------------------------------------------------------------------------------
 $eplug_folder = "trackback";
-	
+
 // Mane of menu item for plugin ----------------------------------------------------------------------------------
 $eplug_menu_name = "";
-	
+
 // Name of the admin configuration file --------------------------------------------------------------------------
 $eplug_conffile = "admin_config.php";
-	
+
 // Icon image and caption text ------------------------------------------------------------------------------------
 $eplug_icon = $eplug_folder."/images/trackback_32.png";
 $eplug_icon_small = $eplug_folder."/images/trackback_16.png";
 $eplug_caption = TRACKBACK_L1;
-	
+
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array(
-"trackbackEnabled" => 0, 
+"trackbackEnabled" => 0,
 "trackbackString" => "<span class='smalltext'><b>".TRACKBACK_L11."</b></span>"
 );
-	
+
 // List of table names -----------------------------------------------------------------------------------------------
 $eplug_table_names = array(
 "trackback");
-	
+
 // List of sql requests to create tables -----------------------------------------------------------------------------
 $eplug_tables = array(
 "CREATE TABLE ".MPREFIX."trackback (
@@ -66,17 +65,21 @@
   trackback_excerpt varchar(250) NOT NULL default '',
   trackback_url varchar(150) NOT NULL default '',
   trackback_blogname varchar(150) NOT NULL default '',
-  PRIMARY KEY  (trackback_id)
+  PRIMARY KEY  (trackback_id),
+  KEY trackback_pid (trackback_pid)
 ) TYPE=MyISAM;");
-	
+
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
 $eplug_link_name = "";
 $ec_dir = "";
 $eplug_link_url = "";
-	
-	
+
+
 // Text to display after plugin successfully installed ------------------------------------------------------------------
 $eplug_done = TRACKBACK_L3;
-	
-?>
\ No newline at end of file
+$upgrade_alter_tables	= array(
+	"ALTER TABLE ".MPREFIX."trackback ADD INDEX (trackback_pid);"
+);
+
+?>
diff -ruN 0.7.5/e107_plugins/tree_menu/tree_menu.php 0.7.7/e107_plugins/tree_menu/tree_menu.php
--- 0.7.5/e107_plugins/tree_menu/tree_menu.php	2005-12-14 13:35:26.000000000 -0600
+++ 0.7.7/e107_plugins/tree_menu/tree_menu.php	2006-11-25 09:39:55.000000000 -0600
@@ -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.23 $
-|     $Date: 2005/12/14 19:35:26 $
-|     $Author: sweetas $
+|     $Revision: 1.26 $
+|     $Date: 2006/11/25 15:39:55 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,52 +28,62 @@
 - Add event onclick for div without subitem, and modify the existing events for items WITH subitems
 - Add a PHP function to read cookie (if existing) when page is loaded and restore menu status (writing or not window.onload js function)
 */
-	
+
 /* changes by jalist
 26/01/2005
 + complete rewrite
 + now uses single db query, links and sublinks are built into array
 */
-	
-include(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
-	
+
+
+global $tp;
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
+
 // Many thanks to Lolo Irie for fixing the javascript that drives this menu item
 unset($text);
-	
-$sql->db_Select("links", "*", "ORDER BY link_order ASC", "nowhere"); // get main category links
+
+$query = "SELECT * FROM #links WHERE link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC";
+$sql -> db_Select_gen($query);
 $linkArray = $sql->db_getList();
-	
+
 // all main links now held in array, we now need to loop through them and assign the sublinks to the correct parent links ...
-	
+
 $mainLinkArray = array();
 foreach($linkArray as $links) {
+
+// Updated to stop using the deprecated method of splitting the link-name in 3.
+// Now uses uses the link parent to determine the 'tree'.
+
 	extract ($links);
-	if (check_class($link_class)) {
-		if (!strstr($link_name, "submenu")) {
+		if ($link_parent == 0)
+		{
 			// main link - add to main array ...
-			$mainLinkArray[$link_name]['id'] = $link_id;
-			$mainLinkArray[$link_name]['name'] = strip_tags($link_name);
-			$mainLinkArray[$link_name]['url'] = $link_url;
-			$mainLinkArray[$link_name]['description'] = $link_description;
-			$mainLinkArray[$link_name]['image'] = $link_button;
-			$mainLinkArray[$link_name]['openMethod'] = $link_open;
-			$mainLinkArray[$link_name]['class'] = $link_class;
-		} else {
+			$mainLinkArray[$link_id]['id'] = $link_id;
+			$mainLinkArray[$link_id]['name'] = $tp->toHtml(strip_tags($link_name),"","defs");
+			$mainLinkArray[$link_id]['url'] = $link_url;
+			$mainLinkArray[$link_id]['description'] = $link_description;
+			$mainLinkArray[$link_id]['image'] = $link_button;
+			$mainLinkArray[$link_id]['openMethod'] = $link_open;
+			$mainLinkArray[$link_id]['class'] = $link_class;
+		}
+		else
+		{
 			// submenu - add to parent's array entry ...
-			list($null, $parent_name, $submenu_name) = explode(".", $link_name);
-			// get parent name ...
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['parent_name'] = $parent_name;
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['id'] = $link_id;
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['name'] = strip_tags($submenu_name);
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['url'] = $link_url;
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['description'] = $link_description;
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['image'] = $link_button;
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['openMethod'] = $link_open;
-			$mainLinkArray[$parent_name]['sublink'][$link_id]['class'] = $link_class;
+			$tmp = explode(".", $link_name);
+			$submenu_name = ($tmp[2]) ? $tmp[2] : $link_name;
+
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['parent_name'] = $link_parent;
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['id'] = $link_id;
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['name'] = $tp->toHtml(strip_tags($submenu_name));
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['url'] = $link_url;
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['description'] = $links['link_description'];
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['image'] = $link_button;
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['openMethod'] = $link_open;
+			$mainLinkArray[$link_parent]['sublink'][$link_id]['class'] = $link_class;
 		}
-	}
+
 }
-	
+
 // ok, now all mainlinks and sublinks are held in the array, now we have to loop through and build the text to send to screen ...
 
 $text = "";
@@ -81,11 +91,12 @@
 	extract ($links);
 	if (array_key_exists("sublink", $links) && $links['name'] != "") {
 		// sublinks found ...
+
 		$url = "javascript:void(0);";
-		$spanName = str_replace(" ", "_", $name);
+		$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";
-		$text .= ($menu_pref['tm_spacer'] ? "<div class='spacer'>".$plink."</div>\n" : $plink);
+		$text .= ($menu_pref['tm_spacer'] ? "<div class='spacer'>\n".$plink."\n</div>\n" : $plink);
 	} else {
 		// no sublinks found ...
 		if($links['name'])
@@ -94,27 +105,29 @@
 			$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>";
-			$text .= ($menu_pref['tm_spacer'] ? "<div class='spacer'>".$plink."</div>\n" : $plink);
+			$text .= ($menu_pref['tm_spacer'] ? "<div class='spacer'>\n".$plink."\n</div>\n" : $plink);
 		}
 	}
-	 
+
 	$c = 0;
 	if (array_key_exists("sublink", $links) && $links['name'] != "" ) {
-		$text .= "<span style=\"display:none\" id=\"span_".$spanName."\">\n";
+
+		$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; ");
-			$spanName = str_replace(" ", "_", $parent_name);
-			 
+			$spanName = $parent_name;
+
 			$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>" : $plink);
+			$text .=($menu_pref['tm_class3'] ? "<span".($menu_pref['tm_class3'] ? " class='{$menu_pref['tm_class3']}'" : "").">".$plink."</span>\n\n" : $plink);
 		}
 		$text .= "</span>\n";
 	}
-	 
+
 }
-	
+
 function setlink($link_name, $link_url, $link_open, $link_description) {
+	global $tp;
 	switch ($link_open) {
 		case 1:
 		$link_append = "rel='external'";
@@ -128,9 +141,12 @@
 		default:
 		$link_append = '';
 	}
+	
 	if (!strstr($link_url, "http:") && !strstr($link_url, "void") && strpos($link_url, "mailto:") !== 0) {
 		$link_url = e_BASE.$link_url;
 	}
+	$link_url =	$tp->replaceConstants($link_url, $nonrelative = TRUE, $all = false);
+
 	if ($link_open == 4) {
 		$link = "<a style='text-decoration:none' title='".$link_description."' href=\"javascript:open_window('".$link_url."')\">".$link_name."</a>\n";
 	} else {
@@ -138,7 +154,7 @@
 	}
 	return $link;
 }
-	
+
 (isset($_COOKIE["treemenustatus"]) && $_COOKIE["treemenustatus"]) ? $treemenustatus = $_COOKIE["treemenustatus"] : $treemenustatus = "0";
 $text .= "
 	<script type='text/javascript'>
@@ -154,7 +170,7 @@
 	clearcook();
 	}
 	}\n
-	 
+
 	function clearcook(){
 	var expireDate = new Date;
 	expireDate.setMinutes(expireDate.getMinutes()+10);
@@ -162,11 +178,11 @@
 	}\n
 	//-->\n
 	";
-	
+
 (($treemenustatus != "0" && isset($treemenustatus))?$text .= "window.onload=document.getElementById('span_".$treemenustatus."').style.display=''":"");
-	
+
 $text .= "</script>
 	";
-$ns->tablerender(LAN_183, $text, 'tree_menu');
-	
+$ns->tablerender(LAN_SITELINKS_183, $text, 'tree_menu');
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/crahan/style.css 0.7.7/e107_themes/crahan/style.css
--- 0.7.5/e107_themes/crahan/style.css	2006-04-12 13:33:50.000000000 -0500
+++ 0.7.7/e107_themes/crahan/style.css	2006-11-09 03:45:37.000000000 -0600
@@ -158,7 +158,10 @@
 img {
 	vertical-align: middle;
 }
-
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
+}
 
 
 
@@ -181,7 +184,7 @@
 	color: #444;
 }
 
-.button {	
+.button {
 	border: #000 1px solid;
 	color: #000;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
@@ -299,11 +302,10 @@
 	border: #c1c1c1 1px solid;
 }
 .forumheader{
-	background-color: #f3f3f7;
+	background-color: #ced6db;
 	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
 	color:#000;
 	padding: 4px;
-	background-image : url('../e107_images/forum/fcap2.png');
 	border: 1px solid #ececf2;
 }
 
@@ -340,7 +342,11 @@
 	color:#000;
 	padding: 4px;
 	border: 1px solid #C3BDBD;
-	background-image : url('../e107_images/forum/finfobar.png');font-style:normal; font-variant:normal; font-weight:normal; font-size:11px; font-family:verdana, tahoma, arial, helvetica, sans-serif
+	font-style:normal;
+	font-variant:normal;
+	font-weight:normal;
+	font-size:11px;
+	font-family:verdana, tahoma, arial, helvetica, sans-serif
 }
 
 .helpbox {
@@ -460,7 +466,7 @@
 	border: #5e5d63 1px solid;
 	color: #000000;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	padding: 2px -2px 2px 2px;
+	padding: 2px 0px 2px 2px;
 }
 
 .treeclass2 {
@@ -468,7 +474,7 @@
 	border: #000 1px solid;
 	color: #000000;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	padding: 2px -2px 2px 2px;
+	padding: 2px 0px 2px 2px;
 }
 
 .treeclass3 {
diff -ruN 0.7.5/e107_themes/e107v4a/forum_template.php 0.7.7/e107_themes/e107v4a/forum_template.php
--- 0.7.5/e107_themes/e107v4a/forum_template.php	2006-01-15 13:08:25.000000000 -0600
+++ 0.7.7/e107_themes/e107v4a/forum_template.php	2006-11-09 12:19:47.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/e107v4a/forum_template.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/01/15 19:08:25 $
+|     $Revision: 1.14 $
+|     $Date: 2006/11/09 18:19:47 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -21,6 +21,7 @@
 
 $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}" : "");
 
 $FORUMSTART = "
 <table style='width:100%' class='nforumholder' cellpadding='0' cellspacing='0'>
@@ -69,7 +70,7 @@
 </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{EXTENDED=location.text}: {EXTENDED=location.value}<br />\n{POSTS}\n</span>\n</td>
+<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>
 </tr>
 <tr>
@@ -101,7 +102,7 @@
 </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{EXTENDED=location.text}: {EXTENDED=location.value}<br />\n{POSTS}\n</span>\n</td>
+<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>
 </tr>
 <tr>
@@ -192,6 +193,8 @@
 </table>
 ";
 
+$sc_style['PAGES']['pre'] = "<span class='smalltext'>";
+$sc_style['PAGES']['post'] = "</span>";
 
 $FORUM_VIEW_FORUM = "
 <tr>
@@ -200,7 +203,7 @@
 
 <table style='width:100%'>
 <tr>
-<td style='width:90%'><span class='mediumtext'><b>{THREADNAME}</b></span> <span class='smalltext'>{PAGES}</span></td>
+<td style='width:90%'><span class='mediumtext'><b>{THREADNAME}</b></span> {PAGES}</td>
 <td style='width:10%; white-space:nowrap;'>{ADMIN_ICONS}</td>
 </tr>
 </table>
@@ -212,12 +215,14 @@
 <td style='vertical-align:top; text-align:center; width:20%' class='nforumview2'><span class='smalltext'>{LASTPOST}</span></td>
 </tr>";
 
+$sc_style['THREADPAGES']['pre'] = "<span class='mediumtext'>";
+$sc_style['THREADPAGES']['post'] = "</span>";
 
 $FORUM_VIEW_END = "
 </table>
 <table style='width:100%'>
 <tr>
-<td style='width:80%'><span class='mediumtext'>{THREADPAGES}</span>
+<td style='width:80%'>{THREADPAGES}
 {FORUMJUMP}
 </td>
 <td style='width:20%; text-align:right'>
diff -ruN 0.7.5/e107_themes/e107v4a/style.css 0.7.7/e107_themes/e107v4a/style.css
--- 0.7.5/e107_themes/e107v4a/style.css	2005-03-21 04:50:44.000000000 -0600
+++ 0.7.7/e107_themes/e107v4a/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -370,4 +370,8 @@
 	background-color: #E4EAF2;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
 	color: #3A4F6C;
+}
+
+.linkspage_button{
+	border:0px;
 }
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/e107v4a/theme.php 0.7.7/e107_themes/e107v4a/theme.php
--- 0.7.5/e107_themes/e107v4a/theme.php	2006-05-05 17:44:39.000000000 -0500
+++ 0.7.7/e107_themes/e107v4a/theme.php	2006-07-04 14:09:52.000000000 -0500
@@ -11,23 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/e107v4a/theme.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/05/05 22:44:39 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.19 $
+|     $Date: 2006/07/04 19:09:52 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."e107v4a/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."e107v4a/languages/English.php");
+include_lan(e_THEME."e107v4a/languages/".e_LANGUAGE.".php");
 
 
 // [theme]
 
 $themename = "e107.v4";
-$themeversion = "2.0";
+$themeversion = "2.01";
 $themeauthor = "Steve Dunstan [jalist]";
 $themeemail = "jalist@e107.org";
 $themewebsite = "http://e107.org";
@@ -231,17 +230,6 @@
 }
 
 
-$POLLSTYLE = <<< EOF
-<b>Poll:</b> {QUESTION}
-<br /><br />
-{OPTIONS=<span class='alttd'>OPTION</span><br />BAR<br /><span class='smalltext'>PERCENTAGE VOTES</span><br />\n}
-<div style='text-align:center' class='smalltext'>{VOTE_TOTAL} {COMMENTS}
-<br />
-{OLDPOLLS}
-</div>
-EOF;
-
-
 $COMMENTSTYLE = "
 <div style='text-align:center'>
 <table style='width:100%'>
diff -ruN 0.7.5/e107_themes/human_condition/style.css 0.7.7/e107_themes/human_condition/style.css
--- 0.7.5/e107_themes/human_condition/style.css	2005-03-21 05:13:48.000000000 -0600
+++ 0.7.7/e107_themes/human_condition/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -21,12 +21,12 @@
 	color: #093860;
 }
 
-#rap { 
+#rap {
   	margin-left: auto;
   	margin-right: auto;
-  	width: 749px; 
-} 
-	
+  	width: 749px;
+}
+
 #header {
 	background: url(images/header.png) repeat-x;
 	height: 80px;
@@ -34,7 +34,7 @@
 	margin: 0 auto;
 	text-align: left;
 }
-	
+
 #header a {
 	text-decoration: none;
 	font-size: 18pt;
@@ -43,16 +43,16 @@
 	left: 10px;
 	font-family: verdana, arial, helvetica, geneva, sans-serif;
 }
-	
+
 #header a:visited {
 	color: #3F729E;
 }
-	
+
 #header a:hover {
 	color: #093860;
 }
 
-.wrapper { 
+.wrapper {
 	width: 100%;
 	margin-left: auto;
   	margin-right: auto;
@@ -60,7 +60,7 @@
 
 #menu {
 	width: 170px;
-	margin-left: 575px; 
+	margin-left: 575px;
 	text-align: left;
 	margin-top: 7px;
 	margin-bottom: 20px;
@@ -70,11 +70,11 @@
 	text-decoration: none;
 	font-family: verdana, arial, helvetica, geneva, sans-serif;
 }
-	
+
 #menu a:visited {
 	color: #3F729E;
 }
-	
+
 #menu a:hover {
 	color: #093860;
 }
@@ -102,7 +102,7 @@
 	font-size: 8pt;
 	margin-top: 15px;
 	padding: 5px;
-	border: 1px solid #D7D7D7; 
+	border: 1px solid #D7D7D7;
 	background: #EAEAEA;
 	width: 150px;
 /*	margin-left: 20px;*/
@@ -130,11 +130,11 @@
 	font-size: 13px;
 	margin: 5px 0 0 0;
 }
-	
+
 .textstyle4 a:link {
 	color: #000;
 }
-	
+
 .textstyle4 a:visited {
 	color: #000;
 	text-decoration: none;
@@ -150,7 +150,7 @@
 	padding-left: 5px;
 	text-align: justify;
 	}
-	
+
 .textstyle3 a:hover {
 	background: #EFF8FF;
 }
@@ -278,7 +278,7 @@
 	border-right: #333A4B 1px solid;
 	border-top: #7180A6 1px solid;
 	letter-spacing: 0.1em;
-	cursor:pointer 
+	cursor:pointer
 }
 
 .button a{
@@ -340,7 +340,7 @@
 .fborder {
 	border: 1px solid #c3bdbd;
 	background-color: #fff;
-	
+
 }
 .forumheader{
 	background-color: #EBEFF2;
@@ -348,7 +348,6 @@
 	font-size: 11px;
 	color:#000;
 	padding: 4px;
-	background-image : url('../e107_images/forum/fcap2.png');
 	border: 1px solid #C3BDBD;
 }
 
@@ -402,7 +401,9 @@
 	color:#000;
 	padding: 4px;
 	border: 1px solid #C3BDBD;
-	background-image : url('../e107_images/forum/finfobar.png');font-style:normal; font-variant:normal; font-weight:normal; font-size:11px; font-family:verdana, tahoma, arial, helvetica, sans-serif
+	font-style:normal; font-variant:normal;
+	font-weight:normal; font-size:11px;
+	font-family:verdana, tahoma, arial, helvetica, sans-serif
 }
 
 a.forumlink{
@@ -415,4 +416,7 @@
 	background-color: transparent;
 	color:#000;
 	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
+}
+.linkspage_button{
+	border:0px;
 }
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/interfectus/style.css 0.7.7/e107_themes/interfectus/style.css
--- 0.7.5/e107_themes/interfectus/style.css	2005-03-21 05:26:42.000000000 -0600
+++ 0.7.7/e107_themes/interfectus/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -1,5 +1,3 @@
-
-
 body {
 	background-image: url(images/background.jpg); color: #ffffff; background-color: #333333; text-align: left; font: 8pt Tahoma, Verdana, Arial, Helvetica, sans-serif; color: #555; margin: 12px 0 0 0;
 }
@@ -51,11 +49,6 @@
 }
 
 
-
-
-
-
-
 #collefttop {
 	background-image: url(images/topleftcol.png);
 	width: 14px;
@@ -216,6 +209,10 @@
 img {
 	vertical-align: middle;
 }
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
+}
 
 .smalltext {
 	font: 7pt Tahoma, Verdana, Arial, Helvetica, sans-serif;
@@ -325,11 +322,6 @@
 	margin: 0px;
 }
 
-
-
-
-
-
 .tbox {
 	background-color: #000;
 	border: 1px solid #3e3e3e;
@@ -425,4 +417,8 @@
 .nextprev {
 	font: 7pt tahoma, verdana, arial, helvetica, sans-serif;
 	color:#b47716;
-}
\ No newline at end of file
+}
+
+#Clock {
+color: #ffb432;
+}
diff -ruN 0.7.5/e107_themes/jayya/admin_template.php 0.7.7/e107_themes/jayya/admin_template.php
--- 0.7.5/e107_themes/jayya/admin_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_themes/jayya/admin_template.php	2006-11-14 12:45:22.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/admin_template.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2005/12/14 19:28:52 $
+|     $Revision: 1.19 $
+|     $Date: 2006/11/14 18:45:22 $
 |     $Author: sweetas $
 +----------------------------------------------------------------------------+
 */
@@ -34,7 +34,11 @@
 
 // [layout]
 
-$ADMIN_HEADER = "<table class='top_section'>
+$ADMIN_HEADER = "<table class='page_container'>
+<tr>
+<td>
+
+<table class='top_section'>
 <tr>
 <td class='top_section_left' style='padding-left: 5px; padding-right: 5px'>
 {ADMIN_LOGO}
@@ -131,6 +135,9 @@
 {ADMIN_CREDITS}
 <br />
 </div>
+</td>
+</tr>
+</table>
 ";
 
 
diff -ruN 0.7.5/e107_themes/jayya/canvas.css 0.7.7/e107_themes/jayya/canvas.css
--- 0.7.5/e107_themes/jayya/canvas.css	2005-06-16 03:04:19.000000000 -0500
+++ 0.7.7/e107_themes/jayya/canvas.css	2006-11-28 20:30:51.000000000 -0600
@@ -40,6 +40,10 @@
 	border: 0px;
 }
 
+.linkspage_button {
+	border: 0px;
+}
+
 form {
 	margin: 0px;
 }
@@ -118,8 +122,18 @@
 	margin-bottom: 0px;
 }
 
+.helpbox {
+	border: 0px;
+}
+
 /* Theme Specific Classes */
 
+.page_container {
+	width: 100%;
+	border-collapse: collapse;
+	border-spacing: 0px;
+}
+
 .top_section, .main_section {
 	width: 100%;
 	background-color: #fff;
diff -ruN 0.7.5/e107_themes/jayya/languages/English.php 0.7.7/e107_themes/jayya/languages/English.php
--- 0.7.5/e107_themes/jayya/languages/English.php	2005-06-23 12:46:30.000000000 -0500
+++ 0.7.7/e107_themes/jayya/languages/English.php	2006-10-12 08:46:33.000000000 -0500
@@ -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.2 $
-|     $Date: 2005/06/23 17:46:30 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/10/12 13:46:33 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,8 +21,8 @@
 define("LAN_THEME_2", "Read/Post Comment: ");
 define("LAN_THEME_3", "Read the rest...");
 define("LAN_THEME_4", "Trackbacks: ");
-define("LAN_THEME_5", "Posted by");
-define("LAN_THEME_6", "on");
+define("LAN_THEME_5", "Posted by ");
+define("LAN_THEME_6", "on ");
 
 
 ?>
diff -ruN 0.7.5/e107_themes/jayya/pepper.css 0.7.7/e107_themes/jayya/pepper.css
--- 0.7.5/e107_themes/jayya/pepper.css	2005-06-16 03:04:19.000000000 -0500
+++ 0.7.7/e107_themes/jayya/pepper.css	2006-11-28 20:30:51.000000000 -0600
@@ -35,6 +35,10 @@
 	border: 0px;
 }
 
+.linkspage_button {
+	border: 0px;
+}
+
 form {
 	margin: 0px;
 }
@@ -113,8 +117,18 @@
 	margin-bottom: 0px;
 }
 
+.helpbox {
+	border: 0px;
+}
+
 /* Theme Specific Classes */
 
+.page_container {
+	width: 100%;
+	border-collapse: collapse;
+	border-spacing: 0px;
+}
+
 .top_section, .main_section {
 	width: 100%;
 	background-color: #fff;
diff -ruN 0.7.5/e107_themes/jayya/style.css 0.7.7/e107_themes/jayya/style.css
--- 0.7.5/e107_themes/jayya/style.css	2006-04-12 16:13:53.000000000 -0500
+++ 0.7.7/e107_themes/jayya/style.css	2006-11-28 20:30:52.000000000 -0600
@@ -33,7 +33,11 @@
 	color: #000000;
 }
 
-img {	
+img {
+	border: 0px;
+}
+
+.linkspage_button {
 	border: 0px;
 }
 
@@ -121,6 +125,12 @@
 
 /* Theme Specific Classes */
 
+.page_container {
+	width: 100%;
+	border-collapse: collapse;
+	border-spacing: 0px;
+}
+
 .top_section, .main_section {
 	width: 100%;
 	background-color: #fff;
@@ -234,7 +244,7 @@
 }
 
 .news_info {
-	width: *;
+	width: auto;
 	background-color: #f7f7f9;
 	border-collapse: collapse;
 	border-spacing: 0px;
@@ -341,4 +351,4 @@
 
 a.menuItem.header {
 	border-bottom: 1px solid #b3b3b3;
-}
+}
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/jayya/theme.php 0.7.7/e107_themes/jayya/theme.php
--- 0.7.5/e107_themes/jayya/theme.php	2006-04-26 08:41:54.000000000 -0500
+++ 0.7.7/e107_themes/jayya/theme.php	2006-11-14 12:45:22.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/theme.php,v $
-|     $Revision: 1.53 $
-|     $Date: 2006/04/26 13:41:54 $
+|     $Revision: 1.55 $
+|     $Date: 2006/11/14 18:45:22 $
 |     $Author: sweetas $
 +----------------------------------------------------------------------------+
 */
@@ -47,7 +47,11 @@
 
 $layout = "_default";
 
-$HEADER = "<table class='top_section'>
+$HEADER = "<table class='page_container'>
+<tr>
+<td>
+
+<table class='top_section'>
 <tr>
 <td class='top_section_left' style='width: 190px; padding-left: 5px; padding-right: 5px'>
 {LOGO}
@@ -69,7 +73,7 @@
 <table class='main_section'>
 <tr style='display: none'>
 <td style='width: 170px'></td>
-<td style='width: *'></td>
+<td style='width: auto'></td>
 <td style='width: 170px'></td>
 </tr>
 
@@ -101,6 +105,9 @@
 {SITEDISCLAIMER}
 <br /><br />
 </div>
+</td>
+</tr>
+</table>
 ";
 
 
@@ -141,9 +148,9 @@
 {NEWSICON}
 </td>
 <td style='width: 100%; padding: 0px; padding-bottom: 0px; padding-left: 2px'>
-".LAN_THEME_5." 
+".LAN_THEME_5."
 {NEWSAUTHOR}
- ".LAN_THEME_6." 
+ ".LAN_THEME_6."
 {NEWSDATE}
 </td><td style='text-align: center; padding: 3px; padding-bottom: 0px; white-space: nowrap'>
 <img src='".THEME_ABS."images/comments_16.png' style='width: 16px; height: 16px' alt='' />
@@ -186,9 +193,9 @@
 		$bodybreak = '<br />';
 		$but_border = '';
 	}
-	
+
 	$menu .= ($style && $style != 'default') ? ' non_default' : '';
-	
+
 	echo "<div class='cap_border".$but_border."'>";
 	if ($style == 'leftmenu') {
 		echo "<div class='left_caption'><div class='bevel'>".$caption."</div></div>";
@@ -244,7 +251,7 @@
 <td style='width: 80%; vertical-align: top' class='forumheader3'>
 {COMMENT}
 {RATING}
-{SIGNATURE} 
+{SIGNATURE}
 </td>
 </tr>
 {COMMENTEDIT}
@@ -261,4 +268,4 @@
 {OLDPOLLS}
 </div>";
 
-?>
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/khatru/forum_post_template.php 0.7.7/e107_themes/khatru/forum_post_template.php
--- 0.7.5/e107_themes/khatru/forum_post_template.php	2005-12-21 11:03:51.000000000 -0600
+++ 0.7.7/e107_themes/khatru/forum_post_template.php	2006-10-24 08:36:10.000000000 -0500
@@ -1,114 +1,114 @@
-<?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_post_template.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/21 17:03:51 $
-|     $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_post_template.php,v $
+|     $Revision: 1.5 $
+|     $Date: 2006/10/24 13:36:10 $
+|     $Author: mrpete $
++----------------------------------------------------------------------------+
+*/
+
 if (!defined('e107_INIT')) { exit; }
 
-// 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.
-
-$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>";
-
-$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 ...
-
-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 ...
-
-$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'))."
-<br />
-
-<div id='fiupsection'>
-<span id='fiupopt'><input class='tbox' name='file_userfile[]' type='file' size='47'></span>
-</div>
-<input class='button' type='button' name='addoption' value='".LAN_417."' onclick=\"duplicateHTML('fiupopt','fiupsection')\" />
-</td>
-</tr>
-</td>
-</tr>";
-
-
-// ------------
-
-
-$FORUMPOST = "
-{FORMSTART}
-".BOXOPEN."{BACKLINK}".BOXMAIN."
-
-<div style='text-align:center'>
-<table style='width:100%' class='fborder'>
-{USERBOX}
-{SUBJECTBOX}
-<tr>
-<td class='forumheader2' style='width:20%; vertical-align:top;'>{POSTTYPE}</td>
-<td style='width:80%'>
-{POSTBOX}<br />{EMOTES}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
-</td>
-</tr>
-{POLL}
-{FILEATTACH}
-<tr style='vertical-align:top'>
-<td colspan='2' class='nforumcaption2' style='text-align:center'>
-{BUTTONS}
-</table>
-{FORMEND}
-</div>
-{FORUMJUMP}".BOXCLOSE;
-
-
-$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'>
-<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;
-
-
-$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'>
-<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;
-
-
-
+// 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.
+
+$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>";
+
+$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 ...
+
+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 ...
+
+$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'))."
+<br />
+
+<div id='fiupsection'>
+<span id='fiupopt'><input class='tbox' name='file_userfile[]' type='file' size='47' /></span>
+</div>
+<input class='button' type='button' name='addoption' value='".LAN_417."' onclick=\"duplicateHTML('fiupopt','fiupsection')\" />
+</td>
+</tr>
+</td>
+</tr>";
+
+
+// ------------
+
+
+$FORUMPOST = "
+{FORMSTART}
+".BOXOPEN."{BACKLINK}".BOXMAIN."
+
+<div style='text-align:center'>
+<table style='width:100%' class='fborder'>
+{USERBOX}
+{SUBJECTBOX}
+<tr>
+<td class='forumheader2' style='width:20%; vertical-align:top;'>{POSTTYPE}</td>
+<td style='width:80%'>
+{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
+</td>
+</tr>
+{POLL}
+{FILEATTACH}
+<tr style='vertical-align:top'>
+<td colspan='2' class='nforumcaption2' style='text-align:center'>
+{BUTTONS}
+</table>
+{FORMEND}
+</div>
+{FORUMJUMP}".BOXCLOSE;
+
+
+$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'>
+<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;
+
+
+$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'>
+<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;
+
+
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/khatru/style.css 0.7.7/e107_themes/khatru/style.css
--- 0.7.5/e107_themes/khatru/style.css	2006-01-14 19:15:01.000000000 -0600
+++ 0.7.7/e107_themes/khatru/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -473,4 +473,9 @@
 	height: 2px;
 	width: 99%;
 	text-align:center;
+}
+
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
 }
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/kubrick/style.css 0.7.7/e107_themes/kubrick/style.css
--- 0.7.5/e107_themes/kubrick/style.css	2006-01-26 20:30:59.000000000 -0600
+++ 0.7.7/e107_themes/kubrick/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -84,6 +84,10 @@
 	border: none;
 	}
 
+.linkspage_button{
+	border:0px;
+}
+
 .hidden{
 	display:none;
 }
diff -ruN 0.7.5/e107_themes/lamb/chat_template.php 0.7.7/e107_themes/lamb/chat_template.php
--- 0.7.5/e107_themes/lamb/chat_template.php	2005-12-14 13:28:52.000000000 -0600
+++ 0.7.7/e107_themes/lamb/chat_template.php	2006-06-05 14:44:05.000000000 -0500
@@ -7,7 +7,7 @@
 		$CHAT_TABLE_START = "";
 }
 if(!$CHAT_TABLE){
-		$CHAT_TABLE = "<div class='spacer'>\n<div class='indent'>\n<span class='defaulttext'><img src='".THEME."images/bullet2.gif' alt='bullet' /> \n<b>{CHAT_TABLE_NICK}</b></span>\n<span class='smalltext'>".LAN_13." {CHAT_TABLE_DATESTAMP}</span><br />\n<div class='spacer'>{CHAT_TABLE_MESSAGE}</div>\n</div>\n</div>\n";
+		$CHAT_TABLE = "<div class='spacer'>\n<div class='indent'>\n<span class='defaulttext'><img src='".THEME."images/bullet2.gif' alt='bullet' /> \n<b>{CHAT_TABLE_NICK}</b></span>\n<span class='smalltext'>".CHATBOX_L22." {CHAT_TABLE_DATESTAMP}</span><br />\n<div class='spacer'>{CHAT_TABLE_MESSAGE}</div>\n</div>\n</div>\n";
 }
 if(!$CHAT_TABLE_END){
 		$CHAT_TABLE_END = "";
diff -ruN 0.7.5/e107_themes/lamb/forum_post_template.php 0.7.7/e107_themes/lamb/forum_post_template.php
--- 0.7.5/e107_themes/lamb/forum_post_template.php	2005-12-21 11:03:51.000000000 -0600
+++ 0.7.7/e107_themes/lamb/forum_post_template.php	2006-10-24 08:45:10.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/forum_post_template.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2005/12/21 17:03:51 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2006/10/24 13:45:10 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 
@@ -49,7 +49,7 @@
 <br />
 
 <div id='fiupsection'>
-<span id='fiupopt'><input class='tbox' name='file_userfile[]' type='file' size='47'></span>
+<span id='fiupopt'><input class='tbox' name='file_userfile[]' type='file' size='47' /></span>
 </div>
 <input class='button' type='button' name='addoption' value='".LAN_417."' onclick=\"duplicateHTML('fiupopt','fiupsection')\" />
 </td>
@@ -73,7 +73,7 @@
 <tr>
 <td class='forumheader2' style='width:20%'>{POSTTYPE}</td>
 <td class='forumheader2' style='width:80%'>
-{POSTBOX}<br />{EMOTES}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
+{POSTBOX}<br />{EMAILNOTIFY}<br />{POSTTHREADAS}
 </td>
 </tr>
 
diff -ruN 0.7.5/e107_themes/lamb/style.css 0.7.7/e107_themes/lamb/style.css
--- 0.7.5/e107_themes/lamb/style.css	2006-04-18 02:38:02.000000000 -0500
+++ 0.7.7/e107_themes/lamb/style.css	2006-11-09 03:45:37.000000000 -0600
@@ -111,12 +111,12 @@
 	text-align: center;
 }
 
-#bqcontent { 
-  margin-left: 4px; 
+#bqcontent {
+  margin-left: 4px;
 }
 
 #bqtext {
-  font-size: 10px; 
+  font-size: 10px;
   color: #666;
 }
 
@@ -169,6 +169,11 @@
 	vertical-align: middle;
 }
 
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
+}
+
 .dlmain {
 	font: 20px tahoma, verdana, helvetica, arial, sans-serif;
 	color: #000;
@@ -204,7 +209,7 @@
 	color: #000;
 }
 
-.button {	
+.button {
 	border: #000 1px solid;
 	color: #000;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
@@ -229,13 +234,13 @@
 	text-align:left
 }
 a {
-	color: #0085b0; 
-	font-family: verdana, arial, sans-serif; 
+	color: #0085b0;
+	font-family: verdana, arial, sans-serif;
 	text-decoration: underline;
 }
 a:hover {
 	color: #616060;
-	font-family: verdana, arial, sans-serif; 
+	font-family: verdana, arial, sans-serif;
 	text-decoration: underline;
 }
 
@@ -332,7 +337,6 @@
 	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
 	color:#000;
 	padding: 4px;
-	background-image : url('../e107_images/forum/fcap2.png');
 	border: 1px solid #ececf2;
 }
 
@@ -369,7 +373,7 @@
 	color:#000;
 	padding: 4px;
 	border: 1px solid #C3BDBD;
-	background-image : url('../e107_images/forum/finfobar.png');font-style:normal; font-variant:normal; font-weight:normal; font-size:11px; font-family:verdana, tahoma, arial, helvetica, sans-serif
+	font-style:normal; font-variant:normal; font-weight:normal; font-size:11px; font-family:verdana, tahoma, arial, helvetica, sans-serif
 }
 
 .helpbox {
@@ -489,7 +493,7 @@
 	border: #5e5d63 1px solid;
 	color: #000000;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	padding: 2px -2px 2px 2px;
+	padding: 2px 0px 2px 2px;
 }
 
 .treeclass2 {
@@ -497,7 +501,7 @@
 	border: #000 1px solid;
 	color: #000000;
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	padding: 2px -2px 2px 2px;
+	padding: 2px 0px 2px 2px;
 }
 
 .treeclass3 {
@@ -506,4 +510,4 @@
 	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
 	padding: 1px;
 	width: 100%;
-}
+}
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/leaf/languages/English.php 0.7.7/e107_themes/leaf/languages/English.php
--- 0.7.5/e107_themes/leaf/languages/English.php	2005-07-27 01:19:47.000000000 -0500
+++ 0.7.7/e107_themes/leaf/languages/English.php	2006-11-29 00:17:57.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.1 $
-|     $Date: 2005/07/27 06:19:47 $
-|     $Author: qnome $
+|     $Revision: 1.2 $
+|     $Date: 2006/11/29 06:17:57 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,6 +23,8 @@
 define("LAN_THEME_4", "Read the rest ...");
 define("LAN_THEME_5", "Trackbacks: ");
 define("LAN_THEME_6", "Comment by");
+define("LAN_THEME_7", "News");
+
 
 
 ?>
diff -ruN 0.7.5/e107_themes/leaf/links.sc 0.7.7/e107_themes/leaf/links.sc
--- 0.7.5/e107_themes/leaf/links.sc	2005-10-16 03:07:01.000000000 -0500
+++ 0.7.7/e107_themes/leaf/links.sc	2006-10-25 20:53:20.000000000 -0500
@@ -5,7 +5,6 @@
 <ul>
 <li><a href='http://www.e107.org' title='e107 CMS official website'>e107 CMS official site</a></li>
 <li><a href='http://e107coders.org' title='e107 CMS coders site'>e107 CMS coders site</a></li>
-<li><a href='http://e107styles.org' title='e107 CMS styles site'>Get more e107 styles!</a></li>
 <li><a href='http://e107themes.com' title='e107 Style Enlightenment'>e107 Style Enlightenment</a></li>
 <li><a href='http://www.stanch.net' title='The orig designer of this skin'>Orig Designer of this skin</a></li>
 <li><a href='http://e107.net' title='William Moffett aka Que~'>Current Designer's site</a></li>
diff -ruN 0.7.5/e107_themes/leaf/style.css 0.7.7/e107_themes/leaf/style.css
--- 0.7.5/e107_themes/leaf/style.css	2005-10-16 03:06:15.000000000 -0500
+++ 0.7.7/e107_themes/leaf/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -15,6 +15,10 @@
 	border: none;
 }
 
+.linkspage_button{
+	border:0px;
+}
+
 td{
 	text-align:left;
 }
diff -ruN 0.7.5/e107_themes/leaf/theme.php 0.7.7/e107_themes/leaf/theme.php
--- 0.7.5/e107_themes/leaf/theme.php	2006-01-12 03:52:21.000000000 -0600
+++ 0.7.7/e107_themes/leaf/theme.php	2006-11-29 00:17:57.000000000 -0600
@@ -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.15 $
-|     $Date: 2006/01/12 09:52:21 $
-|     $Author: lisa_ $
+|     $Revision: 1.17 $
+|     $Date: 2006/11/29 06:17:57 $
+|     $Author: e107coders $
 +---------------------------------------------------------------+
 */
 
@@ -108,7 +108,7 @@
     <div class='contentdiv'><!--Start Contentdiv-->
         <div class='div".e_PAGECLASS."'>
         <!--Database Generated Content-->
-	".(e_PAGECLASS == "news" ? "<h2>".PAGE_NAME."</h2>" : "")."";
+	".(e_PAGECLASS == "news" ? "<h2>".LAN_THEME_7."</h2>" : "")."";
 
 
 $FOOTER = "<!--End Database Generated Content-->
@@ -190,10 +190,10 @@
 	        <div class='itemdetails'>
 	          <span class='item1'>{NEWSAUTHOR}</span>&nbsp;
 	          <span class='item2'>{NEWSCATEGORY}</span>&nbsp;
-	          <span class='item3'>{NEWSCOMMENTS}</span>
-	          <span class='item4'>{EMAILICON}</span>
-	          <span class='item5'>{PRINTICON}</span>
-	          <span class='item5'>{PDFICON}</span>
+	          <span class='item3'>{NEWSCOMMENTS}&nbsp;</span>
+	          <span class='item4'>{EMAILICON}&nbsp;</span>
+	          <span class='item5'>{PRINTICON}&nbsp;</span>
+	          <span class='item5'>{PDFICON}&nbsp;</span>
 	        </div>
 	        </div><!-- end news item -->";
 	return $NEWSSTYLE;
@@ -205,7 +205,7 @@
 define("ICONSTYLE", "border:0");
 define("COMMENTLINK", LAN_THEME_1);
 define("COMMENTOFFSTRING", LAN_THEME_2);
-define("EXTENDEDSTRING", LAN_THEME_3);
+define("EXTENDEDSTRING", LAN_THEME_4);
 
 // [linkstyle]
 define(PRELINK, "");
@@ -256,4 +256,4 @@
 // [chatboxstyle]
 $CHATBOXSTYLE = "";
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_themes/leaf/ul.sc 0.7.7/e107_themes/leaf/ul.sc
--- 0.7.5/e107_themes/leaf/ul.sc	2006-01-25 01:33:59.000000000 -0600
+++ 0.7.7/e107_themes/leaf/ul.sc	2006-07-10 00:07:29.000000000 -0500
@@ -1,12 +1,12 @@
-global $sql, $link_class, $page;
+global $sql, $link_class, $page,$tp;
 
-$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");
+$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(!$link_class || check_class($link_class) || ($link_class==254 && USER)){
 		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;
 			}
@@ -28,7 +28,7 @@
 			$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 .= "</ul>\n".POSTLINK;
 return $ulmenu;
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/newsroom/style.css 0.7.7/e107_themes/newsroom/style.css
--- 0.7.5/e107_themes/newsroom/style.css	2006-04-26 02:02:04.000000000 -0500
+++ 0.7.7/e107_themes/newsroom/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -17,6 +17,15 @@
 	border:1px solid black
 }
 
+a.languagelink:link, a.languagelink:visited {
+	color:white;
+}
+
+a.languagelink_active:link, a.languagelink_active:visited {
+	color:white;
+	text-decoration:underline;
+}
+
 .newscat{
 
 
@@ -353,3 +362,8 @@
 	font-family: tahoma, verdana, arial, helvetica, sans-serif;
 	font-size: 9px;
 }
+
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
+}
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/newsroom/theme.php 0.7.7/e107_themes/newsroom/theme.php
--- 0.7.5/e107_themes/newsroom/theme.php	2006-04-26 02:02:04.000000000 -0500
+++ 0.7.7/e107_themes/newsroom/theme.php	2006-10-25 20:53:20.000000000 -0500
@@ -1,13 +1,11 @@
 <?php
 
-
-
 if (!defined('e107_INIT')) { exit; }
 
 $themename = "newsroom";
-$themeversion = "1.01";
+$themeversion = "1.02";
 $themeauthor = "CaMer0n";
-$themedate = "25th April 2006";
+$themedate = "24th June 2006";
 $themeinfo = "This theme displays some of the news features of 0.7<br />For best results, create news items with a 'news-image' of 65x50 pixels.<br />To place these items in the top right area, choose 'othernews2' for the rendertype of the news item.<br />'othernews' may be used for the simple bullet listing below it.<br />This theme may be used freely under the GPL license providing the 'e107 newsroom' image is replaced.";
 $xhtmlcompliant = TRUE;
 $csscompliant = TRUE;
@@ -20,8 +18,11 @@
 
 $HEADER = "
 <div style='text-align:left'>
-<div class='header_setup'>
+
+<div class='header_setup' style='overflow:hidden'>
+
 <div style='width:770px;padding:0px;'>
+<div style='width:770px;position:absolute;top:5px;text-align:right'>{LANGUAGELINKS}</div> 
 <table cellpadding='0' cellspacing='0' style=\"background-image: url('".THEME_ABS."images/logo_bg.png');margin-bottom:0px;padding:0px;width:100%;\">
 	<tr>
 		<td style='padding-left:5px;'>
@@ -131,9 +132,6 @@
 	<a href='http://www.e107coders.org' rel='external' style=\"color:silver;\">e107coders.org</a></td>
 	<td>
 	<a href='http://www.e107themes.org' rel='external' style=\"color:silver;\">e107themes.org</a></td>
-	<td>
-	<a href='http://www.e107styles.org'  style=\"color:silver;\">e107styles.org</a>
-	</td>
 
 	</tr>
 </table>
diff -ruN 0.7.5/e107_themes/reline/style.css 0.7.7/e107_themes/reline/style.css
--- 0.7.5/e107_themes/reline/style.css	2006-04-29 03:18:14.000000000 -0500
+++ 0.7.7/e107_themes/reline/style.css	2006-11-09 02:34:27.000000000 -0600
@@ -32,6 +32,9 @@
 img {	
 	border: 0px;
 }
+.linkspage_button{
+	border:0px;
+}
 
 form {
 	margin: 0px;
diff -ruN 0.7.5/e107_themes/reline/theme.php 0.7.7/e107_themes/reline/theme.php
--- 0.7.5/e107_themes/reline/theme.php	2006-04-29 01:00:37.000000000 -0500
+++ 0.7.7/e107_themes/reline/theme.php	2006-11-21 13:30:27.000000000 -0600
@@ -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.16 $
-|	$Date: 2006/04/29 06:00:37 $
-|	$Author: sweetas $
+|	$Revision: 1.18 $
+|	$Date: 2006/11/21 19:30:27 $
+|	$Author: lisa_ $
 |
 +----------------------------------------------------------------------------+
 |	Photo Credits
@@ -212,7 +212,7 @@
 
 
  // Uncomment the below line (remove the // ) and enter in the filenames (or part of) for 
- // those pages you wish to use the custom page layout defined above (seperate with spaces).
+ // those pages you wish to use the custom page layout defined above (separate with spaces).
 
  // $CUSTOMPAGES['No_Right_Menu_Area'] = "forum.php forum_post.php forum_viewtopic.php";
 
@@ -353,7 +353,7 @@
 
 // Search shortcode style
 $SEARCH_SHORTCODE = "<input class='tbox search' type='text' name='q' size='20' value='' maxlength='50' />
-<input type='image' name='s' src='".THEME_ABS."images/search.png'  value='' style='width: 16px; height: 16px; border: 0px; vertical-align: middle'  />";
+<input type='image' name='s' src='".THEME_ABS."images/search.png'  value='".LAN_THEME_7."' title='".LAN_THEME_7."' style='width: 16px; height: 16px; border: 0px; vertical-align: middle'  />";
 
 
 // Chatbox post style
diff -ruN 0.7.5/e107_themes/sebes/style.css 0.7.7/e107_themes/sebes/style.css
--- 0.7.5/e107_themes/sebes/style.css	2005-05-25 20:29:42.000000000 -0500
+++ 0.7.7/e107_themes/sebes/style.css	2006-11-09 02:34:28.000000000 -0600
@@ -267,4 +267,9 @@
 
 img {
 	vertical-align: middle;
+}
+
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
 }
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/templates/banner_template.php 0.7.7/e107_themes/templates/banner_template.php
--- 0.7.5/e107_themes/templates/banner_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/banner_template.php	2006-07-16 14:56:47.000000000 -0500
@@ -1,6 +1,7 @@
 <?php
 
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:98%"); }
 
 // ##### LOGIN TABLE -------------------------------------------------------------------------------
 if(!$BANNER_LOGIN_TABLE){
@@ -9,11 +10,11 @@
 		<form method='post' action='".e_SELF."'>\n
 		<table style='width:40%'>
 		<tr>
-			<td style='width:15%' class='defaulttext'>".LAN_16."</td>
+			<td style='width:15%' class='defaulttext'>".BANNERLAN_16."</td>
 			<td>{BANNER_LOGIN_TABLE_LOGIN}\n</td>
 		</tr>
 		<tr>
-			<td style='width:15%' class='defaulttext'>".LAN_17."</td>
+			<td style='width:15%' class='defaulttext'>".BANNERLAN_17."</td>
 			<td>{BANNER_LOGIN_TABLE_PASSW}\n</td>
 		</tr>
 		<tr>
@@ -30,16 +31,16 @@
 // ##### BANNER TABLE -----------------------------------------------------------------------------
 if(!$BANNER_TABLE_START){
 		$BANNER_TABLE_START = "
-		<table class='fborder' style='width:98%; border:1px solid #000' border='1'>
-		<tr><td colspan='7' style='text-align:center' class='fcaption'>".LAN_21."</td></tr>
+		<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>
 		<tr>
-			<td class='forumheader' style='text-align:center'>".LAN_22."</td>
-			<td class='forumheader' style='text-align:center'>".LAN_23."</td>
-			<td class='forumheader' style='text-align:center'>".LAN_24."</td>
-			<td class='forumheader' style='text-align:center'>".LAN_25."</td>
-			<td class='forumheader' style='text-align:center'>".LAN_26."</td>
-			<td class='forumheader' style='text-align:center'>".LAN_27."</td>
-			<td class='forumheader' style='text-align:center'>".LAN_28."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_22."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_23."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_24."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_25."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_26."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_27."</td>
+			<td class='forumheader' style='text-align:center'>".BANNERLAN_28."</td>
 		</tr>";
 }
 if(!$BANNER_TABLE){
@@ -62,7 +63,7 @@
 				$BANNER_TABLE .= "
 				</tr>
 				<tr>
-					<td class='forumheader3'>".LAN_35.": {BANNER_TABLE_IP_LAN}</td>
+					<td class='forumheader3'>".BANNERLAN_35.": {BANNER_TABLE_IP_LAN}</td>
 					<td colspan='6' class='forumheader3'>{BANNER_TABLE_IP}</td>";
 			}
 
@@ -76,8 +77,16 @@
 }
 // ##### ------------------------------------------------------------------------------------------
 
-
-
-
+// ##### 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>";
+}
+// ##### ------------------------------------------------------------------------------------------
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/templates/bbcode_template.php 0.7.7/e107_themes/templates/bbcode_template.php
--- 0.7.5/e107_themes/templates/bbcode_template.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.7/e107_themes/templates/bbcode_template.php	2006-07-20 15:44:49.000000000 -0500
@@ -0,0 +1,68 @@
+<?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/templates/bbcode_template.php,v $
+|     $Revision: 1.10 $
+|     $Date: 2006/07/20 20:44:49 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+// How to register your own BBcode button.
+// Uncomment the 2 commented lines below to see it in action. (only applies to the user area)
+
+// $register_bb['blank'] = array("", "[blank][/blank]","Blank example helper text",e_IMAGE."generic/bbcode/template.png");
+
+$BBCODE_TEMPLATE = "
+	{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}
+";
+
+// $BBCODE_TEMPLATE .= "{BB=blank}";
+
+
+// $sc_style['BB_HELP']['pre'] = "<div style='text-align:center'>";
+// $sc_style['BB_HELP']['post'] = "</div>";
+
+
+
+// --------   Admin Templates ----------------------
+
+$BBCODE_TEMPLATE_ADMIN = "
+	{BB_HELP=admin}<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_PREIMAGEDIR=".e_IMAGE."}
+	{BB=preimage}{BB=prefile}{BB=flash}
+";
+
+// $BBCODE_TEMPLATE_ADMIN .= "{BB=blank}";
+
+$BBCODE_TEMPLATE_NEWSPOST = "
+	{BB_HELP=$mode}<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_PREIMAGEDIR=".e_IMAGE."newspost_images/}
+	{BB=preimage}{BB=prefile}{BB=flash}
+";
+
+$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=bq}{BB=code}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}
+	{BB_PREIMAGEDIR=".e_IMAGE."custom/}
+	{BB=preimage}{BB=prefile}{BB=flash}
+";
+
+
+
+?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/templates/comment_template.php 0.7.7/e107_themes/templates/comment_template.php
--- 0.7.5/e107_themes/templates/comment_template.php	2006-01-12 20:58:23.000000000 -0600
+++ 0.7.7/e107_themes/templates/comment_template.php	2006-07-16 14:40:07.000000000 -0500
@@ -11,13 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/comment_template.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/01/13 02:58:23 $
+|     $Revision: 1.7 $
+|     $Date: 2006/07/16 19:40:07 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:100%"); }
 
 global $sc_style, $comment_shortcodes;
 global $pref, $comrow, $row2, $tp, $NEWIMAGE, $USERNAME, $RATING;
@@ -63,7 +64,7 @@
 
 
 $COMMENTSTYLE = "
-<table class='fborder' style='width:100%;'>
+<table class='fborder' style='".USER_WIDTH."'>
 <tr>
 	<td colspan='2' class='forumheader'>
 		{SUBJECT} {USERNAME} {TIMEDATE} {REPLY} {COMMENTEDIT}
diff -ruN 0.7.5/e107_themes/templates/contact_template.php 0.7.7/e107_themes/templates/contact_template.php
--- 0.7.5/e107_themes/templates/contact_template.php	2006-05-01 18:58:47.000000000 -0500
+++ 0.7.7/e107_themes/templates/contact_template.php	2006-11-09 13:57:47.000000000 -0600
@@ -1,11 +1,12 @@
 <?php
-// $Id: contact_template.php,v 1.3 2006/05/01 23:58:47 mcfly_e107 Exp $
+// $Id: contact_template.php,v 1.7 2006/11/09 19:57:47 e107coders Exp $
 
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
 
 if(!$CONTACT_INFO){
   $CONTACT_INFO = "
-	<table style='width:97%' cellpadding='1' cellspacing='7'>
+	<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
 	<tr>
 		<td>{SITECONTACTINFO}
 		<br />
@@ -14,35 +15,44 @@
 	</table>";
 }
 
-// This must be defined outside $CONTACT_FORM so it can be turned off depending on the $pref
-if(!$CONTACT_EMAIL_COPY)
-{
-	$CONTACT_EMAIL_COPY = "
-	<tr><td>
-	<input type='checkbox' name='email_copy'  value='1'  />
-	".LANCONTACT_07."
-	</td></tr>
-	";
-}	
+$sc_style['CONTACT_EMAIL_COPY']['pre'] = "<tr><td>";
+$sc_style['CONTACT_EMAIL_COPY']['post'] = LANCONTACT_07."</td></tr>";
+
+$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'] = "";
+
+$sc_style['CONTACT_IMAGECODE_INPUT']['pre'] = "";
+$sc_style['CONTACT_IMAGECODE_INPUT']['post'] = "</td></tr>";
+
 
 if(!$CONTACT_FORM){
   $CONTACT_FORM = "
 	<form action='".e_SELF."' method='post' id='contactForm' >
-	<table style='width:97%' cellpadding='1' cellspacing='7'>
+	<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
+	{CONTACT_PERSON}
 	<tr><td>".LANCONTACT_03."<br />
-	<input type='text' name='author_name' size='30' class='tbox' value='' />
+	<input type='text' name='author_name' size='30' class='tbox' value=\"".$_POST['author_name']."\" />
 	</td></tr>
 	<tr><td>".LANCONTACT_04."<br />
-	<input type='text' name='email_send' size='30' class='tbox' value='".USEREMAIL."' />
+	<input type='text' name='email_send' size='30' class='tbox' value='".($_POST['email_send'] ? $_POST['email_send'] : USEREMAIL)."' />
 	</td></tr>
 	<tr><td>
 	".LANCONTACT_05."<br />
-	<input type='text' name='subject' size='30' class='tbox' value='' />
-	</td></tr>{$CONTACT_EMAIL_COPY}
+	<input type='text' name='subject' size='30' class='tbox' value=\"".$_POST['subject']."\" />
+	</td></tr>
+	{CONTACT_EMAIL_COPY}
 	<tr><td>
     ".LANCONTACT_06."<br />
-	<textarea cols='50' rows='10' name='body' class='tbox'></textarea>
+	<textarea cols='50' rows='10' name='body' class='tbox'>".stripslashes($_POST['body'])."</textarea>
 	</td></tr>
+	{CONTACT_IMAGECODE}
+	{CONTACT_IMAGECODE_INPUT}
 	<tr><td>
 	<input type='submit' name='send-contactus' value=\"".LANCONTACT_08."\" class='button' />
 	</td></tr>
@@ -51,4 +61,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_themes/templates/content_template.php 0.7.7/e107_themes/templates/content_template.php
--- 0.7.5/e107_themes/templates/content_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/content_template.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,195 +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_themes/templates/content_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-if (!defined('e107_INIT')) { exit; }
-
-// ##### CATEGORY TABLE ---------------------------------------------------------------------------
-if(!$CONTENT_CATEGORY_TABLE_START){
-                $CONTENT_CATEGORY_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' style='width:95%'>\n";
-}
-if(!$CONTENT_CATEGORY_TABLE){
-                $CONTENT_CATEGORY_TABLE .= "
-                <tr>
-                <td class='forumheader3' style='background-color:transparent; border:#517DB1 1px solid; width:10%; text-align:center' rowspan='2'>
-                        {CONTENT_CATEGORY_ICON}
-                </td>
-                <td class='forumheader' style='width:90%'>
-                        {CONTENT_CATEGORY_HEADING}
-                </td>
-                </tr>
-                <tr>
-                <td class='forumheader3'>
-                        {CONTENT_CATEGORY_SUBHEADING}
-                        <span class='smalltext'>(
-                                {CONTENT_CATEGORY_NUMBER}
-                        )</span>
-                </td>
-                </tr>\n";
-}
-if(!$CONTENT_CATEGORY_TABLE_END){
-                $CONTENT_CATEGORY_TABLE_END = "
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-// ##### RECENT LIST ------------------------------------------------------------------------------
-if(!$CONTENT_RECENT_TABLE_START){
-                $CONTENT_RECENT_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' style='width:95%'>\n";
-}
-if(!$CONTENT_RECENT_TABLE){
-                $CONTENT_RECENT_TABLE .= "
-                <tr>
-                <td rowspan='2' class='forumheader3' style='background-color:transparent; border:#517DB1 1px solid; width:10%; text-align:center'>
-                        {CONTENT_RECENT_ICON}
-                </td>
-                <td class='forumheader' style='width:90%'>
-                        {CONTENT_RECENT_HEADING}
-                </td>
-                </tr>
-                <tr>
-                <td class='forumheader3' style='line-height:130%;'>
-                        {CONTENT_RECENT_SUBHEADING}
-                        {CONTENT_RECENT_SUMMARY}
-                        {CONTENT_RECENT_AUTHOR}, {CONTENT_RECENT_DATE}<br />
-                        {CONTENT_RECENT_RATING}
-                </td>
-                </tr>\n";
-}
-if(!$CONTENT_RECENT_TABLE_END){
-                $CONTENT_RECENT_TABLE_END = "
-                <tr>
-                        <td colspan='2'>
-                        <div style='text-align:right'><a href='".e_SELF."?article'><< ".LAN_37."</a></div>
-                        </td>
-                </tr>
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-// ##### ARCHIVE ----------------------------------------------------------------------------------
-if(!$CONTENT_ARCHIVE_TABLE_START){
-                $CONTENT_ARCHIVE_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' style='width:95%'>\n";
-}
-if(!$CONTENT_ARCHIVE_TABLE){
-                $CONTENT_ARCHIVE_TABLE = "
-                <tr>
-                        <td class='forumheader3' style='background-color:transparent; border:#517DB1 1px solid; width:10%; text-align:center'>
-                                {CONTENT_ARCHIVE_ICON}
-                        </td>
-                        <td class='forumheader' style='width:90%'>
-                                {CONTENT_ARCHIVE_HEADING}
-                                ({CONTENT_ARCHIVE_DATESTAMP})
-                        </td>
-                </tr>
-                ";
-}
-if(!$CONTENT_ARCHIVE_TABLE_END){
-                $CONTENT_ARCHIVE_TABLE_END = "
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-// ##### ARTICLE ----------------------------------------------------------------------------------
-if(!$CONTENT_ARTICLE_TABLE_START){
-                $CONTENT_ARTICLE_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' style='width:95%' border='0'>\n";
-}
-if(!$CONTENT_ARTICLE_TABLE){
-                $CONTENT_ARTICLE_TABLE = "
-                <tr>
-                        <td rowspan='3' style='width:5%; white-space:nowrap;'>
-                                {CONTENT_ARTICLE_CAT_ICON}
-                        </td>
-                        <td>
-                                {CONTENT_ARTICLE_HEADING}
-                        </td>
-                </tr>
-                <tr>
-                        <td>
-                                {CONTENT_ARTICLE_SUBHEADING}
-                        </td>
-                </tr>
-                <tr>
-                        <td>
-                                {CONTENT_ARTICLE_AUTHOR} {CONTENT_ARTICLE_DATESTAMP}<br /><br />
-                        </td>
-                </tr>
-                <tr>
-                        <td colspan='2'>
-                                {CONTENT_ARTICLE_CONTENT}<br />
-                                {CONTENT_ARTICLE_PAGES}<br />
-                        </td>
-                </tr>
-                <tr>
-                        <td colspan='2' style='text-align:right'>
-                                {CONTENT_ARTICLE_EMAILPRINT}
-                        </td>
-                </tr>
-                <tr>
-                        <td colspan='2' style='text-align:right'>
-                                {CONTENT_ARTICLE_LINK_CAT}<br />
-                                {CONTENT_ARTICLE_LINK_MAIN}
-                        </td>
-                </tr>
-                ";
-}
-if(!$CONTENT_ARTICLE_TABLE_END){
-                $CONTENT_ARTICLE_TABLE_END = "
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-// ##### ARTICLE RATING ---------------------------------------------------------------------------
-if(!$CONTENT_ARTICLE_RATING_TABLE_START){
-                $CONTENT_ARTICLE_RATING_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' style='width:95%'>\n";
-}
-if(!$CONTENT_ARTICLE_RATING_TABLE){
-                $CONTENT_ARTICLE_RATING_TABLE = "
-                <tr>
-                        <td>
-                                {CONTENT_ARTICLE_RATING}
-                        </td>
-                </tr>
-                ";
-}
-if(!$CONTENT_ARTICLE_RATING_TABLE_END){
-                $CONTENT_ARTICLE_RATING_TABLE_END = "
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/templates/download_template.php 0.7.7/e107_themes/templates/download_template.php
--- 0.7.5/e107_themes/templates/download_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/download_template.php	2006-07-16 14:56:47.000000000 -0500
@@ -11,12 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/download_template.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
+|     $Revision: 1.15 $
+|     $Date: 2006/07/16 19:56:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
+
 
 /* set style of download image and thumbnail */
 define("DL_IMAGESTYLE","border:0px");
@@ -25,7 +27,7 @@
 if(!$DOWNLOAD_CAT_TABLE_START){
                 $DOWNLOAD_CAT_TABLE_START = "
                 <div style='text-align:center'>
-                <table class='fborder' style='width:95%'>\n
+                <table class='fborder' style='".USER_WIDTH."'>\n
                 <tr>
                 <td style='width:3%; text-align:center' class='fcaption'>&nbsp;</td>
                 <td style='width:60%; text-align:center' class='fcaption'>".LAN_dl_19."</td>
@@ -128,7 +130,7 @@
                 $DOWNLOAD_LIST_TABLE_START = "
                 <div style='text-align:center'>
                 <form method='post' action='".e_SELF."?".e_QUERY."'>
-                <table class='fborder' style='width:95%'>\n
+                <table class='fborder' style='".USER_WIDTH."'>\n
                 <tr>
         <td colspan='7' style='text-align:center' class='forumheader'>
                         <span class='defaulttext'>".LAN_dl_37."</span>
@@ -191,7 +193,7 @@
 		{DOWNLOAD_LIST_RATING}
 		</td>
 		<td class='forumheader3' style='text-align:center;'>
-		{DOWNLOAD_LIST_LINK} {DOWNLOAD_LIST_ICON}
+		{DOWNLOAD_LIST_LINK} {DOWNLOAD_LIST_ICON}</a>
 		</td>
 		</tr>";
 }
@@ -207,35 +209,58 @@
 
 
 // ##### VIEW TABLE -------------------------------------------------------------------------------
-if(!$DOWNLOAD_VIEW_TABLE_START){
-		$DOWNLOAD_VIEW_TABLE_START = "
+
+$DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
+$DL_VIEW_CAPTION = "{DOWNLOAD_VIEW_CAPTION}";
+
+		$DL_VIEW_NEXTPREV = "
 		<div style='text-align:center'>
-		<table class='fborder' style='width:95%'>\n";
-}
+			<table style='".USER_WIDTH."'>
+			<tr>
+			<td style='width:40%;'>{DOWNLOAD_VIEW_PREV}</td>
+			<td style='width:20%; text-align: center;'>{DOWNLOAD_BACK_TO_LIST}</td>
+			<td style='width:40%; text-align: right;'>{DOWNLOAD_VIEW_NEXT}</td>
+			</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'>";
+$sc_style['DOWNLOAD_VIEW_AUTHOR_LAN']['post'] = "</td>";
+
+$sc_style['DOWNLOAD_VIEW_AUTHOR']['pre'] = "<td style='width:80%' class='forumheader3'>";
+$sc_style['DOWNLOAD_VIEW_AUTHOR']['post'] = "</td></tr>";
+
+$sc_style['DOWNLOAD_VIEW_AUTHOREMAIL_LAN']['pre'] = "<tr><td style='width:20%' class='forumheader3'>";
+$sc_style['DOWNLOAD_VIEW_AUTHOREMAIL_LAN']['post'] = "</td>";
+
+$sc_style['DOWNLOAD_VIEW_AUTHOREMAIL']['pre'] = "<td style='width:80%' class='forumheader3'>";
+$sc_style['DOWNLOAD_VIEW_AUTHOREMAIL']['post'] = "</td></tr>";
+
+$sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE_LAN']['pre'] = "<tr><td style='width:20%' class='forumheader3'>";
+$sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE_LAN']['post'] = "</td>";
+
+$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 .= "
+        <div style='text-align:center'>
+		<table class='fborder' style='".USER_WIDTH."'>\n
 		<tr>
 		<td colspan='2' class='fcaption' style='text-align:left;'>
-
 		{DOWNLOAD_VIEW_NAME}
 		</td>
 		</tr>
 
-		<tr>
-		<td style='width:20%' class='forumheader3'>{DOWNLOAD_VIEW_AUTHOR_LAN}</td>
-		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_AUTHOR}</td>
-		</tr>
+		{DOWNLOAD_VIEW_AUTHOR_LAN}
+		{DOWNLOAD_VIEW_AUTHOR}
 
-		<tr>
-		<td style='width:20%' class='forumheader3'>{DOWNLOAD_VIEW_AUTHOREMAIL_LAN}</td>
-		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_AUTHOREMAIL}</td>
-		</tr>
+		{DOWNLOAD_VIEW_AUTHOREMAIL_LAN}
+		{DOWNLOAD_VIEW_AUTHOREMAIL}
 
-		<tr>
-		<td style='width:20%' class='forumheader3'>{DOWNLOAD_VIEW_AUTHORWEBSITE_LAN}</td>
-		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_AUTHORWEBSITE}</td>
-		</tr>
+		{DOWNLOAD_VIEW_AUTHORWEBSITE_LAN}
+		{DOWNLOAD_VIEW_AUTHORWEBSITE}
 
 		<tr>
 		<td style='width:20%' class='forumheader3'>{DOWNLOAD_VIEW_DESCRIPTION_LAN}</td>
@@ -254,7 +279,7 @@
 
 		<tr>
 		<td style='width:20%' class='forumheader3'>{DOWNLOAD_VIEW_DATE_LAN}</td>
-		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_DATE_LONG}</td>
+		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_DATE=long}</td>
 		</tr>
 
 		<tr>
@@ -271,18 +296,15 @@
 		<td style='width:20%' class='forumheader3'>{DOWNLOAD_VIEW_RATING_LAN}</td>
 		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_RATING}</td>
 		</tr>
-		
+
 		<tr>
 		<td style='width:20%' class='forumheader3' colspan='2'>{DOWNLOAD_REPORT_LINK}</td>
-		</tr>";
-}
-
-if(!$DOWNLOAD_VIEW_TABLE_END){
-		$DOWNLOAD_VIEW_TABLE_END = "
+		</tr>
 		</table>
-		<div style='text-align:right; width: 95%; margin-left: auto; margin-right: auto'>{DOWNLOAD_ADMIN_EDIT}</div> 
+		<div style='text-align:right; ".USER_WIDTH."; margin-left: auto; margin-right: auto'>{DOWNLOAD_ADMIN_EDIT}</div>
 		</div>\n";
 }
+
 // ##### ------------------------------------------------------------------------------------------
 
 // ##### MIRROR LIST -------------------------------------------------------------------------------
@@ -291,7 +313,7 @@
 {
 	$DOWNLOAD_MIRROR_START = "
 	<div style='text-align:center'>
-	<table class='fborder' style='width:100%'>
+	<table class='fborder' style='".USER_WIDTH."'>
 	<tr>
 	<td class='fcaption' colspan='4'>{DOWNLOAD_MIRROR_REQUEST}</td>
 	</tr>
diff -ruN 0.7.5/e107_themes/templates/email_template.php 0.7.7/e107_themes/templates/email_template.php
--- 0.7.5/e107_themes/templates/email_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/email_template.php	2006-07-12 03:15:58.000000000 -0500
@@ -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.7 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2006/07/12 08:15:58 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -25,10 +25,29 @@
 $SIGNUPEMAIL_IMAGES =  e_IMAGE.$pref['sitebutton']; // comma separated paths to image to embed. referenced below with {IMAGE1} (IMAGE2} etc.
 $SIGNUPEMAIL_CC = "";  // comma separated email addresses to put in CC of the signup email.
 $SIGNUPEMAIL_BCC = "";   // comma separated email addresses to put in BCC of the signup email.
-$SIGNUPEMAIL_ATTACHMENTS = ""; // files-path array of attachments. eg. array(e_FILE."myfile.zip",e_FILE."myotherfile.zip"); 
+$SIGNUPEMAIL_ATTACHMENTS = ""; // files-path array of attachments. eg. array(e_FILE."myfile.zip",e_FILE."myotherfile.zip");
 $SIGNUPEMAIL_BACKGROUNDIMAGE = "";// relative path to a background image eg. e_IMAGE."mybackground.jpg";
 
 
+$EMAIL_HEADER = "
+<!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><meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
+{STYLESHEET}
+</head>
+<body>
+<div style='padding:10px'>
+";
+
+
+$EMAIL_FOOTER = "
+<br /><br />
+{SITENAME=link}
+</div>
+</body>
+</html>";
+
+
 
 $SIGNUPEMAIL_TEMPLATE = "
 <div style='padding:10px'>
diff -ruN 0.7.5/e107_themes/templates/footer_default.php 0.7.7/e107_themes/templates/footer_default.php
--- 0.7.5/e107_themes/templates/footer_default.php	2006-02-18 18:08:26.000000000 -0600
+++ 0.7.7/e107_themes/templates/footer_default.php	2006-11-21 23:15:47.000000000 -0600
@@ -11,15 +11,38 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/footer_default.php,v $
-|     $Revision: 1.38 $
-|     $Date: 2006/02/19 00:08:26 $
-|     $Author: sweetas $
+|     $Revision: 1.46 $
+|     $Date: 2006/11/22 05:15:47 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $CUSTOMFOOTER, $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 ;)
+//
+// 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
+// [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;
@@ -31,8 +54,17 @@
 }
 
 unset($fh);
-if($e107_popup!=1){
+
+
+if(varset($e107_popup)!=1){
+	//
+	// B Send footer template
+	//
 	parseheader(($ph ? $cust_footer : $FOOTER));
+	
+	//
+	// C Dump all debug and traffic information
+	//
 	$eTimingStop = microtime();
 	global $eTimingStart;
 	$rendertime = number_format($eTraffic->TimeDelta( $eTimingStart, $eTimingStop ), 4);
@@ -44,6 +76,8 @@
 	if(isset($pref['display_memory_usage']) && $pref['display_memory_usage']){ $rinfo .= "Memory Usage: ".$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;
 		echo "\n<!-- DEBUG -->\n";
@@ -72,67 +106,69 @@
 		if (strlen($tmp)) {
 			$ns->tablerender('Paths', $tmp);
 		}
-		$tmp = $db_debug->Show_DEPRECIATED();
+		$tmp = $db_debug->Show_DEPRECATED();
 		if (strlen($tmp)) {
-			$ns->tablerender('Paths', $tmp);
+			$ns->tablerender('Deprecated Function Usage', $tmp);
 		}
 	}
-}
-
-$sql -> db_Close();
-$sql2 -> db_Close();
-
-/*
-changes by jalist 24/01/2005:
-show sql queries
-usage: add ?showsql to query string, must be admin
-*/
-
-if(is_array($queryinfo) && ADMIN)
-{
-	$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)
+	
+	/*
+	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))
 	{
-		echo "<tr>\n<td class='forumheader3' style='width: 5%;'>{$c}</td><td class='forumheader3' style='width: 95%;'>{$infovalue}</td>\n</tr>\n";
-		$c++;
+		$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>";
 	}
-	echo "</table>";
-}
 
 //
-// 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();
+// D Close DB connection. We're done talking to underlying MySQL
 //
-$tmp = eQTimeElapsed();
-if (strlen($tmp)) {
-	global $ns;
-	$ns->tablerender('Quick Admin Timer',"Results: {$tmp} microseconds");
-}
+	$sql -> db_Close();  // Only one is needed; the db is only connected once even with several $sql objects
 
-// Provide a way to sync user and server time -- see e107.js and class2.php
-// This should 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";
-}
+	//
+	// 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");
+	}
+	
+} // End of regular-page footer (the above NOT done for popups)
 
-global $start_ob_level;
-if (ob_get_level() != $start_ob_level && $pref['developer']) {
-	$oblev = ob_get_level();
-	$obdbg = "<div style='text-align:center' class='smalltext'>Software defect detected; ob_*() level {$oblev} at end.</div>";
-	echo $obdbg;
+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) {
@@ -145,10 +181,17 @@
 	";
 }
 
+//
+// 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);
@@ -158,8 +201,33 @@
 		$js_included[] = $fname;
 	}
 }
+
+//
+// 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>";
 
+//
+// I Send the buffered page data, along with appropriate headers
+//
 $page = ob_get_clean();
 
 $etag = md5($page);
diff -ruN 0.7.5/e107_themes/templates/fpw_template.php 0.7.7/e107_themes/templates/fpw_template.php
--- 0.7.5/e107_themes/templates/fpw_template.php	2006-03-26 23:01:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/fpw_template.php	2006-07-16 14:56:47.000000000 -0500
@@ -1,13 +1,15 @@
 <?php
 
+
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:70%"); }
 
 // ##### FPW TABLE -----------------------------------------------------------------------------
 if(!$FPW_TABLE){
 		$FPW_TABLE = "
 		<div style='text-align:center'>
 		<form method='post' action='".e_SELF."'>
-		<table style='width:70%' class='fborder'>
+		<table style='".USER_WIDTH."' class='fborder'>
 
 		<tr>
 		<td class='fcaption' colspan='2'>".LAN_05."</td>
diff -ruN 0.7.5/e107_themes/templates/header_default.php 0.7.7/e107_themes/templates/header_default.php
--- 0.7.5/e107_themes/templates/header_default.php	2006-05-16 13:42:15.000000000 -0500
+++ 0.7.7/e107_themes/templates/header_default.php	2006-11-08 10:32:06.000000000 -0600
@@ -1,26 +1,56 @@
 <?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).
++ ----------------------------------------------------------------------------------------------+
+|     e107 website system  : http://e107.org
+|     Steve Dunstan 2001-2002 : 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/templates/header_default.php,v $
-|     $Revision: 1.82 $
-|     $Date: 2006/05/16 18:42:15 $
+|     $Revision: 1.99 $
+|     $Date: 2006/11/08 16:32:06 $
 |     $Author: mcfly_e107 $
-+----------------------------------------------------------------------------+
++-----------------------------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+define("USER_AREA",TRUE);
+define("ADMIN_AREA",FALSE);
+$sql->db_Mark_Time('(Header Top)');
 
-// send the charset to the browser - overides spurious server settings with the lan pack settings.
-header("Content-type: text/html; charset=".CHARSET, true);
+//
+// *** 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: Define themable header parsing
+// 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: Define themeable header parsing
+//
 
 if (!function_exists("parseheader")) {
 	function parseheader($LAYOUT){
@@ -35,49 +65,69 @@
 		}
 	}
 }
-$sql->db_Mark_Time('(Header Top)');
 
-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\">
-<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
+//
+// 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);
+
+
+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";
+
+//
+// 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.(defined("e_PAGETITLE") ? ": ".e_PAGETITLE : (defined("PAGE_NAME") ? ": ".PAGE_NAME : ""))."</title>\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";
-echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
-$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]."," : "";
-echo (defined("META_DESCRIPTION")) ? "<meta name=\"description\" content=\"".$diz_merge.META_DESCRIPTION."\" />\n" : "";
-echo (defined("META_KEYWORDS")) ? "<meta name=\"keywords\" content=\"".$key_merge.META_KEYWORDS."\" />\n" : "";
+//
+// D: Send JS
+//
+echo "<!-- *JS* -->\n";
 
-if (isset($pref['meta_description'][e_LANGUAGE])) {
-	echo ($pref['meta_description'][e_LANGUAGE] && !defined("META_DESCRIPTION") ) ? "<meta name=\"description\" content=\"".$pref['meta_description'][e_LANGUAGE]."\" />\n" : "";
-}
-if (isset($pref['meta_keywords'][e_LANGUAGE])) {
-	echo ($pref['meta_keywords'][e_LANGUAGE] && !defined("META_KEYWORDS") ) ? "<meta name=\"keywords\" content=\"".$pref['meta_keywords'][e_LANGUAGE]."\" />\n" : "";
+// Wysiwyg JS support on or off.
+if (isset($WYSIWYG) && $WYSIWYG == TRUE && check_class($pref['post_html']) && isset($e_wysiwyg) && $e_wysiwyg != "") {
+	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
+	define("e_WYSIWYG",TRUE);
+	echo wysiwyg($e_wysiwyg);
+}else{
+	define("e_WYSIWYG",FALSE);
 }
-echo ($pref['meta_copyright'][e_LANGUAGE]) ? "<meta name=\"copyright\" content=\"".$pref['meta_copyright'][e_LANGUAGE]."\" />\n" : "";
-echo ($pref['meta_tag'][e_LANGUAGE]) ? str_replace("&lt;", "<", $tp -> toHTML($pref['meta_tag'][e_LANGUAGE], FALSE, "nobreak, no_hook, no_make_clickable"))."\n" : "";
-unset($key_merge,$diz_merge);
 
-if(isset($pref['rss_feeds']) && $pref['rss_feeds'] && file_exists(e_PLUGIN."rss_menu/rss_meta.php")){
-	require_once(e_PLUGIN."rss_menu/rss_meta.php");
+if (isset($theme_js_php) && $theme_js_php) {
+	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(isset($pref['trackbackEnabled'])){
-	echo "<link rel='pingback' href='".SITEURLBASE.e_PLUGIN_ABS."trackback/xmlrpc.php' />\n";
+if (isset($eplug_js) && $eplug_js) {
+	echo "\n<!-- eplug_js -->\n";
+	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)) {
 	echo "<script type='text/javascript' src='".e_FILE_ABS."sleight_js.php'></script>\n";
 }
 
-if(function_exists('core_head')){ echo core_head(); }
+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"; }
-if (isset($eplug_js) && $eplug_js) { echo "<script type='text/javascript' src='{$eplug_js}'></script>\n"; }
+if (isset($eplug_css) && $eplug_css) {
+	echo "\n<!-- eplug_css -->\n";
+	echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
+}
 
+echo "<!-- Theme css -->\n";
 if(defined("PREVIEWTHEME")) {
 	echo "<link rel='stylesheet' href='".PREVIEWTHEME."style.css' type='text/css' />\n";
 } else {
@@ -119,10 +169,64 @@
 	}
 }
 
-if(function_exists('theme_head')){
-	echo theme_head();
+//
+// DEPRECATED!!! This is used in log/stats.php to generate some css. We'll clean this up in a future release.
+//
+
+if(function_exists('core_head')){ echo core_head(); }
+
+//
+// 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";
+
+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_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]."," : "";
+
+function render_meta($type)
+{
+	global $pref,$tp;
+
+	if (!isset($pref['meta_'.$type][e_LANGUAGE])){ return;}
+	if (!$pref['meta_'.$type][e_LANGUAGE]){ return; }
+
+	if($type == "tag")
+	{
+		return str_replace("&lt;", "<", $tp -> toHTML($pref['meta_tag'][e_LANGUAGE], FALSE, "nobreak, no_hook, no_make_clickable"))."\n";
+	}
+	else
+	{
+		return '<meta name="'.$type.'" content="'.$pref['meta_'.$type][e_LANGUAGE].'" />'."\n";
+	}
 }
 
+echo "\n<!-- Core Meta Tags -->\n";
+echo (defined("META_DESCRIPTION")) ? "<meta name=\"description\" content=\"".$diz_merge.META_DESCRIPTION."\" />\n" : render_meta('description');
+echo (defined("META_KEYWORDS")) ? "<meta name=\"keywords\" content=\"".$key_merge.META_KEYWORDS."\" />\n" : render_meta('keywords');
+echo render_meta('copyright');
+echo render_meta('author');
+echo render_meta('tag');
+
+unset($key_merge,$diz_merge);
+
 // ---------- 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";
@@ -130,38 +234,26 @@
 	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 (isset($theme_js_php) && $theme_js_php) {
-	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 (isset($WYSIWYG) && $WYSIWYG == TRUE && check_class($pref['post_html']) && isset($e_wysiwyg) && $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 "\n<!-- *THEME HEAD* -->\n";
+	echo theme_head();
 }
-if (function_exists('headerjs')){echo headerjs();  }
 
-if (isset($pref['statActivate']) && $pref['statActivate']) {
-	if(!$pref['statCountAdmin'] && ADMIN) {
-		/* don't count admin visits */
-	} else {
-		require_once(e_PLUGIN."log/consolidate.php");
-		$script_text = "document.write( '<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '\">' );\n";
-	}
-}
 
+//
+// H: Generate JS for image preloads
+//
+echo "\n<!-- *PRELOAD* -->\n";
 if ($pref['image_preload']) {
 	$ejs_listpics = '';
 	$handle=opendir(THEME.'images');
 	while ($file = readdir($handle)) {
-		if (!strstr($file, "._") && strstr($file,".") && $file != "." && $file != ".." && $file != "Thumbs.db" && $file != ".DS_Store") {
+		if(preg_match("#(jpg|jpeg|gif|bmp|png)$#i", $file)) {
 			$ejs_listpics .= $file.",";
 		}
 	}
@@ -169,8 +261,10 @@
 	$ejs_listpics = substr($ejs_listpics, 0, -1);
 	closedir($handle);
 
+	if (!isset($script_text)) $script_text = '';
 	$script_text .= "ejs_preload('".THEME_ABS."images/','".$ejs_listpics."');\n";
 }
+
 if (isset($script_text) && $script_text) {
 	echo "<script type='text/javascript'>\n";
 	echo "<!--\n";
@@ -179,6 +273,11 @@
 	echo "</script>\n";
 }
 
+
+//
+// I: Calculate JS onload() functions for the BODY tag
+//
+
 $fader_onload='';
 if(in_array('fader_menu', $eMenuActive))
 {
@@ -186,10 +285,19 @@
 }
 
 $links_onload = 'externalLinks();';
-$body_onload = ($fader_onload != '' || $links_onload != '') ? " onload='".$fader_onload.$links_onload."'" : "";
+$theme_onload = (defined('THEME_ONLOAD') ? THEME_ONLOAD : '');
+$body_onload = ($fader_onload != '' || $links_onload != '' || $theme_onload != '' ? " onload='".$fader_onload.$links_onload.$theme_onload."'" : "");
 
+//
+// J: Send end of <head> and start of <body>
+//
 echo "</head>
 <body".$body_onload.">\n";
+$sql->db_Mark_Time("Main Page Body");
+
+//
+// K: (The rest is ignored for popups, which have no menus)
+//
 //echo "XX - ".$e107_popup;
 // require $e107_popup =1; to use it as header for popup without menus
 if(!isset($e107_popup))
@@ -197,6 +305,10 @@
 	$e107_popup = 0;
 }
 if ($e107_popup != 1) {
+	
+//
+// L: (optional) Body JS to disable right clicks
+//
 	if (isset($pref['no_rightclick']) && $pref['no_rightclick']) {
 		echo "<script language='javascript'>\n";
 		echo "<!--\n";
@@ -223,6 +335,9 @@
 		echo "</script>\n";
 	}
 
+//
+// M: Send top of body for custom pages and for news
+//
 	if(isset($CUSTOMPAGES))
 	{
 		if (is_array($CUSTOMPAGES))
@@ -263,14 +378,16 @@
 		}
 		parseheader(($ph ? $cust_header : $HEADER));
 	}
-	$sql->db_Mark_Time("Main Page Body");
 
 
+//
+// N: Send other top-of-body HTML
+//
+
 	if(ADMIN){
 		if(file_exists(e_BASE.'install.php')){ echo "<div class='installe' style='text-align:center'><br /><b>*** ".CORE_LAN4." ***</b><br />".CORE_LAN5."</div><br /><br />"; }
 	}
 
-
 // Display Welcome Message when old method activated.
 
 	echo $tp->parseTemplate("{WMESSAGE=header}");
@@ -284,4 +401,4 @@
 
 	unset($text);
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/e107_themes/templates/links_template.php 0.7.7/e107_themes/templates/links_template.php
--- 0.7.5/e107_themes/templates/links_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/links_template.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,159 +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_themes/templates/links_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-if (!defined('e107_INIT')) { exit; }
-
-// ##### MAIN TABLE -------------------------------------------------------------------------------
-if(!$LINK_MAIN_TABLE_START){
-                $LINK_MAIN_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' style='width:95%'>\n";
-}
-if(!$LINK_MAIN_TABLE){
-                $LINK_MAIN_TABLE .= "
-                <tr>
-                <td class='forumheader3' style='background-color:transparent; border:#517DB1 1px solid; width:10%; text-align:center' rowspan='2'>
-                        {LINK_MAIN_ICON}
-                </td>
-                <td class='forumheader' style='width:90%'>
-                        {LINK_MAIN_HEADING}
-                </td>
-                </tr>
-                <tr>
-                <td class='forumheader3'>
-                        {LINK_MAIN_DESC}
-                        <span class='smalltext'>(
-                                {LINK_MAIN_NUMBER}
-                        )</span>
-                </td>
-                </tr>\n";
-
-}
-if(!$LINK_MAIN_TABLE_END){
-                $LINK_MAIN_TABLE_END = "
-                <tr><td class='forumheader3' colspan='2' style='text-align:right;'>{LINK_MAIN_TOTAL}</td></tr>
-                <tr><td class='forumheader3' colspan='2' style='text-align:right;'>{LINK_MAIN_SHOWALL}</td></tr>
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-// ##### CATEGORY LIST ----------------------------------------------------------------------------
-if(!$LINK_CAT_TABLE_START){
-                $LINK_CAT_TABLE_START = "
-                <div style='text-align:center'>
-                <table class='fborder' cellspacing='0' cellpadding='0' style='width:95%'><tr><td>\n";
-}
-if(!$LINK_CAT_TABLE){
-                $LINK_CAT_TABLE .= "
-                <table class='fborder' style='width:100%'>
-                <tr>
-                <td rowspan='2' class='forumheader3' style='background-color:transparent; border:#517DB1 1px solid; width:10%; text-align:center'>
-                        {LINK_CAT_BUTTON}
-                </td>
-                <td class='forumheader' style='width:90%'>
-                        {LINK_CAT_APPEND}{LINK_CAT_NAME}</a> <i>{LINK_CAT_URL}</i>
-                </td>
-                <td class='forumheader' style='white-space:nowrap;'>
-                        {LINK_CAT_REFER}
-                </td>
-                </tr>
-                <tr>
-                <td colspan='2' class='forumheader3' style='line-height:130%;'>
-                        {LINK_CAT_DESC}<br />
-                </td>
-                </tr>
-                </table>\n";
-
-}
-if(!$LINK_CAT_TABLE_END){
-                $LINK_CAT_TABLE_END = "
-                </td>
-                </tr>
-                <tr>
-                        <td class='forumheader3' colspan='2' style='text-align:right;'>
-                                {LINK_CAT_SUBMIT}
-                        </td>
-                </tr>
-                </table>
-                </div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-// ##### SUBMIT -----------------------------------------------------------------------------------
-if(!$LINK_SUBMIT_TABLE_START){
-        $LINK_SUBMIT_TABLE_START = "
-        <div style='text-align:center'>
-        <form method='post' action='".e_SELF."'>
-        <table class='fborder' cellspacing='0' cellpadding='0' style='width:95%'>";
-}
-if(!$LINK_SUBMIT_TABLE){
-                $LINK_SUBMIT_TABLE .= "
-                <tr>
-                        <td colspan='2' style='text-align:center' class='forumheader2'>".LAN_93."</td>
-                </tr>
-                <tr>
-                        <td class='forumheader3' style='width:30%'>".LAN_86."</td>
-                        <td class='forumheader3' style='width:70%'>
-                                {LINK_SUBMIT_CAT}
-                        </td>
-                </tr>
-                <tr>
-                        <td class='forumheader3' style='width:30%'><u>".LAN_94."</u></td>
-                        <td class='forumheader3' style='width:30%'>
-                                <input class='tbox' type='text' name='link_name' size='60' value='' maxlength='100' />
-                        </td>
-                </tr>
-                <tr>
-                        <td class='forumheader3' style='width:30%'><u>".LAN_95."</u></td>
-                        <td class='forumheader3' style='width:30%'>
-                                <input class='tbox' type='text' name='link_url' size='60' value='' maxlength='200' />
-                        </td>
-                </tr>
-                <tr>
-                        <td class='forumheader3' style='width:30%'><u>".LAN_96."</u></td>
-                        <td class='forumheader3' style='width:30%'>
-                                <textarea class='tbox' name='link_description' cols='59' rows='3'></textarea>
-                        </td>
-                </tr>
-                <tr>
-                        <td class='forumheader3' style='width:30%'>".LAN_97."</td>
-                        <td class='forumheader3' style='width:30%'>
-                                <input class='tbox' type='text' name='link_button' size='60' value='' maxlength='200' />
-                        </td>
-                </tr>
-                <tr>
-                        <td colspan='2' style='text-align:center' class='forumheader3'><span class='smalltext'>".LAN_106."</span></td>
-                </tr>
-                <tr>
-                        <td colspan='2' style='text-align:center' class='forumheader'>
-                                <input class='button' type='submit' name='add_link' value='".LAN_98."' />
-                        </td>
-                </tr>
-                ";
-
-}
-if(!$LINK_SUBMIT_TABLE_END){
-        $LINK_SUBMIT_TABLE_END = "
-        </table></form></div>\n";
-}
-// ##### ------------------------------------------------------------------------------------------
-
-
-?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/templates/login_template.php 0.7.7/e107_themes/templates/login_template.php
--- 0.7.5/e107_themes/templates/login_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/login_template.php	2006-08-08 01:45:48.000000000 -0500
@@ -5,7 +5,7 @@
 // ##### LOGIN HEADER TABLE -----------------------------------------------------------------------
 if(!$LOGIN_TABLE_HEADER){
 	$LOGIN_TABLE_HEADER .= "
-	<div style='width:100%;text-align:center; margin-left: auto;margin-right: auto'>
+	<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" );
 }
@@ -18,7 +18,7 @@
 		}
 		$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;'><img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' /></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."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";
 	}
diff -ruN 0.7.5/e107_themes/templates/online_template.php 0.7.7/e107_themes/templates/online_template.php
--- 0.7.5/e107_themes/templates/online_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/online_template.php	2006-07-16 14:56:47.000000000 -0500
@@ -1,12 +1,13 @@
 <?php
 
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:96%"); }
 
 // ##### ONLINE TABLE -----------------------------------------------------------------------------
 if(!$ONLINE_TABLE_START){
 		$ONLINE_TABLE_START = "
 		<div style='text-align:center'>
-		<table class='fborder' style='width:96%'>
+		<table class='fborder' style='".USER_WIDTH."'>
 		<tr>
 			<td class='forumheader' style='width:3%'>&nbsp;</td>
 			<td class='forumheader' style='width:43%'>".ONLINE_EL10."</td>
@@ -26,7 +27,7 @@
 		</table>
 		</div>
 		<br />
-		".ONLINE_EL1.GUESTS_ONLINE.", 
+		".ONLINE_EL1.GUESTS_ONLINE.",
 		".ONLINE_EL2.MEMBERS_ONLINE." ...<br />
 		<br />{ONLINE_TABLE_MOST_EVER_ONLINE}
 		<br />({ONLINE_TABLE_MOST_MEMBERS_ONLINE}, {ONLINE_TABLE_MOST_GUESTS_ONLINE}) ".ONLINE_EL9." {ONLINE_TABLE_DATESTAMP}<br />
diff -ruN 0.7.5/e107_themes/templates/search_template.php 0.7.7/e107_themes/templates/search_template.php
--- 0.7.5/e107_themes/templates/search_template.php	2006-04-21 20:22:40.000000000 -0500
+++ 0.7.7/e107_themes/templates/search_template.php	2006-07-16 14:56:47.000000000 -0500
@@ -1,7 +1,7 @@
 <?php
 
 if (!defined('e107_INIT')) { exit; }
-
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 /*
 if (!defined('SEARCH_SHORTCODE_REF')) {
 	define('SEARCH_SHORTCODE_REF',"");
@@ -26,7 +26,7 @@
 if (!isset($SEARCH_TOP_TABLE)) {
 	$SEARCH_TOP_TABLE = "<div style='text-align: center'>
 	<form id='searchform' name='searchform' method='get' action='".e_SELF."'>
-	<table style='width: 95%' class='fborder'><tr>
+	<table style='".USER_WIDTH."' class='fborder'><tr>
 	<td class='forumheader3' style='width: 40%'>".LAN_199."</td>
 	<td class='forumheader3' style='width: 60%; white-space: nowrap'>
 	{SEARCH_MAIN_SEARCHFIELD}&nbsp;{SEARCH_MAIN_SUBMIT}&nbsp;{ENHANCED_ICON}
diff -ruN 0.7.5/e107_themes/templates/signup_template.php 0.7.7/e107_themes/templates/signup_template.php
--- 0.7.5/e107_themes/templates/signup_template.php	2006-04-26 02:08:10.000000000 -0500
+++ 0.7.7/e107_themes/templates/signup_template.php	2006-11-16 13:50:45.000000000 -0600
@@ -11,13 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/signup_template.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/04/26 07:08:10 $
-|     $Author: e107coders $
+|     $Revision: 1.8 $
+|     $Date: 2006/11/16 19:50:45 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:100%"); }
+
 
 define("REQUIRED_FIELD_MARKER", "<span style='text-align:right;font-size:15px; color:red'> *</span>");
 
@@ -49,7 +51,7 @@
 <td class='forumheader3' style='width:30%;vertical-align:top'>".LAN_USET_5." ".req($pref['signup_option_class'])."
 <br /><span class='smalltext'>".LAN_USET_6."</span></td>
 <td class='forumheader3' style='width:70%'>
-<table style='width:100%'>
+<table style='".USER_WIDTH."'>
 ";
 }
 
@@ -112,7 +114,7 @@
 
 $SIGNUP_SIGNATURE_END = "
 </textarea><br />
-	<div style='width:99%'>{REN_HELP}</div>
+	<div style='".USER_WIDTH."'>{REN_HELP}</div>
 	</td></tr>
 ";
 
@@ -151,8 +153,7 @@
 
 if(!defined($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."
+$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 />
 <br />
 <div style='text-align:center'><b>".LAN_SIGNUP_17."</b>
@@ -169,7 +170,7 @@
 if(!defined($SIGNUP_TEXT))
 {
 $SIGNUP_TEXT =
-LAN_309." <b>".LAN_SIGNUP_29."</b><br />".LAN_SIGNUP_30."<br />
+LAN_309." <b>".LAN_SIGNUP_29."</b><br /><br />".LAN_SIGNUP_30."<br />
 ";
 }
 
@@ -177,11 +178,11 @@
 {
 $SIGNUP_XUP_FORM = "
 	<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:hand' size='30' value=\"".LAN_SIGNUP_35."\" onclick=\"expandit('xup','default')\" />
 	</div>
 
 	<div id='xup' style='display:none' >
-	<table style='width: 100%;'>
+	<table style='".USER_WIDTH."'>
 	<tr>
 	<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_31."
 	</td>
@@ -219,7 +220,7 @@
 
 	<tr>
 	<td class='forumheader' colspan='2'  style='text-align:center'>
-	<input class='button' type='submit' name='register' value='".LAN_123."' />
+	<input class='button' type='submit' name='register' value=\"".LAN_123."\" />
 	</td>
 	</tr>
 
@@ -232,7 +233,7 @@
 {
 $SIGNUP_BEGIN = "
 {SIGNUP_FORM_OPEN}
-<div style='text-align:center;width:100%'>
+<div style='text-align:center;".USER_WIDTH."'>
 {SIGNUP_SIGNUP_TEXT}
 <br />
 ".LAN_400."<br /><br /></div>";
@@ -243,7 +244,7 @@
 $SIGNUP_BODY = "
 {SIGNUP_XUP}
 <div id='default'>
-<table class='fborder' style='width:99%'>
+<table class='fborder' style='".USER_WIDTH."'>
 {SIGNUP_DISPLAYNAME}
 <tr>
 <td class='forumheader3' style='width:30%;white-space:nowrap' >".LAN_9."<span style='font-size:15px; color:red'> *</span><br /><span class='smalltext'>".LAN_10."</span></td>
@@ -294,7 +295,7 @@
 {SIGNUP_IMAGECODE}
 <tr style='vertical-align:top'>
 <td class='forumheader' colspan='2'  style='text-align:center'>
-<input class='button' type='submit' name='register' value='".LAN_123."' />
+<input class='button' type='submit' name='register' value=\"".LAN_123."\" />
 <br />
 </td>
 </tr>
diff -ruN 0.7.5/e107_themes/templates/sitedown_template.php 0.7.7/e107_themes/templates/sitedown_template.php
--- 0.7.5/e107_themes/templates/sitedown_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/sitedown_template.php	2006-06-29 23:16:39.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/sitedown_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
+|     $Revision: 1.3 $
+|     $Date: 2006/06/30 04:16:39 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,17 +21,20 @@
 
 // ##### SITEDOWN TABLE -----------------------------------------------------------------
 if(!$SITEDOWN_TABLE){
-	$SITEDOWN_TABLE = "
-	<html>
+	$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>
 		<title>{SITEDOWN_TABLE_PAGENAME}</title>
 	</head>
 	<body>
-		<font style='font-size: 14px; color: black; font-family: Tahoma, Verdana, Arial, Helvetica; text-decoration: none'>
-		<div style='text-align:center'><img src='".e_IMAGE."logo.png' alt='Logo' /></div>
+		<div style='text-align:center;font-size: 14px; color: black; font-family: Tahoma, Verdana, Arial, Helvetica; text-decoration: none'>
+		<div style='text-align:center'>{LOGO}</div>
 		<hr />
 		<br />
-		<div style='text-align:center'>{SITEDOWN_TABLE_MAINTAINANCETEXT}</div>
+		{SITEDOWN_TABLE_MAINTAINANCETEXT}
+		</div>
 	</body>
 	</html>";
 }
diff -ruN 0.7.5/e107_themes/templates/user_template.php 0.7.7/e107_themes/templates/user_template.php
--- 0.7.5/e107_themes/templates/user_template.php	2006-05-18 10:20:55.000000000 -0500
+++ 0.7.7/e107_themes/templates/user_template.php	2006-08-03 19:19:07.000000000 -0500
@@ -11,13 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/user_template.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2006/05/18 15:20:55 $
+|     $Revision: 1.15 $
+|     $Date: 2006/08/04 00:19:07 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 global $user_shortcodes, $pref;
 //Set this to TRUE if you would like any extended user field that is empty to NOT be shown on the profile page
@@ -34,10 +35,34 @@
 		<td style='width:60%' class='forumheader3'>{EXTENDED_VALUE}</td>
 	</tr>
 	";
-	
+
 $EXTENDED_END = "";
 //		$datestamp = $gen->convert_date($user_join, "forum");
 
+$USER_SHORT_TEMPLATE_START = "
+	<div style='text-align:center'>".LAN_138." {TOTAL_USERS}
+	<br />
+	<br />
+	{USER_FORM_START}
+	<p>".LAN_419.": {USER_FORM_RECORDS} ".LAN_139." {USER_FORM_ORDER}
+	{USER_FORM_SUBMIT}
+	{USER_FORM_END}
+	</p>
+	</div>
+	<br />
+	<br />
+	<table style='".USER_WIDTH."' class='fborder'>
+	<tr>
+	<td class='fcaption' style='width:2%'>&nbsp;</td>
+	<td class='fcaption' style='width:20%'>".LAN_142."</td>
+	<td class='fcaption' style='width:20%'>".LAN_112."</td>
+	<td class='fcaption' style='width:20%'>".LAN_145."</td>
+	</tr>
+";
+$USER_SHORT_TEMPLATE_END = "
+</table>
+";
+
 $USER_SHORT_TEMPLATE = "
 <tr>
 	<td class='forumheader3' style='width:2%'>{USER_ICON_LINK}</td>
@@ -75,7 +100,7 @@
 	$user_picture =  "";
 	$colspan = "";
 	$main_colspan = " colspan = '2' ";
-}	
+}
 
 $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>";
@@ -95,7 +120,7 @@
 
 $USER_FULL_TEMPLATE = "
 <div style='text-align:center'>
-<table style='width:95%' class='fborder'>
+<table style='".USER_WIDTH."' class='fborder'>
 <tr>
 	<td colspan='2' class='fcaption' style='text-align:center'>".LAN_142." {USER_ID} : {USER_NAME}{USER_LOGINNAME}</td>
 </tr>
diff -ruN 0.7.5/e107_themes/templates/userposts_template.php 0.7.7/e107_themes/templates/userposts_template.php
--- 0.7.5/e107_themes/templates/userposts_template.php	2005-12-14 13:28:53.000000000 -0600
+++ 0.7.7/e107_themes/templates/userposts_template.php	2006-07-16 14:56:47.000000000 -0500
@@ -11,24 +11,29 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/userposts_template.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/14 19:28:53 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2006/07/16 19:56:47 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 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>";
+}
 
 // ##### USERPOSTS_COMMENTS TABLE -----------------------------------------------------------------
 if(!$USERPOSTS_COMMENTS_TABLE_START){
 	$USERPOSTS_COMMENTS_TABLE_START = "
 	<div style='text-align:center'>
-	<table class='fborder' style='width:95%'>\n";
+	<table class='fborder' style='".USER_WIDTH."'>\n";
 }
 if(!$USERPOSTS_COMMENTS_TABLE){
 	$USERPOSTS_COMMENTS_TABLE = "
 	<tr>
 	<td class='fcaption'>
-	{USERPOSTS_COMMENTS_HREF_PRE}<b>{USERPOSTS_COMMENTS_HEADING}</b></a> 
+	{USERPOSTS_COMMENTS_HREF_PRE}<b>{USERPOSTS_COMMENTS_HEADING}</b></a>
 	<span class='smalltext'>{USERPOSTS_COMMENTS_DATESTAMP} ({USERPOSTS_COMMENTS_TYPE})</span>
 	</td>
 	</tr>
@@ -51,7 +56,7 @@
 	$USERPOSTS_FORUM_TABLE_START = "
 	<div style='text-align:center'>
 	<form method='post' action='".e_SELF."?".e_QUERY."'>
-	<table class='fborder' style='width:95%'>";
+	<table class='fborder' style='".USER_WIDTH."'>";
 }
 if(!$USERPOSTS_FORUM_TABLE){
 	$USERPOSTS_FORUM_TABLE .= "
diff -ruN 0.7.5/e107_themes/templates/usersettings_template.php 0.7.7/e107_themes/templates/usersettings_template.php
--- 0.7.5/e107_themes/templates/usersettings_template.php	2006-02-20 12:34:14.000000000 -0600
+++ 0.7.7/e107_themes/templates/usersettings_template.php	2006-10-18 11:34:48.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/usersettings_template.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/02/20 18:34:14 $
-|     $Author: whoisrich $
+|     $Revision: 1.7 $
+|     $Date: 2006/10/18 16:34:48 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
-
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:auto"); }
 global $usersettings_shortcodes, $pref;
 
 
@@ -29,6 +29,25 @@
 ";
 $sc_style['CUSTOMTITLE']['post'] = "</td></tr>";
 
+$sc_style['PASSWORD1']['pre'] = "
+	<tr>
+	<td style='width:40%' class='forumheader3'>".LAN_152."<br /><span class='smalltext'>".LAN_401."</span></td>
+	<td style='width:60%' class='forumheader2'>
+";
+
+$sc_style['PASSWORD2']['pre'] = "
+	</td>
+	</tr>
+
+	<tr>
+	<td style='width:40%' class='forumheader3'>".LAN_153."<br /><span class='smalltext'>".LAN_401."</span></td>
+	<td style='width:60%' class='forumheader2'>
+";
+$sc_style['PASSWORD2']['post'] = "
+	</td>
+	</tr>
+";
+
 $sc_style['PASSWORD_LEN']['pre'] = "<br /><span class='smalltext'>  (".LAN_SIGNUP_1." ";
 $sc_style['PASSWORD_LEN']['post'] = " ".LAN_SIGNUP_2.")</span>";
 
@@ -76,13 +95,13 @@
 <td style='width:60%' class='forumheader3'>
 {FIELDVAL} {HIDEFIELD}
 </td>
-</tr> 
+</tr>
 ";
 $REQUIRED_FIELD = "{FIELDNAME}<span style='text-align:right;font-size:15px; color:red'> *</span>";
 
 $USERSETTINGS_EDIT = "
 <div style='text-align:center'>
-	<table style='width:auto' class='fborder'>
+	<table style='".USER_WIDTH."' class='fborder'>
 
 	<tr>
 	<td colspan='2' class='forumheader'>".LAN_418."</td>
@@ -111,20 +130,9 @@
 
 	{CUSTOMTITLE}
 
-	<tr>
-	<td style='width:40%' class='forumheader3'>".LAN_152."<br /><span class='smalltext'>".LAN_401."</span></td>
-	<td style='width:60%' class='forumheader2'>
 	{PASSWORD1}
 	{PASSWORD_LEN}
-	</td>
-	</tr>
-
-	<tr>
-	<td style='width:40%' class='forumheader3'>".LAN_153."<br /><span class='smalltext'>".LAN_401."</span></td>
-	<td style='width:60%' class='forumheader2'>
 	{PASSWORD2}
-	</td>
-	</tr>
 
 	<tr>
 	<td style='width:40%' class='forumheader3'>".LAN_112."</td>
@@ -182,7 +190,7 @@
 	{AVATAR_CHOOSE}
 	</td>
 	</tr>
-	
+
 	{AVATAR_UPLOAD}
 	{PHOTO_UPLOAD}
 	{XUP}
@@ -193,6 +201,6 @@
 	</table>
 	</div>
 	";
-	
+
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/e107_themes/vekna_blue/style.css 0.7.7/e107_themes/vekna_blue/style.css
--- 0.7.5/e107_themes/vekna_blue/style.css	2005-03-24 04:45:31.000000000 -0600
+++ 0.7.7/e107_themes/vekna_blue/style.css	2006-11-09 02:34:28.000000000 -0600
@@ -285,4 +285,8 @@
 ul, ol {
 	margin-top: 0;
 	margin-bottom: 0;
+}
+
+.linkspage_button{
+	border:0px;
 }
\ No newline at end of file
diff -ruN 0.7.5/email.php 0.7.7/email.php
--- 0.7.5/email.php	2006-05-19 08:11:52.000000000 -0500
+++ 0.7.7/email.php	2006-11-11 22:10:22.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/email.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2006/05/19 13:11:52 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.20 $
+|     $Date: 2006/11/12 04:10:22 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -46,15 +46,16 @@
 
 $emailurl = ($source == "referer") ? $_SERVER['HTTP_REFERER'] : SITEURL;
 
-$comments = $tp->post_toHTML($_POST['comment'], TRUE, 'retain_nl');
-$author = $tp->post_toHTML($_POST['author_name']);
+$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']);
 
+
 if (isset($_POST['emailsubmit']))
 {
 	if (!$email_send)
 	{
-		$error .= LAN_106;
+		$error .= LAN_EMAIL_106;
 	}
 
 	if($use_imagecode)
@@ -73,14 +74,14 @@
 
 	if ($comments == "")
 	{
-		$message = LAN_188." ".SITENAME." (".SITEURL.")";
+		$message = LAN_EMAIL_188." ".SITENAME." (".SITEURL.")";
 		if (USER == TRUE)
 		{
-			$message .= "\n\n".LAN_email_1." ".USERNAME;
+			$message .= "\n\n".LAN_EMAIL_1." ".USERNAME;
 		}
 		else
 		{
-			$message .= "\n\n".LAN_email_1." ".$author;
+			$message .= "\n\n".LAN_EMAIL_1." ".$author;
 		}
 	}
 	else
@@ -88,7 +89,7 @@
 		$message .= $comments;
 	}
 	$ip = $e107->getip();
-	$message .= "\n\n".LAN_email_2." ".$ip."\n\n";
+	$message .= "\n\n".LAN_EMAIL_2." ".$ip."\n\n";
 
 	if(strpos($source,'plugin:') !== FALSE)
 	{
@@ -119,16 +120,17 @@
 	}
 	else
 	{
-		$emailurl = SITEURL;
-		$message = "";
-		if($sql->db_Select("news", "*", "news_id='".intval($parms)."'"))
-		{
-			
-			list($news_id, $news_title, $news_body, $news_extended, $news_datestamp, $news_author, $news_source, $news_url, $news_category, $news_allow_comments) = $sql->db_Fetch();
-			$message .= $tp->toHTML($news_title, TRUE)."\n".$tp->toHTML($news_body, TRUE)."\n".$tp->toHTML($news_extended, TRUE)."\n\n".SITEURL.e_BASE."comment.php?comment.news.".$parms;
-			$message = strip_tags($message);
-		}
-		
+
+		$emailurl = $_POST['referer'];
+        $message = "";
+        if($sql->db_Select("news", "*", "news_id='".intval($parms)."'"))
+        {
+            list($news_id, $news_title, $news_body, $news_extended, $news_datestamp, $news_author, $news_source, $news_url, $news_category, $news_allow_comments) = $sql->db_Fetch();
+			$message = "<h3 class='email_heading'>".$news_title."</h3><br />".$news_body."<br />".$news_extended."<br /><br /><a href='{e_BASE}news.php?extend.".$parms."'>{e_BASE}news.php?extend.".$parms."</a><br />";
+            $message = $tp->toEmail($message);
+
+        }
+
 		if($message == "")
 		{
 			header("location:".e_BASE."index.php");
@@ -138,30 +140,41 @@
 
 	if ($error == "")
 	{
+
+	    // Load Mail Handler and Email Template.
 		require_once(e_HANDLER."mail.php");
-		if (sendemail($email_send, LAN_email_3.SITENAME, $message))
+	    $email_body = $EMAIL_HEADER;
+		$email_body .= (trim($comments) != "") ? $tp->toEmail($comments)."<hr />" : "";
+		$email_body .= $tp->toEmail($message).$EMAIL_FOOTER;
+
+		if (sendemail($email_send, LAN_EMAIL_3.SITENAME,$email_body))
 		{
-			$text = "<div style='text-align:center'>".LAN_10." ".$email_send."</div>";
+			$text = "<div style='text-align:center'>".LAN_EMAIL_10." ".$email_send."</div>";
 		}
 		else
 		{
-			$text = "<div style='text-align:center'>".LAN_9."</div>";
+			$text = "<div style='text-align:center'>".LAN_EMAIL_9."</div>";
 		}
-		$ns->tablerender(LAN_11, $text);
+		$ns->tablerender(LAN_EMAIL_11, $text);
 	}
 	else
 	{
-		$ns->tablerender(LAN_12, "<div style='text-align:center'>".$error."</div>");
+		$ns->tablerender(LAN_EMAIL_12, "<div style='text-align:center'>".$error."</div>");
 	}
 }
 
+
+// --------------------- Form -------------------------------------------------
+
+
+
 $text = "<form method='post' action='".e_SELF."?".e_QUERY."'>\n
 	<table>";
 
 if (USER != TRUE)
 {
 	$text .= "<tr>
-		<td style='width:25%'>".LAN_7."</td>
+		<td style='width:25%'>".LAN_EMAIL_15."</td>
 		<td style='width:75%'>
 		<input class='tbox' type='text' name='author_name' size='60' style='width:95%' value='$author' maxlength='100' />
 		</td>
@@ -170,14 +183,14 @@
 
 $text .= "
 <tr>
-	<td style='width:25%'>".LAN_8."</td>
+	<td style='width:25%'>".LAN_EMAIL_8."</td>
 	<td style='width:75%'>
-	<textarea class='tbox' name='comment' cols='70' rows='4' style='width:95%'>".LAN_email_6." ".SITENAME." (".$emailurl.")
+	<textarea class='tbox' name='comment' cols='70' rows='4' style='width:95%'>".LAN_EMAIL_6." ".SITENAME." (".$emailurl.")
 ";
 
 if (USER == TRUE)
 {
-	$text .= "\n\n".LAN_email_1." ".USERNAME;
+	$text .= "\n\n".LAN_EMAIL_1." ".USERNAME;
 }
 
 $text .= "</textarea>
@@ -185,33 +198,33 @@
 	</tr>
 
 	<tr>
-	<td style='width:25%'>".LAN_187."</td>
+	<td style='width:25%'>".LAN_EMAIL_187."</td>
 	<td style='width:75%'>
 	<input class='tbox' type='text' name='email_send' size='60' value='$email_send' style='width:95%' maxlength='100' />
 	</td>
 	</tr>
 	";
-	
+
 	if($use_imagecode)
 	{
-		$text .= "<tr><td>".LAN_email_8."</td><td>";
+		$text .= "<tr><td>".LAN_EMAIL_190."</td><td>";
 		$text .= $sec_img->r_image();
-		$text .= " <input class='tbox' type='text' name='code_verify' size='15' maxlength='20'>
-			<input type='hidden' name='rand_num' value='".$sec_img->random_number."'></td></tr>";
+		$text .= " <input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />
+			<input type='hidden' name='rand_num' value='".$sec_img->random_number."' /></td></tr>";
 	}
-	
+
 $text .= "
 	<tr style='vertical-align:top'>
 	<td style='width:25%'></td>
 	<td style='width:75%'>
-	<input class='button' type='submit' name='emailsubmit' value='".LAN_email_4."' />
+	<input class='button' type='submit' name='emailsubmit' value='".LAN_EMAIL_4."' />
 	<input type='hidden' name='referer' value='".$_SERVER['HTTP_REFERER']."' />
 </td>
 	</tr>
 	</table>
 	</form>";
 
-$ns->tablerender(LAN_email_5, $text);
+$ns->tablerender(LAN_EMAIL_5, $text);
 
 require_once(FOOTERF);
 ?>
\ No newline at end of file
diff -ruN 0.7.5/error.php 0.7.7/error.php
--- 0.7.5/error.php	2005-12-15 06:28:54.000000000 -0600
+++ 0.7.7/error.php	2006-06-02 08:59:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/error.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2005/12/15 12:28:54 $
-|     $Author: streaky $
+|     $Revision: 1.12 $
+|     $Date: 2006/06/02 13:59:40 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -33,38 +33,38 @@
 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_1."</div><br /><div class='installh'>".LAN_2."</div><br /><div class='smalltext'>".LAN_3."</div>
-		<br /><div class='installh'>".LAN_2."<a href='index.php'>".LAN_20."</a></div>";
+	$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>";
 	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_4."</div><br /><div class='installh'>".LAN_5."</div><br /><div class='smalltext'>".LAN_6."</div>
-		<br /><div class='installh'>".LAN_2."<a href='index.php'>".LAN_20."</a></div>";
+	$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>";
 	break;
 	default:
 
 
 	case 404:
 	header("HTTP/1.1 404 Not Found");
-	$text = "<h3><img src='".e_IMAGE_ABS."icons/icon3.png' alt='Error Icon'> ".LAN_7."</h3><br />".LAN_ERROR_01."<br /><br />".LAN_ERROR_03."<b>{$errTo}</b>".LAN_ERROR_04."<br /><br />";
+	$text = "<h3><img src='".e_IMAGE_ABS."icons/icon3.png' alt='Error Icon'> ".LAN_ERROR_7."</h3><br />".LAN_ERROR_21."<br /><br />".LAN_ERROR_23."<b>{$errTo}</b>".LAN_ERROR_24."<br /><br />";
 
-	if (strlen($errFrom)) $text .= LAN_9." ( <a href='{$errFrom}' rel='external'>{$errFrom}</a> ) -- ".LAN_19."<br />";
+	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_20."</a><br />";
-	$text .= "<a href='{$base_path}search.php'>".LAN_ERROR_02."</a></p>";
+	$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_10."</div><br /><div class='installh'>".LAN_11."</div><br /><div class='smalltext'>".LAN_12."</div>
-		<br /><div class='installh'>".LAN_2."<a href='index.php'>".LAN_20."</a></div>";
+	$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>";
 	break;
-	$text = "<div class='installe'>".LAN_13." (".$_SERVER['QUERY_STRING'].")</div><br /><div class='installh'>".LAN_14."</div><br /><div class='smalltext'>".LAN_15."</div>
-		<br /><div class='installh'>".LAN_2."<a href='index.php'>".LAN_20."</a></div>";
+	$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>";
 }
 
 $ns->tablerender(PAGE_NAME, $text);
diff -ruN 0.7.5/fpw.php 0.7.7/fpw.php
--- 0.7.5/fpw.php	2006-03-13 15:53:47.000000000 -0600
+++ 0.7.7/fpw.php	2006-11-07 15:19:17.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/fpw.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/03/13 21:53:47 $
-|     $Author: e107coders $
+|     $Revision: 1.21 $
+|     $Date: 2006/11/07 21:19:17 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -23,9 +23,14 @@
 	exit;
 }
 
+if($pref['fpwcode'] && extension_loaded("gd")){
+	define("USE_IMAGECODE",TRUE);
+}else{
+	define("USE_IMAGECODE",FALSE);
+}
+
 
-$use_imagecode = ($pref['fpwcode'] && extension_loaded("gd"));
-if ($use_imagecode) {
+if (USE_IMAGECODE) {
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
 }
@@ -53,14 +58,17 @@
 	exit;
 }
 
+//the seperator character used
+$fpw_sep = "#";
+
 if (e_QUERY) {
-	define("FPW_ACTIVE","TRUE");    
-	$tmp = explode(".", e_QUERY);
+	define("FPW_ACTIVE","TRUE");
+	$tmp = explode($fpw_sep, e_QUERY);
 	$tmpinfo = preg_replace("#[\W_]#", "", $tp -> toDB($tmp[0], true));
-	if ($sql->db_Select("tmp", "*", "tmp_info LIKE '%.{$tmpinfo}' ")) {
+	if ($sql->db_Select("tmp", "*", "tmp_info LIKE '%{$fpw_sep}{$tmpinfo}' ")) {
 		$row = $sql->db_Fetch();
 		extract($row);
-		$sql->db_Delete("tmp", "tmp_info LIKE '%.{$tmpinfo}' ");
+		$sql->db_Delete("tmp", "tmp_info LIKE '%{$fpw_sep}{$tmpinfo}' ");
 		$newpw = "";
 		$pwlen = rand(8, 12);
 		for($a = 0; $a <= $pwlen; $a++) {
@@ -68,7 +76,7 @@
 		}
 		$mdnewpw = md5($newpw);
 
-		list($username, $md5) = explode(".", $tmp_info);
+		list($username, $md5) = explode($fpw_sep, $tmp_info);
 		$sql->db_Update("user", "user_password='$mdnewpw', user_viewed='' WHERE user_name='".$tp -> toDB($username, true)."' ");
 		cookie($pref['cookie_name'], "", (time()-2592000));
 		$_SESSION[$pref['cookie_name']] = "";
@@ -107,7 +115,7 @@
 			die();
 		}
 
-		if ($sql->db_Select("tmp", "*", "tmp_ip = 'pwreset' AND tmp_info LIKE '{$user_name}.%'")) {
+		if ($sql->db_Select("tmp", "*", "tmp_ip = 'pwreset' AND tmp_info LIKE '{$user_name}{$fpw_sep}%'")) {
 			fpw_error(LAN_FPW4);
 			exit;
 		}
@@ -124,7 +132,7 @@
 
 		$deltime = time()+86400 * 2;
 		//Set timestamp two days ahead so it doesn't get auto-deleted
-		$sql->db_Insert("tmp", "'pwreset',{$deltime},'{$user_name}.{$rcode}'");
+		$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>";
@@ -142,11 +150,12 @@
 }
 
 
-if ($use_imagecode) {
+if (USE_IMAGECODE) {
+
 	$FPW_TABLE_SECIMG_LAN = LAN_FPW2;
-	$FPW_TABLE_SECIMG_HIDDEN = "<input type='hidden' name='rand_num' value='".$sec_img->random_number."'>";
+	$FPW_TABLE_SECIMG_HIDDEN = "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />";
 	$FPW_TABLE_SECIMG_SECIMG = $sec_img->r_image();
-	$FPW_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20'>";
+	$FPW_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
 }
 
 if (!$FPW_TABLE) {
diff -ruN 0.7.5/gsitemap.php 0.7.7/gsitemap.php
--- 0.7.5/gsitemap.php	2006-04-15 12:44:17.000000000 -0500
+++ 0.7.7/gsitemap.php	2006-11-07 08:59:18.000000000 -0600
@@ -11,36 +11,28 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/gsitemap.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/04/15 17:44:17 $
-|     $Author: e107coders $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/07 14:59:18 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
-
-if (file_exists(e_PLUGIN."gsitemap/languages/gsitemap_".e_LANGUAGE.".php"))
-{
-	include_once(e_PLUGIN."gsitemap/languages/gsitemap_".e_LANGUAGE.".php");
-}
-else
-{
-	include_once(e_PLUGIN."gsitemap/languages/gsitemap_English.php");
-}
-
+include_lan(e_PLUGIN."gsitemap/languages/gsitemap_".e_LANGUAGE.".php");
 
 if(e_QUERY == "show")
 {
 	require_once(HEADERF);
 
-	$sql -> db_Select("gsitemap", "*", "gsitemap_active IN (".USERCLASS_LIST.") ");
+	$sql -> db_Select("gsitemap", "*", "gsitemap_active IN (".USERCLASS_LIST.") ORDER BY gsitemap_order ");
 	$nfArray = $sql -> db_getList();
-	$text = "<ul>";
+	$text = "<div style='text-align:left'><ul>";
 
 	foreach($nfArray as $nfa)
 	{
-		$text .= "<li>".$tp->toHTML($nfa['gsitemap_cat'],"","defs").": <a href='".$nfa['gsitemap_url']."'>".$tp->toHTML($nfa['gsitemap_name'],"","defs")."</a><br />\n";
+		$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 .= "</ul>";
+	$text .= "</ul></div>";
 
 	$ns -> tablerender(SITENAME." : ".GSLAN_Name."", $text);
 
@@ -54,13 +46,14 @@
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'	xsi:schemaLocation='http://www.google.com/schemas/sitemap/0.84
 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd'>";
 
-$sql -> db_Select("gsitemap", "*", "gsitemap_active IN (".USERCLASS_LIST.") ");
+$sql -> db_Select("gsitemap", "*", "gsitemap_active IN (".USERCLASS_LIST.") ORDER BY gsitemap_order ");
 $smArray = $sql -> db_getList();
 foreach($smArray as $sm)
 {
+	$loc = (substr($sm['gsitemap_url'],0,4)== "http")? $sm['gsitemap_url'] : SITEURL.$tp->replaceConstants($sm['gsitemap_url'],TRUE);
 	$xml .= "
 	<url>
-		<loc>".$tp->toRSS($sm['gsitemap_url'],TRUE)."</loc>
+		<loc>".$loc."</loc>
 		<lastmod>".get_iso_8601_date($sm['gsitemap_lastmod'])."</lastmod>
     		<changefreq>".$sm['gsitemap_freq']."</changefreq>
     		<priority>".$sm['gsitemap_priority']."</priority>
@@ -83,4 +76,4 @@
 }
 
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/index.php 0.7.7/index.php
--- 0.7.5/index.php	2006-04-22 14:30:47.000000000 -0500
+++ 0.7.7/index.php	2006-11-13 04:21:17.000000000 -0600
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/index.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/04/22 19:30:47 $
+|     $Revision: 1.26 $
+|     $Date: 2006/11/13 10:21:17 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -43,7 +43,7 @@
 	save_prefs();
 }
 
-$query = (e_QUERY && e_QUERY != '' ? '?'.e_QUERY : '');
+$query = (e_QUERY && e_QUERY != '' && !$_GET['elan']) ? '?'.e_QUERY : '';
 
 if ($pref['membersonly_enabled'] && !USER) {
 	header('location: '.e_LOGIN);
@@ -77,18 +77,24 @@
 		$e_QUERY = preg_match('/^page\.php\?([0-9]*)$/', $location);
 		require_once("page.php");
 	} else {
-		header("Location: {$location}");
+
+	  	header("Location: {$location}");
 		exit();
 	}
 } else {
-	if($location == "index.php"){
-    	require_once(HEADERF);
-		require_once(FOOTERF);
-	}else{
+	list($page,$str) = explode("?",$location."?"); // required to prevent infinite looping when queries are  used on index.php.
+	if($page == "index.php") // Welcome Message is the front-page.
+	{
+      	require_once(HEADERF);
+	 	require_once(FOOTERF);
+	  	exit;
+	}
+	elseif($page != "index.php") // redirect to different frontpage.
+	{
 		header("Location: {$location}");
 	}
 
 	exit();
 }
 
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/login.php 0.7.7/login.php
--- 0.7.5/login.php	2005-04-27 16:54:09.000000000 -0500
+++ 0.7.7/login.php	2006-11-28 12:01:46.000000000 -0600
@@ -11,65 +11,73 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/login.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/04/27 21:54:09 $
-|     $Author: stevedunstan $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/28 18:01:46 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
-	
+
 require_once("class2.php");
-$HEADER = "<div>&nbsp;</div>";
+$HEADER = "";
 require_once(HEADERF);
 $use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
 if ($use_imagecode) {
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
 }
-	
+
 if (!USER) {
 	require_once(e_HANDLER."form_handler.php");
 	$rs = new form;
 	$text = "";
-	 
+
 	$LOGIN_TABLE_LOGINMESSAGE = LOGINMESSAGE;
-	$LOGIN_TABLE_USERNAME = $rs->form_text("username", 40, "", 100);
-	$LOGIN_TABLE_PASSWORD = $rs->form_password("userpass", 40, "", 100);
-	if ($use_imagecode) {
+	$LOGIN_TABLE_USERNAME = "<input class='tbox' type='text' name='username' size='40' maxlength='100' />";
+	$LOGIN_TABLE_PASSWORD = "<input class='tbox' type='password' name='userpass' size='40' maxlength='100' />";
+	if ($use_imagecode)
+	{
 		$LOGIN_TABLE_SECIMG_LAN = LAN_LOGIN_13;
-		$LOGIN_TABLE_SECIMG_HIDDEN = "<input type='hidden' name='rand_num' value='".$sec_img->random_number."'>";
+		$LOGIN_TABLE_SECIMG_HIDDEN = "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />";
 		$LOGIN_TABLE_SECIMG_SECIMG = $sec_img->r_image();
-		$LOGIN_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20'>";
+		$LOGIN_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
 	}
-	$LOGIN_TABLE_AUTOLOGIN = $rs->form_checkbox("autologin", "1");
+	$LOGIN_TABLE_AUTOLOGIN = "<input type='checkbox' name='autologin' value='1' />";
 	$LOGIN_TABLE_AUTOLOGIN_LAN = LAN_LOGIN_8;
-	$LOGIN_TABLE_SUBMIT = $rs->form_button("submit", "userlogin", LAN_LOGIN_9, "", LAN_LOGIN_10);
-	 
-	if (!$LOGIN_TABLE) {
-		if (file_exists(THEME."login_template.php")) {
+	$LOGIN_TABLE_SUBMIT = "<input class='button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
+
+	if (!$LOGIN_TABLE)
+	{
+		if (file_exists(THEME."login_template.php"))
+		{
 			require_once(THEME."login_template.php");
-		} else {
+		}
+		else
+		{
 			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);
-	 
+
 	$login_message = LAN_LOGIN_3." | ".SITENAME;
-	$ns->tablerender($login_message, $text);
-	 
-	if ($pref['user_reg']) {
+	$ns->tablerender($login_message, $text, 'login_page');
+
+	if ($pref['user_reg'])
+	{
 		$LOGIN_TABLE_FOOTER_USERREG = "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>";
 	}
 	echo preg_replace("/\{(.*?)\}/e", '$\1', $LOGIN_TABLE_FOOTER);
-	 
-} else {
+
+}
+else
+{
 	echo "<script type='text/javascript'>document.location.href='".e_BASE."index.php'</script>\n";
 	exit;
 }
 
 echo "</body></html>";
-	
+
 $sql->db_Close();
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/news.php 0.7.7/news.php
--- 0.7.5/news.php	2006-05-17 06:57:35.000000000 -0500
+++ 0.7.7/news.php	2006-11-11 22:10:29.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/news.php,v $
-|     $Revision: 1.98 $
-|     $Date: 2006/05/17 11:57:35 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.111 $
+|     $Date: 2006/11/12 04:10:29 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -55,6 +55,7 @@
 }
 
 $ix = new news;
+$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
 if ($action == 'cat' || $action == 'all'){
 
 	// --> Cache
@@ -80,17 +81,18 @@
 		$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 n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().")  ORDER BY n.news_datestamp DESC LIMIT ".intval($from).",".NEWSALL_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().")  ORDER BY n.news_sticky DESC,n.news_datestamp DESC LIMIT ".intval($from).",".NEWSALL_LIMIT;
 		$category_name = "All";
 	}
 	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 news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_category=".intval($sub_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_category=".intval($sub_action));
 		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 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($from).",".NEWSLIST_LIMIT;
 	}
 
 	if($category_name){
@@ -138,7 +140,7 @@
 	$text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
 
     if(!$NEWSLISTTITLE){
-		$NEWSLISTTITLE = LAN_82." '{$category_name}'";
+		$NEWSLISTTITLE = LAN_NEWS_82." '{$category_name}'";
 	}
 
 	ob_start();
@@ -161,11 +163,14 @@
 	$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 n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id=".intval($sub_action);
+		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);
 	$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']);
 	}
 
@@ -187,11 +192,13 @@
 $interval = 10;
 if ($action == "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");
+	$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
 		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 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 ".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
+		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")
 {
@@ -199,7 +206,7 @@
 	$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 n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id={$sub_action}";
+		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"))
 {
@@ -213,7 +220,7 @@
 	$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 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;
+		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"))
 {
@@ -228,11 +235,11 @@
 	$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 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;
+		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
 {
-	$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_render_type<2" );
+	$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']))
 	{
@@ -247,6 +254,7 @@
 		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().")
 		AND n.news_render_type<2
@@ -259,6 +267,7 @@
 		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
@@ -267,7 +276,7 @@
 	// #### END ---------------------------------------------------------------------------------------------------
 }
 
-if($tmp_cache = checkCache($cacheString))
+if($tmp_cache = checkCache($cacheString)) // normal news front-page - with cache.
 {
 	require_once(HEADERF);
 
@@ -283,13 +292,25 @@
 		}
 
 	}
+
+	//news archive
+	if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
+		if ($sql->db_Select_gen($query)) {
+			$newsAr = $sql -> db_getList();
+			if($newsarchive = checkCache('newsarchive')){
+				$tmp_cache = $tmp_cache.$newsarchive;
+			}else{
+				newsarchive($newsAr);
+			}
+		}
+	}
 	renderCache($tmp_cache, TRUE);
 }
 
 
 if (!$sql->db_Select_gen($query)) {
 	require_once(HEADERF);
-	echo "<br /><br /><div style='text-align:center'><b>".(strstr(e_QUERY, "month") ? LAN_462 : LAN_83)."</b></div><br /><br />";
+	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 {
@@ -298,8 +319,12 @@
 
 
 $p_title = ($action == "item") ? $newsAr[1]['news_title'] : $newsAr[1]['category_name'];
+
 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']);
+	}
 	define("e_PAGETITLE", $p_title);
 }
 
@@ -321,7 +346,7 @@
 news page templating
 
 */
-if($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");
 
@@ -395,6 +420,9 @@
 		$ix->render_newsitem($news);
 		$i++;
 	}
+	$parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
+	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
+	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
 
 	$cache_data = ob_get_clean();
 	require_once(HEADERF);
@@ -404,11 +432,14 @@
 
 // ##### --------------------------------------------------------------------------------------------------------------
 
-// #### new: news archive ---------------------------------------------------------------------------------------------
-if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
-	// do not show the newsarchive on the news.php?item.X page (but only on the news mainpage)
+function newsarchive($newsAr){
+	global $ns, $gen, $interval, $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');
 
+	ob_start();
+	
 	$i = $interval + 1;
 	while(isset($newsAr[$i]))
 	{
@@ -451,6 +482,14 @@
 		$i++;
 	}
 	$ns->tablerender($pref['newsposts_archive_title'], $textnewsarchive, 'news_archive');
+	$newsarchive = ob_get_contents();
+	ob_end_flush(); // dump collected data
+	setNewsCache('newsarchive', $newsarchive);
+}
+
+// #### new: news archive ---------------------------------------------------------------------------------------------
+if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
+	newsarchive($newsAr);
 }
 // #### END -----------------------------------------------------------------------------------------------------------
 
@@ -458,9 +497,9 @@
 	if (is_numeric($action)){
 		$action = "";
 	}
-	$parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
-	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
-	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
+ //	$parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
+ //	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
+ //	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
 }
 
 if(is_dir("remotefile")) {
@@ -490,17 +529,23 @@
 function setNewsCache($cache_tag, $cache_data) {
 	global $e107cache;
 	$e107cache->set($cache_tag, $cache_data);
-	$e107cache->set($cache_tag."_title", e_PAGETITLE);
+	$e107cache->set($cache_tag."_title", defined("e_PAGETITLE") ? e_PAGETITLE : '');
+	$e107cache->set($cache_tag."_diz", defined("META_DESCRIPTION") ? META_DESCRIPTION : '');
 }
 
 function checkCache($cacheString){
 	global $pref,$e107cache;
 	$cache_data = $e107cache->retrieve($cacheString);
 	$cache_title = $e107cache->retrieve($cacheString."_title");
+	$cache_diz = $e107cache->retrieve($cacheString."_diz");
 	$etitle = ($cache_title != "e_PAGETITLE") ? $cache_title : "";
+	$ediz = ($cache_diz != "META_DESCRIPTION") ? $cache_diz : "";
 	if($etitle){
 		define(e_PAGETITLE,$etitle);
 	}
+	if($ediz){
+    	define("META_DESCRIPTION",$ediz);
+	}
 	if ($cache_data) {
 		return $cache_data;
 	} else {
@@ -509,7 +554,8 @@
 }
 
 function renderCache($cache, $nfp = FALSE){
-	global $pref,$tp,$sql;
+	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) {
 		require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
@@ -522,7 +568,7 @@
 function render_newscats(){  // --  CNN Style Categories. ----
 	global $pref,$ns,$tp;
 	if (isset($pref['news_cats']) && $pref['news_cats'] == '1') {
-		$text3 = $tp->toHTML("{NEWS_CATEGORIES}", TRUE, 'parse_sc,nobreak');
+		$text3 = $tp->toHTML("{NEWS_CATEGORIES}", TRUE, 'parse_sc,nobreak,emotes_off,no_make_clickable');
 		$ns->tablerender(LAN_NEWS_23, $text3, 'news_cat');
 	}
 }
diff -ruN 0.7.5/online.php 0.7.7/online.php
--- 0.7.5/online.php	2005-12-24 16:53:38.000000000 -0600
+++ 0.7.7/online.php	2006-10-20 15:57:15.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/online.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2005/12/24 22:53:38 $
-|     $Author: sweetas $
+|     $Revision: 1.14 $
+|     $Date: 2006/10/20 20:57:15 $
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -250,7 +250,7 @@
 	$sysprefs->setArray('menu_pref');
 }
 	
-if (!is_object($gen)) {
+if (!isset($gen) || !is_object($gen)) {
 	$gen = new convert;
 }
 	
diff -ruN 0.7.5/page.php 0.7.7/page.php
--- 0.7.5/page.php	2006-05-16 10:55:05.000000000 -0500
+++ 0.7.7/page.php	2006-11-11 22:10:36.000000000 -0600
@@ -11,11 +11,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/page.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2006/05/16 15:55:05 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.32 $
+|     $Date: 2006/11/12 04:10:36 $ - mods to make password protected pages work
+|     $Author: mrpete $
 +----------------------------------------------------------------------------+
 */
+
 require_once("class2.php");
 $page = new pageClass();
 if(isset($_POST['enterpw']))
@@ -38,29 +39,39 @@
 {
 
 	$cacheString = 'page_'.$page->pageID;
-	$cachePageTitle = 'page-t_'.$page->pageID;
+  $cachePageTitle = 'page-t_'.$page->pageID;
 
-    if($cacheData = $e107cache->retrieve($cacheString)){
+	if($cacheData = $e107cache->retrieve($cacheString))
+	{
 
-        list($pagetitle,$comment_flag) = explode("^",$e107cache->retrieve($cachePageTitle));
+		list($pagetitle,$comment_flag) = explode("^",$e107cache->retrieve($cachePageTitle));
 		define("e_PAGETITLE", $pagetitle);
 		require_once(HEADERF);
-       	echo $cacheData;
+		echo $cacheData;
 
-	}else{
+	}
+	else
+	{
 
 		$tmp = $page -> showPage();
 		define("e_PAGETITLE", $tmp['title']);
 		require_once(HEADERF);
+		if ($tmp['err'])		// Need to display error block after header defined
+		{
+			$ns -> tablerender($tmp['title'], $tmp['text']);
+			require_once(FOOTERF);
+			exit;
+		}
 		ob_start();
 		$ns -> tablerender($tmp['title'], $tmp['text']);
-    	$cache_data = ob_get_flush();
+		$cache_data = ob_get_flush();
 		$e107cache->set($cacheString, $cache_data);
-    	$e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']);
-        $comment_flag = $tmp['comment_flag'];
+		$e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']);
+		$comment_flag = $tmp['comment_flag'];
 	}
 
-	if($com = $page -> pageComment($comment_flag)){
+	if($com = $page -> pageComment($comment_flag))
+	{
 		echo $com['comment'].$com['comment_form'];
 	}
 }
@@ -90,7 +101,20 @@
 		$tmp = explode(".", e_QUERY);
 		$this -> pageID = intval($tmp[0]);
 		$this -> pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
-		$this -> bullet = (defined("BULLET") ? "<img src='".THEME."images/".BULLET."' alt='' style='vertical-align: middle;' />" : "<img src='".THEME."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />");
+		if(defined("BULLET"))
+		{
+        	$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;' />";
+
+		}
+		else
+		{
+        	$this -> bullet = "";
+		}
+
 		$this -> debug = $debug;
 
 		if($this -> debug)
@@ -122,7 +146,7 @@
 					extract($page);
 					$text .= $this -> bullet." <a href='".e_BASE."page.php?".$page_id."'>".$page_title."</a><br />";
 				}
-				$ns -> tablerender(LAN_PAGE_11, $text);
+				$ns -> tablerender(LAN_PAGE_11, $text,"cpage_list");
 			}
 		}
 	}
@@ -137,10 +161,11 @@
 
 		if(!$sql -> db_Select_gen($query) && !$_GET['elan'])
 		{
-			require_once(HEADERF);
-			message_handler("MESSAGE", LAN_PAGE_3);
-			require_once(FOOTERF); 
-			exit;
+			$ret['title'] = LAN_PAGE_12;			// ***** CHANGED
+			$ret['text'] = LAN_PAGE_3;
+			$ret['comment_flag'] = '';
+			$ret['err'] = TRUE;
+			return $ret;
 		}
 
 		extract($sql -> db_Fetch());
@@ -174,9 +199,10 @@
 
 		$ret['title'] = $page_title;
 		$ret['text'] = $text;
-        $ret['comment_flag'] = $page_comment_flag;
+		$ret['comment_flag'] = $page_comment_flag;
+		$ret['err'] = FALSE;
 
-	 	return $ret;
+		return $ret;
 	}
 
 	function parsePage()
@@ -225,7 +251,7 @@
 		foreach($this -> pageTitles as $title)
 		{
 			$titlep = preg_replace("/\[newpage=(.*?)\]/", "\\1", $title);
-			$this -> pageTitles[$count] = ($titlep == "[newpage]" ? "Page ".($count+1)."&nbsp;" : $tp -> toHTML($titlep, TRUE, 'parse_sc, constants'));
+			$this -> pageTitles[$count] = ($titlep == "[newpage]" ? LAN_PAGE_13." ".($count+1)."&nbsp;" : $tp -> toHTML($titlep, TRUE, 'parse_sc, constants,emotes_off,no_make_clickable'));
 			$count++;
 		}
 
@@ -281,12 +307,16 @@
 			}
 			$rate_text .= "</td><td style='width:50%; text-align:right'>";
 
-			if (!$rater->checkrated("page", $this -> pageID) && USER) {
+			if (!$rater->checkrated("page", $this -> pageID) && USER)
+			{
 				$rate_text .= $rater->rateselect("&nbsp;&nbsp;&nbsp;&nbsp; <b>".LAN_PAGE_4."</b>", "page", $this -> pageID);
 			}
-			else if(!USER) {
+			else if(!USER)
+			{
 				$rate_text .= "&nbsp;";
-			} else {
+			}
+			else
+			{
 				$rate_text .= LAN_PAGE_5;
 			}
 			$rate_text .= "</td></tr></table>";
@@ -306,9 +336,9 @@
 			if (isset($_POST['commentsubmit']))
 			{
 				$cobj->enter_comment($_POST['author_name'], $_POST['comment'], "page", $this -> pageID, $pid, $_POST['subject']);
-						$e107cache->clear("comment.page.".$this -> pageID);
-                        $e107cache->clear($cacheString);
-					}
+				$e107cache->clear("comment.page.".$this -> pageID);
+				$e107cache->clear($cacheString);
+			}
 
 			return $cobj->compose_comment("page", "comment", $this -> pageID, $width="", $subject="", $showrate=FALSE, $return=TRUE);
 		}
@@ -316,7 +346,7 @@
 
 	function pageCheckPerms($page_class, $page_password)
 	{
-		global $ns, $HEADER, $FOOTER, $sql;
+		global $ns, $tp, $HEADER, $FOOTER, $sql;     // $tp added
 
 		if (!check_class($page_class))
 		{
@@ -335,9 +365,9 @@
 			{
 				$this -> setPageCookie();
 			}
-			}
-			else
-			{
+		}
+		else
+		{
 			$cookiename = "e107page_".$this -> pageID;
 
 			if($_COOKIE[$cookiename] == md5($page_password.USERID))
@@ -351,28 +381,32 @@
 			message_handler("MESSAGE", LAN_PAGE_7);
 		}
 
-			$text = "
-			<div style='text-align:center; margin-left:auto; margin-right: auto;'>
-			<form method='post' action='".e_SELF."?".e_QUERY."' id='pwform'>
-			<table style='width:100%;' class='fborder'>
-			<tr>
-			<td class='forumheader' colspan='3' style='text-align:center; white-space:nowrap'>".LAN_PAGE_8."</td>
-			</tr>
-			<tr>
-			<td class='forumheader3' style='width:20%;'>".LAN_PAGE_9.":</td>
-			<td class='forumheader3' style='width: 60%;'><input type='password' id='page_pw' name='page_pw' style='width: 90%;'/></td>
-			<td class='forumheader3' style='width:20%; vertical-align:middle; margin-left:auto; margin-right:auto; text-align:center;'><img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' /></td>
-			</tr>
-			<tr>
-			<td class='forumheader' colspan='3' style='text-align:center;'><input class='button' type='submit' name='submit_page_pw' value='".LAN_PAGE_10."' /></td>
-			</tr>
-			</table>
-			</form>
-			</div>
-			";
+		$pw_entry_text = "
+		<div style='text-align:center; margin-left:auto; margin-right: auto;'>
+		<form method='post' action='".e_SELF."?".e_QUERY."' id='pwform'>
+		<table style='width:100%;' class='fborder'>
+		<tr>
+		<td class='forumheader' colspan='3' style='text-align:center; white-space:nowrap'>".LAN_PAGE_8."</td>
+		</tr>
+		<tr>
+		<td class='forumheader3' style='width:20%;'>".LAN_PAGE_9.":</td>
+		<td class='forumheader3' style='width: 60%;'><input type='password' id='page_pw' name='page_pw' style='width: 90%;'/></td>
+		<td class='forumheader3' style='width:20%; vertical-align:middle; margin-left:auto; margin-right:auto; text-align:center;'><img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' /></td>
+		</tr>
+		<tr>
+		<td class='forumheader' colspan='3' style='text-align:center;'><input class='button' type='submit' name='submit_page_pw' value='".LAN_PAGE_10."' /></td>
+		</tr>
+		</table>
+		</form>
+		</div>
+		";
+		// Mustn't return to higher level code here
 
-			$ns->tablerender("&nbsp;", $text);
-		require_once(FOOTERF); exit;
+		// 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
+		require_once(FOOTERF);
+		exit;
 	}
 
 	function setPageCookie()
diff -ruN 0.7.5/print.php 0.7.7/print.php
--- 0.7.5/print.php	2005-09-05 20:52:25.000000000 -0500
+++ 0.7.7/print.php	2006-11-18 12:42:12.000000000 -0600
@@ -11,12 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/print.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/09/06 01:52:25 $
+|     $Revision: 1.10 $
+|     $Date: 2006/11/18 18:42:12 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
+$HEADER="";
+$FOOTER="";
+require_once(HEADERF);
+
 $qs = explode(".", e_QUERY);
 if ($qs[0] == "") {
 	header("location:".e_BASE."index.php");
@@ -62,11 +66,11 @@
 	}
 	$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\">
-	<b>".LAN_135.": ".$news_title."</b>
+	<b>".LAN_PRINT_135.": ".$news_title."</b>
 	<br />
-	(".LAN_86." ".$category_name.")
+	(".LAN_PRINT_86." ".$category_name.")
 	<br />
-	".LAN_94." ".$a_name."<br />
+	".LAN_PRINT_94." ".$a_name."<br />
 	".$news_datestamp."
 	<br /><br />".
 	$news_body;
@@ -75,23 +79,24 @@
 	if ($news_source != ""){ $text .= "<br /><br />".$news_source; }
 	if ($news_url != ""){ $text .= "<br />".$news_url; }
 	 
-	$text .= "<br /><br /><hr />".
-	LAN_303.SITENAME."
+	$text .= "<br /><br /></font><hr />".
+	LAN_PRINT_303.SITENAME."
 	<br />
 	( http://".$_SERVER[HTTP_HOST].e_HTTP."comment.php?comment.news.".$news_id." )
-	</font>";
+	";
+}
+
+if(defined("TEXTDIRECTION") && TEXTDIRECTION == "rtl"){
+	$align = 'right';
+}else{
+	$align = 'left';
 }
 
 echo "
-	<div style=\"text-align:center\">
-	";
-	echo $tp->parseTemplate("{LOGO}", TRUE);
-	echo "
-	</div>
-	<hr />
-	<br />
-	";
-echo $text;
-echo "<br /><br /><div style='text-align:center'><form><input type='button' value='".LAN_307."' onClick='window.print()'></form></div>";
-	
+<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>";
+
+require_once(FOOTERF);
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/request.php 0.7.7/request.php
--- 0.7.5/request.php	2006-04-05 07:19:17.000000000 -0500
+++ 0.7.7/request.php	2006-11-09 03:28:58.000000000 -0600
@@ -12,13 +12,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/request.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/04/05 12:19:17 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.40 $
+|     $Date: 2006/11/09 09:28:58 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_download.php");
 
 if (!e_QUERY || isset($_POST['userlogin'])) {
 	header("location: {$e107->base_path}");
@@ -107,7 +108,7 @@
 
 if ($type == "file")
 {
-	$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 = {$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 = {$id}";
 	if ($sql->db_Select_gen($qry)) {
 		$row = $sql->db_Fetch();
 		if (check_class($row['download_category_class']) && check_class($row['download_class'])) {
@@ -167,7 +168,7 @@
 				echo $binary_data;
 				exit();
 			}
-			if (strstr($download_url, "http://") || strstr($download_url, "ftp://" || strstr($download_url, "https://"))) {
+			if (strstr($download_url, "http://") || strstr($download_url, "ftp://") || strstr($download_url, "https://")) {
 				header("Location: {$download_url}");
 				exit();
 			} else {
@@ -281,7 +282,7 @@
 		exit();
 	}
 	@set_time_limit(10 * 60);
-	@ini_set("max_execution_time", 10 * 60);
+	@e107_ini_set("max_execution_time", 10 * 60);
 	while (@ob_end_clean()); // kill all output buffering else it eats server resources
 	$filename = $file;
 	$file = basename($file);
@@ -368,8 +369,7 @@
 			$row=$sql->db_Fetch();
 			if($row['count'] >= $limits['gen_intdata']) {
 				// Exceeded download count limit
-				@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_download.php");
-				@include_once(e_LANGUAGEDIR."English/lan_download.php");
+
 				require_once(HEADERF);
 				$ns->tablerender(LAN_dl_61, LAN_dl_62);
 				require(FOOTERF);
@@ -393,8 +393,6 @@
 			$row=$sql->db_Fetch();
 			if($row['total_bw'] / 1024 > $limit['gen_user_id']) {
 				//Exceed bandwith limit
-				@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_download.php");
-				@include_once(e_LANGUAGEDIR."English/lan_download.php");
 				require(HEADERF);
 				$ns->tablerender(LAN_dl_61, LAN_dl_62);
 				require(FOOTERF);
diff -ruN 0.7.5/robots.txt 0.7.7/robots.txt
--- 0.7.5/robots.txt	2006-02-15 04:44:25.000000000 -0600
+++ 0.7.7/robots.txt	2006-08-26 21:24:44.000000000 -0500
@@ -1,6 +1,5 @@
 User-agent: *
 Disallow: /e107_admin/
-Disallow: /e107_install/
 Disallow: /e107_handlers/
 Disallow: /e107_files/cache/
 Disallow: /e107_files/public/avatars/
diff -ruN 0.7.5/search.php 0.7.7/search.php
--- 0.7.5/search.php	2006-04-21 20:22:40.000000000 -0500
+++ 0.7.7/search.php	2006-11-09 14:48:27.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/search.php,v $
-|     $Revision: 1.53 $
-|     $Date: 2006/04/22 01:22:40 $
-|     $Author: e107coders $
+|     $Revision: 1.55 $
+|     $Date: 2006/11/09 20:48:27 $
+|     $Author: sweetas $
 +----------------------------------------------------------------------------+
 */
 
@@ -386,7 +386,7 @@
 $text = preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TOP_TABLE);
 foreach ($enhanced_types as $en_id => $ENHANCED_TEXT) {
 	$ENHANCED_DISPLAY_ID = "en_".$en_id;
-	$ENHANCED_FIELD = "<input class='tbox' type='text' id='".$en_id."' name='".$en_id."' size='35' value='".$_GET[$en_id]."' maxlength='50' />";
+	$ENHANCED_FIELD = "<input class='tbox' type='text' id='".$en_id."' name='".$en_id."' size='35' value='".$tp->post_toForm($_GET[$en_id])."' maxlength='50' />";
 	$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_ENHANCED);
 }
 if ($search_prefs['user_select']) {
@@ -493,19 +493,26 @@
 }
 
 function headerjs() {
-	global $search_count, $google_id, $search_prefs, $js_adv;
+	global $search_count, $google_id, $search_prefs, $js_adv, $search_info;
 	if ($search_prefs['selector'] == 1) {
+		
+		$types = array_keys($search_info);
+		$types = implode("', '", $types);
+		
 		$script = "<script type='text/javascript'>
 		<!--
+		var i;
+		var stypes = new Array('".$types."');
+		
 		function checkAll(allbox) {
-			for (var i = 0; i < ".$search_count."; i++)
-			document.getElementById('searchform')[\"t[\" + i + \"]\"].checked = true ;
+			for (var i in stypes)
+			document.getElementById('searchform')[\"t[\" + stypes[i] + \"]\"].checked = true ;
 			uncheckG();
 		}
 
 		function uncheckAll(allbox) {
-			for (var i = 0; i < ".$search_count."; i++)
-			document.getElementById('searchform')[\"t[\" + i + \"]\"].checked = false ;
+			for (var i in stypes)
+			document.getElementById('searchform')[\"t[\" + stypes[i] + \"]\"].checked = false ;
 		}\n";
 
 		if (check_class($search_prefs['google'])) {
diff -ruN 0.7.5/signup.php 0.7.7/signup.php
--- 0.7.5/signup.php	2006-05-15 20:31:12.000000000 -0500
+++ 0.7.7/signup.php	2006-11-14 08:55:56.000000000 -0600
@@ -11,111 +11,158 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/signup.php,v $
-|     $Revision: 1.89 $
-|     $Date: 2006/05/16 01:31:12 $
+|     $Revision: 1.102 $
+|     $Date: 2006/11/14 14:55:56 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
-include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_usersettings.php");
+$qs = explode(".", e_QUERY);
+if($qs[0] != "activate"){   // multi-language fix.
+	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php");
+	e107_include_once(e_LANGUAGEDIR."English/lan_signup.php");
+	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_usersettings.php");
+}
+
 include_once(e_HANDLER."user_extended_class.php");
 $usere = new e107_user_extended;
 require_once(e_HANDLER."calendar/calendar_class.php");
 $cal = new DHTML_Calendar(true);
 
-$fname = "signup_template.php";
-if(is_readable(THEME."templates/".$fname))
-{
-	include_once(THEME."templates/".$fname);
+if (is_readable(THEME."signup_template.php")) {
+	require_once(THEME."signup_template.php");
+} else {
+	require_once(e_THEME."templates/signup_template.php");
 }
-elseif(is_readable(THEME.$fname))
-{
-	include_once(THEME.$fname);
-}
-if(is_readable(e_THEME."templates/{$fname}"))
-{
-	include_once(e_THEME."templates/{$fname}");
-}
-
-
 
 include_once(e_FILE."shortcode/batch/signup_shortcodes.php");
 
 $signup_imagecode = ($pref['signcode'] && extension_loaded("gd"));
 
 // Resend Activation Email ------------------------------------------->
-if(e_QUERY == "resend" && !USER)
+if(e_QUERY == "resend" && !USER && ($pref['user_reg_veri'] == 1))
 {
+	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
+	e107_include_once(e_LANGUAGEDIR."English/lan_".e_PAGE);
 	require_once(HEADERF);
-	$clean_email = check_email($tp -> toDB($_POST['resend_email']));
 
-	if($_POST['submit_resend'])
+    if(!$clean_email = check_email($tp -> toDB($_POST['resend_email'])))
 	{
-		if($sql->db_Select("user", "*", "user_email = \"".$tp->toDB($clean_email)."\" AND user_ban=0"))
-		{
-			$ns -> tablerender("Activation not necessary","Your account is already activated.<br />");
-			require_once(FOOTERF);
-			exit;
-		}
+		$clean_email = "xxx";
+	}
 
-		if($sql->db_Select("user", "*", "user_email = \"".$tp->toDB($clean_email)."\" AND user_ban=2 AND user_sess !='' LIMIT 1"))
-		$row = $sql -> db_Fetch();
+    if(!$new_email = check_email($tp -> toDB($_POST['resend_newemail'])))
+	{
+    	$new_email = FALSE;
+	}
 
-		$_POST['password1'] = "xxxxxxxx";
-		$_POST['loginname'] = $row['user_loginname'];
-		$_POST['name'] = $row['user_name'];
-		$nid = $row['user_id'];
-		$u_key = $row['user_sess'];
 
-		$eml = render_email();
-        $mailheader_e107id = $nid;
-		require_once(e_HANDLER."mail.php");
-		if(!sendemail($row['user_email'], $eml['subject'], $eml['message'], $row['user_name'], "", "", $eml['attachments'], $eml['cc'], $eml['bcc'], $returnpath, $returnreceipt,$eml['inline-images']))
+	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."\" ) "))
 		{
-			$ns -> tablerender("Error","There was a problem, the registration mail was not sent, please contact the website administrator.");
+			$ns -> tablerender(LAN_SIGNUP_40,LAN_SIGNUP_41."<br />");
 			require_once(FOOTERF);
 			exit;
 		}
-		else
+
+		if(trim($_POST['resend_password']) !="" && $new_email)
 		{
-			$ns -> tablerender("Email Sent","Activation email sent to: ".$row['user_email']." - Please check your inbox.<br /><br />");
-			require_once(FOOTERF);
-			exit;
+        	if($sql->db_Select("user", "user_id", "user_password = \"".md5($_POST['resend_password'])."\" AND user_ban=2 AND user_sess !='' LIMIT 1"))
+			{
+				$row = $sql -> db_Fetch();
+            	if($sql->db_Update("user", "user_email='".$new_email."' WHERE user_id = '".$row['user_id']."' LIMIT 1 "))
+				{
+                	$clean_email = $new_email;
+				}
+			}
+			else
+			{
+			   	require_once(e_HANDLER."message_handler.php");
+			   	message_handler("ALERT",LAN_SIGNUP_52); // Incorrect Password.
+			}
 		}
 
+		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();
+
+			$_POST['password1'] = "xxxxxxxxx";
+			$_POST['loginname'] = $row['user_loginname'];
+			$_POST['name'] = $row['user_name'];
+			$nid = $row['user_id'];
+			$u_key = $row['user_sess'];
+
+			$eml = render_email();
+        	$mailheader_e107id = $nid;
+			require_once(e_HANDLER."mail.php");
+
+
+/*            echo "Sending to: ".$row['user_email'];
+            require_once(FOOTERF);
+            exit;
+*/
+
+            if(!sendemail($row['user_email'], $eml['subject'], $eml['message'], $row['user_name'], "", "", $eml['attachments'], $eml['cc'], $eml['bcc'], $returnpath, $returnreceipt,$eml['inline-images']))
+            {
+                $ns -> tablerender(LAN_ERROR,LAN_SIGNUP_42);
+                require_once(FOOTERF);
+                exit;
+            }
+            else
+            {
+                $ns -> tablerender(LAN_SIGNUP_43,LAN_SIGNUP_44." ".$row['user_email']." - ".LAN_SIGNUP_45."<br /><br />");
+                require_once(FOOTERF);
+                exit;
+            }
+         }
+		exit;
 	}
-	else
+	elseif(!$_POST['submit_resend'])
 	{
-		$text = "<div style='text-align:center'>
+
+		$text .= "<div style='text-align:center'>
 		<form method='post' action='".e_SELF."?resend' name='resend_form'>
-		<table style='width:99%' class='fborder'>
+		<table style='".USER_WIDTH."' class='fborder'>
 		<tr>
-		<td class='forumheader3'>
-		If you have already registered but did not receive an email to activate your account, please enter the email address you used during registration below. A new activation email will be resent to you at that address.
+			<td class='forumheader3' style='text-align:right'>".LAN_SIGNUP_48."</td>
+        <td class='forumheader3'>
+		<input type='text' name='resend_email' class='tbox' size='50' style='max-width:80%' value='' maxlength='80' />
 		</td>
 		</tr>
-		<tr><td class='forumheader3'>".LAN_112."
-		<input type='text' name='resend_email' class='tbox' style='width:80%' value='' />
+
+		<tr>
+			<td class='forumheader3' colspan='2'>".LAN_SIGNUP_49."</td>
+		</tr>
+		<tr>
+			<td class='forumheader3' style='text-align:right;width:30%'>".LAN_SIGNUP_50."</td>
+			<td class='forumheader3'><input type='text' name='resend_newemail' class='tbox' size='50' style='max-width:80%' value='' maxlength='80' />
+		</tr>
+		<tr>
+			<td class='forumheader3' style='text-align:right'>".LAN_SIGNUP_51."</td>
+			<td class='forumheader3'><input type='text' name='resend_password' class='tbox' size='50' style='max-width:80%' value='' maxlength='80' />
+
 		</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_resend' value='Send Activation Email' />";
+		$text .= "<input class='button' type='submit' name='submit_resend' value=\"".LAN_SIGNUP_47."\" />";  // resend activation email.
 		$text .= "</td>
 		</tr>
 		</table>
 		</form>
 		</div>";
 
-		$ns -> tablerender("Resend Activation Email", $text);
+		$ns -> tablerender(LAN_SIGNUP_47, $text);
 		require_once(FOOTERF);
 		exit;
 	}
 
-
+    exit;
 }
 
 // ------------------------------------------------------------------
@@ -128,7 +175,6 @@
 	$password1 = "";
 	$password2 = "";
 	$email = "";
-	$name = "";
 	$loginname = "";
 	$realname = "";
 	$user_timezone = "";
@@ -141,6 +187,8 @@
 
 if(ADMIN && (e_QUERY == "preview" || e_QUERY == "test"  || e_QUERY == "preview.aftersignup"))
 {
+	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
+	e107_include_once(e_LANGUAGEDIR."English/lan_".e_PAGE);
 	if(e_QUERY == "preview.aftersignup")
 	{
 		require_once(HEADERF);
@@ -179,12 +227,11 @@
 
 		if(!sendemail(USEREMAIL, $subj, $message, USERNAME, "", "", $attachments, $Cc, $Bcc, $returnpath, $returnreceipt,$inline))
 		{
-			//	if(!sendemail(USEREMAIL, $subj, $message, USERNAME)) {
-			echo "<br /><br /><br /><br >&nbsp;&nbsp;>> There was a problem, the registration mail was not sent, please contact the website administrator.";
+			echo "<br /><br /><br /><br >&nbsp;&nbsp;>> ".LAN_SIGNUP_42; // there was a problem.
 		}
 		else
 		{
-			echo "<br /><br />&nbsp;&nbsp;>> Email Sent to: ".USEREMAIL." - Check your inbox!";
+			echo "<br /><br />&nbsp;&nbsp;>> ".LAN_SIGNUP_43." [ ".USEREMAIL." ] - ".LAN_SIGNUP_45;
 		}
 	}
 	exit;
@@ -223,11 +270,33 @@
 	exit;
 }
 
+// After clicking the activation link -------------------------
 if (e_QUERY)
 {
 	$qs = explode(".", e_QUERY);
-	if ($qs[0] == "activate" && count($qs) == 3 && $qs[2])
+	if ($qs[0] == "activate" && (count($qs) == 3 || count($qs) == 4) && $qs[2])
 	{
+        // return the message in the correct language.
+		if($qs[3] && strlen($qs[3]) == 2 )
+		{
+			require_once(e_HANDLER."language_class.php");
+			$lng = new language;
+			$the_language = $lng->convert($qs[3]);
+			if(is_readable(e_LANGUAGEDIR.$the_language."/lan_signup.php"))
+			{
+				include(e_LANGUAGEDIR.$the_language."/lan_signup.php");
+			}
+			else
+			{
+				require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php");
+ 			}
+		}
+		else
+		{
+            include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php");
+		}
+
+
 		$e107cache->clear("online_menu_totals");
 		if ($sql->db_Select("user", "*", "user_sess='".$tp -> toDB($qs[2], true)."' "))
 		{
@@ -250,6 +319,7 @@
 	}
 }
 
+
 if (isset($_POST['register']))
 {
 	$e107cache->clear("online_menu_totals");
@@ -313,7 +383,12 @@
 	{
 		$error_message .= LAN_103."\\n";
 		$error = TRUE;
-		$name = "";
+	}
+
+	// Use LoginName for DisplayName if restricted   **** MOVED FORWARD ****
+	if (!check_class($pref['displayname_class']))
+	{
+		$_POST['name'] = $_POST['loginname'];
 	}
 
 	// Check for disallowed names.
@@ -325,7 +400,6 @@
 			if( strstr($_POST['name'], $disallow) || strstr($_POST['loginname'], $disallow) ){
 				$error_message .= LAN_103."\\n";
 				$error = TRUE;
-				$name = "";
 			}
 		}
 	}
@@ -339,16 +413,14 @@
 	// Display Name exists.
 	if ($sql->db_Select("user", "*", "user_name='".$tp -> toDB($_POST['name'])."'"))
 	{
-		$error_message .= LAN_411."\\n";
+		$error_message .= LAN_411.": ".$tp -> toDB($_POST['name'])."\\n";
 		$error = TRUE;
-		$name = "";
 	}
 	// Login Name exists
 	if ($sql->db_Select("user", "*", "user_loginname='".$tp -> toDB($_POST['loginname'])."' "))
 	{
-		$error_message .= LAN_104."\\n";
+		$error_message .= LAN_104.": ".$tp -> toDB($_POST['loginname'])."\\n";
 		$error = TRUE;
-		$name = "";
 	}
 
 	// check for multiple signups from the same IP address.
@@ -380,7 +452,7 @@
 	}
 
 	// Password length check.
-	if (strlen($_POST['password1']) < $pref['signup_pass_len'])
+	if (trim(strlen($_POST['password1'])) < $pref['signup_pass_len'])
 	{
 		$error_message .= LAN_SIGNUP_4.$pref['signup_pass_len'].LAN_SIGNUP_5."\\n";
 		$error = TRUE;
@@ -388,14 +460,8 @@
 		$password2 = "";
 	}
 
-	// Use LoginName for DisplayName if restricted
-	if (!check_class($pref['displayname_class']))
-	{
-		$_POST['name'] = $_POST['loginname'];
-	}
-
 	// Check for emtpy fields
-	if ($_POST['name'] == "" || $_POST['loginname'] == "" || $_POST['password1'] == "" || $_POST['password2'] = "")
+	if (trim($_POST['name']) == "" || trim($_POST['loginname']) == "" || trim($_POST['password1']) == "" || trim($_POST['password2']) == "")
 	{
 		$error_message .= LAN_185."\\n";
 		$error = TRUE;
@@ -437,13 +503,33 @@
 	{
 		if(isset($_POST['ue']['user_'.$ext['user_extended_struct_name']]))
 		{
-			$newval = $_POST['ue']['user_'.$ext['user_extended_struct_name']];
-			if($ext['user_extended_struct_required'] == 1 && trim($newval) == "" )
+
+			$newval = trim($_POST['ue']['user_'.$ext['user_extended_struct_name']]);
+			if($ext['user_extended_struct_required'] == 1 && $newval == "" )
 			{
 				$_ftext = (defined($ext['user_extended_struct_text']) ? constant($ext['user_extended_struct_text']) : $ext['user_extended_struct_text']);
 				$error_message .= LAN_SIGNUP_6.$_ftext.LAN_SIGNUP_7."\\n";
 				$error = TRUE;
 			}
+			$parms = explode("^,^", $ext['user_extended_struct_parms']);
+			$regex = (isset($parms[1]) ? $tp->toText($parms[1]) : "");
+			$regexfail = (isset($parms[2]) ? trim($tp->toText($parms[2])) : "");
+
+			if($regexfail == "")
+			{
+				$regexfail = $ext['user_extended_struct_name']." ".LAN_SIGNUP_53;
+			}
+	
+			if(defined($regexfail)) {$regexfail = constant($regexfail);}
+
+			if($regex != "" && $newval != "")
+			{
+				if(!preg_match($regex, $newval))
+				{
+					$error_message .= $regexfail."\\n";
+					$error = TRUE;
+				}
+			}
 		}
 	}
 
@@ -474,7 +560,7 @@
 	}
 
 	// Check email address on remote server (if enabled).
-	if ($pref['signup_remote_emailcheck'] && $error != TRUE)
+	if (varsettrue($pref['signup_remote_emailcheck']) && $error != TRUE)
 	{
 		require_once(e_HANDLER."mail_validation_class.php");
 		list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL);
@@ -484,7 +570,7 @@
 		$validator->timeout=3;
 		//	$validator->debug=1;
 		//	$validator->html_debug=1;
-		if($validator->ValidateEmailBox($_POST['email']) != 1)
+		if($validator->ValidateEmailBox(trim($_POST['email'])) != 1)
 		{
 			$error_message .= LAN_106."\\n";
 			$error = TRUE;
@@ -568,12 +654,12 @@
 
 				if(!sendemail($_POST['email'], $eml['subject'], $eml['message'], "", "", "", $eml['attachments'], $eml['cc'], $eml['bcc'], "", "", $eml['inline-images']))
 				{
-					$error_message = "There was a problem, the registration mail was not sent, please contact the website administrator.";
+					$error_message = LAN_SIGNUP_42; // There was a problem, the registration mail was not sent, please contact the website administrator.
 				}
 			}
 
-			$edata_su = array("username" => $username, "email" => $_POST['email'], "signature" => $_POST['signature'], "image" => $_POST['image'], "timezone" => $_POST['timezone'], "hideemail" => $_POST['hideemail'], "ip" => $ip, "realname" => $_POST['realname'], "xup" => $_POST['xupexist']);
-			$e_event->trigger("usersup", $edata_su);
+            $_POST['ip'] = $ip;
+			$e_event->trigger("usersup", $_POST);  // send everything in the template, including extended fields.
 
 			require_once(HEADERF);
 			if($pref['signup_text_after'])
@@ -628,9 +714,8 @@
 			}
 
 			// ==========================================================
-
-			$edata_su = array("username" => $username, "email" => $_POST['email'], "signature" => $_POST['signature'], "image" => $_POST['image'], "timezone" => $_POST['timezone'], "hideemail" => $_POST['hideemail'], "ip" => $ip, "realname" => $_POST['realname'], "xup" => $_POST['xupexist']);
-			$e_event->trigger("usersup", $edata_su);
+            $_POST['ip'] = $ip;
+			$e_event->trigger("usersup", $_POST);  // send everything in the template, including extended fields.
 
 			if($pref['signup_text_after'])
 			{
@@ -739,7 +824,7 @@
 		$u_key = "1234567890ABCDEFGHIJKLMNOP";
 	}
 
-	define("RETURNADDRESS", (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$nid.".".$u_key : SITEURL."/signup.php?activate.".$nid.".".$u_key));
+	define("RETURNADDRESS", (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$nid.".".$u_key : SITEURL."/signup.php?activate.".$nid.".".$u_key.".".e_LAN));
 	$pass_show = ($pref['user_reg_secureveri'])? "*******" : $_POST['password1'];
 
 	if (file_exists(THEME."email_template.php"))
@@ -833,4 +918,4 @@
 
 	return $ret;
 }
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/sitedown.php 0.7.7/sitedown.php
--- 0.7.5/sitedown.php	2005-06-11 17:24:48.000000000 -0500
+++ 0.7.7/sitedown.php	2006-06-29 23:16:39.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/sitedown.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/06/11 22:24:48 $
-|     $Author: streaky $
+|     $Revision: 1.9 $
+|     $Date: 2006/06/30 04:16:39 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -24,22 +24,24 @@
 e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitedown.php");
 e107_include_once(e_LANGUAGEDIR."English/lan_sitedown.php");
 
-if($pref['maintainance_text']) {
-	$SITEDOWN_TABLE_MAINTAINANCETEXT = $tp->toHTML($pref['maintainance_text'], TRUE, 'parse_sc', 'admin');
-} else {
-	$SITEDOWN_TABLE_MAINTAINANCETEXT = "<b>- ".SITENAME." ".LAN_00." -</b><br /><br />".LAN_01 ;
+if (!$pref['maintainance_flag'] )
+{
+	header("location: ".SITEURL);
 }
 
-$SITEDOWN_TABLE_PAGENAME = PAGE_NAME;
-	
+require_once(e_FILE."shortcode/batch/sitedown_shortcodes.php");
+
 if (!$SITEDOWN_TABLE) {
-	if (file_exists(THEME."sitedown_template.php")) {
+	if (file_exists(THEME."sitedown_template.php"))
+	{
 		require_once(THEME."sitedown_template.php");
-	} else {
+	}
+	else
+	{
 		require_once(e_THEME."templates/sitedown_template.php");
 	}
 }
 
-echo preg_replace("/\{(.*?)\}/e", '$\1', $SITEDOWN_TABLE);
-	
+	echo $tp->parseTemplate($SITEDOWN_TABLE, TRUE, $sitedown_shortcodes);
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/submitnews.php 0.7.7/submitnews.php
--- 0.7.5/submitnews.php	2005-12-24 16:53:38.000000000 -0600
+++ 0.7.7/submitnews.php	2006-08-08 23:07:01.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/submitnews.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2005/12/24 22:53:38 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2006/08/09 04:07:01 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -22,13 +22,13 @@
 if (!isset($pref['subnews_class']))
 {
     $pref['subnews_class'] = "0";
-} 
+}
 if (!check_class($pref['subnews_class']))
 {
     $ns->tablerender(NWSLAN_12, NWSLAN_11);
     require_once(FOOTERF);
     exit;
-} 
+}
 
 $author_name = $tp->toDB($_POST['author_name']);
 $author_email = $tp->toDB(check_email($_POST['author_email']));
@@ -46,10 +46,10 @@
         {
             header("location:" . e_BASE . "index.php");
             exit;
-        } 
+        }
         $itemtitle = $tp->toDB($_POST['itemtitle']);
         $item = $tp->toDB($_POST['item']);
-        $item = str_replace("src=&quot;e107_images", "src=&quot;" . SITEURL . "e107_images", $item); 
+        $item = str_replace("src=&quot;e107_images", "src=&quot;" . SITEURL . "e107_images", $item);
         // Process File Upload    =================================================
         if ($_FILES['file_userfile'] && $pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS)
         {
@@ -63,22 +63,22 @@
             if (!$pref['upload_maxfilesize'])
             {
                 $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576;
-            } 
+            }
 
             if ($uploaded && $fileext != "jpg" && $fileext != "gif" && $fileext != "png")
             {
                 $message = SUBNEWSLAN_3;
                 $error = true;
-            } 
+            }
 
             if ($filesize > $pref['upload_maxfilesize'])
             {
                 $message = SUBNEWSLAN_4;
                 $error = true;
-            } 
+            }
 
             if (!$error)
-            { 
+            {
                 // $numberoffiles = count($uploaded);
                 $today = getdate();
                 $newname = USERID . "_" . $today[0] . "_" . str_replace(" ", "_", substr($itemtitle, 0, 6)) . "." . $fileext;
@@ -89,42 +89,44 @@
                     if (!resize_image(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname, $rezwidth))
                     {
                         rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname);
-                    } 
+                    }
                 } elseif ($file)
                 {
                     rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname);
-                } 
-            } 
-        } 
+                }
+            }
+        }
 
         if ($error == false)
         {
             if (!file_exists(e_IMAGE . "newspost_images/" . $newname))
             {
                 $newname = "";
-            } 
+            }
             $sql->db_Insert("submitnews", "0, '$user', '$email', '$itemtitle', '".intval($_POST['cat_id'])."','$item', '" . time() . "', '$ip', '0', '$newname' ");
             $edata_sn = array("user" => $user, "email" => $email, "itemtitle" => $itemtitle, "catid" => intval($_POST['cat_id']), "item" => $item, "ip" => $ip, "newname" => $newname);
             $e_event->trigger("subnews", $edata_sn);
             $ns->tablerender(LAN_133, "<div style='text-align:center'>" . LAN_134 . "</div>");
             require_once(FOOTERF);
             exit;
-        } 
+        }
         else
         {
             require_once(e_HANDLER . "message_handler.php");
             message_handler("P_ALERT", $message);
-        } 
-    } 
-} 
+        }
+    }
+}
+
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
 $text = "<div style='text-align:center'>
 	<form id='dataform' method='post' action='" . e_SELF . "' enctype='multipart/form-data' onsubmit='return frmVerify()'>\n
-	<table style='width:95%' class='fborder'>";
+	<table style='".USER_WIDTH."' class='fborder'>";
 if (!USER)
 {
     $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']))
@@ -132,7 +134,7 @@
     $text .= " <tr>
 	<td colspan='2' class='forumheader3'>" . $news_aj->tpa($pref['news_subheader']) . "</td>
 	</tr>";
-} 
+}
 // end barry
 $text .= " <tr>
 	<td style='width:20%' class='forumheader3'>" . NWSLAN_6 . ": </td>
@@ -140,7 +142,7 @@
 if (!$sql->db_Select("news_category"))
 {
     $text .= NWSLAN_10;
-} 
+}
 else
 {
     $text .= "
@@ -148,9 +150,9 @@
     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>");
-    } 
+    }
     $text .= "</select>";
-} 
+}
 $text .= "</td>
 	</tr><tr>
 	<td style='width:20%' class='forumheader3'>" . LAN_62 . "</td>
@@ -162,11 +164,11 @@
 {
     require_once(e_HANDLER . "tiny_mce/wysiwyg.php");
     echo wysiwyg("item");
-} 
+}
 
-$insertjs = (!$pref['subnews_htmlarea'])?"rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'" : "rows='25' style='width:100%' ";
+$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'>
@@ -182,7 +184,7 @@
 		<input class='tbox' type='file' name='file_userfile[]' style='width:90%' />
 		</td>
 		</tr>\n";
-} 
+}
 
 $text .= "
 	<tr>
@@ -213,6 +215,6 @@
 		}
 		</script>";
     return $script;
-} 
+}
 
 ?>
\ No newline at end of file
diff -ruN 0.7.5/top.php 0.7.7/top.php
--- 0.7.5/top.php	2006-02-24 07:54:22.000000000 -0600
+++ 0.7.7/top.php	2006-08-03 20:26:35.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/top.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/02/24 13:54:22 $
-|     $Author: whoisrich $
+|     $Revision: 1.11 $
+|     $Date: 2006/08/04 01:26:35 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -40,12 +40,23 @@
 if ($action == "active") {
 	require_once(e_HANDLER."userclass_class.php");
 	 
-	$query = "SELECT t.*, f.forum_name, u.user_name from #forum_t as t
-			LEFT JOIN #forum AS f ON t.thread_forum_id = f.forum_id 
-			LEFT JOIN #user AS u ON t.thread_user = u.user_id
-			WHERE  t.thread_parent = 0
-			ORDER BY t.thread_views DESC 
-			LIMIT {$from}, {$view}";
+	$query = "
+			SELECT 
+				t.*, f.forum_name, f.forum_class, u.user_name, fp.forum_class FROM #forum_t AS t
+			LEFT JOIN #forum AS f 
+				ON t.thread_forum_id = f.forum_id 
+			LEFT JOIN #user AS u 
+				ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+			LEFT JOIN #forum AS fp 
+				ON fp.forum_id = f.forum_parent
+			WHERE  
+				t.thread_parent = 0
+				AND fp.forum_class IN (".USERCLASS_LIST.")
+				AND f.forum_class IN (".USERCLASS_LIST.")
+			ORDER BY 
+				t.thread_views DESC 
+			LIMIT 
+				{$from}, {$view}";
 
 	if ($sql->db_Select_gen($query)) {
 		$text = "<div style='text-align:center'>\n<table style='width:auto' class='fborder'>\n";
diff -ruN 0.7.5/upload.php 0.7.7/upload.php
--- 0.7.5/upload.php	2006-01-10 13:22:30.000000000 -0600
+++ 0.7.7/upload.php	2006-10-22 17:57:54.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/upload.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/01/10 19:22:30 $
+|     $Revision: 1.16 $
+|     $Date: 2006/10/22 22:57:54 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -25,6 +25,8 @@
 
 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);
@@ -56,7 +58,10 @@
 				$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']);
-				$sql->db_Insert("upload", "0, '".$tp -> toDB($poster)."', '".$tp -> toDB(check_email($_POST['file_email']))."', '".$tp -> toDB($_POST['file_website'])."', '".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'])."'");
+				$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;
 			}
 		}
@@ -75,22 +80,17 @@
 
 $text = "<div style='text-align:center'>
 	<form enctype='multipart/form-data' method='post' action='".e_SELF."'>
-	<table style='width:97%' class='fborder'>
+	<table style='".USER_WIDTH."' class='fborder'>
 	<tr>
 	<td style='width:20%' class='forumheader3'>".DOWLAN_11.":</td>
 	<td style='width:80%' class='forumheader3'>";
 
-$sql->db_Select("download_category", "*", "download_category_parent !=0");
-$text .= "<select name='download_category' class='tbox'>\n";
-while ($row = $sql->db_Fetch()) {
-	extract($row);
-	if ($download_category_id == $download_category) {
-		$text .= "<option value='$download_category_id' selected>".$tp->toHTML($download_category_name)."</option>\n";
-	} else {
-		$text .= "<option value='$download_category_id'>".$tp->toHTML($download_category_name)."</option>\n";
-	}
-}
-$text .= "</select>
+	require_once(e_FILE."shortcode/batch/download_shortcodes.php");
+	$dlparm = (isset($download_category)) ? $download_category : "";
+	$text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}",true,$download_shortcodes);
+
+
+$text .= "
 	</td>
 	</tr>
 
@@ -173,4 +173,4 @@
 $ns->tablerender(LAN_417, $text);
 
 require_once(FOOTERF);
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/user.php 0.7.7/user.php
--- 0.7.5/user.php	2006-05-18 20:57:10.000000000 -0500
+++ 0.7.7/user.php	2006-11-07 14:16:40.000000000 -0600
@@ -11,17 +11,24 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/user.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2006/05/19 01:57:10 $
+|     $Revision: 1.41 $
+|     $Date: 2006/11/07 20:16:40 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
 require_once(e_FILE."shortcode/batch/user_shortcodes.php");
+require_once(e_HANDLER."form_handler.php");
 
-if (isset($_POST['delp'])) {
+if (isset($_POST['delp']))
+{
 	$tmp = explode(".", e_QUERY);
-	if (USERID == $tmp[1] || (ADMIN && getperms("4"))) {
+	if ($tmp[0]=="self")
+	{
+		$tmp[1]=USERID;
+	}
+	if (USERID == $tmp[1] || (ADMIN && getperms("4")))
+	{
 		$sql->db_Select("user", "user_sess", "user_id='". USERID."'");
 		@unlink(e_FILE."public/avatars/".$row['user_sess']);
 		$sql->db_Update("user", "user_sess='' WHERE user_id=".intval($tmp[1]));
@@ -30,6 +37,9 @@
 	}
 }
 
+$qs = explode(".", e_QUERY);
+$self_page =($qs[0] == 'id' && intval($qs[1]) == USERID);
+
 if (file_exists(THEME."user_template.php"))
 {
 	require_once(THEME."user_template.php");
@@ -38,50 +48,70 @@
 {
 	require_once(e_BASE.$THEMES_DIRECTORY."templates/user_template.php");
 }
-
+$user_frm = new form;
 require_once(HEADERF);
+if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
-if (!USER) {
-	$ns->tablerender(LAN_20, "<div style='text-align:center'>".LAN_416."</div>");
+if (!check_class(varset($pref['memberlist_access'], 253)) && !$self_page)
+{
+	$ns->tablerender(LAN_20, "<div style='text-align:center'>".USERLAN_2."</div>");
 	require_once(FOOTERF);
 	exit;
 }
 
-if (isset($_POST['records'])) {
+if (isset($_POST['records']))
+{
 	$records = intval($_POST['records']);
 	$order = ($_POST['order'] == 'ASC' ? 'ASC' : 'DESC');
 	$from = 0;
 }
-else if(!e_QUERY) {
+else if(!e_QUERY)
+{
 	$records = 20;
 	$from = 0;
 	$order = "DESC";
-} else {
-	$qs = explode(".", e_QUERY);
-	if ($qs[0] == "id") {
-		$id = $qs[1];
-	} else {
-		$qs = explode(".", e_QUERY);
-		$from = intval($qs[0]);
-		$records = intval($qs[1]);
-		$order = ($qs[2] == 'ASC' ? 'ASC' : 'DESC');
+}
+else
+{
+	if ($qs[0] == "self")
+	{
+		$id = USERID;
+	}
+	else
+	{
+		if ($qs[0] == "id")
+		{
+			$id = $qs[1];
+		}
+		else
+		{
+			$qs = explode(".", e_QUERY);
+			$from = intval($qs[0]);
+			$records = intval($qs[1]);
+			$order = ($qs[2] == 'ASC' ? 'ASC' : 'DESC');
+		}
 	}
 }
-if ($records > 30) {
+if ($records > 30)
+{
 	$records = 30;
 }
 
 if (isset($id))
 {
-	if ($id == 0) {
+	if ($id == 0)
+	{
 		$text = "<div style='text-align:center'>".LAN_137." ".SITENAME."</div>";
 		$ns->tablerender(LAN_20, $text);
 		require_once(FOOTERF);
 		exit;
 	}
 
+	$loop_uid = $id;
+
 	$ret = $e_event->trigger("showuser", $id);
-	if ($ret!='') {
+	if ($ret!='')
+	{
 		$text = "<div style='text-align:center'>".$ret."</div>";
 		$ns->tablerender(LAN_20, $text);
 		require_once(FOOTERF);
@@ -115,79 +145,27 @@
 }
 
 $users_total = $sql->db_Count("user","(*)", "WHERE user_ban = 0");
-$text = "<div style='text-align:center'>
-".LAN_138." ".$users_total."<br /><br />
-<form method='post' action='".e_SELF."'>
-<p>
-".LAN_419.": ";
-
-if ($records == 10) {
-	$text .= "<select name='records' class='tbox'>
-	<option value='10' selected='selected'>10</option>
-	<option value='20'>20</option>
-	<option value='30'>30</option>
-	</select>  ";
-}
-else if($records == 20) {
-	$text .= "<select name='records' class='tbox'>
-	<option value='10'>10</option>
-	<option value='20' selected='selected'>20</option>
-	<option value='30'>30</option>
-	</select>  ";
-} else {
-	$text .= "<select name='records' class='tbox'>
-	<option value='10'>10</option>
-	<option value='20'>20</option>
-	<option value='30' selected='selected'>30</option>
-	</select>  ";
-}
-$text .= LAN_139;
-
-if ($order == "ASC") {
-	$text .= "<select name='order' class='tbox'>
-	<option value='DESC'>".LAN_420."</option>
-	<option value='ASC' selected='selected'>".LAN_421."</option>
-	</select>";
-} else {
-	$text .= "<select name='order' class='tbox'>
-	<option value='DESC' selected='selected'>".LAN_420."</option>
-	<option value='ASC'>".LAN_421."</option>
-	</select>";
-}
-
-$text .= " <input class='button' type='submit' name='submit' value='".LAN_422."' />
-<input type='hidden' name='from' value='$from' />
-</p>
-</form>\n\n<br /><br />";
-
 
-
-if (!$sql->db_Select("user", "*", "user_ban = 0 ORDER BY user_id $order LIMIT $from,$records")) {
+if (!$sql->db_Select("user", "*", "user_ban = 0 ORDER BY user_id $order LIMIT $from,$records"))
+{
 	echo "<div style='text-align:center'><b>".LAN_141."</b></div>";
-} else {
+}
+else
+{
 	$userList = $sql->db_getList();
-	$text .= "
-	<table style='width:95%' class='fborder'>
-	<tr>
-	<td class='fcaption' style='width:2%'>&nbsp;</td>
-	<td class='fcaption' style='width:20%'>".LAN_142."</td>
-	<td class='fcaption' style='width:20%'>".LAN_112."</td>
-	<td class='fcaption' style='width:20%'>".LAN_145."</td>
-	</tr>";
 
+	$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_START, TRUE, $user_shortcodes);
 	foreach ($userList as $row)
 	{
 		$text .= renderuser($row, "short");
 	}
-	$text .= "</table>\n</div>";
+	$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes);
 }
 
 $ns->tablerender(LAN_140, $text);
 
- 	$parms = $users_total.",".$records.",".$from.",".e_SELF.'?[FROM].'.$records.".".$order;
-	echo "<div class='nextprev'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
-
-
+$parms = $users_total.",".$records.",".$from.",".e_SELF.'?[FROM].'.$records.".".$order;
+echo "<div class='nextprev'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
 
 
 function renderuser($uid, $mode = "verbose")
@@ -210,14 +188,13 @@
 
 	if($mode == 'verbose')
 	{
-		return $tp->parseTemplate($USER_FULL_TEMPLATE, FALSE, $user_shortcodes);
+		return $tp->parseTemplate($USER_FULL_TEMPLATE, TRUE, $user_shortcodes);
 	}
 	else
 	{
-		return $tp->parseTemplate($USER_SHORT_TEMPLATE, FALSE, $user_shortcodes);
+		return $tp->parseTemplate($USER_SHORT_TEMPLATE, TRUE, $user_shortcodes);
 	}
 }
 
 require_once(FOOTERF);
-
-?>
\ No newline at end of file
+?>
diff -ruN 0.7.5/userposts.php 0.7.7/userposts.php
--- 0.7.5/userposts.php	2006-05-14 19:54:00.000000000 -0500
+++ 0.7.7/userposts.php	2006-06-22 14:13:41.000000000 -0500
@@ -11,19 +11,21 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/userposts.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/05/15 00:54:00 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.24 $
+|     $Date: 2006/06/22 19:13:41 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
+require_once(e_HANDLER."comment_class.php");
+$cobj = new comment;
 require_once(HEADERF);
-	
+
 if (!USER) {
 	header("location:".e_BASE."index.php");
 	exit;
 }
-	
+
 $_POST['f_query'] = trim($_POST['f_query']);
 
 if (e_QUERY)
@@ -40,10 +42,11 @@
 
 if(!defined("BULLET"))
 {
-	 define("BULLET", "bullet2.gif");
+	define("BULLET", "bullet2.gif");
 }
 
-if ($action == "comments") {
+if ($action == "comments")
+{
 	if(is_numeric($id))
 	{
 		$sql->db_Select("user", "user_name", "user_id=".$id);
@@ -56,15 +59,19 @@
 		$user_name = UP_LAN_16.$id;
 	}
 
-	if (!$USERPOSTS_COMMENTS_TABLE) {
-		if (file_exists(THEME."userposts_template.php")) {
+	if (!$USERPOSTS_COMMENTS_TABLE)
+	{
+		if (file_exists(THEME."userposts_template.php"))
+		{
 			require_once(THEME."userposts_template.php");
-		} else {
+		}
+		else
+		{
 			require_once(e_BASE.$THEMES_DIRECTORY."templates/userposts_template.php");
 		}
 	}
-	 
-	
+
+
 	$sql2 = new db;
 	if(is_numeric($id))
 	{
@@ -72,44 +79,42 @@
 		$sql->db_Select("user", "user_comments", "user_id=".$id."");
 		list($user_comments) = $sql->db_Fetch();
 		$ctotal = $user_comments;
-		$blah = $sql->db_Select("comments", "*", "comment_author = '".$user_id."' ORDER BY comment_datestamp DESC LIMIT ".$from.", 10 ");
+		$data = $cobj->getCommentData($amount='10', $from, "comment_author = '".$user_id."'");
 	}
 	else
 	{
 		require_once(e_HANDLER."encrypt_handler.php");
 		$dip = decode_ip($id);
 		$ccaption = UP_LAN_1.$dip;
-		$blah = $sql->db_Select("comments", "*", "comment_ip = '".$id."' ORDER BY comment_datestamp DESC LIMIT ".$from.", 10 ");
+		$data = $cobj->getCommentData($amount='10', $from, "comment_ip = '".$id."'");
 	}
-	
-	if (!$blah) {
+
+	if(empty($data) || !is_array($data)){
 		$ctext = "<span class='mediumtext'>".UP_LAN_7."</span>";
-	} else {
-		$render = $sql -> db_getList(); 
-		foreach ($render as $row)
-		{
-			extract($row);
-			if($comment_comment)
-			{
-				$userposts_comments_table_string .= parse_userposts_comments_table($row);
-			}
-		}
 	}
+
+	global $row;
+	foreach($data as $row){
+		$userposts_comments_table_string .= parse_userposts_comments_table($row);
+	}
+
 	$userposts_comments_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_START);
 	$userposts_comments_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_END);
-	 
+
 	$ctext .= $userposts_comments_table_start."".$userposts_comments_table_string."".$userposts_comments_table_end;
-	 
+
 	$ns->tablerender($ccaption, $ctext);
-	 
-	require_once(e_HANDLER."np_class.php");
-	$ix = new nextprev("userposts.php", $from, 10, $ctotal, UP_LAN_13, "comments.".$id."");
+
+	$parms = $ctotal.",10,".$from.",".e_SELF."?[FROM].comments.".$id;
+	$USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
+	echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
 }
-	
-	
-	
-if ($action == "forums" || isset($_POST['fsearch'])) {
-	 
+
+
+
+if ($action == "forums" || isset($_POST['fsearch']))
+{
+
 	if(is_numeric($id))
 	{
 		$user_id = intval($id);
@@ -122,10 +127,14 @@
 		$user_name = 0;
 	}
 
-	if (!$USERPOSTS_FORUM_TABLE) {
-		if (file_exists(THEME."userposts_template.php")) {
+	if (!$USERPOSTS_FORUM_TABLE)
+	{
+		if (file_exists(THEME."userposts_template.php"))
+		{
 			require_once(THEME."userposts_template.php");
-		} else {
+		}
+		else
+		{
 			require_once(e_BASE.$THEMES_DIRECTORY."templates/userposts_template.php");
 		}
 	}
@@ -143,10 +152,10 @@
 	LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
 	WHERE ft.thread_user LIKE '{$user_id}.%'
 	AND f.forum_class IN (".USERCLASS_LIST.")
-	AND fp.forum_class IN (".USERCLASS_LIST.") 
+	AND fp.forum_class IN (".USERCLASS_LIST.")
 	{$s_info}
 	ORDER BY ft.thread_datestamp DESC LIMIT {$from}, 10
-	";	
+	";
 
 	$total_qry = "
 	SELECT COUNT(*) AS count FROM #forum_t AS ft
@@ -154,9 +163,9 @@
 	LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
 	WHERE ft.thread_user LIKE '{$user_id}.%'
 	AND f.forum_class IN (".USERCLASS_LIST.")
-	AND fp.forum_class IN (".USERCLASS_LIST.") 
+	AND fp.forum_class IN (".USERCLASS_LIST.")
 	{$s_info}
-	";	
+	";
 
 	$ftotal = 0;
 	if($sql->db_Select_gen($total_qry))
@@ -175,7 +184,7 @@
 		{
 			$gen = new convert;
 		}
-		$render = $sql -> db_getList(); 
+		$render = $sql -> db_getList();
 		foreach ($render as $row)
 		{
 			$userposts_forum_table_string .= parse_userposts_forum_table($row);
@@ -186,169 +195,69 @@
 		$ftext .= $userposts_forum_table_start."".$userposts_forum_table_string."".$userposts_forum_table_end;
 	}
 	$ns->tablerender($fcaption, $ftext);
-	 
-	require_once(e_HANDLER."np_class.php");
-	$ix = new nextprev("userposts.php", $from, 10, $ftotal, UP_LAN_14, "forums.".$id."");
+
+	$parms = $ftotal.",10,".$from.",".e_SELF."?[FROM].forums.".$id;
+	$USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
+	echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
 }
-	
+
 require_once(FOOTERF);
-	
-	
-	
-	
-function parse_userposts_comments_table($row) {
-	global $USERPOSTS_COMMENTS_TABLE, $pref, $gen, $tp, $menu_pref, $id;
-	extract($row);
-	 
-	$poster = substr($comment_author, (strpos($comment_author, ".")+1));
+
+
+
+
+function parse_userposts_comments_table($row)
+{
+	global $USERPOSTS_COMMENTS_TABLE, $pref, $gen, $tp, $menu_pref, $id, $sql2, $comment_files;
+
 	$gen = new convert;
-	$datestamp = $gen->convert_date($comment_datestamp, "short");
-	$DATESTAMP = $datestamp;
-	 
-	$comment_comment = $tp->toHTML($comment_comment, TRUE, "", $id);
-	
-	$sql2 = new db;
-	if ($comment_type == "0") {
-		$sql2->db_Select("news", "news_title, news_class", "news_id = '".intval($comment_item_id)."' ");
-		$row = $sql2->db_Fetch();
-		if (!$row['news_class']) {
-			 
-			$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-			$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-			$USERPOSTS_COMMENTS_HEADING = $row['news_title'];
-			$USERPOSTS_COMMENTS_COMMENT = $comment_comment;
-			$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_BASE."comment.php?comment.news.$comment_item_id'>";
-			$USERPOSTS_COMMENTS_TYPE = "news";
-		}
-	}
-	if ($comment_type == "1") {
-		$sql2->db_Select("content", "content_heading, content_class, content_type", "content_id=".intval($comment_item_id));
-		$row = $sql2->db_Fetch();
-		 
-		if (check_class($row['content_class'])) {
-			if ($row['content_type'] == 0) {
-				$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-				$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-				$USERPOSTS_COMMENTS_HEADING = $row['content_heading'];
-				$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_BASE."content.php?article.$comment_item_id'>";
-				$USERPOSTS_COMMENTS_TYPE = "article";
-			}
-			else if($row['content_type'] == 3) {
-				$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-				$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-				$USERPOSTS_COMMENTS_HEADING = $row['content_heading'];
-				$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_BASE."content.php?review.$comment_item_id'>";
-				$USERPOSTS_COMMENTS_TYPE = "review";
-			}
-			else if($row['content_type'] == 1) {
-				$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-				$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-				$USERPOSTS_COMMENTS_HEADING = $row['content_heading'];
-				$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_BASE."content.php?content.$comment_item_id'>";
-				$USERPOSTS_COMMENTS_TYPE = "content";
-			}
-			$USERPOSTS_COMMENTS_COMMENT = ($comment_blocked ? CM_L2 : $comment_comment);
-		}
-	}
-	if ($comment_type == "2") {
-		$sql2->db_Select("download", "download_name", "download_id=".intval($comment_item_id));
-		$row = $sql2->db_Fetch();
-		 
-		$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-		$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-		$USERPOSTS_COMMENTS_HEADING = $row['download_name'];
-		$USERPOSTS_COMMENTS_COMMENT = $comment_comment;
-		$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_BASE."download.php?view.".$comment_item_id."'>";
-		$USERPOSTS_COMMENTS_TYPE = "download";
-	}
-	if ($comment_type == "4") {
-		$sql2->db_Select("poll", "poll_title", "poll_id=".intval($comment_item_id));
-		$row = $sql2->db_Fetch();
-		 
-		$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-		$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-		$USERPOSTS_COMMENTS_HEADING = $row['poll_title'];
-		$USERPOSTS_COMMENTS_COMMENT = $comment_comment;
-		$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_BASE."comment.php?comment.poll.".$comment_item_id."'>";
-		$USERPOSTS_COMMENTS_TYPE = "poll";
-	}
-
-	if ($comment_type == "5") {
-		$sql2->db_Select("documentation", "doc_title", "doc_id=".intval($comment_item_id));
-		$row = $sql2->db_Fetch();
-		 
-		$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-		$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-		$USERPOSTS_COMMENTS_HEADING = $row['doc_title'];
-		$USERPOSTS_COMMENTS_COMMENT = $comment_comment;
-		$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".e_PLUGIN."documentation/documentation.php?".$comment_item_id."'>";
-		$USERPOSTS_COMMENTS_TYPE = "documentation";
-	}
-	 
-	// added a check for not numeric comment_types (=custom comments for your own plugins)
-	if (!is_numeric($comment_type)) {
-		unset($handle, $heading, $href);
-		$handle = opendir(e_PLUGIN);
-		while (false !== ($file = readdir($handle))) {
-			if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)) {
-				$plugin_handle = opendir(e_PLUGIN.$file."/");
-				while (false !== ($file2 = readdir($plugin_handle))) {
-					if ($file2 == "e_comment.php") {
-						require_once(e_PLUGIN.$file."/".$file2);
-						if ($comment_type == $e_plug_table) {
-							$plugin_redir = $reply_location;
-							list($url, $querystring) = explode("?", $plugin_redir);
-							$USERPOSTS_COMMENTS_HEADING = $comment_subject;
-							$USERPOSTS_COMMENTS_HREF_PRE = "<a href='".$url."?".$comment_item_id."'>";
-						} else {
-							$USERPOSTS_COMMENTS_HEADING = $comment_subject;
-							$USERPOSTS_COMMENTS_HREF_PRE = "";
-						}
-					}
-				}
-			}
-		}
-		 
-		$USERPOSTS_COMMENTS_ICON = "<img src='".THEME."images/".BULLET."' alt='' />";
-		$USERPOSTS_COMMENTS_DATESTAMP = UP_LAN_11." ".$datestamp;
-		$USERPOSTS_COMMENTS_COMMENT = $comment_comment;
-		$USERPOSTS_COMMENTS_TYPE = $comment_type;
-	}
-	// end
-	 
+	$datestamp = $gen->convert_date($row['comment_datestamp'], "short");
+	$USERPOSTS_COMMENTS_ICON		= "<img src='".THEME."images/".BULLET."' alt='' />";
+	$USERPOSTS_COMMENTS_DATESTAMP	= UP_LAN_11." ".$datestamp;
+	$USERPOSTS_COMMENTS_HEADING		= $row['comment_title'];
+	$USERPOSTS_COMMENTS_COMMENT		= $row['comment_comment'];
+	$USERPOSTS_COMMENTS_HREF_PRE	= "<a href='".$row['comment_url']."'>";
+	$USERPOSTS_COMMENTS_TYPE		= $row['comment_type'];
+
 	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE));
 }
-	
-	
-function parse_userposts_forum_table($row) {
+
+
+function parse_userposts_forum_table($row)
+{
 	global $USERPOSTS_FORUM_TABLE, $gen, $tp, $id;
 	extract($row);
-	 
+
 	$gen = new convert;
 	$sql2 = new db;
-	 
+
 	$poster = substr($thread_user, (strpos($thread_user, ".")+1));
 	$datestamp = $gen->convert_date($thread_datestamp, "short");
 	$DATESTAMP = $datestamp;
-	 
-	if ($thread_parent) {
-		 
-		if ($cachevar[$thread_parent]) {
+
+	if ($thread_parent)
+	{
+		if ($cachevar[$thread_parent])
+		{
 			$thread_name = $cachevar[$thread_parent];
-		} else {
+		}
+		else
+		{
 			$tmp = $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;
 		}
 		$USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_15.": ";
-	} else {
+	}
+	else
+	{
 		$tmp = $thread_id;
 		$USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_2.": ";
 	}
-	 
+
 	$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 = $thread_name;
@@ -356,9 +265,8 @@
 	$USERPOSTS_FORUM_NAME = $forum_name;
 	$USERPOSTS_FORUM_THREAD = $thread_thread;
 	$USERPOSTS_FORUM_DATESTAMP = UP_LAN_11." ".$datestamp;
-	 
+
 	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE));
 }
-	
-	
+
 ?>
\ No newline at end of file
diff -ruN 0.7.5/usersettings.php 0.7.7/usersettings.php
--- 0.7.5/usersettings.php	2006-05-18 10:12:58.000000000 -0500
+++ 0.7.7/usersettings.php	2006-11-28 23:11:16.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/usersettings.php,v $
-|     $Revision: 1.69 $
-|     $Date: 2006/05/18 15:12:58 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.80 $
+|     $Date: 2006/11/29 05:11:16 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -67,7 +67,7 @@
 else
 {
 	include_once(e_THEME."templates/usersettings_template.php");
-}	
+}
 include_once(e_FILE."shortcode/batch/usersettings_shortcodes.php");
 
 require_once(e_HANDLER."calendar/calendar_class.php");
@@ -78,8 +78,21 @@
 
 // Save Form Data  --------------------------------------->
 
+$error = "";
+
 if (isset($_POST['updatesettings']))
 {
+	if(!varsettrue($pref['auth_method']) || $pref['auth_method'] == '>e107')
+	{
+		$pref['auth_method'] = 'e107';
+	}
+
+	if($pref['auth_method'] != 'e107')
+	{
+		$_POST['password1'] = '';
+		$_POST['password2'] = '';
+	}
+
 	if ($_uid && ADMIN)
 	{
 		$inp = $_uid;
@@ -89,8 +102,8 @@
 	{
 		$inp = USERID;
 	}
-
 	$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyways, so why allow them? (XSS Fix)
+
 	// check prefs for required fields =================================.
 
 	if ($_POST['image'] && $size = getimagesize($_POST['image'])) {
@@ -101,15 +114,16 @@
 		$pref['im_width'] = ($pref['im_width']) ? $pref['im_width'] : 120;
 		$pref['im_height'] = ($pref['im_height']) ? $pref['im_height'] : 100;
 		if ($avwidth > $pref['im_width']) {
-			$avmsg .= LAN_USET_1."<br />".LAN_USET_2.": {$pref['im_width']}<br /><br />";
+			$avmsg .= LAN_USET_1." ($avwidth)<br />".LAN_USET_2.": {$pref['im_width']}<br /><br />";
 		}
 		if ($avheight > $pref['im_height']) {
-			$avmsg .= LAN_USET_3."<br />".LAN_USET_4.": {$pref['im_height']}";
+			$avmsg .= LAN_USET_3." ($avheight)<br />".LAN_USET_4.": {$pref['im_height']}";
 		}
 		if ($avmsg) {
 			$_POST['image'] = "";
-			$messsage = $avmsg;
+			$error = $avmsg;
 		}
+
 	}
 
 	$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122, LAN_USET_6);
@@ -123,51 +137,6 @@
 		}
     }
 
-
-	if($sql->db_Select('user_extended_struct'))	{
-		while($row = $sql->db_Fetch()) {
-			$extList["user_".$row['user_extended_struct_name']] = $row;
-		}
-	}
-
-	$ue_fields = "";
-	foreach($_POST['ue'] as $key => $val)
-	{
-		$err = false;
-		$parms = explode("^,^", $extList[$key]['user_extended_struct_parms']);
-		$regex = $tp->toText($parms[1]);
-		$regexfail = $tp->toText($parms[2]);
-		if(defined($regexfail)) {$regexfail = constant($regexfail);}
-		if($val == '' && $extList[$key]['user_extended_struct_required'] == 1 && !$_uid)
-		{
-			$error .= LAN_SIGNUP_6.substr($key,5)." ".LAN_SIGNUP_7."\\n";
-			$err = TRUE;
-		}
-		if($regex != "" && $val != "")
-		{
-			if(!preg_match($regex, $val))
-			{
-				$error .= $regexfail."\\n";
-				$err = TRUE;
-			}
-		}
-		if(!$err)
-		{
-			$val = $tp->toDB($val);
-			$ue_fields .= ($ue_fields) ? ", " : "";
-			$ue_fields .= $key."='".$val."'";
-		}
-	}
-	if($ue_fields)
-	{
-		$hidden_fields = implode("^", array_keys($_POST['hide']));
-		if($hidden_fields != "")
-		{
-			$hidden_fields = "^".$hidden_fields."^";
-		}
-		$ue_fields .= ", user_hidden_fields = '".$hidden_fields."'";
-	}
-
 	// ====================================================================
 
 	$pwreset = "";
@@ -176,9 +145,9 @@
 	}
 	else
 	{
-		if($_POST['password1'] != "")
+		if(trim($_POST['password1']) != "")
 		{
-			$pwreset = ", user_password = '".md5($_POST['password1'])."' ";
+			$pwreset = "user_password = '".md5(trim($_POST['password1']))."', ";
 		}
 	}
 
@@ -192,15 +161,19 @@
 		}
 	}
 
-	if (strlen($_POST['password1']) < $pref['signup_pass_len'] && $_POST['password1'] != "") {
+	if (strlen(trim($_POST['password1'])) < $pref['signup_pass_len'] && trim($_POST['password1']) != "") {
 		$error .= LAN_SIGNUP_4.$pref['signup_pass_len'].LAN_SIGNUP_5."\\n";
 		$password1 = "";
 		$password2 = "";
 	}
 
-	if (!check_email($_POST['email'])) 
+	if (isset($pref['disable_emailcheck']) && $pref['disable_emailcheck']==1)
 	{
-	  	$error .= LAN_106."\\n";
+	} else {
+		if (!check_email($_POST['email']))
+		{
+	  		$error .= LAN_106."\\n";
+		}
 	}
 
 	if ($sql->db_Select("user", "user_name, user_email", "user_email='".$tp -> toDB($_POST['email'])."' AND user_id !=".USERID."' ")) {
@@ -208,21 +181,13 @@
 	}
 
 //	$username = strip_tags($_POST['username']);
-	$loginname = strip_tags($_POST['loginname']);
-	
-	if (!$loginname)
-	{
-		$sql->db_Select("user", "user_loginname", "user_id='".intval($inp)."'");
-		$row = $sql -> db_Fetch();
-		$loginname = $row['user_loginname'];
-	}
-	
+
 	$user_sess = "";
 	if ($file_userfile['error'] != 4)
 	{
 		require_once(e_HANDLER."upload_handler.php");
 		require_once(e_HANDLER."resize_handler.php");
-		
+
 		if ($uploaded = file_upload(e_FILE."public/avatars/", "avatar"))
 		{
 			if ($uploaded[0]['name'] && $pref['avatar_upload'])
@@ -247,27 +212,53 @@
 
 	if ($user_sess != "")
 	{
-		$sesschange = ", user_sess = '".$tp->toDB($user_sess)."' ";
+		$sesschange = "user_sess = '".$tp->toDB($user_sess)."', ";
 	}
 
-	if (!$error)
+    // Validate Extended User Fields.
+	if($_POST['ue'])
 	{
-		if (isset($_POST['username']) && check_class($pref['displayname_class']))
+		if($sql->db_Select('user_extended_struct'))	{
+			while($row = $sql->db_Fetch())
+			{
+				$extList["user_".$row['user_extended_struct_name']] = $row;
+			}
+		}
+
+		$ue_fields = "";
+		foreach($_POST['ue'] as $key => $val)
 		{
-			$username = strip_tags($_POST['username']);
-			$username = $tp->toDB(substr($username, 0, $pref['displayname_maxlength']));
-			$new_username = "user_name = '{$username}'";
+			$err = false;
+			$parms = explode("^,^", $extList[$key]['user_extended_struct_parms']);
+			$regex = $tp->toText($parms[1]);
+			$regexfail = $tp->toText($parms[2]);
+    		if(defined($regexfail)) {$regexfail = constant($regexfail);}
+	  		if($val == '' && $extList[$key]['user_extended_struct_required'] == 1 && !$_uid)
+			{
+         		$error .= LAN_SIGNUP_6.($tp->toHtml($extList[$key]['user_extended_struct_text'],FALSE,"defs"))." ".LAN_SIGNUP_7."\\n";
+	    		$err = TRUE;
+			}
+			if($regex != "" && $val != "")
+			{
+				if(!preg_match($regex, $val))
+				{
+               		$error .= $regexfail."\\n";
+         			$err = TRUE;
+	         	}
+			}
+			if(!$err)
+			{
+				$val = $tp->toDB($val);
+				$ue_fields .= ($ue_fields) ? ", " : "";
+				$ue_fields .= $key."='".$val."'";
+				}
 		}
+    }
 
-		$_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'])."' ";
-		}
+	if (!$error)
+	{
 		unset($_POST['password1']);
 		unset($_POST['password2']);
 
@@ -283,7 +274,54 @@
 
 		if ($ret == '')
 		{
-			$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)."' ");
+			$udata = get_user_data($inp);
+			$peer = ($inp == USERID ? false : true);
+			$loginname = strip_tags($_POST['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']))
+			{
+				$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']);
+
+			$new_customtitle = "";
+
+			if(isset($_POST['customtitle']) && ($pref['forum_user_customtitle'] || ADMIN))
+			{
+				$new_customtitle = ", user_customtitle = '".$tp->toDB($_POST['customtitle'])."' ";
+			}
+
+
+			if($ue_fields)
+			{
+				$hidden_fields = implode("^", array_keys($_POST['hide']));
+				if($hidden_fields != "")
+				{
+					$hidden_fields = "^".$hidden_fields."^";
+				}
+				$ue_fields .= ", user_hidden_fields = '".$hidden_fields."'";
+			}
+
+			$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)
 			{
@@ -327,7 +365,7 @@
 					$sql->db_Update("user", "user_class='".$nid."' WHERE user_id='".intval($inp)."'");
 				}
 			}
-			
+
 			if($update_xup == TRUE)
 			{
 				require_once(e_HANDLER."login.php");
@@ -350,6 +388,13 @@
 		unset($_POST);
 	}
 }
+
+if ($error)
+{
+	require_once(e_HANDLER."message_handler.php");
+	message_handler("P_ALERT", $error);
+	$adref = $_POST['adminreturn'];
+}
 // -------------------
 
 if(isset($message))
@@ -358,12 +403,7 @@
 }
 
 // ---------------------
-if ($error)
-{
-	require_once(e_HANDLER."message_handler.php");
-	message_handler("P_ALERT", $error);
-	$adref = $_POST['adminreturn'];
-}
+
 
 $uuid = ($_uid) ? $_uid : USERID;
 
@@ -382,7 +422,7 @@
 if($curVal['user_admin'] == 1)
 {
 	$tmp[] = e_UC_ADMIN;
-}	
+}
 $curVal['userclass_list'] = implode(",", $tmp);
 
 if($_POST)
@@ -447,4 +487,4 @@
 	$script .= $cal->load_files();
 	return $script;
 }
-?>
\ No newline at end of file
+?>
