Inheritance: extends Zend_Controller_Action
Exemple #1
0
 private function callLoginAction($module = 'default')
 {
     Session::delete('user');
     require_once MODULE_PATH . $module . DS . 'controllers' . DS . 'IndexController.php';
     $indexController = new IndexController($this->_params);
     $indexController->loginAction();
 }
Exemple #2
0
 function BaseController()
 {
     $index = new IndexController();
     if (!$index->verificarSessaoAtiva()) {
         $index->expirarSessao();
     } else {
         $index->atualizarSessao();
     }
 }
 public function guardarProveedores()
 {
     $roviIndexController = new IndexController();
     $array = $roviIndexController->darProveedoresServicio();
     foreach ($array as $key => $value) {
         $value['Pais_idPais'] = "1";
         //id  de colombia
         Aplication::insert("Proveedor_Servicio", $value);
         $this->guardarCanalesProveedor($value['idProveedor_Servicio']);
     }
 }
Exemple #4
0
 public function route()
 {
     global $module;
     global $config;
     if ($module == null) {
         $urlData = isset($_GET["url"]) ? explode("/", $_GET["url"]) : null;
         $param = null;
         $cnt = count($urlData);
         $controller = "IndexController";
         $action = "Index";
         $param = null;
         if ($cnt == 1) {
             $controller = isset($config["defaultController"]) ? $config["defaultController"] : "IndexController";
             $action = $urlData[0];
         } elseif ($cnt > 0) {
             $controller = ucfirst($urlData[0]) . "Controller";
             if (isset($urlData[1])) {
                 $action = $urlData[1];
             }
             if (isset($urlData[2])) {
                 $param = trim($urlData[2]);
             }
         }
     } else {
         $urlData = isset($_GET["url"]) ? explode("/", $_GET["url"]) : null;
         $param = null;
         $cnt = count($urlData);
         $controller = "IndexController";
         $action = "Index";
         $param = null;
         if ($cnt > 1) {
             $controller = ucfirst($urlData[1]) . "Controller";
             if (isset($urlData[2])) {
                 $action = $urlData[2];
             }
             if (isset($urlData[3])) {
                 $param = trim($urlData[3]);
             }
         }
     }
     try {
         $app = new $controller();
         if ($app instanceof Controller) {
             if (method_exists($controller, $action)) {
                 $app->{$action}($param);
             } else {
                 // Not Found
             }
         }
     } catch (Exception $e) {
         $app = new IndexController();
         $app->NotFound();
     }
 }
 public function _empty($action)
 {
     $resource = strtolower(CONTROLLER_NAME);
     $this->assign('type', $resource);
     if (in_array($resource, array('text', 'picture', 'music', 'video'))) {
         if (in_array($action, array('new', 'edit'))) {
             if ('edit' == $action) {
                 $id = intval(I('id'));
                 if ($post = M('post')->find($id)) {
                     $this->assign('post', $post);
                 } else {
                     $this->error('错误的记录');
                 }
             }
             $this->display('Post/' . $resource);
         } else {
             $this->error('错误的请求');
         }
     } else {
         switch (strtolower(CONTROLLER_NAME)) {
             case 'post':
                 echo 'post';
                 die;
                 $Index = new IndexController();
                 $Index->detail(ACTION_NAME);
                 break;
             case 'search':
                 $Index = new IndexController();
                 $Index->search();
                 break;
             case 'feed':
                 $type = I('get.type');
                 $this->feed($type);
                 break;
             case 'mine':
                 if (!is_login()) {
                     $this->error('尚未登录,请登录后再访问', "User/login");
                 }
                 $Index = new IndexController();
                 $Index->mine();
                 break;
             default:
                 $Index = new IndexController();
                 if (is_numeric(CONTROLLER_NAME) && is_numeric(ACTION_NAME)) {
                     $Index->archive(CONTROLLER_NAME, ACTION_NAME);
                 } else {
                     $this->error('错误的请求');
                 }
                 break;
         }
     }
 }
