| ... | ... |
@@ -212,7 +212,7 @@ if($current == "viewstory"){
|
| 212 | 212 |
$squery = dbquery("SELECT sid, inorder FROM ".TABLEPREFIX."fanfiction_chapters WHERE chapid = ".$chapid." LIMIT 1");
|
| 213 | 213 |
list($sid, $chapter) = dbrow($squery); |
| 214 | 214 |
} |
| 215 |
- $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");
|
|
| 215 |
+ $titlequery = dbquery("SELECT story.title, story.coauthors, "._PENNAMEFIELD." as penname, story.summary FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE sid = '".(($sid) ?? null)."' AND "._UIDFIELD." = story.uid LIMIT 1");
|
|
| 216 | 216 |
if($story = dbassoc($titlequery)) {
|
| 217 | 217 |
$authlink[] = $story['penname']; |
| 218 | 218 |
if($story['coauthors']) {
|
| ... | ... |
@@ -29,7 +29,7 @@ if(isset($_GET['benchmark'])) {
|
| 29 | 29 |
} |
| 30 | 30 |
$headerSent = false; |
| 31 | 31 |
|
| 32 |
-// Defines the character set for your language/location |
|
| 32 |
+// Defines the character set for the header - preferably at UTF-8 |
|
| 33 | 33 |
define ("_HEADERCHARSET", "utf-8");
|
| 34 | 34 |
|
| 35 | 35 |
//default values to avoid ajax issue when notice error are on |
| ... | ... |
@@ -30,7 +30,7 @@ if(isset($_GET['benchmark'])) {
|
| 30 | 30 |
$headerSent = false; |
| 31 | 31 |
|
| 32 | 32 |
// Defines the character set for your language/location |
| 33 |
-define ("_CHARSET", "utf-8");
|
|
| 33 |
+define ("_HEADERCHARSET", "utf-8");
|
|
| 34 | 34 |
|
| 35 | 35 |
//default values to avoid ajax issue when notice error are on |
| 36 | 36 |
$allowed_tags = ''; |
| ... | ... |
@@ -62,7 +62,7 @@ if(ini_get('register_globals')) {
|
| 62 | 62 |
Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
|
| 63 | 63 |
header ("Pragma: no-cache");
|
| 64 | 64 |
header ("Expires: 0");
|
| 65 |
-header("Content-Type: text/html; charset="._CHARSET);
|
|
| 65 |
+header("Content-Type: text/html; charset="._HEADERCHARSET);
|
|
| 66 | 66 |
|
| 67 | 67 |
// Locate config.php and set the basedir path |
| 68 | 68 |
$folder_level = ""; |
| ... | ... |
@@ -137,7 +137,7 @@ if(isset($_SERVER['PHP_SELF'])) $_SERVER['PHP_SELF'] = htmlspecialchars(descript |
| 137 | 137 |
if(isset($PHP_SELF)) $PHP_SELF = htmlspecialchars(descript($PHP_SELF), ENT_QUOTES); |
| 138 | 138 |
|
| 139 | 139 |
// Set these variables to start. |
| 140 |
-$agecontsent = false; $viewed = array(); |
|
| 140 |
+$ageconsent = false; $viewed = array(); |
|
| 141 | 141 |
|
| 142 | 142 |
require_once("includes/get_session_vars.php");
|
| 143 | 143 |
|
| ... | ... |
@@ -69,7 +69,12 @@ $folder_level = ""; |
| 69 | 69 |
while (!file_exists($folder_level."header.php")) { $folder_level .= "../"; }
|
| 70 | 70 |
if(!defined("_BASEDIR")) define("_BASEDIR", $folder_level);
|
| 71 | 71 |
|
| 72 |
-@ include_once(_BASEDIR."config.php"); |
|
| 72 |
+if (file_exists(_BASEDIR . "config.php")) |
|
| 73 |
+{
|
|
| 74 |
+ include_once(_BASEDIR . "config.php"); |
|
| 75 |
+ include_once(_BASEDIR . "includes/dbfunctions.php"); |
|
| 76 |
+} |
|
| 77 |
+ |
|
| 73 | 78 |
if(empty($sitekey)) {
|
| 74 | 79 |
header("Location: install/install.php");
|
| 75 | 80 |
exit( ); |
| ... | ... |
@@ -132,7 +132,7 @@ if(isset($_SERVER['PHP_SELF'])) $_SERVER['PHP_SELF'] = htmlspecialchars(descript |
| 132 | 132 |
if(isset($PHP_SELF)) $PHP_SELF = htmlspecialchars(descript($PHP_SELF), ENT_QUOTES); |
| 133 | 133 |
|
| 134 | 134 |
// Set these variables to start. |
| 135 |
-$agecontsent = false; $viewed = false; |
|
| 135 |
+$agecontsent = false; $viewed = array(); |
|
| 136 | 136 |
|
| 137 | 137 |
require_once("includes/get_session_vars.php");
|
| 138 | 138 |
|
| ... | ... |
@@ -32,6 +32,9 @@ $headerSent = false; |
| 32 | 32 |
// Defines the character set for your language/location |
| 33 | 33 |
define ("_CHARSET", "utf-8");
|
| 34 | 34 |
|
| 35 |
+//default values to avoid ajax issue when notice error are on |
|
| 36 |
+$allowed_tags = ''; |
|
| 37 |
+ |
|
| 35 | 38 |
// Prevent possible XSS attacks via $_GET. |
| 36 | 39 |
foreach ($_GET as $v) {
|
| 37 | 40 |
if(preg_match('@<script[^>]*?>.*?</script>@si', $v) ||
|
| ... | ... |
@@ -101,10 +104,10 @@ if(isset($globalskin)) $skin = $globalskin; |
| 101 | 104 |
|
| 102 | 105 |
if(isset($_GET['action'])) $action = strip_tags($_GET['action']); |
| 103 | 106 |
else $action = false; |
| 104 |
- |
|
| 107 |
+ |
|
| 105 | 108 |
if(file_exists(_BASEDIR."languages/{$language}.php")) include (_BASEDIR."languages/{$language}.php");
|
| 106 | 109 |
else include (_BASEDIR."languages/en.php"); |
| 107 |
- |
|
| 110 |
+ |
|
| 108 | 111 |
include_once(_BASEDIR."includes/queries.php"); |
| 109 | 112 |
include_once(_BASEDIR."includes/corefunctions.php"); |
| 110 | 113 |
|
| ... | ... |
@@ -189,8 +192,7 @@ if(isset($_SESSION[SITEKEY."_viewed"])) $viewed = $_SESSION[SITEKEY."_viewed"]; |
| 189 | 192 |
if(isset($_GET['ageconsent'])) $_SESSION[SITEKEY."_ageconsent"] = 1; |
| 190 | 193 |
if(isset($_GET['warning'])) $_SESSION[SITEKEY."_warned"][$_GET['warning']] = 1; |
| 191 | 194 |
|
| 192 |
-if(file_exists("languages/{$language}.php")) require_once ("languages/{$language}.php");
|
|
| 193 |
-else require_once ("languages/en.php");
|
|
| 195 |
+ |
|
| 194 | 196 |
if(is_dir(_BASEDIR."skins/$siteskin")) $skindir = _BASEDIR."skins/$siteskin"; |
| 195 | 197 |
else if(is_dir(_BASEDIR."skins/".$settings['skin'])) $skindir = _BASEDIR."skins/".$defaultskin; |
| 196 | 198 |
else $skindir = _BASEDIR."default_tpls"; |
| ... | ... |
@@ -228,7 +230,7 @@ if($current == "viewuser" && isNumber($uid)) {
|
| 228 | 230 |
list($penname) = dbrow($author); |
| 229 | 231 |
$titleinfo = "$sitename :: $penname"; |
| 230 | 232 |
} |
| 231 |
-echo _DOCTYPE."<html><head>"; |
|
| 233 |
+echo _DOCTYPE."<html lang={$language}><head>";
|
|
| 232 | 234 |
echo "<meta charset='utf-8' />"; |
| 233 | 235 |
if(!isset($titleinfo)) $titleinfo = "$sitename :: $slogan"; |
| 234 | 236 |
if(isset($metaDesc)) echo "<meta name='description' content='$metaDesc'>"; |
| ... | ... |
@@ -240,10 +242,11 @@ if (file_exists(_BASEDIR."favicon.ico")) |
| 240 | 242 |
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"; |
| 241 | 243 |
} |
| 242 | 244 |
|
| 243 |
-echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset="._CHARSET."\">"; |
|
| 245 |
+//A document must not include both a “meta” element with an “http-equiv” attribute whose value is “content-type”, and a “meta” element with a “charset” attribute. |
|
| 246 |
+//echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset="._CHARSET."\">"; |
|
| 244 | 247 |
if (!isset($_GET['action']) || $_GET['action'] != "printable") |
| 245 | 248 |
{
|
| 246 |
- echo "<script language=\"javascript\" type=\"text/javascript\" src=\"" . _BASEDIR . "includes/javascript.js\"></script> |
|
| 249 |
+ echo "<script src=\"" . _BASEDIR . "includes/javascript.js\"></script> |
|
| 247 | 250 |
<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$sitename RSS Feed\" href=\"" . _BASEDIR . "rss.php\">"; |
| 248 | 251 |
} |
| 249 | 252 |
|
| ... | ... |
@@ -252,18 +255,18 @@ if (!isset($_GET['action']) || $_GET['action'] != "printable") |
| 252 | 255 |
if (!empty($tinyMCE)) |
| 253 | 256 |
{
|
| 254 | 257 |
if($tinyMCE == 1) {
|
| 255 |
- echo "<script language=\"javascript\" type=\"text/javascript\" src=\"" . _BASEDIR . "tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>"; |
|
| 258 |
+ echo "<script src=\"" . _BASEDIR . "tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>"; |
|
| 256 | 259 |
include(_BASEDIR . "tinymce/init.php"); |
| 257 | 260 |
} |
| 258 | 261 |
else {
|
| 259 |
- echo "<script language=\"javascript\" type=\"text/javascript\" src=\"" . _BASEDIR . "tinymce4/js/tinymce/tinymce.min.js\"></script>"; |
|
| 262 |
+ echo "<script src=\"" . _BASEDIR . "tinymce4/js/tinymce/tinymce.min.js\"></script>"; |
|
| 260 | 263 |
include(_BASEDIR . "tinymce4/init.php"); |
| 261 | 264 |
} |
| 262 | 265 |
} |
| 263 | 266 |
} |
| 264 | 267 |
if(isset($displayform) && $displayform == 1) {
|
| 265 |
-echo "<script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."includes/xmlhttp.js\"></script>"; |
|
| 266 |
-echo "<script language=\"javascript\" type=\"text/javascript\"> |
|
| 268 |
+echo "<script src=\""._BASEDIR."includes/xmlhttp.js\"></script>"; |
|
| 269 |
+echo "<script> |
|
| 267 | 270 |
lang = new Array( ); |
| 268 | 271 |
|
| 269 | 272 |
lang['Back2Cats'] = '"._BACK2CATS."'; |
| ... | ... |
@@ -301,9 +304,9 @@ if(file_exists("$skindir/extra_header.php")) include_once("$skindir/extra_header
|
| 301 | 304 |
if(!$displaycolumns) $displaycolumns = 1; |
| 302 | 305 |
$colwidth = floor(100/$displaycolumns); |
| 303 | 306 |
if(!empty($_GET['action']) && $_GET['action'] == "printable") {
|
| 304 |
- if(file_exists("$skindir/printable.css")) echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$skindir/printable.css\">";
|
|
| 305 |
- else echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"default_tpls/printable.css\">"; |
|
| 306 |
- echo "<script type='text/javascript'> |
|
| 307 |
+ if(file_exists("$skindir/printable.css")) echo "<link rel=\"stylesheet\" href=\"$skindir/printable.css\">";
|
|
| 308 |
+ else echo "<link rel=\"stylesheet\" href=\"default_tpls/printable.css\">"; |
|
| 309 |
+ echo "<script> |
|
| 307 | 310 |
<!-- |
| 308 | 311 |
if (window.print) {
|
| 309 | 312 |
window.print() ; |
| ... | ... |
@@ -316,7 +319,7 @@ document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
|
| 316 | 319 |
</script>"; |
| 317 | 320 |
} |
| 318 | 321 |
else {
|
| 319 |
-echo "<style type=\"text/css\"> |
|
| 322 |
+echo "<style> |
|
| 320 | 323 |
#columncontainer { margin: 1em auto; width: auto; padding: 5%;}
|
| 321 | 324 |
#browseblock, #memberblock { width: 100%; padding: 0; margin: 0; float: left; border: 0px solid transparent; }
|
| 322 | 325 |
.column { float: left; width: ".($colwidth - 1)."%; }
|
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,405 @@ |
| 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','&');
|
|
| 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 |
+ |
|
| 32 |
+// Defines the character set for your language/location |
|
| 33 |
+define ("_CHARSET", "utf-8");
|
|
| 34 |
+ |
|
| 35 |
+// Prevent possible XSS attacks via $_GET. |
|
| 36 |
+foreach ($_GET as $v) {
|
|
| 37 |
+ if(preg_match('@<script[^>]*?>.*?</script>@si', $v) ||
|
|
| 38 |
+ preg_match("'@<iframe[^>]*?>.*?</script>@si'", $v) ||
|
|
| 39 |
+ preg_match("'@<applet[^>]*?>.*?</script>@si'", $v) ||
|
|
| 40 |
+ preg_match("'@<meta[^>]*?>.*?</script>@si'", $v) ||
|
|
| 41 |
+ preg_match('@<[\/\!]*?[^<>]*?>@si', $v) ||
|
|
| 42 |
+ preg_match('@<style[^>]*?>.*?</style>@siU', $v) ||
|
|
| 43 |
+ preg_match('@<![\s\S]*?--[ \t\n\r]*>@', $v)) {
|
|
| 44 |
+ include("languages/en.php"); // no language set yet, so default to English.
|
|
| 45 |
+ die (_POSSIBLEHACK); |
|
| 46 |
+ } |
|
| 47 |
+} |
|
| 48 |
+unset($v); |
|
| 49 |
+ |
|
| 50 |
+if(!isset($_SESSION)) session_start(); |
|
| 51 |
+// clear the global variables if register globals is on. |
|
| 52 |
+if(ini_get('register_globals')) {
|
|
| 53 |
+ $arrayList = array_merge($_SESSION, $_GET, $_POST, $_COOKIE); |
|
| 54 |
+ foreach($arrayList as $k => $v) {
|
|
| 55 |
+ unset($GLOBALS[$k]); |
|
| 56 |
+ } |
|
| 57 |
+} |
|
| 58 |
+ |
|
| 59 |
+Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
|
|
| 60 |
+header ("Pragma: no-cache");
|
|
| 61 |
+header ("Expires: 0");
|
|
| 62 |
+header("Content-Type: text/html; charset="._CHARSET);
|
|
| 63 |
+ |
|
| 64 |
+// Locate config.php and set the basedir path |
|
| 65 |
+$folder_level = ""; |
|
| 66 |
+while (!file_exists($folder_level."header.php")) { $folder_level .= "../"; }
|
|
| 67 |
+if(!defined("_BASEDIR")) define("_BASEDIR", $folder_level);
|
|
| 68 |
+ |
|
| 69 |
+@ include_once(_BASEDIR."config.php"); |
|
| 70 |
+if(empty($sitekey)) {
|
|
| 71 |
+ header("Location: install/install.php");
|
|
| 72 |
+ exit( ); |
|
| 73 |
+} |
|
| 74 |
+if(isset($skin)) $globalskin = $skin; |
|
| 75 |
+$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
|
|
| 76 |
+$settings = dbassoc($settingsresults); |
|
| 77 |
+if(is_null($settings)) {
|
|
| 78 |
+ die(" <b>Your settings issue</b><br /> Please check your sitekey and then setting table. Your settings are empty. ");
|
|
| 79 |
+} |
|
| 80 |
+ |
|
| 81 |
+if(!defined("SITEKEY")) define("SITEKEY", $settings['sitekey']);
|
|
| 82 |
+unset($settings['sitekey']); |
|
| 83 |
+if(!defined("TABLEPREFIX")) define("TABLEPREFIX", $settings['tableprefix']);
|
|
| 84 |
+unset($settings['tableprefix']); |
|
| 85 |
+define("STORIESPATH", $settings['storiespath']);
|
|
| 86 |
+unset($settings['storiespath']); |
|
| 87 |
+foreach($settings as $var => $val) {
|
|
| 88 |
+ if (is_NULL($val)) $val = ''; |
|
| 89 |
+ $$var = stripslashes($val); |
|
| 90 |
+ $settings[$var] = htmlspecialchars($val); |
|
| 91 |
+} |
|
| 92 |
+ |
|
| 93 |
+if(isset($_GET['debug'])) $debug = 1; |
|
| 94 |
+if(!$displaycolumns) $displaycolumns = 1; // shouldn't happen, but just in case. |
|
| 95 |
+if($words) $words = explode(", ", $words);
|
|
| 96 |
+else $words = array( ); |
|
| 97 |
+// Fix for sites with 2.0 or 1.1 running as well as 3.0 with register_globals on. |
|
| 98 |
+$defaultskin = $skin; |
|
| 99 |
+ |
|
| 100 |
+if(isset($globalskin)) $skin = $globalskin; |
|
| 101 |
+ |
|
| 102 |
+if(isset($_GET['action'])) $action = strip_tags($_GET['action']); |
|
| 103 |
+else $action = false; |
|
| 104 |
+ |
|
| 105 |
+if(file_exists(_BASEDIR."languages/{$language}.php")) include (_BASEDIR."languages/{$language}.php");
|
|
| 106 |
+else include (_BASEDIR."languages/en.php"); |
|
| 107 |
+ |
|
| 108 |
+include_once(_BASEDIR."includes/queries.php"); |
|
| 109 |
+include_once(_BASEDIR."includes/corefunctions.php"); |
|
| 110 |
+ |
|
| 111 |
+// Check and/or set some variables used at various points throughout the script |
|
| 112 |
+if(isset($_GET['offset'])) $offset = $_GET['offset']; |
|
| 113 |
+if(!isset($offset) || !isNumber($offset)) $offset = 0; |
|
| 114 |
+if(isset($_REQUEST["sid"])) $sid = $_REQUEST["sid"]; |
|
| 115 |
+if(isset($sid) && !isNumber($sid)) unset($sid); |
|
| 116 |
+if(isset($_REQUEST['seriesid'])) $seriesid = $_REQUEST["seriesid"]; |
|
| 117 |
+if(isset($seriesid) && !isNumber($seriesid)) unset($seriesid); |
|
| 118 |
+if(isset($_REQUEST['uid'])) $uid = $_REQUEST["uid"]; |
|
| 119 |
+if(isset($uid) && !isNumber($uid)) unset($uid); |
|
| 120 |
+if(isset($_REQUEST['chapid'])) $chapid = $_REQUEST["chapid"]; |
|
| 121 |
+if(isset($chapid) && !isNumber($chapid)) unset($chapid); |
|
| 122 |
+$let = false; |
|
| 123 |
+if(isset($_GET['let'])) $let = $_GET['let']; |
|
| 124 |
+if(isset($let) && !in_array($let, $alphabet)) $let = false; |
|
| 125 |
+$output = ""; |
|
| 126 |
+ |
|
| 127 |
+// Cleans these two variables of possible XSS attacks. |
|
| 128 |
+if(isset($_SERVER['PHP_SELF'])) $_SERVER['PHP_SELF'] = htmlspecialchars(descript($_SERVER['PHP_SELF']), ENT_QUOTES); |
|
| 129 |
+if(isset($PHP_SELF)) $PHP_SELF = htmlspecialchars(descript($PHP_SELF), ENT_QUOTES); |
|
| 130 |
+ |
|
| 131 |
+// Set these variables to start. |
|
| 132 |
+$agecontsent = false; $viewed = false; |
|
| 133 |
+ |
|
| 134 |
+require_once("includes/get_session_vars.php");
|
|
| 135 |
+ |
|
| 136 |
+if(isset($_GET['skin'])) {
|
|
| 137 |
+ $siteskin = $_GET['skin']; |
|
| 138 |
+ $_SESSION[SITEKEY."_skin"] = $siteskin; |
|
| 139 |
+} |
|
| 140 |
+ |
|
| 141 |
+$v = explode(".", $version);
|
|
| 142 |
+include("version.php");
|
|
| 143 |
+$newV = explode(".", $version);
|
|
| 144 |
+//if($v[0] == $newV[0] && ($v[1] < $newV[1] || (isset($newV[2]) && $v[2] < $newV[2]))) {
|
|
| 145 |
+foreach($newV AS $k => $l) {
|
|
| 146 |
+ if($newV[$k] > $v[$k] || (!empty($newV[$k]) && empty($v[$k]))) {
|
|
| 147 |
+ if(isADMIN && basename($_SERVER['PHP_SELF']) != "update.php") {
|
|
| 148 |
+ header("Location: update.php");
|
|
| 149 |
+ exit( ); |
|
| 150 |
+ } |
|
| 151 |
+ else if(!isADMIN && basename($_SERVER['PHP_SELF']) != "maintenance.php" && !(isset($_GET['action']) && $_GET['action'] == "login")) {
|
|
| 152 |
+ header("Location: maintenance.php");
|
|
| 153 |
+ exit( ); |
|
| 154 |
+ } |
|
| 155 |
+ } |
|
| 156 |
+} |
|
| 157 |
+ |
|
| 158 |
+if(!empty($_SESSION[SITEKEY."_skin"])) $siteskin = $_SESSION[SITEKEY."_skin"]; |
|
| 159 |
+if($maintenance && !isADMIN && basename($_SERVER['PHP_SELF']) != "maintenance.php" && !(isset($_GET['action']) && $_GET['action'] == "login")) {
|
|
| 160 |
+ header("Location: maintenance.php");
|
|
| 161 |
+ exit( ); |
|
| 162 |
+} |
|
| 163 |
+ |
|
| 164 |
+$blockquery = dbquery("SELECT * FROM " . TABLEPREFIX . "fanfiction_blocks");
|
|
| 165 |
+while ($block = dbassoc($blockquery)) |
|
| 166 |
+{
|
|
| 167 |
+ |
|
| 168 |
+ if (!empty($block['block_variables'])) |
|
| 169 |
+ {
|
|
| 170 |
+ |
|
| 171 |
+ $block_vars = @unserialize($block['block_variables']); |
|
| 172 |
+ if ($block_vars) |
|
| 173 |
+ {
|
|
| 174 |
+ $blocks[$block['block_name']] = $block_vars; |
|
| 175 |
+ } |
|
| 176 |
+ else {
|
|
| 177 |
+ // print_r($block); |
|
| 178 |
+ } |
|
| 179 |
+ } |
|
| 180 |
+ $blocks[$block['block_name']]['title'] = $block['block_title']; |
|
| 181 |
+ $blocks[$block['block_name']]['file'] = $block['block_file']; |
|
| 182 |
+ $blocks[$block['block_name']]['status'] = $block['block_status']; |
|
| 183 |
+} |
|
| 184 |
+ |
|
| 185 |
+ |
|
| 186 |
+// This session variable is used to track the story views |
|
| 187 |
+if(isset($_SESSION[SITEKEY."_viewed"])) $viewed = $_SESSION[SITEKEY."_viewed"]; |
|
| 188 |
+ |
|
| 189 |
+if(isset($_GET['ageconsent'])) $_SESSION[SITEKEY."_ageconsent"] = 1; |
|
| 190 |
+if(isset($_GET['warning'])) $_SESSION[SITEKEY."_warned"][$_GET['warning']] = 1; |
|
| 191 |
+ |
|
| 192 |
+if(file_exists("languages/{$language}.php")) require_once ("languages/{$language}.php");
|
|
| 193 |
+else require_once ("languages/en.php");
|
|
| 194 |
+if(is_dir(_BASEDIR."skins/$siteskin")) $skindir = _BASEDIR."skins/$siteskin"; |
|
| 195 |
+else if(is_dir(_BASEDIR."skins/".$settings['skin'])) $skindir = _BASEDIR."skins/".$defaultskin; |
|
| 196 |
+else $skindir = _BASEDIR."default_tpls"; |
|
| 197 |
+if(USERUID) {
|
|
| 198 |
+ $prefs = dbquery("SELECT sortby, storyindex, tinyMCE FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE uid = '".USERUID."'");
|
|
| 199 |
+ if(dbnumrows($prefs)) list($defaultsort, $displayindex, $tinyMCEAuthor) = dbrow($prefs); |
|
| 200 |
+ if(!$tinyMCEAuthor) $tinyMCE = 0; |
|
| 201 |
+} |
|
| 202 |
+if(isset($_REQUEST['sort'])) $defaultsort = $_REQUEST['sort'] == "update" ? 1 : 0; |
|
| 203 |
+define("_ORDERBY", " ORDER BY ".($defaultsort == 1 ? "updated DESC" : "stories.title ASC"));
|
|
| 204 |
+if($current == "viewstory"){
|
|
| 205 |
+ if(isset($chapid)) {
|
|
| 206 |
+ $squery = dbquery("SELECT sid, inorder FROM ".TABLEPREFIX."fanfiction_chapters WHERE chapid = ".$chapid." LIMIT 1");
|
|
| 207 |
+ list($sid, $chapter) = dbrow($squery); |
|
| 208 |
+ } |
|
| 209 |
+ $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");
|
|
| 210 |
+ if($story = dbassoc($titlequery)) {
|
|
| 211 |
+ $authlink[] = $story['penname']; |
|
| 212 |
+ if($story['coauthors']) {
|
|
| 213 |
+ $coquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_coauthors as ca ON "._UIDFIELD." = ca.uid WHERE ca.sid = '$sid'");
|
|
| 214 |
+ while($co = dbassoc($coquery)) {
|
|
| 215 |
+ $authlink[] = $co['penname']; |
|
| 216 |
+ } |
|
| 217 |
+ } |
|
| 218 |
+ $titleinfo = stripslashes($story['title'])." "._BY." ".implode(", ", $authlink);
|
|
| 219 |
+ $metaDesc = htmlspecialchars(stripslashes($story['summary'])); |
|
| 220 |
+ $filename = basename($titleinfo.".html"); |
|
| 221 |
+ $ie = strpos("msie", strtolower($_SERVER['HTTP_USER_AGENT'])) !== false ? true : false;
|
|
| 222 |
+ if ($ie) $filename = rawurlencode($filename); |
|
| 223 |
+ //header("Content-Disposition: inline; filename=\"".$titleinfo."\"");
|
|
| 224 |
+ } |
|
| 225 |
+} |
|
| 226 |
+if($current == "viewuser" && isNumber($uid)) {
|
|
| 227 |
+ $author = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '".$uid."'");
|
|
| 228 |
+ list($penname) = dbrow($author); |
|
| 229 |
+ $titleinfo = "$sitename :: $penname"; |
|
| 230 |
+} |
|
| 231 |
+echo _DOCTYPE."<html><head>"; |
|
| 232 |
+echo "<meta charset='utf-8' />"; |
|
| 233 |
+if(!isset($titleinfo)) $titleinfo = "$sitename :: $slogan"; |
|
| 234 |
+if(isset($metaDesc)) echo "<meta name='description' content='$metaDesc'>"; |
|
| 235 |
+echo "<title>$titleinfo</title>"; |
|
| 236 |
+ |
|
| 237 |
+// ---------- Favicon --------- |
|
| 238 |
+if (file_exists(_BASEDIR."favicon.ico")) |
|
| 239 |
+{
|
|
| 240 |
+ 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"; |
|
| 241 |
+} |
|
| 242 |
+ |
|
| 243 |
+echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset="._CHARSET."\">"; |
|
| 244 |
+if (!isset($_GET['action']) || $_GET['action'] != "printable") |
|
| 245 |
+{
|
|
| 246 |
+ echo "<script language=\"javascript\" type=\"text/javascript\" src=\"" . _BASEDIR . "includes/javascript.js\"></script> |
|
| 247 |
+<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$sitename RSS Feed\" href=\"" . _BASEDIR . "rss.php\">"; |
|
| 248 |
+} |
|
| 249 |
+ |
|
| 250 |
+if (!isset($_GET['action']) || $_GET['action'] != "printable") |
|
| 251 |
+{
|
|
| 252 |
+ if (!empty($tinyMCE)) |
|
| 253 |
+ {
|
|
| 254 |
+ if($tinyMCE == 1) {
|
|
| 255 |
+ echo "<script language=\"javascript\" type=\"text/javascript\" src=\"" . _BASEDIR . "tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>"; |
|
| 256 |
+ include(_BASEDIR . "tinymce/init.php"); |
|
| 257 |
+ } |
|
| 258 |
+ else {
|
|
| 259 |
+ echo "<script language=\"javascript\" type=\"text/javascript\" src=\"" . _BASEDIR . "tinymce4/js/tinymce/tinymce.min.js\"></script>"; |
|
| 260 |
+ include(_BASEDIR . "tinymce4/init.php"); |
|
| 261 |
+ } |
|
| 262 |
+ } |
|
| 263 |
+} |
|
| 264 |
+if(isset($displayform) && $displayform == 1) {
|
|
| 265 |
+echo "<script language=\"javascript\" type=\"text/javascript\" src=\""._BASEDIR."includes/xmlhttp.js\"></script>"; |
|
| 266 |
+echo "<script language=\"javascript\" type=\"text/javascript\"> |
|
| 267 |
+lang = new Array( ); |
|
| 268 |
+ |
|
| 269 |
+lang['Back2Cats'] = '"._BACK2CATS."'; |
|
| 270 |
+lang['ChooseCat'] = '"._CHOOSECAT."'; |
|
| 271 |
+lang['Categories'] = '"._CATEGORIES."'; |
|
| 272 |
+lang['Characters'] = '"._CHARACTERS."'; |
|
| 273 |
+lang['MoveTop'] = '"._MOVETOP."'; |
|
| 274 |
+lang['TopLevel'] = '"._TOPLEVEL."'; |
|
| 275 |
+lang['CatLocked'] = '"._CATLOCKED."'; |
|
| 276 |
+basedir = '"._BASEDIR."'; |
|
| 277 |
+ |
|
| 278 |
+categories = new Array( ); |
|
| 279 |
+characters = new Array( ); |
|
| 280 |
+\n"; |
|
| 281 |
+/* |
|
| 282 |
+ $result = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_categories ORDER BY leveldown, displayorder");
|
|
| 283 |
+$x = 0; |
|
| 284 |
+ while($category = dbassoc($result)) {
|
|
| 285 |
+ echo "categories[$x] = new category(".$category['parentcatid'].", ".$category['catid'].", \"". str_replace('"', '\"', stripslashes($category['category']))."\", ".$category['locked'].", ".$category['displayorder'].");\r\n";
|
|
| 286 |
+ $catlist[$category['catid']] = array("name" => stripslashes($category['category']), "pid" => $category['parentcatid'], "locked" => (isADMIN ? 0 : $category['locked']), "order" => $category['displayorder'], "leveldown" => $category['leveldown']);
|
|
| 287 |
+ $x++; |
|
| 288 |
+ } |
|
| 289 |
+$x = 0; |
|
| 290 |
+ $result = dbquery("SELECT charname, catid, charid FROM ".TABLEPREFIX."fanfiction_characters ORDER BY charname");
|
|
| 291 |
+ while($char = dbassoc($result)) {
|
|
| 292 |
+ echo "characters[$x] = new character(".$char['charid'].", ".$char['catid'].", \"".str_replace('"', '\"', stripslashes($char['charname']))."\");\r\n";
|
|
| 293 |
+ $charlist[$char['charid']] = array("name" => stripslashes($char['charname']), "catid" => $char['catid']);
|
|
| 294 |
+ $x++; |
|
| 295 |
+ } |
|
| 296 |
+*/ |
|
| 297 |
+echo "</script>"; |
|
| 298 |
+} |
|
| 299 |
+if(file_exists("extra_header.php")) include_once("extra_header.php");
|
|
| 300 |
+if(file_exists("$skindir/extra_header.php")) include_once("$skindir/extra_header.php");
|
|
| 301 |
+if(!$displaycolumns) $displaycolumns = 1; |
|
| 302 |
+$colwidth = floor(100/$displaycolumns); |
|
| 303 |
+if(!empty($_GET['action']) && $_GET['action'] == "printable") {
|
|
| 304 |
+ if(file_exists("$skindir/printable.css")) echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$skindir/printable.css\">";
|
|
| 305 |
+ else echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"default_tpls/printable.css\">"; |
|
| 306 |
+ echo "<script type='text/javascript'> |
|
| 307 |
+<!-- |
|
| 308 |
+if (window.print) {
|
|
| 309 |
+ window.print() ; |
|
| 310 |
+} else {
|
|
| 311 |
+ var WebBrowser = '<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>'; |
|
| 312 |
+document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
|
|
| 313 |
+ WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = \"\"; |
|
| 314 |
+} |
|
| 315 |
+--> |
|
| 316 |
+</script>"; |
|
| 317 |
+} |
|
| 318 |
+else {
|
|
| 319 |
+echo "<style type=\"text/css\"> |
|
| 320 |
+#columncontainer { margin: 1em auto; width: auto; padding: 5%;}
|
|
| 321 |
+#browseblock, #memberblock { width: 100%; padding: 0; margin: 0; float: left; border: 0px solid transparent; }
|
|
| 322 |
+.column { float: left; width: ".($colwidth - 1)."%; }
|
|
| 323 |
+html>body .column { width: $colwidth%; }
|
|
| 324 |
+.cleaner { clear: both; height: 1px; font-size: 1px; margin: 0; padding: 0; background: transparent; }
|
|
| 325 |
+#settingsform { margin: 0; padding: 0; border: none; }
|
|
| 326 |
+#settingsform FORM { width: 100%; margin: 0 10%; }
|
|
| 327 |
+#settingsform LABEL { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left; }
|
|
| 328 |
+#settingsform DIV { clear: both;}
|
|
| 329 |
+#settingsform .fieldset SPAN { float: left; display: block; width: 30%; text-align: right; padding-right: 10px; clear: left;}
|
|
| 330 |
+#settingsform .fieldset LABEL { float: none; width: auto; display: inline; text-align: left; clear: none; }
|
|
| 331 |
+#settingsform { float: left; margin: 1ex 10%; }
|
|
| 332 |
+#settingsform .tinytoggle { text-align: center; }
|
|
| 333 |
+#settingsform .tinytoggle LABEL { float: none; display: inline; width: auto; text-align: center; padding: 0; clear: none; }
|
|
| 334 |
+#settingsform #submitdiv { text-align: center; width: 100%;clear: both; height: 3em; }
|
|
| 335 |
+#settingsform #submitdiv #submit { position: absolute; z-index: 10001; margin: 1em; }
|
|
| 336 |
+a.pophelp{
|
|
| 337 |
+ position: relative; /* this is the key*/ |
|
| 338 |
+ vertical-align: super; |
|
| 339 |
+} |
|
| 340 |
+ |
|
| 341 |
+a.pophelp:hover{z-index:100; border: none; text-decoration: none;}
|
|
| 342 |
+ |
|
| 343 |
+a.pophelp span{display: none; position: absolute; top: -25em; left: 20em; }
|
|
| 344 |
+ |
|
| 345 |
+a.pophelp:hover span{ /*the span will display just on :hover state*/
|
|
| 346 |
+ display:block; |
|
| 347 |
+ position: absolute; |
|
| 348 |
+ top: -3em; left: 8em; width: 225px; |
|
| 349 |
+ border:1px solid #000; |
|
| 350 |
+ background-color:#CCC; color:#000; |
|
| 351 |
+ text-decoration: none; |
|
| 352 |
+ text-align: left; |
|
| 353 |
+ padding: 5px; |
|
| 354 |
+ font-weight: normal; |
|
| 355 |
+ visibility: visible; |
|
| 356 |
+} |
|
| 357 |
+.required { color: red; }
|
|
| 358 |
+.shim {
|
|
| 359 |
+ position: absolute; |
|
| 360 |
+ display: none; |
|
| 361 |
+ height: 0; |
|
| 362 |
+ width:0; |
|
| 363 |
+ margin: 0; |
|
| 364 |
+ padding: 0; |
|
| 365 |
+ z-index: 100; |
|
| 366 |
+} |
|
| 367 |
+ |
|
| 368 |
+.ajaxOptList {
|
|
| 369 |
+ background: #CCC; |
|
| 370 |
+ border: 1px solid #000; |
|
| 371 |
+ margin: 0; |
|
| 372 |
+ position: absolute; |
|
| 373 |
+ padding: 0; |
|
| 374 |
+ z-index: 1000; |
|
| 375 |
+ text-align: left; |
|
| 376 |
+} |
|
| 377 |
+.ajaxListOptOver {
|
|
| 378 |
+ padding: 4px; |
|
| 379 |
+ background: #CCC; |
|
| 380 |
+ margin: 0; |
|
| 381 |
+} |
|
| 382 |
+.ajaxListOpt {
|
|
| 383 |
+ background: #EEE; |
|
| 384 |
+ padding: 4px; |
|
| 385 |
+ margin: 0; |
|
| 386 |
+} |
|
| 387 |
+.multiSelect {
|
|
| 388 |
+ width: 300px; |
|
| 389 |
+} |
|
| 390 |
+ |
|
| 391 |
+</style> |
|
| 392 |
+<link rel='stylesheet' type='text/css' href='$skindir/style.css' /> \n |
|
| 393 |
+<meta name='viewport' content='width=device-width, initial-scale=1.0' /> |
|
| 394 |
+"; |
|
| 395 |
+} |
|
| 396 |
+echo "</head>"; |
|
| 397 |
+$headerSent = true; |
|
| 398 |
+include (_BASEDIR."includes/class.TemplatePower.inc.php"); |
|
| 399 |
+if($debug == 1) {
|
|
| 400 |
+ @ error_reporting(E_ALL); |
|
| 401 |
+ echo "\n<!-- \$_SESSION \n"; print_r($_SESSION); echo " -->"; |
|
| 402 |
+ echo "\n<!-- \$_COOKIE \n"; print_r($_COOKIE); echo " -->"; |
|
| 403 |
+ echo "\n<!-- \$_POST \n"; print_r($_POST); echo " -->"; |
|
| 404 |
+} |
|
| 405 |
+?> |