From 9251320939614794e494ba86199aa04b4e6952e1 Mon Sep 17 00:00:00 2001 From: Git Date: Wed, 14 Aug 2013 08:00:46 +0000 Subject: [PATCH] Empty commit --- classes/util.php | 4 ++-- sections/ajax/index.php | 13 +++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/classes/util.php b/classes/util.php index a9f1e1d7..f9ff7d3a 100644 --- a/classes/util.php +++ b/classes/util.php @@ -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)); diff --git a/sections/ajax/index.php b/sections/ajax/index.php index dcac83e3..67f6dc74 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -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);