Browse code

new start point for integration

Jimmi08 authored on 2021/08/26 05:42:52
Showing 8 changed files
... ...
@@ -41,27 +41,26 @@ rename to searching.php for efiction
41 41
 
42 42
 ### news.php
43 43
 
44
-removed
44
+renamed to ffnews.php for efiction
45 45
 
46 46
 ### index.php
47
-e107 has to be used
48
-- added recent menu to e107 menus
49 47
 
50
-- if you use it (you can), it will be overriden with e107 github sync, so just have backup
48
+- with efiction and e107 on the same level, only one can be used. e107 index.php is recommended because possibility of github synchronization. 
49
+- it could be renamed to efiction.php  
51 50
 
52 51
 ### contact.php
53 52
 
54
-file can't be deleted because reporting 
53
+renamed to report.php
55 54
 
56
-Just notes: 
55
+## Other changes
57 56
 
58
-## Replaced functionality (it is already inbuilt in e107)
57
+Deleted docs. Content was moved to:
58
+
59
+https://docs.e107sk.com/efiction-3-5-5/
60
+
61
+Deleted bridges. 
62
+e107 Alt Auth plugin is better alternative.
59 63
 
60
-* Welcome message - delete from panels
61
-* PHP info - delete from panels
62
-* Custom pages - delete from panels
63 64
 
64
-## Moved admin functionality 
65 65
 
66
-* Custom pages (messages)  - efiction plugin, {FANFICTION_MESSAGES=message_name} for using in themes
67 66
 
