Example #1
0
 $LoggedUser['RatioWatch'] = $LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00' && time() < strtotime($LoggedUser['RatioWatchEnds']) && $LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio'] > $LoggedUser['BytesUploaded'];
 // Load in the permissions
 $LoggedUser['Permissions'] = Permissions::get_permissions_for_user($LoggedUser['ID'], $LoggedUser['CustomPermissions']);
 $LoggedUser['Permissions']['MaxCollages'] += Donations::get_personal_collages($LoggedUser['ID']);
 // Change necessary triggers in external components
 $Cache->CanClear = check_perms('admin_clear_cache');
 // Because we <3 our staff
 if (check_perms('site_disable_ip_history')) {
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
 }
 // Update LastUpdate every 10 minutes
 if (strtotime($UserSessions[$SessionID]['LastUpdate']) + 600 < time()) {
     $DB->query("\n\t\t\tUPDATE users_main\n\t\t\tSET LastAccess = '" . sqltime() . "'\n\t\t\tWHERE ID = '{$LoggedUser['ID']}'");
     $DB->query("\n\t\t\tUPDATE users_sessions\n\t\t\tSET\n\t\t\t\tIP = '" . $_SERVER['REMOTE_ADDR'] . "',\n\t\t\t\tBrowser = '{$Browser}',\n\t\t\t\tOperatingSystem = '{$OperatingSystem}',\n\t\t\t\tLastUpdate = '" . sqltime() . "'\n\t\t\tWHERE UserID = '{$LoggedUser['ID']}'\n\t\t\t\tAND SessionID = '" . db_string($SessionID) . "'");
     $Cache->begin_transaction("users_sessions_{$UserID}");
     $Cache->delete_row($SessionID);
     $Cache->insert_front($SessionID, array('SessionID' => $SessionID, 'Browser' => $Browser, 'OperatingSystem' => $OperatingSystem, 'IP' => $_SERVER['REMOTE_ADDR'], 'LastUpdate' => sqltime()));
     $Cache->commit_transaction(0);
 }
 // Notifications
 if (isset($LoggedUser['Permissions']['site_torrents_notify'])) {
     $LoggedUser['Notify'] = $Cache->get_value('notify_filters_' . $LoggedUser['ID']);
     if (!is_array($LoggedUser['Notify'])) {
         $DB->query("\n\t\t\t\tSELECT ID, Label\n\t\t\t\tFROM users_notify_filters\n\t\t\t\tWHERE UserID = '{$LoggedUser['ID']}'");
         $LoggedUser['Notify'] = $DB->to_array('ID');
         $Cache->cache_value('notify_filters_' . $LoggedUser['ID'], $LoggedUser['Notify'], 2592000);
     }
 }
 // We've never had to disable the wiki privs of anyone.
 if ($LoggedUser['DisableWiki']) {
     unset($LoggedUser['Permissions']['site_edit_wiki']);