mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 10:56:26 +00:00
Empty commit
This commit is contained in:
parent
cc54d82c5d
commit
42206f96ce
@ -3,12 +3,12 @@
|
|||||||
//calculate ratio
|
//calculate ratio
|
||||||
//returns 0 for DNE and -1 for infiinity, because we dont want strings being returned for a numeric value in our java
|
//returns 0 for DNE and -1 for infiinity, because we dont want strings being returned for a numeric value in our java
|
||||||
$Ratio = 0;
|
$Ratio = 0;
|
||||||
if($LoggedUser['BytesUploaded'] == 0 && $LoggedUser['BytesDownloaded'] == 0) {
|
if ($LoggedUser['BytesUploaded'] == 0 && $LoggedUser['BytesDownloaded'] == 0) {
|
||||||
$Ratio = 0;
|
$Ratio = 0;
|
||||||
} elseif($LoggedUser['BytesDownloaded'] == 0) {
|
} elseif ($LoggedUser['BytesDownloaded'] == 0) {
|
||||||
$Ratio = -1;
|
$Ratio = -1;
|
||||||
} else {
|
} else {
|
||||||
$Ratio = number_format(max($LoggedUser['BytesUploaded']/$LoggedUser['BytesDownloaded']-0.005,0), 2); //Subtract .005 to floor to 2 decimals
|
$Ratio = number_format(max($LoggedUser['BytesUploaded'] / $LoggedUser['BytesDownloaded'] - 0.005, 0), 2); //Subtract .005 to floor to 2 decimals
|
||||||
}
|
}
|
||||||
|
|
||||||
$MyNews = $LoggedUser['LastReadNews'];
|
$MyNews = $LoggedUser['LastReadNews'];
|
||||||
@ -24,15 +24,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$NewMessages = $Cache->get_value('inbox_new_'.$LoggedUser['ID']);
|
$NewMessages = $Cache->get_value('inbox_new_' . $LoggedUser['ID']);
|
||||||
if ($NewMessages === false) {
|
if ($NewMessages === false) {
|
||||||
$DB->query("SELECT COUNT(UnRead) FROM pm_conversations_users WHERE UserID='".$LoggedUser['ID']."' AND UnRead = '1' AND InInbox = '1'");
|
$DB->query("SELECT COUNT(UnRead) FROM pm_conversations_users WHERE UserID='" . $LoggedUser['ID'] . "' AND UnRead = '1' AND InInbox = '1'");
|
||||||
list($NewMessages) = $DB->next_record();
|
list($NewMessages) = $DB->next_record();
|
||||||
$Cache->cache_value('inbox_new_'.$LoggedUser['ID'], $NewMessages, 0);
|
$Cache->cache_value('inbox_new_' . $LoggedUser['ID'], $NewMessages, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_perms('site_torrents_notify')) {
|
if (check_perms('site_torrents_notify')) {
|
||||||
$NewNotifications = $Cache->get_value('notifications_new_'.$LoggedUser['ID']);
|
$NewNotifications = $Cache->get_value('notifications_new_' . $LoggedUser['ID']);
|
||||||
if ($NewNotifications === false) {
|
if ($NewNotifications === false) {
|
||||||
$DB->query("SELECT COUNT(UserID) FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='1'");
|
$DB->query("SELECT COUNT(UserID) FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='1'");
|
||||||
list($NewNotifications) = $DB->next_record();
|
list($NewNotifications) = $DB->next_record();
|
||||||
@ -40,7 +40,7 @@
|
|||||||
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'");
|
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'");
|
||||||
$DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'");
|
$DB->query("DELETE FROM users_notify_filters WHERE UserID='$LoggedUser[ID]'");
|
||||||
} */
|
} */
|
||||||
$Cache->cache_value('notifications_new_'.$LoggedUser['ID'], $NewNotifications, 0);
|
$Cache->cache_value('notifications_new_' . $LoggedUser['ID'], $NewNotifications, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,25 +70,48 @@
|
|||||||
$Cache->cache_value('blog_latest_id', $CurrentBlog, 0);
|
$Cache->cache_value('blog_latest_id', $CurrentBlog, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subscriptions
|
||||||
|
$NewSubscriptions = $Cache->get_value('subscriptions_user_new_' . $LoggedUser['ID']);
|
||||||
|
if ($NewSubscriptions === FALSE) {
|
||||||
|
if ($LoggedUser['CustomForums']) {
|
||||||
|
unset($LoggedUser['CustomForums']['']);
|
||||||
|
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
|
||||||
|
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
|
||||||
|
}
|
||||||
|
$DB->query("SELECT COUNT(s.TopicID)
|
||||||
|
FROM users_subscriptions AS s
|
||||||
|
JOIN forums_last_read_topics AS l ON s.UserID = l.UserID AND s.TopicID = l.TopicID
|
||||||
|
JOIN forums_topics AS t ON l.TopicID = t.ID
|
||||||
|
JOIN forums AS f ON t.ForumID = f.ID
|
||||||
|
WHERE (f.MinClassRead <= " . $LoggedUser['Class'] . " OR f.ID IN ('$PermittedForums'))
|
||||||
|
AND l.PostID < t.LastPostID
|
||||||
|
AND s.UserID = " . $LoggedUser['ID'] .
|
||||||
|
(!empty($RestrictedForums) ? "
|
||||||
|
AND f.ID NOT IN ('" . $RestrictedForums . "')" : ""));
|
||||||
|
list($NewSubscriptions) = $DB->next_record();
|
||||||
|
$Cache->cache_value('subscriptions_user_new_' . $LoggedUser['ID'], $NewSubscriptions, 0);
|
||||||
|
}
|
||||||
|
|
||||||
print json_encode(
|
print json_encode(
|
||||||
array(
|
array(
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'response' => array(
|
'response' => array(
|
||||||
'username' => $LoggedUser['Username'],
|
'username' => $LoggedUser['Username'],
|
||||||
'id' => (int) $LoggedUser['ID'],
|
'id' => (int)$LoggedUser['ID'],
|
||||||
'authkey'=> $LoggedUser['AuthKey'],
|
'authkey' => $LoggedUser['AuthKey'],
|
||||||
'passkey'=> $LoggedUser['torrent_pass'],
|
'passkey' => $LoggedUser['torrent_pass'],
|
||||||
'notifications' => array(
|
'notifications' => array(
|
||||||
'messages'=> (int) $NewMessages,
|
'messages' => (int) $NewMessages,
|
||||||
'notifications' => (int) $NewNotifications,
|
'notifications' => (int) $NewNotifications,
|
||||||
'newAnnouncement' => $MyNews < $CurrentNews,
|
'newAnnouncement' => $MyNews < $CurrentNews,
|
||||||
'newBlog' => $MyBlog < $CurrentBlog
|
'newBlog' => $MyBlog < $CurrentBlog,
|
||||||
|
'newSubscriptions' => $NewSubscriptions == 1
|
||||||
),
|
),
|
||||||
'userstats' => array(
|
'userstats' => array(
|
||||||
'uploaded' => (int) $LoggedUser['BytesUploaded'],
|
'uploaded' => (int)$LoggedUser['BytesUploaded'],
|
||||||
'downloaded' => (int) $LoggedUser['BytesDownloaded'],
|
'downloaded' => (int)$LoggedUser['BytesDownloaded'],
|
||||||
'ratio' => (float) $Ratio,
|
'ratio' => (float)$Ratio,
|
||||||
'requiredratio' => (float) $LoggedUser['RequiredRatio'],
|
'requiredratio' => (float)$LoggedUser['RequiredRatio'],
|
||||||
'class' => $ClassLevels[$LoggedUser['Class']]['Name']
|
'class' => $ClassLevels[$LoggedUser['Class']]['Name']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user