/** * This action handles the display configuration page. * * It displays the display configuration page. * If this action is reached through a POST request, it stores all new * configuration values then sends a notification to the user. * * The options available on the page are: * - language (default: en) * - theme (default: Origin) * - content width (default: thin) * - display of read action in header * - display of favorite action in header * - display of date in header * - display of open action in header * - display of read action in footer * - display of favorite action in footer * - display of sharing action in footer * - display of tags in footer * - display of date in footer * - display of open action in footer * - html5 notification timeout (default: 0) * Default values are false unless specified. */ public function displayAction() { if (Minz_Request::isPost()) { FreshRSS_Context::$user_conf->language = Minz_Request::param('language', 'en'); FreshRSS_Context::$user_conf->theme = Minz_Request::param('theme', FreshRSS_Themes::$defaultTheme); FreshRSS_Context::$user_conf->content_width = Minz_Request::param('content_width', 'thin'); FreshRSS_Context::$user_conf->topline_read = Minz_Request::param('topline_read', false); FreshRSS_Context::$user_conf->topline_favorite = Minz_Request::param('topline_favorite', false); FreshRSS_Context::$user_conf->topline_date = Minz_Request::param('topline_date', false); FreshRSS_Context::$user_conf->topline_link = Minz_Request::param('topline_link', false); FreshRSS_Context::$user_conf->bottomline_read = Minz_Request::param('bottomline_read', false); FreshRSS_Context::$user_conf->bottomline_favorite = Minz_Request::param('bottomline_favorite', false); FreshRSS_Context::$user_conf->bottomline_sharing = Minz_Request::param('bottomline_sharing', false); FreshRSS_Context::$user_conf->bottomline_tags = Minz_Request::param('bottomline_tags', false); FreshRSS_Context::$user_conf->bottomline_date = Minz_Request::param('bottomline_date', false); FreshRSS_Context::$user_conf->bottomline_link = Minz_Request::param('bottomline_link', false); FreshRSS_Context::$user_conf->html5_notif_timeout = Minz_Request::param('html5_notif_timeout', 0); FreshRSS_Context::$user_conf->save(); Minz_Session::_param('language', FreshRSS_Context::$user_conf->language); Minz_Translate::reset(FreshRSS_Context::$user_conf->language); invalidateHttpCache(); Minz_Request::good(_t('feedback.conf.updated'), array('c' => 'configure', 'a' => 'display')); } $this->view->themes = FreshRSS_Themes::get(); Minz_View::prependTitle(_t('conf.display.title') . ' · '); }
/** * Permet d'effacer une session * @param $force si à false, n'efface pas le paramètre de langue */ public static function unset_session($force = false) { $language = self::param('language'); session_destroy(); $_SESSION = array(); if (!$force) { self::_param('language', $language); Minz_Translate::reset($language); } }
function initTranslate() { Minz_Translate::init(); $available_languages = Minz_Translate::availableLanguages(); if (!isset($_SESSION['language'])) { $_SESSION['language'] = get_best_language(); } if (!in_array($_SESSION['language'], $available_languages)) { $_SESSION['language'] = 'en'; } Minz_Translate::reset($_SESSION['language']); }
public function displayAction() { if (Minz_Request::isPost()) { $this->view->conf->_language(Minz_Request::param('language', 'en')); $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal')); $this->view->conf->_default_view(Minz_Request::param('default_view', 'a')); $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); $this->view->conf->_display_posts(Minz_Request::param('display_posts', false)); $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); $this->view->conf->_lazyload(Minz_Request::param('lazyload', false)); $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); $this->view->conf->_mark_when(array('article' => Minz_Request::param('mark_open_article', false), 'site' => Minz_Request::param('mark_open_site', false), 'scroll' => Minz_Request::param('mark_scroll', false), 'reception' => Minz_Request::param('mark_upon_reception', false))); $themeId = Minz_Request::param('theme', ''); if ($themeId == '') { $themeId = FreshRSS_Themes::defaultTheme; } $this->view->conf->_theme($themeId); $this->view->conf->_topline_read(Minz_Request::param('topline_read', false)); $this->view->conf->_topline_favorite(Minz_Request::param('topline_favorite', false)); $this->view->conf->_topline_date(Minz_Request::param('topline_date', false)); $this->view->conf->_topline_link(Minz_Request::param('topline_link', false)); $this->view->conf->_bottomline_read(Minz_Request::param('bottomline_read', false)); $this->view->conf->_bottomline_favorite(Minz_Request::param('bottomline_favorite', false)); $this->view->conf->_bottomline_sharing(Minz_Request::param('bottomline_sharing', false)); $this->view->conf->_bottomline_tags(Minz_Request::param('bottomline_tags', false)); $this->view->conf->_bottomline_date(Minz_Request::param('bottomline_date', false)); $this->view->conf->_bottomline_link(Minz_Request::param('bottomline_link', false)); $this->view->conf->save(); Minz_Session::_param('language', $this->view->conf->language); Minz_Translate::reset(); invalidateHttpCache(); $notif = array('type' => 'good', 'content' => Minz_Translate::t('configuration_updated')); Minz_Session::_param('notification', $notif); Minz_Request::forward(array('c' => 'configure', 'a' => 'display'), true); } $this->view->themes = FreshRSS_Themes::get(); Minz_View::prependTitle(Minz_Translate::t('reading_configuration') . ' · '); }