Skip to content

Commit 3f3c0fe

Browse files
authored
Redo using Query Builder
1 parent e911a7b commit 3f3c0fe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

application/libraries/REST_Controller.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,9 @@ protected function _detect_api_key()
10051005
// you can also perform an extra check for this
10061006

10071007
$existsactive = $this->db->query("SELECT api_key_activated FROM api_keys WHERE api_key = '".$key."' ");
1008+
// Using the Query builder method. This will only work if you have a column named activated in the api_key table.
1009+
//If you also want to add this as a config item replace the get('activated') with $this->config->item('rest_key_activated_column').
1010+
$existsactive = $this->rest->db->where($this->config->item('rest_key_column'), $key)->get('activated')->result();
10081011
$isactive = $existsactive->result();
10091012
if ( ! ($row = $this->rest->db->where($this->config->item('rest_key_column'), $key)->get($this->config->item('rest_keys_table'))->row() ) || $isactive[0]->api_key_activated == 'no' )
10101013
{

0 commit comments

Comments
 (0)