public function authenticate() { if ($this->data->datasource == '') { $this->data->datasource = 'fnapolo'; //$this->renderPrompt('error', 'Inform database name.'); } Manager::setConf('fnbr20.db', $this->data->datasource); Manager::getSession()->fnbr20db = $this->data->datasource; $auth = Manager::getAuth(); $this->data->result = $auth->authenticate($this->data->user, $this->data->challenge, $this->data->response); if ($this->data->result) { $user = Manager::getLogin()->getUser(); $this->data->idLanguage = $user->getConfigData('fnbr20IdLanguage'); if ($this->data->idLanguage == '') { $this->data->idLanguage = 1; $user->setConfigData('fnbr20IdLanguage', $this->data->idLanguage); } if ($this->data->ifLanguage == '') { $this->data->ifLanguage = 'en'; //$this->renderPrompt('error', 'Inform language.'); } Manager::getSession()->idLanguage = $this->data->idLanguage; Manager::getSession()->lang = $this->data->ifLanguage; Manager::getSession()->fnbr20Level = $user->getUserLevel(); $this->redirect(Manager::getURL('fnbr20/main')); } else { $this->renderPrompt('error', 'Login or password not valid.'); } }
private static function getHrefAction($href) { $app = Manager::getApp(); $re = '#^(\\/?)' . $app . '\\/#'; if (preg_match($re, $href)) { $href = preg_replace($re, '', $href); } return Manager::getURL($href); }
public function ajaxMultiplo() { $pessoa = new models\Pessoa(); $this->data->multiplo1 = Manager::getURL('ajax/ajaxMultiplo1'); $this->data->multiplo2 = Manager::getURL('ajax/ajaxMultiplo2'); $this->data->multiplo3 = Manager::getURL('ajax/ajaxMultiplo3'); $this->data->multiplo4 = Manager::getURL('ajax/ajaxMultiplo4'); $this->render(); }
public function authenticate() { $auth = Manager::getAuth(); $this->data->result = $auth->authenticate($this->data->user, $this->data->challenge, $this->data->response); if ($this->data->result) { mdump("++++++++++++"); $this->redirect(Manager::getURL('dlivro/main')); } else { $this->renderPrompt('error', 'Login ou senha inválidos. Tente novamente.'); } }
public function preProcess() { $frontController = $this->frontController; // exemplo de alteração da configuração dependendo do controller sendo executado $context = $frontController->getContext(); $controller = $context->getController(); if ($controller == 'controls') { Manager::setConf('session.check', false); } // é necessário validar a sessão? if (Manager::getConf('login.check') || Manager::getConf('session.check')) { $timeout = Manager::getSession()->checkTimeout(Manager::getConf('session.exception')); } if ($timeout) { $frontController->canCallHandler(false); $url = Manager::getURL(Manager::getApp() . '/main'); $frontController->setResult(new MRedirect(NULL, $url)); } }
public function checkAccess($transaction, $access, $deny = false) { //mdump($transaction); //mdump('--------------------'); //mdump($access); $module = Manager::getModule(); $ok = false; if (!is_numeric($access)) { $access = $this->access[$access]; } if ($this->auth->isLogged()) { $login = $this->auth->getLogin(); // MLogin object $transaction = strtoupper($transaction); // Transaction name $isAdmin = $login->isAdmin(); // Is administrator? $rights = (int) $login->getRights($transaction); // user rights $rightsInAll = (int) $login->getRights('ALL'); // user rights in all transactions $ok = ($rights & $access) == $access || ($rightsInAll & $access) == $access || $isAdmin; if (!$ok && $deny) { $msg = _M('Acesso Negado') . "<br><br>\n" . "<center><big><i><font color=red>" . _M('Transação: ') . "{$transaction}</font></i></big></center><br><br>\n" . _M('Informe um login válido para acessar esta página.') . "<br>"; //$go = Manager::getCurrentURL(); //$error = MPrompt::error($msg, $go, $caption, ''); //Manager::prompt($error, $deny); throw new ESecurityException($msg); } } else { if ($deny) { $currentUrl = urlencode(Manager::getCurrentURL()); $module = Manager::getConf('login.module'); $url = Manager::getURL("{$module}/main.login", array('return_to' => $currentUrl)); Manager::getPage()->redirect($url); } } return $ok; }
public function generateAjax() { if (count($this->ajax)) { foreach ($this->ajax as $ajax) { $url = Manager::getURL($ajax->url); if ($ajax->type == 'text') { $ajaxCmd = "manager.doAjaxText(\"{$url}\",\"{$ajax->load}\", \"{$this->id}\");"; } else { $this->page->addDojoRequire('dojo.data.ItemFileReadStore'); if ($ajax->event == "onSelectionChange") { $ajax->event = "change"; $ajax->load = "function(result){manager.byId(result.data.ajaxReturn.control).reset();manager.byId(result.data.ajaxReturn.control).set(\"store\",new dojo.data.ItemFileReadStore({data:result.data.ajaxReturn}));manager.page.clearBusy();}"; } $ajaxCmd = "manager.doAjax(\"{$url}\",{$ajax->load}, \"{$this->id}\");"; } $this->addEvent($ajax->event, $ajaxCmd, $ajax->preventDefault, $ajax->dijit); } } }
public static function setHREF($id, $href) { $href = Manager::getURL($href); return "manager.byId(\"{$id}\").set(\"href\",\"{$href}\");"; }
public function formBackgroundExecute() { $this->data->background = Manager::getURL('diversos/background'); $this->render(); }
public function getURL($action = '', $oid = '', $args = array()) { return Manager::getURL(($this->module ? $this->module . "/" : '') . "{$this->getController()->getName()}/{$action}/{$oid}", $args); }