summaryrefslogtreecommitdiffstats
path: root/inc/session.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-02 18:49:09 +0200
committerSimon Rettberg2022-05-02 18:49:09 +0200
commit5eb8df7432a708284862e4b126e418265d36b4ab (patch)
treed8812cc2bd6245e0b02ca6866a4c14e977e1bb62 /inc/session.inc.php
parent[rebootcontrol] Show time of execution for WOL/reboot/shutdown (diff)
downloadslx-admin-5eb8df7432a708284862e4b126e418265d36b4ab.tar.gz
slx-admin-5eb8df7432a708284862e4b126e418265d36b4ab.tar.xz
slx-admin-5eb8df7432a708284862e4b126e418265d36b4ab.zip
[inc/Util] Add types, move error printing functions to their own class
Diffstat (limited to 'inc/session.inc.php')
-rw-r--r--inc/session.inc.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/inc/session.inc.php b/inc/session.inc.php
index fc875669..3afbc4ce 100644
--- a/inc/session.inc.php
+++ b/inc/session.inc.php
@@ -13,7 +13,7 @@ class Session
private static function generateSessionId(string $salt)
{
if (self::$sid !== false)
- Util::traceError('Error: Asked to generate session id when already set.');
+ ErrorHandler::traceError('Error: Asked to generate session id when already set.');
self::$sid = sha1($salt . ','
. mt_rand(0, 65535)
. $_SERVER['REMOTE_ADDR']
@@ -74,7 +74,7 @@ class Session
public static function set(string $key, $value, $validMinutes = 60)
{
if (self::$data === false)
- Util::traceError('Tried to set session data with no active session');
+ ErrorHandler::traceError('Tried to set session data with no active session');
if ($value === false) {
unset(self::$data[$key]);
} else {
@@ -86,7 +86,7 @@ class Session
private static function loadSessionId(): bool
{
if (self::$sid !== false)
- Util::traceError('Error: Asked to load session id when already set.');
+ ErrorHandler::traceError('Error: Asked to load session id when already set.');
if (empty($_COOKIE['sid']))
return false;
$id = preg_replace('/[^a-zA-Z0-9]/', '', $_COOKIE['sid']);
@@ -115,7 +115,7 @@ class Session
private static function readSessionData(): bool
{
if (self::$data !== false)
- Util::traceError('Tried to call read session data twice');
+ ErrorHandler::traceError('Tried to call read session data twice');
$row = Database::queryFirst("SELECT userid, dateline, lastip, fixedip, data FROM session WHERE sid = :sid",
['sid' => self::$sid]);
$now = time();
@@ -149,7 +149,7 @@ class Session
$ret = setcookie('sid', self::$sid, time() + CONFIG_SESSION_TIMEOUT,
null, null, !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off', true);
if (!$ret)
- Util::traceError('Error: Could not set Cookie for Client (headers already sent)');
+ ErrorHandler::traceError('Error: Could not set Cookie for Client (headers already sent)');
}
register_shutdown_function(function () {
Session::saveInternal();