diff options
author | Git <git@what.cd> | 2013-06-06 08:01:03 +0000 |
---|---|---|
committer | Git <git@what.cd> | 2013-06-06 08:01:03 +0000 |
commit | ac26edc0caefdfc7f1054b64f4c6cb89dfe8e4f6 (patch) | |
tree | 8b546165e2efe87a32c98eaad15a0331fb4036ac /classes/script_start.php | |
parent | 8016cb4277f99450370252aed66dc00c23b0836d (diff) | |
download | Gazelle-ac26edc0caefdfc7f1054b64f4c6cb89dfe8e4f6.zip Gazelle-ac26edc0caefdfc7f1054b64f4c6cb89dfe8e4f6.tar.gz Gazelle-ac26edc0caefdfc7f1054b64f4c6cb89dfe8e4f6.tar.bz2 |
Empty commit
Diffstat (limited to 'classes/script_start.php')
-rw-r--r-- | classes/script_start.php | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/classes/script_start.php b/classes/script_start.php index c5496bc..e80e653 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -216,12 +216,14 @@ list($Classes, $ClassLevels) = Users::get_classes(); // Enabled - if the user's enabled or not // Permissions -if (isset($_COOKIE['session'])) { $LoginCookie=$Enc->decrypt($_COOKIE['session']); } +if (isset($_COOKIE['session'])) { + $LoginCookie = $Enc->decrypt($_COOKIE['session']); +} if (isset($LoginCookie)) { - list($SessionID, $LoggedUser['ID'])=explode("|~|",$Enc->decrypt($LoginCookie)); + list($SessionID, $LoggedUser['ID']) = explode("|~|", $Enc->decrypt($LoginCookie)); $LoggedUser['ID'] = (int)$LoggedUser['ID']; - $UserID=$LoggedUser['ID']; //TODO: UserID should not be LoggedUser + $UserID = $LoggedUser['ID']; //TODO: UserID should not be LoggedUser if (!$LoggedUser['ID'] || !$SessionID) { logout(); @@ -244,14 +246,17 @@ if (isset($LoginCookie)) { $Cache->cache_value('users_sessions_'.$UserID, $UserSessions, 0); } - if (!array_key_exists($SessionID,$UserSessions)) { + if (!array_key_exists($SessionID, $UserSessions)) { logout(); } // Check if user is enabled $Enabled = $Cache->get_value('enabled_'.$LoggedUser['ID']); if ($Enabled === false) { - $DB->query("SELECT Enabled FROM users_main WHERE ID='$LoggedUser[ID]'"); + $DB->query(" + SELECT Enabled + FROM users_main + WHERE ID='$LoggedUser[ID]'"); list($Enabled) = $DB->next_record(); $Cache->cache_value('enabled_'.$LoggedUser['ID'], $Enabled, 0); } @@ -336,7 +341,10 @@ if (isset($LoginCookie)) { if (isset($LoggedUser['Permissions']['site_torrents_notify'])) { $LoggedUser['Notify'] = $Cache->get_value('notify_filters_'.$LoggedUser['ID']); if (!is_array($LoggedUser['Notify'])) { - $DB->query("SELECT ID, Label FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'"); + $DB->query(" + SELECT ID, Label + FROM users_notify_filters + WHERE UserID='$LoggedUser[ID]'"); $LoggedUser['Notify'] = $DB->to_array('ID'); $Cache->cache_value('notify_filters_'.$LoggedUser['ID'], $LoggedUser['Notify'], 2592000); } @@ -371,7 +379,10 @@ if (isset($LoginCookie)) { ('$LoggedUser[ID]', '$NewIP', '".sqltime()."')"); $ipcc = Tools::geoip($NewIP); - $DB->query("UPDATE users_main SET IP='$NewIP', ipcc='".$ipcc."' WHERE ID='$LoggedUser[ID]'"); + $DB->query(" + UPDATE users_main + SET IP='$NewIP', ipcc='$ipcc' + WHERE ID='$LoggedUser[ID]'"); $Cache->begin_transaction('user_info_heavy_'.$LoggedUser['ID']); $Cache->update_row(false, array('IP' => $_SERVER['REMOTE_ADDR'])); $Cache->commit_transaction(0); @@ -383,7 +394,12 @@ if (isset($LoginCookie)) { // Get stylesheets $Stylesheets = $Cache->get_value('stylesheets'); if (!is_array($Stylesheets)) { - $DB->query('SELECT ID, LOWER(REPLACE(Name," ","_")) AS Name, Name AS ProperName FROM stylesheets'); + $DB->query(' + SELECT + ID, + LOWER(REPLACE(Name," ","_")) AS Name, + Name AS ProperName + FROM stylesheets'); $Stylesheets = $DB->to_array('ID', MYSQLI_BOTH); $Cache->cache_value('stylesheets', $Stylesheets, 600); } @@ -396,12 +412,10 @@ if (isset($LoginCookie)) { } } - $Debug->set_flag('end user handling'); $Debug->set_flag('start function definitions'); - /** * Log out the current session */ @@ -413,7 +427,10 @@ function logout() { if ($SessionID) { - $DB->query("DELETE FROM users_sessions WHERE UserID='$LoggedUser[ID]' AND SessionID='".db_string($SessionID)."'"); + $DB->query(" + DELETE FROM users_sessions + WHERE UserID='$LoggedUser[ID]' + AND SessionID='".db_string($SessionID)."'"); $Cache->begin_transaction('users_sessions_'.$LoggedUser['ID']); $Cache->delete_row($SessionID); @@ -453,8 +470,6 @@ function authorize($Ajax = false) { return true; } - - $Debug->set_flag('ending function definitions'); //Include /sections/*/index.php $Document = basename(parse_url($_SERVER['SCRIPT_FILENAME'], PHP_URL_PATH), '.php'); |