68 67
deleted file mode 100644
... ...
@@ -1,49 +0,0 @@
1
-This folder contains the default files for connecting to the default author
2
-table for eFiction.  
3
-
4
-They are included here as a backup in case you need 
5
-to restore from a failed bridge.
6
-
7
-This bridge can be used only for efiction installed as the subdirectory of e107 site
8
-
9
-1. add 
10
-`@ include_once(_BASEDIR.UN_FULLAPP_PATH."class2.php");
11
-
12
-Note: Full path is important because modules, example:
13
-`define("UN_FULLAPP_PATH", "../");`
14
-
15
-after 
16
-`@ include_once(_BASEDIR."config.php");`
17
-
18
-- you can't add this directly in config.php, because than ajax will stop to work
19
-
20
-`UN_FULLAPP_PATH` is constant defined in config.php - path to your e107 installation .  
21
-
22
-2.  replace files from this directory
23
-
24
-queries.php -  allows to use e107 user table as authors
25
-
26
-get_session_vars.php - allows to use e107 constants to detect if user is logged or not.  Thanks installation in subdirectory, all cookies/sessions are available for efiction site too.
27
-
28
-using class2.php allows use any e107 feature inside efiction script
29
-
30
-3. change paths in panels for login, signup and user info to e107 urls
31
-
32
-if your e107 use the same theme as efiction, user will not notice difference
33
-
34
-
35
-
36
-## Way how to load e107 theme
37
-(to have css in one place and use e107 caching)
38
-
39
-`$cssId =  "theme_css";`
40
-`$e_js->renderJs($cssId, false, 'css', false);`
41
-`$e_js->renderCached('css');`
42
-
43
-- removed all css from header.php
44
-
45
-## User Profile Settings
46
-- add panel with /user/settings 
47
-- use modified editbio.php to remove account related info (name, password, email)
48
-
49
-
50 0
deleted file mode 100644
... ...
@@ -1,126 +0,0 @@
1
-<?php
2
-// ----------------------------------------------------------------------
3
-// eFiction 3.2
4
-// Copyright (c) 2007 by Tammy Keefer
5
-// Valid HTML 4.01 Transitional
6
-// Based on eFiction 1.1
7
-// Copyright (C) 2003 by Rebecca Smallwood.
8
-// http://efiction.sourceforge.net/
9
-// ----------------------------------------------------------------------
10
-// LICENSE
11
-//
12
-// This program is free software; you can redistribute it and/or
13
-// modify it under the terms of the GNU General Public License (GPL)
14
-// as published by the Free Software Foundation; either version 2
15
-// of the License, or (at your option) any later version.
16
-//
17
-// This program is distributed in the hope that it will be useful,
18
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-// GNU General Public License for more details.
21
-//
22
-// To read the license please visit http://www.gnu.org/copyleft/gpl.html
23
-// ----------------------------------------------------------------------
24
-
25
-if(!defined("_CHARSET")) exit( );
26
-if(!function_exists("random_char")) {
27
-
28
-function random_char($string)
29
-{
30
-	$length = strlen($string);
31
-	$position = mt_rand(0, $length - 1);
32
-	$output = ($string[$position]);
33
-	return $output;
34
-}
35
-
36
-function random_string ($charset_string, $length)
37
-{
38
-	$return_string = random_char($charset_string);
39
-	for ($x = 1; $x < $length; $x++)
40
-	$return_string .= random_char($charset_string);
41
-	return $return_string;
42
-}
43
-
44
-}
45
-	$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : false;
46
-	if(!$uid) $uid = USERUID;
47
-
48
-	if((!isADMIN || uLEVEL > 2) && $uid != USERUID && $action == "editbio") $output .= write_error(_NOTAUTHORIZED);
49
-	if(isMEMBER) $output .= "<div id=\"pagetitle\">"._EDITPERSONAL."</div>";
50
-	else $output .= "<div id=\"pagetitle\">"._NEWACCOUNT."</div>";
51
-	if(!empty($_POST['submit'])) {
52
- 
53
- 
54
-/* The section adds fields from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
55
-			$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
56
-			while($field = dbassoc($fields)) {
57
-				$uid = isset($_POST['uid']) && isNumber($_POST['uid']) ? $_POST['uid'] : false;
58
-				if(!$uid) continue;
59
-				$oldfield = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE field='".$field['field_id']."' AND uid = '".$uid."'");
60
-				if(dbnumrows($oldfield) > 0) {
61
-					$newinfo = isset($_POST["af_".$field['field_name']]) ? escapestring(descript($_POST["af_".$field['field_name']])) : false;
62
-					if(!empty($newinfo)) dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET info='".$newinfo."' WHERE uid = '$uid' AND field = '".descript($field['field_id'])."'");
63
-					else dbquery("DELETE FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid' AND field = '".$field['field_id']."'");
64
-				}
65
-				else if(!empty($_POST["af_".$field['field_name']])) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`, `field`) VALUES('$uid', '".escapestring($_POST["af_".$field['field_name']])."', '".$field['field_id']."');");
66
-			}
67
-/* End dynamic fields */
68
-		   
69
-			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT));
70
-	 
71
-	}
72
-	else {
73
-		if($action != "register") {
74
-			$result = dbquery("SELECT * FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
75
-			$user = dbassoc($result);
76
-			$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
77
-			while($field = dbassoc($result2)) {
78
-				$user["af_".$field['field']] = $field['info'];
79
-			}
80
-		}
81
- 
82
-		$output .= "<div id='settingsform'>
83
-        <form method=\"POST\" id=\"editbio\" name=\"editbio\" enctype=\"multipart/form-data\" style='margin: 0 auto;' 
84
-        action=\"user.php?action=$action".($uid != USERUID ? "&uid=".$uid : "")."\">
85
-		<div><label for='newpenname'>"._PENNAME.":</label>";
86
-		$output .= " ".$user['user_name'];
87
-		$output .= "</div>
88
-        <div><label for='realname'>"._REALNAME.": </label>";
89
-        $output .= " ".$user['user_realm'];
90
-        $output .= "</div>";
91
- 		$output .= "<div><label for='realname'>"._EMAIL.": </label>";
92
-        $output .= " ".$user['user_email'];
93
-        $output .= "</div>";       
94
- 		$output .= "<div><label for='realname'>"._BIO.": </label>";
95
-        $output .= " ".$user['user_email'];
96
-        $output .= "</div>"; 
97
-	 	 /* The section adds fields to the form from the authorfields table to the authorinfo table allowing dynamic additions to the bio/registration page */
98
-		$authorfields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = '1'");
99
-		while($field = dbassoc($authorfields)) {
100
-			if($field['field_type'] == 1 || $field['field_type'] == 4 || $field['field_type'] == 6) 
101
-				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n<input type='text' class='textbox' name='af_".$field['field_name']."'".(!empty($user["af_".$field['field_id']]) ? "value='".$user["af_".$field['field_id']]."'" : "").">\n</div>\n";
102
-			if($field['field_type'] == 2) {
103
-				$output .= "<div><label for='".$field['field_name']."'>".$field['field_title'].":</label>\n
104
-						<select class='textbox' name='af_".$field['field_name']."'>\n";
105
-				$opts = explode("|#|", $field['field_options']);
106
-				foreach($opts as $opt) {
107
-					$output .= "<option".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == $opt ? " selected" : "").">$opt</option>\n";
108
-				}
109
-				$output .= "</select>\n</div>\n";
110
-			}
111
-			if($field['field_type'] == 5) eval(stripslashes($field['field_code_in']));
112
-			if($field['field_type'] == 3) {
113
-				$output .= "<div class='fieldset'><span class='label'>".$field['field_title'].":</span>\n";
114
-				$output .= "<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._YES."' value='"._YES."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _YES ? "checked='checked'" : "")."> <label for='".$field['field_name']._YES."'>"._YES."</label>\n
115
-					<input type='radio' name='af_".$field['field_name']."' id='af_".$field['field_name']._NO."' value='"._NO."'".(!empty($user["af_".$field['field_id']]) && $user["af_".$field['field_id']] == _NO ? "checked='checked'" : "")."> <label for='".$field['field_name']._NO."'>"._NO."</label></div>\n";
116
-			}
117
-		}
118
-/* End dynamic fields */
119
- 	 	$output .= "<div style='text-align: center; margin: 1em;'><INPUT type=\"hidden\" name=\"uid\" value=\"".(isset($user) ? $user['uid'] : "")."\"><INPUT type=\"submit\" class=\"button\" name=\"submit\" value=\""._SUBMIT."\">";
120
-	 	if(!isADMIN && $action != "register")
121
-	 	{
122
-			 	$output .= " [<a href=\"admin.php?action=members&delete=$uid\">"._DELETE."</a>]";
123
-	 	}
124
-	 	$output .= "</div></form></div>".write_message("<font color=\"red\">*</font> "._REQUIREDFIELDS);
125
-	}
126
-?>
127 0
\ No newline at end of file
128 1
deleted file mode 100644
... ...
@@ -1,62 +0,0 @@
1
-<?php
2
-// ----------------------------------------------------------------------
3
-// eFiction 3.2
4
-// Copyright (c) 2007 by Tammy Keefer
5
-// Valid HTML 4.01 Transitional
6
-// Based on eFiction 1.1
7
-// Copyright (C) 2003 by Rebecca Smallwood.
8
-// http://efiction.sourceforge.net/
9
-// ----------------------------------------------------------------------
10
-// LICENSE
11
-//
12
-// This program is free software; you can redistribute it and/or
13
-// modify it under the terms of the GNU General Public License (GPL)
14
-// as published by the Free Software Foundation; either version 2
15
-// of the License, or (at your option) any later version.
16
-//
17
-// This program is distributed in the hope that it will be useful,
18
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
-// GNU General Public License for more details.
21
-//                                                                             user_id
22
-// To read the license please visit http://www.gnu.org/copyleft/gpl.html
23
-// ----------------------------------------------------------------------
24
-
25
-if(!defined("_CHARSET")) exit( );
26
-
27
-//replace with e107 stuff  */
28
-
29
-if (USERID) {
30
-    // is log in e107, so it's member
31
-    define("isMEMBER", true);
32
-    define("USERUID", USERID);
33
-    define("USERPENNAME", USERNAME);
34
-    // check if it's author, so they are in author table 
35
-    $userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." 
36
-    LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".USERUID."'"));
37
- 
38
-    if($userdata && $userdata['level'] != -1 ) {
39
-		define("USERUID", $userdata['uid']);
40
-		define("USERPENNAME", $userdata['penname']);
41
-		// the following line fixes missing authorpref rows
42
-		if(empty($userdata['userskin'] )) dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(uid, userskin, storyindex, sortby, tinyMCE) VALUES('".$userdata['uid']."', '$defaultskin', '$displayindex', '$defaultsort', '$tinyMCE')");
43
-		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
44
-		else if(isset($_SESSION[$sitekey."_skin"])) $siteskin = $_SESSION[$sitekey."_skin"];
45
-		else $siteskin = $defaultskin;
46
-		define("uLEVEL", $userdata['level']);
47
-		define("isADMIN", uLEVEL > 0 ? true : false);
48
-		define("isMEMBER", true);
49
-		if(EMPTY($_SESSION[$sitekey."_agecontsent"])) $ageconsent = $userdata['ageconsent'];
50
-		else $ageconsent = $_SESSION[$sitekey."_agecontsent"];
51
-	} 
52
-}
53
- 
54
-if(!defined("USERUID")) define("USERUID", 0);
55
-if(!defined("USERPENNAME")) define("USERPENNAME", false);
56
-if(!defined("uLEVEL")) define("uLEVEL", 0);
57
-if(!defined("isMEMBER")) define("isMEMBER", false);
58
-if(!defined("isADMIN")) define("isADMIN", false);
59
-if(empty($siteskin)) $siteskin = $defaultskin;
60
- 
61
-
62
-?>
63 0
\ No newline at end of file
64 1
deleted file mode 100644
... ...
@@ -1,458 +0,0 @@
1
-<?php
2
-// ----------------------------------------------------------------------
3
-// Copyright (c) 2007 by Tammy Keefer
4
-// Based on eFiction 1.1
5
-// Copyright (C) 2003 by Rebecca Smallwood.
6
-// http://efiction.sourceforge.net/
7
-// ----------------------------------------------------------------------
8
-// LICENSE
9
-//
10
-// This program is free software; you can redistribute it and/or
11
-// modify it under the terms of the GNU General Public License (GPL)
12
-// as published by the Free Software Foundation; either version 2
13
-// of the License, or (at your option) any later version.
14
-//
15
-// This program is distributed in the hope that it will be useful,
16
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
-// GNU General Public License for more details.
19
-//
20
-// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
-// ----------------------------------------------------------------------
22
-
23
-// Force the argument separator to be standards compliant
24
-@ ini_set('arg_separator.output','&amp;'); 
25
-if(isset($_GET['debug'])) @ error_reporting(E_ALL);
26
-if(isset($_GET['benchmark'])) {
27
-	list($usec, $sec) = explode(" ", microtime());
28
-	$start = ((float)$usec + (float)$sec);
29
-}
30
-$headerSent = false;
31
-if(get_magic_quotes_gpc()){
32
-	foreach($_POST as $var => $val) {
33
-		$_POST[$var] = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
34
-	}
35
-	foreach($_GET as $var => $val) {
36
-		$_GET[$var] = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
37
-	}
38
-}
39
-
40
-// Defines the character set for your language/location
41
-define ("_CHARSET", "utf-8");
42
-
43
-// Prevent possible XSS attacks via $_GET.
44
-foreach ($_GET as $v) {
45
-	if(preg_match('@<script[^>]*?>.*?</script>@si', $v) ||
46
-		preg_match("'@<iframe[^>]*?>.*?</script>@si'", $v) ||
47
-		preg_match("'@<applet[^>]*?>.*?</script>@si'", $v) ||
48
-		preg_match("'@<meta[^>]*?>.*?</script>@si'", $v) ||
49
-		preg_match('@<[\/\!]*?[^<>]*?>@si', $v) ||
50
-		preg_match('@<style[^>]*?>.*?</style>@siU', $v) ||
51
-		preg_match('@<![\s\S]*?--[ \t\n\r]*>@', $v)) {
52
-		include("languages/en.php"); // no language set yet, so default to English.	
53
-		die (_POSSIBLEHACK);
54
-	}
55
-}
56
-unset($v);
57
-
58
-if(!isset($_SESSION)) session_start();
59
-// clear the global variables if register globals is on.
60
-if(ini_get('register_globals')) {
61
-	$arrayList = array_merge($_SESSION, $_GET, $_POST, $_COOKIE);
62
-	foreach($arrayList as $k => $v) {
63
-		unset($GLOBALS[$k]);
64
-	}
65
-}                   
66
- 
67
-Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
68
-header ("Pragma: no-cache"); 
69
-header ("Expires: 0"); 
70
-header("Content-Type: text/html; charset="._CHARSET);
71
-
72
-// Locate config.php and set the basedir path
73
-$folder_level = "";
74
-while (!file_exists($folder_level."header.php")) { $folder_level .= "../"; }
75
-if(!defined("_BASEDIR")) define("_BASEDIR", $folder_level);
76
-
77
-@ include_once(_BASEDIR."config.php");
78
-@ include_once(_BASEDIR.UN_FULLAPP_PATH."class2.php");
79
-
80
-if(empty($sitekey)) {
81
-	header("Location: install/install.php");
82
-	exit( );
83
-}
84
-if(isset($skin)) $globalskin = $skin; 
85
-$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
86
-$settings = dbassoc($settingsresults);
87
-if(!defined("SITEKEY")) define("SITEKEY", $settings['sitekey']);
88
-unset($settings['sitekey']);
89
-if(!defined("TABLEPREFIX")) define("TABLEPREFIX", $settings['tableprefix']);
90
-unset($settings['tableprefix']);
91
-define("STORIESPATH", $settings['storiespath']);
92
-unset($settings['storiespath']);
93
-foreach($settings as $var => $val) {
94
-	$$var = stripslashes($val);
95
-	$settings[$var] = htmlspecialchars($val);
96
-}
97
-
98
-if(isset($_GET['debug'])) $debug = 1;
99
-if(!$displaycolumns) $displaycolumns = 1; // shouldn't happen, but just in case.
100
-if($words) $words = explode(", ", $words);
101
-else $words = array( );
102
-// Fix for sites with 2.0 or 1.1 running as well as 3.0 with register_globals on.
103
-$defaultskin = $skin;
104
-
105
-if(isset($globalskin)) $skin = $globalskin;
106
-
107
-if(isset($_GET['action'])) $action = strip_tags($_GET['action']);
108
-else $action = false;
109
-
110
-if(file_exists(_BASEDIR."languages/{$language}.php")) include (_BASEDIR."languages/{$language}.php");
111
-else include (_BASEDIR."languages/en.php");
112
-
113
-include_once(_BASEDIR."includes/queries.php");
114
-include_once(_BASEDIR."includes/corefunctions.php");
115
-
116
-// Check and/or set some variables used at various points throughout the script
117
-if(isset($_GET['offset'])) $offset = $_GET['offset'];
118
-if(!isset($offset) || !isNumber($offset)) $offset = 0;
119
-if(isset($_REQUEST["sid"])) $sid = $_REQUEST["sid"];
120
-if(isset($sid) && !isNumber($sid)) unset($sid);
121
-if(isset($_REQUEST['seriesid'])) $seriesid = $_REQUEST["seriesid"];
122
-if(isset($seriesid) && !isNumber($seriesid)) unset($seriesid);
123
-if(isset($_REQUEST['uid'])) $uid = $_REQUEST["uid"];
124
-if(isset($uid) && !isNumber($uid)) unset($uid);
125
-if(isset($_REQUEST['chapid'])) $chapid = $_REQUEST["chapid"];
126
-if(isset($chapid) && !isNumber($chapid)) unset($chapid);
127
-$let = false;
128
-if(isset($_GET['let'])) $let = $_GET['let'];
129
-if(isset($let) && !in_array($let, $alphabet)) $let = false;
130
-$output = "";
131
-
132
-// Cleans these two variables of possible XSS attacks.
133
-if(isset($_SERVER['PHP_SELF'])) $_SERVER['PHP_SELF'] = htmlspecialchars(descript($_SERVER['PHP_SELF']), ENT_QUOTES);
134
-if(isset($PHP_SELF)) $PHP_SELF = htmlspecialchars(descript($PHP_SELF), ENT_QUOTES);
135
-
136
-// Set these variables to start.
137
-$agecontsent = false; $viewed = false; 
138
-
139
-require_once("includes/get_session_vars.php");
140
-
141
-if(isset($_GET['skin'])) {
142
-	$siteskin = $_GET['skin'];
143
-	$_SESSION[SITEKEY."_skin"] = $siteskin;
144
-}
145
-
146
-$v = explode(".", $version);
147
-include("version.php");
148
-$newV = explode(".", $version);
149
-//if($v[0] == $newV[0] && ($v[1] < $newV[1] || (isset($newV[2]) && $v[2] < $newV[2]))) {
150
-foreach($newV AS $k => $l) {
151
-	if($newV[$k] > $v[$k] || (!empty($newV[$k]) && empty($v[$k]))) {
152
-		if(isADMIN && basename($_SERVER['PHP_SELF']) != "update.php") {
153
-			header("Location: update.php");
154
-			exit( );
155
-		}
156
-		else if(!isADMIN && basename($_SERVER['PHP_SELF']) != "maintenance.php" && !(isset($_GET['action']) && $_GET['action'] == "login")) {
157
-			header("Location: maintenance.php");
158
-			exit( );
159
-		}
160
-	}
161
-}
162
-
163
-if(!empty($_SESSION[SITEKEY."_skin"])) $siteskin = $_SESSION[SITEKEY."_skin"];
164
-if($maintenance && !isADMIN && basename($_SERVER['PHP_SELF']) != "maintenance.php" && !(isset($_GET['action']) && $_GET['action'] == "login")) {
165
-	header("Location: maintenance.php");
166
-	exit( );
167
-}
168
-
169
-$blockquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_blocks");
170
-while($block = dbassoc($blockquery)) {
171
-	$blocks[$block['block_name']] = unserialize($block['block_variables']);
172
-	$blocks[$block['block_name']]['title'] = $block['block_title'];
173
-	$blocks[$block['block_name']]['file'] = $block['block_file'];
174
-	$blocks[$block['block_name']]['status'] = $block['block_status'];
175
-}
176
-
177
-// This session variable is used to track the story views
178
-if(isset($_SESSION[SITEKEY."_viewed"])) $viewed = $_SESSION[SITEKEY."_viewed"];
179
-
180
-if(isset($_GET['ageconsent'])) $_SESSION[SITEKEY."_ageconsent"] = 1;
181
-if(isset($_GET['warning'])) $_SESSION[SITEKEY."_warned"][$_GET['warning']] = 1;
182
-
183
-if(file_exists("languages/{$language}.php")) require_once ("languages/{$language}.php");
184
-else require_once ("languages/en.php");
185
-if(is_dir(_BASEDIR."skins/$siteskin")) $skindir = _BASEDIR."skins/$siteskin";
186
-else if(is_dir(_BASEDIR."skins/".$settings['skin'])) $skindir = _BASEDIR."skins/".$defaultskin;
187
-else $skindir = _BASEDIR."default_tpls";
188
-if(USERUID) {
189
-	$prefs = dbquery("SELECT sortby, storyindex, tinyMCE FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE uid = '".USERUID."'");
190
-	if(dbnumrows($prefs)) list($defaultsort, $displayindex, $tinyMCE) = dbrow($prefs);
191
-}
192
-if(isset($_REQUEST['sort'])) $defaultsort = $_REQUEST['sort'] == "update" ? 1 : 0;
193
-define("_ORDERBY", " ORDER BY ".($defaultsort == 1 ? "updated DESC" : "stories.title ASC"));
194
-if($current == "viewstory"){
195
-	if(isset($chapid)) {
196
-		$squery = dbquery("SELECT sid, inorder FROM ".TABLEPREFIX."fanfiction_chapters WHERE chapid = ".$chapid." LIMIT 1");
197
-		list($sid, $chapter) = dbrow($squery);
198
-	}
199
-	$titlequery = dbquery("SELECT story.title, story.coauthors, "._PENNAMEFIELD." as penname, story.summary FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE sid = '$sid' AND "._UIDFIELD." = story.uid LIMIT 1");
200
-	if($story = dbassoc($titlequery)) { 
201
-			$authlink[] = $story['penname'];
202
-		if($story['coauthors']) {
203
-			$coquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as ca ON "._UIDFIELD." = ca.uid WHERE ca.sid = '$sid'");
204
-			while($co = dbassoc($coquery)) {
205
-				$authlink[] = $co['penname'];
206
-			}
207
-		}
208
-		$titleinfo = stripslashes($story['title'])." "._BY." ".implode(", ", $authlink);
209
-		$metaDesc = htmlspecialchars(stripslashes($story['summary']));
210
-		$filename = basename($titleinfo.".html");
211
-		$ie = strpos("msie", strtolower($_SERVER['HTTP_USER_AGENT'])) !== false ? true : false;
212
-		if ($ie) $filename = rawurlencode($filename);
213
-		//header("Content-Disposition: inline; filename=\"".$titleinfo."\"");
214
- 	}
215
-}
216
-if($current == "viewuser" && isNumber($uid)) {
217
-	$author = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '".$uid."'");
218
-	list($penname) = dbrow($author);
219
-	$titleinfo = "$sitename :: $penname";
220
-}
221
-echo _DOCTYPE."<html><head>";
222
-echo "<meta charset='utf-8' />";
223
-if(!isset($titleinfo)) $titleinfo = "$sitename :: $slogan";
224
-if(isset($metaDesc)) echo "<meta name='description' content='$metaDesc'>";
225
-echo "<title>$titleinfo</title>";
226
-
227
-// ---------- Favicon ---------
228
-if (file_exists($skindir."/images/favicon.ico")) 
229
-{
230
-	echo "<link rel='icon' href='".THEME_ABS."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='".THEME_ABS."favicon.ico' type='image/xicon' />\n";
231
-}
232
-elseif (file_exists(_BASEDIR."favicon.ico")) 
233
-{
234
-	echo "<link rel='icon' href='"._BASEDIR."favicon.ico' type='image/x-icon' />\n<link rel='shortcut icon' href='"._BASEDIR."favicon.ico' type='image/xicon' />\n";
235
-}
236
- 
237
-
238
-echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset="._CHARSET."\">";
239
-if(!isset($_GET['action']) || $_GET['action'] != "printable") {
240
-echo "<script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."includes/javascript.js\"></script>
241
-<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$sitename RSS Feed\" href=\""._BASEDIR."rss.php\">";
242
-if(!empty($tinyMCE)) {
243
-	echo "<script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."tinymce/js/tinymce/tinymce.min.js\"></script>
244
-	<script language=\"javascript\" type=\"text/javascript\"><!--";
245
-	$tinymessage = dbquery("SELECT message_text FROM ".TABLEPREFIX."fanfiction_messages WHERE message_name = 'tinyMCE' LIMIT 1");
246
-	list($tinysettings) = dbrow($tinymessage);
247
-	if(!empty($tinysettings) && $current != "adminarea") {
248
-		echo $tinysettings;
249
-	}
250
-	else {
251
-		echo "
252
-	tinymce.init({
253
-  		selector: 'textarea:not(.mceNoEditor)',
254
-  		menubar: false,
255
-		language: '$language',
256
-  		theme: 'modern',
257
-		skin: 'lightgray',
258
-		min_height: 200,
259
-		plugins: [
260
-		    'autolink lists link image charmap paste preview hr anchor pagebreak',
261
-		    'searchreplace wordcount visualblocks visualchars code fullscreen',
262
-		    'insertdatetime media nonbreaking save table contextmenu directionality',
263
-		    'emoticons template textcolor colorpicker textpattern imagetools toc textcolor table'
264
-		],
265
-		paste_word_valid_elements: 'b,strong,i,em,h1,h2,u,p,ol,ul,li,a[href],span,color,font-size,font-color,font-family,mark,table,tr,td',
266
-		  		paste_retain_style_properties : 'all',
267
-		paste_strip_class_attributes: 'none',
268
-		toolbar1: 'undo redo | insert styleselect | bold italic underline strikethrough | link image | alignleft aligncenter alignright alignjustify',
269
-		toolbar2: 'preview | bullist numlist | forecolor backcolor emoticons | fontselect |  fontsizeselect wordcount',
270
-		image_advtab: true,
271
-		templates: [
272
-		    { title: 'Test template 1', content: 'Test 1' },
273
-		    { title: 'Test template 2', content: 'Test 2' }
274
-		],
275
-		content_css: [
276
-		    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
277
-		    '//www.tinymce.com/css/codepen.min.css'
278
-		],";
279
-		if(USERUID) 
280
-			echo "		external_image_list_url : '".STORIESPATH."/".USERUID."/images/imagelist.js',";
281
-		echo "
282
-		theme_modern_resizing: true,".($current == "adminarea" ? "\n\t\tentity_encoding: 'raw'" : "\n\t\tinvalid_elements: 'script,object,applet,iframe'")."
283
-   });
284
-	
285
-";
286
-	}
287
-	echo "
288
-var tinyMCEmode = true;
289
-	function toogleEditorMode(id) {
290
-		var elm = document.getElementById(id);
291
-
292
-		if (tinyMCE.getInstanceById(id) == null)
293
-			tinyMCE.execCommand('mceAddControl', false, id);
294
-		else
295
-			tinyMCE.execCommand('mceRemoveControl', false, id);
296
-	}
297
-";
298
-/*echo "
299
-var tinyMCEmode = true;
300
-	function toogleEditorMode(id) {
301
-		var elm = document.getElementById(id);
302
-
303
-		if (tinyMCE.get(id) == null)
304
-			tinyMCE.execCommand('mceAddControl', false, id);
305
-		else
306
-			tinyMCE.execCommand('mceRemoveControl', false, id);
307
-	}
308
-";*/
309
-echo " --></script>";
310
-}
311
-}
312
-if(isset($displayform) && $displayform == 1) {
313
-echo "<script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."includes/xmlhttp.js\"></script>";
314
-echo "<script language=\"javascript\" type=\"text/javascript\">
315
-lang = new Array( );
316
-
317
-lang['Back2Cats'] = '"._BACK2CATS."';
318
-lang['ChooseCat'] = '"._CHOOSECAT."';
319
-lang['Categories'] = '"._CATEGORIES."';
320
-lang['Characters'] = '"._CHARACTERS."';
321
-lang['MoveTop'] = '"._MOVETOP."';
322
-lang['TopLevel'] = '"._TOPLEVEL."';
323
-lang['CatLocked'] = '"._CATLOCKED."';
324
-basedir = '"._BASEDIR."';
325
-
326
-categories = new Array( );
327
-characters = new Array( );
328
-\n";
329
-/*
330
-	$result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_categories ORDER BY leveldown, displayorder");
331
-$x = 0;
332
-	while($category = dbassoc($result)) {
333
-		echo "categories[$x] = new category(".$category['parentcatid'].", ".$category['catid'].", \"". str_replace('"', '\"', stripslashes($category['category']))."\", ".$category['locked'].", ".$category['displayorder'].");\r\n";
334
-		$catlist[$category['catid']] = array("name" => stripslashes($category['category']), "pid" => $category['parentcatid'], "locked" => (isADMIN ? 0 : $category['locked']), "order" => $category['displayorder'], "leveldown" => $category['leveldown']);
335
-		$x++;
336
-	}
337
-$x = 0;
338
-	$result = dbquery("SELECT charname, catid, charid FROM ".TABLEPREFIX."fanfiction_characters ORDER BY charname");
339
-	while($char = dbassoc($result)) {
340
-		echo "characters[$x] = new character(".$char['charid'].", ".$char['catid'].", \"".str_replace('"', '\"', stripslashes($char['charname']))."\");\r\n";
341
-		$charlist[$char['charid']] = array("name" => stripslashes($char['charname']), "catid" => $char['catid']);
342
-		$x++;
343
-	}
344
-*/
345
-echo "</script>";
346
-}
347
-if(file_exists("extra_header.php")) include_once("extra_header.php");
348
-if(file_exists("$skindir/extra_header.php")) include_once("$skindir/extra_header.php");
349
-if(!$displaycolumns) $displaycolumns = 1;
350
-$colwidth = floor(100/$displaycolumns);
351
-if(!empty($_GET['action']) && $_GET['action'] == "printable") {
352
-	if(file_exists("$skindir/printable.css")) echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$skindir/printable.css\">";
353
-	else echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"default_tpls/printable.css\">";
354
-	echo "<script type='text/javascript'>
355
-<!--
356
-if (window.print) {
357
-    window.print() ;  
358
-} else {
359
-    var WebBrowser = '<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>';
360
-document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
361
-    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = \"\";  
362
-}
363
-</script>";
364
-}
365
-else {
366
-echo "<style type=\"text/css\">
367
-#columncontainer { margin: 1em auto; width: auto; padding: 5%;}
368
-#browseblock, #memberblock { width: 100%; padding: 0; margin: 0; float: left; border: 0px solid transparent; }
369
-.column { float: left; width: ".($colwidth - 1)."%; }
370
-html>body .column { width: $colwidth%; }
371
-.cleaner { clear: both; height: 1px; font-size: 1px; margin: 0; padding: 0; background: transparent; }
372
-#settingsform { margin: 0; padding: 0; border: none; }
373
-#settingsform FORM { width: 100%; margin: 0 10%; }
374
-#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
375
-#settingsform DIV { clear: both;}
376
-#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
377
-#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
378
-#settingsform { float: left; margin: 1ex 10%; }
379
-#settingsform .tinytoggle { text-align: center; }
380
-#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
381
-#settingsform #submitdiv { text-align: center; width: 100%;clear: both; height: 3em; }
382
-#settingsform #submitdiv #submit { position: absolute; z-index: 10001; margin: 1em; }
383
-a.pophelp{
384
-    position: relative; /* this is the key*/
385
-    vertical-align: super;
386
-}
387
-
388
-a.pophelp:hover{z-index:100; border: none; text-decoration: none;}
389
-
390
-a.pophelp span{display: none; position: absolute; top: -25em; left: 20em; }
391
-
392
-a.pophelp:hover span{ /*the span will display just on :hover state*/
393
-    display:block;
394
-    position: absolute;
395
-    top: -3em; left: 8em; width: 225px;
396
-    border:1px solid #000;
397
-    background-color:#CCC; color:#000;
398
-    text-decoration: none;
399
-    text-align: left;
400
-    padding: 5px;
401
-    font-weight: normal;
402
-    visibility: visible;
403
-}
404
-.required { color: red; }
405
-.shim {
406
-	position: absolute;
407
-	display: none;
408
-	height: 0;
409
-	width:0;
410
-	margin: 0;
411
-	padding: 0;
412
-	z-index: 100;
413
-}
414
-
415
-.ajaxOptList {
416
-	background: #CCC;
417
-	border: 1px solid #000;
418
-	margin: 0;
419
-	position: absolute;
420
-	padding: 0;
421
-	z-index: 1000;
422
-	text-align: left;
423
-}
424
-.ajaxListOptOver {
425
-	padding: 4px;
426
-	background: #CCC;
427
-	margin: 0;
428
-}
429
-.ajaxListOpt {
430
-	background: #EEE;
431
-	padding: 4px;
432
-	margin: 0;
433
-}
434
-.multiSelect {
435
-	width: 300px;
436
-}
437
-
438
-@media all and (max-width: 767px) { 
439
-html>body .column {
440
-    width: 100%;
441
-}
442
-
443
-</style>
444
-<link rel='stylesheet' type='text/css' href='$skindir/style.css' /> \n
445
-<meta name='viewport' content='width=device-width, initial-scale=1.0' />
446
-";
447
-}
448
-echo "</head>";
449
-$headerSent = true;
450
-include (_BASEDIR."includes/class.TemplatePower.inc.php");
451
-if($debug == 1) {
452
-	@ error_reporting(E_ALL);
453
-	echo "\n<!-- \$_SESSION \n"; print_r($_SESSION); echo " -->";
454
-	echo "\n<!-- \$_COOKIE \n"; print_r($_COOKIE); echo " -->";
455
-	echo "\n<!-- \$_POST \n"; print_r($_POST); echo " -->";
456
-}
457
-?>
458 0
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-<?php
2
-
3
-// Default query strings used throughout the script.  You may need to alter these to bridge to other scripts or databases.
4
-
5
-define ("_AUTHORPREFIX", defined("TABLEPREFIX") ? TABLEPREFIX : $tableprefix);
6
-
7
-define ("_UIDFIELD", "author.user_id");  // Do not change the aliasing (the "author." part)!
8
-define ("_PENNAMEFIELD", "author.user_name");  // Do not change the aliasing (the "author." part)!
9
-define ("_EMAILFIELD", "author.user_email");  // Do not change the aliasing (the "author." part)!
10
-define ("_PASSWORDFIELD", "author.user_password"); //  Do not change the aliasing (the "author." part)!
11
-define ("_AUTHORTABLE", _AUTHORPREFIX."user as author"); // Do not change the aliasing (the "as author" part)!
12
-
13
-define ("_STORYQUERY",  "SELECT stories.*, "._PENNAMEFIELD." as penname, UNIX_TIMESTAMP(stories.date) as date, UNIX_TIMESTAMP(stories.updated) as updated FROM ("._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_stories as stories) WHERE "._UIDFIELD." = stories.uid AND stories.validated > 0 ");
14
-define ("_STORYCOUNT", "SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_stories as stories WHERE validated > 0");
15
-define ("_SERIESQUERY", "SELECT series.*, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE.", ".TABLEPREFIX."fanfiction_series as series WHERE "._UIDFIELD." = series.uid ");
16
-define ("_SERIESCOUNT", "SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series as series ");   
17
-define ("_MEMBERLIST", "SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid, ap.stories FROM "._AUTHORTABLE." 
18
-LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON "._UIDFIELD." = ap.uid");
19
-define ("_MEMBERCOUNT", "SELECT COUNT("._UIDFIELD.") FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs AS ap ON ap.uid = "._UIDFIELD);
20
-
21
-
22
-
23
-?>
24 0
\ No newline at end of file
25 1
deleted file mode 100644
... ...
@@ -1,1138 +0,0 @@
1
-<?php
2
-// ----------------------------------------------------------------------
3
-// Copyright (c) 2007 by Tammy Keefer
4
-// Based on eFiction 1.1
5
-// Copyright (C) 2003 by Rebecca Smallwood.
6
-// http://efiction.sourceforge.net/
7
-// ----------------------------------------------------------------------
8
-// LICENSE
9
-//
10
-// This program is free software; you can redistribute it and/or
11
-// modify it under the terms of the GNU General Public License (GPL)
12
-// as published by the Free Software Foundation; either version 2
13
-// of the License, or (at your option) any later version.
14
-//
15
-// This program is distributed in the hope that it will be useful,
16
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
-// GNU General Public License for more details.
19
-//
20
-// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
-// ----------------------------------------------------------------------
22
-
23
-function random_char($string)
24
-{
25
-	$length = strlen($string);
26
-	$position = mt_rand(0, $length - 1);
27
-	 return $string[$position];
28
-}
29
-
30
-function random_string ($charset_string, $length)
31
-{
32
-	$return_string = random_char($charset_string);
33
-	for ($x = 1; $x < $length; $x++)
34
-	$return_string .= random_char($charset_string);
35
-	return $return_string;
36
-}
37
-
38
-
39
-$randomcharset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';
40
-
41
-// Strip out slashes if magic quotes isn't on.
42
-if(ini_get("magic_quotes_gpc")) {
43
-	foreach($_POST as $var => $val) {
44
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
45
-	}
46
-	foreach($_GET as $var => $val) {
47
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
48
-	}
49
-	foreach($_COOKIE as $var => $val) {
50
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
51
-	}
52
-}
53
-
54
-Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
55
-header ("Pragma: no-cache"); 
56
-header ("Expires: 0"); 
57
-
58
-//make a new TemplatePower object
59
-echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
60
-<html><head><title>eFiction 1.1 to $version Upgrade</title>
61
-<style>
62
-LABEL { float: left; display: block; width: 50%; text-align: right; padding-right: 10px; clear: left;}
63
-.row { float: left; width: 99%; }
64
-#settingsform FORM { width: 80%; margin; 0 auto; }
65
-#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
66
-#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
67
-#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
68
-#settingsform .tinytoggle { text-align: center; }
69
-#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
70
-#settingsform #submit { display: block; margin: 1ex auto; }
71
-a.pophelp{
72
-    position: relative; /* this is the key*/
73
-    z-index:24;
74
-    vertical-align: super;
75
-    text-decoration: none;
76
-}
77
-
78
-a.pophelp:hover{z-index:100; border: none; text-decoration: none;}
79
-
80
-a.pophelp span{display: none; position: absolute; text-decoration: none;}
81
-
82
-a.pophelp:hover span{ /*the span will display just on :hover state*/
83
-    display:block;
84
-    position: absolute;
85
-    top: 0; left: 8em; width: 225px;
86
-    border:1px solid #000;
87
-    background-color:#CCC; color:#000;
88
-    text-decoration: none;
89
-    text-align: left;
90
-    padding: 5px;
91
-    font-weight: normal;
92
-}
93
-.required { color: red; }
94
-</style>
95
-<link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
96
-
97
-$output = "";
98
-define("_BASEDIR", "../");
99
-include ("../includes/class.TemplatePower.inc.php");
100
-if(isset($_GET['step']) && $_GET['step'] > 2) {
101
-	include("../config.php");
102
-	$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
103
-	list($tableprefix, $language) = dbrow($settings);
104
-	define("SITEKEY", $sitekey);
105
-	define("TABLEPREFIX", $tableprefix);
106
-}
107
-if(isset($language)) {
108
-if(file_exists("../languages/{$language}.php")) include ("../languages/{$language}.php");
109
-else include ("../languages/en.php");
110
-if(file_exists("../languages/{$language}_admin.php")) include ("../languages/{$language}_admin.php");
111
-else include ("../languages/en_admin.php");
112
-if(file_exists("languages/$language.php")) include ("languages/{$language}.php");
113
-else include("languages/en.php");
114
-}
115
-else {
116
-include ("../languages/en.php");
117
-include ("../languages/en_admin.php");
118
-include("languages/en.php");
119
-}
120
-include("../includes/corefunctions.php");
121
-
122
-
123
-//  So I don't have to keep updating the version number in 3 different files.
124
-include("../version.php");
125
-
126
-$tpl = new TemplatePower( "../default_tpls/default.tpl" );
127
-$tpl->assignInclude( "header", "./../default_tpls/header.tpl" );
128
-$tpl->assignInclude( "footer", "./../default_tpls/footer.tpl" );
129
-$tpl->prepare( );
130
-$tpl->newBlock("header");
131
-$tpl->assign("sitename", "Upgrade eFiction 1.1 to eFiction $version");
132
-$tpl->gotoBlock( "_ROOT" );
133
-$tpl->newBlock("footer");
134
-$tpl->assign( "footer", "eFiction $version &copy; 2006. <a href='http://efiction.org/'>http://efiction.org/</a>");
135
-$tpl->gotoBlock( "_ROOT" );
136
-
137
-switch($_GET['step']) {
138
-	case "18":
139
-		$output .= "<div id='pagetitle'>"._MISCDBUPDATE."</div>";
140
-		if(isset($_GET['install'])) {
141
-			if($_GET['install'] == "automatic") {
142
-				include("../config.php");
143
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
144
-				list($tableprefix) = dbrow($settings);
145
-				$alter1 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_characters` ADD `bio` TEXT NULL, ADD `image` VARCHAR( 200 ) NOT NULL");
146
-				$output .= write_message(_ALTER11CHARACTERS.($alter1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
147
-				$alter1 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_categories` CHANGE `locked` `locked` CHAR( 1 ) DEFAULT '0' NOT NULL");
148
-				$output .= write_message(_ALTER11CATEGORIES.($alter1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
149
-				$alter1 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_ratings` CHANGE `ratingwarning` `ratingwarning` CHAR( 1 ) DEFAULT '0' NOT NULL ");
150
-				$output .= write_message(_ALTER11RATINGS.($alter1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
151
-				$alter1 = dbquery("DROP TABLE IF EXISTS `".$tableprefix."fanfiction_settings_old`");
152
-				dbquery("alter table ".$tableprefix."fanfiction_categories drop index category;");
153
-				dbquery("alter table ".$tableprefix."fanfiction_categories drop index parentcatid;");
154
-				dbquery("create index byparent on ".$tableprefix."fanfiction_categories (parentcatid,displayorder);");
155
-				dbquery("create index forstoryblock on ".$tableprefix."fanfiction_chapters (sid,validated);");
156
-				dbquery("alter table ".$tableprefix."fanfiction_comments drop index nid;");
157
-				dbquery("alter table ".$tableprefix."fanfiction_comments add index commentlist (nid,time);");
158
-				dbquery("create index avgrating on ".$tableprefix."fanfiction_reviews(type,item,rating);");
159
-				dbquery("alter table ".$tableprefix."fanfiction_reviews drop index sid;");
160
-				dbquery("create index bychapter on ".$tableprefix."fanfiction_reviews (chapid,rating);");
161
-				dbquery("alter table ".$tableprefix."fanfiction_reviews add index byuid (uid,item,type);");
162
-				dbquery("alter table ".$tableprefix."fanfiction_stories drop index validated;");
163
-				dbquery("create index validateduid on ".$tableprefix."fanfiction_stories (validated,uid);");
164
-				dbquery("create index recent on ".$tableprefix."fanfiction_stories (updated,validated);");
165
-				$serieslist = dbquery("SELECT seriesid FROM ".$tableprefix."fanfiction_series");
166
-				$totalseries = dbnumrows($serieslist);
167
-				while($s = dbassoc($serieslist)) {
168
-					$numstories = count(storiesInSeries($s['seriesid']));
169
-					dbquery("UPDATE ".$tableprefix."fanfiction_series SET numstories = '$numstories' WHERE seriesid = ".$s['seriesid']." LIMIT 1");
170
-				}
171
-				$storiesquery =dbquery("SELECT COUNT(sid) as totals, COUNT(DISTINCT uid) as totala, SUM(wordcount) as totalwords FROM ".$tableprefix."fanfiction_stories WHERE validated > 0 ");
172
-				list($stories, $authors, $words) = dbrow($storiesquery);
173
-				dbquery("UPDATE ".$tableprefix."fanfiction_stats SET stories = '$stories', authors = '$authors', wordcount = '$words' WHERE sitekey = '".$sitekey."'"); 
174
-
175
-				$chapterquery = dbquery("SELECT COUNT(chapid) as chapters FROM ".$tableprefix."fanfiction_chapters where validated > 0");
176
-				list($chapters) = dbrow($chapterquery);
177
-
178
-				$authorquery = dbquery("SELECT COUNT(uid) as totalm FROM ".$tableprefix."fanfiction_authors");
179
-				list($members) = dbrow($authorquery);
180
-
181
-				list($newest) = dbrow(dbquery("SELECT uid as uid FROM ".$tableprefix."fanfiction_authors ORDER BY uid DESC LIMIT 1"));
182
-				$reviewquery = dbquery("SELECT COUNT(reviewid) as totalr FROM ".$tableprefix."fanfiction_reviews WHERE review != 'No Review'");
183
-				list($reviews) = dbrow($reviewquery);
184
-				$reviewquery = dbquery("SELECT COUNT(uid) FROM ".$tableprefix."fanfiction_reviews WHERE review != 'No Review' AND uid != 0");
185
-				list($reviewers) = dbrow($reviewquery);
186
-				dbquery("UPDATE ".$tableprefix."fanfiction_stats SET series = '$totalseries', chapters = '$chapters', members = '$members', newestmember = '$newest', reviews = '$reviews', reviewers = '$reviewers' WHERE sitekey = '".$sitekey."'"); 
187
-				$alltables = dbquery("SHOW TABLES");
188
-				while ($table = dbassoc($alltables)) {
189
-					foreach ($table as $db => $tablename) {
190
-						dbquery("OPTIMIZE TABLE `".$tablename."`");
191
-					}
192
-				}
193
-				$output .= write_message(_UPGRADE11END);
194
-			}
195
-			else $output .= write_message(_MISCDBUPDATEMANUAL._UPGRADE11END);
196
-		}
197
-		else $output .= write_message(_MISCDBUPDATEINFO."<br /><br /><a href='upgrade11.php?step=18&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?step=18&amp;install=manual'>"._MANUAL2."</a>");
198
-	break;
199
-	case "17":
200
-		$output .= "<div id='pagetitle'>"._NEWSUPDATE."</div>";
201
-		if(isset($_GET['install'])) {
202
-			include("../config.php");
203
-
204
-			$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
205
-			list($tableprefix) = dbrow($settings);
206
-			dbquery("ALTER TABLE `".$tableprefix."fanfiction_news` ADD `comments` INT NOT NULL DEFAULT '0'");
207
-			$newslist = dbquery("SELECT count(cid) as count, nid FROM ".$tableprefix."fanfiction_comments GROUP BY nid");
208
-			while($n = dbassoc($newslist)) {
209
-				dbquery("UPDATE ".$tableprefix."fanfiction_news SET comments = '".$n['count']."' WHERE nid = ".$n['nid']);
210
-			}
211
-			$comments = dbquery("SELECT uname FROM ".$tableprefix."fanfiction_comments GROUP BY uname");
212
-			while($uname = dbassoc($comments)) {
213
-				unset($uid);
214
-				$nameinfo = dbquery("SELECT uid FROM ".$tableprefix."fanfiction_authors WHERE penname = '".$uname['uname']."'");
215
-				list($uid) = dbrow($nameinfo);
216
-				if(empty($uid)) $uid = 0;
217
-				dbquery("UPDATE ".$tableprefix."fanfiction_comments SET uname = '$uid' WHERE uname = '".$uname['uname']."'");
218
-			}
219
-			$result2 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_comments` CHANGE `uname` `uid` INT NOT NULL DEFAULT '0';");
220
-			$output .= write_message(_NEWSUPDATERESULT.($result2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));	
221
-			$output .= write_message("<a href='upgrade11.php?step=18'>"._CONTINUE."</a>");				
222
-
223
-		}
224
-		else $output .= write_message(_NEWSUPDATEINFO."<br /><a href='upgrade11.php?step=17&amp;install=automatic'>"._CONTINUE."</a>");
225
-
226
-	break;
227
-	case "16":
228
-		$output .= "<div id='pagetitle'>"._AUTHORUPDATE."</div>";
229
-		if(isset($_GET['install'])) {
230
-			include("../config.php");
231
-			define("_BASEDIR", "../");
232
-			$settings = dbquery("SELECT tableprefix, defaultsort, displayindex, tinyMCE, storiespath FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
233
-			list($defaultsort, $displayindex, $tinyMCE, $storiespath) = dbrow($settings);
234
-			$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorprefs(`uid`, `newreviews`, `validated`, `userskin`, `level`, `categories`, `contact`) SELECT uid, newreviews, validated, userskin, level, categories, contact FROM ".$tableprefix."fanfiction_authors");
235
-			$result2 = dbquery("UPDATE ".$tableprefix."fanfiction_authorprefs set sortby = '$defaultsort', storyindex = '$displayindex', tinyMCE = '$tinyMCE'");
236
-			$authors = dbquery("SELECT author.penname, author.uid, count(stories.uid) as count FROM ".$tableprefix."fanfiction_authors as author, ".$tableprefix."fanfiction_stories as stories WHERE author.uid = stories.uid GROUP BY stories.uid");
237
-			while($author = dbassoc($authors)) {
238
-				if( file_exists( _BASEDIR.STORIESPATH."/$author[penname]/") ) {
239
-					$moved = rename(_BASEDIR.STORIESPATH."/$author[penname]/", _BASEDIR.STORIESPATH."/$author[uid]/");
240
-					$output .= $author['penname'].($moved ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">")."<br />";
241
-				}
242
-			}
243
-			$output .= write_message(_AUTHORRESULT.($result ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
244
-			$fields = dbquery("SELECT * FROM ".$tableprefix."fanfiction_authorfields WHERE field_on = 1");
245
-			while($f = dbassoc($fields)) {
246
-				$col = dbquery("SHOW COLUMNS FROM ".$tableprefix."fanfiction_authors LIKE '".$f['field_name']."'");
247
-				if(dbnumrows($col) > 0) {
248
-					$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_authorinfo(`uid`, `info`) SELECT uid, ".$f['field_name']." FROM ".$tableprefix."fanfiction_authors WHERE ".$f['field_name']." IS NOT NULL AND ".$f['field_name']." != ''");
249
-					$result2 = dbquery("UPDATE ".$tableprefix."fanfiction_authorinfo SET field = ".$f['field_id']." WHERE field = 0");
250
-				}
251
-			}
252
-			$result2 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_authors` DROP `validated`, DROP `userskin`, DROP `level`, DROP `contact`, DROP `categories`, DROP `carry`, CHANGE `admincreated` `admincreated` CHAR( 1 ) DEFAULT '0' NOT NULL;");
253
-			$output .= write_message(_AUTHORDROPRESULT.($result2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));	
254
-			$output .= write_message("<a href='upgrade11.php?step=17'>"._CONTINUE."</a>");				
255
-
256
-		}
257
-		else $output .= write_message(_AUTHORUPDATEINFO."<br /><a href='upgrade11.php?step=16&amp;install=automatic'>"._CONTINUE."</a>");
258
-	break;
259
-	case "15":
260
-		$output .= "<div id='pagetitle'>"._AUTHORFIELDS."</div>";
261
-		include("../config.php");
262
-		$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
263
-		list($tableprefix) = dbrow($settings);
264
-		if(isset($_GET['install'])) {
265
-			if($_GET['install'] == "automatic") {
266
-				$fields[] = array('4','lj','Live Journal','http://{info}.livejournal.com','','','0');
267
-				$fields[] = array('1','website','Web Site','','','','1');
268
-				$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');
269
-				$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');
270
-				$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');
271
-				$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');
272
-				$fields[] = array('4','da','Deviant Art','http://{info}.deviantart.com','','','0');
273
-				$fields[] = array('3','betareader','Beta-reader','','','','1');
274
-				$fields[] = array('4','dj','DeadJournal','http://{info}.deadjournal.com/','','','0');
275
-				$fields[] = array('4','xanga','Xanga','http://www.xanga.com/{info}','','','0');
276
-				$fields[] = array('2', 'gender', 'Gender', 'male|#|female|#|undisclosed', '', '', '0');
277
-				$fields[] = array('4','myspace','MySpace','http://www.myspace.com/{info}','','','0');
278
-		
279
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
280
-				list($tableprefix) = dbrow($settings);
281
-
282
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._FIELD."</th><th>"._RESULT."</th></tr>";
283
-				foreach($fields as $field) {
284
-					$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]."');");
285
-					$output .= "<tr><td>".$field[2]."</td><td align='center'>" . ($f ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
286
-				}
287
-				$output .= "</table>";
288
-				$output .= write_message(_FIELDAUTOFAIL." "._FIELDUPDATE."<br /><br /> <a href='upgrade11.php?step=16'>"._CONTINUE."</a>");
289
-			}
290
-			else {
291
-				$output .= write_message(_FIELDMANUAL," "._FIELDUPDATE."<br /><br /><a href='upgrade11.php?step=16'>"._CONTINUE."</a>");
292
-			}
293
-		}
294
-		else $output .= write_message(_FIELDDATAINFO."<br /><br /><a href='upgrade11.php?step=15&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?step=15&amp;install=manual'>"._MANUAL2."</a>");
295
-	break;
296
-	case "14":
297
-		$output .= "<div id='pagetitle'>"._UPDATECATORDER."</div>";
298
-		if(isset($_GET['install'])) {
299
-			if($_GET['install'] == "automatic") {
300
-				include("../config.php");
301
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
302
-				list($tableprefix) = dbrow($settings);
303
-				$selectA = "SELECT category, catid FROM ".$tableprefix."fanfiction_categories ORDER BY leveldown, displayorder";
304
-				$resultA = dbquery($selectA);
305
-				$countA = 1;
306
-				while($cat = dbassoc($resultA)) {
307
-					$count = 1;
308
-					if($cat[parentcatid] = -1) {
309
-						dbquery("UPDATE ".$tableprefix."fanfiction_categories SET displayorder = $countA WHERE catid = $cat[catid]");
310
-						$countA++;
311
-					}
312
-					$selectB = "SELECT category, catid FROM ".$tableprefix."fanfiction_categories WHERE parentcatid = '$cat[catid]' ORDER BY displayorder";
313
-					$resultB = dbquery($selectB) or die(_FATALERROR."Query: ".$selectB."<br />Error: (".mysql_errno( ).") ".mysql_error( ));
314
-					while($sub = dbassoc($resultB)) {
315
-						dbquery("UPDATE ".$tableprefix."fanfiction_categories SET displayorder = $count WHERE catid = $sub[catid]");
316
-						$count++;
317
-					}
318
-				}
319
-				$output .= write_message(_ACTIONSUCCESSFUL."<br /> <a href='upgrade11.php?step=15'>"._CONTINUE."</a>");
320
-			}
321
-		}
322
-		else {
323
-			include("../config.php");
324
-			$output .= write_message(_UPDATECATORDERINFO." <BR /><BR /><a href='upgrade11.php?step=14&amp;install=automatic'>"._CONTINUE."</a>");
325
-		}
326
-	break;
327
-	case "13":
328
-		$output .= "<div id='pagetitle'>"._FAVUPDATE."</div>";
329
-		if(isset($_GET['install'])) {
330
-			include("../config.php");
331
-			$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
332
-			list($tableprefix) = dbrow($settings);
333
-			$favst = dbquery("INSERT INTO ".$tableprefix."fanfiction_favorites(uid, item, type) SELECT uid, sid, 'ST' FROM ".$tableprefix."fanfiction_favstor");
334
-			$output .= write_message(_FAV1.($favst ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
335
-			$favau = dbquery("INSERT INTO ".$tableprefix."fanfiction_favorites(uid, item, type) SELECT uid, favuid, 'AU' FROM ".$tableprefix."fanfiction_favauth");
336
-			$output .= write_message(_FAV3.($favau ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
337
-			$drop1 = dbquery("DROP TABLE `".$tableprefix."fanfiction_favstor`");
338
-			$output .= write_message(_FAV4.($drop1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
339
-			$drop3 = dbquery("DROP TABLE `".$tableprefix."fanfiction_favauth`");
340
-			$output .= write_message(_FAV6.($drop3 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
341
-			$output .= write_message("<a href='upgrade11.php?step=14'>"._CONTINUE."</a>");		
342
-		}
343
-		else $output .= write_message(_FAVUPDATEINFO11."<br /><a href='upgrade11.php?step=13&amp;install=automatic'>"._CONTINUE."</a>");
344
-	break;
345
-	case "12":
346
-		$output .= "<div id='pagetitle'>"._UPDATESTORIES11."</div>";
347
-		if(isset($_GET['install'])) {
348
-			if($_GET['install'] == "automatic") {
349
-				include("../config.php");
350
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
351
-				list($tableprefix) = dbrow($settings);
352
-				$characters = dbquery("SELECT charid, charname FROM ".$tableprefix."fanfiction_characters");
353
-					while($char = dbassoc($characters)) {
354
-					$character[stripslashes($char[charname])] = $char[charid];
355
-				}
356
-				$ratlist = dbquery("SELECT * FROM ".$tableprefix."fanfiction_ratings");
357
-				while($rate = dbassoc($ratlist)) {
358
-					$ratingslist[$rate['rating']] = $rate['rid'];
359
-				}
360
-				$classresults = dbquery("SELECT * FROM ".$tableprefix."fanfiction_classes");
361
-				while($class = dbassoc($classresults)) {
362
-					$classlist[$class['class_name']] = array("id" => $class['class_id'], "type" => $class['class_type'], "name" => $class['class_name']);
363
-				}
364
-				$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
365
-				$stories = dbquery("SELECT s.*, AVG( re.rating ) AS rating, count( re.rating ) AS reviews FROM ".$tableprefix."fanfiction_stories AS s LEFT JOIN ".$tableprefix."fanfiction_reviews AS re ON s.sid = re.chapid GROUP BY s.sid LIMIT $offset, 200");
366
-				while($chapter = dbassoc($stories)) {
367
-					dbquery("INSERT INTO ".$tableprefix."fanfiction_chapters(`chapid` , `title` , `inorder` , `storytext` , `validated` , `wordcount` , `rating` , `reviews` , `sid` , `uid` ) VALUES('$chapter[sid]', '".addslashes($chapter[chapter])."', '".($chapter[inorder] + 1)."', '".addslashes($chapter[storytext])."', '$chapter[validated]', '$chapter[wordcount]', '".(empty($chapter[rating]) ? "0" : $chapter[rating])."', '$chapter[reviews]', '$chapter[psid]', '$chapter[uid]')");
368
-					if($chapter['sid'] == $chapter['psid']) {		
369
-						unset($genres, $warnings, $g, $w, $classes, $characters, $c, $clist, $rid);
370
-						$characters = explode(",", $chapter['charid']);
371
-						foreach($characters as $c) {
372
-							$clist[] = $character[$c];
373
-						}
374
-						$genres = explode(",", $chapter['gid']);
375
-						foreach($genres as $g) {
376
-							if($g && $g != " " && $classlist[$g]['type'] == 1) $classes[] = $classlist[$g]['id'];
377
-						}
378
-						$warnings = explode(",", $chapter['wid']);
379
-						foreach($warnings as $w) {
380
-							if($w && $w != " " && $classlist[$w]['type'] == 2) $classes[] = $classlist[$w]['id'];
381
-						}
382
-						$rid = $ratingslist[$chapter['rid']];
383
-						dbquery("UPDATE ".$tableprefix."fanfiction_stories SET rid = '$rid', classes = '".($classes ? implode(",", $classes) : "")."', charid = '".($clist ? implode(",", $clist) : "")."' WHERE sid = '$chapter[sid]'");
384
-					}
385
-				}
386
-				if(dbnumrows($stories)) $output .= write_message(_STORIES." ".($offset + 1)."-".($offset + dbnumrows($stories)).".<br /><a href='upgrade11.php?step=12&amp;install=automatic&amp;offset=".($offset+200)."'>"._CONTINUE."</a>");
387
-				else {
388
-					dbquery("DELETE FROM ".$tableprefix."fanfiction_stories WHERE sid != psid");
389
-					dbquery("ALTER TABLE `".$tableprefix."fanfiction_stories` CHANGE `featured` `featured` CHAR( 1 ) DEFAULT '0' NOT NULL ,
390
-CHANGE `validated` `validated` CHAR( 1 ) DEFAULT '0' NOT NULL ,
391
-CHANGE `rr` `rr` CHAR( 1 ) DEFAULT '0' NOT NULL, DROP `chapter`, 
392
-DROP `inorder`, 
393
-DROP `storytext`, 
394
-DROP `psid`,
395
-DROP `gid`,
396
-DROP `wid`,
397
-CHANGE `catid` `catid` VARCHAR( 100 ) DEFAULT '0' NOT NULL, 
398
-ADD `rating` TINYINT( 4 ) NOT NULL");
399
-	$stories = dbquery("SELECT AVG(rating) as average, item FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND rating != '-1' GROUP BY item");
400
-	while($s = dbassoc($stories)) {
401
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET rating = '".round($s['average'])."' WHERE sid = '".$s['item']."'");
402
-	}
403
-	$stories = dbquery("SELECT COUNT(reviewid) as count, item FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND review != 'No Review' GROUP BY item");
404
-	while($s = dbassoc($stories)) {
405
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET reviews = '".$s['count']."' WHERE sid = '".$s['item']."'");
406
-	}
407
-	dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET rating = '0', reviews = '0'");
408
-	$chapters = dbquery("SELECT AVG(rating) as average, chapid FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND rating != '-1' GROUP BY chapid");
409
-	while($c = dbassoc($chapters)) {
410
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET rating = '".round($c['average'])."' WHERE chapid = '".$c['chapid']."'");
411
-	}
412
-	$chapters = dbquery("SELECT COUNT(reviewid) as count, chapid FROM ".TABLEPREFIX."fanfiction_reviews WHERE type = 'ST' AND review != 'No Review' GROUP BY chapid");
413
-	while($c = dbassoc($chapters)) {
414
-		dbquery("UPDATE ".TABLEPREFIX."fanfiction_chapters SET reviews = '".$c['count']."' WHERE chapid = '".$c['chapid']."'");
415
-	}					$output .= write_message(_STORIESUPDATED."<br /><br /><a href='upgrade11.php?step=13&amp;install=automatic'>"._CONTINUE."</a>");
416
-				}
417
-			}
418
-		}
419
-		else {
420
-			include("../config.php");
421
-			$output .= write_message(_UPDATESTORIES11INFO."<br /><br /> <a href='upgrade11.php?step=12&amp;install=automatic'>"._CONTINUE."</a>");
422
-		}
423
-	break;
424
-	case "11":
425
-		$output .= "<div id='pagetitle'>"._REVIEWUPDATE."</div>";
426
-		if(isset($_GET['install'])) {
427
-			include("../config.php");
428
-			$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
429
-			list($tableprefix) = dbrow($settings);
430
-			$alter = dbquery("ALTER TABLE `".$tableprefix."fanfiction_reviews` CHANGE `psid` `item` INT( 11 ) NOT NULL DEFAULT '0'");
431
-			$output .= write_message(_REVIEWALTER7.($alter ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
432
-			$alter2 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_reviews` ADD `type` VARCHAR( 2 ) NOT NULL DEFAULT 'ST'");
433
-			$output .= write_message(_REVIEWALTER2.($alter2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
434
-			$alter3 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_reviews` CHANGE `member` `uid` INT( 11 ) NOT NULL DEFAULT '0'");
435
-			$output .= write_message(_REVIEWALTER3.($alter3 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
436
-			$alter4 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_reviews` ADD `respond` CHAR( 1 ) DEFAULT '0' NOT NULL");
437
-			$output .= write_message(_REVIEWALTER5.($alter4 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
438
-			$update1 = dbquery("UPDATE ".$tableprefix."fanfiction_reviews SET type = 'ST' WHERE item > 0");
439
-			$alter5 = dbquery("ALTER TABLE `".$tableprefix."fanfiction_reviews` CHANGE `sid` `chapid` INT( 11 ) NOT NULL DEFAULT '0'");
440
-			$output .= write_message(_REVIEWALTER6.($alter5 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
441
-
442
-			$output .= write_message(_REVIEWUPDATE1.($update1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
443
-			$update3 = dbquery("UPDATE ".$tableprefix."fanfiction_reviews SET respond = 1 WHERE review LIKE \"%Author's Response:%\"");
444
-			$output .= write_message(_REVIEWUPDATE3.($update3 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
445
-			$output .= write_message("<a href='upgrade11.php?step=12'>"._CONTINUE."</a>");
446
-		}
447
-		else $output .= write_message(_REVIEWUPDATEINFO."<br /><a href='upgrade11.php?step=11&amp;install=automatic'>"._CONTINUE."</a>");
448
-
449
-	break;
450
-	case "10":
451
-		$output .= "<div id='pagetitle'>"._UPDATESTORIESTABLE11."</div>";
452
-		if(isset($_GET['install'])) {
453
-			if($_GET['install'] == "automatic") {
454
-				include("../config.php");
455
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
456
-				list($tableprefix) = dbrow($settings);
457
-				$result = dbquery("ALTER TABLE ".$tableprefix."fanfiction_stories ADD `classes` VARCHAR( 200 ) NULL AFTER `catid`;");
458
-				if($result) $result = dbquery("ALTER TABLE ".$tableprefix."fanfiction_stories CHANGE `summary` `summary` TEXT NULL");
459
-				if($result) $result = dbquery("ALTER TABLE ".$tableprefix."fanfiction_stories ADD `coauthors` tinyint(1) NULL AFTER `uid`");
460
-				if($result) $result = dbquery("ALTER TABLE ".$tableprefix."fanfiction_stories CHANGE `numreviews` `reviews` SMALLINT( 6 ) DEFAULT '0' NOT NULL");
461
-				if($result) $result = dbquery("ALTER TABLE ".$tableprefix."fanfiction_stories CHANGE `counter` `count` INT( 11 ) NOT NULL DEFAULT '0' AFTER `reviews`;");
462
-				if($result) $result = dbquery("ALTER TABLE ".$tableprefix."fanfiction_stories ADD `storynotes` TEXT NULL AFTER `summary`;");
463
-				if($result) $output .= write_message(_ACTIONSUCCESSFUL."<br /> <a href='upgrade11.php?step=11'>"._CONTINUE."</a>");
464
-			}
465
-			else if($_GET['install'] == "manual") {
466
-				$output .= write_message(_UPDATESTORIESTABLEMANUAL11."<br /> <a href='upgrade11.php?step=11'>"._CONTINUE."</a>");
467
-			}
468
-		}
469
-		else {
470
-			include("../config.php");
471
-			$output .= write_message(_UPDATESTORIESTABLEINFO11." <a href='upgrade11.php?step=10&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?step=10&amp;install=manual'>"._MANUAL2."</a>");
472
-		}
473
-	break;	case "9":
474
-		$output .= "<div id='pagetitle'>"._MOVECLASSES."</div>";
475
-		if(isset($_GET['install'])) {
476
-			include("../config.php");
477
-			$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
478
-			list($tableprefix) = dbrow($settings);
479
-			$newclass = dbquery("INSERT INTO ".$tableprefix."fanfiction_classtypes (`classtype_name`, `classtype_title`) VALUES('genres', 'Genres');");
480
-			$genres = dbquery("SELECT * FROM ".$tableprefix."fanfiction_genres");
481
-			$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Genres</th><th>Result</th></tr>";
482
-			while($g = dbassoc($genres)) {
483
-				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_classes (`class_type`, `class_name`) VALUES('1', '".$g['genre']."')");
484
-				$output .= "<tr><td>".$g['genre']."</td><td align='center'>" . ($result ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
485
-			}
486
-			$output .= "</table>";
487
-			// Ditto with the warnings
488
-			$newclass = dbquery("INSERT INTO ".$tableprefix."fanfiction_classtypes (`classtype_name`, `classtype_title`) VALUES('warnings', 'Warnings');");
489
-			$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Warnings</th><th>Result</th></tr>";
490
-			$warnings = dbquery("SELECT * FROM ".$tableprefix."fanfiction_warnings");
491
-			while($w = dbassoc($warnings)) {
492
-				$result = dbquery("INSERT INTO ".$tableprefix."fanfiction_classes (`class_type`, `class_name`) VALUES('2', '$w[warning]')");
493
-				$output .= "<tr><td>".$w['warning']."</td><td align='center'>" . ($result ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
494
-			}
495
-			$output .= "</table>";
496
-			$drop1 = dbquery("DROP TABLE `".$tableprefix."fanfiction_genres`");
497
-			$output .= write_message(_DROPGENRES.($drop1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
498
-			$drop2 = dbquery("DROP TABLE `".$tableprefix."fanfiction_warnings`");
499
-			$output .= write_message(_DROPWARNINGS.($drop2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
500
-			
501
-			$output .= write_message(_MOVECLASSFAIL."<br /><a href='upgrade11.php?step=10'>continue</a>");
502
-		}
503
-		else $output .= write_message(_MOVECLASSESINFO."<br /><a href='upgrade11.php?step=9&amp;install=automatic'>"._CONTINUE."</a>");
504
-	break;
505
-	case "8":
506
-		$output .= "<div id='pagetitle'>"._MESSAGEDATA."</div>";
507
-		if(isset($_GET['install'])) {
508
-			if($_GET['install'] == "automatic") {
509
-				include("../config.php");
510
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
511
-				list($tableprefix) = dbrow($settings);
512
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Message</th><th>Result</th></tr>";
513
-				$settings = dbquery("SELECT * FROM ".$tableprefix."fanfiction_settings_old");
514
-				if(!$settings) $settings = dbquery("SELECT * FROM ".$tableprefix."fanfiction_settings");
515
-				$messages = dbassoc($settings);
516
-				foreach($messages as $name => $text) {
517
-					
518
-					$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages` (`message_name`, `message_title`, `message_text`) VALUES ('$name', '".$defaulttitles[$name]."', '".addslashes($text)."');");
519
-					$output .= "<tr><td>".$defaulttitles[$name]."</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
520
-				}
521
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages`(`message_name`, `message_title`, `message_text`) VALUES ('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.');");
522
-				$output .= "<tr><td>Printable Copyright</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
523
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages`(`message_name`, `message_title`, `message_text`) VALUES ('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>');");
524
-				$output .= "<tr><td>Submission Rules</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
525
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages`(`message_name`, `message_title`, `message_text`) VALUES ('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.');");
526
-				$output .= "<tr><td>Terms of Service</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
527
-				$msg = dbquery("INSERT INTO `".$tableprefix."fanfiction_messages`(`message_name`, `message_title`, `message_text`) VALUES('maintenance', 'Site Maintenance', '<p style=\"text-align: center;\">This site is currently undergoing maintenance.  Please check back soon.  Thank you.</p>');");
528
-				$output .= "<tr><td>Site Maintenance</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
529
-				$output .= "</table>";
530
-				$output .= write_message(_MESSAGEAUTOFAILUPGRADE."<br /><a href='upgrade11.php?step=9'>continue</a>");
531
-			}
532
-		}
533
-		else $output .= write_message(_MESSAGEDATAUPGRADE."<br /><a href='upgrade11.php?step=8&amp;install=automatic'>"._CONTINUE."</a>");
534
-
535
-	break;
536
-	case "7":
537
-		$output .= "<div id='pagetitle'>"._BLOCKDATA."</div>";
538
-		if(isset($_GET['install'])) {
539
-			if($_GET['install'] == "automatic") {
540
-				include("../config.php");
541
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
542
-				list($tableprefix) = dbrow($settings);
543
-				$blocklist = array(
544
-					array("categories","Categories","categories/categories.php","1",""),
545
-					array("featured","Featured Stories","featured/featured.php","1",""),
546
-					array("info","Site Info","info/info.php","2",""),
547
-					array("login","Log In","login/login.php","1",""),
548
-					array("menu","Main Menu","menu/menu.php","1",""),
549
-					array("random","Random Story","random/random.php","2",""),
550
-					array("recent","Most Recent","recent/recent.php","2","a:1:{s:3:\"num\";s:1:\"1\";}"),
551
-					array("skinchange","Skin Change","skinchange/skinchange.php","1",""),
552
-					array("news","Site News","news/news.php","1","a:1:{s:3:\"num\";s:1:\"1\";}")
553
-				);
554
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._BLOCK."</th><th>"._RESULT."</th></tr>";
555
-				foreach($blocklist as $block) {
556
-					$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])."');");
557
-					$output .= "<tr><td>".$block[1]."</td><td align='center'>" . ($b ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
558
-				}
559
-				$output .= "</table>";
560
-				$output .= write_message(_BLOCKDATAFAILUPGRADE."<br /><br /><a href='upgrade11.php?step=8'>"._CONTINUE."</a>");
561
-			}
562
-			else {
563
-				$output .= write_message(_BLOCKDATAMANUAL."<br /><br /><a href='upgrade11.php?step=7'>"._CONTINUE."</a>");
564
-			}
565
-		}
566
-		else $output .= write_message(_BLOCKDATANEW."<br /><br /><a href='upgrade11.php?step=7&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='iupgrade11.php?step=7&amp;install=manual'>"._MANUAL2."</a>");
567
-	break;
568
-	case "6":
569
-		$output .= "<div id='pagetitle'>"._LINKDATA."</div>";
570
-		if(isset($_GET['install'])) {
571
-			if($_GET['install'] == "automatic") {
572
-				include("../config.php");
573
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
574
-				list($tableprefix) = dbrow($settings);
575
-				$pagelist = array(
576
-					array("home","Home","index.php","0","0"),
577
-					array("recent","Most Recent","browse.php?type=recent","0","0"),
578
-					array("login","Login","user.php?action=login","0","0"),
579
-					array("adminarea","Admin","admin.php","0","2"),
580
-					array("logout","Logout","user.php?action=logout","0","1"),
581
-					array("featured","Featured Stories","browse.php?type=featured","0","0"),
582
-					array("catslink","Categories","browse.php?type=categories","0","0"),
583
-					array("members","Members","authors.php?action=list","0","0"),
584
-					array("authors","Authors","authors.php?list=authors","0","0"),
585
-					array("help","Help","viewpage.php?page=help","0","0"),
586
-					array("search","Search","search.php","0","0"),
587
-					array("series","Series","browse.php?type=series","0","0"),
588
-					array("tens","Top Tens","toplists.php","0","0"),
589
-					array("challenges","Challenges","modules/challenges/challenges.php","0","0"),
590
-					array("contactus","Contact Us","contact.php","0","0"),
591
-					array("rules","Rules","viewpage.php?page=rules","0","0"),
592
-					array("tos","Terms of Service","viewpage.php?page=tos","0","0"),
593
-					array("rss","<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>","rss.php","0","0"),
594
-					array("login","Account Info","user.php","0","1"),
595
-					array("titles","Titles","browse.php?type=titles","0","0"),
596
-					array("register","Register","user.php?action=register","0","0"),
597
-					array("lostpassword","Lost Password","user.php?action=lostpassword","0","0"),
598
-					array("newsarchive","News Archive","news.php","0","0"),
599
-					array("browse","Browse","browse.php","0","0"),
600
-					array("charslink", "Characters", "browse.php?type=characters","0","0"),
601
-					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
602
-					array("genres_link", "Genres", "browse.php?type=class&amp;type_id=1", "0", "0"),
603
-					array("warnings_link", "Warnings", "browse.php?type=class&amp;type_id=2", "0", "0")
604
-				);
605
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Pages</th><th>Result</th></tr>";
606
-				foreach($pagelist as $page) {
607
-					$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]."');");
608
-					$output .= "<tr><td>".stripslashes($page[1])."</td><td align='center'>" . ($pages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
609
-				}
610
-
611
-				$output .= "</table>";
612
-				$output .= write_message(_LINKAUTOFAIL."<br /><a href='upgrade11.php?step=7'>"._CONTINUE."</a>");
613
-			}
614
-			else {
615
-				$output .= write_message(_LINKMANUAL."<br /><a href='upgrade11.php?step=7'>"._CONTINUE."</a>");
616
-			}
617
-		}
618
-		else $output .= write_message(_LINKDATAINFO." "._LINKSETUP." <a href='upgrade11.php?step=6&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?step=6&amp;install=manual'>"._MANUAL2."</a>");
619
-	break;
620
-	case "5":
621
-		$output .= "<div id='pagetitle'>"._PANELDATA."</div>";
622
-		if(isset($_GET['install'])){
623
-			if($_GET['install'] == "automatic") {
624
-				include("../config.php");
625
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
626
-				list($tableprefix) = dbrow($settings);
627
-				$panellist = array(
628
-					array("submitted","Submissions", "","3","5","0","A"),
629
-					array("versioncheck", "Version Check", "", "3", "7", "0", "A"),
630
-					array("newstory","Add New Story","stories.php?action=newstory&admin=1","3","3","0","A"),
631
-					array("addseries","Add New Series","series.php?action=add","3","3","0","A"),
632
-					array("news","News","","3","5","0","A"),
633
-					array("featured","Featured Stories","","3","5","0","A"),
634
-					array("characters","Characters","","2","2","0","A"),
635
-					array("ratings","Ratings","","2","3","0","A"),
636
-					array("members","Members","","2","5","0","A"),
637
-					array("mailusers","Mail Users","","2","6","0","A"),
638
-					array("settings","Settings","","1","2","0","A"),
639
-					array("blocks","Blocks","","1","3","0","A"),
640
-					array("censor","Censor","","1","0","1","A"),
641
-					array("admins","Admins","","1","6","0","A"),
642
-					array("classifications","Classifications","","2","4","0","A"),
643
-					array("categories","Categories","","2","1","0","A"),
644
-					array("custpages","Custom Pages","","1","4","0","A"),
645
-					array("validate","Validate Submission","","3","0","1","A"),
646
-					array("yesletter","Validation Letter","","3","0","1","A"),
647
-					array("noletter","Rejection Letter","","3","0","1","A"),
648
-					array("links","Page Links","","1","5","0","A"),
649
-					array("messages","Message Settings","","2","0","1","A"),
650
-					array("login","Login","","0","0","1","U"),
651
-					array("logout","Logout","","1","5","0","U"),
652
-					array("revreceived","Reviews Received","","1","0","1","U"),
653
-					array("editprefs","Edit Preferences","","1","2","0","U"),
654
-					array("lostpassword","Lost Password","","0","0","1","U"),
655
-					array("editbio","Edit Bio","","1","1","0","U"),
656
-					array("register","Register","","0","0","1","U"),
657
-					array("manageimages","Manage Images","","1","5","0","S"),
658
-					array("manfavs","Manage Favorites","","1","2","0","F"),
659
-					array("revres","Review Response","","1","0","1","U"),
660
-					array("stats","View Your Statistics","","1","3","0","U"),
661
-					array("newstory","Add New Story","stories.php?action=newstory","1","1","0","S"),
662
-					array("newseries","Add New Series","series.php?action=add","1","3","0","S"),
663
-					array("managestories","Manage Stories","stories.php?action=viewstories","1","2","0","S"),
664
-					array("manageseries","Manage Series","series.php?action=manage","1","4","0","S"),
665
-					array("reviewsby","Your Reviews","","1","0","1","U"),
666
-					array("storiesby","Stories by {author}","","0","1","0","P"),
667
-					array("seriesby","Series by {author}","","0","2","0","P"),
668
-					array("reviewsby","Reviews by {author}","","0","3","0","P"),
669
-					array("categories","Categories","","0","1","0","B"),
670
-					array("characters","Characters","","0","2","0","B"),
671
-					array("ratings","Ratings","","0","3","0","B"),
672
-					array("titles","Titles","","0","5","0","B"),
673
-					array("class","Classes","","0","0","1","B"),
674
-					array("recent","Most Recent","","0","0","1","B"),
675
-					array("featured","Featured Stories","","0","0","1","B"),
676
-					array("panels","Panels","","1","1","0","A"),
677
-					array("phpinfo","PHP Info","","1","7","0","A"),
678
-					array("contact","Contact","","0","0","1","P"),
679
-					array("series", "Series", "", "0", "4", "0", "B"),
680
-					array("viewlog", "Action Log", "", "1", "8", "0", "A"),
681
-					array("shortstories","10 Shortest Stories","toplists/default.php","0","6","0","L"), 
682
-					array("longstories","10 Longest Stories","toplists/default.php","0","5","0","L"), 
683
-					array("largeseries","10 Largest Series","toplists/default.php","0","1","0","L"), 
684
-					array("smallseries","10 Smallest Series","toplists/default.php","0","2","0","L"), 
685
-					array("reviewedseries","10 Most Reviewed Series","toplists/default.php","0","4","0","L"), 
686
-					array("prolificauthors","10 Most Prolific Authors","toplists/default.php","0","10","0","L"), 
687
-					array("prolificreviewers","10 Most Prolific Reviewers","toplists/default.php","0","12","0","L"), 
688
-					array("reviewedstories","10 Most Reviewed Stories","toplists/default.php","0","8","0","L"), 
689
-					array("readstories","10 Most Read Stories","toplists/default.php","0","9","0","L"),
690
-					array("favstories","10 Most Favorite Stories","toplists/default.php","0","7","0","L"), 
691
-					array("favauthors","10 Most Favorite Authors","toplists/default.php","0","11","0","L"), 
692
-					array("favseries","10 Most Favorite Series","toplists/default.php","0","3","0","L"), 
693
-					array("favst","Favorite Stories","","0","0","1","F"),
694
-					array("favse","Favorite Series","","0","0","1","F"),
695
-					array("favau","Favorite Authors","","0","0","1","F"),
696
-					array("favst","Favorite Stories","","0","0","1","U"),
697
-					array("favse","Favorite Series","","0","0","1","U"),
698
-					array("favau","Favorite Authors","","0","0","1","U"),
699
-					array("favlist","{author}\'s Favorites","viewuser.php?action=manfavs","0","5","0","F"),
700
-					array("skins", "Skins", "", "3", "6", "0", "A"),
701
-					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
702
-					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
703
-					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
704
-					array('modules', 'Modules', '', 1, "11", 0, 'A')
705
-
706
-				);
707
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>Result</th></tr>";
708
-				foreach($panellist as $panel) {
709
-					unset($panels);
710
-					$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]."');");
711
-					$output .= "<tr><td>".stripslashes($panel[1])."</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
712
-				}
713
-				$output .= "</table>";
714
-				$output .= write_message(_PANELAUTOFAIL."<br /> <a href='upgrade11.php?step=6'>"._CONTINUE."</a>");
715
-			}
716
-			else {
717
-				$output .= write_message(_PANELMANUAL."<br /> <a href='upgrade11.php?step=6'>"._CONTINUE."</a>");
718
-			}
719
-		}
720
-		else $output .= write_message(_PANELDATAINFO." "._PANELSETUP." <a href='upgrade11.php?step=5&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?step=5&amp;install=manual'>"._MANUAL2."</a>");
721
-	break;
722
-	case "4":
723
-		$output .= "<div id='pagetitle'>"._INSTALLTABLES."</div>";
724
-		if(isset($_GET['install'])) {
725
-			if($_GET['install'] == "automatic") {
726
-				include("../config.php");
727
-				$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
728
-				list($tableprefix) = dbrow($settings);
729
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Table</th><th>Result</th></tr>";
730
-				$authorfields = dbquery("CREATE TABLE `".$tableprefix."fanfiction_authorfields` (
731
-  `field_id` int(11) NOT NULL AUTO_INCREMENT,
732
-  `field_type` tinyint(4) NOT NULL default '0',
733
-  `field_name` varchar(30) NOT NULL default ' ',
734
-  `field_title` varchar(255) NOT NULL default ' ',
735
-  `field_options` text,
736
-  `field_code_in` text,
737
-  `field_code_out` text,
738
-  `field_on` tinyint(1) NOT NULL default '0',
739
-  PRIMARY KEY  (`field_id`)
740
-) ENGINE=MyISAM;");
741
-$output .= "<tr><td>".$tableprefix."fanfiction_authorfields</td><td align='center'>" . ($authorfields ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
742
-				$authorinfo = dbquery("CREATE TABLE `".$tableprefix."fanfiction_authorinfo` (
743
-  `uid` int(11) NOT NULL default '0',
744
-  `field` int(11) NOT NULL default '0',
745
-  `info` varchar(255) NOT NULL default ' ',
746
-  KEY `uid` (`uid`)
747
-) ENGINE=MyISAM;");
748
-$output .= "<tr><td>".$tableprefix."fanfiction_authorinfo</td><td align='center'>" . ($authorinfo ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
749
-				$authorprefs = dbquery("
750
-CREATE TABLE `".$tableprefix."fanfiction_authorprefs` (
751
-  `uid` int(11) NOT NULL default '0',
752
-  `newreviews` tinyint(1) NOT NULL default '0',
753
-  `newrespond` tinyint(1) NOT NULL default '0',
754
-  `ageconsent` tinyint(1) NOT NULL default '0',
755
-  `alertson` tinyint(1) NOT NULL default '0',
756
-  `tinyMCE` tinyint(1) NOT NULL default '0',
757
-  `sortby` tinyint(1) NOT NULL default '0',
758
-  `storyindex` tinyint(1) NOT NULL default '0',
759
-  `validated` tinyint(1) NOT NULL default '0',
760
-  `userskin` varchar(60) NOT NULL default 'default',
761
-  `level` tinyint(1) NOT NULL default '0',
762
-  `categories` varchar(200) NOT NULL default '0',
763
-  `contact` tinyint(1) NOT NULL default '0',
764
-  `stories` int(11) NOT NULL default '0',
765
-   PRIMARY KEY  (`uid`)
766
-) ENGINE=MyISAM;");
767
-$output .= "<tr><td>".$tableprefix."fanfiction_authorprefs</td><td align='center'>" . ($authorprefs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
768
-				$blocks = dbquery("CREATE TABLE `".$tableprefix."fanfiction_blocks` (
769
-  `block_id` int(11) NOT NULL auto_increment,
770
-  `block_name` varchar(30) NOT NULL default '',
771
-  `block_title` varchar(150) NOT NULL default '',
772
-  `block_file` varchar(200) NOT NULL default '',
773
-  `block_status` tinyint(1) NOT NULL default '0',
774
-  `block_variables` text NOT NULL,
775
-  PRIMARY KEY  (`block_id`),
776
-  KEY `block_name` (`block_name`)
777
-) ENGINE=MyISAM;");
778
-$output .= "<tr><td>".$tableprefix."fanfiction_blocks</td><td align='center'>" . ($blocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
779
-				$chapters = dbquery("CREATE TABLE `".$tableprefix."fanfiction_chapters` (
780
-  `chapid` int(11) NOT NULL auto_increment,
781
-  `title` varchar(250) NOT NULL default '',
782
-  `inorder` int(11) NOT NULL default '0',
783
-  `notes` text NULL,
784
-  `storytext` text NULL,
785
-  `endnotes` text NULL,
786
-  `validated` char(1) NOT NULL default '0',
787
-  `wordcount` int(11) NOT NULL default '0',
788
-  `rating` tinyint(4) NOT NULL default '0',
789
-  `reviews` smallint(6) NOT NULL default '0',
790
-  `sid` int(11) NOT NULL default '0',
791
-  `uid` int(11) NOT NULL default '0',
792
-  `count` int(11) NOT NULL default '0',
793
-  PRIMARY KEY  (`chapid`),
794
-  KEY `sid` (`sid`),
795
-  KEY `uid` (`uid`),
796
-  KEY `inorder` (`inorder`),
797
-  KEY `title` (`title`),
798
-  KEY `validated` (`validated`)
799
-) ENGINE=MyISAM;");
800
-$output .= "<tr><td>".$tableprefix."fanfiction_chapters</td><td align='center'>" . ($chapters ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
801
-				$classes = dbquery("CREATE TABLE `".$tableprefix."fanfiction_classes` (
802
-  `class_id` int(11) NOT NULL auto_increment,
803
-  `class_type` int(11) NOT NULL default '0',
804
-  `class_name` varchar(100) NOT NULL default '',
805
-  PRIMARY KEY  (`class_id`)
806
-) ENGINE=MyISAM;");
807
-
808
-$output .= "<tr><td>".$tableprefix."fanfiction_classes</td><td align='center'>" . ($classes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
809
-				$classtypes = dbquery("CREATE TABLE `".$tableprefix."fanfiction_classtypes` (
810
-  `classtype_id` int(11) NOT NULL auto_increment,
811
-  `classtype_name` varchar(50) NOT NULL default '',
812
-  `classtype_title` varchar(50) NOT NULL default '',
813
-  PRIMARY KEY  (`classtype_id`),
814
-  KEY `classtype_title` (`classtype_title`)
815
-) ENGINE=MyISAM;");
816
-$output .= "<tr><td>".$tableprefix."fanfiction_classtypes</td><td align='center'>" . ($classtypes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
817
-$coauthors = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_coauthors` (
818
-  `sid` int(11) NOT NULL default '0',
819
-  `uid` int(11) NOT NULL default '0',
820
-  PRIMARY KEY  (`sid`,`uid`)
821
-) ENGINE=MyISAM;");
822
-$output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>" . ($coauthors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
823
-				$codeblocks = dbquery("CREATE TABLE `".$tableprefix."fanfiction_codeblocks` (
824
-  `code_id` int(11) NOT NULL auto_increment,
825
-  `code_text` text NOT NULL,
826
-  `code_type` varchar(20) default NULL,
827
-  `code_module` varchar(60) default NULL,
828
-  PRIMARY KEY  (`code_id`)
829
-) ENGINE=MyISAM;");
830
-$output .= "<tr><td>".$tableprefix."fanfiction_codeblocks</td><td align='center'>" . ($codeblocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
831
-				$favorites = dbquery("CREATE TABLE `".$tableprefix."fanfiction_favorites` (
832
-  `uid` int(11) NOT NULL default '0',
833
-  `item` int(11) NOT NULL default '0',
834
-  `type` char(2) NOT NULL default '',
835
-  `comments` text NULL,
836
-  KEY `uid` (`uid`)
837
-) ENGINE=MyISAM;");
838
-$output .= "<tr><td>".$tableprefix."fanfiction_favorites</td><td align='center'>" . ($favorites ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
839
-				$inseries = dbquery("CREATE TABLE `".$tableprefix."fanfiction_inseries` (
840
-  `seriesid` int(11) NOT NULL default '0',
841
-  `sid` int(11) NOT NULL default '0',
842
-  `subseriesid` int(11) NOT NULL default '0',
843
-  `confirmed` int(11) NOT NULL default '0',
844
-  `inorder` int(11) NOT NULL default '0',
845
-   PRIMARY KEY  (`sid`,`seriesid`, `subseriesid`),
846
-   KEY `seriesid` (`seriesid`,`inorder`)
847
-) ENGINE=MyISAM;");
848
-$output .= "<tr><td>".$tableprefix."fanfiction_inseries</td><td align='center'>" . ($inseries ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
849
-				$logs = dbquery("CREATE TABLE `".$tableprefix."fanfiction_log` (
850
-  `log_id` int(11) NOT NULL auto_increment,
851
-  `log_action` varchar(255) default NULL,
852
-  `log_uid` int(11) NOT NULL,
853
-  `log_ip` int(11) UNSIGNED default NULL,
854
-  `log_timestamp` timestamp NOT NULL,
855
-  `log_type` varchar(2) NOT NULL,
856
-  PRIMARY KEY  (`log_id`)
857
-) ENGINE=MyISAM");
858
-$output .= "<tr><td>".$tableprefix."fanfiction_log</td><td align='center'>" . ($logs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
859
-				$messages = dbquery("CREATE TABLE `".$tableprefix."fanfiction_messages` (
860
-  `message_id` int(11) NOT NULL auto_increment,
861
-  `message_name` varchar(50) NOT NULL default '',
862
-  `message_title` varchar(200) NOT NULL default '',
863
-  `message_text` text NULL,
864
-  PRIMARY KEY  (`message_id`)
865
-) ENGINE=MyISAM;");
866
-$output .= "<tr><td>".$tableprefix."fanfiction_messages</td><td align='center'>" . ($messages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
867
-				$modules = dbquery("
868
-CREATE TABLE `".$tableprefix."fanfiction_modules` (
869
-  `id` int(11) NOT NULL auto_increment,
870
-  `name` varchar(100) NOT NULL default 'Test Module',
871
-  `version` varchar(10) NOT NULL default '1.0',
872
-  PRIMARY KEY  (`id`),
873
-  KEY `name_version` (`name`,`version`)
874
-)");
875
-$output .= "<tr><td>".$tableprefix."fanfiction_modules</td><td align='center'>" . ($modules ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
876
-				$pagelinks = dbquery("CREATE TABLE `".$tableprefix."fanfiction_pagelinks` (
877
-  `link_id` int(11) NOT NULL auto_increment,
878
-  `link_name` varchar(50) NOT NULL default '',
879
-  `link_text` varchar(100) NOT NULL default '',
880
-  `link_key` CHAR( 1 ) NULL,
881
-  `link_url` varchar(250) NOT NULL default '',
882
-  `link_target` char(1) NOT NULL default '0',
883
-  `link_access` tinyint(4) NOT NULL default '0',
884
-  PRIMARY KEY  (`link_id`),
885
-  KEY `link_text` (`link_text`),
886
-  KEY `link_name` (`link_name`)
887
-) ENGINE=MyISAM;");
888
-$output .= "<tr><td>".$tableprefix."fanfiction_pagelinks</td><td align='center'>" . ($pagelinks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
889
-				$panels = dbquery("CREATE TABLE `".$tableprefix."fanfiction_panels` (
890
-  `panel_id` int(11) NOT NULL auto_increment,
891
-  `panel_name` varchar(50) NOT NULL default 'unknown',
892
-  `panel_title` varchar(100) NOT NULL default 'Unnamed Panel',
893
-  `panel_url` varchar(100) default NULL,
894
-  `panel_level` tinyint(4) NOT NULL default '3',
895
-  `panel_order` tinyint(4) NOT NULL default '0',
896
-  `panel_hidden` tinyint(1) NOT NULL default '0',
897
-  `panel_type` varchar(20) NOT NULL default 'A',
898
-  PRIMARY KEY  (`panel_id`),
899
-  KEY `panel_hidden` (`panel_hidden`),
900
-  KEY `panel_type` (`panel_type`)
901
-) ENGINE=MyISAM;");
902
-$output .= "<tr><td>".$tableprefix."fanfiction_panels</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
903
-				$series = dbquery("CREATE TABLE `".$tableprefix."fanfiction_series` (
904
-  `seriesid` int(11) NOT NULL auto_increment,
905
-  `title` varchar(200) NOT NULL default '',
906
-  `summary` text NOT NULL,
907
-  `uid` int(11) NOT NULL default '0',
908
-  `isopen` tinyint(4) NOT NULL default '0',
909
-  `catid` varchar(200) NOT NULL default '0',
910
-  `rating` tinyint(4) NOT NULL default '0',
911
-  `classes` varchar(200) NOT NULL default '',
912
-  `characters` varchar(250) NOT NULL default '',
913
-  `reviews` smallint(6) NOT NULL default '0',
914
-  `numstories` INT NOT NULL DEFAULT '0',
915
-  PRIMARY KEY  (`seriesid`),
916
-  KEY `catid` (`catid`),
917
-  KEY `characters` (`characters`),
918
-  KEY `classes` (`classes`),
919
-  KEY `owner` (`uid`,`title`)
920
-) ENGINE=MyISAM;");
921
-$output .= "<tr><td>".$tableprefix."fanfiction_series</td><td align='center'>" . ($series ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
922
-	$stats = dbquery("CREATE TABLE `".$tableprefix."fanfiction_stats` (
923
-  `sitekey` varchar(50) NOT NULL default '0',
924
-  `stories` int(11) NOT NULL default '0',
925
-  `chapters` int(11) NOT NULL default '0',
926
-  `series` int(11) NOT NULL default '0',
927
-  `reviews` int(11) NOT NULL default '0',
928
-  `wordcount` int(11) NOT NULL default '0',
929
-  `authors` int(11) NOT NULL default '0',
930
-  `members` int(11) NOT NULL default '0',
931
-  `reviewers` int(11) NOT NULL default '0',
932
-  `newestmember` int(11) NOT NULL default '0'
933
-) ENGINE=MyISAM");
934
-	dbquery("INSERT INTO ".$tableprefix."fanfiction_stats(`sitekey`) VALUES('".$sitekey."')");
935
-$output .= "<tr><td>".$tableprefix."fanfiction_stats</td><td align='center'>" . ($stats ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
936
-$output .= "</table>";
937
-$output .= write_message(_NEWTABLEAUTOFAIL11."<br /> <a href='upgrade11.php?step=5'>"._CONTINUE."</a>");
938
-			}
939
-			else if($_GET['install'] == "manual") {
940
-				$output .= write_message(_NEWTABLESSETUP."<br /> <a href='upgrade11.php?step=5'>"._CONTINUE."</a>");
941
-			}
942
-		}
943
-		else {
944
-			include("../config.php");
945
-			$output .= write_message(_NEWTABLESSETUP." <a href='upgrade11.php?step=4&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?step=4&amp;install=manual'>"._MANUAL2."</a>");
946
-		}
947
-	break;
948
-	case "3":			
949
-		define ("_BASEDIR", "../");
950
-		include("../config.php");
951
-		define("SITEKEY", $sitekey);
952
-		if(!$_GET['sect']) $sect = "main";
953
-		else $sect = $_GET['sect'];
954
-		$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
955
-		if(dbnumrows($settingsresults) == 0) {
956
-			dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings (`sitekey`) VALUES('".$sitekey."');");
957
-			$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
958
-		}
959
-		$settings = dbassoc($settingsresults);
960
-			foreach($settings as $var => $val) {
961
-			$$var = stripslashes($val);
962
-		}
963
-		define("TABLEPREFIX", $tableprefix);
964
-		if((empty($sect) || $sect == "main") && !isset($_POST['submit'])) $output .= write_message(_SKINWARNING);
965
-		if($sect == "submissions") {
966
-			if($_POST['submit']) {
967
-				$storiespath = descript($_POST['newstoriespath']);
968
-				if(!file_exists($storiespath) && !file_exists("../".$storiespath)) {
969
-					if(!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
970
-					mkdir("$storiespath", 0755);
971
-					chmod("$storiespath", 0777);
972
-				}
973
-			}
974
-		}
975
-		if($sect == "email" && $_POST['submit']) {
976
-			$output .= "<div id=\"pagetitle\">"._SETTINGS."</div>";
977
-			$smtp_host = $_POST['newsmtp_host'];
978
-			$smtp_username = $_POST['newsmtp_username'];
979
-			$smtp_password = $_POST['newsmtp_password'];
980
-			$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '".$sitekey."'");
981
-			if($result) {
982
-				$output .= write_message(_ACTIONSUCCESSFUL);
983
-				$output .= write_message("<a href='upgrade11.php?step=4'>"._CONTINUE."</a>");
984
-			}
985
-			else include("../admin/settings.php");
986
-		}
987
-		else include("../admin/settings.php");
988
-	break;
989
-	case "2":
990
-		$output .= "<div id='pagetitle'>"._CONFIGDATA."</div>";
991
-		define ("_BASEDIR", "../");		
992
-		include("../config.php");
993
-		if(isset($_POST['sitekey'])) {
994
-			// relative path
995
-			if(file_exists("../".$databasepath."/dbconfig.php")) include("../".$databasepath."/dbconfig.php");
996
-			// absolute path
997
-			else if(file_exists($databasepath."/dbconfig.php")) include($databasepath."/dbconfig.php");
998
-			include_once("../includes/dbfunctions.php");
999
-			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
1000
-			$sitekey = !empty($_POST['sitekey']) ? descript($_POST['sitekey']) : random_string($randomcharset, 10);
1001
-			$settingsprefix = descript($_POST['settingsprefix']);
1002
-			$sitesettings = dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings(
1003
-			`sitename`, `slogan`, `url`, `siteemail`, `store`, `autovalidate`, `multiplecats`, `reviewsallowed`, `ratings`, `roundrobins`, 
1004
-			`submissionsoff`, `anonreviews`, `itemsperpage`, `imageupload`, `imageheight`, `imagewidth`, `skin`) 
1005
-			VALUES('$sitename', '$slogan', '$url', '$siteemail', '$store', '$autovalidate', '$numcats', '$reviewsallowed', '$ratings', '$roundrobins',
1006
-			'$submissionsoff', '$anonreviews', '$itemsperpage', '$imageupload', '$imageheight', '$imagewidth', '$skin')");
1007
-			if($sitesettings) $output .= write_message("<img src=\"../images/check.gif\">"._SITESETTINGSMOVED);
1008
-			$handle = fopen("../config.php", 'w');
1009
-			if(!$handle) {
1010
-				chmod("../config.php", 0666);
1011
-				$handle = fopen("../config.php", 'w');
1012
-			}
1013
-			if ($handle) {
1014
-				$text = "<?php 
1015
-\$dbhost = \"$dbhost\";
1016
-\$dbname = \"$dbname\";
1017
-\$dbuser= \"$dbuser\";
1018
-\$dbpass = \"$dbpass\";
1019
-\$sitekey = \"$sitekey\";
1020
-\$settingsprefix = \"$settingsprefix\";
1021
-
1022
-include_once(\"includes/dbfunctions.php\");
1023
-if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbname);
1024
-
1025
-?>";
1026
-				fwrite($handle, $text);
1027
-				fclose($handle);
1028
-				@chmod("../config.php", 0644);
1029
-				$output .= write_message("<img src=\"../images/check.gif\">"._CONFIG_WRITTEN."<br /><a href='upgrade11.php?step=3'>"._CONTINUE."</a>");
1030
-			}
1031
-			else $output .= write_message(_ERROR_CONFIGWRITE);						
1032
-		}
1033
-		else {
1034
-			$output .=  
1035
-				"<form method='POST' enctype='multipart/form-data' action='upgrade11.php?step=2' class='tblborder' style='width: 325px; margin: 1em auto;'>
1036
-						<label for='sitekey'>"._SITEKEY."</label><input type='text' name='sitekey' value='".random_string($randomcharset, 10)."' id='sitekey'><br />
1037
-						<input type='hidden' name='settingsprefix' value='".$_GET['settingsprefix']."'>
1038
-						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
1039
-					</form>";
1040
-			$output .= write_message(_HELP_SITEKEY." "._SITEKEYNOTE);
1041
-		}
1042
-	break;
1043
-	default:
1044
-		$output .= "<div id='pagetitle'>Create Settings Table</div>";
1045
-		include("../config.php");
1046
-		if(isset($_POST['submit'])) {
1047
-			// relative path
1048
-			if(file_exists("../".$databasepath."/dbconfig.php")) include("../".$databasepath."/dbconfig.php");
1049
-			// absolute path
1050
-			else if(file_exists($databasepath."/dbconfig.php")) include($databasepath."/dbconfig.php");
1051
-			include("../includes/dbfunctions.php");
1052
-			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
1053
-			$settings = dbquery("SHOW TABLES LIKE '".$tableprefix."fanfiction_settings'");
1054
-			if($settings) dbquery("RENAME TABLE ".$tableprefix."fanfiction_settings TO ".$tableprefix."fanfiction_settings_old");
1055
-								$settings = dbquery("CREATE TABLE IF NOT EXISTS`".$_POST['settingsprefix']."fanfiction_settings` (
1056
-  `sitekey` varchar(50) NOT NULL default '1',
1057
-  `sitename` varchar(200) NOT NULL default 'Your Site',
1058
-  `slogan` varchar(200) NOT NULL default 'It''s a cool site!',
1059
-  `url` varchar(200) NOT NULL default 'http://www.yoursite.com',
1060
-  `siteemail` varchar(200) NOT NULL default 'you@yoursite.com',
1061
-  `tableprefix` varchar(50) NOT NULL default '',
1062
-  `skin` varchar(50) NOT NULL default 'default',
1063
-  `hiddenskins` varchar(255) default '',
1064
-  `language` varchar(10) NOT NULL default 'en',
1065
-  `submissionsoff` tinyint(1) NOT NULL default '0',
1066
-  `storiespath` varchar(20) NOT NULL default 'stories',
1067
-  `store` varchar(5) NOT NULL default 'files',
1068
-  `autovalidate` tinyint(1) NOT NULL default '0',
1069
-  `coauthallowed` int(1) NOT NULL default '0',
1070
-  `maxwords` int(11) NOT NULL default '0',
1071
-  `minwords` int(11) NOT NULL default '0',
1072
-  `imageupload` tinyint(1) NOT NULL default '0',
1073
-  `imageheight` int(11) NOT NULL default '200',
1074
-  `imagewidth` int(11) NOT NULL default '200',
1075
-  `roundrobins` tinyint(1) NOT NULL default '0',
1076
-  `allowseries` tinyint(4) NOT NULL default '2',
1077
-  `tinyMCE` tinyint(1) NOT NULL default '0',
1078
-  `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
1079
-  `favorites` tinyint(1) NOT NULL default '0',
1080
-  `multiplecats` tinyint(1) NOT NULL default '0',
1081
-  `newscomments` tinyint(1) NOT NULL default '0',
1082
-  `logging` tinyint(1) NOT NULL default '0',
1083
-  `maintenance` tinyint(1) NOT NULL default '0',
1084
-  `debug` tinyint(1) NOT NULL default '0',
1085
-  `captcha` tinyint(1) NOT NULL default '0',
1086
-  `dateformat` varchar(20) NOT NULL default 'd/m/y',
1087
-  `timeformat` varchar(20) NOT NULL default '- h:i a',
1088
-  `recentdays` tinyint(2) NOT NULL default '7',
1089
-  `displaycolumns` tinyint(1) NOT NULL default '1',
1090
-  `itemsperpage` tinyint(2) NOT NULL default '25',
1091
-  `extendcats` tinyint(1) NOT NULL default '0',
1092
-  `displayindex` tinyint(1) NOT NULL default '0',
1093
-  `defaultsort` tinyint(1) NOT NULL default '0',
1094
-  `displayprofile` tinyint(1) NOT NULL default '0',
1095
-  `linkstyle` tinyint(1) NOT NULL default '0',
1096
-  `linkrange` tinyint(2) NOT NULL default '5',
1097
-  `reviewsallowed` tinyint(1) NOT NULL default '0',
1098
-  `ratings` tinyint(1) NOT NULL default '0',
1099
-  `anonreviews` tinyint(1) NOT NULL default '0',
1100
-  `revdelete` tinyint(1) NOT NULL default '0',
1101
-  `rateonly` tinyint(1) NOT NULL default '0',
1102
-  `pwdsetting` tinyint(1) NOT NULL default '0',
1103
-  `alertson` tinyint(1) NOT NULL default '0',
1104
-  `disablepopups` tinyint(1) NOT NULL default '0',
1105
-  `agestatement` tinyint(1) NOT NULL default '0',
1106
-  `words` text,
1107
-  `version` varchar(10) NOT NULL default '".$version."',
1108
-  `smtp_host` varchar(200) default NULL,
1109
-  `smtp_username` varchar(50) default NULL,
1110
-  `smtp_password` varchar(50) default NULL,
1111
-  PRIMARY KEY  (`sitekey`)
1112
-) ENGINE=MyISAM;");
1113
-if($settings) $output .= write_message("<img src=\"../images/check.gif\"> "._SETTINGSTABLESUCCESS." <br /><a href='upgrade11.php?step=2&amp;settingsprefix=".$_POST['settingsprefix']."'>"._CONTINUE."</a>");
1114
-else $output .= write_message(_SETTINGSTABLEAUTOFAIL." <br /><a href='upgrade11.php?step=2&amp;settingsprefix=".$_POST['settingsprefix']."'>"._CONTINUE."</a> ");
1115
-		}
1116
-		else {
1117
-			$install = isset($_GET['install']) ? $_GET['install'] : false;
1118
-			if($install == "manual") {
1119
-				$output .= write_message(_SETTINGSTABLEMANUAL."<br /><a href='upgrade11.php?step=2'>"._CONTINUE."</a>");
1120
-			}
1121
-			else if($install == "automatic") {
1122
-				$output .=  
1123
-					"<form method='POST' enctype='multipart/form-data' action='upgrade11.php?step=1' class='tblborder' style='width: 325px; margin: 1em auto;'>
1124
-						<label for='settingsprefix'>"._SETTINGSPREFIX."</label><input type='text' name='settingsprefix' id='settingsprefix' value='".$tableprefix."'><br />
1125
-						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
1126
-					</form>";
1127
-				$output .= write_message(_SETTINGSTABLENOTE);
1128
-			}
1129
-			else { 
1130
-				$output .= write_message(_SETTINGSTABLESETUP." <a href='upgrade11.php?install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade11.php?install=manual'>"._MANUAL2."</a>");
1131
-			}
1132
-		}
1133
-}
1134
-$tpl->assign("output", $output);
1135
-
1136
-$tpl->printToScreen();
1137
-if($step > 1) dbclose( );
1138
-?>
1139 0
\ No newline at end of file
1140 1
deleted file mode 100644
... ...
@@ -1,1186 +0,0 @@
1
-<?php
2
-// ----------------------------------------------------------------------
3
-// Copyright (c) 2007 by Tammy Keefer
4
-// Based on eFiction 1.1
5
-// Copyright (C) 2003 by Rebecca Smallwood.
6
-// http://efiction.sourceforge.net/
7
-// ----------------------------------------------------------------------
8
-// LICENSE
9
-//
10
-// This program is free software; you can redistribute it and/or
11
-// modify it under the terms of the GNU General Public License (GPL)
12
-// as published by the Free Software Foundation; either version 2
13
-// of the License, or (at your option) any later version.
14
-//
15
-// This program is distributed in the hope that it will be useful,
16
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
-// GNU General Public License for more details.
19
-//
20
-// To read the license please visit http://www.gnu.org/copyleft/gpl.html
21
-// ----------------------------------------------------------------------
22
-
23
-function isNumber($num) {
24
-	return preg_match("/^[0-9]+$/", $num);
25
-}
26
-
27
-function random_char($string)
28
-{
29
-	$length = strlen($string);
30
-	$position = mt_rand(0, $length - 1);
31
-	 return $string[$position];
32
-}
33
-
34
-function random_string ($charset_string, $length)
35
-{
36
-	$return_string = random_char($charset_string);
37
-	for ($x = 1; $x < $length; $x++)
38
-	$return_string .= random_char($charset_string);
39
-	return $return_string;
40
-}
41
-
42
-$randomcharset = '23456789' . 'abcdefghijkmnpqrstuvwxyz' . 'ABCDEFGHJKLMNPQRSTUVWXYZ';
43
-
44
-function descript($text, $addbreaks = 0) {
45
-	// Convert problematic ascii characters to their true values
46
-	$search = array("40","41","58","65","66","67","68","69","70",
47
-		"71","72","73","74","75","76","77","78","79","80","81",
48
-		"82","83","84","85","86","87","88","89","90","97","98",
49
-		"99","100","101","102","103","104","105","106","107",
50
-		"108","109","110","111","112","113","114","115","116",
51
-		"117","118","119","120","121","122"
52
-		);
53
-	$replace = array("(",")",":","a","b","c","d","e","f","g","h",
54
-		"i","j","k","l","m","n","o","p","q","r","s","t","u",
55
-		"v","w","x","y","z","a","b","c","d","e","f","g","h",
56
-		"i","j","k","l","m","n","o","p","q","r","s","t","u",
57
-		"v","w","x","y","z"
58
-		);
59
-	$entities = count($search);
60
-	for ($i=0;$i < $entities;$i++) $text = preg_replace("#(&\#)(0*".$search[$i]."+);*#si", $replace[$i], $text);
61
-	// the following is based on code from bitflux (http://blog.bitflux.ch/wiki/)
62
-	// Kill hexadecimal characters completely
63
-	$text = preg_replace('#(&\#x)([0-9A-F]+);*#si', "", $text);
64
-	// remove any attribute starting with "on" or xmlns
65
-	$text = preg_replace('#(<[^>]+[\\"\'\s])(onmouseover|onmousedown|onmouseup|onmouseout|onmousemove|onclick|ondblclick|onload|xmlns)[^>]*>#iUu',">",$text);
66
-	// remove javascript: and vbscript: protocol
67
-	$text = preg_replace('#([a-z]*)=([\`\'\"]*)script:#iUu','$1=$2nojscript...',$text);
68
-	$text = preg_replace('#([a-z]*)=([\`\'\"]*)javascript:#iUu','$1=$2nojavascript...',$text);
69
-	$text = preg_replace('#([a-z]*)=([\'\"]*)vbscript:#iUu','$1=$2novbscript...',$text);
70
-        //<span style="width: expression(alert('Ping!'));"></span> (only affects ie...)
71
-        $text = preg_replace('#(<[^>]+)style=([\`\'\"]*).*expression\([^>]*>#iU',"$1>",$text);
72
-        $text = preg_replace('#(<[^>]+)style=([\`\'\"]*).*behaviour\([^>]*>#iU',"$1>",$text);
73
-	do {
74
-        	$thistext = $text;
75
-		$text = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i',"",$text);
76
-	} while ($thistext != $text); 
77
-	if($addbreaks && strpos($text, "<br>") === false && strpos($text, "<p>") === false && strpos($text, "<br />") === false) $text = nl2br($text);
78
-	return $text;
79
-}
80
-
81
-function write_message($text) {
82
-	return "<div style='text-align: center; margin: 1em;'>$text</div>";
83
-}
84
-// Strip out slashes if magic quotes isn't on.
85
-if(ini_get("magic_quotes_gpc")) {
86
-	foreach($_POST as $var => $val) {
87
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
88
-	}
89
-	foreach($_GET as $var => $val) {
90
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
91
-	}
92
-	foreach($_COOKIE as $var => $val) {
93
-		$val = is_array( $val ) ? array_map( 'stripslashes', $val ) : stripslashes( $val );
94
-	}
95
-}
96
-
97
-function storiesInSeries($thisseries) {
98
-	
99
-		$storylist = array( );
100
-	$serieslist = array( );
101
-	$stinseries = dbquery("SELECT sid, subseriesid FROM ".TABLEPREFIX."fanfiction_inseries WHERE seriesid = '$thisseries'");
102
-	while($st = dbassoc($stinseries)) { 
103
-		if(!empty($st['sid'])) $storylist[] = $st['sid'];
104
-		else if(!empty($st['subseriesid'])) $serieslist[] = $st['subseriesid'];
105
-	}
106
-	if($serieslist) {
107
-		foreach($serieslist as $s) {
108
-			$storylist = array_merge($storylist, storiesInSeries($s));
109
-		}
110
-	}
111
-	return $storylist;
112
-}
113
-
114
-Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
115
-header ("Pragma: no-cache"); 
116
-header ("Expires: 0"); 
117
-
118
-//make a new TemplatePower object
119
-echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
120
-<html><head><title>eFiction $version Install</title>
121
-<style>
122
-#settingsform { margin: 0; padding: 0; border: none; }
123
-#settingsform FORM { width: 100%; margin: 0 10%; }
124
-#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; padding-top: 1px;}
125
-#settingsform .textbox { margin: 1px 0; }
126
-#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
127
-#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
128
-#settingsform { float: left; margin: 1ex 10%; }
129
-#settingsform .tinytoggle { text-align: center; }
130
-#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
131
-#settingsform #submitdiv { text-align: center; width: 100%;clear: both; height: 3em; }
132
-#settingsform #submitdiv #submit { position: absolute; z-index: 10001; margin: 1em; }
133
-LABEL { float: left; display: block; width: 50%; text-align: right; padding-right: 10px; clear: left;}
134
-.row { float: left; width: 99%; }
135
-a.pophelp{
136
-    position: relative; /*this is the key*/
137
-    z-index:24;
138
-    vertical-align: super;
139
-}
140
-
141
-a.pophelp:hover{z-index:100; border: none;}
142
-
143
-a.pophelp span{display: none; position: absolute;}
144
-
145
-a.pophelp:hover span{ /*the span will display just on :hover state*/
146
-    display:block;
147
-    position:absolute;
148
-    top:2em; left:4em; width: 225px;
149
-    border:1px solid #000;
150
-    background-color:#CCC; color:#000;
151
-    text-decoration: none;
152
-    text-align: left;
153
-    padding: 5px;
154
-    font-weight: normal;
155
-}
156
-</style>
157
-<link rel=\"stylesheet\" type=\"text/css\" href='../default_tpls/style.css'></head>";
158
-
159
-$output = "";
160
-define("_BASEDIR", "../");
161
-
162
-include ("../includes/class.TemplatePower.inc.php");
163
-include("../config.php");
164
-if(isset($_GET['step']) && $_GET['step'] > 2) {
165
-	$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
166
-	list($tableprefix, $language) = dbrow($settings);
167
-	define("TABLEPREFIX", $tableprefix);
168
-	define("SITEKEY", $sitekey);
169
-}
170
-if(isset($language)) {
171
-if(file_exists("../languages/{$language}.php")) include ("../languages/{$language}.php");
172
-else include ("../languages/en.php");
173
-if(file_exists("../languages/{$language}_admin.php")) include ("../languages/{$language}_admin.php");
174
-else include ("../languages/en_admin.php");
175
-if(file_exists("languages/$language.php")) include ("languages/{$language}.php");
176
-else include("languages/en.php");
177
-}
178
-else {
179
-include ("../languages/en.php");
180
-include ("../languages/en_admin.php");
181
-include("languages/en.php");
182
-}
183
-//  So I don't have to keep updating the version number in 3 different files.
184
-include("../version.php");
185
-
186
-$tpl = new TemplatePower( "../default_tpls/default.tpl" );
187
-$tpl->assignInclude( "header", "./../default_tpls/header.tpl" );
188
-$tpl->assignInclude( "footer", "./../default_tpls/footer.tpl" );
189
-$tpl->prepare( );
190
-$tpl->newBlock("header");
191
-$tpl->assign("sitename", "Upgrade eFiction 2.0.X to eFiction $version");
192
-$tpl->gotoBlock( "_ROOT" );
193
-$tpl->newBlock("footer");
194
-$tpl->assign( "footer", "eFiction $version &copy; 2006. <a href='http://efiction.org/'>http://efiction.org/</a>");
195
-$tpl->gotoBlock( "_ROOT" );
196
-
197
-switch($_GET['step']) {
198
-	case "19":
199
-		$output .= "<div id='pagetitle'>"._OPTIMIZEDB."</div>";
200
-
201
-		if(isset($_GET['install'])) {
202
-			if($_GET['install'] == "automatic") {
203
-				dbquery("alter table ".TABLEPREFIX."fanfiction_categories drop index category;");
204
-				dbquery("alter table ".TABLEPREFIX."fanfiction_categories drop index parentcatid;");
205
-				dbquery("create index byparent on ".TABLEPREFIX."fanfiction_categories (parentcatid,displayorder);");
206
-				dbquery("create index forstoryblock on ".TABLEPREFIX."fanfiction_chapters (sid,validated);");
207
-				dbquery("alter table ".TABLEPREFIX."fanfiction_comments drop index nid;");
208
-				dbquery("alter table ".TABLEPREFIX."fanfiction_comments add index commentlist (nid,time);");
209
-				dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index seriesid;");
210
-				dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index inorder;");
211
-				dbquery("alter table ".TABLEPREFIX."fanfiction_inseries add index (seriesid,inorder);");
212
-				dbquery("alter table ".TABLEPREFIX."fanfiction_inseries drop index sid;");
213
-				dbquery("alter table ".TABLEPREFIX."fanfiction_inseries add primary key (sid,seriesid,subseriesid);");
214
-				dbquery("create index avgrating on ".TABLEPREFIX."fanfiction_reviews(type,item,rating);");
215
-				dbquery("alter table ".TABLEPREFIX."fanfiction_reviews drop index sid;");
216
-				dbquery("create index bychapter on ".TABLEPREFIX."fanfiction_reviews (chapid,rating);");
217
-				dbquery("alter table ".TABLEPREFIX."fanfiction_reviews add index byuid (uid,item,type);");
218
-				dbquery("alter table ".TABLEPREFIX."fanfiction_series drop index owner;");
219
-				dbquery("create index owner on ".TABLEPREFIX."fanfiction_series (uid,title);");
220
-				dbquery("alter table ".TABLEPREFIX."fanfiction_stories drop index validated;");
221
-				dbquery("create index validateduid on ".TABLEPREFIX."fanfiction_stories (validated,uid);");
222
-				dbquery("create index recent on ".TABLEPREFIX."fanfiction_stories (updated,validated);");
223
-				dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_inseries` DROP `updated`");
224
-				dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_news` ADD `comments` INT NOT NULL DEFAULT '0'");
225
-				dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_series` ADD `numstories` INT NOT NULL DEFAULT '0'");
226
-				$serieslist = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series");
227
-				$totalseries = dbnumrows($serieslist);
228
-				while($s = dbassoc($serieslist)) {
229
-					$numstories = count(storiesInSeries($s['seriesid']));
230
-					dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET numstories = '$numstories' WHERE seriesid = ".$s['seriesid']." LIMIT 1");
231
-				}
232
-
233
-				$newslist = dbquery("SELECT count(cid) as count, nid FROM ".TABLEPREFIX."fanfiction_comments GROUP BY nid");
234
-				while($n = dbassoc($newslist)) {
235
-					dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = '".$n['count']."' WHERE nid = ".$n['nid']);
236
-				}
237
-
238
-				$storiesquery =dbquery("SELECT COUNT(sid) as totals, COUNT(DISTINCT uid) as totala, SUM(wordcount) as totalwords FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 ");
239
-				list($stories, $authors, $words) = dbrow($storiesquery);
240
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = '$stories', authors = '$authors', wordcount = '$words' WHERE sitekey = '".SITEKEY."'"); 
241
-
242
-				$chapterquery = dbquery("SELECT COUNT(chapid) as chapters FROM ".TABLEPREFIX."fanfiction_chapters where validated > 0");
243
-				list($chapters) = dbrow($chapterquery);
244
-
245
-				$authorquery = dbquery("SELECT COUNT(uid) as totalm FROM ".TABLEPREFIX."fanfiction_authors");
246
-				list($members) = dbrow($authorquery);
247
-
248
-				list($newest) = dbrow(dbquery("SELECT uid as uid FROM ".TABLEPREFIX."fanfiction_authors ORDER BY uid DESC LIMIT 1"));
249
-				$reviewquery = dbquery("SELECT COUNT(reviewid) as totalr FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review'");
250
-				list($reviews) = dbrow($reviewquery);
251
-				$reviewquery = dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review' AND uid != 0");
252
-				list($reviewers) = dbrow($reviewquery);
253
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET series = '$totalseries', chapters = '$chapters', members = '$members', newestmember = '$newest', reviews = '$reviews', reviewers = '$reviewers' WHERE sitekey = '".SITEKEY."'"); 
254
-				$alltables = dbquery("SHOW TABLES");
255
-				while ($table = dbassoc($alltables)) {
256
-					foreach ($table as $db => $tablename) {
257
-						dbquery("OPTIMIZE TABLE `".$tablename."`");
258
-					}
259
-				}
260
-				$output .= write_message(_DONE."<br />"._UPGRADEEND);
261
-			}
262
-			else {
263
-				$output .= write_message(_OPTIMIZEMANUAL." "._UPGRADEEND);
264
-			}
265
-		}
266
-		else $output .= write_message(_OPTIMIZEINFO."<br /><br /><a href='upgrade20.php?step=19&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade20.php?step=19&amp;install=manual'>"._MANUAL2."</a>");
267
-	break;
268
-	case "18":
269
-		$output .= "<div id='pagetitle'>"._SERIESREVIEWS."</div>";
270
-		if(isset($_GET['install'])) {
271
-
272
-
273
-	
274
-			$series = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series");
275
-			if(dbnumrows($series)) {
276
-				while($s = dbassoc($series)) {
277
-					$thisseries = $s['seriesid'];
278
-					include("../includes/seriesreviews.php");
279
-				}
280
-			}
281
-			$output .= write_message("<a href='upgrade20.php?step=19'>"._CONTINUE."</a>");				
282
-		}
283
-		else $output .= write_message(_SERIESREVIEWSINFO."<br /><a href='upgrade20.php?step=18&amp;install=automatic'>"._CONTINUE."</a>");
284
-	break;
285
-	case "17":
286
-		$output .= "<div id='pagetitle'>"._NEWSUPDATE."</div>";
287
-		if(isset($_GET['install'])) {
288
-
289
-
290
-
291
-	
292
-			$comments = dbquery("SELECT uname FROM ".TABLEPREFIX."fanfiction_comments GROUP BY uname");
293
-			while($uname = dbassoc($comments)) {
294
-				unset($uid);
295
-				$nameinfo = dbquery("SELECT uid FROM ".TABLEPREFIX."fanfiction_authors WHERE penname = '".$uname['uname']."'");
296
-				list($uid) = dbrow($nameinfo);
297
-				if(empty($uid)) $uid = 0;
298
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_comments SET uname = '$uid' WHERE uname = '".$uname['uname']."'");
299
-			}
300
-			$result2 = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_comments` CHANGE `uname` `uid` INT NOT NULL DEFAULT '0';");
301
-			$output .= write_message(_NEWSUPDATERESULT.($result2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));	
302
-			$output .= write_message("<a href='upgrade20.php?step=18'>"._CONTINUE."</a>");				
303
-
304
-		}
305
-		else $output .= write_message(_NEWSUPDATEINFO."<br /><a href='upgrade20.php?step=17&amp;install=automatic'>"._CONTINUE."</a>");
306
-
307
-	break;
308
-	case "16":
309
-		$output .= "<div id='pagetitle'>"._AUTHORUPDATE."</div>";
310
-		if(isset($_GET['install'])) {
311
-
312
-
313
-			$settings = dbquery("SELECT tableprefix, defaultsort, displayindex, tinyMCE FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
314
-			list($defaultsort, $displayindex, $tinyMCE) = dbrow($settings);
315
-			$fix = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authors SET ageconsent = 0 WHERE ageconsent != 1");
316
-			$result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorprefs(`uid`, `newreviews`, `ageconsent`, `alertson`, `validated`, `userskin`, `level`, `categories`, `contact`) SELECT uid, newreviews, ageconsent, alertson, validated, userskin, level, categories, contact FROM ".TABLEPREFIX."fanfiction_authors");
317
-			$result2 = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs set sortby = '$defaultsort', storyindex = '$displayindex', tinyMCE = '$tinyMCE'");
318
-			$output .= write_message(_AUTHORRESULT.($result ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
319
-			$fields = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_on = 1");
320
-			while($f = dbassoc($fields)) {
321
-				$result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_authorinfo(`uid`, `info`) SELECT uid, ".$f['field_name']." FROM ".TABLEPREFIX."fanfiction_authors WHERE ".$f['field_name']." IS NOT NULL AND ".$f['field_name']." != ''");
322
-				$result2 = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorinfo SET field = ".$f['field_id']." WHERE field = 0");
323
-			}
324
-			$result2 = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_authors` DROP `newreviews`, DROP `validated`, DROP `userskin`, DROP `level`, DROP `contact`, DROP `categories`, DROP `ageconsent`, DROP `betareader`, DROP `alertson`, DROP `AOL`, DROP `Yahoo`, DROP `ICQ`, DROP `MSN`;");
325
-			$output .= write_message(_AUTHORDROPRESULT.($result2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));	
326
-			$output .= write_message("<a href='upgrade20.php?step=17'>"._CONTINUE."</a>");				
327
-
328
-		}
329
-		else $output .= write_message(_AUTHORUPDATEINFO."<br /><a href='upgrade20.php?step=16&amp;install=automatic'>"._CONTINUE."</a>");
330
-	break;
331
-	case "15":
332
-		$output .= "<div id='pagetitle'>"._AUTHORFIELDS."</div>";
333
-		include("../config.php");
334
-		$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
335
-
336
-		if(isset($_GET['install'])) {
337
-			if($_GET['install'] == "automatic") {
338
-				$fields[] = array('4','lj','Live Journal','http://{info}.livejournal.com','','','0');
339
-				$fields[] = array('1','website','Web Site','','','','1');
340
-				$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');
341
-				$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');
342
-				$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');
343
-				$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');
344
-				$fields[] = array('4','da','Deviant Art','http://{info}.deviantart.com','','','0');
345
-				$fields[] = array('3','betareader','Beta-reader','','','','1');
346
-				$fields[] = array('4','dj','DeadJournal','http://{info}.deadjournal.com/','','','0');
347
-				$fields[] = array('4','xanga','Xanga','http://www.xanga.com/{info}','','','0');
348
-				$fields[] = array('2', 'gender', 'Gender', 'male|#|female|#|undisclosed', '', '', '0');
349
-				$fields[] = array('4','myspace','MySpace','http://www.myspace.com/{info}','','','0');
350
-		
351
-
352
-		
353
-
354
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>"._FIELD."</th><th>"._RESULT."</th></tr>";
355
-				foreach($fields as $field) {
356
-					$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]."');");
357
-					$output .= "<tr><td>".$field[2]."</td><td align='center'>" . ($f ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
358
-				}
359
-				$output .= "</table>";
360
-				$output .= write_message(_FIELDAUTOFAIL." "._FIELDUPDATE."<br /><br /> <a href='upgrade20.php?step=16'>"._CONTINUE."</a>");
361
-			}
362
-			else {
363
-				$output .= write_message(_FIELDMANUAL," "._FIELDUPDATE."<br /><br /><a href='upgrade20.php?step=16'>"._CONTINUE."</a>");
364
-			}
365
-		}
366
-		else $output .= write_message(_FIELDDATAINFO."<br /><br /><a href='upgrade20.php?step=15&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade20.php?step=15&amp;install=manual'>"._MANUAL2."</a>");
367
-	break;
368
-	case "14":
369
-		$output .= "<div id='pagetitle'>"._CHALLENGEUPDATE."</div>";
370
-		include("../config.php");
371
-		$settings = dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
372
-
373
-		$challenges = dbquery("SELECT chalid, characters FROM ".TABLEPREFIX."fanfiction_challenges");
374
-		if(dbnumrows($challenges)) {
375
-			if(isset($_GET['install'])) {
376
-				$altersettings = dbquery("ALTER TABLE `".$settingsprefix."fanfiction_settings` ADD `anonchallenges` TINYINT( 1 ) NOT NULL DEFAULT 0");
377
-				$output .= write_message(_CHALLENGESETTING.($altersettings ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
378
-				$alter = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_challenges` ADD `responses` int(11) NOT NULL DEFAULT 0");
379
-				$output .= write_message(_CHALLENGESALTER.($alter ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
380
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ( 'include(_BASEDIR.\"modules/challenges/authorof.php\");', 'AO', 'challenges');");
381
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/storyblock.php\");', 'storyblock', 'challenges');");
382
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/seriesblock.php\");', 'seriesblock', 'challenges');");
383
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/seriestitle.php\");', 'seriestitle', 'challenges');");
384
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/adminfunctions.php\");', 'delchar', 'challenges');");
385
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/adminfunctions.php\");', 'delcategory', 'challenges');");
386
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES ('include(_BASEDIR.\"modules/challenges/otherresults.php\");', 'otherresults', 'challenges');");
387
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_codeblocks` (`code_text`, `code_type`, `code_module`) VALUES('include(_BASEDIR.\"modules/challenges/stats.php\");', 'sitestats', 'challenges');");
388
-				$proquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'P' AND panel_hidden = '0'");
389
-				list($profiles) = dbrow($proquery);
390
-				$profiles++;
391
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('challengesby', 'Challenges by {author}', 'modules/challenges/challengesby.php', 0, $profiles, 0, 'P');");
392
-				$userquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'U' AND panel_hidden = '0'");
393
-				list($userpanels) = dbrow($userquery);
394
-				$userpanels++;
395
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_order`, `panel_hidden`, `panel_type`) VALUES ('challengesby', 'Your Challenges', 'modules/challenges/challengesby.php', 0, $userpanels, 0, 'U');");
396
-				$adminquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'A' AND panel_hidden = '0'");
397
-				list($adminpanels) = dbrow($adminquery);
398
-				$adminpanels++;
399
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name` , `panel_title` , `panel_url` , `panel_level` , `panel_order` , `panel_hidden` , `panel_type` ) VALUES ('challenges', 'Challenges', 'modules/challenges/admin.php', '1', $adminpanels, 0, 'A');");
400
-				$topquery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'L' AND panel_hidden = '0'");
401
-				list($listpanels) = dbrow($topquery);
402
-				$listpanels++;
403
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name` , `panel_title` , `panel_url` , `panel_level` , `panel_order` , `panel_hidden` , `panel_type` ) VALUES ('challenges', 'Top 10 Challenges', 'modules/challenges/topchallenges.php', '0', $listpanels, 0, 'L');");
404
-				$browsequery = dbquery("SELECT count(panel_id) FROM `".TABLEPREFIX."fanfiction_panels` WHERE panel_type = 'B' AND panel_hidden = '0'");
405
-				list($browse) = dbrow($browsequery);
406
-				$browse++;
407
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels` (`panel_name` , `panel_title` , `panel_url` , `panel_level` , `panel_order` , `panel_hidden` , `panel_type` ) VALUES ('challenges', 'Challenges', 'browse.php?type=challenges', '0', $browse, 0, 'B');");
408
-				dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_pagelinks` (`link_name`, `link_text`, `link_url`, `link_target`, `link_access`) VALUES ('challenges', 'Challenges', 'browse.php?type=challenges', '0', 0);");
409
-				$characters = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_characters");
410
-				while($char = dbassoc($characters)) {
411
-					$charlist[stripslashes($char['charname'])] = $char['charid'];
412
-				}
413
-				while($c = dbassoc($challenges)) {
414
-					unset($newchars, $count, $count1, $count2);
415
-					if($c['characters']) {
416
-						$chars = explode(",", $c['characters']);
417
-						foreach($chars as $char) {
418
-							if(isset($charlist[$char])) $newchars[] = $charlist[$char];
419
-						}
420
-					}
421
-					$stories = dbquery("SELECT COUNT(sid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE FIND_IN_SET('".$c['chalid']."', challenges) > 0");
422
-					list($count1) = dbrow($stories);
423
-					$series = dbquery("SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series WHERE FIND_IN_SET('".$c['chalid']."', challenges) > 0");
424
-					list($count2) = dbrow($series);
425
-					$count = $count1 + $count2;
426
-					dbquery("UPDATE ".TABLEPREFIX."fanfiction_challenges SET  responses = '$count', characters = '".(isset($newchars) ? implode(",", $newchars) : "")."' WHERE chalid = $c[chalid]");
427
-				}
428
-				$output .= write_message("<a href='upgrade20.php?step=15'>"._CONTINUE."</a>");				
429
-			}
430
-			else $output .= write_message(_CHALLENGEUPDATEINFO."<br /><a href='upgrade20.php?step=14&amp;install=automatic'>"._CONTINUE."</a>");
431
-		}
432
-		else $output .= write_message(_CHALLENGESEMPTY."<a href='upgrade20.php?step=15'>"._CONTINUE."</a>");
433
-	break;
434
-	case "13":
435
-		$output .= "<div id='pagetitle'>"._FAVUPDATE."</div>";
436
-		if(isset($_GET['install'])) {
437
-
438
-
439
-	
440
-			$favst = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_favorites(uid, item, type) SELECT uid, sid, 'ST' FROM ".TABLEPREFIX."fanfiction_favstor");
441
-			$output .= write_message(_FAV1.($favst ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
442
-			$favse = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_favorites(uid, item, type) SELECT uid, seriesid, 'SE' FROM ".TABLEPREFIX."fanfiction_favseries");
443
-			$output .= write_message(_FAV2.($favse ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
444
-			$favau = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_favorites(uid, item, type) SELECT uid, favuid, 'AU' FROM ".TABLEPREFIX."fanfiction_favauth");
445
-			$output .= write_message(_FAV3.($favau ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
446
-			$drop1 = dbquery("DROP TABLE `".TABLEPREFIX."fanfiction_favstor`");
447
-			$output .= write_message(_FAV4.($drop1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
448
-			$drop2 = dbquery("DROP TABLE `".TABLEPREFIX."fanfiction_favseries`");
449
-			$output .= write_message(_FAV5.($drop2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
450
-			$drop3 = dbquery("DROP TABLE `".TABLEPREFIX."fanfiction_favauth`");
451
-			$output .= write_message(_FAV6.($drop3 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
452
-			$output .= write_message("<a href='upgrade20.php?step=14'>"._CONTINUE."</a>");		
453
-		}
454
-		else $output .= write_message(_FAVUPDATEINFO."<br /><a href='upgrade20.php?step=13&amp;install=automatic'>"._CONTINUE."</a>");
455
-	break;
456
-	case "12":
457
-		$output .= "<div id='pagetitle'>"._REVIEWUPDATE."</div>";
458
-		if(isset($_GET['install'])) {
459
-
460
-
461
-	
462
-			$alter = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_reviews` CHANGE `sid` `item` INT( 11 ) NOT NULL DEFAULT '0'");
463
-			$output .= write_message(_REVIEWALTER1.($alter ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
464
-			$alter2 = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_reviews` ADD `type` VARCHAR( 2 ) NOT NULL DEFAULT 'ST'");
465
-			$output .= write_message(_REVIEWALTER2.($alter2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
466
-			$alter3 = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_reviews` CHANGE `member` `uid` INT( 11 ) NOT NULL DEFAULT '0'");
467
-			$output .= write_message(_REVIEWALTER3.($alter3 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
468
-			$update1 = dbquery("UPDATE ".TABLEPREFIX."fanfiction_reviews SET type = 'ST' WHERE item > 0");
469
-			$output .= write_message(_REVIEWUPDATE1.($update1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
470
-			$update2 = dbquery("UPDATE ".TABLEPREFIX."fanfiction_reviews SET type = 'SE', item = seriesid WHERE seriesid > 0");
471
-			$output .= write_message(_REVIEWUPDATE2.($update2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
472
-			$alter4 = dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_reviews` DROP `seriesid`");
473
-			$output .= write_message(_REVIEWALTER4.($alter4 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
474
-			$output .= write_message("<a href='upgrade20.php?step=13'>"._CONTINUE."</a>");
475
-		}
476
-		else $output .= write_message(_REVIEWUPDATEINFO."<br /><a href='upgrade20.php?step=12&amp;install=automatic'>"._CONTINUE."</a>");
477
-
478
-	break;
479
-	case "11":
480
-		$output .= "<div id='pagetitle'>"._UPDATESTORIES."</div>";
481
-		if(isset($_GET['install'])) {
482
-
483
-
484
-	
485
-			$characters = dbquery("SELECT charid, charname FROM ".TABLEPREFIX."fanfiction_characters");
486
-				while($char = dbassoc($characters)) {
487
-				$character[stripslashes($char[charname])] = $char[charid];
488
-			}
489
-			$ratlist = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_ratings");
490
-			while($rate = dbassoc($ratlist)) {
491
-				$ratingslist[$rate['rating']] = $rate['rid'];
492
-			}
493
-			$classresults = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_classes");
494
-			while($class = dbassoc($classresults)) {
495
-				$classlist[$class['class_name']] = array("id" => $class['class_id'], "type" => $class['class_type'], "name" => $class['class_name']);
496
-			}
497
-			$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
498
-			$stories = dbquery("SELECT sid, gid, wid, charid, rid FROM ".TABLEPREFIX."fanfiction_stories LIMIT $offset, 200");
499
-			while($story = dbassoc($stories)) {
500
-				unset($genres, $warnings, $g, $w, $classes, $characters, $c, $clist, $rid);
501
-				$characters = explode(",", $story['charid']);
502
-				foreach($characters as $c) {
503
-					$clist[] = $character[$c];
504
-				}
505
-				$genres = explode(",", $story['gid']);
506
-				foreach($genres as $g) {
507
-					if($g && $g != " " && $classlist[$g]['type'] == 1) $classes[] = $classlist[$g]['id'];
508
-				}
509
-				$warnings = explode(",", $story['wid']);
510
-				foreach($warnings as $w) {
511
-					if($w && $w != " " && $classlist[$w]['type'] == 2) $classes[] = $classlist[$w]['id'];
512
-				}
513
-				$rid = $ratingslist[$story['rid']];
514
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET rid = '$rid', classes = '".($classes ? implode(",", $classes) : "")."', charid = '".($clist ? implode(",", $clist) : "")."' WHERE sid = '$story[sid]'");
515
-			}
516
-			if(dbnumrows($stories)) $output .= write_message(_STORIES." ".($offset + 1)."-".($offset + dbnumrows($stories)).".<br /><a href='upgrade20.php?step=11&amp;install=automatic&amp;offset=".($offset+200)."'>"._CONTINUE."</a>");
517
-			else {
518
-				$seriesquery = dbquery("SELECT seriesid, genres, warnings FROM ".TABLEPREFIX."fanfiction_series");
519
-				while($series = dbassoc($seriesquery)) {
520
-					unset($genres, $warnings, $g, $w, $classes);
521
-					$genres = explode(",", $series[genres]);
522
-					foreach($genres as $g) {
523
-						if($g && $g != " " && $classlist[$g]['type'] == 1) $classes[] = $classlist[$g]['id'];
524
-					}
525
-					$warnings = explode(",", $series[warnings]);
526
-					foreach($warnings as $w) {
527
-						if($w && $w != " " && $classlist[$w]['type'] == 2) $classes[] = $classlist[$w]['id'];
528
-					}
529
-					dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET classes = '".($classes ? implode(",", $classes) : "")."' WHERE seriesid = '$series[seriesid]'");
530
-				}
531
-				dbquery("UPDATE ".TABLEPREFIX."fanfiction_inseries SET confirmed = 1");
532
-				$drop1 = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories drop `gid`, drop `wid`;");
533
-				$output .= write_message(_DROPGWSTORIES.($drop1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));				
534
-				$output .= write_message((dbnumrows($seriesquery) ? _SERIES." 1-".dbnumrows($seriesquery)."<br />" : "")."<a href='upgrade20.php?step=12'>"._CONTINUE."</a>");
535
-			}
536
-		}
537
-		else $output .= write_message(_UPDATESTORIESINFO."<br /><a href='upgrade20.php?step=11&amp;install=automatic'>"._CONTINUE."</a>");
538
-	break;
539
-	case "10":
540
-		$output .= "<div id='pagetitle'>"._UPDATESTORIESTABLE."</div>";
541
-		if(isset($_GET['install'])) {
542
-			if($_GET['install'] == "automatic") {
543
-	
544
-
545
-		
546
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories ADD `classes` VARCHAR( 200 ) NULL AFTER `catid`;");
547
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series ADD `classes` VARCHAR( 200 ) NULL AFTER `catid`;");
548
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CHANGE `owner` `uid` INT( 11 ) NOT NULL DEFAULT '0'");
549
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories CHANGE `summary` `summary` TEXT NULL");
550
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_series CHANGE `summary` `summary` TEXT NULL");
551
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories ADD `coauthors` tinyint(1) NOT NULL default '0' AFTER `uid`");
552
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories ADD `count` INT( 11 ) NOT NULL DEFAULT '0' AFTER `reviews`;");
553
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_stories ADD `storynotes` TEXT NULL AFTER `summary`;");
554
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_chapters ADD `endnotes` TEXT NULL AFTER `storytext`;");
555
-				$result = dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_chapters ADD `count` INT( 11 ) NOT NULL DEFAULT '0' AFTER `uid`;");
556
-
557
-				if($result) $output .= write_message(_ACTIONSUCCESSFUL."<br /> <a href='upgrade20.php?step=11'>"._CONTINUE."</a>");
558
-			}
559
-			else if($_GET['install'] == "manual") {
560
-				$output .= write_message(_UPDATESTORIESTABLEMANUAL."<br /> <a href='upgrade20.php?step=11'>"._CONTINUE."</a>");
561
-			}
562
-		}
563
-		else {
564
-
565
-			$output .= write_message(_UPDATESTORIESTABLEINFO." <a href='upgrade20.php?step=10&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade20.php?step=10&amp;install=manual'>"._MANUAL2."</a>");
566
-		}
567
-	break;
568
-	case "9":
569
-		$output .= "<div id='pagetitle'>"._MOVECLASSES."</div>";
570
-		if(isset($_GET['install'])) {
571
-
572
-
573
-	
574
-			$newclass = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_classtypes (`classtype_name`, `classtype_title`) VALUES('genres', 'Genres');");
575
-			$genres = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_genres");
576
-			$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Genres</th><th>Result</th></tr>";
577
-			while($g = dbassoc($genres)) {
578
-				$result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_classes (`class_type`, `class_name`) VALUES('1', '".$g['genre']."')");
579
-				$output .= "<tr><td>".$g['genre']."</td><td align='center'>" . ($result ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
580
-			}
581
-			$output .= "</table>";
582
-			// Ditto with the warnings
583
-			$newclass = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_classtypes (`classtype_name`, `classtype_title`) VALUES('warnings', 'Warnings');");
584
-			$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Warnings</th><th>Result</th></tr>";
585
-			$warnings = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_warnings");
586
-			while($w = dbassoc($warnings)) {
587
-				$result = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_classes (`class_type`, `class_name`) VALUES('2', '$w[warning]')");
588
-				$output .= "<tr><td>".$w['warning']."</td><td align='center'>" . ($result ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
589
-			}
590
-			$output .= "</table>";
591
-			$drop1 = dbquery("DROP TABLE `".TABLEPREFIX."fanfiction_genres`");
592
-			$output .= write_message(_DROPGENRES.($drop1 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
593
-			$drop2 = dbquery("DROP TABLE `".TABLEPREFIX."fanfiction_warnings`");
594
-			$output .= write_message(_DROPWARNINGS.($drop2 ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">"));
595
-			
596
-			$output .= write_message(_MOVECLASSFAIL."<br /><a href='upgrade20.php?step=10'>continue</a>");
597
-		}
598
-		else $output .= write_message(_MOVECLASSESINFO."<br /><a href='upgrade20.php?step=9&amp;install=automatic'>"._CONTINUE."</a>");
599
-	break;
600
-	case "8":
601
-		$output .= "<div id='pagetitle'>"._MESSAGEDATA."</div>";
602
-		if(isset($_GET['install'])) {
603
-			if($_GET['install'] == "automatic") {
604
-	
605
-
606
-		
607
-				$directory = opendir("../messages");
608
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Message</th><th>Result</th></tr>";
609
-				while($filename = readdir($directory)) {
610
-					if($filename=="." || $filename=="..") continue;
611
-					$text = "";
612
-					$out = fopen ("../messages/".$filename, "r");
613
-					while (!feof($out)) { $text .= fgets($out, 10000); }
614
-					$msgname = substr($filename, 0, strrpos($filename, "."));
615
-					$msg = dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_messages` (`message_name`, `message_title`, `message_text`) VALUES ('$msgname', '".$defaulttitles[$msgname]."', '".addslashes($text)."');");
616
-				$output .= "<tr><td>".$defaulttitles[$msgname]."</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
617
-				}
618
-				$msg = dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_messages` (`message_name`, `message_title`, `message_text`) VALUES('maintenance', 'Site Maintenance', '<p style=\"text-align: center;\">This site is currently undergoing maintenance.  Please check back soon.  Thank you.</p>');");
619
-				$msg = dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_messages` (`message_name`, `message_title`, `message_text`) VALUES ('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.');");
620
-				$output .= "<tr><td>Terms of Service</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
621
-				$output .= "<tr><td>Site Maintenance</td><td align='center'>" . ($msg ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
622
-				$output .= "</table>";
623
-				$output .= write_message(_MESSAGEAUTOFAILUPGRADE."<br /><a href='upgrade20.php?step=9'>continue</a>");
624
-			}
625
-		}
626
-		else $output .= write_message(_MESSAGEDATAUPGRADE."<br /><a href='upgrade20.php?step=8&amp;install=automatic'>"._CONTINUE."</a>");
627
-
628
-	break;
629
-	case "7":
630
-		$output .= "<div id='pagetitle'>"._BLOCKDATA."</div>";
631
-		if(isset($_GET['install'])) {
632
-			if($_GET['install'] == "automatic") {
633
-	
634
-				include("../blocks_config.php");
635
-				$blocks['news']['num'] = 1;
636
-				$blocks['recent']['num'] = 1;
637
-				define("_BASEDIR", "../");
638
-
639
-		
640
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Block</th><th>Result</th></tr>";
641
-				foreach($blocks as $block =>$value) {
642
-					unset($blockvars);
643
-					foreach($value as $var=>$val) {
644
-						if($var != "name" && $var != "title" && $var != "file" && $var != "status") $blockvars[$var] = $val;
645
-					}
646
-					$b = dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_blocks (`block_name`, `block_title`, `block_file`, `block_status`, `block_variables`) VALUES('$block', '".escapestring($value['title'])."', '".$value['file']."', '".$value['status']."', '".($blockvars ? addslashes(serialize($blockvars)) : "")."');");
647
-					$output .= "<tr><td>".$value['title']."</td><td align='center'>" . ($b ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
648
-				}
649
-				$output .= "</table>";
650
-				$output .= write_message(_BLOCKDATAFAILUPGRADE."<br /><a href='upgrade20.php?step=8'>"._CONTINUE."</a>");
651
-			}
652
-		}
653
-		else $output .= write_message(_BLOCKDATAUPGRADE." <br /><a href='upgrade20.php?step=7&amp;install=automatic'>"._CONTINUE."</a>");
654
-	break;
655
-	case "6":
656
-		$output .= "<div id='pagetitle'>"._LINKDATA."</div>";
657
-		if(isset($_GET['install'])) {
658
-			if($_GET['install'] == "automatic") {
659
-	
660
-
661
-		
662
-				$pagelist = array(
663
-					array("home","Home","index.php","0","0"),
664
-					array("recent","Most Recent","browse.php?type=recent","0","0"),
665
-					array("login","Login","member.php?action=login","0","0"),
666
-					array("adminarea","Admin","admin.php","0","2"),
667
-					array("logout","Logout","member.php?action=logout","0","1"),
668
-					array("featured","Featured Stories","browse.php?type=featured","0","0"),
669
-					array("catslink","Categories","browse.php?type=categories","0","0"),
670
-					array("members","Members","authors.php?action=list","0","0"),
671
-					array("authors","Authors","authors.php?list=authors","0","0"),
672
-					array("help","Help","viewpage.php?page=help","0","0"),
673
-					array("search","Search","search.php","0","0"),
674
-					array("series","Series","browse.php?type=series","0","0"),
675
-					array("tens","Top Tens","toplists.php","0","0"),
676
-					array("challenges","Challenges","modules/challenges/challenges.php","0","0"),
677
-					array("contactus","Contact Us","contact.php","0","0"),
678
-					array("rules","Rules","viewpage.php?page=rules","0","0"),
679
-					array("tos","Terms of Service","viewpage.php?page=tos","0","0"),
680
-					array("rss","<img src=\'images/xml.gif\' alt=\'RSS\' border=\'0\'>","rss.php","0","0"),
681
-					array("login","Account Info","member.php","0","1"),
682
-					array("titles","Titles","browse.php?type=titles","0","0"),
683
-					array("register","Register","member.php?action=register","0","0"),
684
-					array("lostpassword","Lost Password","member.php?action=lostpassword","0","0"),
685
-					array("newsarchive","News Archive","news.php","0","0"),
686
-					array("browse","Browse","browse.php","0","0"),
687
-					array("charslink", "Characters", "browse.php?type=characters","0","0"),
688
-					array("ratings", "Ratings", "browse.php?type=ratings", "0", "0"),
689
-					array("genres_link", "Genres", "browse.php?type=class&amp;type_id=1", "0", "0"),
690
-					array("warnings_link", "Warnings", "browse.php?type=class&amp;type_id=2", "0", "0")
691
-				);
692
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Pages</th><th>Result</th></tr>";
693
-				foreach($pagelist as $page) {
694
-					$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]."');");
695
-					$output .= "<tr><td>".stripslashes($page[1])."</td><td align='center'>" . ($pages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
696
-				}
697
-
698
-				$output .= "</table>";
699
-				$output .= write_message(_LINKAUTOFAIL."<br /><a href='upgrade20.php?step=7'>"._CONTINUE."</a>");
700
-			}
701
-			else {
702
-				$output .= write_message(_LINKMANUAL."<br /><a href='upgrade20.php?step=7'>"._CONTINUE."</a>");
703
-			}
704
-		}
705
-		else $output .= write_message(_LINKDATAINFO." "._LINKSETUP." <a href='upgrade20.php?step=6&amp;install=automatic'>automatic</a> "._OR." <a href='upgrade20.php?step=6&amp;install=manual'>manual</a>");
706
-	break;
707
-	case "5":
708
-		$output .= "<div id='pagetitle'>"._PANELDATA."</div>";
709
-		if(isset($_GET['install'])){
710
-			if($_GET['install'] == "automatic") {
711
-	
712
-
713
-		
714
-				$panellist = array(
715
-					array("submitted","Submissions", "","3","5","0","A"),
716
-					array("versioncheck", "Version Check", "", "3", "7", "0", "A"),
717
-					array("newstory","Add New Story","stories.php?action=newstory&admin=1","3","3","0","A"),
718
-					array("addseries","Add New Series","series.php?action=add","3","3","0","A"),
719
-					array("news","News","","3","5","0","A"),
720
-					array("featured","Featured Stories","","3","5","0","A"),
721
-					array("characters","Characters","","2","2","0","A"),
722
-					array("ratings","Ratings","","2","3","0","A"),
723
-					array("members","Members","","2","5","0","A"),
724
-					array("mailusers","Mail Users","","2","6","0","A"),
725
-					array("settings","Settings","","1","2","0","A"),
726
-					array("blocks","Blocks","","1","3","0","A"),
727
-					array("censor","Censor","","1","0","1","A"),
728
-					array("admins","Admins","","1","6","0","A"),
729
-					array("classifications","Classifications","","2","4","0","A"),
730
-					array("categories","Categories","","2","1","0","A"),
731
-					array("custpages","Custom Pages","","1","4","0","A"),
732
-					array("validate","Validate Submission","","3","0","1","A"),
733
-					array("yesletter","Validation Letter","","3","0","1","A"),
734
-					array("noletter","Rejection Letter","","3","0","1","A"),
735
-					array("links","Page Links","","1","5","0","A"),
736
-					array("messages","Message Settings","","2","0","1","A"),
737
-					array("login","Login","","0","0","1","U"),
738
-					array("logout","Logout","","1","5","0","U"),
739
-					array("revreceived","Reviews Received","","1","0","1","U"),
740
-					array("editprefs","Edit Preferences","","1","2","0","U"),
741
-					array("lostpassword","Lost Password","","0","0","1","U"),
742
-					array("editbio","Edit Bio","","1","1","0","U"),
743
-					array("register","Register","","0","0","1","U"),
744
-					array("manageimages","Manage Images","","1","5","0","S"),
745
-					array("manfavs","Manage Favorites","","1","4","0","U"),
746
-					array("revres","Review Response","","1","0","1","U"),
747
-					array("stats","View Your Statistics","","1","3","0","U"),
748
-					array("newstory","Add New Story","stories.php?action=newstory","1","1","0","S"),
749
-					array("newseries","Add New Series","series.php?action=add","1","3","0","S"),
750
-					array("managestories","Manage Stories","stories.php?action=viewstories","1","2","0","S"),
751
-					array("manageseries","Manage Series","series.php?action=manage","1","4","0","S"),
752
-					array("reviewsby","Your Reviews","","1","0","1","U"),
753
-					array("storiesby","Stories by {author}","","0","1","0","P"),
754
-					array("seriesby","Series by {author}","","0","2","0","P"),
755
-					array("reviewsby","Reviews by {author}","","0","3","0","P"),
756
-					array("categories","Categories","","0","1","0","B"),
757
-					array("characters","Characters","","0","2","0","B"),
758
-					array("ratings","Ratings","","0","3","0","B"),
759
-					array("titles","Titles","","0","5","0","B"),
760
-					array("class","Classes","","0","0","1","B"),
761
-					array("recent","Most Recent","","0","0","1","B"),
762
-					array("featured","Featured Stories","","0","0","1","B"),
763
-					array("panels","Panels","","1","1","0","A"),
764
-					array("phpinfo","PHP Info","","1","7","0","A"),
765
-					array("contact","Contact","","0","0","1","P"),
766
-					array("series", "Series", "", "0", "4", "0", "B"),
767
-					array("viewlog", "Action Log", "", "1", "8", "0", "A"),
768
-					array("shortstories","10 Shortest Stories","toplists/default.php","0","6","0","L"), 
769
-					array("longstories","10 Longest Stories","toplists/default.php","0","5","0","L"), 
770
-					array("largeseries","10 Largest Series","toplists/default.php","0","1","0","L"), 
771
-					array("smallseries","10 Smallest Series","toplists/default.php","0","2","0","L"), 
772
-					array("reviewedseries","10 Most Reviewed Series","toplists/default.php","0","4","0","L"), 
773
-					array("prolificauthors","10 Most Prolific Authors","toplists/default.php","0","10","0","L"), 
774
-					array("prolificreviewers","10 Most Prolific Reviewers","toplists/default.php","0","12","0","L"), 
775
-					array("reviewedstories","10 Most Reviewed Stories","toplists/default.php","0","8","0","L"), 
776
-					array("readstories","10 Most Read Stories","toplists/default.php","0","9","0","L"),
777
-					array("favstories","10 Most Favorite Stories","toplists/default.php","0","7","0","L"), 
778
-					array("favauthors","10 Most Favorite Authors","toplists/default.php","0","11","0","L"), 
779
-					array("favseries","10 Most Favorite Series","toplists/default.php","0","3","0","L"), 
780
-					array("favst","Favorite Stories","","0","0","1","F"),
781
-					array("favse","Favorite Series","","0","0","1","F"),
782
-					array("favau","Favorite Authors","","0","0","1","F"),
783
-					array("favst","Favorite Stories","","0","0","1","U"),
784
-					array("favse","Favorite Series","","0","0","1","U"),
785
-					array("favau","Favorite Authors","","0","0","1","U"),
786
-					array("favlist","{author}\'s Favorites","viewuser.php?action=manfavs","0","5","0","F"),
787
-					array("skins", "Skins", "", "3", "6", "0", "A"),
788
-					array("authorfields", "Profile Information", "", "1", "9", "0", "A"),
789
-					array("maintenance", "Archive Maintenance", "", "1", "10", "0", "A"),
790
-					array("manual", "Admin Manual", "", "3", "6", "0", "A"),
791
-					array('modules', 'Modules', '', 1, "11", 0, 'A')
792
-				);
793
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Panel</th><th>Result</th></tr>";
794
-				foreach($panellist as $panel) {
795
-					unset($panels);
796
-					$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]."');");
797
-					$output .= "<tr><td>".stripslashes($panel[1])."</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
798
-				}
799
-				$output .= "</table>";
800
-				$output .= write_message(_PANELAUTOFAIL."<br /> <a href='upgrade20.php?step=6'>"._CONTINUE."</a>");
801
-			}
802
-			else {
803
-				$output .= write_message(_PANELMANUAL."<br /> <a href='upgrade20.php?step=6'>"._CONTINUE."</a>");
804
-			}
805
-		}
806
-		else $output .= write_message(_PANELDATAINFO." "._PANELSETUP." <a href='upgrade20.php?step=5&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade20.php?step=5&amp;install=manual'>"._MANUAL2."</a>");
807
-	break;
808
-	case "4":
809
-		$output .= "<div id='pagetitle'>"._INSTALLTABLES."</div>";
810
-		if(isset($_GET['install'])) {
811
-			if($_GET['install'] == "automatic") {
812
-	
813
-
814
-		
815
-				$output .= "<table class='tblborder' style='margin: 1em auto; padding: 1em;' cellpadding='5'><tr><th>Table</th><th>Result</th></tr>";
816
-				$authorfields = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_authorfields` (
817
-  `field_id` int(11) NOT NULL AUTO_INCREMENT,
818
-  `field_type` tinyint(4) NOT NULL default '0',
819
-  `field_name` varchar(30) NOT NULL default ' ',
820
-  `field_title` varchar(255) NOT NULL default ' ',
821
-  `field_options` text,
822
-  `field_code_in` text,
823
-  `field_code_out` text,
824
-  `field_on` tinyint(1) NOT NULL default '0',
825
-  PRIMARY KEY  (`field_id`)
826
-) ENGINE=MyISAM;");
827
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_authorfields</td><td align='center'>" . ($authorfields ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
828
-				$authorinfo = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_authorinfo` (
829
-  `uid` int(11) NOT NULL default '0',
830
-  `field` int(11) NOT NULL default '0',
831
-  `info` varchar(255) NOT NULL default ' ',
832
-  PRIMARY KEY  (`uid`,`field`),
833
-  KEY `uid` (`uid`)) ENGINE=MyISAM;");
834
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_authorinfo</td><td align='center'>" . ($authorinfo ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
835
-				$authorprefs = dbquery("
836
-CREATE TABLE `".TABLEPREFIX."fanfiction_authorprefs` (
837
-  `uid` int(11) NOT NULL default '0',
838
-  `newreviews` tinyint(1) NOT NULL default '0',
839
-  `newrespond` tinyint(1) NOT NULL default '0',
840
-  `ageconsent` tinyint(1) NOT NULL default '0',
841
-  `alertson` tinyint(1) NOT NULL default '0',
842
-  `tinyMCE` tinyint(1) NOT NULL default '0',
843
-  `sortby` tinyint(1) NOT NULL default '0',
844
-  `storyindex` tinyint(1) NOT NULL default '0',
845
-  `validated` tinyint(1) NOT NULL default '0',
846
-  `userskin` varchar(60) NOT NULL default 'default',
847
-  `level` tinyint(1) NOT NULL default '0',
848
-  `categories` varchar(200) NOT NULL default '0',
849
-  `contact` tinyint(1) NOT NULL default '0',
850
-  `stories` int(11) NOT NULL default '0',
851
-   PRIMARY KEY  (`uid`)
852
-) ENGINE=MyISAM;");
853
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_authorprefs</td><td align='center'>" . ($authorprefs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";				
854
-				$blocks = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_blocks` (
855
-  `block_id` int(11) NOT NULL auto_increment,
856
-  `block_name` varchar(30) NOT NULL default '',
857
-  `block_title` varchar(150) NOT NULL default '',
858
-  `block_file` varchar(200) NOT NULL default '',
859
-  `block_status` tinyint(1) NOT NULL default '0',
860
-  `block_variables` text NOT NULL,
861
-  PRIMARY KEY  (`block_id`),
862
-  KEY `block_name` (`block_name`)
863
-) ENGINE=MyISAM;");
864
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_blocks</td><td align='center'>" . ($blocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
865
-				$classes = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_classes` (
866
-  `class_id` int(11) NOT NULL auto_increment,
867
-  `class_type` int(11) NOT NULL default '0',
868
-  `class_name` varchar(100) NOT NULL default '',
869
-  PRIMARY KEY  (`class_id`),
870
-  KEY `byname` (`class_type`,`class_name`,`class_id`)
871
-) ENGINE=MyISAM;");
872
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_classes</td><td align='center'>" . ($classes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
873
-				$classtypes = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_classtypes` (
874
-  `classtype_id` int(11) NOT NULL auto_increment,
875
-  `classtype_name` varchar(50) NOT NULL default '',
876
-  `classtype_title` varchar(50) NOT NULL default '',
877
-  PRIMARY KEY  (`classtype_id`),
878
-  UNIQUE KEY `classtype_name` (`classtype_name`)
879
-) ENGINE=MyISAM;");
880
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_classtypes</td><td align='center'>" . ($classtypes ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
881
-$coauthors = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_coauthors` (
882
-  `sid` int(11) NOT NULL default '0',
883
-  `uid` int(11) NOT NULL default '0',
884
-  PRIMARY KEY  (`sid`,`uid`)
885
-) ENGINE=MyISAM;");
886
-$output .= "<tr><td>".$tableprefix."fanfiction_coauthors</td><td align='center'>" . ($coauthors ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
887
-				$codeblocks = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_codeblocks` (
888
-  `code_id` int(11) NOT NULL auto_increment,
889
-  `code_text` text NOT NULL,
890
-  `code_type` varchar(20) default NULL,
891
-  `code_module` varchar(60) default NULL,
892
-  PRIMARY KEY  (`code_id`),
893
-  KEY `code_type` (`code_type`)
894
-) ENGINE=MyISAM;");
895
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_codeblocks</td><td align='center'>" . ($codeblocks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
896
-				$favorites = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_favorites` (
897
-  `uid` int(11) NOT NULL default '0',
898
-  `item` int(11) NOT NULL default '0',
899
-  `type` char(2) NOT NULL default '',
900
-  `comments` text NOT NULL,
901
-  UNIQUE KEY `byitem` (`item`,`type`,`uid`),
902
-  UNIQUE KEY `byuid` (`uid`,`type`,`item`)
903
-) ENGINE=MyISAM;");
904
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_favorites</td><td align='center'>" . ($favorites ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
905
-				$logs = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_log` (
906
-  `log_id` int(11) NOT NULL auto_increment,
907
-  `log_action` varchar(255) default NULL,
908
-  `log_uid` int(11) NOT NULL,
909
-  `log_ip` int(11) UNSIGNED default NULL,
910
-  `log_timestamp` timestamp NOT NULL,
911
-  `log_type` varchar(2) NOT NULL,
912
-  PRIMARY KEY  (`log_id`)
913
-) ENGINE=MyISAM");
914
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_log</td><td align='center'>" . ($logs ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
915
-				$messages = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_messages` (
916
-  `message_id` int(11) NOT NULL auto_increment,
917
-  `message_name` varchar(50) NOT NULL default '',
918
-  `message_title` varchar(200) NOT NULL default '',
919
-  `message_text` text NOT NULL,
920
-  PRIMARY KEY  (`message_id`),
921
-  KEY `message_name` (`message_name`)
922
-) ENGINE=MyISAM;");
923
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_messages</td><td align='center'>" . ($messages ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
924
-				$modules = dbquery("
925
-CREATE TABLE `".TABLEPREFIX."fanfiction_modules` (
926
-  `id` int(11) NOT NULL auto_increment,
927
-  `name` varchar(100) NOT NULL default 'Test Module',
928
-  `version` varchar(10) NOT NULL default '1.0',
929
-  PRIMARY KEY  (`id`),
930
-  KEY `name_version` (`name`,`version`)
931
-)");
932
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_modules</td><td align='center'>" . ($modules ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
933
-				$pagelinks = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_pagelinks` (
934
-  `link_id` int(11) NOT NULL auto_increment,
935
-  `link_name` varchar(50) NOT NULL default '',
936
-  `link_text` varchar(100) NOT NULL default '',
937
-  `link_key` CHAR( 1 ) NULL,
938
-  `link_url` varchar(250) NOT NULL default '',
939
-  `link_target` char(1) NOT NULL default '0',
940
-  `link_access` tinyint(4) NOT NULL default '0',
941
-  PRIMARY KEY  (`link_id`),
942
-  KEY `link_name` (`link_name`)
943
-) ENGINE=MyISAM;");
944
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_pagelinks</td><td align='center'>" . ($pagelinks ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
945
-				$panels = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_panels` (
946
-  `panel_id` int(11) NOT NULL auto_increment,
947
-  `panel_name` varchar(50) NOT NULL default 'unknown',
948
-  `panel_title` varchar(100) NOT NULL default 'Unnamed Panel',
949
-  `panel_url` varchar(100) default NULL,
950
-  `panel_level` tinyint(4) NOT NULL default '3',
951
-  `panel_order` tinyint(4) NOT NULL default '0',
952
-  `panel_hidden` tinyint(1) NOT NULL default '0',
953
-  `panel_type` varchar(20) NOT NULL default 'A',
954
-  PRIMARY KEY  (`panel_id`),
955
-  KEY `panel_type` (`panel_type`,`panel_name`)
956
-) ENGINE=MyISAM;");
957
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_panels</td><td align='center'>" . ($panels ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
958
-	$stats = dbquery("CREATE TABLE `".TABLEPREFIX."fanfiction_stats` (
959
-  `sitekey` varchar(50) NOT NULL default '0',
960
-  `stories` int(11) NOT NULL default '0',
961
-  `chapters` int(11) NOT NULL default '0',
962
-  `series` int(11) NOT NULL default '0',
963
-  `reviews` int(11) NOT NULL default '0',
964
-  `wordcount` int(11) NOT NULL default '0',
965
-  `authors` int(11) NOT NULL default '0',
966
-  `members` int(11) NOT NULL default '0',
967
-  `reviewers` int(11) NOT NULL default '0',
968
-  `newestmember` int(11) NOT NULL default '0'
969
-) ENGINE=MyISAM");
970
-	dbquery("INSERT INTO ".TABLEPREFIX."fanfiction_stats(`sitekey`, `newestmember`) VALUES('".SITEKEY."', '1')");
971
-$output .= "<tr><td>".TABLEPREFIX."fanfiction_stats</td><td align='center'>" . ($stats ? "<img src=\"../images/check.gif\">" : "<img src=\"../images/X.gif\">") ."</td></tr>";
972
-$output .= "</table>";
973
-$output .= write_message(_NEWTABLEAUTOFAIL."<br /> <a href='upgrade20.php?step=5'>"._CONTINUE."</a>");
974
-			}
975
-			else if($_GET['install'] == "manual") {
976
-				$output .= write_message(_NEWTABLESSETUP."<br /> <a href='upgrade20.php?step=5'>"._CONTINUE."</a>");
977
-			}
978
-		}
979
-		else {
980
-
981
-			$output .= write_message(_NEWTABLESSETUP." <a href='upgrade20.php?step=4&amp;install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade20.php?step=4&amp;install=manual'>"._MANUAL2."</a>");
982
-		}
983
-	break;
984
-	case "3":			
985
-		if(!$_GET['sect']) $sect = "main";
986
-		else $sect = $_GET['sect'];
987
-		$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
988
-		if(dbnumrows($settingsresults) == 0) {
989
-			dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings (`sitekey`) VALUES('".$sitekey."');");
990
-			$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".SITEKEY."'");
991
-		}
992
-		$settings = dbassoc($settingsresults);
993
-			foreach($settings as $var => $val) {
994
-			$$var = stripslashes($val);
995
-		}
996
-		define("SITEKEY", $sitekey);
997
-		define("TABLEPREFIX", $tableprefix);
998
-		define("STORIESPATH", $settings['storiespath']);
999
-		if($sect == "submissions") {
1000
-			if($_POST['submit']) {
1001
-				$storiespath = descript($_POST['newstoriespath']);
1002
-				if(!file_exists($storiespath) && !file_exists("../".$storiespath)) {
1003
-					if(!strrchr($storiespath, "/") && !strrchr($storiespath, "\\")) $storiespath = "../$storiespath";
1004
-					@mkdir("$storiespath", 0755);
1005
-					@chmod("$storiespath", 0777);
1006
-				}
1007
-			}
1008
-		}
1009
-		if($sect == "main" && !isset($_POST['submit'])) $output .= write_message(_SKINWARNING);
1010
-		if($sect == "email" && $_POST['submit']) {
1011
-			$output .= "<div id=\"pagetitle\">"._SETTINGS."</div>";
1012
-			$smtp_host = $_POST['newsmtp_host'];
1013
-			$smtp_username = $_POST['newsmtp_username'];
1014
-			$smtp_password = $_POST['newsmtp_password'];
1015
-			$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey = '".SITEKEY."'");
1016
-			if($result) {
1017
-				$output .= write_message(_ACTIONSUCCESSFUL);
1018
-				$output .= write_message("<a href='upgrade20.php?step=4'>"._CONTINUE."</a>");
1019
-			}
1020
-			else include("../admin/settings.php");
1021
-		}
1022
-		else include("../admin/settings.php");
1023
-	break;
1024
-	case "2":
1025
-		$output .= "<div id='pagetitle'>"._CONFIGDATA."</div>";
1026
-
1027
-		if(isset($_POST['sitekey'])) {
1028
-			include("../naughtywords.php");
1029
-			// relative path
1030
-			if(file_exists("../".$databasepath."/dbconfig.php")) include("../".$databasepath."/dbconfig.php");
1031
-			// absolute path
1032
-			else if(file_exists($databasepath."/dbconfig.php")) include($databasepath."/dbconfig.php");
1033
-			include_once("../includes/dbfunctions.php");
1034
-			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
1035
-			$sitekey = !empty($_POST['sitekey']) ? descript($_POST['sitekey']) : random_string($randomcharset, 10);
1036
-			$settingsprefix = descript($_POST['settingsprefix']);
1037
-			$sitesettings = dbquery("INSERT INTO ".$settingsprefix."fanfiction_settings(
1038
-				`sitekey`, `sitename`, `slogan`, `url`, `siteemail`, `tableprefix`, `skin`, `language`, 
1039
-				`submissionsoff`, `storiespath`, `store`, `autovalidate`, `maxwords`, `minwords`, 
1040
-				`imageupload`, `imageheight`, `imagewidth`, `roundrobins`, `tinyMCE`, `allowed_tags`, 
1041
-				`favorites`, `multiplecats`, `newscomments`, `recentdays`, `displaycolumns`,
1042
-				`itemsperpage`, `displayindex`, `defaultsort`, `reviewsallowed`, `ratings`, 
1043
-				`anonreviews`, `revdelete`, `rateonly`, `pwdsetting`, `alertson`, `disablepopups`, 
1044
-				`agestatement`, `words`, `smtp_host`, `smtp_username`, `smtp_password`) VALUES(
1045
-				'".$sitekey."', '".addslashes(stripslashes($sitename))."', '".addslashes(stripslashes($slogan))."', '".addslashes($url)."', '".addslashes($siteemail)."',
1046
-				'$tableprefix', '$skin', '$language', $submissionsoff, '".addslashes($storiespath)."', '$store', $autovalidate,
1047
-				".($maxwords ? $maxwords : 0).", ".($minwords ? $minwords : 0).", $imageupload, ".($imageheight ? $imageheight : 0).", 
1048
-				".($imagewidth ? $imagewidth : 0).", $roundrobins, $tinyMCE, '".addslashes($allowed_tags)."',
1049
-				$favorites, ".($numcats == 1 ? 0 : 1).", $newscomments, ".($recentdays ? $recentdays : 0).", ".($columns ? $columns : 1).",
1050
-				".($itemsperpage > 0 ? $itemsperpage : 10).", ".($displayindex ? 1 : 0)." , ".($defaultsort ? 1 : 0).", 
1051
-				".($reviewsallowed ? 1 : 0).", ".($ratings ? $ratings : 0).",
1052
-				".($anonreviews ? 1 : 0).", ".($revdelete  ? 1 : 0).", ".($rateonly ? 1 : 0).", 
1053
-				".($pwdsetting ? 1 : 0).", ".($alertson ? 1 : 0).", ".($disablePopups ? 1 : 0).",
1054
-				 ".($agestatement ? 1 : 0).", '".implode(",", $words)."', '".addslashes($smtp_host)."', 
1055
-				'".addslashes($smtp_username)."', '".addslashes($smtp_password)."');");
1056
-			if($sitesettings) $output .= write_message("<img src=\"../images/check.gif\">"._SITESETTINGSMOVED);
1057
-			$handle = fopen("../config.php", 'w');
1058
-			if(!$handle) {
1059
-				@chmod("../config.php", 0666);
1060
-				$handle = fopen("../config.php", 'w');
1061
-			}
1062
-			if ($handle) {
1063
-				$text = "<?php 
1064
-\$dbhost = \"$dbhost\";
1065
-\$dbname = \"$dbname\";
1066
-\$dbuser= \"$dbuser\";
1067
-\$dbpass = \"$dbpass\";
1068
-\$sitekey = \"$sitekey\";
1069
-\$settingsprefix = \"$settingsprefix\";
1070
-
1071
-include_once(\"includes/dbfunctions.php\");
1072
-if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbname);
1073
-
1074
-?>";
1075
-				fwrite($handle, $text);
1076
-				fclose($handle);
1077
-				@chmod("../config.php", 0644);
1078
-				$output .= write_message("<img src=\"../images/check.gif\">"._CONFIG_WRITTEN."<br /><a href='upgrade20.php?step=3'>"._CONTINUE."</a>");
1079
-			}
1080
-			else $output .= write_message(_ERROR_CONFIGWRITE);						
1081
-		}
1082
-		else {
1083
-			$output .=  
1084
-				"<form method='POST' enctype='multipart/form-data' action='upgrade20.php?step=2' class='tblborder' style='width: 325px; margin: 1em auto;'>
1085
-						<label for='sitekey'>"._SITEKEY."</label><input type='text' name='sitekey' value='".random_string($randomcharset, 10)."' id='sitekey'><br />
1086
-						<input type='hidden' name='settingsprefix' value='".$_GET['settingsprefix']."'>
1087
-						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
1088
-					</form>";
1089
-			$output .= write_message(_HELP_SITEKEY." "._SITEKEYNOTE);
1090
-		}
1091
-	break;
1092
-	default:
1093
-		$output .= "<div id='pagetitle'>"._SETTINGSTABLE."</div>";
1094
-
1095
-		if(isset($_POST['submit'])) {
1096
-			// relative path
1097
-			if(file_exists("../".$databasepath."/dbconfig.php")) include("../".$databasepath."/dbconfig.php");
1098
-			// absolute path
1099
-			else if(file_exists($databasepath."/dbconfig.php")) include($databasepath."/dbconfig.php");
1100
-			include("../includes/dbfunctions.php");
1101
-			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
1102
-			$set1 = dbquery("DROP TABLE IF EXISTS ".$_POST['settingsprefix']."fanfiction_settings");
1103
-								$settings = dbquery("CREATE TABLE `".$_POST['settingsprefix']."fanfiction_settings` (
1104
-  `sitekey` varchar(50) NOT NULL default '1',
1105
-  `sitename` varchar(200) NOT NULL default 'Your Site',
1106
-  `slogan` varchar(200) NOT NULL default 'It\'s a cool site!',
1107
-  `url` varchar(200) NOT NULL default 'http://www.yoursite.com',
1108
-  `siteemail` varchar(200) NOT NULL default 'you@yoursite.com',
1109
-  `tableprefix` varchar(50) NOT NULL default '',
1110
-  `skin` varchar(50) NOT NULL default 'default',
1111
-  `hiddenskins` varchar(255) NULL default '',
1112
-  `language` varchar(10) NOT NULL default 'en',
1113
-  `submissionsoff` tinyint(1) NOT NULL default '0',
1114
-  `storiespath` varchar(20) NOT NULL default 'stories',
1115
-  `store` varchar(5) NOT NULL default 'files',
1116
-  `autovalidate` tinyint(1) NOT NULL default '0',
1117
-  `coauthallowed` int(1) NOT NULL default '0',
1118
-  `maxwords` int(11) NOT NULL default '0',
1119
-  `minwords` int(11) NOT NULL default '0',
1120
-  `imageupload` tinyint(1) NOT NULL default '0',
1121
-  `imageheight` int(11) NOT NULL default '200',
1122
-  `imagewidth` int(11) NOT NULL default '200',
1123
-  `roundrobins` tinyint(1) NOT NULL default '0',
1124
-  `allowseries` TINYINT NOT NULL DEFAULT '2',
1125
-  `tinyMCE` tinyint(1) NOT NULL default '0',
1126
-  `allowed_tags` varchar(200) NOT NULL default '<b><i><u><center><hr><p><br /><br><blockquote><ol><ul><li><img><strong><em>',
1127
-  `favorites` tinyint(1) NOT NULL default '0',
1128
-  `multiplecats` tinyint(1) NOT NULL default '0',
1129
-  `newscomments` tinyint(1) NOT NULL default '0',
1130
-  `logging` tinyint(1) NOT NULL default '0',
1131
-  `maintenance` tinyint(1) NOT NULL default '0',
1132
-  `debug` tinyint(1) NOT NULL default '0',
1133
-  `captcha` tinyint(1) NOT NULL default '0',
1134
-  `dateformat` varchar(20) NOT NULL default 'd/m/y',
1135
-  `timeformat` varchar(20) NOT NULL default '- h:i a',
1136
-  `recentdays` tinyint(2) NOT NULL default '7',
1137
-  `displaycolumns` tinyint(1) NOT NULL default '1',
1138
-  `itemsperpage` tinyint(2) NOT NULL default '25',
1139
-  `extendcats` tinyint(1) NOT NULL default '0',
1140
-  `displayindex` tinyint(1) NOT NULL default '0',
1141
-  `defaultsort` tinyint(1) NOT NULL default '0',
1142
-  `displayprofile` tinyint(1) NOT NULL default '0',
1143
-  `linkstyle` tinyint(1) NOT NULL default '0',
1144
-  `linkrange` tinyint(2) NOT NULL default '5',
1145
-  `reviewsallowed` tinyint(1) NOT NULL default '0',
1146
-  `ratings` tinyint(1) NOT NULL default '0',
1147
-  `anonreviews` tinyint(1) NOT NULL default '0',
1148
-  `revdelete` tinyint(1) NOT NULL default '0',
1149
-  `rateonly` tinyint(1) NOT NULL default '0',
1150
-  `pwdsetting` tinyint(1) NOT NULL default '0',
1151
-  `alertson` tinyint(1) NOT NULL default '0',
1152
-  `disablepopups` tinyint(1) NOT NULL default '0',
1153
-  `agestatement` tinyint(1) NOT NULL default '0',
1154
-  `words` text,
1155
-  `version` varchar(10) NOT NULL default '$version',
1156
-  `smtp_host` varchar(200) default NULL,
1157
-  `smtp_username` varchar(50) default NULL,
1158
-  `smtp_password` varchar(50) default NULL,
1159
-  PRIMARY KEY  (`sitekey`)
1160
-) ENGINE=MyISAM;");
1161
-if($settings) $output .= write_message("<img src=\"../images/check.gif\"> "._SETTINGSTABLESUCCESS." <br /><a href='upgrade20.php?step=2&amp;settingsprefix=".$_POST['settingsprefix']."'>"._CONTINUE."</a>");
1162
-else $output .= write_message(_SETTINGSTABLEAUTOFAIL." <br /><a href='upgrade20.php?step=2&amp;settingsprefix=".$_POST['settingsprefix']."'>"._CONTINUE."</a> ");
1163
-		}
1164
-		else {
1165
-			$install = isset($_GET['install']) ? $_GET['install'] : false;
1166
-			if($install == "manual") {
1167
-				$output .= write_message(_SETTINGSTABLEMANUALUP."<br /><a href='upgrade20.php?step=2'>"._CONTINUE."</a>");
1168
-			}
1169
-			else if($install == "automatic") {
1170
-				$output .=  
1171
-					"<form method='POST' enctype='multipart/form-data' action='upgrade20.php?step=1' class='tblborder' style='width: 325px; margin: 1em auto;'>
1172
-						<label for='settingsprefix'>"._SETTINGSPREFIX."</label><input type='text' name='settingsprefix' id='settingsprefix' value='".$tableprefix."'><br />
1173
-						<div style='text-align: center; margin: 1em;'><INPUT type=\"submit\"class=\"button\" name=\"submit\" value=\"submit\"></div>
1174
-					</form>";
1175
-				$output .= write_message(_SETTINGSTABLENOTE);
1176
-			}
1177
-			else { 
1178
-				$output .= write_message(_SETTINGSTABLESETUP." <a href='upgrade20.php?install=automatic'>"._AUTO."</a> "._OR." <a href='upgrade20.php?install=manual'>"._MANUAL2."</a>");
1179
-			}
1180
-		}
1181
-}
1182
-$tpl->assign("output", $output);
1183
-
1184
-$tpl->printToScreen();
1185
-dbclose( );
1186
-?>
1187 0
\ No newline at end of file