Browse code

just formatting fix

Jimmi08 authored on 2023/03/07 13:59:25
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,34 +41,38 @@ $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 67
 $language = "";
64 68
 
65
-include ("../includes/class.TemplatePower.inc.php");
69
+include("../includes/class.TemplatePower.inc.php");
66 70
 
67 71
 /* PHP 8 fix - other way is separated LANs to smaller files */
68 72
 $allowed_tags = '';
69 73
 $recentdays = 7;
70 74
 $sitename = "";  // this breaks stuff in PHP 8.2 
71
-$url = "" ;
75
+$url = "";
72 76
 $multiplecats = '';
73 77
 $minwords = '';
74 78
 $maxwords = '';
... ...
@@ -82,36 +86,39 @@ $user['penname'] = '';
82 86
 $user['email'] = '';
83 87
 $penname = '';
84 88
 
85
-if(!isset($_GET['step']) || $_GET['step'] == 2) {
86
-	include ("../languages/en.php");
87
-	include ("../languages/en_admin.php");
88
-	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");
89 94
 }
90
-else if(isset($_REQUEST['language'])) {
95
+else if (isset($_REQUEST['language']))
96
+{
91 97
 	$language = $_REQUEST['language'];
92
-	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
93
-	else include ("../languages/en.php");
94
-	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
95
-	else include ("../languages/en_admin.php");
96
-	if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
97
-	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");
98 104
 }
99
-else {
100
-include("../config.php");
101
-$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
102
-$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
103
-list($tableprefix, $language) = dbrow($settings);
104
-
105
-define("TABLEPREFIX", $tableprefix);
106
-define("SITEKEY", $sitekey);
107
-if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
108
-else include ("../languages/en.php");
109
-if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
110
-else include ("../languages/en_admin.php");
111
-if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
112
-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");
113 120
 }
114
-include(_BASEDIR."includes/corefunctions.php");
121
+include(_BASEDIR . "includes/corefunctions.php");
115 122
 
116 123
 //  So I don't have to keep updating the version number in 3 different files.
117 124
 include("../version.php");
... ...
@@ -155,294 +162,319 @@ a.pophelp:hover span{ /*the span will display just on :hover state*/
155 162
 </style>
156 163
 <link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
157 164
 
158
-$tpl = new TemplatePower( "../default_tpls/default.tpl" );
159
-$tpl->assignInclude( "header", "./../default_tpls/header.tpl" );
160
-$tpl->assignInclude( "footer", "./../default_tpls/footer.tpl" );
161
-$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();
162 169
 $tpl->newBlock("header");
163 170
 $tpl->assign("sitename", "eFiction $version Install");
164
-$tpl->gotoBlock( "_ROOT" );
171
+$tpl->gotoBlock("_ROOT");
165 172
 $tpl->newBlock("footer");
166
-$tpl->assign( "footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
167
-$tpl->gotoBlock( "_ROOT" );
173
+$tpl->assign("footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
174
+$tpl->gotoBlock("_ROOT");
168 175
 
169
-if(!isset($_GET['step']))  $_GET['step'] = 0;
170
-switch($_GET['step']) {
176
+if (!isset($_GET['step']))  $_GET['step'] = 0;
177
+switch ($_GET['step'])
178
+{
171 179
 	case "9":
172
-		if(isset($_POST['submit'])) {
180
+		if (isset($_POST['submit']))
181
+		{
173 182
 			$penname = descript($_POST['newpenname']);
174
-			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
175
-			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
176
-			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>";
177
-			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']);
178 187
 			else $fail =  write_message(_PASSWORDTWICE);
179
-			if(!isset($fail)) {
180
-				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '".$_POST['email']."', '$encryptpassword', now( ))");
181
-				define("USERUID", dbinsertid( ));
182
-				$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', now( ))");
191
+				define("USERUID", dbinsertid());
192
+				$skinquery = dbquery("SELECT skin FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . SITEKEY . "'");
183 193
 				list($skin) = dbrow($skinquery);
184
-				$result2 = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('".USERUID."', '$skin', '1')");
185
-				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!");
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!");
186 196
 			}
187 197
 			else $output .= $fail;
188 198
 		}
189
-		else {
190
-			$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\">
191
-			<div class='row'><label for='newpenname'>"._PENNAME.":</label> 
192
-			<input name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"".$user['penname']."\"></div>
193
-		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$user['email'].
194
-			"\" maxlength=\"200\"></div>
195
-			<div class='row'><label for='password'>"._PASSWORD.":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></div> 
196
-			<div class='row'><label for='password2'>"._PASSWORD2.":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></div>
197
-			<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>";
198 209
 		}
199
-	break;
210
+		break;
200 211
 
201 212
 	case "8":
202
-		$output .= "<div id='pagetitle'>"._AUTHORFIELDS."</div>";
203
-		if(isset($_GET['install'])) {
204
-			if($_GET['install'] == "automatic") {
205
-				$fields[] = array('4','lj','Live Journal','http://{info}.livejournal.com','','','0');
206
-				$fields[] = array('1','website','Web Site','','','','1');
207
-				$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');
208
-				$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');
209
-				$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');
210
-				$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');
211
-				$fields[] = array('4','da','Deviant Art','http://{info}.deviantart.com','','','0');
212
-				$fields[] = array('3','betareader','Beta-reader','','','','1');
213
-				$fields[] = array('4','dj','DeadJournal','http://{info}.deadjournal.com/','','','0');
214
-				$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');
215 228
 				$fields[] = array('2', 'gender', 'Gender', 'male|#|female|#|undisclosed', '', '', 0);
216
-				$fields[] = array('4','myspace','MySpace','http://www.myspace.com/{info}','','','0');
217
-		
218
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._FIELD."</th><th>"._RESULT."</th></tr>";
219
-				foreach($fields as $field) {
220
-					$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]."');");
221
-					$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>";
222 236
 				}
223 237
 				$output .= "</table>";
224
-				$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>");
225 239
 			}
226
-			else {
227
-				$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>");
228 243
 			}
229 244
 		}
230
-		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>");
231
-	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;
232 247
 	case "7":
233
-		$output .= "<div id='pagetitle'>"._MESSAGEDATA."</div>";
234
-		if(isset($_GET['install'])) {
235
-			if($_GET['install'] == "automatic") {
236
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._MESSAGE."</th><th>"._RESULT."</th></tr>";
237
-				$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}.');");
238
-				$output .= "<tr><td>Welcome</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
239
-				$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');");
240
-				$output .= "<tr><td>Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
241
-				$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>');");
242
-				$output .= "<tr><td>Help</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
243
-				$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}');");
244
-				$output .= "<tr><td>Rejection Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
245
-				$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.');");
246
-				$output .= "<tr><td>Printable Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
247
-				$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>');");
248
-				$output .= "<tr><td>Submission Rules</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
249
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` VALUES (7, 'thankyou', '{sitename} Submission Acceptance', 'Thanks for your submission.');");
250
-				$output .= "<tr><td>Acceptance Letter</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
251
-				$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.');");
252
-				$output .= "<tr><td>Terms of Service</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
253
-				$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>');");
254
-				$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>";
255 272
 				$output .= "</table>";
256
-				$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>");
257 274
 			}
258
-			else {
259
-				$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>");
260 278
 			}
261 279
 		}
262
-		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>");
263 281
 
264
-	break;
282
+		break;
265 283
 	case "6":
266
-		$output .= "<div id='pagetitle'>"._BLOCKDATA."</div>";
267
-		if(isset($_GET['install'])) {
268
-			if($_GET['install'] == "automatic") {
284
+		$output .= "<div id='pagetitle'>" . _BLOCKDATA . "</div>";
285
+		if (isset($_GET['install']))
286
+		{
287
+			if ($_GET['install'] == "automatic")
288
+			{
269 289
 				$blocklist = array(
270
-					array("categories","Categories","categories/categories.php","1",""),
271
-					array("featured","Featured Stories","featured/featured.php","1",""),
272
-					array("info","Site Info","info/info.php","2",""),
273
-					array("login","Log In","login/login.php","1",""),
274
-					array("menu","Main Menu","menu/menu.php","1",""),
275
-					array("random","Random Story","random/random.php","2",""),
276
-					array("recent","Most Recent","recent/recent.php","2","a:1:{s:3:\"num\";s:1:\"1\";}"),
277
-					array("skinchange","Skin Change","skinchange/skinchange.php","1",""),
278
-					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\";}")
279 299
 				);
280
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._BLOCK."</th><th>"._RESULT."</th></tr>";
281
-				foreach($blocklist as $block) {
282
-					$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])."');");
283
-					$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>";
284 305
 				}
285 306
 				$output .= "</table>";
286
-				$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>");
287 308
 			}
288
-			else {
289
-				$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>");
290 312
 			}
291 313
 		}
292
-		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>");
293
-	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;
294 316
 	case "5":
295
-		$output .= "<div id='pagetitle'>"._LINKDATA."</div>";
296
-		if(isset($_GET['install'])) {
297
-			if($_GET['install'] == "automatic") {
317
+		$output .= "<div id='pagetitle'>" . _LINKDATA . "</div>";
318
+		if (isset($_GET['install']))
319
+		{
320
+			if ($_GET['install'] == "automatic")
321
+			{
298 322
 				$pagelist = array(
299
-					array("home","Home","index.php","0","0"),
300
-					array("recent","Most Recent","browse.php?type=recent","0","0"),
301
-					array("login","Login","user.php?action=login","0","0"),
302
-					array("adminarea","Admin","admin.php","0","2"),
303
-					array("logout","Logout","user.php?action=logout","0","1"),
304
-					array("featured","Featured Stories","browse.php?type=featured","0","0"),
305
-					array("catslink","Categories","browse.php?type=categories","0","0"),
306
-					array("members","Members","authors.php?action=list","0","0"),
307
-					array("authors","Authors","authors.php?list=authors","0","0"),
308
-					array("help","Help","viewpage.php?page=help","0","0"),
309
-					array("search","Search","search.php","0","0"),
310
-					array("series","Series","browse.php?type=series","0","0"),
311
-					array("tens","Top Tens","toplists.php","0","0"),
312
-					array("challenges","Challenges","modules/challenges/challenges.php","0","0"),
313
-					array("contactus","Contact Us","contact.php","0","0"),
314
-					array("rules","Rules","viewpage.php?page=rules","0","0"),
315
-					array("tos","Terms of Service","viewpage.php?page=tos","0","0"),
316
-					array("rss","<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>","rss.php","0","0"),
317
-					array("login","Account Info","user.php","0","1"),
318
-					array("titles","Titles","browse.php?type=titles","0","0"),
319
-					array("register","Register","user.php?action=register","0","0"),
320
-					array("lostpassword","Lost Password","user.php?action=lostpassword","0","0"),
321
-					array("newsarchive","News Archive","news.php","0","0"),
322
-					array("browse","Browse","browse.php","0","0"),
323
-					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"),
324 348
 					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
325 349
 				);
326
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._PAGE."</th><th>"._RESULT."</th></tr>";
327
-				foreach($pagelist as $page) {
328
-					$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]."');");
329
-					$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>";
330 355
 				}
331 356
 
332 357
 				$output .= "</table>";
333
-				$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>");
334 359
 			}
335
-			else {
336
-				$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>");
337 363
 			}
338 364
 		}
339
-		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>");
340
-	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;
341 367
 	case "4":
342
-		$output .= "<div id='pagetitle'>"._PANELDATA."</div>";
343
-		if(isset($_GET['install'])){
344
-			if($_GET['install'] == "automatic") {
345
-		
368
+		$output .= "<div id='pagetitle'>" . _PANELDATA . "</div>";
369
+		if (isset($_GET['install']))
370
+		{
371
+			if ($_GET['install'] == "automatic")
372
+			{
373
+
346 374
 				$panellist = array(
347
-					array("submitted","Submissions", "","3","5","0","A"),
375
+					array("submitted", "Submissions", "", "3", "5", "0", "A"),
348 376
 					array("versioncheck", "Version Check", "", "3", "7", "0", "A"),
349
-					array("newstory","Add New Story","stories.php?action=newstory&admin=1","3","3","0","A"),
350
-					array("addseries","Add New Series","series.php?action=add","3","3","0","A"),
351
-					array("news","News","","3","5","0","A"),
352
-					array("featured","Featured Stories","","3","5","0","A"),
353
-					array("characters","Characters","","2","2","0","A"),
354
-					array("ratings","Ratings","","2","3","0","A"),
355
-					array("members","Members","","2","5","0","A"),
356
-					array("mailusers","Mail Users","","2","6","0","A"),
357
-					array("settings","Settings","","1","2","0","A"),
358
-					array("blocks","Blocks","","1","3","0","A"),
359
-					array("censor","Censor","","1","0","1","A"),
360
-					array("admins","Admins","","1","6","0","A"),
361
-					array("classifications","Classifications","","2","4","0","A"),
362
-					array("categories","Categories","","2","1","0","A"),
363
-					array("custpages","Custom Pages","","1","4","0","A"),
364
-					array("validate","Validate Submission","","3","0","1","A"),
365
-					array("yesletter","Validation Letter","","3","0","1","A"),
366
-					array("noletter","Rejection Letter","","3","0","1","A"),
367
-					array("links","Page Links","","1","5","0","A"),
368
-					array("messages","Message Settings","","2","0","1","A"),
369
-					array("login","Login","","0","0","1","U"),
370
-					array("logout","Logout","","1","5","0","U"),
371
-					array("revreceived","Reviews Received","","1","0","1","U"),
372
-					array("editprefs","Edit Preferences","","1","2","0","U"),
373
-					array("lostpassword","Lost Password","","0","0","1","U"),
374
-					array("editbio","Edit Bio","","1","1","0","U"),
375
-					array("register","Register","","0","0","1","U"),
376
-					array("manageimages","Manage Images","","1","5","0","S"),
377
-					array("revres","Review Response","","1","0","1","U"),
378
-					array("stats","View Your Statistics","","1","3","0","U"),
379
-					array("newstory","Add New Story","stories.php?action=newstory","1","1","0","S"),
380
-					array("newseries","Add New Series","series.php?action=add","1","3","0","S"),
381
-					array("managestories","Manage Stories","stories.php?action=viewstories","1","2","0","S"),
382
-					array("manageseries","Manage Series","series.php?action=manage","1","4","0","S"),
383
-					array("reviewsby","Your Reviews","","1","0","1","U"),
384
-					array("storiesby","Stories by {author}","","0","1","0","P"),
385
-					array("seriesby","Series by {author}","","0","2","0","P"),
386
-					array("reviewsby","Reviews by {author}","","0","3","0","P"),
387
-					array("categories","Categories","","0","1","0","B"),
388
-					array("characters","Characters","","0","2","0","B"),
389
-					array("ratings","Ratings","","0","3","0","B"),
390
-					array("titles","Titles","","0","5","0","B"),
391
-					array("class","Classes","","0","0","1","B"),
392
-					array("recent","Most Recent","","0","0","1","B"),
393
-					array("featured","Featured Stories","","0","0","1","B"),
394
-					array("panels","Panels","","1","1","0","A"),
395
-					array("phpinfo","PHP Info","","1","7","0","A"),
396
-					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"),
397 425
 					array("series", "Series", "", "0", "4", "0", "B"),
398 426
 					array("viewlog", "Action Log", "", "1", "8", "0", "A"),
399
-					array("shortstories","10 Shortest Stories","toplists/default.php","0","6","0","L"), 
400
-					array("longstories","10 Longest Stories","toplists/default.php","0","5","0","L"), 
401
-					array("largeseries","10 Largest Series","toplists/default.php","0","1","0","L"), 
402
-					array("smallseries","10 Smallest Series","toplists/default.php","0","2","0","L"), 
403
-					array("reviewedseries","10 Most Reviewed Series","toplists/default.php","0","4","0","L"), 
404
-					array("prolificauthors","10 Most Prolific Authors","toplists/default.php","0","10","0","L"), 
405
-					array("prolificreviewers","10 Most Prolific Reviewers","toplists/default.php","0","12","0","L"), 
406
-					array("reviewedstories","10 Most Reviewed Stories","toplists/default.php","0","8","0","L"), 
407
-					array("readstories","10 Most Read Stories","toplists/default.php","0","9","0","L"),
408
-					array("manfavs","Manage Favorites","","1","2","0","F"),
409
-					array("favstories","10 Most Favorite Stories","toplists/default.php","0","7","0","L"), 
410
-					array("favauthors","10 Most Favorite Authors","toplists/default.php","0","11","0","L"), 
411
-					array("favseries","10 Most Favorite Series","toplists/default.php","0","3","0","L"), 
412
-					array("favst","Favorite Stories","","0","0","1","F"),
413
-					array("favse","Favorite Series","","0","0","1","F"),
414
-					array("favau","Favorite Authors","","0","0","1","F"),
415
-					array("favst","Favorite Stories","","0","0","1","U"),
416
-					array("favse","Favorite Series","","0","0","1","U"),
417
-					array("favau","Favorite Authors","","0","0","1","U"),
418
-					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"),
419 447
 					array("skins", "Skins", "", "3", "6", "0", "A"),
420 448
 					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
421 449
 					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
422 450
 					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
423 451
 					array('modules', 'Modules', '', 1, "11", 0, 'A')
424 452
 				);
425
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>"._RESULT."</th></tr>";
426
-				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
+				{
427 456
 					unset($panels);
428
-					$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]."');");
429
-					$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>";
430 459
 				}
431 460
 				$output .= "</table>";
432
-				$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>");
433 462
 			}
434
-			else {
435
-				$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>");
436 466
 			}
437 467
 		}
438
-		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>");
439
-	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;
440 470
 	case "3":
441
-		$output .= "<div id='pagetitle'>"._INSTALLTABLES."</div>";
442
-		if(isset($_GET['install'])) {
443
-			if($_GET['install'] == "automatic") {
444
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Table</th><th>"._RESULT."</th></tr>";
445
-				$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` (
446 478
   `field_id` int(11) NOT NULL AUTO_INCREMENT,
447 479
   `field_type` tinyint(4) NOT NULL default '0',
448 480
   `field_name` varchar(30) NOT NULL default ' ',
... ...
@@ -453,16 +485,16 @@ switch($_GET['step']) {
453 485
   `field_on` tinyint(1) NOT NULL default '0',
454 486
   PRIMARY KEY  (`field_id`)
455 487
 ) ENGINE=MyISAM;");
456
-$output .= "<tr><td>".$tableprefix."fanfiction_authorfields</td><td align='center'>" . ($authorfields ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
457
-				$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` (
458 490
   `uid` int(11) NOT NULL default '0',
459 491
   `field` int(11) NOT NULL default '0',
460 492
   `info` varchar(255) NOT NULL default ' ',
461 493
   PRIMARY KEY  (`uid`,`field`),
462 494
   KEY `uid` (`uid`)) ENGINE=MyISAM;");
463
-$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>";
464 496
 				$authorprefs = dbquery("
465
-CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorprefs` (
497
+CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorprefs` (
466 498
   `uid` int(11) NOT NULL default '0',
467 499
   `newreviews` tinyint(1) NOT NULL default '0',
468 500
   `newrespond` tinyint(1) NOT NULL default '0',
... ...
@@ -479,8 +511,8 @@ CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_authorprefs` (
479 511
   `stories` int(11) NOT NULL default '0',
480 512
   PRIMARY KEY  (`uid`)
481 513
 ) ENGINE=MyISAM;");
482
-$output .= "<tr><td>".$tableprefix."fanfiction_authorprefs</td><td align='center'>" . ($authorprefs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
483
-				$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` (
484 516
   `uid` int(11) NOT NULL auto_increment,
485 517
   `penname` varchar(200) NOT NULL default '',
486 518
   `realname` varchar(200) NOT NULL default '',
... ...
@@ -494,8 +526,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_authorprefs</td><td align='center
494 526
   KEY `penname` (`penname`),
495 527
   KEY `admincreated` (`admincreated`)
496 528
 ) ENGINE=MyISAM;");
497
-$output .= "<tr><td>".$tableprefix."fanfiction_authors</td><td align='center'>" . ($authors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
498
-				$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` (
499 531
   `block_id` int(11) NOT NULL auto_increment,
500 532
   `block_name` varchar(30) NOT NULL default '',
501 533
   `block_title` varchar(150) NOT NULL default '',
... ...
@@ -505,8 +537,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_authors</td><td align='center'>"
505 537
   PRIMARY KEY  (`block_id`),
506 538
   KEY `block_name` (`block_name`)
507 539
 ) ENGINE=MyISAM;");
508
-$output .= "<tr><td>".$tableprefix."fanfiction_blocks</td><td align='center'>" . ($blocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
509
-				$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` (
510 542
   `catid` int(11) NOT NULL auto_increment,
511 543
   `parentcatid` int(11) NOT NULL default '-1',
512 544
   `category` varchar(60) NOT NULL default '',
... ...
@@ -519,8 +551,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_blocks</td><td align='center'>" .
519 551
   PRIMARY KEY  (`catid`),
520 552
   KEY `byparent` (`parentcatid`,`displayorder`)
521 553
 ) ENGINE=MyISAM;");
522
-$output .= "<tr><td>".$tableprefix."fanfiction_categories</td><td align='center'>" . ($categories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
523
-				$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` (
524 556
   `chapid` int(11) NOT NULL auto_increment,
525 557
   `title` varchar(250) NOT NULL default '',
526 558
   `inorder` int(11) NOT NULL default '0',
... ...
@@ -542,8 +574,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_categories</td><td align='center'
542 574
   KEY `validated` (`validated`),
543 575
   KEY `forstoryblock` (`sid`,`validated`)
544 576
 ) ENGINE=MyISAM;");
545
-$output .= "<tr><td>".$tableprefix."fanfiction_chapters</td><td align='center'>" . ($chapters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
546
-				$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` (
547 579
   `charid` int(11) NOT NULL auto_increment,
548 580
   `catid` int(11) NOT NULL default '0',
549 581
   `charname` varchar(60) NOT NULL default '',
... ...
@@ -553,30 +585,30 @@ $output .= "<tr><td>".$tableprefix."fanfiction_chapters</td><td align='center'>"
553 585
   KEY `catid` (`catid`),
554 586
   KEY `charname` (`charname`)
555 587
 ) ENGINE=MyISAM;");
556
-$output .= "<tr><td>".$tableprefix."fanfiction_characters</td><td align='center'>" . ($characters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
557
-				$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` (
558 590
   `class_id` int(11) NOT NULL auto_increment,
559 591
   `class_type` int(11) NOT NULL default '0',
560 592
   `class_name` varchar(100) NOT NULL default '',
561 593
   PRIMARY KEY  (`class_id`),
562 594
   KEY `byname` (`class_type`,`class_name`,`class_id`)
563 595
 ) ENGINE=MyISAM;");
564
-$output .= "<tr><td>".$tableprefix."fanfiction_classes</td><td align='center'>" . ($classes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
565
-				$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` (
566 598
   `classtype_id` int(11) NOT NULL auto_increment,
567 599
   `classtype_name` varchar(50) NOT NULL default '',
568 600
   `classtype_title` varchar(50) NOT NULL default '',
569 601
   PRIMARY KEY  (`classtype_id`),
570 602
   UNIQUE KEY `classtype_name` (`classtype_name`)
571 603
 ) ENGINE=MyISAM;");
572
-$output .= "<tr><td>".$tableprefix."fanfiction_classtypes</td><td align='center'>" . ($classtypes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
573
-$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` (
574 606
   `sid` int(11) NOT NULL default '0',
575 607
   `uid` int(11) NOT NULL default '0',
576 608
   PRIMARY KEY  (`sid`,`uid`)
577 609
 ) ENGINE=MyISAM;");
578
-$output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>" . ($coauthors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
579
-				$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` (
580 612
   `code_id` int(11) NOT NULL auto_increment,
581 613
   `code_text` text NOT NULL,
582 614
   `code_type` varchar(20) default NULL,
... ...
@@ -584,8 +616,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>
584 616
   PRIMARY KEY  (`code_id`),
585 617
   KEY `code_type` (`code_type`)
586 618
 ) ENGINE=MyISAM;");
587
-$output .= "<tr><td>".$tableprefix."fanfiction_codeblocks</td><td align='center'>" . ($codeblocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
588
-				$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` (
589 621
   `cid` int(11) NOT NULL auto_increment,
590 622
   `nid` int(11) NOT NULL default '0',
591 623
   `uid` int(11) NOT NULL default '0',
... ...
@@ -594,8 +626,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_codeblocks</td><td align='center'
594 626
   PRIMARY KEY  (`cid`),
595 627
   KEY `commentlist` (`nid`,`time`)
596 628
 ) ENGINE=MyISAM;");
597
-$output .= "<tr><td>".$tableprefix."fanfiction_comments</td><td align='center'>" . ($comments ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
598
-				$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` (
599 631
   `uid` int(11) NOT NULL default '0',
600 632
   `item` int(11) NOT NULL default '0',
601 633
   `type` char(2) NOT NULL default '',
... ...
@@ -603,8 +635,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_comments</td><td align='center'>"
603 635
   UNIQUE KEY `byitem` (`item`,`type`,`uid`),
604 636
   UNIQUE KEY `byuid` (`uid`,`type`,`item`)
605 637
 ) ENGINE=MyISAM;");
606
-$output .= "<tr><td>".$tableprefix."fanfiction_favorites</td><td align='center'>" . ($favorites ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
607
-				$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` (
608 640
   `seriesid` int(11) NOT NULL default '0',
609 641
   `sid` int(11) NOT NULL default '0',
610 642
   `subseriesid` int(11) NOT NULL default '0',
... ...
@@ -613,8 +645,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_favorites</td><td align='center'>
613 645
   PRIMARY KEY  (`sid`,`seriesid`, `subseriesid`),
614 646
   KEY `seriesid` (`seriesid`,`inorder`)
615 647
 ) ENGINE=MyISAM;");
616
-$output .= "<tr><td>".$tableprefix."fanfiction_inseries</td><td align='center'>" . ($inseries ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
617
-				$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` (
618 650
   `log_id` int(11) NOT NULL auto_increment,
619 651
   `log_action` varchar(255) default NULL,
620 652
   `log_uid` int(11) NOT NULL,
... ...
@@ -623,8 +655,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_inseries</td><td align='center'>"
623 655
   `log_type` varchar(2) NOT NULL,
624 656
   PRIMARY KEY  (`log_id`)
625 657
 ) ENGINE=MyISAM");
626
-$output .= "<tr><td>".$tableprefix."fanfiction_log</td><td align='center'>" . ($logs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
627
-				$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` (
628 660
   `message_id` int(11) NOT NULL auto_increment,
629 661
   `message_name` varchar(50) NOT NULL default '',
630 662
   `message_title` varchar(200) NOT NULL default '',
... ...
@@ -632,17 +664,17 @@ $output .= "<tr><td>".$tableprefix."fanfiction_log</td><td align='center'>" . ($
632 664
   PRIMARY KEY  (`message_id`),
633 665
   KEY `message_name` (`message_name`)
634 666
 ) ENGINE=MyISAM;");
635
-$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>";
636 668
 				$modules = dbquery("
637
-CREATE TABLE IF NOT EXISTS `".$tableprefix."fanfiction_modules` (
669
+CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
638 670
   `id` int(11) NOT NULL auto_increment,
639 671
   `name` varchar(100) NOT NULL default 'Test Module',
640 672
   `version` varchar(10) NOT NULL default '1.0',
641 673
   PRIMARY KEY  (`id`),
642 674
   KEY `name_version` (`name`,`version`)
643 675
 )");
644
-$output .= "<tr><td>".$tableprefix."fanfiction_modules</td><td align='center'>" . ($modules ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
645
-				$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` (
646 678
   `nid` int(11) NOT NULL auto_increment,
647 679
   `author` varchar(60) NOT NULL default '',
648 680
   `title` varchar(255) NOT NULL default '',
... ...
@@ -651,8 +683,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_modules</td><td align='center'>"
651 683
   `comments` INT NOT NULL DEFAULT '0',
652 684
   PRIMARY KEY  (`nid`)
653 685
 ) ENGINE=MyISAM;");
654
-$output .= "<tr><td>".$tableprefix."fanfiction_news</td><td align='center'>" . ($news ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
655
-				$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` (
656 688
   `link_id` int(11) NOT NULL auto_increment,
657 689
   `link_name` varchar(50) NOT NULL default '',
658 690
   `link_text` varchar(100) NOT NULL default '',
... ...
@@ -663,8 +695,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_news</td><td align='center'>" . (
663 695
   PRIMARY KEY  (`link_id`),
664 696
   KEY `link_name` (`link_name`)
665 697
 ) ENGINE=MyISAM;");
666
-$output .= "<tr><td>".$tableprefix."fanfiction_pagelinks</td><td align='center'>" . ($pagelinks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
667
-				$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` (
668 700
   `panel_id` int(11) NOT NULL auto_increment,
669 701
   `panel_name` varchar(50) NOT NULL default 'unknown',
670 702
   `panel_title` varchar(100) NOT NULL default 'Unnamed Panel',
... ...
@@ -676,8 +708,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_pagelinks</td><td align='center'>
676 708
   PRIMARY KEY  (`panel_id`),
677 709
   KEY `panel_type` (`panel_type`,`panel_name`)
678 710
 ) ENGINE=MyISAM;");
679
-$output .= "<tr><td>".$tableprefix."fanfiction_panels</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
680
-				$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` (
681 713
   `rid` int(11) NOT NULL auto_increment,
682 714
   `rating` varchar(60) NOT NULL default '',
683 715
   `ratingwarning` char(1) NOT NULL default '0',
... ...
@@ -685,8 +717,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_panels</td><td align='center'>" .
685 717
   PRIMARY KEY  (`rid`),
686 718
   KEY `rating` (`rating`)
687 719
 ) ENGINE=MyISAM;");
688
-$output .= "<tr><td>".$tableprefix."fanfiction_ratings</td><td align='center'>" . ($ratings ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
689
-				$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` (
690 722
   `reviewid` int(11) NOT NULL auto_increment,
691 723
   `item` int(11) NOT NULL default '0',
692 724
   `chapid` int(11) NOT NULL default '0',
... ...
@@ -705,8 +737,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_ratings</td><td align='center'>"
705 737
   KEY `bychapter` (`chapid`,`rating`),
706 738
   KEY `byuid` (`uid`,`item`,`type`)
707 739
 ) ENGINE=MyISAM;");
708
-$output .= "<tr><td>".$tableprefix."fanfiction_reviews</td><td align='center'>" . ($reviews ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
709
-				$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` (
710 742
   `seriesid` int(11) NOT NULL auto_increment,
711 743
   `title` varchar(200) NOT NULL default '',
712 744
   `summary` text NOT NULL,
... ...
@@ -725,8 +757,8 @@ $output .= "<tr><td>".$tableprefix."fanfiction_reviews</td><td align='center'>"
725 757
   KEY `classes` (`classes`),
726 758
   KEY `owner` (`uid`,`title`)
727 759
 ) ENGINE=MyISAM;");
728
-$output .= "<tr><td>".$tableprefix."fanfiction_series</td><td align='center'>" . ($series ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
729
-	$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` (
730 762
   `sitekey` varchar(50) NOT NULL default '0',
731 763
   `stories` int(11) NOT NULL default '0',
732 764
   `chapters` int(11) NOT NULL default '0',
... ...
@@ -738,9 +770,9 @@ $output .= "<tr><td>".$tableprefix."fanfiction_series</td><td align='center'>" .
738 770
   `reviewers` int(11) NOT NULL default '0',
739 771
   `newestmember` int(11) NOT NULL default '0'
740 772
 ) ENGINE=MyISAM");
741
-	dbquery("INSERT INTO ".$tableprefix."fanfiction_stats(`sitekey`, `newestmember`) VALUES('".SITEKEY."', '1')");
742
-$output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" . ($stats ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
743
-				$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` (
744 776
   `sid` int(11) NOT NULL auto_increment,
745 777
   `title` varchar(200) NOT NULL default 'Untitled',
746 778
   `summary` text NULL,
... ...
@@ -773,76 +805,87 @@ $output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" .
773 805
   KEY `validateduid` (`validated`,`uid`),
774 806
   KEY `recent` (`updated`,`validated`)
775 807
 ) ENGINE=MyISAM;");
776
-$output .= "<tr><td>".$tableprefix."fanfiction_stories</td><td align='center'>" . ($stories ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
777
-$output .= "</table>";
778
-$output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>"._CONTINUE."</a>");
779
-
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>");
780 811
 			}
781
-			else if($_GET['install'] == "manual") {
782
-				$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>");
783 815
 			}
784
-
785 816
 		}
786
-		else {
787
-	
788
-			$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>");
789 821
 		}
790 822
 
791
-	break;
823
+		break;
792 824
 
793 825
 	case "2";
794 826
 		include("../config.php");
795
-		if(dbnumrows(dbquery("SHOW TABLES LIKE '".$settingsprefix."fanfiction_settings'"))) {
827
+		if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
828
+		{
796 829
 			include("../config.php");
797
-			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
798
-			$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 . "'");
799 832
 			list($tableprefix, $language) = dbrow($settings);
800
-			
833
+
801 834
 			if ($tableprefix == '') $tableprefix = $settingsprefix;
802 835
 
803 836
 			define("TABLEPREFIX", $tableprefix);
804 837
 			define("SITEKEY", $sitekey);
805
-			
838
+
806 839
 			$sect = isset($_GET['sect']) ? $_GET['sect'] : "main";
807
-			$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
808
-			if(dbnumrows($settingsresults) == 0) {
809
-				dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings (`sitekey`) VALUES('".SITEKEY."');");
810
-				$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 . "'");
811 845
 			}
812 846
 			$settings = dbassoc($settingsresults);
813
-			foreach($settings as $var => $val) {
847
+			foreach ($settings as $var => $val)
848
+			{
814 849
 				$$var = $val;
815 850
 			}
816
-			if($sect == "submissions") {
817
-				if(isset($_POST['submit'])) {
851
+			if ($sect == "submissions")
852
+			{
853
+				if (isset($_POST['submit']))
854
+				{
818 855
 					$storiespath = descript($_POST['newstoriespath']);
819
-					if(!file_exists($storiespath) && !file_exists("../".$storiespath)) {
820
-						if(!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
856
+					if (!file_exists($storiespath) && !file_exists("../" . $storiespath))
857
+					{
858
+						if (!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
821 859
 						mkdir("$storiespath", 0755);
822 860
 						@chmod("$storiespath", 0777);
823
-						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);
824 862
 					}
825 863
 				}
826 864
 			}
827
-			if($sect == "email" && isset($_POST['submit'])) {
828
-				$output .= "<div id=\"pagetitle\">"._SETTINGS."</div>";
865
+			if ($sect == "email" && isset($_POST['submit']))
866
+			{
867
+				$output .= "<div id=\"pagetitle\">" . _SETTINGS . "</div>";
829 868
 				$smtp_host = $_POST['newsmtp_host'];
830 869
 				$smtp_username = $_POST['newsmtp_username'];
831 870
 				$smtp_password = $_POST['newsmtp_password'];
832
-				$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '".SITEKEY."'");
833
-				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
+				{
834 874
 					$output .= write_message(_ACTIONSUCCESSFUL);
835
-					$output .= write_message("<a href='install.php?step=3'>"._CONTINUE."</a>");
875
+					$output .= write_message("<a href='install.php?step=3'>" . _CONTINUE . "</a>");
836 876
 				}
837 877
 				else include("../admin/settings.php");
838 878
 			}
839 879
 			else include("../admin/settings.php");
840 880
 		}
841
-		else {
842
-			if($_GET['install']) {
843
-				if($_GET['install'] == "automatic") {
844
-			
845
-								$settings = dbquery("CREATE TABLE IF NOT EXISTS `".$settingsprefix."fanfiction_settings` (
881
+		else
882
+		{
883
+			if ($_GET['install'])
884
+			{
885
+				if ($_GET['install'] == "automatic")
886
+				{
887
+
888
+					$settings = dbquery("CREATE TABLE IF NOT EXISTS `" . $settingsprefix . "fanfiction_settings` (
846 889
   `sitekey` varchar(50) NOT NULL default '1',
847 890
   `sitename` varchar(200) NOT NULL default 'Your Site',
848 891
   `slogan` varchar(200) NOT NULL default 'It''s a cool site!',
... ...
@@ -894,30 +937,33 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
894 937
   `disablepopups` tinyint(1) NOT NULL default '0',
895 938
   `agestatement` tinyint(1) NOT NULL default '0',
896 939
   `words` text,
897
-  `version` varchar(10) NOT NULL default '".$version."',
940
+  `version` varchar(10) NOT NULL default '" . $version . "',
898 941
   `smtp_host` varchar(200) default NULL,
899 942
   `smtp_username` varchar(50) default NULL,
900 943
   `smtp_password` varchar(50) default NULL,
901 944
   PRIMARY KEY  (`sitekey`)
902 945
 ) ENGINE=MyISAM;");
903
-if($settings) $output .= write_message("<img src=\"../images/check.gif\"> "._SETTINGSTABLESUCCESS." <br /><a href='install.php?step=2'>"._CONTINUE."</a>");
904
-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>");
905 948
 				}
906
-				else {
907
-					$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>");
908 952
 				}
909 953
 			}
910
-			else {
911
-		
954
+			else
955
+			{
956
+
912 957
 				$test = dbquery("SHOW TABLES");
913
-				if(!$test) $output .= write_message(_CONFIGFAILED);
914
-				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>");
915 960
 			}
916 961
 		}
917
-	break;
962
+		break;
918 963
 	default:
919
-		$output .= "<div id='pagetitle'>"._CONFIGDATA."</div>";
920
-		if(isset($_POST['submit'])) {
964
+		$output .= "<div id='pagetitle'>" . _CONFIGDATA . "</div>";
965
+		if (isset($_POST['submit']))
966
+		{
921 967
 			$dbhost = descript($_POST['dbhost']);
922 968
 			$dbname = descript($_POST['dbname']);
923 969
 			$dbuser = descript($_POST['dbuser']);
... ...
@@ -926,23 +972,27 @@ else $output .= write_message(_SETTINGSTABLEAUTOFAIL."<br /><br /> <a href='inst
926 972
 			$sitekey = descript($_POST['sitekey']);
927 973
 			$settingsprefix = descript($_POST['settingsprefix']);
928 974
 			$mysql_access = mysqli_connect($dbhost, $dbuser, $dbpass);
929
-			if(!$mysql_access) {
975
+			if (!$mysql_access)
976
+			{
930 977
 				$output .= write_message(_CONFIGFAILED);
931 978
 			}
932 979
 		}
933
-		if(isset($_POST['submit']) && $mysql_access) {
980
+		if (isset($_POST['submit']) && $mysql_access)
981
+		{
934 982
 			$handle = fopen("../config.php", 'w');
935
-			if(!$handle) {
983
+			if (!$handle)
984
+			{
936 985
 				@chmod("../config.php", 0666);
937 986
 				$handle = fopen("../config.php", 'w');
938 987
 			}
939
-			if($handle) {
988
+			if ($handle)
989
+			{
940 990
 				$dbhost = descript($_POST['dbhost']);
941 991
 				$dbname = descript($_POST['dbname']);
942 992
 				$dbuser = descript($_POST['dbuser']);
943 993
 				$dbpass = descript($_POST['dbpass']);
944 994
 				$sitekey = descript($_POST['sitekey']);
945
-				if(empty($sitekey)) $sitekey = random_string($randomcharset, 10);
995
+				if (empty($sitekey)) $sitekey = random_string($randomcharset, 10);
946 996
 				$language = $_POST['language'];
947 997
 				$settingsprefix = descript($_POST['settingsprefix']);
948 998
 				$text = "<?php 
... ...
@@ -960,42 +1010,43 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
960 1010
 				fwrite($handle, $text);
961 1011
 				fclose($handle);
962 1012
 				@chmod("../config.php", 0644);
963
-				$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>");
964 1014
 			}
965 1015
 			else $output .= write_message(_ERROR_CONFIGWRITE);
966
-
967 1016
 		}
968
-		else { 
969
-			if(file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
970
-			if(isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
971
-			else if(isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
972
-			else {
973
-				$output .=  
1017
+		else
1018
+		{
1019
+			if (file_exists("../config.php") && !isset($mysql_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 .=
974 1025
 					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
975
-						<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>
976
-						<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>
977
-						<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>
978
-						<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>
979
-						<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>
980
-						<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\">";
981 1032
 				$directory = opendir("../languages");
982
-				while($filename = readdir($directory)) {
983
-					if($filename=="." || $filename==".." || substr($filename, 2) == "_admin.php") continue;
984
-					$output .= "<option value=\"".substr($filename, 0, 2)."\"".
985
-						($language == substr($filename, 0, strpos($filename, ".php")) ? " selected" : "").">
986
-					".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>";
987 1039
 				}
988 1040
 				closedir($directory);
989
-				$output .= 
990
-					"</select> <A HREF=\"#\" class=\"pophelp\">[?]<span>"._HELP_LANGUAGE."</span></A></div>
991
-						<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 />
992 1044
 						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
993 1045
 					</form>";
994 1046
 			}
995
-		}	
1047
+		}
996 1048
 }
997 1049
 $tpl->assign("output", $output);
998 1050
 
999 1051
 $tpl->printToScreen();
1000
-if(isset($_GET['step']) && $_GET['step'] > 2) dbclose( );
1001
-?>
1002 1052
\ No newline at end of file
1053
+if (isset($_GET['step']) && $_GET['step'] > 2) dbclose();
Browse code

Fix installation PHP 8.2 - always upgrade

Jimmi08 authored on 2023/03/07 13:58:02
Showing 1 changed files
... ...
@@ -67,7 +67,7 @@ include ("../includes/class.TemplatePower.inc.php");
67 67
 /* PHP 8 fix - other way is separated LANs to smaller files */
68 68
 $allowed_tags = '';
69 69
 $recentdays = 7;
70
-$sitename = "";
70
+$sitename = "";  // this breaks stuff in PHP 8.2 
71 71
 $url = "" ;
72 72
 $multiplecats = '';
73 73
 $minwords = '';
... ...
@@ -968,7 +968,7 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
968 968
 		else { 
969 969
 			if(file_exists("../config.php") && !isset($mysql_access)) include("../config.php");
970 970
 			if(isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
971
-			else if(isset($sitename)) $output .= write_message(_CONFIG1DETECTED);
971
+			else if(isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
972 972
 			else {
973 973
 				$output .=  
974 974
 					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
Browse code

Fixed install process - for PHP 8.1

Jimmi08 authored on 2023/02/19 12:58:30
Showing 1 changed files
... ...
@@ -64,17 +64,35 @@ $language = "";
64 64
 
65 65
 include ("../includes/class.TemplatePower.inc.php");
66 66
 
67
+/* PHP 8 fix - other way is separated LANs to smaller files */
68
+$allowed_tags = '';
69
+$recentdays = 7;
70
+$sitename = "";
71
+$url = "" ;
72
+$multiplecats = '';
73
+$minwords = '';
74
+$maxwords = '';
75
+$action = '';
76
+$pwdsetting = '';
77
+$imagewidth = '';
78
+$imageheight = '';
79
+$version = '';
80
+$user = array();
81
+$user['penname'] = '';
82
+$user['email'] = '';
83
+$penname = '';
84
+
67 85
 if(!isset($_GET['step']) || $_GET['step'] == 2) {
68
-	//include ("../languages/en.php");
69
-	//include ("../languages/en_admin.php");
86
+	include ("../languages/en.php");
87
+	include ("../languages/en_admin.php");
70 88
 	include ("languages/en.php");
71 89
 }
72 90
 else if(isset($_REQUEST['language'])) {
73 91
 	$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");
92
+	if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
93
+	else include ("../languages/en.php");
94
+	if(file_exists("../languages/".$language."_admin.php")) include("../languages/".$language."_admin.php");
95
+	else include ("../languages/en_admin.php");
78 96
 	if(file_exists("languages/".$language.".php")) include("languages/".$language.".php");
79 97
 	else include ("languages/en.php");
80 98
 }
... ...
@@ -83,6 +101,7 @@ include("../config.php");
83 101
 $dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
84 102
 $settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
85 103
 list($tableprefix, $language) = dbrow($settings);
104
+
86 105
 define("TABLEPREFIX", $tableprefix);
87 106
 define("SITEKEY", $sitekey);
88 107
 if(file_exists("../languages/".$language.".php")) include ("../languages/".$language.".php");
... ...
@@ -169,8 +188,10 @@ switch($_GET['step']) {
169 188
 		}
170 189
 		else {
171 190
 			$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\">
172
-			<div class='row'><label for='newpenname'>"._PENNAME.":</label> <INPUT name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"$user[penname]\"></div>
173
-		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"$user[email]\" maxlength=\"200\"></div>
191
+			<div class='row'><label for='newpenname'>"._PENNAME.":</label> 
192
+			<input name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"".$user['penname']."\"></div>
193
+		 	<div class='row'><label for='email'>"._EMAIL.":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"".$user['email'].
194
+			"\" maxlength=\"200\"></div>
174 195
 			<div class='row'><label for='password'>"._PASSWORD.":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></div> 
175 196
 			<div class='row'><label for='password2'>"._PASSWORD2.":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></div>
176 197
 			<div style='text-align: center;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div></form>";	
... ...
@@ -776,6 +797,9 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
776 797
 			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
777 798
 			$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
778 799
 			list($tableprefix, $language) = dbrow($settings);
800
+			
801
+			if ($tableprefix == '') $tableprefix = $settingsprefix;
802
+
779 803
 			define("TABLEPREFIX", $tableprefix);
780 804
 			define("SITEKEY", $sitekey);
781 805
 			
... ...
@@ -786,7 +810,6 @@ $output .= write_message(_TABLEFAILED."<br /><br /><a href='install.php?step=4'>
786 810
 				$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
787 811
 			}
788 812
 			$settings = dbassoc($settingsresults);
789
-			define("_BASEDIR", "../");
790 813
 			foreach($settings as $var => $val) {
791 814
 				$$var = $val;
792 815
 			}
Browse code

Fixed install process - step 1 - for PHP 8.1

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

attempt to fix national characters coding

Jimmi08 authored on 2020/01/15 12:04:08
Showing 1 changed files
... ...
@@ -54,7 +54,7 @@ if(ini_get("magic_quotes_gpc")) {
54 54
 }
55 55
 
56 56
 define("_BASEDIR", "../");
57
-
57
+define("_CHARSET", "utf-8");
58 58
 Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
59 59
 header ("Pragma: no-cache"); 
60 60
 header ("Expires: 0"); 
Rainer Volkrodt authored on 2017/01/28 09:22:40
Showing 1 changed files
... ...
@@ -152,9 +152,7 @@ switch($_GET['step']) {
152 152
 			$penname = descript($_POST['newpenname']);
153 153
 			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154 154
 			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155
-<<<<<<< HEAD
156 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>";
157
->>>>>>> 94417774241deeaf340c9434135fed42b738a15d
158 156
 			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
159 157
 			else $fail =  write_message(_PASSWORDTWICE);
160 158
 			if(!isset($fail)) {
Browse code

Merge branch 'master' of https://github.com/jsnider2/efiction_v3_stable into jsnider2-master

Conflicts:
install/install.php

Rainer Volkrodt authored on 2017/01/28 09:18:27
Showing 0 changed files
Browse code

Push latest patches

Rainer Volkrodt authored on 2017/01/28 09:08:54
Showing 1 changed files
... ...
@@ -152,8 +152,7 @@ switch($_GET['step']) {
152 152
 			$penname = descript($_POST['newpenname']);
153 153
 			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154 154
 			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155
-//			if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[email])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
156
-			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>";
155
+			if(!preg_match("/[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+/i", $_POST[email])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
157 156
 			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
158 157
 			else $fail =  write_message(_PASSWORDTWICE);
159 158
 			if(!isset($fail)) {
Browse code

Fixed deprecated mysql_* call in installer

Rainer Volkrodt authored on 2016/09/25 06:21:05
Showing 1 changed files
... ...
@@ -158,9 +158,9 @@ switch($_GET['step']) {
158 158
 			else $fail =  write_message(_PASSWORDTWICE);
159 159
 			if(!isset($fail)) {
160 160
 				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '".$_POST['email']."', '$encryptpassword', now( ))");
161
+				define("USERUID", dbinsertid( ));
161 162
 				$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
162 163
 				list($skin) = dbrow($skinquery);
163
-				define("USERUID", dbinsertid( ));
164 164
 				$result2 = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `userskin`, `level`) VALUES('".USERUID."', '$skin', '1')");
165 165
 				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 166
 			}
... ...
@@ -901,7 +901,7 @@ else $output .= write_message(_SETTINGSTABLEAUTOFAIL."<br /><br /> <a href='inst
901 901
 			$language = $_POST['language'];
902 902
 			$sitekey = descript($_POST['sitekey']);
903 903
 			$settingsprefix = descript($_POST['settingsprefix']);
904
-			$mysql_access = mysql_connect($dbhost, $dbuser, $dbpass);
904
+			$mysql_access = mysqli_connect($dbhost, $dbuser, $dbpass);
905 905
 			if(!$mysql_access) {
906 906
 				$output .= write_message(_CONFIGFAILED);
907 907
 			}
Browse code

preg_match requires // delimiters around the regular expression

Jeff Snider authored on 2016/08/28 13:15:24
Showing 1 changed files
... ...
@@ -153,7 +153,7 @@ switch($_GET['step']) {
153 153
 			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154 154
 			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155 155
 //			if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[email])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
156
-			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(!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>";
157 157
 			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
158 158
 			else $fail =  write_message(_PASSWORDTWICE);
159 159
 			if(!isset($fail)) {
Browse code

Removed ereg(i) instances, because deprecated

Rainer Volkrodt authored on 2016/05/18 09:11:36
Showing 1 changed files
... ...
@@ -152,7 +152,8 @@ switch($_GET['step']) {
152 152
 			$penname = descript($_POST['newpenname']);
153 153
 			if((!$_POST['email']) && !isADMIN) $fail .= "<div style='text-align: center;'>"._EMAILREQUIRED." "._TRYAGAIN."</div>";
154 154
 			if($penname && !preg_match("!^[a-z0-9_ ]{3,30}$!i", $penname)) $fail = "<div style='text-align: center;'>"._BADUSERNAME." "._TRYAGAIN."</div>";
155
-			if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[email])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
155
+//			if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[email])) $fail = "<div style='text-align: center;'>"._INVALIDEMAIL." "._TRYAGAIN."</div>";
156
+			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 157
 			if($_POST['password'] == $_POST['password2']) $encryptpassword = md5($_POST[password]);
157 158
 			else $fail =  write_message(_PASSWORDTWICE);
158 159
 			if(!isset($fail)) {
Browse code

Initial uplad w/ php7 fixes

Rainer Volkrodt authored on 2016/03/12 15:54:02
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
+
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(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_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
+				$skinquery = dbquery("SELECT skin FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
161
+				list($skin) = dbrow($skinquery);
162
+				define("USERUID", dbinsertid( ));
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 = mysql_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