Esempio n. 1
0
 /**
  * Returns true if selected theme is installed
  *
  * @return bool
  */
 private function _themeIsInstalled()
 {
     $errors = array();
     // Twig is an absolute requirement for wallabag to function.
     // Abort immediately if the Composer installer hasn't been run yet
     if (!$this->canRenderTemplates) {
         $errors[] = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. You can also download <a href="http://wllbg.org/vendor">vendor.zip</a> and extract it in your wallabag folder.';
     }
     // Check if the selected theme and its requirements are present
     $theme = $this->getTheme();
     if ($theme != '' && !is_dir(THEME . '/' . $theme)) {
         $errors[] = 'The currently selected theme (' . $theme . ') does not seem to be properly installed (Missing directory: ' . THEME . '/' . $theme . ')';
         $this->canRenderTemplates = FALSE;
     }
     $themeInfo = $this->getThemeInfo($theme);
     if (isset($themeInfo['requirements']) && is_array($themeInfo['requirements'])) {
         foreach ($themeInfo['requirements'] as $requiredTheme) {
             if (!is_dir(THEME . '/' . $requiredTheme)) {
                 $errors[] = 'The required "' . $requiredTheme . '" theme is missing for the current theme (' . $theme . ')';
                 $this->canRenderTemplates = FALSE;
             }
         }
     }
     $currentErrors = is_null(Session::getParam('errors')) ? array() : Session::getParam('errors');
     Session::setParam('errors', array_merge($errors, $currentErrors));
     return $errors;
 }
Esempio n. 2
0
 public function __construct(Poche $wallabag)
 {
     $this->wallabag = $wallabag;
     $pocheUser = Session::getParam('poche_user');
     $language = is_null($pocheUser) ? LANG : $pocheUser->getConfigValue('language');
     @putenv('LC_ALL=' . $language);
     setlocale(LC_ALL, $language);
     bindtextdomain($language, LOCALE);
     textdomain($language);
     $this->currentLanguage = $language;
 }
Esempio n. 3
0
 private function init()
 {
     Tools::initPhp();
     $pocheUser = Session::getParam('poche_user');
     if ($pocheUser && $pocheUser != array()) {
         $this->user = $pocheUser;
     } else {
         // fake user, just for install & login screens
         $this->user = new User();
         $this->user->setConfig($this->getDefaultConfig());
     }
     $this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p');
     $this->language = new Language($this);
     $this->tpl = new Template($this);
     $this->store = new Database();
     $this->messages = new Messages();
     $this->routing = new Routing($this);
 }