Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace $_SESSION['aid'] with CUserManager->GetAid() #561

Merged
merged 3 commits into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/configs/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.7.0",
"git": "808",
"git": "931",
"dev": true
}
7 changes: 4 additions & 3 deletions web/includes/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
class Log
{
private static $dbs = null;
public static function init(\Database $dbs)
private static $user = null;
public static function init(\Database $dbs, \CUserManager $user)
{
self::$dbs = $dbs;
self::$user = $user;
}

public static function add($type, $title, $message)
{
$aid = filter_var($_SESSION['aid'], FILTER_VALIDATE_INT) ? $_SESSION['aid'] : -1;
$host = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP) ? $_SERVER['REMOTE_ADDR'] : '';

self::$dbs->query(
Expand All @@ -22,7 +23,7 @@ public static function add($type, $title, $message)
self::$dbs->bind(':message', filter_var($message, FILTER_SANITIZE_STRING));
self::$dbs->bind(':function', filter_var(self::getCaller(), FILTER_SANITIZE_STRING));
self::$dbs->bind(':query', filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING));
self::$dbs->bind(':aid', $aid);
self::$dbs->bind(':aid', self::$user->GetAid());
self::$dbs->bind(':host', $host);
self::$dbs->execute();
}
Expand Down
5 changes: 2 additions & 3 deletions web/includes/sb-callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -2549,8 +2549,7 @@ function RefreshServer($sid)
$sid = (int)$sid;
session_start();
$data = $GLOBALS['db']->GetRow("SELECT ip, port FROM `".DB_PREFIX."_servers` WHERE sid = ?;", array($sid));
if (isset($_SESSION['getInfo.' . $data['ip'] . '.' . $data['port']]) && is_array($_SESSION['getInfo.' . $data['ip'] . '.' . $data['port']]))
unset($_SESSION['getInfo.' . $data['ip'] . '.' . $data['port']]);

$objResponse->addScript("xajax_ServerHostPlayers('".$sid."');");
return $objResponse;
}
Expand Down Expand Up @@ -2877,7 +2876,7 @@ function BanFriends($friendid, $name)
':authid' => $steam,
':name' => filter_var($fname, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES),
':reason' => "Steam Community Friend Ban (".$name.")",
':aid' => $_SESSION['aid'],
':aid' => $userbank->GetAid(),
':admip' => $_SERVER['REMOTE_ADDR']
]);
if (!$GLOBALS['PDO']->execute()) {
Expand Down
18 changes: 9 additions & 9 deletions web/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,20 @@
require_once(INCLUDES_PATH.'/SteamID/bootstrap.php');
\SteamID\SteamID::init($GLOBALS['PDO']);

require_once(INCLUDES_PATH.'/Log.php');
Log::init($GLOBALS['PDO']);

require_once(INCLUDES_PATH.'/Config.php');
Config::init($GLOBALS['PDO']);

Auth::init($GLOBALS['PDO']);

// ---------------------------------------------------
// Setup our user manager
// ---------------------------------------------------

$userbank = new CUserManager(Auth::verify());

require_once(INCLUDES_PATH.'/Log.php');
Log::init($GLOBALS['PDO'], $userbank);

// ---------------------------------------------------
// Setup our custom error handler
// ---------------------------------------------------
Expand Down Expand Up @@ -226,9 +232,3 @@ function sbError($errno, $errstr, $errfile, $errline)
'cache' => SB_CACHE,
'loader' => new Mustache_Loader_FilesystemLoader(SB_THEMES.$theme_name)
]));

// ---------------------------------------------------
// Setup our user manager
// ---------------------------------------------------

$userbank = new CUserManager(Auth::verify());
4 changes: 2 additions & 2 deletions web/pages/admin.bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
);
$GLOBALS['PDO']->bindMultiple([
':ip' => $line[2],
':aid' => $_SESSION['aid'],
':aid' => $userbank->GetAid(),
':admip' => $_SERVER['REMOTE_ADDR']
]);
$GLOBALS['PDO']->execute();
Expand All @@ -96,7 +96,7 @@
$GLOBALS['PDO']->bindMultiple([
':authid' => $steam,
':name' => $name,
':aid' => $_SESSION['aid'],
':aid' => $userbank->GetAid(),
':ip' => $_SERVER['REMOTE_ADDR']
]);
$GLOBALS['PDO']->execute();
Expand Down
3 changes: 0 additions & 3 deletions web/pages/page.servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
$servers = array();
$i = 0;
while (!$res->EOF) {
if (isset($_SESSION['getInfo.' . $res->fields[1] . '.' . $res->fields[2]])) {
$_SESSION['getInfo.' . $res->fields[1] . '.' . $res->fields[2]] = "";
}
$info = array();
$info['sid'] = $res->fields[0];
$info['ip'] = $res->fields[1];
Expand Down