From 98457e649b3dfa0887500f32e7e77408d9529cf1 Mon Sep 17 00:00:00 2001 From: Leandro Corsino Date: Sun, 12 Apr 2020 15:23:27 -0300 Subject: [PATCH 01/35] Fix valid_response on _prepare_digest_auth --- src/RestController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 2147f83b..9a2711f1 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -1782,12 +1782,13 @@ protected function _prepare_digest_auth() $digest = (empty($matches[1]) || empty($matches[2])) ? [] : array_combine($matches[1], $matches[2]); // For digest authentication the library function should return already stored md5(username:restrealm:password) for that username see rest.php::auth_library_function config - if (isset($digest['username']) === false || $this->_check_login($digest['username'], true) === false) { + $username = $this->_check_login($digest['username'], true); + if (isset($digest['username']) === false || $username === false) { $this->_force_login($unique_id); } $md5 = md5(strtoupper($this->request->method).':'.$digest['uri']); - $valid_response = md5($digest['username'].':'.$digest['nonce'].':'.$digest['nc'].':'.$digest['cnonce'].':'.$digest['qop'].':'.$md5); + $valid_response = md5($username.':'.$digest['nonce'].':'.$digest['nc'].':'.$digest['cnonce'].':'.$digest['qop'].':'.$md5); // Check if the string don't compare (case-insensitive) if (strcasecmp($digest['response'], $valid_response) !== 0) { From 750b92820a1408b31bff4812207396c92f977ac8 Mon Sep 17 00:00:00 2001 From: =W530 Lenovo Cmder Vendor Git <=w530.lenovo@ericariyanto.com> Date: Mon, 23 Mar 2020 22:45:38 +0700 Subject: [PATCH 02/35] ^ Fix Bugs - failed load custom rest config - failed access constant HTTP return code --- src/RestController.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 9a2711f1..09ca48f0 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -258,15 +258,15 @@ public function __construct($config = 'rest') // when output is displayed for not damaging data accidentally $this->output->parse_exec_vars = false; - // Load the rest.php configuration file - $this->get_local_config($config); - // Log the loading time to the log table if ($this->config->item('rest_enable_logging') === true) { // Start the timer for how long the request takes $this->_start_rtime = microtime(true); } + // Load the rest.php configuration file + $this->get_local_config($config); + // Determine supported output formats from configuration $supported_formats = $this->config->item('rest_supported_formats'); @@ -443,11 +443,15 @@ private function do_auth($method = false) */ private function get_local_config($config_file) { - if (!$this->load->config($config_file, false)) { - $config = []; - include __DIR__.'/'.$config_file.'.php'; - foreach ($config as $key => $value) { - $this->config->set_item($key, $value); + if ( file_exists(APPPATH . 'config/' . $config_file . '.php') ) { + $this->load->config($config_file, false); + } else { + if ( file_exists(__DIR__.'/'.$config_file.'.php') ) { + $config = []; + include __DIR__.'/'.$config_file.'.php'; + foreach ($config as $key => $value) { + $this->config->set_item($key, $value); + } } } } @@ -540,7 +544,7 @@ public function _remap($object_called, $arguments = []) $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unknown_method'), - ], self::HTTP_METHOD_NOT_ALLOWED); + ], $this->http_status['METHOD_NOT_ALLOWED']); } // Doing key related stuff? Can only do it if they have a key right? @@ -619,7 +623,7 @@ public function response($data = null, $http_code = null, $continue = false) // If data is NULL and no HTTP status code provided, then display, error and exit if ($data === null && $http_code === null) { - $http_code = self::HTTP_NOT_FOUND; + $http_code = HTTP_NOT_FOUND; } // If data is not NULL and a HTTP status code provided, then continue @@ -657,7 +661,7 @@ public function response($data = null, $http_code = null, $continue = false) // If not greater than zero, then set the HTTP status code as 200 by default // Though perhaps 500 should be set instead, for the developer not passing a // correct HTTP status code - $http_code > 0 || $http_code = self::HTTP_OK; + $http_code > 0 || $http_code = HTTP_OK; $this->output->set_status_header($http_code); @@ -1537,7 +1541,7 @@ protected function _perform_ldap_auth($username = '', $password = null) 'basedn' => $this->config->item('basedn', 'ldap'), ]; - log_message('debug', 'LDAP Auth: Connect to '.(isset($ldap['host']) ? $ldap['host'] : '[ldap not configured]')); + log_message('debug', 'LDAP Auth: Connect to '.(isset($ldaphost) ? $ldaphost : '[ldap not configured]')); // Connect to the ldap server $ldapconn = ldap_connect($ldap['host'], $ldap['port']); @@ -1711,7 +1715,7 @@ protected function _check_php_session() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unauthorized'), - ], self::HTTP_UNAUTHORIZED); + ], $this->http_status['UNAUTHORIZED']); } } @@ -1796,7 +1800,7 @@ protected function _prepare_digest_auth() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_invalid_credentials'), - ], self::HTTP_UNAUTHORIZED); + ], $this->http_status['UNAUTHORIZED']); } } @@ -1816,7 +1820,7 @@ protected function _check_blacklist_auth() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_ip_denied'), - ], self::HTTP_UNAUTHORIZED); + ], $this->http_status['UNAUTHORIZED']); } } @@ -1841,7 +1845,7 @@ protected function _check_whitelist_auth() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_ip_unauthorized'), - ], self::HTTP_UNAUTHORIZED); + ], $this->http_status['UNAUTHORIZED']); } } @@ -1876,7 +1880,7 @@ protected function _force_login($nonce = '') $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unauthorized'), - ], self::HTTP_UNAUTHORIZED); + ], $this->http_status['UNAUTHORIZED']); } /** From c726a496c0d72f05cf05cf9193fcd44590fe5e5c Mon Sep 17 00:00:00 2001 From: Moch Zawaruddin Abdullah Date: Tue, 18 Feb 2020 22:37:16 +0700 Subject: [PATCH 03/35] maybe "auth" is a folder than prefix-file --- src/RestController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 09ca48f0..cfc80fb5 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -433,8 +433,8 @@ private function do_auth($method = false) return true; } - if (file_exists(__DIR__.'/auth-'.$method.'.php')) { - include __DIR__.'/auth-'.$method.'.php'; + if (file_exists(__DIR__.'/auth/'.$method.'.php')) { + include __DIR__.'/auth/'.$method.'.php'; } } From 4f0777c5231a7a13d3f884e0e2d08ae51bffea71 Mon Sep 17 00:00:00 2001 From: krishna0102 Date: Fri, 20 Dec 2019 18:00:30 +0530 Subject: [PATCH 04/35] For fixing use of undefined constant issue --- src/RestController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index cfc80fb5..fe250e3c 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -32,6 +32,11 @@ class RestController extends \CI_Controller */ protected $methods = []; + /** + * Defines https status + */ + protected $http_status = []; + /** * List of allowed HTTP methods. * @@ -218,7 +223,6 @@ class RestController extends \CI_Controller const HTTP_UNAUTHORIZED = 401; const HTTP_FORBIDDEN = 403; const HTTP_NOT_FOUND = 404; - const HTTP_METHOD_NOT_ALLOWED = 405; const HTTP_NOT_ACCEPTABLE = 406; const HTTP_INTERNAL_ERROR = 500; @@ -623,7 +627,7 @@ public function response($data = null, $http_code = null, $continue = false) // If data is NULL and no HTTP status code provided, then display, error and exit if ($data === null && $http_code === null) { - $http_code = HTTP_NOT_FOUND; + $http_code = self::HTTP_NOT_FOUND; } // If data is not NULL and a HTTP status code provided, then continue @@ -661,7 +665,7 @@ public function response($data = null, $http_code = null, $continue = false) // If not greater than zero, then set the HTTP status code as 200 by default // Though perhaps 500 should be set instead, for the developer not passing a // correct HTTP status code - $http_code > 0 || $http_code = HTTP_OK; + $http_code > 0 || $http_code = self::HTTP_OK; $this->output->set_status_header($http_code); From 88a63ccd8a1dec23e1373c0a2a8a7658d44600e2 Mon Sep 17 00:00:00 2001 From: Syaiful Huda <49975659+hudamida@users.noreply.github.com> Date: Thu, 23 Apr 2020 10:03:46 +0700 Subject: [PATCH 05/35] Update RestController.php It looks like the _check_php_session function needs a Codeigniter session library. --- src/RestController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/RestController.php b/src/RestController.php index fe250e3c..ba82b731 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -1709,6 +1709,9 @@ protected function _check_php_session() if ($this->config->item('rest_ip_whitelist_enabled')) { $this->_check_whitelist_auth(); } + + // Load library session of CodeIgniter + $this->load->library('session'); // Get the auth_source config item $key = $this->config->item('auth_source'); From becfe9b44b6239d12663feafd13cbf6dc2d80c40 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Wed, 6 May 2020 17:27:48 -0500 Subject: [PATCH 06/35] Delete FUNDING.yml --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index a7b75f10..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: chriskacerguis \ No newline at end of file From b1c15aa13b803bc01e2df1f5d5271190c95386c3 Mon Sep 17 00:00:00 2001 From: leanec Date: Wed, 15 Apr 2020 11:11:42 -0300 Subject: [PATCH 07/35] Restoring deleted fixes --- src/RestController.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index ba82b731..0127f49e 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -262,15 +262,15 @@ public function __construct($config = 'rest') // when output is displayed for not damaging data accidentally $this->output->parse_exec_vars = false; + // Load the rest.php configuration file + $this->get_local_config($config); + // Log the loading time to the log table if ($this->config->item('rest_enable_logging') === true) { // Start the timer for how long the request takes $this->_start_rtime = microtime(true); } - // Load the rest.php configuration file - $this->get_local_config($config); - // Determine supported output formats from configuration $supported_formats = $this->config->item('rest_supported_formats'); @@ -548,7 +548,7 @@ public function _remap($object_called, $arguments = []) $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unknown_method'), - ], $this->http_status['METHOD_NOT_ALLOWED']); + ], self::HTTP_METHOD_NOT_ALLOWED); } // Doing key related stuff? Can only do it if they have a key right? @@ -1545,7 +1545,7 @@ protected function _perform_ldap_auth($username = '', $password = null) 'basedn' => $this->config->item('basedn', 'ldap'), ]; - log_message('debug', 'LDAP Auth: Connect to '.(isset($ldaphost) ? $ldaphost : '[ldap not configured]')); + log_message('debug', 'LDAP Auth: Connect to '.(isset($ldap['host']) ? $ldap['host'] : '[ldap not configured]')); // Connect to the ldap server $ldapconn = ldap_connect($ldap['host'], $ldap['port']); @@ -1722,7 +1722,7 @@ protected function _check_php_session() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unauthorized'), - ], $this->http_status['UNAUTHORIZED']); + ], self::HTTP_UNAUTHORIZED); } } @@ -1807,7 +1807,7 @@ protected function _prepare_digest_auth() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_invalid_credentials'), - ], $this->http_status['UNAUTHORIZED']); + ], self::HTTP_UNAUTHORIZED); } } @@ -1827,7 +1827,7 @@ protected function _check_blacklist_auth() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_ip_denied'), - ], $this->http_status['UNAUTHORIZED']); + ], self::HTTP_UNAUTHORIZED); } } @@ -1852,7 +1852,7 @@ protected function _check_whitelist_auth() $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_ip_unauthorized'), - ], $this->http_status['UNAUTHORIZED']); + ], self::HTTP_UNAUTHORIZED); } } @@ -1887,7 +1887,7 @@ protected function _force_login($nonce = '') $this->response([ $this->config->item('rest_status_field_name') => false, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unauthorized'), - ], $this->http_status['UNAUTHORIZED']); + ], self::HTTP_UNAUTHORIZED); } /** From 49e02df8effae4d37c721b809c46c034d4323ebb Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sat, 15 Aug 2020 13:34:52 -0500 Subject: [PATCH 08/35] Create stale.yml --- .github/workflows/stale.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..34045177 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,19 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Stale issue message' + stale-pr-message: 'Stale pull request message' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' From 65828c3556a012a94d90f514ac812317a2130fe8 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sat, 15 Aug 2020 13:37:26 -0500 Subject: [PATCH 09/35] fixes #1099 --- src/RestController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RestController.php b/src/RestController.php index 0127f49e..6e433378 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -223,6 +223,7 @@ class RestController extends \CI_Controller const HTTP_UNAUTHORIZED = 401; const HTTP_FORBIDDEN = 403; const HTTP_NOT_FOUND = 404; + const HTTP_METHOD_NOT_ALLOWED = 405; const HTTP_NOT_ACCEPTABLE = 406; const HTTP_INTERNAL_ERROR = 500; From 0f683ff9579500f1f5a17a8e781ca10c2f27d522 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sat, 15 Aug 2020 13:45:47 -0500 Subject: [PATCH 10/35] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..b2676296 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior, or a code snippet (properly formatted): +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. From 6e3335c6a08b2320c810530cfbc08b8380413447 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sat, 15 Aug 2020 13:49:23 -0500 Subject: [PATCH 11/35] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 29 +++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index b2676296..34ee3d3c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -11,27 +11,24 @@ assignees: '' A clear and concise description of what the bug is. **To Reproduce** -Steps to reproduce the behavior, or a code snippet (properly formatted): -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error +Please provide either a cleanly formatted code snippet or a link to repo / gist with code that I can use to reproduce: + +```php + public function set_response($data = null, $http_code = null) + { + $this->response($data, $http_code, true); + } +``` **Expected behavior** A clear and concise description of what you expected to happen. -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] +**Screenshots / Error Messages** +If applicable, add screenshots and/or error messages to help explain your problem. -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] +**Environment (please complete the following information):** + - PHP Version: [e.g. 7.2.1] + - CodeIgniter Version [e.g. 4.0.1] - Version [e.g. 22] **Additional context** From f05eafea520633028bcae9a6c12fe45463b7ee5a Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sat, 15 Aug 2020 19:00:21 +0000 Subject: [PATCH 12/35] Apply fixes from StyleCI --- src/RestController.php | 59 +++++++++++++++++++++++++----------------- src/rest.php | 22 ++++++++-------- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 6e433378..078cf535 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -33,7 +33,7 @@ class RestController extends \CI_Controller protected $methods = []; /** - * Defines https status + * Defines https status. */ protected $http_status = []; @@ -448,10 +448,10 @@ private function do_auth($method = false) */ private function get_local_config($config_file) { - if ( file_exists(APPPATH . 'config/' . $config_file . '.php') ) { + if (file_exists(APPPATH.'config/'.$config_file.'.php')) { $this->load->config($config_file, false); } else { - if ( file_exists(__DIR__.'/'.$config_file.'.php') ) { + if (file_exists(__DIR__.'/'.$config_file.'.php')) { $config = []; include __DIR__.'/'.$config_file.'.php'; foreach ($config as $key => $value) { @@ -951,15 +951,17 @@ protected function _log_request($authorized = false) // Insert the request into the log table $is_inserted = $this->rest->db ->insert( - $this->config->item('rest_logs_table'), [ - 'uri' => $this->uri->uri_string(), - 'method' => $this->request->method, - 'params' => $this->_args ? ($this->config->item('rest_logs_json_params') === true ? json_encode($this->_args) : serialize($this->_args)) : null, - 'api_key' => isset($this->rest->key) ? $this->rest->key : '', - 'ip_address' => $this->input->ip_address(), - 'time' => time(), - 'authorized' => $authorized, - ]); + $this->config->item('rest_logs_table'), + [ + 'uri' => $this->uri->uri_string(), + 'method' => $this->request->method, + 'params' => $this->_args ? ($this->config->item('rest_logs_json_params') === true ? json_encode($this->_args) : serialize($this->_args)) : null, + 'api_key' => isset($this->rest->key) ? $this->rest->key : '', + 'ip_address' => $this->input->ip_address(), + 'time' => time(), + 'authorized' => $authorized, + ] + ); // Get the last insert id to update at a later stage of the request $this->_insert_id = $this->rest->db->insert_id(); @@ -1710,7 +1712,7 @@ protected function _check_php_session() if ($this->config->item('rest_ip_whitelist_enabled')) { $this->_check_whitelist_auth(); } - + // Load library session of CodeIgniter $this->load->library('session'); @@ -1877,7 +1879,8 @@ protected function _force_login($nonce = '') header( 'WWW-Authenticate: Digest realm="'.$rest_realm .'", qop="auth", nonce="'.$nonce - .'", opaque="'.md5($rest_realm).'"'); + .'", opaque="'.md5($rest_realm).'"' + ); } if ($this->config->item('strict_api_and_auth') === true) { @@ -1907,9 +1910,12 @@ protected function _log_access_time() $payload['rtime'] = $this->_end_rtime - $this->_start_rtime; return $this->rest->db->update( - $this->config->item('rest_logs_table'), $payload, [ - 'id' => $this->_insert_id, - ]); + $this->config->item('rest_logs_table'), + $payload, + [ + 'id' => $this->_insert_id, + ] + ); } /** @@ -1930,9 +1936,12 @@ protected function _log_response_code($http_code) $payload['response_code'] = $http_code; return $this->rest->db->update( - $this->config->item('rest_logs_table'), $payload, [ - 'id' => $this->_insert_id, - ]); + $this->config->item('rest_logs_table'), + $payload, + [ + 'id' => $this->_insert_id, + ] + ); } /** @@ -1949,10 +1958,12 @@ protected function _check_access() // Fetch controller based on path and controller name $controller = implode( - '/', [ - $this->router->directory, - $this->router->class, - ]); + '/', + [ + $this->router->directory, + $this->router->class, + ] + ); // Remove any double slashes for safety $controller = str_replace('//', '/', $controller); diff --git a/src/rest.php b/src/rest.php index 887141c6..d58d7ce1 100644 --- a/src/rest.php +++ b/src/rest.php @@ -556,11 +556,11 @@ | */ $config['allowed_cors_headers'] = [ - 'Origin', - 'X-Requested-With', - 'Content-Type', - 'Accept', - 'Access-Control-Request-Method', + 'Origin', + 'X-Requested-With', + 'Content-Type', + 'Accept', + 'Access-Control-Request-Method', ]; /* @@ -572,12 +572,12 @@ | */ $config['allowed_cors_methods'] = [ - 'GET', - 'POST', - 'OPTIONS', - 'PUT', - 'PATCH', - 'DELETE', + 'GET', + 'POST', + 'OPTIONS', + 'PUT', + 'PATCH', + 'DELETE', ]; /* From 24eab8a5231608cd1fc89c17e90e2e432a23d410 Mon Sep 17 00:00:00 2001 From: Kobus Myburgh Date: Sat, 19 Sep 2020 01:20:19 +0200 Subject: [PATCH 13/35] Attempt to fix issue 1069 - XSS filtering --- src/RestController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/RestController.php b/src/RestController.php index 078cf535..879c8998 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -1411,6 +1411,9 @@ public function head($key = null, $xss_clean = null) public function post($key = null, $xss_clean = null) { if ($key === null) { + foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($this->_post_args), RecursiveIteratorIterator::CATCH_GET_CHILD) as $key => $value) { + $this->_post_args[$key] = $this->_xss_clean($this->_post_args[$key], $xss_clean); + } return $this->_post_args; } From 399d9bcefabf19242260581aa12bcd6245b6b5e3 Mon Sep 17 00:00:00 2001 From: Kobus Myburgh Date: Sat, 19 Sep 2020 01:26:38 +0200 Subject: [PATCH 14/35] Added new line, as per CI error. --- src/RestController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RestController.php b/src/RestController.php index 879c8998..a5ac91f7 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -1414,6 +1414,7 @@ public function post($key = null, $xss_clean = null) foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($this->_post_args), RecursiveIteratorIterator::CATCH_GET_CHILD) as $key => $value) { $this->_post_args[$key] = $this->_xss_clean($this->_post_args[$key], $xss_clean); } + return $this->_post_args; } From 949d5ad8b35962d74bd8510a9d429c9b43e19cd6 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sun, 28 Feb 2021 09:33:53 -0600 Subject: [PATCH 15/35] Update RestController.php fixes #1115 --- src/RestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RestController.php b/src/RestController.php index a5ac91f7..83d9f2d2 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -11,7 +11,7 @@ * CodeIgniter Rest Controller * A fully RESTful server implementation for CodeIgniter using one library, one config file and one controller. * - * @link https://github.com/chriskacerguis/ci-restserver + * @link https://github.com/chriskacerguis/codeigniter-restserver * * @version 4.0.0 */ From 99d996275ebc323a00f35a4ab004f18c2f48be3d Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Sun, 28 Feb 2021 09:35:11 -0600 Subject: [PATCH 16/35] Update stale.yml --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 34045177..0a753df8 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/stale@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' + stale-issue-message: 'There has been no activity on this issue, so it will be closed.' stale-pr-message: 'Stale pull request message' stale-issue-label: 'no-issue-activity' stale-pr-label: 'no-pr-activity' From 4c5b88b08f10089a1b939e484c8f26e067c04dda Mon Sep 17 00:00:00 2001 From: Jamie Burchell Date: Thu, 3 Feb 2022 10:11:19 +0000 Subject: [PATCH 17/35] Fix RecursiveIteratorIterator not found Fixes https://github.com/chriskacerguis/codeigniter-restserver/issues/1111 --- src/RestController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RestController.php b/src/RestController.php index 83d9f2d2..b8f36c71 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -4,6 +4,7 @@ use Exception; use stdClass; +use RecursiveIteratorIterator; defined('BASEPATH') or exit('No direct script access allowed'); From c01570892b25bf87c49a92c8889be20c3813bfd0 Mon Sep 17 00:00:00 2001 From: Jamie Burchell Date: Thu, 3 Feb 2022 10:12:51 +0000 Subject: [PATCH 18/35] Fix code style --- src/RestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RestController.php b/src/RestController.php index b8f36c71..765f0598 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -3,8 +3,8 @@ namespace chriskacerguis\RestServer; use Exception; -use stdClass; use RecursiveIteratorIterator; +use stdClass; defined('BASEPATH') or exit('No direct script access allowed'); From 4571473e69fc830176cdd132938f5b8d25bea511 Mon Sep 17 00:00:00 2001 From: Jamie Burchell Date: Thu, 3 Feb 2022 10:15:29 +0000 Subject: [PATCH 19/35] Fix RecursiveArrayIterator not found --- src/RestController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RestController.php b/src/RestController.php index 765f0598..9ab38913 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -3,6 +3,7 @@ namespace chriskacerguis\RestServer; use Exception; +use RecursiveArrayIterator; use RecursiveIteratorIterator; use stdClass; From f386f4e0013daadaa213681a0a41af69aa81d9de Mon Sep 17 00:00:00 2001 From: Jamie Burchell Date: Wed, 23 Feb 2022 14:52:03 +0000 Subject: [PATCH 20/35] Don't attempt to lowercase a NULL Fixes PHP 8.1 deprecation notice when trying to `strtolower` `NULL` --- src/RestController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/RestController.php b/src/RestController.php index 9ab38913..0e0aa4bc 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -834,7 +834,9 @@ protected function _detect_method() $method = $this->input->server('HTTP_X_HTTP_METHOD_OVERRIDE'); } - $method = strtolower($method); + if ($method !== null) { + $method = strtolower($method); + } } if (empty($method)) { From 2e1cbd347625cb489776528696f7980984e9b7f5 Mon Sep 17 00:00:00 2001 From: alex-monte <61494531+alex-monte@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:16:18 +0200 Subject: [PATCH 21/35] Update RestController.php I propose this simple change so that in case $row is false, the message 'text_rest_invalid_api_key' has the information in '$this->rest->key' to display it correctly. --- src/RestController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 0e0aa4bc..ab46a570 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -867,12 +867,13 @@ protected function _detect_api_key() // 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))) { + + $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; From a16bdd648db2fa2cb3c386e7bb9b06d3ddb73fb9 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis Date: Tue, 2 May 2023 11:16:52 -0500 Subject: [PATCH 22/35] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index f7f4e305..2078f9fd 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ A fully RESTful server implementation for CodeIgniter using one library, one config file and one controller. +## Important!! + +CodeIgniter 4 includes REST support out of the box and therefore does not require the RestServer. + +See the documentation here: [RESTful Resource Handling](https://codeigniter4.github.io/userguide/incoming/restful.html) + ## Requirements - PHP 7.2 or greater From f36aa04e1d31ff83d447b170cef31ffb557ff0c3 Mon Sep 17 00:00:00 2001 From: tenzap Date: Tue, 20 Jun 2023 12:35:39 +0200 Subject: [PATCH 23/35] add SQL CREATE TABLE queries for PostgreSQL --- src/rest.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/rest.php b/src/rest.php index d58d7ce1..b4cc7984 100644 --- a/src/rest.php +++ b/src/rest.php @@ -322,6 +322,19 @@ | PRIMARY KEY (`id`) | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | +| For PostgreSQL +| CREATE TABLE keys ( +| id SERIAL, +| user_id INT NOT NULL, +| key VARCHAR(40) NOT NULL, +| level INT NOT NULL, +| ignore_limits SMALLINT NOT NULL DEFAULT '0', +| is_private_key SMALLINT NOT NULL DEFAULT '0', +| ip_addresses TEXT NULL DEFAULT NULL, +| date_created INT NOT NULL, +| PRIMARY KEY (id) +| ) ; +| | */ $config['rest_enable_keys'] = false; @@ -402,6 +415,20 @@ | PRIMARY KEY (`id`) | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | +| For PostgreSQL +| CREATE TABLE logs ( +| id SERIAL, +| uri VARCHAR(255) NOT NULL, +| method VARCHAR(6) NOT NULL, +| params TEXT DEFAULT NULL, +| api_key VARCHAR(40) NOT NULL, +| ip_address VARCHAR(45) NOT NULL, +| time INT NOT NULL, +| rtime DOUBLE PRECISION DEFAULT NULL, +| authorized boolean NOT NULL, +| response_code smallint DEFAULT '0', +| PRIMARY KEY (id) +| ) ; */ $config['rest_enable_logging'] = false; @@ -435,6 +462,31 @@ | PRIMARY KEY (`id`) | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | +| For PostgreSQL +| CREATE TABLE access ( +| id SERIAL, +| key VARCHAR(40) NOT NULL DEFAULT '', +| all_access SMALLINT NOT NULL DEFAULT '0', +| controller VARCHAR(50) NOT NULL DEFAULT '', +| date_created TIMESTAMP(0) DEFAULT NULL, +| date_modified TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, +| PRIMARY KEY (id) +| ) ; +| CREATE OR REPLACE FUNCTION upd_timestamp() RETURNS TRIGGER +| LANGUAGE plpgsql +| AS +| $$ +| BEGIN +| NEW.modified = CURRENT_TIMESTAMP; +| RETURN NEW; +| END; +| $$; +| CREATE TRIGGER trigger_access +| BEFORE UPDATE +| ON access +| FOR EACH ROW +| EXECUTE PROCEDURE upd_timestamp(); +| */ $config['rest_enable_access'] = false; @@ -479,6 +531,16 @@ | PRIMARY KEY (`id`) | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | +| For PostgreSQL +| CREATE TABLE limits ( +| id SERIAL, +| uri VARCHAR(255) NOT NULL, +| count INT NOT NULL, +| hour_started INT NOT NULL, +| api_key VARCHAR(40) NOT NULL, +| PRIMARY KEY (id) +| ) ; +| | To specify the limits within the controller's __construct() method, add per-method | limits with: | From 57b74957b95e0f1b2cd85d1adf6607b11ab3eda2 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> Date: Sat, 29 Jul 2023 13:14:25 -0500 Subject: [PATCH 24/35] Updated to MIT license --- src/Format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Format.php b/src/Format.php index ce5b2de6..d2058634 100644 --- a/src/Format.php +++ b/src/Format.php @@ -11,7 +11,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 { From 63c5ccad5581c3e0035c400aa929ba1ef0822418 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sat, 29 Jul 2023 18:18:03 +0000 Subject: [PATCH 25/35] Apply fixes from StyleCI --- src/Format.php | 1 - src/RestController.php | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Format.php b/src/Format.php index d2058634..54dc4c46 100644 --- a/src/Format.php +++ b/src/Format.php @@ -183,7 +183,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; diff --git a/src/RestController.php b/src/RestController.php index ab46a570..09f37163 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -697,7 +697,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); } @@ -866,8 +866,7 @@ 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())) { From 94c779f0f995fddedb00b703ac1e3682c71574fe Mon Sep 17 00:00:00 2001 From: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> Date: Sat, 29 Jul 2023 13:23:44 -0500 Subject: [PATCH 26/35] Delete stale.yml --- .github/workflows/stale.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 0a753df8..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Mark stale issues and pull requests - -on: - schedule: - - cron: "30 1 * * *" - -jobs: - stale: - - runs-on: ubuntu-latest - - steps: - - uses: actions/stale@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'There has been no activity on this issue, so it will be closed.' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' From bdf3548de32dc7305de6b93a47c6adb5c99c9878 Mon Sep 17 00:00:00 2001 From: Ivan Peevski <133036+ipeevski@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:32:43 +0930 Subject: [PATCH 27/35] Fix handling null in to_xml() --- src/Format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Format.php b/src/Format.php index 54dc4c46..4c55a430 100644 --- a/src/Format.php +++ b/src/Format.php @@ -215,7 +215,7 @@ public function to_xml($data = null, $structure = null, $basenode = 'xml') $this->to_xml($value, $node, $key); } else { // add single node. - $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); + $value = htmlspecialchars(html_entity_decode($value ?? '', ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8'); $structure->addChild($key, $value); } From 548cc4161f86aefdab7059e9ef6b29745c7152eb Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 11 Sep 2024 00:05:07 +0000 Subject: [PATCH 28/35] Apply fixes from StyleCI --- src/RestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RestController.php b/src/RestController.php index 09f37163..99a99148 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -697,7 +697,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); } From 8ab48d53ea542030dea71f96dfbd28a0ba6efb1a Mon Sep 17 00:00:00 2001 From: Ivan Peevski Date: Wed, 11 Sep 2024 15:39:08 +0930 Subject: [PATCH 29/35] Allow extending Formatter class --- src/RestController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 99a99148..9c2c9b13 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -232,7 +232,7 @@ class RestController extends \CI_Controller /** * @var Format */ - private $format; + protected $format; /** * @var bool @@ -636,10 +636,17 @@ public function response($data = null, $http_code = null, $continue = false) // If data is not NULL and a HTTP status code provided, then continue elseif ($data !== null) { // If the format method exists, call and return the output in that format - if (method_exists(Format::class, 'to_'.$this->response->format)) { + $formatter = null; + if ($this->format && method_exists($this->format, 'to_'.$this->response->format)) { + $formatter = $this->format::factory($data); + } else if (method_exists(Format::class, 'to_'.$this->response->format)) { + $formatter = Format::factory($data); + } + + if ($formatter !== null) { // CORB protection // First, get the output content. - $output = Format::factory($data)->{'to_'.$this->response->format}(); + $output = $formatter->{'to_'.$this->response->format}(); // Set the format header // Then, check if the client asked for a callback, and if the output contains this callback : From d0e5bd68cd5f704645b63fb79eafe520e596283a Mon Sep 17 00:00:00 2001 From: Ivan Peevski Date: Wed, 11 Sep 2024 15:50:30 +0930 Subject: [PATCH 30/35] Fix style --- src/RestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RestController.php b/src/RestController.php index 9c2c9b13..c5fddefb 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -639,7 +639,7 @@ public function response($data = null, $http_code = null, $continue = false) $formatter = null; if ($this->format && method_exists($this->format, 'to_'.$this->response->format)) { $formatter = $this->format::factory($data); - } else if (method_exists(Format::class, 'to_'.$this->response->format)) { + } elseif (method_exists(Format::class, 'to_'.$this->response->format)) { $formatter = Format::factory($data); } From 70bcd18e590df90b33949153455695ac8a6e2bd7 Mon Sep 17 00:00:00 2001 From: Ivan Peevski Date: Tue, 17 Sep 2024 11:36:09 +0930 Subject: [PATCH 31/35] Update Readme file to add example for extending Format --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/README.md b/README.md index 2078f9fd..0390fcff 100644 --- a/README.md +++ b/README.md @@ -114,3 +114,56 @@ class Api extends RestController { } } ``` + +## Extending supported formats + +If you need to be able to support more formats for replies, you can extend the +`Format` class to add the required `to_...` methods + +1. Extend the `RestController` class (in `libraries/MY_REST_Controller.php`) +```php +format = new Format(); + } +} +``` + +2. Extend the `Format` class (can be created as a CodeIgniter library in `libraries/Format.php`). +Following is an example to add support for PDF output + +```php +_data; + } + + if (is_array($data) || substr($data, 0, 4) != '%PDF') { + $html = $this->to_html($data); + + // Use your PDF lib of choice. For example mpdf + $mpdf = new \Mpdf\Mpdf(); + $mpdf->WriteHTML($html); + return $mpdf->Output('', 'S'); + } + + return $data; + } +} +``` From 05245888ae49dc97a34fafe1dd4ffa068c690f26 Mon Sep 17 00:00:00 2001 From: Ashton Smith Date: Thu, 21 Nov 2024 15:01:00 +1300 Subject: [PATCH 32/35] add support for expiring api keys --- src/RestController.php | 4 ++++ src/rest.php | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/RestController.php b/src/RestController.php index c5fddefb..3c7298c2 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -880,6 +880,10 @@ protected function _detect_api_key() return false; } + if ($this->config->item('rest_keys_expire')===true && $row->{$this->config->item('rest_keys_expiry_column')} < time()) { + return false; + } + 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; diff --git a/src/rest.php b/src/rest.php index b4cc7984..28cd6ea8 100644 --- a/src/rest.php +++ b/src/rest.php @@ -319,6 +319,7 @@ | `is_private_key` TINYINT(1) NOT NULL DEFAULT '0', | `ip_addresses` TEXT NULL DEFAULT NULL, | `date_created` INT(11) NOT NULL, +| `expires` INT(11) NOT NULL | PRIMARY KEY (`id`) | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | @@ -332,6 +333,7 @@ | is_private_key SMALLINT NOT NULL DEFAULT '0', | ip_addresses TEXT NULL DEFAULT NULL, | date_created INT NOT NULL, +| expires INT NOT NULL, | PRIMARY KEY (id) | ) ; | | @@ -348,6 +350,19 @@ | */ $config['rest_key_column'] = 'key'; +/* +|-------------------------------------------------------------------------- +| REST Table Key Expiry Config and Column Name +|-------------------------------------------------------------------------- +| +| Configure wether or not api keys should expire, and the column name to +| match e.g. expires +| Note: the value in the column will be treated as a unix timestamp and +| compared with php function time() +| +*/ +$config['rest_keys_expire'] = false; +$config['rest_keys_expiry_column'] = 'expires'; /* |-------------------------------------------------------------------------- From 60b2009982b27ff29e7b7554d2de776519e4ca8e Mon Sep 17 00:00:00 2001 From: Ashton Smith Date: Thu, 21 Nov 2024 15:07:30 +1300 Subject: [PATCH 33/35] style fixes for #1159 --- src/RestController.php | 2 +- src/rest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RestController.php b/src/RestController.php index 3c7298c2..7f292a98 100644 --- a/src/RestController.php +++ b/src/RestController.php @@ -880,7 +880,7 @@ protected function _detect_api_key() return false; } - if ($this->config->item('rest_keys_expire')===true && $row->{$this->config->item('rest_keys_expiry_column')} < time()) { + if ($this->config->item('rest_keys_expire') === true && $row->{$this->config->item('rest_keys_expiry_column')} < time()) { return false; } diff --git a/src/rest.php b/src/rest.php index 28cd6ea8..7c8c4c9b 100644 --- a/src/rest.php +++ b/src/rest.php @@ -355,9 +355,9 @@ | REST Table Key Expiry Config and Column Name |-------------------------------------------------------------------------- | -| Configure wether or not api keys should expire, and the column name to +| Configure wether or not api keys should expire, and the column name to | match e.g. expires -| Note: the value in the column will be treated as a unix timestamp and +| Note: the value in the column will be treated as a unix timestamp and | compared with php function time() | */ From 55c1a5b099f581d2a3cabf5d9bd5887b175737f3 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> Date: Thu, 25 Sep 2025 08:33:11 -0500 Subject: [PATCH 34/35] Update README to reflect current CodeIgniter status Removed outdated information about CodeIgniter 4 and updated the description. Signed-off-by: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0390fcff..59776fe9 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,9 @@ # CodeIgniter RestServer -[![StyleCI](https://github.styleci.io/repos/230589/shield?branch=master)](https://github.styleci.io/repos/230589) +A fully RESTful server implementation for CodeIgniter 3 using one library, one config file and one controller. -A fully RESTful server implementation for CodeIgniter using one library, one config file and one controller. - -## Important!! - -CodeIgniter 4 includes REST support out of the box and therefore does not require the RestServer. - -See the documentation here: [RESTful Resource Handling](https://codeigniter4.github.io/userguide/incoming/restful.html) +> [!IMPORTANT] +> I have published the first "beta" of codeigniter-restserver 4. See the "development" branch. Please be sure to note the system requirments. ## Requirements From 13811da74d1eb259e76f0a8fce4255cb571b5795 Mon Sep 17 00:00:00 2001 From: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> Date: Thu, 25 Sep 2025 18:36:07 -0500 Subject: [PATCH 35/35] Add CODEOWNERS file for repository ownership Signed-off-by: Chris Kacerguis <2414647+chriskacerguis@users.noreply.github.com> --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..5d609ac7 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @chriskacerguis