Browse code

install/install.php: disable MySQLi error suppression by default with a note

Clarissa Walker authored on 2026/09/11 19:52:41
Showing 1 changed files
... ...
@@ -24,9 +24,10 @@
24 24
 
25 25
 /**
26 26
  * Revert PHP 8.1 mysqli default error mode
27
+ * commented out by default - uncomment if you run into any db related issues with this file
27 28
  * @link https://github.com/php/php-src/blob/4025cf2875f895e9f7193cebb1c8efa4290d052e/UPGRADING#L101-L105
28 29
  */
29
-mysqli_report(MYSQLI_REPORT_OFF);
30
+// mysqli_report(MYSQLI_REPORT_OFF);
30 31
 
31 32
 
32 33
 function random_char($string)
Browse code

install/install.php: cleanup due to the script's recent changes

Clarissa Walker authored on 2026/09/10 15:01:23
Showing 1 changed files
... ...
@@ -65,7 +65,7 @@ if (ini_get("magic_quotes_gpc"))
65 65
 }
66 66
 
67 67
 define("_BASEDIR", "../");
68
-define("_CHARSET", "utf-8");
68
+
69 69
 Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
70 70
 header("Pragma: no-cache");
71 71
 header("Expires: 0");
... ...
@@ -1080,7 +1080,7 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1080 1080
 				$directory = opendir("../languages");
1081 1081
 				while ($filename = readdir($directory))