Exemple #6
0
 function __construct()
 {
     $url = isset($_GET['url']) ? $_GET['url'] : null;
     $url = rtrim($url, '/');
     $url = filter_var($url, FILTER_SANITIZE_URL);
     $url = explode('/', $_GET['url']);
     if (empty($url[0])) {
         require 'app/controllers/index_controller.php';
         $controller = new IndexController();
         $controller->index();
         return false;
     } else {
         $controller = $url[0];
     }
     $file = 'app/controllers/' . $url[0] . '_controller.php';
     if (file_exists($file)) {
         require $file;
         $controller_class = ucfirst($controller) . 'Controller';
         $controller = new $controller_class();
         $controller->loadModel($url[0]);
         if (!$url[1]) {
             $controller->index();
             return false;
             // Check back on this!
         }
     } else {
         require 'app/controllers/error_controller.php';
         $controller = new ErrorController();
         $controller->notfound();
         exit;
     }
     if (isset($url[2])) {
         $arg = $url[2];
     } else {
         $arg = '';
     }
     if (isset($url[1])) {
         if (method_exists($controller, $url[1])) {
             $action = $url[1];
             if (empty($arg)) {
                 $controller->{$action}();
             } else {
                 $controller->{$action}($arg);
             }
         } else {
             require 'app/controllers/error_controller.php';
             $controller = new ErrorController();
             $controller->notfound();
             exit;
         }
     }
 }
Exemple #7
0
 public function indexAction()
 {
     $index = new IndexController();
     if (!$index->verificarSessaoAtiva()) {
         $index->expirarSessao();
     } else {
         $index->atualizarSessao();
         $connection = Databases::connect();
         $dados = $this->carregarDadosListar($connection);
         Databases::disconnect($connection);
         $this->exibirTelaListar($dados);
     }
 }
 public function dispatch()
 {
     require_once "dispatch-point.php";
     $params = $_GET['page'];
     switch ($params) {
         case 'check-point':
             $controllerInstance = new CheckPointController();
             break;
         default:
             $controllerInstance = new IndexController();
             break;
     }
     $controllerInstance->action();
 }
Exemple #9
0
 public function run()
 {
     // Получить строку запроса
     $uri = $this->getUri();
     if ($uri == '') {
         include_once ROOT . '/controllers/IndexController.php';
         $controllerObject = new IndexController();
         $controllerObject->render();
     } else {
         // Проверить наличие такого запроса в routes.php
         foreach ($this->routes as $uriPattern => $path) {
             // Сравниваем $uriPattern и $uri
             if (preg_match("~{$uriPattern}~", $uri)) {
                 // Получаем внутренний путь из внешнего согласно правилу
                 $internalRoute = preg_replace("~{$uriPattern}~", $path, $uri);
                 // Определить контроллер, action, параметры
                 $segments = explode('/', $internalRoute);
                 $controllerName = array_shift($segments) . 'Controller';
                 $controllerName = ucfirst($controllerName);
                 $actionName = array_shift($segments);
                 $parameters = array_shift($segments);
                 // Подключить файл класса-контроллера
                 $controllerFile = ROOT . '/controllers/' . $controllerName . '.php';
                 if (file_exists($controllerFile)) {
                     include_once $controllerFile;
                 }
                 //Создать объект, вызвать метод (action)
                 $controllerObject = new $controllerName();
                 $controllerObject->{$actionName}($parameters);
                 //$result = call_user_func_array(array($controllerObject, $actionName), $parameters);
                 //$controllerObject->$actionName($parameters);
                 break;
                 // if ($result != null) {
                 // 	break;
                 // }
             }
         }
     }
     // if (!isset($controllerObject)){
     // 	$controllerName = "Controller404";
     // 	$actionName = "action_404";
     // 	$controllerFile = ROOT.'/controllers/'.$controllerName.'.php';
     // 	if (file_exists($controllerFile)) {
     // 		include_once($controllerFile);
     // 	}
     // 	$controllerObject = new $controllerName;
     // 	$result = $controllerObject->$actionName();
     // }
 }
 public function __construct()
 {
     parent::__construct();
     $this->model_shop = D("Shop");
     $this->model_cat = D('ShopCat');
     $this->assign('bannerpic', 1);
 }
