Skip to content

Commit 5e05076

Browse files
author
juantorres
committed
If log is enabled, all request with an invalid API key will be logged.
1 parent 6fce106 commit 5e05076

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

application/libraries/REST_Controller.php

Lines changed: 12 additions & 0 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
@@ -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

0 commit comments

Comments
 (0)