mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
add Redis for cache and Mysqli for database query
This commit is contained in:
@@ -9,5 +9,12 @@ $showversion = " - Powered by ".PROJECTNAME;
|
||||
$rootpath=realpath(dirname(__FILE__) . '/..');
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
|
||||
$rootpath .= "/";
|
||||
include($rootpath . 'include/core.php');
|
||||
include_once($rootpath . 'include/functions.php');
|
||||
require $rootpath . 'include/config.php';
|
||||
require $rootpath . 'include/functions.php';
|
||||
|
||||
require $rootpath . 'classes/interface_db.php';
|
||||
require $rootpath . 'classes/class_db_mysqli.php';
|
||||
require $rootpath . 'classes/class_db.php';
|
||||
require $rootpath . 'include/functions_db.php';
|
||||
|
||||
require $rootpath . 'include/core.php';
|
||||
|
||||
@@ -58,7 +58,6 @@ if (file_exists('config/allconfig.php')) {
|
||||
} else {
|
||||
ReadConfig();
|
||||
}
|
||||
|
||||
$SITENAME = $BASIC['SITENAME'];
|
||||
$BASEURL = $BASIC['BASEURL'];
|
||||
$announce_urls = array();
|
||||
@@ -148,10 +147,10 @@ $smtp_host = $SMTP['smtp_host'];
|
||||
$smtp_port = $SMTP['smtp_port'];
|
||||
if (strtoupper(substr(PHP_OS,0,3)=='WIN'))
|
||||
$smtp_from = $SMTP['smtp_from'];
|
||||
$smtpaddress = $SMTP['smtpaddress'];
|
||||
$smtpport = $SMTP['smtpport'];
|
||||
$accountname = $SMTP['accountname'];
|
||||
$accountpassword = $SMTP['accountpassword'];
|
||||
$smtpaddress = $SMTP['smtpaddress'] ?? '';
|
||||
$smtpport = $SMTP['smtpport'] ?? '';
|
||||
$accountname = $SMTP['accountname'] ?? '';
|
||||
$accountpassword = $SMTP['accountpassword'] ?? '';
|
||||
|
||||
$securelogin = $SECURITY['securelogin'];
|
||||
$securetracker = $SECURITY['securetracker'];
|
||||
@@ -179,7 +178,7 @@ $forummanage_class = $AUTHORITY['forummanage'];
|
||||
$viewuserlist_class = $AUTHORITY['viewuserlist'];
|
||||
$torrentmanage_class = $AUTHORITY['torrentmanage'];
|
||||
$torrentsticky_class = $AUTHORITY['torrentsticky'];
|
||||
$torrentonpromotion_class = $AUTHORITY['torrentonpromotion'];
|
||||
$torrentonpromotion_class = $AUTHORITY['torrentonpromotion'] ?? '';
|
||||
$askreseed_class = $AUTHORITY['askreseed'];
|
||||
$viewnfo_class = $AUTHORITY['viewnfo'];
|
||||
$torrentstructure_class = $AUTHORITY['torrentstructure'];
|
||||
@@ -382,9 +381,9 @@ $normalbecome_torrent = $TORRENT['normalbecome'];
|
||||
$uploaderdouble_torrent = $TORRENT['uploaderdouble'];
|
||||
$deldeadtorrent_torrent = $TORRENT['deldeadtorrent'];
|
||||
|
||||
foreach ($CONFIGURATIONS as $CONFIGURATION) {
|
||||
unset($GLOBALS[$CONFIGURATION]);
|
||||
}
|
||||
//foreach ($CONFIGURATIONS as $CONFIGURATION) {
|
||||
// unset($GLOBALS[$CONFIGURATION]);
|
||||
//}
|
||||
|
||||
//Directory for subs
|
||||
$SUBSPATH = "subs";
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
if(!defined('IN_TRACKER'))
|
||||
die('Hacking attempt!');
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
ini_set('display_errors', 0);
|
||||
include_once($rootpath . 'classes/class_cache.php'); //Require the caching class
|
||||
$Cache = NEW CACHE(); //Load the caching class
|
||||
ini_set('display_errors', $TWEAK['display_errors']);
|
||||
//include_once($rootpath . 'classes/class_cache.php'); //Require the caching class
|
||||
//$Cache = NEW CACHE(); //Load the caching class
|
||||
//@todo
|
||||
include_once($rootpath . 'classes/class_cache_redis.php'); //Require the caching class
|
||||
$Cache = new RedisCache(); //Load the caching class
|
||||
$Cache->setLanguageFolderArray(get_langfolder_list());
|
||||
define('TIMENOW', time());
|
||||
$USERUPDATESET = array();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
if(!defined('IN_TRACKER'))
|
||||
die('Hacking attempt!');
|
||||
include_once($rootpath . 'include/globalfunctions.php');
|
||||
include_once($rootpath . 'include/config.php');
|
||||
include_once($rootpath . 'classes/class_advertisement.php');
|
||||
require_once($rootpath . get_langfile_path("functions.php"));
|
||||
|
||||
@@ -1690,8 +1689,9 @@ function dbconn($autoclean = false)
|
||||
global $lang_functions;
|
||||
global $mysql_host, $mysql_user, $mysql_pass, $mysql_db;
|
||||
global $useCronTriggerCleanUp;
|
||||
global $BASIC;
|
||||
|
||||
if (!mysql_connect($mysql_host, $mysql_user, $mysql_pass))
|
||||
if (!mysql_connect($mysql_host, $mysql_user, $mysql_pass, $BASIC['mysql_db'], $BASIC['mysql_port']))
|
||||
{
|
||||
switch (mysql_errno())
|
||||
{
|
||||
@@ -4322,4 +4322,14 @@ function return_category_image($categoryid, $link="")
|
||||
}
|
||||
return $catimg;
|
||||
}
|
||||
|
||||
function dd($vars)
|
||||
{
|
||||
echo '<pre>';
|
||||
array_map(function ($var) {
|
||||
var_dump($var);
|
||||
}, func_get_args());
|
||||
echo '</pre>';
|
||||
exit(0);
|
||||
}
|
||||
?>
|
||||
|
||||
57
include/functions_db.php
Normal file
57
include/functions_db.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
function mysql_connect($host, $username, $password, $database, $port)
|
||||
{
|
||||
return DB::getInstance()->connect($host, $username, $password, $database, $port);
|
||||
}
|
||||
|
||||
function mysql_errno()
|
||||
{
|
||||
return DB::getInstance()->errno();
|
||||
}
|
||||
|
||||
function mysql_error()
|
||||
{
|
||||
return DB::getInstance()->error();
|
||||
}
|
||||
|
||||
function mysql_query(string $sql)
|
||||
{
|
||||
return DB::getInstance()->query($sql);
|
||||
}
|
||||
|
||||
function mysql_select_db($database)
|
||||
{
|
||||
return DB::getInstance()->select_db($database);
|
||||
}
|
||||
|
||||
function mysql_num_rows($result)
|
||||
{
|
||||
return DB::getInstance()->numRows($result);
|
||||
}
|
||||
|
||||
function mysql_fetch_array($result)
|
||||
{
|
||||
return DB::getInstance()->fetchAssoc($result);
|
||||
}
|
||||
|
||||
function mysql_fetch_assoc($result)
|
||||
{
|
||||
return DB::getInstance()->fetchAssoc($result);
|
||||
}
|
||||
|
||||
function mysql_fetch_row($result)
|
||||
{
|
||||
return DB::getInstance()->fetchRow($result);
|
||||
}
|
||||
|
||||
function mysql_affected_rows()
|
||||
{
|
||||
return DB::getInstance()->affectedRows();
|
||||
}
|
||||
|
||||
function mysql_real_escape_string($string)
|
||||
{
|
||||
return DB::getInstance()->escapeString($string);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user