示例#1
0
        		} */
        $Cache->cache_value('notifications_new_' . $LoggedUser['ID'], $NewNotifications, 0);
    }
}
// News
$MyNews = $LoggedUser['LastReadNews'];
$CurrentNews = $Cache->get_value('news_latest_id');
if ($CurrentNews === false) {
    $DB->query("\n\t\tSELECT ID\n\t\tFROM news\n\t\tORDER BY Time DESC\n\t\tLIMIT 1");
    if ($DB->record_count() === 1) {
        list($CurrentNews) = $DB->next_record();
    } else {
        $CurrentNews = -1;
    }
    $Cache->cache_value('news_latest_id', $CurrentNews, 0);
}
// Blog
$MyBlog = $LoggedUser['LastReadBlog'];
$CurrentBlog = $Cache->get_value('blog_latest_id');
if ($CurrentBlog === false) {
    $DB->query("\n\t\tSELECT ID\n\t\tFROM blog\n\t\tWHERE Important = 1\n\t\tORDER BY Time DESC\n\t\tLIMIT 1");
    if ($DB->record_count() === 1) {
        list($CurrentBlog) = $DB->next_record();
    } else {
        $CurrentBlog = -1;
    }
    $Cache->cache_value('blog_latest_id', $CurrentBlog, 0);
}
// Subscriptions
$NewSubscriptions = Subscriptions::has_new_subscriptions();
json_die("success", array('username' => $LoggedUser['Username'], 'id' => (int) $LoggedUser['ID'], 'authkey' => $LoggedUser['AuthKey'], 'passkey' => $LoggedUser['torrent_pass'], 'notifications' => array('messages' => (int) $NewMessages, 'notifications' => (int) $NewNotifications, 'newAnnouncement' => $MyNews < $CurrentNews, 'newBlog' => $MyBlog < $CurrentBlog, 'newSubscriptions' => $NewSubscriptions == 1), 'userstats' => array('uploaded' => (int) $LoggedUser['BytesUploaded'], 'downloaded' => (int) $LoggedUser['BytesDownloaded'], 'ratio' => (double) $Ratio, 'requiredratio' => (double) $LoggedUser['RequiredRatio'], 'class' => $ClassLevels[$LoggedUser['Class']]['Name'])));
 public function load_subscriptions()
 {
     $SubscriptionsCount = Subscriptions::has_new_subscriptions();
     if ($SubscriptionsCount > 0) {
         $Title = 'New subscription' . ($SubscriptionsCount > 1 ? 's' : '');
         $this->create_notification(self::SUBSCRIPTIONS, 0, $Title, 'userhistory.php?action=subscriptions', self::INFO);
     }
 }