@@ 23-30 (lines=8) @@ | ||
20 | if (is_array($request_data)) { |
|
21 | // this request key already exists, update it |
|
22 | $request_data['la'] = $now; |
|
23 | if ($request == 'api') { |
|
24 | $request_data['ha'] += 1; |
|
25 | if ($config['mc_antidos']['ajax_hits_additive']) { |
|
26 | $request_data['hn'] += 1; |
|
27 | } |
|
28 | } else { |
|
29 | $request_data['hn'] += 1; |
|
30 | } |
|
31 | // not rate limited yet, update the rest of the object |
|
32 | if (($request_data['hn'] < $config['mc_antidos']['rate_limit_site']) && ($request_data['ha'] < $config['mc_antidos']['rate_limit_api'])) { |
|
33 | if (((($request_data['hnl'] + $config['mc_antidos']['flush_seconds_site']) <= $now) || ($request_data['hal'] + $config['mc_antidos']['flush_seconds_api']) <= $now) || (($request_data['la'] + $max_req_flush) <= $now)) { |
|
@@ 66-73 (lines=8) @@ | ||
63 | $new = $this->getRequestBase(); |
|
64 | $new['key'] = $config['memcache']['keyprefix'].md5($userORip); |
|
65 | $new['la'] = time(); |
|
66 | if ($request == 'api') { |
|
67 | $new['ha'] += 1; |
|
68 | if ($config['mc_antidos']['ajax_hits_additive']) { |
|
69 | $new['hn'] += 1; |
|
70 | } |
|
71 | } else { |
|
72 | $new['hn'] += 1; |
|
73 | } |
|
74 | $this->cache->set($key_md5, $new, $config['memcache']['expiration']); |
|
75 | $this->rate_limit_api_request = false; |
|
76 | $this->rate_limit_site_request = false; |