define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php');
$HTTPS = ($_SERVER['SERVER_PORT'] == 443) ? 'ssl_' : '';
$UseTooltipster = !isset(G::$LoggedUser['Tooltipster']) || G::$LoggedUser['Tooltipster'];
?>
=SITE_NAME?>
//Start handling alert bars
$Alerts = array();
$ModBar = array();
// Staff blog
if (check_perms('users_mod')) {
global $SBlogReadTime, $LatestSBlogTime;
if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
G::$DB->query("
SELECT Time
FROM staff_blog_visits
WHERE UserID = ".G::$LoggedUser['ID']);
if (list($SBlogReadTime) = G::$DB->next_record()) {
$SBlogReadTime = strtotime($SBlogReadTime);
} else {
$SBlogReadTime = 0;
}
G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
}
if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
G::$DB->query("
SELECT MAX(Time)
FROM staff_blog");
list($LatestSBlogTime) = G::$DB->next_record();
if ($LatestSBlogTime) {
$LatestSBlogTime = strtotime($LatestSBlogTime);
} else {
$LatestSBlogTime = 0;
}
G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
}
if ($SBlogReadTime < $LatestSBlogTime) {
$Alerts[] = '
New staff blog post!';
}
}
// Inbox
if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
$NotificationsManager->load_inbox();
$NewMessages = $NotificationsManager->get_notifications();
if (isset($NewMessages[NotificationsManager::INBOX])) {
$Alerts[] = NotificationsManagerView::format_traditional($NewMessages[NotificationsManager::INBOX]);
}
$NotificationsManager->clear_notifications_array();
}
if (G::$LoggedUser['RatioWatch']) {
$Alerts[] = '
Ratio Watch: You have '.time_diff(G::$LoggedUser['RatioWatchEnds'], 3).' to get your ratio over your required ratio or your leeching abilities will be disabled.';
} elseif (G::$LoggedUser['CanLeech'] != 1) {
$Alerts[] = '
Ratio Watch: Your downloading privileges are disabled until you meet your required ratio.';
}
// Torrents
if ($NotificationsManager->is_traditional(NotificationsManager::TORRENTS)) {
$NotificationsManager->load_torrent_notifications();
$NewTorrents = $NotificationsManager->get_notifications();
if (isset($NewTorrents[NotificationsManager::TORRENTS])) {
$Alerts[] = NotificationsManagerView::format_traditional($NewTorrents[NotificationsManager::TORRENTS]);
}
$NotificationsManager->clear_notifications_array();
}
if (check_perms('users_mod')) {
$ModBar[] = '
Toolbox';
}
if (check_perms('users_mod')) {
$NumStaffPMs = G::$Cache->get_value('num_staff_pms_'.G::$LoggedUser['ID']);
if ($NumStaffPMs === false) {
if (check_perms('users_mod')) {
$LevelCap = 1000;
G::$DB->query("
SELECT COUNT(ID)
FROM staff_pm_conversations
WHERE Status = 'Unanswered'
AND (AssignedToUser = ".G::$LoggedUser['ID']."
OR (LEAST('$LevelCap', Level) <= '".G::$LoggedUser['EffectiveClass']."'
AND Level <= ".G::$LoggedUser['Class']."))");
}
if (G::$LoggedUser['PermissionID'] == FORUM_MOD) {
G::$DB->query("
SELECT COUNT(ID)
FROM staff_pm_conversations
WHERE Status='Unanswered'
AND (AssignedToUser = ".G::$LoggedUser['ID']."
OR Level = '". $Classes[FORUM_MOD]['Level'] . "')");
}
list($NumStaffPMs) = G::$DB->next_record();
G::$Cache->cache_value('num_staff_pms_'.G::$LoggedUser['ID'], $NumStaffPMs , 1000);
}
if ($NumStaffPMs > 0) {
$ModBar[] = '
'.$NumStaffPMs.' Staff PMs';
}
}
if (check_perms('admin_reports')) {
// Torrent reports code
$NumTorrentReports = G::$Cache->get_value('num_torrent_reportsv2');
if ($NumTorrentReports === false) {
G::$DB->query("
SELECT COUNT(ID)
FROM reportsv2
WHERE Status = 'New'");
list($NumTorrentReports) = G::$DB->next_record();
G::$Cache->cache_value('num_torrent_reportsv2', $NumTorrentReports, 0);
}
$ModBar[] = '
'.$NumTorrentReports.(($NumTorrentReports == 1) ? ' Report' : ' Reports').'';
// Other reports code
$NumOtherReports = G::$Cache->get_value('num_other_reports');
if ($NumOtherReports === false) {
G::$DB->query("
SELECT COUNT(ID)
FROM reports
WHERE Status = 'New'");
list($NumOtherReports) = G::$DB->next_record();
G::$Cache->cache_value('num_other_reports', $NumOtherReports, 0);
}
if ($NumOtherReports > 0) {
$ModBar[] = '
'.$NumOtherReports.(($NumTorrentReports == 1) ? ' Other report' : ' Other reports').'';
}
} elseif (check_perms('project_team')) {
$NumUpdateReports = G::$Cache->get_value('num_update_reports');
if ($NumUpdateReports === false) {
G::$DB->query("
SELECT COUNT(ID)
FROM reports
WHERE Status = 'New'
AND Type = 'request_update'");
list($NumUpdateReports) = G::$DB->next_record();
G::$Cache->cache_value('num_update_reports', $NumUpdateReports, 0);
}
if ($NumUpdateReports > 0) {
$ModBar[] = '
Request update reports';
}
} elseif (check_perms('site_moderate_forums')) {
$NumForumReports = G::$Cache->get_value('num_forum_reports');
if ($NumForumReports === false) {
G::$DB->query("
SELECT COUNT(ID)
FROM reports
WHERE Status = 'New'
AND Type IN('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment')");
list($NumForumReports) = G::$DB->next_record();
G::$Cache->cache_value('num_forum_reports', $NumForumReports, 0);
}
if ($NumForumReports > 0) {
$ModBar[] = '
'.$NumForumReports.(($NumForumReports == 1) ? ' Forum report' : ' Forum reports').'';
}
}
if (check_perms('users_mod')) {
$NumEmailDeleteRequests = G::$Cache->get_value('num_email_delete_requests');
if ($NumEmailDeleteRequests === false) {
G::$DB->query("SELECT COUNT(*) FROM email_delete_requests");
list($NumEmailDeleteRequests) = G::$DB->next_record();
G::$Cache->cache_value('num_email_delete_request', $NumEmailDeleteRequests);
}
if ($NumEmailDeleteRequests > 0) {
$ModBar[] = '
' . $NumEmailDeleteRequests . " Email deletion request(s)";
}
}
if (check_perms('users_mod') && FEATURE_EMAIL_REENABLE) {
$NumEnableRequests = G::$Cache->get_value(AutoEnable::CACHE_KEY_NAME);
if ($NumEnableRequests === false) {
G::$DB->query("SELECT COUNT(1) FROM users_enable_requests WHERE Outcome IS NULL");
list($NumEnableRequests) = G::$DB->next_record();
G::$Cache->cache_value(AutoEnable::CACHE_KEY_NAME, $NumEnableRequests);
}
if ($NumEnableRequests > 0) {
$ModBar[] = '
' . $NumEnableRequests . " Enable requests";
}
}
if (!empty($Alerts) || !empty($ModBar)) { ?>
foreach ($Alerts as $Alert) { ?>
=$Alert?>
}
if (!empty($ModBar)) { ?>
=implode(' | ', $ModBar); echo "\n"?>
}
if (check_perms('site_debug') && !apc_exists('DBKEY')) { ?>
} ?>
}
//Done handling alertbars
?>