Browse code

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

Clarissa Walker authored on 2026/09/05 13:38:55
Showing 7 changed files
... ...
@@ -6,4 +6,5 @@ $dbpass = "dbpass";
6 6
 $sitekey = "";
7 7
 $settingsprefix = "settings";
8 8
 
9
+include("includes/dbfunctions.php");
9 10
 ?>
... ...
@@ -1,7 +1,6 @@
1 1
 <?php
2 2
 define("_BASEDIR", "../");
3 3
 include("../config.php");
4
-include("../includes/dbfunctions.php");
5 4
 list($tableprefix) = dbrow(dbquery("SELECT tableprefix FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'"));
6 5
 define("TABLEPREFIX", $tableprefix);
7 6
 include("../includes/queries.php");
... ...
@@ -22,4 +21,4 @@ while($char = dbassoc($characters)) {
22 21
 	echo "characters[$x] = new Array(".$char['charid'].", \"".str_replace($find, $replace, stripslashes($char['charname']))."\");\r\n";
23 22
 	$x++;
24 23
 }
25
-?>
26 24
\ No newline at end of file
25
+?>
... ...
@@ -3,7 +3,6 @@ define("_BASEDIR", "../");
3 3
 define("_CHARSET", "utf-8");
4 4
 
5 5
 include("../config.php");
6
-include("../includes/dbfunctions.php");
7 6
  
8 7
 
9 8
 list($tableprefix, $lang) = dbrow(dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'"));
... ...
@@ -1,7 +1,6 @@
1 1
 <?php
2 2
 define("_BASEDIR", "../");
3 3
 include("../config.php");
4
-include("../includes/dbfunctions.php");
5 4
 list($tableprefix, $lang) = dbrow(dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'"));
6 5
 define("TABLEPREFIX", $tableprefix);
7 6
 include(_BASEDIR."languages/$lang.php");
... ...
@@ -7,7 +7,6 @@ define("_BASEDIR", "../");
7 7
 define("_CHARSET", "utf-8");
8 8
 
9 9
 include("../config.php");
10
-include("../includes/dbfunctions.php");
11 10
 list($tableprefix, $language) = dbrow(dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'"));
12 11
 define("TABLEPREFIX", $tableprefix);
13 12
 if(file_exists(_BASEDIR."languages/{$language}.php")) include (_BASEDIR."languages/{$language}.php");
... ...
@@ -29,4 +28,4 @@ if(count($userlist) > 0) {
29 28
 		$x++;
30 29
 	}
31 30
 }
32
-?>
33 31
\ No newline at end of file
32
+?>
... ...
@@ -112,7 +112,6 @@ else if (isset($_REQUEST['language']))
112 112
 else
113 113
 {
114 114
 	include("../config.php");
115
-	include("../includes/dbfunctions.php");
116 115
 
117 116
 	$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
118 117
 	$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
... ...
@@ -849,11 +848,8 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
849 848
 
850 849
 	case "2";
851 850
 		include("../config.php");
852
-		include("../includes/dbfunctions.php");
853 851
 		if (dbnumrows(dbquery("SHOW TABLES LIKE '" . $settingsprefix . "fanfiction_settings'")))
854 852
 		{
855
-			//include("../config.php");
856
-			//include("../includes/dbfunctions.php");
857 853
 			$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname);
858 854
 			$settings = dbquery("SELECT tableprefix, language FROM " . $settingsprefix . "fanfiction_settings WHERE sitekey = '" . $sitekey . "'");
859 855
 			list($tableprefix, $language) = dbrow($settings);
... ...
@@ -1037,6 +1033,7 @@ CREATE TABLE IF NOT EXISTS `" . $tableprefix . "fanfiction_modules` (
1037 1033
 \$sitekey = \"$sitekey\";
1038 1034
 \$settingsprefix = \"$settingsprefix\";
1039 1035
 
1036
+include(\"includes/dbfunctions.php\");
1040 1037
 ?>";
1041 1038
 
1042 1039
 /* removed in 3.5.8 and moved to file: 
... ...
@@ -1055,7 +1052,6 @@ if(!empty(\$sitekey)) \$dbconnect = dbconnect(\$dbhost, \$dbuser,\$dbpass, \$dbn
1055 1052
 		{
1056 1053
 			if (file_exists("../config.php") && !isset($mysqli_access)) {
1057 1054
 				include("../config.php");
1058
-				include("../includes/dbfunctions.php");
1059 1055
 			}
1060 1056
 			if (isset($tinyMCE)) $output .= write_message(_CONFIG2DETECTED);
1061 1057
 			else if (isset($sitename) && $sitename) $output .= write_message(_CONFIG1DETECTED);
... ...
@@ -26,7 +26,6 @@
26 26
 		if(!defined("_LOGINCHECK")) exit( );
27 27
 		define("_BASEDIR", "");
28 28
 		include_once("config.php");
29
-		include(_BASEDIR . "includes/dbfunctions.php");
30 29
 		$settings = dbquery("SELECT tableprefix, maintenance, sitekey, debug FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
31 30
 		list($tableprefix, $maintenance, $sitekey, $debug) = dbrow($settings);
32 31
 		$tempdebug = $debug;