public function run($post_opts = array())
 {
     $config = $this->application->get_config(element('action', $post_opts), 'actions');
     $post_data = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts)));
     $response = array();
     $start = microtime(true);
     $this->curl->create(element('server', $post_opts));
     $this->curl->option('buffersize', 10);
     $this->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)');
     $this->curl->option('returntransfer', true);
     $this->curl->option('followlocation', true);
     $this->curl->option('connecttimeout', true);
     $this->curl->post($post_data);
     $data = $this->curl->execute();
     $this->response_time = round(microtime(true) - $start, 3) . " seconds";
     if ($data !== false) {
         if (strcasecmp(element('responseformat', $post_opts), 'json') == 0) {
             $response = json_decode($data, true);
         } else {
             $response = $data;
         }
         $this->set_message('call_search_success');
     } else {
         $this->set_error('call_search_error');
     }
     $this->curl->close();
     return $response;
 }
 public function call_get_content($post_opts = array())
 {
     $response = array();
     $server = array_merge($this->server, $this->usermeta_model->get_usermeta(0, array('meta_key' => 'server_status')));
     $config = $this->application->get_config('getcontent', 'actions');
     $settings = $this->usermeta_model->get_usermeta(0, array('meta_key' => 'settings_query_getcontent'));
     $search = $this->application->get_session_userdata('current_search');
     $post_data = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts)), clean_parameters(elements(array_keys($config), $settings)), clean_parameters(array('links' => strtolower(element('text', $search)))));
     $response = array();
     $data = $this->curl->simple_post(element('url', $server) . ':' . element('port', $server), $post_data);
     if ($data && $data !== false) {
         $response = json_decode($data, true);
         $response = $this->document_lib->clean_json_response($response);
     }
     return $response;
 }
Beispiel #3
0
 public function call_suggest($post_opts = array())
 {
     $config = $this->application->get_config('suggest', 'actions');
     $settings = $this->usermeta_model->get_usermeta(0, array('meta_key' => 'settings_query_suggest'));
     $search = $this->application->get_session_userdata('current_search');
     $server = array_merge($this->server, $this->usermeta_model->get_usermeta(0, array('meta_key' => 'server_status')));
     $post_data = array_merge(clean_parameters(elements(array_keys($config), $search)), clean_parameters($config), clean_parameters(elements(array_keys($config), $settings)), clean_parameters(elements(array_keys($config), $post_opts)));
     $response = array();
     $start = microtime(true);
     $data = $this->curl->simple_post(element('url', $server) . ':' . element('port', $server), $post_data);
     $this->response_time = round(microtime(true) - $start, 3) . " seconds";
     if ($data !== false) {
         $response = json_decode($data, true);
     }
     $response = $this->document_lib->clean_json_response($response);
     return $response;
 }
Beispiel #4
0
 public function call_term_get_info($post_opts = array())
 {
     $response = array();
     $server = array_merge($this->server, $this->usermeta_model->get_usermeta(0, array('meta_key' => 'server_status')));
     $config = $this->application->get_config('termgetinfo', 'actions');
     $search = array();
     if ($this->session->userdata('search_settings')) {
         $search = $this->session->userdata('search_settings');
     }
     $post_data = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts)));
     $response = array();
     //$data =
     //$this->curl->simple_post( element('url', $server) . ':' . element('port', $server), $post_data);
     $this->curl->create(element('url', $server) . ':' . element('port', $server));
     $this->curl->option('buffersize', 10);
     $this->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)');
     $this->curl->option('returntransfer', 1);
     $this->curl->option('followlocation', 1);
     $this->curl->option('connecttimeout', 1);
     $this->curl->post($post_data);
     $data = $this->curl->execute();
     if ($data && $data !== false) {
         $response = json_decode($data, true);
         $response = $this->document_lib->clean_terms_json_response($response);
     }
     if (strcasecmp(element('value', $response['autnresponse']['response']), 'SUCCESS') === 0) {
         $responsedata = element('responsedata', $response['autnresponse']);
         $response = elements(array('autn:term'), $responsedata);
     }
     $this->curl->close();
     return $response;
 }
Beispiel #5
0
 public function call_get_tag_values($post_opts = array())
 {
     $response = array();
     //$server = array_merge($this->server , $this->usermeta_model->get_usermeta(0, array( 'meta_key' => 'server_status')));
     $config = $this->application->get_config('gettagvalues', 'actions');
     $search = array();
     if ($this->session->userdata('search_settings')) {
         $search = $this->session->userdata('search_settings');
     }
     $post_data = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts)));
     //$data =
     //$this->curl->simple_post( element('url', $server) . ':' . element('port', $server), $post_data);
     $this->curl->create(element('server', $post_opts));
     $this->curl->option('buffersize', 10);
     $this->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)');
     $this->curl->option('returntransfer', 1);
     $this->curl->option('followlocation', 1);
     $this->curl->option('connecttimeout', 1);
     $this->curl->post($post_data);
     $data = $this->curl->execute();
     if ($data && $data !== false) {
         $response = json_decode($data, true);
         $response = clean_json_response($response);
     }
     if (is_response_success($response)) {
         $response = get_responsedata($response);
     }
     $this->curl->close();
     return $response;
 }
Beispiel #6
0
 public function get_pid($post_opts = array())
 {
     $response = false;
     $config = $this->CI->application->get_config('getpid', 'actions');
     $config = array_merge(clean_parameters($config), clean_parameters(elements(array_keys($config), $post_opts)));
     $this->CI->curl->create(element('server', $post_opts));
     $this->CI->curl->option('buffersize', 10);
     $this->CI->curl->option('useragent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)');
     $this->CI->curl->option('returntransfer', 1);
     $this->CI->curl->option('followlocation', 1);
     //$this->CI->curl->option('HEADER', true);
     $this->CI->curl->option('connecttimeout', 1);
     $this->CI->curl->option('POST', true);
     $this->CI->curl->option('POSTFIELDS', $config);
     $data = $this->CI->curl->execute();
     if ((bool) $data) {
         $data = json_decode($data, true);
         $response = clean_json_response($data);
     } else {
         $this->set_error('An error encountered while accessing the server, please try again.');
     }
     $this->CI->curl->close();
     return $response;
 }