Exemple #11
0
 public function getProgramList($lang = false, $category = false, $offset = 0)
 {
     $programList = array();
     $bindParams = array();
     if (empty($lang) && empty($category)) {
         IndexController::$isHomePage = true;
     }
     $pidCol = ProgramDetails_DBTable::PROGRAM_ID;
     $langCol = ProgramDetails_DBTable::FK_LANGUAGE_ID;
     $cateCol = ProgramDetails_DBTable::FK_CATEGORY_ID;
     $limit = UserPreferencesController::get(PreferenceKeys::PAGINATOR_LIMIT);
     $limit = empty($limit) ? Constants::PAGINATOR_LIMIT : $limit;
     $totalRecordCount = (new ProgramDetailsController())->getAllRecordCount();
     $this->processPaginator($offset, $limit, $totalRecordCount);
     $query = 'SELECT ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.*,' . Users_DBTable::DB_TABLE_NAME . '.' . Users_DBTable::USER_NAME . ' AS created_by,' . Category_DBTable::DB_TABLE_NAME . '.' . Category_DBTable::CATEGORY_NAME . ' AS category_name,' . Language_DBTable::DB_TABLE_NAME . '.' . Language_DBTable::LANGUAGE_NAME . ' AS language_name FROM ' . ProgramDetails_DBTable::DB_TABLE_NAME . ' INNER JOIN ' . Category_DBTable::DB_TABLE_NAME . ' ON ' . Category_DBTable::DB_TABLE_NAME . '.' . Category_DBTable::CATEGORY_ID . ' = ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_CATEGORY_ID . ' INNER JOIN ' . Language_DBTable::DB_TABLE_NAME . ' ON ' . Language_DBTable::DB_TABLE_NAME . '.' . Language_DBTable::LANGUAGE_ID . ' = ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_LANGUAGE_ID . ' INNER JOIN ' . Users_DBTable::DB_TABLE_NAME . ' ON ' . Users_DBTable::DB_TABLE_NAME . '.' . Users_DBTable::USER_ID . ' = ' . ProgramDetails_DBTable::FK_CREATED_BY . ' WHERE ';
     if (!empty($lang)) {
         $bindParams[] = $lang;
         $query .= ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_LANGUAGE_ID . "=? AND ";
         if (!empty($category)) {
             $bindParams[] = $category;
             $query .= ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_CATEGORY_ID . "=? AND ";
         }
     }
     $query .= ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::IS_DELETED . "= '0'";
     if (!empty($offset) && is_numeric($offset)) {
         $query .= ' LIMIT ' . $offset . ', ' . $limit;
     } else {
         $query .= ' LIMIT ' . $limit;
     }
     $resultSet = DBManager::executeQuery($query, $bindParams, true);
     return $resultSet;
 }
Exemple #12
0
 /**
  * Initialize - clear main view
  *
  * @package     las
  * @version     1.0
  */
 public function initialize()
 {
     // Load index Controller initialize first
     parent::initialize();
     // Disable main view, but layout modal exist and is loading
     $this->view->setMainView(null);
 }
 function __construct()
 {
     $strUrl = isset($_GET['url']) ? $_GET['url'] : null;
     $strUrl = rtrim($strUrl, '/');
     $arrUrl = explode('/', $strUrl);
     if (empty($arrUrl[0])) {
         require 'controller/IndexController.php';
         $controller = new IndexController();
         $controller->index();
         return false;
     }
     $strCapitalized = $this->capitalize($arrUrl[0]);
     $strControllerName = $strCapitalized . 'Controller';
     $strModelName = $strCapitalized . 'Model';
     $file = 'controller/' . $strControllerName . '.php';
     if (file_exists($file)) {
         require $file;
     } else {
         require 'controller/ErrorController.php';
         $controller = new ErrorController();
         return false;
     }
     $controller = new $strControllerName();
     $controller->loadModel($strModelName);
     if (isset($arrUrl[2])) {
         if (method_exists($controller, $arrUrl[1])) {
             $controller->{$arrUrl[1]}($arrUrl[2]);
         } else {
             require 'controller/ErrorController.php';
             $controller = new ErrorController();
             return false;
         }
     } else {
         if (isset($arrUrl[1])) {
             if (method_exists($controller, $arrUrl[1])) {
                 $controller->{$arrUrl[1]}();
             } else {
                 require 'controller/ErrorController.php';
                 $controller = new ErrorController();
                 return false;
             }
         }
         /*} else {
         			$controller->index();	
         		}*/
     }
 }
 function __construct()
 {
     if (!is_null(self::$_redis)) {
         return;
     }
     $parameters = array('host' => '127.0.0.1', 'port' => 6379, 'database' => 13);
     self::$_redis = new Predis\Client($parameters);
 }
 public function before()
 {
     if (!Session::has('user')) {
         return View::create('login')->with('loginForm', IndexController::getLoginForm());
     } else {
         $this->user = Session::get('user');
     }
 }
