Browse code

conflict file names fix

Jimako authored on 2023/09/07 15:38:37
Showing 1 changed files
... ...
@@ -255,7 +255,7 @@ switch ($_GET['step'])
255 255
 				$output .= "<tr><td>Welcome</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
256 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 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>');");
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=\"report.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 259
 				$output .= "<tr><td>Help</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
260 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 261
 				$output .= "<tr><td>Rejection Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
... ...
@@ -324,25 +324,25 @@ switch ($_GET['step'])
324 324
 					array("recent", "Most Recent", "browse.php?type=recent", "0", "0"),
325 325
 					array("login", "Login", "user.php?action=login", "0", "0"),
326 326
 					array("adminarea", "Admin", "admin.php", "0", "2"),
327
-					array("logout", "Logout", "user.php?action=logout", "0", "1"),
327
+					array("logout", "Logout", "author.php?action=logout", "0", "1"),
328 328
 					array("featured", "Featured Stories", "browse.php?type=featured", "0", "0"),
329 329
 					array("catslink", "Categories", "browse.php?type=categories", "0", "0"),
330 330
 					array("members", "Members", "authors.php?action=list", "0", "0"),
331 331
 					array("authors", "Authors", "authors.php?list=authors", "0", "0"),
332 332
 					array("help", "Help", "viewpage.php?page=help", "0", "0"),
333
-					array("search", "Search", "search.php", "0", "0"),
333
+					array("search", "Search", "searching.php", "0", "0"),
334 334
 					array("series", "Series", "browse.php?type=series", "0", "0"),
335 335
 					array("tens", "Top Tens", "toplists.php", "0", "0"),
336 336
 					array("challenges", "Challenges", "modules/challenges/challenges.php", "0", "0"),
337
-					array("contactus", "Contact Us", "contact.php", "0", "0"),
337
+					array("contactus", "Contact Us", "report.php", "0", "0"),
338 338
 					array("rules", "Rules", "viewpage.php?page=rules", "0", "0"),
339 339
 					array("tos", "Terms of Service", "viewpage.php?page=tos", "0", "0"),
340 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"),
341
+					array("login", "Account Info", "author.php", "0", "1"),
342 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"),
343
+					array("register", "Register", "author.php?action=register", "0", "0"),
344
+					array("lostpassword", "Lost Password", "author.php?action=lostpassword", "0", "0"),
345
+					array("newsarchive", "News Archive", "ffnews.php", "0", "0"),
346 346
 					array("browse", "Browse", "browse.php", "0", "0"),
347 347
 					array("charslink", "Characters", "browse.php?type=characters", "0", "0"),
348 348
 					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
Browse code

update

Jimako authored on 2023/09/07 15:28:52
Showing 1 changed files
... ...
@@ -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();
Browse code

fix new installation under e107

