diff -x .svn -aruN 0.7.12.src/comment.php 0.7.13.src/comment.php
--- 0.7.12.src/comment.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/comment.php	2008-09-23 14:43:32.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/comment.php,v $
-|     $Revision: 1.57 $
-|     $Date: 2008/06/03 21:31:19 $
+|     $Revision: 1.58 $
+|     $Date: 2008/09/23 19:43:55 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -21,7 +21,8 @@
 require_once(e_HANDLER."comment_class.php");
 define("PAGE_NAME", COMLAN_99);
 
-if (!e_QUERY) {
+if (!e_QUERY) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -221,7 +222,7 @@
 	define('e_PAGETITLE', $title." / ".COMLAN_99." / ".COMLAN_102.$subject."");
 	require_once(HEADERF);
 } 
-else 
+elseif ($action == 'comment')
 {  //  Default code if not reply
 
 	// Check cache
@@ -343,6 +344,11 @@
 	  }
 	}
 }
+else
+{	// Invalid action - just exit
+	header("location:".e_BASE."index.php");
+	exit;
+}
 
 if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news")
 {
diff -x .svn -aruN 0.7.12.src/e107_admin/banner.php 0.7.13.src/e107_admin/banner.php
--- 0.7.12.src/e107_admin/banner.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/banner.php	2008-08-26 14:44:52.000000000 -0500
@@ -11,13 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/banner.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2008/07/20 18:05:49 $
+|     $Revision: 1.33 $
+|     $Date: 2008/08/26 19:45:15 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-if (!getperms("D")) {
+if (!getperms("D")) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -29,8 +30,8 @@
 require_once(e_HANDLER."file_class.php");
 $fl = new e_file;
 
-$lan_file = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php";
-include_once(file_exists($lan_file) ? $lan_file : e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
+@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
+@include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
 
 
 if(e_QUERY)
@@ -474,7 +475,7 @@
 
 
 	$text = "<div style='text-align:center'>
-	<form method='post' action='".e_SELF."' name='menu_conf_form'>
+	<form method='post' action='".e_SELF."?menu' name='menu_conf_form'>
 	<table style='".ADMIN_WIDTH."' class='fborder' >
 
 	<tr>
@@ -530,9 +531,11 @@
 	<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'>
-	".$rs->form_option(BANNER_MENU_L12, ($menu_pref['banner_rendertype'] == 1 ? "1" : "0"), 1)."
-	".$rs->form_option(BANNER_MENU_L13, ($menu_pref['banner_rendertype'] == 2 ? "1" : "0"), 2)."
+	<select class='tbox' id='banner_rendertype' name='banner_rendertype' size='1'  >
+	".$rs->form_option(BANNER_MENU_L11, (!$menu_pref['banner_rendertype'] || $menu_pref['banner_rendertype'] == "0" ? "1" : "0"), 0)."
+	".$rs->form_option("1 - ".BANNER_MENU_L12."", ($menu_pref['banner_rendertype'] == "1" ? "1" : "0"), 1)."
+	".$rs->form_option("2 - ".BANNER_MENU_L13."", ($menu_pref['banner_rendertype'] == "2" ? "1" : "0"), 2)."
+	".$rs->form_option("3 - ".BANNER_MENU_L14."", ($menu_pref['banner_rendertype'] == "3" ? "1" : "0"), 3)."
 	".$rs->form_select_close()."
 	</td>
 	</tr>
diff -x .svn -aruN 0.7.12.src/e107_admin/core_image.php 0.7.13.src/e107_admin/core_image.php
--- 0.7.12.src/e107_admin/core_image.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/core_image.php	2008-09-28 20:50:21.000000000 -0500
@@ -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.49 $
-|     $Date: 2008/08/25 23:41:14 $
+|     $Revision: 1.50 $
+|     $Date: 2008/09/29 01:50:44 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -52,7 +52,7 @@
     'article.php' => '7b21dc8ef4bc68ceb9ecf4d1c519a645',
     'auth.php' => 'ff049badda2e090168f61849a496e4bb',
     'banlist.php' => '6ff4252414f390d5080d778e59198a12',
-    'banner.php' => '0b9f1a9510a6cd82c0fc89819ee68dca',
+    'banner.php' => '94365c8703d0baa0a72ca9941650ecd5',
     'cache.php' => '62fc17d1f4c6db977c66642c5a76127a',
     'cascade.php' => '3d70a650778f09e6c85efd91b6ab5e4a',
     'categories.php' => 'cbbed37d26ab602700d46a0cb1955205',
@@ -61,19 +61,19 @@
     'comment.php' => '96f04e71003de6b6a6ea3a0f2ede285d',
     'compact.php' => '20bccea2ef81cc86a86782fa4841e45f',
     'content.php' => 'bf2239404990afed185913002429e682',
-    'core_image.php' => '1e24d83e0779ad02d8d854bd75a24303',
+    'core_image.php' => '9137ada2971a098decf91b6244315a64',
     'cpage.php' => '249109943f5bb394b70065596e556ff5',
     'credits.php' => '273cb301d908936a58a8d38b4e92ba5a',
     'db.php' => '74e4d75fbafe9a8493fbba384ae6f97f',
     'db_verify.php' => '0699ccfd73686113023ee99cf406e6ce',
     'docs.php' => 'e5ebdd8fd30362636cfe1a3878b3fb18',
-    'download.php' => 'c78709b384c8ea21798dea81a72a7e92',
+    'download.php' => '19820445103f0c1463a093622c6b8b7f',
     'e107_update.php' => 'c23624862e7dc50fab29aa1890c7872a',
     'emoticon.php' => '9403ce6e8c4dc4ab34d32b3d74a1d699',
     'fileinspector.php' => 'e1d831bfb0ca6a9244a4ced5b0d85fc3',
     'filemanager.php' => '7b05edc097aa543f1a29941600134ed3',
     'filetypes_.php' => 'f951037335e993337792606cc1475cec',
-    'fla.php' => 'c44c289dcdbe2bcf53305103275ce899',
+    'fla.php' => '79d38f85554dd27204e7102438430d5e',
     'footer.php' => '1195647fdeaa996c43c3e58bf9bb86cc',
     'frontpage.php' => '18cdca6033109f4609ce69cf8f0dafb6',
     'header.php' => '24eed26f8a60cafaefe629d9928472aa',
@@ -81,7 +81,7 @@
     'index.php' => 'e4e143ee2d34d4ce1f17b3f043cc6cd6',
     'lancheck.php' => '486475f13c553f7337ca5242f7aa27fd',
     'language.php' => 'ebae973cbea51afd9c5a9cc62d39f95a',
-    'links.php' => '5201430aa2d47e2b0ba0b59bbb1bfe31',
+    'links.php' => 'e2dc3726b76807645c1426aae226b385',
     'mailout.php' => '3d2a68cb77ceac276bc493dc6d297cca',
     'menus.php' => '816ba85a06f966b9bbc59c53d31c1bc6',
     'message.php' => 'a598b5e493298500d81b815f1455280b',
@@ -102,10 +102,10 @@
     'userclass.php' => 'cbc4006fb0664fca537a910d2f54d59c',
     'userclass2.php' => 'cdf66f5a605f42b7ca51d63a1102f7b4',
     'userinfo.php' => 'fcbb4c620a0a9ed430588ee7539fb2d7',
-    'users.php' => '79deb7b129bf8aeab58ab688184f1c8f',
-    'users_extended.php' => '1d7db886d11bdff41a33cf222ee291bb',
+    'users.php' => 'ffe9886f91987ecbc08546e6bbc9b433',
+    'users_extended.php' => '016339d4fdaeaac0d7e8bb7f91c46952',
     'users_extended_predefined.php' => '51128e45b6620f7b6ead6fbd8521b43e',
-    'ver.php' => 'd36c6b0018a3afba3a3cdd203bf91b33',
+    'ver.php' => 'e426c0e7cd0ca83dbbf15dc278604a5c',
     'wmessage.php' => '17afb0f8ef07cfd675cd92e9f7e606a3',
   ),
   $coredir['docs'] => 
@@ -236,10 +236,10 @@
         'bbcode_shortcodes.php' => '979de9d7330c0e547d952f1c547d76e1',
         'comment_shortcodes.php' => '97e52cf2411985c27833bbe5010b9e94',
         'contact_shortcodes.php' => 'd593f9dadff312c61eb27e32457d7f95',
-        'download_shortcodes.php' => '7dd3e10bd9d2a2c4f44ce19acc366911',
+        'download_shortcodes.php' => '4343dc24873d041c626dc9aa29c3e1f8',
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         'news_archives.php' => '1115fe90b0de9f170fce31c94680dabf',
-        'news_shortcodes.php' => 'c1741e24763f64883faa1730e55b115b',
+        'news_shortcodes.php' => '0be9a876d70804827f076d7335447470',
         'signup_shortcodes.php' => 'fbaad5179aa055dcd04f5bfdc6614782',
         'sitedown_shortcodes.php' => '3ae9199cbae645d23869d517a5f6cef4',
         'user_shortcodes.php' => 'a3b47064debd03115dfb95cb82927438',
@@ -271,7 +271,7 @@
       'custom.sc' => 'ea36528652b9aa0bff9bef4e6658c139',
       'e_image.sc' => '3819fdf5b9dfc7b189fb4073d33ae0d5',
       'email.sc' => 'e363b6b54037a8c80b373b76994c8db9',
-      'email_item.sc' => 'a23b3abbb722bbf5bc58be9d23906583',
+      'email_item.sc' => 'fa6140b7829cb0a32ae04ae4efd24d94',
       'emailto.sc' => '2a090d41cd91744486aa4f74519f3c4b',
       'extended.sc' => '868d45e725d7565a1d9c5b743aba0967',
       'extended_icon.sc' => 'db16dbaa0dfa2f8fc944ba87c15a09d1',
@@ -291,7 +291,7 @@
       'nextprev.sc' => '8fbd81c6f1a3274aa8b587e48660d566',
       'picture.sc' => '0f4d00920f1ddbac7293549862b3c0da',
       'plugin.sc' => 'be06266acd86f06b244dd27266df8f12',
-      'print_item.sc' => '8ca4f150e4758249c346dd0edd5623f3',
+      'print_item.sc' => 'fb3b5508fed60548689a5c496d45e1b3',
       'profile.sc' => 'ea7fc4eca12f39e19a735d2014fe341f',
       'search.sc' => '12a174161a186e9a936fc10c946f0517',
       'setstyle.sc' => '88ec920b668233bd21ba95e2cdd607e7',
@@ -306,7 +306,7 @@
       'theme_disclaimer.sc' => '606d98f47c1a64b179d9baf6e6930dbc',
       'uploadfile.sc' => '85ea5b2a10cde7c2267a40c359694aed',
       'user_avatar.sc' => '1501550f2414900d47edee2621b2e624',
-      'user_extended.sc' => '6f88944ae59ef9b56ad31632e70ddd69',
+      'user_extended.sc' => 'f2567490098c503095af564db3c8e04f',
       'wmessage.sc' => 'c24f80349ceafd36f6cf0d6ec6875fa7',
     ),
     'def_e107_prefs.php' => '60132274af17ba102249ef9e8be76f69',
@@ -664,8 +664,8 @@
     'debug_handler.php' => '9fa1acc69ef4cfc2593345c3866841d3',
     'e107_Compat_handler.php' => 'e76211b3178e4a9724933ecfe85ba8ea',
     'e107_class.php' => 'de0052a652261489b4b9609b3b70af6c',
-    'e_parse_class.php' => '445c3f15becfd23579ca9289963010eb',
-    'emailprint_class.php' => 'c7de0da4205693ddb952e9723a7fc226',
+    'e_parse_class.php' => '6806f027ba9f8fa86d8bacddee5b90ae',
+    'emailprint_class.php' => 'c0dbe279de39cf512f5bcb6baa339ebb',
     'emote.php' => 'bbda3eafde2bb54c645194bf72dd47e3',
     'emote_filter.php' => '6348bb4a8adf203fccc2b5ecf4bff378',
     'encrypt_handler.php' => 'de4230eb5dc1541306a43f83b6a04671',
@@ -699,7 +699,7 @@
     'preset_class.php' => 'a687add695b164e133e4c6375c5791fc',
     'profanity_filter.php' => 'd41dc2dcd84a33f37f3ea1200fef3814',
     'rate_class.php' => 'be7d6c95e9e702eddf6c93e0de6344e1',
-    'ren_help.php' => 'f0410eed0dd683e8e1b75c4b980107e2',
+    'ren_help.php' => 'f9e6af20482a72ab0b9109c14c6e659e',
     'resize_handler.php' => '49ec3b36dcd96ce97390101099e1ed6b',
     'search_class.php' => 'fe9c65c10349512b91164b8b67e724be',
     'secure_img_handler.php' => '2cf9d9bb7616a5cc9d04d782a7bf8611',
@@ -1217,7 +1217,7 @@
         'lan_admin_log.php' => '0f9dacdf93cb2d6a4145487de304cb87',
         'lan_administrator.php' => '83b1eaead32e6c500d42a74c40b059a5',
         'lan_banlist.php' => 'eab999e2192f8806d3c296a51ff7b304',
-        'lan_banner.php' => '11d2439138f74b116de4697e066f7ca5',
+        'lan_banner.php' => '576ae839e8066b9452bf413aa971dd48',
         'lan_cache.php' => '0926abdc99274d71157280c9d58749e0',
         'lan_cpage.php' => '011e368a1d39d8bd1b95560289b1cb9e',
         'lan_credits.php' => 'aae0c491eb54b8c529013691755044a1',
@@ -1254,8 +1254,8 @@
         'lan_userclass.php' => '4ea892222af2878ae303e6234545107c',
         'lan_userclass2.php' => 'e475c31e99b4867d9517705b584f5a44',
         'lan_userinfo.php' => '241d3c717696a30d97152aec8f5fcdf2',
-        'lan_users.php' => 'cf518b91e8fcb326f76305851e4b81e0',
-        'lan_users_extended.php' => '47cde233437a8883572ecf8bedab59bb',
+        'lan_users.php' => 'a41954c84f438a673df3c9c4cdc9601a',
+        'lan_users_extended.php' => '01668b2029e05b10ed6cc14c71757d31',
         'lan_wmessage.php' => '27b96105500cdfa56bc27e391a0c2f3b',
       ),
       'English.php' => '737802cb8d3c4cbf03327944272bcf1e',
@@ -1267,7 +1267,7 @@
       'lan_email.php' => '499e255fe29b037d49ea7b50fa679c09',
       'lan_error.php' => '9d5d4ac7a6672f0be9c83b06cebc8d16',
       'lan_fpw.php' => 'cb552bb8035414854363a77d844b194b',