Exemple #16
0
 function __construct()
 {
     $url = isset($_GET["url"]) ? $_GET["url"] : NULL;
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     if (empty($url[0]) || $url[0] == 'index.php') {
         require 'controller/IndexController.php';
         $controller = new IndexController();
         $controller->index();
         return FALSE;
     }
     $file = 'controller/' . $url[0] . 'Controller.php';
     if (file_exists($file)) {
         require $file;
     } else {
         require 'controller/ErrorController.php';
         $error = new ErrorController();
         $error->index();
         return FALSE;
     }
     $controllerFullName = $url[0] . "Controller";
     $controller = new $controllerFullName();
     if (isset($url[2])) {
         if (method_exists($controller, $url[1])) {
             $controller->{$url[1]}($url[2]);
         } else {
             require 'controller/ErrorController.php';
             $error = new ErrorController();
             $error->index();
             return FALSE;
         }
     } else {
         if (isset($url[1])) {
             if (method_exists($controller, $url[1])) {
                 $controller->{$url[1]}();
             } else {
                 require 'controller/ErrorController.php';
                 $error = new ErrorController();
                 $error->index();
                 return FALSE;
             }
         } else {
             $controller->index();
         }
     }
 }
Exemple #17
0
 public function route()
 {
     $request = trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
     $request_arr = explode('/', $request);
     if ($request == '') {
         $controller = new IndexController($this->service);
         $controller->indexAction();
     } elseif ($request == 'basket') {
         $controller = new BasketController($this->service);
         $controller->indexAction();
     } elseif ($request == 'auth') {
         $controller = new AuthController($this->service);
         $controller->indexAction();
     } elseif ($request == 'reg') {
         $controller = new RegController($this->service);
         $controller->indexAction();
     } elseif ($request == 'admin') {
         $controller = new AdminController($this->service);
         $controller->indexAction();
     } elseif ($request == 'admin/additem') {
         $controller = new AdminController($this->service);
         $controller->additemAction();
     } elseif ($request == 'admin/category') {
         $controller = new AdminController($this->service);
         $controller->categoryAction();
     } elseif ($request == 'admin/catalog') {
         $controller = new AdminController($this->service);
         $controller->catalogAction();
     } elseif ($request == 'admin/orders') {
         $controller = new AdminController($this->service);
         $controller->ordersAction();
     } elseif ($request = 'cat/' . $request_arr[1]) {
         $category_mapper = new CategoryMapper($this->service->get('db'));
         if (!$category_mapper->getCategoryFromCode($request_arr[1])) {
             $this->get404();
         } else {
             $controller = new CatController($this->service);
             $controller->categoryAction($request_arr[1]);
         }
     } else {
         $this->get404();
     }
 }
 /**
  * Get the name of the resource being accessed 
  *
  * @return String 
  */
 function getActionforACL()
 {
     $action = strtolower($this->getRequest()->getActionName());
     if ($action == "markasread" || $action == "processmassmail" || $action == "processnotification" || $action == "processreply" || $action == "subscriber" || $action == "invite") {
         return ACTION_VIEW;
     }
     if ($action == "sent" || $action == "sentsearch" || $action == "massmail" || $action == "subscriber" || $action == "invite") {
         return ACTION_LIST;
     }
     return parent::getActionforACL();
 }
 /**
  * Gets the class model of the module and set the parent.
  *
  * @return Phprojekt_Model_Interface An instance of Phprojekt_Model_Interface.
  */
 public function getModelObject()
 {
     $minutesId = (int) $this->getRequest()->getParam('minutesId', 0);
     if ($minutesId == 0) {
         // Try with parentId
         $minutesId = (int) $this->getRequest()->getParam('parentId', 0);
     }
     $object = parent::getModelObject();
     $object->setParent($minutesId);
     return $object;
 }
 /**
  * Returns a list of all the active users.
  *
  * Returns a list of all the users with:
  * <pre>
  *  - id      => id of user.
  *  - display => Display for the user.
  * </pre>
  *
  * The return is in JSON format.
  *
  * @return void
  */
 public function jsonGetUsersAction()
 {
     IndexController::setCurrentProjectId();
     $db = Phprojekt::getInstance()->getDb();
     $where = sprintf('status = %s', $db->quote('A'));
     $user = new Phprojekt_User_User();
     $records = $user->fetchAll($where);
     $data = array();
     foreach ($records as $node) {
         $data['data'][] = array('id' => $node->id, 'display' => $node->displayName);
     }
     Phprojekt_Converter_Json::echoConvert($data, Phprojekt_ModelInformation_Default::ORDERING_LIST);
 }
