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()); } }
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'); } }