mirror of
https://github.com/WhatCD/Gazelle.git
synced 2025-01-18 12:11:36 +00:00
Empty commit
This commit is contained in:
parent
d16aef7dbf
commit
9251320939
@ -120,9 +120,9 @@ function check_perms($PermissionName, $MinClass = 0) {
|
||||
*/
|
||||
|
||||
function json_die($Status, $Message) {
|
||||
if ($Status == "success" && $Message) {
|
||||
if ($Status == 'success' && $Message) {
|
||||
print json_encode(array('status' => $Status, 'response' => $Message));
|
||||
} else if ($Message) {
|
||||
} elseif ($Message) {
|
||||
print json_encode(array('status' => $Status, 'error' => $Message));
|
||||
} else {
|
||||
print json_encode(array('status' => $Status));
|
||||
|
@ -24,18 +24,11 @@
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
// Enforce rate limiting everywhere except info.php
|
||||
if (!in_array($UserID, $UserExceptions) && isset($_GET['action']) && in_array($_GET['action'], $LimitedPages)) {
|
||||
if (!$userrequests = $Cache->get_value('ajax_requests_'.$UserID)) {
|
||||
$userrequests = 0;
|
||||
if (!$UserRequests = $Cache->get_value('ajax_requests_'.$UserID)) {
|
||||
$UserRequests = 0;
|
||||
$Cache->cache_value('ajax_requests_'.$UserID, '0', $AJAX_LIMIT[1]);
|
||||
}
|
||||
if ($userrequests > $AJAX_LIMIT[0]) {
|
||||
print json_encode(
|
||||
array(
|
||||
'status' => 'failure',
|
||||
'response' => 'Rate limit exceeded.'
|
||||
)
|
||||
);
|
||||
|
||||
if ($UserRequests > $AJAX_LIMIT[0]) {
|
||||
json_die("failure", "rate limit exceeded");
|
||||
} else {
|
||||
$Cache->increment_value('ajax_requests_'.$UserID);
|
||||
|
Loading…
Reference in New Issue
Block a user