예제 #1
0
 public function getAppLogs($id_application)
 {
     $result = array();
     //$log_data  = logModel::getAppLog( $id_application, $id_platform );
     $platforms = platformModel::getPlatforms();
     foreach ($platforms as $k => $v) {
         $log_data = array();
         $log_data = logModel::getAppLog($id_application, $v['id_platform'], 10);
         if (count($log_data)) {
             $result[$v['id_platform']] = $log_data + array('name_platform' => $v['name_platform']);
         }
     }
     return $this->render('app_log', array('app_log' => $result));
 }
예제 #2
0
 public function getHttpCodeAction()
 {
     $resources = array();
     $id_application = $_GET['id_application'];
     $id_platform = $_GET['id_platform'];
     if (check_RequestMethod('GET')) {
         set_Json_header();
         $app_data = appsModel::getApplicationData($id_application);
         $platform_data = platformModel::getPlatformData($id_platform);
         /*  bool   CURLOPT_FRESH_CONNECT - TRUE to force the use of a new connection instead of a cached one.
          *  string CURLOPT_USERAGENT     - The contents of the "User-Agent: " header to be used in a HTTP request.
          *  array  CURLOPT_HTTPHEADER     - An array of HTTP header fields to set, in the format array('Content-type: text/plain', 'Content-length: 100')
          *  bool   CURLOPT_RETURNTRANSFER - TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
          * */
         $response_data = apiModel::getRequestInfo($app_data['url_application'], array(CURLOPT_FRESH_CONNECT => true, CURLOPT_USERAGENT => $platform_data['UA_string'], CURLOPT_RETURNTRANSFER => true, CURLINFO_HEADER_OUT => true));
         print_r($response_data);
         $resources = $this->getResources($app_data['url_application'], $response_data['html']);
         if (is_array($resources)) {
             foreach ($resources as $v) {
                 $r = apiModel::getRequestInfo($v, array(CURLOPT_FRESH_CONNECT => true, CURLOPT_USERAGENT => $platform_data['UA_string'], CURLOPT_RETURNTRANSFER => true, CURLINFO_HEADER_OUT => true));
                 $response_data['size_download'] += $r['size_download'];
             }
         }
         $last_log_data = logModel::getLastLogs($id_application, $id_platform);
         $log_data = array('id_application' => $id_application, 'id_platform' => $id_platform, 'HTTP_code' => !count(apiModel::$errors) ? $response_data['http_code'] : apiModel::$errors[0], 'date_check' => date('Y-m-d H:i:s', time()), 'id_user' => authModel::getCurrentUserId(), 'size_download' => $response_data['size_download'], 'download_content_length' => $response_data['download_content_length'], 'redirect_url' => $response_data['redirect_url'], 'request_header' => $response_data['request_header'], 'weight_diff' => $response_data['size_download'] - $last_log_data[$id_application][$id_platform]['size_download'], 'app_resources' => implode(', ', $resources));
         if (($id_check_log = logModel::checkInBase($log_data, array('date_check', 'app_resources'))) !== false) {
             logModel::updateData($log_data + array('id_check_log' => $id_check_log));
         } else {
             $id_check_log = logModel::insertData($log_data);
         }
         $log_data = logModel::getLog($id_check_log);
         print json_encode($log_data + array('curl_response' => $response_data, 'last_log' => $last_log_data));
         die;
     } else {
         _404();
     }
 }
예제 #3
0
 /**
  * Get app list
  * @return string
  */
 private function getAppsList()
 {
     $id_user = classModel::getCurrentUserId();
     $apps_list = appsModel::getApps($id_user);
     $platforms = platformModel::getPlatforms();
     $logs = logModel::getLastLogs();
     foreach ($apps_list as $k => $v) {
         $apps_list[$k]['platforms'] = appsModel::getApp2PlatformData($v['id_application']);
         $apps_list[$k]['btn_edit'] = $this->render_common('btn_edit', array('url' => $this->makeURI(array('action' => 'edit', 'id_application' => $v['id_application'], 'id_user' => $v['id_user']))));
         $apps_list[$k]['btn_delete'] = $this->render_common('btn_delete', array('url' => $this->makeURI(array('action' => 'delete', 'id_application' => $v['id_application'])), 'confirm_text' => 'Do you want to delete this application?'));
     }
     return $this->render('apps_list', array('apps_list' => $apps_list, 'platforms' => $platforms, 'curent_user' => $id_user, 'logs' => $logs, 'btn_add_platform' => $this->render_common('btn_add', array('url' => $this->makeURI(array('controller' => 'platforms', 'action' => 'add'))))));
 }
예제 #4
0
 public function sessao_expirada()
 {
     //Log
     $log_o = new logModel();
     $log_o->logPadrao('sessao expirada após ' . round(TEMPO_LIMITE / 60, 1) . ' minutos ', 1);
     $_SESSION['user'] = null;
     session_destroy();
     //$this->template->run();
     //$this->smarty->display('/index.html');
     header('Location: /index.html');
     // die('chegou');
     exit;
 }
예제 #5
0
파일: util.php 프로젝트: hermeto/framework
 public function debug_no_log($texto, $tipo_log = 1)
 {
     $log_o = new logModel();
     $log_o->logPadrao($texto, $tipo_log);
 }
예제 #6
0
 public function debug_no_log($texto)
 {
     $log_o = new logModel();
     $log_o->logPadrao($texto, 1);
 }