/** * Method called after the module has been setup, but before the action * is executed. * @param Context $context */ function controllerStart($context) { if (!$this->config['enabled']) { return; } #Execute this only when it is a page controller and not when #it is a block, layout or some other type of controller if ($context->getType() != 'controller') { return; } #Put the action in lowercase to avoid it not being detected due to case $action = strtolower($context->getAction()); #Checks for user credentials and executes in case they are not valid if (!$this->isAuthorized($action)) { $this->callDenyFunction($action); $view_type = $context->getViewType(); switch ($view_type) { case 'html': case 'process': case 'mail': $this->loginRedirect(); break; case 'json': case 'feed': default: exit; } exit; } $this->started = true; }
final function __construct(Context $context) { parent::__construct($this->driver_name); $this->load = new Loader($context); $this->db = new DatabaseProxy($this->load); $this->session = new Session($context->getModule()); $this->plugin = $this->load->service('plugin'); $this->table_name = strtolower($context->getAction()); $this->id_column = $this->table_name . '_id'; }