| ... | ... |
@@ -2,6 +2,8 @@ |
| 2 | 2 |
|
| 3 | 3 |
- added notification module |
| 4 | 4 |
- changed files: user/editbio.php and user/lostpassword.php |
| 5 |
+- chanded way for loading DB functions - moved from config file! |
|
| 6 |
+- fixed bug in install.php - script worked but in PHP 8.x it caused warnings |
|
| 5 | 7 |
|
| 6 | 8 |
|
| 7 | 9 |
# efiction v3.5.7 |
| ... | ... |
@@ -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( ); |
| ... | ... |
@@ -1,7 +1,12 @@ |
| 1 | 1 |
<?php |
| 2 | 2 |
|
| 3 |
-if(function_exists("mysqli_connect")) include_once(_BASEDIR."includes/mysqli_functions.php");
|
|
| 4 |
-else {
|
|
| 3 |
+ |
|
| 4 |
+ |
|
| 5 |
+if(function_exists("mysqli_connect")) {
|
|
| 6 |
+ |
|
| 7 |
+ include_once(_BASEDIR."includes/mysqli_functions.php"); |
|
| 8 |
+ $dbconnect = @dbconnect($dbhost, $dbuser, $dbpass, $dbname); |
|
| 9 |
+}else {
|
|
| 5 | 10 |
include(_BASEDIR."languages/en.php"); // Because we haven't selected a language setting yet |
| 6 | 11 |
die(_FATALERROR._NODBFUNCTIONALITY); |
| 7 | 12 |
} |
| ... | ... |
@@ -4,10 +4,11 @@ |
| 4 | 4 |
if(!function_exists("dbconnect")) { // just in case. Some people seemed to be having an issue and this was the easiest fix.
|
| 5 | 5 |
|
| 6 | 6 |
function dbconnect($dbhost, $dbuser, $dbpass, $dbname ) {
|
| 7 |
- $mysql_access = new mysqli($dbhost, $dbuser, $dbpass, $dbname); |
|
| 7 |
+ $mysqli_access = new mysqli($dbhost, $dbuser, $dbpass, $dbname); |
|
| 8 |
+ |
|
| 8 | 9 |
try |
| 9 | 10 |
{
|
| 10 |
- $mysql_access = new mysqli($dbhost, $dbuser, $dbpass, $dbname); |
|
| 11 |
+ $mysqli_access = new mysqli($dbhost, $dbuser, $dbpass, $dbname); |
|
| 11 | 12 |
} |
| 12 | 13 |
catch (mysqli_sql_exception $e) |
| 13 | 14 |
{
|
| ... | ... |
@@ -18,9 +19,9 @@ function dbconnect($dbhost, $dbuser, $dbpass, $dbname ) {
|
| 18 | 19 |
} |
| 19 | 20 |
} |
| 20 | 21 |
//mysqli_query($mysql_access, "SET SESSION sql_mode = 'NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION'"); |
| 21 |
- mysqli_query($mysql_access, "SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION'"); |
|
| 22 |
- mysqli_query($mysql_access, "SET NAMES UTF8;"); |
|
| 23 |
- return $mysql_access; |
|
| 22 |
+ mysqli_query($mysqli_access, "SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION'"); |
|
| 23 |
+ mysqli_query($mysqli_access, "SET NAMES UTF8;"); |
|
| 24 |
+ return $mysqli_access; |
|
| 24 | 25 |
} |
| 25 | 26 |
|
| 26 | 27 |
|
| ... | ... |
@@ -91,4 +92,4 @@ function escapestring($str) {
|
| 91 | 92 |
// End DB functions |
| 92 | 93 |
|
| 93 | 94 |
} |
| 94 |
-?> |
|
| 95 | 95 |
\ No newline at end of file |
| 96 |
+?> |
| ... | ... |
@@ -100,7 +100,7 @@ if(!defined("_CHARSET")) exit( );
|
| 100 | 100 |
$numchapsquery = dbquery("SELECT count(sid) FROM ".TABLEPREFIX."fanfiction_chapters WHERE sid = '".$stories['sid']."' AND validated > 0");
|
| 101 | 101 |
list($chapters) = dbrow($numchapsquery); |
| 102 | 102 |
$tpl->assign("numchapters", $chapters );
|
| 103 |
- |
|
| 103 |
+ |
|
| 104 | 104 |
$tpl->assign("updated" , date("$dateformat", $stories['updated']) );
|
| 105 | 105 |
$tpl->assign("published" , date("$dateformat", $stories['date']) );
|
| 106 | 106 |
if(!empty($recentdays)) {
|
| ... | ... |
@@ -105,6 +105,8 @@ else if (isset($_REQUEST['language'])) |
| 105 | 105 |
else |
| 106 | 106 |
{
|
| 107 | 107 |
include("../config.php");
|
| 108 |
+ include("../includes/dbfunctions.php");
|
|
| 109 |
+ |
|
| 108 | 110 |
$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname); |
| 109 | 111 |
$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
|
| 110 | 112 |
list($tableprefix, $language) = dbrow($settings); |
| ... | ... |
@@ -824,9 +826,11 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` ( |
| 824 | 826 |
|
| 825 | 827 |
case "2"; |
| 826 | 828 |
include("../config.php");
|
| 829 |
+ include("../includes/dbfunctions.php");
|
|
| 827 | 830 |
if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
|
| 828 | 831 |
{
|
| 829 |
- include("../config.php");
|
|
| 832 |
+ //include("../config.php");
|
|
| 833 |
+ //include("../includes/dbfunctions.php");
|
|
| 830 | 834 |
$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname); |
| 831 | 835 |
$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
|
| 832 | 836 |
list($tableprefix, $language) = dbrow($settings); |
| ... | ... |
@@ -955,13 +959,14 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` ( |
| 955 | 959 |
{
|
| 956 | 960 |
|
| 957 | 961 |
$test = dbquery("SHOW TABLES");
|
| 958 |
- if (!$test) $output .= write_message(_CONFIGFAILED); |
|
| 962 |
+ if (!$test) $output .= write_message(_CONFIGFAILED. "(2)"); |
|
| 959 | 963 |
else $output .= write_message(_SETTINGSTABLESETUP . " <a href='install.php?step=2&install=automatic'>" . _AUTO . "</a> " . _OR . " <a href='install.php?step=2&install=manual'>" . _MANUAL2 . "</a>"); |
| 960 | 964 |
} |
| 961 | 965 |
} |
| 962 | 966 |
break; |
| 963 | 967 |
default: |
| 964 | 968 |
$output .= "<div id='pagetitle'>" . _CONFIGDATA . "</div>"; |
| 969 |
+ |
|
| 965 | 970 |
if (isset($_POST['submit'])) |
| 966 | 971 |
{
|
| 967 | 972 |
$dbhost = descript($_POST['dbhost']); |
| ... | ... |
@@ -971,14 +976,16 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` ( |
| 971 | 976 |
$language = $_POST['language']; |
| 972 | 977 |
$sitekey = descript($_POST['sitekey']); |
| 973 | 978 |
$settingsprefix = descript($_POST['settingsprefix']); |
| 974 |
- $mysqli_access = mysqli_connect($dbhost, $dbuser, $dbpass); |
|
| 979 |
+ $mysqli_access = @mysqli_connect($dbhost, $dbuser,$dbpass, $dbname); |
|
| 980 |
+ |
|
| 975 | 981 |
if (!$mysqli_access) |
| 976 | 982 |
{
|
| 977 |
- $output .= write_message(_CONFIGFAILED); |
|
| 983 |
+ $output .= write_message(_CONFIGFAILED . "(1)"); |
|
| 978 | 984 |
} |
| 979 | 985 |
} |
| 980 | 986 |
if (isset($_POST['submit']) && $mysqli_access) |
| 981 | 987 |
{
|
| 988 |
+ |
|
| 982 | 989 |
$handle = fopen("../config.php", 'w');
|
| 983 | 990 |
if (!$handle) |
| 984 | 991 |
{
|
| ... | ... |
@@ -1003,10 +1010,13 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` ( |
| 1003 | 1010 |
\$sitekey = \"$sitekey\"; |
| 1004 | 1011 |
\$settingsprefix = \"$settingsprefix\"; |
| 1005 | 1012 |
|
| 1006 |
-include_once(\"includes/dbfunctions.php\"); |
|
| 1013 |
+?>"; |
|
| 1014 |
+ |
|
| 1015 |
+/* removed in 3.5.8 and moved to file: |
|
| 1016 |
+include(\"includes/dbfunctions.php\"); |
|
| 1007 | 1017 |
if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbname); |
| 1018 |
+*/ |
|
| 1008 | 1019 |
|
| 1009 |
-?>"; |
|
| 1010 | 1020 |
fwrite($handle, $text); |
| 1011 | 1021 |
fclose($handle); |
| 1012 | 1022 |
@chmod("../config.php", 0644);
|
| ... | ... |
@@ -1016,7 +1026,10 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn |
| 1016 | 1026 |
} |
| 1017 | 1027 |
else |
| 1018 | 1028 |
{
|
| 1019 |
- if (file_exists("../config.php") && !isset($mysqli_access)) include("../config.php");
|
|
| 1029 |
+ if (file_exists("../config.php") && !isset($mysqli_access)) {
|
|
| 1030 |
+ include("../config.php");
|
|
| 1031 |
+ include("../includes/dbfunctions.php");
|
|
| 1032 |
+ } |
|
| 1020 | 1033 |
if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED); |
| 1021 | 1034 |
else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED); |
| 1022 | 1035 |
else |
| ... | ... |
@@ -24,9 +24,10 @@ ini_set('display_errors', 0);
|
| 24 | 24 |
ini_set('display_startup_errors', 0);
|
| 25 | 25 |
error_reporting(-1); |
| 26 | 26 |
|
| 27 |
-define("_BASEDIR", "");
|
|
| 28 |
- require_once("includes/dbfunctions.php");
|
|
| 29 |
- require_once("config.php");
|
|
| 27 |
+define("_BASEDIR", "");
|
|
| 28 |
+require_once("config.php");
|
|
| 29 |
+require_once("includes/dbfunctions.php");
|
|
| 30 |
+ |
|
| 30 | 31 |
$settingsresults = dbquery("SELECT sitename, url, siteemail, slogan, language, tableprefix, dateformat FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'");
|
| 31 | 32 |
$settings = dbassoc($settingsresults); |
| 32 | 33 |
foreach($settings as $var => $val) {
|
| ... | ... |
@@ -624,7 +624,7 @@ function editstory($sid) {
|
| 624 | 624 |
if(isset($_POST['submit'])) {
|
| 625 | 625 |
$title = isset($_POST['title']) ? strip_tags(descript($_POST['title']), $allowed_tags) : ""; |
| 626 | 626 |
$summary = isset($_POST['summary']) ? strip_tags(descript($_POST['summary']), $allowed_tags) : ""; |
| 627 |
- $storynotes = strip_tags(descript($_POST['storynotes']), $allowed_tags); |
|
| 627 |
+ $storynotes = isset($_POST['storynotes']) ? strip_tags(descript($_POST['storynotes']), $allowed_tags) : ""; |
|
| 628 | 628 |
$rr = isset($_POST['rr']) && isNumber($_POST['rr']) ? $_POST['rr'] : 0; |
| 629 | 629 |
$feat = isset($_POST['feature']) && isNumber($_POST['feature']) ? $_POST['feature'] : 0; |
| 630 | 630 |
$complete = isset($_POST['complete']) && isNumber($_POST['complete']) ? $_POST['complete'] : 0; |
| ... | ... |
@@ -202,7 +202,7 @@ if ($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 6)) //3.5.5 |
| 202 | 202 |
else $output .= write_message("Are you ready to update? <a href='update.php?confirm=yes'>" . _YES . "</a> " . _OR . " <a href='update.php?confirm=no'>" . _NO . "</a>");
|
| 203 | 203 |
} |
| 204 | 204 |
} |
| 205 |
-elseif ($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 7)) //3.5.6 |
|
| 205 |
+elseif ($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 8)) //3.5.6 + 3.5.7 |
|
| 206 | 206 |
{
|
| 207 | 207 |
if ($confirm == "yes") |
| 208 | 208 |
{
|
| ... | ... |
@@ -261,6 +261,7 @@ elseif ($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 7)) //3. |
| 261 | 261 |
} |
| 262 | 262 |
|
| 263 | 263 |
} |
| 264 |
+ |
|
| 264 | 265 |
else $output .= write_message(_ALREADYUPDATED); |
| 265 | 266 |
|
| 266 | 267 |
/* until database is fully fixed, not update efiction version */ |
| ... | ... |
@@ -26,6 +26,7 @@ |
| 26 | 26 |
if(!defined("_LOGINCHECK")) exit( );
|
| 27 | 27 |
define("_BASEDIR", "");
|
| 28 | 28 |
include_once("config.php");
|
| 29 |
+ include(_BASEDIR . "includes/dbfunctions.php"); |
|
| 29 | 30 |
$settings = dbquery("SELECT tableprefix, maintenance, sitekey, debug FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
|
| 30 | 31 |
list($tableprefix, $maintenance, $sitekey, $debug) = dbrow($settings); |
| 31 | 32 |
$tempdebug = $debug; |
| ... | ... |
@@ -110,7 +111,12 @@ |
| 110 | 111 |
if($link['link_access'] == 2 && !isADMIN) continue; |
| 111 | 112 |
$pagelinks[$link['link_name']] = array("id" => $link['link_id'], "text" => $link['link_text'], "url" => _BASEDIR.$link['link_url'], "link" => "<a href=\"".$link['link_url']."\" title=\"".$link['link_text']."\"".($link['link_target'] ? " target=\"_blank\"" : "").($current == $link['link_name'] ? " id=\"current\"" : "").">".$link['link_text']."</a>");
|
| 112 | 113 |
} |
| 113 |
- $output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']."</div>"; |
|
| 114 |
+ $output .= "<div style='text-align: center;'>"; |
|
| 115 |
+ if(isset($pagelinks['register'])) {
|
|
| 116 |
+ $output .= $pagelinks['register']['link']." | "; |
|
| 117 |
+ } |
|
| 118 |
+ $output .= $pagelinks['lostpassword']['link']."</div>"; |
|
| 119 |
+ |
|
| 114 | 120 |
} |
| 115 | 121 |
} |
| 116 | 122 |
?> |
| ... | ... |
@@ -34,7 +34,22 @@ if(empty($chapter)) $chapter = isset($_GET['chapter']) && isNumber($_GET['chapte |
| 34 | 34 |
// Get the story information |
| 35 | 35 |
$storyquery = dbquery("SELECT "._PENNAMEFIELD." as penname, "._UIDFIELD." as uid, story.*, story.date as date, story.updated as updated, story.validated as valid FROM ".TABLEPREFIX."fanfiction_stories as story, "._AUTHORTABLE." WHERE story.sid = '".$sid."' AND story.uid = "._UIDFIELD);
|
| 36 | 36 |
$storyinfo = dbassoc($storyquery); |
| 37 |
- if($storyinfo['coauthors'] == 1) {
|
|
| 37 |
+ |
|
| 38 |
+ if(!$storyinfo) {
|
|
| 39 |
+ $current = "storyerror"; |
|
| 40 |
+ // load our template files to set up the page. |
|
| 41 |
+ if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
|
|
| 42 |
+ else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 43 |
+ $title = "Story was not found"; |
|
| 44 |
+ $text = "Story with ID " . $sid . " is not in database"; |
|
| 45 |
+ include("includes/pagesetup.php");
|
|
| 46 |
+ $tpl->assign("output", "<div id='pagetitle'>" . $title . "</div>" . write_error($text));
|
|
| 47 |
+ $tpl->printToScreen(); |
|
| 48 |
+ dbclose(); |
|
| 49 |
+ exit(); |
|
| 50 |
+ } |
|
| 51 |
+ |
|
| 52 |
+ if($storyinfo['coauthors'] > 0) {
|
|
| 38 | 53 |
$array_coauthors = array(); |
| 39 | 54 |
$coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$sid."'");
|
| 40 | 55 |
while($c = dbassoc($coauth)) {
|
| ... | ... |
@@ -295,12 +310,28 @@ else {
|
| 295 | 310 |
// if the story has only one chapter this is what happens |
| 296 | 311 |
else {
|
| 297 | 312 |
$chapter = dbassoc($chapterinfo); |
| 313 |
+ |
|
| 314 |
+ if (!$chapter) |
|
| 315 |
+ {
|
|
| 316 |
+ $current = "chaptererror"; |
|
| 317 |
+ // load our template files to set up the page. |
|
| 318 |
+ if (file_exists("$skindir/default.tpl")) $tpl = new TemplatePower("$skindir/default.tpl");
|
|
| 319 |
+ else $tpl = new TemplatePower("default_tpls/default.tpl");
|
|
| 320 |
+ $title = "Chapter was not found"; |
|
| 321 |
+ $text = "Missing chapter"; |
|
| 322 |
+ include("includes/pagesetup.php");
|
|
| 323 |
+ $tpl->assign("output", "<div id='pagetitle'>" . $title . "</div>" . write_error($text));
|
|
| 324 |
+ $tpl->printToScreen(); |
|
| 325 |
+ dbclose(); |
|
| 326 |
+ exit(); |
|
| 327 |
+ } |
|
| 328 |
+ |
|
| 298 | 329 |
$chapterauthor = $chapter['uid']; |
| 299 | 330 |
$chapterpenname = $chapter['penname']; |
| 300 | 331 |
$chaptertitle = $chapter['title']; |
| 301 | 332 |
$chapid = $chapter['chapid']; |
| 302 |
- $title = stripslashes($chapter['title']); |
|
| 303 |
- $inorder = $chapter['inorder']; |
|
| 333 |
+ $title = stripslashes((string) $chapter['title']); |
|
| 334 |
+ $inorder = $chapter['inorder']; |
|
| 304 | 335 |
$notes = format_story($chapter['notes']); |
| 305 | 336 |
$endnotes = format_story($chapter['endnotes']); |
| 306 | 337 |
$story = $chapter['storytext']; |