-      'lan_installer.php' => 'bd24714ba9298821b041ff1f7e41740a',
+      'lan_installer.php' => '08806a3107735703ba7060b4757c77c4',
       'lan_login.php' => '3bf7ecb7c00be86b54c83370fab6f8c6',
       'lan_mail_handler.php' => '001b336311279c058df01c2ae04aa87d',
       'lan_membersonly.php' => '102bba47b482668bb433a5a607767bae',
@@ -1341,7 +1341,7 @@
         'English.php' => '34df03d8f502238bd6f3c8102f1fc399',
       ),
       'banner_menu.php' => '32329ab6e68ec3b1cc6ec89374f3b4d6',
-      'config.php' => '91398fb8db5e565e0659790796de8860',
+      'config.php' => 'b98411f3612b2c0dbf2ab1314f7ed663',
     ),
     'blogcalendar_menu' => 
     array (
@@ -1405,7 +1405,7 @@
         'search_parser.php' => '46ad148c6924dff0789cffa7240d895a',
       ),
       'admin_config.php' => '637d77a1f80e4fc40d4772e285e52a82',
-      'calendar.php' => 'cd96dede903591eb4e609ae9b1aea129',
+      'calendar.php' => '75a8709d8089c63f7c277696010311b1',
       'calendar_menu.php' => '89fa2cc5825235633565c48682940e16',
       'calendar_shortcodes.php' => '8caad7046186dc80c386a932cb485ff0',
       'calendar_sql.php' => '39899457df794d8b56c58d3b1c8db88e',
@@ -1414,11 +1414,11 @@
       'e_notify.php' => '4c206cee17bed1c6b02f66fe202252f5',
       'e_rss.php' => '077b415bf70aaae7b8de3d55a5912632',
       'e_search.php' => 'a1681c6fed9972dd140b72b3ebfbd3c8',
-      'ecal_class.php' => '8aca3973a9722d4e29aabcf54b488c99',
-      'event.php' => '8af08a9c55c2f1b8c78dadc0cf6d2565',
+      'ecal_class.php' => 'a1b10a8c8695f4cff9ed82e310825189',
+      'event.php' => '2ddb0bbb67a293ce9106cbe42c5c34ac',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'next_event_menu.php' => '6d1819f703dc045efa0fd1a4041e6545',
-      'plugin.php' => '350495d7a23233b13d47792c1c65e0a3',
+      'plugin.php' => 'ba58d6517d948f30f27dcbd7d1c2026a',
       'readme.pdf' => 'bde9420355a7306b71df8c5143575347',
       'subs_menu.php' => '816619639ab421ff3229f6536bb33416',
       'subscribe.php' => '4bb2bd64a5ef6aa97f9d70e0401ee465',
@@ -1597,7 +1597,7 @@
       array (
         'search_advanced.php' => 'c6c6ae35cd1020d27a861ac693347560',
         'search_comments.php' => '34b14edbe1d2e8fbac541dc03262b21d',
-        'search_parser.php' => 'bd879427b3e98dea676b02fc4271f8e6',
+        'search_parser.php' => '1dd7a7f04aba6ae80cbd2d74457040f1',
       ),
       'templates' => 
       array (
@@ -1670,7 +1670,7 @@
       'admin_config.php' => '773de81a3c2d8bdbb714e280277500ec',
       'e_rss.php' => 'e3b277cca6f5262dcee948434aacfc5e',
       'featurebox.php' => '58326f62f0251b8660d3040097cdd958',
-      'plugin.php' => '39f2a1375fe640e6cda8347ff7ab8de3',
+      'plugin.php' => '47e04d81450fac857afde4570ae883e3',
     ),
     'forum' => 
     array (
@@ -1815,7 +1815,7 @@
         'forum_post_template.php' => 'f1017fb9b9ae6c73691d27b4da2d8cd3',
         'forum_posted_template.php' => 'd0790156815c4f32a794becbe68da4cc',
         'forum_preview_template.php' => '11b636f1bcccded162fcf42880df5b5d',
-        'forum_template.php' => '725a50b55d6e76a9844821992601aa67',
+        'forum_template.php' => 'f8aad182659e07658db54aa81bd798c1',
         'forum_viewforum_template.php' => 'b57d11f7e8b34a77b95d8a7154dbfc7e',
         'forum_viewtopic_template.php' => '86bb9e4bb1cb15c4f311783899e736a4',
       ),
@@ -1927,7 +1927,7 @@
       'link_defines.php' => '1c9c8a4d29cac5f35e2164805bb3eca6',
       'link_menu.php' => '3520965348d79de448646454ddb04565',
       'link_shortcodes.php' => 'e7c72490ab6613732109aa5bbff0a8da',
-      'links.php' => 'c5bb9ad93c44ab803196d17b31fe34ea',
+      'links.php' => 'c005496fee00534679321e8fb9837b6d',
       'links_page_sql.php' => 'ebe16a35037a69b93eaa929782ca66ba',
       'links_template.php' => 'b578512e4b94cd623ee3cfcf5d0be178',
       'plugin.php' => 'b05df4d36293f4c2e2b949b3006cc712',
@@ -1987,7 +1987,7 @@
       'list_recent_menu.php' => 'a8cffc271ef0637df899195561e07cb4',
       'list_shortcodes.php' => '1c4972d09e83f1945c6652126bba6248',
       'list_template.php' => 'ca73750411b19f1b8df71c5111fe1789',
-      'plugin.php' => 'c39cfd9c145036b3cfbfca56aef150dc',
+      'plugin.php' => '9eb14ccec83d20559b387b9c332a6d23',
     ),
     'log' => 
     array (
@@ -2080,7 +2080,7 @@
       array (
         'admin' => 
         array (
-          'English.php' => '06b1c15da4d655b002cd2a5c9e59852e',
+          'English.php' => 'd9643eecb880103e72681374690e5c84',
         ),
         'English.php' => 'c4f4a5f7525aae287a2aec94f5aef830',
       ),
@@ -2088,7 +2088,7 @@
       array (
         'null.txt' => 'd41d8cd98f00b204e9800998ecf8427e',
       ),
-      'admin_config.php' => '13920f4a08dfdffb95074ba6fb96f01c',
+      'admin_config.php' => '0d9cb944bcb0efd5410b961ff4fea3d4',
       'consolidate.php' => '98cc86b8054e93d3f86f150504f0940b',
       'e_meta.php' => '6f94262ca53688c5466e906f0d2f9dd4',
       'log.php' => '309b0e75cb210dabbfbb17b940576435',
@@ -2096,7 +2096,7 @@
       'log_update.php' => '619bea78d9c76a1ec0cd4c44eeda36c5',
       'log_update_check.php' => 'f4e7f5fb3767e4c19adae8cb5e41e62c',
       'loginfo.php' => '854e51cd364a5f34bbb98559a1d997a5',
-      'plugin.php' => 'b15d463132ce97a2f6e06af1a0a976d3',
+      'plugin.php' => '5809c35fd538c5326ebe6e1876de72c4',
       'stats.php' => 'a5e903fba25292d4a5e50e0b1dbe5753',
     ),
     'login_menu' => 
@@ -2161,9 +2161,9 @@
       ),
       'languages' => 
       array (
-        'English.php' => '5fe08735f2bf070770827d051fcd69cd',
+        'English.php' => 'dbf0f956c851ae529fd3bb4c04fbe29f',
       ),
-      'admin_config.php' => '22db9734164abc83043b3bb986f4d54b',
+      'admin_config.php' => 'd11d3be81f37367ea36d146590cf5fc3',
       'newsletter_menu.php' => 'f8b8ab30443dea6a8dbb2e27c17799d6',
       'plugin.php' => '5c491459a08ab61854fb5a8f56230f66',
     ),
@@ -2250,7 +2250,7 @@
       'fpdf.css' => '35c07d5049ac6e55b8ab473c6dc38bf0',
       'fpdf.php' => 'da7385d29345f1c12fe85b6cacf5e905',
       'pdf.php' => '9c05a56fbb296b60cddcfc68ec1ae2c3',
-      'pdf.sc' => 'cd179b47d126ac55eb48cdbdbd4c1a19',
+      'pdf.sc' => 'e42b36c918e9c9951706689b949304f5',
       'plugin.php' => 'd5aba62f42496d21e3ec8d48ded5b3ba',
       'ufpdf.php' => 'ba87afe3cb2f777f921ea8a3a0457abd',
     ),
@@ -2323,7 +2323,7 @@
       ),
       'admin_config.php' => 'eeea52c7fab3125610a8e3903c0be8c9',
       'oldpolls.php' => '4a873e55c457ae529acb447b28e06780',
-      'plugin.php' => '6dff875dd04ce5d602f4b64b7732610e',
+      'plugin.php' => 'f68c44986bf5d097e3901f220726530b',
       'poll.php' => 'b51353ac9b1d4f9664b954d528644547',
       'poll_class.php' => '4b78af6d41376320b39df4a85e09e71e',
       'poll_menu.php' => '002a59a4cfa6b2036a0ae0e5abf34051',
@@ -2355,7 +2355,7 @@
       'admin_prefs.php' => '511047205732e1f3a5098052e3a2eb4e',
       'e_meta.php' => 'af7e8b4a56e0d4cbb7a469dea4b86f9c',
       'plugin.php' => '46b1e37c9d18e6872083425afb3115fa',
-      'rss.php' => '27e183fcdad34d922b84522fce7e17c1',
+      'rss.php' => 'c4ebc7f060ade515a0d30d15df93d452',
       'rss_menu.php' => '1be0ce84109cbbbcdadf68cc93fb5c20',
       'rss_shortcodes.php' => '5e842cc4bcb5262055b7bf4d9aa57f55',
       'rss_sql.php' => 'efee18037cab9fbf35cdf81f97efc2a3',
@@ -2925,7 +2925,7 @@
       'email_template.php' => 'cc12dc6238aa47bf50f915a1a114a858',
       'footer_default.php' => '633f17fe5dbb3865de99b9e65eecc190',
       'fpw_template.php' => '326abf6c01f19246a9ebe07e64d07ead',
-      'header_default.php' => 'e7b5cb81653ecdd8d7bfc8e9916a3e80',
+      'header_default.php' => 'bd4edc6cfd3a11249a9f59a846ffab87',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'login_template.php' => 'cd32f6bad43c829a8fa6e166a987c987',
       'membersonly_template.php' => '14635660ab8f2daed92f4260ed0f3fa1',
@@ -2972,7 +2972,7 @@
   'backend.php' => '312552577f67c7965a76bda84b949a64',
   'banner.php' => 'e028fd2fa6fac77863505acb501b6632',
   'class2.php' => 'f0b9fecb1230bca885d545a6572e68fc',
-  'comment.php' => '0b4676b8c5873e7ef54be536927bbcce',
+  'comment.php' => '6985ad615ac7221af65410fb21a98072',
   'contact.php' => 'be3feefdfb6c086b112ef037989fcbd1',
   'content.php' => '0eaa8d6a20548b6842ade24b9a0bf4ae',
   'download.php' => '110185761e87d967f9bb1fcf84cfb458',
@@ -2984,7 +2984,7 @@
   'forum.php' => '3c10184d52685d7c9a6906a967b7e3d8',
   'forum_viewforum.php' => '4b9fcc3a820ed2f93b4dc707c3ebe3b4',
   'forum_viewtopic.php' => '5fea10d40850fd6f72cfbec7a328e120',
-  'fpw.php' => 'cf1d99007ec405101e8973073d4dbb39',
+  'fpw.php' => '00e593fd7dbabc88c678ccc21562caee',
   'gsitemap.php' => '5a3d81b0d9ca3f41c6a8c46155c41cc7',
   'index.php' => '960de1b196ffa6e7887fe99ae65fa682',
   'links.php' => 'bed206fc2abe8f1307ef4db3b7fee63e',
@@ -2998,7 +2998,7 @@
   'request.php' => '3891299e7754fae7fcf92d9ec65d8a3e',
   'robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
   'search.php' => '1d24fcf7464762584979aa78cf0d6b7c',
-  'signup.php' => 'bc2fa04b7e17112614cb2df905e7b4e2',
+  'signup.php' => '6a21abd6d10b6ca199429cd7819d8a9d',
   'sitedown.php' => '7a2d95fb0976ce5ab287a403b118acfa',
   'subcontent.php' => '5a534e399228320e38056244e944357d',
   'submitnews.php' => '4615a023d5c16cd745bd03cc4fb980ad',
@@ -5710,8 +5710,9 @@
   'ReadMe_English_iso-8859-1.txt' => 'a15c32416143ecdebb10fab747a9065a',
   'chat.php' => 'f99ca9a68e350852ff12b6f201ff46e4',
   'e107_6171_readme.txt' => '7f411eaafccc974f91447c8efd9992d4',
+  'e107_v0.7.12_full.tar.gz' => '65db4826265763e2a4e719b369d9aefc',
   'forum_post.php' => 'b4537a7296252a0d8c010824b698259b',
-  'install.php' => '2e6a5693e9d057cf1c3690c01e26ffca',
+  'install.php' => 'e5ab961c3e9aaeefd8bcc11b9e2ae6bc',
   'oldpolls.php' => '2758e56550195c508819c6062b950bc3',
   'readme.txt' => 'ff257006036939e779d287cdfee3b4b3',
   'sitemap.php' => 'd72fdc265a68f5a3b8a5d4b51d776f84',
diff -x .svn -aruN 0.7.12.src/e107_admin/download.php 0.7.13.src/e107_admin/download.php
--- 0.7.12.src/e107_admin/download.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/download.php	2008-09-23 14:31:13.000000000 -0500
@@ -11,13 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/download.php,v $
-|     $Revision: 1.103 $
-|     $Date: 2008/06/06 19:14:14 $
+|     $Revision: 1.104 $
+|     $Date: 2008/09/23 19:31:36 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
+
+define('DOWNLOAD_DEBUG',FALSE);
+
 require_once("../class2.php");
-if (!getperms("R")) {
+if (!getperms("R")) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -284,7 +288,10 @@
 }
 
 