1082 1082
 				{
1083
-					if ($filename == "." || $filename == ".." || substr($filename, 2) == "_admin.php") continue;
1083
+					if ($filename == "." || $filename == ".." || $filename == "mailer" || substr($filename, 2) == "_admin.php") continue;
1084 1084
 					$output .= "<option value=\"" . substr($filename, 0, 2) . "\"" .
1085 1085
 						($language == substr($filename, 0, strpos($filename, ".php")) ? " selected" : "") . ">
1086 1086
 					" . substr($filename, 0, strpos($filename, ".php")) . "</option>";
Browse code

Add includes/dbfunctions.php include back to config.php, but leave the actual dbconnect in the includes/dbfunctions.php file where it belongs - this makes legacy modules work without adding another include

Clarissa Walker authored on 2026/09/05 13:38:55
Showing 1 changed files
... ...
@@ -112,7 +112,6 @@ else if (isset($_REQUEST['language']))
112 112
 else
113 113
 {
114 114
 	include("../config.php");
115
-	include("../includes/dbfunctions.php");
116 115
 
117 116
 	$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
118 117
 	$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
... ...
@@ -849,11 +848,8 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
849 848
 
850 849
 	case "2";
851 850
 		include("../config.php");
852
-		include("../includes/dbfunctions.php");
853 851
 		if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
854 852
 		{
855
-			//include("../config.php");
856
-			//include("../includes/dbfunctions.php");
857 853
 			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
858 854
 			$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
859 855
 			list($tableprefix, $language) = dbrow($settings);
... ...
@@ -1037,6 +1033,7 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
1037 1033
 \$sitekey = \"$sitekey\";
1038 1034
 \$settingsprefix = \"$settingsprefix\";
1039 1035
 
1036
+include(\"includes/dbfunctions.php\");
1040 1037
 ?>";
1041 1038
 
1042 1039
 /* removed in 3.5.8 and moved to file: 
... ...
@@ -1055,7 +1052,6 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1055 1052
 		{
1056 1053
 			if (file_exists("../config.php") && !isset($mysqli_access)) {
1057 1054
 				include("../config.php");
1058
-				include("../includes/dbfunctions.php");
1059 1055
 			}
1060 1056
 			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
1061 1057
 			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
Browse code

Installer layout fixes

Clarissa Walker authored on 2026/08/22 20:44:53
Showing 1 changed files
... ...
@@ -136,15 +136,6 @@ include("../version.php");
136 136
 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
137 137
 <html><head><title>eFiction {$version} Install</title>
138 138
 <style>
139
-LABEL { float: left; display: block; width: 45%; text-align: right; padding-right: 10px; clear: left;}
140
-.row { float: left; width: 99%; }
141
-#settingsform FORM { width: 80%; margin; 0 auto; }
142
-#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
143
-#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
144
-#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
145
-#settingsform .tinytoggle { text-align: center; }
146
-#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
147
-#settingsform #submit { display: block; margin: 1ex auto; }
148 139
 a.pophelp{
149 140
     position: relative; /* this is the key*/
150 141
     z-index:24;
... ...
@@ -171,6 +162,17 @@ a.pophelp:hover span{ /*the span will display just on :hover state*/
171 162
 </style>
172 163
 <link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
173 164
 
165
+// leftover data that would be right after the <style> tag above
166
+// LABEL { float: left; display: block; width: 45%; text-align: right; padding-right: 10px; clear: left;}
167
+// .row { float: left; width: 99%; }
168
+// #settingsform FORM { width: 80%; margin; 0 auto; }
169
+// #settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
170
+// #settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
171
+// #settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
172
+// #settingsform .tinytoggle { text-align: center; }
173
+// #settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
174
+// #settingsform #submit { display: block; margin: 1ex auto; }
175
+
174 176
 $tpl = new TemplatePower("../default_tpls/default.tpl");
175 177
 $tpl->assignInclude("header", "./../default_tpls/header.tpl");
176 178
 $tpl->assignInclude("footer", "./../default_tpls/footer.tpl");
... ...
@@ -208,13 +210,27 @@ switch ($_GET['step'])
208 210
 		else
209 211
 		{
210 212
 			$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\">
211
-			<div class='row'><label for='newpenname'>" . _PENNAME . ":</label> 
212
-			<input name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"" . $user['penname'] . "\"></div>
213
-		 	<div class='row'><label for='email'>" . _EMAIL . ":</label> <INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"" . $user['email'] .
214
-				"\" maxlength=\"200\"></div>
215
-			<div class='row'><label for='password'>" . _PASSWORD . ":</label>  <INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></div> 
216
-			<div class='row'><label for='password2'>" . _PASSWORD2 . ":</label> <INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></div>
217
-			<div style='text-align: center;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div></form>";
213
+			<table class='acp' style='margin: 0 auto;'>
214
+				<tr>
215
+					<td><label for='newpenname'>" . _PENNAME . ":</label></td>
216
+					<td><input name=\"newpenname\" type=\"text\" class=\"textbox\" maxlength=\"200\" value=\"" . $user['penname'] . "\"></td>
217
+				</tr>
218
+				<tr>
219
+					<td><label for='email'>" . _EMAIL . ":</label></td>
220
+					<td><INPUT  type=\"text\" class=\"textbox=\" name=\"email\" value=\"" . $user['email'] . "\"maxlength=\"200\"></td>
221
+				</tr>
222
+				<tr>
223
+					<td><label for='password'>" . _PASSWORD . ":</label></td>
224
+					<td><INPUT name=\"password\" class=\"textbox\" value=\"\" type=\"password\"></td>
225
+				</tr>
226
+				<tr>
227
+					<td><label for='password2'>" . _PASSWORD2 . ":</label></td>
228
+					<td><INPUT name=\"password2\" class=\"textbox=\" value=\"\" type=\"password\"></td>
229
+				</tr>
230
+			</table>
231
+			<div style='text-align: center; margin: 0.5em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
232
+			</div></form>
233
+			";
218 234
 		}
219 235
 		break;
220 236
 
... ...
@@ -1046,13 +1062,25 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1046 1062
 			else
1047 1063
 			{
1048 1064
 				$output .=
1049
-					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
1050
-						<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>
1051
-						<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>
1052
-						<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>
1053
-						<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>
1054
-						<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>
1055
-						<div><label for=\"language\">" . _LANGUAGE . ":</label> <select name=\"language\">";
1065
+					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 45%; margin: 1em auto;'>
1066
+						<table class='acp' style='margin: 0 auto;'>
1067
+							<tr>
1068
+								<td><label for='dbhost'>" . _DBHOST . "</label></td><td><input type='text'  name='dbhost' id='dbhost'" . (!empty($dbhost) ? "value='$dbhost'" : "value='localhost'") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBHOST . "</span></A></td>
1069
+							</tr>
1070
+							<tr>
1071
+								<td><label for='dbname'>" . _DBNAME . "</label></td><td><input type='text' name='dbname' id='dbname'" . (!empty($dbname) ? "value='$dbname'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBNAME . "</span></A></td>
1072
+							</tr>
1073
+							<tr>
1074
+								<td><label for='dbuser'>" . _DBUSER . "</label></td><td><input type='text' name='dbuser' id='dbuser'" . (!empty($dbuser) ? "value='$dbuser'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBUSER . "</span></A></td>
1075
+							</tr>
1076
+							<tr>
1077
+								<td><label for='dbpass'>" . _DBPASS . "</label></td><td><input type='password' name='dbpass' id='dbpass'" . (!empty($dbpass) ? "value='$dbpass'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_DBPASS . "</span></A></td>
1078
+							</tr>
1079
+							<tr>
1080
+								<td><label for='sitekey'>" . _SITEKEY . "</label></td><td><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></td>
1081
+							</tr>
1082
+							<tr>
1083
+								<td><label for=\"language\">" . _LANGUAGE . ":</label></td><td><select name=\"language\">";
1056 1084
 				$directory = opendir("../languages");
1057 1085
 				while ($filename = readdir($directory))
1058 1086
 				{
... ...
@@ -1063,9 +1091,12 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1063 1091
 				}
1064 1092
 				closedir($directory);
1065 1093
 				$output .=
1066
-					"</select> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_LANGUAGE . "</span></A></div>
1067
-						<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 />
1068
-						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
1094
+					"</select> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_LANGUAGE . "</span></A></td>
1095
+							</tr>
1096
+								<td><label for='settingsprefix'>" . _SETTINGSPREFIX . "</label></td><td><input type='text' name='settingsprefix' id='settingsprefix'" . (isset($settingsprefix) ? "value='$settingsprefix'" : "") . "> <A HREF=\"#\" class=\"pophelp\">[?]<span>" . _HELP_SETTINGSPREFIX . "</span></A></td>
1097
+							</tr>
1098
+							<tr><td colspan='2'><div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div></td></tr>
1099
+						</table>
1069 1100
 					</form>";
1070 1101
 			}
1071 1102
 		}
Browse code

Fix settings table column creation oversight with SMTP updates; also general consistency changes

Clarissa Walker authored on 2026/08/22 19:34:21
Showing 1 changed files
... ...
@@ -879,7 +879,9 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
879 879
 				$smtp_host = $_POST['newsmtp_host'];
880 880
 				$smtp_username = $_POST['newsmtp_username'];
881 881
 				$smtp_password = $_POST['newsmtp_password'];
882
-				$result = dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '" . SITEKEY . "'");
882
+				$smtp_port = $_POST['newsmtp_port'];
883
+				$smtp_secure = $_POST['newsmtp_secure'];
884
+				$result = dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password', smtp_port = '$smtp_port', smtp_secure = '$smtp_secure' WHERE sitekey = '" . SITEKEY . "'");
883 885
 				if ($result)
884 886
 				{
885 887
 					$output .= write_message(_ACTIONSUCCESSFUL);
... ...
@@ -952,6 +954,8 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
952 954
   `smtp_host` varchar(200) default NULL,
953 955
   `smtp_username` varchar(50) default NULL,
954 956
   `smtp_password` varchar(50) default NULL,
957
+  `smtp_port` varchar(5) NOT NULL default '',
958
+  `smtp_secure` varchar(3) NOT NULL default '',
955 959
   PRIMARY KEY  (`sitekey`)
956 960
 ) ENGINE=MyISAM;");
957 961
 					if ($settings) $output .= write_message("<img src=\"../images/check.gif\"> " . _SETTINGSTABLESUCCESS . " <br /><a href='install.php?step=2'>" . _CONTINUE . "</a>");
Browse code

php 8.1 fix

Jimako authored on 2024/06/19 13:42:06
Showing 1 changed files
... ...
@@ -22,6 +22,13 @@
22 22
 // ----------------------------------------------------------------------
23 23
 
24 24
 
25
+/**
26
+ * Revert PHP 8.1 mysqli default error mode
27
+ * @link https://github.com/php/php-src/blob/4025cf2875f895e9f7193cebb1c8efa4290d052e/UPGRADING#L101-L105
28
+ */
29
+mysqli_report(MYSQLI_REPORT_OFF);
30
+
31
+
25 32
 function random_char($string)
26 33
 {
27 34
 	$length = strlen($string);
Browse code

3.5.8.1 warnings, dbconnect, install changes

Jimako authored on 2024/05/09 06:30:39
Showing 1 changed files
... ...
@@ -105,6 +105,8 @@ else if (isset($_REQUEST['language']))
105 105
 else
106 106
 {
107 107
 	include("../config.php");
108
+	include("../includes/dbfunctions.php");
109
+
108 110
 	$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
109 111
 	$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
110 112
 	list($tableprefix, $language) = dbrow($settings);
... ...
@@ -824,9 +826,11 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
824 826
 
825 827
 	case "2";
826 828
 		include("../config.php");
829
+		include("../includes/dbfunctions.php");
827 830
 		if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
828 831
 		{
829
-			include("../config.php");
832
+			//include("../config.php");
833
+			//include("../includes/dbfunctions.php");
830 834
 			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
831 835
 			$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
832 836
 			list($tableprefix, $language) = dbrow($settings);
... ...
@@ -955,13 +959,14 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
955 959
 			{
956 960
 
957 961
 				$test = dbquery("SHOW TABLES");
958
-				if (!$test) $output .= write_message(_CONFIGFAILED);
962
+				if (!$test) $output .= write_message(_CONFIGFAILED. "(2)");
959 963
 				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>");
960 964
 			}
961 965
 		}
962 966
 		break;
963 967
 	default:
964 968
 		$output .= "<div id='pagetitle'>" . _CONFIGDATA . "</div>";
969
+
965 970
 		if (isset($_POST['submit']))
966 971
 		{
967 972
 			$dbhost = descript($_POST['dbhost']);
... ...
@@ -971,14 +976,16 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
971 976
 			$language = $_POST['language'];
972 977
 			$sitekey = descript($_POST['sitekey']);
973 978
 			$settingsprefix = descript($_POST['settingsprefix']);
974
-			$mysqli_access = mysqli_connect($dbhost, $dbuser, $dbpass);
979
+			$mysqli_access = @mysqli_connect($dbhost, $dbuser,$dbpass, $dbname);
980
+			 
975 981
 			if (!$mysqli_access)
976 982
 			{
977
-				$output .= write_message(_CONFIGFAILED);
983
+				$output .= write_message(_CONFIGFAILED . "(1)");
978 984
 			}
979 985
 		}
980 986
 		if (isset($_POST['submit']) && $mysqli_access)
981 987
 		{
988
+		
982 989
 			$handle = fopen("../config.php", 'w');
983 990
 			if (!$handle)
984 991
 			{
... ...
@@ -1003,10 +1010,13 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
1003 1010
 \$sitekey = \"$sitekey\";
1004 1011
 \$settingsprefix = \"$settingsprefix\";
1005 1012
 
1006
-include_once(\"includes/dbfunctions.php\");
1013
+?>";
1014
+
1015
+/* removed in 3.5.8 and moved to file: 
1016
+include(\"includes/dbfunctions.php\");
1007 1017
 if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbname);
1018
+*/
1008 1019
 
1009
-?>";
1010 1020
 				fwrite($handle, $text);
1011 1021
 				fclose($handle);
1012 1022
 				@chmod("../config.php", 0644);
... ...
@@ -1016,7 +1026,10 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1016 1026
 		}
1017 1027
 		else
1018 1028
 		{
1019
-			if (file_exists("../config.php") && !isset($mysqli_access)) include("../config.php");
1029
+			if (file_exists("../config.php") && !isset($mysqli_access)) {
1030
+				include("../config.php");
1031
+				include("../includes/dbfunctions.php");
1032
+			}
1020 1033
 			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
1021 1034
 			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
1022 1035
 			else
Browse code

fix for default value of IP fields (localhost)

Jimako authored on 2024/04/09 08:01:51
Showing 1 changed files
... ...
@@ -650,7 +650,7 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorprefs` (
650 650
   `log_id` int(11) NOT NULL auto_increment,
651 651
   `log_action` varchar(255) default NULL,
652 652
   `log_uid` int(11) NOT NULL,
653
-  `log_ip` VARBINARY(16) NOT NULL,
653
+  `log_ip` varbinary(16) DEFAULT NULL,
654 654
   `log_timestamp` int(10) unsigned NOT NULL default '0',
655 655
   `log_type` varchar(2) NOT NULL,
656 656
   PRIMARY KEY  (`log_id`)
Browse code

version 3.5.7

Jimako authored on 2024/04/08 12:21:57
Showing 1 changed files
... ...
@@ -650,7 +650,7 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorprefs` (
650 650
   `log_id` int(11) NOT NULL auto_increment,
651 651
   `log_action` varchar(255) default NULL,
652 652
   `log_uid` int(11) NOT NULL,
653
-  `log_ip` int(11) UNSIGNED default NULL,
653
+  `log_ip` VARBINARY(16) NOT NULL,
654 654
   `log_timestamp` int(10) unsigned NOT NULL default '0',
655 655
   `log_type` varchar(2) NOT NULL,
656 656
   PRIMARY KEY  (`log_id`)
Browse code

3.5.6 efiction version

Jimako authored on 2024/03/09 16:09:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,1052 @@
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
+{
46
+	foreach ($_POST as $var => $val)
47
+	{
48
+		$val = is_array($val) ? array_map('stripslashes', $val) : stripslashes($val);
49
+	}
50
+	foreach ($_GET as $var => $val)
51
+	{
52
+		$val = is_array($val) ? array_map('stripslashes', $val) : stripslashes($val);
53
+	}
54
+	foreach ($_COOKIE as $var => $val)
55
+	{
56
+		$val = is_array($val) ? array_map('stripslashes', $val) : stripslashes($val);
57
+	}
58
+}
59
+
60
+define("_BASEDIR", "../");
61
+define("_CHARSET", "utf-8");
62
+Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
63
+header("Pragma: no-cache");
64
+header("Expires: 0");
65
+
66
+$output = "";
67
+$language = "";
68
+
69
+include("../includes/class.TemplatePower.inc.php");
70
+
71
+/* PHP 8 fix - other way is separated LANs to smaller files */
72
+$allowed_tags = '';
73
+$recentdays = 7;
74
+$sitename = "";  // this breaks stuff in PHP 8.2 
75
+$url = "";
76
+$multiplecats = '';
77
+$minwords = '';
78
+$maxwords = '';
79
+$action = '';
80
+$pwdsetting = '';
81
+$imagewidth = '';
82
+$imageheight = '';
83
+$version = '';
84
+$user = array();
85
+$user['penname'] = '';
86
+$user['email'] = '';
87
+$penname = '';
88
+
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");
94
+}
95
+else if (isset($_REQUEST['language']))
96
+{
97
+	$language = $_REQUEST['language'];
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");
104
+}
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");
120
+}
121
+include(_BASEDIR . "includes/corefunctions.php");
122
+
123
+//  So I don't have to keep updating the version number in 3 different files.
124
+include("../version.php");
125
+
126
+//make a new TemplatePower object
127
+echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
128
+<html><head><title>eFiction {$version} Install</title>
129
+<style>
130
+LABEL { float: left; display: block; width: 45%; text-align: right; padding-right: 10px; clear: left;}
131
+.row { float: left; width: 99%; }
132
+#settingsform FORM { width: 80%; margin; 0 auto; }
133
+#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
134
+#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
135
+#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
136
+#settingsform .tinytoggle { text-align: center; }
137
+#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
138
+#settingsform #submit { display: block; margin: 1ex auto; }
139
+a.pophelp{
140
+    position: relative; /* this is the key*/
141
+    z-index:24;
142
+    vertical-align: super;
143
+    text-decoration: none;
144
+}
145
+
146
+a.pophelp:hover{z-index:100; border: none; text-decoration: none;}
147
+
148
+a.pophelp span{display: none; position: absolute; text-decoration: none;}
149
+
150
+a.pophelp:hover span{ /*the span will display just on :hover state*/
151
+    display:block;
152
+    position: absolute;
153
+    top: 0; left: 8em; width: 225px;
154
+    border:1px solid #000;
155
+    background-color:#CCC; color:#000;
156
+    text-decoration: none;
157
+    text-align: left;
158
+    padding: 5px;
159
+    font-weight: normal;
160
+}
161
+.required { color: red; }
162
+</style>
163
+<link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
164
+
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();
169
+$tpl->newBlock("header");
170
+$tpl->assign("sitename", "eFiction $version Install");
171
+$tpl->gotoBlock("_ROOT");
172
+$tpl->newBlock("footer");
173
+$tpl->assign("footer", "eFiction $version &copy; 2007. <a href='http://efiction.org/'>http://efiction.org/</a>");
174
+$tpl->gotoBlock("_ROOT");
175
+
176
+if (!isset($_GET['step']))  $_GET['step'] = 0;
177
+switch ($_GET['step'])
178
+{
179
+	case "9":
180
+		if (isset($_POST['submit']))
181
+		{
182
+			$penname = descript($_POST['newpenname']);
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']);
187
+			else $fail =  write_message(_PASSWORDTWICE);
188
+			if (!isset($fail))
189
+			{
190
+				$result = dbquery("INSERT INTO " . $tableprefix . "fanfiction_authors(`penname`, `email`, `password`, `date`) VALUES('$penname', '" . $_POST['email'] . "', '$encryptpassword', '" . time() . "')");
191
+				define("USERUID", dbinsertid());
192
+				$skinquery = dbquery("SELECT skin FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . SITEKEY . "'");
193
+				list($skin) = dbrow($skinquery);
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!");
196
+			}
197
+			else $output .= $fail;
198
+		}
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>";
209
+		}
210
+		break;
211
+
212
+	case "8":
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');
228
+				$fields[] = array('2', 'gender', 'Gender', 'male|#|female|#|undisclosed', '', '', 0);
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>";
236
+				}
237
+				$output .= "</table>";
238
+				$output .= write_message(_FIELDAUTOFAIL . "<br /><br /> <a href='install.php?step=9'>" . _CONTINUE . "</a>");
239
+			}
240
+			else
241
+			{
242
+				$output .= write_message(_FIELDMANUAL . "<br /><br /><a href='install.php?step=9'>" . _CONTINUE . "</a>");
243
+			}
244
+		}
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;
247
+	case "7":
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>";
272
+				$output .= "</table>";
273
+				$output .= write_message(_MESSAGEAUTOFAILUPGRADE . "<br /><br /> <a href='install.php?step=8'>" . _CONTINUE . "</a>");
274
+			}
275
+			else
276
+			{
277
+				$output .= write_message(_MESSAGEMANUAL . "<br /><br /><a href='install.php?step=8'>" . _CONTINUE . "</a>");
278
+			}
279
+		}
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>");
281
+
282
+		break;
283
+	case "6":
284
+		$output .= "<div id='pagetitle'>" . _BLOCKDATA . "</div>";
285
+		if (isset($_GET['install']))
286
+		{
287
+			if ($_GET['install'] == "automatic")
288
+			{
289
+				$blocklist = array(
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\";}")
299
+				);
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>";
305
+				}
306
+				$output .= "</table>";
307
+				$output .= write_message(_BLOCKDATAFAILUPGRADE . "<br /><br /><a href='install.php?step=7'>" . _CONTINUE . "</a>");
308
+			}
309
+			else
310
+			{
311
+				$output .= write_message(_BLOCKDATAMANUAL . "<br /><br /><a href='install.php?step=6'>" . _CONTINUE . "</a>");
312
+			}
313
+		}
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;
316
+	case "5":
317
+		$output .= "<div id='pagetitle'>" . _LINKDATA . "</div>";
318
+		if (isset($_GET['install']))
319
+		{
320
+			if ($_GET['install'] == "automatic")
321
+			{
322
+				$pagelist = array(
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"),
348
+					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
349
+				);
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>";
355
+				}
356
+
357
+				$output .= "</table>";
358
+				$output .= write_message(_LINKAUTOFAIL . "<br /><br /> <a href='install.php?step=6'>" . _CONTINUE . "</a>");
359
+			}
360
+			else
361
+			{
362
+				$output .= write_message(_LINKMANUAL . "<br /><br /><a href='install.php?step=5'>" . _CONTINUE . "</a>");
363
+			}
364
+		}
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;
367
+	case "4":
368
+		$output .= "<div id='pagetitle'>" . _PANELDATA . "</div>";
369
+		if (isset($_GET['install']))
370
+		{
371
+			if ($_GET['install'] == "automatic")
372
+			{
373
+
374
+				$panellist = array(
375
+					array("submitted", "Submissions", "", "3", "5", "0", "A"),
376
+					array("versioncheck", "Version Check", "", "3", "7", "0", "A"),
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"),
425
+					array("series", "Series", "", "0", "4", "0", "B"),
426
+					array("viewlog", "Action Log", "", "1", "8", "0", "A"),
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"),
447
+					array("skins", "Skins", "", "3", "6", "0", "A"),
448
+					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
449
+					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
450
+					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
451
+					array('modules', 'Modules', '', 1, "11", 0, 'A')
452
+				);
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
+				{
456
+					unset($panels);
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>";
459
+				}
460
+				$output .= "</table>";
461
+				$output .= write_message(_PANELAUTOFAIL . "<br /><br /><a href='install.php?step=5'>" . _CONTINUE . "</a>");
462
+			}
463
+			else
464
+			{
465
+				$output .= write_message(_PANELMANUAL . "<br /><br /><a href='install.php?step=5'>" . _CONTINUE . "</a>");
466
+			}
467
+		}
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;
470
+	case "3":
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` (
478
+  `field_id` int(11) NOT NULL AUTO_INCREMENT,
479
+  `field_type` tinyint(4) NOT NULL default '0',
480
+  `field_name` varchar(30) NOT NULL default ' ',
481
+  `field_title` varchar(255) NOT NULL default ' ',
482
+  `field_options` text,
483
+  `field_code_in` text,
484
+  `field_code_out` text,
485
+  `field_on` tinyint(1) NOT NULL default '0',
486
+  PRIMARY KEY  (`field_id`)
487
+) ENGINE=MyISAM;");
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` (
490
+  `uid` int(11) NOT NULL default '0',
491
+  `field` int(11) NOT NULL default '0',
492
+  `info` varchar(255) NOT NULL default ' ',
493
+  PRIMARY KEY  (`uid`,`field`),
494
+  KEY `uid` (`uid`)) ENGINE=MyISAM;");
495
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_authorinfo</td><td align='center'>" . ($authorinfo ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
496
+				$authorprefs = dbquery("
497
+CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_authorprefs` (
498
+  `uid` int(11) NOT NULL default '0',
499
+  `newreviews` tinyint(1) NOT NULL default '0',
500
+  `newrespond` tinyint(1) NOT NULL default '0',
501
+  `ageconsent` tinyint(1) NOT NULL default '0',
502
+  `alertson` tinyint(1) NOT NULL default '0',
503
+  `tinyMCE` tinyint(1) NOT NULL default '0',
504
+  `sortby` tinyint(1) NOT NULL default '0',
505
+  `storyindex` tinyint(1) NOT NULL default '0',
506
+  `validated` tinyint(1) NOT NULL default '0',
507
+  `userskin` varchar(60) NOT NULL default 'default',
508
+  `level` tinyint(1) NOT NULL default '0',
509
+  `categories` varchar(200) NOT NULL default '0',
510
+  `contact` tinyint(1) NOT NULL default '0',
511
+  `stories` int(11) NOT NULL default '0',
512
+  PRIMARY KEY  (`uid`)
513
+) ENGINE=MyISAM;");
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` (
516
+  `uid` int(11) NOT NULL auto_increment,
517
+  `penname` varchar(200) NOT NULL default '',
518
+  `realname` varchar(200) NOT NULL default '',
519
+  `email` varchar(200) NOT NULL default '',
520
+  `bio` text NULL,
521
+  `image` varchar(200) NOT NULL default '',
522
+  `date`int(10) unsigned NOT NULL default '0',
523
+  `admincreated` char(1) NOT NULL default '0',
524
+  `password` varchar(40) NOT NULL default '0',
525
+  PRIMARY KEY  (`uid`),
526
+  KEY `penname` (`penname`),
527
+  KEY `admincreated` (`admincreated`)
528
+) ENGINE=MyISAM;");
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` (
531
+  `block_id` int(11) NOT NULL auto_increment,
532
+  `block_name` varchar(30) NOT NULL default '',
533
+  `block_title` varchar(150) NOT NULL default '',
534
+  `block_file` varchar(200) NOT NULL default '',
535
+  `block_status` tinyint(1) NOT NULL default '0',
536
+  `block_variables` text NOT NULL,
537
+  PRIMARY KEY  (`block_id`),
538
+  KEY `block_name` (`block_name`)
539
+) ENGINE=MyISAM;");
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` (
542
+  `catid` int(11) NOT NULL auto_increment,
543
+  `parentcatid` int(11) NOT NULL default '-1',
544
+  `category` varchar(60) NOT NULL default '',
545
+  `description` text NOT NULL,
546
+  `image` varchar(100) NOT NULL default '',
547
+  `locked` char(1) NOT NULL default '0',
548
+  `leveldown` tinyint(4) NOT NULL default '0',
549
+  `displayorder` int(11) NOT NULL default '0',
550
+  `numitems` int(11) NOT NULL default '0',
551
+  PRIMARY KEY  (`catid`),
552
+  KEY `byparent` (`parentcatid`,`displayorder`)
553
+) ENGINE=MyISAM;");
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` (
556
+  `chapid` int(11) NOT NULL auto_increment,
557
+  `title` varchar(250) NOT NULL default '',
558
+  `inorder` int(11) NOT NULL default '0',
559
+  `notes` text NULL,
560
+  `storytext` text NULL,
561
+  `endnotes` text NULL,
562
+  `validated` char(1) NOT NULL default '0',
563
+  `wordcount` int(11) NOT NULL default '0',
564
+  `rating` tinyint(4) NOT NULL default '0',
565
+  `reviews` smallint(6) NOT NULL default '0',
566
+  `sid` int(11) NOT NULL default '0',
567
+  `uid` int(11) NOT NULL default '0',
568
+  `count` int(11) NOT NULL default '0',
569
+  PRIMARY KEY  (`chapid`),
570
+  KEY `sid` (`sid`),
571
+  KEY `uid` (`uid`),
572
+  KEY `inorder` (`inorder`),
573
+  KEY `title` (`title`),
574
+  KEY `validated` (`validated`),
575
+  KEY `forstoryblock` (`sid`,`validated`)
576
+) ENGINE=MyISAM;");
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` (
579
+  `charid` int(11) NOT NULL auto_increment,
580
+  `catid` int(11) NOT NULL default '0',
581
+  `charname` varchar(60) NOT NULL default '',
582
+  `bio` text NOT NULL,
583
+  `image` varchar(200) NOT NULL default '',
584
+  PRIMARY KEY  (`charid`),
585
+  KEY `catid` (`catid`),
586
+  KEY `charname` (`charname`)
587
+) ENGINE=MyISAM;");
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` (
590
+  `class_id` int(11) NOT NULL auto_increment,
591
+  `class_type` int(11) NOT NULL default '0',
592
+  `class_name` varchar(100) NOT NULL default '',
593
+  PRIMARY KEY  (`class_id`),
594
+  KEY `byname` (`class_type`,`class_name`,`class_id`)
595
+) ENGINE=MyISAM;");
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` (
598
+  `classtype_id` int(11) NOT NULL auto_increment,
599
+  `classtype_name` varchar(50) NOT NULL default '',
600
+  `classtype_title` varchar(50) NOT NULL default '',
601
+  PRIMARY KEY  (`classtype_id`),
602
+  UNIQUE KEY `classtype_name` (`classtype_name`)
603
+) ENGINE=MyISAM;");
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` (
606
+  `sid` int(11) NOT NULL default '0',
607
+  `uid` int(11) NOT NULL default '0',
608
+  PRIMARY KEY  (`sid`,`uid`)
609
+) ENGINE=MyISAM;");
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` (
612
+  `code_id` int(11) NOT NULL auto_increment,
613
+  `code_text` text NOT NULL,
614
+  `code_type` varchar(20) default NULL,
615
+  `code_module` varchar(60) default NULL,
616
+  PRIMARY KEY  (`code_id`),
617
+  KEY `code_type` (`code_type`)
618
+) ENGINE=MyISAM;");
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` (
621
+  `cid` int(11) NOT NULL auto_increment,
622
+  `nid` int(11) NOT NULL default '0',
623
+  `uid` int(11) NOT NULL default '0',
624
+  `comment` text NOT NULL,
625
+  `time` int(10) unsigned NOT NULL default '0',
626
+  PRIMARY KEY  (`cid`),
627
+  KEY `commentlist` (`nid`,`time`)
628
+) ENGINE=MyISAM;");
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` (
631
+  `uid` int(11) NOT NULL default '0',
632
+  `item` int(11) NOT NULL default '0',
633
+  `type` char(2) NOT NULL default '',
634
+  `comments` text NOT NULL,
635
+  UNIQUE KEY `byitem` (`item`,`type`,`uid`),
636
+  UNIQUE KEY `byuid` (`uid`,`type`,`item`)
637
+) ENGINE=MyISAM;");
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` (
640
+  `seriesid` int(11) NOT NULL default '0',
641
+  `sid` int(11) NOT NULL default '0',
642
+  `subseriesid` int(11) NOT NULL default '0',
643
+  `confirmed` int(11) NOT NULL default '0',
644
+  `inorder` int(11) NOT NULL default '0',
645
+  PRIMARY KEY  (`sid`,`seriesid`, `subseriesid`),
646
+  KEY `seriesid` (`seriesid`,`inorder`)
647
+) ENGINE=MyISAM;");
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` (
650
+  `log_id` int(11) NOT NULL auto_increment,
651
+  `log_action` varchar(255) default NULL,
652
+  `log_uid` int(11) NOT NULL,
653
+  `log_ip` int(11) UNSIGNED default NULL,
654
+  `log_timestamp` int(10) unsigned NOT NULL default '0',
655
+  `log_type` varchar(2) NOT NULL,
656
+  PRIMARY KEY  (`log_id`)
657
+) ENGINE=MyISAM");
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` (
660
+  `message_id` int(11) NOT NULL auto_increment,
661
+  `message_name` varchar(50) NOT NULL default '',
662
+  `message_title` varchar(200) NOT NULL default '',
663
+  `message_text` text NOT NULL,
664
+  PRIMARY KEY  (`message_id`),
665
+  KEY `message_name` (`message_name`)
666
+) ENGINE=MyISAM;");
667
+				$output .= "<tr><td>" . $tableprefix . "fanfiction_messages</td><td align='center'>" . ($messages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") . "</td></tr>";
668
+				$modules = dbquery("
669
+CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
670
+  `id` int(11) NOT NULL auto_increment,
671
+  `name` varchar(100) NOT NULL default 'Test Module',
672
+  `version` varchar(10) NOT NULL default '1.0',
673
+  PRIMARY KEY  (`id`),
674
+  KEY `name_version` (`name`,`version`)
675
+)");
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` (
678
+  `nid` int(11) NOT NULL auto_increment,
679
+  `author` varchar(60) NOT NULL default '',
680
+  `title` varchar(255) NOT NULL default '',
681
+  `story` text NOT NULL,
682
+  `time` int(10) unsigned NOT NULL default '0',
683
+  `comments` INT NOT NULL DEFAULT '0',
684
+  PRIMARY KEY  (`nid`)
685
+) ENGINE=MyISAM;");
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` (
688
+  `link_id` int(11) NOT NULL auto_increment,
689
+  `link_name` varchar(50) NOT NULL default '',
690
+  `link_text` varchar(100) NOT NULL default '',
691
+  `link_key` CHAR( 1 ) NULL,
692
+  `link_url` varchar(250) NOT NULL default '',
693
+  `link_target` char(1) NOT NULL default '0',
694
+  `link_access` tinyint(4) NOT NULL default '0',
695
+  PRIMARY KEY  (`link_id`),
696
+  KEY `link_name` (`link_name`)
697
+) ENGINE=MyISAM;");
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` (
700
+  `panel_id` int(11) NOT NULL auto_increment,
701
+  `panel_name` varchar(50) NOT NULL default 'unknown',
702
+  `panel_title` varchar(100) NOT NULL default 'Unnamed Panel',
703
+  `panel_url` varchar(100) default NULL,
704
+  `panel_level` tinyint(4) NOT NULL default '3',
705
+  `panel_order` tinyint(4) NOT NULL default '0',
706
+  `panel_hidden` tinyint(1) NOT NULL default '0',
707
+  `panel_type` varchar(20) NOT NULL default 'A',
708
+  PRIMARY KEY  (`panel_id`),
709
+  KEY `panel_type` (`panel_type`,`panel_name`)
710
+) ENGINE=MyISAM;");
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` (
713
+  `rid` int(11) NOT NULL auto_increment,
714
+  `rating` varchar(60) NOT NULL default '',
715
+  `ratingwarning` char(1) NOT NULL default '0',
716
+  `warningtext` text NOT NULL,
717
+  PRIMARY KEY  (`rid`),
718
+  KEY `rating` (`rating`)
719
+) ENGINE=MyISAM;");
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` (
722
+  `reviewid` int(11) NOT NULL auto_increment,
723
+  `item` int(11) NOT NULL default '0',
724
+  `chapid` int(11) NOT NULL default '0',
725
+  `reviewer` varchar(60) NOT NULL default '0',
726
+  `uid` int(11) NOT NULL default '0',
727
+  `review` text NOT NULL,
728
+  `date`int(10) unsigned NOT NULL default '0',
729
+  `rating` int(11) NOT NULL default '0',
730
+  `respond` char(1) NOT NULL default '0',
731
+  `type` char(2) NOT NULL default '',
732
+  PRIMARY KEY  (`reviewid`),
733
+  KEY `chapid` (`chapid`),
734
+  KEY `rating` (`rating`),
735
+  KEY `respond` (`respond`),
736
+  KEY `avgrating` (`type`,`item`,`rating`),
737
+  KEY `bychapter` (`chapid`,`rating`),
738
+  KEY `byuid` (`uid`,`item`,`type`)
739
+) ENGINE=MyISAM;");
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` (
742
+  `seriesid` int(11) NOT NULL auto_increment,
743
+  `title` varchar(200) NOT NULL default '',
744
+  `summary` text NOT NULL,
745
+  `uid` int(11) NOT NULL default '0',
746
+  `isopen` tinyint(4) NOT NULL default '0',
747
+  `catid` varchar(200) NOT NULL default '0',
748
+  `rating` tinyint(4) NOT NULL default '0',
749
+  `classes` varchar(200) NOT NULL default '',
750
+  `characters` varchar(250) NOT NULL default '',
751
+  `reviews` smallint(6) NOT NULL default '0',
752
+  `numstories` INT NOT NULL DEFAULT '0',
753
+  `challenges` varchar(200) NOT NULL default '',
754
+  PRIMARY KEY  (`seriesid`),
755
+  KEY `catid` (`catid`),
756
+  KEY `characters` (`characters`),
757
+  KEY `classes` (`classes`),
758
+  KEY `owner` (`uid`,`title`)
759
+) ENGINE=MyISAM;");
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` (
762
+  `sitekey` varchar(50) NOT NULL default '0',
763
+  `stories` int(11) NOT NULL default '0',
764
+  `chapters` int(11) NOT NULL default '0',
765
+  `series` int(11) NOT NULL default '0',
766
+  `reviews` int(11) NOT NULL default '0',
767
+  `wordcount` int(11) NOT NULL default '0',
768
+  `authors` int(11) NOT NULL default '0',
769
+  `members` int(11) NOT NULL default '0',
770
+  `reviewers` int(11) NOT NULL default '0',
771
+  `newestmember` int(11) NOT NULL default '0'
772
+) ENGINE=MyISAM");
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` (
776
+  `sid` int(11) NOT NULL auto_increment,
777
+  `title` varchar(200) NOT NULL default 'Untitled',
778
+  `summary` text NULL,
779
+  `storynotes` text NULL,
780
+  `catid` varchar(100) NOT NULL default '0',
781
+  `classes` varchar(200) NOT NULL default '0',
782
+  `charid` varchar(250) NOT NULL default '0',
783
+  `rid` varchar(25) NOT NULL default '0',
784
+  `date` int(10) unsigned NOT NULL default '0',
785
+  `updated` int(10) unsigned NOT NULL default '0',
786
+  `uid` int(11) NOT NULL default '0',
787
+  `coauthors` tinyint(1) NOT NULL default '0',
788
+  `featured` char(1) NOT NULL default '0',
789
+  `validated` char(1) NOT NULL default '0',
790
+  `completed` char(1) NOT NULL default '0',
791
+  `rr` char(1) NOT NULL default '0',
792
+  `wordcount` int(11) NOT NULL default '0',
793
+  `rating` tinyint(4) NOT NULL default '0',
794
+  `reviews` smallint(6) NOT NULL default '0',
795
+  `count` int(11) NOT NULL default '0',
796
+  PRIMARY KEY  (`sid`),
797
+  KEY `title` (`title`),
798
+  KEY `catid` (`catid`),
799
+  KEY `charid` (`charid`),
800
+  KEY `rid` (`rid`),
801
+  KEY `uid` (`uid`),
802
+  KEY `featured` (`featured`),
803
+  KEY `completed` (`completed`),
804
+  KEY `rr` (`rr`),
805
+  KEY `validateduid` (`validated`,`uid`),
806
+  KEY `recent` (`updated`,`validated`)
807
+) ENGINE=MyISAM;");
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>");
811
+			}
812
+			else if ($_GET['install'] == "manual")
813
+			{
814
+				$output .= write_message(_TABLESMANUAL . "<br /><br /><a href='install.php?step=3'>" . _CONTINUE . "</a>");
815
+			}
816
+		}
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>");
821
+		}
822
+
823
+		break;
824
+
825
+	case "2";
826
+		include("../config.php");
827
+		if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
828
+		{
829
+			include("../config.php");
830
+			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
831
+			$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
832
+			list($tableprefix, $language) = dbrow($settings);
833
+
834
+			if ($tableprefix == '') $tableprefix = $settingsprefix;
835
+
836
+			define("TABLEPREFIX", $tableprefix);
837
+			define("SITEKEY", $sitekey);
838
+
839
+			$sect = isset($_GET['sect']) ? $_GET['sect'] : "main";
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 . "'");
845
+			}
846
+			$settings = dbassoc($settingsresults);
847
+			foreach ($settings as $var => $val)
848
+			{
849
+				$$var = $val;
850
+			}
851
+			if ($sect == "submissions")
852
+			{
853
+				if (isset($_POST['submit']))
854
+				{
855
+					$storiespath = descript($_POST['newstoriespath']);
856
+					if (!file_exists($storiespath) && !file_exists("../" . $storiespath))
857
+					{
858
+						if (!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
859
+						mkdir("$storiespath", 0755);
860
+						@chmod("$storiespath", 0777);
861
+						if (substr(sprintf('%o', @fileperms("../" . $storiespath)), -4) != "0777") $output .= write_message(_STORIESPATHNOTWRITABLE);
862
+					}
863
+				}
864
+			}
865
+			if ($sect == "email" && isset($_POST['submit']))
866
+			{
867
+				$output .= "<div id=\"pagetitle\">" . _SETTINGS . "</div>";
868
+				$smtp_host = $_POST['newsmtp_host'];
869
+				$smtp_username = $_POST['newsmtp_username'];
870
+				$smtp_password = $_POST['newsmtp_password'];
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
+				{
874
+					$output .= write_message(_ACTIONSUCCESSFUL);
875
+					$output .= write_message("<a href='install.php?step=3'>" . _CONTINUE . "</a>");
876
+				}
877
+				else include("../admin/settings.php");
878
+			}
879
+			else include("../admin/settings.php");
880
+		}
881
+		else
882
+		{
883
+			if (isset($_GET['install']))
884
+			{
885
+				if ($_GET['install'] == "automatic")
886
+				{
887
+
888
+					$settings = dbquery("CREATE TABLE IF NOT EXISTS `" . $settingsprefix . "fanfiction_settings` (
889
+  `sitekey` varchar(50) NOT NULL default '1',
890
+  `sitename` varchar(200) NOT NULL default 'Your Site',
891
+  `slogan` varchar(200) NOT NULL default 'It''s a cool site!',
892
+  `url` varchar(200) NOT NULL default 'http://www.yoursite.com',
893
+  `siteemail` varchar(200) NOT NULL default 'you@yoursite.com',
894
+  `tableprefix` varchar(50) NOT NULL default '',
895
+  `skin` varchar(50) NOT NULL default 'default',
896
+  `hiddenskins` varchar(255) default '',
897
+  `language` varchar(10) NOT NULL default 'en',
898
+  `submissionsoff` tinyint(1) NOT NULL default '0',
899
+  `storiespath` varchar(20) NOT NULL default 'stories',
900
+  `store` varchar(5) NOT NULL default 'files',
901
+  `autovalidate` tinyint(1) NOT NULL default '0',
902
+  `coauthallowed` int(1) NOT NULL default '0',
903
+  `maxwords` int(11) NOT NULL default '0',
904
+  `minwords` int(11) NOT NULL default '0',
905
+  `imageupload` tinyint(1) NOT NULL default '0',
906
+  `imageheight` int(11) NOT NULL default '200',
907
+  `imagewidth` int(11) NOT NULL default '200',
908
+  `roundrobins` tinyint(1) NOT NULL default '0',
909
+  `allowseries` tinyint(4) NOT NULL default '2',
910
+  `tinyMCE` tinyint(1) NOT NULL default '0',
911
+  `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
912
+  `favorites` tinyint(1) NOT NULL default '0',
913
+  `multiplecats` tinyint(1) NOT NULL default '0',
914
+  `newscomments` tinyint(1) NOT NULL default '0',
915
+  `logging` tinyint(1) NOT NULL default '0',
916
+  `maintenance` tinyint(1) NOT NULL default '0',
917
+  `debug` tinyint(1) NOT NULL default '0',
918
+  `captcha` tinyint(1) NOT NULL default '0',
919
+  `dateformat` varchar(20) NOT NULL default 'd/m/y',
920
+  `timeformat` varchar(20) NOT NULL default '- h:i a',
921
+  `recentdays` tinyint(2) NOT NULL default '7',
922
+  `displaycolumns` tinyint(1) NOT NULL default '1',
923
+  `itemsperpage` tinyint(2) NOT NULL default '25',
924
+  `extendcats` tinyint(1) NOT NULL default '0',
925
+  `displayindex` tinyint(1) NOT NULL default '0',
926
+  `defaultsort` tinyint(1) NOT NULL default '0',
927
+  `displayprofile` tinyint(1) NOT NULL default '0',
928
+  `linkstyle` tinyint(1) NOT NULL default '0',
929
+  `linkrange` tinyint(2) NOT NULL default '5',
930
+  `reviewsallowed` tinyint(1) NOT NULL default '0',
931
+  `ratings` tinyint(1) NOT NULL default '0',
932
+  `anonreviews` tinyint(1) NOT NULL default '0',
933
+  `revdelete` tinyint(1) NOT NULL default '0',
934
+  `rateonly` tinyint(1) NOT NULL default '0',
935
+  `pwdsetting` tinyint(1) NOT NULL default '0',
936
+  `alertson` tinyint(1) NOT NULL default '0',
937
+  `disablepopups` tinyint(1) NOT NULL default '0',
938
+  `agestatement` tinyint(1) NOT NULL default '0',
939
+  `words` text,
940
+  `version` varchar(10) NOT NULL default '" . $version . "',
941
+  `smtp_host` varchar(200) default NULL,
942
+  `smtp_username` varchar(50) default NULL,
943
+  `smtp_password` varchar(50) default NULL,
944
+  PRIMARY KEY  (`sitekey`)
945
+) ENGINE=MyISAM;");
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>");
948
+				}
949
+				else
950
+				{
951
+					$output .= write_message(_SETTINGSTABLEMANUAL . "<br /><br /><a href='install.php?step=2'>" . _CONTINUE . "</a>");
952
+				}
953
+			}
954
+			else
955
+			{
956
+
957
+				$test = dbquery("SHOW TABLES");
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>");
960
+			}
961
+		}
962
+		break;
963
+	default:
964
+		$output .= "<div id='pagetitle'>" . _CONFIGDATA . "</div>";
965
+		if (isset($_POST['submit']))
966
+		{
967
+			$dbhost = descript($_POST['dbhost']);
968
+			$dbname = descript($_POST['dbname']);
969
+			$dbuser = descript($_POST['dbuser']);
970
+			$dbpass = descript($_POST['dbpass']);
971
+			$language = $_POST['language'];
972
+			$sitekey = descript($_POST['sitekey']);
973
+			$settingsprefix = descript($_POST['settingsprefix']);
974
+			$mysqli_access = mysqli_connect($dbhost, $dbuser, $dbpass);
975
+			if (!$mysqli_access)
976
+			{
977
+				$output .= write_message(_CONFIGFAILED);
978
+			}
979
+		}
980
+		if (isset($_POST['submit']) && $mysqli_access)
981
+		{
982
+			$handle = fopen("../config.php", 'w');
983
+			if (!$handle)
984
+			{
985
+				@chmod("../config.php", 0666);
986
+				$handle = fopen("../config.php", 'w');
987
+			}
988
+			if ($handle)
989
+			{
990
+				$dbhost = descript($_POST['dbhost']);
991
+				$dbname = descript($_POST['dbname']);
992
+				$dbuser = descript($_POST['dbuser']);
993
+				$dbpass = descript($_POST['dbpass']);
994
+				$sitekey = descript($_POST['sitekey']);
995
+				if (empty($sitekey)) $sitekey = random_string($randomcharset, 10);
996
+				$language = $_POST['language'];
997
+				$settingsprefix = descript($_POST['settingsprefix']);
998
+				$text = "<?php 
999
+\$dbhost = \"$dbhost\";
1000
+\$dbname = \"$dbname\";
1001
+\$dbuser= \"$dbuser\";
1002
+\$dbpass = \"$dbpass\";
1003
+\$sitekey = \"$sitekey\";
1004
+\$settingsprefix = \"$settingsprefix\";
1005
+
1006
+include_once(\"includes/dbfunctions.php\");
1007
+if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbname);
1008
+
1009
+?>";
1010
+				fwrite($handle, $text);
1011
+				fclose($handle);
1012
+				@chmod("../config.php", 0644);
1013
+				$output .= write_message(_CONFIGSUCCESS . "<br /><br /><a href='install.php?step=2&amp;language=$language'>" . _CONTINUE . "</a>");
1014
+			}
1015
+			else $output .= write_message(_ERROR_CONFIGWRITE);
1016
+		}
1017
+		else
1018
+		{
1019
+			if (file_exists("../config.php") && !isset($mysqli_access)) include("../config.php");
1020
+			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
1021
+			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
1022
+			else
1023
+			{
1024
+				$output .=
1025
+					"<form method='POST' enctype='multipart/form-data' action='install.php?step=1' class='tblborder' style='width: 350px; margin: 1em auto;'>
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\">";
1032
+				$directory = opendir("../languages");
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>";
1039
+				}
1040
+				closedir($directory);
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 />
1044
+						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
1045
+					</form>";
1046
+			}
1047
+		}
1048
+}
1049
+$tpl->assign("output", $output);
1050
+
1051
+$tpl->printToScreen();
1052
+if (isset($_GET['step']) && $_GET['step'] > 2) dbclose();