Jimmi08 authored on 2021/08/26 07:43:59
Showing 1 changed files
... ...
@@ -947,7 +947,6 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
947 947
 		else { 
948 948
 			if(file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
949 949
 			if(isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
950
-			else if(isset($sitename)) $output .= write_message(_CONFIG1DETECTED);
951 950
 			else {
952 951
 				$output .=  
953 952
 					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
Browse code

fix for PHP notices during install process

Jimmi08 authored on 2021/06/11 08:24:44
Showing 1 changed files
... ...
@@ -60,20 +60,21 @@ header ("Pragma: no-cache");
60 60
 header ("Expires: 0"); 
61 61
 
62 62
 $output = "";
63
+$language = "en";
63 64
 
64 65
 include ("../includes/class.TemplatePower.inc.php");
65 66
 
66
-if(!isset($_GET['step']) || $_GET['step'] == 2) {
67
+if(!isset($_GET['step']) || $_GET['step'] == 2) {   
67 68
 	include ("../languages/en.php");
68 69
 	include ("../languages/en_admin.php");
69 70
 	include ("languages/en.php");
70 71
 }
71 72
 else if(isset($_REQUEST['language'])) {
72 73
 	$language = $_REQUEST['language'];
73
-	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
74
-	else include ("../languages/en.php");
75
-	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
76
-	else include ("../languages/en_admin.php");
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");
77 78
 	if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
78 79
 	else include ("languages/en.php");
79 80
 }
... ...
@@ -146,14 +147,15 @@ $tpl->newBlock("footer");
146 147
 $tpl->assign( "footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
147 148
 $tpl->gotoBlock( "_ROOT" );
148 149
 
149
-switch($_GET['step']) {
150
+$step = isset($_GET["step"]) ? $_GET["step"] : "";
151
+switch($step) {
150 152
 	case "9":
151 153
 		if(isset($_POST['submit'])) {
152 154
 			$penname = descript($_POST['newpenname']);
153 155
 			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154 156
 			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155
-			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>";
156
-			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
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']);
157 159
 			else $fail =  write_message(_PASSWORDTWICE);
158 160
 			if(!isset($fail)) {
159 161
 				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '".$_POST['email']."', '$encryptpassword', now( ))");
... ...
@@ -161,11 +163,13 @@ switch($_GET['step']) {
161 163
 				$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
162 164
 				list($skin) = dbrow($skinquery);
163 165
 				$result2 = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('".USERUID."', '$skin', '1')");
164
-				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!");
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!");
165 167
 			}
166 168
 			else $output .= $fail;
167 169
 		}
168 170
 		else {
171
+            if(!isset($user['penname'])) $user['penname'] = '';
172
+            if(!isset($user['email'])) $user['email'] = '';
169 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\">
170 174
 			<div class='row'><label for='newpenname'>"._PENNAME.":</label> <INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"$user[penname]\"></div>
171 175
 		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"$user[email]\" maxlength=\"200\"></div>
... ...
@@ -784,7 +788,7 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
784 788
 				$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
785 789
 			}
786 790
 			$settings = dbassoc($settingsresults);
787
-			define("_BASEDIR", "../");
791
+            if (!defined("_BASEDIR")) define('constant', define("_BASEDIR", "../"));
788 792
 			foreach($settings as $var => $val) {
789 793
 				$$var = $val;
790 794
 			}
... ...
@@ -814,7 +818,7 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
814 818
 			else include("../admin/settings.php");
815 819
 		}
816 820
 		else {
817
-			if($_GET['install']) {
821
+			if(isset($_GET['install'])) {
818 822
 				if($_GET['install'] == "automatic") {
819 823
 			
820 824
 								$settings = dbquery("CREATE TABLE IF NOT EXISTS `".$settingsprefix."fanfiction_settings` (
Browse code

replaced user.php

Jimmi08 authored on 2021/04/02 11:32:40
Showing 1 changed files
... ...
@@ -215,7 +215,7 @@ switch($_GET['step']) {
215 215
 				$output .= "<tr><td>Welcome</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
216 216
 				$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');");
217 217
 				$output .= "<tr><td>Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
218
-				$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>');");
218
+				$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>');");
219 219
 				$output .= "<tr><td>Help</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
220 220
 				$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}');");
221 221
 				$output .= "<tr><td>Rejection Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
... ...
@@ -275,9 +275,9 @@ switch($_GET['step']) {
275 275
 				$pagelist = array(
276 276
 					array("home","Home","index.php","0","0"),
277 277
 					array("recent","Most Recent","browse.php?type=recent","0","0"),
278
-					array("login","Login","user.php?action=login","0","0"),
278
+					array("login","Login","member.php?action=login","0","0"),
279 279
 					array("adminarea","Admin","admin.php","0","2"),
280
-					array("logout","Logout","user.php?action=logout","0","1"),
280
+					array("logout","Logout","member.php?action=logout","0","1"),
281 281
 					array("featured","Featured Stories","browse.php?type=featured","0","0"),
282 282
 					array("catslink","Categories","browse.php?type=categories","0","0"),
283 283
 					array("members","Members","authors.php?action=list","0","0"),
... ...
@@ -291,10 +291,10 @@ switch($_GET['step']) {
291 291
 					array("rules","Rules","viewpage.php?page=rules","0","0"),
292 292
 					array("tos","Terms of Service","viewpage.php?page=tos","0","0"),
293 293
 					array("rss","<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>","rss.php","0","0"),
294
-					array("login","Account Info","user.php","0","1"),
294
+					array("login","Account Info","member.php","0","1"),
295 295
 					array("titles","Titles","browse.php?type=titles","0","0"),
296
-					array("register","Register","user.php?action=register","0","0"),
297
-					array("lostpassword","Lost Password","user.php?action=lostpassword","0","0"),
296
+					array("register","Register","member.php?action=register","0","0"),
297
+					array("lostpassword","Lost Password","member.php?action=lostpassword","0","0"),
298 298
 					array("newsarchive","News Archive","news.php","0","0"),
299 299
 					array("browse","Browse","browse.php","0","0"),
300 300
 					array("charslink", "Characters", "browse.php?type=characters","0","0"),
Browse code

backup 3.52

Jimmi08 authored on 2021/04/02 11:08:04
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,976 @@
1
+<?php
2
+// ----------------------------------------------------------------------
3
+// Updated June 2014
4
+// Copyright (c) 2007 by Tammy Keefer
5
+// Based on eFiction 1.1
6
+// Copyright (C) 2003 by Rebecca Smallwood.
7
+// http://efiction.sourceforge.net/
8
+// ----------------------------------------------------------------------
9
+// LICENSE
10
+//
11
+// This program is free software; you can redistribute it and/or
12
+// modify it under the terms of the GNU General Public License (GPL)
13
+// as published by the Free Software Foundation; either version 2
14
+// of the License, or (at your option) any later version.
15
+//
16
+// This program is distributed in the hope that it will be useful,
17
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+// GNU General Public License for more details.
20
+//
21
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html
22
+// ----------------------------------------------------------------------
23
+
24
+
25
+function random_char($string)
26
+{
27
+	$length = strlen($string);
28
+	$position = mt_rand(0, $length - 1);
29
+	 return $string[$position];
30
+}
31
+
32
+function random_string ($charset_string, $length)
33
+{
34
+	$return_string = random_char($charset_string);
35
+	for ($x = 1; $x < $length; $x++)
36
+	$return_string .= random_char($charset_string);
37
+	return $return_string;
38
+}
39
+
40
+$randomcharset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';
41
+
42
+
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 );
47
+	}
48
+	foreach($_GET as $var => $val) {
49
+		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
50
+	}
51
+	foreach($_COOKIE as $var => $val) {
52
+		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
53
+	}
54
+}
55
+
56
+define("_BASEDIR", "../");
57
+define("_CHARSET", "utf-8");
58
+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"); 
61
+
62
+$output = "";
63
+
64
+include ("../includes/class.TemplatePower.inc.php");
65
+
66
+if(!isset($_GET['step']) || $_GET['step'] == 2) {
67
+	include ("../languages/en.php");
68
+	include ("../languages/en_admin.php");
69
+	include ("languages/en.php");
70
+}
71
+else if(isset($_REQUEST['language'])) {
72
+	$language = $_REQUEST['language'];
73
+	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
74
+	else include ("../languages/en.php");
75
+	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
76
+	else include ("../languages/en_admin.php");
77
+	if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
78
+	else include ("languages/en.php");
79
+}
80
+else {
81
+include("../config.php");
82
+$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
83
+$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
84
+list($tableprefix, $language) = dbrow($settings);
85
+define("TABLEPREFIX", $tableprefix);
86
+define("SITEKEY", $sitekey);
87
+if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
88
+else include ("../languages/en.php");
89
+if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
90
+else include ("../languages/en_admin.php");
91
+if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
92
+else include ("languages/en.php");
93
+}
94
+include(_BASEDIR."includes/corefunctions.php");
95
+
96
+//  So I don't have to keep updating the version number in 3 different files.
97
+include("../version.php");
98
+
99
+//make a new TemplatePower object
100
+echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
101
+<html><head><title>eFiction {$version} Install</title>
102
+<style>
103
+LABEL { float: left; display: block; width: 45%; text-align: right; padding-right: 10px; clear: left;}
104
+.row { float: left; width: 99%; }
105
+#settingsform FORM { width: 80%; margin; 0 auto; }
106
+#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
107
+#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
108
+#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
109
+#settingsform .tinytoggle { text-align: center; }
110
+#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
111
+#settingsform #submit { display: block; margin: 1ex auto; }
112
+a.pophelp{
113
+    position: relative; /* this is the key*/
114
+    z-index:24;
115
+    vertical-align: super;
116
+    text-decoration: none;
117
+}
118
+
119
+a.pophelp:hover{z-index:100; border: none; text-decoration: none;}
120
+
121
+a.pophelp span{display: none; position: absolute; text-decoration: none;}
122
+
123
+a.pophelp:hover span{ /*the span will display just on :hover state*/
124
+    display:block;
125
+    position: absolute;
126
+    top: 0; left: 8em; width: 225px;
127
+    border:1px solid #000;
128
+    background-color:#CCC; color:#000;
129
+    text-decoration: none;
130
+    text-align: left;
131
+    padding: 5px;
132
+    font-weight: normal;
133
+}
134
+.required { color: red; }
135
+</style>
136
+<link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
137
+
138
+$tpl = new TemplatePower( "../default_tpls/default.tpl" );
139
+$tpl->assignInclude( "header", "./../default_tpls/header.tpl" );
140
+$tpl->assignInclude( "footer", "./../default_tpls/footer.tpl" );
141
+$tpl->prepare( );
142
+$tpl->newBlock("header");
143
+$tpl->assign("sitename", "eFiction $version Install");
144
+$tpl->gotoBlock( "_ROOT" );
145
+$tpl->newBlock("footer");
146
+$tpl->assign( "footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
147
+$tpl->gotoBlock( "_ROOT" );
148
+
149
+switch($_GET['step']) {
150
+	case "9":
151
+		if(isset($_POST['submit'])) {
152
+			$penname = descript($_POST['newpenname']);
153
+			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154
+			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155
+			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>";
156
+			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
157
+			else $fail =  write_message(_PASSWORDTWICE);
158
+			if(!isset($fail)) {
159
+				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '".$_POST['email']."', '$encryptpassword', now( ))");
160
+				define("USERUID", dbinsertid( ));
161
+				$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
162
+				list($skin) = dbrow($skinquery);
163
+				$result2 = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('".USERUID."', '$skin', '1')");
164
+				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!");
165
+			}
166
+			else $output .= $fail;
167
+		}
168
+		else {
169
+			$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\">
170
+			<div class='row'><label for='newpenname'>"._PENNAME.":</label> <INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"$user[penname]\"></div>
171
+		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"$user[email]\" maxlength=\"200\"></div>
172
+			<div class='row'><label for='password'>"._PASSWORD.":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></div> 
173
+			<div class='row'><label for='password2'>"._PASSWORD2.":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></div>
174
+			<div style='text-align: center;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div></form>";	
175
+		}
176
+	break;
177
+
178
+	case "8":
179
+		$output .= "<div id='pagetitle'>"._AUTHORFIELDS."</div>";
180
+		if(isset($_GET['install'])) {
181
+			if($_GET['install'] == "automatic") {
182
+				$fields[] = array('4','lj','Live Journal','http://{info}.livejournal.com','','','0');
183
+				$fields[] = array('1','website','Web Site','','','','1');
184
+				$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');
185
+				$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');
186
+				$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');
187
+				$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');
188
+				$fields[] = array('4','da','Deviant Art','http://{info}.deviantart.com','','','0');
189
+				$fields[] = array('3','betareader','Beta-reader','','','','1');
190
+				$fields[] = array('4','dj','DeadJournal','http://{info}.deadjournal.com/','','','0');
191
+				$fields[] = array('4','xanga','Xanga','http://www.xanga.com/{info}','','','0');
192
+				$fields[] = array('2', 'gender', 'Gender', 'male|#|female|#|undisclosed', '', '', 0);
193
+				$fields[] = array('4','myspace','MySpace','http://www.myspace.com/{info}','','','0');
194
+		
195
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._FIELD."</th><th>"._RESULT."</th></tr>";
196
+				foreach($fields as $field) {
197
+					$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]."');");
198
+					$output .= "<tr><td>".$field[2]."</td><td align='center'>" . ($f ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
199
+				}
200
+				$output .= "</table>";
201
+				$output .= write_message(_FIELDAUTOFAIL."<br /><br /> <a href='install.php?step=9'>"._CONTINUE."</a>");
202
+			}
203
+			else {
204
+				$output .= write_message(_FIELDMANUAL."<br /><br /><a href='install.php?step=9'>"._CONTINUE."</a>");
205
+			}
206
+		}
207
+		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>");
208
+	break;
209
+	case "7":
210
+		$output .= "<div id='pagetitle'>"._MESSAGEDATA."</div>";
211
+		if(isset($_GET['install'])) {
212
+			if($_GET['install'] == "automatic") {
213
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._MESSAGE."</th><th>"._RESULT."</th></tr>";
214
+				$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}.');");
215
+				$output .= "<tr><td>Welcome</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
216
+				$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');");
217
+				$output .= "<tr><td>Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
218
+				$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>');");
219
+				$output .= "<tr><td>Help</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 (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}');");
221
+				$output .= "<tr><td>Rejection Letter</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 (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.');");
223
+				$output .= "<tr><td>Printable Copyright</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 (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>');");
225
+				$output .= "<tr><td>Submission Rules</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 (7, 'thankyou', '{sitename} Submission Acceptance', 'Thanks for your submission.');");
227
+				$output .= "<tr><td>Acceptance Letter</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 (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.');");
229
+				$output .= "<tr><td>Terms of Service</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 (9, 'maintenance', 'Site Maintenance', '<p style=\"text-align: center;\">This site is currently undergoing maintenance.  Please check back soon.  Thank you.</p>');");
231
+				$output .= "<tr><td>Site Maintenance</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
232
+				$output .= "</table>";
233
+				$output .= write_message(_MESSAGEAUTOFAILUPGRADE."<br /><br /> <a href='install.php?step=8'>"._CONTINUE."</a>");
234
+			}
235
+			else {
236
+				$output .= write_message(_MESSAGEMANUAL."<br /><br /><a href='install.php?step=8'>"._CONTINUE."</a>");
237
+			}
238
+		}
239
+		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>");
240
+
241
+	break;
242
+	case "6":
243
+		$output .= "<div id='pagetitle'>"._BLOCKDATA."</div>";
244
+		if(isset($_GET['install'])) {
245
+			if($_GET['install'] == "automatic") {
246
+				$blocklist = array(
247
+					array("categories","Categories","categories/categories.php","1",""),
248
+					array("featured","Featured Stories","featured/featured.php","1",""),
249
+					array("info","Site Info","info/info.php","2",""),
250
+					array("login","Log In","login/login.php","1",""),
251
+					array("menu","Main Menu","menu/menu.php","1",""),
252
+					array("random","Random Story","random/random.php","2",""),
253
+					array("recent","Most Recent","recent/recent.php","2","a:1:{s:3:\"num\";s:1:\"1\";}"),
254
+					array("skinchange","Skin Change","skinchange/skinchange.php","1",""),
255
+					array("news","Site News","news/news.php","1","a:1:{s:3:\"num\";s:1:\"1\";}")
256
+				);
257
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._BLOCK."</th><th>"._RESULT."</th></tr>";
258
+				foreach($blocklist as $block) {
259
+					$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])."');");
260
+					$output .= "<tr><td>".$block[1]."</td><td align='center'>" . ($b ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
261
+				}
262
+				$output .= "</table>";
263
+				$output .= write_message(_BLOCKDATAFAILUPGRADE."<br /><br /><a href='install.php?step=7'>"._CONTINUE."</a>");
264
+			}
265
+			else {
266
+				$output .= write_message(_BLOCKDATAMANUAL."<br /><br /><a href='install.php?step=6'>"._CONTINUE."</a>");
267
+			}
268
+		}
269
+		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>");
270
+	break;
271
+	case "5":
272
+		$output .= "<div id='pagetitle'>"._LINKDATA."</div>";
273
+		if(isset($_GET['install'])) {
274
+			if($_GET['install'] == "automatic") {
275
+				$pagelist = array(
276
+					array("home","Home","index.php","0","0"),
277
+					array("recent","Most Recent","browse.php?type=recent","0","0"),
278
+					array("login","Login","user.php?action=login","0","0"),
279
+					array("adminarea","Admin","admin.php","0","2"),
280
+					array("logout","Logout","user.php?action=logout","0","1"),
281
+					array("featured","Featured Stories","browse.php?type=featured","0","0"),
282
+					array("catslink","Categories","browse.php?type=categories","0","0"),
283
+					array("members","Members","authors.php?action=list","0","0"),
284
+					array("authors","Authors","authors.php?list=authors","0","0"),
285
+					array("help","Help","viewpage.php?page=help","0","0"),
286
+					array("search","Search","search.php","0","0"),
287
+					array("series","Series","browse.php?type=series","0","0"),
288
+					array("tens","Top Tens","toplists.php","0","0"),
289
+					array("challenges","Challenges","modules/challenges/challenges.php","0","0"),
290
+					array("contactus","Contact Us","contact.php","0","0"),
291
+					array("rules","Rules","viewpage.php?page=rules","0","0"),
292
+					array("tos","Terms of Service","viewpage.php?page=tos","0","0"),
293
+					array("rss","<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>","rss.php","0","0"),
294
+					array("login","Account Info","user.php","0","1"),
295
+					array("titles","Titles","browse.php?type=titles","0","0"),
296
+					array("register","Register","user.php?action=register","0","0"),
297
+					array("lostpassword","Lost Password","user.php?action=lostpassword","0","0"),
298
+					array("newsarchive","News Archive","news.php","0","0"),
299
+					array("browse","Browse","browse.php","0","0"),
300
+					array("charslink", "Characters", "browse.php?type=characters","0","0"),
301
+					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
302
+				);
303
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._PAGE."</th><th>"._RESULT."</th></tr>";
304
+				foreach($pagelist as $page) {
305
+					$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]."');");
306
+					$output .= "<tr><td>".stripslashes($page[1])."</td><td align='center'>" . ($pages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
307
+				}
308
+
309
+				$output .= "</table>";
310
+				$output .= write_message(_LINKAUTOFAIL."<br /><br /> <a href='install.php?step=6'>"._CONTINUE."</a>");
311
+			}
312
+			else {
313
+				$output .= write_message(_LINKMANUAL."<br /><br /><a href='install.php?step=5'>"._CONTINUE."</a>");
314
+			}
315
+		}
316
+		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>");
317
+	break;
318
+	case "4":
319
+		$output .= "<div id='pagetitle'>"._PANELDATA."</div>";
320
+		if(isset($_GET['install'])){
321
+			if($_GET['install'] == "automatic") {
322
+		
323
+				$panellist = array(
324
+					array("submitted","Submissions", "","3","5","0","A"),
325
+					array("versioncheck", "Version Check", "", "3", "7", "0", "A"),
326
+					array("newstory","Add New Story","stories.php?action=newstory&admin=1","3","3","0","A"),
327
+					array("addseries","Add New Series","series.php?action=add","3","3","0","A"),
328
+					array("news","News","","3","5","0","A"),
329
+					array("featured","Featured Stories","","3","5","0","A"),
330
+					array("characters","Characters","","2","2","0","A"),
331
+					array("ratings","Ratings","","2","3","0","A"),
332
+					array("members","Members","","2","5","0","A"),
333
+					array("mailusers","Mail Users","","2","6","0","A"),
334
+					array("settings","Settings","","1","2","0","A"),
335
+					array("blocks","Blocks","","1","3","0","A"),
336
+					array("censor","Censor","","1","0","1","A"),
337
+					array("admins","Admins","","1","6","0","A"),
338
+					array("classifications","Classifications","","2","4","0","A"),
339
+					array("categories","Categories","","2","1","0","A"),
340
+					array("custpages","Custom Pages","","1","4","0","A"),
341
+					array("validate","Validate Submission","","3","0","1","A"),
342
+					array("yesletter","Validation Letter","","3","0","1","A"),
343
+					array("noletter","Rejection Letter","","3","0","1","A"),
344
+					array("links","Page Links","","1","5","0","A"),
345
+					array("messages","Message Settings","","2","0","1","A"),
346
+					array("login","Login","","0","0","1","U"),
347
+					array("logout","Logout","","1","5","0","U"),
348
+					array("revreceived","Reviews Received","","1","0","1","U"),
349
+					array("editprefs","Edit Preferences","","1","2","0","U"),
350
+					array("lostpassword","Lost Password","","0","0","1","U"),
351
+					array("editbio","Edit Bio","","1","1","0","U"),
352
+					array("register","Register","","0","0","1","U"),
353
+					array("manageimages","Manage Images","","1","5","0","S"),
354
+					array("revres","Review Response","","1","0","1","U"),
355
+					array("stats","View Your Statistics","","1","3","0","U"),
356
+					array("newstory","Add New Story","stories.php?action=newstory","1","1","0","S"),
357
+					array("newseries","Add New Series","series.php?action=add","1","3","0","S"),
358
+					array("managestories","Manage Stories","stories.php?action=viewstories","1","2","0","S"),
359
+					array("manageseries","Manage Series","series.php?action=manage","1","4","0","S"),
360
+					array("reviewsby","Your Reviews","","1","0","1","U"),
361
+					array("storiesby","Stories by {author}","","0","1","0","P"),
362
+					array("seriesby","Series by {author}","","0","2","0","P"),
363
+					array("reviewsby","Reviews by {author}","","0","3","0","P"),
364
+					array("categories","Categories","","0","1","0","B"),
365
+					array("characters","Characters","","0","2","0","B"),
366
+					array("ratings","Ratings","","0","3","0","B"),
367
+					array("titles","Titles","","0","5","0","B"),
368
+					array("class","Classes","","0","0","1","B"),
369
+					array("recent","Most Recent","","0","0","1","B"),
370
+					array("featured","Featured Stories","","0","0","1","B"),
371
+					array("panels","Panels","","1","1","0","A"),
372
+					array("phpinfo","PHP Info","","1","7","0","A"),
373
+					array("contact","Contact","","0","0","1","P"),
374
+					array("series", "Series", "", "0", "4", "0", "B"),
375
+					array("viewlog", "Action Log", "", "1", "8", "0", "A"),
376
+					array("shortstories","10 Shortest Stories","toplists/default.php","0","6","0","L"), 
377
+					array("longstories","10 Longest Stories","toplists/default.php","0","5","0","L"), 
378
+					array("largeseries","10 Largest Series","toplists/default.php","0","1","0","L"), 
379
+					array("smallseries","10 Smallest Series","toplists/default.php","0","2","0","L"), 
380
+					array("reviewedseries","10 Most Reviewed Series","toplists/default.php","0","4","0","L"), 
381
+					array("prolificauthors","10 Most Prolific Authors","toplists/default.php","0","10","0","L"), 
382
+					array("prolificreviewers","10 Most Prolific Reviewers","toplists/default.php","0","12","0","L"), 
383
+					array("reviewedstories","10 Most Reviewed Stories","toplists/default.php","0","8","0","L"), 
384
+					array("readstories","10 Most Read Stories","toplists/default.php","0","9","0","L"),
385
+					array("manfavs","Manage Favorites","","1","2","0","F"),
386
+					array("favstories","10 Most Favorite Stories","toplists/default.php","0","7","0","L"), 
387
+					array("favauthors","10 Most Favorite Authors","toplists/default.php","0","11","0","L"), 
388
+					array("favseries","10 Most Favorite Series","toplists/default.php","0","3","0","L"), 
389
+					array("favst","Favorite Stories","","0","0","1","F"),
390
+					array("favse","Favorite Series","","0","0","1","F"),
391
+					array("favau","Favorite Authors","","0","0","1","F"),
392
+					array("favst","Favorite Stories","","0","0","1","U"),
393
+					array("favse","Favorite Series","","0","0","1","U"),
394
+					array("favau","Favorite Authors","","0","0","1","U"),
395
+					array("favlist","{author}\'s Favorites","viewuser.php?action=manfavs","0","5","0","F"),
396
+					array("skins", "Skins", "", "3", "6", "0", "A"),
397
+					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
398
+					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
399
+					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
400
+					array('modules', 'Modules', '', 1, "11", 0, 'A')
401
+				);
402
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>"._RESULT."</th></tr>";
403
+				foreach($panellist as $panel) {
404
+					unset($panels);
405
+					$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]."');");
406
+					$output .= "<tr><td>".stripslashes($panel[1])."</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
407
+				}
408
+				$output .= "</table>";
409
+				$output .= write_message(_PANELAUTOFAIL."<br /><br /><a href='install.php?step=5'>"._CONTINUE."</a>");
410
+			}
411
+			else {
412
+				$output .= write_message(_PANELMANUAL."<br /><br /><a href='install.php?step=5'>"._CONTINUE."</a>");
413
+			}
414
+		}
415
+		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>");
416
+	break;
417
+	case "3":
418
+		$output .= "<div id='pagetitle'>"._INSTALLTABLES."</div>";
419
+		if(isset($_GET['install'])) {
420
+			if($_GET['install'] == "automatic") {
421
+				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Table</th><th>"._RESULT."</th></tr>";
422
+				$authorfields = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorfields` (
423
+  `field_id` int(11) NOT NULL AUTO_INCREMENT,
424
+  `field_type` tinyint(4) NOT NULL default '0',
425
+  `field_name` varchar(30) NOT NULL default ' ',
426
+  `field_title` varchar(255) NOT NULL default ' ',
427
+  `field_options` text,
428
+  `field_code_in` text,
429
+  `field_code_out` text,
430
+  `field_on` tinyint(1) NOT NULL default '0',
431
+  PRIMARY KEY  (`field_id`)
432
+) ENGINE=MyISAM;");
433
+$output .= "<tr><td>".$tableprefix."fanfiction_authorfields</td><td align='center'>" . ($authorfields ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
434
+				$authorinfo = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorinfo` (
435
+  `uid` int(11) NOT NULL default '0',
436
+  `field` int(11) NOT NULL default '0',
437
+  `info` varchar(255) NOT NULL default ' ',
438
+  PRIMARY KEY  (`uid`,`field`),
439
+  KEY `uid` (`uid`)) ENGINE=MyISAM;");
440
+$output .= "<tr><td>".$tableprefix."fanfiction_authorinfo</td><td align='center'>" . ($authorinfo ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
441
+				$authorprefs = dbquery("
442
+CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorprefs` (
443
+  `uid` int(11) NOT NULL default '0',
444
+  `newreviews` tinyint(1) NOT NULL default '0',
445
+  `newrespond` tinyint(1) NOT NULL default '0',
446
+  `ageconsent` tinyint(1) NOT NULL default '0',
447
+  `alertson` tinyint(1) NOT NULL default '0',
448
+  `tinyMCE` tinyint(1) NOT NULL default '0',
449
+  `sortby` tinyint(1) NOT NULL default '0',
450
+  `storyindex` tinyint(1) NOT NULL default '0',
451
+  `validated` tinyint(1) NOT NULL default '0',
452
+  `userskin` varchar(60) NOT NULL default 'default',
453
+  `level` tinyint(1) NOT NULL default '0',
454
+  `categories` varchar(200) NOT NULL default '0',
455
+  `contact` tinyint(1) NOT NULL default '0',
456
+  `stories` int(11) NOT NULL default '0',
457
+  PRIMARY KEY  (`uid`)
458
+) ENGINE=MyISAM;");
459
+$output .= "<tr><td>".$tableprefix."fanfiction_authorprefs</td><td align='center'>" . ($authorprefs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
460
+				$authors = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authors` (
461
+  `uid` int(11) NOT NULL auto_increment,
462
+  `penname` varchar(200) NOT NULL default '',
463
+  `realname` varchar(200) NOT NULL default '',
464
+  `email` varchar(200) NOT NULL default '',
465
+  `bio` text NULL,
466
+  `image` varchar(200) NOT NULL default '',
467
+  `date` datetime NOT NULL default '0000-00-00 00:00:00',
468
+  `admincreated` char(1) NOT NULL default '0',
469
+  `password` varchar(40) NOT NULL default '0',
470
+  PRIMARY KEY  (`uid`),
471
+  KEY `penname` (`penname`),
472
+  KEY `admincreated` (`admincreated`)
473
+) ENGINE=MyISAM;");
474
+$output .= "<tr><td>".$tableprefix."fanfiction_authors</td><td align='center'>" . ($authors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
475
+				$blocks = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_blocks` (
476
+  `block_id` int(11) NOT NULL auto_increment,
477
+  `block_name` varchar(30) NOT NULL default '',
478
+  `block_title` varchar(150) NOT NULL default '',
479
+  `block_file` varchar(200) NOT NULL default '',
480
+  `block_status` tinyint(1) NOT NULL default '0',
481
+  `block_variables` text NOT NULL,
482
+  PRIMARY KEY  (`block_id`),
483
+  KEY `block_name` (`block_name`)
484
+) ENGINE=MyISAM;");
485
+$output .= "<tr><td>".$tableprefix."fanfiction_blocks</td><td align='center'>" . ($blocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
486
+				$categories = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_categories` (
487
+  `catid` int(11) NOT NULL auto_increment,
488
+  `parentcatid` int(11) NOT NULL default '-1',
489
+  `category` varchar(60) NOT NULL default '',
490
+  `description` text NOT NULL,
491
+  `image` varchar(100) NOT NULL default '',
492
+  `locked` char(1) NOT NULL default '0',
493
+  `leveldown` tinyint(4) NOT NULL default '0',
494
+  `displayorder` int(11) NOT NULL default '0',
495
+  `numitems` int(11) NOT NULL default '0',
496
+  PRIMARY KEY  (`catid`),
497
+  KEY `byparent` (`parentcatid`,`displayorder`)
498
+) ENGINE=MyISAM;");
499
+$output .= "<tr><td>".$tableprefix."fanfiction_categories</td><td align='center'>" . ($categories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
500
+				$chapters = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_chapters` (
501
+  `chapid` int(11) NOT NULL auto_increment,
502
+  `title` varchar(250) NOT NULL default '',
503
+  `inorder` int(11) NOT NULL default '0',
504
+  `notes` text NULL,
505
+  `storytext` text NULL,
506
+  `endnotes` text NULL,
507
+  `validated` char(1) NOT NULL default '0',
508
+  `wordcount` int(11) NOT NULL default '0',
509
+  `rating` tinyint(4) NOT NULL default '0',
510
+  `reviews` smallint(6) NOT NULL default '0',
511
+  `sid` int(11) NOT NULL default '0',
512
+  `uid` int(11) NOT NULL default '0',
513
+  `count` int(11) NOT NULL default '0',
514
+  PRIMARY KEY  (`chapid`),
515
+  KEY `sid` (`sid`),
516
+  KEY `uid` (`uid`),
517
+  KEY `inorder` (`inorder`),
518
+  KEY `title` (`title`),
519
+  KEY `validated` (`validated`),
520
+  KEY `forstoryblock` (`sid`,`validated`)
521
+) ENGINE=MyISAM;");
522
+$output .= "<tr><td>".$tableprefix."fanfiction_chapters</td><td align='center'>" . ($chapters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
523
+				$characters = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_characters` (
524
+  `charid` int(11) NOT NULL auto_increment,
525
+  `catid` int(11) NOT NULL default '0',
526
+  `charname` varchar(60) NOT NULL default '',
527
+  `bio` text NOT NULL,
528
+  `image` varchar(200) NOT NULL default '',
529
+  PRIMARY KEY  (`charid`),
530
+  KEY `catid` (`catid`),
531
+  KEY `charname` (`charname`)
532
+) ENGINE=MyISAM;");
533
+$output .= "<tr><td>".$tableprefix."fanfiction_characters</td><td align='center'>" . ($characters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
534
+				$classes = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_classes` (
535
+  `class_id` int(11) NOT NULL auto_increment,
536
+  `class_type` int(11) NOT NULL default '0',
537
+  `class_name` varchar(100) NOT NULL default '',
538
+  PRIMARY KEY  (`class_id`),
539
+  KEY `byname` (`class_type`,`class_name`,`class_id`)
540
+) ENGINE=MyISAM;");
541
+$output .= "<tr><td>".$tableprefix."fanfiction_classes</td><td align='center'>" . ($classes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
542
+				$classtypes = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_classtypes` (
543
+  `classtype_id` int(11) NOT NULL auto_increment,
544
+  `classtype_name` varchar(50) NOT NULL default '',
545
+  `classtype_title` varchar(50) NOT NULL default '',
546
+  PRIMARY KEY  (`classtype_id`),
547
+  UNIQUE KEY `classtype_name` (`classtype_name`)
548
+) ENGINE=MyISAM;");
549
+$output .= "<tr><td>".$tableprefix."fanfiction_classtypes</td><td align='center'>" . ($classtypes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
550
+$coauthors = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_coauthors` (
551
+  `sid` int(11) NOT NULL default '0',
552
+  `uid` int(11) NOT NULL default '0',
553
+  PRIMARY KEY  (`sid`,`uid`)
554
+) ENGINE=MyISAM;");
555
+$output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>" . ($coauthors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
556
+				$codeblocks = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_codeblocks` (
557
+  `code_id` int(11) NOT NULL auto_increment,
558
+  `code_text` text NOT NULL,
559
+  `code_type` varchar(20) default NULL,
560
+  `code_module` varchar(60) default NULL,
561
+  PRIMARY KEY  (`code_id`),
562
+  KEY `code_type` (`code_type`)
563
+) ENGINE=MyISAM;");
564
+$output .= "<tr><td>".$tableprefix."fanfiction_codeblocks</td><td align='center'>" . ($codeblocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
565
+				$comments = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_comments` (
566
+  `cid` int(11) NOT NULL auto_increment,
567
+  `nid` int(11) NOT NULL default '0',
568
+  `uid` int(11) NOT NULL default '0',
569
+  `comment` text NOT NULL,
570
+  `time` datetime NOT NULL default '0000-00-00 00:00:00',
571
+  PRIMARY KEY  (`cid`),
572
+  KEY `commentlist` (`nid`,`time`)
573
+) ENGINE=MyISAM;");
574
+$output .= "<tr><td>".$tableprefix."fanfiction_comments</td><td align='center'>" . ($comments ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
575
+				$favorites = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_favorites` (
576
+  `uid` int(11) NOT NULL default '0',
577
+  `item` int(11) NOT NULL default '0',
578
+  `type` char(2) NOT NULL default '',
579
+  `comments` text NOT NULL,
580
+  UNIQUE KEY `byitem` (`item`,`type`,`uid`),
581
+  UNIQUE KEY `byuid` (`uid`,`type`,`item`)
582
+) ENGINE=MyISAM;");
583
+$output .= "<tr><td>".$tableprefix."fanfiction_favorites</td><td align='center'>" . ($favorites ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
584
+				$inseries = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_inseries` (
585
+  `seriesid` int(11) NOT NULL default '0',
586
+  `sid` int(11) NOT NULL default '0',
587
+  `subseriesid` int(11) NOT NULL default '0',
588
+  `confirmed` int(11) NOT NULL default '0',
589
+  `inorder` int(11) NOT NULL default '0',
590
+  PRIMARY KEY  (`sid`,`seriesid`, `subseriesid`),
591
+  KEY `seriesid` (`seriesid`,`inorder`)
592
+) ENGINE=MyISAM;");
593
+$output .= "<tr><td>".$tableprefix."fanfiction_inseries</td><td align='center'>" . ($inseries ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
594
+				$logs = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_log` (
595
+  `log_id` int(11) NOT NULL auto_increment,
596
+  `log_action` varchar(255) default NULL,
597
+  `log_uid` int(11) NOT NULL,
598
+  `log_ip` int(11) UNSIGNED default NULL,
599
+  `log_timestamp` timestamp NOT NULL,
600
+  `log_type` varchar(2) NOT NULL,
601
+  PRIMARY KEY  (`log_id`)
602
+) ENGINE=MyISAM");
603
+$output .= "<tr><td>".$tableprefix."fanfiction_log</td><td align='center'>" . ($logs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
604
+				$messages = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_messages` (
605
+  `message_id` int(11) NOT NULL auto_increment,
606
+  `message_name` varchar(50) NOT NULL default '',
607
+  `message_title` varchar(200) NOT NULL default '',
608
+  `message_text` text NOT NULL,
609
+  PRIMARY KEY  (`message_id`),
610
+  KEY `message_name` (`message_name`)
611
+) ENGINE=MyISAM;");
612
+$output .= "<tr><td>".$tableprefix."fanfiction_messages</td><td align='center'>" . ($messages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
613
+				$modules = dbquery("
614
+CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_modules` (
615
+  `id` int(11) NOT NULL auto_increment,
616
+  `name` varchar(100) NOT NULL default 'Test Module',
617
+  `version` varchar(10) NOT NULL default '1.0',
618
+  PRIMARY KEY  (`id`),
619
+  KEY `name_version` (`name`,`version`)
620
+)");
621
+$output .= "<tr><td>".$tableprefix."fanfiction_modules</td><td align='center'>" . ($modules ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
622
+				$news = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_news` (
623
+  `nid` int(11) NOT NULL auto_increment,
624
+  `author` varchar(60) NOT NULL default '',
625
+  `title` varchar(255) NOT NULL default '',
626
+  `story` text NOT NULL,
627
+  `time` datetime default NULL,
628
+  `comments` INT NOT NULL DEFAULT '0',
629
+  PRIMARY KEY  (`nid`)
630
+) ENGINE=MyISAM;");
631
+$output .= "<tr><td>".$tableprefix."fanfiction_news</td><td align='center'>" . ($news ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
632
+				$pagelinks = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_pagelinks` (
633
+  `link_id` int(11) NOT NULL auto_increment,
634
+  `link_name` varchar(50) NOT NULL default '',
635
+  `link_text` varchar(100) NOT NULL default '',
636
+  `link_key` CHAR( 1 ) NULL,
637
+  `link_url` varchar(250) NOT NULL default '',
638
+  `link_target` char(1) NOT NULL default '0',
639
+  `link_access` tinyint(4) NOT NULL default '0',
640
+  PRIMARY KEY  (`link_id`),
641
+  KEY `link_name` (`link_name`)
642
+) ENGINE=MyISAM;");
643
+$output .= "<tr><td>".$tableprefix."fanfiction_pagelinks</td><td align='center'>" . ($pagelinks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
644
+				$panels = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_panels` (
645
+  `panel_id` int(11) NOT NULL auto_increment,
646
+  `panel_name` varchar(50) NOT NULL default 'unknown',
647
+  `panel_title` varchar(100) NOT NULL default 'Unnamed Panel',
648
+  `panel_url` varchar(100) default NULL,
649
+  `panel_level` tinyint(4) NOT NULL default '3',
650
+  `panel_order` tinyint(4) NOT NULL default '0',
651
+  `panel_hidden` tinyint(1) NOT NULL default '0',
652
+  `panel_type` varchar(20) NOT NULL default 'A',
653
+  PRIMARY KEY  (`panel_id`),
654
+  KEY `panel_type` (`panel_type`,`panel_name`)
655
+) ENGINE=MyISAM;");
656
+$output .= "<tr><td>".$tableprefix."fanfiction_panels</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
657
+				$ratings = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_ratings` (
658
+  `rid` int(11) NOT NULL auto_increment,
659
+  `rating` varchar(60) NOT NULL default '',
660
+  `ratingwarning` char(1) NOT NULL default '0',
661
+  `warningtext` text NOT NULL,
662
+  PRIMARY KEY  (`rid`),
663
+  KEY `rating` (`rating`)
664
+) ENGINE=MyISAM;");
665
+$output .= "<tr><td>".$tableprefix."fanfiction_ratings</td><td align='center'>" . ($ratings ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
666
+				$reviews = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_reviews` (
667
+  `reviewid` int(11) NOT NULL auto_increment,
668
+  `item` int(11) NOT NULL default '0',
669
+  `chapid` int(11) NOT NULL default '0',
670
+  `reviewer` varchar(60) NOT NULL default '0',
671
+  `uid` int(11) NOT NULL default '0',
672
+  `review` text NOT NULL,
673
+  `date` datetime NOT NULL default '0000-00-00 00:00:00',
674
+  `rating` int(11) NOT NULL default '0',
675
+  `respond` char(1) NOT NULL default '0',
676
+  `type` char(2) NOT NULL default '',
677
+  PRIMARY KEY  (`reviewid`),
678
+  KEY `chapid` (`chapid`),
679
+  KEY `rating` (`rating`),
680
+  KEY `respond` (`respond`),
681
+  KEY `avgrating` (`type`,`item`,`rating`),
682
+  KEY `bychapter` (`chapid`,`rating`),
683
+  KEY `byuid` (`uid`,`item`,`type`)
684
+) ENGINE=MyISAM;");
685
+$output .= "<tr><td>".$tableprefix."fanfiction_reviews</td><td align='center'>" . ($reviews ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
686
+				$series = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_series` (
687
+  `seriesid` int(11) NOT NULL auto_increment,
688
+  `title` varchar(200) NOT NULL default '',
689
+  `summary` text NOT NULL,
690
+  `uid` int(11) NOT NULL default '0',
691
+  `isopen` tinyint(4) NOT NULL default '0',
692
+  `catid` varchar(200) NOT NULL default '0',
693
+  `rating` tinyint(4) NOT NULL default '0',
694
+  `classes` varchar(200) NOT NULL default '',
695
+  `characters` varchar(250) NOT NULL default '',
696
+  `reviews` smallint(6) NOT NULL default '0',
697
+  `numstories` INT NOT NULL DEFAULT '0',
698
+  `challenges` varchar(200) NOT NULL default '',
699
+  PRIMARY KEY  (`seriesid`),
700
+  KEY `catid` (`catid`),
701
+  KEY `characters` (`characters`),
702
+  KEY `classes` (`classes`),
703
+  KEY `owner` (`uid`,`title`)
704
+) ENGINE=MyISAM;");
705
+$output .= "<tr><td>".$tableprefix."fanfiction_series</td><td align='center'>" . ($series ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
706
+	$stats = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_stats` (
707
+  `sitekey` varchar(50) NOT NULL default '0',
708
+  `stories` int(11) NOT NULL default '0',
709
+  `chapters` int(11) NOT NULL default '0',
710
+  `series` int(11) NOT NULL default '0',
711
+  `reviews` int(11) NOT NULL default '0',
712
+  `wordcount` int(11) NOT NULL default '0',
713
+  `authors` int(11) NOT NULL default '0',
714
+  `members` int(11) NOT NULL default '0',
715
+  `reviewers` int(11) NOT NULL default '0',
716
+  `newestmember` int(11) NOT NULL default '0'
717
+) ENGINE=MyISAM");
718
+	dbquery("INSERT INTO ".$tableprefix."fanfiction_stats(`sitekey`, `newestmember`) VALUES('".SITEKEY."', '1')");
719
+$output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" . ($stats ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
720
+				$stories = dbquery("CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_stories` (
721
+  `sid` int(11) NOT NULL auto_increment,
722
+  `title` varchar(200) NOT NULL default 'Untitled',
723
+  `summary` text NULL,
724
+  `storynotes` text NULL,
725
+  `catid` varchar(100) NOT NULL default '0',
726
+  `classes` varchar(200) NOT NULL default '0',
727
+  `charid` varchar(250) NOT NULL default '0',
728
+  `rid` varchar(25) NOT NULL default '0',
729
+  `date` datetime default NULL,
730
+  `updated` datetime NOT NULL default '0000-00-00 00:00:00',
731
+  `uid` int(11) NOT NULL default '0',
732
+  `coauthors` varchar(50) NOT NULL default '0',
733
+  `featured` char(1) NOT NULL default '0',
734
+  `validated` char(1) NOT NULL default '0',
735
+  `completed` char(1) NOT NULL default '0',
736
+  `rr` char(1) NOT NULL default '0',
737
+  `wordcount` int(11) NOT NULL default '0',
738
+  `rating` tinyint(4) NOT NULL default '0',
739
+  `reviews` smallint(6) NOT NULL default '0',
740
+  `count` int(11) NOT NULL default '0',
741
+  PRIMARY KEY  (`sid`),
742
+  KEY `title` (`title`),
743
+  KEY `catid` (`catid`),
744
+  KEY `charid` (`charid`),
745
+  KEY `rid` (`rid`),
746
+  KEY `uid` (`uid`),
747
+  KEY `featured` (`featured`),
748
+  KEY `completed` (`completed`),
749
+  KEY `rr` (`rr`),
750
+  KEY `validateduid` (`validated`,`uid`),
751
+  KEY `recent` (`updated`,`validated`)
752
+) ENGINE=MyISAM;");
753
+$output .= "<tr><td>".$tableprefix."fanfiction_stories</td><td align='center'>" . ($stories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
754
+$output .= "</table>";
755
+$output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>"._CONTINUE."</a>");
756
+
757
+			}
758
+			else if($_GET['install'] == "manual") {
759
+				$output .= write_message(_TABLESMANUAL."<br /><br /><a href='install.php?step=3'>"._CONTINUE."</a>");
760
+			}
761
+
762
+		}
763
+		else {
764
+	
765
+			$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>");
766
+		}
767
+
768
+	break;
769
+
770
+	case "2";
771
+		include("../config.php");
772
+		if(dbnumrows(dbquery("SHOW TABLES LIKE '".$settingsprefix."fanfiction_settings'"))) {
773
+			include("../config.php");
774
+			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
775
+			$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
776
+			list($tableprefix, $language) = dbrow($settings);
777
+			define("TABLEPREFIX", $tableprefix);
778
+			define("SITEKEY", $sitekey);
779
+			
780
+			$sect = isset($_GET['sect']) ? $_GET['sect'] : "main";
781
+			$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
782
+			if(dbnumrows($settingsresults) == 0) {
783
+				dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings (`sitekey`) VALUES('".SITEKEY."');");
784
+				$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
785
+			}
786
+			$settings = dbassoc($settingsresults);
787
+			define("_BASEDIR", "../");
788
+			foreach($settings as $var => $val) {
789
+				$$var = $val;
790
+			}
791
+			if($sect == "submissions") {
792
+				if(isset($_POST['submit'])) {
793
+					$storiespath = descript($_POST['newstoriespath']);
794
+					if(!file_exists($storiespath) && !file_exists("../".$storiespath)) {
795
+						if(!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
796
+						mkdir("$storiespath", 0755);
797
+						@chmod("$storiespath", 0777);
798
+						if(substr(sprintf('%o', @fileperms("../".$storiespath)), -4) != "0777") $output .= write_message(_STORIESPATHNOTWRITABLE);
799
+					}
800
+				}
801
+			}
802
+			if($sect == "email" && isset($_POST['submit'])) {
803
+				$output .= "<div id=\"pagetitle\">"._SETTINGS."</div>";
804
+				$smtp_host = $_POST['newsmtp_host'];
805
+				$smtp_username = $_POST['newsmtp_username'];
806
+				$smtp_password = $_POST['newsmtp_password'];
807
+				$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '".SITEKEY."'");
808
+				if($result) {
809
+					$output .= write_message(_ACTIONSUCCESSFUL);
810
+					$output .= write_message("<a href='install.php?step=3'>"._CONTINUE."</a>");
811
+				}
812
+				else include("../admin/settings.php");
813
+			}
814
+			else include("../admin/settings.php");
815
+		}
816
+		else {
817
+			if($_GET['install']) {
818
+				if($_GET['install'] == "automatic") {
819
+			
820
+								$settings = dbquery("CREATE TABLE IF NOT EXISTS `".$settingsprefix."fanfiction_settings` (
821
+  `sitekey` varchar(50) NOT NULL default '1',
822
+  `sitename` varchar(200) NOT NULL default 'Your Site',
823
+  `slogan` varchar(200) NOT NULL default 'It''s a cool site!',
824
+  `url` varchar(200) NOT NULL default 'http://www.yoursite.com',
825
+  `siteemail` varchar(200) NOT NULL default 'you@yoursite.com',
826
+  `tableprefix` varchar(50) NOT NULL default '',
827
+  `skin` varchar(50) NOT NULL default 'default',
828
+  `hiddenskins` varchar(255) default '',
829
+  `language` varchar(10) NOT NULL default 'en',
830
+  `submissionsoff` tinyint(1) NOT NULL default '0',
831
+  `storiespath` varchar(20) NOT NULL default 'stories',
832
+  `store` varchar(5) NOT NULL default 'files',
833
+  `autovalidate` tinyint(1) NOT NULL default '0',
834
+  `coauthallowed` int(1) NOT NULL default '0',
835
+  `maxwords` int(11) NOT NULL default '0',
836
+  `minwords` int(11) NOT NULL default '0',
837
+  `imageupload` tinyint(1) NOT NULL default '0',
838
+  `imageheight` int(11) NOT NULL default '200',
839
+  `imagewidth` int(11) NOT NULL default '200',
840
+  `roundrobins` tinyint(1) NOT NULL default '0',
841
+  `allowseries` tinyint(4) NOT NULL default '2',
842
+  `tinyMCE` tinyint(1) NOT NULL default '0',
843
+  `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
844
+  `favorites` tinyint(1) NOT NULL default '0',
845
+  `multiplecats` tinyint(1) NOT NULL default '0',
846
+  `newscomments` tinyint(1) NOT NULL default '0',
847
+  `logging` tinyint(1) NOT NULL default '0',
848
+  `maintenance` tinyint(1) NOT NULL default '0',
849
+  `debug` tinyint(1) NOT NULL default '0',
850
+  `captcha` tinyint(1) NOT NULL default '0',
851
+  `dateformat` varchar(20) NOT NULL default 'd/m/y',
852
+  `timeformat` varchar(20) NOT NULL default '- h:i a',
853
+  `recentdays` tinyint(2) NOT NULL default '7',
854
+  `displaycolumns` tinyint(1) NOT NULL default '1',
855
+  `itemsperpage` tinyint(2) NOT NULL default '25',
856
+  `extendcats` tinyint(1) NOT NULL default '0',
857
+  `displayindex` tinyint(1) NOT NULL default '0',
858
+  `defaultsort` tinyint(1) NOT NULL default '0',
859
+  `displayprofile` tinyint(1) NOT NULL default '0',
860
+  `linkstyle` tinyint(1) NOT NULL default '0',
861
+  `linkrange` tinyint(2) NOT NULL default '5',
862
+  `reviewsallowed` tinyint(1) NOT NULL default '0',
863
+  `ratings` tinyint(1) NOT NULL default '0',
864
+  `anonreviews` tinyint(1) NOT NULL default '0',
865
+  `revdelete` tinyint(1) NOT NULL default '0',
866
+  `rateonly` tinyint(1) NOT NULL default '0',
867
+  `pwdsetting` tinyint(1) NOT NULL default '0',
868
+  `alertson` tinyint(1) NOT NULL default '0',
869
+  `disablepopups` tinyint(1) NOT NULL default '0',
870
+  `agestatement` tinyint(1) NOT NULL default '0',
871
+  `words` text,
872
+  `version` varchar(10) NOT NULL default '".$version."',
873
+  `smtp_host` varchar(200) default NULL,
874
+  `smtp_username` varchar(50) default NULL,
875
+  `smtp_password` varchar(50) default NULL,
876
+  PRIMARY KEY  (`sitekey`)
877
+) ENGINE=MyISAM;");
878
+if($settings) $output .= write_message("<img src=\"../images/check.gif\"> "._SETTINGSTABLESUCCESS." <br /><a href='install.php?step=2'>"._CONTINUE."</a>");
879
+else $output .= write_message(_SETTINGSTABLEAUTOFAIL."<br /><br /> <a href='install.php?step=2'>"._CONTINUE."</a>");
880
+				}
881
+				else {
882
+					$output .= write_message(_SETTINGSTABLEMANUAL."<br /><br /><a href='install.php?step=2'>"._CONTINUE."</a>");
883
+				}
884
+			}
885
+			else {
886
+		
887
+				$test = dbquery("SHOW TABLES");
888
+				if(!$test) $output .= write_message(_CONFIGFAILED);
889
+				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>");
890
+			}
891
+		}
892
+	break;
893
+	default:
894
+		$output .= "<div id='pagetitle'>"._CONFIGDATA."</div>";
895
+		if(isset($_POST['submit'])) {
896
+			$dbhost = descript($_POST['dbhost']);
897
+			$dbname = descript($_POST['dbname']);
898
+			$dbuser = descript($_POST['dbuser']);
899
+			$dbpass = descript($_POST['dbpass']);
900
+			$language = $_POST['language'];
901
+			$sitekey = descript($_POST['sitekey']);
902
+			$settingsprefix = descript($_POST['settingsprefix']);
903
+			$mysql_access = mysqli_connect($dbhost, $dbuser, $dbpass);
904
+			if(!$mysql_access) {
905
+				$output .= write_message(_CONFIGFAILED);
906
+			}
907
+		}
908
+		if(isset($_POST['submit']) && $mysql_access) {
909
+			$handle = fopen("../config.php", 'w');
910
+			if(!$handle) {
911
+				@chmod("../config.php", 0666);
912
+				$handle = fopen("../config.php", 'w');
913
+			}
914
+			if($handle) {
915
+				$dbhost = descript($_POST['dbhost']);
916
+				$dbname = descript($_POST['dbname']);
917
+				$dbuser = descript($_POST['dbuser']);
918
+				$dbpass = descript($_POST['dbpass']);
919
+				$sitekey = descript($_POST['sitekey']);
920
+				if(empty($sitekey)) $sitekey = random_string($randomcharset, 10);
921
+				$language = $_POST['language'];
922
+				$settingsprefix = descript($_POST['settingsprefix']);
923
+				$text = "<?php 
924
+\$dbhost = \"$dbhost\";
925
+\$dbname = \"$dbname\";
926
+\$dbuser= \"$dbuser\";
927
+\$dbpass = \"$dbpass\";
928
+\$sitekey = \"$sitekey\";
929
+\$settingsprefix = \"$settingsprefix\";
930
+
931
+include_once(\"includes/dbfunctions.php\");
932
+if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbname);
933
+
934
+?>";
935
+				fwrite($handle, $text);
936
+				fclose($handle);
937
+				@chmod("../config.php", 0644);
938
+				$output .= write_message(_CONFIGSUCCESS."<br /><br /><a href='install.php?step=2&amp;language=$language'>"._CONTINUE."</a>");
939
+			}
940
+			else $output .= write_message(_ERROR_CONFIGWRITE);
941
+
942
+		}
943
+		else { 
944
+			if(file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
945
+			if(isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
946
+			else if(isset($sitename)) $output .= write_message(_CONFIG1DETECTED);
947
+			else {
948
+				$output .=  
949
+					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
950
+						<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>
951
+						<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>
952
+						<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>
953
+						<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>
954
+						<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>
955
+						<div><label for=\"language\">"._LANGUAGE.":</label> <select name=\"language\">";
956
+				$directory = opendir("../languages");
957
+				while($filename = readdir($directory)) {
958
+					if($filename=="." || $filename==".." || substr($filename, 2) == "_admin.php") continue;
959
+					$output .= "<option value=\"".substr($filename, 0, 2)."\"".
960
+						($language == substr($filename, 0, strpos($filename, ".php")) ? " selected" : "").">
961
+					".substr($filename, 0, strpos($filename, ".php"))."</option>";
962
+				}
963
+				closedir($directory);
964
+				$output .= 
965
+					"</select> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_LANGUAGE."</span></A></div>
966
+						<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 />
967
+						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
968
+					</form>";
969
+			}
970
+		}	
971
+}
972
+$tpl->assign("output", $output);
973
+
974
+$tpl->printToScreen();
975
+if(isset($_GET['step']) && $_GET['step'] > 2) dbclose( );
976
+?>
0 977
\ No newline at end of file