Browse code

update

Jimako authored on 2023/09/07 15:28:52
Showing 70 changed files
... ...
@@ -19,6 +19,13 @@ e107_fanfiction_xxx
19 19
 All e107 tables will look:
20 20
 e107_xxx
21 21
 
22
+
23
+## Update for fixed 3.3.6
24
+Changes:
25
+file user.php -  now author.php  (more logical than member)
26
+file index.php - no changes
27
+
28
+
22 29
 ## Files
23 30
 
24 31
 Only problem if you use e107 and efiction on the same level (what is the final goal):
... ...
@@ -78,7 +78,7 @@ function datadump ($table) {
78 78
 			datadump(current($table));
79 79
 	}
80 80
 
81
- 	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_BACKUP, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
81
+ 	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_BACKUP, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM', " . time() . ")");
82 82
 	exit( );
83 83
 
84 84
 ?>
85 85
\ No newline at end of file
... ...
@@ -79,7 +79,7 @@ function datadump ($table) {
79 79
 			datadump(current($table));
80 80
 	}
81 81
 
82
- 	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_BACKUP, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
82
+ 	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_BACKUP, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM', " . time() . ")");
83 83
 	exit( );
84 84
 
85 85
 ?>
86 86
\ No newline at end of file
... ...
@@ -31,7 +31,7 @@ if(!defined("_CHARSET")) exit( );
31 31
 		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 0 WHERE sid = ".$_GET['remove']);
32 32
 	if(isset($_GET['feature']))
33 33
 		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
-	$fresult = dbquery("SELECT stories.*, stories.title as title, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.updated) as updated, UNIX_TIMESTAMP(stories.date) as date FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = "._UIDFIELD." ORDER BY stories.featured");
34
+	$fresult = dbquery("SELECT stories.*, stories.title as title, "._PENNAMEFIELD." as penname, stories.updated as updated, stories.date as date FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = "._UIDFIELD." ORDER BY stories.featured");
35 35
 	$output .= "<div id='pagetitle'>"._FEATUREDSTORIES."</div>";
36 36
 	if(!dbnumrows($fresult)) $output .= write_message(_NORESULTS);
37 37
 	else {
... ...
@@ -59,7 +59,7 @@ if($maint == "reviews") {
59 59
 	while($code = dbassoc($codequery)) {
60 60
 		$eval($code['code_text']);
61 61
 	}
62
-	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_RECALCREVIEWS, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
62
+	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_RECALCREVIEWS, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM', " . time() . ")");
63 63
 	$output .= write_message(_ACTIONSUCCESSFUL);
64 64
 }
65 65
 else if($maint == "stories") {
... ...
@@ -97,7 +97,7 @@ else if($maint == "categories") {
97 97
 		list($count) = dbrow($countquery);
98 98
 		dbquery("UPDATE ".TABLEPREFIX."fanfiction_categories SET numitems = $count WHERE catid = $cat[0]");
99 99
 	}
100
-	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_CATCOUNTS, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
100
+	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_CATCOUNTS, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM', " . time() . ")");
101 101
 	$output .= write_message(_CATCOUNTSUPDATED);
102 102
 }
103 103
 else if($maint == "categories2") {
... ...
@@ -192,7 +192,7 @@ else if($maint == "optimize") {
192 192
 			dbquery("OPTIMIZE TABLE `".$tablename."`");
193 193
 		}
194 194
 	}
195
- 	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_OPTIMIZE, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM')");
195
+ 	if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_OPTIMIZE, USERPENNAME, USERUID))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'AM', " . time() . ")");
196 196
 	$output .= write_message(_ACTIONSUCCESSFUL);
197 197
 }
198 198
 else if($maint == "backup") {
... ...
@@ -168,7 +168,7 @@ $confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
168 168
 			if(preg_match("!^[a-z0-9_ ]{3,30}$!i", $_POST['penname'])) {
169 169
 				dbquery("INSERT INTO ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))."(penname, realname, email, admincreated, date) VALUES ('".escapestring(descript($_POST['penname']))."', '".escapestring(descript($_POST['realname']))."', '".escapestring(descript($_POST['email']))."', '1', now())");
170 170
 				$newuid = dbinsertid( );
171
-				if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_REG, descript($_POST['penname']), $newuid, USERPENNAME, USERUID, $_SERVER['REMOTE_ADDR']))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG')");
171
+				if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_REG, descript($_POST['penname']), $newuid, USERPENNAME, USERUID, $_SERVER['REMOTE_ADDR']))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG', " . time() . ")");
172 172
 				if(!$skin) {
173 173
 					$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey ='".SITEKEY."'");
174 174
 					list($skin) = dbrow($skinquery);
... ...
@@ -233,13 +233,13 @@ $confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
233 233
 		}
234 234
 		else if($list == "authors") {
235 235
 			$where = " WHERE ap.stories > 0";
236
-			$authorlink = "<a href=\"member.php?action=editbio&amp;uid=";
236
+			$authorlink = "<a href=\"author.php?action=editbio&amp;uid=";
237 237
 			$output .= _AUTHORS;
238 238
 		}
239 239
 		else {
240 240
 			$where = "";
241 241
 			$do = "members";
242
-			$authorlink = "<a href=\"member.php?action=editbio&amp;uid=";
242
+			$authorlink = "<a href=\"author.php?action=editbio&amp;uid=";
243 243
 			$output .= _MEMBERS;
244 244
 		}
245 245
 		if($let == _OTHER) {
... ...
@@ -23,76 +23,86 @@
23 23
 // To read the license please visit http://www.gnu.org/copyleft/gpl.html
24 24
 // ----------------------------------------------------------------------
25 25
 
26
-if(!defined("_CHARSET")) exit( );
27
-if(uLEVEL > 3) accessDenied();
28
-		$output .= "<div id=\"pagetitle\">"._NEWS."</div>";
29
-		if(isset($_POST['submit'])) {
30
-			$title = addslashes(strip_tags(descript($_POST['title']), $allowed_tags));
31
-			$author = addslashes(strip_tags(descript($_POST['author']), $allowed_tags));
32
-			$story = addslashes(strip_tags(descript($_POST['story']), $allowed_tags));
33
-			if($_GET['form'] == "new") $result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_news (title, author, story, time) VALUES ('$title', '$author', '$story', now())");
34
-			else $result = dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET title = '$title', author = '$author', story = '$story' WHERE nid = '$_POST[nid]'");
35
-			if($result) {
36
-				$output .= write_message(_ACTIONSUCCESSFUL);
37
-				unset($_GET['form']);
38
-			}
39
-			else $output .= write_error(_ERROR." ".TRYAGAIN);
26
+if (!defined("_CHARSET")) exit();
27
+if (uLEVEL > 3) accessDenied();
28
+$output .= "<div id=\"pagetitle\">" . _NEWS . "</div>";
29
+if (isset($_POST['submit']))
30
+{
31
+	$title = addslashes(strip_tags(descript($_POST['title']), $allowed_tags));
32
+	$author = addslashes(strip_tags(descript($_POST['author']), $allowed_tags));
33
+	$story = addslashes(strip_tags(descript($_POST['story']), $allowed_tags));
34
+	if ($_GET['form'] == "new") $result = dbquery("INSERT INTO " . TABLEPREFIX . "fanfiction_news (title, author, story, time) VALUES ('$title', '$author', '$story', now())");
35
+	else $result = dbquery("UPDATE " . TABLEPREFIX . "fanfiction_news SET title = '$title', author = '$author', story = '$story' WHERE nid = '$_POST[nid]'");
36
+	if ($result)
37
+	{
38
+		$output .= write_message(_ACTIONSUCCESSFUL);
39
+		unset($_GET['form']);
40
+	}
41
+	else $output .= write_error(_ERROR . " " . TRYAGAIN);
42
+}
43
+if (isset($_GET['delete']) && isNumber($_GET['delete']))
44
+{
45
+	if (isset($_GET['confirm']))
46
+	{
47
+		if ($_GET['confirm'] == "yes")
48
+		{
49
+			dbquery("DELETE FROM " . TABLEPREFIX . "fanfiction_news where nid = '" . $_GET['delete'] . "'");
50
+			$output .= write_message(_ACTIONSUCCESSFUL);
40 51
 		}
41
-		if(isset($_GET['delete']) && isNumber($_GET['delete'])) {
42
-			if($_GET['confirm'] == "yes") {
43
-				dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_news where nid = '".$_GET['delete']."'");
44
-				$output .= write_message(_ACTIONSUCCESSFUL);
45
-			}
46
-			else if ($_GET['confirm'] == "no") $output .= write_message(_ACTIONCANCELLED);
47
-			else {
48
-			$output .= write_message(_CONFIRMDELETE."<br /><br />
49
-[ <a href=\"admin.php?action=news&confirm=yes&delete=$_GET[delete]\">"._YES."</a> | <a href=\"admin.php?action=news&confirm=no&delete=$_GET[delete]\">"._NO."</a> ]");
50
-			}
51
-		}
52
-		else if(isset($_GET["form"])) {
53
-			if($_GET["form"] != "new" && isNumber($_GET["form"])) {
54
-				$result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_news WHERE nid = '".$_GET['form']."' LIMIT 1");
55
-				$newsitem = dbassoc($result);
56
-			}
57
-			else $newsitem = array("title" => "", "author" => "", "story" => "");
58
-			$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=news&form=$_GET[form]\">
59
-				<table align=\"center\"><tr><td colspan=\"2\" align=\"center\"><b>".($_GET["form"] == "new" ? _ADDNEWS : _EDITNEWS)."</b></td></tr>
60
-			<tr><td>"._AUTHOR.": </td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"author\" value=\"".stripslashes($newsitem['author'])."\"></td></tr>
61
-			<tr><td>"._TITLE.": </td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"title\" value=\"".stripslashes($newsitem['title'])."\"></td></tr>
62
-			<tr><td>"._TEXT.": </td><td><textarea class=\"textbox\" name=\"story\" id=\"story\" COLS=\"45\" ROWS=\"6\">".stripslashes($newsitem['story'])."</TEXTAREA>";
63
-			if($tinyMCE) 
64
-				$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('story');\" checked><label for='toggle'>"._TINYMCETOGGLE."</label></div>";
52
+		else if ($_GET['confirm'] == "no") $output .= write_message(_ACTIONCANCELLED);
53
+	}
54
+	else
55
+	{
56
+		$output .= write_message(_CONFIRMDELETE . "<br /><br />
57
+	[ <a href=\"admin.php?action=news&confirm=yes&delete=$_GET[delete]\">" . _YES . "</a> | <a href=\"admin.php?action=news&confirm=no&delete=$_GET[delete]\">" . _NO . "</a> ]");
58
+	}
59
+}
60
+else if (isset($_GET["form"]))
61
+{
62
+	if ($_GET["form"] != "new" && isNumber($_GET["form"]))
63
+	{
64
+		$result = dbquery("SELECT * FROM " . TABLEPREFIX . "fanfiction_news WHERE nid = '" . $_GET['form'] . "' LIMIT 1");
65
+		$newsitem = dbassoc($result);
66
+	}
67
+	else $newsitem = array("title" => "", "author" => "", "story" => "");
68
+	$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=news&form=$_GET[form]\">
69
+				<table align=\"center\"><tr><td colspan=\"2\" align=\"center\"><b>" . ($_GET["form"] == "new" ? _ADDNEWS : _EDITNEWS) . "</b></td></tr>
70
+			<tr><td>" . _AUTHOR . ": </td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"author\" value=\"" . stripslashes($newsitem['author']) . "\"></td></tr>
71
+			<tr><td>" . _TITLE . ": </td><td><INPUT  type=\"text\" class=\"textbox=\" name=\"title\" value=\"" . stripslashes($newsitem['title']) . "\"></td></tr>
72
+			<tr><td>" . _TEXT . ": </td><td><textarea class=\"textbox\" name=\"story\" id=\"story\" COLS=\"45\" ROWS=\"6\">" . stripslashes($newsitem['story']) . "</TEXTAREA>";
73
+	if ($tinyMCE)
74
+		$output .= "<div class='tinytoggle'><input type='checkbox' name='toggle' onclick=\"toogleEditorMode('story');\" checked><label for='toggle'>" . _TINYMCETOGGLE . "</label></div>";
65 75
 
66
-			$output .= "</td></tr><tr><td colspan=\"2\" align=\"center\">".($_GET["form"] != "new" ? "<INPUT type=\"hidden\" name=\"nid\" value=\"".$_GET['form']."\">" : "")."<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></td></tr></table></form>";
67
-		}
68
-		else {
69
-			$output .= "<p align=\"center\"><a href=\"admin.php?action=news&form=new\">"._ADDNEWS."</a></p>";
70
-			$count = dbquery("SELECT COUNT(nid) FROM ".TABLEPREFIX."fanfiction_news");
71
-			list($numrows)= dbrow($count);
72
-	
73
-			$result = dbquery("SELECT n.*, UNIX_TIMESTAMP(n.time) as date, count(c.cid) as comments FROM ".TABLEPREFIX."fanfiction_news as n LEFT JOIN ".TABLEPREFIX."fanfiction_comments as c ON  n.nid = c.nid GROUP BY n.nid ORDER BY time DESC LIMIT $offset, $itemsperpage");
74
-			if(file_exists("$skindir/newsbox.tpl")) $news = new TemplatePower( "$skindir/newsbox.tpl" );
75
-			else $news = new TemplatePower( "default_tpls/newsbox.tpl" );
76
-			$news->prepare();
77
-			$count = 0;
78
-			while($stories = dbassoc($result)) {
79
-				$news->newBlock("newsbox");
80
-		
81
-				//assign values
82
-				$news->assign("newstitle"   , $stories['title'] );
83
-				$news->assign("newsstory"   , $stories['story'] );
84
-				$news->assign("newsauthor", $stories['author'] );
85
-				$news->assign("newsdate", date("$dateformat $timeformat", $stories['date']) );
86
-				$news->assign("oddeven", ($count % 2 ? "even" : "odd"));
87
-				if($newscomments == "1")
88
-					$news->assign("newscomments", "<a href=\"ffnews.php?action=newsstory&amp;nid=".$stories['nid']."\">".$stories['comments']." "._COMMENTS."</a>");
89
-				if(isADMIN) 
90
-					$news->assign("adminoptions", "<a href=\"admin.php?action=news&amp;form=".$stories['nid']."\">"._EDIT."</a> | <a href=\"admin.php?action=news&amp;delete=".$stories['nid']."\">"._DELETE."</a>");
91
-				$count++;
92
-			}
93
-			$news->gotoBlock("_ROOT");
94
-			$output .= $news->getOutputContent( );
95
-			if($numrows > $itemsperpage) $output .= build_pagelinks("admin.php?action=news&amp;", $numrows, $offset);
96
-		}
76
+	$output .= "</td></tr><tr><td colspan=\"2\" align=\"center\">" . ($_GET["form"] != "new" ? "<INPUT type=\"hidden\" name=\"nid\" value=\"" . $_GET['form'] . "\">" : "") . "<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\"" . _SUBMIT . "\"></td></tr></table></form>";
77
+}
78
+else
79
+{
80
+	$output .= "<p align=\"center\"><a href=\"admin.php?action=news&form=new\">" . _ADDNEWS . "</a></p>";
81
+	$count = dbquery("SELECT COUNT(nid) FROM " . TABLEPREFIX . "fanfiction_news");
82
+	list($numrows) = dbrow($count);
83
+
84
+	$result = dbquery("SELECT n.*, n.time as date, count(c.cid) as comments FROM " . TABLEPREFIX . "fanfiction_news as n LEFT JOIN " . TABLEPREFIX . "fanfiction_comments as c ON  n.nid = c.nid GROUP BY n.nid ORDER BY time DESC LIMIT $offset, $itemsperpage");
85
+	if (file_exists("$skindir/newsbox.tpl")) $news = new TemplatePower("$skindir/newsbox.tpl");
86
+	else $news = new TemplatePower("default_tpls/newsbox.tpl");
87
+	$news->prepare();
88
+	$count = 0;
89
+	while ($stories = dbassoc($result))
90
+	{
91
+		$news->newBlock("newsbox");
97 92
 
98
-?>
99 93
\ No newline at end of file
94
+		//assign values
95
+		$news->assign("newstitle", $stories['title']);
96
+		$news->assign("newsstory", $stories['story']);
97
+		$news->assign("newsauthor", $stories['author']);
98
+		$news->assign("newsdate", date("$dateformat $timeformat", $stories['date']));
99
+		$news->assign("oddeven", ($count % 2 ? "even" : "odd"));
100
+		if ($newscomments == "1")
101
+			$news->assign("newscomments", "<a href=\"news.php?action=newsstory&amp;nid=" . $stories['nid'] . "\">" . $stories['comments'] . " " . _COMMENTS . "</a>");
102
+		if (isADMIN)
103
+			$news->assign("adminoptions", "<a href=\"admin.php?action=news&amp;form=" . $stories['nid'] . "\">" . _EDIT . "</a> | <a href=\"admin.php?action=news&amp;delete=" . $stories['nid'] . "\">" . _DELETE . "</a>");
104
+		$count++;
105
+	}
106
+	$news->gotoBlock("_ROOT");
107
+	$output .= $news->getOutputContent();
108
+	if ($numrows > $itemsperpage) $output .= build_pagelinks("admin.php?action=news&amp;", $numrows, $offset);
109
+}
... ...
@@ -42,7 +42,7 @@ $chapid = isset($_GET['chapid']) && isNumber($_GET['chapid']) ? $_GET['chapid']
42 42
 		if($logging) {
43 43
 			$storyquery = dbquery("SELECT story.title, chapter.title as chapter, author.email, author.penname, chapter.uid, chapter.inorder FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter, ".TABLEPREFIX."fanfiction_authors as author WHERE chapter.uid = author.uid AND chapter.chapid = '$chapid' AND chapter.sid = story.sid LIMIT 1");
44 44
 			$story = dbassoc($storyquery);
45
-			dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_REJECTION, USERPENNAME, USERUID, $title, $sid, $uid, $penname, $inorder, $letter))."', '".USERUID."', INET_ATON('".$_ENV['REMOTE_ADDR']."'), 'RJ')");
45
+			dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_REJECTION, USERPENNAME, USERUID, $title, $sid, $uid, $penname, $inorder, $letter))."', '".USERUID."', INET_ATON('".$_ENV['REMOTE_ADDR']."'), 'RJ', ". time() . ")");
46 46
 		}
47 47
 
48 48
 	}
... ...
@@ -49,7 +49,7 @@ function updatePanelOrder( ) {
49 49
 	}
50 50
 }
51 51
 
52
-if(isset($action) && $action == "settings") {
52
+if($action == "settings") {
53 53
 $output .= "<h1>"._SETTINGS."</h1><div style='text-align: center;'>
54 54
 	<a href='admin.php?action=settings&amp;sect=main'>"._MAINSETTINGS."</a> |
55 55
 	<a href='admin.php?action=settings&amp;sect=submissions'>"._SUBMISSIONSETTINGS."</a> |
... ...
@@ -105,7 +105,7 @@ if(isset($_POST['submit'])) {
105 105
 		$submissionsoff = $_POST['newsubmissionsoff'] == 1 ? 1 : 0;
106 106
 		$autovalidate = $_POST['newautovalidate'] == 1 ? 1 : 0;
107 107
 		$coauthallowed = $_POST['newcoauthallowed'] == 1 ? 1 : 0;
108
-		$store = !empty($_POST['newstore']) ? $_POST['newstore'] == "files" ? "files" : "mysql" : $store;
108
+		$store = !empty($_POST['newstore']) ? ($_POST['newstore'] == "files" ? "files" : "mysql" ) : $store;
109 109
 		$storiespath = descript($_POST['newstoriespath']);
110 110
 		$minwords = isNumber($_POST['newminwords']) ? $_POST['newminwords'] : 0;
111 111
 		$maxwords = isNumber($_POST['newmaxwords']) ? $_POST['newmaxwords'] : 0;
... ...
@@ -178,11 +178,13 @@ if(isset($_POST['submit'])) {
178 178
 }
179 179
 	$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey ='".SITEKEY."'");
180 180
 	$settings = dbassoc($settingsresults);
181
+ 
181 182
 	foreach($settings as $var => $val) {
182
-		$$var = stripslashes($val);
183
+		if(is_NULL($val)) $val = '';
184
+		$$var = stripslashes($val );
183 185
 	}
184 186
 
185
-	$output .= "<form method='POST' class='tblborder' style='' enctype='multipart/form-data' action='".(isset($action) &&  $action == "settings" ? "admin.php?action=settings" : $_SERVER['PHP_SELF']."?step=".$_GET['step'])."&amp;sect=$sect'>";
187
+	$output .= "<form method='POST' class='tblborder' style='' enctype='multipart/form-data' action='".($action == "settings" ? "admin.php?action=settings" : $_SERVER['PHP_SELF']."?step=".$_GET['step'])."&amp;sect=$sect'>";
186 188
 	if($sect == "main") {
187 189
 		$output .= "<h2>"._SITEINFO."</h2>
188 190
 		<table class='acp'>
... ...
@@ -25,17 +25,17 @@
25 25
 
26 26
 if(!defined("_CHARSET")) exit( );
27 27
 function featured( ) {
28
-	global $tableprefix;
28
+	global $tableprefix, $dbconnect;
29 29
 
30 30
 	if($_GET['retire'])
31
-		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
31
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 2 WHERE sid = ".$_GET['retire']);
32 32
 	if($_GET['feature'])
33
-		mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
-	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(stories.updated, '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(stories.updated, '$datim') as updated FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured";
35
-	$fresult = mysql_query($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
36
-	$output .= "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37
-	if(!mysql_num_rows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
38
-	while($story = mysql_fetch_array($fresult)) {
33
+		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET featured = 1 WHERE sid = ".$_GET['feature']);
34
+	$fquery = "SELECT stories.*, stories.title as title, author.penname, DATE_FORMAT(FROM_UNIXTIME(stories.updated), '%Y.%m.%d') as updatesort, DATE_FORMAT(stories.date, '$datim') as date, DATE_FORMAT(FROM_UNIXTIME(stories.updated), '$datim') as updated FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.featured > 0 AND stories.uid = author.uid ORDER BY stories.featured";
35
+	$fresult = dbquery($fquery) or die(_FATALERROR."Query: ".$fquery."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
36
+	$output = "<center><table class=\"tblborder\" cellpadding=\"5\"><tr><th colspan=\"2\" align=\"center\">"._FEATUREDSTORIES."</th></tr>";
37
+	if(!dbnumrows($fresult)) $output .= "<tr><td colspan=\"2\" align=\"center\">"._NOSTORIES."</td><tr>";
38
+	while($story = dbassoc($fresult)) {
39 39
 		$output .= "<tr><td class=\"tblborder\"><a href=\"viewstory.php?sid=".$story['sid']."\">$story[title]</a> "._BY." <a href=\"viewuser.php?uid=".$story['uid']."\">".$story['penname']."</a></td><td class=\"tblborder\" align=\"center\">".($story['featured'] == 1 ? "<a href=\"admin.php?action=featured&retire=".$story['sid']."\">"._CURRENT."</a>" : "<b>"._RETIRED."</b>")."</td></tr>";
40 40
 	}
41 41
 	$output .= "</table>"._FEATUREDNOTE;
... ...
@@ -45,17 +45,17 @@ function featured( ) {
45 45
 
46 46
 function submitted()
47 47
 {
48
-	global $tableprefix, $admincats, $allowed_tags;
49
-		$output .= "<center><h4>"._SUBMITTED."</h4></center>";
48
+	global $tableprefix, $admincats, $allowed_tags, $dbconnect;
49
+		$output = "<center><h4>"._SUBMITTED."</h4></center>";
50 50
 		$query = "SELECT story.title as storytitle, chapter.uid, chapter.sid, story.catid, chapter.chapid, chapter.inorder, chapter.title, author.penname FROM (".TABLEPREFIX."fanfiction_chapters as chapter, ".TABLEPREFIX."fanfiction_authors as author) LEFT JOIN ".TABLEPREFIX."fanfiction_stories as story ON story.sid = chapter.sid WHERE chapter.validated = '0' AND chapter.uid = author.uid ORDER BY story.title ASC, chapter.inorder ASC";
51
-		$result = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
51
+		$result = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
52 52
 		$output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\"><tr class=\"tblborder\"><th>"._TITLE."</th><th>"._AUTHOR."</th><th>"._CATEGORY."</th><th>"._OPTIONS."</th></tr>";
53 53
 		$array = explode(",", $admincats);
54
-		while ($story = mysql_fetch_assoc($result))
54
+		while ($story = dbassoc($result))
55 55
 		{
56 56
 			unset($catstring);
57
-			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
58
-			while($cats = mysql_fetch_array($result3)) {
57
+			$result3 = dbquery("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
58
+			while($cats = dbassoc($result3)) {
59 59
 				$catstring[] = "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
60 60
 			}
61 61
 			if(!$admincats || sizeof(array_intersect(explode(",", $story['catid']), explode(",", $admincats)))) {
... ...
@@ -76,14 +76,14 @@ function submitted()
76 76
 function validate( ) {
77 77
 	global $tableprefix, $level, $store, $storiespath, $allowed_tags, $admincats, $sitename, $siteemail, $url, $alertson;
78 78
 
79
-	$output .= "<center><h4>"._VIEWSUBMITTED."</h4></center>";
79
+	$output  = "<center><h4>"._VIEWSUBMITTED."</h4></center>";
80 80
 	if($_GET['validate'] == "yes") {
81
-		$storyquery = mysql_query("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters  as chapter, ".TABLEPREFIX."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1");
82
-		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = mysql_fetch_array($storyquery);
81
+		$storyquery = dbquery("SELECT story.validated, story.catid, story.sid, story.title, story.summary, story.uid, author.penname, chapter.inorder FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters  as chapter, ".TABLEPREFIX."fanfiction_authors as author WHERE author.uid = story.uid AND chapter.sid = story.sid AND chapter.chapid ='".$_GET['chapid']."' LIMIT 1");
82
+		list($validated, $catid, $sid, $title, $summary, $authoruid, $author, $inorder) = dbassoc($storyquery);
83 83
 		if($admincats == "0" || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats)))) {
84 84
 			include("includes/emailer.php");
85 85
 			if($validated != "1") {
86
-				mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '".$_GET['sid']."'");
86
+				dbquery("UPDATE ".TABLEPREFIX. "fanfiction_stories SET validated = '1', updated = '".time()."' WHERE sid = '".$_GET['sid']."'");
87 87
 				$categories = explode(",", $catid);
88 88
 				include("functions.php");
89 89
 				foreach($categories as $cat) {
... ...
@@ -92,8 +92,8 @@ function validate( ) {
92 92
 				if($alertson) {
93 93
 					$subject = _NEWSTORYAT;
94 94
 					$mailtext = sprintf(_AUTHORALERTNOTE, $title, $author, $summary, $sid);
95
-					$favorites = mysql_query("SELECT author.uid, email, penname FROM ".TABLEPREFIX."fanfiction_favauth as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid");
96
-					while($favuser = mysql_fetch_array($favorites)) { 
95
+					$favorites = dbquery("SELECT author.uid, email, penname FROM ".TABLEPREFIX."fanfiction_favauth as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE fav.favuid = $authoruid AND fav.uid = author.uid");
96
+					while($favuser = dbassoc($favorites)) { 
97 97
 						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
98 98
 					}				
99 99
 				}
... ...
@@ -101,28 +101,28 @@ function validate( ) {
101 101
 			else if($alertson) {
102 102
 				$subject = _STORYALERT;
103 103
 				$mailtext = sprintf(_STORYALERTNOTE, $title, $author, $sid, $inorder);
104
-				$favorites = mysql_query("SELECT author.uid, penname, email FROM ".TABLEPREFIX."fanfiction_favstor as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid");
105
-				while($favuser = mysql_fetch_array($favorites)) { 
104
+				$favorites = dbquery("SELECT author.uid, penname, email FROM ".TABLEPREFIX."fanfiction_favstor as fav, ".TABLEPREFIX."fanfiction_authors as author WHERE sid = '$sid' AND fav.uid = author.uid");
105
+				while($favuser = dbassoc($favorites)) { 
106 106
 					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
107 107
 				}
108 108
 			}
109
-			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
-			mysql_query("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
109
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '".$_GET['chapid']."'");
110
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = '" . time() . "' WHERE sid = '$sid'");
111 111
 			$output .= "<center><b>"._STORYVALIDATED."</b></center>";
112 112
 		}
113 113
 		else
114 114
 			$output .= "<br /><br /><center>"._NOTAUTHORIZEDADMIN."  "._TRYAGAIN."</center><br /><br />";
115 115
 	}
116 116
 	else {
117
-			$result = mysql_query("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid");
118
-			$story = mysql_fetch_array($result);
117
+			$result = dbquery("SELECT story.title as storytitle, story.sid, story.catid, story.rid, story.gid, story.charid, story.wid, story.summary as storysummary, chapter.chapid, chapter.title, chapter.storytext, author.penname, chapter.uid as uid FROM ".TABLEPREFIX."fanfiction_authors as author, ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid AND chapter.uid = author.uid");
118
+			$story = dbassoc($result);
119 119
 			$output .= "<b>"._AUTHOR.":</b> ".$story['penname']."<br />";
120 120
 			$output .= "<b>"._TITLE.":</b> ".$story['storytitle'].": ".$story['title'];
121 121
 			$output .= "<br />";
122
-			$result3 = mysql_query("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
122
+			$result3 = dbquery("SELECT catid, category FROM ".TABLEPREFIX."fanfiction_categories WHERE FIND_IN_SET(catid, '".$story['catid']."')");
123 123
 			$catstring = "";
124 124
 			$count = 0;
125
-			while($cats = mysql_fetch_array($result3)) {
125
+			while($cats = dbassoc($result3)) {
126 126
 				if($count > 0) $catstring .= ", ";
127 127
 				$catstring .= "<a href=\"categories.php?catid=".$cats['catid']."\">".$cats['category']."</a>";
128 128
 				$categories[] = $cats['catid'];
... ...
@@ -183,10 +183,10 @@ function yesletter( ) {
183 183
 		else echo "<div style='text-align: center;'>"._ERROR."</div>";
184 184
 	}
185 185
 	else {
186
-			$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
187
-			$author = mysql_fetch_array($authorquery);
188
-			$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
189
-			$story = mysql_fetch_array($storyquery);
186
+			$authorquery = dbquery("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
187
+			$author = dbassoc($authorquery);
188
+			$storyquery = dbquery("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
189
+			$story = dbassoc($storyquery);
190 190
 			$letter = file_get_contents("messages/thankyou.txt");
191 191
 			echo "<body>";
192 192
 			echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
... ...
@@ -220,10 +220,10 @@ function noletter( ) {
220 220
 	}
221 221
 	else
222 222
 	{
223
-		$authorquery = mysql_query("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
224
-		$author = mysql_fetch_array($authorquery);
225
-		$storyquery = mysql_query("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
226
-		$story = mysql_fetch_array($storyquery);
223
+		$authorquery = dbquery("SELECT email,penname FROM ".TABLEPREFIX."fanfiction_authors WHERE uid = '".$_GET['uid']."' LIMIT 1");
224
+		$author = dbassoc($authorquery);
225
+		$storyquery = dbquery("SELECT story.title, chapter.title as chapter FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '".$_GET['chapid']."' AND chapter.sid = story.sid LIMIT 1");
226
+		$story = dbassoc($storyquery);
227 227
 		$letter = file_get_contents("messages/nothankyou.txt");
228 228
 		echo "<body>";
229 229
 		echo "<table><tr><td>Story:</td><td>".$story['title'].": ".$story['chapter']."</td></tr>";
... ...
@@ -80,7 +80,7 @@ function preview_story($stories) {
80 80
 		if(uLEVEL == 1 || (empty($admincats) || sizeof(array_intersect(explode(",", $catid), explode(",", $admincats))))) {
81 81
 			include("includes/emailer.php");
82 82
 			if(!$storyvalid) {
83
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '1', updated = NOW() WHERE sid = '$_GET[sid]'");
83
+				dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '1', updated = '" . time() . "' WHERE sid = '$_GET[sid]'");
84 84
 				foreach(explode(",", $catid) as $cat) {
85 85
 					categoryitems($cat, 1);
86 86
 				}
... ...
@@ -108,7 +108,7 @@ function preview_story($stories) {
108 108
 						sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
109 109
 					}				
110 110
 				}
111
-				if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_VALIDATE_STORY, USERPENNAME, USERUID, $title, $sid, $author, $authoruid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'VS')");
111
+				if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_VALIDATE_STORY, USERPENNAME, USERUID, $title, $sid, $author, $authoruid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'VS', " . time() . ")");
112 112
 				dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = stories + 1");
113 113
 			}
114 114
 			else if($alertson) {
... ...
@@ -122,10 +122,10 @@ function preview_story($stories) {
122 122
 				while($favuser = dbassoc($favorites)) { 
123 123
 					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
124 124
 				}
125
-				if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_VALIDATE_CHAPTER, USERPENNAME, USERUID, $title, $sid, $author, $authoruid, $inorder))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'VS')");
125
+				if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_VALIDATE_CHAPTER, USERPENNAME, USERUID, $title, $sid, $author, $authoruid, $inorder))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'VS', " . time() . ")");
126 126
 			}
127 127
 			dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = '1' WHERE chapid = '$_GET[chapid]'");
128
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
128
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = '" . time() . "' WHERE sid = '$sid'");
129 129
 			$count =  dbquery("SELECT SUM(wordcount) as totalcount FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '$sid' and validated = 1");
130 130
 			list($totalcount) = dbrow($count);
131 131
 			if($totalcount) {
... ...
@@ -142,7 +142,7 @@ function preview_story($stories) {
142 142
 	}
143 143
 	else {
144 144
 		if(isNumber($_GET['chapid'])) {
145
-			$result = dbquery("SELECT stories.*, stories.title as title, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.updated) as updated, UNIX_TIMESTAMP(stories.date) as date, chapter.uid as uid, chapter.inorder, chapter.title as chaptertitle, chapter.storytext, chapter.chapid, chapter.notes, chapter.endnotes FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '$_GET[chapid]' AND chapter.sid = stories.sid AND chapter.uid = "._UIDFIELD);
145
+			$result = dbquery("SELECT stories.*, stories.title as title, "._PENNAMEFIELD." as penname, stories.updated as updated, stories.date as date, chapter.uid as uid, chapter.inorder, chapter.title as chaptertitle, chapter.storytext, chapter.chapid, chapter.notes, chapter.endnotes FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '$_GET[chapid]' AND chapter.sid = stories.sid AND chapter.uid = "._UIDFIELD);
146 146
 			$stories = dbassoc($result);
147 147
 			$output .= preview_story($stories);
148 148
 
... ...
@@ -26,62 +26,17 @@
26 26
 if(!defined("_CHARSET")) exit( );
27 27
 
28 28
 
29
+	$currentversion = "3.5.6";
29 30
 
30 31
 	$output .= "<div id=\"pagetitle\">"._VERSIONCHECK."</div>";
31 32
 
32
-	// make sure curl is installed
33
-	if (function_exists('curl_init')) {
34
-		$output .= write_message(_RUNNINGVERSION);
35
-	   // initialize a new curl resource
36
-	   $ch = curl_init();
33
+ 
34
+	 $output .= write_message(_CURRENTVERSION. "$currentversion");
37 35
 
38
-	   // set the url to fetch
39
-	   curl_setopt($ch, CURLOPT_URL, 'https://www.efiction.org/version.txt');
40
-
41
-	   // don't give me the headers just the content
42
-	   curl_setopt($ch, CURLOPT_HEADER, 0);
43
-
44
-	   // return the value instead of printing the response to browser
45
-	   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
46
-
47
-	   // use a user agent to mimic a browser
48
-	   curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
49
-
50
-	   $content = curl_exec($ch);
51
-	   $currentversion = $content;
52
-				$output .= write_message(_CURRENTVERSION. "$currentversion");
53
-
54
-				if ($currentversion != $version) {
55
-				$output .= write_message (_UPDATEVERSION);
56
-				}
57
-				else $output .= write_message (_UPTODATE);
58
-
59
-	   // remember to always close the session and free all resources
60
-	   curl_close($ch);
61
-	}
62
-
63
-	else if(ini_get("allow_url_fopen")) {
64
-		$output .= write_message(_RUNNINGVERSION);
65
-
66
-		$location = fopen ("https://efiction.org/version.txt", "r");
67
-		$buffer = '';
68
-		while (!feof ($location)) {
69
-			$buffer .= fgets($location, 4096);
70
-		}
71
-		fclose ($location);
72
-
73
-		if ($buffer != '') {
74
-			$currentversion = $buffer;
75
-			$output .= write_message(_CURRENTVERSION. "$currentversion");
76
-
77
-			if ($currentversion != $version) {
78
-			$output .= write_message (_UPDATEVERSION);
79
-			}
80
-			else $output .= write_message (_UPTODATE);
81
-		}
82
-	}
83
-	else {	
84
-		$output .= write_message(_VERSIONNOTALLOWED);
36
+	if ($currentversion != $version) {
37
+	$output .= write_message (_UPDATEVERSION);
85 38
 	}
39
+	else $output .= write_message (_UPTODATE);
40
+ 
86 41
 
87 42
 ?>
88 43
\ No newline at end of file
... ...
@@ -46,7 +46,7 @@ $output .= "</select></form></div>";
46 46
 $countquery = dbquery("SELECT COUNT(log_id) FROM ".TABLEPREFIX."fanfiction_log".($type ? " WHERE log_type = '$type'" : ""));
47 47
 list($count) = dbrow($countquery);
48 48
 if($count > 0) {
49
-	$result = dbquery("SELECT log_action, INET_NTOA(log_ip) as log_ip, UNIX_TIMESTAMP(log_timestamp) as log_timestamp FROM ".TABLEPREFIX."fanfiction_log".($type ? " WHERE log_type = '$type'" : "")." ORDER BY log_timestamp DESC LIMIT $offset, $itemsperpage");
49
+	$result = dbquery("SELECT log_action, INET_NTOA(log_ip) as log_ip,  log_timestamp as log_timestamp FROM ".TABLEPREFIX."fanfiction_log".($type ? " WHERE log_type = '$type'" : "")." ORDER BY log_timestamp DESC LIMIT $offset, $itemsperpage");
50 50
 	$output .= "<table class=\"tblborder\" cellspacing=\"0\" cellpadding=\"3\" style=\"width: 90%; margin: 0 auto;\"><tr class=\"tblborder\"><th>"._ACTION."</th><th>"._IP."</th><th>"._DATE."</th></tr>";
51 51
 	while ($item = dbassoc($result)) {
52 52
 			$output .= "<tr class=\"tblborder\">
... ...
@@ -26,9 +26,9 @@
26 26
 if(!defined("_CHARSET")) exit( );
27 27
 
28 28
 function warnings( ) {
29
-	global $allowed_tags;
29
+	global $allowed_tags, $dbconnect;
30 30
 
31
-	$output .= "<center><h4>"._WARNINGS."</h4></center>";
31
+	$output = "<center><h4>"._WARNINGS."</h4></center>";
32 32
 	if($_GET["delete"]) {
33 33
 		$wid = $_GET["delete"];
34 34
 		if($_GET["confirm"] == "yes")
... ...
@@ -68,14 +68,14 @@ function warnings( ) {
68 68
 		}
69 69
 	}
70 70
 	if ($_POST['submit']) {
71
-		if($_GET['warning'] == "new") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(stripinput(strip_tags($_POST['warning'])))."')") or die(_FATALERROR."Query: INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(strip_tags($_POST['warning']))."')<br />Error: (".mysql_errno( ).") ".mysql_error( ));
72
-		else dbquery("UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(stripinput(strip_tags($_POST['warning'])))."' WHERE wid = '".$_GET['warning']."'") or die(_FATALERROR."Query: UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(strip_tags($_POST['warnings']))."' WHERE wid = '".$_GET['warning']."'<br />Error: (".mysql_errno( ).") ".mysql_error( ));
71
+		if($_GET['warning'] == "new") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(stripinput(strip_tags($_POST['warning'])))."')") or die(_FATALERROR."Query: INSERT INTO ".TABLEPREFIX."fanfiction_warnings (warning) VALUES ('".addslashes(strip_tags($_POST['warning']))."')<br />Error: (". $dbconnect->errno.") ".$dbconnect->error);
72
+		else dbquery("UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(stripinput(strip_tags($_POST['warning'])))."' WHERE wid = '".$_GET['warning']."'") or die(_FATALERROR."Query: UPDATE ".TABLEPREFIX."fanfiction_warnings set warning = '".addslashes(strip_tags($_POST['warnings']))."' WHERE wid = '".$_GET['warning']."'<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
73 73
 			$output .= "<center>"._ACTIONSUCCESSFUL."</center>";
74 74
 	}
75 75
 	else {
76 76
 		if(isset($_GET['warning'])) {
77 77
 			if($_GET['warning'] != "new") {
78
-				$warnquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1") or die(_FATALERROR."Query: SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1<br />Error: (".mysql_errno( ).") ".mysql_error( ));
78
+				$warnquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1") or die(_FATALERROR."Query: SELECT * FROM ".TABLEPREFIX."fanfiction_warnings WHERE wid = '".$_GET['warning']."' LIMIT 1<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
79 79
 				$warning = dbassoc($warnquery);
80 80
 			}
81 81
 			$output .=  "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"admin.php?action=warnings&warning=".$_GET['warning']."\">
82 82
similarity index 98%
83 83
rename from member.php
84 84
rename to author.php
... ...
@@ -50,7 +50,7 @@ if((empty($action) || $action == "login") && isMEMBER) {
50 50
 	$panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '1' AND (panel_type = 'U' ".(!$submissionsoff || isADMIN ? " OR panel_type = 'S'" : "").($favorites ? " OR panel_type = 'F'" : "").") ORDER BY panel_type, panel_order, panel_title ASC");
51 51
 	if(!dbnumrows($panelquery)) $output .= _FATALERROR;
52 52
 	while($panel = dbassoc($panelquery)) {
53
-		if(!$panel['panel_url']) $output .=  "<a href=\"member.php?action=".$panel['panel_name']."\">".$panel['panel_title']."</a><br />\n";
53
+		if(!$panel['panel_url']) $output .=  "<a href=\"author.php?action=".$panel['panel_name']."\">".$panel['panel_title']."</a><br />\n";
54 54
 		else $output .= "<a href=\"".$panel['panel_url']."\">".$panel['panel_title']."</a><br />\n";
55 55
 	}
56 56
 	$output .= "</div>\n";
... ...
@@ -30,7 +30,7 @@ if(!defined("_CHARSET")) exit( );
30 30
 	if($multiplecats) {
31 31
 		$displaycolumns = $displaycolumns ? $displaycolumns : 1;
32 32
 		$query = "SELECT * FROM ".TABLEPREFIX."fanfiction_categories WHERE parentcatid = '-1' ORDER BY displayorder";
33
-		$result4 = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
33
+		$result4 = dbquery($query) or die(_FATALERROR."Query: ".$query."<br />Error: (". $dbconnect->errno.") ". $dbconnect->error);
34 34
 		$total = dbnumrows($result4);
35 35
 		$count = 0;
36 36
 		$collist = array( );
... ...
@@ -4,7 +4,7 @@ if(!defined("_CHARSET")) exit( );
4 4
 	$longform = "{penname} {password} {rememberme} {go} <div id='loginlinks'>{register} | {lostpwd}</div>";
5 5
 	$shortform = "{penname} {password} {rememberme} {go}";
6 6
 if(!isMEMBER) {
7
-	$content = "<form method=\"POST\" id=\"loginblock\" enctype=\"multipart/form-data\" action=\""._BASEDIR."member.php?action=login\">";
7
+	$content = "<form method=\"POST\" id=\"loginblock\" enctype=\"multipart/form-data\" action=\""._BASEDIR."author.php?action=login\">";
8 8
 	$replace = array("<label for=\"penname=\">"._PENNAME.":</label><INPUT type=\"text\" class=\"textbox\" name=\"penname\" id=\"penname\" size=\"15\">", 
9 9
 			"<label for=\"password\">"._PASSWORD.":</label><INPUT type=\"password\" class=\"textbox\" name=\"password\" id=\"password\" size=\"15\">",
10 10
 			"<span id='rememberme'><INPUT type=\"checkbox\" class=\"checkbox\" name=\"cookiecheck\" id=\"cookiecheck\" value=\"1\"><label for=\"cookiecheck=\">"._REMEMBERME."</label></span>",
... ...
@@ -33,7 +33,7 @@ if(!defined("_CHARSET")) exit( );
33 33
 	else include_once(_BASEDIR."blocks/news/en.php");
34 34
 
35 35
 	$news->prepare();
36
-	$newsquery = dbquery("SELECT nid, author, title, story, UNIX_TIMESTAMP(time) as date, comments FROM ".TABLEPREFIX."fanfiction_news ORDER BY time DESC LIMIT $numupdated");
36
+	$newsquery = dbquery("SELECT nid, author, title, story, time as date, comments FROM ".TABLEPREFIX."fanfiction_news ORDER BY time DESC LIMIT $numupdated");
37 37
 	$count = 0;
38 38
 	while($stories = dbassoc($newsquery)) {
39 39
 
... ...
@@ -24,7 +24,7 @@ include("blocks/".$blocks['poll']['file']);
24 24
 			$n = $num + 1;
25 25
 			$final .= (isset($results[$n]) ? $results[$n] : "0");
26 26
 		}
27
-		$closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = NOW( ) WHERE poll_id = '".$currentpoll['poll_id']."'");
27
+		$closepoll =dbquery("UPDATE ".TABLEPREFIX."fanfiction_poll SET poll_results = '$final', poll_end = '" . time() . "' WHERE poll_id = '".$currentpoll['poll_id']."'");
28 28
 		if($closepoll) $emptyvotes = dbquery("TRUNCATE TABLE `".TABLEPREFIX."fanfiction_poll_votes`");
29 29
 		$output .= write_message(_ACTIONSUCCESSFUL);
30 30
 	}
... ...
@@ -36,7 +36,7 @@ include("blocks/".$blocks['poll']['file']);
36 36
 			if(strlen(trim(preg_replace("!&nbsp;!", " ", $opt))) > 0) $new_opts[] = $opt;
37 37
 		}
38 38
 		$new_opts = escapestring(implode("|#|", $new_opts));
39
-		$newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', NOW( ))");
39
+		$newpoll = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_poll(`poll_question`, `poll_opts`, `poll_start`) VALUES('$poll_question', '$new_opts', '" . time() . "')");
40 40
 		include("blocks/".$blocks['poll']['file']);
41 41
 		$output .= "<div style='text-align: center;'><b>"._CURRENT.":</b><br /><div class=\"tblborder\" style=\"width: 200px; margin: 0 auto; text-align: left;\">$content</div><br /></div>";
42 42
 	}
... ...
@@ -63,7 +63,7 @@ if($poll) {
63 63
 }
64 64
 else {
65 65
 	$output .= "<div id='pagetitle'>"._POLLARCHIVE."</div>";
66
-	$listquery = dbquery("SELECT poll_id, poll_question, UNIX_TIMESTAMP(poll_start) as start, UNIX_TIMESTAMP(poll_end) as end FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end IS NOT NULL OR poll_end != '0000-00-00 00:00:00' ORDER BY poll_id DESC");
66
+	$listquery = dbquery("SELECT poll_id, poll_question, poll_startas start, poll_end as end FROM ".TABLEPREFIX."fanfiction_poll WHERE poll_end IS NOT NULL OR poll_end != '0000-00-00 00:00:00' ORDER BY poll_id DESC");
67 67
 	if(dbnumrows($listquery) > 0) {
68 68
 		$output .= "<table class='tblborder' style='margin: 1em auto;'><tr><th class='tblborder'>"._POLLARCHQUESTION."</th><th class='tblborder'>"._START."</th><th class='tblborder'>"._END."</th></tr>";
69 69
 		while($poll = dbassoc($listquery)) {
... ...
@@ -1,8 +1,8 @@
1 1
 <?php
2
-if (!defined('_CHARSET')) {
3
-    exit();
4
-}
5
-    $content = '<form method="POST" id="searchblock" enctype="multipart/form-data" action="'._BASEDIR.'searching.php?action=advanced">
6
-			<INPUT type="text" class="textbox" name="searchterm" id="searchterm" size="15"> 
7
-			<INPUT type="hidden" name="searchtype" value="advanced">
8
-			<INPUT type="submit" class="button" name="submit" value="'._SEARCH.'"></form>';
2
+if(!defined("_CHARSET")) exit( );
3
+	$content = "<form method=\"POST\" id=\"searchblock\" enctype=\"multipart/form-data\" action=\""._BASEDIR."search.php?action=advanced\">
4
+			<INPUT type=\"text\" class=\"textbox\" name=\"searchterm\" id=\"searchterm\" size=\"15\"> 
5
+			<INPUT type=\"hidden\" name=\"searchtype\" value=\"advanced\">
6
+			<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SEARCH."\"></form>";
7
+
8
+?>
9 9
\ No newline at end of file
... ...
@@ -4,7 +4,8 @@ if(!defined("_CHARSET")) exit( );
4 4
 if(file_exists(_BASEDIR."blocks/shoutbox/{$language}.php")) include_once(_BASEDIR."blocks/shoutbox/{$language}.php");
5 5
 else include_once(_BASEDIR."blocks/shoutbox/en.php");
6 6
 $content = "";
7
-if(isset($_POST['shout']) && (isMEMBER || !empty($blocks['shoutbox']['guestshouts']))) {
7
+if(isset($_POST['shouthidden']) && (isMEMBER || !empty($blocks['shoutbox']['guestshouts']))) {
8
+	http_response_code(202);
8 9
 	if(isMEMBER) $shout_name = USERUID;
9 10
 	else {
10 11
 		$shout_name = trim(descript($_POST['shoutname']));
... ...
@@ -24,7 +25,23 @@ if(isset($_POST['shout']) && (isMEMBER || !empty($blocks['shoutbox']['guestshout
24 25
 
25 26
 }
26 27
 if(isMEMBER || !empty($blocks['shoutbox']['guestshouts'])) {
27
-	$content = "<script language=\"javascript\" type=\"text/javascript\">
28
+	$content = "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>
29
+	<script language=\"javascript\" type=\"text/javascript\">
30
+	$(document).ready(function() {
31
+		$(function () {
32
+		  $('#shout').click( function () {
33
+			$.ajax({
34
+			  type: 'post',
35
+			  url: $('#shoutbox').attr('action'),
36
+			  data: $('#shoutbox').serialize(),
37
+			  success: function () {
38
+				location.reload();
39
+				$('#shout_message').val(\"\");
40
+			  }
41
+			});
42
+		  });
43
+		});
44
+	});
28 45
 var shoutend = '"._SHOUTEND."';
29 46
 function ismaxlength(obj){
30 47
 var mlength = 200
... ...
@@ -40,7 +57,8 @@ if (document.shoutbox.shout_message.value.length >= mlength) {
40 57
 	if(!isMEMBER) $content .= "<div><label for='shoutname'>"._NAME.":</label> <input type='text' name='shoutname' value='' style='display: block; width: 90%; margin: 0 auto;' maxlength='30'></div>";
41 58
 	else $content .= "<div><span class='label'>"._NAME.":</span> ".USERPENNAME."</div>";
42 59
 	if(!isMEMBER && $captcha) $content .= "<div><label for='userdigit'>"._CAPTCHANOTE."</label><input MAXLENGTH=5 SIZE=5 name=\"userdigit\" type=\"text\" value=\"\"><div style='text-align: center;'><img width=120 height=40 src=\""._BASEDIR."includes/button.php\" style=\"border: 1px solid #111;\"></div></div>";
43
-	$content .= "<div><label for='shout_MESSAGE'>"._SHOUT.":</label> <textarea name='shout_message' class='mceNoEditor' id='shout_message' rows='4' cols='15' maxlength='200' style='display: block; width: 90%; margin: 0 auto;' onkeyDown='return ismaxlength(this)'></textarea></div> <input type='submit' name='shout' id='shout' value='"._SHOUT."'> <input size='1' class='small' type='text' id='counter' value='200'></form></div>";
60
+	$content .= "<div><label for='shout_MESSAGE'>"._SHOUT.":</label> <textarea name='shout_message' class='mceNoEditor' id='shout_message' rows='4' cols='15' maxlength='200' style='display: block; width: 90%; margin: 0 auto;' onkeyDown='return ismaxlength(this)'></textarea></div> <input type='button' name='shout' id='shout' value='"._SHOUT."'> <input size='1' class='small' type='text' id='counter' value='200'> <input type='hidden' name='shouthidden' id='shouthidden' value='"._SHOUT."'>
61
+	</form></div>";
44 62
 }
45 63
 if(isset($blocks['shoutbox']['shoutlimit'])) $shoutlimit = $blocks['shoutbox']['shoutlimit'];
46 64
 else $shoutlimit = 10;
... ...
@@ -63,4 +81,4 @@ if(dbnumrows($shouts) != 0) {
63 81
 else $content .= write_message(_NOSHOUTS);
64 82
 $content .= "</div>";
65 83
 if($totalshouts > $shoutlimit) $content .= write_message("<a href='"._BASEDIR."blocks/shoutbox/archive.php'>"._SHOUTARCHIVE."</a>");
66
-?>
67 84
\ No newline at end of file
85
+?>
... ...
@@ -30,7 +30,7 @@ if($uid > 0) {
30 30
 	$query = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
31 31
 	list($penname) = dbrow($query);
32 32
 	$output = "<div id='pagetitle'>".stripslashes($penname)."</div>\n";
33
-	$squery = "SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON coauth.sid = stories.sid WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 $squery AND (stories.uid = '$uid' OR coauth.uid = '$uid') "._ORDERBY;
33
+	$squery = "SELECT stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON coauth.sid = stories.sid WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 $squery AND (stories.uid = '$uid' OR coauth.uid = '$uid') "._ORDERBY;
34 34
 	$cquery = "SELECT count(stories.sid) FROM ".TABLEPREFIX."fanfiction_stories as stories LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON stories.sid = coauth.sid WHERE validated > 0 $countquery AND (stories.uid = '$uid' OR coauth.uid = '$uid')";
35 35
 	$numrows = search($squery, $cquery, "browse.php?");
36 36
 }
... ...
@@ -1,6 +1,6 @@
1 1
 INSERT INTO `fanfiction_messages` (`message_id`, `message_name`, `message_title`, `message_text`) VALUES (1, 'welcome', '', 'This is your welcome message. It appears on the index page. Include it in your .tpl files with {welcome}.'),
2 2
 (2, 'copyright', '', 'This is your sample copyright footer.  Include it in your footer.tpl with <b>{footer}</b><br />\r\n<u>Disclaimer:</u>  All publicly recognizable characters, settings, etc. are the property of their respective owners.  The original characters and plot are the property of the author.  No money is being made from this work.  No copyright infringement is intended.\r\n'),
3
-(3, 'help', 'Help', '<h3>FAQ</h3><p><strong>I forgot my password!&nbsp; What do I do now?</strong></p><p>To recover a lost password, <a href="member.php?action=lostpassword">click here</a> and enter the e-mail address with which you registered.&nbsp; Your password will be sent to you shortly.</p><p><strong>What kinds of stories are allowed?</strong></p><p>See our <a href="submission.php">Submission Rules.</a></p><p><strong>How do I contact the site administrators?</strong></p><p>You can e-mail us via our <a href="contact.php">contact form.</a></p><p><strong>How do I submit stories?</strong></p><p>If you have not already done so, please <a href="member.php?action=newaccount">register for an account</a>. Once you''ve logged in, click on <a href="member.php">Account Information</a> and choose <a href="stories.php?action=newstory">Add Story</a>.&nbsp; The form presented there will allow you to submit your story.</p><p><strong>What are the ratings used on the site?</strong></p><p>We use the ratings system from <a href="http://www.fictionratings.com/">www.fictionratings.com</a>.</p><p><strong>What are the story classifications?</strong></p><p>Stories are classified by categories, genres, and warnings.</p>'),
3
+(3, 'help', 'Help', '<h3>FAQ</h3><p><strong>I forgot my password!&nbsp; What do I do now?</strong></p><p>To recover a lost password, <a href="user.php?action=lostpassword">click here</a> and enter the e-mail address with which you registered.&nbsp; Your password will be sent to you shortly.</p><p><strong>What kinds of stories are allowed?</strong></p><p>See our <a href="submission.php">Submission Rules.</a></p><p><strong>How do I contact the site administrators?</strong></p><p>You can e-mail us via our <a href="contact.php">contact form.</a></p><p><strong>How do I submit stories?</strong></p><p>If you have not already done so, please <a href="user.php?action=newaccount">register for an account</a>. Once you''ve logged in, click on <a href="user.php">Account Information</a> and choose <a href="stories.php?action=newstory">Add Story</a>.&nbsp; The form presented there will allow you to submit your story.</p><p><strong>What are the ratings used on the site?</strong></p><p>We use the ratings system from <a href="http://www.fictionratings.com/">www.fictionratings.com</a>.</p><p><strong>What are the story classifications?</strong></p><p>Stories are classified by categories, genres, and warnings.</p>'),
4 4
 (4, 'nothankyou', '{sitename} Submission Rejection', 'Your recent submission of "{storytitle} : {chaptertitle}" to {sitename} did not meet our requirements for submission.  Please review our {rules}.<br /><br />\r\n\r\n{adminname}'),
5 5
 (5, 'printercopyright', '', '<u>Disclaimer:</u> All publicly recognizable characters and settings are the property of their respective owners. The original characters and plot are the property of the author. No money is being made from this work. No copyright infringement is intended.'),
6 6
 (6, 'rules', 'Submission Rules', '<p align="center"><strong>Submission Rules</strong></p>\r\n<ol>\r\n  <li>All submissions must be accompanied by a complete disclaimer. If a \r\n  suitable disclaimer is not included, the site administrators reserve the right \r\n  to add a disclaimer.&nbsp; Repeat offenders may be subject to further action \r\n  up to and including removal of stories and account.\r\n<div class="tblborder" style="width: 400px; margin: 1em auto;">\r\n<div style="background: #000; color: #FFF; padding: 5px; text-align: center; font-weight: bold;">Sample Disclaimer</div>\r\n<div class="tblborder" style="padding: 5px;"><span style="text-decoration: underline;">Disclaimer:</span>  All publicly recognizable characters, settings, etc. are the property of their respective owners.  The original characters and plot are the property of the author.&nbsp; \r\n        The author is in no way associated with the owners, creators, or producers of any media franchise.&nbsp;  No copyright infringement is intended.</div>\r\n  </div>\r\n  </li>\r\n  <li>Stories must be submitted to the proper category. &nbsp;If there is an appropriate sub-category, <strong>DO NOT</strong> add your story to the main category.&nbsp; The submission \r\n  form allows you to choose multiple categories for your story, and we worked very hard to add that functionality for you.&nbsp;&nbsp; <u><strong>So please \r\n  do NOT add your story multiple times!</strong></u></li>\r\n  <li>Titles and summaries must be kid friendly.&nbsp; No exceptions.&nbsp; </li>\r\n  <li>&quot;Please read&quot;, &quot;Untitled&quot;, etc. are not acceptable titles or summaries.</li>\r\n  <li>A number of authors have requested that fans refrain from writing fan \r\n  fiction based on their work.&nbsp; Therefore submissions will not be \r\n  accepted based on the works of P.N. Elrod, Raymond Feist, Terry Goodkind, \r\n  Laurell K. Hamilton, Anne McCaffrey, Robin McKinley, Irene Radford, Anne Rice, \r\n  and Nora Roberts/J.D. Robb.&nbsp; </li>\r\n  <li>Actor/actress stories are not permitted...not even if they''re visiting an \r\n  alternate reality.</li>\r\n  <li>Correct grammar and spelling are expected of all stories submitted to this \r\n  site.&nbsp; The site administrators are not grammar Nazis.&nbsp; However, the \r\n  site administrators reserve the right to request corrections in submissions \r\n  with a multitude of grammar and/or spelling errors.&nbsp; If such a request is \r\n  ignored, the story will be deleted.</li>\r\n  <li>All stories must be rated correctly and have the appropriate warnings.&nbsp; \r\n  All adult rated stories are expected to have warnings.&nbsp; After all, they \r\n  wouldn''t have that rating if there wasn''t something to be warned about!&nbsp; The site administrators recognize \r\n  that there is an audience for these stories, but please respect those who do \r\n  not wish to read them by labeling them appropriately.&nbsp;\r\n  <u><strong>Please note: Stories containing adults having sex with minors are strictly forbidden.</strong></u>&nbsp; </li>\r\n  <li>Stories with multiple chapters should be archived as such and <span style="font-weight: bold; text-decoration: underline;">NEVER</span> as \r\n  separate stories.&nbsp; Upload the first chapter of your story, then go to <a href="stories.php?action=viewstories">Manage Stories</a> in \r\nyour account to add additional chapters.  If you have trouble with this, please contact the site administrator or ask a \r\n  friend to help you.</li>\r\n  <li>As much as possible, spoiler warnings are expected on all stories.  For categories with serialized content, such as series of books or television series, \r\n  spoilers are <strong>mandatory</strong> for the current season and/or most recent part.  An appropriate spoiler warning to place in your summary would be: Spoilers for <u>Star Trek II: The Wrath of Khan.</u> \r\n  <strong>DO NOT</strong> do anything like this: <u>Spoilers for the one where Spock dies.</u></li>\r\n</ol>\r\n  <p>Submissions found to be in violation of these rules may be removed and the \r\n  author''s account suspended at the discretion of the site administrators and/or \r\n  moderators.&nbsp; The site administrators reserve the right to modify these \r\n  rules as needed.</p>'),
... ...
@@ -1,14 +1,14 @@
1
-INSERT INTO `e107_fanfiction_pagelinks` (`link_id`, `link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES (1, 'home', 'Home', 'index.php', '0', 0),
1
+INSERT INTO `test3fanfiction_pagelinks` (`link_id`, `link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES (1, 'home', 'Home', 'index.php', '0', 0),
2 2
 (2, 'recent', 'Most Recent', 'browse.php?type=recent', '0', 0),
3
-(3, 'login', 'Login', 'member.php?action=login', '0', 0),
3
+(3, 'login', 'Login', 'author.php?action=login', '0', 0),
4 4
 (4, 'adminarea', 'Admin', 'admin.php', '0', 2),
5
-(5, 'logout', 'Logout', 'member.php?action=logout', '0', 1),
5
+(5, 'logout', 'Logout', 'author.php?action=logout', '0', 1),
6 6
 (6, 'featured', 'Featured Stories', 'browse.php?type=featured', '0', 0),
7 7
 (7, 'catslink', 'Categories', 'browse.php?type=categories', '0', 0),
8 8
 (8, 'members', 'Members', 'authors.php?action=list', '0', 0),
9 9
 (9, 'authors', 'Authors', 'authors.php?list=authors', '0', 0),
10 10
 (10, 'help', 'Help', 'viewpage.php?page=help', '0', 0),
11
-(11, 'search', 'Search', 'searching.php', '0', 0),
11
+(11, 'search', 'Search', 'search.php', '0', 0),
12 12
 (12, 'series', 'Series', 'browse.php?type=series', '0', 0),
13 13
 (13, 'tens', 'Top Tens', 'toplists.php', '0', 0),
14 14
 (14, 'challenges', 'Challenges', 'browse.php?type=challenges', '0', 0),
... ...
@@ -16,11 +16,11 @@ INSERT INTO `e107_fanfiction_pagelinks` (`link_id`, `link_name`, `link_text`, `l
16 16
 (16, 'rules', 'Rules', 'viewpage.php?page=rules', '0', 0),
17 17
 (17, 'tos', 'Terms of Service', 'viewpage.php?page=tos', '0', 0),
18 18
 (18, 'rss', '<img src=''images/xml.gif'' alt=''RSS'' border=''0''>', 'rss.php', '0', 0),
19
-(19, 'login', 'Account Info', 'member.php', '0', 1),
19
+(19, 'login', 'Account Info', 'author.php', '0', 1),
20 20
 (20, 'titles', 'Titles', 'browse.php?type=titles', '0', 0),
21
-(21, 'register', 'Register', 'member.php?action=register', '0', 0),
22
-(22, 'lostpassword', 'Lost Password', 'member.php?action=lostpassword', '0', 0),
23
-(23, 'newsarchive', 'News Archive', 'ffnews.php', '0', 0),
21
+(21, 'register', 'Register', 'author.php?action=register', '0', 0),
22
+(22, 'lostpassword', 'Lost Password', 'author.php?action=lostpassword', '0', 0),
23
+(23, 'newsarchive', 'News Archive', 'news.php', '0', 0),
24 24
 (24, 'browse', 'Browse', 'browse.php', '0', 0),
25 25
 (25, 'charslink', 'Characters', 'browse.php?type=characters', '0', 0),
26 26
 (26, 'ratings', 'Ratings', 'browse.php?type=ratings', '0', 0);
... ...
@@ -26,7 +26,7 @@ CREATE TABLE `fanfiction_authorinfo` (
26 26
   `info` varchar(255) NOT NULL default '',
27 27
   PRIMARY KEY  (`uid`,`field`),
28 28
   KEY `uid` (`uid`)
29
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
29
+) REPLACE=MyISAM;
30 30
 
31 31
 -- --------------------------------------------------------
32 32
 
... ...
@@ -66,7 +66,7 @@ CREATE TABLE `fanfiction_authors` (
66 66
   `website` varchar(200) NOT NULL default '',
67 67
   `bio` text NOT NULL,
68 68
   `image` varchar(200) NOT NULL default '',
69
-  `date` datetime NOT NULL default '0000-00-00 00:00:00',
69
+  `date`  int(11) NOT NULL default '0',
70 70
   `admincreated` int(11) NOT NULL default '0',
71 71
   `password` varchar(40) NOT NULL default '0',
72 72
   PRIMARY KEY  (`uid`),
... ...
@@ -222,7 +222,7 @@ CREATE TABLE `fanfiction_comments` (
222 222
   `nid` int(11) NOT NULL default '0',
223 223
   `uid` int(11) NOT NULL default '0',
224 224
   `comment` text NOT NULL,
225
-  `time` datetime NOT NULL default '0000-00-00 00:00:00',
225
+  `time` int(11) NOT NULL default '0',
226 226
   PRIMARY KEY  (`cid`),
227 227
   KEY `commentlist` (`nid`,`time`)
228 228
 ) REPLACE=MyISAM;
... ...
@@ -254,7 +254,6 @@ CREATE TABLE `fanfiction_inseries` (
254 254
   `subseriesid` int(11) NOT NULL default '0',
255 255
   `confirmed` int(11) NOT NULL default '0',
256 256
   `inorder` int(11) NOT NULL default '0',
257
-  `updated` datetime NOT NULL default '0000-00-00 00:00:00',
258 257
   PRIMARY KEY  (`sid`,`seriesid`),
259 258
   KEY `seriesid` (`seriesid`,`inorder`)
260 259
 ) REPLACE=MyISAM;
... ...
@@ -270,7 +269,7 @@ CREATE TABLE `fanfiction_log` (
270 269
   `log_action` varchar(255) default NULL,
271 270
   `log_uid` int(11) NOT NULL default '0',
272 271
   `log_ip` int(11) default NULL,
273
-  `log_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
272
+  `log_timestamp` int(11) NOT NULL default '0',
274 273
   `log_type` char(2) NOT NULL default '',
275 274
   PRIMARY KEY  (`log_id`)
276 275
 ) REPLACE=MyISAM;
... ...
@@ -384,7 +383,7 @@ CREATE TABLE `fanfiction_reviews` (
384 383
   `reviewer` varchar(60) NOT NULL default '0',
385 384
   `uid` int(11) NOT NULL default '0',
386 385
   `review` text NOT NULL,
387
-  `date` datetime NOT NULL default '0000-00-00 00:00:00',
386
+  `date` int(11) NOT NULL default '0',
388 387
   `rating` int(11) NOT NULL default '0',
389 388
   `respond` char(1) NOT NULL default '0',
390 389
   `type` char(2) NOT NULL default 'ST',
... ...
@@ -456,8 +455,8 @@ CREATE TABLE `fanfiction_stories` (
456 455
   `classes` varchar(200) default NULL,
457 456
   `charid` varchar(250) NOT NULL default '0',
458 457
   `rid` varchar(25) NOT NULL default '0',
459
-  `date` datetime NOT NULL default '0000-00-00 00:00:00',
460
-  `updated` datetime NOT NULL default '0000-00-00 00:00:00',
458
+  `date` int(11) NOT NULL default '0',
459
+  `updated` int(11) NOT NULL default '0',
461 460
   `uid` int(11) NOT NULL default '0',
462 461
   `coauthors` varchar(200) default NULL,
463 462
   `featured` tinyint(4) NOT NULL default '0',
... ...
@@ -28,14 +28,6 @@ if(isset($_GET['benchmark'])) {
28 28
 	$start = ((float)$usec + (float)$sec);
29 29
 }
30 30
 $headerSent = false;
31
-if(get_magic_quotes_gpc()){
32
-	foreach($_POST as $var => $val) {
33
-		$_POST[$var] = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
34
-	}
35
-	foreach($_GET as $var => $val) {
36
-		$_GET[$var] = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
37
-	}
38
-}
39 31
 
40 32
 // Defines the character set for your language/location
41 33
 define ("_CHARSET", "utf-8");
... ...
@@ -89,6 +81,7 @@ unset($settings['tableprefix']);
89 81
 define("STORIESPATH", $settings['storiespath']);
90 82
 unset($settings['storiespath']);
91 83
 foreach($settings as $var => $val) {
84
+	if (is_NULL($val)) $val = '';
92 85
 	$$var = stripslashes($val);
93 86
 	$settings[$var] = htmlspecialchars($val);
94 87
 }
... ...
@@ -166,7 +159,10 @@ if($maintenance && !isADMIN && basename($_SERVER['PHP_SELF']) != "maintenance.ph
166 159
 
167 160
 $blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks");
168 161
 while($block = dbassoc($blockquery)) {
169
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
162
+	if ($block['block_variables'])
163
+	{
164
+		$blocks[$block['block_name']] = unserialize($block['block_variables']);
165
+	}
170 166
 	$blocks[$block['block_name']]['title'] = $block['block_title'];
171 167
 	$blocks[$block['block_name']]['file'] = $block['block_file'];
172 168
 	$blocks[$block['block_name']]['status'] = $block['block_status'];
... ...
@@ -223,11 +219,7 @@ if(isset($metaDesc)) echo "<meta name='description' content='$metaDesc'>";
223 219
 echo "<title>$titleinfo</title>";
224 220
 
225 221
 // ---------- Favicon ---------
226
-if (file_exists($skindir."/images/favicon.ico")) 
227
-{
228
-	echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n";
229
-}
230
-elseif (file_exists(_BASEDIR."favicon.ico")) 
222
+if (file_exists(_BASEDIR."favicon.ico")) 
231 223
 {
232 224
 	echo "<link rel='icon' href='"._BASEDIR."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='"._BASEDIR."favicon.ico' type='image/xicon' />\n";
233 225
 }
... ...
@@ -37,13 +37,4 @@ if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
37 37
     } else {
38 38
         spl_autoload_register('PHPMailerAutoload');
39 39
     }
40
-} else {
41
-    /**
42
-     * Fall back to traditional autoload for old PHP versions
43
-     * @param string $classname The name of the class to load
44
-     */
45
-    function __autoload($classname)
46
-    {
47
-        PHPMailerAutoload($classname);
48
-    }
49
-}
40
+}  
... ...
@@ -1,4 +1,7 @@
1 1
 <?php
2
+ini_set('display_errors', 0);
3
+ini_set('display_startup_errors', 0);
4
+error_reporting(-1);
2 5
 
3 6
 session_start();
4 7
 define("_BASEDIR", "../");
... ...
@@ -56,23 +59,21 @@ for( $i=0; $i<(140*40)/3; $i++ ) {
56 59
   imagefilledellipse($image, mt_rand(0,140), mt_rand(0,40), 1, 1, $gray);
57 60
 }
58 61
 
59
-
60 62
 for ($i = 0; $i < 5; $i++) {
61 63
  $x = $x + mt_rand(16, 24);
62 64
  $y = mt_rand(26, 32); 
63 65
  $angle = mt_rand(-15, 15);
64
- $c = $ccolor[$i];
66
+ $c = $color[$i];
65 67
  $fnt = mt_rand(0, sizeof($fontList) - 1);
66 68
  $colori = $rColors[$i];
67 69
  imagettftext($image, mt_rand(20, 24), $angle,  $x, $y, $colori, $fontList[$fnt], $cnum[$i]); 
68 70
 
69 71
 }
70
-
71
-
72
+ 
72 73
 $digit = "$cnum[0]$cnum[1]$cnum[2]$cnum[3]$cnum[4]";
73 74
 
74 75
 $_SESSION[$sitekey.'_digit'] = md5($sitekey.$digit);
75
-
76
+ 
76 77
 header("Expires: Tue, 11 Jun 1985 05:00:00 GMT");  
77 78
 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
78 79
 header("Cache-Control: no-store, no-cache, must-revalidate");  
... ...
@@ -39,9 +39,6 @@ define("T_BYVAR", 1);
39 39
 define("TP_ROOTBLOCK", '_ROOT');
40 40
 
41 41
 
42
-//https://php.watch/versions/8.2/dynamic-properties-deprecated
43
-
44
-
45 42
 #[AllowDynamicProperties]
46 43
 class TemplatePowerParser
47 44
 {
... ...
@@ -608,36 +605,38 @@ class TemplatePower extends TemplatePowerParser
608 605
      */
609 606
     public function newBlock($blockname)
610 607
     {
611
-        $parent = &$this->content[ $this->parent[$blockname] .'_'. $this->index[$this->parent[$blockname]] ];
608
+        if(isset($this->parent[$blockname])) {
609
+            $parent = &$this->content[ $this->parent[$blockname] .'_'. $this->index[$this->parent[$blockname]] ];
612 610
 
613
-		$lastitem = sizeof( $parent );
614
-        $lastitem > 1 ? $lastitem-- : $lastitem = 0;
611
+            $lastitem = sizeof( $parent );
612
+            $lastitem > 1 ? $lastitem-- : $lastitem = 0;
615 613
 
616
-		$ind_blockname = $blockname . '_' . $this->index[ $blockname ];
614
+            $ind_blockname = $blockname . '_' . $this->index[ $blockname ];
617 615
 
618
-        if (! isset($parent[ $lastitem ]["_B:$blockname"])) {
619
-            //ok, there is no block found in the parentblock with the name of {$blockname}
616
+            if (! isset($parent[ $lastitem ]["_B:$blockname"])) {
617
+                //ok, there is no block found in the parentblock with the name of {$blockname}
620 618
 
621
-            //so, increase the index counter and create a new {$blockname} block
622
-            $this->index[ $blockname ] += 1;
619
+                //so, increase the index counter and create a new {$blockname} block
620
+                $this->index[ $blockname ] += 1;
623 621
 
624
-            $ind_blockname = $blockname . '_' . $this->index[ $blockname ];
622
+                $ind_blockname = $blockname . '_' . $this->index[ $blockname ];
625 623
 
626
-            if (! isset($this->content[ $ind_blockname ])) {
627
-                 $this->content[ $ind_blockname ] = array();
628
-            }
624
+                if (! isset($this->content[ $ind_blockname ])) {
625
+                    $this->content[ $ind_blockname ] = array();
626
+                }
629 627
 
630
-            //tell the parent where his (possible) children are located
631
-            $parent[ $lastitem ]["_B:$blockname"] = $ind_blockname;
632
-        }
628
+                //tell the parent where his (possible) children are located
629
+                $parent[ $lastitem ]["_B:$blockname"] = $ind_blockname;
630
+            }
633 631
 
634
-        //now, make a copy of the block defenition
635
-        $blocksize = sizeof( $this->content[ $ind_blockname ] );
632
+            //now, make a copy of the block defenition
633
+            $blocksize = sizeof( $this->content[ $ind_blockname ] );
636 634
 
637
-        $this->content[ $ind_blockname ][ $blocksize ] = array( $blockname );
635
+            $this->content[ $ind_blockname ][ $blocksize ] = array( $blockname );
638 636
 
639
-        //link the current block to the block we just created
640
-        $this->currentBlock = &$this->content[ $ind_blockname ][ $blocksize ];
637
+            //link the current block to the block we just created
638
+            $this->currentBlock = &$this->content[ $ind_blockname ][ $blocksize ];
639
+        }
641 640
     }
642 641
 
643 642
     /**
... ...
@@ -252,7 +252,7 @@ function title_link($stories) {
252 252
 				$warning = _AGECHECK." - "._AGECONSENT." ".$warningtext." -- 1";
253 253
 			}
254 254
 			if($warninglevel[0] && !isMEMBER) {
255
-				$location = "member.php?action=login&amp;sid=".$stories['sid'];
255
+				$location = "author.php?action=login&amp;sid=".$stories['sid'];
256 256
 				$warning = _RUSERSONLY." - $warningtext";		
257 257
 			}
258 258
 			if(!empty($warning)) {
... ...
@@ -366,7 +366,7 @@ function replace_naughty($text) {
366 366
 	$i = 0;
367 367
 	for($j = 0; $j < sizeof($words); $j++) {
368 368
 		if(strpos($words[$j], "*") === false) {
369
-			$replace[$i] = str_pad($words[$j]{0}, strlen($words[$j]), "*");
369
+			$replace[$i] = str_pad($words[$j][0], strlen($words[$j]), "*");
370 370
 			$naughtywords[$i] = '/\b('.$words[$j].'\b)|('.build_word($words[$j]).')\b/i';
371 371
 			$i++;
372 372
 		}
... ...
@@ -523,7 +523,7 @@ function charlist($characters) {
523 523
 }
524 524
 
525 525
 // Most of the pages that list stories and series use this fuction.  This handles showing the series and stories and pagination of the two together when needed
526
-function search($storyquery, $countquery, $pagelink = "searching.php?", $pagetitle = 0) {
526
+function search($storyquery, $countquery, $pagelink = "search.php?", $pagetitle = 0) {
527 527
 	global $tpl, $new, $ratingslist, $itemsperpage, $reviewsallowed, $output, $dateformat, $current, $featured, $favorites, $retired, $ageconsent, $classtypelist, $classlist, $offset, $recentdays;
528 528
      
529 529
 	$count = dbquery($countquery);
... ...
@@ -1,9 +1,8 @@
1 1
 <?php
2 2
 
3 3
 if(function_exists("mysqli_connect")) include_once(_BASEDIR."includes/mysqli_functions.php");
4
-else if(function_exists("mysql_connect")) include_once(_BASEDIR."includes/mysql_functions.php");
5 4
 else {
6 5
 	include(_BASEDIR."languages/en.php"); // Because we haven't selected a language setting yet
7 6
 	die(_FATALERROR._NODBFUNCTIONALITY);
8 7
 }
9
-?>
10 8
\ No newline at end of file
9
+ 
11 10
\ No newline at end of file
... ...
@@ -40,17 +40,18 @@ function deleteStory($story) {
40 40
 	if($logging) {
41 41
 		$authorquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '".$story['uid']."' LIMIT 1");
42 42
 		list($penname) = dbrow($authorquery);
43
-		dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_DEL, USERPENNAME, USERUID, $story['title'], $sid, $penname, $story['uid']))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'DL')");
43
+		dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_DEL, USERPENNAME, USERUID, $story['title'], $sid, $penname, $story['uid']))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'DL')");
44 44
 	}
45 45
 	dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$sid' LIMIT 1");
46 46
 	dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '$sid'");
47 47
 	dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_reviews WHERE item = '$sid' AND type = 'ST'");
48 48
 	dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_favorites WHERE item = '$sid' AND type = 'ST'");
49 49
 	// get the coauthors list before we delete the coauthors info.
50
+	$array_coauthors = array();
50 51
 	if($story['coauthors'] == 1) {
51 52
 		$coauth = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$sid'");
52 53
 		while($c = dbassoc($coauth)) {
53
-			$coauthors[] = $c['uid'];
54
+			$array_coauthors[] = $c['uid'];
54 55
 			
55 56
 		}
56 57
 	}	
... ...
@@ -70,9 +71,9 @@ function deleteStory($story) {
70 71
 	}
71 72
 	if($story['validated'] > 0) {
72 73
 		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = stories - 1");
73
-		if(!empty($coauthors)) {
74
-			$coauthors[] = $story['uid'];
75
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = stories - 1 WHERE FIND_IN_SET(uid, '".implode(",", $coauthors)."') > 0");
74
+		if(!empty($array_coauthors)) {
75
+			$array_coauthors[] = $story['uid'];
76
+			dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = stories - 1 WHERE FIND_IN_SET(uid, '".implode(",", $array_coauthors)."') > 0");
76 77
 		}
77 78
 		else dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = stories - 1 WHERE uid = '".$story['uid']."' LIMIT 1");
78 79
 		list($chapters, $words) = dbrow(dbquery("SELECT COUNT(chapid), SUM(wordcount) FROM ".TABLEPREFIX."fanfiction_chapters WHERE validated > 0"));
... ...
@@ -96,13 +97,14 @@ function deleteUser($uid) {
96 97
 				}
97 98
 				else { // Co-authors found...give the story a new author.
98 99
 					$cQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '".$story['sid']."' LIMIT 1");
99
-					$newauthor = 0; $coauthors = array( );
100
+					$newauthor = 0; $coauthors = 0;
101
+					$array_coauthors = array();
100 102
 					while($cRes= dbassoc($cQuery)) {
101 103
 						if(!$newauthor) $newauthor = $cRes['uid'];
102
-						else $coauthors[] = $cRes['uid'];
104
+						else $array_coauthors[] = $cRes['uid'];
103 105
 					}			
104 106
 					if(!empty($newauthor)) {
105
-						$coauthors = count($coauthors) > 0 ? 1 : 0;
107
+						$coauthors = count($array_coauthors) > 0 ? 1 : 0;
106 108
 						dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET uid = '$newauthor', coauthors = '$coauthors' WHERE sid = '".$story['sid']."' LIMIT 1");
107 109
 						$chapters = dbquery("SELECT chapid FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$story['sid']."' AND uid = '$uid'");
108 110
 						while($chap = dbassoc($chapters)) {
... ...
@@ -188,7 +190,7 @@ function deleteSeries($seriesid) {
188 190
 			eval($code['code_text']);
189 191
 	}
190 192
 	if($logging && isADMIN) {
191
-		if($uid != USERUID) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_DEL_SERIES, USERPENNAME, USERUID, $title))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'DL')");
193
+		if($uid != USERUID) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_DEL_SERIES, USERPENNAME, USERUID, $title))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'DL', " . time() . ")");
192 194
 	}
193 195
 }
194 196
 ?>
195 197
\ No newline at end of file
... ...
@@ -23,7 +23,6 @@
23 23
 // ----------------------------------------------------------------------
24 24
 
25 25
 if(!defined("_CHARSET")) exit( );
26
-
27 26
 // Get session variables from cookie data if not logged in.
28 27
 // To bridge to another program replace (or add to) this information with the bridge to your other script.  See examples in the includes/bridges/ folder.
29 28
 if (!empty($_COOKIE[$sitekey."_useruid"])) {
... ...
@@ -18,14 +18,14 @@ function dbconnect($dbhost, $dbuser, $dbpass, $dbname ) {
18 18
 function dbquery($query) {
19 19
 	global $debug, $headerSent, $dbconnect;
20 20
 	if($debug && $headerSent) echo "<!-- $query -->\n";
21
-	$result = $dbconnect->query($query) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".$dbconnect->mysqli_errno.") ".$dbconnect->mysqli_error : ""));
21
+	$result = $dbconnect->query($query) or accessDenied( _FATALERROR.(isADMIN ? "Query: ".$query."<br />Error: (".$dbconnect->errno.") ".$dbconnect->error : ""));
22 22
 	return $result;
23 23
 }
24 24
 
25 25
 function dbnumrows($query) {
26 26
 	global $debug, $dbconnect;
27 27
 	if ($query === false && $debug) {
28
-		echo "<!-- dbnumrows ".$dbconnect->mysqli_error." -->\n";
28
+		echo "<!-- dbnumrows ".$dbconnect->error." -->\n";
29 29
 	}
30 30
 	return $query->num_rows;
31 31
 }
... ...
@@ -33,7 +33,7 @@ function dbnumrows($query) {
33 33
 function dbassoc($query) {
34 34
 	global $debug, $dbconnect;
35 35
 	if ($query === false && $debug) {
36
-		echo "<!-- dbassoc ".$dbconnect->mysqli_error." -->\n";
36
+		echo "<!-- dbassoc ".$dbconnect->errno." -->\n";
37 37
 	}
38 38
 	return $query->fetch_assoc();
39 39
 }
... ...
@@ -46,7 +46,7 @@ function dbinsertid($tablename = 0) {
46 46
 function dbrow($query) {
47 47
 	global $debug, $dbconnect;
48 48
 	if ($query === false && $debug) {
49
-		if($error) echo "<!-- dbrow ".$dbconnect->mysqli_error." -->\n";
49
+		if($dbconnect->error) echo "<!-- dbrow ".$dbconnect->errno." -->\n";
50 50
 	}
51 51
 	return $query->fetch_row();
52 52
 }
... ...
@@ -10,7 +10,7 @@ define ("_EMAILFIELD", "author.email");  // Do not change the aliasing (the "aut
10 10
 define ("_PASSWORDFIELD", "author.password"); //  Do not change the aliasing (the "author." part)!
11 11
 define ("_AUTHORTABLE", _AUTHORPREFIX."fanfiction_authors as author"); // Do not change the aliasing (the "as author" part)!
12 12
 
13
-define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
13
+define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
14 14
 define ("_STORYCOUNT", "SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_stories as stories WHERE validated > 0");
15 15
 define ("_SERIESQUERY", "SELECT series.*, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_series as series WHERE "._UIDFIELD." = series.uid ");
16 16
 define ("_SERIESCOUNT", "SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series as series ");
... ...
@@ -73,7 +73,7 @@ if(!defined("_CHARSET")) exit( );
73 73
 	if(count($seriescode)) foreach($seriescode as $c) { eval($c); } 
74 74
 	$tpl->assign("classifications", $allclasslist);
75 75
 	if(isMEMBER && $favorites) {
76
-		$addtofaves = "[<a href=\"member.php?action=favse&amp;uid=".USERUID."&amp;add=".$stories['seriesid']."\">"._ADDSERIES2FAVES."</a>]";
76
+		$addtofaves = "[<a href=\"author.php?action=favse&amp;uid=".USERUID."&amp;add=".$stories['seriesid']."\">"._ADDSERIES2FAVES."</a>]";
77 77
 		if($stories['isopen'] < 2) {
78 78
 			$addtofaves .= " [<a href=\"viewuser.php?action=favau&amp;uid=".USERUID."&amp;author=".$stories['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
79 79
 		}
... ...
@@ -26,19 +26,19 @@ if(!defined("_CHARSET")) exit( );
26 26
 	$tpl->assign("sid", $stories['sid']);
27 27
 	unset($challengelinks, $challengeadmin, $serieslinks, $categorylinks, $adminlinks, $authlink);
28 28
 	if($stories['coauthors'] == 1) {
29
-		$coauthors = array();
29
+		$array_coauthors = array();
30 30
 		$coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$stories['sid']."'");
31 31
 		while($c = dbassoc($coauth)) {
32
-			$coauthors[$c['uid']] = $c['penname'];
32
+			$array_coauthors[$c['uid']] = $c['penname'];
33 33
 		}
34
-		$stories['coauthors'] = $coauthors;
35
-		unset($coauthors);
34
+		$stories['coauthors'] = $array_coauthors;
35
+		unset($array_coauthors);
36 36
 	}
37 37
 	else if(empty($stories['coauthors'])) $stories['coauthors'] = array( );	
38 38
 	$tpl->assign("title"   , stripslashes(title_link($stories)) );
39 39
 	$tpl->assign("author"   , author_link($stories));
40 40
 	$tpl->assign("summary", stripslashes($stories['summary']) );
41
-	$tpl->assign("rating"   , $ratingslist[$stories['rid']]['name']);
41
+	$tpl->assign("rating"   , !empty($ratingslist) ? $ratingslist[$stories['rid']]['name'] : "");
42 42
 	$tpl->assign("score", ratingpics($stories['rating']) );
43 43
 	$tpl->assign("count", $stories['count'] ? $stories['count'] : "0");
44 44
 	$allclasslist = "";
... ...
@@ -71,7 +71,7 @@ if(!defined("_CHARSET")) exit( );
71 71
 	if(count($storycodeblocks)) foreach($storycodeblocks as $c) { eval($c); } 
72 72
 	$tpl->assign("classifications", $allclasslist);
73 73
 	$seriesquery = "SELECT series.* FROM ".TABLEPREFIX."fanfiction_inseries as list, ".TABLEPREFIX."fanfiction_series as series WHERE list.sid = '".$stories['sid']."' AND series.seriesid = list.seriesid";
74
-	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (".mysql_errno( ).") ".mysql_error( ));
74
+	$seriesresult = dbquery($seriesquery) or die(_FATALERROR."<br>Query: $seriesquery<br>Error: (". $dbconnect->errno.") ". $dbconnect->error);
75 75
 	$serieslinks = array( );
76 76
 	while($s = dbassoc($seriesresult)) {
77 77
 		if(isset($action) && $action == "printable") $serieslinks[] = stripslashes($s['title']);
... ...
@@ -86,7 +86,7 @@ if(!defined("_CHARSET")) exit( );
86 86
 	$tpl->assign("ratingpics"   , ratingpics($stories['rating']) );
87 87
 	$tpl->assign("reviews"   , ($reviewsallowed ? "<a href=\""._BASEDIR."reviews.php?type=ST&amp;item=".$stories['sid']."\">"._REVIEWS."</a>" : "") );
88 88
 	if(isMEMBER && !empty($favorites)) 
89
-		$tpl->assign("addtofaves", "[<a href=\""._BASEDIR."member.php?action=favst&amp;add=1&amp;sid=".$stories['sid']."\">"._ADDSTORY2FAVES."</a>] [<a href=\""._BASEDIR."member.php?action=favau&amp;add=".$stories['uid'].(count($stories['coauthors']) ? ",".implode(",", array_keys($stories['coauthors'])) : "")."\">"._ADDAUTHOR2FAVES."</a>]");
89
+		$tpl->assign("addtofaves", "[<a href=\""._BASEDIR."user.php?action=favst&amp;add=1&amp;sid=".$stories['sid']."\">"._ADDSTORY2FAVES."</a>] [<a href=\""._BASEDIR."user.php?action=favau&amp;add=".$stories['uid'].(count($stories['coauthors']) ? ",".implode(",", array_keys($stories['coauthors'])) : "")."\">"._ADDAUTHOR2FAVES."</a>]");
90 90
 	
91 91
 	$numchapsquery = dbquery("SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$stories['sid']."' AND validated > 0");
92 92
 	list($chapters) = dbrow($numchapsquery);
... ...
@@ -63,15 +63,16 @@ function storyform($stories, $preview = 0){
63 63
 <div id='coauthorsDiv' name='coauthorsDiv' style='visibility: hidden;'></div>
64 64
 <iframe id='coauthorsshim' scr='' scrolling='no' frameborder='0' class='shim'></iframe>
65 65
 <div><label for='coauthorsSelected'>"._COAUTHORS.": <br /><select name='coauthorsSelected' id='coauthorsSelected' size='8' multiple='multiple' class='multiSelect' onclick='javascript: removeMember(\"coauthors\");'>";
66
-	$couids = array() ;
66
+	$array_couids = array() ;
67
+	$couids = "";
67 68
 	if(is_array($stories['coauthors']) && count($stories['coauthors'])) {
68 69
 		$coauths = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid FROM "._AUTHORTABLE." WHERE FIND_IN_SET("._UIDFIELD.", '".implode(",", $stories['coauthors'])."') > 0");
69 70
 		while($c = dbassoc($coauths)) {
70 71
 			if($c['uid'] == $stories['uid']) continue;
71 72
 			$output .= "<option label='".$c['penname']."' value='".$c['uid']."'>".$c['penname']."</option>";
72
-			$couids[] = $c['uid'];
73
+			$array_couids[] = $c['uid'];
73 74
 		}
74
-		$couids = implode(",", $couids);
75
+		$couids = implode(",", $array_couids);
75 76
 	}
76 77
 	$output .= "</select></label>
77 78
 		<input type='hidden' name='coauthors' id='coauthors' value='$couids'></div>";
... ...
@@ -1,4 +1,8 @@
1 1
 <?php
2
+ini_set('display_errors', 0);
3
+ini_set('display_startup_errors', 0);
4
+error_reporting(-1);
5
+
2 6
 define("_BASEDIR", "../");
3 7
 include("../config.php");
4 8
 include("../includes/dbfunctions.php");
... ...
@@ -26,14 +26,14 @@ function random_char($string)
26 26
 {
27 27
 	$length = strlen($string);
28 28
 	$position = mt_rand(0, $length - 1);
29
-	 return $string[$position];
29
+	return $string[$position];
30 30
 }
31 31
 
32
-function random_string ($charset_string, $length)
32
+function random_string($charset_string, $length)
33 33
 {
34 34
 	$return_string = random_char($charset_string);
35 35
 	for ($x = 1; $x < $length; $x++)
36
-	$return_string .= random_char($charset_string);
36
+		$return_string .= random_char($charset_string);
37 37
 	return $return_string;
38 38
 }
39 39
 
... ...
@@ -41,58 +41,84 @@ $randomcharset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUV
41 41
 
42 42
 
43 43
 // Strip out slashes if magic quotes isn't on.
44
-if(ini_get("magic_quotes_gpc")) {
45
-	foreach($_POST as $var => $val) {
46
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
44
+if (ini_get("magic_quotes_gpc"))
45
+{
46
+	foreach ($_POST as $var => $val)
47
+	{
48
+		$val = is_array($val) ? array_map('stripslashes', $val) : stripslashes($val);
47 49
 	}
48
-	foreach($_GET as $var => $val) {
49
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
50
+	foreach ($_GET as $var => $val)
51
+	{
52
+		$val = is_array($val) ? array_map('stripslashes', $val) : stripslashes($val);
50 53
 	}
51
-	foreach($_COOKIE as $var => $val) {
52
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
54
+	foreach ($_COOKIE as $var => $val)
55
+	{
56
+		$val = is_array($val) ? array_map('stripslashes', $val) : stripslashes($val);
53 57
 	}
54 58
 }
55 59
 
56 60
 define("_BASEDIR", "../");
57 61
 define("_CHARSET", "utf-8");
58 62
 Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
59
-header ("Pragma: no-cache"); 
60
-header ("Expires: 0"); 
63
+header("Pragma: no-cache");
64
+header("Expires: 0");
61 65
 
62 66
 $output = "";
63
-$language = "en";
67
+$language = "";
68
+
69
+include("../includes/class.TemplatePower.inc.php");
64 70
 
65
-include ("../includes/class.TemplatePower.inc.php");
71
+/* PHP 8 fix - other way is separated LANs to smaller files */
72
+$allowed_tags = '';
73
+$recentdays = 7;
74
+$sitename = "";  // this breaks stuff in PHP 8.2 
75
+$url = "";
76
+$multiplecats = '';
77
+$minwords = '';
78
+$maxwords = '';
79
+$action = '';
80
+$pwdsetting = '';
81
+$imagewidth = '';
82
+$imageheight = '';
83
+$version = '';
84
+$user = array();
85
+$user['penname'] = '';
86
+$user['email'] = '';
87
+$penname = '';
66 88
 
67
-if(!isset($_GET['step']) || $_GET['step'] == 2) {   
68
-	include ("../languages/en.php");
69
-	include ("../languages/en_admin.php");
70
-	include ("languages/en.php");
89
+if (!isset($_GET['step']) || $_GET['step'] == 2)
90
+{
91
+	include("../languages/en.php");
92
+	include("../languages/en_admin.php");
93
+	include("languages/en.php");
71 94
 }
72
-else if(isset($_REQUEST['language'])) {
95
+else if (isset($_REQUEST['language']))
96
+{
73 97
 	$language = $_REQUEST['language'];
74
- 	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
75
- 	else include ("../languages/en.php");
76
- 	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
77
- 	else include ("../languages/en_admin.php");
78
-	if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
79
-	else include ("languages/en.php");
98
+	if (file_exists("../languages/" . $language . ".php")) include("../languages/" . $language . ".php");
99
+	else include("../languages/en.php");
100
+	if (file_exists("../languages/" . $language . "_admin.php")) include("../languages/" . $language . "_admin.php");
101
+	else include("../languages/en_admin.php");
102
+	if (file_exists("languages/" . $language . ".php")) include("languages/" . $language . ".php");
103
+	else include("languages/en.php");
80 104
 }
81
-else {
82
-include("../config.php");
83
-$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
84
-$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
85
-list($tableprefix, $language) = dbrow($settings);
86
-define("TABLEPREFIX", $tableprefix);
87
-define("SITEKEY", $sitekey);
88
-if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
89
-else include ("../languages/en.php");
90
-if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
91
-else include ("../languages/en_admin.php");
92
-if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
93
-else include ("languages/en.php");
105
+else
106
+{
107
+	include("../config.php");
108
+	$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
109
+	$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
110
+	list($tableprefix, $language) = dbrow($settings);
111
+
112
+	define("TABLEPREFIX", $tableprefix);
113
+	define("SITEKEY", $sitekey);
114
+	if (file_exists("../languages/" . $language . ".php")) include("../languages/" . $language . ".php");
115
+	else include("../languages/en.php");
116
+	if (file_exists("../languages/" . $language . "_admin.php")) include("../languages/" . $language . "_admin.php");
117
+	else include("../languages/en_admin.php");
118
+	if (file_exists("languages/" . $language . ".php")) include("languages/" . $language . ".php");
119
+	else include("languages/en.php");
94 120
 }
95
-include(_BASEDIR."includes/corefunctions.php");
121
+include(_BASEDIR . "includes/corefunctions.php");
96 122
 
97 123
 //  So I don't have to keep updating the version number in 3 different files.
98 124
 include("../version.php");
... ...
@@ -136,294 +162,319 @@ a.pophelp:hover span{ /*the span will display just on :hover state*/
136 162
 </style>
137 163
 <link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
138 164
 
139
-$tpl = new TemplatePower( "../default_tpls/default.tpl" );
140
-$tpl->assignInclude( "header", "./../default_tpls/header.tpl" );
141
-$tpl->assignInclude( "footer", "./../default_tpls/footer.tpl" );
142
-$tpl->prepare( );
165
+$tpl = new TemplatePower("../default_tpls/default.tpl");
166
+$tpl->assignInclude("header", "./../default_tpls/header.tpl");
167
+$tpl->assignInclude("footer", "./../default_tpls/footer.tpl");
168
+$tpl->prepare();
143 169
 $tpl->newBlock("header");
144 170
 $tpl->assign("sitename", "eFiction $version Install");
145
-$tpl->gotoBlock( "_ROOT" );
171
+$tpl->gotoBlock("_ROOT");
146 172
 $tpl->newBlock("footer");
147
-$tpl->assign( "footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
148
-$tpl->gotoBlock( "_ROOT" );
173
+$tpl->assign("footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
174
+$tpl->gotoBlock("_ROOT");
149 175
 
150
-$step = isset($_GET["step"]) ? $_GET["step"] : "";
151
-switch($step) {
176
+if (!isset($_GET['step']))  $_GET['step'] = 0;
177
+switch ($_GET['step'])
178
+{
152 179
 	case "9":
153
-		if(isset($_POST['submit'])) {
180
+		if (isset($_POST['submit']))
181
+		{
154 182
 			$penname = descript($_POST['newpenname']);
155
-			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
156
-			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
157
-			if(!preg_match("/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/", $_POST['email'])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
158
-			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST['password']);
183
+			if ((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>" . _EMAILREQUIRED . " " . _TRYAGAIN . "</div>";
184
+			if ($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>" . _BADUSERNAME . " " . _TRYAGAIN . "</div>";
185
+			if (!preg_match("/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/", $_POST['email'])) $fail = "<div style='text-align: center;'>" . _INVALIDEMAIL . " " . _TRYAGAIN . "</div>";
186
+			if ($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST['password']);
159 187
 			else $fail =  write_message(_PASSWORDTWICE);
160
-			if(!isset($fail)) {
161
-				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '".$_POST['email']."', '$encryptpassword', now( ))");
162
-				define("USERUID", dbinsertid( ));
163
-				$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
188
+			if (!isset($fail))
189
+			{
190
+				$result = dbquery("INSERT INTO " . $tableprefix . "fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '" . $_POST['email'] . "', '$encryptpassword', '" . time() . "')");
191
+				define("USERUID", dbinsertid());
192
+				$skinquery = dbquery("SELECT skin FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . SITEKEY . "'");
164 193
 				list($skin) = dbrow($skinquery);
165
-				$result2 = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('".USERUID."', '$skin', '1')");
166
-				if($result && $result2) $output .= write_message(_ACTIONSUCCESSFUL."<br /><br />Installation complete!  <a href='../member.php?action=login'>Log in</a> to your site and go to the Admin area to configure your archive. <strong>Note:</strong> Please delete the install/ folder!");
194
+				$result2 = dbquery("INSERT INTO " . $tableprefix . "fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('" . USERUID . "', '$skin', '1')");
195
+				if ($result && $result2) $output .= write_message(_ACTIONSUCCESSFUL . "<br /><br />Installation complete!  <a href='../user.php?action=login'>Log in</a> to your site and go to the Admin area to configure your archive. <strong>Note:</strong> Please delete the install/ folder!");
167 196
 			}
168 197
 			else $output .= $fail;
169 198
 		}
170
-		else {
171
-            if(!isset($user['penname'])) $user['penname'] = '';
172
-            if(!isset($user['email'])) $user['email'] = '';
173
-			$output .= "<div id='pagetitle'>"._ADMINACCT."</div><form method=\"POST\" class='tblborder' style='margin: 1em auto; width: 400px;' enctype=\"multipart/form-data\" action=\"install.php?step=9\">
174
-			<div class='row'><label for='newpenname'>"._PENNAME.":</label> <INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"$user[penname]\"></div>
175
-		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"$user[email]\" maxlength=\"200\"></div>
176
-			<div class='row'><label for='password'>"._PASSWORD.":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></div> 
177
-			<div class='row'><label for='password2'>"._PASSWORD2.":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></div>
178
-			<div style='text-align: center;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div></form>";	
199
+		else
200
+		{
201
+			$output .= "<div id='pagetitle'>" . _ADMINACCT . "</div><form method=\"POST\" class='tblborder' style='margin: 1em auto; width: 400px;' enctype=\"multipart/form-data\" action=\"install.php?step=9\">
202
+			<div class='row'><label for='newpenname'>" . _PENNAME . ":</label> 
203
+			<input name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"" . $user['penname'] . "\"></div>
204
+		 	<div class='row'><label for='email'>" . _EMAIL . ":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"" . $user['email'] .
205
+				"\" maxlength=\"200\"></div>
206
+			<div class='row'><label for='password'>" . _PASSWORD . ":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></div> 
207
+			<div class='row'><label for='password2'>" . _PASSWORD2 . ":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></div>
208
+			<div style='text-align: center;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div></form>";
179 209
 		}
180
-	break;
210
+		break;
181 211
 
182 212
 	case "8":
183
-		$output .= "<div id='pagetitle'>"._AUTHORFIELDS."</div>";
184
-		if(isset($_GET['install'])) {
185
-			if($_GET['install'] == "automatic") {
186
-				$fields[] = array('4','lj','Live Journal','http://{info}.livejournal.com','','','0');
187
-				$fields[] = array('1','website','Web Site','','','','1');
188
-				$fields[] = array('5','AOL','AIM','','$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";','$thisfield = "<img src=\"http://big.oscar.aol.com/".$field[\'info\']."?on_url=$url/images/aim.gif&off_url=$url/images/aim.gif\"> <a href=\"aim:goim?{aol}ScreenName=".$field[\'info\']."\">".format_email($field[\'info\'])."</a>";','1');
189
-				$fields[] = array('5','ICQ','ICQ','','$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";','$thisfield = "<img src=\"http://status.icq.com/online.gif?icq=".$field[\'info\']."&img=5\"> ".$field[\'info\'];','1');
190
-				$fields[] = array('5','MSN','MSN IM','','$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";','$thisfield = "<img src=\"images/msntalk.gif\" alt=\""._MSN."\"> ".format_email($field[\'info\']);','1');
191
-				$fields[] = array('5','Yahoo','Yahoo IM','','$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";','$thisfield = "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$field[\'info\']."&.src=pg\"><img border=\'0\' src=\"http://opi.yahoo.com/online?u=".$field[\'info\']."&m=g&t=1\"> ".format_email($field[\'info\'])."</a>";','1');
192
-				$fields[] = array('4','da','Deviant Art','http://{info}.deviantart.com','','','0');
193
-				$fields[] = array('3','betareader','Beta-reader','','','','1');
194
-				$fields[] = array('4','dj','DeadJournal','http://{info}.deadjournal.com/','','','0');
195
-				$fields[] = array('4','xanga','Xanga','http://www.xanga.com/{info}','','','0');
213
+		$output .= "<div id='pagetitle'>" . _AUTHORFIELDS . "</div>";
214
+		if (isset($_GET['install']))
215
+		{
216
+			if ($_GET['install'] == "automatic")
217
+			{
218
+				$fields[] = array('4', 'lj', 'Live Journal', 'http://{info}.livejournal.com', '', '', '0');
219
+				$fields[] = array('1', 'website', 'Web Site', '', '', '', '1');
220
+				$fields[] = array('5', 'AOL', 'AIM', '', '$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";', '$thisfield = "<img src=\"http://big.oscar.aol.com/".$field[\'info\']."?on_url=$url/images/aim.gif&off_url=$url/images/aim.gif\"> <a href=\"aim:goim?{aol}ScreenName=".$field[\'info\']."\">".format_email($field[\'info\'])."</a>";', '1');
221
+				$fields[] = array('5', 'ICQ', 'ICQ', '', '$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";', '$thisfield = "<img src=\"http://status.icq.com/online.gif?icq=".$field[\'info\']."&img=5\"> ".$field[\'info\'];', '1');
222
+				$fields[] = array('5', 'MSN', 'MSN IM', '', '$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";', '$thisfield = "<img src=\"images/msntalk.gif\" alt=\""._MSN."\"> ".format_email($field[\'info\']);', '1');
223
+				$fields[] = array('5', 'Yahoo', 'Yahoo IM', '', '$output .= "<div><label for=\'AOL\'>".$field[\'field_title\'].":</label><INPUT type=\'text\' class=\'textbox\'  name=\'af_".$field[\'field_name\']."\' maxlength=\'40\' value=\'".(!empty($user[\'af_\'.$field[\'field_id\']]) ? $user[\'af_\'.$field[\'field_id\']] : "")."\' size=\'20\'></div>";', '$thisfield = "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$field[\'info\']."&.src=pg\"><img border=\'0\' src=\"http://opi.yahoo.com/online?u=".$field[\'info\']."&m=g&t=1\"> ".format_email($field[\'info\'])."</a>";', '1');
224
+				$fields[] = array('4', 'da', 'Deviant Art', 'http://{info}.deviantart.com', '', '', '0');
225
+				$fields[] = array('3', 'betareader', 'Beta-reader', '', '', '', '1');
226
+				$fields[] = array('4', 'dj', 'DeadJournal', 'http://{info}.deadjournal.com/', '', '', '0');
227
+				$fields[] = array('4', 'xanga', 'Xanga', 'http://www.xanga.com/{info}', '', '', '0');
196 228
 				$fields[] = array('2', 'gender', 'Gender', 'male|#|female|#|undisclosed', '', '', 0);
197
-				$fields[] = array('4','myspace','MySpace','http://www.myspace.com/{info}','','','0');
198
-		
199
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._FIELD."</th><th>"._RESULT."</th></tr>";
200
-				foreach($fields as $field) {
201
-					$f = dbquery("INSERT INTO `".$tableprefix."fanfiction_authorfields` (`field_type`, `field_name`, `field_title`, `field_options`, `field_code_in`, `field_code_out`, `field_on`) VALUES('".$field[0]."', '".$field[1]."','".$field[2]."','".escapestring($field[3])."','".escapestring($field[4])."','".escapestring($field[5])."','".$field[6]."');");
202
-					$output .= "<tr><td>".$field[2]."</td><td align='center'>" . ($f ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
229
+				$fields[] = array('4', 'myspace', 'MySpace', 'http://www.myspace.com/{info}', '', '', '0');
230
+
231
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>" . _FIELD . "</th><th>" . _RESULT . "</th></tr>";
232
+				foreach ($fields as $field)
233
+				{
234
+					$f = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_authorfields` (`field_type`, `field_name`, `field_title`, `field_options`, `field_code_in`, `field_code_out`, `field_on`) VALUES('" . $field[0] . "', '" . $field[1] . "','" . $field[2] . "','" . escapestring($field[3]) . "','" . escapestring($field[4]) . "','" . escapestring($field[5]) . "','" . $field[6] . "');");
235
+					$output .= "<tr><td>" . $field[2] . "</td><td align='center'>" . ($f ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
203 236
 				}
204 237
 				$output .= "</table>";
205
-				$output .= write_message(_FIELDAUTOFAIL."<br /><br /> <a href='install.php?step=9'>"._CONTINUE."</a>");
238
+				$output .= write_message(_FIELDAUTOFAIL . "<br /><br /> <a href='install.php?step=9'>" . _CONTINUE . "</a>");
206 239
 			}
207
-			else {
208
-				$output .= write_message(_FIELDMANUAL."<br /><br /><a href='install.php?step=9'>"._CONTINUE."</a>");
240
+			else
241
+			{
242
+				$output .= write_message(_FIELDMANUAL . "<br /><br /><a href='install.php?step=9'>" . _CONTINUE . "</a>");
209 243
 			}
210 244
 		}
211
-		else $output .= write_message(_FIELDDATAINFO."<br /><br /><a href='install.php?step=8&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=8&amp;install=manual'>"._MANUAL2."</a>");
212
-	break;
245
+		else $output .= write_message(_FIELDDATAINFO . "<br /><br /><a href='install.php?step=8&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=8&amp;install=manual'>" . _MANUAL2 . "</a>");
246
+		break;
213 247
 	case "7":
214
-		$output .= "<div id='pagetitle'>"._MESSAGEDATA."</div>";
215
-		if(isset($_GET['install'])) {
216
-			if($_GET['install'] == "automatic") {
217
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._MESSAGE."</th><th>"._RESULT."</th></tr>";
218
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (1, 'welcome', '', 'This is your welcome message. It appears on the index page. Include it in your .tpl files with {welcome}.');");
219
-				$output .= "<tr><td>Welcome</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
220
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (2, 'copyright', '', 'This is your sample copyright footer.  Include it in your footer.tpl with <b>{footer}</b><br />\r\n<u>Disclaimer:</u>  All publicly recognizable characters, settings, etc. are the property of their respective owners.  The original characters and plot are the property of the author.  No money is being made from this work.  No copyright infringement is intended.\r\n');");
221
-				$output .= "<tr><td>Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
222
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (3, 'help', 'Help', '<h3>FAQ</h3><p><strong>I forgot my password!&nbsp; What do I do now?</strong></p><p>To recover a lost password, <a href=\"member.php?action=lostpassword\">click here</a> and enter the e-mail address with which you registered.&nbsp; Your password will be sent to you shortly.</p><p><strong>What kinds of stories are allowed?</strong></p><p>See our <a href=\"submission.php\">Submission Rules.</a></p><p><strong>How do I contact the site administrators?</strong></p><p>You can e-mail us via our <a href=\"contact.php\">contact form.</a></p><p><strong>How do I submit stories?</strong></p><p>If you have not already done so, please <a href=\"member.php?action=newaccount\">register for an account</a>. Once you\'ve logged in, click on <a href=\"member.php\">Account Information</a> and choose <a href=\"stories.php?action=newstory\">Add Story</a>.&nbsp; The form presented there will allow you to submit your story.</p><p><strong>What are the ratings used on the site?</strong></p><p>We use the ratings system from <a href=\"http://www.fictionratings.com/\">www.fictionratings.com</a>.</p><p><strong>What are the story classifications?</strong></p><p>Stories are classified by categories, genres, and warnings.</p>');");
223
-				$output .= "<tr><td>Help</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
224
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (4, 'nothankyou', 'Submission Rejection', 'Your recent submission of \"{storytitle} : {chaptertitle}\" to {sitename} did not meet our requirements for submission.  Please review our {rules}.<br /><br />\r\n\r\n{adminname}');");
225
-				$output .= "<tr><td>Rejection Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
226
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (5, 'printercopyright', '', '<u>Disclaimer:</u> All publicly recognizable characters and settings are the property of their respective owners. The original characters and plot are the property of the author. No money is being made from this work. No copyright infringement is intended.');");
227
-				$output .= "<tr><td>Printable Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
228
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (6, 'rules', 'Submission Rules', '<p align=\"center\"><strong>Submission Rules</strong></p>\r\n<ol>\r\n  <li>All submissions must be accompanied by a complete disclaimer. If a \r\n  suitable disclaimer is not included, the site administrators reserve the right \r\n  to add a disclaimer.&nbsp; Repeat offenders may be subject to further action \r\n  up to and including removal of stories and account.\r\n<div class=\"tblborder\" style=\"width: 400px; margin: 1em auto;\">\r\n<div style=\"background: #000; color: #FFF; padding: 5px; text-align: center; font-weight: bold;\">Sample Disclaimer</div>\r\n<div class=\"tblborder\" style=\"padding: 5px;\"><span style=\"text-decoration: underline;\">Disclaimer:</span>  All publicly recognizable characters, settings, etc. are the property of their respective owners.  The original characters and plot are the property of the author.&nbsp; \r\n        The author is in no way associated with the owners, creators, or producers of any media franchise.&nbsp;  No copyright infringement is intended.</div>\r\n  </div>\r\n  </li>\r\n  <li>Stories must be submitted to the proper category. &nbsp;If there is an appropriate sub-category, <strong>DO NOT</strong> add your story to the main category.&nbsp; The submission \r\n  form allows you to choose multiple categories for your story, and we worked very hard to add that functionality for you.&nbsp;&nbsp; <u><strong>So please \r\n  do NOT add your story multiple times!</strong></u></li>\r\n  <li>Titles and summaries must be kid friendly.&nbsp; No exceptions.&nbsp; </li>\r\n  <li>&quot;Please read&quot;, &quot;Untitled&quot;, etc. are not acceptable titles or summaries.</li>\r\n  <li>A number of authors have requested that fans refrain from writing fan \r\n  fiction based on their work.&nbsp; Therefore submissions will not be \r\n  accepted based on the works of P.N. Elrod, Raymond Feist, Terry Goodkind, \r\n  Laurell K. Hamilton, Anne McCaffrey, Robin McKinley, Irene Radford, Anne Rice, \r\n  and Nora Roberts/J.D. Robb.&nbsp; </li>\r\n  <li>Actor/actress stories are not permitted...not even if they\'re visiting an \r\n  alternate reality.</li>\r\n  <li>Correct grammar and spelling are expected of all stories submitted to this \r\n  site.&nbsp; The site administrators are not grammar Nazis.&nbsp; However, the \r\n  site administrators reserve the right to request corrections in submissions \r\n  with a multitude of grammar and/or spelling errors.&nbsp; If such a request is \r\n  ignored, the story will be deleted.</li>\r\n  <li>All stories must be rated correctly and have the appropriate warnings.&nbsp; \r\n  All adult rated stories are expected to have warnings.&nbsp; After all, they \r\n  wouldn\'t have that rating if there wasn\'t something to be warned about!&nbsp; The site administrators recognize \r\n  that there is an audience for these stories, but please respect those who do \r\n  not wish to read them by labeling them appropriately.&nbsp;\r\n  <u><strong>Please note: Stories containing adults having sex with minors are strictly forbidden.</strong></u>&nbsp; </li>\r\n  <li>Stories with multiple chapters should be archived as such and <span style=\"font-weight: bold; text-decoration: underline;\">NEVER</span> as \r\n  separate stories.&nbsp; Upload the first chapter of your story, then go to <a href=\"stories.php?action=viewstories\">Manage Stories</a> in \r\nyour account to add additional chapters.  If you have trouble with this, please contact the site administrator or ask a \r\n  friend to help you.</li>\r\n  <li>As much as possible, spoiler warnings are expected on all stories.  For categories with serialized content, such as series of books or television series, \r\n  spoilers are <strong>mandatory</strong> for the current season and/or most recent part.  An appropriate spoiler warning to place in your summary would be: Spoilers for <u>Star Trek II: The Wrath of Khan.</u> \r\n  <strong>DO NOT</strong> do anything like this: <u>Spoilers for the one where Spock dies.</u></li>\r\n</ol>\r\n  <p>Submissions found to be in violation of these rules may be removed and the \r\n  author\'s account suspended at the discretion of the site administrators and/or \r\n  moderators.&nbsp; The site administrators reserve the right to modify these \r\n  rules as needed.</p>');");
229
-				$output .= "<tr><td>Submission Rules</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
230
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (7, 'thankyou', '{sitename} Submission Acceptance', 'Thanks for your submission.');");
231
-				$output .= "<tr><td>Acceptance Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
232
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (8, 'tos', 'Terms of Service', 'This is the Terms of Service for your site.  It will be displayed when a new member registers to the site.');");
233
-				$output .= "<tr><td>Terms of Service</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
234
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (9, 'maintenance', 'Site Maintenance', '<p style=\"text-align: center;\">This site is currently undergoing maintenance.  Please check back soon.  Thank you.</p>');");
235
-				$output .= "<tr><td>Site Maintenance</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
248
+		$output .= "<div id='pagetitle'>" . _MESSAGEDATA . "</div>";
249
+		if (isset($_GET['install']))
250
+		{
251
+			if ($_GET['install'] == "automatic")
252
+			{
253
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>" . _MESSAGE . "</th><th>" . _RESULT . "</th></tr>";
254
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (1, 'welcome', '', 'This is your welcome message. It appears on the index page. Include it in your .tpl files with {welcome}.');");
255
+				$output .= "<tr><td>Welcome</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
256
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (2, 'copyright', '', 'This is your sample copyright footer.  Include it in your footer.tpl with <b>{footer}</b><br />\r\n<u>Disclaimer:</u>  All publicly recognizable characters, settings, etc. are the property of their respective owners.  The original characters and plot are the property of the author.  No money is being made from this work.  No copyright infringement is intended.\r\n');");
257
+				$output .= "<tr><td>Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
258
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (3, 'help', 'Help', '<h3>FAQ</h3><p><strong>I forgot my password!&nbsp; What do I do now?</strong></p><p>To recover a lost password, <a href=\"user.php?action=lostpassword\">click here</a> and enter the e-mail address with which you registered.&nbsp; Your password will be sent to you shortly.</p><p><strong>What kinds of stories are allowed?</strong></p><p>See our <a href=\"submission.php\">Submission Rules.</a></p><p><strong>How do I contact the site administrators?</strong></p><p>You can e-mail us via our <a href=\"contact.php\">contact form.</a></p><p><strong>How do I submit stories?</strong></p><p>If you have not already done so, please <a href=\"user.php?action=newaccount\">register for an account</a>. Once you\'ve logged in, click on <a href=\"user.php\">Account Information</a> and choose <a href=\"stories.php?action=newstory\">Add Story</a>.&nbsp; The form presented there will allow you to submit your story.</p><p><strong>What are the ratings used on the site?</strong></p><p>We use the ratings system from <a href=\"http://www.fictionratings.com/\">www.fictionratings.com</a>.</p><p><strong>What are the story classifications?</strong></p><p>Stories are classified by categories, genres, and warnings.</p>');");
259
+				$output .= "<tr><td>Help</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
260
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (4, 'nothankyou', 'Submission Rejection', 'Your recent submission of \"{storytitle} : {chaptertitle}\" to {sitename} did not meet our requirements for submission.  Please review our {rules}.<br /><br />\r\n\r\n{adminname}');");
261
+				$output .= "<tr><td>Rejection Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
262
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (5, 'printercopyright', '', '<u>Disclaimer:</u> All publicly recognizable characters and settings are the property of their respective owners. The original characters and plot are the property of the author. No money is being made from this work. No copyright infringement is intended.');");
263
+				$output .= "<tr><td>Printable Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
264
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (6, 'rules', 'Submission Rules', '<p align=\"center\"><strong>Submission Rules</strong></p>\r\n<ol>\r\n  <li>All submissions must be accompanied by a complete disclaimer. If a \r\n  suitable disclaimer is not included, the site administrators reserve the right \r\n  to add a disclaimer.&nbsp; Repeat offenders may be subject to further action \r\n  up to and including removal of stories and account.\r\n<div class=\"tblborder\" style=\"width: 400px; margin: 1em auto;\">\r\n<div style=\"background: #000; color: #FFF; padding: 5px; text-align: center; font-weight: bold;\">Sample Disclaimer</div>\r\n<div class=\"tblborder\" style=\"padding: 5px;\"><span style=\"text-decoration: underline;\">Disclaimer:</span>  All publicly recognizable characters, settings, etc. are the property of their respective owners.  The original characters and plot are the property of the author.&nbsp; \r\n        The author is in no way associated with the owners, creators, or producers of any media franchise.&nbsp;  No copyright infringement is intended.</div>\r\n  </div>\r\n  </li>\r\n  <li>Stories must be submitted to the proper category. &nbsp;If there is an appropriate sub-category, <strong>DO NOT</strong> add your story to the main category.&nbsp; The submission \r\n  form allows you to choose multiple categories for your story, and we worked very hard to add that functionality for you.&nbsp;&nbsp; <u><strong>So please \r\n  do NOT add your story multiple times!</strong></u></li>\r\n  <li>Titles and summaries must be kid friendly.&nbsp; No exceptions.&nbsp; </li>\r\n  <li>&quot;Please read&quot;, &quot;Untitled&quot;, etc. are not acceptable titles or summaries.</li>\r\n  <li>A number of authors have requested that fans refrain from writing fan \r\n  fiction based on their work.&nbsp; Therefore submissions will not be \r\n  accepted based on the works of P.N. Elrod, Raymond Feist, Terry Goodkind, \r\n  Laurell K. Hamilton, Anne McCaffrey, Robin McKinley, Irene Radford, Anne Rice, \r\n  and Nora Roberts/J.D. Robb.&nbsp; </li>\r\n  <li>Actor/actress stories are not permitted...not even if they\'re visiting an \r\n  alternate reality.</li>\r\n  <li>Correct grammar and spelling are expected of all stories submitted to this \r\n  site.&nbsp; The site administrators are not grammar Nazis.&nbsp; However, the \r\n  site administrators reserve the right to request corrections in submissions \r\n  with a multitude of grammar and/or spelling errors.&nbsp; If such a request is \r\n  ignored, the story will be deleted.</li>\r\n  <li>All stories must be rated correctly and have the appropriate warnings.&nbsp; \r\n  All adult rated stories are expected to have warnings.&nbsp; After all, they \r\n  wouldn\'t have that rating if there wasn\'t something to be warned about!&nbsp; The site administrators recognize \r\n  that there is an audience for these stories, but please respect those who do \r\n  not wish to read them by labeling them appropriately.&nbsp;\r\n  <u><strong>Please note: Stories containing adults having sex with minors are strictly forbidden.</strong></u>&nbsp; </li>\r\n  <li>Stories with multiple chapters should be archived as such and <span style=\"font-weight: bold; text-decoration: underline;\">NEVER</span> as \r\n  separate stories.&nbsp; Upload the first chapter of your story, then go to <a href=\"stories.php?action=viewstories\">Manage Stories</a> in \r\nyour account to add additional chapters.  If you have trouble with this, please contact the site administrator or ask a \r\n  friend to help you.</li>\r\n  <li>As much as possible, spoiler warnings are expected on all stories.  For categories with serialized content, such as series of books or television series, \r\n  spoilers are <strong>mandatory</strong> for the current season and/or most recent part.  An appropriate spoiler warning to place in your summary would be: Spoilers for <u>Star Trek II: The Wrath of Khan.</u> \r\n  <strong>DO NOT</strong> do anything like this: <u>Spoilers for the one where Spock dies.</u></li>\r\n</ol>\r\n  <p>Submissions found to be in violation of these rules may be removed and the \r\n  author\'s account suspended at the discretion of the site administrators and/or \r\n  moderators.&nbsp; The site administrators reserve the right to modify these \r\n  rules as needed.</p>');");
265
+				$output .= "<tr><td>Submission Rules</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
266
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (7, 'thankyou', '{sitename} Submission Acceptance', 'Thanks for your submission.');");
267
+				$output .= "<tr><td>Acceptance Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
268
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (8, 'tos', 'Terms of Service', 'This is the Terms of Service for your site.  It will be displayed when a new member registers to the site.');");
269
+				$output .= "<tr><td>Terms of Service</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
270
+				$msg = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_messages` VALUES (9, 'maintenance', 'Site Maintenance', '<p style=\"text-align: center;\">This site is currently undergoing maintenance.  Please check back soon.  Thank you.</p>');");
271
+				$output .= "<tr><td>Site Maintenance</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
236 272
 				$output .= "</table>";
237
-				$output .= write_message(_MESSAGEAUTOFAILUPGRADE."<br /><br /> <a href='install.php?step=8'>"._CONTINUE."</a>");
273
+				$output .= write_message(_MESSAGEAUTOFAILUPGRADE . "<br /><br /> <a href='install.php?step=8'>" . _CONTINUE . "</a>");
238 274
 			}
239
-			else {
240
-				$output .= write_message(_MESSAGEMANUAL."<br /><br /><a href='install.php?step=8'>"._CONTINUE."</a>");
275
+			else
276
+			{
277
+				$output .= write_message(_MESSAGEMANUAL . "<br /><br /><a href='install.php?step=8'>" . _CONTINUE . "</a>");
241 278
 			}
242 279
 		}
243
-		else $output .= write_message(_MESSAGEDATANEW."<br /><br /><a href='install.php?step=7&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=7&amp;install=manual'>"._MANUAL2."</a>");
280
+		else $output .= write_message(_MESSAGEDATANEW . "<br /><br /><a href='install.php?step=7&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=7&amp;install=manual'>" . _MANUAL2 . "</a>");
244 281
 
245
-	break;
282
+		break;
246 283
 	case "6":
247
-		$output .= "<div id='pagetitle'>"._BLOCKDATA."</div>";
248
-		if(isset($_GET['install'])) {
249
-			if($_GET['install'] == "automatic") {
284
+		$output .= "<div id='pagetitle'>" . _BLOCKDATA . "</div>";
285
+		if (isset($_GET['install']))
286
+		{
287
+			if ($_GET['install'] == "automatic")
288
+			{
250 289
 				$blocklist = array(
251
-					array("categories","Categories","categories/categories.php","1",""),
252
-					array("featured","Featured Stories","featured/featured.php","1",""),
253
-					array("info","Site Info","info/info.php","2",""),
254
-					array("login","Log In","login/login.php","1",""),
255
-					array("menu","Main Menu","menu/menu.php","1",""),
256
-					array("random","Random Story","random/random.php","2",""),
257
-					array("recent","Most Recent","recent/recent.php","2","a:1:{s:3:\"num\";s:1:\"1\";}"),
258
-					array("skinchange","Skin Change","skinchange/skinchange.php","1",""),
259
-					array("news","Site News","news/news.php","1","a:1:{s:3:\"num\";s:1:\"1\";}")
290
+					array("categories", "Categories", "categories/categories.php", "1", ""),
291
+					array("featured", "Featured Stories", "featured/featured.php", "1", ""),
292
+					array("info", "Site Info", "info/info.php", "2", ""),
293
+					array("login", "Log In", "login/login.php", "1", ""),
294
+					array("menu", "Main Menu", "menu/menu.php", "1", ""),
295
+					array("random", "Random Story", "random/random.php", "2", ""),
296
+					array("recent", "Most Recent", "recent/recent.php", "2", "a:1:{s:3:\"num\";s:1:\"1\";}"),
297
+					array("skinchange", "Skin Change", "skinchange/skinchange.php", "1", ""),
298
+					array("news", "Site News", "news/news.php", "1", "a:1:{s:3:\"num\";s:1:\"1\";}")
260 299
 				);
261
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._BLOCK."</th><th>"._RESULT."</th></tr>";
262
-				foreach($blocklist as $block) {
263
-					$b = dbquery("INSERT INTO `".$tableprefix."fanfiction_blocks` (`block_name`, `block_title`, `block_file`, `block_status`, `block_variables`) VALUES('".$block[0]."', '".$block[1]."', '".$block[2]."', '".$block[3]."', '".escapestring($block[4])."');");
264
-					$output .= "<tr><td>".$block[1]."</td><td align='center'>" . ($b ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
300
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>" . _BLOCK . "</th><th>" . _RESULT . "</th></tr>";
301
+				foreach ($blocklist as $block)
302
+				{
303
+					$b = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_blocks` (`block_name`, `block_title`, `block_file`, `block_status`, `block_variables`) VALUES('" . $block[0] . "', '" . $block[1] . "', '" . $block[2] . "', '" . $block[3] . "', '" . escapestring($block[4]) . "');");
304
+					$output .= "<tr><td>" . $block[1] . "</td><td align='center'>" . ($b ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
265 305
 				}
266 306
 				$output .= "</table>";
267
-				$output .= write_message(_BLOCKDATAFAILUPGRADE."<br /><br /><a href='install.php?step=7'>"._CONTINUE."</a>");
307
+				$output .= write_message(_BLOCKDATAFAILUPGRADE . "<br /><br /><a href='install.php?step=7'>" . _CONTINUE . "</a>");
268 308
 			}
269
-			else {
270
-				$output .= write_message(_BLOCKDATAMANUAL."<br /><br /><a href='install.php?step=6'>"._CONTINUE."</a>");
309
+			else
310
+			{
311
+				$output .= write_message(_BLOCKDATAMANUAL . "<br /><br /><a href='install.php?step=6'>" . _CONTINUE . "</a>");
271 312
 			}
272 313
 		}
273
-		else $output .= write_message(_BLOCKDATANEW."<br /><br /><a href='install.php?step=6&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=6&amp;install=manual'>"._MANUAL2."</a>");
274
-	break;
314
+		else $output .= write_message(_BLOCKDATANEW . "<br /><br /><a href='install.php?step=6&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=6&amp;install=manual'>" . _MANUAL2 . "</a>");
315
+		break;
275 316
 	case "5":
276
-		$output .= "<div id='pagetitle'>"._LINKDATA."</div>";
277
-		if(isset($_GET['install'])) {
278
-			if($_GET['install'] == "automatic") {
317
+		$output .= "<div id='pagetitle'>" . _LINKDATA . "</div>";
318
+		if (isset($_GET['install']))
319
+		{
320
+			if ($_GET['install'] == "automatic")
321
+			{
279 322
 				$pagelist = array(
280
-					array("home","Home","index.php","0","0"),
281
-					array("recent","Most Recent","browse.php?type=recent","0","0"),
282
-					array("login","Login","member.php?action=login","0","0"),
283
-					array("adminarea","Admin","admin.php","0","2"),
284
-					array("logout","Logout","member.php?action=logout","0","1"),
285
-					array("featured","Featured Stories","browse.php?type=featured","0","0"),
286
-					array("catslink","Categories","browse.php?type=categories","0","0"),
287
-					array("members","Members","authors.php?action=list","0","0"),
288
-					array("authors","Authors","authors.php?list=authors","0","0"),
289
-					array("help","Help","viewpage.php?page=help","0","0"),
290
-					array("search","Search","search.php","0","0"),
291
-					array("series","Series","browse.php?type=series","0","0"),
292
-					array("tens","Top Tens","toplists.php","0","0"),
293
-					array("challenges","Challenges","modules/challenges/challenges.php","0","0"),
294
-					array("contactus","Contact Us","contact.php","0","0"),
295
-					array("rules","Rules","viewpage.php?page=rules","0","0"),
296
-					array("tos","Terms of Service","viewpage.php?page=tos","0","0"),
297
-					array("rss","<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>","rss.php","0","0"),
298
-					array("login","Account Info","member.php","0","1"),
299
-					array("titles","Titles","browse.php?type=titles","0","0"),
300
-					array("register","Register","member.php?action=register","0","0"),
301
-					array("lostpassword","Lost Password","member.php?action=lostpassword","0","0"),
302
-					array("newsarchive","News Archive","news.php","0","0"),
303
-					array("browse","Browse","browse.php","0","0"),
304
-					array("charslink", "Characters", "browse.php?type=characters","0","0"),
323
+					array("home", "Home", "index.php", "0", "0"),
324
+					array("recent", "Most Recent", "browse.php?type=recent", "0", "0"),
325
+					array("login", "Login", "user.php?action=login", "0", "0"),
326
+					array("adminarea", "Admin", "admin.php", "0", "2"),
327
+					array("logout", "Logout", "user.php?action=logout", "0", "1"),
328
+					array("featured", "Featured Stories", "browse.php?type=featured", "0", "0"),
329
+					array("catslink", "Categories", "browse.php?type=categories", "0", "0"),
330
+					array("members", "Members", "authors.php?action=list", "0", "0"),
331
+					array("authors", "Authors", "authors.php?list=authors", "0", "0"),
332
+					array("help", "Help", "viewpage.php?page=help", "0", "0"),
333
+					array("search", "Search", "search.php", "0", "0"),
334
+					array("series", "Series", "browse.php?type=series", "0", "0"),
335
+					array("tens", "Top Tens", "toplists.php", "0", "0"),
336
+					array("challenges", "Challenges", "modules/challenges/challenges.php", "0", "0"),
337
+					array("contactus", "Contact Us", "contact.php", "0", "0"),
338
+					array("rules", "Rules", "viewpage.php?page=rules", "0", "0"),
339
+					array("tos", "Terms of Service", "viewpage.php?page=tos", "0", "0"),
340
+					array("rss", "<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>", "rss.php", "0", "0"),
341
+					array("login", "Account Info", "user.php", "0", "1"),
342
+					array("titles", "Titles", "browse.php?type=titles", "0", "0"),
343
+					array("register", "Register", "user.php?action=register", "0", "0"),
344
+					array("lostpassword", "Lost Password", "user.php?action=lostpassword", "0", "0"),
345
+					array("newsarchive", "News Archive", "news.php", "0", "0"),
346
+					array("browse", "Browse", "browse.php", "0", "0"),
347
+					array("charslink", "Characters", "browse.php?type=characters", "0", "0"),
305 348
 					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
306 349
 				);
307
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._PAGE."</th><th>"._RESULT."</th></tr>";
308
-				foreach($pagelist as $page) {
309
-					$pages = dbquery("INSERT INTO `".$tableprefix."fanfiction_pagelinks` (`link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES ('".$page[0]."', '".$page[1]."', '".$page[2]."', '".$page[3]."', '".$page[4]."');");
310
-					$output .= "<tr><td>".stripslashes($page[1])."</td><td align='center'>" . ($pages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
350
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>" . _PAGE . "</th><th>" . _RESULT . "</th></tr>";
351
+				foreach ($pagelist as $page)
352
+				{
353
+					$pages = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_pagelinks` (`link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES ('" . $page[0] . "', '" . $page[1] . "', '" . $page[2] . "', '" . $page[3] . "', '" . $page[4] . "');");
354
+					$output .= "<tr><td>" . stripslashes($page[1]) . "</td><td align='center'>" . ($pages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
311 355
 				}
312 356
 
313 357
 				$output .= "</table>";
314
-				$output .= write_message(_LINKAUTOFAIL."<br /><br /> <a href='install.php?step=6'>"._CONTINUE."</a>");
358
+				$output .= write_message(_LINKAUTOFAIL . "<br /><br /> <a href='install.php?step=6'>" . _CONTINUE . "</a>");
315 359
 			}
316
-			else {
317
-				$output .= write_message(_LINKMANUAL."<br /><br /><a href='install.php?step=5'>"._CONTINUE."</a>");
360
+			else
361
+			{
362
+				$output .= write_message(_LINKMANUAL . "<br /><br /><a href='install.php?step=5'>" . _CONTINUE . "</a>");
318 363
 			}
319 364
 		}
320
-		else $output .= write_message(_LINKDATAINFO."<br /><br />"._LINKSETUP." <a href='install.php?step=5&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=5&amp;install=manual'>"._MANUAL2."</a>");
321
-	break;
365
+		else $output .= write_message(_LINKDATAINFO . "<br /><br />" . _LINKSETUP . " <a href='install.php?step=5&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=5&amp;install=manual'>" . _MANUAL2 . "</a>");
366
+		break;
322 367
 	case "4":
323
-		$output .= "<div id='pagetitle'>"._PANELDATA."</div>";
324
-		if(isset($_GET['install'])){
325
-			if($_GET['install'] == "automatic") {
326
-		
368
+		$output .= "<div id='pagetitle'>" . _PANELDATA . "</div>";
369
+		if (isset($_GET['install']))
370
+		{
371
+			if ($_GET['install'] == "automatic")
372
+			{
373
+
327 374
 				$panellist = array(
328
-					array("submitted","Submissions", "","3","5","0","A"),
375
+					array("submitted", "Submissions", "", "3", "5", "0", "A"),
329 376
 					array("versioncheck", "Version Check", "", "3", "7", "0", "A"),
330
-					array("newstory","Add New Story","stories.php?action=newstory&admin=1","3","3","0","A"),
331
-					array("addseries","Add New Series","series.php?action=add","3","3","0","A"),
332
-					array("news","News","","3","5","0","A"),
333
-					array("featured","Featured Stories","","3","5","0","A"),
334
-					array("characters","Characters","","2","2","0","A"),
335
-					array("ratings","Ratings","","2","3","0","A"),
336
-					array("members","Members","","2","5","0","A"),
337
-					array("mailusers","Mail Users","","2","6","0","A"),
338
-					array("settings","Settings","","1","2","0","A"),
339
-					array("blocks","Blocks","","1","3","0","A"),
340
-					array("censor","Censor","","1","0","1","A"),
341
-					array("admins","Admins","","1","6","0","A"),
342
-					array("classifications","Classifications","","2","4","0","A"),
343
-					array("categories","Categories","","2","1","0","A"),
344
-					array("custpages","Custom Pages","","1","4","0","A"),
345
-					array("validate","Validate Submission","","3","0","1","A"),
346
-					array("yesletter","Validation Letter","","3","0","1","A"),
347
-					array("noletter","Rejection Letter","","3","0","1","A"),
348
-					array("links","Page Links","","1","5","0","A"),
349
-					array("messages","Message Settings","","2","0","1","A"),
350
-					array("login","Login","","0","0","1","U"),
351
-					array("logout","Logout","","1","5","0","U"),
352
-					array("revreceived","Reviews Received","","1","0","1","U"),
353
-					array("editprefs","Edit Preferences","","1","2","0","U"),
354
-					array("lostpassword","Lost Password","","0","0","1","U"),
355
-					array("editbio","Edit Bio","","1","1","0","U"),
356
-					array("register","Register","","0","0","1","U"),
357
-					array("manageimages","Manage Images","","1","5","0","S"),
358
-					array("revres","Review Response","","1","0","1","U"),
359
-					array("stats","View Your Statistics","","1","3","0","U"),
360
-					array("newstory","Add New Story","stories.php?action=newstory","1","1","0","S"),
361
-					array("newseries","Add New Series","series.php?action=add","1","3","0","S"),
362
-					array("managestories","Manage Stories","stories.php?action=viewstories","1","2","0","S"),
363
-					array("manageseries","Manage Series","series.php?action=manage","1","4","0","S"),
364
-					array("reviewsby","Your Reviews","","1","0","1","U"),
365
-					array("storiesby","Stories by {author}","","0","1","0","P"),
366
-					array("seriesby","Series by {author}","","0","2","0","P"),
367
-					array("reviewsby","Reviews by {author}","","0","3","0","P"),
368
-					array("categories","Categories","","0","1","0","B"),
369
-					array("characters","Characters","","0","2","0","B"),
370
-					array("ratings","Ratings","","0","3","0","B"),
371
-					array("titles","Titles","","0","5","0","B"),
372
-					array("class","Classes","","0","0","1","B"),
373
-					array("recent","Most Recent","","0","0","1","B"),
374
-					array("featured","Featured Stories","","0","0","1","B"),
375
-					array("panels","Panels","","1","1","0","A"),
376
-					array("phpinfo","PHP Info","","1","7","0","A"),
377
-					array("contact","Contact","","0","0","1","P"),
377
+					array("newstory", "Add New Story", "stories.php?action=newstory&admin=1", "3", "3", "0", "A"),
378
+					array("addseries", "Add New Series", "series.php?action=add", "3", "3", "0", "A"),
379
+					array("news", "News", "", "3", "5", "0", "A"),
380
+					array("featured", "Featured Stories", "", "3", "5", "0", "A"),
381
+					array("characters", "Characters", "", "2", "2", "0", "A"),
382
+					array("ratings", "Ratings", "", "2", "3", "0", "A"),
383
+					array("members", "Members", "", "2", "5", "0", "A"),
384
+					array("mailusers", "Mail Users", "", "2", "6", "0", "A"),
385
+					array("settings", "Settings", "", "1", "2", "0", "A"),
386
+					array("blocks", "Blocks", "", "1", "3", "0", "A"),
387
+					array("censor", "Censor", "", "1", "0", "1", "A"),
388
+					array("admins", "Admins", "", "1", "6", "0", "A"),
389
+					array("classifications", "Classifications", "", "2", "4", "0", "A"),
390
+					array("categories", "Categories", "", "2", "1", "0", "A"),
391
+					array("custpages", "Custom Pages", "", "1", "4", "0", "A"),
392
+					array("validate", "Validate Submission", "", "3", "0", "1", "A"),
393
+					array("yesletter", "Validation Letter", "", "3", "0", "1", "A"),
394
+					array("noletter", "Rejection Letter", "", "3", "0", "1", "A"),
395
+					array("links", "Page Links", "", "1", "5", "0", "A"),
396
+					array("messages", "Message Settings", "", "2", "0", "1", "A"),
397
+					array("login", "Login", "", "0", "0", "1", "U"),
398
+					array("logout", "Logout", "", "1", "5", "0", "U"),
399
+					array("revreceived", "Reviews Received", "", "1", "0", "1", "U"),
400
+					array("editprefs", "Edit Preferences", "", "1", "2", "0", "U"),
401
+					array("lostpassword", "Lost Password", "", "0", "0", "1", "U"),
402
+					array("editbio", "Edit Bio", "", "1", "1", "0", "U"),
403
+					array("register", "Register", "", "0", "0", "1", "U"),
404
+					array("manageimages", "Manage Images", "", "1", "5", "0", "S"),
405
+					array("revres", "Review Response", "", "1", "0", "1", "U"),
406
+					array("stats", "View Your Statistics", "", "1", "3", "0", "U"),
407
+					array("newstory", "Add New Story", "stories.php?action=newstory", "1", "1", "0", "S"),
408
+					array("newseries", "Add New Series", "series.php?action=add", "1", "3", "0", "S"),
409
+					array("managestories", "Manage Stories", "stories.php?action=viewstories", "1", "2", "0", "S"),
410
+					array("manageseries", "Manage Series", "series.php?action=manage", "1", "4", "0", "S"),
411
+					array("reviewsby", "Your Reviews", "", "1", "0", "1", "U"),
412
+					array("storiesby", "Stories by {author}", "", "0", "1", "0", "P"),
413
+					array("seriesby", "Series by {author}", "", "0", "2", "0", "P"),
414
+					array("reviewsby", "Reviews by {author}", "", "0", "3", "0", "P"),
415
+					array("categories", "Categories", "", "0", "1", "0", "B"),
416
+					array("characters", "Characters", "", "0", "2", "0", "B"),
417
+					array("ratings", "Ratings", "", "0", "3", "0", "B"),
418
+					array("titles", "Titles", "", "0", "5", "0", "B"),
419
+					array("class", "Classes", "", "0", "0", "1", "B"),
420
+					array("recent", "Most Recent", "", "0", "0", "1", "B"),
421
+					array("featured", "Featured Stories", "", "0", "0", "1", "B"),
422
+					array("panels", "Panels", "", "1", "1", "0", "A"),
423
+					array("phpinfo", "PHP Info", "", "1", "7", "0", "A"),
424
+					array("contact", "Contact", "", "0", "0", "1", "P"),
378 425
 					array("series", "Series", "", "0", "4", "0", "B"),
379 426
 					array("viewlog", "Action Log", "", "1", "8", "0", "A"),
380
-					array("shortstories","10 Shortest Stories","toplists/default.php","0","6","0","L"), 
381
-					array("longstories","10 Longest Stories","toplists/default.php","0","5","0","L"), 
382
-					array("largeseries","10 Largest Series","toplists/default.php","0","1","0","L"), 
383
-					array("smallseries","10 Smallest Series","toplists/default.php","0","2","0","L"), 
384
-					array("reviewedseries","10 Most Reviewed Series","toplists/default.php","0","4","0","L"), 
385
-					array("prolificauthors","10 Most Prolific Authors","toplists/default.php","0","10","0","L"), 
386
-					array("prolificreviewers","10 Most Prolific Reviewers","toplists/default.php","0","12","0","L"), 
387
-					array("reviewedstories","10 Most Reviewed Stories","toplists/default.php","0","8","0","L"), 
388
-					array("readstories","10 Most Read Stories","toplists/default.php","0","9","0","L"),
389
-					array("manfavs","Manage Favorites","","1","2","0","F"),
390
-					array("favstories","10 Most Favorite Stories","toplists/default.php","0","7","0","L"), 
391
-					array("favauthors","10 Most Favorite Authors","toplists/default.php","0","11","0","L"), 
392
-					array("favseries","10 Most Favorite Series","toplists/default.php","0","3","0","L"), 
393
-					array("favst","Favorite Stories","","0","0","1","F"),
394
-					array("favse","Favorite Series","","0","0","1","F"),
395
-					array("favau","Favorite Authors","","0","0","1","F"),
396
-					array("favst","Favorite Stories","","0","0","1","U"),
397
-					array("favse","Favorite Series","","0","0","1","U"),
398
-					array("favau","Favorite Authors","","0","0","1","U"),
399
-					array("favlist","{author}\'s Favorites","viewuser.php?action=manfavs","0","5","0","F"),
427
+					array("shortstories", "10 Shortest Stories", "toplists/default.php", "0", "6", "0", "L"),
428
+					array("longstories", "10 Longest Stories", "toplists/default.php", "0", "5", "0", "L"),
429
+					array("largeseries", "10 Largest Series", "toplists/default.php", "0", "1", "0", "L"),
430
+					array("smallseries", "10 Smallest Series", "toplists/default.php", "0", "2", "0", "L"),
431
+					array("reviewedseries", "10 Most Reviewed Series", "toplists/default.php", "0", "4", "0", "L"),
432
+					array("prolificauthors", "10 Most Prolific Authors", "toplists/default.php", "0", "10", "0", "L"),
433
+					array("prolificreviewers", "10 Most Prolific Reviewers", "toplists/default.php", "0", "12", "0", "L"),
434
+					array("reviewedstories", "10 Most Reviewed Stories", "toplists/default.php", "0", "8", "0", "L"),
435
+					array("readstories", "10 Most Read Stories", "toplists/default.php", "0", "9", "0", "L"),
436
+					array("manfavs", "Manage Favorites", "", "1", "2", "0", "F"),
437
+					array("favstories", "10 Most Favorite Stories", "toplists/default.php", "0", "7", "0", "L"),
438
+					array("favauthors", "10 Most Favorite Authors", "toplists/default.php", "0", "11", "0", "L"),
439
+					array("favseries", "10 Most Favorite Series", "toplists/default.php", "0", "3", "0", "L"),
440
+					array("favst", "Favorite Stories", "", "0", "0", "1", "F"),
441
+					array("favse", "Favorite Series", "", "0", "0", "1", "F"),
442
+					array("favau", "Favorite Authors", "", "0", "0", "1", "F"),
443
+					array("favst", "Favorite Stories", "", "0", "0", "1", "U"),
444
+					array("favse", "Favorite Series", "", "0", "0", "1", "U"),
445
+					array("favau", "Favorite Authors", "", "0", "0", "1", "U"),
446
+					array("favlist", "{author}\'s Favorites", "viewuser.php?action=manfavs", "0", "5", "0", "F"),
400 447
 					array("skins", "Skins", "", "3", "6", "0", "A"),
401 448
 					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
402 449
 					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
403 450
 					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
404 451
 					array('modules', 'Modules', '', 1, "11", 0, 'A')
405 452
 				);
406
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>"._RESULT."</th></tr>";
407
-				foreach($panellist as $panel) {
453
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>" . _RESULT . "</th></tr>";
454
+				foreach ($panellist as $panel)
455
+				{
408 456
 					unset($panels);
409
-					$panels = dbquery("INSERT INTO `".$tableprefix."fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('".$panel[0]."', '".$panel[1]."', '".$panel[2]."', '".$panel[3]."', '".$panel[4]."', '".$panel[5]."', '".$panel[6]."');");
410
-					$output .= "<tr><td>".stripslashes($panel[1])."</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
457
+					$panels = dbquery("INSERT INTO `" . $tableprefix . "fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('" . $panel[0] . "', '" . $panel[1] . "', '" . $panel[2] . "', '" . $panel[3] . "', '" . $panel[4] . "', '" . $panel[5] . "', '" . $panel[6] . "');");
458
+					$output .= "<tr><td>" . stripslashes($panel[1]) . "</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
411 459
 				}
412 460
 				$output .= "</table>";
413
-				$output .= write_message(_PANELAUTOFAIL."<br /><br /><a href='install.php?step=5'>"._CONTINUE."</a>");
461
+				$output .= write_message(_PANELAUTOFAIL . "<br /><br /><a href='install.php?step=5'>" . _CONTINUE . "</a>");
414 462
 			}
415
-			else {
416
-				$output .= write_message(_PANELMANUAL."<br /><br /><a href='install.php?step=5'>"._CONTINUE."</a>");
463
+			else
464
+			{
465
+				$output .= write_message(_PANELMANUAL . "<br /><br /><a href='install.php?step=5'>" . _CONTINUE . "</a>");
417 466
 			}
418 467
 		}
419
-		else $output .= write_message(_PANELDATAINFO."<br /><br />"._PANELSETUP." <a href='install.php?step=4&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=4&amp;install=manual'>"._MANUAL2."</a>");
420
-	break;
468
+		else $output .= write_message(_PANELDATAINFO . "<br /><br />" . _PANELSETUP . " <a href='install.php?step=4&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=4&amp;install=manual'>" . _MANUAL2 . "</a>");
469
+		break;
421 470
 	case "3":
422
-		$output .= "<div id='pagetitle'>"._INSTALLTABLES."</div>";
423
-		if(isset($_GET['install'])) {
424
-			if($_GET['install'] == "automatic") {
425
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Table</th><th>"._RESULT."</th></tr>";
426
-				$authorfields = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorfields` (
471
+		$output .= "<div id='pagetitle'>" . _INSTALLTABLES . "</div>";
472
+		if (isset($_GET['install']))
473
+		{
474
+			if ($_GET['install'] == "automatic")
475
+			{
476
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Table</th><th>" . _RESULT . "</th></tr>";
477
+				$authorfields = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorfields` (
427 478
   `field_id` int(11) NOT NULL AUTO_INCREMENT,
428 479
   `field_type` tinyint(4) NOT NULL default '0',
429 480
   `field_name` varchar(30) NOT NULL default ' ',
... ...
@@ -434,16 +485,16 @@ switch($step) {
434 485
   `field_on` tinyint(1) NOT NULL default '0',
435 486
   PRIMARY KEY  (`field_id`)
436 487
 ) ENGINE=MyISAM;");
437
-$output .= "<tr><td>".$tableprefix."fanfiction_authorfields</td><td align='center'>" . ($authorfields ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
438
-				$authorinfo = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorinfo` (
488
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_authorfields</td><td align='center'>" . ($authorfields ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
489
+				$authorinfo = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorinfo` (
439 490
   `uid` int(11) NOT NULL default '0',
440 491
   `field` int(11) NOT NULL default '0',
441 492
   `info` varchar(255) NOT NULL default ' ',
442 493
   PRIMARY KEY  (`uid`,`field`),
443 494
   KEY `uid` (`uid`)) ENGINE=MyISAM;");
444
-$output .= "<tr><td>".$tableprefix."fanfiction_authorinfo</td><td align='center'>" . ($authorinfo ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
495
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_authorinfo</td><td align='center'>" . ($authorinfo ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
445 496
 				$authorprefs = dbquery("
446
-CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorprefs` (
497
+CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorprefs` (
447 498
   `uid` int(11) NOT NULL default '0',
448 499
   `newreviews` tinyint(1) NOT NULL default '0',
449 500
   `newrespond` tinyint(1) NOT NULL default '0',
... ...
@@ -460,23 +511,23 @@ CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorprefs` (
460 511
   `stories` int(11) NOT NULL default '0',
461 512
   PRIMARY KEY  (`uid`)
462 513
 ) ENGINE=MyISAM;");
463
-$output .= "<tr><td>".$tableprefix."fanfiction_authorprefs</td><td align='center'>" . ($authorprefs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
464
-				$authors = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authors` (
514
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_authorprefs</td><td align='center'>" . ($authorprefs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
515
+				$authors = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authors` (
465 516
   `uid` int(11) NOT NULL auto_increment,
466 517
   `penname` varchar(200) NOT NULL default '',
467 518
   `realname` varchar(200) NOT NULL default '',
468 519
   `email` varchar(200) NOT NULL default '',
469 520
   `bio` text NULL,
470 521
   `image` varchar(200) NOT NULL default '',
471
-  `date` datetime NOT NULL default '0000-00-00 00:00:00',
522
+  `date`int(11) NOT NULL default '0',
472 523
   `admincreated` char(1) NOT NULL default '0',
473 524
   `password` varchar(40) NOT NULL default '0',
474 525
   PRIMARY KEY  (`uid`),
475 526
   KEY `penname` (`penname`),
476 527
   KEY `admincreated` (`admincreated`)
477 528
 ) ENGINE=MyISAM;");
478
-$output .= "<tr><td>".$tableprefix."fanfiction_authors</td><td align='center'>" . ($authors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
479
-				$blocks = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_blocks` (
529
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_authors</td><td align='center'>" . ($authors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
530
+				$blocks = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_blocks` (
480 531
   `block_id` int(11) NOT NULL auto_increment,
481 532
   `block_name` varchar(30) NOT NULL default '',
482 533
   `block_title` varchar(150) NOT NULL default '',
... ...
@@ -486,8 +537,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_authors</td><td align='center'>"
486 537
   PRIMARY KEY  (`block_id`),
487 538
   KEY `block_name` (`block_name`)
488 539
 ) ENGINE=MyISAM;");
489
-$output .= "<tr><td>".$tableprefix."fanfiction_blocks</td><td align='center'>" . ($blocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
490
-				$categories = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_categories` (
540
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_blocks</td><td align='center'>" . ($blocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
541
+				$categories = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_categories` (
491 542
   `catid` int(11) NOT NULL auto_increment,
492 543
   `parentcatid` int(11) NOT NULL default '-1',
493 544
   `category` varchar(60) NOT NULL default '',
... ...
@@ -500,8 +551,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_blocks</td><td align='center'>" .
500 551
   PRIMARY KEY  (`catid`),
501 552
   KEY `byparent` (`parentcatid`,`displayorder`)
502 553
 ) ENGINE=MyISAM;");
503
-$output .= "<tr><td>".$tableprefix."fanfiction_categories</td><td align='center'>" . ($categories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
504
-				$chapters = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_chapters` (
554
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_categories</td><td align='center'>" . ($categories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
555
+				$chapters = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_chapters` (
505 556
   `chapid` int(11) NOT NULL auto_increment,
506 557
   `title` varchar(250) NOT NULL default '',
507 558
   `inorder` int(11) NOT NULL default '0',
... ...
@@ -523,8 +574,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_categories</td><td align='center'
523 574
   KEY `validated` (`validated`),
524 575
   KEY `forstoryblock` (`sid`,`validated`)
525 576
 ) ENGINE=MyISAM;");
526
-$output .= "<tr><td>".$tableprefix."fanfiction_chapters</td><td align='center'>" . ($chapters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
527
-				$characters = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_characters` (
577
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_chapters</td><td align='center'>" . ($chapters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
578
+				$characters = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_characters` (
528 579
   `charid` int(11) NOT NULL auto_increment,
529 580
   `catid` int(11) NOT NULL default '0',
530 581
   `charname` varchar(60) NOT NULL default '',
... ...
@@ -534,30 +585,30 @@ $output .= "<tr><td>".$tableprefix."fanfiction_chapters</td><td align='center'>"
534 585
   KEY `catid` (`catid`),
535 586
   KEY `charname` (`charname`)
536 587
 ) ENGINE=MyISAM;");
537
-$output .= "<tr><td>".$tableprefix."fanfiction_characters</td><td align='center'>" . ($characters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
538
-				$classes = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_classes` (
588
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_characters</td><td align='center'>" . ($characters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
589
+				$classes = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_classes` (
539 590
   `class_id` int(11) NOT NULL auto_increment,
540 591
   `class_type` int(11) NOT NULL default '0',
541 592
   `class_name` varchar(100) NOT NULL default '',
542 593
   PRIMARY KEY  (`class_id`),
543 594
   KEY `byname` (`class_type`,`class_name`,`class_id`)
544 595
 ) ENGINE=MyISAM;");
545
-$output .= "<tr><td>".$tableprefix."fanfiction_classes</td><td align='center'>" . ($classes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
546
-				$classtypes = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_classtypes` (
596
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_classes</td><td align='center'>" . ($classes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
597
+				$classtypes = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_classtypes` (
547 598
   `classtype_id` int(11) NOT NULL auto_increment,
548 599
   `classtype_name` varchar(50) NOT NULL default '',
549 600
   `classtype_title` varchar(50) NOT NULL default '',
550 601
   PRIMARY KEY  (`classtype_id`),
551 602
   UNIQUE KEY `classtype_name` (`classtype_name`)
552 603
 ) ENGINE=MyISAM;");
553
-$output .= "<tr><td>".$tableprefix."fanfiction_classtypes</td><td align='center'>" . ($classtypes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
554
-$coauthors = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_coauthors` (
604
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_classtypes</td><td align='center'>" . ($classtypes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
605
+				$coauthors = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_coauthors` (
555 606
   `sid` int(11) NOT NULL default '0',
556 607
   `uid` int(11) NOT NULL default '0',
557 608
   PRIMARY KEY  (`sid`,`uid`)
558 609
 ) ENGINE=MyISAM;");
559
-$output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>" . ($coauthors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
560
-				$codeblocks = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_codeblocks` (
610
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_coauthors</td><td align='center'>" . ($coauthors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
611
+				$codeblocks = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_codeblocks` (
561 612
   `code_id` int(11) NOT NULL auto_increment,
562 613
   `code_text` text NOT NULL,
563 614
   `code_type` varchar(20) default NULL,
... ...
@@ -565,18 +616,18 @@ $output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>
565 616
   PRIMARY KEY  (`code_id`),
566 617
   KEY `code_type` (`code_type`)
567 618
 ) ENGINE=MyISAM;");
568
-$output .= "<tr><td>".$tableprefix."fanfiction_codeblocks</td><td align='center'>" . ($codeblocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
569
-				$comments = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_comments` (
619
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_codeblocks</td><td align='center'>" . ($codeblocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
620
+				$comments = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_comments` (
570 621
   `cid` int(11) NOT NULL auto_increment,
571 622
   `nid` int(11) NOT NULL default '0',
572 623
   `uid` int(11) NOT NULL default '0',
573 624
   `comment` text NOT NULL,
574
-  `time` datetime NOT NULL default '0000-00-00 00:00:00',
625
+  `time` int(11) NOT NULL default '0',
575 626
   PRIMARY KEY  (`cid`),
576 627
   KEY `commentlist` (`nid`,`time`)
577 628
 ) ENGINE=MyISAM;");
578
-$output .= "<tr><td>".$tableprefix."fanfiction_comments</td><td align='center'>" . ($comments ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
579
-				$favorites = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_favorites` (
629
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_comments</td><td align='center'>" . ($comments ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
630
+				$favorites = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_favorites` (
580 631
   `uid` int(11) NOT NULL default '0',
581 632
   `item` int(11) NOT NULL default '0',
582 633
   `type` char(2) NOT NULL default '',
... ...
@@ -584,8 +635,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_comments</td><td align='center'>"
584 635
   UNIQUE KEY `byitem` (`item`,`type`,`uid`),
585 636
   UNIQUE KEY `byuid` (`uid`,`type`,`item`)
586 637
 ) ENGINE=MyISAM;");
587
-$output .= "<tr><td>".$tableprefix."fanfiction_favorites</td><td align='center'>" . ($favorites ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
588
-				$inseries = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_inseries` (
638
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_favorites</td><td align='center'>" . ($favorites ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
639
+				$inseries = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_inseries` (
589 640
   `seriesid` int(11) NOT NULL default '0',
590 641
   `sid` int(11) NOT NULL default '0',
591 642
   `subseriesid` int(11) NOT NULL default '0',
... ...
@@ -594,8 +645,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_favorites</td><td align='center'>
594 645
   PRIMARY KEY  (`sid`,`seriesid`, `subseriesid`),
595 646
   KEY `seriesid` (`seriesid`,`inorder`)
596 647
 ) ENGINE=MyISAM;");
597
-$output .= "<tr><td>".$tableprefix."fanfiction_inseries</td><td align='center'>" . ($inseries ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
598
-				$logs = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_log` (
648
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_inseries</td><td align='center'>" . ($inseries ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
649
+				$logs = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_log` (
599 650
   `log_id` int(11) NOT NULL auto_increment,
600 651
   `log_action` varchar(255) default NULL,
601 652
   `log_uid` int(11) NOT NULL,
... ...
@@ -604,8 +655,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_inseries</td><td align='center'>"
604 655
   `log_type` varchar(2) NOT NULL,
605 656
   PRIMARY KEY  (`log_id`)
606 657
 ) ENGINE=MyISAM");
607
-$output .= "<tr><td>".$tableprefix."fanfiction_log</td><td align='center'>" . ($logs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
608
-				$messages = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_messages` (
658
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_log</td><td align='center'>" . ($logs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
659
+				$messages = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_messages` (
609 660
   `message_id` int(11) NOT NULL auto_increment,
610 661
   `message_name` varchar(50) NOT NULL default '',
611 662
   `message_title` varchar(200) NOT NULL default '',
... ...
@@ -613,17 +664,17 @@ $output .= "<tr><td>".$tableprefix."fanfiction_log</td><td align='center'>" . ($
613 664
   PRIMARY KEY  (`message_id`),
614 665
   KEY `message_name` (`message_name`)
615 666
 ) ENGINE=MyISAM;");
616
-$output .= "<tr><td>".$tableprefix."fanfiction_messages</td><td align='center'>" . ($messages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
667
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_messages</td><td align='center'>" . ($messages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
617 668
 				$modules = dbquery("
618
-CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_modules` (
669
+CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
619 670
   `id` int(11) NOT NULL auto_increment,
620 671
   `name` varchar(100) NOT NULL default 'Test Module',
621 672
   `version` varchar(10) NOT NULL default '1.0',
622 673
   PRIMARY KEY  (`id`),
623 674
   KEY `name_version` (`name`,`version`)
624 675
 )");
625
-$output .= "<tr><td>".$tableprefix."fanfiction_modules</td><td align='center'>" . ($modules ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
626
-				$news = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_news` (
676
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_modules</td><td align='center'>" . ($modules ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
677
+				$news = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_news` (
627 678
   `nid` int(11) NOT NULL auto_increment,
628 679
   `author` varchar(60) NOT NULL default '',
629 680
   `title` varchar(255) NOT NULL default '',
... ...
@@ -632,8 +683,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_modules</td><td align='center'>"
632 683
   `comments` INT NOT NULL DEFAULT '0',
633 684
   PRIMARY KEY  (`nid`)
634 685
 ) ENGINE=MyISAM;");
635
-$output .= "<tr><td>".$tableprefix."fanfiction_news</td><td align='center'>" . ($news ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
636
-				$pagelinks = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_pagelinks` (
686
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_news</td><td align='center'>" . ($news ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
687
+				$pagelinks = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_pagelinks` (
637 688
   `link_id` int(11) NOT NULL auto_increment,
638 689
   `link_name` varchar(50) NOT NULL default '',
639 690
   `link_text` varchar(100) NOT NULL default '',
... ...
@@ -644,8 +695,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_news</td><td align='center'>" . (
644 695
   PRIMARY KEY  (`link_id`),
645 696
   KEY `link_name` (`link_name`)
646 697
 ) ENGINE=MyISAM;");
647
-$output .= "<tr><td>".$tableprefix."fanfiction_pagelinks</td><td align='center'>" . ($pagelinks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
648
-				$panels = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_panels` (
698
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_pagelinks</td><td align='center'>" . ($pagelinks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
699
+				$panels = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_panels` (
649 700
   `panel_id` int(11) NOT NULL auto_increment,
650 701
   `panel_name` varchar(50) NOT NULL default 'unknown',
651 702
   `panel_title` varchar(100) NOT NULL default 'Unnamed Panel',
... ...
@@ -657,8 +708,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_pagelinks</td><td align='center'>
657 708
   PRIMARY KEY  (`panel_id`),
658 709
   KEY `panel_type` (`panel_type`,`panel_name`)
659 710
 ) ENGINE=MyISAM;");
660
-$output .= "<tr><td>".$tableprefix."fanfiction_panels</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
661
-				$ratings = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_ratings` (
711
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_panels</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
712
+				$ratings = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_ratings` (
662 713
   `rid` int(11) NOT NULL auto_increment,
663 714
   `rating` varchar(60) NOT NULL default '',
664 715
   `ratingwarning` char(1) NOT NULL default '0',
... ...
@@ -666,15 +717,15 @@ $output .= "<tr><td>".$tableprefix."fanfiction_panels</td><td align='center'>" .
666 717
   PRIMARY KEY  (`rid`),
667 718
   KEY `rating` (`rating`)
668 719
 ) ENGINE=MyISAM;");
669
-$output .= "<tr><td>".$tableprefix."fanfiction_ratings</td><td align='center'>" . ($ratings ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
670
-				$reviews = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_reviews` (
720
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_ratings</td><td align='center'>" . ($ratings ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
721
+				$reviews = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_reviews` (
671 722
   `reviewid` int(11) NOT NULL auto_increment,
672 723
   `item` int(11) NOT NULL default '0',
673 724
   `chapid` int(11) NOT NULL default '0',
674 725
   `reviewer` varchar(60) NOT NULL default '0',
675 726
   `uid` int(11) NOT NULL default '0',
676 727
   `review` text NOT NULL,
677
-  `date` datetime NOT NULL default '0000-00-00 00:00:00',
728
+  `date`int(11) NOT NULL default '0',
678 729
   `rating` int(11) NOT NULL default '0',
679 730
   `respond` char(1) NOT NULL default '0',
680 731
   `type` char(2) NOT NULL default '',
... ...
@@ -686,8 +737,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_ratings</td><td align='center'>"
686 737
   KEY `bychapter` (`chapid`,`rating`),
687 738
   KEY `byuid` (`uid`,`item`,`type`)
688 739
 ) ENGINE=MyISAM;");
689
-$output .= "<tr><td>".$tableprefix."fanfiction_reviews</td><td align='center'>" . ($reviews ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
690
-				$series = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_series` (
740
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_reviews</td><td align='center'>" . ($reviews ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
741
+				$series = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_series` (
691 742
   `seriesid` int(11) NOT NULL auto_increment,
692 743
   `title` varchar(200) NOT NULL default '',
693 744
   `summary` text NOT NULL,
... ...
@@ -706,8 +757,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_reviews</td><td align='center'>"
706 757
   KEY `classes` (`classes`),
707 758
   KEY `owner` (`uid`,`title`)
708 759
 ) ENGINE=MyISAM;");
709
-$output .= "<tr><td>".$tableprefix."fanfiction_series</td><td align='center'>" . ($series ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
710
-	$stats = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_stats` (
760
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_series</td><td align='center'>" . ($series ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
761
+				$stats = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_stats` (
711 762
   `sitekey` varchar(50) NOT NULL default '0',
712 763
   `stories` int(11) NOT NULL default '0',
713 764
   `chapters` int(11) NOT NULL default '0',
... ...
@@ -719,9 +770,9 @@ $output .= "<tr><td>".$tableprefix."fanfiction_series</td><td align='center'>" .
719 770
   `reviewers` int(11) NOT NULL default '0',
720 771
   `newestmember` int(11) NOT NULL default '0'
721 772
 ) ENGINE=MyISAM");
722
-	dbquery("INSERT INTO ".$tableprefix."fanfiction_stats(`sitekey`, `newestmember`) VALUES('".SITEKEY."', '1')");
723
-$output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" . ($stats ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
724
-				$stories = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_stories` (
773
+				dbquery("INSERT INTO " . $tableprefix . "fanfiction_stats(`sitekey`, `newestmember`) VALUES('" . SITEKEY . "', '1')");
774
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_stats</td><td align='center'>" . ($stats ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
775
+				$stories = dbquery("CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_stories` (
725 776
   `sid` int(11) NOT NULL auto_increment,
726 777
   `title` varchar(200) NOT NULL default 'Untitled',
727 778
   `summary` text NULL,
... ...
@@ -730,10 +781,10 @@ $output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" .
730 781
   `classes` varchar(200) NOT NULL default '0',
731 782
   `charid` varchar(250) NOT NULL default '0',
732 783
   `rid` varchar(25) NOT NULL default '0',
733
-  `date` datetime default NULL,
734
-  `updated` datetime NOT NULL default '0000-00-00 00:00:00',
784
+  `date` int(11) NOT NULL default '0',
785
+  `updated` int(11) NOT NULL default '0',
735 786
   `uid` int(11) NOT NULL default '0',
736
-  `coauthors` varchar(50) NOT NULL default '0',
787
+  `coauthors` tinyint(1) NOT NULL default '0',
737 788
   `featured` char(1) NOT NULL default '0',
738 789
   `validated` char(1) NOT NULL default '0',
739 790
   `completed` char(1) NOT NULL default '0',
... ...
@@ -754,74 +805,87 @@ $output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" .
754 805
   KEY `validateduid` (`validated`,`uid`),
755 806
   KEY `recent` (`updated`,`validated`)
756 807
 ) ENGINE=MyISAM;");
757
-$output .= "<tr><td>".$tableprefix."fanfiction_stories</td><td align='center'>" . ($stories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
758
-$output .= "</table>";
759
-$output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>"._CONTINUE."</a>");
760
-
808
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_stories</td><td align='center'>" . ($stories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
809
+				$output .= "</table>";
810
+				$output .= write_message(_TABLEFAILED . "<br /><br /><a href='install.php?step=4'>" . _CONTINUE . "</a>");
761 811
 			}
762
-			else if($_GET['install'] == "manual") {
763
-				$output .= write_message(_TABLESMANUAL."<br /><br /><a href='install.php?step=3'>"._CONTINUE."</a>");
812
+			else if ($_GET['install'] == "manual")
813
+			{
814
+				$output .= write_message(_TABLESMANUAL . "<br /><br /><a href='install.php?step=3'>" . _CONTINUE . "</a>");
764 815
 			}
765
-
766 816
 		}
767
-		else {
768
-	
769
-			$output .= write_message(_TABLESINSTALL."<br /><br /><a href='install.php?step=3&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=3&amp;install=manual'>"._MANUAL2."</a>");
817
+		else
818
+		{
819
+
820
+			$output .= write_message(_TABLESINSTALL . "<br /><br /><a href='install.php?step=3&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=3&amp;install=manual'>" . _MANUAL2 . "</a>");
770 821
 		}
771 822
 
772
-	break;
823
+		break;
773 824
 
774 825
 	case "2";
775 826
 		include("../config.php");
776
-		if(dbnumrows(dbquery("SHOW TABLES LIKE '".$settingsprefix."fanfiction_settings'"))) {
827
+		if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
828
+		{
777 829
 			include("../config.php");
778
-			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
779
-			$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
830
+			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
831
+			$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
780 832
 			list($tableprefix, $language) = dbrow($settings);
833
+
834
+			if ($tableprefix == '') $tableprefix = $settingsprefix;
835
+
781 836
 			define("TABLEPREFIX", $tableprefix);
782 837
 			define("SITEKEY", $sitekey);
783
-			
838
+
784 839
 			$sect = isset($_GET['sect']) ? $_GET['sect'] : "main";
785
-			$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
786
-			if(dbnumrows($settingsresults) == 0) {
787
-				dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings (`sitekey`) VALUES('".SITEKEY."');");
788
-				$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
840
+			$settingsresults = dbquery("SELECT * FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . SITEKEY . "'");
841
+			if (dbnumrows($settingsresults) == 0)
842
+			{
843
+				dbquery("INSERT INTO " . $settingsprefix . "fanfiction_settings (`sitekey`) VALUES('" . SITEKEY . "');");
844
+				$settingsresults = dbquery("SELECT * FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . SITEKEY . "'");
789 845
 			}
790 846
 			$settings = dbassoc($settingsresults);
791
-            if (!defined("_BASEDIR")) define('constant', define("_BASEDIR", "../"));
792
-			foreach($settings as $var => $val) {
847
+			foreach ($settings as $var => $val)
848
+			{
793 849
 				$$var = $val;
794 850
 			}
795
-			if($sect == "submissions") {
796
-				if(isset($_POST['submit'])) {
851
+			if ($sect == "submissions")
852
+			{
853
+				if (isset($_POST['submit']))
854
+				{
797 855
 					$storiespath = descript($_POST['newstoriespath']);
798
-					if(!file_exists($storiespath) && !file_exists("../".$storiespath)) {
799
-						if(!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
856
+					if (!file_exists($storiespath) && !file_exists("../" . $storiespath))
857
+					{
858
+						if (!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
800 859
 						mkdir("$storiespath", 0755);
801 860
 						@chmod("$storiespath", 0777);
802
-						if(substr(sprintf('%o', @fileperms("../".$storiespath)), -4) != "0777") $output .= write_message(_STORIESPATHNOTWRITABLE);
861
+						if (substr(sprintf('%o', @fileperms("../" . $storiespath)), -4) != "0777") $output .= write_message(_STORIESPATHNOTWRITABLE);
803 862
 					}
804 863
 				}
805 864
 			}
806
-			if($sect == "email" && isset($_POST['submit'])) {
807
-				$output .= "<div id=\"pagetitle\">"._SETTINGS."</div>";
865
+			if ($sect == "email" && isset($_POST['submit']))
866
+			{
867
+				$output .= "<div id=\"pagetitle\">" . _SETTINGS . "</div>";
808 868
 				$smtp_host = $_POST['newsmtp_host'];
809 869
 				$smtp_username = $_POST['newsmtp_username'];
810 870
 				$smtp_password = $_POST['newsmtp_password'];
811
-				$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '".SITEKEY."'");
812
-				if($result) {
871
+				$result = dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '" . SITEKEY . "'");
872
+				if ($result)
873
+				{
813 874
 					$output .= write_message(_ACTIONSUCCESSFUL);
814
-					$output .= write_message("<a href='install.php?step=3'>"._CONTINUE."</a>");
875
+					$output .= write_message("<a href='install.php?step=3'>" . _CONTINUE . "</a>");
815 876
 				}
816 877
 				else include("../admin/settings.php");
817 878
 			}
818 879
 			else include("../admin/settings.php");
819 880
 		}
820
-		else {
821
-			if(isset($_GET['install'])) {
822
-				if($_GET['install'] == "automatic") {
823
-			
824
-								$settings = dbquery("CREATE TABLE IF NOT EXISTS `".$settingsprefix."fanfiction_settings` (
881
+		else
882
+		{
883
+			if (isset($_GET['install']))
884
+			{
885
+				if ($_GET['install'] == "automatic")
886
+				{
887
+
888
+					$settings = dbquery("CREATE TABLE IF NOT EXISTS `" . $settingsprefix . "fanfiction_settings` (
825 889
   `sitekey` varchar(50) NOT NULL default '1',
826 890
   `sitename` varchar(200) NOT NULL default 'Your Site',
827 891
   `slogan` varchar(200) NOT NULL default 'It''s a cool site!',
... ...
@@ -873,30 +937,33 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
873 937
   `disablepopups` tinyint(1) NOT NULL default '0',
874 938
   `agestatement` tinyint(1) NOT NULL default '0',
875 939
   `words` text,
876
-  `version` varchar(10) NOT NULL default '".$version."',
940
+  `version` varchar(10) NOT NULL default '" . $version . "',
877 941
   `smtp_host` varchar(200) default NULL,
878 942
   `smtp_username` varchar(50) default NULL,
879 943
   `smtp_password` varchar(50) default NULL,
880 944
   PRIMARY KEY  (`sitekey`)
881 945
 ) ENGINE=MyISAM;");
882
-if($settings) $output .= write_message("<img src=\"../images/check.gif\"> "._SETTINGSTABLESUCCESS." <br /><a href='install.php?step=2'>"._CONTINUE."</a>");
883
-else $output .= write_message(_SETTINGSTABLEAUTOFAIL."<br /><br /> <a href='install.php?step=2'>"._CONTINUE."</a>");
946
+					if ($settings) $output .= write_message("<img src=\"../images/check.gif\"> " . _SETTINGSTABLESUCCESS . " <br /><a href='install.php?step=2'>" . _CONTINUE . "</a>");
947
+					else $output .= write_message(_SETTINGSTABLEAUTOFAIL . "<br /><br /> <a href='install.php?step=2'>" . _CONTINUE . "</a>");
884 948
 				}
885
-				else {
886
-					$output .= write_message(_SETTINGSTABLEMANUAL."<br /><br /><a href='install.php?step=2'>"._CONTINUE."</a>");
949
+				else
950
+				{
951
+					$output .= write_message(_SETTINGSTABLEMANUAL . "<br /><br /><a href='install.php?step=2'>" . _CONTINUE . "</a>");
887 952
 				}
888 953
 			}
889
-			else {
890
-		
954
+			else
955
+			{
956
+
891 957
 				$test = dbquery("SHOW TABLES");
892
-				if(!$test) $output .= write_message(_CONFIGFAILED);
893
-				else $output .= write_message(_SETTINGSTABLESETUP." <a href='install.php?step=2&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='install.php?step=2&amp;install=manual'>"._MANUAL2."</a>");
958
+				if (!$test) $output .= write_message(_CONFIGFAILED);
959
+				else $output .= write_message(_SETTINGSTABLESETUP . " <a href='install.php?step=2&amp;install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=2&amp;install=manual'>" . _MANUAL2 . "</a>");
894 960
 			}
895 961
 		}
896
-	break;
962
+		break;
897 963
 	default:
898
-		$output .= "<div id='pagetitle'>"._CONFIGDATA."</div>";
899
-		if(isset($_POST['submit'])) {
964
+		$output .= "<div id='pagetitle'>" . _CONFIGDATA . "</div>";
965
+		if (isset($_POST['submit']))
966
+		{
900 967
 			$dbhost = descript($_POST['dbhost']);
901 968
 			$dbname = descript($_POST['dbname']);
902 969
 			$dbuser = descript($_POST['dbuser']);
... ...
@@ -904,24 +971,28 @@ else $output .= write_message(_SETTINGSTABLEAUTOFAIL."<br /><br /> <a href='inst
904 971
 			$language = $_POST['language'];
905 972
 			$sitekey = descript($_POST['sitekey']);
906 973
 			$settingsprefix = descript($_POST['settingsprefix']);
907
-			$mysql_access = mysqli_connect($dbhost, $dbuser, $dbpass);
908
-			if(!$mysql_access) {
974
+			$mysqli_access = mysqli_connect($dbhost, $dbuser, $dbpass);
975
+			if (!$mysqli_access)
976
+			{
909 977
 				$output .= write_message(_CONFIGFAILED);
910 978
 			}
911 979
 		}
912
-		if(isset($_POST['submit']) && $mysql_access) {
980
+		if (isset($_POST['submit']) && $mysqli_access)
981
+		{
913 982
 			$handle = fopen("../config.php", 'w');
914
-			if(!$handle) {
983
+			if (!$handle)
984
+			{
915 985
 				@chmod("../config.php", 0666);
916 986
 				$handle = fopen("../config.php", 'w');
917 987
 			}
918
-			if($handle) {
988
+			if ($handle)
989
+			{
919 990
 				$dbhost = descript($_POST['dbhost']);
920 991
 				$dbname = descript($_POST['dbname']);
921 992
 				$dbuser = descript($_POST['dbuser']);
922 993
 				$dbpass = descript($_POST['dbpass']);
923 994
 				$sitekey = descript($_POST['sitekey']);
924
-				if(empty($sitekey)) $sitekey = random_string($randomcharset, 10);
995
+				if (empty($sitekey)) $sitekey = random_string($randomcharset, 10);
925 996
 				$language = $_POST['language'];
926 997
 				$settingsprefix = descript($_POST['settingsprefix']);
927 998
 				$text = "<?php 
... ...
@@ -939,41 +1010,43 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
939 1010
 				fwrite($handle, $text);
940 1011
 				fclose($handle);
941 1012
 				@chmod("../config.php", 0644);
942
-				$output .= write_message(_CONFIGSUCCESS."<br /><br /><a href='install.php?step=2&amp;language=$language'>"._CONTINUE."</a>");
1013
+				$output .= write_message(_CONFIGSUCCESS . "<br /><br /><a href='install.php?step=2&amp;language=$language'>" . _CONTINUE . "</a>");
943 1014
 			}
944 1015
 			else $output .= write_message(_ERROR_CONFIGWRITE);
945
-
946 1016
 		}
947
-		else { 
948
-			if(file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
949
-			if(isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
950
-			else {
951
-				$output .=  
1017
+		else
1018
+		{
1019
+			if (file_exists("../config.php") && !isset($mysqli_access)) include("../config.php");
1020
+			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
1021
+			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
1022
+			else
1023
+			{
1024
+				$output .=
952 1025
 					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
953
-						<div><label for='dbhost'>"._DBHOST."</label><input type='text'  name='dbhost' id='dbhost'".(!empty($dbhost) ? "value='$dbhost'" : "value='localhost'")."> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_DBHOST."</span></A></div>
954
-						<div><label for='dbname'>"._DBNAME."</label><input type='text' name='dbname' id='dbname'".(!empty($dbname) ? "value='$dbname'" : "")."> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_DBNAME."</span></A></div>
955
-						<div><label for='dbuser'>"._DBUSER."</label><input type='text' name='dbuser' id='dbuser'".(!empty($dbuser) ? "value='$dbuser'" : "")."> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_DBUSER."</span></A></div>
956
-						<div><label for='dbpass'>"._DBPASS."</label><input type='password' name='dbpass' id='dbpass'".(!empty($dbpass) ? "value='$dbpass'" : "")."> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_DBPASS."</span></A></div>
957
-						<div><label for='sitekey'>"._SITEKEY."</label><input type='text' name='sitekey' value='".(!empty($sitekey) ? $sitekey : random_string($randomcharset, 10))."' id='sitekey'> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_INSTALL_SITEKEY."</span></A></div>
958
-						<div><label for=\"language\">"._LANGUAGE.":</label> <select name=\"language\">";
1026
+						<div><label for='dbhost'>" . _DBHOST . "</label><input type='text'  name='dbhost' id='dbhost'" . (!empty($dbhost) ? "value='$dbhost'" : "value='localhost'") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBHOST . "</span></A></div>
1027
+						<div><label for='dbname'>" . _DBNAME . "</label><input type='text' name='dbname' id='dbname'" . (!empty($dbname) ? "value='$dbname'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBNAME . "</span></A></div>
1028
+						<div><label for='dbuser'>" . _DBUSER . "</label><input type='text' name='dbuser' id='dbuser'" . (!empty($dbuser) ? "value='$dbuser'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBUSER . "</span></A></div>
1029
+						<div><label for='dbpass'>" . _DBPASS . "</label><input type='password' name='dbpass' id='dbpass'" . (!empty($dbpass) ? "value='$dbpass'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBPASS . "</span></A></div>
1030
+						<div><label for='sitekey'>" . _SITEKEY . "</label><input type='text' name='sitekey' value='" . (!empty($sitekey) ? $sitekey : random_string($randomcharset, 10)) . "' id='sitekey'> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_INSTALL_SITEKEY . "</span></A></div>
1031
+						<div><label for=\"language\">" . _LANGUAGE . ":</label> <select name=\"language\">";
959 1032
 				$directory = opendir("../languages");
960
-				while($filename = readdir($directory)) {
961
-					if($filename=="." || $filename==".." || substr($filename, 2) == "_admin.php") continue;
962
-					$output .= "<option value=\"".substr($filename, 0, 2)."\"".
963
-						($language == substr($filename, 0, strpos($filename, ".php")) ? " selected" : "").">
964
-					".substr($filename, 0, strpos($filename, ".php"))."</option>";
1033
+				while ($filename = readdir($directory))
1034
+				{
1035
+					if ($filename == "." || $filename == ".." || substr($filename, 2) == "_admin.php") continue;
1036
+					$output .= "<option value=\"" . substr($filename, 0, 2) . "\"" .
1037
+						($language == substr($filename, 0, strpos($filename, ".php")) ? " selected" : "") . ">
1038
+					" . substr($filename, 0, strpos($filename, ".php")) . "</option>";
965 1039
 				}
966 1040
 				closedir($directory);
967
-				$output .= 
968
-					"</select> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_LANGUAGE."</span></A></div>
969
-						<label for='settingsprefix'>"._SETTINGSPREFIX."</label><input type='text' name='settingsprefix' id='settingsprefix'".(isset($settingsprefix) ? "value='$settingsprefix'" : "")."> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_SETTINGSPREFIX."</span></A><br />
1041
+				$output .=
1042
+					"</select> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_LANGUAGE . "</span></A></div>
1043
+						<label for='settingsprefix'>" . _SETTINGSPREFIX . "</label><input type='text' name='settingsprefix' id='settingsprefix'" . (isset($settingsprefix) ? "value='$settingsprefix'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_SETTINGSPREFIX . "</span></A><br />
970 1044
 						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
971 1045
 					</form>";
972 1046
 			}
973
-		}	
1047
+		}
974 1048
 }
975 1049
 $tpl->assign("output", $output);
976 1050
 
977 1051
 $tpl->printToScreen();
978
-if(isset($_GET['step']) && $_GET['step'] > 2) dbclose( );
979
-?>
980 1052
\ No newline at end of file
1053
+if (isset($_GET['step']) && $_GET['step'] > 2) dbclose();
... ...
@@ -190,4 +190,6 @@ define("_HELP_DBPASS", "Dies ist das Passwort des Datenbankbenutzers.");
190 190
 define("_HELP_INSTALL_SITEKEY", "Der Site-Key wird f�r den Zugriff auf die Seiteneinstellungen benutzt und verhindert Konflikte bei mehreren Installationen auf einer Domain. Du <strong>musst</strong> f�r jede eFiction-Installation einen <strong>eindeutigen</strong> Site-Key angeben! Wenn du das Feld leer l�sst, wird das Script einen zuf�lligen Key generieren.");
191 191
 define("_HELP_SETTINGSPREFIX", "Du kannst unabh�ngig von den anderen Tabellen ein Pr�fix f�r die Einstellungstabelle angeben. Dies erlaubt es, mehrere Instanzen von eFiction in der selben Datenbank mit den gleichen Einstellungen zu betreiben.");
192 192
 
193
-?>
194 193
\ No newline at end of file
194
+//  Missing LANs - fatal error  
195
+define("_EMAILREQUIRED", "Email is required");
196
+define("_BADSITEKEY", "Wrong Sitekey");
... ...
@@ -197,4 +197,6 @@ define("_HELP_DBPASS", "This is the password for the database user.");
197 197
 define("_HELP_INSTALL_SITEKEY", "The sitekey will be used to access the settings for your site.  It is also used to prevent crossed member logins when two or more sites are installed on the same domain.  You <strong>must</strong> have a <strong>unique</strong> sitekey for each eFiction site!  If you leave this blank, the script will randomly generate another one for you.");
198 198
 define("_HELP_SETTINGSPREFIX", "This allows you to define a separate prefix for the settings table.  This allows you to share the settings table among more than one eFiction site in the same database.");
199 199
 
200
-?>
201 200
\ No newline at end of file
201
+//  Missing LANs - fatal error  
202
+define("_EMAILREQUIRED", "Email is required");
203
+define("_BADSITEKEY", "Wrong Sitekey");
... ...
@@ -1,455 +1,446 @@
1 1
 <?php
2 2
 
3
+
4
+
5
+
3 6
 // Defines the doc type.  Most people will not need to change this.
4
-define('_DOCTYPE', '<!doctype html>');
7
+define ("_DOCTYPE", "<!doctype html>");
5 8
 
6 9
 // Your alphabet list.  If you need other than single characters be sure to enclose the character entity in quotes.  For example: "&#338;"
7
-define('_OTHER', 'Other');
8
-$alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', _OTHER);
10
+define ("_OTHER", "Other");
11
+$alphabet = array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', _OTHER );
9 12
 
10 13
 // General...used in many pages.
11
-if(!isset($allowed_tags)) $allowed_tags = '';
12
-if(!isset($recentdays)) $recentdays = '7';
13
-if(!isset($sitename )) $sitename  = '';
14
-if(!isset($url )) $url  = '';
15
-if(!isset($multiplecats )) $multiplecats  = '';
16
-if(!isset($minwords )) $minwords  = '';
17
-if(!isset($maxwords )) $maxwords  = '';
18
-if(!isset($action )) $action  = '';
19
-if(!isset($pwdsetting )) $pwdsetting  = '';
20
-if(!isset($imagewidth )) $imagewidth  = '';
21
-if(!isset($imageheight )) $imageheight = '';
22
-if(!isset($version)) $version  = '';
23
-
24
-
25
-define('_ACTIONSUCCESSFUL', 'The action was successful.');
26
-define('_ACTIONCANCELLED', 'The requested action was cancelled.');
27
-define('_ACTIVE', 'Active');
28
-define('_ADD', 'Add');
29
-define('_ADDAUTHOR2FAVES', 'Add Author to Favorites');
30
-define('_ADDSTORY2FAVES', 'Add Story to Favorites');
31
-define('_ADDTOFAVORITES', 'Add to Favorites');
32
-define('_ADMINOPTIONS', 'Admin Options');
33
-define('_AGECHECK', 'Age Consent Required');
34
-define('_AGECONSENT', 'I am of the age of consent in my locale to view materials with adult content.&nbsp; I realize that by agreeing, the normal warnings for stories with adult content will be by-passed.');
35
-define('_ALL', 'All');
36
-define('_ALLOWEDTAGS', '<span style="font-weight: bold; text-decoration: underline;">Note:</span> Allowed HTML tags are: '.htmlentities(preg_replace('/></', '> <', $allowed_tags)));
37
-define('_ALLSTORIES', 'All Stories');
38
-define('_ALPHA', 'Alphabetically');
39
-define('_ANONYMOUS', 'Anonymous');
40
-define('_AUTHORSNOTES', "Author's Notes");
41
-define('_BACK2ACCT', 'Back to <a href="member.php">your account</a> area.');
42
-define('_BACK2ADMIN', 'Back to <a href="admin.php">Admin</a> area.');
43
-define('_BACK2CATS', 'Back to Main Categories');
44
-define('_BACK2PREVIOUS', 'Back to Previous.');
45
-define('_BACK2STORY', "<a href='viewstory.php?sid=%s'>Back to story.</a>");
46
-define('_BACK2SERIES', "<a href='series.php?seriesid=%s'>Back to series.</a>");
47
-define('_BACK2REVIEWS', "<a href='reviews.php?%s'>Back to reviews.</a>");
48
-define('_BY', 'by');
49
-define('_CAPTCHAFAIL', 'The security code you entered did not match.  Please <a href="javascript: history.back(1)">try again.</a>');
50
-define('_CAPTCHANOTE', 'Enter the security code shown below:');
51
-define('_CATEGORIES', 'Categories');
52
-define('_CATEGORY', 'Category');
53
-define('_CATLOCKED', 'This category is locked.');
54
-define('_CATOPTIONS', 'Category Options');
55
-define('_CLEAR', 'Clear');
56
-define('_CHAPTER', 'Chapter');
57
-define('_CHAPTERS', 'Chapters');
58
-define('_CHARACTERS', 'Characters');
59
-define('_CHOOSECAT', 'Choose a Category');
60
-define('_CONFIRMDELETE', 'Are you sure you want to delete this?');
61
-define('_COAUTHORSEARCH', "Type in the first few letters of the person's penname.  The first ten matches will appear in a list.  Click on the person's name to select them as a co-author.");
62
-define('_DELETE', 'Delete');
63
-define('_DISLIKE', 'dislike');
64
-define('_DOWN', 'down arrow');
65
-define('_EDIT', 'Edit');
66
-define('_EDITFAVORITES', 'Edit Favorites');
67
-define('_EMAIL', 'E-mail');
68
-define('_EMAILFAILED', "The email could not be sent.  Please <a href='"._BASEDIR."contact.php'>contact the administrator</a> to report this problem.");
69
-define('_ERROR', '<strong>Error!</strong>We encountered an error.  Please go back and try again.');
70
-define('_FATALERROR', '<b>A fatal MySQL error was encountered.</b><br />');
71
-define('_FSTORY', 'Feature');
72
-define('_GO', 'Go');
73
-define('_HALFSTAR', 'half-star');
74
-define('_JAVASCRIPTOFF', 'You must have javascript enabled for this form to work properly.'); // Modified for version 3.0
75
-define('_LIKE', 'like');
76
-define('_LOGIN', 'Log In');
77
-define('_PLEASELOGIN', 'Please login to access this feature.');
78
-define('_MEMBER', 'Member');
79
-define('_MEMBERS', 'Members');
80
-define('_MOSTRECENT', 'Most Recent');
81
-define('_MOVE', 'Move');
82
-define('_MOVETOP', 'Move to Top'); // Really only used in the admin files, but we need it in the header.
83
-define(
84
-    '_MULTIPLECATEGORIES',
85
-    "<span style=\"text-decoration: underline; font-weight: bold;\">Note:</span> You may select multiple categories.  
14
+
15
+define ("_ACTIONSUCCESSFUL", "The action was successful.");
16
+define ("_ACTIONCANCELLED", "The requested action was cancelled.");
17
+define ("_ACTIVE", "Active");
18
+define ("_ADD", "Add");
19
+define ("_ADDAUTHOR2FAVES", "Add Author to Favorites");
20
+define ("_ADDSTORY2FAVES", "Add Story to Favorites");
21
+define ("_ADDTOFAVORITES", "Add to Favorites");
22
+define ("_ADMINOPTIONS", "Admin Options");
23
+define ("_AGECHECK", "Age Consent Required");
24
+define ("_AGECONSENT", "I am of the age of consent in my locale to view materials with adult content.&nbsp; I realize that by agreeing, the normal warnings for stories with adult content will be by-passed.");
25
+define ("_ALL", "All");
26
+define ("_ALLOWEDTAGS", "<span style=\"font-weight: bold; text-decoration: underline;\">Note:</span> Allowed HTML tags are: ".htmlentities(preg_replace("/></", "> <", $allowed_tags)));
27
+define ("_ALLSTORIES", "All Stories");
28
+define ("_ALPHA", "Alphabetically");
29
+define ("_ANONYMOUS", "Anonymous");
30
+define ("_AUTHORSNOTES", "Author's Notes");
31
+define ("_BACK2ACCT", "Back to <a href=\"user.php\">your account</a> area.");
32
+define ("_BACK2ADMIN", "Back to <a href=\"admin.php\">Admin</a> area.");
33
+define ("_BACK2CATS", "Back to Main Categories");
34
+define ("_BACK2PREVIOUS", "Back to Previous.");
35
+define ("_BACK2STORY", "<a href='viewstory.php?sid=%s'>Back to story.</a>");
36
+define ("_BACK2SERIES", "<a href='series.php?seriesid=%s'>Back to series.</a>");
37
+define ("_BACK2REVIEWS", "<a href='reviews.php?%s'>Back to reviews.</a>");
38
+define ("_BY", "by");
39
+define ("_CAPTCHAFAIL", "The security code you entered did not match.  Please <a href=\"javascript: history.back(1)\">try again.</a>");
40
+define ("_CAPTCHANOTE", "Enter the security code shown below:");
41
+define ("_CATEGORIES", "Categories");
42
+define ("_CATEGORY", "Category");
43
+define ("_CATLOCKED", "This category is locked.");
44
+define ("_CATOPTIONS", "Category Options");
45
+define ("_CLEAR", "Clear");
46
+define ("_CHAPTER", "Chapter");
47
+define ("_CHAPTERS", "Chapters");
48
+define ("_CHARACTERS", "Characters");
49
+define ("_CHOOSECAT", "Choose a Category");
50
+define ("_CONFIRMDELETE", "Are you sure you want to delete this?");
51
+define ("_COAUTHORSEARCH", "Type in the first few letters of the person's penname.  The first ten matches will appear in a list.  Click on the person's name to select them as a co-author.");
52
+define ("_DELETE", "Delete");
53
+define ("_DISLIKE", "dislike");
54
+define ("_DOWN", "down arrow");
55
+define ("_EDIT", "Edit");
56
+define ("_EDITFAVORITES", "Edit Favorites");
57
+define ("_EMAIL", "E-mail");
58
+define ("_EMAILFAILED", "The email could not be sent.  Please <a href='"._BASEDIR."contact.php'>contact the administrator</a> to report this problem.");
59
+define ("_ERROR", "<strong>Error!</strong>We encountered an error.  Please go back and try again.");
60
+define ("_FATALERROR", "<b>A fatal MySQL error was encountered.</b><br />");
61
+define ("_FSTORY", "Feature");
62
+define ("_GO", "Go");
63
+define ("_HALFSTAR", "half-star");
64
+define ("_JAVASCRIPTOFF", "You must have javascript enabled for this form to work properly."); // Modified for version 3.0
65
+define ("_LIKE", "like");
66
+define ("_LOGIN", "Log In");
67
+define ("_PLEASELOGIN", "Please login to access this feature.");
68
+define ("_MEMBER", "Member");
69
+define ("_MEMBERS", "Members");
70
+define ("_MOSTRECENT", "Most Recent");
71
+define ("_MOVE", "Move");
72
+define ("_MOVETOP", "Move to Top"); // Really only used in the admin files, but we need it in the header.
73
+define ("_MULTIPLECATEGORIES", 
74
+"<span style=\"text-decoration: underline; font-weight: bold;\">Note:</span> You may select multiple categories.  
86 75
 <u>Please be aware that when you select a category in the drop-down menu below, the options in the list will change to display that category's sub-categories.</u>
87
- Press the 'Select >' button to add it to your choices. You may clear your selections at any time using the 'Clear' button."
88
-);
89
-define('_MULTIPLESELECT', 'Hold the CTRL key to make multiple selections.');
90
-define('_NAME', 'Name');
91
-define('_NAUGHTYWORDS', 'You have triggered our bad language filters.  We require that all content not behind an age verification warning be suitable for all audiences.  This includes titles, summaries, and names (for anonymous reviews, challenges, etc.). Please <a href="javascript: history.back(1)">try again.</a>');
92
-define('_NEXT', 'Next');
93
-define('_NEW', 'New!');
94
-define('_NO', 'No');
95
-define('_NODBFUNCTIONALITY', 'It appears no applicable database functionality for PHP has not been enabled in the php configuration for this website.  Please consult the PHP documentation or ask your hosting provider.');
96
-define('_NOMAILSENT', 'We encountered an error.  No e-mail was sent.');
97
-define('_NONE', 'None');
98
-define('_NOSKIN', "The skin you selected in your user profile seems to be missing.  The site's default skin will be used instead. Please edit your profile to choose another skin.");
99
-define('_NORESULTS', 'No results found.');
100
-define('_NOTAUTHORIZED', 'You are not authorized to access that function.');
101
-define('_NOTCONNECTED', 'ERROR: Failed to connect to the database!');
102
-define('_OPTIONS', 'Options');
103
-define('_OR', 'or');
104
-define('_ORPHAN', 'Orphan');
105
-define('_OTHERRESULTS', 'Other Results');
106
-define('_PENNAME', 'Penname');
107
-define('_PFSTORY', 'Past Featured Story');
108
-define('_POSSIBLEHACK', 'A hacking attempt has been detected.');
109
-define('_PREVIEW', 'Preview');
110
-define('_PREVIOUS', 'Previous');
111
-define('_PRINTER', 'Printer');
112
-define('_ORDER', 'Order');
113
-define('_RATING', 'Rating');
114
-define('_RATINGS', 'Ratings');
115
-define('_REMOVE', 'Remove');
116
-define('_REQUIREDINFO', 'Some of the required information is missing.  Please check your input.');
117
-define('_REVIEW', 'Review');
118
-define('_REVIEWNOTE', '<span style="text-decoration: underline; font-weight: bold;">Note:</span> You may submit either a rating or a review or both.');
119
-define('_REVIEWRATING', _RATING);
120
-define('_REVIEWS', 'Reviews');
121
-define('_RETIRE', 'Retire');
122
-define('_RETIRED', 'Retired');
123
-define('_RUSERSONLY', 'Registered Users Only');
124
-define('_SELECT', 'Select');
125
-define('_SELECTCATS', 'Selected Categories');
126
-define('_SERIES', 'Series');
127
-define('_SORT', 'Sort');
128
-define('_STAR', 'star');
129
-define('_STORIES', 'Stories');
130
-define('_STORY', 'Story');
131
-define('_SUBMIT', 'Submit');
132
-define('_SUMMARY', 'Summary');
133
-define('_TEXT', 'Text');
134
-define('_TINYMCETOGGLE', 'Use tinyMCE');
135
-define('_TITLE', 'Title');
136
-define('_TOC', 'Table of Contents');
137
-define('_TOPLEVEL', 'Top Level Category'); // Really only used in the admin, but needs to load with the header.
138
-define('_UP', 'up arrow');
139
-define('_WIP', 'Work in Progress Only'); // Added 01/12/07
140
-define('_YES', 'Yes');
76
+ Press the 'Select >' button to add it to your choices. You may clear your selections at any time using the 'Clear' button.");
77
+define ("_MULTIPLESELECT", "Hold the CTRL key to make multiple selections.");
78
+define ("_NAME", "Name");
79
+define ("_NAUGHTYWORDS", "You have triggered our bad language filters.  We require that all content not behind an age verification warning be suitable for all audiences.  This includes titles, summaries, and names (for anonymous reviews, challenges, etc.). Please <a href=\"javascript: history.back(1)\">try again.</a>");
80
+define ("_NEXT", "Next");
81
+define ("_NEW", "New!");
82
+define ("_NO", "No");
83
+define ("_NODBFUNCTIONALITY", "It appears no applicable database functionality for PHP has not been enabled in the php configuration for this website.  Please consult the PHP documentation or ask your hosting provider.");
84
+define ("_NOMAILSENT", "We encountered an error.  No e-mail was sent.");
85
+define ("_NONE", "None");
86
+define ("_NOSKIN", "The skin you selected in your user profile seems to be missing.  The site's default skin will be used instead. Please edit your profile to choose another skin.");
87
+define ("_NORESULTS", "No results found.");
88
+define ("_NOTAUTHORIZED", "You are not authorized to access that function.");
89
+define ("_NOTCONNECTED", "ERROR: Failed to connect to the database!");
90
+define ("_OPTIONS", "Options");
91
+define ("_OR", "or");
92
+define ("_ORPHAN", "Orphan");
93
+define ("_OTHERRESULTS", "Other Results");
94
+define ("_PENNAME", "Penname");
95
+define ("_PFSTORY", "Past Featured Story");
96
+define ("_POSSIBLEHACK", "A hacking attempt has been detected.");
97
+define ("_PREVIEW", "Preview");
98
+define ("_PREVIOUS", "Previous");
99
+define ("_PRINTER", "Printer");
100
+define ("_ORDER", "Order");
101
+define ("_RATING", "Rating");
102
+define ("_RATINGS", "Ratings");
103
+define ("_REMOVE", "Remove");
104
+define ("_REQUIREDINFO", "Some of the required information is missing.  Please check your input.");
105
+define ("_REVIEW", "Review");
106
+define ("_REVIEWNOTE", "<span style=\"text-decoration: underline; font-weight: bold;\">Note:</span> You may submit either a rating or a review or both.");
107
+define ("_REVIEWRATING", _RATING);
108
+define ("_REVIEWS", "Reviews");
109
+define ("_RETIRE", "Retire");
110
+define ("_RETIRED", "Retired");
111
+define ("_RUSERSONLY", "Registered Users Only");
112
+define ("_SELECT", "Select");
113
+define ("_SELECTCATS", "Selected Categories");
114
+define ("_SERIES", "Series");
115
+define ("_SORT", "Sort");
116
+define ("_STAR", "star"); 
117
+define ("_STORIES", "Stories");
118
+define ("_STORY", "Story");
119
+define ("_SUBMIT", "Submit");
120
+define ("_SUMMARY", "Summary");
121
+define ("_TEXT", "Text");
122
+define ("_TINYMCETOGGLE", "Use tinyMCE");
123
+define ("_TITLE", "Title");
124
+define ("_TOC", "Table of Contents");
125
+define ("_TOPLEVEL", "Top Level Category"); // Really only used in the admin, but needs to load with the header.
126
+define ("_UP", "up arrow");
127
+define ("_WIP", "Work in Progress Only"); // Added 01/12/07
128
+define ("_YES", "Yes");
141 129
 
142 130
 // Login
143 131
 
144
-define('_REMEMBERME', 'Remember Me');
145
-define('_MEMBERLOGIN', 'Member Login');
132
+define ("_REMEMBERME", "Remember Me");
133
+define ("_MEMBERLOGIN", "Member Login");
146 134
 
147 135
 // Browse
148
-define('_BROWSE', 'Browse');
149
-define('_RECENTSTORIES', 'Stories updated in the last '.$recentdays.' days.');
150
-define('_EMAILSENT', 'Your e-mail has been sent.');
151
-define('_TITLES', 'Titles');
136
+define ("_BROWSE", "Browse");
137
+define ("_RECENTSTORIES", "Stories updated in the last ".$recentdays." days.");
138
+define ("_EMAILSENT", "Your e-mail has been sent.");
139
+define ("_TITLES", "Titles");
152 140
 // Contact Us
153
-define('_YOUREMAIL', 'Your E-mail');
154
-define('_CONTACTUS', 'Contact Us');
141
+define ("_YOUREMAIL", "Your E-mail");
142
+define ("_CONTACTUS", "Contact Us");
155 143
 
156 144
 // Members/Authors page
157
-define('_AUTHORS', 'Authors');
158
-define('_BETAS', 'Beta-readers');
159
-define('_ALLMEMBERS', 'All Members');
160
-define('_SITEADMINS', 'Site Admins');
145
+define ("_AUTHORS" , "Authors");
146
+define ("_BETAS", "Beta-readers");
147
+define ("_ALLMEMBERS", "All Members");
148
+define ("_SITEADMINS", "Site Admins");
161 149
 
162 150
 // News
163
-define('_COMMENTS', 'Comments');
164
-define('_NEWS', 'News');
151
+define ("_COMMENTS", "Comments");
152
+define ("_NEWS", "News");
165 153
 
166 154
 // Reviews
167
-define('_ALREADYRESPONDED', 'You have already responded to that review!');
168
-define('_BACKTOSTORY', 'Back to story.');
169
-define('_DELETEREVIEW', 'Delete Review');
170
-define('_DISLIKED', 'Disliked');
171
-define('_LIKED', 'Liked');
172
-define('_MISSINGINFO', 'You must supply either a review or rating.');
173
-define('_MISSINGINFO2', 'Rating a story without writing a review is not allowed.  You must write a review.');
174
-define('_OPINION', 'Opinion');
175
-define('_RESPECTNOTE', ' Please be respectful and polite when contacting an author.');
176
-define('_RESPOND', 'Respond');
177
-define('_REVEMAIL1', "New Review at $sitename for ");
178
-define('_REVEMAIL2', "Hello,
155
+define ("_ALREADYRESPONDED", "You have already responded to that review!");
156
+define ("_BACKTOSTORY", "Back to story.");
157
+define ("_DELETEREVIEW", "Delete Review");
158
+define ("_DISLIKED", "Disliked");
159
+define ("_LIKED", "Liked");
160
+define ("_MISSINGINFO", "You must supply either a review or rating.");
161
+define ("_MISSINGINFO2", "Rating a story without writing a review is not allowed.  You must write a review.");
162
+define ("_OPINION", "Opinion");
163
+define ("_RESPECTNOTE", " Please be respectful and polite when contacting an author.");
164
+define ("_RESPOND", "Respond");
165
+define ("_REVEMAIL1", "New Review at $sitename for ");
166
+define ("_REVEMAIL2", "Hello,
179 167
   You have received a new review at $sitename.\r\n You can view your new review at <a href='$url/reviews.php?%1\$s'>$url/reviews.php?%1\$s</a>.
180 168
 If you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
181 169
 on $sitename, and edit your profile."); // Modified 11-12-05
182
-define('_REVIEWSFOR', 'Reviews For');
183
-define('_REVTHANKYOU', 'Thank you for your review!');
184
-define('_SIGNED', 'Signed');
185
-define('_VIEWALLREVIEWS', 'View All Reviews');
170
+define ("_REVIEWSFOR", "Reviews For");
171
+define ("_REVTHANKYOU", "Thank you for your review!");
172
+define ("_SIGNED", "Signed");
173
+define ("_VIEWALLREVIEWS", "View All Reviews");
186 174
 
187 175
 // Search
188 176
 
189
-define('_10LISTS', 'Top Ten Lists');
190
-define('_10LARGESERIES', 'Ten Largest Series');
191
-define('_10SMALLSERIES', 'Ten Smallest Series');
192
-define('_10REVIEWEDSERIES', 'Ten Most Reviewed Series');
193
-define('_10FAVSERIES', 'Ten Favorite Series');
194
-define('_10SHORTSTORY', 'Ten Shortest Stories');
195
-define('_10LONGSTORY', 'Ten Longest Stories');
196
-define('_10REVIEWEDSTORY', 'Ten Most Reviewed Stories');
197
-define('_10FAVSTORY', 'Ten Favorite Stories');
198
-define('_10FAVAUTHOR', 'Ten Favorite Authors');
199
-define('_10PROLIFICAUTHOR', 'Ten Most Prolific Authors');
200
-define('_10PROLIFICREVIEWER', 'Ten Most Prolific Reviewers');
201
-define('_ADVANCED', 'Advanced Search');
202
-define('_COMPLETEONLY', 'Completed Only');
203
-define('_EXCLUDE', 'to Exclude');
204
-define('_FULLTEXT', 'Full Text');
205
-define('_INCLUDE', 'to Include');
206
-define('_RESULTS', 'Search Results');
207
-define('_SEARCHTERM', 'Search term');
208
-define('_SEARCHTERMTOOSHORT', "Your search term was too short.  Your search term must be a minimum of three characters long. <a href='searching.php'>Try again.</a>");
209
-define('_SIMPLE', 'Simple Search');
210
-define('_WORDCOUNT', 'Word count');
211
-define('_SEARCH', 'Search');
177
+define ("_10LISTS", "Top Ten Lists");
178
+define ("_10LARGESERIES", "Ten Largest Series");
179
+define ("_10SMALLSERIES", "Ten Smallest Series");
180
+define ("_10REVIEWEDSERIES", "Ten Most Reviewed Series");
181
+define ("_10FAVSERIES", "Ten Favorite Series");
182
+define ("_10SHORTSTORY", "Ten Shortest Stories");
183
+define ("_10LONGSTORY", "Ten Longest Stories");
184
+define ("_10REVIEWEDSTORY", "Ten Most Reviewed Stories");
185
+define ("_10FAVSTORY", "Ten Favorite Stories");
186
+define ("_10FAVAUTHOR", "Ten Favorite Authors");
187
+define ("_10PROLIFICAUTHOR", "Ten Most Prolific Authors");
188
+define ("_10PROLIFICREVIEWER", "Ten Most Prolific Reviewers");
189
+define ("_ADVANCED", "Advanced Search");
190
+define ("_COMPLETEONLY", "Completed Only");
191
+define ("_EXCLUDE", "to Exclude");
192
+define ("_FULLTEXT", "Full Text");
193
+define ("_INCLUDE", "to Include");
194
+define ("_RESULTS", "Search Results");
195
+define ("_SEARCHTERM", "Search term");
196
+define ("_SEARCHTERMTOOSHORT", "Your search term was too short.  Your search term must be a minimum of three characters long. <a href='search.php'>Try again.</a>");
197
+define ("_SIMPLE", "Simple Search");
198
+define ("_WORDCOUNT", "Word count");
199
+define ("_SEARCH", "Search");
212 200
 
213 201
 // Series
214
-define('_ADD2SERIES', 'Add to Series');
215
-define('_ADDSERIES', 'Add New Series');
216
-define('_ADDSERIES2FAVES', 'Add Series to Favorites');
217
-define('_BACKTOSERIES', 'Back to the Series'); // Added 11-06-05
218
-define('_CHOOSEAUTHOR', 'Choose another author');
219
-define('_CLOSED', 'Closed'); // Added 02-10-07
220
-define('_CONFIRMREMOVE', 'Are you sure you want to remove this from the series?'); // Added 12-22-05
221
-define('_DELETESERIES', 'Delete Series');
222
-define('_EDITSERIES', 'Edit Series');
223
-define('_MANAGESERIES', 'Manage Series');
224
-define('_MODERATED', 'Moderated'); // Added 02-10-07
225
-define('_OPEN', 'Open');
226
-define('_OPENNOTE', '<span style="font-weight: bold; text-decoration: underline;">Note:</span>  An open series is a shared universe (sometimes called a sandbox) in which other authors may add to the series.  
202
+define ("_ADD2SERIES", "Add to Series");
203
+define ("_ADDSERIES", "Add New Series");
204
+define ("_ADDSERIES2FAVES", "Add Series to Favorites");
205
+define ("_BACKTOSERIES", "Back to the Series"); // Added 11-06-05
206
+define ("_CHOOSEAUTHOR", "Choose another author");
207
+define ("_CLOSED", "Closed"); // Added 02-10-07
208
+define ("_CONFIRMREMOVE", "Are you sure you want to remove this from the series?"); // Added 12-22-05
209
+define ("_DELETESERIES", "Delete Series");
210
+define ("_EDITSERIES", "Edit Series");
211
+define ("_MANAGESERIES", "Manage Series");
212
+define ("_MODERATED", "Moderated"); // Added 02-10-07
213
+define ("_OPEN", "Open");
214
+define ("_OPENNOTE", "<span style=\"font-weight: bold; text-decoration: underline;\">Note:</span>  An open series is a shared universe (sometimes called a sandbox) in which other authors may add to the series.  
227 215
 By marking your series as open, <u>other authors will be able to add to the series.</u>  A moderated series will allow other authors to add to the series, but those entries must be approved by the series owner. 
228
-Only the series owner (and the site admins) may add to a closed series.');
229
-define('_REMOVEFROM', 'Remove From Series');
230
-define('_SERIESNOTE', '<span style="font-weight: bold; text-decoration: underline;">Note:</span>  You will choose the stories to add to your series on the next page.');
231
-define('_SERIESNOTE2', '<span style="font-weight: bold; text-decoration: underline;">Note:</span>  You will set the order of your stories and subseries on the next page.');
232
-define('_SERIESTYPE', 'Series Type'); // Added 02-10-07
233
-define('_SERIESTITLEREQUIRED', 'A title for the series is required!');
234
-define('_NEWSERIESITEMS', "New items have been submitted to your series, %1\$s, at $sitename.  To validate these additions log in to your account.");
235
-define('_SERIESITEMSSUBS', "New items for %1\$s at $sitename");
216
+Only the series owner (and the site admins) may add to a closed series.");
217
+define ("_REMOVEFROM", "Remove From Series");
218
+define ("_SERIESNOTE", "<span style=\"font-weight: bold; text-decoration: underline;\">Note:</span>  You will choose the stories to add to your series on the next page.");
219
+define ("_SERIESNOTE2", "<span style=\"font-weight: bold; text-decoration: underline;\">Note:</span>  You will set the order of your stories and subseries on the next page.");
220
+define ("_SERIESTYPE", "Series Type"); // Added 02-10-07
221
+define ("_SERIESTITLEREQUIRED", "A title for the series is required!");
222
+define ("_NEWSERIESITEMS", "New items have been submitted to your series, %1\$s, at $sitename.  To validate these additions log in to your account.");
223
+define ("_SERIESITEMSSUBS", "New items for %1\$s at $sitename");
236 224
 
237 225
 // Stories
238 226
 
239
-define('_ADDNEWCHAPTER', 'Add New Chapter');
240
-define('_ADDNEWSTORY', 'Add New Story');
241
-define('_ADDSTORY', 'Add Story');
242
-define('_AUTHOR', 'Author');
243
-define('_AUTHORALERTNOTE', "One of your favorite authors at $sitename has posted a new story.<br><br>%1\$s "._BY." %2\$s<br><br>%3\$s<br><br><a href=\"$url/viewstory.php?sid=%4\$d\">$url/viewstory.php?sid=%4\$d</a>If you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
227
+define ("_ADDNEWCHAPTER", "Add New Chapter");
228
+define ("_ADDNEWSTORY", "Add New Story");
229
+define ("_ADDSTORY", "Add Story");
230
+define ("_AUTHOR", "Author");
231
+define ("_AUTHORALERTNOTE", "One of your favorite authors at $sitename has posted a new story.<br><br>%1\$s "._BY." %2\$s<br><br>%3\$s<br><br><a href=\"$url/viewstory.php?sid=%4\$d\">$url/viewstory.php?sid=%4\$d</a>If you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
244 232
 on $sitename, and edit your profile.");  // Modified 2-3-10 to add reminder for turning off alerts
245
-define('_CHAPTERNOTES', 'Chapter Notes');
246
-define('_CHAPTERTITLE', 'Chapter Title');
247
-define('_COAUTHORS', 'Co-Authors');
248
-define('_COMPLETE', 'Complete');
249
-define('_CURRENT', 'Current');
250
-define('_DELETECHAPTERTITLE', 'Delete Chapter');
251
-define('_DELETESTORY', 'Are you sure you want to delete this story? All chapters beneath it will be deleted as well!');
252
-define('_DELETESTORYTITLE', 'Delete Story');
253
-define('_EDITCHAPTER', 'Edit Chapter');
254
-define('_EDITSTORY', 'Edit Story');
255
-define('_ENDNOTES', 'End Notes');
256
-define('_FEATURED', 'Featured');
257
-define('_HIDECHAPTERS', 'Hide Chapters');
258
-define('_INVALIDUPLOAD', 'Invalid Upload!  File uploads must be in plain text or html format.');
259
-define('_LOCKED', 'This category is locked.');
260
-define('_MANAGESTORIES', 'Manage Stories');
261
-define('_MISSINGFIELDS', 'Some of the required information is missing.  Please check your input.  Required fields are title, summary, '.($multiplecats ? strtolower(_CATEGORIES.', ') : '').'rating, and story text.'); // Modified 11/06/05 - If categories are turned off don't show category as required field. :)
262
-define('_NEWSTORYAT', 'New Story at ');
263
-define('_NEWSTORYAT2', "A new story has been submitted to the validation queue at $sitename.<br><br> %1\$s by %2\$s<br><br>%3\$s\n\nIf you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
233
+define ("_CHAPTERNOTES", "Chapter Notes");
234
+define ("_CHAPTERTITLE", "Chapter Title");
235
+define ("_COAUTHORS", "Co-Authors");
236
+define ("_COMPLETE", "Complete");
237
+define ("_CURRENT", "Current");
238
+define ("_DELETECHAPTERTITLE", "Delete Chapter");
239
+define ("_DELETESTORY", "Are you sure you want to delete this story? All chapters beneath it will be deleted as well!");
240
+define ("_DELETESTORYTITLE", "Delete Story");
241
+define ("_EDITCHAPTER", "Edit Chapter");
242
+define ("_EDITSTORY", "Edit Story");
243
+define ("_ENDNOTES", "End Notes");
244
+define ("_FEATURED", "Featured");
245
+define ("_HIDECHAPTERS", "Hide Chapters");
246
+define ("_INVALIDUPLOAD", "Invalid Upload!  File uploads must be in plain text or html format.");
247
+define ("_LOCKED", "This category is locked.");
248
+define ("_MANAGESTORIES", "Manage Stories");
249
+define ("_MISSINGFIELDS", "Some of the required information is missing.  Please check your input.  Required fields are title, summary, ".($multiplecats ? strtolower(_CATEGORIES.", ") : "")."rating, and story text."); // Modified 11/06/05 - If categories are turned off don't show category as required field. :)
250
+define ("_NEWSTORYAT", "New Story at ");
251
+define ("_NEWSTORYAT2", "A new story has been submitted to the validation queue at $sitename.<br><br> %1\$s by %2\$s<br><br>%3\$s\n\nIf you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
264 252
 on $sitename, and edit your profile.");  // Modified 2-3-10 to add reminder for turning off alerts
265
-define('_NOSTORYTEXT', 'You must include the text of your story either as an upload or as input into the textarea.');
266
-define('_READS', 'Read Count');
267
-define('_ROUNDROBIN', 'Round robin');
268
-define('_STORYADDED', 'Your story has been added. If the admin is reviewing submissions, then it will appear to the public after they have okayed it. In the meantime, you can always edit the story in your account area.');
269
-define('_STORYALERT', "Update to favorites at $sitename");
270
-define('_STORYALERTNOTE', "%1\$s by %2\$s, one of your favorite stories at $sitename, has been updated.<br><br><a href=\"$url/viewstory.php?sid=%3\$d&amp;chapter=%4\$d\">$url/viewstory.php?sid=%3\$d&amp;chapter=%4\$d</a>\n\nIf you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
253
+define ("_NOSTORYTEXT", "You must include the text of your story either as an upload or as input into the textarea.");
254
+define ("_READS", "Read Count");
255
+define ("_ROUNDROBIN", "Round robin");
256
+define ("_STORYADDED", "Your story has been added. If the admin is reviewing submissions, then it will appear to the public after they have okayed it. In the meantime, you can always edit the story in your account area.");
257
+define ("_STORYALERT", "Update to favorites at $sitename");
258
+define ("_STORYALERTNOTE", "%1\$s by %2\$s, one of your favorite stories at $sitename, has been updated.<br><br><a href=\"$url/viewstory.php?sid=%3\$d&amp;chapter=%4\$d\">$url/viewstory.php?sid=%3\$d&amp;chapter=%4\$d</a>\n\nIf you no longer wish to receive e-mails such as this, please go to <a href='$url/user.php'>your account</a>\r\n
271 259
 on $sitename, and edit your profile."); // Modified 2-3-10 to add reminder for turning off alerts
272
-define('_STORYNOTES', 'Story Notes');
273
-define('_STORYTEXTTEXT', 'Story Text (text)');
274
-define('_STORYTEXTFILE', 'Story Text (file)');
275
-define('_STORYUPDATED', 'The story has been updated.');
276
-define('_VALIDATED', 'Validated');
277
-define('_VIEWCHAPTERS', 'View Chapters');
278
-define('_WORDCOUNTFAILED', 'Your story failed to meet the required minimum or maximum word count for story submission on this site.  Each chapter must be'.($minwords ? ' no less than '.$minwords : '').($maxwords ? ($minwords ? ' and' : '')." no more than $maxwords " : '').' words long.');
260
+define ("_STORYNOTES", "Story Notes");
261
+define ("_STORYTEXTTEXT", "Story Text (text)");
262
+define ("_STORYTEXTFILE", "Story Text (file)");
263
+define ("_STORYUPDATED", "The story has been updated.");
264
+define ("_VALIDATED", "Validated");
265
+define ("_VIEWCHAPTERS", "View Chapters");
266
+define ("_WORDCOUNTFAILED", "Your story failed to meet the required minimum or maximum word count for story submission on this site.  Each chapter must be".($minwords ? " no less than ".$minwords : "").($maxwords ? ($minwords ? " and" : "")." no more than $maxwords " : "")." words long.");
267
+
279 268
 
280 269
 // User
281 270
 
282
-define('_USERACCOUNT', 'Member Account');
271
+define ("_USERACCOUNT", "Member Account");
283 272
 
284 273
 // User --  Edit prefs
285
-define('_ALERTSON2', 'Contact when favorites are updated.');
286
-define('_BETANOTE', 'I would like to volunteer to be a beta-reader for others.');
287
-define('_CONTACTREVIEWS', 'Contact for new reviews');
288
-define('_CONTACTRESPOND', 'Contact when author responds to review');
289
-define('_DEFAULTSORT', 'Default Story Sort');
290
-define('_DISPLAYINDEX', 'Display table of contents for stories.');
291
-define('_EDITPREFS', 'Edit Preferences');
292
-define('_REQUIREDFIELDS', 'Indicates required fields.');
293
-define('_SKIN', 'Skin');
294
-define('_USETINYMCE', 'Use tinyMCE WYSWYG editor');
274
+define ("_ALERTSON2", "Contact when favorites are updated.");
275
+define ("_BETANOTE", "I would like to volunteer to be a beta-reader for others.");
276
+define ("_CONTACTREVIEWS", "Contact for new reviews");
277
+define ("_CONTACTRESPOND", "Contact when author responds to review");
278
+define ("_DEFAULTSORT", "Default Story Sort");
279
+define ("_DISPLAYINDEX", "Display table of contents for stories.");
280
+define ("_EDITPREFS", "Edit Preferences");
281
+define ("_REQUIREDFIELDS", "Indicates required fields.");
282
+define ("_SKIN", "Skin");
283
+define ("_USETINYMCE", "Use tinyMCE WYSWYG editor");
295 284
 
296 285
 // User - Edit Bio/Registration (default)
297
-define('_AOL', 'AOL IM');
298
-define('_BADEMAIL', "That address doesn't appear to be in our database. Please <a href=\"member.php?action=lostpassword\">try again.</a>");
299
-define('_BADUSERNAME', 'Sorry! Usernames can only contain letters, numbers, underscores, hyphens, or spaces, and must be between 3 and 20 characters long.');
300
-define('_BIO', 'Bio');
301
-define('_EDITPERSONAL', 'Edit Personal Information');
302
-define('_EMAILINUSE', "This email address has already been used to sign up for an account. If you've lost your password, please generate a new one by using the <a href=\"member.php?action=lostpassword\">lost password</a> feature.");
303
-define('_ICQ', 'ICQ');
304
-define('_INVALIDEMAIL', 'The e-mail address you supplied is an invalid format.');
305
-define('_NEWACCOUNT', 'New Account');
306
-define('_NEWPEN', '%1$s ( %2$d ) changed penname %3$s ( %4$d ) to %5$s.');
307
-define('_MSN', 'MSN IM');
308
-define('_PASSWORD', 'Password');
309
-define('_PASSWORD2', 'Confirm Password');
310
-define('_PASSWORDTWICE', 'You must enter your new password twice. Please <a href="member.php?action='.$action.'">try again</a>.');
311
-define('_PWDREQUIRED', 'A password is required to access this function.');
312
-define('_PENEMAILREQUIRED', 'You must fill out the penname and email fields. Please <a href="member.php?action=newaccount">try again</a>.');
313
-define('_PENNAMEINUSE', 'This penname is already in use.');
314
-define('_REALNAME', 'Real name');
315
-define('_REGISTER', 'Register');
316
-define('_REGLOG', '%1$s (%2$d) registered from IP address %3$s.');
317
-define('_SIGNUPSUBJECT', "Welcome to $sitename");
318
-define('_SIGNUPMESSAGE', "Hello, you or someone using your email has signed you up at $sitename. Your login and password are below:\n\n");
319
-define('_SIGNUPTHANKS', 'Thank you for signing up! You will receive '.(!$pwdsetting ? 'your temporary password' : 'a confirmation').' at the e-mail address you provided.');
320
-define('_SIGNUPWARNING', 'It is recommended that you log in and change the password to something easier for you to remember.');
321
-define('_TRYAGAIN', 'Please try again.');
322
-define('_WEBSITE', 'Website');
323
-define('_YAHOO', 'Yahoo IM');
286
+define ("_AOL", "AOL IM");
287
+define ("_BADEMAIL", "That address doesn't appear to be in our database. Please <a href=\"user.php?action=lostpassword\">try again.</a>");
288
+define ("_BADUSERNAME", "Sorry! Usernames can only contain letters, numbers, underscores, hyphens, or spaces, and must be between 3 and 20 characters long.");
289
+define ("_BIO", "Bio");
290
+define ("_EDITPERSONAL", "Edit Personal Information");
291
+define ("_EMAILINUSE", "This email address has already been used to sign up for an account. If you've lost your password, please generate a new one by using the <a href=\"user.php?action=lostpassword\">lost password</a> feature.");
292
+define ("_ICQ", "ICQ");
293
+define ("_INVALIDEMAIL", "The e-mail address you supplied is an invalid format.");
294
+define ("_NEWACCOUNT", "New Account");
295
+define ("_NEWPEN", "%1\$s ( %2\$d ) changed penname %3\$s ( %4\$d ) to %5\$s.");
296
+define ("_MSN", "MSN IM");
297
+define ("_PASSWORD", "Password");
298
+define ("_PASSWORD2", "Confirm Password");
299
+define ("_PASSWORDTWICE", "You must enter your new password twice. Please <a href=\"user.php?action=".$action."\">try again</a>.");
300
+define ("_PWDREQUIRED", "A password is required to access this function.");
301
+define ("_PENEMAILREQUIRED", "You must fill out the penname and email fields. Please <a href=\"user.php?action=newaccount\">try again</a>.");
302
+define ("_PENNAMEINUSE", "This penname is already in use.");
303
+define ("_REALNAME", "Real name");
304
+define ("_REGISTER", "Register");
305
+define ("_REGLOG", "%1\$s (%2\$d) registered from IP address %3\$s.");
306
+define ("_SIGNUPSUBJECT", "Welcome to $sitename");
307
+define ("_SIGNUPMESSAGE", "Hello, you or someone using your email has signed you up at $sitename. Your login and password are below:\n\n");
308
+define ("_SIGNUPTHANKS", "Thank you for signing up! You will receive ".(!$pwdsetting ? "your temporary password" : "a confirmation")." at the e-mail address you provided.");
309
+define ("_SIGNUPWARNING",  "It is recommended that you log in and change the password to something easier for you to remember.");
310
+define ("_TRYAGAIN", "Please try again.");
311
+define ("_WEBSITE", "Website");
312
+define ("_YAHOO", "Yahoo IM");
324 313
 
325 314
 // User - Image Management
326 315
 
327
-define('_ALLOWEDEXT', 'Only files with the following extensions are allowed: ');
328
-define('_ALREADYEXISTS', 'Uploading <strong>%s...Error!</strong> Sorry, a file with this name already exists.');
329
-define('_BADFILENAMES', 'You have tried to upload the following files with invalid characters inside the filename.');
330
-define('_FILENAME', 'Filename');
331
-define('_FILENOTEXISTS', 'The file <strong>%s</strong> does not exist.');
332
-define('_IMAGE', 'Image');
333
-define('_IMAGECODE', 'HTML code to use image in story');
334
-define('_IMAGETOOBIG', "This image is too big. Images may only be $imagewidth wide by $imageheight high. Please <a href=\"member.php?action=manageimages&upload=upload\">try again</a>.");
335
-define('_INVALIDNAME', 'Sorry, the filename contains invalid characters. Use only alphanumerical chars and separate parts of the name (if needed) with an underscore. <br>A valid filename ends with one dot followed by the extension.');
336
-define('_MANAGEIMAGES', 'Manage Images');
337
-define('_MAXFILENAME', 'The filename exceeds the maximum length of %s characters.');
338
-define('_MAXFSSERVER', 'The uploaded file exceeds the max. upload filesize directive in the server configuration.');
339
-define('_MAXFSFORM', 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form.');
340
-define('_NODIRECTORY', "Sorry, the upload directory doesn't exist!");
341
-define('_NOFILESSELECTED', 'Select at least on file.');
342
-define('_NOFILESELECTED', 'No file was uploaded.');
343
-define('_PARTIALUPLOAD', 'The uploaded file was only partially uploaded');
344
-define('_RENAMEDTO', 'The uploaded file was renamed to <b>%s</b>.');
345
-define('_SELECTFILE', 'Please select a file for upload.');
346
-define('_UPLOADIMAGE', 'Upload New Images');
347
-define('_UPLOADSUCCESS', '<strong>%s</strong> successfully uploaded!');
348
-define('_VIEW', 'View');
349
-define('_WRONGEXT', 'You have tried to upload %1$d files with a bad extension, the following extensions are allowed: <strong>%2$s</strong>');
316
+define ("_ALLOWEDEXT","Only files with the following extensions are allowed: ");
317
+define ("_ALREADYEXISTS", "Uploading <strong>%s...Error!</strong> Sorry, a file with this name already exists.");
318
+define ("_BADFILENAMES", "You have tried to upload the following files with invalid characters inside the filename.");
319
+define ("_FILENAME", "Filename");
320
+define ("_FILENOTEXISTS", "The file <strong>%s</strong> does not exist.");
321
+define ("_IMAGE", "Image");
322
+define ("_IMAGECODE", "HTML code to use image in story");
323
+define ("_IMAGETOOBIG", "This image is too big. Images may only be $imagewidth wide by $imageheight high. Please <a href=\"user.php?action=manageimages&upload=upload\">try again</a>.");
324
+define ("_INVALIDNAME", "Sorry, the filename contains invalid characters. Use only alphanumerical chars and separate parts of the name (if needed) with an underscore. <br>A valid filename ends with one dot followed by the extension.");
325
+define ("_MANAGEIMAGES", "Manage Images");
326
+define ("_MAXFILENAME", "The filename exceeds the maximum length of %s characters.");
327
+define ("_MAXFSSERVER", "The uploaded file exceeds the max. upload filesize directive in the server configuration.");
328
+define ("_MAXFSFORM", "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form.");
329
+define ("_NODIRECTORY", "Sorry, the upload directory doesn't exist!");
330
+define ("_NOFILESSELECTED", "Select at least on file.");
331
+define ("_NOFILESELECTED", "No file was uploaded.");
332
+define ("_PARTIALUPLOAD", "The uploaded file was only partially uploaded");
333
+define ("_RENAMEDTO", "The uploaded file was renamed to <b>%s</b>.");
334
+define ("_SELECTFILE", "Please select a file for upload.");
335
+define ("_UPLOADIMAGE", "Upload New Images");
336
+define ("_UPLOADSUCCESS", "<strong>%s</strong> successfully uploaded!");
337
+define ("_VIEW", "View");
338
+define ("_WRONGEXT", "You have tried to upload %1\$d files with a bad extension, the following extensions are allowed: <strong>%2\$s</strong>");
350 339
 
351 340
 // User - Lost password
352 341
 
353
-define('_ENTEREMAIL', 'Enter your e-mail address');
354
-define('_LOSTPASSWORD', 'Lost password');
355
-define('_NEWPWDSUB', "New Password for $sitename");
356
-define('_NEWPWDMSG', "Hello, you appear to have requested a new password for $sitename. Your new password is:\n\nPassword: %s\n\nIt is recommended that you log in and change the password to something easier for you to remember.");
357
-define('_PASSWORDSENT', 'A new password has been sent to your e-mail address.');
342
+define ("_ENTEREMAIL", "Enter your e-mail address");
343
+define ("_LOSTPASSWORD", "Lost password");
344
+define ("_NEWPWDSUB", "New Password for $sitename");
345
+define ("_NEWPWDMSG", "Hello, you appear to have requested a new password for $sitename. Your new password is:\n\nPassword: %s\n\nIt is recommended that you log in and change the password to something easier for you to remember.");
346
+define ("_PASSWORDSENT", "A new password has been sent to your e-mail address.");
358 347
 
359 348
 // User - Stats
360 349
 
361
-define('_AUTHOROF', 'Author of:');
362
-define('_FAVOF', 'Favorite author of');
363
-define('_FAVORITE', 'Favorite');
364
-define('_MANAGEREVIEWS', 'Manage Your Reviews');
365
-define('_STATSFOR', 'Statistics for ');
366
-define('_UNRESPONDED', 'Unresponded');
367
-define('_YOURFAVORITES', 'Your Favorites');
368
-define('_YOURSTATS', 'Your Statistics');
369
-define('_YOURREVIEWS', 'Your Reviews');
350
+define ("_AUTHOROF", "Author of:");
351
+define ("_FAVOF", "Favorite author of");
352
+define ("_FAVORITE", "Favorite");
353
+define ("_MANAGEREVIEWS", "Manage Your Reviews");
354
+define ("_STATSFOR", "Statistics for ");
355
+define ("_UNRESPONDED", "Unresponded");
356
+define ("_YOURFAVORITES", "Your Favorites");
357
+define ("_YOURSTATS", "Your Statistics");
358
+define ("_YOURREVIEWS", "Your Reviews");
370 359
 
371 360
 // User - Manage Favorites
372 361
 
373
-define('_MANAGEFAVORITES', 'Manage Favorites');
374
-define('_REMOVEFAV', 'Remove Favorite');
362
+define ("_MANAGEFAVORITES", "Manage Favorites");
363
+define ("_REMOVEFAV", "Remove Favorite");
375 364
 
376 365
 // User - Login
377 366
 
378
-define('_WRONGPASSWORD', "That password doesn't match the one in our database. Please <a href=\"member.php?action=login\">try again</a> or retrieve a <a href=\"member.php?action=lostpassword\">new password</a> if you can't remember yours.");
379
-define('_ACCOUNTLOCKED', "This account has been locked by the adminstrators of this site.  Please <a href='contact.php'>contact</a> the site adminstrators for more information.");
380
-define('_NOSUCHACCOUNT', 'There is no such account on our website.'); // Added 6-18-2008
367
+define ("_WRONGPASSWORD", "That password doesn't match the one in our database. Please <a href=\"user.php?action=login\">try again</a> or retrieve a <a href=\"user.php?action=lostpassword\">new password</a> if you can't remember yours.");
368
+define ("_ACCOUNTLOCKED", "This account has been locked by the adminstrators of this site.  Please <a href='contact.php'>contact</a> the site adminstrators for more information.");
369
+define ("_NOSUCHACCOUNT", "There is no such account on our website."); // Added 6-18-2008
381 370
 
382 371
 // User - Review Response
383
-define('_AUTHORSRESPONSE', "Author's Response");
384
-define('_RESPONSESUBJECT', "Author Response to Your Review at $sitename");
385
-define('_RESPONSETEXT', "{penname} has responded to your review.\r\n\r\nYou can see the response at <a href=\"".$url.'/reviews.php?reviewid={review}">'.$url.'/reviews.php?reviewid={review}</a>');
372
+define("_AUTHORSRESPONSE", "Author's Response");
373
+define ("_RESPONSESUBJECT", "Author Response to Your Review at $sitename");
374
+define ("_RESPONSETEXT", "{penname} has responded to your review.\r\n\r\nYou can see the response at <a href=\"".$url."/reviews.php?reviewid={review}\">".$url."/reviews.php?reviewid={review}</a>");
386 375
 
387 376
 // View story
388 377
 
389
-define('_ACCESSDENIED', 'Access denied. This story has not been validated by the adminstrators of this site.');
390
-define('_ARCHIVEDAT', 'This story archived at');
391
-define('_BACK2INDEX', 'Back to index');
392
-define('_CONTINUE', 'Continue');
393
-define('_CONTRIBUTE2RR', 'Contribute to Round Robin');
394
-define('_INVALIDSTORY', "That story does not exist on this archive.  You may <a href='searching.php'>search</a> for it or return to <a href='index.php'>the home page.</a>");
395
-define('_LOGINTOREVIEW', 'You must %1$s (%2$s) to review.');
396
-define('_SUBMITREVIEW', 'Submit a Review');
397
-define('_TEXTSIZE', 'Text Size');
378
+define ("_ACCESSDENIED", "Access denied. This story has not been validated by the adminstrators of this site.");
379
+define ("_ARCHIVEDAT", "This story archived at");
380
+define ("_BACK2INDEX", "Back to index");
381
+define ("_CONTINUE", "Continue");
382
+define ("_CONTRIBUTE2RR", "Contribute to Round Robin");
383
+define ("_INVALIDSTORY", "That story does not exist on this archive.  You may <a href='search.php'>search</a> for it or return to <a href='index.php'>the home page.</a>");
384
+define ("_LOGINTOREVIEW", "You must %1\$s (%2\$s) to review.");
385
+define ("_SUBMITREVIEW", "Submit a Review");
386
+define ("_TEXTSIZE", "Text Size");
398 387
 
399 388
 // View User
400 389
 
401
-define('_ADMINISTRATOR', 'Administrator');
402
-define('_CONTACT', 'Contact');
403
-define('_CONTACTAUTHOR', 'Contact Author:');
404
-define('_EDITADMIN', 'Edit Admin Privileges');
405
-define('_FAVORITEAUTHORS', 'Favorite Authors'); // Added for 3.0
406
-define('_FAVORITESERIES', 'Favorite Series'); // Added for 3.0
407
-define('_FAVORITESTORIES', 'Favorite Stories'); // Added for 3.0
408
-define('_FAVORITESOF', 'Favorites of '); // Added for 3.0
409
-define('_LOCKMEM', 'Lock Account');
410
-define('_MAKEADMIN', 'Make User an Admin');
411
-define('_REVOKEADMIN', 'Revoke Admin Privileges');
412
-define('_REVOKEVAL', 'Revoke Validation');
413
-define('_REVIEWSBY', 'Reviews by ');
414
-define('_SERIESBY', 'Series by ');
415
-define('_SITESIG', "This message was sent to you from $sitename located at <a href='$url'>$url</a>.");
416
-define('_SITESIG2', "This message was sent to you by %s from $sitename located at <a href='$url'>$url</a>.");
417
-define('_STORIESBY', 'Stories by');
418
-define('_SUBJECT', 'Subject');
419
-define('_UNLOCKMEM', 'Unlock Account');
420
-define('_VALIDATE', 'Validate');
421
-
422
-// Tooltip help for various items.
423
-define('_HELP_NEWREV', 'Check this box if you wish to receive an e-mail notice each time you get a new review.');
424
-define('_HELP_NEWRESP', 'Check this box if you wish to receive an e-mail notice each time an author resonds to your review.');
425
-define('_HELP_FAVALERT', "Check this box if you wish to receive an e-mail notice each time one of your favorite stories is updated or when one of your favorites author's publishes a new story.");
426
-define('_HELP_BETA', "Check this box if you are willing to have other author's contact you to read their stories before they are published and provide the feedback and help the author requests.");
427
-define('_HELP_TOC', 'Check this box if you wish to see the story index first rather than the first chapter of the story on multi-chapters.');
428
-define('_HELP_TINYMCE', 'Check this box if you wish to use the tinyMCE editor when entering content in forms.  You will have the option to toggle the editor on/off if need be.');
429
-define('_HELP_AGE', 'By agreeing, you are confirming you are above the age of majority in your locality and that you wish to view the adult oriented material on this site.');
430
-define('_HELP_DEFAULTSORT', 'Select the order in which to sort stories by default.  Your choices are Alphabetically or Most Recent (newest to oldest).');
431
-define('_HELP_SKIN', 'Choose the appearance of the site.');
390
+define ("_ADMINISTRATOR", "Administrator");
391
+define ("_CONTACT", "Contact");
392
+define ("_CONTACTAUTHOR", "Contact Author:");
393
+define ("_EDITADMIN", "Edit Admin Privileges");
394
+define ("_FAVORITEAUTHORS", "Favorite Authors"); // Added for 3.0
395
+define ("_FAVORITESERIES", "Favorite Series"); // Added for 3.0
396
+define ("_FAVORITESTORIES", "Favorite Stories"); // Added for 3.0
397
+define ("_FAVORITESOF", "Favorites of "); // Added for 3.0
398
+define ("_LOCKMEM", "Lock Account");
399
+define ("_MAKEADMIN", "Make User an Admin");
400
+define ("_REVOKEADMIN", "Revoke Admin Privileges");
401
+define ("_REVOKEVAL", "Revoke Validation");
402
+define ("_REVIEWSBY", "Reviews by ");
403
+define ("_SERIESBY", "Series by ");
404
+define ("_SITESIG", "This message was sent to you from $sitename located at <a href='$url'>$url</a>.");
405
+define ("_SITESIG2", "This message was sent to you by %s from $sitename located at <a href='$url'>$url</a>.");
406
+define ("_STORIESBY", "Stories by");
407
+define ("_SUBJECT", "Subject");
408
+define ("_UNLOCKMEM", "Unlock Account");
409
+define ("_VALIDATE", "Validate");
410
+
411
+// Tooltip help for various items.  
412
+define ("_HELP_NEWREV", "Check this box if you wish to receive an e-mail notice each time you get a new review.");
413
+define ("_HELP_NEWRESP", "Check this box if you wish to receive an e-mail notice each time an author resonds to your review.");
414
+define ("_HELP_FAVALERT", "Check this box if you wish to receive an e-mail notice each time one of your favorite stories is updated or when one of your favorites author's publishes a new story.");
415
+define ("_HELP_BETA", "Check this box if you are willing to have other author's contact you to read their stories before they are published and provide the feedback and help the author requests.");
416
+define ("_HELP_TOC", "Check this box if you wish to see the story index first rather than the first chapter of the story on multi-chapters.");
417
+define ("_HELP_TINYMCE", "Check this box if you wish to use the tinyMCE editor when entering content in forms.  You will have the option to toggle the editor on/off if need be.");
418
+define ("_HELP_AGE", "By agreeing, you are confirming you are above the age of majority in your locality and that you wish to view the adult oriented material on this site.");
419
+define ("_HELP_DEFAULTSORT", "Select the order in which to sort stories by default.  Your choices are Alphabetically or Most Recent (newest to oldest).");
420
+define ("_HELP_SKIN", "Choose the appearance of the site.");
432 421
 
433 422
 // Log strings
434
-define('_LOG_ADMIN_DEL', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>.");
435
-define('_LOG_ADMIN_EDIT', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>.");
436
-define('_LOG_ADMIN_DEL_CHAPTER', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>, chapter %7\$d");
437
-define('_LOG_ADMIN_EDIT_CHAPTER', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>, chapter %7\$d");
438
-define('_LOG_ADMIN_EDIT_AUTHOR', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> changed the author of <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%8\$7'>%5\$s</a> to <a href='viewuser.php?uid=%6\$d'>%5\$s</a>.");
439
-define('_LOG_ADMIN_DEL_SERIES', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted the series '%3\$s'.");
440
-define('_LOG_ADMIN_EDIT_SERIES', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited the series '<a href='viewseries.php?seriesid=%4\$d'>%3\$s</a>'.");
441
-define('_LOG_ADMIN_DEL_FROM_SERIES', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a> from '<a href='viewseries.php?seriesid=%8\$d'>%7\$s</a>.'");
442
-define('_LOG_BAD_LOGIN', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> entered a wrong password trying to log in.");
443
-define('_LOG_LOST_PASSWORD', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> requested a new password.  Password sent: %3\$s.");
444
-define('_LOG_ADMIN_REG', '%1$s (%2$d) was registered by %3$s (%4$d) from IP address %5$s.');
445
-define('_LOG_REGISTER', '%1$s (%2$d) registered from IP address %3$s.');
446
-define('_LOG_REVIEW', "%1\$s wrote '%2\$s' as a review for '%3\$s'.");
447
-define('_LOG_EDIT_REVIEW', "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited <a href='reviews.php?reviewid=%4\$d'>a review</a> for '%3\$s'.");
423
+define ("_LOG_ADMIN_DEL", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>.");
424
+define ("_LOG_ADMIN_EDIT", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>.");
425
+define ("_LOG_ADMIN_DEL_CHAPTER", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>, chapter %7\$d");
426
+define ("_LOG_ADMIN_EDIT_CHAPTER", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a>, chapter %7\$d");
427
+define ("_LOG_ADMIN_EDIT_AUTHOR", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> changed the author of <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%8\$7'>%5\$s</a> to <a href='viewuser.php?uid=%6\$d'>%5\$s</a>.");
428
+define ("_LOG_ADMIN_DEL_SERIES", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted the series '%3\$s'.");
429
+define ("_LOG_ADMIN_EDIT_SERIES", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited the series '<a href='viewseries.php?seriesid=%4\$d'>%3\$s</a>'.");
430
+define ("_LOG_ADMIN_DEL_FROM_SERIES", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> deleted <a href='viewstory.php?sid=%4\$d'>%3\$s</a> by <a href='viewuser.php?uid=%6\$d'>%5\$s</a> from '<a href='viewseries.php?seriesid=%8\$d'>%7\$s</a>.'");
431
+define ("_LOG_BAD_LOGIN", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> entered a wrong password trying to log in.");
432
+define ("_LOG_LOST_PASSWORD", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> requested a new password.  Password sent: %3\$s.");
433
+define ("_LOG_ADMIN_REG", "%1\$s (%2\$d) was registered by %3\$s (%4\$d) from IP address %5\$s.");
434
+define ("_LOG_REGISTER", "%1\$s (%2\$d) registered from IP address %3\$s.");
435
+define ("_LOG_REVIEW", "%1\$s wrote '%2\$s' as a review for '%3\$s'.");
436
+define ("_LOG_EDIT_REVIEW", "<a href='viewuser.php?uid=%2\$d'>%1\$s</a> edited <a href='reviews.php?reviewid=%4\$d'>a review</a> for '%3\$s'.");
448 437
 
449 438
 // Report Types
450 439
 
451
-define('_REPORT', 'Report');
452
-define('_MISSING', 'Missing Information');
453
-define('_RULESVIOLATION', 'Violation of Rules');
454
-define('_BUGREPORT', 'Bug Report');
455
-define('_REPORTTHIS', 'Report This');
440
+define ("_REPORT", "Report");
441
+define ("_MISSING", "Missing Information");
442
+define ("_RULESVIOLATION", "Violation of Rules");
443
+define ("_BUGREPORT", "Bug Report");
444
+define ("_REPORTTHIS", "Report This");
445
+
446
+?>
456 447
\ No newline at end of file
... ...
@@ -63,7 +63,7 @@ else include_once(_BASEDIR."modules/challenges/languages/en.php");
63 63
 
64 64
 
65 65
 	$count = dbquery("SELECT count(chalid) FROM ".TABLEPREFIX."fanfiction_challenges as chal $chalquery");
66
-	$query = "SELECT chal.* FROM ".TABLEPREFIX."fanfiction_challenges as chal $chalquery ORDER BY title LIMIT $offset, $itemsperpage";
66
+	$query = "SELECT chal.* FROM ".TABLEPREFIX."fanfiction_challenges as chal $chalquery ORDER BY chalid DESC LIMIT $offset, $itemsperpage";
67 67
 
68 68
 	list($numrows) = dbrow($count);
69 69
 	if($numrows > 0) {
... ...
@@ -164,10 +164,10 @@ else if($action == "edit" || $action == "add") {
164 164
 				$uidquery = dbquery("SELECT uid,title, coauthors FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$item'");
165 165
 				list($author, $title, $coauthors) = dbrow($uidquery);
166 166
 				if($coauthors) {
167
-					$coauthors = array( );
167
+					$array_coauthors = array( );
168 168
 					$coQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$item'");
169 169
 					while($c = dbassoc($coQuery)) {
170
-						$coauthors[] = $c['uid'];
170
+						$array_coauthors[] = $c['uid'];
171 171
 					}
172 172
 				}
173 173
 			}
... ...
@@ -186,7 +186,7 @@ else if($action == "edit" || $action == "add") {
186 186
 				}
187 187
 			}
188 188
 			if($review != "No Review" && $action == "add") {
189
-				$mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $coauthors) : ""));
189
+				$mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $array_coauthors) : ""));
190 190
 				while($mail = dbassoc($mailquery)) {
191 191
 					if($mail['newreviews']) {
192 192
 						include_once("includes/emailer.php");
... ...
@@ -219,8 +219,8 @@ else if($action == "edit" || $action == "add") {
219 219
 					}
220 220
 				}
221 221
 				$reviewname = $reviewer."(".$_SERVER['REMOTE_ADDR'].")";
222
-				if($action == "add") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_REVIEW, $reviewname, truncate_text($review), $title))."', '0', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RE')");
223
-				else dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_EDIT_REVIEW, USERPENNAME, USERUID, $title, $reviewid))."', '0', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RE')");
222
+				if($action == "add") dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_REVIEW, $reviewname, truncate_text($review), $title))."', '0', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RE', " . time() . ")");
223
+				else dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_EDIT_REVIEW, USERPENNAME, USERUID, $title, $reviewid))."', '0', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RE', " . time() . ")");
224 224
 			}
225 225
 		}
226 226
 	}
... ...
@@ -247,10 +247,11 @@ else {
247 247
 		$story = dbassoc($storyquery);
248 248
 		$title = title_link($story);
249 249
 		$authoruid = $story['uid'];
250
+		$array_coauthors = array();
250 251
 		if(!empty($story['coauthors'])) {
251 252
 			$colist = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$item'");
252 253
 			while($c = dbassoc($colist)) {
253
-				$coauthors[] = $c['uid'];
254
+				$array_coauthors[] = $c['uid'];
254 255
 			}
255 256
 		}
256 257
 	}
... ...
@@ -308,7 +309,7 @@ else {
308 309
 			$jumpmenu .= "</select></form>";
309 310
 		}
310 311
 		$tpl->assign("jumpmenu", $jumpmenu );
311
-		$query = "SELECT review.reviewid, review.respond, review.review, review.uid, review.reviewer, review.rating, UNIX_TIMESTAMP(review.date) as date, series.title as seriestitle, stories.title as title FROM ".TABLEPREFIX."fanfiction_reviews as review LEFT JOIN ".TABLEPREFIX."fanfiction_series as series ON review.item = series.seriesid AND review.type = 'SE' LEFT JOIN ".TABLEPREFIX."fanfiction_stories as stories ON stories.sid = review.item AND review.type ='ST' WHERE 
312
+		$query = "SELECT review.reviewid, review.respond, review.review, review.uid, review.reviewer, review.rating, review.date as date, series.title as seriestitle, stories.title as title FROM ".TABLEPREFIX."fanfiction_reviews as review LEFT JOIN ".TABLEPREFIX."fanfiction_series as series ON review.item = series.seriesid AND review.type = 'SE' LEFT JOIN ".TABLEPREFIX."fanfiction_stories as stories ON stories.sid = review.item AND review.type ='ST' WHERE 
312 313
 			((series.seriesid = '$item' AND series.seriesid = review.item AND review.type = 'SE')".
313 314
 			(isset($storylist) ? " OR (FIND_IN_SET(review.item, '".(implode(",", $storieslist))."') > 0 AND review.type = 'ST')" : "").
314 315
 			(isset($serieslist) ? " OR (FIND_IN_SET(item, '".(implode(",", $serieslist))."') > 0 AND type = 'SE')" : "").
... ...
@@ -318,11 +319,11 @@ else {
318 319
 	}
319 320
 	else if($type == "ST") {
320 321
 		if(isset($chapid))  {
321
-			$query = "SELECT review.reviewid, review.respond, review.review, review.uid, review.reviewer, review.rating, UNIX_TIMESTAMP(date) as date, chapter.title as title, chapter.inorder as inorder FROM ".TABLEPREFIX."fanfiction_reviews as review, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '$chapid' AND chapter.chapid = review.chapid AND review.review != 'No Review' ";
322
+			$query = "SELECT review.reviewid, review.respond, review.review, review.uid, review.reviewer, review.rating, date as date, chapter.title as title, chapter.inorder as inorder FROM ".TABLEPREFIX."fanfiction_reviews as review, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.chapid = '$chapid' AND chapter.chapid = review.chapid AND review.review != 'No Review' ";
322 323
 			$count =  "SELECT count(reviewid) FROM ".TABLEPREFIX."fanfiction_reviews as review WHERE chapid = '$chapid' AND review != 'No Review'";
323 324
 		}
324 325
 		else  {
325
-			$query = "SELECT review.reviewid, review.respond, review.review, review.uid, review.reviewer, review.rating, UNIX_TIMESTAMP(review.date) as date, chapter.title as title, chapter.inorder as inorder FROM ".TABLEPREFIX."fanfiction_reviews as review, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.sid = '$item' AND chapter.chapid = review.chapid AND review.review != 'No Review' AND review.type = 'ST'";
326
+			$query = "SELECT review.reviewid, review.respond, review.review, review.uid, review.reviewer, review.rating, review.date as date, chapter.title as title, chapter.inorder as inorder FROM ".TABLEPREFIX."fanfiction_reviews as review, ".TABLEPREFIX."fanfiction_chapters as chapter WHERE chapter.sid = '$item' AND chapter.chapid = review.chapid AND review.review != 'No Review' AND review.type = 'ST'";
326 327
 			$count = "SELECT count(reviewid) FROM ".TABLEPREFIX."fanfiction_reviews as review WHERE item = '$item' AND review != 'No Review' AND type = 'ST'";
327 328
 		}
328 329
 		$jumpmenu = "<form name=\"jump\" action=\"\">";
... ...
@@ -379,10 +380,10 @@ else {
379 380
 			$reviewer = $reviews['reviewer'];
380 381
 			$member = _ANONYMOUS;
381 382
 		}
382
-		if(empty($reviews['respond']) && (USERUID == $authoruid || (isset($coauthors) && in_array(USERUID, $coauthors)))) $adminlink .= " [<a href=\"member.php?action=revres&amp;reviewid=".$reviews['reviewid']."\">"._RESPOND."</a>]";
383
+		if(empty($reviews['respond']) && (USERUID == $authoruid || (isset($array_coauthors) && in_array(USERUID, $array_coauthors)))) $adminlink .= " [<a href=\"user.php?action=revres&amp;reviewid=".$reviews['reviewid']."\">"._RESPOND."</a>]";
383 384
 		$tpl->newBlock("reviewsblock");
384 385
 		$tpl->assign("reviewer"   , $reviewer );
385
-		$tpl->assign("reportthis", "[<a href=\""._BASEDIR."report.php?action=report&amp;url=reviews.php?reviewid=".$reviews['reviewid']."\">"._REPORTTHIS."</a>]");
386
+		$tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=reviews.php?reviewid=".$reviews['reviewid']."\">"._REPORTTHIS."</a>]");
386 387
 		$tpl->assign("review"   , stripslashes($reviews['review']));
387 388
 		$tpl->assign("reviewdate", date("$dateformat $timeformat", $reviews['date']) );
388 389
 		$tpl->assign("rating", ratingpics($reviews['rating']) );
... ...
@@ -121,7 +121,7 @@ if($add == "series" || ($action == "add" && !$add) || $action == "edit") {
121 121
 				if($logging && $admin) {
122 122
 					$seriesinfo = dbquery("SELECT title, uid FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '$seriesid'");
123 123
 					list($title, $uid) = dbrow($seriesinfo);
124
-					if($uid != USERUID) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT_SERIES, USERPENNAME, USERUID, $title, $seriesid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED')");
124
+					if($uid != USERUID) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT_SERIES, USERPENNAME, USERUID, $title, $seriesid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED', " . time() . ")");
125 125
 				}
126 126
 				$output = write_message(_ACTIONSUCCESSFUL."<br />"._BACK2ACCT);
127 127
 			}
... ...
@@ -139,7 +139,7 @@ if($add == "series" || ($action == "add" && !$add) || $action == "edit") {
139 139
 		}
140 140
 	}
141 141
 	else {
142
-	$output = "<div id=\"pagetitle\">".($action == "edit" ? _EDITSERIES : $add == "stories" ? _ADD2SERIES : _ADDSERIES)."</div>
142
+	$output = "<div id=\"pagetitle\">".($action == "edit" ? _EDITSERIES : ($add == "stories" ? _ADD2SERIES : _ADDSERIES))."</div>
143 143
 <form METHOD=\"POST\" style='width: 90%; margin: 0 auto;' name=\"form\" action=\"series.php?action=$action&amp;add=".(!empty($add) ? $add : "series").(!empty($seriesid) ? "&amp;seriesid=$seriesid" : "")."\">";
144 144
 	if($action == "edit" && !isset($POST['submit'])) {
145 145
 		$seriesquery = dbquery(_SERIESQUERY." AND seriesid = '$seriesid' LIMIT 1");
... ...
@@ -251,7 +251,7 @@ if($add == "stories") {
251 251
 		$output .= write_message(_ACTIONSUCCESSFUL);
252 252
 	}
253 253
 	else {
254
-		$output = "<div id=\"pagetitle\">".($action == "edit" ? _EDITSERIES : $add == "stories" ? _ADD2SERIES : _ADDSERIES)."</div>
254
+		$output = "<div id=\"pagetitle\">".($action == "edit" ? _EDITSERIES : ($add == "stories" ? _ADD2SERIES : _ADDSERIES))."</div>
255 255
 			<form METHOD=\"POST\" style='width: 90%; margin: 0 auto;' name=\"form\" action=\"series.php?action=$action&amp;add=".(!empty($add) ? $add : "series").(!empty($seriesid) ? "&amp;seriesid=$seriesid" : "")."\">";
256 256
 		$output .= "<input type=\"hidden\" name=\"seriesid\" value=\"$seriesid\">";
257 257
 		$series = dbquery("SELECT title, uid, isopen FROM ".TABLEPREFIX."fanfiction_series WHERE seriesid = '$seriesid' LIMIT 1");
... ...
@@ -24,8 +24,10 @@
24 24
 
25 25
 $current = "stories";
26 26
 
27
-if($_GET['action'] != "newchapter") $displayform = 1;
28
-if($_GET['action'] == "newstory" || $_GET['action'] == "editstory") $current = "addstory";
27
+if(isset($_GET['action'])) {
28
+	if($_GET['action'] != "newchapter") $displayform = 1;
29
+	if($_GET['action'] == "newstory" || $_GET['action'] == "editstory") $current = "addstory";
30
+}
29 31
 
30 32
 include ("header.php");
31 33
 
... ...
@@ -46,16 +48,16 @@ include("includes/storyform.php");
46 48
 			if($result) list($sid, $author) = dbrow($result);
47 49
 		}
48 50
 		if(isset($sid)) {
49
-			$coauthors = array( );
51
+			$array_coauthors = array( );
50 52
 			$authorquery = dbquery("SELECT uid, rr, coauthors FROM ".TABLEPREFIX."fanfiction_stories WHERE sid='$sid' LIMIT 1");
51 53
 			$story = dbassoc($authorquery);
52 54
 			if($story['coauthors']) {
53 55
 				$cQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$sid'");
54 56
 				while($c = dbassoc($cQuery)) {
55
-					$coauthors[] = $c['uid'];
57
+					$array_coauthors[] = $c['uid'];
56 58
 				}
57 59
 			}
58
-			if($story['uid'] != USERUID && (is_array($coauthors) && !in_array(USERUID, $coauthors)) && !$story['rr']) accessDenied( );
60
+			if($story['uid'] != USERUID && (is_array($array_coauthors) && !in_array(USERUID, $array_coauthors)) && !$story['rr']) accessDenied( );
59 61
 		}
60 62
 	}
61 63
 	else if(isADMIN && uLEVEL < 4 && isset($_GET['admin'])) {
... ...
@@ -73,7 +75,7 @@ function preview_story($stories) {
73 75
 	$count = 0;
74 76
 	if(file_exists("$skindir/listings.tpl")) $tpl = new TemplatePower( "$skindir/listings.tpl" );
75 77
 	else $tpl = new TemplatePower("default_tpls/listings.tpl");
76
-	if(count($stories['coauthors']) > 0) $stories['coauthors'] = 1;
78
+	if(is_array($stories['coauthors']) && count($stories['coauthors']) > 0) $stories['coauthors'] = 1;
77 79
 	$tpl->prepare( );
78 80
 	$tpl->newBlock("listings");
79 81
 	$tpl->newBlock("storyblock");
... ...
@@ -137,7 +139,7 @@ function newstory( ) {
137 139
 	$storynotes = isset($_POST['storynotes']) ? descript(strip_tags($_POST['storynotes'], $allowed_tags)) : "";
138 140
 	$catid = isset($_POST['catid']) ? array_filter(explode(",", $_POST['catid']), "isNumber") : array( );
139 141
 	$charid = isset($_POST['charid']) ? array_filter($_POST['charid'], "isNumber") : array( );
140
-	$coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
142
+	$array_coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
141 143
 	$classes = array( );
142 144
 	$classquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classtypes");
143 145
 	while($type = dbassoc($classquery)) {
... ...
@@ -176,8 +178,8 @@ function newstory( ) {
176 178
 	$words_to_count = trim($words_to_count);
177 179
 	$wordcount = count(explode(" ",$words_to_count)); 
178 180
 	$au[] = $uid;
179
-	if(count($coauthors)) {
180
-		$au = array_merge($au, $coauthors);
181
+	if(count($array_coauthors)) {
182
+		$au = array_merge($au, $array_coauthors);
181 183
 		$coauthors = 1;
182 184
 	}
183 185
 	else $coauthors = 0;
... ...
@@ -222,7 +224,7 @@ function newstory( ) {
222 224
 		if($store == "mysql")
223 225
 		{
224 226
 			if(!$newchapter) {
225
-				$insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_stories (title, summary, storynotes, catid, classes, charid,  rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('".addslashes($title)."', '".addslashes(format_story($summary))."', '".addslashes(format_story($storynotes))."', '".($catid ? implode(",", $catid) : "")."', '".($classes? implode(",", $classes) : "")."', '".($charid ? implode(",", $charid) : "")."', '$rid', now(), now(), '$uid', '$validated', '$rr', '$complete', '$wordcount', '$feat', '$coauthors')");
227
+				$insert = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_stories (title, summary, storynotes, catid, classes, charid,  rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('".addslashes($title)."', '".addslashes(format_story($summary))."', '".addslashes(format_story($storynotes))."', '".($catid ? implode(",", $catid) : "")."', '".($classes? implode(",", $classes) : "")."', '".($charid ? implode(",", $charid) : "")."', '$rid', '" . time() ."', '" . time() . "', '$uid', '$validated', '$rr', '$complete', '$wordcount', '$feat', '$coauthors')");
226 228
 				$sid = dbinsertid( );
227 229
 				$inorder = 1;
228 230
 			}
... ...
@@ -236,7 +238,7 @@ function newstory( ) {
236 238
 		else if ($store == "files")
237 239
 		{
238 240
 			if(!$newchapter) {
239
-				$insertstory = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_stories (title, summary, storynotes, catid, classes, charid, rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('".addslashes($title)."', '".addslashes(format_story($summary))."', '".addslashes(format_story($storynotes))."', '".($catid ? implode(",", $catid) : "")."', '".($classes ? implode(",", $classes) : "")."', '".($charid ? implode(",", $charid) : "")."', '$rid', now(), now(), '$uid', '$validated', '$rr', '$complete', '$wordcount', '$feat', '$coauthors')");
241
+				$insertstory = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_stories (title, summary, storynotes, catid, classes, charid, rid, date, updated, uid, validated, rr, completed, wordcount, featured, coauthors) VALUES ('".addslashes($title)."', '".addslashes(format_story($summary))."', '".addslashes(format_story($storynotes))."', '".($catid ? implode(",", $catid) : "")."', '".($classes ? implode(",", $classes) : "")."', '".($charid ? implode(",", $charid) : "")."', '$rid', '" . time() ."', '" . time() . "', '$uid', '$validated', '$rr', '$complete', '$wordcount', '$feat', '$coauthors')");
240 242
 				$sid = dbinsertid( );
241 243
 				$inorder = 1;
242 244
 			}
... ...
@@ -271,7 +273,7 @@ function newstory( ) {
271 273
 			else $output .= write_error(_FATALERROR." "._TRYAGAIN);
272 274
 		}
273 275
 		if(!$newchapter) {
274
-			if(count($coauthors)) {
276
+			if(count($array_coauthors)) {
275 277
 				foreach($au AS $c) {
276 278
 					if($c == $uid) continue;
277 279
 					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_coauthors(`sid`, `uid`) VALUES('$sid', '$c')");
... ...
@@ -323,7 +325,7 @@ function newstory( ) {
323 325
 					sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
324 326
 				}
325 327
 			}
326
-			$update = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = NOW( ) WHERE sid = '$sid'");
328
+			$update = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET updated = '" . time() . "' WHERE sid = '$sid'");
327 329
 			list($chapters, $words) = dbrow(dbquery("SELECT COUNT(chapid), SUM(wordcount) FROM ".TABLEPREFIX."fanfiction_chapters WHERE validated > 0"));
328 330
 			list($authors) = dbrow(dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE stories > 0"));
329 331
 			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats set wordcount = '$words', chapters = '$chapters', authors = '$authors'");
... ...
@@ -358,7 +360,7 @@ function newstory( ) {
358 360
 		return $output;
359 361
 	}
360 362
 	if($newchapter) {
361
-		$storyinfo = dbquery("SELECT s.*, UNIX_TIMESTAMP(s.updated) as updated, UNIX_TIMESTAMP(s.date) as date, "._PENNAMEFIELD." as penname  FROM ".TABLEPREFIX."fanfiction_stories as s, "._AUTHORTABLE." WHERE "._UIDFIELD." = s.uid AND sid = '$sid' LIMIT 1");
363
+		$storyinfo = dbquery("SELECT s.*, s.updated as updated, s.date as date, "._PENNAMEFIELD." as penname  FROM ".TABLEPREFIX."fanfiction_stories as s, "._AUTHORTABLE." WHERE "._UIDFIELD." = s.uid AND sid = '$sid' LIMIT 1");
362 364
 		$stories = dbassoc($storyinfo);
363 365
 		$uid = $stories['uid'];
364 366
 		$chapterquery = dbquery("SELECT COUNT(sid) FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '$sid'");
... ...
@@ -440,7 +442,9 @@ function viewstories( ) {
440 442
 	}
441 443
 	$output .= "<p style=\"text-align: right; margin: 1em;\"><a href=\"stories.php?action=viewstories&amp;chapters=".($hidechapters != "view" ? "view\">"._VIEWCHAPTERS : "hide\">"._HIDECHAPTERS)."</a></p>
442 444
 		<div style=\"width: 90%; margin: 0 auto;\"><table cellpadding=\"3\" cellspacing=\"0\" width=\"100%\" class=\"tblborder\"><tr><th class=\"tblborder\">"._STORIES."</th><th colspan=\"3\" class=\"tblborder\">"._OPTIONS."</th>".($reviewsallowed ? "<th class=\"tblborder\">"._REVIEWS."</th>" : "").($autovalidate ? "" : "<th class=\"tblborder\">"._VALIDATED."</th>")."<th class=\"tblborder\">"._READS."</th></tr>";
443
-	$sresult = dbquery("SELECT stories.sid, title, reviews, rating, completed, validated, featured, count FROM ".TABLEPREFIX."fanfiction_stories AS stories LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors AS coauth ON stories.sid = coauth.sid WHERE stories.uid = '".USERUID."' OR coauth.uid = '".USERUID."' ORDER BY title");
445
+	
446
+	$squery = "SELECT stories.sid, title, reviews, rating, completed, validated, featured, count FROM " . TABLEPREFIX . "fanfiction_stories AS stories LEFT JOIN " . TABLEPREFIX . "fanfiction_coauthors AS coauth ON stories.sid = coauth.sid WHERE stories.uid = '" . USERUID . "' OR coauth.uid = '" . USERUID . "' GROUP BY stories.sid ORDER BY title ";
447
+	$sresult = dbquery($squery); 
444 448
 	$stories = dbnumrows($sresult);
445 449
 	while($story = dbassoc($sresult)) {
446 450
 		$query2 = dbquery("SELECT chapid, title, inorder, rating, reviews, validated, count FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$story['sid']."' ORDER BY inorder"); 
... ...
@@ -554,7 +558,7 @@ function editchapter( $chapid ) {
554 558
 			if($admin && $logging && USERUID != $uid) {
555 559
 				$storyinfo = dbquery("SELECT story.title, story.sid, chapter.uid, chapter.inorder, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_stories as story, ".TABLEPREFIX."fanfiction_chapters as chapter, "._AUTHORTABLE." WHERE "._UIDFIELD." = chapter.uid AND story.sid = chapter.sid AND chapter.chapid = $chapid");
556 560
 				list($title, $sid, $chapuid, $inorder, $chappenname) = dbrow($storyinfo);
557
-				dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT_CHAPTER, USERPENNAME, USERUID, $title, $sid, $chappenname, $chapuid, $inorder))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED')");
561
+				dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT_CHAPTER, USERPENNAME, USERUID, $title, $sid, $chappenname, $chapuid, $inorder))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED', " . time() . ")");
558 562
 			}
559 563
 			unset($_POST['submit']);
560 564
 			$output = write_message(_STORYUPDATED).editstory($sid);
... ...
@@ -630,7 +634,7 @@ function editstory($sid) {
630 634
 		$rid = isset($_POST['rid']) && isNumber($_POST['rid']) ? $_POST['rid'] : 0;
631 635
 		$catid = isset($_POST['catid']) ? array_filter(explode(",", $_POST['catid']), "isNumber") : array( );
632 636
 		$charid = isset($_POST['charid']) ? array_filter($_POST['charid'], "isNumber") : array( );
633
-		$coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
637
+		$array_coauthors = isset($_POST['coauthors']) ? array_filter(explode(",", $_POST['coauthors']), "isNumber") : array( );
634 638
 		if(isset($_POST['uid']) && isNumber($_POST['uid'])) $uid = $_POST['uid'];
635 639
 		else $uid = USERUID;
636 640
 		$classes = array( );
... ...
@@ -643,8 +647,8 @@ function editstory($sid) {
643 647
 		}
644 648
 		if(!$admin && $authorvalid && !$validated) $validated = 2;
645 649
 		$au[] = $uid;
646
-		if(count($coauthors)) {
647
-			$au = array_merge($au, $coauthors);
650
+		if(count($array_coauthors)) {
651
+			$au = array_merge($au, $array_coauthors);
648 652
 			$coauthors = 1;
649 653
 		}
650 654
 		else $coauthors = 0;
... ...
@@ -694,7 +698,7 @@ function editstory($sid) {
694 698
 						list($oldpenname) = dbrow($authorquery);
695 699
 						$author2query = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
696 700
 						list($newpenname) = dbrow($author2query);
697
-						dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT_AUTHOR, USERPENNAME, USERUID, $title, $sid, $newpenname, $uid, $oldpenname, $olduid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED')");
701
+						dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT_AUTHOR, USERPENNAME, USERUID, $title, $sid, $newpenname, $uid, $oldpenname, $olduid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED', " . time() . ")");
698 702
 					}
699 703
 				}
700 704
 
... ...
@@ -738,7 +742,7 @@ function editstory($sid) {
738 742
 							sendemail($favuser['penname'], $favuser['email'], $sitename, $siteemail, $subject, $mailtext, "html");
739 743
 						}
740 744
 					}
741
-					$update = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '$validated', updated = NOW( ) WHERE sid = '$sid'");
745
+					$update = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET validated = '$validated', updated = '" . time() . "' WHERE sid = '$sid'");
742 746
 					$update2 = dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET validated = 1 WHERE sid = '$sid'");
743 747
 					$coauths = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$sid'");
744 748
 					while($c = dbassoc($coauths)) {
... ...
@@ -787,7 +791,8 @@ function editstory($sid) {
787 791
 			list($authors) = dbrow(dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE stories > 0"));
788 792
 			dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats set wordcount = '$words', chapters = '$chapters', authors = '$authors'");
789 793
 
790
-			$updatequery = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET title = '".addslashes($title)."', summary = '".addslashes(format_story($summary))."', storynotes = '".addslashes(format_story($storynotes))."', rr = '".($rr ? 1 : 0)."', completed = '".($complete ? 1 : 0)."', validated = '$validated', rid = '$rid', classes = '".(is_array($classes) ? implode(",", $classes) : $classes)."', charid = '".(is_array($charid) ? implode(",", $charid) : $charid)."', catid = '".(is_array($catid) ? implode(",", $catid) : $catid)."', coauthors = '".(is_array($coauthors) ? implode(",", $coauthors) : $coauthors)."', featured = '$feat' WHERE sid = '$sid'");
794
+			$updatequery = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET title = '".addslashes($title)."', summary = '".addslashes(format_story($summary))."', storynotes = '".addslashes(format_story($storynotes))."', rr = '".($rr ? 1 : 0)."', completed = '".($complete ? 1 : 0)."', validated = '$validated', rid = '$rid', classes = '".(is_array($classes) ? implode(",", $classes) : $classes)."', charid = '".(is_array($charid) ? implode(",", $charid) : $charid)."', catid = '".(is_array($catid) ? implode(",", $catid) : $catid)."', coauthors = '".$coauthors."', featured = '$feat' WHERE sid = '$sid'");
795
+		 
791 796
 			$clist = array( );
792 797
 			$coauths = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '$sid'");
793 798
 			while($c = dbassoc($coauths)) {
... ...
@@ -814,7 +819,7 @@ function editstory($sid) {
814 819
 				if(USERUID != $uid) { // If you're editing your own story, don't log it.
815 820
 					$authorquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
816 821
 					list($penname) = dbrow($authorquery);
817
-					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT, USERPENNAME, USERUID, $title, $sid, $penname, $uid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED')");
822
+					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_EDIT, USERPENNAME, USERUID, $title, $sid, $penname, $uid))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'ED', " . time() . ")");
818 823
 				}
819 824
 			}
820 825
 			$output .= write_message(_STORYUPDATED."  ".($admin ? _BACK2ADMIN : _BACK2ACCT));
... ...
@@ -824,21 +829,21 @@ function editstory($sid) {
824 829
 			exit( );
825 830
 		}
826 831
 	}
827
-	$query = dbquery("SELECT DATE_FORMAT(date, '$dateformat') as date, wordcount, uid FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$sid' LIMIT 1");
832
+	$query = dbquery("SELECT DATE_FORMAT(FROM_UNIXTIME(date), '$dateformat') as date, wordcount, uid FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$sid' LIMIT 1");
828 833
 	list($published, $wordcount, $storyuid) = dbrow($query);
829 834
 	$formbegin = "<div class=\"tblborder\" style=\"margin: 10px auto; width: 550px; padding: 10px;\">
830 835
 		<form METHOD=\"POST\" name=\"form\" action=\"stories.php?action=editstory".($admin ? "&amp;admin=1" : "")."&amp;sid=$sid\">";
831 836
 
832 837
 	if(isset($_POST['submit']) && $_POST['submit'] != _PREVIEW) {
833 838
 		$submit = _PREVIEW;
834
-		$storyquery = dbquery("SELECT title, summary, storynotes,  rr, completed, rid, classes, charid, catid, featured, uid, coauthors, UNIX_TIMESTAMP(date) as date FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$sid' LIMIT 1");
839
+		$storyquery = dbquery("SELECT title, summary, storynotes,  rr, completed, rid, classes, charid, catid, featured, uid, coauthors, date as date FROM ".TABLEPREFIX."fanfiction_stories WHERE sid = '$sid' LIMIT 1");
835 840
 		$story = dbassoc($storyquery);
836 841
 		$output .= $formbegin.storyform($story, $preview);
837 842
 		$output .= "<input type=\"hidden\" name=\"oldcats\" value =\"".$story['catid']."\">";
838 843
 	}
839 844
 	else {
840 845
 		$submit = _PREVIEW;
841
-		$storyinfo = dbquery("SELECT s.*, UNIX_TIMESTAMP(s.date) as date, UNIX_TIMESTAMP(s.updated) as updated, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_stories as s, "._AUTHORTABLE." WHERE "._UIDFIELD." = s.uid AND sid = '$sid' LIMIT 1");
846
+		$storyinfo = dbquery("SELECT s.*, s.date as date, s.updated as updated, "._PENNAMEFIELD." as penname FROM ".TABLEPREFIX."fanfiction_stories as s, "._AUTHORTABLE." WHERE "._UIDFIELD." = s.uid AND sid = '$sid' LIMIT 1");
842 847
 		$stories = dbassoc($storyinfo);
843 848
 		if($stories['coauthors'] && !isset($_POST['submit'])) {
844 849
 			$au = array();
... ...
@@ -926,7 +931,7 @@ function delete( ) {
926 931
 			if($logging && $admin) {
927 932
 				$authorquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
928 933
 				list($penname) = dbrow($authorquery);
929
-				dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_ADMIN_DEL_CHAPTER, USERPENNAME, USERUID, $story['title'], $sid, $penname, $uid, $inorder))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'DL')");
934
+				dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_ADMIN_DEL_CHAPTER, USERPENNAME, USERUID, $story['title'], $sid, $penname, $uid, $inorder))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'DL', " . time() . ")");
930 935
 			}
931 936
 			return "<center>"._ACTIONSUCCESSFUL."</center>".editstory( $sid );
932 937
 		}
... ...
@@ -42,7 +42,7 @@ if(!defined("_CHARSET")) exit( );
42 42
 			}
43 43
 			break;
44 44
 		case "favstories":
45
-			$result = dbquery("SELECT count( fav.item ) AS count, stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ".TABLEPREFIX."fanfiction_favorites AS fav, "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.uid = "._UIDFIELD." AND stories.validated > 0 AND fav.item = stories.sid AND fav.type = 'ST' GROUP  BY stories.sid ORDER  BY count DESC LIMIT 10");
45
+			$result = dbquery("SELECT count( fav.item ) AS count, stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ".TABLEPREFIX."fanfiction_favorites AS fav, "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories WHERE stories.uid = "._UIDFIELD." AND stories.validated > 0 AND fav.item = stories.sid AND fav.type = 'ST' GROUP  BY stories.sid ORDER  BY count DESC LIMIT 10");
46 46
 			if(dbnumrows($result) == 0) $output .= write_message(_NORESULTS);
47 47
 			$tpl->newBlock("listings");
48 48
 			while($stories = dbassoc($result)) { 
... ...
@@ -29,306 +29,172 @@ $blocks['news']['status'] = 0;
29 29
 $blocks['info']['status'] = 0;
30 30
 
31 31
 //make a new TemplatePower object
32
-if(file_exists("$skindir/default.tpl")) $tpl = new TemplatePower( "$skindir/default.tpl" );
32
+if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
33 33
 else $tpl = new TemplatePower("default_tpls/default.tpl");
34 34
 include("includes/pagesetup.php");
35
-if(file_exists("languages/".$language."_admin.php")) include_once("languages/".$language."_admin.php");
35
+if (file_exists("languages/" . $language . "_admin.php")) include_once("languages/" . $language . "_admin.php");
36 36
 else include_once("languages/en_admin.php");
37 37
 // end basic page setup
38 38
 
39
-if(!isADMIN) {
40
-$output .= "<script language=\"javascript\" type=\"text/javascript\">
39
+if (!isADMIN)
40
+{
41
+	$output .= "<script language=\"javascript\" type=\"text/javascript\">
41 42
 location = \"maintenance.php\";
42 43
 </script>";
43
-$tpl->assign( "output", $output );
44
-$tpl->printToScreen();
45
-dbclose( );
46
-exit( );
44
+	$tpl->assign("output", $output);
45
+	$tpl->printToScreen();
46
+	dbclose();
47
+	exit();
47 48
 }
48 49
 $oldVersion = explode(".", $settings['version']);
50
+
49 51
 $confirm = isset($_GET['confirm']) ? $_GET['confirm'] : false;
50
-if($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 3)) {
51
-if($confirm == "yes") {
52
-	// For the slow-pokes who haven't updated to 3.1
53
-	if($oldVersion[1] == 0 ) {
54
-		list($field) = dbrow(dbquery("SELECT field_id FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_name = 'betareader'"));
55
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info = '"._YES."' WHERE field = '$field' AND info = '1'");
56
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info = '"._NO."' WHERE field = '$field' AND info != '"._YES."'");
57
-		dbquery("alter table ".TABLEPREFIX."fanfiction_authorinfo add primary key(uid,field);");
58
-		dbquery("alter table ".TABLEPREFIX."fanfiction_blocks drop index block_name;");
59
-		dbquery("alter table ".TABLEPREFIX."fanfiction_blocks add unique index block_name (block_name);");
60
-		dbquery("alter table ".TABLEPREFIX."fanfiction_categories drop index category;");
61
-		dbquery("alter table ".TABLEPREFIX."fanfiction_categories drop index parentcatid;");
62
-		dbquery("create index byparent on ".TABLEPREFIX."fanfiction_categories (parentcatid,displayorder);");
63
-		dbquery("create index forstoryblock on ".TABLEPREFIX."fanfiction_chapters (sid,validated);");
64
-		dbquery("create index byname on ".TABLEPREFIX."fanfiction_classes (class_type,class_name,class_id);");
65
-		dbquery("alter table ".TABLEPREFIX."fanfiction_classtypes drop index classtype_title;");
66
-		dbquery("create unique index classtype_name on ".TABLEPREFIX."fanfiction_classtypes(classtype_name);");
67
-		dbquery("create index code_type on ".TABLEPREFIX."fanfiction_codeblocks(code_type);");
68
-		dbquery("alter table ".TABLEPREFIX."fanfiction_comments drop index nid;");
69
-		dbquery("alter table ".TABLEPREFIX."fanfiction_comments add index commentlist (nid,time);");
70
-		dbquery("alter table ".TABLEPREFIX."fanfiction_favorites drop index uid;");
71
-		dbquery("create unique index byitem on ".TABLEPREFIX."fanfiction_favorites (item,type,uid);");
72
-		dbquery("create unique index byuid on ".TABLEPREFIX."fanfiction_favorites (uid,type,item);");
73
-		dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index seriesid;");
74
-		dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index inorder;");
75
-		dbquery("alter table ".TABLEPREFIX."fanfiction_inseries add index (seriesid,inorder);");
76
-		dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index sid;");
77
-		dbquery("alter table ".TABLEPREFIX."fanfiction_inseries add primary key (sid,seriesid);");
78
-		dbquery("create index message_name on ".TABLEPREFIX."fanfiction_messages (message_name);");
79
-		dbquery("alter table ".TABLEPREFIX."fanfiction_pagelinks drop index link_text;");
80
-		dbquery("alter table ".TABLEPREFIX."fanfiction_panels drop index panel_hidden;");
81
-		dbquery("alter table ".TABLEPREFIX."fanfiction_panels drop index panel_type;");
82
-		dbquery("alter table ".TABLEPREFIX."fanfiction_panels add index panel_type (panel_type,panel_name);");
83
-		dbquery("create index avgrating on ".TABLEPREFIX."fanfiction_reviews(type,item,rating);");
84
-		dbquery("alter table ".TABLEPREFIX."fanfiction_reviews drop index sid;");
85
-		dbquery("create index bychapter on ".TABLEPREFIX."fanfiction_reviews (chapid,rating);");
86
-		dbquery("alter table ".TABLEPREFIX."fanfiction_reviews add index byuid (uid,item,type);");
87
-		dbquery("alter table ".TABLEPREFIX."fanfiction_series drop index owner;");
88
-		dbquery("create index owner on ".TABLEPREFIX."fanfiction_series (uid,title);");
89
-		dbquery("alter table ".TABLEPREFIX."fanfiction_stories drop index validated;");
90
-		dbquery("create index validateduid on ".TABLEPREFIX."fanfiction_stories (validated,uid);");
91
-		dbquery("create index recent on ".TABLEPREFIX."fanfiction_stories (updated,validated);");
92
-		$alltables = dbquery("SHOW TABLES");
93
-	}
94
-	// Still a little behind.
95
-	if($oldVersion[1] < 2) { 
96
-		dbquery("
97
-CREATE TABLE `".TABLEPREFIX."fanfiction_stats` (
98
-  `sitekey` varchar(50) NOT NULL default '0',
99
-  `stories` int(11) NOT NULL default '0',
100
-  `chapters` int(11) NOT NULL default '0',
101
-  `series` int(11) NOT NULL default '0',
102
-  `reviews` int(11) NOT NULL default '0',
103
-  `wordcount` int(11) NOT NULL default '0',
104
-  `authors` int(11) NOT NULL default '0',
105
-  `members` int(11) NOT NULL default '0',
106
-  `reviewers` int(11) NOT NULL default '0',
107
-  `newestmember` int(11) NOT NULL default '0'
108
-) ENGINE=MyISAM");
109
-		dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_stats(`sitekey`) VALUES('SITEKEY')");
110
-		dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_inseries` DROP `updated`");
111
-		dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_news` ADD `comments` INT NOT NULL DEFAULT '0'");
112
-		dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_series` ADD `numstories` INT NOT NULL DEFAULT '0'");
113
-		dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_pagelinks` ADD `link_key` CHAR( 1 ) NULL AFTER `link_text`");
114
-		if(!isset($allowseries)) dbquery("ALTER TABLE `".$settingsprefix."fanfiction_settings` ADD `allowseries` TINYINT NOT NULL DEFAULT '2' AFTER `roundrobins`");
115
-		dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_log` CHANGE `log_ip` `log_ip` INT( 11 ) UNSIGNED NULL DEFAULT NULL");
116
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_inseries SET confirmed = 1");
117
-		$serieslist = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series");
118
-		$totalseries = dbnumrows($serieslist);
119
-		while($s = dbassoc($serieslist)) {
120
-			$numstories = count(storiesInSeries($s['seriesid']));
121
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET numstories = '$numstories' WHERE seriesid = ".$s['seriesid']." LIMIT 1");
122
-		}
52
+if ($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 6))  //3.5.5
53
+{
54
+	if ($confirm == "yes")
55
+	{
56
+		if ($oldVersion[1] == 5 && $oldVersion[2] < 6)
57
+		{
58
+			/****************************************************************************************************************/
59
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_authors LIKE 'date'"));
60
+			if ($tmp['Type'] == "datetime")
61
+			{ 
62
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_authors LIKE 'date_tmp'"));
63
+				if (!$updated)
64
+				{
65
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_authors` ADD `date_tmp` int(11) NOT NULL default '0'");
66
+				}
123 67
 
124
-		$newslist = dbquery("SELECT count(cid) as count, nid FROM ".TABLEPREFIX."fanfiction_comments GROUP BY nid");
125
-		while($n = dbassoc($newslist)) {
126
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = '".$n['count']."' WHERE nid = ".$n['nid']);
127
-		}
128
-	
129
-		$storiesquery =dbquery("SELECT COUNT(sid) as totals, COUNT(DISTINCT uid) as totala, SUM(wordcount) as totalwords FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 ");
130
-		list($stories, $authors, $words) = dbrow($storiesquery);
131
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = '$stories', authors = '$authors', wordcount = '$words' WHERE sitekey = 'SITEKEY'"); 
68
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_authors` SET `date_tmp` = UNIX_TIMESTAMP( `date` )");
69
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_authors` CHANGE `date` `date` INT NOT NULL");
70
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_authors` set date = date_tmp");
71
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_authors` DROP `date_tmp`");
72
+			}
73
+			/****************************************************************************************************************/
74
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_log LIKE 'log_timestamp'"));
132 75
 
133
-		$chapterquery = dbquery("SELECT COUNT(chapid) as chapters FROM ".TABLEPREFIX."fanfiction_chapters where validated > 0");
134
-		list($chapters) = dbrow($chapterquery);
76
+			if ($tmp['Type'] == "datetime")
77
+			{ 
78
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_log LIKE 'log_timestamp_tmp'"));
79
+				if (!$updated)
80
+				{
81
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_log` ADD `log_timestamp_tmp` int(11) NOT NULL default '0'");
82
+				}
135 83
 
136
-		$authorquery = dbquery("SELECT COUNT("._UIDFIELD.") as totalm FROM "._AUTHORTABLE);
137
-		list($members) = dbrow($authorquery);
84
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_log` SET `log_timestamp_tmp` = UNIX_TIMESTAMP( `log_timestamp` )");
85
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_log` CHANGE `log_timestamp` `log_timestamp` INT NOT NULL");
86
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_log` set log_timestamp = log_timestamp_tmp");
87
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_log` DROP `log_timestamp_tmp`");
88
+			}
89
+			/****************************************************************************************************************/
90
+			/* fanfiction_comments   `time` datetime NOT NULL default '0000-00-00 00:00:00'  */
91
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_comments LIKE 'date'"));
92
+			if ($tmp['Type'] == "datetime")
93
+			{
94
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_comments LIKE 'time_tmp'"));
95
+				if (!$updated)
96
+				{
97
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_comments` ADD `time_tmp` int(11) NOT NULL default '0'");
98
+				}
138 99
 
139
-		list($newest) = dbrow(dbquery("SELECT "._UIDFIELD." as uid FROM "._AUTHORTABLE." ORDER BY "._UIDFIELD." DESC LIMIT 1"));
140
-		$reviewquery = dbquery("SELECT COUNT(reviewid) as totalr FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review'");
141
-		list($reviews) = dbrow($reviewquery);
142
-		$reviewquery = dbquery("SELECT COUNT(DISTINCT uid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review' AND uid > 0");
143
-		list($reviewers) = dbrow($reviewquery);
144
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET series = '$totalseries', chapters = '$chapters', members = '$members', newestmember = '$newest', reviews = '$reviews', reviewers = '$reviewers' WHERE sitekey = 'SITEKEY'"); 
145
-		$news = dbquery("SELECT count(nid) as count, nid FROM ".TABLEPREFIX."fanfiction_comments GROUP BY nid");
146
-		while($n = dbassoc($news)) {
147
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = '".$n['count']."' WHERE nid = '".$n['nid']."' LIMIT 1");
148
-		}
149
-	} // End version 3.2 updates.
150
-	if($oldVersion[1] < 3) {
151
-	dbquery("
152
-CREATE TABLE `".TABLEPREFIX."fanfiction_modules` (
153
-  `id` int(11) NOT NULL auto_increment,
154
-  `name` varchar(100) NOT NULL default 'Test Module',
155
-  `version` varchar(10) NOT NULL default '1.0',
156
-  PRIMARY KEY  (`id`),
157
-  KEY `name_version` (`name`,`version`)
158
-)");
159
-	list($panelCount) = dbrow(dbquery("SELECT count(panel_name) AS count FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_type = 'A' AND panel_level = '1' AND panel_hidden = '0'"));
160
-	$panelCount++;
161
-	dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('modules', 'Modules', '', 1, ".$panelCount.", 0, 'A')");
162
-	// Insert the modules into the table.
163
-	$dir = opendir(_BASEDIR."modules");
164
-	while($folder = readdir($dir)) {
165
-		if($folder == "." || $folder == ".." || !is_dir("modules/$folder")) continue;
166
-		if(file_exists("modules/$folder/version.php")) {
167
-			$moduleVersion = ""; $moduleName = ""; 
168
-			include("modules/$folder/version.php");
169
-			if(empty($moduleName)) $moduleName = $folder;
170
-			// The next few lines try to determine if the module is installed.  
171
-			if($folder == "challenges" && !isset($anonchallenges)) continue;
172
-			if($folder == "recommendations" && !isset($anonrecs)) continue;
173
-			
174
-			dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_modules(`name`, `version`) VALUES('$moduleName', '1.0')");
175
-		}
176
-	}
177
-	if($ratings == "1") dbquery("UPDATE ".TABLEPREFIX."fanfiction_reviews SET rating = '-1' WHERE rating = '0'");
178
-	dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET rating = '0', reviews = '0'"); // Set them all to 0 before we re-insert.
179
-	$stories = dbquery("SELECT AVG(rating) as average, item FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND rating != '-1' GROUP BY item");
180
-	while($s = dbassoc($stories)) {
181
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET rating = '".round($s['average'])."' WHERE sid = '".$s['item']."'");
182
-	}
183
-	$stories = dbquery("SELECT COUNT(reviewid) as count, item FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND review != 'No Review' GROUP BY item");
184
-	while($s = dbassoc($stories)) {
185
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET reviews = '".$s['count']."' WHERE sid = '".$s['item']."'");
186
-	}
187
-	dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET rating = '0', reviews = '0'");
188
-	$chapters = dbquery("SELECT AVG(rating) as average, chapid FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND rating != '-1' GROUP BY chapid");
189
-	while($c = dbassoc($chapters)) {
190
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET rating = '".round($c['average'])."' WHERE chapid = '".$c['chapid']."'");
191
-	}
192
-	$chapters = dbquery("SELECT COUNT(reviewid) as count, chapid FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND review != 'No Review' GROUP BY chapid");
193
-	while($c = dbassoc($chapters)) {
194
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET reviews = '".$c['count']."' WHERE chapid = '".$c['chapid']."'");
195
-	}
196
-	dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET rating = '0', reviews = '0'");
197
-	$series = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series");
198
-	while($s = dbassoc($series)) {
199
-		$thisseries = $s['seriesid'];
200
-		include("includes/seriesreviews.php");
201
-	}
202
-	} // End 3.3 updates
203
-	// Version 3.3.1 updates
204
-	if($oldVersion[1] == 3 && empty($oldVersion[2])) {
205
-		if(isset($anonchallenges)) dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES('include(_BASEDIR.\"modules/challenges/stats.php\");', 'sitestats', 'challenges');");
206
-	}
207
-	// Versin 3.4 updates
208
-	if($oldVersion[1] < 4) {
209
-		dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_coauthors` (
210
-  `sid` int(11) NOT NULL default '0',
211
-  `uid` int(11) NOT NULL default '0',
212
-  PRIMARY KEY  (`sid`,`uid`)
213
-) ENGINE=MyISAM;");
214
-		dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_authorprefs` ADD `stories` INT NOT NULL DEFAULT '0'");
215
-		$alist = array( );
216
-		$authors = dbquery("SELECT uid, count(uid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 GROUP BY uid");
217
-		while($a = dbassoc($authors)) {
218
-			$alist[$a['uid']] = $a['count'];
219
-		}
220
-		$coauthors = dbquery("SELECT coauthors,sid FROM ".TABLEPREFIX."fanfiction_stories WHERE coauthors != '0'");
221
-		while($ca = dbassoc($coauthors)) {
222
-			$co = explode(",", $ca['coauthors']);
223
-			foreach($co AS $a) {
224
-				if(!isNumber($a)) continue;
225
-				if(in_array($a, $alist)) $alist[$a]++;
226
-				else $alist[$a] = 1;
227
-				dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_coauthors(`uid`, `sid`) VALUES('$a', '".$ca['sid']."')");
100
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_comments` SET `time_tmp` = UNIX_TIMESTAMP( `time` )");
101
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_comments` CHANGE `time` `time` INT NOT NULL");
102
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_comments` set time = time_tmp");
103
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_comments` DROP `time_tmp`");
228 104
 			}
229
-		}
230
-		foreach($alist AS $a => $s) {
231
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = '$s' WHERE uid = '$a' LIMIT 1");
232
-		}
233
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET coauthors = '1' WHERE coauthors != '0'");
234
-	}
235
-	if($oldVersion[1] == 4 && !isset($oldVersion[2])) {
236
-		$statsupdate = dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET sitekey = '".SITEKEY."' WHERE sitekey = 'SITEKEY' LIMIT 1");
237
-		$coauthors = dbquery("SHOW TABLES LIKE '".TABLEPREFIX."fanfiction_coauthors'"); 
238
-		if(!dbnumrows($coauthors)) { 
239
-			dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_coauthors` (
240
-			  `sid` int(11) NOT NULL default '0',
241
-			  `uid` int(11) NOT NULL default '0',
242
-			  PRIMARY KEY  (`sid`,`uid`)
243
-			) ENGINE=MyISAM;");
244
-			dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_authorprefs` ADD `stories` INT NOT NULL DEFAULT '0'");
245
-		}		
246
-		$authors = dbquery("SELECT uid, count(uid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 GROUP BY uid");
247
-		while($a = dbassoc($authors)) {
248
-			$alist[$a['uid']] = $a['count'];
249
-		}
250
-		$coauthors = dbquery("SELECT uid, count(sid) AS count FROM ".TABLEPREFIX."fanfiction_coauthors GROUP BY uid");
251
-		while($ca = dbassoc($coauthors)) {
252
-			if(in_array($ca['uid'], $alist)) $alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];
253
-			else $alist[$ca['uid']] = $ca['count'];
254
-		}
255
-		foreach($alist AS $a => $s) {
256
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = '$s' WHERE uid = '$a' LIMIT 1");
257
-		}
258
-	}
259
-	if($oldVersion[1] == 4 && $oldVersion[2] < 2) {
260
-		$coauthors = dbquery("SHOW TABLES LIKE '".TABLEPREFIX."fanfiction_coauthors'"); 
261
-		if(!dbnumrows($coauthors)) { 
262
-			dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_coauthors` (
263
-			  `sid` int(11) NOT NULL default '0',
264
-			  `uid` int(11) NOT NULL default '0',
265
-			  PRIMARY KEY  (`sid`,`uid`)
266
-			) ENGINE=MyISAM;");
267
-			dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_authorprefs` ADD `stories` INT NOT NULL DEFAULT '0'");
268
-		}
269
-		$storiesAdded = dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_authorprefs LIKE 'stories'");
270
-		if(!$storiesAdded) {
271
-			dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_authorprefs` ADD `stories` INT NOT NULL DEFAULT '0'");
272
-			$authors = dbquery("SELECT uid, count(uid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 GROUP BY uid");
273
-			while($a = dbassoc($authors)) {
274
-				$alist[$a['uid']] = $a['count'];
105
+			/****************************************************************************************************************/
106
+			/* fanfiction_reviews   `date` datetime NOT NULL default '0000-00-00 00:00:00', */
107
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_reviews LIKE 'date'"));
108
+			if ($tmp['Type'] == "datetime")
109
+			{
110
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_reviews LIKE 'date_tmp'"));
111
+				if (!$updated)
112
+				{
113
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_reviews` ADD `date_tmp` int(11) NOT NULL default '0'");
114
+				}
115
+
116
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_reviews` SET `date_tmp` = UNIX_TIMESTAMP( `date` )");
117
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_reviews` CHANGE `date` `date` INT NOT NULL");
118
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_reviews` set date = date_tmp");
119
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_reviews` DROP `date_tmp`");
120
+			}
121
+			/****************************************************************************************************************/
122
+			/* fanfiction_stories `date` datetime NOT NULL default '0000-00-00 00:00:00',   */
123
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_stories LIKE 'date'"));
124
+			if($tmp['Type'] == "datetime") {
125
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_stories LIKE 'date_tmp'"));
126
+				if (!$updated)
127
+				{
128
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_stories` ADD `date_tmp` int(11) NOT NULL default '0'");
129
+				}
130
+
131
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_stories` SET `date_tmp` = UNIX_TIMESTAMP( `date` )");
132
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_stories` CHANGE `date` `date` INT NOT NULL");
133
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_stories` set date = date_tmp");
134
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_stories` DROP `date_tmp`");
275 135
 			}
276
-			$coauthors = dbquery("SELECT uid, count(sid) AS count FROM ".TABLEPREFIX."fanfiction_coauthors GROUP BY uid");
277
-			while($ca = dbassoc($coauthors)) {
278
-				if(in_array($ca['uid'], $alist)) $alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];
279
-				else $alist[$ca['uid']] = $ca['count'];
136
+
137
+			/****************************************************************************************************************/
138
+			/* fanfiction_stories `updated` datetime NOT NULL default '0000-00-00 00:00:00', */
139
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_stories LIKE 'updated'"));
140
+			if ($tmp['Type'] == "datetime")
141
+			{				
142
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_stories LIKE 'updated_tmp'"));
143
+				if (!$updated)
144
+				{
145
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_stories` ADD `updated_tmp` int(11) NOT NULL default '0'");
146
+				}
147
+
148
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_stories` SET `updated_tmp` = UNIX_TIMESTAMP( `updated` )");
149
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_stories` CHANGE `updated` `updated` INT NOT NULL");
150
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_stories` set updated = updated_tmp");
151
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_stories` DROP `updated_tmp`");
280 152
 			}
281
-			foreach($alist AS $a => $s) {
282
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = '$s' WHERE uid = '$a' LIMIT 1");
153
+
154
+			/****************************************************************************************************************/
155
+			/* fanfiction_news `time` datetime default NULL,  */
156
+			$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_news LIKE 'time'"));
157
+			
158
+			if ($tmp['Type'] == "datetime")
159
+			{		
160
+				$updated = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_news LIKE 'time_tmp'"));
161
+				if (!$updated)
162
+				{
163
+					dbquery("ALTER TABLE 	`" . TABLEPREFIX . "fanfiction_news` ADD `time_tmp` int(11) NOT NULL default '0'");
164
+				}
165
+
166
+				dbquery("UPDATE 		`" . TABLEPREFIX . "fanfiction_news` SET `time_tmp` = UNIX_TIMESTAMP( `time` )");
167
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_news` CHANGE `time` `time` INT NOT NULL");
168
+				dbquery("UPDATE `" . TABLEPREFIX . "fanfiction_news` set time = time_tmp");
169
+				dbquery("ALTER TABLE `" . TABLEPREFIX . "fanfiction_news` DROP `time_tmp`");
283 170
 			}
171
+
172
+			/* todo */
173
+			/* ALTER TABLE `e107_fanfiction_stories` CHANGE `coauthors` `coauthors` TINYINT NOT NULL DEFAULT '0'; */
284 174
 		}
175
+		$update = dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET version = '" . $version . "' WHERE sitekey = '" . SITEKEY . "'");
176
+		if ($update) $output .= write_message(_ACTIONSUCCESSFUL);
177
+		else $output .= write_error(_ERROR);
285 178
 	}
286
-	if($oldVersion[1] == 5) { // Try to fix some errors for people
287
-		// Recalculate the story count for authors.
288
-		$authors = dbquery("SELECT uid, count(uid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 GROUP BY uid");
289
-		$alist = array( );
290
-		while($a = dbassoc($authors)) {
291
-			$alist[$a['uid']] = $a['count'];
292
-		}
293
-		$coauthors = dbquery("SELECT uid, count(sid) AS count FROM ".TABLEPREFIX."fanfiction_coauthors GROUP BY uid");
294
-		while($ca = dbassoc($coauthors)) {
295
-			if(isset($alist[$ca['uid']])) $alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];
296
-			else $alist[$ca['uid']] = $ca['count'];
297
-		}
298
-		foreach($alist AS $a => $s) {
299
-			dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = '$s' WHERE uid = '$a' LIMIT 1");
300
-		}
301
-		// Recalculate the number of authors
302
-		list($authors) = dbrow(dbquery("SELECT count(uid) FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE stories > 0"));
303
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET authors = '$authors' WHERE sitekey = '".SITEKEY."'"); 
179
+	else if ($confirm == "no")
180
+	{
181
+		$output .= write_message(_ACTIONCANCELLED);
182
+	}
183
+	else
184
+	{
185
+		if ($oldVersion[0] == 3 && ($oldVersion[1] < 4 || $oldVersion[1] == 4 && (!isset($oldVersion[2]) || $oldVersion[2] < 6)))
186
+			$output .= write_message(_CONFIRMUPDATE . "<br /> <a href='update.php?confirm=yes'>" . _YES . "</a> " . _OR . " <a href='update.php?confirm=no'>" . _NO . "</a>");
187
+		else $output .= write_message("Are you ready to update? <a href='update.php?confirm=yes'>" . _YES . "</a> " . _OR . " <a href='update.php?confirm=no'>" . _NO . "</a>");
304 188
 	}
305
-	if($oldVersion[1] == 5 && $oldVersion[2] < 3) {
306
-		// fix the indexes for the inseries table.
307
-		$exists = dbnumrows(dbquery("SHOW INDEX FROM ".TABLEPREFIX."fanfiction_inseries WHERE Key_name = 'seriesid'"));
308
-		if($exists) dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index seriesid;");
309
-		$exists = dbnumrows(dbquery("SHOW INDEX FROM ".TABLEPREFIX."fanfiction_inseries WHERE Key_name = 'inorder'"));
310
-		if($exists) dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index inorder;");
311
-		dbquery("alter table ".TABLEPREFIX."fanfiction_inseries add index (seriesid,inorder);");
312
-		$exists = dbnumrows(dbquery("SHOW INDEX FROM ".TABLEPREFIX."fanfiction_inseries WHERE Key_name = 'sid'"));
313
-		if($exists) dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index sid;");
314
-		$exists = dbnumrows(dbquery("SHOW INDEX FROM ".TABLEPREFIX."fanfiction_inseries WHERE Key_name = 'PRIMARY'"));
315
-		if($exists) dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop primary key");
316
-		dbquery("alter ignore table ".TABLEPREFIX."fanfiction_inseries add primary key (sid,seriesid,subseriesid);");
317
-	}	
318
-	$update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '".$version."' WHERE sitekey = '".SITEKEY."'");
319
-	if($update) $output .= write_message(_ACTIONSUCCESSFUL);
320
-	else $output .= write_error(_ERROR);
321
-}
322
-else if($confirm == "no") {
323
-	$output .= write_message(_ACTIONCANCELLED);
324
-}
325
-else {
326
-  	if($oldVersion[0] == 3 && ($oldVersion[1] < 4 || $oldVersion[1] == 4 && (!isset($oldVersion[2]) || $oldVersion[2] < 3))) $output .= write_message(_CONFIRMUPDATE."<br /> <a href='update.php?confirm=yes'>"._YES."</a> "._OR." <a href='update.php?confirm=no'>"._NO."</a>");
327
-	else $output .= write_message("Are you ready to update? <a href='update.php?confirm=yes'>"._YES."</a> "._OR." <a href='update.php?confirm=no'>"._NO."</a>");
328 189
 }
190
+elseif ($oldVersion[0] == 4) //3.5.5
191
+{
192
+	/* quick fix for switching between version on dev */
193
+	$update = dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET version = '3.5.5' WHERE sitekey = '" . SITEKEY . "'");
194
+	header("Location: update.php");
195
+	exit();
329 196
 }
330 197
 else $output .= write_message(_ALREADYUPDATED);
331
-$tpl->assign( "output", $output );
198
+$tpl->assign("output", $output);
332 199
 $tpl->printToScreen();
333
-dbclose( );
334
-?>
335 200
\ No newline at end of file
201
+dbclose();
... ...
@@ -34,7 +34,7 @@ if(!defined("_CHARSET")) exit( );
34 34
 			else {
35 35
 				include_once(_BASEDIR."includes/emailer.php");
36 36
 				if(!$email) $output .= write_error(_ERROR);
37
-				else $result = sendemail($penname, $email, $_POST['email'], $_POST['email'], descript(strip_tags($_POST['subject'])), descript($_POST['comments'])."<br /><br />".(isMEMBER ? sprintf(_SITESIG2, "<a href='".$url."/viewuser.php?uid=".USERUID."'>".USERPENNAME."</a>") : _SITESIG), "html");
37
+				else $result = sendemail($penname, $email, $_POST['email'], $siteemail , descript(strip_tags($_POST['subject'])), descript($_POST['comments'])."<br /><br />".(isMEMBER ? sprintf(_SITESIG2, "<a href='".$url."/viewuser.php?uid=".USERUID."'>".USERPENNAME."</a>") : _SITESIG), "html");
38 38
 				if($result)  $output .= write_message(_ACTIONSUCCESSFUL);
39 39
 				else $output .= write_error(_ERROR);
40 40
 			}
... ...
@@ -82,7 +82,7 @@ function random_string ($charset_string, $length)
82 82
 					}
83 83
 					dbquery("INSERT INTO ".substr(_AUTHORTABLE, 0, strpos(_AUTHORTABLE, "as author"))." (penname, realname, bio, email, date, password) VALUES ('".escapestring($penname)."', '".escapestring(strip_tags($_POST['realname']))."', '".strip_tags(escapestring($_POST['bio']), $allowed_tags)."', '$email', now(), '$encryppass')");
84 84
 					$useruid = dbinsertid();
85
-					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_REGISTER, $penname, $useruid, $_SERVER['REMOTE_ADDR']))."', '".$useruid."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG')");
85
+					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_REGISTER, $penname, $useruid, $_SERVER['REMOTE_ADDR']))."', '".$useruid."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'RG', " . time() . ")");
86 86
 					if(empty($siteskin)) {
87 87
 						$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
88 88
 						list($skin) = dbrow($skinquery);
... ...
@@ -132,7 +132,7 @@ function random_string ($charset_string, $length)
132 132
 				}
133 133
 				else {
134 134
 					dbquery("UPDATE "._AUTHORTABLE." SET penname = '".escapestring($penname)."' WHERE uid = '$_POST[uid]'");
135
-					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST[oldpenname], $uid, $penname))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB')");
135
+					if($logging) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_NEWPEN, USERPENNAME, USERUID, $_POST[oldpenname], $uid, $penname))."', '".USERUID."', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'EB', " . time() . ")");
136 136
 				}
137 137
 			}
138 138
 /* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
... ...
@@ -167,7 +167,7 @@ function random_string ($charset_string, $length)
167 167
 			list($tos) = dbrow($query);
168 168
 			$output .= "<div class='tblborder' style='width: 90%; margin: 1em auto;'>$tos</div>";
169 169
 		}
170
-		$output .= "<div id='settingsform'><form method=\"POST\" id=\"editbio\" name=\"editbio\" enctype=\"multipart/form-data\" style='margin: 0 auto;' action=\"member.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
170
+		$output .= "<div id='settingsform'><form method=\"POST\" id=\"editbio\" name=\"editbio\" enctype=\"multipart/form-data\" style='margin: 0 auto;' action=\"author.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
171 171
 		<div><label for='newpenname'>"._PENNAME.":</label>";
172 172
 		if((isADMIN && uLEVEL == 1) || $action == "register")
173 173
 			$output .= "<INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"".(isset($user) ? $user['penname'] : "")."\"><INPUT name=\"oldpenname\" type=\"hidden\" value=\"".(isset($user) ? $user['penname'] : "")."\"><font color=\"red\">*</font> ";
... ...
@@ -45,7 +45,7 @@ if(!defined("_CHARSET")) exit( );
45 45
 			$result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE uid = '".USERUID."' LIMIT 1");
46 46
 		}
47 47
 		$user = dbassoc($result);
48
-		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" style='width: 425px; margin: 0 auto;' action=\"member.php?action=editprefs\">
48
+		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" style='width: 425px; margin: 0 auto;' action=\"author.php?action=editprefs\">
49 49
 		<label for='newreviews'>"._CONTACTREVIEWS.":</label> <INPUT name=\"newreviews\" type=\"checkbox\" class=\"checkbox\"".($user['newreviews'] ? " checked" : "")."> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_NEWREV."</span></A><br />
50 50
 		<label for='newrespond'>"._CONTACTRESPOND.":</label> <INPUT name=\"newrespond\" type=\"checkbox\" class=\"checkbox\"".($user['newrespond'] ? " checked" : "")."><A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_NEWRESP."</span></A><br />";
51 51
 		if($alertson) 
... ...
@@ -36,6 +36,8 @@ if(empty($favorites)) accessDenied( );
36 36
 	$edit = isset($_GET['edit']) && isNumber($_GET['edit']) ? $_GET['edit'] : false;
37 37
 	$author = explode(",", $add);
38 38
 	$author = array_filter($author, "isNumber");
39
+	$array_pennames = array();
40
+	$pennames = '';
39 41
 	if(($add || $edit || $delete) && !isMEMBER) accessDenied( );
40 42
 
41 43
 	if(isMEMBER && $uid == USERUID) {
... ...
@@ -69,9 +71,9 @@ if(empty($favorites)) accessDenied( );
69 71
 				else {
70 72
 					$pQuery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE ".findclause(_UIDFIELD, $author));
71 73
 					while($pRes = dbassoc($pQuery)) {
72
-						$pennames[] = $pRes['penname'];
74
+						$array_pennames[] = $pRes['penname'];
73 75
 					}
74
-					$pennames = implode(", ", $pennames);
76
+					$pennames = implode(", ", $array_pennames);
75 77
 				}
76 78
 				$output = "<div class='sectionheader'>"._ADDTOFAVORITES.": ".$pennames."</div>";
77 79
 			}
... ...
@@ -86,14 +88,14 @@ if(empty($favorites)) accessDenied( );
86 88
 					$author = array($edit);
87 89
 					$pQuery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE ".findclause(_UIDFIELD, $author));
88 90
 					while($pRes = dbassoc($pQuery)) {
89
-						$pennames[] = $pRes['penname'];
91
+						$array_pennames[] = $pRes['penname'];
90 92
 					}
91
-					$pennames = implode(", ", $pennames);
93
+					$pennames = implode(", ", $array_pennames);
92 94
 					$output .= "<div class='sectionheader'>"._ADDTOFAVORITES.": ".$pennames."</div>";
93 95
 				}
94 96
 			}
95 97
 			$author = implode(",", $author);
96
-			$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"member.php?action=favau&amp;".( $add ? "add=$author" : "edit=$edit")."\">\n
98
+			$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"author.php?action=favau&amp;".( $add ? "add=$author" : "edit=$edit")."\">\n
97 99
 				<div style=\"width: 350px; margin: 0 auto; text-align: left;\"><label for=\"comments\">"._COMMENTS.":</label><br />
98 100
 				<textarea class=\"textbox\" name=\"comments\" id=\"comments\" cols=\"40\" rows=\"5\">".(isset($info['comments']) ? $info['comments'] : "")."</textarea><br />
99 101
 				<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form>";
... ...
@@ -114,7 +116,7 @@ if(empty($favorites)) accessDenied( );
114 116
 					$cmt->newBlock("comment");
115 117
 					$cmt->assign("comment", format_story($author['comments']));
116 118
 					if(USERUID == $uid) 
117
-					$cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"member.php?action=favau&amp;edit=".$author['uid']."\">"._EDIT."</a> | <a href=\"member.php?action=favau&amp;delete=".$author['uid']."\">"._REMOVEFAV."</a></div>");
119
+					$cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"author.php?action=favau&amp;edit=".$author['uid']."\">"._EDIT."</a> | <a href=\"author.php?action=favau&amp;delete=".$author['uid']."\">"._REMOVEFAV."</a></div>");
118 120
 					$cmt->assign("oddeven", ($x % 2 ? "odd" : "even"));
119 121
 					$output .= $cmt->getOutputContent( );
120 122
 					$x++;
... ...
@@ -70,7 +70,7 @@ if(empty($favorites)) accessDenied( );
70 70
 			$query = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'SE' AND item = '$edit' LIMIT 1");
71 71
 			$info = dbassoc($query);
72 72
 		}			
73
-		$tpl->assign("pagelinks", "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"member.php?action=favse&amp;add=1&amp;seriesid=".($add ? $add : $edit)."\">\n
73
+		$tpl->assign("pagelinks", "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"author.php?action=favse&amp;add=1&amp;seriesid=".($add ? $add : $edit)."\">\n
74 74
 			<div style=\"width: 350px; margin: 0 auto; text-align: left;\"><label for=\"comments\">"._COMMENTS.":</label><br />
75 75
 			<textarea class=\"textbox\" name=\"comments\" id=\"comments\" cols=\"40\" rows=\"5\">".(isset($info['comments']) ? $info['comments'] : "")."</textarea><br />
76 76
 			<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form>");
... ...
@@ -93,7 +93,7 @@ if(empty($favorites)) accessDenied( );
93 93
 			$cmt->newBlock("comment");
94 94
 			$cmt->assign("comment", $stories['comments'] ? "<div class='comments'><span class='label'>"._COMMENTS.": </span>".strip_tags($stories['comments'])."</div>" : "");
95 95
 			if(USERUID == $uid) 
96
-				$cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"member.php?action=favse&amp;edit=".$stories['seriesid']."\">"._EDIT."</a> | <a href=\"member.php?action=favse&amp;delete=".$stories['seriesid']."\">"._REMOVEFAV."</a></div>");
96
+				$cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"author.php?action=favse&amp;edit=".$stories['seriesid']."\">"._EDIT."</a> | <a href=\"author.php?action=favse&amp;delete=".$stories['seriesid']."\">"._REMOVEFAV."</a></div>");
97 97
 			$cmt->assign("oddeven", ($count % 2 ? "odd" : "even"));
98 98
 			$tpl->assign("comment", $cmt->getOutputContent( ));
99 99
 			$count++;
... ...
@@ -73,7 +73,7 @@ if(empty($favorites)) accessDenied( );
73 73
 			$tpl->newBlock("storyblock");
74 74
 			include("includes/storyblock.php");
75 75
 			$tpl->gotoBlock("listings");
76
-			$tpl->assign("pagelinks", "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"member.php?action=favst&amp;".($edit? "edit=$edit" : "add=1")."&amp;sid=".(isset($sid) ? $sid : $edit)."\">\n
76
+			$tpl->assign("pagelinks", "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"author.php?action=favst&amp;".($edit? "edit=$edit" : "add=1")."&amp;sid=".(isset($sid) ? $sid : $edit)."\">\n
77 77
 				<div style=\"width: 350px; margin: 0 auto; text-align: left;\"><label for=\"comments\">"._COMMENTS.":</label><br />
78 78
 				<textarea class=\"textbox\" name=\"comments\" id=\"comments\" cols=\"40\" rows=\"5\">".(isset($info['comments']) ? $info['comments'] : "")."</textarea><br />
79 79
 				<INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></div></form>");
... ...
@@ -81,7 +81,7 @@ if(empty($favorites)) accessDenied( );
81 81
 		}
82 82
 	}
83 83
 	else if(!isset($_POST['submit'])) {
84
-		$storyquery = "SELECT stories.*, "._PENNAMEFIELD." as penname, fav.comments as comments,  UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ".TABLEPREFIX."fanfiction_stories as stories, ".TABLEPREFIX."fanfiction_favorites as fav, "._AUTHORTABLE." WHERE fav.uid = '$uid' AND fav.type = 'ST' AND stories.uid = "._UIDFIELD." AND fav.item = stories.sid "._ORDERBY;
84
+		$storyquery = "SELECT stories.*, "._PENNAMEFIELD." as penname, fav.comments as comments,  stories.date as date, stories.updated as updated FROM ".TABLEPREFIX."fanfiction_stories as stories, ".TABLEPREFIX."fanfiction_favorites as fav, "._AUTHORTABLE." WHERE fav.uid = '$uid' AND fav.type = 'ST' AND stories.uid = "._UIDFIELD." AND fav.item = stories.sid "._ORDERBY;
85 85
 		$countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid' AND type = 'ST' GROUP BY uid");
86 86
 		list($storycount) = dbrow($countquery);
87 87
 		if($storycount) {
... ...
@@ -98,7 +98,7 @@ if(empty($favorites)) accessDenied( );
98 98
 				$cmt->newBlock("comment");
99 99
 				$cmt->assign("comment", $stories['comments'] ? "<div class='comments'><span class='label'>"._COMMENTS.": </span>".strip_tags($stories['comments'])."</div>" : "");
100 100
 				if(USERUID == $uid) 
101
-				$cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"member.php?action=favst&amp;edit=".$stories['sid']."\">"._EDIT."</a> | <a href=\"member.php?action=favst&amp;delete=".$stories['sid']."\">"._REMOVEFAV."</a></div>");
101
+				$cmt->assign("commentoptions", "<div class='adminoptions'><span class='label'>"._OPTIONS.":</span> <a href=\"author.php?action=favst&amp;edit=".$stories['sid']."\">"._EDIT."</a> | <a href=\"author.php?action=favst&amp;delete=".$stories['sid']."\">"._REMOVEFAV."</a></div>");
102 102
 				$cmt->assign("oddeven", ($count % 2 ? "odd" : "even"));
103 103
 				$tpl->assign("comment", $cmt->getOutputContent( ));
104 104
 				$tpl->gotoBlock( "listings" );
... ...
@@ -95,7 +95,7 @@
95 95
 	}
96 96
 	else if(!isMEMBER) {
97 97
 		$output .= "<div id=\"pagetitle\">"._MEMBERLOGIN."</div>";
98
-		$output .= "<div style=\"width: 250px; margin: 0 auto; text-align: center;\"><form method=\"POST\" enctype=\"multipart/form-data\" action=\"member.php?action=login".(isset($_GET['sid']) && isNumber($_GET['sid']) ? "&amp;sid=".$_GET['sid'] : "")."\">
98
+		$output .= "<div style=\"width: 250px; margin: 0 auto; text-align: center;\"><form method=\"POST\" enctype=\"multipart/form-data\" action=\"author.php?action=login".(isset($_GET['sid']) && isNumber($_GET['sid']) ? "&amp;sid=".$_GET['sid'] : "")."\">
99 99
 		<div class=\"label\" style=\"float: left;  width: 30%; text-align: right;\"><label for=\"penname\">"._PENNAME.":</label></div><INPUT type=\"text\" class=\"textbox\" name=\"penname\" id=\"penname\"><br />
100 100
 		<div class=\"label\" style=\"float: left; width: 30%; text-align: right;\"><label for=\"pswd\">"._PASSWORD.":</label></div><INPUT type=\"password\" class=\"textbox\" id=\"pswd\" name=\"password\"><br />
101 101
 		<INPUT type=\"checkbox\" class=\"checkbox\" name=\"cookiecheck\" id=\"cookiecheck\" value=\"1\"><label for=\"cookiecheck\">"._REMEMBERME."</label><br />
... ...
@@ -66,14 +66,14 @@ if(isMEMBER) accessDenied( );
66 66
 				}
67 67
 				else $output .=  write_message(_EMAILFAILED);
68 68
 				if($logging) 
69
-					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`) VALUES('".escapestring(sprintf(_LOG_LOST_PASSWORD, $penname, $uid, ($result ? _YES : _NO)))."', '$uid', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'LP')");
69
+					dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_log (`log_action`, `log_uid`, `log_ip`, `log_type`, `log_timestamp`) VALUES('".escapestring(sprintf(_LOG_LOST_PASSWORD, $penname, $uid, ($result ? _YES : _NO)))."', '$uid', INET_ATON('".$_SERVER['REMOTE_ADDR']."'), 'LP', " . time() . ")");
70 70
 			}
71 71
 
72 72
 		}
73 73
 		else $output .= write_message(_BADEMAIL);
74 74
 	}
75 75
 	else {
76
-		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"member.php?action=lostpassword\">
76
+		$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"author.php?action=lostpassword\">
77 77
 		<table align=\"center\" width=\"300\">
78 78
 		<tr><td>"._ENTEREMAIL."</td></tr>
79 79
 		<tr><td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\"> <INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\"></form>
... ...
@@ -88,7 +88,7 @@ class multi_upfiles extends file_upload {
88 88
 	}
89 89
 	function upload_multi_files () {
90 90
 		global $output, $imageheight, $imagewidth; 
91
-		$this->message = "";
91
+		$this->message = array();
92 92
 		if ($this->count_files()) {
93 93
 			foreach ($this->names_array as $key => $value) { 
94 94
 				if ($value != "") {
... ...
@@ -166,7 +166,7 @@ if($imageupload) {
166 166
 		buildImageList( );
167 167
 	}
168 168
 	if(isset($_GET['upload']) && !isset($_POST['submit'])) {
169
-			$output .= "<form method=\"post\" action=\"member.php?action=manageimages&upload=upload\" ENCTYPE=\"multipart/form-data\">
169
+			$output .= "<form method=\"post\" action=\"author.php?action=manageimages&upload=upload\" ENCTYPE=\"multipart/form-data\">
170 170
 					<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$max_size\">";
171 171
 			for($x = 1; $x < 6; $x++) {
172 172
 				$output .= "<div style='width: 300px; margin: 0 auto;'><label for='upfile$x'>"._IMAGE." $x:</label><input id=\"upfile$x\" type=\"file\" class=\"textbox\" name=\"upfile[]\"></div>";
... ...
@@ -206,12 +206,12 @@ if($imageupload) {
206 206
 		while($filename = readdir($directory)) {
207 207
 			if($filename=="." || $filename==".." || $filename == "imagelist.js") continue;
208 208
 			list($imght, $imgwth, $type, $attr) = getimagesize("$folder/$filename");
209
-			$output .= "<tr><td class='tblborder'>$filename</td><td class='tblborder'>&#60;img src=\"$folder/$filename\"&#62;</td><td class='tblborder' style='text-align: center;'><a href=\"javascript:pop('$folder/$filename', $imgwth, $imght, 'yes')\">"._VIEW."</a> | <a href=\"member.php?action=manageimages&amp;delete=$filename\" onclick=\"return confirm('"._CONFIRMDELETE."')\">"._DELETE."</a></td></tr>";
209
+			$output .= "<tr><td class='tblborder'>$filename</td><td class='tblborder'>&#60;img src=\"$folder/$filename\"&#62;</td><td class='tblborder' style='text-align: center;'><a href=\"javascript:pop('$folder/$filename', $imgwth, $imght, 'yes')\">"._VIEW."</a> | <a href=\"author.php?action=manageimages&amp;delete=$filename\" onclick=\"return confirm('"._CONFIRMDELETE."')\">"._DELETE."</a></td></tr>";
210 210
 			$count++;
211 211
 		}
212 212
 		if($count == 0) $output .= "<tr><td colspan='3' style='text-align: center;'>"._NORESULTS."</td></tr>";
213 213
 		$output .= "</table></div>";
214
-		$output .= write_message("<a href=\"member.php?action=manageimages&amp;upload=upload\">"._UPLOADIMAGE."</a>");
214
+		$output .= write_message("<a href=\"author.php?action=manageimages&amp;upload=upload\">"._UPLOADIMAGE."</a>");
215 215
 
216 216
 	}
217 217
 }
... ...
@@ -45,7 +45,7 @@ else {
45 45
 			$itemcount = 0;
46 46
 			$countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid' AND type = '$type'");
47 47
 			list($itemcount) = dbrow($countquery);
48
-			if(empty($panel['panel_url'])) $output .=  "<a href=\"member.php?action=".$panel['panel_name']."\">".$panel['panel_title']." [$itemcount]</a><br />\n";
48
+			if(empty($panel['panel_url'])) $output .=  "<a href=\"author.php?action=".$panel['panel_name']."\">".$panel['panel_title']." [$itemcount]</a><br />\n";
49 49
 			else $output .= "<a href=\"".$panel['panel_url']."\">".$panel['panel_title']." [$itemcount]</a><br />\n";
50 50
 		}
51 51
 	}
... ...
@@ -26,15 +26,16 @@ if(!defined("_CHARSET")) exit( );
26 26
 
27 27
 // Build the user's profile information
28 28
 $tpl->newBlock("profile");
29
-$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
29
+$result2 = dbquery("SELECT *, date as date FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
30 30
 $userinfo = dbassoc($result2);
31 31
 $nameinfo = "";
32 32
 if($userinfo['email'])
33 33
 	$nameinfo .= " [<a href=\"viewuser.php?action=contact&amp;uid=".$userinfo['uid']."\">"._CONTACT."</a>]";
34 34
 if(!empty($favorites) && isMEMBER && $userinfo['uid'] != USERUID) {
35 35
 	$fav = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'AU' AND item = '".$userinfo['uid']."'");
36
-	if(dbnumrows($fav) == 0) $nameinfo .= " [<a href=\"member.php?action=favau&amp;uid=".USERUID."&amp;add=".$userinfo['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
36
+	if(dbnumrows($fav) == 0) $nameinfo .= " [<a href=\"author.php?action=favau&amp;uid=".USERUID."&amp;add=".$userinfo['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
37 37
 }
38
+ 
38 39
 $tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);
39 40
 $tpl->assign("membersince", date("$dateformat", $userinfo['date']));
40 41
 if($userinfo['realname'])
... ...
@@ -81,7 +82,7 @@ if(!empty($dynamicfields)) $tpl->assign("authorfields", $dynamicfields);
81 82
 $tpl->assign("reportthis", "[<a href=\""._BASEDIR."contact.php?action=report&amp;url=viewuser.php?uid=".$uid."\">"._REPORTTHIS."</a>]");
82 83
 $adminopts = "";
83 84
 if(isADMIN && uLEVEL < 3) {
84
-	$adminopts .= "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"member.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
85
+	$adminopts .= "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"author.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
85 86
 	$adminopts .= " [<a href=\"admin.php?action=members&amp;".($userinfo['level'] < 0 ? "unlock=".$userinfo['uid']."\" class=\"vuadmin\">"._UNLOCKMEM : "lock=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."</a>]";
86 87
 	$adminopts .= " [<a href=\"admin.php?action=admins&amp;".(isset($userinfo['level']) && $userinfo['level'] > 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."</a>] [<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=$uid\" class=\"vuadmin\">"._EDITADMIN : "do=new&amp;uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."</a>]</div>";
87 88
 	$tpl->assign("adminoptions", $adminopts);
... ...
@@ -8,7 +8,7 @@ define ("_EMAILFIELD", "author.email");  // Do not change the aliasing (the "aut
8 8
 define ("_PASSWORDFIELD", "author.password"); //  Do not change the aliasing (the "author." part)!
9 9
 define ("_AUTHORTABLE", TABLEPREFIX."fanfiction_authors as author"); // Do not change the aliasing (the "as author" part)!
10 10
 
11
-define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
11
+define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
12 12
 define ("_STORYCOUNT", "SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_stories as stories WHERE validated > 0");
13 13
 define ("_SERIESQUERY", "SELECT series.*, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_series as series WHERE "._UIDFIELD." = series.uid ");
14 14
 define ("_SERIESCOUNT", "SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series as series ");
... ...
@@ -37,7 +37,7 @@ else {
37 37
 $revcount = dbquery("SELECT COUNT(reviewid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE uid = '$uid' AND review != 'No Review'");
38 38
 list($reviewcount) = dbrow($revcount);
39 39
 if($reviewcount) {
40
-	$revquery = dbquery("SELECT rev.*, UNIX_TIMESTAMP(rev.date) as date, "._PENNAMEFIELD." FROM ".TABLEPREFIX."fanfiction_reviews as rev, "._AUTHORTABLE." WHERE rev.uid = "._UIDFIELD." AND rev.uid = '$uid' AND rev.review != 'No Review' ORDER BY type, item LIMIT $offset, $itemsperpage");
40
+	$revquery = dbquery("SELECT rev.*, rev.date as date, "._PENNAMEFIELD." FROM ".TABLEPREFIX."fanfiction_reviews as rev, "._AUTHORTABLE." WHERE rev.uid = "._UIDFIELD." AND rev.uid = '$uid' AND rev.review != 'No Review' ORDER BY type, item LIMIT $offset, $itemsperpage");
41 41
 	$counter = 0;
42 42
 	$count = 0;
43 43
 	while($reviews = dbassoc($revquery)) {
... ...
@@ -84,7 +84,7 @@ if($reviewcount) {
84 84
 			$reviewer = $reviews['reviewer'];
85 85
 			$member = _ANONYMOUS;
86 86
 		}
87
-		if(!empty($authoruid) && USERUID == $authoruid) $adminlink .= " [<a href=\"member.php?action=revres&amp;reviewid=".$reviews['reviewid']."\">"._RESPOND."</a>]";
87
+		if(!empty($authoruid) && USERUID == $authoruid) $adminlink .= " [<a href=\"author.php?action=revres&amp;reviewid=".$reviews['reviewid']."\">"._RESPOND."</a>]";
88 88
 		$revlist->newBlock("reviewsblock");
89 89
 		$revlist->assign("reviewer"   , $reviewer );
90 90
 		$revlist->assign("review"   , $reviews['review']);
... ...
@@ -46,7 +46,7 @@ if(!defined("_CHARSET")) exit( );
46 46
 	else {
47 47
 		$reviewid = isset($_GET['reviewid']) && isNumber($_GET['reviewid']) ? $_GET['reviewid'] : false;
48 48
 		if(!$reviewid) accessDenied( );
49
-		$result = dbquery("SELECT review.*, UNIX_TIMESTAMP(review.date) as date FROM ".TABLEPREFIX."fanfiction_reviews as review LEFT JOIN ".TABLEPREFIX."fanfiction_authors as member ON member.uid = review.uid WHERE review.reviewid = '$reviewid' LIMIT 1");
49
+		$result = dbquery("SELECT review.*, review.date as date FROM ".TABLEPREFIX."fanfiction_reviews as review LEFT JOIN ".TABLEPREFIX."fanfiction_authors as member ON member.uid = review.uid WHERE review.reviewid = '$reviewid' LIMIT 1");
50 50
 		$reviews = dbassoc($result);
51 51
 		if(!empty($reviews['respond'])) {
52 52
 			$tpl->assign("output", write_message(_ALREADYRESPONDED));
... ...
@@ -67,13 +67,14 @@ if(!defined("_CHARSET")) exit( );
67 67
 			}
68 68
 		}
69 69
 		$user = dbassoc(dbquery($query2));
70
+		$array_coauthors = array();
70 71
 		if(!empty($user['coauthors'])) {
71 72
 			$coQuery = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_coauthors WHERE sid = '".$reviews['item']."'");
72 73
 			while($c = dbassoc($coQuery)) {
73
-				$coauthors[] = $c['uid'];
74
+				$array_coauthors[] = $c['uid'];
74 75
 			}
75 76
 		}
76
-		if(USERUID == $user['uid'] || (!empty($user['coauthors']) && in_array(USERUID, $coauthors))) {
77
+		if(USERUID == $user['uid'] || (!empty($user['coauthors']) && in_array(USERUID, $array_coauthors))) {
77 78
 			if($type == "ST") {
78 79
 				$storyquery = dbquery("SELECT s.title, s.uid, r.rid, r.rating, r.ratingwarning, r.warningtext, s.sid FROM ".TABLEPREFIX."fanfiction_stories as s, ".TABLEPREFIX."fanfiction_ratings as r WHERE s.sid = '".$reviews['item']."' AND s.rid = r.rating LIMIT 1");
79 80
 				$story = dbassoc($storyquery);
... ...
@@ -113,7 +114,7 @@ if(!defined("_CHARSET")) exit( );
113 114
 			$revlist->assign("member", $member );
114 115
 			$revlist->assign("oddeven", "odd");
115 116
 			$output .= $revlist->getOutputContent( );
116
-			$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"member.php?action=revres\">";
117
+			$output .= "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"author.php?action=revres\">";
117 118
 			$output .= "<INPUT type=\"hidden\" name=\"rid\" value=\"$reviewid\">
118 119
 				<div style=\"text-align: center;\"><label for=\"response\">"._AUTHORSRESPONSE.":</label><span style='clear: left;'>&nbsp;</span></div>
119 120
 				<div class='shorttextarea'><textarea class=\"textbox\" name=\"response\" id=\"response\" style='width: 100%;' rows=\"5\"></TEXTAREA></div>";
... ...
@@ -70,7 +70,7 @@ $authorof[] =  "<a href='".$thislink."action=stats&amp;stat=series'>$seriescount
70 70
 if($stat == "series" && dbnumrows($seriesquery)) {
71 71
 	$output .= "<center><h4>"._SERIES."</h4></center><table class=\"tblborder\"  width=\"90%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"><tr><th>"._TITLE."</th>".($reviewsallowed ? "<th>"._REVIEWS."</th>" : "").($favorites ? "<th>"._FAVORITE."</th>" : "")."</tr>";
72 72
 	while($series = dbassoc($seriesquery)) {
73
-		$output .= "<tr><td class=\"tblborder\"><a href=\"series.php?seriesid=$series[seriesid]\">".stripslashes($series['title'])."</a> ".ratingpics($series['rating'])."</td>".($reviewsallowed ? "<td class=\"tblborder\" align=\"center\"><a href=\"reviews.php?type=SE&amp;item=$series[seriesid]\">$series[reviews]</a></td>" : "").($favorites ? "<td class=\"tblborder\" align=\"center\">".($series['count'] ? "<a href=\"member.php?action=stats&amp;favseries=$series[seriesid]\">$series[count]</a>" : "0")."</td>" : "")."</td></tr>";
73
+		$output .= "<tr><td class=\"tblborder\"><a href=\"series.php?seriesid=$series[seriesid]\">".stripslashes($series['title'])."</a> ".ratingpics($series['rating'])."</td>".($reviewsallowed ? "<td class=\"tblborder\" align=\"center\"><a href=\"reviews.php?type=SE&amp;item=$series[seriesid]\">$series[reviews]</a></td>" : "").($favorites ? "<td class=\"tblborder\" align=\"center\">".($series['count'] ? "<a href=\"author.php?action=stats&amp;favseries=$series[seriesid]\">$series[count]</a>" : "0")."</td>" : "")."</td></tr>";
74 74
 		$serieslist[] = $series['seriesid'];
75 75
 	}
76 76
 	$output .= "</table>";
... ...
@@ -34,7 +34,7 @@ if($numstories) {
34 34
 	$count = 0;
35 35
 	$tpl->newBlock("listings");
36 36
 	$tpl->assign("stories", "<div class='sectionheader'>"._STORIESBY." $penname</div>");
37
-	$storyquery = dbquery("SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON coauth.sid = stories.sid WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 AND (stories.uid = '$uid' OR coauth.uid = '$uid') GROUP BY stories.sid "._ORDERBY." LIMIT $offset, $itemsperpage");
37
+	$storyquery = dbquery("SELECT stories.*, "._PENNAMEFIELD." as penname, stories.date as date, stories.updated as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as coauth ON coauth.sid = stories.sid WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 AND (stories.uid = '$uid' OR coauth.uid = '$uid') GROUP BY stories.sid "._ORDERBY." LIMIT $offset, $itemsperpage");
38 38
 	while($stories = dbassoc($storyquery)) {
39 39
 		$tpl->newBlock("storyblock");
40 40
 		include("includes/storyblock.php");
... ...
@@ -1,4 +1,19 @@
1 1
 <?php
2 2
 if(!defined("_CHARSET")) exit( );
3
-$version = "3.5.5";
4
-?>
5 3
\ No newline at end of file
4
+$version = "3.5.6";
5
+
6
+/* shortcut 
7
+$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_stories LIKE 'date'"));
8
+if($tmp['Type'] == "datetime") {
9
+    dbquery("UPDATE " . TABLEPREFIX . "fanfiction_settings SET version = '3.5.5' WHERE sitekey = '" . SITEKEY . "'");
10
+}
11
+
12
+
13
+$tmp = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . "fanfiction_news LIKE 'time'"));
14
+ 
15
+if ($tmp['Type'] == "datetime")
16
+{
17
+    dbquery("UPDATE " . TABLEPREFIX . "fanfiction_settings SET version = '3.5.5' WHERE sitekey = '" . SITEKEY . "'");
18
+}
19
+
20
+*/
6 21
\ No newline at end of file
... ...
@@ -82,11 +82,11 @@ if($reviewsallowed && (isMEMBER || $anonreviews)) {
82 82
 	$jumpmenu .= "<option value=\"reviews.php?action=add&amp;type=SE&amp;item=$seriesid\">"._SUBMITREVIEW."</option>";
83 83
 }
84 84
 if(isMEMBER && $favorites) {
85
-	$addtofaves = "[<a href=\"member.php?action=favse&amp;uid=".USERUID."&amp;add=$seriesid\">"._ADDSERIES2FAVES."</a>]";
86
-	$jumpmenu .= "<option value=\"member.php?action=favse&amp;uid=".USERUID."&amp;add=$seriesid\">"._ADDSERIES2FAVES."</option>";
85
+	$addtofaves = "[<a href=\"author.php?action=favse&amp;uid=".USERUID."&amp;add=$seriesid\">"._ADDSERIES2FAVES."</a>]";
86
+	$jumpmenu .= "<option value=\"author.php?action=favse&amp;uid=".USERUID."&amp;add=$seriesid\">"._ADDSERIES2FAVES."</option>";
87 87
 	if($series['isopen'] == 0) { // Only closed series.
88
-		$addtofaves .= " [<a href=\"member.php?action=favau&amp;uid=".USERUID."&amp;add=".$series['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
89
-		$jumpmenu .= "<option value=\"member.php?action=favau&amp;uid=".USERUID."&amp;add=".$series['uid']."\">"._ADDAUTHOR2FAVES."</option>";
88
+		$addtofaves .= " [<a href=\"author.php?action=favau&amp;uid=".USERUID."&amp;add=".$series['uid']."\">"._ADDAUTHOR2FAVES."</a>]";
89
+		$jumpmenu .= "<option value=\"author.php?action=favau&amp;uid=".USERUID."&amp;add=".$series['uid']."\">"._ADDAUTHOR2FAVES."</option>";
90 90
 	}
91 91
 }
92 92
 if($series['isopen'] && isMEMBER) {
... ...
@@ -32,16 +32,16 @@ else $textsize = 0;
32 32
 if(empty($chapter)) $chapter = isset($_GET['chapter']) && isNumber($_GET['chapter']) ? $_GET['chapter'] : false;
33 33
 
34 34
 	// Get the story information
35
-	$storyquery = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid, story.*, UNIX_TIMESTAMP(story.date) as date, UNIX_TIMESTAMP(story.updated) as updated, story.validated as valid FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE story.sid = '".$sid."' AND story.uid = "._UIDFIELD);
35
+	$storyquery = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid, story.*, story.date as date, story.updated as updated, story.validated as valid FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE story.sid = '".$sid."' AND story.uid = "._UIDFIELD);
36 36
 	$storyinfo = dbassoc($storyquery);
37 37
 	if($storyinfo['coauthors'] == 1) {
38
-		$coauthors = array();
38
+	$array_coauthors = array();
39 39
 		$coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$sid."'");
40 40
 		while($c = dbassoc($coauth)) {
41
-			$coauthors[$c['uid']] = $c['penname'];
41
+		$array_coauthors[$c['uid']] = $c['penname'];
42 42
 		}
43
-		$storyinfo['coauthors'] = $coauthors;
44
-		unset($coauthors);
43
+		$storyinfo['coauthors'] = $array_coauthors;
44
+		unset($array_coauthors);
45 45
 	}
46 46
 	else $storyinfo['coauthors'] = array();
47 47
 	//  Check that the story is valid and that the visitor has permissions to read this story
... ...
@@ -315,7 +315,7 @@ else {
315 315
 	if(isADMIN && uLEVEL < 3) 
316 316
 		$adminlinks = "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> "._EDIT." - <a href=\"stories.php?action=editstory&amp;sid=$sid&amp;admin=1\">"._STORY."</a> "._OR." <a href=\"stories.php?action=editchapter&amp;chapid=$chapid&amp;admin=1\">"._CHAPTER."</a> | "._DELETE." - <a href=\"stories.php?action=delete&amp;sid=$sid&amp;admin=1\">"._STORY."</a> "._OR." <a href=\"stories.php?action=delete&amp;chapid=$chapid&amp;sid=$sid&amp;admin=1\">"._CHAPTER."</a></div>";
317 317
 	if(isMEMBER && $favorites) {
318
-		$jumpmenu2 .= "<option value=\"member.php?action=favst&amp;add=1&amp;sid=$sid\">"._ADDSTORY2FAVES."</option><option value=\"member.php?action=favau&amp;add=1&amp;author=".$stories['uid'].(count($storyinfo['coauthors']) ? ",".implode(",", array_keys($storyinfo['coauthors'])) : "")."\">"._ADDAUTHOR2FAVES."</option>";
318
+		$jumpmenu2 .= "<option value=\"author.php?action=favst&amp;add=1&amp;sid=$sid\">"._ADDSTORY2FAVES."</option><option value=\"author.php?action=favau&amp;add=1&amp;author=".$stories['uid'].(count($storyinfo['coauthors']) ? ",".implode(",", array_keys($storyinfo['coauthors'])) : "")."\">"._ADDAUTHOR2FAVES."</option>";
319 319
 	}
320 320
 	if($reviewsallowed ) {
321 321
 		if(isMEMBER || $anonreviews) {
... ...
@@ -344,7 +344,7 @@ else {
344 344
 	if(empty($viewed) || (is_array($viewed) && !in_array($sid, $viewed))) {
345 345
 		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET count = count + 1 WHERE sid = '$sid'  LIMIT 1");
346 346
 		$viewed[] = $sid;
347
-		$_SESSION['viewed'] = $viewed;
347
+		$_SESSION[SITEKEY."_viewed"] = $viewed;
348 348
 	}
349 349
 	dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET count = count + 1 WHERE chapid = '$chapid' LIMIT 1");
350 350
 	// end counters
... ...
@@ -46,7 +46,7 @@ if($displayprofile) include("user/profile.php");
46 46
 else if(isADMIN && uLEVEL < 3) {
47 47
 	$result2 = dbquery("SELECT * FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
48 48
 	$userinfo = dbassoc($result2);
49
-	$adminopts = "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"member.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
49
+	$adminopts = "<div class=\"adminoptions\"><span class='label'>"._ADMINOPTIONS.":</span> ".(isset($userinfo['validated']) && $userinfo['validated'] ? "[<a href=\"admin.php?action=members&amp;revoke=$uid\" class=\"vuadmin\">"._REVOKEVAL."</a>] " : "[<a href=\"admin.php?action=members&amp;validate=$uid\" class=\"vuadmin\">"._VALIDATE."</a>] ")."[<a href=\"author.php?action=editbio&amp;uid=$uid\" class=\"vuadmin\">"._EDIT."</a>] [<a href=\"admin.php?action=members&amp;delete=$uid\" class=\"vuadmin\">"._DELETE."</a>]";
50 50
 	$adminopts .= " [<a href=\"admin.php?action=members&amp;".($userinfo['level'] < 0 ? "unlock=".$userinfo['uid']."\" class=\"vuadmin\">"._UNLOCKMEM : "lock=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."</a>]";
51 51
 	$adminopts .= " [<a href=\"admin.php?action=admins&amp;".(isset($userinfo['level']) && $userinfo['level'] > 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."</a>] [<a href=\"admin.php?action=admins&amp;do=edit&amp;uid=$uid\" class=\"vuadmin\">"._EDITADMIN : "do=new&amp;uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."</a>]</div>";
52 52
 	$tpl->assign("adminoptions", $adminopts);