Esempio n. 1
0
 public function __construct()
 {
     if ($this->config === null) {
         $this->config = config::getConfig(__CLASS__);
     }
     $this->config['cookie.user'] .= ':' . crc32(environment::getCurrentEnvironment());
 }
Esempio n. 2
0
 /**
  * @return mixed
  */
 private function getConfig()
 {
     static $config;
     if ($config === null) {
         $config = config::getConfig(__CLASS__);
     }
     return $config;
 }
Esempio n. 3
0
 public function __construct()
 {
     $tokenClass = config::getConfig(__CLASS__)['token_class'];
     $this->token_class = new $tokenClass();
     if (!$this->token_class instanceof tokenManagerInterface) {
         throw new tokenManagerException("{$tokenClass} is not implements tokenManagerInterface");
     }
 }
Esempio n. 4
0
 public function __construct()
 {
     $config = config::getConfig(__CLASS__);
     $this->cookie = $config['cookie'];
     $this->cookie['name'] .= ':' . crc32(environment::getCurrentEnvironment());
     $aclClass = $config['acl_class'];
     $this->aclManager = new $aclClass();
     if (!$this->aclManager instanceof aclManagerInterface) {
         throw new aclException("{$aclClass} is not implements aclManagerInterface");
     }
 }
Esempio n. 5
0
 /**
  * Initialize driver and connect to host
  *
  * @var string $configSection
  * @throws cacheException
  */
 public function __construct($configSection = 'default')
 {
     $this->factoryConstruct($configSection);
     $config = config::getConfig(__CLASS__);
     if (!isset($config[$configSection])) {
         throw new cacheException("Config section {$configSection} not found!");
     }
     $this->memcached = new \Memcached();
     foreach ($config[$configSection]['servers'] as $server) {
         $this->memcached->addServer($server['host'], $server['port']);
     }
 }
Esempio n. 6
0
 /**
  * @return mongoInstance
  * @throws storageException
  */
 public function storage()
 {
     if ($this->storageInstance === null) {
         $config = config::getConfig(get_called_class());
         $this->mongoCrudStorageConfig = $config['storage'];
         if (!array_key_exists('configSection', $this->mongoCrudStorageConfig)) {
             throw new storageException('Unable to find config[storage][configSection] in case of mongoCrud usage');
         }
         $this->storageInstance = mongoInstance::factory($this->mongoCrudStorageConfig['configSection']);
     }
     return $this->storageInstance;
 }
Esempio n. 7
0
 protected function getPackageConfig()
 {
     static $config;
     if ($config === null) {
         $config = config::getConfig(get_called_class());
     }
     if (!isset($config[$this->configSection])) {
         // TODO :: Check, really configurationException needed to throw or factoryException
         throw new configurationException("Unable to find configSection: \"{$this->configSection}\"");
     }
     return $config[$this->configSection];
 }
Esempio n. 8
0
 /**
  * Constructor
  */
 public function __construct()
 {
     profiler::addStack('view::init');
     if (!defined('SMARTY_MBSTRING')) {
         define(SMARTY_MBSTRING, true);
     }
     $options = config::getConfig(get_called_class());
     parent::__construct();
     $this->force_compile = $options['force_compile'];
     $this->debugging = $options['debugging'];
     $this->caching = $options['caching'];
     $this->cache_lifetime = $options['cache_lifetime'];
     $this->setCompileDir($options['compile_dir']);
     $this->setConfigDir($options['config_dir']);
     $this->setCacheDir($options['cache_dir']);
 }
Esempio n. 9
0
 /**
  * Executes the current command.
  *
  * This method is not because you can use this class
  * as a concrete class. In this case, instead of defining the
  * execute() method, you set the code to execute by passing
  * a Closure to the setCode() method.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return null|int null or 0 if everything went fine, or an error code
  *
  * @throws \LogicException When this method is not implemented
  *
  * @see setCode()
  */
 protected function handle(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $smartyDir = dirname(rtrim(config::getConfig('mpcmf_system_view_smartyDriver')['config_dir'], '/'));
     if (file_exists($smartyDir)) {
         @shell_exec("chmod -R 0777 '{$smartyDir}' && chmod -R 0777 '{$smartyDir}'");
     } else {
         @mkdir($smartyDir, 0777, true);
     }
     $this->prepareThreads($input);
     $this->checkThreads();
     $masterServerAddr = $input->getOption('master-server');
     if ($masterServerAddr) {
         $this->masterServer($this->parseAddr($masterServerAddr));
     } else {
         for (;;) {
             $this->checkThreads();
             sleep(1);
         }
     }
 }
Esempio n. 10
0
 /**
  * Get micro-web-framework object
  *
  * @param null $instance
  * @param string|null $appKey
  *
  * @return Slim
  * @throws webApplicationException
  */
 public function slim($instance = null, $appKey = null)
 {
     if ($appKey === null) {
         $appKey = get_called_class();
     }
     if ($instance !== null) {
         self::$slimInstance[$appKey] = $instance;
     } elseif (!isset(self::$slimInstance[$appKey])) {
         $config = array_replace_recursive(config::getConfig(__CLASS__), $this->getPackageConfig());
         if (!isset($config['slim'], $config['name'])) {
             throw new webApplicationException('Undefined required config sections: slim, name');
         }
         self::$slimInstance[$appKey] = new Slim($config['slim']);
         self::$slimInstance[$appKey]->setName($appKey);
         set_error_handler(array('\\Slim\\Slim', 'handleErrors'));
         //Apply final outer middleware layers
         if (self::$slimInstance[$appKey]->config('debug')) {
             //Apply pretty exceptions only in debug to avoid accidental information leakage in production
             self::$slimInstance[$appKey]->add(new PrettyExceptions());
         }
     }
     return self::$slimInstance[$appKey];
 }
Esempio n. 11
0
 /**
  * Get package config data
  *
  * @return mixed
  */
 protected function getPackageConfig()
 {
     return config::getConfig(get_called_class());
 }