Skip to content

Commit 9a1cfd8

Browse files
author
Phil Sturgeon
committed
Merge pull request chriskacerguis#62 from onema/master
Limit bug, no log with bad API key and changed serialize to serialized.
2 parents 6fce106 + bc9df8e commit 9a1cfd8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

application/libraries/REST_Controller.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php defined('BASEPATH') OR exit('No direct script access allowed');
22

3+
/**
4+
* REST_controller V 2.5.x
5+
*
6+
* @see https://github.com/philsturgeon/codeigniter-restserver
7+
*
8+
*/
9+
310
class REST_Controller extends CI_Controller {
411

512
protected $rest_format = NULL; // Set this in a controller to use a default format
@@ -20,7 +27,7 @@ class REST_Controller extends CI_Controller {
2027
'rawxml' => 'application/xml',
2128
'json' => 'application/json',
2229
'jsonp' => 'application/javascript',
23-
'serialize' => 'application/vnd.php.serialized',
30+
'serialized' => 'application/vnd.php.serialized',
2431
'php' => 'text/plain',
2532
'html' => 'text/html',
2633
'csv' => 'application/csv'
@@ -163,6 +170,11 @@ public function _remap($object_called, $arguments)
163170
// Get that useless shitty key out of here
164171
if (config_item('rest_enable_keys') AND $use_key AND $this->_allow === FALSE)
165172
{
173+
if (config_item('rest_enable_logging') AND $log_method)
174+
{
175+
$this->_log_request();
176+
}
177+
166178
$this->response(array('status' => false, 'error' => 'Invalid API Key.'), 403);
167179
}
168180

@@ -519,7 +531,7 @@ protected function _check_limit($controller_method)
519531
else
520532
{
521533
// Your luck is out, you've called too many times!
522-
if ($result->count > $limit)
534+
if ($result->count >= $limit)
523535
{
524536
return FALSE;
525537
}

0 commit comments

Comments
 (0)