Ejemplo n.º 1
0
 public static function hook()
 {
     try {
         self::firstCall();
         $securityYml = cache::getInstance()->loadYaml(config::getPathAbsolute() . 'config/security.yml', 'securityYml');
         // preguntando si el módulo y la acción solicitada, tienen o no seguridad
         if (isset($securityYml[session::getInstance()->getModule()][session::getInstance()->getAction()]) === true and isset($securityYml[session::getInstance()->getModule()][session::getInstance()->getAction()]['security']) === true and $securityYml[session::getInstance()->getModule()][session::getInstance()->getAction()]['security'] === true) {
             // si hay seguridad, entonces preguntamos si el usuario está autenticado
             if (!session::getInstance()->isUserAuthenticated()) {
                 self::saveUrlParams();
                 //routing::getInstance()->redirect(config::getDefaultModuleSecurity(), config::getDefaultActionSecurity());
                 routing::getInstance()->forward(config::getDefaultModuleSecurity(), config::getDefaultActionSecurity());
             }
             // verifico permisos de acceso
             if (!self::verifyCredentials($securityYml, session::getInstance()->getModule(), session::getInstance()->getAction())) {
                 routing::getInstance()->forward(config::getDefaultModulePermission(), config::getDefaultActionPermission());
             }
         }
         /* else {
              session::getInstance()->deleteAttribute('shfSecurityModuleGO');
              session::getInstance()->deleteAttribute('shfSecurityActionGO');
            }*/
     } catch (\PDOException $exc) {
         throw $exc;
     }
 }
Ejemplo n.º 2
0
 public static function hooksEnd()
 {
     if (!self::$listHooks) {
         self::$listHooks = cacheManagerClass::getInstance()->loadYaml(configClass::getPathAbsolute() . 'config/hooks.yml', 'hooksYaml');
     }
     self::loadHooksAndExecute(self::$listHooks['end'], isset(self::$listHooks['configLoader']) ? self::$listHooks['configLoader'] : null);
 }
 /**
  * Carga los archivos básicos declarados en loader.yml
  * en el punto mvcBasicPackage
  * @return null
  */
 public function autoLoad()
 {
     $includes = cacheManagerClass::getInstance()->loadYaml(configClass::getPathAbsolute() . 'libs/vendor/loader.yml', 'autoLoadYaml');
     foreach ($includes['mvcBasicPackage'] as $include) {
         include_once configClass::getPathAbsolute() . $include;
     }
     return null;
 }
Ejemplo n.º 4
0
 /**
  * 
  * @param integer $message
  * @param string $culture [optional]
  * @param string $dictionary [optional]
  * @param array $vars [optional] $vars[':nombre'] = 'NOMBRE';
  * @return string
  */
 public static function __($message, $culture = null, $dictionary = 'default', $vars = array())
 {
     if ($culture === null) {
         $culture = self::getCulture();
     }
     $__ymlCulture = cacheManagerClass::getInstance()->loadYaml(configClass::getPathAbsolute() . 'i18n/' . $culture . '.yml', 'i18nYaml' . $culture);
     $rsp = '';
     if (count($vars) > 0) {
         $keys = array_keys($vars);
         $values = array_values($vars);
         $rsp = str_replace($keys, $values, $__ymlCulture['dictionary'][$dictionary][$message]);
     } else {
         $rsp = $__ymlCulture['dictionary'][$dictionary][$message];
     }
     return $rsp;
 }
 private function registerDefaultModuleAndAction()
 {
     $yamlRouting = cacheManagerClass::getInstance()->loadYaml(configClass::getPathAbsolute() . 'config/routing.yml', 'routingYaml');
     sessionClass::getInstance()->setModule($yamlRouting['homepage']['param']['module']);
     sessionClass::getInstance()->setAction($yamlRouting['homepage']['param']['action']);
     sessionClass::getInstance()->setLoadFiles(isset($yamlRouting['homepage']['load']) ? $yamlRouting['homepage']['load'] : false);
     sessionClass::getInstance()->setFormatOutput($yamlRouting['homepage']['param']['format']);
 }
Ejemplo n.º 6
0
 /**
  * Funcion diseñada para integrar un titulo a cada vista de el sistema de el portal
  * @author Leonardo Betancourt Caicedo <*****@*****.**>
  * @return string
  */
 public static function genTitle()
 {
     $module = sessionClass::getInstance()->getModule();
     $action = sessionClass::getInstance()->getAction();
     $title = '';
     $includes = cacheManagerClass::getInstance()->loadYaml(configClass::getPathAbsolute() . 'config/view.yml', 'viewYaml');
     if (isset($includes[$module][$action]['title'])) {
         $title = '<title>' . $includes[$module][$action]['title'] . '</title>';
     } else {
         if (isset($includes['all']['title'])) {
             $title = '<title>' . $includes['all']['title'] . '</title>';
         }
     }
     return $title;
 }