application/core/Common_Service_Controller.php
/**
     * Verify a Request prior to exection or authentication
     */
Verify a Request prior to exection or authentication
Verify a Request prior to exection or authentication
public function verify_request() {
        $this->request_headers = array_change_key_case($this->_head_args, CASE_LOWER);
        $headers = $this->request_headers;
        $headers      = array_change_key_case($headers, CASE_LOWER);
        if(!isset($headers['device-id']) || !isset($headers['device-type']) || !isset($headers['device-timezone'])) {
            $this->auth_error_msg(HEADERS_MISSING, get_response_message(110), BAD_REQUEST);
        }
        $supported_device_types = array(1, 2, 3); 
        if(!in_array($headers['device-type'], $supported_device_types) || $headers['device-type'] == "" || $headers['device-timezone'] == "" || $headers['device-id'] == "") {
           $this->auth_error_msg(INVALID_HEADER_VALUE, get_response_message(113), BAD_REQUEST);
        }
    }
public function verify_request ( ) { $ this -> request_headers = array_change_key_case ( $ this -> _head_args , CASE_LOWER ) ; $ headers = $ this -> request_headers ; $ headers = array_change_key_case ( $ headers , CASE_LOWER ) ; if ( ! isset ( $ headers [ 'device-id' ] ) || ! isset ( $ headers [ 'device-type' ] ) || ! isset ( $ headers [ 'device-timezone' ] ) ) { $ this -> auth_error_msg ( HEADERS_MISSING , get_response_message ( 110 ) , BAD_REQUEST ) ; } $ supported_device_types = array ( 1 , 2 , 3 ) ; if ( ! in_array ( $ headers [ 'device-type' ] , $ supported_device_types ) || $ headers [ 'device-type' ] == " " || $ headers [ 'device-timezone' ] == " " || $ headers [ 'device-id' ] == " " ) { $ this -> auth_error_msg ( INVALID_HEADER_VALUE , get_response_message ( 113 ) , BAD_REQUEST ) ; } }
Verify a Request prior to exection or authentication
Verify a Request prior to exection or authentication
// We don't need anything for verification as of now so will just set request headers here /*
         * Convert all keys to lower case as some server manipulates header keys
         * Header keys should always be treated as case insensitive
         */ //extract($headers); /*
        * Check device_type value
        */ //1:iOs, 2:Android, 3:Web/Desktop