Пример #1
0
 /**
  * Call to the get_data script
  *
  * @return	void
  */
 private function getData()
 {
     // init vars
     $this->redirectAction = SpoonFilter::getGetValue('redirect_action', null, 'index');
     $this->identifier = time() . rand(0, 999);
     $this->pageId = SpoonFilter::getGetValue('page_id', null, '');
     $this->pagePath = SpoonFilter::getGetValue('page_path', null, '');
     $force = SpoonFilter::getGetValue('force', null, '');
     // no id set but we have a path
     if ($this->pageId == '' && $this->pagePath != '') {
         // get page for path
         $page = BackendAnalyticsModel::getPageByPath($this->pagePath);
         // set id
         $this->pageId = isset($page['id']) ? $page['id'] : '';
     }
     // build url
     $URL = SITE_URL . '/backend/cronjob.php?module=analytics&action=get_data&id=1';
     $URL .= '&page=' . $this->redirectAction;
     if ($this->pageId != '') {
         $URL .= '&page_id=' . $this->pageId;
     }
     $URL .= '&identifier=' . $this->identifier;
     $URL .= '&start_date=' . $this->startTimestamp;
     $URL .= '&end_date=' . $this->endTimestamp;
     $URL .= '&force=' . $force;
     // set options
     $options = array();
     $options[CURLOPT_URL] = $URL;
     if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
         $options[CURLOPT_FOLLOWLOCATION] = true;
     }
     $options[CURLOPT_RETURNTRANSFER] = true;
     $options[CURLOPT_TIMEOUT] = 1;
     // init
     $curl = curl_init();
     // set options
     curl_setopt_array($curl, $options);
     // execute
     curl_exec($curl);
     // close
     curl_close($curl);
 }