コード例 #1
0
 public function execute()
 {
     $settings = waRequest::post('settings', array(), waRequest::TYPE_ARRAY);
     if (strlen($error = logsHelper::setPhpLogSetting(ifset($settings['php_log'], false)))) {
         $this->errors[] = $error;
     }
 }
コード例 #2
0
 public function execute()
 {
     $controls = array(_w('Enable PHP error log') => waHtmlControl::getControl(waHtmlControl::CHECKBOX, 'settings[php_log]', array('value' => 1, 'checked' => logsHelper::getPhpLogSetting(), 'description' => '<span class="hint">' . _w('PHP error messages will be saved to file <tt>wa-log/<b>php.log</b></tt>.') . '<br><br>' . '<b>' . _w('Enable this setting if you cannot, or do not want to, edit files on your server.') . '</b><br>' . sprintf(_w('Otherwise add the following lines to your file <tt class>%s</tt>:'), wa()->getConfig()->getRootPath() . '/<b>.htaccess</b>') . '<br><br>' . '<tt>php_flag display_errors Off<br>
                     php_value error_reporting 2147483647<br>
                     php_flag log_errors On<br>
                     php_value error_log ./wa-log/php.log</tt>' . '</span>')));
     $this->view->assign('controls', $controls);
 }
コード例 #3
0
 public function fileAction()
 {
     $path = waRequest::get('path');
     $page = waRequest::get('page', null, 'int');
     $file = logsHelper::getFile(array('path' => $path, 'page' => $page));
     if ($page !== null && ($page < 1 || $page > $file['page_count'])) {
         $this->redirect('?action=file&path=' . $path);
     } else {
         $this->view->assign('file', $file);
     }
 }
コード例 #4
0
 public function execute()
 {
     $path = waRequest::get('path');
     $full_path = logsHelper::getAbsolutePath($path);
     $available = logsHelper::checkPath($full_path, false);
     if ($available) {
         $file_name = basename($full_path);
         waFiles::readFile($full_path, $file_name);
     } else {
         $this->redirect(wa()->getAppUrl());
     }
 }
コード例 #5
0
 public function execute()
 {
     $file = logsHelper::getFile(array('path' => waRequest::post('path'), 'first_line' => waRequest::post('first_line', 0, 'int'), 'last_line' => waRequest::post('last_line', 0, 'int'), 'direction' => waRequest::post('direction'), 'check' => false));
     if ($file['error']) {
         $this->errors[] = $file['error'];
         $this->response['redirect_url'] = $file['return_url'];
     } else {
         $template = wa()->getAppPath('templates/actions/backend/BackendGetmore.html');
         $view = wa()->getView();
         $view->assign('html', $file['contents']);
         $html = $view->fetch($template);
         if (strlen($html)) {
             $this->response = array('contents' => $view->fetch($template), 'first_line' => $file['first_line'], 'last_line' => $file['last_line']);
         } else {
             $this->response = array('contents' => null);
         }
     }
 }
コード例 #6
0
 public function execute()
 {
     if ($path = waRequest::get('path')) {
         $this->view->assign('breadcrumbs', logsHelper::getBreadcrumbs($path));
     } else {
         $action = waRequest::get('action');
         $mode = waRequest::get('mode', '');
         $view_modes = array(array('action' => '', 'mode' => '', 'url' => 'logs/', 'title' => _w('View files by directory'), 'sort' => 0, 'icon' => 'folders'), array('action' => 'files', 'mode' => 'updatetime', 'url' => 'logs/?action=files&mode=updatetime', 'title' => _w('Sort files by update time'), 'sort' => 1, 'icon' => 'bytime'), array('action' => 'files', 'mode' => 'size', 'url' => 'logs/?action=files&mode=size', 'title' => _w('Sort files by size'), 'sort' => 2, 'icon' => 'bysize'));
         foreach ($view_modes as &$view_mode) {
             $view_mode['selected'] = $view_mode['action'] == $action && $view_mode['mode'] == $mode;
         }
         usort($view_modes, create_function('$a, $b', 'if ($a["selected"] != $b["selected"]) {
                 return $b["selected"] ? 1 : -1;
             } else {
                 return $a["sort"] < $b["sort"] ? -1 : 1;
             }'));
         $this->view->assign('view_modes', $view_modes);
         $this->view->assign('total_size', logsHelper::getTotalLogsSize());
     }
 }
コード例 #7
0
 public function execute()
 {
     $deleted = false;
     if ($this->getRights('delete_files')) {
         $path = waRequest::post('path');
         if ($path) {
             $full_path = logsHelper::getAbsolutePath($path);
             if (!is_dir($full_path)) {
                 $available = logsHelper::checkPath($full_path, false);
                 if ($available) {
                     $deleted = waFiles::delete($full_path);
                 }
             }
         }
     }
     if ($deleted) {
         $update_total_size = waRequest::get('update_size', 0, waRequest::TYPE_INT) == 1;
         $this->response['total_size'] = $update_total_size ? logsHelper::getTotalLogsSize() : '';
     } else {
         $this->errors[] = _wp('File cannot be deleted');
     }
 }