示例#1
0
 /**
  * construtor
  *
  * @param ConfigAbstract $config
  * */
 public function __construct(ConfigAbstract $config)
 {
     $this->_config = $config;
     # inicia o setup das configurações de ambiente
     $this->setupEnvironment($this->_config);
     # registra o bootstrap na registry
     Registry::set('bootstrap', $this);
     # setup default module/functionaly/action
     $tmpCfgApp = $this->_config->get('app');
     # setup persistcofig
     PersistConfig::registerConfigs($tmpCfgApp->get('persist')->toArray());
     $moduleDefault = $tmpCfgApp->get('module.default');
     Request::$moduleDefault = $moduleDefault->get('name');
     Request::$functionalityDefault = $moduleDefault->get('functionality');
     Request::$actionDefault = $moduleDefault->get('action');
     /* recupera */
     $this->_request = new Request();
     /* aponta para o config.ini do módulo selecionado, caso este possui um .ini próprio */
     $this->_useEspecificConfigIniFileIfExistsOne();
     # registra o local de armazenamento do cache dos Values Object
     AnnotationCache::$cacheDir = $tmpCfgApp->get('cache.home');
     # inicializa a requisicao
     $this->_request->setBehaviorMagicQuotesGPC($config->get('php.environment.magic_quotes_gpc'));
     # inicializa o manipulador de constantes
     $this->_constantHandler = ConstantHandler::factory($this);
     $this->_autoloadConstant();
     # habilita ou nao uso de registro de log
     $this->_enablePersistLog($this->_config);
 }
示例#2
0
 /**
  * cria estrutura
  * @param string $path
  * @return string
  */
 private static function createStructPersist($path)
 {
     $year = date('Y');
     $month = date('m');
     $path .= Registry::get('bootstrap')->config()->get('app.file.repository');
     $system = Registry::get('bootstrap')->request()->getModule();
     $permission = octdec(self::$_permission);
     # obtenho a permissao do diretorio
     $repoSystem = $path . DIRECTORY_SEPARATOR . $system;
     # destino onde os arquivos serao salvos
     $repoCreate = $repoSystem . DIRECTORY_SEPARATOR . $year . DIRECTORY_SEPARATOR . $month;
     #@todo lancar exception se não poder efetuar a escrita is_writable
     $owner = self::whoIsOwner($path);
     $permDir = self::pathPermissions($path);
     //dump("SEM PERMISSAO PARA ESCRITA, PERMISSAO NA PASTA É {$permDir} E O DONO É {$owner}" ,1);
     # listo os diretorios e procuro na lista de diretorios pelo sistema informado
     if (!array_search($system, scandir($path))) {
         # cria repositorio e sub-diretorios referente ao Mes
         mkdir($repoCreate, $permission, TRUE);
     } else {
         # a pasta do sistema existe, agora faz a valizadacao da estrutura
         if (!array_search($year, scandir($repoSystem))) {
             mkdir($repoCreate, $permission, TRUE);
         } else {
             # Ultima verificacao caso o sub referente ao mes nao foi criado
             $listDir = scandir($repoSystem . DIRECTORY_SEPARATOR . $year);
             if (!array_search($month, $listDir)) {
                 mkdir($repoCreate, $permission, TRUE);
             }
         }
     }
     return base64_encode($repoCreate);
 }
示例#3
0
 public function setCredential($userCredential = NULL)
 {
     $this->_validateCredential($userCredential);
     $backtrace = debug_backtrace();
     ParentRegistry::get('bootstrap')->request()->setAction($backtrace[1]['function'])->setModule("wsdl")->setFuncionality('libcorp');
     $_SESSION['USER'] = (object) $userCredential;
 }
示例#4
0
 public function controller()
 {
     try {
         return parent::controller();
     } catch (ControllerException $cExc) {
         $flow = new \RedirectFlow(Registry::get('bootstrap')->config()->get('app.sisbio.redirectflow.target'));
         # o controle se pode ou nao enviar eh feito no
         # proprio componente RedirectFlow
         $flow->forward();
     }
 }
示例#5
0
 /**
  * Obtém uma instância do objeto session para manipulação dos dados de autenticação.
  *
  * @return br\gov\sial\core\util\Session
  */
 private static function _getSession()
 {
     $sessionExpire = Registry::get('bootstrap')->config(self::SESSION_EXPIRE);
     return Session::start(self::NAMESPACE_SESSION, $sessionExpire);
 }
示例#6
0
 /**
  * define a quantidade maxima de caracteres por linha
  *
  * @param integer $maxLen
  * @return \br\gov\sial\core\util\mail\Mail
  * */
 public function wordWrap($maxLen)
 {
     Registry::get($this->_hashKey)->SetWordWrap((int) $maxLen);
     return $this;
 }
 /**
  * Referência do bootstrap.
  *
  * @return br\gov\sial\core\Bootstrap
  * @throws ControllerException
  * @example ControllerAbstract::bootstrap
  * @code
  * <?php
  *  var_dump($this->bootstrap());
  * ?>
  * @encode
  * */
 public function bootstrap()
 {
     if (NULL === $this->_bootstrap) {
         if (FALSE === Registry::isRegistered('bootstrap') || !Registry::get('bootstrap') instanceof BootstrapAbstract) {
             throw new ControllerException(self::T_CONTROLLER_MISSING_BOOTSTRAP);
         }
         $this->_bootstrap = Registry::get('bootstrap');
     }
     return $this->_bootstrap;
 }
示例#8
0
 /**
  * Construtor.
  *
  * @param string $viewType
  * @param string[] $config
  * @example ViewAbstract::__construct
  * @code
  * <?php
  *      ...
  *      $result = new FooView('html', array());
  *      var_dump($result);
  * ?>
  * @encode
  * */
 public function __construct($viewType, array $config = array())
 {
     $this->_TYPE = $viewType;
     $this->_config = empty($config) ? Registry::get('bootstrap')->config() : $config;
     // # registro scripts basicos do sial para o tipo de view selecionado
     $this->addScriptPath(__DIR__ . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . $this::T_TYPE);
     # registra o repositorio principal de helpers
     Helper::registerNamespace(__NAMESPACE__ . self::NAMESPACE_SEPARATOR . 'helper');
     # inicializa o helper de view
     $this->_helper = new Helper();
     # define o cabecalho (MIME-TYPE) do tipo de view
     if ((bool) self::$forceMime) {
         $this->mime();
     }
     # criar instancia do SAF se o mesmo tiver sido habilidado no arquivo de configuracao do projeto:
     # .project/application/config/config.ini
     $safConf = $this->_config->get('app.saf');
     if ($safConf && $safConf->get('enable')) {
         $this->saf();
     }
     # mantem compatibilidade, a chamada a _commonDir nao deve
     # ser feita diretamente das subclasses
     # @deprecated
     if (isset($this->_commonDir[$this::T_TYPE])) {
         foreach ($this->_commonDir[$this::T_TYPE] as $dir) {
             $this->addScriptPath($dir);
         }
     }
 }