-if ($action == "opt") {
+
+
+if ($action == "opt") 
+{
 	global $pref, $ns;
 	$agree_flag = $pref['agree_flag'];
 	$agree_text = $pref['agree_text'];
@@ -395,6 +402,8 @@
 	$ns->tablerender(DOWLAN_54, $text);
 }
 
+
+
 if($action == 'limits')
 {
 	if($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
@@ -497,23 +506,23 @@
 {
 	function show_existing_items($action, $sub_action, $id, $from, $amount) 
 	{
-	global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref;
+		global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref;
 		$text = "<div style='text-align:center'><div style='padding : 1px; ".ADMIN_WIDTH."; margin-left: auto; margin-right: auto;'>";
         $sortorder = ($pref['download_order']) ? $pref['download_order'] : "download_datestamp";
-    $sortdirection = ($pref['download_sort']) ? strtolower($pref['download_sort']) : "desc";
-	if ($sortdirection != 'desc') $sortdirection = 'asc';
-	if(isset($_POST['searchdisp']))
-	{
+		$sortdirection = ($pref['download_sort']) ? strtolower($pref['download_sort']) : "desc";
+		if ($sortdirection != 'desc') $sortdirection = 'asc';
+		if(isset($_POST['searchdisp']))
+		{
 			$pref['admin_download_disp'] = implode("|",$_POST['searchdisp']);
 			save_prefs();
 		}
 
-	if(!$pref['admin_download_disp'])
-	{
+		if(!$pref['admin_download_disp'])
+		{
 			$search_display = array("download_name","download_class");
-	}
-	else
-	{
+		}
+		else
+		{
             $search_display = explode("|",$pref['admin_download_disp']);
 		}
 
@@ -541,7 +550,7 @@
 				<td style='width:5%' class='fcaption'>ID</td>
 				";
 
-// Search Display Column header.----------
+			// Search Display Column header.----------
 		  foreach($search_display as $disp)
 		  {
 			if($disp == "download_name")
@@ -707,50 +716,78 @@
 // ---------------------------------------------------------------------------
 
 
+	// Given the string which is stored in the DB, turns it into an array of mirror entries
+	// If $byID is true, the array index is the mirror ID. Otherwise its a simple array
+	function makeMirrorArray($source, $byID = FALSE)
+	{
+		$ret = array();
+		if($source)
+		{
+			$mirrorTArray = explode(chr(1), $source);
+
+			$count = 0;
+			foreach($mirrorTArray as $mirror)
+			{
+				if ($mirror)
+				{
+					list($mid, $murl, $mreq) = explode(",", $mirror);
+					$ret[$byID ? $mid : $count] = array('id' => $mid, 'url' => $murl, 'requests' => $mreq);
+					$count++;
+				}
+			}
+		}
+		return $ret;
+	}
+
+
+	// Turn the array into a string which can be stored in the DB
+	function compressMirrorArray($source)
+	{
+		if (!is_array($source) || !count($source)) return '';
+		$inter = array();
+		foreach ($source as $s)
+		{
+			$inter[] = $s['id'].','.$s['url'].','.$s['requests'];
+		}
+		return implode(chr(1),$inter);
+	}
+
+
+
 	function create_download($sub_action, $id) 
 	{
 		global $cal,$tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array,$pst;
 		require_once(e_FILE."shortcode/batch/download_shortcodes.php");
 
+		$mirrorArray = array();
+
 		$download_status[0] = DOWLAN_122;
 		$download_status[1] = DOWLAN_123;
 		$download_status[2] = DOWLAN_124;
 		$preset = $pst->read_preset("admin_downloads");  // read preset values into array
 		extract($preset);
 
-		if (!$sql->db_Select("download_category")) {
+		if (!$sql->db_Select("download_category")) 
+		{
 			$ns->tablerender(ADLAN_24, "<div style='text-align:center'>".DOWLAN_5."</div>");
 			return;
 		}
 		$download_active = 1;
-		if ($sub_action == "edit" && !$_POST['submit']) {
-			if ($sql->db_Select("download", "*", "download_id='$id' ")) {
+		if ($sub_action == "edit" && !$_POST['submit']) 
+		{
+			if ($sql->db_Select("download", "*", "download_id=".$id)) 
+			{
 				$row = $sql->db_Fetch();
 				extract($row);
 
-				if($download_mirror)
-				{
-
-					$mirrorTArray = explode(chr(1), $download_mirror);
-					$mirrorArray = array();
-
-					$count=0;
-					foreach($mirrorTArray as $mirror)
-					{
-						if($mirror)
-						{
-							list($mid, $murl) = explode(",", $mirror);
-							$mirrorArray[$count]['id'] = $mid;
-							$mirrorArray[$count]['url'] = $murl;
-							$count++;
-						}
-					}
-				}
+				$mirrorArray = $this->makeMirrorArray($row['download_mirror']);
 			}
 		}
 
-		if ($sub_action == "dlm" && !$_POST['submit']) {
-			if ($sql->db_Select("upload", "*", "upload_id='$id' ")) {
+		if ($sub_action == "dlm" && !$_POST['submit']) 
+		{
+			if ($sql->db_Select("upload", "*", "upload_id=".$id)) 
+			{
 				$row = $sql->db_Fetch();
 
 				$download_category = $row['upload_category'];
@@ -799,9 +836,9 @@
 		while (isset($file_array[$counter])) 
 		{
 			$fpath = str_replace(e_DOWNLOAD,"",$file_array[$counter]['path']).$file_array[$counter]['fname'];
-		  $selected = '';
-		  if (stristr($fpath, $download_url) !== FALSE) 
-		  {
+			$selected = '';
+			if (stristr($fpath, $download_url) !== FALSE) 
+			{
 				$selected = " selected='selected'";
 				$found = 1;
 			}
@@ -814,12 +851,13 @@
 		if (preg_match("/http:|ftp:/", $download_url)) 
 		{
 			$download_url_external = $download_url;
-		  $download_url = '';
-		  $dt = '';
+			$download_url = '';
+			$dt = '';
 		}
 
 		$etext = " - (".DOWLAN_68.")";
-		if (file_exists(e_FILE."public/".$download_url)) {
+		if (file_exists(e_FILE."public/".$download_url)) 
+		{
 			$etext = "";
 		}
 
@@ -845,34 +883,49 @@
 			<td style='width:20%' class='forumheader3'><span title='".DOWLAN_129."' style='cursor:help'>".DOWLAN_128."</span>:</td>
 			<td style='width:80%' class='forumheader3'>";
 
+
+		// See if any mirrors to display
 		if(!$sql -> db_Select("download_mirror"))
-		{
+		{	// No mirrors defined here
 			$text .= DOWLAN_144."</tr>";
 		}
 		else
 		{
-
 			$text .= DOWLAN_132."<br />
 			<div id='mirrorsection'>";
 
-			$mirrorList = $sql -> db_getList();
+			$mirrorList = $sql -> db_getList();			// Get the list of possible mirrors
 
-			$m_count = (count($mirrorArray) ? count($mirrorArray) : 1);
+			$m_count = (count($mirrorArray) ? count($mirrorArray) : 1);		// Count of mirrors actually in use (or count of 1 if none defined yet)
 
-			for($count = 1; $count <= $m_count; $count++){
+			for($count = 1; $count <= $m_count; $count++)
+			{
 
 				$opt = ($count==1) ? "id='mirror'" : "";
-				$text .="<span $opt>
+				$text .="<span {$opt}>
 				<select name='download_mirror_name[]' class='tbox'>
 					<option value=''>&nbsp;</option>";
 
-				foreach($mirrorList as $mirror)	{
+				foreach ($mirrorList as $mirror)	
+				{
 					extract($mirror);
-					$text .= "<option value='$mirror_id'".($mirror_id == $mirrorArray[($count-1)]['id'] ? " selected='selected'" : "").">$mirror_name</option>\n";
+					$text .= "<option value='{$mirror_id}'".($mirror_id == $mirrorArray[($count-1)]['id'] ? " selected='selected'" : "").">{$mirror_name}</option>\n";
 				}
 
 				$text .= "</select>
 				<input  class='tbox' type='text' name='download_mirror[]' style='width: 75%;' value=\"".$mirrorArray[($count-1)]['url']."\" maxlength='200' />";
+				if (DOWNLOAD_DEBUG)
+				{
+					if ($id)
+					{
+						$text .= '('.$mirrorArray[($count-1)]['requests'].')';
+					}
+					else
+					{
+					$text .= "
+				<input  class='tbox' type='text' name='download_mirror_requests[]' style='width: 10%;' value=\"".$mirrorArray[($count-1)]['requests']."\" maxlength='10' />";
+					}
+				}
 				$text .= "</span><br />";
 			}
 
@@ -889,7 +942,7 @@
 			<input type='radio' name='download_mirror_type' value='0'".(!$download_mirror_type ? " checked='checked'" : "")." /> ".DOWLAN_157."
 			</td>
 			</tr>";
-		}
+		}		// End of mirror-related stuff
 
 			$text .= "<tr>
 			<td style='width:20%' class='forumheader3'>".DOWLAN_15.":</td>
@@ -1107,7 +1160,8 @@
 
 
 
-	function submit_download($sub_action, $id) {
+	function submit_download($sub_action, $id) 
+	{
 		global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
 
 		if($sub_action == 'edit')
@@ -1201,33 +1255,75 @@
            $_POST['download_datestamp'] = time();
 		}
 
-		if($_POST['update_datestamp']){	$_POST['download_datestamp'] = time();	}
+		if($_POST['update_datestamp'])
+		{	
+			$_POST['download_datestamp'] = time();	
+		}
 
 		$mirrorStr = "";
-		$mirrorReq = "";
+		$mirrorFlag = FALSE;
 
-		if($_POST['download_mirror_name'][0])
+		// See if any mirrors defined
+		// Need to check all the possible mirror names - might have deleted the first one if we're in edit mode
+		foreach ($_POST['download_mirror_name'] as $mn)
+		{
+			if ($mn)
+			{
+				$mirrorFlag = TRUE;
+				break;
+			}
+		}
+		if($mirrorFlag)
 		{
 			$mirrors = count($_POST['download_mirror_name']);
+			$mirrorArray = array();
+			$newMirrorArray = array();
+			if ($id && $sql->db_Select('download','download_mirror', 'download_id = '.$id))		// Get existing download stats
+			{
+				if ($row = $sql->db_Fetch())
+				{
+					$mirrorArray = $this->makeMirrorArray($row['download_mirror'], TRUE);
+				}
+			}
 			for($a=0; $a<$mirrors; $a++)
 			{
-				$mirror_id = $_POST['download_mirror_name'][$a];
-				$mirror_url = $_POST['download_mirror'][$a];
-				$mirrorStr .= $mirror_id.",".$mirror_url.",0".chr(1);
+				$mid = trim($_POST['download_mirror_name'][$a]);
+				$murl = trim($_POST['download_mirror'][$a]);
+				if ($mid && $murl)
+				{
+					$newMirrorArray[$mid] = array('id' => $mid, 'url' => $murl, 'requests' => 0);
+					if (DOWNLOAD_DEBUG && !$id)
+					{
+						$newMirrorArray[$mid]['requests'] = intval($_POST['download_mirror_requests'][$a]);
+					}
+				}
+			}
+			// Now copy across any existing usage figures
+			foreach ($newMirrorArray as $k => $m)
+			{
+				if (isset($mirrorArray[$k]))
+				{
+					$newMirrorArray[$k]['requests'] = $mirrorArray[$k]['requests'];
+				}
 			}
+			$mirrorStr = $this->compressMirrorArray($newMirrorArray);
 		}
 
 		if ($id)
-		{
+		{	// Its an edit
 			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." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)")) {
+		} 
+		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." (<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);
 
-				if ($_POST['remove_upload']) {
+				if ($_POST['remove_upload']) 
+				{
 					$sql->db_Update("upload", "upload_active='1' WHERE upload_id='".$_POST['remove_id']."'");
 					$mes = "<br />".$_POST['download_name']." ".DOWLAN_104;
 					$mes .= "<br /><br /><a href='".e_ADMIN."upload.php'>".DOWLAN_105."</a>";
diff -x .svn -aruN 0.7.12.src/e107_admin/fla.php 0.7.13.src/e107_admin/fla.php
--- 0.7.12.src/e107_admin/fla.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/fla.php	2008-08-28 14:22:17.000000000 -0500
@@ -11,13 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/fla.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/10/30 03:58:29 $
-|     $Author: e107coders $
+|     $Revision: 1.13 $
+|     $Date: 2008/08/28 19:22:40 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-if (!getperms("4")) {
+if (!getperms("4")) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -26,8 +27,37 @@
 require_once("auth.php");
 
 $tmp = (e_QUERY) ? explode(".", e_QUERY) : "";
-$from = (!$tmp[0]) ? 0 : intval($tmp[0]);
-$amount = (!$tmp[1]) ? 50 : intval($tmp[1]);
+$from = intval(varset($tmp[0], 0));
+$amount = intval(varset($tmp[1], 50));
+
+/*
+'generic' table:
+  gen_id 		- unique identifier
+  gen_type 		- 'auto_banned' is of interest here
+  gen_datestamp	- date/time of ban
+  gen_user_id 	- set to zero
+  gen_ip 		- IP address of ban
+  gen_intdata 	- user ID (where known)
+  gen_chardata 	- ban detail as known
+
+*/
+
+function deleteBan($banID, $banIP = '')
+{
+	global $sql2;
+	if ($banIP == '')
+	{
+		if($sql2->db_Select("generic", "gen_ip", "gen_id={$banID}"))
+		{
+			$at = $sql2->db_Fetch();
+			$banIP = $at['gen_ip'];
+		}
+	}
+	if ($banIP == '') return FALSE;
+	$sql2->db_Delete("banlist", "banlist_ip='{$banIP}'");		// Delete from main banlist
+	$sql2->db_Delete("generic", "gen_id='{$banID}' ");			// Delete from generic table
+	return TRUE;
+}
 
 
 if(isset($_POST['delbanSubmit']))
@@ -36,20 +66,22 @@
 	$delcount = 0;
 	foreach($_POST['fladelete'] as $delete)
 	{
-		$delcount ++;
-		$sql -> db_Delete("generic", "gen_id='$delete' ");
+		if (deleteBan($delete))
+		{
+			$delcount ++;
+		}
 	}
 	$message = FLALAN_3.": ".$delcount;
 
 	$bancount = 0;
 	foreach($_POST['flaban'] as $ban)
 	{
-		if($sql -> db_Select("generic", "*", "gen_id=$ban"))
+		if($sql -> db_Select("generic", "*", "gen_id={$ban}"))
 		{
 			$at = $sql -> db_Fetch();
 			$banlist_ip = $at['gen_ip'];
-			$sql->db_Insert("banlist", "'$banlist_ip', '".ADMINID."', '".FLALAN_4."' ");
-			$sql -> db_Delete("generic", "gen_id='$ban' ");
+			$sql->db_Insert("banlist", "'{$banlist_ip}', '".ADMINID."', '".FLALAN_4."' ");
+			$sql -> db_Delete("generic", "gen_id='{$ban}' ");
 			$bancount ++;
 		}
 	}
@@ -59,11 +91,19 @@
 
 if(e_QUERY == "dabl")
 {
-	$sql -> db_Delete("generic", "gen_type='auto_banned' ");
+	$sql -> db_Select("generic", 'gen_ip,gen_id',"gen_type='auto_banned' ");
+	while ($row = $sql->db_Fetch())
+	{
+		if (deleteBan($row['gen_id'],$row['gen_ip']))
+		{
+			$delcount ++;
+		}
+	}
 	$message = FLALAN_17;
 }
 
 
+// Now display any outstanding auto-banned IP addresses
 if($sql -> db_Select("generic", "*", "gen_type='auto_banned' ORDER BY gen_datestamp DESC "))
 {
 	$abArray = $sql -> db_getList();
@@ -77,13 +117,14 @@
 
 }
 
-if (isset($message)) {
+if (isset($message)) 
+{
 	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
 
 $gen = new convert;
 $fla_total = $sql->db_Count("generic", "(*)", "WHERE gen_type='failed_login'");
-if(!$sql -> db_Select("generic", "*", "gen_type='failed_login' ORDER BY gen_datestamp DESC LIMIT $from,$amount"))
+if(!$sql -> db_Select("generic", "*", "gen_type='failed_login' ORDER BY gen_datestamp DESC LIMIT {$from},{$amount}"))
 {
 	$text = "<div style='text-align: center;'>".FLALAN_2."</div>";
 }
@@ -113,8 +154,8 @@
 		<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 />
-		<input type='checkbox' name='flaban[]' value='$gen_id' /> ".LAN_BAN."
+		<input type='checkbox' name='fladelete[]' value='{$gen_id}' /> ".LAN_DELETE."<br />
+		<input type='checkbox' name='flaban[]' value='{$gen_id}' /> ".LAN_BAN."
 		</td>
 		</tr>
 		";
diff -x .svn -aruN 0.7.12.src/e107_admin/links.php 0.7.13.src/e107_admin/links.php
--- 0.7.12.src/e107_admin/links.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/links.php	2008-09-23 14:37:07.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/links.php,v $
-|     $Revision: 1.72 $
-|     $Date: 2008/07/10 20:37:03 $
+|     $Revision: 1.73 $
+|     $Date: 2008/09/23 19:37:30 $
 |     $Author: e107steved $
 |
 | links.php?debug shows stored data for each link after name (before constant conversion)
@@ -147,11 +147,13 @@
 
 if ($delete == 'main')
 {
-	if($sql->db_Select("links", "link_id, link_name, link_order", "link_id='".$del_id."'")){
+	if ($sql->db_Select("links", "link_id, link_name, link_order, link_parent", "link_id=".intval($del_id)))
+	{
 		$row = $sql->db_Fetch();
 		$msg = $linkpost->delete_link($row);
 
-		if($msg){
+		if ($msg)
+		{
 			$e107cache->clear("sitelinks");
 			$linkpost->show_message($msg);
 		}
@@ -485,7 +487,7 @@
 			<td style='width:70%' class='forumheader3'>
 			<input class='tbox' type='text' id='link_button' name='link_button' size='42' value='$link_button' maxlength='100' />
 
-					<input class='button' type ='button' style='cursor:hand' size='30' value='".LCLAN_39."' onclick='expandit(this)' />
+					<input class='button' type ='button' style='cursor:pointer' size='30' value='".LCLAN_39."' onclick='expandit(this)' />
 			<div id='linkicn' style='display:none;{head}'>";
 
 		foreach($iconlist as $icon)
@@ -589,6 +591,8 @@
 		}
 	}
 
+
+
 	function show_pref_options() {
 		global $pref, $ns;
 		$text = "<div style='text-align:center'>
@@ -626,19 +630,27 @@
 		$ns->tablerender(LCLAN_88, $text);
 	}
 
-	function delete_link($linkInfo)	{
+
+
+	// Delete link
+	// We need to update the 'order' number of other links with the same parentage - may be top level or a sub-level
+	function delete_link($linkInfo)	
+	{
 		global $sql;
 
-		if ($sql->db_Select("links", "link_id", "link_order > '{$linkInfo['link_order']}'")){
+		if ($sql->db_Select("links", "link_id", "link_order > '{$linkInfo['link_order']}' AND `link_parent`={$linkInfo['link_parent']} "))
+		{
 			$linkList = $sql->db_getList();
-			foreach($linkList as $l){
+			foreach($linkList as $l)
+			{
 				$sql->db_Update("links", "link_order = link_order -1 WHERE link_id = '{$l['link_id']}'");
 			}
 		}
 
 
-		if ($sql->db_Delete("links", "link_id='".$linkInfo['link_id']."'")){
-			// Update ophaned sublinks.
+		if ($sql->db_Delete("links", "link_id='".$linkInfo['link_id']."'"))
+		{
+			// Update orphaned sublinks - just hide them, and make them top level. And delete any obsolete naming while we're there
 			$sql->db_Update("links", "link_name = SUBSTRING_INDEX(link_name, '.', -1) , link_parent = '0', link_class='255' WHERE link_parent= '".$linkInfo['link_id']."'");
 
 			return LCLAN_53." #".$linkInfo['link_id']." ".LCLAN_54."<br />";
@@ -651,7 +663,8 @@
 
 // -------------------------- Sub links generator ------------->
 
-function show_sublink_generator() {
+function show_sublink_generator() 
+{
 	global $ns,$sql;
 
     $sublinks = $this->sublink_list();
@@ -703,7 +716,8 @@
 
 
 
-function sublink_list($name=""){
+function sublink_list($name="")
+{
     global $sql,$PLUGINS_DIRECTORY;
 	$sublink_type['news']['title'] = LINKLAN_8; // "News Categories";
 	$sublink_type['news']['table'] = "news_category";
@@ -722,14 +736,18 @@
 	$sublink_type['downloads']['fieldicon'] = "download_category_icon";
 
 
-	if ($sql -> db_Select("plugin", "plugin_path", "plugin_installflag = '1'")) {
-		while ($row = $sql -> db_Fetch()) {
+	if ($sql -> db_Select("plugin", "plugin_path", "plugin_installflag = '1'")) 
+	{
+		while ($row = $sql -> db_Fetch()) 
+		{
 			$sublink_plugs[] = $row['plugin_path'];
 		}
 	}
 
-	foreach ($sublink_plugs as $plugin_id) {
-		if (is_readable(e_PLUGIN.$plugin_id.'/e_linkgen.php')) {
+	foreach ($sublink_plugs as $plugin_id) 
+	{
+		if (is_readable(e_PLUGIN.$plugin_id.'/e_linkgen.php')) 
+		{
 		  	require_once(e_PLUGIN.$plugin_id.'/e_linkgen.php');
 		}
 	}
@@ -756,7 +774,7 @@
 // each entry is array( 'val'=>value, 'txt'=>text )
 //
 
-$i=0;
+	$i=0;
 	foreach($aData as $aVal)
 	{
 		$sVal = $aVal['val'];
@@ -769,7 +787,8 @@
 		$aPrep[$i++] = $sOut;
 		$sTxtPrev = $sTxt;
 	}
-	if ($i) {  // terminate final option
+	if ($i) 
+	{  // terminate final option
 		$aPrep[$i] = '>'.$sTxtPrev.'</option>';
 	}
 
@@ -802,9 +821,11 @@
 
 }
 
-function links_adminmenu() {
+function links_adminmenu() 
+{
 	global $action;
-	if ($action == "") {
+	if ($action == "") 
+	{
 		$action = "main";
 	}
 	$var['main']['text'] = LCLAN_62;
diff -x .svn -aruN 0.7.12.src/e107_admin/users_extended.php 0.7.13.src/e107_admin/users_extended.php
--- 0.7.12.src/e107_admin/users_extended.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/users_extended.php	2008-08-30 15:21:39.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users_extended.php,v $
-|     $Revision: 1.45 $
-|     $Date: 2008/04/06 21:37:41 $
+|     $Revision: 1.47 $
+|     $Date: 2008/08/30 20:22:02 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -273,6 +273,7 @@
 
 	  if(!$current)
 	  {	// Show existing fields
+		$mode = 'show';
 		$text = "<div style='text-align:center'>";
 		$text .= "<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
@@ -357,6 +358,7 @@
 	  {
 		if($current == 'new')
 		{
+			$mode = 'new';
 		  $current = array();
 		  $current_include = '';
 		  $current_regex = '';
@@ -365,8 +367,10 @@
 		}
 		else
 		{	// Editing existing definition
+			$mode = 'edit';
 		  list($current_include, $current_regex, $current_regexfail, $current_hide) = explode("^,^",$current['user_extended_struct_parms']);
 		}
+
 		$text .= "
 			<form method='post' action='".e_SELF."?".e_QUERY."'>
 			";
@@ -624,7 +628,8 @@
 			$text .= "<tr>
 			<td colspan='4' style='text-align:center' class='forumheader'>";
 
-			if ((!is_array($current) || $action == "continue") && $sub_action == "")
+//			if ((!is_array($current) || $action == "continue") && $sub_action == "")
+			if ((($mode == 'new') || $action == "continue") && $sub_action == "")
 			{
 				$text .= "
 				<input class='button' type='submit' name='add_field' value='".EXTLAN_23."' />
@@ -958,8 +963,16 @@
 		{
 			$ret .= EXTLAN_68." $f ".EXTLAN_69."<br />";
 
-			if($tmp[$f]['type']=="db field" && is_readable(e_ADMIN."sql/extended_".$f.".php")){
+			if ($tmp[$f]['type']=="db field")
+			{
+				if (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 />";
+				}
+				else
+				{
+					$ret .= str_replace('--FILE--',e_ADMIN.'sql/extended_'.$f.'.php',EXTLAN_78);
+				}
 			}
 		}
 		else
diff -x .svn -aruN 0.7.12.src/e107_admin/users.php 0.7.13.src/e107_admin/users.php
--- 0.7.12.src/e107_admin/users.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/users.php	2008-08-28 14:57:23.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users.php,v $
-|     $Revision: 1.94 $
-|     $Date: 2008/06/06 19:14:14 $
+|     $Revision: 1.95 $
+|     $Date: 2008/08/28 19:57:46 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -175,47 +175,70 @@
 
 
 // ------- Quick Add User --------------
-if (isset($_POST['adduser'])) {
+if (isset($_POST['adduser'])) 
+{
 	$e107cache->clear("online_menu_totals");
-	if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
+	if (!$_POST['ac'] == md5(ADMINPWCHANGE)) 
+	{
 		exit;
 	}
 
 	require_once(e_HANDLER."message_handler.php");
-	if (strstr($_POST['name'], "#") || strstr($_POST['name'], "=")) {
+	if (strstr($_POST['name'], "#") || strstr($_POST['name'], "=")) 
+	{
 		message_handler("P_ALERT", USRLAN_92);
 		$error = TRUE;
 	}
 	$_POST['name'] = trim(str_replace("&nbsp;", "", $_POST['name']));
-	if ($_POST['name'] == "Anonymous") {
+	if ($_POST['name'] == "Anonymous") 
+	{
 		message_handler("P_ALERT", USRLAN_65);
 		$error = TRUE;
 	}
-	if ($sql->db_Select("user", "*", "user_name='".$_POST['name']."' ")) {
+	if ($sql->db_Select("user", "*", "user_name='".$_POST['name']."' ")) 
+	{
 		message_handler("P_ALERT", USRLAN_66);
 		$error = TRUE;
 	}
-	if ($_POST['password1'] != $_POST['password2']) {
+	if ($_POST['password1'] != $_POST['password2']) 
+	{
 		message_handler("P_ALERT", USRLAN_67);
 		$error = TRUE;
 	}
 
-	if ($_POST['name'] == "" || $_POST['password1'] == "" || $_POST['password2'] = "") {
+	if ($_POST['name'] == "" || $_POST['password1'] == "" || $_POST['password2'] = "") 
+	{
 		message_handler("P_ALERT", USRLAN_68);
 		$error = TRUE;
 	}
-	if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $_POST['email'])) {
-		message_handler("P_ALERT", USRLAN_69);
-		$error = TRUE;
-	}
-	if (!$error) {
-		if ($sql->db_Select("user", "*", "user_email='".$_POST['email']."' AND user_ban='1' ")) {
-			exit;
+
+	if (!varset($pref['disable_emailcheck'],FALSE))
+	{
+		// Email address checks
+		if (!check_email($_POST['email'])) 
+		{
+			message_handler("P_ALERT", USRLAN_69);
+			$error = TRUE;
 		}
-		if ($sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'")) {
-			exit;
+		elseif ($sql->db_Count("user", "(*)", "WHERE user_email='".$_POST['email']."' AND user_ban='1' ")) 
+		{	// Specifically identify banned users
+			message_handler("P_ALERT", USRLAN_147);
+			$error = TRUE;
 		}
+		elseif ($sql->db_Count("banlist", "(*)", "WHERE banlist_ip='".$_POST['email']."'")) 
+		{	// ... and filter against the ban list
+			message_handler("P_ALERT", USRLAN_148);
+			$error = TRUE;
+		}
+		elseif ($sql->db_Count("user", "(*)", "WHERE user_email='".$_POST['email']."' ")) 
+		{	// Finally, email addresses are required to be unique anyway
+			message_handler("P_ALERT", USRLAN_156);
+			$error = TRUE;
+		}
+	}
 
+	if (!$error) 
+	{
 		$username = strip_tags($_POST['name']);
 		$loginname = strip_tags($_POST['loginname']);
 
@@ -969,7 +992,7 @@
 
 	function add_user() {
 		global $rs, $ns;
-		$text = "<div style='text-align:center'>". $rs->form_open("post", e_SELF, "adduserform")."
+		$text = "<div style='text-align:center'>". $rs->form_open("post", e_SELF.'?create', "adduserform")."
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
 			<td style='width:30%' class='forumheader3'>".USRLAN_61."</td>
diff -x .svn -aruN 0.7.12.src/e107_admin/ver.php 0.7.13.src/e107_admin/ver.php
--- 0.7.12.src/e107_admin/ver.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_admin/ver.php	2008-09-28 20:49:06.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ver.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2008/08/25 23:37:52 $
+|     $Revision: 1.25 $
+|     $Date: 2008/09/29 01:49:29 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$e107info['e107_version'] = "0.7.12";
+$e107info['e107_version'] = "0.7.13";
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.12.src/e107_files/shortcode/batch/download_shortcodes.php 0.7.13.src/e107_files/shortcode/batch/download_shortcodes.php
--- 0.7.12.src/e107_files/shortcode/batch/download_shortcodes.php	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_files/shortcode/batch/download_shortcodes.php	2008-09-23 14:31:22.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/download_shortcodes.php,v $
-|     $Revision: 1.28 $
-|     $Date: 2008/08/14 22:55:55 $
-|     $Author: e107coders $
+|     $Revision: 1.29 $
+|     $Date: 2008/09/23 19:31:45 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -454,7 +454,7 @@
 
 		// Its a structured display option - need a 2-step process to create a tree
 	    $catlist = array();
-	    while ($row = $sql->db_Fetch())
+	    while ($row = $sql->db_Fetch(MYSQL_ASSOC))
 	    {
 			$tmp = $row['download_category_parent'];
 	      	if ($tmp == '0')
@@ -484,14 +484,14 @@
 	    {  // Main categories
 			// Could add a display class to the group, but the default looked OK
 
-            if(count($catlist)>1)
+            if(count($thiscat['subcats'])>0)
 			{
 				$boxinfo .= "<optgroup label='".htmlspecialchars($thiscat['download_category_name'])."'>\n";
 		  		$scprefix = '';
 			}
 			else
 			{
-				$sel = ($cdc == $sc['download_category_id']) ? " selected='selected'" : "";
+				$sel = ($cdc == $thiscat['download_category_id']) ? " selected='selected'" : "";
             	$boxinfo .= "<option value='".$thiscat['download_category_id']."' {$sel}>".htmlspecialchars($thiscat['download_category_name'])."</option>\n";
 			}
 
diff -x .svn -aruN 0.7.12.src/e107_files/shortcode/batch/news_shortcodes.php 0.7.13.src/e107_files/shortcode/batch/news_shortcodes.php
--- 0.7.12.src/e107_files/shortcode/batch/news_shortcodes.php	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_files/shortcode/batch/news_shortcodes.php	2008-09-04 15:06:40.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/news_shortcodes.php,v $
-|     $Revision: 1.35 $
-|     $Date: 2008/07/15 21:11:50 $
+|     $Revision: 1.37 $
+|     $Date: 2008/09/04 20:07:03 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -46,7 +46,7 @@
 $param = getcachedvars('current_news_param');
 $category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
 if (!$category_icon) return '';
-return "<a class='".$GLOBALS['NEWS_CSSMODE']."_icon' href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."'  src='".$category_icon."' alt='' /></a>";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_icon' href='".e_HTTP."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."'  src='".$category_icon."' alt='' /></a>";
 SC_END
 
 SC_BEGIN NEWSHEADER
@@ -55,9 +55,9 @@
 $category_icon = str_replace("../", "", trim($news_item['category_icon']));
 if (!$category_icon) return '';
 if ($category_icon && strstr("images", $category_icon)) {
-	return THEME.$category_icon;
+	return THEME_ABS.$category_icon;
 } else {
-	return e_IMAGE."icons/".$category_icon;
+	return e_IMAGE_ABS."icons/".$category_icon;
 }
 SC_END
 
@@ -66,7 +66,7 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $category_name = $tp -> toHTML($news_item['category_name'],FALSE,"defs");
-return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".e_BASE."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".e_HTTP."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
 SC_END
 
 SC_BEGIN NEWSAUTHOR
@@ -80,7 +80,7 @@
 	}
 	else
 	{
-		return "<a class='".$GLOBALS['NEWS_CSSMODE']."_author' href='".e_BASE."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
+		return "<a class='".$GLOBALS['NEWS_CSSMODE']."_author' href='".e_HTTP."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
 	}
 }
 return "<a href='http://e107.org'>e107</a>";
@@ -132,14 +132,14 @@
 } else {
 	$NEWIMAGE = $param['image_nonew_small'];
 }
-return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : "".($pref['comments_icon'] ? $NEWIMAGE : "")." <a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total']."</a>");
+return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : "".($pref['comments_icon'] ? $NEWIMAGE : "")." <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total']."</a>");
 SC_END
 
 SC_BEGIN NEWSCOMMENTLINK
 global $pref, $sql;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : " <a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink']."</a>");
+return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : " <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink']."</a>");
 SC_END
 
 SC_BEGIN NEWSCOMMENTCOUNT
@@ -164,7 +164,8 @@
 SC_END
 
 SC_BEGIN PDFICON
-global $tp;
+global $tp, $pref;
+if (!$pref['plug_installed']['pdf']) return '';
 $news_item = getcachedvars('current_news_item');
 return $tp -> parseTemplate("{PDF=".LAN_NEWS_24."^news.".$news_item['news_id']."}");
 SC_END
@@ -179,8 +180,8 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 if (ADMIN && getperms("H")) {
-	$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";
+	$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."generic/".IMODE."/newsedit.png");
+	return " <a href='".e_ADMIN_ABS."newspost.php?create.edit.".$news_item['news_id']."'><img src='".$adop_icon."' alt='' style='border:0' /></a>\n";
 } else {
 	return '';
 }
@@ -199,7 +200,7 @@
 	if (isset($_POST['preview'])) {
 		return $es1.EXTENDEDSTRING.$es2."<br />".$news_item['news_extended'];
 	} else {
-		return $es1."<a class='".$GLOBALS['NEWS_CSSMODE']."_extendstring' href='".e_BASE."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
+		return $es1."<a class='".$GLOBALS['NEWS_CSSMODE']."_extendstring' href='".e_HTTP."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
 	}
 } else {
 	return "";
@@ -211,7 +212,7 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $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>";
+return "<div class='category".$news_item['news_category']."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
 SC_END
 
 SC_BEGIN ADMINCAPTION
@@ -219,7 +220,7 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $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>";
+return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
 SC_END
 
 SC_BEGIN ADMINBODY
@@ -239,13 +240,13 @@
 SC_BEGIN NEWSTHUMBNAIL
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='".$GLOBALS['NEWS_CSSMODE']."_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
+return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_HTTP."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='".$GLOBALS['NEWS_CSSMODE']."_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
 SC_END
 
 SC_BEGIN NEWSIMAGE
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='".$GLOBALS['NEWS_CSSMODE']."_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
+return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_HTTP."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='".$GLOBALS['NEWS_CSSMODE']."_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
 SC_END
 
 SC_BEGIN STICKY_ICON
@@ -258,7 +259,7 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $mode = ($parm == "extend") ? "extend" : "item";
-return "<a class='".$GLOBALS['NEWS_CSSMODE']."_titlelink' style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".e_BASE."news.php?".$mode.".".$news_item['news_id'].".".$news_item['news_category']."' title=\"".$news_item['news_title']."\" >".$news_item['news_title']."</a>";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_titlelink' style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".e_HTTP."news.php?".$mode.".".$news_item['news_id'].".".$news_item['news_category']."' title=\"".$news_item['news_title']."\" >".$news_item['news_title']."</a>";
 SC_END
 
 SC_BEGIN NEWSCATICON
@@ -268,7 +269,7 @@
 $category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
 if (!$category_icon) return '';
 if($param['caticon'] == ""){$param['caticon'] = "border:0px";}
-return "<a class='".$GLOBALS['NEWS_CSSMODE']."_caticon' href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
+return "<a class='".$GLOBALS['NEWS_CSSMODE']."_caticon' href='".e_HTTP."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
 SC_END
 
 SC_BEGIN TRACKBACK
@@ -276,7 +277,7 @@
 if(!varsettrue($pref['trackbackEnabled'])) return '';
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-return ($param['trackbackbeforestring'] ? $param['trackbackbeforestring'] : "")."<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."#track'>".$param['trackbackstring'].$news_item['tb_count']."</a>".($param['trackbackafterstring'] ? $param['trackbackafterstring'] : "");
+return ($param['trackbackbeforestring'] ? $param['trackbackbeforestring'] : "")."<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."#track'>".$param['trackbackstring'].$news_item['tb_count']."</a>".($param['trackbackafterstring'] ? $param['trackbackafterstring'] : "");
 SC_END
 
 SC_BEGIN NEWSINFO
diff -x .svn -aruN 0.7.12.src/e107_files/shortcode/email_item.sc 0.7.13.src/e107_files/shortcode/email_item.sc
--- 0.7.12.src/e107_files/shortcode/email_item.sc	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_files/shortcode/email_item.sc	2008-09-04 15:06:40.000000000 -0500
@@ -1,11 +1,11 @@
 if (defined("ICONMAIL") && file_exists(THEME."images/".ICONMAIL)) 
 {
-	$icon = THEME."images/".ICONMAIL;
+	$icon = THEME_ABS."images/".ICONMAIL;
 }
 else
 {
-	$icon = e_IMAGE."generic/".IMODE."/email.png";
+	$icon = e_IMAGE_ABS."generic/".IMODE."/email.png";
 }
 $parms = explode("^",$parm);
 // message^source^other_parms
-return "<a href='".e_BASE."email.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
+return "<a href='".e_HTTP."email.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
diff -x .svn -aruN 0.7.12.src/e107_files/shortcode/print_item.sc 0.7.13.src/e107_files/shortcode/print_item.sc
--- 0.7.12.src/e107_files/shortcode/print_item.sc	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_files/shortcode/print_item.sc	2008-09-04 15:06:40.000000000 -0500
@@ -1,10 +1,10 @@
 if (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT))
 {
-	$icon = THEME."images/".ICONPRINT;
+	$icon = THEME_ABS."images/".ICONPRINT;
 }
 else
 {
-	$icon = e_IMAGE."generic/".IMODE."/printer.png";
+	$icon = e_IMAGE_ABS."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>";
\ No newline at end of file
+return "<a href='".e_HTTP."print.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
\ No newline at end of file
diff -x .svn -aruN 0.7.12.src/e107_files/shortcode/user_extended.sc 0.7.13.src/e107_files/shortcode/user_extended.sc
--- 0.7.12.src/e107_files/shortcode/user_extended.sc	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_files/shortcode/user_extended.sc	2008-09-02 14:31:23.000000000 -0500
@@ -98,7 +98,7 @@
 		$sql_ue = new db;			// Use our own DB object to avoid conflicts
 		if($sql_ue->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
 		{
-			$row = $sql->db_Fetch();
+			$row = $sql_ue->db_Fetch();
 			$ret_data = $row[$tmp[2]];
 		}
 		else
diff -x .svn -aruN 0.7.12.src/e107_handlers/emailprint_class.php 0.7.13.src/e107_handlers/emailprint_class.php
--- 0.7.12.src/e107_handlers/emailprint_class.php	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_handlers/emailprint_class.php	2008-09-04 15:06:47.000000000 -0500
@@ -11,38 +11,47 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/emailprint_class.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/09/03 13:43:18 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2008/09/04 20:07:10 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
-@include_once(e_LANGUAGEDIR."English/lan_print.php");
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
-@include_once(e_LANGUAGEDIR."English/lan_email.php");
-
-class emailprint {
-	function render_emailprint($mode, $id, $look = 0) {
+@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
+//@include_once(e_LANGUAGEDIR."English/lan_print.php");
+@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
+//@include_once(e_LANGUAGEDIR."English/lan_email.php");
+
+class emailprint 
+{
+	function render_emailprint($mode, $id, $look = 0) 
+	{
 		// $look = 0  --->display all icons
 		// $look = 1  --->display email icon only
 		// $look = 2  --->display print icon only
 		$text_emailprint = "";
 
 		//new method emailprint_class : (only news is core, rest is plugin: searched for e_emailprint.php which should hold $email and $print values)
-		if($mode == "news"){
+		if($mode == "news")
+		{
 			$email = "news";
 			$print = "news";
-		}else{
+		}
+		else
+		{
 			//load the others from plugins
 			$handle = opendir(e_PLUGIN);
-			while (false !== ($file = readdir($handle))) {
-				if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)) {
+			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_emailprint.php") {
+					while (false !== ($file2 = readdir($plugin_handle))) 
+					{
+						if ($file2 == "e_emailprint.php") 
+						{
 							require_once(e_PLUGIN.$file."/".$file2);
 						}
 					}
@@ -50,13 +59,15 @@
 			}
 		}
 
-		if ($look == 0 || $look == 1) {
-			$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 == 1) 
+		{
+			$ico_mail = (file_exists(THEME."images/".ICONMAIL) ? THEME_ABS."images/".ICONMAIL : e_IMAGE_ABS."generic/".IMODE."/email.png");
+			$text_emailprint .= "<a href='".e_HTTP."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."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>";
+		if ($look == 0 || $look == 2) 
+		{
+			$ico_print = (file_exists(THEME."images/".ICONPRINT) ? THEME_ABS."images/".ICONPRINT : e_IMAGE_ABS."generic/".IMODE."/printer.png");
+			$text_emailprint .= "<a href='".e_HTTP."print.php?".$print.".".$id."'><img src='".$ico_print."' style='border:0' alt='".LAN_PRINT_1."' title='".LAN_PRINT_1."' /></a>";
 		}
 		return $text_emailprint;
 	}
diff -x .svn -aruN 0.7.12.src/e107_handlers/e_parse_class.php 0.7.13.src/e107_handlers/e_parse_class.php
--- 0.7.12.src/e107_handlers/e_parse_class.php	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_handlers/e_parse_class.php	2008-09-04 14:49:55.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e_parse_class.php,v $
-|     $Revision: 1.211 $
-|     $Date: 2008/07/17 19:17:54 $
+|     $Revision: 1.212 $
+|     $Date: 2008/09/04 19:50:18 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -242,12 +242,13 @@
 
 
 
-	function htmlwrap($str, $width, $break = "\n", $nobreak = "", $nobr = "pre", $utf = false)
+	function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = false)
 	{
 		/*
 		Pretty well complete rewrite to try and handle utf-8 properly.
-		Breaks a utf-8 string every $width characters max. If possible, breaks after 'safe' characters.
+		Breaks each utf-8 'word' every $width characters max. If possible, breaks after 'safe' characters.
 		$break is the character inserted to flag the break.
+		$nobreak is a list of tags within which word wrap is to be inactive
 		*/
 
   if (!ctype_digit($width)) return $str;		// Don't wrap if non-numeric width
@@ -266,7 +267,26 @@
   $lbrks = "/?!%)-}]\\\"':;&";
 
   // Is $str a UTF8 string?
-	$utf8 = ($utf || strtolower(CHARSET) == 'utf-8') ? "u" : "";
+	if ($utf || strtolower(CHARSET) == 'utf-8')
+	{	// 0x1680, 0x180e, 0x2000-0x200a, 0x2028, 0x205f, 0x3000 are 'non-ASCII' Unicode UCS-4 codepoints - see http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
+		// All convert to 3-byte utf-8 sequences:
+		// 0x1680	0xe1	0x9a	0x80
+		// 0x180e	0xe1	0xa0	0x8e
+		// 0x2000	0xe2	0x80	0x80
+		//   -
+		// 0x200a	0xe2	0x80	0x8a
+		// 0x2028	0xe2	0x80	0xa8
+		// 0x205f	0xe2	0x81	0x9f
+		// 0x3000	0xe3	0x80	0x80
+		$utf8 = 'u';
+		$whiteSpace = '#([\x20|\x0c]|[\xe1][\x9a][\x80]|[\xe1][\xa0][\x8e]|[\xe2][\x80][\x80-\x8a,\xa8]|[\xe2][\x81][\x9f]|[\xe3][\x80][\x80]+)#';	
+		// Have to explicitly enumerate the whitespace chars, and use non-utf-8 mode, otherwise regex fails on badly formed utf-8
+	}
+	else
+	{
+		$utf8 = '';
+		$whiteSpace = '#(\s+)#';		// For non-utf-8, can use a simple match string
+	}
 	
 
 // Start of the serious stuff - split into HTML tags and text between
@@ -319,19 +339,27 @@
             $value = str_replace("\x06", "", $value);
             preg_match_all("/&([a-z\d]{2,7}|#\d{2,5});/i", $value, $ents);
             $value = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x06", $value);
-			$split = preg_split('#(\s)#'.$utf8, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+//			echo "Found block length ".strlen($value).': '.substr($value,20).'<br />';
+			// Split at spaces - note that this will fail if presented with invalid utf-8 when doing the regex whitespace search
+//			$split = preg_split('#(\s)#'.$utf8, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+			$split = preg_split($whiteSpace, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
 			$value = '';
 			foreach ($split as $sp)
 			{
+//			echo "Split length ".strlen($sp).': '.substr($sp,20).'<br />';
+				$loopCount = 0;
 			  while (strlen($sp) > $width)
 			  {	// Enough characters that we may need to do something.
 				$pulled = '';
 				if ($utf8)
 				{
 				  // Pull out a piece of the maximum permissible length
-				  preg_match('#^((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$width.'})(.{0,1}).*#s',$sp,$matches);
-
-				  if (empty($matches[2]))
+				  if (preg_match('#^((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$width.'})(.{0,1}).*#s',$sp,$matches) == 0)
+				  {
+					$value .= '[!<b>invalid utf-8: '.$sp.'<b>!]';		// Make any problems obvious for now
+					$sp = '';
+				  }
+				  elseif (empty($matches[2]))
 				  {  // utf-8 length is less than specified - treat as a special case
 				    $value .= $sp;
 					$sp = '';
@@ -351,6 +379,12 @@
 					  $pulled = substr($sp,0,$i+1);
 					}
 				  }
+				  $loopCount++;
+				  if ($loopCount > 20)
+				  {
+					$value .= '[!<b>loop count exceeded: '.$sp.'</b>!]';		// Make any problems obvious for now
+					$sp = '';
+				  }
 				}
 				else
 				{
diff -x .svn -aruN 0.7.12.src/e107_handlers/ren_help.php 0.7.13.src/e107_handlers/ren_help.php
--- 0.7.12.src/e107_handlers/ren_help.php	2008-09-29 14:54:52.000000000 -0500
+++ 0.7.13.src/e107_handlers/ren_help.php	2008-09-18 14:12:13.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/ren_help.php,v $
-|     $Revision: 1.64 $
-|     $Date: 2007/10/26 11:43:57 $
-|     $Author: e107coders $
+|     $Revision: 1.65 $
+|     $Date: 2008/09/18 19:12:36 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -208,7 +208,7 @@
 			}
 			else
 			{
-				$text .= "<select class='tbox' name='preimageselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
+				$text .= "<select class='tbox' name='preimageselect' onchange=\"addtext(this.value, true); expandit('{$formid}')\">
 				<option value=''>".LANHELP_42."</option>";
 				foreach($imagelist as $image)
 				{
diff -x .svn -aruN 0.7.12.src/e107_languages/English/admin/lan_banner.php 0.7.13.src/e107_languages/English/admin/lan_banner.php
--- 0.7.12.src/e107_languages/English/admin/lan_banner.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_languages/English/admin/lan_banner.php	2008-08-26 14:45:01.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.11 $
-|     $Date: 2006/06/14 22:12:07 $
-|     $Author: lisa_ $
+|     $Revision: 1.12 $
+|     $Date: 2008/08/26 19:45:24 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("BNRLAN_1", "Banner deleted.");
@@ -65,8 +65,8 @@
 define("BANNER_MENU_L8", "selected campaigns");
 define("BANNER_MENU_L9", "remove selection");
 define("BANNER_MENU_L10", "Render type");
-define("BANNER_MENU_L12", "plain");
-define("BANNER_MENU_L13", "in captioned box");
+//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");
 
diff -x .svn -aruN 0.7.12.src/e107_languages/English/admin/lan_users_extended.php 0.7.13.src/e107_languages/English/admin/lan_users_extended.php
--- 0.7.12.src/e107_languages/English/admin/lan_users_extended.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_languages/English/admin/lan_users_extended.php	2008-08-30 15:21:47.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_users_extended.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2008/06/29 10:00:24 $
+|     $Revision: 1.22 $
+|     $Date: 2008/08/30 20:22:10 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -90,6 +90,7 @@
 define("EXTLAN_75", "Error adding field to database.");
 define("EXTLAN_76", "Invalid characters in field name - only A-Z, a-z, 0-9, '_' allowed.");
 define("EXTLAN_77", "Category not deleted - must delete fields in category first: ");
+define('EXTLAN_78', 'Cannot find file --FILE-- needed to create data table');
 
 
 //textbox
diff -x .svn -aruN 0.7.12.src/e107_languages/English/admin/lan_users.php 0.7.13.src/e107_languages/English/admin/lan_users.php
--- 0.7.12.src/e107_languages/English/admin/lan_users.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_languages/English/admin/lan_users.php	2008-08-28 14:57:32.000000000 -0500
@@ -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.33 $
-|     $Date: 2008/07/03 21:23:24 $
+|     $Revision: 1.34 $
+|     $Date: 2008/08/28 19:57:55 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -156,6 +156,7 @@
 define("USRLAN_153", "Delete non-bounce emails");
 define("USRLAN_154", "Clear email for checked");
 define("USRLAN_155", "Total {TOTAL} emails found. {DELCOUNT} deleted through options.<br />{DELUSER} users marked as 'bounced' (out of {FOUND} emails)");
+define("USRLAN_156", "Email address is already in use");
 
 define("LAN_MAINADMIN","Main Admin");
 define("LAN_ADMIN","Admin");
diff -x .svn -aruN 0.7.12.src/e107_languages/English/lan_installer.php 0.7.13.src/e107_languages/English/lan_installer.php
--- 0.7.12.src/e107_languages/English/lan_installer.php	2008-09-29 14:54:47.000000000 -0500
+++ 0.7.13.src/e107_languages/English/lan_installer.php	2008-09-23 14:24:18.000000000 -0500
@@ -60,7 +60,7 @@
 define("LANINS_050", "XML Extension");
 define("LANINS_051", "Installed");
 define("LANINS_052", "Not Installed");
-define("LANINS_053", "e107 .700 requires the PHP XML Extension to be installed. Please contact your host or read the information at ");
+define("LANINS_053", "e107 0.7.x requires the PHP XML Extension to be installed. Please contact your host or read the information at ");
 define("LANINS_054", " before continuing");
 define("LANINS_055", "Install Confirmation");
 define("LANINS_056", "6");
diff -x .svn -aruN 0.7.12.src/e107_plugins/banner_menu/config.php 0.7.13.src/e107_plugins/banner_menu/config.php
--- 0.7.12.src/e107_plugins/banner_menu/config.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/banner_menu/config.php	2008-08-26 14:45:10.000000000 -0500
@@ -11,14 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/banner_menu/config.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/10/24 13:41:21 $
-|     $Author: mrpete $
+|     $Revision: 1.10 $
+|     $Date: 2008/08/26 19:45:33 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
 require_once("../../class2.php");
-if (!getperms("1")) {
+if (!getperms("1")) 		// Access to those who can change prefs, theme etc
+{
 	header("location:".e_BASE."index.php");
 	 exit ;
 }
@@ -26,13 +27,11 @@
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
 	
-@include_once(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."banner_menu/languages/English.php");
+@include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
 	
-$lan_file = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php";
-include(file_exists($lan_file) ? $lan_file : e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
-	
-if (e_QUERY) {
+if (e_QUERY) 
+{
 	$tmp = explode(".", e_QUERY);
 	$action = $tmp[0];
 	$sub_action = $tmp[1];
@@ -40,16 +39,21 @@
 	unset($tmp);
 }
 	
-if (isset($_POST['update_menu'])) {
-	foreach($_POST as $k => $v) {
-		if (strpos($k, "banner_") === 0) {
+if (isset($_POST['update_menu'])) 
+{
+	foreach($_POST as $k => $v) 
+	{
+		if (strpos($k, "banner_") === 0) 
+		{
 			$menu_pref[$k] = $v;
 		}
 	}
 	 
-	if (isset($_POST['catid'])) {
+	if (isset($_POST['catid'])) 
+	{
 		$array_cat = explode("-", $_POST['catid']);
-		for($i = 0; $i < count($array_cat); $i++) {
+		for($i = 0; $i < count($array_cat); $i++) 
+		{
 			$cat .= $array_cat[$i]."|";
 		}
 		$cat = substr($cat, 0, -1);
@@ -60,7 +64,8 @@
 	$ns->tablerender("", "<div style='text-align:center'><b>".BANNER_MENU_L2."</b></div>");
 }
 	
-if (!$menu_pref['banner_caption']) {
+if (!$menu_pref['banner_caption']) 
+{
 	$menu_pref['banner2_caption'] = BANNER_MENU_L1;
 }
 	
diff -x .svn -aruN 0.7.12.src/e107_plugins/calendar_menu/calendar.php 0.7.13.src/e107_plugins/calendar_menu/calendar.php
--- 0.7.12.src/e107_plugins/calendar_menu/calendar.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/calendar_menu/calendar.php	2008-09-17 14:55:51.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2006/11/16 10:24:14 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2008/09/17 19:56:14 $
+|     $Author: e107steved $
 |
 | 11.11.06 - steved - mods for next CVS release
 |
@@ -57,7 +57,7 @@
 $category_filter = "";
 if  ((isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] != "all"))
 {
-  $category_filter = " AND (e.event_category = '".$_POST['event_cat_ids']."') ";
+  $category_filter = " AND (e.event_category = '".intval($_POST['event_cat_ids'])."') ";
 }
 
 
diff -x .svn -aruN 0.7.12.src/e107_plugins/calendar_menu/ecal_class.php 0.7.13.src/e107_plugins/calendar_menu/ecal_class.php
--- 0.7.12.src/e107_plugins/calendar_menu/ecal_class.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/calendar_menu/ecal_class.php	2008-09-28 15:26:41.000000000 -0500
@@ -11,9 +11,9 @@
 |     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 $
+|     $Revision: 1.3 $
+|     $Date: 2008/09/28 20:27:04 $
+|     $Author: e107steved $
 |
 | Event calendar class for gradual enhancement
 | (Some bits may be usefully transferred to common code later)
@@ -62,6 +62,11 @@
     function ecal_class()
 	{  // Constructor
 	  global $pref;
+	  if (!isset($pref['plug_installed']['calendar_menu']))
+	  {
+		header('location:'.e_BASE.'index.php');
+		exit;
+	  }
 	  
 	  $this->time_now = time();
 	  $this->site_timedate = $this->time_now + ($pref['time_offset'] * 3600);			// Check sign of offset
diff -x .svn -aruN 0.7.12.src/e107_plugins/calendar_menu/event.php 0.7.13.src/e107_plugins/calendar_menu/event.php
--- 0.7.12.src/e107_plugins/calendar_menu/event.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/calendar_menu/event.php	2008-09-17 14:55:51.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/event.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2007/10/29 20:49:54 $
+|     $Revision: 1.33 $
+|     $Date: 2008/09/17 19:56:14 $
 |     $Author: e107steved $
 |
 | 09.11.06 - Started next batch of mods
@@ -50,7 +50,7 @@
 $category_filter = "";
 if  ((isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] != "all"))
 {
-  $category_filter = " AND (e.event_category = '".$_POST['event_cat_ids']."') ";
+  $category_filter = " AND (e.event_category = '".intval($_POST['event_cat_ids'])."') ";
 }
 
 /*
diff -x .svn -aruN 0.7.12.src/e107_plugins/calendar_menu/plugin.php 0.7.13.src/e107_plugins/calendar_menu/plugin.php
--- 0.7.12.src/e107_plugins/calendar_menu/plugin.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/calendar_menu/plugin.php	2008-09-02 16:11:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/plugin.php,v $
-|     $Revision: 1.20 $ - with mods to hopefully trigger upgrade to new version
-|     $Date: 2007/04/12 08:45:37 $
-|     $Author: lisa_ $
+|     $Revision: 1.21 $ - with mods to hopefully trigger upgrade to new version
+|     $Date: 2008/09/02 21:12:08 $
+|     $Author: e107steved $
 |
 | 22.07.06 - Mods for V3.6 upgrade, including log directory
 | 02.08.06 - Support for category icon display added
@@ -30,7 +30,7 @@
 // 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 = EC_ADLAN_1;
+$eplug_name = 'EC_ADLAN_1';
 $eplug_version = "3.6";
 $eplug_author = "jalist / cameron / McFly / Barry / Lisa_ / steved";
 $eplug_url = "http://e107.org";
diff -x .svn -aruN 0.7.12.src/e107_plugins/content/search/search_parser.php 0.7.13.src/e107_plugins/content/search/search_parser.php
--- 0.7.12.src/e107_plugins/content/search/search_parser.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/content/search/search_parser.php	2008-09-28 14:02:37.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.4 $
-|     $Date: 2007/01/17 14:05:41 $
-|     $Author: lisa_ $
+|     $Revision: 1.7 $
+|     $Date: 2008/09/28 19:03:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,17 +21,22 @@
 
 // advanced 
 $advanced_where = "";
-if (isset($_GET['cat']) && is_numeric($_GET['cat'])) {
+if (isset($_GET['cat']) && is_numeric($_GET['cat'])) 
+{
 	$advanced_where .= " content_parent='".$_GET['cat']."' AND";
 }
 
-if (isset($_GET['time']) && is_numeric($_GET['time'])) {
+if (isset($_GET['time']) && is_numeric($_GET['time'])) 
+{
 	$advanced_where .= " content_datestamp ".($_GET['on'] == 'new' ? '>=' : '<=')." '".(time() - $_GET['time'])."' AND";
 }
 
-if (isset($_GET['match']) && $_GET['match']) {
+if (isset($_GET['match']) && $_GET['match']) 
+{
 	$search_fields = array('content_heading');
-} else {
+} 
+else 
+{
 	$search_fields = array('content_heading', 'content_subheading', 'content_summary', 'content_text');
 }
 
@@ -39,7 +44,7 @@
 $return_fields = 'content_id, content_heading, content_subheading, content_summary, content_text, content_datestamp, content_parent, content_author';
 $weights = array('1.2', '0.9', '0.6', '0.6');
 $no_results = LAN_198;
-$where = "content_class IN (".USERCLASS_LIST.") AND".$advanced_where;
+$where = "content_class IN (".USERCLASS_LIST.") AND `content_refer`!='sa' AND".$advanced_where;
 $order = array('content_datestamp' => DESC);
 
 $ps = $sch -> parsesearch('pcontent', $return_fields, $search_fields, $weights, 'search_content', $no_results, $where, $order);
@@ -47,7 +52,8 @@
 $results = $ps['results'];
 
 
-function search_content($row) {
+function search_content($row) 
+{
 	global $con, $sql;
 	$res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
 	$res['pre_title'] = "";
@@ -55,18 +61,23 @@
 	$res['summary'] = $row['content_summary'].' '.$row['content_text'];
 	
 	//get category heading
-	if($row['content_parent'] == '0'){
+	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){
+	}
+	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{
+	}
+	else
+	{
 		$qry = "
 		SELECT c.*, p.*
 		FROM #pcontent as c
diff -x .svn -aruN 0.7.12.src/e107_plugins/featurebox/plugin.php 0.7.13.src/e107_plugins/featurebox/plugin.php
--- 0.7.12.src/e107_plugins/featurebox/plugin.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/featurebox/plugin.php	2008-09-02 16:11:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/featurebox/plugin.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/07/13 21:14:05 $
-|     $Author: e107coders $
+|     $Revision: 1.8 $
+|     $Date: 2008/09/02 21:12:08 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,7 +23,7 @@
 @include_once(e_PLUGIN."featurebox/languages/English.php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = FBLAN_01;
+$eplug_name = 'FBLAN_01';
 $eplug_version = "1.0";
 $eplug_author = "Steve Dunstan (jalist)";
 $eplug_url = "http://e107.org";
diff -x .svn -aruN 0.7.12.src/e107_plugins/forum/templates/forum_template.php 0.7.13.src/e107_plugins/forum/templates/forum_template.php
--- 0.7.12.src/e107_plugins/forum/templates/forum_template.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/forum/templates/forum_template.php	2008-08-29 14:58:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_template.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/07/16 21:57:03 $
-|     $Author: e107coders $
+|     $Revision: 1.11 $
+|     $Date: 2008/08/29 19:58:42 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -60,7 +60,7 @@
 		$FORUM_TRACK_MAIN = "<tr>
 			<td style='text-align:center; vertical-align:middle; width:6%'  class='forumheader3'>{NEWIMAGE}</td>
 			<td style='vertical-align:middle; text-align:left; width:70%'  class='forumheader3'><span class='mediumtext'>{TRACKPOSTNAME}</span></td>
-			<td style='vertical-align:middle; text-align:center; width:24%'  class='forumheader3'><span class='mediumtext'>{UNTRACK}</td>
+			<td style='vertical-align:middle; text-align:center; width:24%'  class='forumheader3'><span class='mediumtext'>{UNTRACK}</span></td>
 			</tr>";
 	}
 }
diff -x .svn -aruN 0.7.12.src/e107_plugins/links_page/links.php 0.7.13.src/e107_plugins/links_page/links.php
--- 0.7.12.src/e107_plugins/links_page/links.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/links_page/links.php	2008-09-25 15:01:18.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/links.php,v $
-|     $Revision: 1.47 $
-|     $Date: 2008/02/25 20:11:10 $
+|     $Revision: 1.48 $
+|     $Date: 2008/09/25 20:01:41 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -491,7 +491,8 @@
 				$arr[$rowl['link_category_id']][] = $rowl;
 			}
 		}
-		if($mode){
+		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);
@@ -501,15 +502,21 @@
 			$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)){
+			if(is_numeric($mode))
+			{
 				$lc->ShowNextPrev($from, $number, $link_total);
 			}
-		}else{
-			foreach($arr as $key => $value){
+		}
+		else
+		{
+			$text = '';
+			foreach($arr as $key => $value)
+			{
 				$link_table_string = "";
 				$linkbutton_count = 0;
 				$i=0;
-				for($i=0;$i<count($value);$i++){
+				for($i=0;$i<count($value);$i++)
+				{
 					$rowl				= $value[$i];
 
 					$linkbutton_count   = ($rowl['link_button']) ?  $linkbutton_count + 1 : $linkbutton_count;
diff -x .svn -aruN 0.7.12.src/e107_plugins/list_new/plugin.php 0.7.13.src/e107_plugins/list_new/plugin.php
--- 0.7.12.src/e107_plugins/list_new/plugin.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/list_new/plugin.php	2008-09-02 16:11:45.000000000 -0500
@@ -20,7 +20,7 @@
 include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."list_new/languages/English.php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = LIST_PLUGIN_1;
+$eplug_name = 'LIST_PLUGIN_1';
 $eplug_version = "1.0";
 $eplug_author = "Eric Vanderfeesten (lisa)";
 $eplug_logo = "";
diff -x .svn -aruN 0.7.12.src/e107_plugins/log/admin_config.php 0.7.13.src/e107_plugins/log/admin_config.php
--- 0.7.12.src/e107_plugins/log/admin_config.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/log/admin_config.php	2008-09-07 15:50:41.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/admin_config.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2008/04/25 19:17:04 $
+|     $Revision: 1.19 $
+|     $Date: 2008/09/07 20:51:04 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -82,8 +82,9 @@
 
 
 
-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(!is_writable(LOGPATH."logs")) 
+{
+	$message = "<b>".ADSTAT_L38."</b>";
 }
 
 if (isset($_POST['updatesettings'])) {
diff -x .svn -aruN 0.7.12.src/e107_plugins/log/languages/admin/English.php 0.7.13.src/e107_plugins/log/languages/admin/English.php
--- 0.7.12.src/e107_plugins/log/languages/admin/English.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/log/languages/admin/English.php	2008-09-07 15:50:42.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/languages/admin/English.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2007/05/30 20:48:59 $
+|     $Revision: 1.14 $
+|     $Date: 2008/09/07 20:51:05 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -54,5 +54,7 @@
 define("ADSTAT_L33", "Configure Statistics Logging");
 define("ADSTAT_L34", "Site Stats");
 
+define('ADSTAT_L38', "You must set the e107_plugins/log/logs folder to be writable");	// Constant compatible with 0.8
+
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.12.src/e107_plugins/log/plugin.php 0.7.13.src/e107_plugins/log/plugin.php
--- 0.7.12.src/e107_plugins/log/plugin.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/log/plugin.php	2008-09-02 16:11:45.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/plugin.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2007/05/30 20:48:59 $
+|     $Revision: 1.7 $
+|     $Date: 2008/09/02 21:12:08 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -23,7 +23,7 @@
 @include_once(e_PLUGIN."log/languages/admin/English.php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = ADSTAT_L3;
+$eplug_name = 'ADSTAT_L3';
 $eplug_version = "2.0";
 $eplug_author = "jalist";
 $eplug_url = "http://e107.org";
diff -x .svn -aruN 0.7.12.src/e107_plugins/newsletter/admin_config.php 0.7.13.src/e107_plugins/newsletter/admin_config.php
--- 0.7.12.src/e107_plugins/newsletter/admin_config.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/newsletter/admin_config.php	2008-09-22 15:37:55.000000000 -0500
@@ -11,21 +11,25 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsletter/admin_config.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2007/01/27 17:47:06 $
+|     $Revision: 1.12 $
+|     $Date: 2008/09/22 20:38:18 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
-if (!getperms("P")) {
+if (!getperms("P")) 
+{
 	header("location:".e_BASE."index.php");
-	 exit;
+	exit;
 }
 $e_sub_cat = 'newsletter';
 require_once(e_ADMIN."auth.php");
 
-if (e_QUERY) {
-	list($action, $id) = explode(".", e_QUERY);
+if (e_QUERY) 
+{
+	list($action, $id, $key) = explode(".", e_QUERY);
+	$key = intval($key);
+	$id = intval($id);
 }
 else
 {
@@ -42,13 +46,24 @@
 }
 else
 {
-	$function = $action."Newsletter";
-	$nl -> $function();
+	if ($action == "vs") 
+	{ // View subscribers of a newsletter
+		$nl -> view_subscribers($id);
+	} 
+	elseif ($action == "remove") 
+	{ // Remove subscriber
+		$nl -> remove_subscribers($id,$key);
+	} 
+	else 
+	{
+		$function = $action."Newsletter";
+		$nl -> $function();
+	}
 }
 
+
 class newsletter
 {
-
 	var $message;
 
 
@@ -100,7 +115,7 @@
 			$text = "<form action='".e_SELF."' id='newsletterform' method='post'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
-			<td style='width:5%; text-align: center;' class='forumheader'>ID</td>
+			<td style='width:5%; text-align: center;' class='forumheader'>".NLLAN_55."</td>
 			<td style='width:65%' class='forumheader'>".NLLAN_06."</td>
 			<td style='width:20%; text-align: center;' class='forumheader'>".NLLAN_07."</td>
 			<td style='width:10%; text-align: center;' class='forumheader'>".NLLAN_08."</td>
@@ -113,7 +128,7 @@
 				$text .= "<tr>
 				<td style='width:5%; text-align: center;' class='forumheader3'>".$data['newsletter_id']."</td>
 				<td style='width:65%' class='forumheader3'>".$data['newsletter_title']."</td>
-				<td style='width:20%; text-align: center;' class='forumheader'>".substr_count($data['newsletter_subscribers'], chr(1))."</td>
+				<td style='width:20%; text-align: center;' class='forumheader'>".((substr_count($data['newsletter_subscribers'], chr(1))!= 0)?"<a href='".e_SELF."?vs.".$data['newsletter_id']."'>".substr_count($data['newsletter_subscribers'], chr(1))."</a>":substr_count($data['newsletter_subscribers'], chr(1)))."</td>
 				<td style='width:10%; text-align: center;' class='forumheader3'>
 				<a href='".e_SELF."?edit.".$data['newsletter_id']."'>".ADMIN_EDIT_ICON."</a>
 				<input type='image' title='".LAN_DELETE."' name='delete[newsletter_".$data['newsletter_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(NLLAN_09." [ID: ".$data['newsletter_id']." ]")."') \"/>
@@ -137,7 +152,6 @@
 		}
 		else
 		{
-
 			$text = "<form action='".e_SELF."' id='newsletterform2' method='post'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
@@ -153,7 +167,6 @@
 
 			foreach($nlArray as $data)
 			{
-
 				$text .= "<tr>
 				<td style='width:5%; text-align: center;' class='forumheader3'>".$data['newsletter_id']."</td>
 				<td style='width:10%; text-align: center;' class='forumheader3'>".$data['newsletter_issue']."</td>
@@ -172,16 +185,15 @@
 			</form>
 			</div>
 			";
-
 		}
 		$ns -> tablerender(NLLAN_20, $text);
-
 	}
 
 
+
+
 	function defineNewsletter($edit=FALSE)
 	{
-
 		global $ns, $tp;
 
 		if($edit)
@@ -226,11 +238,10 @@
 		$caption = ($edit ? NLLAN_25 : NLLAN_26);
 
 		$ns -> tablerender($caption, $text);
-
-
 	}
 
 
+
 	function createNewsletter()
 	{
 		global $sql, $tp;
@@ -253,9 +264,9 @@
 	}
 
 
+
 	function makeNewsletter($edit=FALSE)
 	{
-
 		global $sql, $ns, $tp;
 
 		if($edit)
@@ -320,6 +331,7 @@
 	}
 
 
+
 	function createIssue()
 	{
 		global $sql, $tp;
@@ -339,9 +351,9 @@
 	}
 
 
+
 	function releaseIssue($issue)
 	{
-
 		global $pref, $sql, $ns, $tp, $THEMES_DIRECTORY;
 
 		$issue = str_replace("nlmailnow_", "", $issue);
@@ -384,7 +396,7 @@
 		$mail->Subject = $newsletterParentInfo['newsletter_title'] . ": ".$newsletterInfo['newsletter_title'];
 		$mail->IsHTML(true);
 
-		// ============================  Render Results and Mailit =========
+		// ============================  Render Results and Mail it =========
 
 		$message_subject = stripslashes($tp -> toHTML($mail->Subject));
 		$message_body = stripslashes($tp -> toHTML($mail->Subject, TRUE));
@@ -459,6 +471,7 @@
 	}
 
 
+
 	function deleteNewsletter()
 	{
 		global $sql;
@@ -500,6 +513,95 @@
 		show_admin_menu(NLLAN_47, $action, $var);
 	}
 
+
+
+	
+ function view_subscribers($p_id)
+ {
+	global $ns;
+
+	$nl_sql = new db;
+	if(!$nl_sql -> db_Select("newsletter", "*", "newsletter_id=".$p_id))
+	{
+		// Check if newsletter id is available
+		$vs_text .= "<br /><br /><center>".NLLAN_56."<br /><br/>
+                 <input class='button' type=button value='".NLLAN_57."' onClick='history.go(-1)'></center>";
+		$ns -> tablerender(NLLAN_58, $vs_text);
+		return;
+	} 
+	else 
+	{
+	  $vs_text .= "
+		<table style='".ADMIN_WIDTH."' class='fborder'>
+			<tr>
+			<td style='width:5%; text-align: center;' class='forumheader'>".NLLAN_55."</td>
+			<td style='width:35%' class='forumheader'>".NLLAN_59."</td>
+			<td style='width:45%;' class='forumheader'>".NLLAN_60."</td>
+			<td style='width:15%; text-align: center;' class='forumheader'>".NLLAN_61."</td>
+			</tr>";
+
+		$nl_sql -> db_Select("newsletter", "*", "newsletter_id='".$p_id."'");
+		if($nl_row = $nl_sql-> db_Fetch())
+		{
+//			$subscribers_total_count = substr_count($nl_row['newsletter_subscribers'], chr(1));
+			$subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers']));
+			$subscribers_total_count = count($subscribers_list) - 1;		// Get a null entry as well
+		}
+		if ($subscribers_total_count<1) 
+		{
+			header("location:".e_SELF);
+			exit;
+		}
+		// Loop through each user in the array subscribers_list
+		foreach ($subscribers_list as $val)
+		{
+			$val=trim($val);
+			if ($val) 
+			{
+				$nl_sql -> db_Select("user", "*", "user_id=".$val);
+				if($nl_row = $nl_sql-> db_Fetch())
+				{
+					$vs_text .= "<tr>
+						<td text-align: center;' class='forumheader3'>{$val}
+						</td>
+						<td class='forumheader3'><a href='".e_BASE."user.php?id.{$val}'>".$nl_row['user_name']."</a>
+						</td>
+						<td class='forumheader3'>".$nl_row['user_email']."
+						</td>
+						<td text-align: center;' class='forumheader3'><a href='".e_SELF."?remove.{$p_id}.{$key}'>".ADMIN_DELETE_ICON."</a>
+					".(($nl_row['user_ban'] > 0) ? NLLAN_62 : "")."
+					</td>
+					</tr>";
+				}
+			}
+		}
+	}
+
+	$vs_text .= "
+      <tr>
+      <td colspan=4 class='forumheader'>".NLLAN_63.": ".$subscribers_total_count."</td>
+      </tr>
+      <tr><td colspan=4 style='text-align:center;'><br /><input class='button' type=button value='".NLLAN_64."' onClick='history.go(-1)'></td></tr>
+      </table>
+      ";
+	$ns -> tablerender(NLLAN_65.' '.$p_id, $vs_text);
+ }
+ 
+ 
+  function remove_subscribers($p_id, $p_key) 
+  {
+	global $sql;
+   	$sql -> db_Select("newsletter", "*", "newsletter_id=".$p_id);
+  	if($nl_row = $sql-> db_Fetch())
+	{
+		$subscribers_list = explode(chr(1), $nl_row['newsletter_subscribers']);
+		unset($subscribers_list[$p_key]);
+		$new_subscriber_list = implode(chr(1), $subscribers_list);
+		$sql -> db_Update("newsletter", "newsletter_subscribers='{$new_subscriber_list}' WHERE newsletter_id=".$p_id);
+		header("location:".e_SELF."?vs.{$p_id}");
+     	exit;
+  	}
+  }
 }
 
 
@@ -514,5 +616,4 @@
 	$nl->show_options($action);
 }
 
-
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.12.src/e107_plugins/newsletter/languages/English.php 0.7.13.src/e107_plugins/newsletter/languages/English.php
--- 0.7.12.src/e107_plugins/newsletter/languages/English.php	2008-09-29 14:54:54.000000000 -0500
+++ 0.7.13.src/e107_plugins/newsletter/languages/English.php	2008-09-22 15:37:56.000000000 -0500
@@ -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.4 $
-|     $Date: 2006/11/04 18:28:51 $
-|     $Author: e107coders $
+|     $Revision: 1.5 $
+|     $Date: 2008/09/22 20:38:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -80,7 +80,16 @@
 
 define("NLLAN_54", "Sending");
 
+define("NLLAN_55", "ID");
+define("NLLAN_56", "Newsletter ID not available");
+define("NLLAN_57", "Return to previous page");
+define("NLLAN_58", "Error");
+define("NLLAN_59", "Name");
+define("NLLAN_60", "Email");
+define("NLLAN_61", "Actions");
+define("NLLAN_62", "User is banned! (or not fully signed up)");
+define("NLLAN_63", "Total subscribers");
+define("NLLAN_64", "Return to Newsletter frontpage");
+define("NLLAN_65", "Subscribers overview newsletter ID");
 
-
-
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.12.src/e107_plugins/pdf/pdf.sc 0.7.13.src/e107_plugins/pdf/pdf.sc
--- 0.7.12.src/e107_plugins/pdf/pdf.sc	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/pdf/pdf.sc	2008-09-04 15:06:54.000000000 -0500
@@ -1,14 +1,19 @@
+/*
+ * e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
+ * $Id: pdf.sc,v 1.3 2008/09/04 20:07:17 e107steved Exp $
+*/
+
 if (defined("ICONPRINTPDF") && file_exists(THEME."images/".ICONPRINTPDF)) 
 {
-	$icon = THEME."images/".ICONPRINTPDF;
+	$icon = THEME_ABS."images/".ICONPRINTPDF;
 }
 else
 {
-	$icon = e_PLUGIN."pdf/images/pdf_16.png";
+	$icon = e_PLUGIN_ABS."pdf/images/pdf_16.png";
 }
 $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>";
 
-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_ABS."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
diff -x .svn -aruN 0.7.12.src/e107_plugins/poll/plugin.php 0.7.13.src/e107_plugins/poll/plugin.php
--- 0.7.12.src/e107_plugins/poll/plugin.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/poll/plugin.php	2008-09-02 16:11:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/plugin.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/11/04 18:33:58 $
-|     $Author: e107coders $
+|     $Revision: 1.8 $
+|     $Date: 2008/09/02 21:12:08 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,7 +22,7 @@
 include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$eplug_name = POLL_ADLAN01;
+$eplug_name = 'POLL_ADLAN01';
 $eplug_version = "2.0";
 $eplug_author = "Steve Dunstan (jalist)";
 $eplug_url = "http://e107.org";
diff -x .svn -aruN 0.7.12.src/e107_plugins/rss_menu/rss.php 0.7.13.src/e107_plugins/rss_menu/rss.php
--- 0.7.12.src/e107_plugins/rss_menu/rss.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/e107_plugins/rss_menu/rss.php	2008-09-23 15:03:13.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/rss.php,v $
-|     $Revision: 1.60 $
-|     $Date: 2008/08/06 19:10:46 $
+|     $Revision: 1.61 $
+|     $Date: 2008/09/23 20:03:36 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -223,7 +223,7 @@
 			case comments:
 			case 5:
 				$path='';
-				$this -> rssQuery = "SELECT * FROM #comments ORDER BY comment_datestamp DESC LIMIT 0,".$this -> limit;
+				$this -> rssQuery = "SELECT * FROM `#comments` WHERE `comment_blocked` = 0 ORDER BY `comment_datestamp` DESC LIMIT 0,".$this -> limit;
 				$sql->db_Select_gen($this -> rssQuery);
 				$tmp = $sql->db_getList();
 				$this -> rssItems = array();
diff -x .svn -aruN 0.7.12.src/e107_themes/templates/header_default.php 0.7.13.src/e107_themes/templates/header_default.php
--- 0.7.12.src/e107_themes/templates/header_default.php	2008-09-29 14:54:48.000000000 -0500
+++ 0.7.13.src/e107_themes/templates/header_default.php	2008-08-26 16:23:52.000000000 -0500
@@ -6,8 +6,8 @@
 |     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.110 $
-|     $Date: 2007/11/23 20:48:09 $
+|     $Revision: 1.111 $
+|     $Date: 2008/08/26 21:24:15 $
 |     $Author: e107steved $
 +-----------------------------------------------------------------------------------------------+
 */
@@ -94,23 +94,32 @@
 echo "<!-- *JS* -->\n";
 
 // Wysiwyg JS support on or off.
-if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") {
+if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") 
+{
 	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
 	define("e_WYSIWYG",TRUE);
 	echo wysiwyg($e_wysiwyg);
-}else{
+}
+else
+{
 	define("e_WYSIWYG",FALSE);
 }
 
-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"; }
+
+echo "<script type='text/javascript' src='".e_FILE_ABS."e107.js'></script>\n";
+if (isset($theme_js_php) && $theme_js_php) 
+{
+	echo "<script type='text/javascript' src='".THEME_ABS."theme-js.php'></script>\n";
+} 
+else 
+{
+	if (is_readable(THEME.'theme.js')) { echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n"; }
 	if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js')) { echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n"; }
 }
 
-if (isset($eplug_js) && $eplug_js) {
+
+if (isset($eplug_js) && $eplug_js) 
+{
 	echo "\n<!-- eplug_js -->\n";
 	if(is_array($eplug_js))
 	{
diff -x .svn -aruN 0.7.12.src/fpw.php 0.7.13.src/fpw.php
--- 0.7.12.src/fpw.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/fpw.php	2008-08-29 16:15:58.000000000 -0500
@@ -11,37 +11,47 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/fpw.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2007/12/13 00:44:06 $
-|     $Author: e107coders $
+|     $Revision: 1.24 $
+|     $Date: 2008/08/29 21:16:21 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
 
-if(USER){
+if(USER)
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
 
-if($pref['fpwcode'] && extension_loaded("gd")){
+if($pref['fpwcode'] && extension_loaded("gd"))
+{
 	define("USE_IMAGECODE",TRUE);
-}else{
+}
+else
+{
 	define("USE_IMAGECODE",FALSE);
 }
 
 
-if (USE_IMAGECODE) {
+if (USE_IMAGECODE) 
+{
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
 }
 
 
 
-if ($pref['membersonly_enabled']) {
-	if (!$FPW_TABLE_HEADER) {
-		if (file_exists(THEME."fpw_template.php")) {
+if ($pref['membersonly_enabled']) 
+{
+	if (!$FPW_TABLE_HEADER) 
+	{
+		if (file_exists(THEME."fpw_template.php")) 
+		{
 			require_once(THEME."fpw_template.php");
-		} else {
+		} 
+		else 
+		{
 			require_once(e_BASE.$THEMES_DIRECTORY."templates/fpw_template.php");
 		}
 	}
@@ -51,76 +61,95 @@
 
 require_once(HEADERF);
 
-function fpw_error($txt) {
+
+function fpw_error($txt) 
+{
 	global $ns;
 	$ns->tablerender(LAN_03, "<div style='text-align:center'>".$txt."</div>");
 	require_once(FOOTERF);
 	exit;
 }
 
-//the seperator character used
+
+//the separator character used
 $fpw_sep = "#";
 
-if (e_QUERY) {
+
+
+if (e_QUERY) 
+{	// User has clicked on the emailed link
 	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 '%{$fpw_sep}{$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 '%{$fpw_sep}{$tmpinfo}' ");
+		$sql->db_Delete("tmp", "`tmp_info` LIKE '%{$fpw_sep}{$tmpinfo}' ");
 		$newpw = "";
 		$pwlen = rand(8, 12);
-		for($a = 0; $a <= $pwlen; $a++) {
+		for($a = 0; $a <= $pwlen; $a++) 
+		{
 			$newpw .= chr(rand(97, 122));
 		}
-		$mdnewpw = md5($newpw);
+		$mdnewpw = md5($newpw);			// Generate new random password
 
-		list($username, $md5) = explode($fpw_sep, $tmp_info);
-		$sql->db_Update("user", "user_password='$mdnewpw', user_viewed='' WHERE user_name='".$tp -> toDB($username, true)."' ");
+		list($loginName, $md5) = explode($fpw_sep, $tmp_info);
+		$sql->db_Update("user", "`user_password`='{$mdnewpw}', `user_viewed`='' WHERE `user_loginname`='".$tp -> toDB($loginName, true)."' ");
 		cookie($pref['cookie_name'], "", (time()-2592000));
 		$_SESSION[$pref['cookie_name']] = "";
 
 		$txt = "<div>".LAN_FPW8."<br /><br />
 		<table style='width:70%'>
-		<tr><td>".LAN_218."</td><td style='font-weight:bold'>{$username}</td></tr>
+		<tr><td>".LAN_218."</td><td style='font-weight:bold'>{$loginName}</td></tr>
 		<tr><td>".LAN_FPW9."</td><td style='font-weight:bold'>{$newpw}</td></tr>
 		</table>
 		<br /><br />".LAN_FPW10." <a href='".e_LOGIN."'>".LAN_FPW11."</a> ".LAN_FPW12."</div>";
 		fpw_error($txt);
 
-	} else {
+	} 
+	else 
+	{
 		fpw_error(LAN_FPW7);
 	}
 }
 
-if (isset($_POST['pwsubmit'])) {
+
+// Request to reset password
+//--------------------------
+if (isset($_POST['pwsubmit'])) 
+{	// Request for password reset submitted
 	require_once(e_HANDLER."mail.php");
 	$email = $_POST['email'];
 
-	if ($pref['fpwcode'] && extension_loaded("gd")) {
-		if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) {
+	if ($pref['fpwcode'] && extension_loaded("gd")) 
+	{
+		if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) 
+		{
 			fpw_error(LAN_FPW3);
 		}
 	}
 
 	$clean_email = check_email($tp -> toDB($_POST['email']));
 	$clean_username = $tp -> toDB($_POST['username']);
- 	$query = "user_email='{$clean_email}' ";
+ 	$query = "`user_email`='{$clean_email}' ";
 	// Allow admins to remove 'username' from fpw_template.php if they wish.
-	$query .= (isset($_POST['username'])) ? " AND user_loginname='{$clean_username}'" : "";
+	$query .= (isset($_POST['username'])) ? " AND `user_loginname`='{$clean_username}'" : "";
 
-	if ($sql->db_Select("user", "*", $query)) {
+	if ($sql->db_Select("user", "*", $query)) 
+	{	// Found user in DB
 		$row = $sql->db_Fetch();
 		 extract($row);
 
-		if ($user_admin == 1 && $user_perms == "0") {
+		if ($row['user_admin'] == 1 && $row['user_perms'] == "0") 
+		{	// Main admin expected to be competent enough to never forget password! (And its a security check - so warn them)
 			sendemail($pref['siteadminemail'], LAN_06, LAN_07."".$e107->getip()." ".LAN_08);
 			echo "<script type='text/javascript'>document.location.href='index.php'</script>\n";
 			die();
 		}
 
-		if ($sql->db_Select("tmp", "*", "tmp_ip = 'pwreset' AND tmp_info LIKE '{$user_name}{$fpw_sep}%'")) {
+		if ($result = $sql->db_Select("tmp", "*", "`tmp_ip` = 'pwreset' AND `tmp_info` LIKE '{$row['user_loginname']}{$fpw_sep}%'")) 
+		{
 			fpw_error(LAN_FPW4);
 			exit;
 		}
@@ -137,37 +166,46 @@
 
 		$deltime = time()+86400 * 2;
 		//Set timestamp two days ahead so it doesn't get auto-deleted
-		$sql->db_Insert("tmp", "'pwreset',{$deltime},'{$user_name}{$fpw_sep}{$rcode}'");
+		$sql->db_Insert("tmp", "'pwreset',{$deltime},'{$row['user_loginname']}{$fpw_sep}{$rcode}'");
 
 
-		if (sendemail($_POST['email'], "".LAN_09."".SITENAME, $message)) {
+		if (sendemail($_POST['email'], "".LAN_09."".SITENAME, $message)) 
+		{
 			$text = "<div style='text-align:center'>".LAN_FPW6."</div>";
-		} else {
+		} 
+		else 
+		{
 			$text = "<div style='text-align:center'>".LAN_02."</div>";
 		}
 
 		$ns->tablerender(LAN_03, $text);
 		require_once(FOOTERF);
 		exit;
-	} else {
+	} 
+	else 
+	{
 		$text = LAN_213;
 		$ns->tablerender(LAN_214, "<div style='text-align:center'>".$text."</div>");
 	}
 }
 
 
-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_SECIMG = $sec_img->r_image();
 	$FPW_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
 }
 
-if (!$FPW_TABLE) {
-	if (file_exists(THEME."fpw_template.php")) {
+if (!$FPW_TABLE) 
+{
+	if (file_exists(THEME."fpw_template.php")) 
+	{
 		require_once(THEME."fpw_template.php");
-	} else {
+	} 
+	else 
+	{
 		require_once(e_BASE.$THEMES_DIRECTORY."templates/fpw_template.php");
 	}
 }
diff -x .svn -aruN 0.7.12.src/signup.php 0.7.13.src/signup.php
--- 0.7.12.src/signup.php	2008-09-29 14:54:55.000000000 -0500
+++ 0.7.13.src/signup.php	2008-09-23 14:55:13.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/signup.php,v $
-|     $Revision: 1.117 $
-|     $Date: 2008/07/16 22:12:24 $
-|     $Author: e107coders $
+|     $Revision: 1.118 $
+|     $Date: 2008/09/23 19:55:36 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -658,6 +658,7 @@
 	if($error_message)
 	{
 	  message_handler("P_ALERT", $error_message);
+	  $error_message = '';
 	}
 
 	// ========== End of verification.. ====================================================
@@ -757,7 +758,7 @@
 			}
 			if(isset($error_message))
 			{
-				$text .= "<br /><b>".$error_message."</b><br />";
+				$text = "<br /><b>".$error_message."</b><br />";	// Just display the error message
 			}
 			$ns->tablerender(LAN_406, $text);
 			require_once(FOOTERF);
