public function initialize() { $conf = SomeFactory::getConfiguration(); # # start session here # $session = SomeFactory::getSession(); # # session started, create default user # $user = SomeFactory::getUser(); # # language selection # $this->setLanguage(); # # template= url parameter? # $template = SomeRequest::getCmd('template', ''); $this->setTemplate($template); // does session has sysmessage? if ($session->get('sysmessage')) { $this->sysmessage = $session->get('sysmessage'); $session->clear('sysmessage'); } }
function tables() { $view = SomeRequest::getCmd('view', 'edit'); $model = $this->getModel($view); $view = $this->getView($view); $view->setModel($model); $view->display(); }
public function install() { $table = SomeRequest::getCmd('table'); if ($table == 'someuser') { $this->installSomeUserTable(); } else { if ($table == 'somesession') { $this->installSomeSessionTable(); } } }
protected function changeRole() { $id = SomeRequest::getInt('id', 0); if ($id) { $ur = SomeRequest::getCmd('newrole'); $user = new SomeUser(); $user->setId($id); $user->read(); $user->setUserrole($ur); $user->update(); } }
function display() { // if the user is logged in, then it is sort of wrong to show register form... $user = SomeFactory::getUser(); if ($user->getId()) { $app = SomeFactory::getApplication(); $app->redirect("index.php?app=hops"); } else { $view = SomeRequest::getCmd('view', 'login'); $model = $this->getModel('default'); $view = $this->getView($view); $tmpl = SomeRequest::getVar('tmpl', 'default'); $view->setModel($model); $view->display($tmpl); } }
/** * * @return void */ public function execute() { $this->loadLanguage(); //get the view parameter from request. If there is method that has the name of the value, call it. //default call is display. $view = SomeRequest::getCmd('view', null); $action = SomeRequest::getCmd('action', null); // action is alias for view, when the view is not set // if view is set, action is just extension argument if ($view === null && $action !== null) { $view = $action; } $methods = get_class_methods($this); if (in_array($view, $methods)) { $this->{$view}(); } else { $this->display(); } }
<?php defined('SOME_PATH') or die('Unauthorized access'); //// //// MUST BE ADMIN TO ACCESS HERE! //// /* $user = SomeFactory::getUser(); if ($user->getUserrole() != 'admin') { $app = SomeFactory::getApplication(); $app->redirect('index.php?app=login', SomeText::_('MUST LOGIN AS ADMIN')); exit; } */ someloader('some.application.controller'); if (!defined('PATH_CONTENT')) { define('PATH_CONTENT', dirname(__FILE__)); } $cntrparam = SomeRequest::getCmd('cntr', 'default'); $cntrlclass = 'SomeController' . ucfirst($cntrparam); include PATH_CONTENT . DS . 'controller' . DS . $cntrparam . '.php'; // default or install controller. $controller = new $cntrlclass(); $controller->execute();