@@ -95,17 +95,17 @@ function __construct()
9595 // Which format should the data be returned in?
9696 $ this ->request ->lang = $ this ->_detect_lang ();
9797
98- // Load DB if its enabled
99- if (config_item ('rest_database_group ' ) AND (config_item ('rest_enable_keys ' ) OR config_item ('rest_enable_logging ' )))
100- {
101- $ this ->rest ->db = $ this ->load ->database (config_item ('rest_database_group ' ), TRUE );
102- }
103-
104- // Checking for keys? GET TO WORK!
105- if (config_item ('rest_enable_keys ' ))
106- {
107- $ this ->_allow = $ this ->_detect_api_key ();
108- }
98+ // Load DB if its enabled
99+ if (config_item ('rest_database_group ' ) AND (config_item ('rest_enable_keys ' ) OR config_item ('rest_enable_logging ' )))
100+ {
101+ $ this ->rest ->db = $ this ->load ->database (config_item ('rest_database_group ' ), TRUE );
102+ }
103+
104+ // Checking for keys? GET TO WORK!
105+ if (config_item ('rest_enable_keys ' ))
106+ {
107+ $ this ->_allow = $ this ->_detect_api_key ();
108+ }
109109 }
110110
111111 /*
@@ -319,7 +319,7 @@ private function _detect_api_key()
319319 // Find the key from server or arguments
320320 if ($ key = isset ($ this ->_args ['API-Key ' ]) ? $ this ->_args ['API-Key ' ] : $ this ->input ->server ($ key_name ))
321321 {
322- if ( ! $ row = $ this ->rest ->db ->where ('key ' , $ key )->get (' keys ' )->row ())
322+ if ( ! $ row = $ this ->rest ->db ->where ('key ' , $ key )->get (config_item ( ' rest_keys_table ' ) )->row ())
323323 {
324324 return FALSE ;
325325 }
@@ -377,7 +377,7 @@ private function _detect_lang()
377377 */
378378 private function _log_request ($ authorized = FALSE )
379379 {
380- return $ this ->rest ->db ->insert (' logs ' , array (
380+ return $ this ->rest ->db ->insert (config_item ( ' rest_logs_table ' ) , array (
381381 'uri ' => $ this ->uri ->uri_string (),
382382 'method ' => $ this ->request ->method ,
383383 'params ' => serialize ($ this ->_args ),
@@ -410,7 +410,7 @@ private function _check_limit($controller_method)
410410 $ result = $ this ->rest ->db
411411 ->where ('uri ' , $ this ->uri ->uri_string ())
412412 ->where ('api_key ' , $ this ->rest ->key )
413- ->get (' limits ' )
413+ ->get (config_item ( ' rest_limits_table ' ) )
414414 ->row ();
415415
416416 // No calls yet, or been an hour since they called
@@ -438,7 +438,7 @@ private function _check_limit($controller_method)
438438 ->where ('uri ' , $ this ->uri ->uri_string ())
439439 ->where ('api_key ' , $ this ->rest ->key )
440440 ->set ('count ' , 'count + 1 ' , FALSE )
441- ->update ('limits ' );
441+ ->update (config_item ( 'limits ' ) );
442442 }
443443
444444 return TRUE ;
0 commit comments