@@ -154,10 +154,10 @@ public function __construct()
154154
155155 // let's learn about the request
156156 $ this ->request = new stdClass ();
157-
157+
158158 // Is it over SSL?
159159 $ this ->request ->ssl = $ this ->_detect_ssl ();
160-
160+
161161 // How is this request being made? POST, DELETE, GET, PUT?
162162 $ this ->request ->method = $ this ->_detect_method ();
163163
@@ -265,9 +265,9 @@ public function _remap($object_called, $arguments)
265265 // Should we answer if not over SSL?
266266 if (config_item ('force_https ' ) AND !$ this ->_detect_ssl ())
267267 {
268- $ this ->response (array ('status ' => false , 'error ' => 'Unsupported protocol ' ), 403 );
268+ $ this ->response (array ('status ' => false , 'error ' => 'Unsupported protocol ' ), 403 );
269269 }
270-
270+
271271 $ pattern = '/^(.*)\.( ' .implode ('| ' , array_keys ($ this ->_supported_formats )).')$/ ' ;
272272 if (preg_match ($ pattern , $ object_called , $ matches ))
273273 {
@@ -434,8 +434,8 @@ protected function _detect_ssl()
434434 {
435435 return (isset ($ _SERVER ['HTTPS ' ]) && $ _SERVER ['HTTPS ' ] == "on " );
436436 }
437-
438-
437+
438+
439439 /*
440440 * Detect input format
441441 *
@@ -608,7 +608,7 @@ protected function _detect_api_key()
608608 isset ($ row ->user_id ) AND $ this ->rest ->user_id = $ row ->user_id ;
609609 isset ($ row ->level ) AND $ this ->rest ->level = $ row ->level ;
610610 isset ($ row ->ignore_limits ) AND $ this ->rest ->ignore_limits = $ row ->ignore_limits ;
611-
611+
612612 /*
613613 * If "is private key" is enabled, compare the ip address with the list
614614 * of valid ip addresses stored in the database.
@@ -621,7 +621,7 @@ protected function _detect_api_key()
621621 // multiple ip addresses must be separated using a comma, explode and loop
622622 $ list_ip_addresses = explode (", " , $ row ->ip_addresses );
623623 $ found_address = FALSE ;
624-
624+
625625 foreach ($ list_ip_addresses as $ ip_address )
626626 {
627627 if ($ this ->input ->ip_address () == trim ($ ip_address ))
@@ -631,7 +631,7 @@ protected function _detect_api_key()
631631 break ;
632632 }
633633 }
634-
634+
635635 return $ found_address ;
636636 }
637637 else
@@ -640,7 +640,7 @@ protected function _detect_api_key()
640640 return FALSE ;
641641 }
642642 }
643-
643+
644644 return $ row ;
645645 }
646646
@@ -696,7 +696,7 @@ protected function _log_request($authorized = FALSE)
696696 return $ this ->rest ->db ->insert (config_item ('rest_logs_table ' ), array (
697697 'uri ' => $ this ->uri ->uri_string (),
698698 'method ' => $ this ->request ->method ,
699- 'params ' => $ this ->_args ? serialize ($ this ->_args ) : null ,
699+ 'params ' => $ this ->_args ? ( config_item ( ' rest_logs_json_params ' ) ? json_encode ( $ this -> _args ) : serialize ($ this ->_args ) ) : null ,
700700 'api_key ' => isset ($ this ->rest ->key ) ? $ this ->rest ->key : '' ,
701701 'ip_address ' => $ this ->input ->ip_address (),
702702 'time ' => function_exists ('now ' ) ? now () : time (),
0 commit comments