Skip to content

Commit

Permalink
update to upstream's RestController 3.1.5 (#501)
Browse files Browse the repository at this point in the history
* update to upstream's RestController 3.1.5

* rest_api plugin: patch upstream's RestController to work with Kalkun
  • Loading branch information
tenzap authored Aug 10, 2023
1 parent be4d110 commit e67d7bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion application/plugins/rest_api/CREDITS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

CodeIgniter Rest Server v3.1.4 <https://github.com/chriskacerguis/codeigniter-restserver>
CodeIgniter Rest Server v3.1.5 <https://github.com/chriskacerguis/codeigniter-restserver>
3 changes: 1 addition & 2 deletions application/plugins/rest_api/libraries/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Help convert between various formats such as XML, JSON, CSV, etc.
*
* @author Phil Sturgeon, Chris Kacerguis, @softwarespot
* @license http://www.dbad-license.org/
* @license MIT (See LICENSE)
*/
class Format
{
Expand Down Expand Up @@ -179,7 +179,6 @@ public function to_xml($data = null, $structure = null, $basenode = 'xml')
}

foreach ($data as $key => $value) {

//change false/true to 0/1
if (is_bool($value)) {
$value = (int) $value;
Expand Down
8 changes: 4 additions & 4 deletions application/plugins/rest_api/libraries/RestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public function response($data = null, $http_code = null, $continue = false)
}
}
ob_end_flush();
// Otherwise dump the output automatically
// Otherwise dump the output automatically
} else {
echo json_encode($data);
}
Expand Down Expand Up @@ -872,13 +872,13 @@ protected function _detect_api_key()
$this->rest->ignore_limits = false;

// Find the key from server or arguments
if (($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name))) {
if ($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name)) {
$this->rest->key = $key;

if (!($row = $this->rest->db->where($this->config->item('rest_key_column'), $key)->get($this->config->item('rest_keys_table'))->row())) {
return false;
}

$this->rest->key = $row->{$this->config->item('rest_key_column')};

isset($row->user_id) && $this->rest->user_id = $row->user_id;
isset($row->level) && $this->rest->level = $row->level;
isset($row->ignore_limits) && $this->rest->ignore_limits = $row->ignore_limits;
Expand Down

0 comments on commit e67d7bc

Please sign in to comment.