public function log() { // auth Auth::isAdminAuthorized($this->signedUser, 'admin.tools.log', true, '/tools'); $delete = Converter::bool('delete'); $code = Converter::int('code'); $id = Converter::int('id', 'get'); $deleteUrl = $code != 0 ? '?code=' . $code . '&delete=true' : '?delete=true'; if ($delete) { Auth::isAdminAuthorized($this->signedUser, 'admin.tools.log.edit', true, '/tools'); \Rebond\Core\Log\Data::clear($code); Session::adminSuccess('logClear', '/tools/log'); } if ($id != 0) { $log = \Rebond\Core\Log\Data::loadById($id); if (isset($log)) { // view $this->setTpl(); $formLog = new \Rebond\Core\Log\Form($log); // main $tplMain = new Template(Template::MODULE, ['core', 'log']); $tplMain->set('item', $formLog); // layout $this->tplLayout->set('column1', $tplMain->render('view')); // master $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col')); return $this->tplMaster->render('tpl-default'); } } $options = []; $options['order'][] = 'log.modified_date DESC'; if ($code != 0) { $options['where'][] = ['log.code = ?', $code]; } $options['limit'][] = 200; $logs = \Rebond\Core\Log\Data::loadAll($options); // view $this->setTpl(); // filter $tplFilter = new Template(Template::MODULE, ['core', 'log']); $tplFilter->set('count', count($logs)); $tplFilter->set('list', \Rebond\Util\Error::errorCodes()); $tplFilter->set('code', $code); $tplFilter->set('deleteUrl', '/tools/log/' . $deleteUrl); // main $tplMain = new Template(Template::MODULE, ['core', 'log']); $tplMain->set('items', $logs); // layout $this->tplLayout->set('column1', $tplFilter->render('filter')); $this->tplLayout->set('column2', $tplMain->render('listing')); // master $this->tplMaster->set('layout', $this->tplLayout->render('layout-2-row')); $this->tplMaster->set('jsLauncher', 'toolsLog'); return $this->tplMaster->render('tpl-default'); }
public function detail() { if (!$this->app->isDebug()) { return self::generic(); } $logId = Util\Converter::toInt('id'); if ($logId == 0) { return self::generic(); } $log = \Rebond\Core\Log\Data::loadById($logId); if (!isset($log)) { return self::generic(); } $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; // main $tpl = new Util\Template(Util\Template::MODULE, ['app', 'error']); $tpl->set('log', $log); $tpl->set('referer', $referer); $tpl->set('adminUrl', \Rebond\Config::getPath('adminUrl')); return $tpl->render('detail'); }
public function detail() { $this->setBaseTpl(); // auth Auth::isAdminAuthorized($this->signedUser, null, true, '/profile/sign-in'); $logId = Converter::int('id'); if ($logId == 0) { return $this->generic(); } if ($this->app->logLevel() == 1) { return $this->generic(); } $log = \Rebond\Core\Log\Data::loadById($logId); if (!isset($log)) { return $this->generic(); } $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; // main $this->tplMain->set('log', $log); $this->tplMain->set('referer', $referer); // layout $this->tplLayout->set('column1', $this->tplMain->render('detail')); // master $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col')); return $this->tplMaster->render('tpl-error'); }