Exemplo n.º 1
0
 public function render()
 {
     try {
         $this->currentModule = Core_Helper::getModule();
         //$this->userLogin = Core_Helper::getCurrentUserLogin();
         $this->url = Core_Url::getCurrentUrl();
         //$this->token_auth = Core_Core::getCurrentUserTokenAuth();
         //$this->userHasSomeAdminAccess = Core_Core::isUserHasSomeAdminAccess();
         //$this->userIsSuperUser = Core_Core::isUserIsSuperUser();
         //$this->Core_version = Core_Version::VERSION;
         //$this->latest_version_available = UpdateCheck::isNewestVersionAvailable();
         //$this->loginModule = Zend_Registry::get('auth')->getName();
         // global value accessible to all templates: the
         // Core base URL for the current request
         $this->Core_Url = Core_Url::getCurrentUrlWithoutFileName();
         /* The navigation menu */
         $this->Core_NavigationMenu = Core_Navigator::getInstance()->getMenu();
         $this->InternetIsConnected = Zend_Registry::get('config')->General->internet_is_connected == 1;
         $this->MapData = Zend_Registry::get('config')->General->map_data;
     } catch (Exception $e) {
         // can fail, for example at installation (no plugin loaded yet)
     }
     //$this->totalTimeGeneration = Zend_Registry::get('timer')->getTime();
     /*
     		try {
     			$this->totalNumberOfQueries = Core_Common::getQueryCount();
     		}
     		catch(Exception $e){
     			$this->totalNumberOfQueries = 0;
     		}*/
     @header('Content-Type: text/html; charset=utf-8');
     @header("Pragma: ");
     @header("Cache-Control: no-store, must-revalidate");
     return $this->smarty->fetch($this->template);
 }
Exemplo n.º 2
0
 /**
  *
  */
 function preDispatch()
 {
     $currentLogin = Core_Common::getCurrentUserLogin();
     $currentModule = Core_Helper::getModule();
     $loginModule = Core_Helper::getLoginModuleName();
     if ($currentModule !== $loginModule && (empty($currentLogin) || $currentLogin === 'anonymous')) {
         Core_Helper::redirectToModule($loginModule);
     }
 }
Exemplo n.º 3
0
 function dispatch($module = null, $action = null, $parameters = null)
 {
     if (is_null($module)) {
         $defaultModule = Core_Helper::getDefaultModuleName();
         $module = Core_Common::getRequestVar('module', $defaultModule, 'string');
     }
     if (is_null($action)) {
         $action = Core_Common::getRequestVar('action', false);
     }
     if (is_null($parameters)) {
         $parameters = array();
     }
     if (!ctype_alnum($module)) {
         throw new Exception("Invalid module name '{$module}'");
     }
     $controllerClassName = "Module_" . $module . "_Controller";
     /* Check if the plugin has been activated */
     if (!Core_ModuleManager::getInstance()->isModuleActivated($module)) {
         throw new Core_FrontController_PluginDeactivatedException($module);
     }
     // Dynamically create the class
     $controller = new $controllerClassName();
     if ($action === false) {
         $action = $controller->getDefaultAction();
     }
     // Dynamically call the action
     if (!is_callable(array($controller, $action))) {
         throw new Exception("Action not found in {$controllerClassName}::{$action}().");
     }
     try {
         $controller->preDispatch();
         return call_user_func_array(array($controller, $action), $parameters);
     } catch (Core_Access_NoAccessException $e) {
         Core_PostEvent('FrontController.NoAccessException');
     } catch (Exception $e) {
         echo 'Error: ' . $e;
         return null;
     }
 }
Exemplo n.º 4
0
 function initAuthenticationObject($notification)
 {
     $auth = new Module_Login_Auth();
     Zend_Registry::set('auth', $auth);
     $action = Core_Helper::getAction();
     if (Core_Helper::getModule() === 'API' && (empty($action) || $action == 'index')) {
         return;
     }
     /* Create the cookie */
     $authCookieName = Zend_Registry::get('config')->General->login_cookie_name;
     $authCookieExpiry = 0;
     $authCookiePath = Zend_Registry::get('config')->General->login_cookie_path;
     $authCookie = new Core_Cookie($authCookieName, $authCookieExpiry, $authCookiePath);
     $defaultLogin = '******';
     $defaultTokenAuth = 'anonymous';
     if ($authCookie->isCookieFound()) {
         $defaultLogin = $authCookie->get('login');
         $defaultTokenAuth = $authCookie->get('token_auth');
     }
     $auth->setLogin($defaultLogin);
     $auth->setTokenAuth($defaultTokenAuth);
 }
Exemplo n.º 5
0
 /**
  * Returns the plugin currently being used to display the page
  *
  * @return Core_Module
  */
 public static function getCurrentModule()
 {
     return Core_ModuleManager::getInstance()->getLoadedModule(Core_Helper::getModule());
 }
Exemplo n.º 6
0
function Core_Form_isValidEmailString($element, $value)
{
    return Core_Helper::isValidEmailString($value);
}
Exemplo n.º 7
0
 /**
  * Logout the current user
  */
 function logout()
 {
     self::clearSession();
     Core_Helper::redirectToModule(Core_Helper::getDefaultModuleName());
 }