/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'self': if ($this->s->element !== $this->s->user->username) { Error::addError('Fehler: Dein Benutzername stimmt nicht mit dem des Formularaufrufs überein!'); break; } case 'update': $user = User::getInstance($this->s->element); $content = $this->getUserForm($user); break; case 'create': $content = $this->getUserForm(); break; case 'list': $content = $this->listUsers(); break; case 'delete': $user = User::getInstance($this->s->element); $content = 'Möchtest du den Benutzer <strong>' . $user->realname . '</strong> wirklich löschen?<input type="hidden" value="form/user/delete/' . $this->s->element . '.html" />'; break; case 'logout': session_destroy(); $this->s->user = ''; Error::addMessage('Du hast dich erfolgreich abgemeldet. Auf Wiedersehen!'); break; case 'login': default: break; } parent::buildSite($content); }
public function __construct() { parent::__construct(); if (!in_array($this->loginUserInfo['username'], array('aozhongxu'))) { $this->renderError('你没有权限访问!'); } }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'update': case 'send': case 'reply': $content = $this->getForm(); break; case 'list': $tpl = new Template('message'); $m = $this->listMessages(); if ($m !== false) { $tpl->assign('messages', $m['messages']); $tpl->assign('current', $m['current']); $tpl->assign('read', $m['read']); $tpl->assign('user', $this->s->user); $content = $tpl->fetch('messages.html'); } else { $content = '<h2>Keine Nachrichten vorhanden!</h2>'; } break; case 'show': $tpl = new Template('message'); $tpl->assign('m', Message::getInstance($this->s->element)); $tpl->assign('user', $this->s->user); $content = $tpl->fetch('message.html'); break; case 'delete': $m = Message::getInstance($this->s->element); $content = 'Soll die Nachricht <strong>„' . $m->subject . '“</strong> wirklich gelöscht werden?<input type="hidden" value="form/message/delete/' . $this->s->element . '.html" />'; break; } parent::buildSite($content); }
public function __construct() { parent::__construct(); $this->load->model('ShopModel', 'shopModel'); // 删除所有的缓存 $this->shopModel->deleteShopCache(); }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'info': $site = $this->s->getConfig('site'); $site['modules']['all'] = Module::getNumber(); $site['modules']['active'] = Module::getNumber(true); $site['users'] = User::getNumber(true); $db = DB::getInstance(); $server = array('type' => $_SERVER['SERVER_SOFTWARE'], 'php' => array('version' => phpversion(), 'safe_mode' => ini_get('safe_mode'), 'magic_quotes_gpc' => ini_get('magic_quotes_gpc'), 'magic_quotes_runtime' => ini_get('magic_quotes_runtime'), 'gpc_order' => ini_get('gpc_order'), 'memory_limit' => ini_get('memory_limit'), 'max_execution_time' => ini_get('max_execution_time'), 'disable_functions' => ini_get('disable_functions'), 'sql_safe_mode' => ini_get('sql.safe_mode'), 'include_path' => ini_get('include_path')), 'gd' => $this->getPhpModuleInfo('gd'), 'db' => $db->info()); $file = 'CHANGELOG.txt'; $changelog = is_readable($file) ? file_get_contents($file) : false; $file = 'logs/error.log'; $errorlog = is_readable($file) ? file_get_contents($file) : false; if ($errorlog == '') { $errorlog = 'Errorlog ist leer!'; } $tpl = new Template('system'); $tpl->assign('chispa', $this->s->getConfig('chispa')); $tpl->assign('site', $site); $tpl->assign('server', $server); $tpl->assign('changelog', $changelog); $tpl->assign('errorlog', $errorlog); $content = $tpl->fetch('info.html'); break; } parent::buildSite($content); }
public static function slugAlias($data, $title = 'title', $slug = 'slug') { if (!empty($data[$slug])) { return BackendController::stripUnicode($data[$slug]); } else { return BackendController::stripUnicode($data[$title]); } }
public function beforeAction($action) { parent::beforeAction($action); if(!$this->companyId) { Yii::app()->user->setFlash('error' , '请选择公司'); $this->redirect(array('company/index')); } return true; }
function __construct() { parent::__construct(); $this->load->database(); $this->load->library(array('ion_auth', 'form_validation')); $this->load->helper(array('url', 'language')); $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth')); $this->lang->load('auth'); }
public function beforeAction($action) { parent::beforeAction($action); if (!$this->companyId && $this->getAction()->getId() != 'upload') { Yii::app()->user->setFlash('error', yii::t('app', '请选择公司')); $this->redirect(array('company/index')); } return true; }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'list': $content = $this->listModules(); break; } parent::buildSite($content); }
/** * Prepare controller */ function __before() { parent::__before(); $this->wireframe->tabs->clear(); $this->wireframe->tabs->add('calendar', lang('Timer'), TimerModule::getTimerRoute(), null, true); // Custom event EventsManager::trigger('on_timer_tabs', array(&$this->wireframe->tabs, &$this->logged_user)); // set wireframe $this->wireframe->breadcrumbs->add('timer', lang('Timer'), TimerModule::getTimerRoute()); $this->wireframe->setCurrentMenuItem('timer'); $this->wireframe->actions->clear(); // assign template variable $this->smarty->assign('api_url', ROOT_URL . '/api.php?format=json&auth_api_token=1-HQVcG1x3xfSNIMypMkDsAVT8W670QwGwhI387Tta'); $this->smarty->assign('user_id', ROOT_URL . '1'); }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'delete': $group = Group::getInstance($this->s->element); $content = 'Möchtest du die Gruppe <strong>' . $group->name . '</strong> wirklich löschen?<input type="hidden" value="form/group/delete/' . $this->s->element . '.html" />'; break; case 'list': $content = $this->listGroups(); break; case 'create': $content = $this->getGroupForm(); break; } parent::buildSite($content); }
public function __construct() { parent::__construct(); $menuArr = array(); foreach (DocVars::$CATEGORY as $i => $title) { $menuItem = array('title' => $title, 'url' => '/list/' . $i . '/'); $menuArr[] = $menuItem; if ($menuItem['url'] == Url::getPath()) { $this->backendMenuInfo = $menuItem; $this->backendMenuInfo['parent_title'] = $this->backendMenuList['category']['title']; $this->backendMenuInfo['parent_code'] = Arr::get('code', $this->backendMenuList['category'], ''); } } $this->backendMenuList['category']['menu'] = $menuArr; $this->view->assign(array('backendMenuList' => $this->backendMenuList, 'backendMenuInfo' => $this->backendMenuInfo)); }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'list': $content = $this->listTables(); break; case 'create': case 'update': $content = $this->getForm($this->s->params[0]); break; case 'delete': $content = 'Soll dieser Pokertisch wirklich gelöscht werden?<input type="hidden" value="form/poker/poker_table-delete/' . $this->s->element . '" />'; break; } parent::buildSite($content); }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'show': //$content = '<h3>Es gibt auch wieder eine neue <a href="files/pdf/babel_handbuch.pdf">Anleitung für den Belegungskalender</a>!</h3>'; $hooks = $this->addHook('Blackboard'); foreach ($hooks as $hook) { $elem = $hook->hookBlackboard(); $elems['priorities'][] = $elem['priority'] != '' ? $elem['priority'] : 1000; $elems['content'][] = $elem; } if (is_array($elems['priorities'])) { array_multisort($elems['priorities'], SORT_NUMERIC, SORT_ASC, $elems['content']); foreach ($elems['content'] as $e) { $content .= '<div id="bb_' . $e['id'] . '">' . $e['content'] . '</div>'; } } break; } parent::buildSite($content); }
public function __construct() { parent::__construct(); $this->load->model('CouponCodeModel', 'couponCodeModel'); }
function __construct($module = NULL) { $layout = "layout.default"; parent::__construct($module, $layout); }
/** * Make the most basic decision about what to do in the backend. */ public final function handleRequest() { $right = $this->right(); if ($this->s->area == "form") { // check if form submitted if (empty(Error::$messages)) { // execute requested action $result = $this->handleForm(); } // error occured while processing the form data? if ($result === false || !empty(Error::$messages)) { if ($this->s->post['call'] == 'ajax') { // form submitted via ajax -> return JSON object $ret['messages'] = !empty(Error::$messages) ? Error::$messages : array('error' => array('Unbekannter Fehler')); if (count($this->form['errors']) > 0) { $ret['fields'] = $this->form['errors']; } if (count($this->form['reload']) > 0) { $ret['reload'] = $this->form['reload']; } if (count($this->form['dialog']) > 0) { $ret['dialog'] = $this->form['dialog']; } echo FastJSON::encode($ret); } elseif ($this->s->post['call'] == 'load') { // ajax load() -> return string with messages if (!empty(Error::$messages)) { foreach (Error::$messages as $texts) { foreach ($texts as $msg) { $message .= '<p>' . $msg . '</p>'; } } echo $message; } } elseif ($this->s->post['call'] == 'load_text') { // ajax load() for form field -> return string with messages if (!empty(Error::$messages)) { $message = "Fehler:\r\n"; foreach (Error::$messages as $texts) { foreach ($texts as $msg) { $message .= '– ' . $msg . "\r\n"; } } echo $message; } } else { // form submitted normal -> display form + error message(s) $this->s->resetParams(); $this->buildSite(); } } else { if ($this->s->post['call'] == 'ajax') { // form submitted via ajax -> return JSON object $ret = array(); if (count($this->form['reload']) > 0) { $ret['reload'] = $this->form['reload']; } if (count($this->form['autocomplete']) > 0) { $ret = $this->form['autocomplete']; } if (count($this->form['dialog']) > 0) { $ret['dialog'] = $this->form['dialog']; } echo FastJSON::encode($ret); } elseif ($this->s->post['call'] != 'load' && $this->s->post['call'] != 'load_text') { // form submitted normal -> display target site $this->s->resetParams(); $this->buildSite(); } } } elseif (!$this->s->auth()) { // check if user is logged in BackendController::buildSite(); } elseif (!$this->s->user->hasRights($this->s->controller . ':' . $right) && array_key_exists($right, $this->registerRights())) { // check if action is allowed for the user Error::addError('Du besitzt nicht die erforderlichen Rechte, um die Aktion ' . $action . ' auszuführen!'); BackendController::buildSite(); } else { // normal behaviour: generate the requested backend site $this->buildSite(); } }
public function __construct() { parent::__construct(); $this->load->model('BackupModel', 'backupModel'); }
public function init() { parent::init(); $this->_table = 'users'; }
public function __construct() { parent::__construct(); $this->load->model('ProjectModel', 'projectModel'); $this->projectModel->deleteProjectsCache(); }
/** * Build site content depending on requested action. */ protected function buildSite() { switch ($this->s->action) { case 'debug': $range = '99+, AQs+, 74s-73s, Th6h, Tc6c, Qh5h, 9s5s, 9c5c, Qh4h, 9d4d, 9h4h, 8s4s, 8c4c, 8d3d, 8h3h, Kc2c, 4d2d, 4s2s, AQo+, Ad4s, Ah4s, As4d, As4h, As4c, Ac4s, Ad3c, Ah3c, As3c, Ac3d, Ac3h, Ac3s, Ad2h, Ad2s, Ad2c, Ah2d, As2d, Ac2d, Jd7s, Jh7s, Js7d, Js7h, 9d6s, 9h6s, 9s6d, 9s6h, 8d6c, 8h6d, 8s6h, 8c6d, 7h5d, 7h5c, 7s5c, 7c5s, 6d5s, 6h5s, 6s5d, 6c5d'; $content = '<h2>' . $range . '</h2>'; $range = explode(',', $range); $objDeck = new PokerDeck(); $objDeck->shuffle(); $range = new PokerRange($range, $objDeck); $cards = $range->getRandomPair(); $content .= '<p>Expanded: ' . implode(', ', $range->range) . '</p>'; $content .= '<p>Pairs: ' . implode(', ', $range->pairs) . '</p>'; $content .= '<p>Cards: ' . $cards[0]->shortname() . ' / ' . $cards[1]->shortname() . '</p>'; parent::buildSite($content); break; case 'play': $tpl = new Template('poker'); $tables = PokerTable::getAll(); foreach ($tables as $key => $table) { $table->active = PokerPlayer::getActivePlayer($key) !== FALSE ? TRUE : FALSE; $table->free = $table->seats - count($table->players); } if (count($tables) == 0) { $content = '<h2>Keine Pokertische vorhanden. <a href="poker/poker_table-list">Pokertisch anlegen</a>?</h2>'; } else { $tpl->assign('tables', $tables); $tpl->assign('current', ''); //current($tables)); $content = $tpl->fetch('games.html'); } parent::buildSite($content); break; case 'show': if ($this->s->params[0] != '') { $tpl = new Template('poker'); $tpl->assign('idtable', $this->s->params[0]); $content = $tpl->fetch('game.html'); } else { $content = 'Es wurde kein Pokertisch ausgewählt, der angezeigt werden könnte!'; } parent::buildSite($content, true); break; case 'save': if ($this->s->params[0] == 'table' && $this->s->params[2] != 0) { $new_actions = PokerTable::getTableActions($this->s->params[2], $this->s->params[1]); $actions = $this->getActionLog($new_actions); } elseif (is_array($this->s->post['games'])) { $actions = array(); foreach ($this->s->post['games'] as $key => $idgame) { $game = Poker::getInstance($idgame); $actions = array_merge($actions, $this->getActionLog($game->actions)); } } if (is_array($actions)) { header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: text/plain; charset=utf-8"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=poker_log.txt"); header("Content-Transfer-Encoding: binary"); foreach ($actions as $key => $value) { echo $value . "\r\n"; } } break; case 'archive': if ($this->s->params[0] == '') { $table = FALSE; $content = '<h2>Spiele für ' . $this->s->user->realname . '</h2><h3>Um die Liste der Spiele auf einem bestimmten Tisch anzuzeigen, wähle „Spiele anzeigen“ in der <a href="poker/poker_table-list">Liste der Tische</a> aus.</h3>'; } else { $table = PokerTable::getInstance($this->s->params[0]); $content = '<h2>Spiele am Tisch „' . $table->title . '“.</h2>'; } $content .= $this->listGames($table); parent::buildSite($content); break; } }
public function __construct() { parent::__construct(); $this->sliderModel = new SliderModel(); }
public function init() { $this->_table = 'category'; parent::init(); }
public function __construct() { parent::__construct(); $this->model = new ProductsModel(); }
/** * Rules for CAccessControlFilter. * * We enable the registration and other basic pages for guest users. * * @see http://www.yiiframework.com/doc/api/1.1/CController#accessRules-detail * * @return array Rules for the "accessControl" filter. */ public function accessRules() { return array_merge([['allow', 'actions' => ['index', 'login', 'logout', 'captcha', 'error']]], parent::accessRules()); }
public function __construct() { parent::__construct(); $this->load->model('CategoryModel', 'categoryModel'); $this->categoryModel->deleteCacheCategories(); }
public function __construct() { parent::__construct(); Asset::add('document-js', URL::to('media/backend/js/document.js')); }
public function __construct() { parent::__construct(); $this->load->model('CustomerModel', 'customerModel'); }
public function __construct() { parent::__construct(); $this->model = new UserModel(); }