Exemplo n.º 1
0
 /**
  * @param Core $core
  * @param HttpRequest $httpRequest
  * @param Route $route
  */
 public function __construct(Core $core, HttpRequest $httpRequest, Route $route)
 {
     parent::__construct($core, $httpRequest, $route);
     $this->cmsSettings = $this->getSettings('cms');
     $dbSettings = $this->getSettings('db');
     $this->eventDispatcher = new EventDispatcher();
     if (!defined('LC_MESSAGES')) {
         define('LC_MESSAGES', 5);
     }
     $this->localizer = Localizer::fromAcceptedLanguages($this->httpRequest->getAcceptLanguage(), array(LC_MESSAGES => array('de_CH' => 'de_DE', 'de_AT' => 'de_DE', 'de_LI' => 'de_DE', 'de' => 'de_DE')));
     $this->translator = $this->getTranslator($this->core->getSiteRoot() . 'locale' . DIRECTORY_SEPARATOR);
     $this->translator->bindTextDomain('backend', 'UTF-8');
     $this->db = new DBMySQL(new DBConnect($dbSettings->host, $dbSettings->database, $dbSettings->user, $dbSettings->password));
     $this->auth = new CmsAuthHandlerDB($this->db, $this->core->getSessionHandler(), array('login_site' => $this->core->getSettings()->logincontroller->login_page, 'session_max_idle_time' => $this->core->getSettings()->logincontroller->session_max_idle_time));
     $this->moduleModel = new ModuleModel($this->db);
     $this->loadedModules = array();
     /*if($this->auth->isLoggedIn()) {
     			// TODO use reparate DB connection so it doesnt affect the cms one
     			$this->db->addListener(new DBRevisionListener($this->core->getSiteRoot() . 'revision/'));
     		}*/
     $this->loadNeededModules();
 }
Exemplo n.º 2
0
 public function testSettingIllegalLocaleOnlyArray()
 {
     $localizer = new Localizer();
     $localesArr = array(LC_ALL => array('foo', 'bar'), LC_TIME => array('foo', 'baz'));
     $this->assertEquals(array(LC_ALL => false, LC_TIME => false), $localizer->setLocale($localesArr), 'Illegal locales');
 }