Пример #1
0
 /**
  * load translated messages using $dir and $lang
  */
 public static function init()
 {
     $lang = self::$lang;
     if (isset($_GET['lang'])) {
         $lang = $_GET['lang'];
         $_SESSION['lang'] = $lang;
     } else {
         if (isset($_SESSION['lang'])) {
             $lang = $_SESSION['lang'];
         }
     }
     if (in_array($lang, array_keys(self::$langList))) {
         self::$lang = $lang;
     } else {
         unset($_SESSION['lang']);
     }
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param string $configFile Configuration file
  * @param string $version    Kriss feed version
  */
 public function __construct($configFile, $version)
 {
     $this->_file = $configFile;
     $this->version = $version;
     $this->lang = Intl::$lang;
     // Loading user config
     if (file_exists($this->_file)) {
         include_once $this->_file;
     } else {
         $this->_install();
     }
     Session::$disableSessionProtection = $this->disableSessionProtection;
     if ($this->addFavicon) {
         /* favicon dir */
         if (!is_dir(INC_DIR)) {
             if (!@mkdir(INC_DIR, 0755)) {
                 FeedPage::$pb->assign('message', sprintf(Intl::msg('Can not create %s directory, check permissions'), INC_DIR));
                 FeedPage::$pb->renderPage('message');
             }
         }
         if (!is_dir(FAVICON_DIR)) {
             if (!@mkdir(FAVICON_DIR, 0755)) {
                 FeedPage::$pb->assign('message', sprintf(Intl::msg('Can not create %s directory, check permissions'), FAVICON_DIR));
                 FeedPage::$pb->renderPage('message');
             }
         }
     }
     if ($this->isLogged()) {
         unset($_SESSION['view']);
         unset($_SESSION['listFeeds']);
         unset($_SESSION['filter']);
         unset($_SESSION['order']);
         unset($_SESSION['byPage']);
         unset($_SESSION['lang']);
     }
     $view = $this->getView();
     $listFeeds = $this->getListFeeds();
     $filter = $this->getFilter();
     $order = $this->getOrder();
     $byPage = $this->getByPage();
     $lang = $this->getLang();
     if ($this->view != $view || $this->listFeeds != $listFeeds || $this->filter != $filter || $this->order != $order || $this->byPage != $byPage || $this->lang != $lang) {
         $this->view = $view;
         $this->listFeeds = $listFeeds;
         $this->filter = $filter;
         $this->order = $order;
         $this->byPage = $byPage;
         $this->lang = $lang;
         $this->write();
     }
     if (!$this->isLogged()) {
         $_SESSION['view'] = $view;
         $_SESSION['listFeeds'] = $listFeeds;
         $_SESSION['filter'] = $filter;
         $_SESSION['order'] = $order;
         $_SESSION['byPage'] = $byPage;
         $_SESSION['lang'] = $lang;
     }
     Intl::$lang = $this->lang;
 }