Exemple #21
0
 /**
  * Returns a list of all the active users.
  *
  * Returns a list of all the users with:
  * <pre>
  *  - id      => id of user.
  *  - display => Display for the user.
  *  - current => True or false if is the current user.
  * </pre>
  *
  * The return is in JSON format.
  *
  * @return void
  */
 public function jsonGetUsersAction()
 {
     IndexController::setCurrentProjectId();
     $db = Phprojekt::getInstance()->getDb();
     $user = Phprojekt_Loader::getLibraryClass('Phprojekt_User_User');
     $records = $user->getAllowedUsers();
     $current = Phprojekt_Auth::getUserId();
     $data = array();
     foreach ($records as $record) {
         $data['data'][] = array('id' => (int) $record['id'], 'display' => $record['name'], 'current' => $current == $record['id']);
     }
     Phprojekt_Converter_Json::echoConvert($data, Phprojekt_ModelInformation_Default::ORDERING_LIST);
 }
 /**
  * Returns the list of items for one model.
  *
  * The return have:
  *  - The metadata of each field.
  *  - The data of all the rows.
  *  - The number of rows.
  *
  * The function use Phprojekt_ModelInformation_Default::ORDERING_LIST for get and sort the fields.
  *
  * OPTIONAL request parameters:
  * <pre>
  *  - integer <b>id</b>     List only this id.
  *  - integer <b>nodeId</b> List all the items with projectId == nodeId.
  *  - integer <b>count</b>  Use for SQL LIMIT count.
  *  - integer <b>offset</b> Use for SQL LIMIT offset.
  *  - integer <b>userId</b> UserId of the user requesting the list (for proxy mode).
  *  - boolean <b>recursive</b> Include items of subprojects.
  * </pre>
  *
  * The return is in JSON format.
  *
  * @return void
  */
 public function jsonListAction()
 {
     $userId = $this->getRequest()->getParam('userId', Phprojekt_Auth_Proxy::getEffectiveUserId());
     if (!Cleaner::validate('int', $userId)) {
         throw new Zend_Controller_Action_Exception("Invalid userId '{$userId}'", 400);
     }
     $userId = (int) $userId;
     if (!Phprojekt_Auth_Proxy::hasProxyRightForUserById($userId)) {
         throw new Zend_Controller_Action_Exception("Current user has no proxy rights for this user {$userId}", 403);
     } else {
         Phprojekt_Auth_Proxy::switchToUserById($userId);
     }
     parent::jsonListAction();
 }
 protected function render(array $args = array(), $tpl = null)
 {
     extract($args);
     ob_start();
     require $this->file_path($tpl);
     //$templateFile;
     $content = ob_get_clean();
     ob_start();
     ob_start();
     require VIEW_DIR . 'img_content.phtml';
     //$templateFile;
     $img_content = ob_get_clean();
     ob_start();
     require VIEW_DIR . 'searchForm.phtml';
     $search = ob_get_clean();
     $menu = new MenuController();
     $main_menu = $menu->mainMenuAction();
     $login_logout = new SecurityController();
     $login_logout_block = $login_logout->logAction();
     $news = new NewsController();
     $news_block = $news->getBlockAction();
     $menu_block = $menu->getBlockMainMenuAction();
     $basic_page_bl = new IndexController();
     $basic_page_block = $basic_page_bl->getBasicPageBlockAction();
     if (Router::getLanguage() == 'uk') {
         $lang = 'en';
     } else {
         $lang = 'uk';
     }
     $lang_icon = Lang::url_translation($lang, Config::get('default_id_error_204'));
     $bread_crumbs = BreadCrumbs::getBreadcrumbs();
     $footer_text = __t('footer_text');
     ob_start();
     require VIEW_DIR . 'layout.phtml';
     return ob_get_clean();
 }
 /**
  * When requesting the default values, adjust the start date to the start
  * date of the project.
  */
 public function jsonDetailAction()
 {
     $id = (int) $this->getRequest()->getParam('id');
     if (!empty($id)) {
         parent::jsonDetailAction();
     } else {
         $this->setCurrentProjectId();
         $project = new Project_Models_Project();
         $project->find(Phprojekt::getCurrentProjectId());
         $record = new Todo_Models_Todo();
         $record->startDate = $project->startDate;
         $record->endDate = $project->endDate;
         Phprojekt_Converter_Json::echoConvert($record, Phprojekt_ModelInformation_Default::ORDERING_FORM);
     }
 }
 /**
  * Init function.
  *
  * There are only a few actions that a normal user can do requesting the Core controller.
  * The function check them, and allow the acction or not,
  * if not, the user is redirected to the login form or throws an exception.
  *
  * @throws Zend_Controller_Action_Exception If the user is not an admin.
  *
  * @return void
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Phprojekt_Auth::isAdminUser()) {
         $valid = false;
         // Add exceptions for public calls into the Core
         $controller = strtolower($this->getRequest()->getControllerName());
         $action = $this->getRequest()->getActionName();
         if ($controller == 'history' && $action == 'jsonList') {
             $valid = true;
         } else {
             if ($controller == 'module' && $action == 'jsonGetGlobalModules') {
                 $valid = true;
             } else {
                 if ($controller == 'role' && $action == 'jsonGetModulesAccess') {
                     $valid = true;
                 } else {
                     if ($controller == 'user' && $action == 'jsonGetUsers') {
                         $valid = true;
                     } else {
                         if ($controller == 'user' && $action == 'jsonGetProxyableUsers') {
                             $valid = true;
                         } else {
                             if ($controller == 'tab' && $action == 'jsonList') {
                                 $valid = true;
                             } else {
                                 if ($controller == 'setting') {
                                     $valid = true;
                                 } else {
                                     if ($controller == 'upgrade') {
                                         $valid = true;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (!$valid) {
             $this->getResponse()->setRawHeader('HTTP/1.1 401 Authorization Require');
             $this->getResponse()->sendHeaders();
             exit;
         }
     }
 }
 function createAction()
 {
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     // debugMessage($formvalues);
     if (!isEmptyString($this->_getParam('spamcheck'))) {
         $session->setVar(ERROR_MESSAGE, 'Spam detected. Try again later');
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
     }
     $this->_setParam("action", ACTION_CREATE);
     $this->_setParam("entityname", 'UserAccount');
     $this->_setParam("firstname", ucfirst($formvalues['firstname']));
     $this->_setParam("lastname", ucfirst($formvalues['lastname']));
     $this->_setParam("status", 0);
     // debugMessage($formvalues); exit();
     parent::createAction();
 }
 public function init()
 {
     // initialize the parent controller
     parent::init();
     $session = SessionWrapper::getInstance();
     // check whether the user is logged in
     if (isEmptyString($session->getVar('userid'))) {
         // clear the session
         $this->_helper->redirector->gotoSimpleAndExit("login", "user", $this->getRequest()->getModuleName(), array('redirecturl' => encode(Zend_Controller_Front::getInstance()->getRequest()->getRequestUri())));
     }
     $cache = Zend_Registry::get('cache');
     // load the acl instance
     $acl = getACLInstance();
     // debugMessage('resource is '.$this->getResourceForACL()." action ".$this->getActionforACL()); exit;
     if (!$acl->checkPermission($this->getResourceForACL(), $this->getActionforACL())) {
         // debugMessage('resource is '.$this->getResourceForACL()." action ".$this->getActionforACL());
         // redirect to the access denied page
         $this->_helper->redirector->gotoSimpleAndExit("accessdenied", "index");
     }
 }
 /**
  * Init function.
  *
  * There are only a few actions that a normal user can do requesting the Core controller.
  * The function check them, and allow the acction or not,
  * if not, the user is redirected to the login form or throws an exception.
  *
  * @throws Phprojekt_PublishedException If the user is not an admin.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     if (!Phprojekt_Auth::isAdminUser()) {
         $valid = false;
         // Add exceptions for public calls into the Core
         if ($this->getRequest()->getControllerName() == 'history' && $this->getRequest()->getActionName() == 'jsonList') {
             $valid = true;
         } else {
             if ($this->getRequest()->getControllerName() == 'module' && $this->getRequest()->getActionName() == 'jsonGetGlobalModules') {
                 $valid = true;
             } else {
                 if ($this->getRequest()->getControllerName() == 'role' && $this->getRequest()->getActionName() == 'jsonGetModulesAccess') {
                     $valid = true;
                 } else {
                     if ($this->getRequest()->getControllerName() == 'user' && $this->getRequest()->getActionName() == 'jsonGetUsers') {
                         $valid = true;
                     } else {
                         if ($this->getRequest()->getControllerName() == 'tab' && $this->getRequest()->getActionName() == 'jsonList') {
                             $valid = true;
                         } else {
                             if ($this->getRequest()->getControllerName() == 'setting') {
                                 $valid = true;
                             }
                         }
                     }
                 }
             }
         }
         if (!$valid) {
             // If is a GET, show the login page
             // If is a POST, send message in json format
             if (!$this->getFrontController()->getRequest()->isGet()) {
                 throw new Phprojekt_PublishedException('Admin section is only for admin users', 500);
             } else {
                 $this->_redirect(Phprojekt::getInstance()->getConfig()->webpath . 'index.php/Login/logout');
             }
             exit;
         }
     }
 }
 public static function login()
 {
     $usuario = new Usuario();
     $aviso = '';
     if (!empty($_SESSION['auth']['id'])) {
         self::$corpo = 'index';
         self::renderizar(self::$viewController);
     }
     if (!empty($_POST)) {
         $usuario = $usuario->logar($_POST['email'], $_POST['senha']);
         if (!empty($usuario)) {
             $_SESSION['auth']['id'] = $usuario->id;
             $_SESSION['auth']['permissao'] = $usuario->tipo;
             self::redirecionar($_SERVER['HTTP_REFERER']);
         } else {
             $aviso = "O par login/senha está incorreto";
         }
     }
     self::$header = 'header_login';
     self::$menu = '';
     self::$variaveis = array('aviso' => $aviso);
     self::$corpo = 'login';
     self::renderizar(self::$viewController);
 }
 function clistorders()
 {
     $status = parent::_listorders($this->model_cate);
     if ($status) {
         $this->success("排序更新成功!");
     } else {
         $this->error("排序更新失败!");
     }
 }