diff options
| author | 2017-02-15 14:14:03 +0100 | |
|---|---|---|
| committer | 2017-02-15 14:14:03 +0100 | |
| commit | 5a1bb1393b4496eb35a2ffb3cc63d41c9dc1e2e5 (patch) | |
| tree | 67028e45792c575c25c92616633f64cc7a4a13eb /app | |
| parent | 7e949d50320317b5c3b5a2da2bdaf324e794b2f7 (diff) | |
| parent | 5f637bd816b7323885bfe1751a1724ee59a822f6 (diff) | |
Merge remote-tracking branch 'FreshRSS/master'
Diffstat (limited to 'app')
188 files changed, 18537 insertions, 5295 deletions
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php new file mode 100644 index 000000000..1398e4e49 --- /dev/null +++ b/app/Controllers/authController.php @@ -0,0 +1,212 @@ +<?php + +/** + * This controller handles action about authentication. + */ +class FreshRSS_auth_Controller extends Minz_ActionController { + /** + * This action handles authentication management page. + * + * Parameters are: + * - token (default: current token) + * - anon_access (default: false) + * - anon_refresh (default: false) + * - auth_type (default: none) + * - unsafe_autologin (default: false) + * - api_enabled (default: false) + * + * @todo move unsafe_autologin in an extension. + */ + public function indexAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + + Minz_View::prependTitle(_t('admin.auth.title') . ' · '); + + if (Minz_Request::isPost()) { + $ok = true; + + $current_token = FreshRSS_Context::$user_conf->token; + $token = Minz_Request::param('token', $current_token); + FreshRSS_Context::$user_conf->token = $token; + $ok &= FreshRSS_Context::$user_conf->save(); + + $anon = Minz_Request::param('anon_access', false); + $anon = ((bool)$anon) && ($anon !== 'no'); + $anon_refresh = Minz_Request::param('anon_refresh', false); + $anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no'); + $auth_type = Minz_Request::param('auth_type', 'none'); + $unsafe_autologin = Minz_Request::param('unsafe_autologin', false); + $api_enabled = Minz_Request::param('api_enabled', false); + if ($anon != FreshRSS_Context::$system_conf->allow_anonymous || + $auth_type != FreshRSS_Context::$system_conf->auth_type || + $anon_refresh != FreshRSS_Context::$system_conf->allow_anonymous_refresh || + $unsafe_autologin != FreshRSS_Context::$system_conf->unsafe_autologin_enabled || + $api_enabled != FreshRSS_Context::$system_conf->api_enabled) { + + // TODO: test values from form + FreshRSS_Context::$system_conf->auth_type = $auth_type; + FreshRSS_Context::$system_conf->allow_anonymous = $anon; + FreshRSS_Context::$system_conf->allow_anonymous_refresh = $anon_refresh; + FreshRSS_Context::$system_conf->unsafe_autologin_enabled = $unsafe_autologin; + FreshRSS_Context::$system_conf->api_enabled = $api_enabled; + + $ok &= FreshRSS_Context::$system_conf->save(); + } + + invalidateHttpCache(); + + if ($ok) { + Minz_Request::good(_t('feedback.conf.updated'), + array('c' => 'auth', 'a' => 'index')); + } else { + Minz_Request::bad(_t('feedback.conf.error'), + array('c' => 'auth', 'a' => 'index')); + } + } + } + + /** + * This action handles the login page. + * + * It forwards to the correct login page (form) or main page if + * the user is already connected. + */ + public function loginAction() { + if (FreshRSS_Auth::hasAccess()) { + Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true); + } + + $auth_type = FreshRSS_Context::$system_conf->auth_type; + switch ($auth_type) { + case 'form': + Minz_Request::forward(array('c' => 'auth', 'a' => 'formLogin')); + break; + case 'http_auth': + case 'none': + // It should not happened! + Minz_Error::error(404); + default: + // TODO load plugin instead + Minz_Error::error(404); + } + } + + /** + * This action handles form login page. + * + * If this action is reached through a POST request, username and password + * are compared to login the current user. + * + * Parameters are: + * - nonce (default: false) + * - username (default: '') + * - challenge (default: '') + * - keep_logged_in (default: false) + * + * @todo move unsafe autologin in an extension. + */ + public function formLoginAction() { + invalidateHttpCache(); + + $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'); + Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . $file_mtime)); + + $conf = Minz_Configuration::get('system'); + $limits = $conf->limits; + $this->view->cookie_days = round($limits['cookie_duration'] / 86400, 1); + + if (Minz_Request::isPost()) { + $nonce = Minz_Session::param('nonce'); + $username = Minz_Request::param('username', ''); + $challenge = Minz_Request::param('challenge', ''); + + $conf = get_user_configuration($username); + if (is_null($conf)) { + Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false); + return; + } + + $ok = FreshRSS_FormAuth::checkCredentials( + $username, $conf->passwordHash, $nonce, $challenge + ); + if ($ok) { + // Set session parameter to give access to the user. + Minz_Session::_param('currentUser', $username); + Minz_Session::_param('passwordHash', $conf->passwordHash); + FreshRSS_Auth::giveAccess(); + + // Set cookie parameter if nedded. + if (Minz_Request::param('keep_logged_in')) { + FreshRSS_FormAuth::makeCookie($username, $conf->passwordHash); + } else { + FreshRSS_FormAuth::deleteCookie(); + } + + // All is good, go back to the index. + Minz_Request::good(_t('feedback.auth.login.success'), + array('c' => 'index', 'a' => 'index')); + } else { + Minz_Log::warning('Password mismatch for' . + ' user=' . $username . + ', nonce=' . $nonce . + ', c=' . $challenge); + Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false); + } + } elseif (FreshRSS_Context::$system_conf->unsafe_autologin_enabled) { + $username = Minz_Request::param('u', ''); + $password = Minz_Request::param('p', ''); + Minz_Request::_param('p'); + + if (!$username) { + return; + } + + $conf = get_user_configuration($username); + if (is_null($conf)) { + return; + } + + if (!function_exists('password_verify')) { + include_once(LIB_PATH . '/password_compat.php'); + } + + $s = $conf->passwordHash; + $ok = password_verify($password, $s); + unset($password); + if ($ok) { + Minz_Session::_param('currentUser', $username); + Minz_Session::_param('passwordHash', $s); + FreshRSS_Auth::giveAccess(); + + Minz_Request::good(_t('feedback.auth.login.success'), + array('c' => 'index', 'a' => 'index')); + } else { + Minz_Log::warning('Unsafe password mismatch for user ' . $username); + Minz_Error::error(403, array(_t('feedback.auth.login.invalid')), false); + } + } + } + + /** + * This action removes all accesses of the current user. + */ + public function logoutAction() { + invalidateHttpCache(); + FreshRSS_Auth::removeAccess(); + Minz_Request::good(_t('feedback.auth.logout.success'), + array('c' => 'index', 'a' => 'index')); + } + + /** + * This action gives possibility to a user to create an account. + */ + public function registerAction() { + if (max_registrations_reached()) { + Minz_Error::error(403); + } + + Minz_View::prependTitle(_t('gen.auth.registration.title') . ' · '); + } +} diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php new file mode 100644 index 000000000..922f92844 --- /dev/null +++ b/app/Controllers/categoryController.php @@ -0,0 +1,193 @@ +<?php + +/** + * Controller to handle actions relative to categories. + * User needs to be connected. + */ +class FreshRSS_category_Controller extends Minz_ActionController { + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + * + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + + $catDAO = new FreshRSS_CategoryDAO(); + $catDAO->checkDefault(); + } + + /** + * This action creates a new category. + * + * Request parameter is: + * - new-category + */ + public function createAction() { + $catDAO = new FreshRSS_CategoryDAO(); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); + + $limits = FreshRSS_Context::$system_conf->limits; + $this->view->categories = $catDAO->listCategories(false); + + if (count($this->view->categories) >= $limits['max_categories']) { + Minz_Request::bad(_t('feedback.sub.category.over_max', $limits['max_categories']), + $url_redirect); + } + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $cat_name = Minz_Request::param('new-category'); + if (!$cat_name) { + Minz_Request::bad(_t('feedback.sub.category.no_name'), $url_redirect); + } + + $cat = new FreshRSS_Category($cat_name); + + if ($catDAO->searchByName($cat->name()) != null) { + Minz_Request::bad(_t('feedback.sub.category.name_exists'), $url_redirect); + } + + $values = array( + 'id' => $cat->id(), + 'name' => $cat->name(), + ); + + if ($catDAO->addCategory($values)) { + Minz_Request::good(_t('feedback.sub.category.created', $cat->name()), $url_redirect); + } else { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action updates the given category. + * + * Request parameters are: + * - id + * - name + */ + public function updateAction() { + $catDAO = new FreshRSS_CategoryDAO(); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $id = Minz_Request::param('id'); + $name = Minz_Request::param('name', ''); + if (strlen($name) <= 0) { + Minz_Request::bad(_t('feedback.sub.category.no_name'), $url_redirect); + } + + if ($catDAO->searchById($id) == null) { + Minz_Request::bad(_t('feedback.sub.category.not_exist'), $url_redirect); + } + + $cat = new FreshRSS_Category($name); + $values = array( + 'name' => $cat->name(), + ); + + if ($catDAO->updateCategory($id, $values)) { + Minz_Request::good(_t('feedback.sub.category.updated'), $url_redirect); + } else { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action deletes a category. + * Feeds in the given category are moved in the default category. + * Related user queries are deleted too. + * + * Request parameter is: + * - id (of a category) + */ + public function deleteAction() { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $catDAO = new FreshRSS_CategoryDAO(); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $id = Minz_Request::param('id'); + if (!$id) { + Minz_Request::bad(_t('feedback.sub.category.no_id'), $url_redirect); + } + + if ($id === FreshRSS_CategoryDAO::defaultCategoryId) { + Minz_Request::bad(_t('feedback.sub.category.not_delete_default'), $url_redirect); + } + + if ($feedDAO->changeCategory($id, FreshRSS_CategoryDAO::defaultCategoryId) === false) { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + + if ($catDAO->deleteCategory($id) === false) { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + + // Remove related queries. + FreshRSS_Context::$user_conf->queries = remove_query_by_get( + 'c_' . $id, FreshRSS_Context::$user_conf->queries); + FreshRSS_Context::$user_conf->save(); + + Minz_Request::good(_t('feedback.sub.category.deleted'), $url_redirect); + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action deletes all the feeds relative to a given category. + * Feed-related queries are deleted. + * + * Request parameter is: + * - id (of a category) + */ + public function emptyAction() { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $id = Minz_Request::param('id'); + if (!$id) { + Minz_Request::bad(_t('feedback.sub.category.no_id'), $url_redirect); + } + + // List feeds to remove then related user queries. + $feeds = $feedDAO->listByCategory($id); + + if ($feedDAO->deleteFeedByCategory($id)) { + // TODO: Delete old favicons + + // Remove related queries + foreach ($feeds as $feed) { + FreshRSS_Context::$user_conf->queries = remove_query_by_get( + 'f_' . $feed->id(), FreshRSS_Context::$user_conf->queries); + } + FreshRSS_Context::$user_conf->save(); + + Minz_Request::good(_t('feedback.sub.category.emptied'), $url_redirect); + } else { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } +} diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index ad8bc546a..e73f106a6 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -1,354 +1,331 @@ <?php +/** + * Controller to handle every configuration options. + */ class FreshRSS_configure_Controller extends Minz_ActionController { - public function firstAction () { - if (!$this->view->loginOk) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); } - - $catDAO = new FreshRSS_CategoryDAO (); - $catDAO->checkDefault (); } - public function categorizeAction () { - $feedDAO = new FreshRSS_FeedDAO (); - $catDAO = new FreshRSS_CategoryDAO (); - $defaultCategory = $catDAO->getDefault (); - $defaultId = $defaultCategory->id (); - - if (Minz_Request::isPost ()) { - $cats = Minz_Request::param ('categories', array ()); - $ids = Minz_Request::param ('ids', array ()); - $newCat = trim (Minz_Request::param ('new_category', '')); - - foreach ($cats as $key => $name) { - if (strlen ($name) > 0) { - $cat = new FreshRSS_Category ($name); - $values = array ( - 'name' => $cat->name (), - ); - $catDAO->updateCategory ($ids[$key], $values); - } elseif ($ids[$key] != $defaultId) { - $feedDAO->changeCategory ($ids[$key], $defaultId); - $catDAO->deleteCategory ($ids[$key]); - } - } - - if ($newCat != '') { - $cat = new FreshRSS_Category ($newCat); - $values = array ( - 'id' => $cat->id (), - 'name' => $cat->name (), - ); - - if ($catDAO->searchByName ($newCat) == false) { - $catDAO->addCategory ($values); - } - } + /** + * 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(); - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('categories_updated') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + Minz_Request::good(_t('feedback.conf.updated'), + array('c' => 'configure', 'a' => 'display')); } - $this->view->categories = $catDAO->listCategories (false); - $this->view->defaultCategory = $catDAO->getDefault (); - $this->view->feeds = $feedDAO->listFeeds (); - $this->view->flux = false; + $this->view->themes = FreshRSS_Themes::get(); - Minz_View::prependTitle (Minz_Translate::t ('categories_management') . ' · '); + Minz_View::prependTitle(_t('conf.display.title') . ' · '); } - public function feedAction () { - $catDAO = new FreshRSS_CategoryDAO (); - $this->view->categories = $catDAO->listCategories (false); - - $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); - - $id = Minz_Request::param ('id'); - if ($id == false && !empty ($this->view->feeds)) { - $id = current ($this->view->feeds)->id (); - } - - $this->view->flux = false; - if ($id != false) { - $this->view->flux = $this->view->feeds[$id]; - - if (!$this->view->flux) { - Minz_Error::error ( - 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) - ); - } else { - if (Minz_Request::isPost () && $this->view->flux) { - $user = Minz_Request::param ('http_user', ''); - $pass = Minz_Request::param ('http_pass', ''); - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - - $cat = intval(Minz_Request::param('category', 0)); - - $values = array ( - 'name' => Minz_Request::param ('name', ''), - 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), - 'website' => Minz_Request::param('website', ''), - 'url' => Minz_Request::param('url', ''), - 'category' => $cat, - 'pathEntries' => Minz_Request::param ('path_entries', ''), - 'priority' => intval(Minz_Request::param ('priority', 0)), - 'httpAuth' => $httpAuth, - 'keep_history' => intval(Minz_Request::param ('keep_history', -2)), - ); - - if ($feedDAO->updateFeed ($id, $values)) { - $this->view->flux->_category ($cat); - $this->view->flux->faviconPrepare(); - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_updated') - ); - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occurred_update') - ); - } - invalidateHttpCache(); - - Minz_Session::_param ('notification', $notif); - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true); - } - - Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' — ' . $this->view->flux->name () . ' · '); - } - } else { - Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' · '); - } - } - - public function displayAction () { + /** + * This action handles the reading configuration page. + * + * It displays the reading 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: + * - number of posts per page (default: 10) + * - view mode (default: normal) + * - default article view (default: all) + * - load automatically articles + * - display expanded articles + * - display expanded categories + * - hide categories and feeds without unread articles + * - jump on next category or feed when marked as read + * - image lazy loading + * - stick open articles to the top + * - display a confirmation when reading all articles + * - auto remove article after reading + * - article order (default: DESC) + * - mark articles as read when: + * - displayed + * - opened on site + * - scrolled + * - received + * Default values are false unless specified. + */ + public function readingAction() { 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( + FreshRSS_Context::$user_conf->posts_per_page = Minz_Request::param('posts_per_page', 10); + FreshRSS_Context::$user_conf->view_mode = Minz_Request::param('view_mode', 'normal'); + FreshRSS_Context::$user_conf->default_view = Minz_Request::param('default_view', 'adaptive'); + FreshRSS_Context::$user_conf->auto_load_more = Minz_Request::param('auto_load_more', false); + FreshRSS_Context::$user_conf->display_posts = Minz_Request::param('display_posts', false); + FreshRSS_Context::$user_conf->display_categories = Minz_Request::param('display_categories', false); + FreshRSS_Context::$user_conf->hide_read_feeds = Minz_Request::param('hide_read_feeds', false); + FreshRSS_Context::$user_conf->onread_jump_next = Minz_Request::param('onread_jump_next', false); + FreshRSS_Context::$user_conf->lazyload = Minz_Request::param('lazyload', false); + FreshRSS_Context::$user_conf->sticky_post = Minz_Request::param('sticky_post', false); + FreshRSS_Context::$user_conf->reading_confirm = Minz_Request::param('reading_confirm', false); + FreshRSS_Context::$user_conf->auto_remove_article = Minz_Request::param('auto_remove_article', false); + FreshRSS_Context::$user_conf->mark_updated_article_unread = Minz_Request::param('mark_updated_article_unread', false); + FreshRSS_Context::$user_conf->sort_order = Minz_Request::param('sort_order', 'DESC'); + FreshRSS_Context::$user_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); + FreshRSS_Context::$user_conf->save(); + invalidateHttpCache(); - Minz_Request::forward (array ('c' => 'configure', 'a' => 'display'), true); + Minz_Request::good(_t('feedback.conf.updated'), + array('c' => 'configure', 'a' => 'reading')); } - $this->view->themes = FreshRSS_Themes::get(); - - Minz_View::prependTitle (Minz_Translate::t ('reading_configuration') . ' · '); + Minz_View::prependTitle(_t('conf.reading.title') . ' · '); } - public function sharingAction () { - if (Minz_Request::isPost ()) { - $this->view->conf->_sharing (array( - 'shaarli' => Minz_Request::param ('shaarli', false), - 'wallabag' => Minz_Request::param ('wallabag', false), - 'diaspora' => Minz_Request::param ('diaspora', false), - 'twitter' => Minz_Request::param ('twitter', false), - 'g+' => Minz_Request::param ('g+', false), - 'facebook' => Minz_Request::param ('facebook', false), - 'email' => Minz_Request::param ('email', false), - 'print' => Minz_Request::param ('print', false), - )); - $this->view->conf->save(); + /** + * This action handles the sharing configuration page. + * + * It displays the sharing configuration page. + * If this action is reached through a POST request, it stores all + * configuration values then sends a notification to the user. + */ + public function sharingAction() { + if (Minz_Request::isPost()) { + $params = Minz_Request::fetchPOST(); + FreshRSS_Context::$user_conf->sharing = $params['share']; + FreshRSS_Context::$user_conf->save(); invalidateHttpCache(); - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('configuration_updated') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ('c' => 'configure', 'a' => 'sharing'), true); + Minz_Request::good(_t('feedback.conf.updated'), + array('c' => 'configure', 'a' => 'sharing')); } - Minz_View::prependTitle (Minz_Translate::t ('sharing') . ' · '); + Minz_View::prependTitle(_t('conf.sharing.title') . ' · '); } - public function importExportAction () { - require_once(LIB_PATH . '/lib_opml.php'); - $catDAO = new FreshRSS_CategoryDAO (); - $this->view->categories = $catDAO->listCategories (); + /** + * This action handles the shortcut configuration page. + * + * It displays the shortcut 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 authorized values for shortcuts are letters (a to z), numbers (0 + * to 9), function keys (f1 to f12), backspace, delete, down, end, enter, + * escape, home, insert, left, page down, page up, return, right, space, + * tab and up. + */ + public function shortcutAction() { + $list_keys = array('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter', + 'escape', 'f', 'g', 'h', 'home', 'i', 'insert', 'j', 'k', 'l', 'left', + 'm', 'n', 'o', 'p', 'page_down', 'page_up', 'q', 'r', 'return', 'right', + 's', 'space', 't', 'tab', 'u', 'up', 'v', 'w', 'x', 'y', + 'z', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', + 'f10', 'f11', 'f12'); + $this->view->list_keys = $list_keys; - $this->view->req = Minz_Request::param ('q'); + if (Minz_Request::isPost()) { + $shortcuts = Minz_Request::param('shortcuts'); + $shortcuts_ok = array(); + + foreach ($shortcuts as $key => $value) { + if (in_array($value, $list_keys)) { + $shortcuts_ok[$key] = $value; + } + } - if ($this->view->req == 'export') { - Minz_View::_title ('freshrss_feeds.opml'); + FreshRSS_Context::$user_conf->shortcuts = $shortcuts_ok; + FreshRSS_Context::$user_conf->save(); + invalidateHttpCache(); - $this->view->_useLayout (false); - header('Content-Type: application/xml; charset=utf-8'); - header('Content-disposition: attachment; filename=freshrss_feeds.opml'); + Minz_Request::good(_t('feedback.conf.shortcuts_updated'), + array('c' => 'configure', 'a' => 'shortcut')); + } - $feedDAO = new FreshRSS_FeedDAO (); - $catDAO = new FreshRSS_CategoryDAO (); + Minz_View::prependTitle(_t('conf.shortcut.title') . ' · '); + } - $list = array (); - foreach ($catDAO->listCategories () as $key => $cat) { - $list[$key]['name'] = $cat->name (); - $list[$key]['feeds'] = $feedDAO->listByCategory ($cat->id ()); - } + /** + * This action handles the archive configuration page. + * + * It displays the archive 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 that page are: + * - duration to retain old article (default: 3) + * - number of article to retain per feed (default: 0) + * - refresh frequency (default: -2) + * + * @todo explain why the default value is -2 but this value does not + * exist in the drop-down list + */ + public function archivingAction() { + if (Minz_Request::isPost()) { + FreshRSS_Context::$user_conf->old_entries = Minz_Request::param('old_entries', 3); + FreshRSS_Context::$user_conf->keep_history_default = Minz_Request::param('keep_history_default', 0); + FreshRSS_Context::$user_conf->ttl_default = Minz_Request::param('ttl_default', -2); + FreshRSS_Context::$user_conf->save(); + invalidateHttpCache(); - $this->view->categories = $list; - } elseif ($this->view->req == 'import' && Minz_Request::isPost ()) { - if ($_FILES['file']['error'] == 0) { - invalidateHttpCache(); - // on parse le fichier OPML pour récupérer les catégories et les flux associés - try { - list ($categories, $feeds) = opml_import ( - file_get_contents ($_FILES['file']['tmp_name']) - ); - - // On redirige vers le controller feed qui va se charger d'insérer les flux en BDD - // les flux sont mis au préalable dans des variables de Request - Minz_Request::_param ('q', 'null'); - Minz_Request::_param ('categories', $categories); - Minz_Request::_param ('feeds', $feeds); - Minz_Request::forward (array ('c' => 'feed', 'a' => 'massiveImport')); - } catch (FreshRSS_Opml_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('bad_opml_file') - ); - Minz_Session::_param ('notification', $notif); - - Minz_Request::forward (array ( - 'c' => 'configure', - 'a' => 'importExport' - ), true); - } - } + Minz_Request::good(_t('feedback.conf.updated'), + array('c' => 'configure', 'a' => 'archiving')); } - $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); + Minz_View::prependTitle(_t('conf.archiving.title') . ' · '); - // au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste - $this->view->flux = false; + $entryDAO = FreshRSS_Factory::createEntryDao(); + $this->view->nb_total = $entryDAO->count(); + $this->view->size_user = $entryDAO->size(); - Minz_View::prependTitle (Minz_Translate::t ('import_export_opml') . ' · '); + if (FreshRSS_Auth::hasAccess('admin')) { + $this->view->size_total = $entryDAO->size(true); + } } - public function shortcutAction () { - $list_keys = array ('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter', - 'escape', 'f', 'g', 'h', 'home', 'i', 'insert', 'j', 'k', 'l', 'left', - 'm', 'n', 'o', 'p', 'page_down', 'page_up', 'q', 'r', 'return', 'right', - 's', 'space', 't', 'tab', 'u', 'up', 'v', 'w', 'x', 'y', - 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', - '9', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', - 'f10', 'f11', 'f12'); - $this->view->list_keys = $list_keys; - - if (Minz_Request::isPost ()) { - $shortcuts = Minz_Request::param ('shortcuts'); - $shortcuts_ok = array (); + /** + * This action handles the user queries configuration page. + * + * If this action is reached through a POST request, it stores all new + * configuration values then sends a notification to the user then + * redirect to the same page. + * If this action is not reached through a POST request, it displays the + * configuration page and verifies that every user query is runable by + * checking if categories and feeds are still in use. + */ + public function queriesAction() { + $category_dao = new FreshRSS_CategoryDAO(); + $feed_dao = FreshRSS_Factory::createFeedDao(); + if (Minz_Request::isPost()) { + $params = Minz_Request::param('queries', array()); - foreach ($shortcuts as $key => $value) { - if (in_array($value, $list_keys)) { - $shortcuts_ok[$key] = $value; + foreach ($params as $key => $query) { + if (!$query['name']) { + $query['name'] = _t('conf.query.number', $key + 1); } + $queries[] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } + FreshRSS_Context::$user_conf->queries = $queries; + FreshRSS_Context::$user_conf->save(); - $this->view->conf->_shortcuts ($shortcuts_ok); - $this->view->conf->save(); - invalidateHttpCache(); + Minz_Request::good(_t('feedback.conf.updated'), + array('c' => 'configure', 'a' => 'queries')); + } else { + $this->view->queries = array(); + foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { + $this->view->queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); + } + } - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('shortcuts_updated') - ); - Minz_Session::_param ('notification', $notif); + Minz_View::prependTitle(_t('conf.query.title') . ' · '); + } - Minz_Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true); + /** + * This action handles the creation of a user query. + * + * It gets the GET parameters and stores them in the configuration query + * storage. Before it is saved, the unwanted parameters are unset to keep + * lean data. + */ + public function addQueryAction() { + $category_dao = new FreshRSS_CategoryDAO(); + $feed_dao = FreshRSS_Factory::createFeedDao(); + $queries = array(); + foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { + $queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); } + $params = Minz_Request::fetchGET(); + $params['url'] = Minz_Url::display(array('params' => $params)); + $params['name'] = _t('conf.query.number', count($queries) + 1); + $queries[] = new FreshRSS_UserQuery($params, $feed_dao, $category_dao); - Minz_View::prependTitle (Minz_Translate::t ('shortcuts') . ' · '); - } + FreshRSS_Context::$user_conf->queries = $queries; + FreshRSS_Context::$user_conf->save(); - public function usersAction() { - Minz_View::prependTitle(Minz_Translate::t ('users') . ' · '); + Minz_Request::good(_t('feedback.conf.query_created', $query['name']), + array('c' => 'configure', 'a' => 'queries')); } - public function archivingAction () { + /** + * This action handles the system configuration page. + * + * It displays the system configuration page. + * If this action is reach through a POST request, it stores all new + * configuration values then sends a notification to the user. + * + * The options available on the page are: + * - user limit (default: 1) + * - user category limit (default: 16384) + * - user feed limit (default: 16384) + */ + public function systemAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } if (Minz_Request::isPost()) { - $old = Minz_Request::param('old_entries', 3); - $keepHistoryDefault = Minz_Request::param('keep_history_default', 0); + $limits = FreshRSS_Context::$system_conf->limits; + $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); + $limits['max_feeds'] = Minz_Request::param('max-feeds', 16384); + $limits['max_categories'] = Minz_Request::param('max-categories', 16384); + FreshRSS_Context::$system_conf->limits = $limits; + FreshRSS_Context::$system_conf->title = Minz_Request::param('instance-name', 'FreshRSS'); + FreshRSS_Context::$system_conf->auto_update_url = Minz_Request::param('auto-update-url', false); + FreshRSS_Context::$system_conf->save(); - $this->view->conf->_old_entries($old); - $this->view->conf->_keep_history_default($keepHistoryDefault); - $this->view->conf->save(); invalidateHttpCache(); - $notif = array( + Minz_Session::_param('notification', array( 'type' => 'good', - 'content' => Minz_Translate::t('configuration_updated') - ); - Minz_Session::_param('notification', $notif); - - Minz_Request::forward(array('c' => 'configure', 'a' => 'archiving'), true); - } - - Minz_View::prependTitle(Minz_Translate::t('archiving_configuration') . ' · '); - - $entryDAO = new FreshRSS_EntryDAO(); - $this->view->nb_total = $entryDAO->count(); - $this->view->size_user = $entryDAO->size(); - - if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { - $this->view->size_total = $entryDAO->size(true); + 'content' => _t('feedback.conf.updated') + )); } } } diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 1756c91e5..c40588105 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -1,158 +1,203 @@ <?php +/** + * Controller to handle every entry actions. + */ class FreshRSS_entry_Controller extends Minz_ActionController { - public function firstAction () { - if (!$this->view->loginOk) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); } - $this->params = array (); - $output = Minz_Request::param('output', ''); - if (($output != '') && ($this->view->conf->view_mode !== $output)) { - $this->params['output'] = $output; - } - - $this->redirect = false; - $ajax = Minz_Request::param ('ajax'); - if ($ajax) { - $this->view->_useLayout (false); + // If ajax request, we do not print layout + $this->ajax = Minz_Request::param('ajax'); + if ($this->ajax) { + $this->view->_useLayout(false); + Minz_Request::_param('ajax'); } } - public function lastAction () { - $ajax = Minz_Request::param ('ajax'); - if (!$ajax && $this->redirect) { - Minz_Request::forward (array ( - 'c' => 'index', - 'a' => 'index', - 'params' => $this->params - ), true); + /** + * Mark one or several entries as read (or not!). + * + * If request concerns several entries, it MUST be a POST request. + * If request concerns several entries, only mark them as read is available. + * + * Parameters are: + * - id (default: false) + * - get (default: false) /(c_\d+|f_\d+|s|a)/ + * - nextGet (default: $get) + * - idMax (default: 0) + * - is_read (default: true) + */ + public function readAction() { + $id = Minz_Request::param('id'); + $get = Minz_Request::param('get'); + $next_get = Minz_Request::param('nextGet', $get); + $id_max = Minz_Request::param('idMax', 0); + FreshRSS_Context::$search = new FreshRSS_Search(Minz_Request::param('search', '')); + + FreshRSS_Context::$state = Minz_Request::param('state', 0); + if (FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_FAVORITE)) { + FreshRSS_Context::$state = FreshRSS_Entry::STATE_FAVORITE; + } elseif (FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_FAVORITE)) { + FreshRSS_Context::$state = FreshRSS_Entry::STATE_NOT_FAVORITE; } else { - Minz_Request::_param ('ajax'); + FreshRSS_Context::$state = 0; } - } - public function readAction () { - $this->redirect = true; + $params = array(); - $id = Minz_Request::param ('id'); - $get = Minz_Request::param ('get'); - $nextGet = Minz_Request::param ('nextGet', $get); - $idMax = Minz_Request::param ('idMax', 0); + $entryDAO = FreshRSS_Factory::createEntryDao(); + if ($id === false) { + // id is false? It MUST be a POST request! + if (!Minz_Request::isPost()) { + Minz_Request::bad(_t('feedback.access.not_found'), array('c' => 'index', 'a' => 'index')); + return; + } - $entryDAO = new FreshRSS_EntryDAO (); - if ($id == false) { if (!$get) { - $entryDAO->markReadEntries ($idMax); + // No get? Mark all entries as read (from $id_max) + $entryDAO->markReadEntries($id_max); } else { - $typeGet = $get[0]; - $get = substr ($get, 2); - switch ($typeGet) { - case 'c': - $entryDAO->markReadCat ($get, $idMax); - break; - case 'f': - $entryDAO->markReadFeed ($get, $idMax); - break; - case 's': - $entryDAO->markReadEntries ($idMax, true); - break; - case 'a': - $entryDAO->markReadEntries ($idMax); - break; + $type_get = $get[0]; + $get = substr($get, 2); + switch($type_get) { + case 'c': + $entryDAO->markReadCat($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state); + break; + case 'f': + $entryDAO->markReadFeed($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state); + break; + case 's': + $entryDAO->markReadEntries($id_max, true, 0, FreshRSS_Context::$search); + break; + case 'a': + $entryDAO->markReadEntries($id_max, false, 0, FreshRSS_Context::$search, FreshRSS_Context::$state); + break; } - if ($nextGet !== 'a') { - $this->params['get'] = $nextGet; + + if ($next_get !== 'a') { + // Redirect to the correct page (category, feed or starred) + // Not "a" because it is the default value if nothing is + // given. + $params['get'] = $next_get; } } - - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feeds_marked_read') - ); - Minz_Session::_param ('notification', $notif); } else { - $is_read = (bool)(Minz_Request::param ('is_read', true)); - $entryDAO->markRead ($id, $is_read); + $is_read = (bool)(Minz_Request::param('is_read', true)); + $entryDAO->markRead($id, $is_read); + } + + if (!$this->ajax) { + Minz_Request::good(_t('feedback.sub.feed.marked_read'), array( + 'c' => 'index', + 'a' => 'index', + 'params' => $params, + ), true); } } - public function bookmarkAction () { - $this->redirect = true; + /** + * This action marks an entry as favourite (bookmark) or not. + * + * Parameter is: + * - id (default: false) + * - is_favorite (default: true) + * If id is false, nothing happened. + */ + public function bookmarkAction() { + $id = Minz_Request::param('id'); + $is_favourite = (bool)Minz_Request::param('is_favorite', true); + if ($id !== false) { + $entryDAO = FreshRSS_Factory::createEntryDao(); + $entryDAO->markFavorite($id, $is_favourite); + } - $id = Minz_Request::param ('id'); - if ($id) { - $entryDAO = new FreshRSS_EntryDAO (); - $entryDAO->markFavorite ($id, (bool)(Minz_Request::param ('is_favorite', true))); + if (!$this->ajax) { + Minz_Request::forward(array( + 'c' => 'index', + 'a' => 'index', + ), true); } } + /** + * This action optimizes database to reduce its size. + * + * This action shouldbe reached by a POST request. + * + * @todo move this action in configure controller. + * @todo call this action through web-cron when available + */ public function optimizeAction() { - if (Minz_Request::isPost()) { - @set_time_limit(300); - - // La table des entrées a tendance à grossir énormément - // Cette action permet d'optimiser cette table permettant de grapiller un peu de place - // Cette fonctionnalité n'est à appeler qu'occasionnellement - $entryDAO = new FreshRSS_EntryDAO(); - $entryDAO->optimizeTable(); - - invalidateHttpCache(); - - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('optimization_complete') - ); - Minz_Session::_param ('notification', $notif); + $url_redirect = array( + 'c' => 'configure', + 'a' => 'archiving', + ); + + if (!Minz_Request::isPost()) { + Minz_Request::forward($url_redirect, true); } - Minz_Request::forward(array( - 'c' => 'configure', - 'a' => 'archiving' - ), true); + @set_time_limit(300); + + $entryDAO = FreshRSS_Factory::createEntryDao(); + $entryDAO->optimizeTable(); + + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feedDAO->updateCachedValues(); + + invalidateHttpCache(); + Minz_Request::good(_t('feedback.admin.optimization_complete'), $url_redirect); } + /** + * This action purges old entries from feeds. + * + * @todo should be a POST request + * @todo should be in feedController + */ public function purgeAction() { @set_time_limit(300); - $nb_month_old = max($this->view->conf->old_entries, 1); + $nb_month_old = max(FreshRSS_Context::$user_conf->old_entries, 1); $date_min = time() - (3600 * 24 * 30 * $nb_month_old); - $feedDAO = new FreshRSS_FeedDAO(); - $feeds = $feedDAO->listFeedsOrderUpdate(); - $nbTotal = 0; + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feeds = $feedDAO->listFeeds(); + $nb_total = 0; invalidateHttpCache(); foreach ($feeds as $feed) { - $feedHistory = $feed->keepHistory(); - if ($feedHistory == -2) { //default - $feedHistory = $this->view->conf->keep_history_default; + $feed_history = $feed->keepHistory(); + if ($feed_history == -2) { + // TODO: -2 must be a constant! + // -2 means we take the default value from configuration + $feed_history = FreshRSS_Context::$user_conf->keep_history_default; } - if ($feedHistory >= 0) { - $nb = $feedDAO->cleanOldEntries($feed->id(), $date_min, $feedHistory); + + if ($feed_history >= 0) { + $nb = $feedDAO->cleanOldEntries($feed->id(), $date_min, $feed_history); if ($nb > 0) { - $nbTotal += $nb; - Minz_Log::record($nb . ' old entries cleaned in feed [' . $feed->url() . ']', Minz_Log::DEBUG); - $feedDAO->updateLastUpdate($feed->id()); + $nb_total += $nb; + Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url() . ']'); } } } - invalidateHttpCache(); - - $notif = array( - 'type' => 'good', - 'content' => Minz_Translate::t('purge_completed', $nbTotal) - ); - Minz_Session::_param('notification', $notif); + $feedDAO->updateCachedValues(); - Minz_Request::forward(array( + invalidateHttpCache(); + Minz_Request::good(_t('feedback.sub.purge_completed', $nb_total), array( 'c' => 'configure', 'a' => 'archiving' - ), true); + )); } } diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php index dc9a2ee25..b0bafda72 100644 --- a/app/Controllers/errorController.php +++ b/app/Controllers/errorController.php @@ -1,26 +1,53 @@ <?php +/** + * Controller to handle error page. + */ class FreshRSS_error_Controller extends Minz_ActionController { - public function indexAction () { - switch (Minz_Request::param ('code')) { + /** + * This action is the default one for the controller. + * + * It is called by Minz_Error::error() method. + * + * Parameters are passed by Minz_Session to have a proper url: + * - error_code (default: 404) + * - error_logs (default: array()) + */ + public function indexAction() { + $code_int = Minz_Session::param('error_code', 404); + $error_logs = Minz_Session::param('error_logs', array()); + Minz_Session::_param('error_code'); + Minz_Session::_param('error_logs'); + + switch ($code_int) { + case 200 : + header('HTTP/1.1 200 OK'); + break; case 403: + header('HTTP/1.1 403 Forbidden'); $this->view->code = 'Error 403 - Forbidden'; - break; - case 404: - $this->view->code = 'Error 404 - Not found'; + $this->view->errorMessage = _t('feedback.access.denied'); break; case 500: + header('HTTP/1.1 500 Internal Server Error'); $this->view->code = 'Error 500 - Internal Server Error'; break; case 503: + header('HTTP/1.1 503 Service Unavailable'); $this->view->code = 'Error 503 - Service Unavailable'; break; + case 404: default: + header('HTTP/1.1 404 Not Found'); $this->view->code = 'Error 404 - Not found'; + $this->view->errorMessage = _t('feedback.access.not_found'); + } + + $error_message = trim(implode($error_logs)); + if ($error_message !== '') { + $this->view->errorMessage = $error_message; } - - $this->view->logs = Minz_Request::param ('logs'); - - Minz_View::prependTitle ($this->view->code . ' · '); + + Minz_View::prependTitle($this->view->code . ' · '); } } diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php new file mode 100644 index 000000000..b6d2d3fe4 --- /dev/null +++ b/app/Controllers/extensionController.php @@ -0,0 +1,215 @@ +<?php + +/** + * The controller to manage extensions. + */ +class FreshRSS_extension_Controller extends Minz_ActionController { + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + } + + /** + * This action lists all the extensions available to the current user. + */ + public function indexAction() { + Minz_View::prependTitle(_t('admin.extensions.title') . ' · '); + $this->view->extension_list = array( + 'system' => array(), + 'user' => array(), + ); + + $extensions = Minz_ExtensionManager::listExtensions(); + foreach ($extensions as $ext) { + $this->view->extension_list[$ext->getType()][] = $ext; + } + } + + /** + * This action handles configuration of a given extension. + * + * Only administrator can configure a system extension. + * + * Parameters are: + * - e: the extension name (urlencoded) + * - additional parameters which should be handle by the extension + * handleConfigureAction() method (POST request). + */ + public function configureAction() { + if (Minz_Request::param('ajax')) { + $this->view->_useLayout(false); + } else { + $this->indexAction(); + $this->view->change_view('extension', 'index'); + } + + $ext_name = urldecode(Minz_Request::param('e')); + $ext = Minz_ExtensionManager::findExtension($ext_name); + + if (is_null($ext)) { + Minz_Error::error(404); + } + if ($ext->getType() === 'system' && !FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + + $this->view->extension = $ext; + $this->view->extension->handleConfigureAction(); + } + + /** + * This action enables a disabled extension for the current user. + * + * System extensions can only be enabled by an administrator. + * This action must be reached by a POST request. + * + * Parameter is: + * - e: the extension name (urlencoded). + */ + public function enableAction() { + $url_redirect = array('c' => 'extension', 'a' => 'index'); + + if (Minz_Request::isPost()) { + $ext_name = urldecode(Minz_Request::param('e')); + $ext = Minz_ExtensionManager::findExtension($ext_name); + + if (is_null($ext)) { + Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), + $url_redirect); + } + + if ($ext->isEnabled()) { + Minz_Request::bad(_t('feedback.extensions.already_enabled', $ext_name), + $url_redirect); + } + + $conf = null; + if ($ext->getType() === 'system' && FreshRSS_Auth::hasAccess('admin')) { + $conf = FreshRSS_Context::$system_conf; + } elseif ($ext->getType() === 'user') { + $conf = FreshRSS_Context::$user_conf; + } else { + Minz_Request::bad(_t('feedback.extensions.no_access', $ext_name), + $url_redirect); + } + + $res = $ext->install(); + + if ($res === true) { + $ext_list = $conf->extensions_enabled; + array_push_unique($ext_list, $ext_name); + $conf->extensions_enabled = $ext_list; + $conf->save(); + + Minz_Request::good(_t('feedback.extensions.enable.ok', $ext_name), + $url_redirect); + } else { + Minz_Log::warning('Can not enable extension ' . $ext_name . ': ' . $res); + Minz_Request::bad(_t('feedback.extensions.enable.ko', $ext_name, _url('index', 'logs')), + $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action disables an enabled extension for the current user. + * + * System extensions can only be disabled by an administrator. + * This action must be reached by a POST request. + * + * Parameter is: + * - e: the extension name (urlencoded). + */ + public function disableAction() { + $url_redirect = array('c' => 'extension', 'a' => 'index'); + + if (Minz_Request::isPost()) { + $ext_name = urldecode(Minz_Request::param('e')); + $ext = Minz_ExtensionManager::findExtension($ext_name); + + if (is_null($ext)) { + Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), + $url_redirect); + } + + if (!$ext->isEnabled()) { + Minz_Request::bad(_t('feedback.extensions.not_enabled', $ext_name), + $url_redirect); + } + + $conf = null; + if ($ext->getType() === 'system' && FreshRSS_Auth::hasAccess('admin')) { + $conf = FreshRSS_Context::$system_conf; + } elseif ($ext->getType() === 'user') { + $conf = FreshRSS_Context::$user_conf; + } else { + Minz_Request::bad(_t('feedback.extensions.no_access', $ext_name), + $url_redirect); + } + + $res = $ext->uninstall(); + + if ($res === true) { + $ext_list = $conf->extensions_enabled; + array_remove($ext_list, $ext_name); + $conf->extensions_enabled = $ext_list; + $conf->save(); + + Minz_Request::good(_t('feedback.extensions.disable.ok', $ext_name), + $url_redirect); + } else { + Minz_Log::warning('Can not unable extension ' . $ext_name . ': ' . $res); + Minz_Request::bad(_t('feedback.extensions.disable.ko', $ext_name, _url('index', 'logs')), + $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action handles deletion of an extension. + * + * Only administrator can remove an extension. + * This action must be reached by a POST request. + * + * Parameter is: + * -e: extension name (urlencoded) + */ + public function removeAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + + $url_redirect = array('c' => 'extension', 'a' => 'index'); + + if (Minz_Request::isPost()) { + $ext_name = urldecode(Minz_Request::param('e')); + $ext = Minz_ExtensionManager::findExtension($ext_name); + + if (is_null($ext)) { + Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), + $url_redirect); + } + + $res = recursive_unlink($ext->getPath()); + if ($res) { + Minz_Request::good(_t('feedback.extensions.removed', $ext_name), + $url_redirect); + } else { + Minz_Request::bad(_t('feedback.extensions.cannot_delete', $ext_name), + $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } +} diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index c718fcd5c..f71f26a4e 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -1,451 +1,591 @@ <?php +/** + * Controller to handle every feed actions. + */ class FreshRSS_feed_Controller extends Minz_ActionController { - public function firstAction () { - if (!$this->view->loginOk) { + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { // Token is useful in the case that anonymous refresh is forbidden // and CRON task cannot be used with php command so the user can // set a CRON task to refresh his feeds by using token inside url - $token = $this->view->conf->token; - $token_param = Minz_Request::param ('token', ''); + $token = FreshRSS_Context::$user_conf->token; + $token_param = Minz_Request::param('token', ''); $token_is_ok = ($token != '' && $token == $token_param); - $action = Minz_Request::actionName (); - if (!(($token_is_ok || Minz_Configuration::allowAnonymousRefresh()) && - $action === 'actualize') - ) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); + $action = Minz_Request::actionName(); + $allow_anonymous_refresh = FreshRSS_Context::$system_conf->allow_anonymous_refresh; + if ($action !== 'actualize' || + !($allow_anonymous_refresh || $token_is_ok)) { + Minz_Error::error(403); } } } - public function addAction () { + public static function addFeed($url, $title = '', $cat_id = 0, $new_cat_name = '', $http_auth = '') { + FreshRSS_UserDAO::touch(); @set_time_limit(300); - if (Minz_Request::isPost ()) { - $this->catDAO = new FreshRSS_CategoryDAO (); - $this->catDAO->checkDefault (); + $catDAO = new FreshRSS_CategoryDAO(); - $url = Minz_Request::param ('url_rss'); - $cat = Minz_Request::param ('category', false); - if ($cat === false) { - $def_cat = $this->catDAO->getDefault (); - $cat = $def_cat->id (); + $cat = null; + if ($cat_id > 0) { + $cat = $catDAO->searchById($cat_id); + } + if ($cat == null && $new_cat_name != '') { + $cat = $catDAO->addCategory(array('name' => $new_cat_name)); + } + if ($cat == null) { + $catDAO->checkDefault(); + } + $cat_id = $cat == null ? FreshRSS_CategoryDAO::defaultCategoryId : $cat->id(); + + $feed = new FreshRSS_Feed($url); //Throws FreshRSS_BadUrl_Exception + $feed->_httpAuth($http_auth); + $feed->load(true); //Throws FreshRSS_Feed_Exception, Minz_FileNotExistException + $feed->_category($cat_id); + + $feedDAO = FreshRSS_Factory::createFeedDao(); + if ($feedDAO->searchByUrl($feed->url())) { + throw new FreshRSS_AlreadySubscribed_Exception($url, $feed->name()); + } + + // Call the extension hook + $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); + if ($feed === null) { + throw new FreshRSS_FeedNotAdded_Exception($url, $feed->name()); + } + + $values = array( + 'url' => $feed->url(), + 'category' => $feed->category(), + 'name' => $title != '' ? $title : $feed->name(), + 'website' => $feed->website(), + 'description' => $feed->description(), + 'lastUpdate' => time(), + 'httpAuth' => $feed->httpAuth(), + ); + + $id = $feedDAO->addFeed($values); + if (!$id) { + // There was an error in database... we cannot say what here. + throw new FreshRSS_FeedNotAdded_Exception($url, $feed->name()); + } + $feed->_id($id); + + // Ok, feed has been added in database. Now we have to refresh entries. + self::actualizeFeed($id, $url, false, null, true); + + return $feed; + } + + /** + * This action subscribes to a feed. + * + * It can be reached by both GET and POST requests. + * + * GET request displays a form to add and configure a feed. + * Request parameter is: + * - url_rss (default: false) + * + * POST request adds a feed in database. + * Parameters are: + * - url_rss (default: false) + * - category (default: false) + * - new_category (required if category == 'nc') + * - http_user (default: false) + * - http_pass (default: false) + * It tries to get website information from RSS feed. + * If no category is given, feed is added to the default one. + * + * If url_rss is false, nothing happened. + */ + public function addAction() { + $url = Minz_Request::param('url_rss'); + + if ($url === false) { + // No url, do nothing + Minz_Request::forward(array( + 'c' => 'subscription', + 'a' => 'index' + ), true); + } + + $feedDAO = FreshRSS_Factory::createFeedDao(); + $url_redirect = array( + 'c' => 'subscription', + 'a' => 'index', + 'params' => array(), + ); + + $limits = FreshRSS_Context::$system_conf->limits; + $this->view->feeds = $feedDAO->listFeeds(); + if (count($this->view->feeds) >= $limits['max_feeds']) { + Minz_Request::bad(_t('feedback.sub.feed.over_max', $limits['max_feeds']), + $url_redirect); + } + + if (Minz_Request::isPost()) { + $cat = Minz_Request::param('category'); + $new_cat_name = ''; + if ($cat === 'nc') { + // User want to create a new category, new_category parameter + // must exist + $new_cat = Minz_Request::param('new_category'); + $new_cat_name = isset($new_cat['name']) ? $new_cat['name'] : ''; } - $user = Minz_Request::param ('http_user'); - $pass = Minz_Request::param ('http_pass'); - $params = array (); + // HTTP information are useful if feed is protected behind a + // HTTP authentication + $user = trim(Minz_Request::param('http_user', '')); + $pass = Minz_Request::param('http_pass', ''); + $http_auth = ''; + if ($user != '' && $pass != '') { //TODO: Sanitize + $http_auth = $user . ':' . $pass; + } - $transactionStarted = false; try { - $feed = new FreshRSS_Feed ($url); - $feed->_category ($cat); - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - $feed->_httpAuth ($httpAuth); - - $feed->load(true); - - $feedDAO = new FreshRSS_FeedDAO (); - $values = array ( - 'url' => $feed->url (), - 'category' => $feed->category (), - 'name' => $feed->name (), - 'website' => $feed->website (), - 'description' => $feed->description (), - 'lastUpdate' => time (), - 'httpAuth' => $feed->httpAuth (), - ); - - if ($feedDAO->searchByUrl ($values['url'])) { - // on est déjà abonné à ce flux - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('already_subscribed', $feed->name ()) - ); - Minz_Session::_param ('notification', $notif); - } else { - $id = $feedDAO->addFeed ($values); - if (!$id) { - // problème au niveau de la base de données - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('feed_not_added', $feed->name ()) - ); - Minz_Session::_param ('notification', $notif); - } else { - $feed->_id ($id); - $feed->faviconPrepare(); - - $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; - - $entryDAO = new FreshRSS_EntryDAO (); - $entries = array_reverse($feed->entries()); //We want chronological order and SimplePie uses reverse order - - // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = $this->view->conf->old_entries; - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); - - $transactionStarted = true; - $feedDAO->beginTransaction (); - // on ajoute les articles en masse sans vérification - foreach ($entries as $entry) { - $values = $entry->toArray (); - $values['id_feed'] = $feed->id (); - $values['id'] = min(time(), $entry->date (true)) . uSecString(); - $values['is_read'] = $is_read; - $entryDAO->addEntry ($values); - } - $feedDAO->updateLastUpdate ($feed->id ()); - $feedDAO->commit (); - $transactionStarted = false; - - // ok, ajout terminé - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_added', $feed->name ()) - ); - Minz_Session::_param ('notification', $notif); - - // permet de rediriger vers la page de conf du flux - $params['id'] = $feed->id (); - } - } + $feed = self::addFeed($url, '', $cat, $new_cat_name, $http_auth); } catch (FreshRSS_BadUrl_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('invalid_url', $url) - ); - Minz_Session::_param ('notification', $notif); + // Given url was not a valid url! + Minz_Log::warning($e->getMessage()); + Minz_Request::bad(_t('feedback.sub.feed.invalid_url', $url), $url_redirect); } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('internal_problem_feed') - ); - Minz_Session::_param ('notification', $notif); + // Something went bad (timeout, server not found, etc.) + Minz_Log::warning($e->getMessage()); + Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); } catch (Minz_FileNotExistException $e) { - // Répertoire de cache n'existe pas - Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('internal_problem_feed') - ); - Minz_Session::_param ('notification', $notif); + // Cache directory doesn't exist! + Minz_Log::error($e->getMessage()); + Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); + } catch (FreshRSS_AlreadySubscribed_Exception $e) { + Minz_Request::bad(_t('feedback.sub.feed.already_subscribed', $e->feedName()), $url_redirect); + } catch (FreshRSS_FeedNotAdded_Exception $e) { + Minz_Request::bad(_t('feedback.sub.feed.not_added', $e->feedName()), $url_redirect); } - if ($transactionStarted) { - $feedDAO->rollBack (); + + // Entries are in DB, we redirect to feed configuration page. + $url_redirect['params']['id'] = $feed->id(); + Minz_Request::good(_t('feedback.sub.feed.added', $feed->name()), $url_redirect); + } else { + // GET request: we must ask confirmation to user before adding feed. + Minz_View::prependTitle(_t('sub.feed.title_add') . ' · '); + + $this->catDAO = new FreshRSS_CategoryDAO(); + $this->view->categories = $this->catDAO->listCategories(false); + $this->view->feed = new FreshRSS_Feed($url); + try { + // We try to get more information about the feed. + $this->view->feed->load(true); + $this->view->load_ok = true; + } catch (Exception $e) { + $this->view->load_ok = false; } - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); + $feed = $feedDAO->searchByUrl($this->view->feed->url()); + if ($feed) { + // Already subscribe so we redirect to the feed configuration page. + $url_redirect['params']['id'] = $feed->id(); + Minz_Request::good(_t('feedback.sub.feed.already_subscribed', $feed->name()), $url_redirect); + } } } - public function truncateAction () { - if (Minz_Request::isPost ()) { - $id = Minz_Request::param ('id'); - $feedDAO = new FreshRSS_FeedDAO (); - $n = $feedDAO->truncate($id); - $notif = array( - 'type' => $n === false ? 'bad' : 'good', - 'content' => Minz_Translate::t ('n_entries_deleted', $n) - ); - Minz_Session::_param ('notification', $notif); - invalidateHttpCache(); - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true); + /** + * This action remove entries from a given feed. + * + * It should be reached by a POST action. + * + * Parameter is: + * - id (default: false) + */ + public function truncateAction() { + $id = Minz_Request::param('id'); + $url_redirect = array( + 'c' => 'subscription', + 'a' => 'index', + 'params' => array('id' => $id) + ); + + if (!Minz_Request::isPost()) { + Minz_Request::forward($url_redirect, true); + } + + $feedDAO = FreshRSS_Factory::createFeedDao(); + $n = $feedDAO->truncate($id); + + invalidateHttpCache(); + if ($n === false) { + Minz_Request::bad(_t('feedback.sub.feed.error'), $url_redirect); + } else { + Minz_Request::good(_t('feedback.sub.feed.n_entries_deleted', $n), $url_redirect); } } - public function actualizeAction () { + public static function actualizeFeed($feed_id, $feed_url, $force, $simplePiePush = null, $isNewFeed = false) { @set_time_limit(300); - $feedDAO = new FreshRSS_FeedDAO (); - $entryDAO = new FreshRSS_EntryDAO (); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $entryDAO = FreshRSS_Factory::createEntryDao(); - Minz_Session::_param('actualize_feeds', false); - $id = Minz_Request::param ('id'); - $force = Minz_Request::param ('force', false); - - // on créé la liste des flux à mettre à actualiser - // si on veut mettre un flux à jour spécifiquement, on le met - // dans la liste, mais seul (permet d'automatiser le traitement) - $feeds = array (); - if ($id) { - $feed = $feedDAO->searchById ($id); + // Create a list of feeds to actualize. + // If feed_id is set and valid, corresponding feed is added to the list but + // alone in order to automatize further process. + $feeds = array(); + if ($feed_id > 0 || $feed_url) { + $feed = $feed_id > 0 ? $feedDAO->searchById($feed_id) : $feedDAO->searchByUrl($feed_url); if ($feed) { - $feeds = array ($feed); + $feeds[] = $feed; } } else { - $feeds = $feedDAO->listFeedsOrderUpdate (); + $feeds = $feedDAO->listFeedsOrderUpdate(-1); } - // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = max($this->view->conf->old_entries, 1); - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + // Calculate date of oldest entries we accept in DB. + $nb_month_old = max(FreshRSS_Context::$user_conf->old_entries, 1); + $date_min = time() - (3600 * 24 * 30 * $nb_month_old); - $i = 0; - $flux_update = 0; - $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; + // PubSubHubbub support + $pubsubhubbubEnabledGeneral = FreshRSS_Context::$system_conf->pubsubhubbub_enabled; + $pshbMinAge = time() - (3600 * 24); //TODO: Make a configuration. + + $updated_feeds = 0; + $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { + $url = $feed->url(); //For detection of HTTP 301 + + $pubSubHubbubEnabled = $pubsubhubbubEnabledGeneral && $feed->pubSubHubbubEnabled(); + if ((!$simplePiePush) && (!$feed_id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { + //$text = 'Skip pull of feed using PubSubHubbub: ' . $url; + //Minz_Log::debug($text); + //file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + continue; //When PubSubHubbub is used, do not pull refresh so often + } + + $mtime = 0; + $ttl = $feed->ttl(); + if ($ttl == -1) { + continue; //Feed refresh is disabled + } + if ((!$simplePiePush) && (!$feed_id) && + ($feed->lastUpdate() + 10 >= time() - ($ttl == -2 ? FreshRSS_Context::$user_conf->ttl_default : $ttl))) { + //Too early to refresh from source, but check whether the feed was updated by another user + $mtime = $feed->cacheModifiedTime(); + if ($feed->lastUpdate() + 10 >= $mtime) { + continue; //Nothing newer from other users + } + //Minz_Log::debug($feed->url() . ' was updated at ' . date('c', $mtime) . ' by another user'); + //Will take advantage of the newer cache + } + if (!$feed->lock()) { - Minz_Log::record('Feed already being actualized: ' . $feed->url(), Minz_Log::NOTICE); + Minz_Log::notice('Feed already being actualized: ' . $feed->url()); continue; } + try { - $url = $feed->url(); - $feedHistory = $feed->keepHistory(); + if ($simplePiePush) { + $feed->loadEntries($simplePiePush); //Used by PubSubHubbub + } else { + $feed->load(false, $isNewFeed); + } + } catch (FreshRSS_Feed_Exception $e) { + Minz_Log::warning($e->getMessage()); + $feedDAO->updateLastUpdate($feed->id(), true); + $feed->unlock(); + continue; + } - $feed->load(false); - $entries = array_reverse($feed->entries()); //We want chronological order and SimplePie uses reverse order - $hasTransaction = false; + $feed_history = $feed->keepHistory(); + if ($isNewFeed) { + $feed_history = -1; //∞ + } elseif ($feed_history == -2) { + // TODO: -2 must be a constant! + // -2 means we take the default value from configuration + $feed_history = FreshRSS_Context::$user_conf->keep_history_default; + } - if (count($entries) > 0) { - //For this feed, check last n entry GUIDs already in database - $existingGuids = array_fill_keys ($entryDAO->listLastGuidsByFeed ($feed->id (), count($entries) + 10), 1); - $useDeclaredDate = empty($existingGuids); + // We want chronological order and SimplePie uses reverse order. + $entries = array_reverse($feed->entries()); + if (count($entries) > 0) { + $newGuids = array(); + foreach ($entries as $entry) { + $newGuids[] = safe_ascii($entry->guid()); + } + // For this feed, check existing GUIDs already in database. + $existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids); + unset($newGuids); + + $oldGuids = array(); + // Add entries in database if possible. + foreach ($entries as $entry) { + $entry_date = $entry->date(true); + if (isset($existingHashForGuids[$entry->guid()])) { + $existingHash = $existingHashForGuids[$entry->guid()]; + if (strcasecmp($existingHash, $entry->hash()) === 0 || trim($existingHash, '0') == '') { + //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3 + $oldGuids[] = $entry->guid(); + } else { //This entry already exists but has been updated + //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->id() . + //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); + //TODO: Make an updated/is_read policy by feed, in addition to the global one. + $entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy. + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->updateEntry($entry->toArray()); + } + } elseif ($feed_history == 0 && $entry_date < $date_min) { + // This entry should not be added considering configuration and date. + $oldGuids[] = $entry->guid(); + } else { + if ($isNewFeed) { + $id = min(time(), $entry_date) . uSecString(); + } elseif ($entry_date < $date_min) { + $id = min(time(), $entry_date) . uSecString(); + $entry->_isRead(true); //Old article that was not in database. Probably an error, so mark as read + } else { + $id = uTimeString(); + $entry->_isRead($is_read); + } + $entry->_id($id); - if ($feedHistory == -2) { //default - $feedHistory = $this->view->conf->keep_history_default; - } + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); + if ($entry === null) { + // An extension has returned a null value, there is nothing to insert. + continue; + } - $hasTransaction = true; - $feedDAO->beginTransaction(); - - // On ne vérifie pas strictement que l'article n'est pas déjà en BDD - // La BDD refusera l'ajout car (id_feed, guid) doit être unique - foreach ($entries as $entry) { - $eDate = $entry->date (true); - if ((!isset ($existingGuids[$entry->guid ()])) && - (($feedHistory != 0) || ($eDate >= $date_min))) { - $values = $entry->toArray (); - //Use declared date at first import, otherwise use discovery date - $values['id'] = ($useDeclaredDate || $eDate < $date_min) ? - min(time(), $eDate) . uSecString() : - uTimeString(); - $values['is_read'] = $is_read; - $entryDAO->addEntry ($values); + if ($pubSubHubbubEnabled && !$simplePiePush) { //We use push, but have discovered an article by pull! + $text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' . $url . ' GUID ' . $entry->guid(); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + Minz_Log::warning($text); + $pubSubHubbubEnabled = false; + $feed->pubSubHubbubError(true); } + + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); + } + $entryDAO->addEntry($entry->toArray()); } } + $entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime); + } - if (($feedHistory >= 0) && (rand(0, 30) === 1)) { - if (!$hasTransaction) { - $feedDAO->beginTransaction(); - } - $nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, max($feedHistory, count($entries) + 10)); - if ($nb > 0) { - Minz_Log::record ($nb . ' old entries cleaned in feed [' . $feed->url() . ']', Minz_Log::DEBUG); - } + if ($feed_history >= 0 && rand(0, 30) === 1) { + // TODO: move this function in web cron when available (see entry::purge) + // Remove old entries once in 30. + if (!$entryDAO->inTransaction()) { + $entryDAO->beginTransaction(); } - // on indique que le flux vient d'être mis à jour en BDD - $feedDAO->updateLastUpdate ($feed->id (), 0, $hasTransaction); - if ($hasTransaction) { - $feedDAO->commit(); + $nb = $feedDAO->cleanOldEntries($feed->id(), + $date_min, + max($feed_history, count($entries) + 10)); + if ($nb > 0) { + Minz_Log::debug($nb . ' old entries cleaned in feed [' . + $feed->url() . ']'); } - $flux_update++; - if ($feed->url() !== $url) { //URL has changed (auto-discovery) - $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); + } + + $feedDAO->updateLastUpdate($feed->id(), false, $entryDAO->inTransaction(), $mtime); + if ($entryDAO->inTransaction()) { + $entryDAO->commit(); + } + + if ($feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for PubSubHubbub + if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs + $selfUrl = checkUrl($feed->selfUrl()); + if ($selfUrl) { + Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe + Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url()); + } + $feed->_url($selfUrl, false); + Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url()); + $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); + } } - } catch (FreshRSS_Feed_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); - $feedDAO->updateLastUpdate ($feed->id (), 1); + } + elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently + Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url()); + $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } $feed->faviconPrepare(); + if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) { + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); + } + } $feed->unlock(); + $updated_feeds++; unset($feed); - // On arrête à 10 flux pour ne pas surcharger le serveur - // sauf si le paramètre $force est à vrai - $i++; - if ($i >= 10 && !$force) { + // No more than 10 feeds unless $force is true to avoid overloading + // the server. + if ($updated_feeds >= 10 && !$force) { break; } } + return array($updated_feeds, reset($feeds)); + } - $url = array (); - if ($flux_update === 1) { - // on a mis un seul flux à jour - $feed = reset ($feeds); - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_actualized', $feed->name ()) - ); - } elseif ($flux_update > 1) { - // plusieurs flux on été mis à jour - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('n_feeds_actualized', $flux_update) - ); - } else { - // aucun flux n'a été mis à jour, oups - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('no_feed_to_refresh') - ); - } + /** + * This action actualizes entries from one or several feeds. + * + * Parameters are: + * - id (default: false): Feed ID + * - url (default: false): Feed URL + * - force (default: false) + * If id and url are not specified, all the feeds are actualized. But if force is + * false, process stops at 10 feeds to avoid time execution problem. + */ + public function actualizeAction() { + Minz_Session::_param('actualize_feeds', false); + $id = Minz_Request::param('id'); + $url = Minz_Request::param('url'); + $force = Minz_Request::param('force'); - if ($i === 1) { - // Si on a voulu mettre à jour qu'un flux - // on filtre l'affichage par ce flux - $feed = reset ($feeds); - $url['params'] = array ('get' => 'f_' . $feed->id ()); - } + list($updated_feeds, $feed) = self::actualizeFeed($id, $url, $force); - if (Minz_Request::param ('ajax', 0) === 0) { - Minz_Session::_param ('notification', $notif); - Minz_Request::forward ($url, true); - } else { - // Une requête Ajax met un seul flux à jour. - // Comme en principe plusieurs requêtes ont lieu, - // on indique que "plusieurs flux ont été mis à jour". - // Cela permet d'avoir une notification plus proche du - // ressenti utilisateur - $notif = array ( + if (Minz_Request::param('ajax')) { + // Most of the time, ajax request is for only one feed. But since + // there are several parallel requests, we should return that there + // are several updated feeds. + $notif = array( 'type' => 'good', - 'content' => Minz_Translate::t ('feeds_actualized') + 'content' => _t('feedback.sub.feed.actualizeds') ); - Minz_Session::_param ('notification', $notif); - // et on désactive le layout car ne sert à rien - $this->view->_useLayout (false); + Minz_Session::_param('notification', $notif); + // No layout in ajax request. + $this->view->_useLayout(false); + } else { + // Redirect to the main page with correct notification. + if ($updated_feeds === 1) { + Minz_Request::good(_t('feedback.sub.feed.actualized', $feed->name()), array( + 'params' => array('get' => 'f_' . $feed->id()) + )); + } elseif ($updated_feeds > 1) { + Minz_Request::good(_t('feedback.sub.feed.n_actualized', $updated_feeds), array()); + } else { + Minz_Request::good(_t('feedback.sub.feed.no_refresh'), array()); + } } + return $updated_feeds; } - public function massiveImportAction () { - @set_time_limit(300); - - $this->catDAO = new FreshRSS_CategoryDAO (); - $this->catDAO->checkDefault (); - - $entryDAO = new FreshRSS_EntryDAO (); - $feedDAO = new FreshRSS_FeedDAO (); + public static function renameFeed($feed_id, $feed_name) { + if ($feed_id <= 0 || $feed_name == '') { + return false; + } + FreshRSS_UserDAO::touch(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + return $feedDAO->updateFeed($feed_id, array('name' => $feed_name)); + } - $categories = Minz_Request::param ('categories', array (), true); - $feeds = Minz_Request::param ('feeds', array (), true); + public static function moveFeed($feed_id, $cat_id, $new_cat_name = '') { + if ($feed_id <= 0 || ($cat_id <= 0 && $new_cat_name == '')) { + return false; + } + FreshRSS_UserDAO::touch(); - // on ajoute les catégories en masse dans une fonction à part - $this->addCategories ($categories); + $catDAO = new FreshRSS_CategoryDAO(); + if ($cat_id > 0) { + $cat = $catDAO->searchById($cat_id); + $cat_id = $cat == null ? 0 : $cat->id(); + } + if ($cat_id <= 1 && $new_cat_name != '') { + $cat_id = $catDAO->addCategory(array('name' => $new_cat_name)); + } + if ($cat_id <= 1) { + $catDAO->checkDefault(); + $cat_id = FreshRSS_CategoryDAO::defaultCategoryId; + } - // on calcule la date des articles les plus anciens qu'on accepte - $nb_month_old = $this->view->conf->old_entries; - $date_min = time () - (3600 * 24 * 30 * $nb_month_old); + $feedDAO = FreshRSS_Factory::createFeedDao(); + return $feedDAO->updateFeed($feed_id, array('category' => $cat_id)); + } - // la variable $error permet de savoir si une erreur est survenue - // Le but est de ne pas arrêter l'import même en cas d'erreur - // L'utilisateur sera mis au courant s'il y a eu des erreurs, mais - // ne connaîtra pas les détails. Ceux-ci seront toutefois logguées - $error = false; - $i = 0; - foreach ($feeds as $feed) { - try { - $values = array ( - 'id' => $feed->id (), - 'url' => $feed->url (), - 'category' => $feed->category (), - 'name' => $feed->name (), - 'website' => $feed->website (), - 'description' => $feed->description (), - 'lastUpdate' => 0, - 'httpAuth' => $feed->httpAuth () - ); - - // ajout du flux que s'il n'est pas déjà en BDD - if (!$feedDAO->searchByUrl ($values['url'])) { - $id = $feedDAO->addFeed ($values); - if ($id) { - $feed->_id ($id); - $feed->faviconPrepare(); - } else { - $error = true; - } - } - } catch (FreshRSS_Feed_Exception $e) { - $error = true; - Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); - } + /** + * This action changes the category of a feed. + * + * This page must be reached by a POST request. + * + * Parameters are: + * - f_id (default: false) + * - c_id (default: false) + * If c_id is false, default category is used. + * + * @todo should handle order of the feed inside the category. + */ + public function moveAction() { + if (!Minz_Request::isPost()) { + Minz_Request::forward(array('c' => 'subscription'), true); } - if ($error) { - $res = Minz_Translate::t ('feeds_imported_with_errors'); + $feed_id = Minz_Request::param('f_id'); + $cat_id = Minz_Request::param('c_id'); + + if (self::moveFeed($feed_id, $cat_id)) { + // TODO: return something useful } else { - $res = Minz_Translate::t ('feeds_imported'); + Minz_Log::warning('Cannot move feed `' . $feed_id . '` ' . + 'in the category `' . $cat_id . '`'); + Minz_Error::error(404); } - - $notif = array ( - 'type' => 'good', - 'content' => $res - ); - Minz_Session::_param ('notification', $notif); - Minz_Session::_param ('actualize_feeds', true); - - // et on redirige vers la page d'accueil - Minz_Request::forward (array ( - 'c' => 'index', - 'a' => 'index' - ), true); } - public function deleteAction () { - if (Minz_Request::isPost ()) { - $type = Minz_Request::param ('type', 'feed'); - $id = Minz_Request::param ('id'); - - $feedDAO = new FreshRSS_FeedDAO (); - if ($type == 'category') { - if ($feedDAO->deleteFeedByCategory ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('category_emptied') - ); - //TODO: Delete old favicons - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occured') - ); - } - } else { - if ($feedDAO->deleteFeed ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_deleted') - ); - //TODO: Delete old favicon - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occured') - ); - } - } + public static function deleteFeed($feed_id) { + FreshRSS_UserDAO::touch(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + if ($feedDAO->deleteFeed($feed_id)) { + // TODO: Delete old favicon - Minz_Session::_param ('notification', $notif); + // Remove related queries + FreshRSS_Context::$user_conf->queries = remove_query_by_get( + 'f_' . $feed_id, FreshRSS_Context::$user_conf->queries); + FreshRSS_Context::$user_conf->save(); - if ($type == 'category') { - Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); - } else { - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); - } + return true; } + return false; } - private function addCategories ($categories) { - foreach ($categories as $cat) { - if (!$this->catDAO->searchByName ($cat->name ())) { - $values = array ( - 'id' => $cat->id (), - 'name' => $cat->name (), - ); - $catDAO->addCategory ($values); - } + /** + * This action deletes a feed. + * + * This page must be reached by a POST request. + * If there are related queries, they are deleted too. + * + * Parameters are: + * - id (default: false) + * - r (default: false) + * r permits to redirect to a given page at the end of this action. + * + * @todo handle "r" redirection in Minz_Request::forward()? + */ + public function deleteAction() { + $redirect_url = Minz_Request::param('r', false, true); + if (!$redirect_url) { + $redirect_url = array('c' => 'subscription', 'a' => 'index'); + } + if (!Minz_Request::isPost()) { + Minz_Request::forward($redirect_url, true); + } + + $id = Minz_Request::param('id'); + + if (self::deleteFeed($id)) { + Minz_Request::good(_t('feedback.sub.feed.deleted'), $redirect_url); + } else { + Minz_Request::bad(_t('feedback.sub.feed.error'), $redirect_url); } } } diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php new file mode 100644 index 000000000..6ae89defb --- /dev/null +++ b/app/Controllers/importExportController.php @@ -0,0 +1,716 @@ +<?php + +/** + * Controller to handle every import and export actions. + */ +class FreshRSS_importExport_Controller extends Minz_ActionController { + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + + require_once(LIB_PATH . '/lib_opml.php'); + + $this->catDAO = new FreshRSS_CategoryDAO(); + $this->entryDAO = FreshRSS_Factory::createEntryDao(); + $this->feedDAO = FreshRSS_Factory::createFeedDao(); + } + + /** + * This action displays the main page for import / export system. + */ + public function indexAction() { + $this->view->feeds = $this->feedDAO->listFeeds(); + Minz_View::prependTitle(_t('sub.import_export.title') . ' · '); + } + + public function importFile($name, $path, $username = null) { + require_once(LIB_PATH . '/lib_opml.php'); + + $this->catDAO = new FreshRSS_CategoryDAO($username); + $this->entryDAO = FreshRSS_Factory::createEntryDao($username); + $this->feedDAO = FreshRSS_Factory::createFeedDao($username); + + $type_file = self::guessFileType($name); + + $list_files = array( + 'opml' => array(), + 'json_starred' => array(), + 'json_feed' => array() + ); + + // We try to list all files according to their type + $list = array(); + if ($type_file === 'zip' && extension_loaded('zip')) { + $zip = zip_open($path); + if (!is_resource($zip)) { + // zip_open cannot open file: something is wrong + throw new FreshRSS_Zip_Exception($zip); + } + while (($zipfile = zip_read($zip)) !== false) { + if (!is_resource($zipfile)) { + // zip_entry() can also return an error code! + throw new FreshRSS_Zip_Exception($zipfile); + } else { + $type_zipfile = self::guessFileType(zip_entry_name($zipfile)); + if ($type_file !== 'unknown') { + $list_files[$type_zipfile][] = zip_entry_read( + $zipfile, + zip_entry_filesize($zipfile) + ); + } + } + } + zip_close($zip); + } elseif ($type_file === 'zip') { + // ZIP extension is not loaded + throw new FreshRSS_ZipMissing_Exception(); + } elseif ($type_file !== 'unknown') { + $list_files[$type_file][] = file_get_contents($path); + } + + // Import file contents. + // OPML first(so categories and feeds are imported) + // Starred articles then so the "favourite" status is already set + // And finally all other files. + $ok = true; + foreach ($list_files['opml'] as $opml_file) { + if (!$this->importOpml($opml_file)) { + $ok = false; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML import' . "\n"); + } else { + Minz_Log::warning('Error during OPML import'); + } + } + } + foreach ($list_files['json_starred'] as $article_file) { + if (!$this->importJson($article_file, true)) { + $ok = false; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during JSON stars import' . "\n"); + } else { + Minz_Log::warning('Error during JSON stars import'); + } + } + } + foreach ($list_files['json_feed'] as $article_file) { + if (!$this->importJson($article_file)) { + $ok = false; + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during JSON feeds import' . "\n"); + } else { + Minz_Log::warning('Error during JSON feeds import'); + } + } + } + + return $ok; + } + + /** + * This action handles import action. + * + * It must be reached by a POST request. + * + * Parameter is: + * - file (default: nothing!) + * Available file types are: zip, json or xml. + */ + public function importAction() { + if (!Minz_Request::isPost()) { + Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); + } + + $file = $_FILES['file']; + $status_file = $file['error']; + + if ($status_file !== 0) { + Minz_Log::warning('File cannot be uploaded. Error code: ' . $status_file); + Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), + array('c' => 'importExport', 'a' => 'index')); + } + + @set_time_limit(300); + + $error = false; + try { + $error = !$this->importFile($file['name'], $file['tmp_name']); + } catch (FreshRSS_ZipMissing_Exception $zme) { + Minz_Request::bad(_t('feedback.import_export.no_zip_extension'), + array('c' => 'importExport', 'a' => 'index')); + } catch (FreshRSS_Zip_Exception $ze) { + Minz_Log::warning('ZIP archive cannot be imported. Error code: ' . $ze->zipErrorCode()); + Minz_Request::bad(_t('feedback.import_export.zip_error'), + array('c' => 'importExport', 'a' => 'index')); + } + + // And finally, we get import status and redirect to the home page + Minz_Session::_param('actualize_feeds', true); + $content_notif = $error === true ? _t('feedback.import_export.feeds_imported_with_errors') : + _t('feedback.import_export.feeds_imported'); + Minz_Request::good($content_notif); + } + + /** + * This method tries to guess the file type based on its name. + * + * Itis a *very* basic guess file type function. Only based on filename. + * That's could be improved but should be enough for what we have to do. + */ + private static function guessFileType($filename) { + if (substr_compare($filename, '.zip', -4) === 0) { + return 'zip'; + } elseif (substr_compare($filename, '.opml', -5) === 0 || + substr_compare($filename, '.xml', -4) === 0) { + return 'opml'; + } elseif (substr_compare($filename, '.json', -5) === 0 && + strpos($filename, 'starred') !== false) { + return 'json_starred'; + } elseif (substr_compare($filename, '.json', -5) === 0) { + return 'json_feed'; + } else { + return 'unknown'; + } + } + + /** + * This method parses and imports an OPML file. + * + * @param string $opml_file the OPML file content. + * @return boolean false if an error occured, true otherwise. + */ + private function importOpml($opml_file) { + $opml_array = array(); + try { + $opml_array = libopml_parse_string($opml_file, false); + } catch (LibOPML_Exception $e) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML parsing: ' . $e->getMessage() . "\n"); + } else { + Minz_Log::warning($e->getMessage()); + } + return false; + } + + $this->catDAO->checkDefault(); + + return $this->addOpmlElements($opml_array['body']); + } + + /** + * This method imports an OPML file based on its body. + * + * @param array $opml_elements an OPML element (body or outline). + * @param string $parent_cat the name of the parent category. + * @return boolean false if an error occured, true otherwise. + */ + private function addOpmlElements($opml_elements, $parent_cat = null) { + $ok = true; + + $nb_feeds = count($this->feedDAO->listFeeds()); + $nb_cats = count($this->catDAO->listCategories(false)); + $limits = FreshRSS_Context::$system_conf->limits; + + foreach ($opml_elements as $elt) { + if (isset($elt['xmlUrl'])) { + // If xmlUrl exists, it means it is a feed + if (FreshRSS_Context::$isCli && $nb_feeds >= $limits['max_feeds']) { + Minz_Log::warning(_t('feedback.sub.feed.over_max', + $limits['max_feeds'])); + $ok = false; + continue; + } + + if ($this->addFeedOpml($elt, $parent_cat)) { + $nb_feeds++; + } else { + $ok = false; + } + } else { + // No xmlUrl? It should be a category! + $limit_reached = ($nb_cats >= $limits['max_categories']); + if (!FreshRSS_Context::$isCli && $limit_reached) { + Minz_Log::warning(_t('feedback.sub.category.over_max', + $limits['max_categories'])); + $ok = false; + continue; + } + + if ($this->addCategoryOpml($elt, $parent_cat, $limit_reached)) { + $nb_cats++; + } else { + $ok = false; + } + } + } + + return $ok; + } + + /** + * This method imports an OPML feed element. + * + * @param array $feed_elt an OPML element (must be a feed element). + * @param string $parent_cat the name of the parent category. + * @return boolean false if an error occured, true otherwise. + */ + private function addFeedOpml($feed_elt, $parent_cat) { + if ($parent_cat == null) { + // This feed has no parent category so we get the default one + $this->catDAO->checkDefault(); + $default_cat = $this->catDAO->getDefault(); + $parent_cat = $default_cat->name(); + } + + $cat = $this->catDAO->searchByName($parent_cat); + if ($cat == null) { + // If there is not $cat, it means parent category does not exist in + // database. + // If it happens, take the default category. + $this->catDAO->checkDefault(); + $cat = $this->catDAO->getDefault(); + } + + // We get different useful information + $url = Minz_Helper::htmlspecialchars_utf8($feed_elt['xmlUrl']); + $name = Minz_Helper::htmlspecialchars_utf8($feed_elt['text']); + $website = ''; + if (isset($feed_elt['htmlUrl'])) { + $website = Minz_Helper::htmlspecialchars_utf8($feed_elt['htmlUrl']); + } + $description = ''; + if (isset($feed_elt['description'])) { + $description = Minz_Helper::htmlspecialchars_utf8($feed_elt['description']); + } + + $error = false; + try { + // Create a Feed object and add it in DB + $feed = new FreshRSS_Feed($url); + $feed->_category($cat->id()); + $feed->_name($name); + $feed->_website($website); + $feed->_description($description); + + // Call the extension hook + $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); + if ($feed != null) { + // addFeedObject checks if feed is already in DB so nothing else to + // check here + $id = $this->feedDAO->addFeedObject($feed); + $error = ($id === false); + } else { + $error = true; + } + } catch (FreshRSS_Feed_Exception $e) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML feed import: ' . $e->getMessage() . "\n"); + } else { + Minz_Log::warning($e->getMessage()); + } + $error = true; + } + + if ($error) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML feed import from URL: ' . $url . ' in category ' . $cat->id() . "\n"); + } else { + Minz_Log::warning('Error during OPML feed import from URL: ' . $url . ' in category ' . $cat->id()); + } + } + + return !$error; + } + + /** + * This method imports an OPML category element. + * + * @param array $cat_elt an OPML element (must be a category element). + * @param string $parent_cat the name of the parent category. + * @param boolean $cat_limit_reached indicates if category limit has been reached. + * if yes, category is not added (but we try for feeds!) + * @return boolean false if an error occured, true otherwise. + */ + private function addCategoryOpml($cat_elt, $parent_cat, $cat_limit_reached) { + // Create a new Category object + $catName = Minz_Helper::htmlspecialchars_utf8($cat_elt['text']); + $cat = new FreshRSS_Category($catName); + + $error = true; + if (FreshRSS_Context::$isCli || !$cat_limit_reached) { + $id = $this->catDAO->addCategoryObject($cat); + $error = ($id === false); + } + if ($error) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during OPML category import from URL: ' . $catName . "\n"); + } else { + Minz_Log::warning('Error during OPML category import from URL: ' . $catName); + } + } + + if (isset($cat_elt['@outlines'])) { + // Our cat_elt contains more categories or more feeds, so we + // add them recursively. + // Note: FreshRSS does not support yet category arborescence + $error &= !$this->addOpmlElements($cat_elt['@outlines'], $catName); + } + + return !$error; + } + + /** + * This method import a JSON-based file (Google Reader format). + * + * @param string $article_file the JSON file content. + * @param boolean $starred true if articles from the file must be starred. + * @return boolean false if an error occured, true otherwise. + */ + private function importJson($article_file, $starred = false) { + $article_object = json_decode($article_file, true); + if ($article_object == null) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error trying to import a non-JSON file' . "\n"); + } else { + Minz_Log::warning('Try to import a non-JSON file'); + } + return false; + } + + $is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0; + + $google_compliant = strpos($article_object['id'], 'com.google') !== false; + + $error = false; + $article_to_feed = array(); + + $nb_feeds = count($this->feedDAO->listFeeds()); + $limits = FreshRSS_Context::$system_conf->limits; + + // First, we check feeds of articles are in DB (and add them if needed). + foreach ($article_object['items'] as $item) { + $key = $google_compliant ? 'htmlUrl' : 'feedUrl'; + $feed = new FreshRSS_Feed($item['origin'][$key]); + $feed = $this->feedDAO->searchByUrl($feed->url()); + + if ($feed == null) { + // Feed does not exist in DB,we should to try to add it. + if ((!FreshRSS_Context::$isCli) && ($nb_feeds >= $limits['max_feeds'])) { + // Oops, no more place! + Minz_Log::warning(_t('feedback.sub.feed.over_max', $limits['max_feeds'])); + } else { + $feed = $this->addFeedJson($item['origin'], $google_compliant); + } + + if ($feed == null) { + // Still null? It means something went wrong. + $error = true; + } else { + $nb_feeds++; + } + } + + if ($feed != null) { + $article_to_feed[$item['id']] = $feed->id(); + } + } + + $newGuids = array(); + foreach ($article_object['items'] as $item) { + $newGuids[] = safe_ascii($item['id']); + } + // For this feed, check existing GUIDs already in database. + $existingHashForGuids = $this->entryDAO->listHashForFeedGuids($feed->id(), $newGuids); + unset($newGuids); + + // Then, articles are imported. + $this->entryDAO->beginTransaction(); + foreach ($article_object['items'] as $item) { + if (!isset($article_to_feed[$item['id']])) { + // Related feed does not exist for this entry, do nothing. + continue; + } + + $feed_id = $article_to_feed[$item['id']]; + $author = isset($item['author']) ? $item['author'] : ''; + $key_content = ($google_compliant && !isset($item['content'])) ? + 'summary' : 'content'; + $tags = $item['categories']; + if ($google_compliant) { + // Remove tags containing "/state/com.google" which are useless. + $tags = array_filter($tags, function($var) { + return strpos($var, '/state/com.google') !== false; + }); + } + + $entry = new FreshRSS_Entry( + $feed_id, $item['id'], $item['title'], $author, + $item[$key_content]['content'], $item['alternate'][0]['href'], + $item['published'], $is_read, $starred + ); + $entry->_id(min(time(), $entry->date(true)) . uSecString()); + $entry->_tags($tags); + + $entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry); + if ($entry == null) { + // An extension has returned a null value, there is nothing to insert. + continue; + } + + $values = $entry->toArray(); + if (isset($existingHashForGuids[$entry->guid()])) { + $id = $this->entryDAO->updateEntry($values); + } else { + $id = $this->entryDAO->addEntry($values); + } + + if (!$error && ($id === false)) { + $error = true; + } + } + $this->entryDAO->commit(); + + return !$error; + } + + /** + * This method import a JSON-based feed (Google Reader format). + * + * @param array $origin represents a feed. + * @param boolean $google_compliant takes care of some specific values if true. + * @return FreshRSS_Feed if feed is in database at the end of the process, + * else null. + */ + private function addFeedJson($origin, $google_compliant) { + $return = null; + $key = $google_compliant ? 'htmlUrl' : 'feedUrl'; + $url = $origin[$key]; + $name = $origin['title']; + $website = $origin['htmlUrl']; + + try { + // Create a Feed object and add it in database. + $feed = new FreshRSS_Feed($url); + $feed->_category(FreshRSS_CategoryDAO::defaultCategoryId); + $feed->_name($name); + $feed->_website($website); + + // Call the extension hook + $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); + if ($feed != null) { + // addFeedObject checks if feed is already in DB so nothing else to + // check here. + $id = $this->feedDAO->addFeedObject($feed); + + if ($id !== false) { + $feed->_id($id); + $return = $feed; + } + } + } catch (FreshRSS_Feed_Exception $e) { + if (FreshRSS_Context::$isCli) { + fwrite(STDERR, 'FreshRSS error during JSON feed import: ' . $e->getMessage() . "\n"); + } else { + Minz_Log::warning($e->getMessage()); + } + } + + return $return; + } + + public function exportFile($export_opml = true, $export_starred = false, $export_feeds = array(), $maxFeedEntries = 50, $username = null) { + require_once(LIB_PATH . '/lib_opml.php'); + + $this->catDAO = new FreshRSS_CategoryDAO($username); + $this->entryDAO = FreshRSS_Factory::createEntryDao($username); + $this->feedDAO = FreshRSS_Factory::createFeedDao($username); + + $this->entryDAO->disableBuffering(); + + if ($export_feeds === true) { + //All feeds + $export_feeds = $this->feedDAO->listFeedsIds(); + } + if (!is_array($export_feeds)) { + $export_feeds = array(); + } + + $day = date('Y-m-d'); + + $export_files = array(); + if ($export_opml) { + $export_files["feeds_${day}.opml.xml"] = $this->generateOpml(); + } + + if ($export_starred) { + $export_files["starred_${day}.json"] = $this->generateEntries('starred'); + } + + foreach ($export_feeds as $feed_id) { + $feed = $this->feedDAO->searchById($feed_id); + if ($feed) { + $filename = "feed_${day}_" . $feed->category() . '_' + . $feed->id() . '.json'; + $export_files[$filename] = $this->generateEntries('feed', $feed, $maxFeedEntries); + } + } + + $nb_files = count($export_files); + if ($nb_files > 1) { + // If there are more than 1 file to export, we need a ZIP archive. + try { + $this->sendZip($export_files); + } catch (Exception $e) { + throw new FreshRSS_ZipMissing_Exception($e); + } + } elseif ($nb_files === 1) { + // Only one file? Guess its type and export it. + $filename = key($export_files); + $type = self::guessFileType($filename); + $this->sendFile('freshrss_' . $filename, $export_files[$filename], $type); + } + return $nb_files; + } + + /** + * This action handles export action. + * + * This action must be reached by a POST request. + * + * Parameters are: + * - export_opml (default: false) + * - export_starred (default: false) + * - export_feeds (default: array()) a list of feed ids + */ + public function exportAction() { + if (!Minz_Request::isPost()) { + Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); + } + $this->view->_useLayout(false); + + $nb_files = 0; + try { + $nb_files = $this->exportFile( + Minz_Request::param('export_opml', false), + Minz_Request::param('export_starred', false), + Minz_Request::param('export_feeds', array()) + ); + } catch (FreshRSS_ZipMissing_Exception $zme) { + # Oops, there is no ZIP extension! + Minz_Request::bad(_t('feedback.import_export.export_no_zip_extension'), + array('c' => 'importExport', 'a' => 'index')); + } + + if ($nb_files < 1) { + // Nothing to do... + Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true); + } + } + + /** + * This method returns the OPML file based on user subscriptions. + * + * @return string the OPML file content. + */ + private function generateOpml() { + $list = array(); + foreach ($this->catDAO->listCategories() as $key => $cat) { + $list[$key]['name'] = $cat->name(); + $list[$key]['feeds'] = $this->feedDAO->listByCategory($cat->id()); + } + + $this->view->categories = $list; + return $this->view->helperToString('export/opml'); + } + + /** + * This method returns a JSON file content. + * + * @param string $type must be "starred" or "feed" + * @param FreshRSS_Feed $feed feed of which we want to get entries. + * @return string the JSON file content. + */ + private function generateEntries($type, $feed = NULL, $maxFeedEntries = 50) { + $this->view->categories = $this->catDAO->listCategories(); + + if ($type == 'starred') { + $this->view->list_title = _t('sub.import_export.starred_list'); + $this->view->type = 'starred'; + $unread_fav = $this->entryDAO->countUnreadReadFavorites(); + $this->view->entriesRaw = $this->entryDAO->listWhereRaw( + 's', '', FreshRSS_Entry::STATE_ALL, 'ASC', $unread_fav['all'] + ); + } elseif ($type === 'feed' && $feed != null) { + $this->view->list_title = _t('sub.import_export.feed_list', $feed->name()); + $this->view->type = 'feed/' . $feed->id(); + $this->view->entriesRaw = $this->entryDAO->listWhereRaw( + 'f', $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', + $maxFeedEntries + ); + $this->view->feed = $feed; + } + + return $this->view->helperToString('export/articles'); + } + + /** + * This method zips a list of files and returns it by HTTP. + * + * @param array $files list of files where key is filename and value the content. + * @throws Exception if Zip extension is not loaded. + */ + private function sendZip($files) { + if (!extension_loaded('zip')) { + throw new Exception(); + } + + // From https://stackoverflow.com/questions/1061710/php-zip-files-on-the-fly + $zip_file = tempnam('tmp', 'zip'); + $zip = new ZipArchive(); + $zip->open($zip_file, ZipArchive::OVERWRITE); + + foreach ($files as $filename => $content) { + $zip->addFromString($filename, $content); + } + + // Close and send to user + $zip->close(); + header('Content-Type: application/zip'); + header('Content-Length: ' . filesize($zip_file)); + $day = date('Y-m-d'); + header('Content-Disposition: attachment; filename="freshrss_' . $day . '_export.zip"'); + readfile($zip_file); + unlink($zip_file); + } + + /** + * This method returns a single file (OPML or JSON) by HTTP. + * + * @param string $filename + * @param string $content + * @param string $type the file type (opml, json_feed or json_starred). + * If equals to unknown, nothing happens. + */ + private function sendFile($filename, $content, $type) { + if ($type === 'unknown') { + return; + } + + $content_type = ''; + if ($type === 'opml') { + $content_type = 'application/xml'; + } elseif ($type === 'json_feed' || $type === 'json_starred') { + $content_type = 'application/json'; + } + + header('Content-Type: ' . $content_type . '; charset=utf-8'); + header('Content-disposition: attachment; filename=' . $filename); + print($content); + } +} diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 38f4c0e7c..5ca147ff3 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -1,371 +1,272 @@ <?php +/** + * This class handles main actions of FreshRSS. + */ class FreshRSS_index_Controller extends Minz_ActionController { - private $nb_not_read_cat = 0; - - public function indexAction () { - $output = Minz_Request::param ('output'); - $token = $this->view->conf->token; - - // check if user is logged in - if (!$this->view->loginOk && !Minz_Configuration::allowAnonymous()) { - $token_param = Minz_Request::param ('token', ''); - $token_is_ok = ($token != '' && $token === $token_param); - if ($output === 'rss' && !$token_is_ok) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); - return; - } elseif ($output !== 'rss') { - // "hard" redirection is not required, just ask dispatcher to - // forward to the login form without 302 redirection - Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin')); - return; - } - } - // construction of RSS url of this feed - $params = Minz_Request::params (); - $params['output'] = 'rss'; - if (isset ($params['search'])) { - $params['search'] = urlencode ($params['search']); - } - if (!Minz_Configuration::allowAnonymous()) { - $params['token'] = $token; - } - $this->view->rss_url = array ( + /** + * This action only redirect on the default view mode (normal or global) + */ + public function indexAction() { + $prefered_output = FreshRSS_Context::$user_conf->view_mode; + Minz_Request::forward(array( 'c' => 'index', - 'a' => 'index', - 'params' => $params - ); - - if ($output === 'rss') { - // no layout for RSS output - $this->view->_useLayout (false); - header('Content-Type: application/rss+xml; charset=utf-8'); - } elseif ($output === 'global') { - Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); - } + 'a' => $prefered_output + )); + } - $catDAO = new FreshRSS_CategoryDAO(); - $entryDAO = new FreshRSS_EntryDAO(); - - $this->view->cat_aside = $catDAO->listCategories (); - $this->view->nb_favorites = $entryDAO->countUnreadReadFavorites (); - $this->view->nb_not_read = FreshRSS_CategoryDAO::CountUnreads($this->view->cat_aside, 1); - $this->view->currentName = ''; - - $this->view->get_c = ''; - $this->view->get_f = ''; - - $get = Minz_Request::param ('get', 'a'); - $getType = $get[0]; - $getId = substr ($get, 2); - if (!$this->checkAndProcessType ($getType, $getId)) { - Minz_Log::record ('Not found [' . $getType . '][' . $getId . ']', Minz_Log::DEBUG); - Minz_Error::error ( - 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) - ); + /** + * This action displays the normal view of FreshRSS. + */ + public function normalAction() { + $allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous; + if (!FreshRSS_Auth::hasAccess() && !$allow_anonymous) { + Minz_Request::forward(array('c' => 'auth', 'a' => 'login')); return; } - // mise à jour des titres - $this->view->rss_title = $this->view->currentName . ' | ' . Minz_View::title(); - if ($this->view->nb_not_read > 0) { - Minz_View::appendTitle (' (' . formatNumber($this->view->nb_not_read) . ')'); + try { + $this->updateContext(); + } catch (FreshRSS_Context_Exception $e) { + Minz_Error::error(404); } - Minz_View::prependTitle ( - $this->view->currentName . - ($this->nb_not_read_cat > 0 ? ' (' . formatNumber($this->nb_not_read_cat) . ')' : '') . - ' · ' - ); - // On récupère les différents éléments de filtrage - $this->view->state = $state = Minz_Request::param ('state', $this->view->conf->default_view); - $filter = Minz_Request::param ('search', ''); - if (!empty($filter)) { - $state = 'all'; //Search always in read and unread articles - } - $this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sort_order); - $nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page); - $first = Minz_Request::param ('next', ''); - - if ($state === 'not_read') { //Any unread article in this category at all? - switch ($getType) { - case 'a': - $hasUnread = $this->view->nb_not_read > 0; - break; - case 's': - $hasUnread = $this->view->nb_favorites['unread'] > 0; - break; - case 'c': - $hasUnread = (!isset($this->view->cat_aside[$getId])) || ($this->view->cat_aside[$getId]->nbNotRead() > 0); - break; - case 'f': - $myFeed = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId); - $hasUnread = ($myFeed === null) || ($myFeed->nbNotRead() > 0); - break; - default: - $hasUnread = true; - break; + $this->view->callbackBeforeContent = function($view) { + try { + FreshRSS_Context::$number++; //+1 for pagination + $entries = FreshRSS_index_Controller::listEntriesByContext(); + FreshRSS_Context::$number--; + + $nb_entries = count($entries); + if ($nb_entries > FreshRSS_Context::$number) { + // We have more elements for pagination + $last_entry = array_pop($entries); + FreshRSS_Context::$next_id = $last_entry->id(); + } + + $first_entry = $nb_entries > 0 ? $entries[0] : null; + FreshRSS_Context::$id_max = $first_entry === null ? + (time() - 1) . '000000' : + $first_entry->id(); + if (FreshRSS_Context::$order === 'ASC') { + // In this case we do not know but we guess id_max + $id_max = (time() - 1) . '000000'; + if (strcmp($id_max, FreshRSS_Context::$id_max) > 0) { + FreshRSS_Context::$id_max = $id_max; + } + } + + $view->entries = $entries; + } catch (FreshRSS_EntriesGetter_Exception $e) { + Minz_Log::notice($e->getMessage()); + Minz_Error::error(404); } - if (!$hasUnread) { - $this->view->state = $state = 'all'; + + $view->categories = FreshRSS_Context::$categories; + + $view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $title = FreshRSS_Context::$name; + if (FreshRSS_Context::$get_unread > 0) { + $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; } - } + Minz_View::prependTitle($title . ' · '); + }; + } - $today = @strtotime('today'); - $this->view->today = $today; + /** + * This action displays the reader view of FreshRSS. + * + * @todo: change this view into specific CSS rules? + */ + public function readerAction() { + $this->normalAction(); + } + + /** + * This action displays the global view of FreshRSS. + */ + public function globalAction() { + $allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous; + if (!FreshRSS_Auth::hasAccess() && !$allow_anonymous) { + Minz_Request::forward(array('c' => 'auth', 'a' => 'login')); + return; + } - // on calcule la date des articles les plus anciens qu'on affiche - $nb_month_old = $this->view->conf->old_entries; - $date_min = $today - (3600 * 24 * 30 * $nb_month_old); //Do not use a fast changing value such as time() to allow SQL caching - $keepHistoryDefault = $this->view->conf->keep_history_default; + Minz_View::appendScript(Minz_Url::display('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); try { - $entries = $entryDAO->listWhere($getType, $getId, $state, $order, $nb + 1, $first, $filter, $date_min, $keepHistoryDefault); - - // Si on a récupéré aucun article "non lus" - // on essaye de récupérer tous les articles - if ($state === 'not_read' && empty($entries)) { - Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG); - $this->view->state = 'all'; - $entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, $keepHistoryDefault); - } + $this->updateContext(); + } catch (FreshRSS_Context_Exception $e) { + Minz_Error::error(404); + } - if (count($entries) <= $nb) { - $this->view->nextId = ''; - } else { //We have more elements for pagination - $lastEntry = array_pop($entries); - $this->view->nextId = $lastEntry->id(); - } + $this->view->categories = FreshRSS_Context::$categories; - $this->view->entries = $entries; - } catch (FreshRSS_EntriesGetter_Exception $e) { - Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); - Minz_Error::error ( - 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) - ); + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $title = _t('index.feed.title_global'); + if (FreshRSS_Context::$get_unread > 0) { + $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; } + Minz_View::prependTitle($title . ' · '); } - /* - * Vérifie que la catégorie / flux sélectionné existe - * + Initialise correctement les variables de vue get_c et get_f - * + Met à jour la variable $this->nb_not_read_cat + /** + * This action displays the RSS feed of FreshRSS. */ - private function checkAndProcessType ($getType, $getId) { - switch ($getType) { - case 'a': - $this->view->currentName = Minz_Translate::t ('your_rss_feeds'); - $this->nb_not_read_cat = $this->view->nb_not_read; - $this->view->get_c = $getType; - return true; - case 's': - $this->view->currentName = Minz_Translate::t ('your_favorites'); - $this->nb_not_read_cat = $this->view->nb_favorites['unread']; - $this->view->get_c = $getType; - return true; - case 'c': - $cat = isset($this->view->cat_aside[$getId]) ? $this->view->cat_aside[$getId] : null; - if ($cat === null) { - $catDAO = new FreshRSS_CategoryDAO(); - $cat = $catDAO->searchById($getId); - } - if ($cat) { - $this->view->currentName = $cat->name (); - $this->nb_not_read_cat = $cat->nbNotRead (); - $this->view->get_c = $getId; - return true; - } else { - return false; - } - case 'f': - $feed = FreshRSS_CategoryDAO::findFeed($this->view->cat_aside, $getId); - if (empty($feed)) { - $feedDAO = new FreshRSS_FeedDAO(); - $feed = $feedDAO->searchById($getId); - } - if ($feed) { - $this->view->currentName = $feed->name (); - $this->nb_not_read_cat = $feed->nbNotRead (); - $this->view->get_f = $getId; - $this->view->get_c = $feed->category (); - return true; - } else { - return false; - } - default: - return false; + public function rssAction() { + $allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous; + $token = FreshRSS_Context::$user_conf->token; + $token_param = Minz_Request::param('token', ''); + $token_is_ok = ($token != '' && $token === $token_param); + + // Check if user has access. + if (!FreshRSS_Auth::hasAccess() && + !$allow_anonymous && + !$token_is_ok) { + Minz_Error::error(403); } - } - - public function statsAction () { - if (!$this->view->loginOk) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); + + try { + $this->updateContext(); + } catch (FreshRSS_Context_Exception $e) { + Minz_Error::error(404); } - Minz_View::prependTitle (Minz_Translate::t ('stats') . ' · '); + try { + $this->view->entries = FreshRSS_index_Controller::listEntriesByContext(); + } catch (FreshRSS_EntriesGetter_Exception $e) { + Minz_Log::notice($e->getMessage()); + Minz_Error::error(404); + } - $statsDAO = new FreshRSS_StatsDAO (); - Minz_View::appendScript (Minz_Url::display ('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); - $this->view->repartition = $statsDAO->calculateEntryRepartition(); - $this->view->count = ($statsDAO->calculateEntryCount()); - $this->view->feedByCategory = $statsDAO->calculateFeedByCategory(); - $this->view->entryByCategory = $statsDAO->calculateEntryByCategory(); - $this->view->topFeed = $statsDAO->calculateTopFeed(); + // No layout for RSS output. + $this->view->url = empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']; + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $this->view->_useLayout(false); + header('Content-Type: application/rss+xml; charset=utf-8'); } - public function aboutAction () { - Minz_View::prependTitle (Minz_Translate::t ('about') . ' · '); - } + /** + * This action updates the Context object by using request parameters. + * + * Parameters are: + * - state (default: conf->default_view) + * - search (default: empty string) + * - order (default: conf->sort_order) + * - nb (default: conf->posts_per_page) + * - next (default: empty string) + * - hours (default: 0) + */ + private function updateContext() { + if (empty(FreshRSS_Context::$categories)) { + $catDAO = new FreshRSS_CategoryDAO(); + FreshRSS_Context::$categories = $catDAO->listCategories(); + } - public function logsAction () { - if (!$this->view->loginOk) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); + // Update number of read / unread variables. + $entryDAO = FreshRSS_Factory::createEntryDao(); + FreshRSS_Context::$total_starred = $entryDAO->countUnreadReadFavorites(); + FreshRSS_Context::$total_unread = FreshRSS_CategoryDAO::CountUnreads( + FreshRSS_Context::$categories, 1 + ); + + FreshRSS_Context::_get(Minz_Request::param('get', 'a')); + + FreshRSS_Context::$state = Minz_Request::param( + 'state', FreshRSS_Context::$user_conf->default_state + ); + $state_forced_by_user = Minz_Request::param('state', false) !== false; + if (FreshRSS_Context::$user_conf->default_view === 'adaptive' && + FreshRSS_Context::$get_unread <= 0 && + !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ) && + !$state_forced_by_user) { + FreshRSS_Context::$state |= FreshRSS_Entry::STATE_READ; } - Minz_View::prependTitle (Minz_Translate::t ('logs') . ' · '); + FreshRSS_Context::$search = new FreshRSS_Search(Minz_Request::param('search', '')); + FreshRSS_Context::$order = Minz_Request::param( + 'order', FreshRSS_Context::$user_conf->sort_order + ); + FreshRSS_Context::$number = intval(Minz_Request::param('nb', FreshRSS_Context::$user_conf->posts_per_page)); + if (FreshRSS_Context::$number > FreshRSS_Context::$user_conf->max_posts_per_rss) { + FreshRSS_Context::$number = max( + FreshRSS_Context::$user_conf->max_posts_per_rss, + FreshRSS_Context::$user_conf->posts_per_page); + } + FreshRSS_Context::$first_id = Minz_Request::param('next', ''); + FreshRSS_Context::$sinceHours = intval(Minz_Request::param('hours', 0)); + } - if (Minz_Request::isPost ()) { - FreshRSS_LogDAO::truncate(); + /** + * This method returns a list of entries based on the Context object. + */ + public static function listEntriesByContext() { + $entryDAO = FreshRSS_Factory::createEntryDao(); + + $get = FreshRSS_Context::currentGet(true); + if (count($get) > 1) { + $type = $get[0]; + $id = $get[1]; + } else { + $type = $get; + $id = ''; } - $logs = FreshRSS_LogDAO::lines(); //TODO: ask only the necessary lines + $limit = FreshRSS_Context::$number; - //gestion pagination - $page = Minz_Request::param ('page', 1); - $this->view->logsPaginator = new Minz_Paginator ($logs); - $this->view->logsPaginator->_nbItemsPerPage (50); - $this->view->logsPaginator->_currentPage ($page); - } + $date_min = 0; + if (FreshRSS_Context::$sinceHours) { + $date_min = time() - (FreshRSS_Context::$sinceHours * 3600); + $limit = FreshRSS_Context::$user_conf->max_posts_per_rss; + } - public function loginAction () { - $this->view->_useLayout (false); - - $url = 'https://verifier.login.persona.org/verify'; - $assert = Minz_Request::param ('assertion'); - $params = 'assertion=' . $assert . '&audience=' . - urlencode (Minz_Url::display (null, 'php', true)); - $ch = curl_init (); - $options = array ( - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => TRUE, - CURLOPT_POST => 2, - CURLOPT_POSTFIELDS => $params + $entries = $entryDAO->listWhere( + $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, + $limit, FreshRSS_Context::$first_id, + FreshRSS_Context::$search, $date_min ); - curl_setopt_array ($ch, $options); - $result = curl_exec ($ch); - curl_close ($ch); - - $res = json_decode ($result, true); - - $loginOk = false; - $reason = ''; - if ($res['status'] === 'okay') { - $email = filter_var($res['email'], FILTER_VALIDATE_EMAIL); - if ($email != '') { - $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; - if (($currentUser = @file_get_contents($personaFile)) !== false) { - $currentUser = trim($currentUser); - if (ctype_alnum($currentUser)) { - try { - $this->conf = new FreshRSS_Configuration($currentUser); - $loginOk = strcasecmp($email, $this->conf->mail_login) === 0; - } catch (Minz_Exception $e) { - $reason = 'Invalid configuration for user [' . $currentUser . ']! ' . $e->getMessage(); //Permission denied or conf file does not exist - } - } else { - $reason = 'Invalid username format [' . $currentUser . ']!'; - } - } - } else { - $reason = 'Invalid email format [' . $res['email'] . ']!'; - } - } - if ($loginOk) { - Minz_Session::_param('currentUser', $currentUser); - Minz_Session::_param ('mail', $email); - $this->view->loginOk = true; - invalidateHttpCache(); - } else { - $res = array (); - $res['status'] = 'failure'; - $res['reason'] = $reason == '' ? Minz_Translate::t ('invalid_login') : $reason; - Minz_Log::record ('Persona: ' . $res['reason'], Minz_Log::WARNING); + + if (FreshRSS_Context::$sinceHours && (count($entries) < FreshRSS_Context::$user_conf->min_posts_per_rss)) { + $date_min = 0; + $limit = FreshRSS_Context::$user_conf->min_posts_per_rss; + $entries = $entryDAO->listWhere( + $type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, + $limit, FreshRSS_Context::$first_id, + FreshRSS_Context::$search, $date_min + ); } - header('Content-Type: application/json; charset=UTF-8'); - $this->view->res = json_encode ($res); + return $entries; } - public function logoutAction () { - $this->view->_useLayout(false); - invalidateHttpCache(); - Minz_Session::_param('currentUser'); - Minz_Session::_param('mail'); - Minz_Session::_param('passwordHash'); + /** + * This action displays the about page of FreshRSS. + */ + public function aboutAction() { + Minz_View::prependTitle(_t('index.about.title') . ' · '); } - public function formLoginAction () { + /** + * This action displays logs of FreshRSS for the current user. + */ + public function logsAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + + Minz_View::prependTitle(_t('index.log.title') . ' · '); + if (Minz_Request::isPost()) { - $ok = false; - $nonce = Minz_Session::param('nonce'); - $username = Minz_Request::param('username', ''); - $c = Minz_Request::param('challenge', ''); - if (ctype_alnum($username) && ctype_graph($c) && ctype_alnum($nonce)) { - if (!function_exists('password_verify')) { - include_once(LIB_PATH . '/password_compat.php'); - } - try { - $conf = new FreshRSS_Configuration($username); - $s = $conf->passwordHash; - $ok = password_verify($nonce . $s, $c); - if ($ok) { - Minz_Session::_param('currentUser', $username); - Minz_Session::_param('passwordHash', $s); - } else { - Minz_Log::record('Password mismatch for user ' . $username . ', nonce=' . $nonce . ', c=' . $c, Minz_Log::WARNING); - } - } catch (Minz_Exception $me) { - Minz_Log::record('Login failure: ' . $me->getMessage(), Minz_Log::WARNING); - } - } else { - Minz_Log::record('Invalid credential parameters: user=' . $username . ' challenge=' . $c . ' nonce=' . $nonce, Minz_Log::DEBUG); - } - if (!$ok) { - $notif = array( - 'type' => 'bad', - 'content' => Minz_Translate::t('invalid_login') - ); - Minz_Session::_param('notification', $notif); - } - $this->view->_useLayout(false); - Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true); - } elseif (!Minz_Configuration::canLogIn()) { - Minz_Error::error ( - 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) - ); + FreshRSS_LogDAO::truncate(); } - invalidateHttpCache(); - } - public function formLogoutAction () { - $this->view->_useLayout(false); - invalidateHttpCache(); - Minz_Session::_param('currentUser'); - Minz_Session::_param('mail'); - Minz_Session::_param('passwordHash'); - Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true); + $logs = FreshRSS_LogDAO::lines(); //TODO: ask only the necessary lines + + //gestion pagination + $page = Minz_Request::param('page', 1); + $this->view->logsPaginator = new Minz_Paginator($logs); + $this->view->logsPaginator->_nbItemsPerPage(50); + $this->view->logsPaginator->_currentPage($page); } } diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 3d741e298..00a7b5c38 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -1,14 +1,14 @@ <?php class FreshRSS_javascript_Controller extends Minz_ActionController { - public function firstAction () { - $this->view->_useLayout (false); + public function firstAction() { + $this->view->_useLayout(false); } - public function actualizeAction () { - header('Content-Type: text/javascript; charset=UTF-8'); - $feedDAO = new FreshRSS_FeedDAO (); - $this->view->feeds = $feedDAO->listFeedsOrderUpdate(); + public function actualizeAction() { + header('Content-Type: application/json; charset=UTF-8'); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feeds = $feedDAO->listFeedsOrderUpdate(FreshRSS_Context::$user_conf->ttl_default); } public function nbUnreadsPerFeedAction() { @@ -28,19 +28,27 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { $user = isset($_GET['user']) ? $_GET['user'] : ''; if (ctype_alnum($user)) { try { - $conf = new FreshRSS_Configuration($user); + $salt = FreshRSS_Context::$system_conf->salt; + $conf = get_user_configuration($user); $s = $conf->passwordHash; if (strlen($s) >= 60) { $this->view->salt1 = substr($s, 0, 29); //CRYPT_BLOWFISH Salt: "$2a$", a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z". - $this->view->nonce = sha1(Minz_Configuration::salt() . uniqid(mt_rand(), true)); + $this->view->nonce = sha1($salt . uniqid(mt_rand(), true)); Minz_Session::_param('nonce', $this->view->nonce); return; //Success } } catch (Minz_Exception $me) { - Minz_Log::record('Nonce failure: ' . $me->getMessage(), Minz_Log::WARNING); + Minz_Log::warning('Nonce failure: ' . $me->getMessage()); } + } else { + Minz_Log::notice('Nonce failure due to invalid username!'); + } + //Failure: Return random data. + $this->view->salt1 = sprintf('$2a$%02d$', FreshRSS_user_Controller::BCRYPT_COST); + $alphabet = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for ($i = 22; $i > 0; $i--) { + $this->view->salt1 .= $alphabet[rand(0, 63)]; } - $this->view->nonce = ''; //Failure - $this->view->salt1 = ''; + $this->view->nonce = sha1(rand()); } } diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php new file mode 100644 index 000000000..5d1dee72c --- /dev/null +++ b/app/Controllers/statsController.php @@ -0,0 +1,150 @@ +<?php + +/** + * Controller to handle application statistics. + */ +class FreshRSS_stats_Controller extends Minz_ActionController { + + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + + Minz_View::prependTitle(_t('admin.stats.title') . ' · '); + } + + private function convertToSerie($data) { + $serie = array(); + + foreach ($data as $key => $value) { + $serie[] = array($key, $value); + } + + return $serie; + } + + private function convertToPieSerie($data) { + $serie = array(); + + foreach ($data as $value) { + $value['data'] = array(array(0, (int) $value['data'])); + $serie[] = $value; + } + + return $serie; + } + + /** + * This action handles the statistic main page. + * + * It displays the statistic main page. + * The values computed to display the page are: + * - repartition of read/unread/favorite/not favorite + * - number of article per day + * - number of feed by category + * - number of article by category + * - list of most prolific feed + */ + public function indexAction() { + $statsDAO = FreshRSS_Factory::createStatsDAO(); + Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); + $this->view->repartition = $statsDAO->calculateEntryRepartition(); + $entryCount = $statsDAO->calculateEntryCount(); + $this->view->count = $this->convertToSerie($entryCount); + $this->view->average = round(array_sum(array_values($entryCount)) / count($entryCount), 2); + $this->view->feedByCategory = $this->convertToPieSerie($statsDAO->calculateFeedByCategory()); + $this->view->entryByCategory = $this->convertToPieSerie($statsDAO->calculateEntryByCategory()); + $this->view->topFeed = $statsDAO->calculateTopFeed(); + } + + /** + * This action handles the idle feed statistic page. + * + * It displays the list of idle feed for different period. The supported + * periods are: + * - last year + * - last 6 months + * - last 3 months + * - last month + * - last week + */ + public function idleAction() { + $statsDAO = FreshRSS_Factory::createStatsDAO(); + $feeds = $statsDAO->calculateFeedLastDate(); + $idleFeeds = array( + 'last_year' => array(), + 'last_6_month' => array(), + 'last_3_month' => array(), + 'last_month' => array(), + 'last_week' => array(), + ); + $now = new \DateTime(); + $feedDate = clone $now; + $lastWeek = clone $now; + $lastWeek->modify('-1 week'); + $lastMonth = clone $now; + $lastMonth->modify('-1 month'); + $last3Month = clone $now; + $last3Month->modify('-3 month'); + $last6Month = clone $now; + $last6Month->modify('-6 month'); + $lastYear = clone $now; + $lastYear->modify('-1 year'); + + foreach ($feeds as $feed) { + $feedDate->setTimestamp($feed['last_date']); + if ($feedDate >= $lastWeek) { + continue; + } + if ($feedDate < $lastYear) { + $idleFeeds['last_year'][] = $feed; + } elseif ($feedDate < $last6Month) { + $idleFeeds['last_6_month'][] = $feed; + } elseif ($feedDate < $last3Month) { + $idleFeeds['last_3_month'][] = $feed; + } elseif ($feedDate < $lastMonth) { + $idleFeeds['last_month'][] = $feed; + } elseif ($feedDate < $lastWeek) { + $idleFeeds['last_week'][] = $feed; + } + } + + $this->view->idleFeeds = $idleFeeds; + } + + /** + * This action handles the article repartition statistic page. + * + * It displays the number of article and the average of article for the + * following periods: + * - hour of the day + * - day of the week + * - month + * + * @todo verify that the metrics used here make some sense. Especially + * for the average. + */ + public function repartitionAction() { + $statsDAO = FreshRSS_Factory::createStatsDAO(); + $categoryDAO = new FreshRSS_CategoryDAO(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); + $id = Minz_Request::param('id', null); + $this->view->categories = $categoryDAO->listCategories(); + $this->view->feed = $feedDAO->searchById($id); + $this->view->days = $statsDAO->getDays(); + $this->view->months = $statsDAO->getMonths(); + $this->view->repartition = $statsDAO->calculateEntryRepartitionPerFeed($id); + $this->view->repartitionHour = $this->convertToSerie($statsDAO->calculateEntryRepartitionPerFeedPerHour($id)); + $this->view->averageHour = $statsDAO->calculateEntryAveragePerFeedPerHour($id); + $this->view->repartitionDayOfWeek = $this->convertToSerie($statsDAO->calculateEntryRepartitionPerFeedPerDayOfWeek($id)); + $this->view->averageDayOfWeek = $statsDAO->calculateEntryAveragePerFeedPerDayOfWeek($id); + $this->view->repartitionMonth = $this->convertToSerie($statsDAO->calculateEntryRepartitionPerFeedPerMonth($id)); + $this->view->averageMonth = $statsDAO->calculateEntryAveragePerFeedPerMonth($id); + } +} diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php new file mode 100644 index 000000000..03d3ee15e --- /dev/null +++ b/app/Controllers/subscriptionController.php @@ -0,0 +1,116 @@ +<?php + +/** + * Controller to handle subscription actions. + */ +class FreshRSS_subscription_Controller extends Minz_ActionController { + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + + $catDAO = new FreshRSS_CategoryDAO(); + + $catDAO->checkDefault(); + $this->view->categories = $catDAO->listCategories(false); + $this->view->default_category = $catDAO->getDefault(); + } + + /** + * This action handles the main subscription page + * + * It displays categories and associated feeds. + */ + public function indexAction() { + Minz_View::appendScript(Minz_Url::display('/scripts/category.js?' . + @filemtime(PUBLIC_PATH . '/scripts/category.js'))); + Minz_View::prependTitle(_t('sub.title') . ' · '); + + $id = Minz_Request::param('id'); + if ($id !== false) { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feed = $feedDAO->searchById($id); + } + } + + /** + * This action handles the feed configuration page. + * + * It displays the feed configuration page. + * If this action is reached through a POST request, it stores all new + * configuraiton values then sends a notification to the user. + * + * The options available on the page are: + * - name + * - description + * - website URL + * - feed URL + * - category id (default: default category id) + * - CSS path to article on website + * - display in main stream (default: 0) + * - HTTP authentication + * - number of article to retain (default: -2) + * - refresh frequency (default: -2) + * Default values are empty strings unless specified. + */ + public function feedAction() { + if (Minz_Request::param('ajax')) { + $this->view->_useLayout(false); + } + + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feeds = $feedDAO->listFeeds(); + + $id = Minz_Request::param('id'); + if ($id === false || !isset($this->view->feeds[$id])) { + Minz_Error::error(404); + return; + } + + $this->view->feed = $this->view->feeds[$id]; + + Minz_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $this->view->feed->name() . ' · '); + + if (Minz_Request::isPost()) { + $user = trim(Minz_Request::param('http_user_feed' . $id, '')); + $pass = Minz_Request::param('http_pass_feed' . $id, ''); + + $httpAuth = ''; + if ($user != '' && $pass != '') { //TODO: Sanitize + $httpAuth = $user . ':' . $pass; + } + + $cat = intval(Minz_Request::param('category', 0)); + + $values = array( + 'name' => Minz_Request::param('name', ''), + 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), + 'website' => Minz_Request::param('website', ''), + 'url' => Minz_Request::param('url', ''), + 'category' => $cat, + 'pathEntries' => Minz_Request::param('path_entries', ''), + 'priority' => intval(Minz_Request::param('priority', 0)), + 'httpAuth' => $httpAuth, + 'keep_history' => intval(Minz_Request::param('keep_history', -2)), + 'ttl' => intval(Minz_Request::param('ttl', -2)), + ); + + invalidateHttpCache(); + + $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id)); + if ($feedDAO->updateFeed($id, $values) !== false) { + $this->view->feed->_category($cat); + $this->view->feed->faviconPrepare(); + + Minz_Request::good(_t('feedback.sub.feed.updated'), $url_redirect); + } else { + Minz_Request::bad(_t('feedback.sub.feed.error'), $url_redirect); + } + } + } +} diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php new file mode 100644 index 000000000..8f939dbdb --- /dev/null +++ b/app/Controllers/updateController.php @@ -0,0 +1,226 @@ +<?php + +class FreshRSS_update_Controller extends Minz_ActionController { + + public static function isGit() { + return is_dir(FRESHRSS_PATH . '/.git/'); + } + + public static function hasGitUpdate() { + $cwd = getcwd(); + chdir(FRESHRSS_PATH); + $output = array(); + try { + exec('git fetch', $output, $return); + if ($return == 0) { + exec('git status -sb --porcelain remote', $output, $return); + } else { + $line = is_array($output) ? implode('; ', $output) : '' . $output; + Minz_Log::warning('git fetch warning:' . $line); + } + } catch (Exception $e) { + Minz_Log::warning('git fetch error:' . $e->getMessage()); + } + chdir($cwd); + $line = is_array($output) ? implode('; ', $output) : '' . $output; + return strpos($line, '[behind') !== false; + } + + public static function gitPull() { + $cwd = getcwd(); + chdir(FRESHRSS_PATH); + $output = array(); + $return = 1; + try { + exec('git pull --ff-only', $output, $return); + } catch (Exception $e) { + Minz_Log::warning('git pull error:' . $e->getMessage()); + } + chdir($cwd); + $line = is_array($output) ? implode('; ', $output) : '' . $output; + return $return == 0 ? true : 'Git error: ' . $line; + } + + public function firstAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + + invalidateHttpCache(); + + $this->view->update_to_apply = false; + $this->view->last_update_time = 'unknown'; + $timestamp = @filemtime(join_path(DATA_PATH, 'last_update.txt')); + if ($timestamp !== false) { + $this->view->last_update_time = timestamptodate($timestamp); + } + } + + public function indexAction() { + Minz_View::prependTitle(_t('admin.update.title') . ' · '); + + if (!is_writable(FRESHRSS_PATH)) { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.file_is_nok', FRESHRSS_PATH) + ); + } elseif (file_exists(UPDATE_FILENAME)) { + // There is an update file to apply! + $version = @file_get_contents(join_path(DATA_PATH, 'last_update.txt')); + if (empty($version)) { + $version = 'unknown'; + } + $this->view->update_to_apply = true; + $this->view->message = array( + 'status' => 'good', + 'title' => _t('gen.short.ok'), + 'body' => _t('feedback.update.can_apply', $version) + ); + } + } + + public function checkAction() { + $this->view->change_view('update', 'index'); + + if (file_exists(UPDATE_FILENAME)) { + // There is already an update file to apply: we don't need to check + // the webserver! + // Or if already check during the last hour, do nothing. + Minz_Request::forward(array('c' => 'update'), true); + + return; + } + + $script = ''; + $version = ''; + + if (self::isGit()) { + if (self::hasGitUpdate()) { + $version = 'git'; + } else { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.none') + ); + @touch(join_path(DATA_PATH, 'last_update.txt')); + return; + } + } else { + $auto_update_url = FreshRSS_Context::$system_conf->auto_update_url . '?v=' . FRESHRSS_VERSION; + Minz_Log::debug('HTTP GET ' . $auto_update_url); + $c = curl_init($auto_update_url); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, true); + curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 2); + $result = curl_exec($c); + $c_status = curl_getinfo($c, CURLINFO_HTTP_CODE); + $c_error = curl_error($c); + curl_close($c); + + if ($c_status !== 200) { + Minz_Log::warning( + 'Error during update (HTTP code ' . $c_status . '): ' . $c_error + ); + + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.server_not_found', $auto_update_url) + ); + return; + } + + $res_array = explode("\n", $result, 2); + $status = $res_array[0]; + if (strpos($status, 'UPDATE') !== 0) { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.none') + ); + @touch(join_path(DATA_PATH, 'last_update.txt')); + return; + } + + $script = $res_array[1]; + $version = explode(' ', $status, 2); + $version = $version[1]; + } + + if (file_put_contents(UPDATE_FILENAME, $script) !== false) { + @file_put_contents(join_path(DATA_PATH, 'last_update.txt'), $version); + Minz_Request::forward(array('c' => 'update'), true); + } else { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('gen.short.damn'), + 'body' => _t('feedback.update.error', 'Cannot save the update script') + ); + } + } + + public function applyAction() { + if (!file_exists(UPDATE_FILENAME) || !is_writable(FRESHRSS_PATH)) { + Minz_Request::forward(array('c' => 'update'), true); + } + + if (Minz_Request::param('post_conf', false)) { + if (self::isGit()) { + $res = !self::hasGitUpdate(); + } else { + require(UPDATE_FILENAME); + $res = do_post_update(); + } + + Minz_ExtensionManager::callHook('post_update'); + + if ($res === true) { + @unlink(UPDATE_FILENAME); + @file_put_contents(join_path(DATA_PATH, 'last_update.txt'), ''); + Minz_Request::good(_t('feedback.update.finished')); + } else { + Minz_Request::bad(_t('feedback.update.error', $res), + array('c' => 'update', 'a' => 'index')); + } + } else { + $res = false; + + if (self::isGit()) { + $res = self::gitPull(); + } else { + if (Minz_Request::isPost()) { + save_info_update(); + } + if (!need_info_update()) { + $res = apply_update(); + } else { + return; + } + } + + if ($res === true) { + Minz_Request::forward(array( + 'c' => 'update', + 'a' => 'apply', + 'params' => array('post_conf' => true) + ), true); + } else { + Minz_Request::bad(_t('feedback.update.error', $res), + array('c' => 'update', 'a' => 'index')); + } + } + } + + /** + * This action displays information about installation. + */ + public function checkInstallAction() { + Minz_View::prependTitle(_t('admin.check_install.title') . ' · '); + + $this->view->status_php = check_install_php(); + $this->view->status_files = check_install_files(); + $this->view->status_database = check_install_database(); + } +} diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php new file mode 100644 index 000000000..9d6ae18e6 --- /dev/null +++ b/app/Controllers/userController.php @@ -0,0 +1,257 @@ +<?php + +/** + * Controller to handle user actions. + */ +class FreshRSS_user_Controller extends Minz_ActionController { + // Will also have to be computed client side on mobile devices, + // so do not use a too high cost + const BCRYPT_COST = 9; + + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + * + * @todo clean up the access condition. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess() && !( + Minz_Request::actionName() === 'create' && + !max_registrations_reached() + )) { + Minz_Error::error(403); + } + } + + public static function hashPassword($passwordPlain) { + if (!function_exists('password_hash')) { + include_once(LIB_PATH . '/password_compat.php'); + } + $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); + $passwordPlain = ''; + $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js + return $passwordHash == '' ? '' : $passwordHash; + } + + /** + * This action displays the user profile page. + */ + public function profileAction() { + Minz_View::prependTitle(_t('conf.profile.title') . ' · '); + + Minz_View::appendScript(Minz_Url::display( + '/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js') + )); + + if (Minz_Request::isPost()) { + $ok = true; + + $passwordPlain = Minz_Request::param('newPasswordPlain', '', true); + if ($passwordPlain != '') { + Minz_Request::_param('newPasswordPlain'); //Discard plain-text password ASAP + $_POST['newPasswordPlain'] = ''; + $passwordHash = self::hashPassword($passwordPlain); + $ok &= ($passwordHash != ''); + FreshRSS_Context::$user_conf->passwordHash = $passwordHash; + } + Minz_Session::_param('passwordHash', FreshRSS_Context::$user_conf->passwordHash); + + $passwordPlain = Minz_Request::param('apiPasswordPlain', '', true); + if ($passwordPlain != '') { + $passwordHash = self::hashPassword($passwordPlain); + $ok &= ($passwordHash != ''); + FreshRSS_Context::$user_conf->apiPasswordHash = $passwordHash; + } + + $ok &= FreshRSS_Context::$user_conf->save(); + + if ($ok) { + Minz_Request::good(_t('feedback.profile.updated'), + array('c' => 'user', 'a' => 'profile')); + } else { + Minz_Request::bad(_t('feedback.profile.error'), + array('c' => 'user', 'a' => 'profile')); + } + } + } + + /** + * This action displays the user management page. + */ + public function manageAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + + Minz_View::prependTitle(_t('admin.user.title') . ' · '); + + // Get the correct current user. + $username = Minz_Request::param('u', Minz_Session::param('currentUser')); + if (!FreshRSS_UserDAO::exist($username)) { + $username = Minz_Session::param('currentUser'); + } + $this->view->current_user = $username; + + // Get information about the current user. + $entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user); + $this->view->nb_articles = $entryDAO->count(); + $this->view->size_user = $entryDAO->size(); + } + + public static function createUser($new_user_name, $passwordPlain, $apiPasswordPlain, $userConfig = array(), $insertDefaultFeeds = true) { + if (!is_array($userConfig)) { + $userConfig = array(); + } + + $ok = ($new_user_name != '') && ctype_alnum($new_user_name); + + if ($ok) { + $languages = Minz_Translate::availableLanguages(); + if (empty($userConfig['language']) || !in_array($userConfig['language'], $languages)) { + $userConfig['language'] = 'en'; + } + + $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive + + $configPath = join_path(DATA_PATH, 'users', $new_user_name, 'config.php'); + $ok &= !file_exists($configPath); + } + if ($ok) { + $passwordHash = ''; + if ($passwordPlain != '') { + $passwordHash = self::hashPassword($passwordPlain); + $ok &= ($passwordHash != ''); + } + + $apiPasswordHash = ''; + if ($apiPasswordPlain != '') { + $apiPasswordHash = self::hashPassword($apiPasswordPlain); + $ok &= ($apiPasswordHash != ''); + } + } + if ($ok) { + mkdir(join_path(DATA_PATH, 'users', $new_user_name)); + $userConfig['passwordHash'] = $passwordHash; + $userConfig['apiPasswordHash'] = $apiPasswordHash; + $ok &= (file_put_contents($configPath, "<?php\n return " . var_export($userConfig, true) . ';') !== false); + } + if ($ok) { + $userDAO = new FreshRSS_UserDAO(); + $ok &= $userDAO->createUser($new_user_name, $userConfig['language'], $insertDefaultFeeds); + } + return $ok; + } + + /** + * This action creates a new user. + * + * Request parameters are: + * - new_user_language + * - new_user_name + * - new_user_passwordPlain + * - r (i.e. a redirection url, optional) + * + * @todo clean up this method. Idea: write a method to init a user with basic information. + * @todo handle r redirection in Minz_Request::forward directly? + */ + public function createAction() { + if (Minz_Request::isPost() && ( + FreshRSS_Auth::hasAccess('admin') || + !max_registrations_reached() + )) { + $new_user_name = Minz_Request::param('new_user_name'); + $passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true); + $new_user_language = Minz_Request::param('new_user_language', FreshRSS_Context::$user_conf->language); + + $ok = self::createUser($new_user_name, $passwordPlain, '', array('language' => $new_user_language)); + Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP + $_POST['new_user_passwordPlain'] = ''; + invalidateHttpCache(); + + $notif = array( + 'type' => $ok ? 'good' : 'bad', + 'content' => _t('feedback.user.created' . (!$ok ? '.error' : ''), $new_user_name) + ); + Minz_Session::_param('notification', $notif); + } + + $redirect_url = urldecode(Minz_Request::param('r', false, true)); + if (!$redirect_url) { + $redirect_url = array('c' => 'user', 'a' => 'manage'); + } + Minz_Request::forward($redirect_url, true); + } + + public static function deleteUser($username) { + $db = FreshRSS_Context::$system_conf->db; + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + $ok = ctype_alnum($username); + if ($ok) { + $default_user = FreshRSS_Context::$system_conf->default_user; + $ok &= (strcasecmp($username, $default_user) !== 0); //It is forbidden to delete the default user + } + $user_data = join_path(DATA_PATH, 'users', $username); + if ($ok) { + $ok &= is_dir($user_data); + } + if ($ok) { + $userDAO = new FreshRSS_UserDAO(); + $ok &= $userDAO->deleteUser($username); + $ok &= recursive_unlink($user_data); + } + return $ok; + } + + /** + * This action delete an existing user. + * + * Request parameter is: + * - username + * + * @todo clean up this method. Idea: create a User->clean() method. + */ + public function deleteAction() { + $username = Minz_Request::param('username'); + $redirect_url = urldecode(Minz_Request::param('r', false, true)); + if (!$redirect_url) { + $redirect_url = array('c' => 'user', 'a' => 'manage'); + } + + $self_deletion = Minz_Session::param('currentUser', '_') === $username; + + if (Minz_Request::isPost() && ( + FreshRSS_Auth::hasAccess('admin') || + $self_deletion + )) { + $ok = true; + if ($ok && $self_deletion) { + // We check the password if it's a self-destruction + $nonce = Minz_Session::param('nonce'); + $challenge = Minz_Request::param('challenge', ''); + + $ok &= FreshRSS_FormAuth::checkCredentials( + $username, FreshRSS_Context::$user_conf->passwordHash, + $nonce, $challenge + ); + } + if ($ok) { + $ok &= self::deleteUser($username); + } + if ($ok && $self_deletion) { + FreshRSS_Auth::removeAccess(); + $redirect_url = array('c' => 'index', 'a' => 'index'); + } + invalidateHttpCache(); + + $notif = array( + 'type' => $ok ? 'good' : 'bad', + 'content' => _t('feedback.user.deleted' . (!$ok ? '.error' : ''), $username) + ); + Minz_Session::_param('notification', $notif); + } + + Minz_Request::forward($redirect_url, true); + } +} diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php deleted file mode 100644 index bb4f34c5e..000000000 --- a/app/Controllers/usersController.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php - -class FreshRSS_users_Controller extends Minz_ActionController { - - const BCRYPT_COST = 9; //Will also have to be computed client side on mobile devices, so do not use a too high cost - - public function firstAction() { - if (!$this->view->loginOk) { - Minz_Error::error( - 403, - array('error' => array(Minz_Translate::t('access_denied'))) - ); - } - } - - public function authAction() { - if (Minz_Request::isPost()) { - $ok = true; - - $passwordPlain = Minz_Request::param('passwordPlain', false); - if ($passwordPlain != '') { - Minz_Request::_param('passwordPlain'); //Discard plain-text password ASAP - $_POST['passwordPlain'] = ''; - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); - } - $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); - $passwordPlain = ''; - $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js - $ok &= ($passwordHash != ''); - $this->view->conf->_passwordHash($passwordHash); - } - Minz_Session::_param('passwordHash', $this->view->conf->passwordHash); - - if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { - $this->view->conf->_mail_login(Minz_Request::param('mail_login', false)); - } - $email = $this->view->conf->mail_login; - Minz_Session::_param('mail', $email); - - $ok &= $this->view->conf->save(); - - if ($email != '') { - $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; - @unlink($personaFile); - $ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false); - } - - if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { - $current_token = $this->view->conf->token; - $token = Minz_Request::param('token', $current_token); - $this->view->conf->_token($token); - $ok &= $this->view->conf->save(); - - $anon = Minz_Request::param('anon_access', false); - $anon = ((bool)$anon) && ($anon !== 'no'); - $anon_refresh = Minz_Request::param('anon_refresh', false); - $anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no'); - $auth_type = Minz_Request::param('auth_type', 'none'); - if ($anon != Minz_Configuration::allowAnonymous() || - $auth_type != Minz_Configuration::authType() || - $anon_refresh != Minz_Configuration::allowAnonymousRefresh()) { - - Minz_Configuration::_authType($auth_type); - Minz_Configuration::_allowAnonymous($anon); - Minz_Configuration::_allowAnonymousRefresh($anon_refresh); - $ok &= Minz_Configuration::writeFile(); - } - } - - invalidateHttpCache(); - - $notif = array( - 'type' => $ok ? 'good' : 'bad', - 'content' => Minz_Translate::t($ok ? 'configuration_updated' : 'error_occurred') - ); - Minz_Session::_param('notification', $notif); - } - Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true); - } - - public function createAction() { - if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { - require_once(APP_PATH . '/sql.php'); - - $new_user_language = Minz_Request::param('new_user_language', $this->view->conf->language); - if (!in_array($new_user_language, $this->view->conf->availableLanguages())) { - $new_user_language = $this->view->conf->language; - } - - $new_user_name = Minz_Request::param('new_user_name'); - $ok = ($new_user_name != '') && ctype_alnum($new_user_name); - - if ($ok) { - $ok &= (strcasecmp($new_user_name, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to alter the default user - - $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive - - $configPath = DATA_PATH . '/' . $new_user_name . '_user.php'; - $ok &= !file_exists($configPath); - } - if ($ok) { - - $passwordPlain = Minz_Request::param('new_user_passwordPlain', false); - $passwordHash = ''; - if ($passwordPlain != '') { - Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP - $_POST['new_user_passwordPlain'] = ''; - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); - } - $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); - $passwordPlain = ''; - $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js - $ok &= ($passwordHash != ''); - } - if (empty($passwordHash)) { - $passwordHash = ''; - } - - $new_user_email = filter_var($_POST['new_user_email'], FILTER_VALIDATE_EMAIL); - if (empty($new_user_email)) { - $new_user_email = ''; - } else { - $personaFile = DATA_PATH . '/persona/' . $new_user_email . '.txt'; - @unlink($personaFile); - $ok &= (file_put_contents($personaFile, $new_user_name) !== false); - } - } - if ($ok) { - $config_array = array( - 'language' => $new_user_language, - 'passwordHash' => $passwordHash, - 'mail_login' => $new_user_email, - ); - $ok &= (file_put_contents($configPath, "<?php\n return " . var_export($config_array, true) . ';') !== false); - } - if ($ok) { - $userDAO = new FreshRSS_UserDAO(); - $ok &= $userDAO->createUser($new_user_name); - } - invalidateHttpCache(); - - $notif = array( - 'type' => $ok ? 'good' : 'bad', - 'content' => Minz_Translate::t($ok ? 'user_created' : 'error_occurred', $new_user_name) - ); - Minz_Session::_param('notification', $notif); - } - Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true); - } - - public function deleteAction() { - if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { - require_once(APP_PATH . '/sql.php'); - - $username = Minz_Request::param('username'); - $ok = ctype_alnum($username); - - if ($ok) { - $ok &= (strcasecmp($username, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to delete the default user - } - if ($ok) { - $configPath = DATA_PATH . '/' . $username . '_user.php'; - $ok &= file_exists($configPath); - } - if ($ok) { - $userDAO = new FreshRSS_UserDAO(); - $ok &= $userDAO->deleteUser($username); - $ok &= unlink($configPath); - //TODO: delete Persona file - } - invalidateHttpCache(); - - $notif = array( - 'type' => $ok ? 'good' : 'bad', - 'content' => Minz_Translate::t($ok ? 'user_deleted' : 'error_occurred', $username) - ); - Minz_Session::_param('notification', $notif); - } - Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true); - } -} diff --git a/app/Exceptions/AlreadySubscribedException.php b/app/Exceptions/AlreadySubscribedException.php new file mode 100644 index 000000000..33b9f9555 --- /dev/null +++ b/app/Exceptions/AlreadySubscribedException.php @@ -0,0 +1,14 @@ +<?php + +class FreshRSS_AlreadySubscribed_Exception extends Exception { + private $feedName = ''; + + public function __construct($url, $feedName) { + parent::__construct('Already subscribed! ' . $url, 2135); + $this->feedName = $feedName; + } + + public function feedName() { + return $this->feedName; + } +} diff --git a/app/Exceptions/BadUrlException.php b/app/Exceptions/BadUrlException.php index 7d1fe110e..d2509e4ba 100644 --- a/app/Exceptions/BadUrlException.php +++ b/app/Exceptions/BadUrlException.php @@ -1,6 +1,9 @@ <?php + class FreshRSS_BadUrl_Exception extends FreshRSS_Feed_Exception { - public function __construct ($url) { - parent::__construct ('`' . $url . '` is not a valid URL'); + + public function __construct($url) { + parent::__construct('`' . $url . '` is not a valid URL'); } + } diff --git a/app/Exceptions/ContextException.php b/app/Exceptions/ContextException.php new file mode 100644 index 000000000..00934cbfd --- /dev/null +++ b/app/Exceptions/ContextException.php @@ -0,0 +1,8 @@ +<?php + +/** + * An exception raised when a context is invalid + */ +class FreshRSS_Context_Exception extends Exception { + +} diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php new file mode 100644 index 000000000..14bee3403 --- /dev/null +++ b/app/Exceptions/DAOException.php @@ -0,0 +1,5 @@ +<?php + +class FreshRSS_DAO_Exception extends Exception { + +} diff --git a/app/Exceptions/EntriesGetterException.php b/app/Exceptions/EntriesGetterException.php index eaa330979..3b76195ee 100644 --- a/app/Exceptions/EntriesGetterException.php +++ b/app/Exceptions/EntriesGetterException.php @@ -1,7 +1,5 @@ <?php class FreshRSS_EntriesGetter_Exception extends Exception { - public function __construct ($message) { - parent::__construct ($message); - } + } diff --git a/app/Exceptions/FeedException.php b/app/Exceptions/FeedException.php index 50918ba95..abfcbce79 100644 --- a/app/Exceptions/FeedException.php +++ b/app/Exceptions/FeedException.php @@ -1,6 +1,5 @@ <?php + class FreshRSS_Feed_Exception extends Exception { - public function __construct ($message) { - parent::__construct ($message); - } + } diff --git a/app/Exceptions/FeedNotAddedException.php b/app/Exceptions/FeedNotAddedException.php new file mode 100644 index 000000000..350a17c56 --- /dev/null +++ b/app/Exceptions/FeedNotAddedException.php @@ -0,0 +1,14 @@ +<?php + +class FreshRSS_FeedNotAdded_Exception extends Exception { + private $feedName = ''; + + public function __construct($url, $feedName) { + parent::__construct('Feed not added! ' . $url, 2147); + $this->feedName = $feedName; + } + + public function feedName() { + return $this->feedName; + } +} diff --git a/app/Exceptions/OpmlException.php b/app/Exceptions/OpmlException.php deleted file mode 100644 index e0ea3e493..000000000 --- a/app/Exceptions/OpmlException.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -class FreshRSS_Opml_Exception extends FreshRSS_Feed_Exception { - public function __construct ($name_file) { - parent::__construct ('OPML file is invalid'); - } -} diff --git a/app/Exceptions/ZipException.php b/app/Exceptions/ZipException.php new file mode 100644 index 000000000..8441daedf --- /dev/null +++ b/app/Exceptions/ZipException.php @@ -0,0 +1,14 @@ +<?php + +class FreshRSS_Zip_Exception extends Exception { + private $zipErrorCode = 0; + + public function __construct($zipErrorCode) { + parent::__construct('ZIP error! ' . $url, 2141); + $this->zipErrorCode = $zipErrorCode; + } + + public function zipErrorCode() { + return $this->zipErrorCode; + } +} diff --git a/app/Exceptions/ZipMissingException.php b/app/Exceptions/ZipMissingException.php new file mode 100644 index 000000000..864cc3991 --- /dev/null +++ b/app/Exceptions/ZipMissingException.php @@ -0,0 +1,4 @@ +<?php + +class FreshRSS_ZipMissing_Exception extends Exception { +} diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 84cf3429b..e4caf23d1 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -1,146 +1,128 @@ <?php + class FreshRSS extends Minz_FrontController { + /** + * Initialize the different FreshRSS / Minz components. + * + * PLEASE DON'T CHANGE THE ORDER OF INITIALIZATIONS UNLESS YOU KNOW WHAT + * YOU DO!! + * + * Here is the list of components: + * - Create a configuration setter and register it to system conf + * - Init extension manager and enable system extensions (has to be done asap) + * - Init authentication system + * - Init user configuration (need auth system) + * - Init FreshRSS context (need user conf) + * - Init i18n (need context) + * - Init sharing system (need user conf and i18n) + * - Init generic styles and scripts (need user conf) + * - Init notifications + * - Enable user extensions (need all the other initializations) + */ public function init() { if (!isset($_SESSION)) { Minz_Session::init('FreshRSS'); } - $loginOk = $this->accessControl(Minz_Session::param('currentUser', '')); - $this->loadParamsView(); - $this->loadStylesAndScripts($loginOk); //TODO: Do not load that when not needed, e.g. some Ajax requests - $this->loadNotifications(); - } - private function accessControl($currentUser) { - if ($currentUser == '') { - switch (Minz_Configuration::authType()) { - case 'form': - $currentUser = Minz_Configuration::defaultUser(); - Minz_Session::_param('passwordHash'); - $loginOk = false; - break; - case 'http_auth': - $currentUser = httpAuthUser(); - $loginOk = $currentUser != ''; - break; - case 'persona': - $loginOk = false; - $email = filter_var(Minz_Session::param('mail'), FILTER_VALIDATE_EMAIL); - if ($email != '') { //TODO: Remove redundancy with indexController - $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; - if (($currentUser = @file_get_contents($personaFile)) !== false) { - $currentUser = trim($currentUser); - $loginOk = true; - } - } - if (!$loginOk) { - $currentUser = Minz_Configuration::defaultUser(); - } - break; - case 'none': - $currentUser = Minz_Configuration::defaultUser(); - $loginOk = true; - break; - default: - $currentUser = Minz_Configuration::defaultUser(); - $loginOk = false; - break; - } - } else { - $loginOk = true; - } + // Register the configuration setter for the system configuration + $configuration_setter = new FreshRSS_ConfigurationSetter(); + $system_conf = Minz_Configuration::get('system'); + $system_conf->_configurationSetter($configuration_setter); - if (!ctype_alnum($currentUser)) { - Minz_Session::_param('currentUser', ''); - die('Invalid username [' . $currentUser . ']!'); - } + // Load list of extensions and enable the "system" ones. + Minz_ExtensionManager::init(); - try { - $this->conf = new FreshRSS_Configuration($currentUser); - Minz_View::_param ('conf', $this->conf); - Minz_Session::_param('currentUser', $currentUser); - } catch (Minz_Exception $me) { - $loginOk = false; - try { - $this->conf = new FreshRSS_Configuration(Minz_Configuration::defaultUser()); - Minz_Session::_param('currentUser', Minz_Configuration::defaultUser()); - Minz_View::_param('conf', $this->conf); - $notif = array( - 'type' => 'bad', - 'content' => 'Invalid configuration for user [' . $currentUser . ']!', - ); - Minz_Session::_param ('notification', $notif); - Minz_Log::record ($notif['content'] . ' ' . $me->getMessage(), Minz_Log::WARNING); - Minz_Session::_param('currentUser', ''); - } catch (Exception $e) { - die($e->getMessage()); - } - } + // Auth has to be initialized before using currentUser session parameter + // because it's this part which create this parameter. + self::initAuth(); - if ($loginOk) { - switch (Minz_Configuration::authType()) { - case 'form': - $loginOk = Minz_Session::param('passwordHash') === $this->conf->passwordHash; - break; - case 'http_auth': - $loginOk = strcasecmp($currentUser, httpAuthUser()) === 0; - break; - case 'persona': - $loginOk = strcasecmp(Minz_Session::param('mail'), $this->conf->mail_login) === 0; - break; - case 'none': - $loginOk = true; - break; - default: - $loginOk = false; - break; - } + // Then, register the user configuration and use the configuration setter + // created above. + $current_user = Minz_Session::param('currentUser', '_'); + Minz_Configuration::register('user', + join_path(USERS_PATH, $current_user, 'config.php'), + join_path(USERS_PATH, '_', 'config.default.php'), + $configuration_setter); + + // Finish to initialize the other FreshRSS / Minz components. + FreshRSS_Context::init(); + self::initI18n(); + self::loadNotifications(); + // Enable extensions for the current (logged) user. + if (FreshRSS_Auth::hasAccess() || $system_conf->allow_anonymous) { + $ext_list = FreshRSS_Context::$user_conf->extensions_enabled; + Minz_ExtensionManager::enableByList($ext_list); } - Minz_View::_param ('loginOk', $loginOk); - return $loginOk; } - private function loadParamsView () { - Minz_Session::_param ('language', $this->conf->language); - Minz_Translate::init(); - $output = Minz_Request::param ('output', ''); - if (($output === '') || ($output !== 'normal' && $output !== 'rss' && $output !== 'reader' && $output !== 'global')) { - $output = $this->conf->view_mode; - Minz_Request::_param ('output', $output); + private static function initAuth() { + FreshRSS_Auth::init(); + if (Minz_Request::isPost() && !(is_referer_from_same_domain() && FreshRSS_Auth::isCsrfOk())) { + // Basic protection against XSRF attacks + FreshRSS_Auth::removeAccess(); + $http_referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; + Minz_Translate::init('en'); //TODO: Better choice of fallback language + Minz_Error::error( + 403, + array('error' => array( + _t('feedback.access.denied'), + ' [HTTP_REFERER=' . htmlspecialchars($http_referer) . ']' + )) + ); } } - private function loadStylesAndScripts ($loginOk) { - $theme = FreshRSS_Themes::load($this->conf->theme); + private static function initI18n() { + Minz_Session::_param('language', FreshRSS_Context::$user_conf->language); + Minz_Translate::init(FreshRSS_Context::$user_conf->language); + } + + public static function loadStylesAndScripts() { + $theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme); if ($theme) { foreach($theme['files'] as $file) { - Minz_View::appendStyle (Minz_Url::display ('/themes/' . $theme['id'] . '/' . $file . '?' . @filemtime(PUBLIC_PATH . '/themes/' . $theme['id'] . '/' . $file))); + if ($file[0] === '_') { + $theme_id = 'base-theme'; + $filename = substr($file, 1); + } else { + $theme_id = $theme['id']; + $filename = $file; + } + $filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename); + $url = '/themes/' . $theme_id . '/' . $filename . '?' . $filetime; + header('Link: <' . Minz_Url::display($url, '', 'root') . '>;rel=preload', false); //HTTP2 + Minz_View::appendStyle(Minz_Url::display($url)); } } - switch (Minz_Configuration::authType()) { - case 'form': - if (!$loginOk) { - Minz_View::appendScript(Minz_Url::display ('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'))); - } - break; - case 'persona': - Minz_View::appendScript('https://login.persona.org/include.js'); - break; - } - $includeLazyLoad = $this->conf->lazyload && ($this->conf->display_posts || Minz_Request::param ('output') === 'reader'); - Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')), false, !$includeLazyLoad, !$includeLazyLoad); - if ($includeLazyLoad) { - Minz_View::appendScript (Minz_Url::display ('/scripts/jquery.lazyload.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.lazyload.min.js'))); - } - Minz_View::appendScript (Minz_Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); - Minz_View::appendScript (Minz_Url::display ('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); + Minz_View::appendScript(Minz_Url::display('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js'))); + Minz_View::appendScript(Minz_Url::display('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); + Minz_View::appendScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); } - private function loadNotifications () { - $notif = Minz_Session::param ('notification'); + private static function loadNotifications() { + $notif = Minz_Session::param('notification'); if ($notif) { - Minz_View::_param ('notification', $notif); - Minz_Session::_param ('notification'); + Minz_View::_param('notification', $notif); + Minz_Session::_param('notification'); + } + } + + public static function preLayout() { + switch (Minz_Request::controllerName()) { + case 'index': + header("Content-Security-Policy: default-src 'self'; child-src *; frame-src *; img-src * data:; media-src *"); + break; + case 'stats': + header("Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'"); + break; + default: + header("Content-Security-Policy: default-src 'self'"); + break; } + header("X-Content-Type-Options: nosniff"); + + FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php')); + self::loadStylesAndScripts(); } } diff --git a/app/Models/Auth.php b/app/Models/Auth.php new file mode 100644 index 000000000..b3255cfbd --- /dev/null +++ b/app/Models/Auth.php @@ -0,0 +1,264 @@ +<?php + +/** + * This class handles all authentication process. + */ +class FreshRSS_Auth { + /** + * Determines if user is connected. + */ + private static $login_ok = false; + + /** + * This method initializes authentication system. + */ + public static function init() { + self::$login_ok = Minz_Session::param('loginOk', false); + $current_user = Minz_Session::param('currentUser', ''); + if ($current_user === '') { + $conf = Minz_Configuration::get('system'); + $current_user = $conf->default_user; + Minz_Session::_param('currentUser', $current_user); + } + + if (self::$login_ok) { + self::giveAccess(); + } elseif (self::accessControl()) { + self::giveAccess(); + FreshRSS_UserDAO::touch(); + } else { + // Be sure all accesses are removed! + self::removeAccess(); + } + } + + /** + * This method checks if user is allowed to connect. + * + * Required session parameters are also set in this method (such as + * currentUser). + * + * @return boolean true if user can be connected, false else. + */ + private static function accessControl() { + $conf = Minz_Configuration::get('system'); + $auth_type = $conf->auth_type; + switch ($auth_type) { + case 'form': + $credentials = FreshRSS_FormAuth::getCredentialsFromCookie(); + $current_user = ''; + if (isset($credentials[1])) { + $current_user = trim($credentials[0]); + Minz_Session::_param('currentUser', $current_user); + Minz_Session::_param('passwordHash', trim($credentials[1])); + } + return $current_user != ''; + case 'http_auth': + $current_user = httpAuthUser(); + $login_ok = $current_user != ''; + if ($login_ok) { + Minz_Session::_param('currentUser', $current_user); + } + return $login_ok; + case 'none': + return true; + default: + // TODO load extension + return false; + } + } + + /** + * Gives access to the current user. + */ + public static function giveAccess() { + $current_user = Minz_Session::param('currentUser'); + $user_conf = get_user_configuration($current_user); + $system_conf = Minz_Configuration::get('system'); + + switch ($system_conf->auth_type) { + case 'form': + self::$login_ok = Minz_Session::param('passwordHash') === $user_conf->passwordHash; + break; + case 'http_auth': + self::$login_ok = strcasecmp($current_user, httpAuthUser()) === 0; + break; + case 'none': + self::$login_ok = true; + break; + default: + // TODO: extensions + self::$login_ok = false; + } + + Minz_Session::_param('loginOk', self::$login_ok); + } + + /** + * Returns if current user has access to the given scope. + * + * @param string $scope general (default) or admin + * @return boolean true if user has corresponding access, false else. + */ + public static function hasAccess($scope = 'general') { + $conf = Minz_Configuration::get('system'); + $default_user = $conf->default_user; + $ok = self::$login_ok; + switch ($scope) { + case 'general': + break; + case 'admin': + $ok &= Minz_Session::param('currentUser') === $default_user; + break; + default: + $ok = false; + } + return $ok; + } + + /** + * Removes all accesses for the current user. + */ + public static function removeAccess() { + Minz_Session::_param('loginOk'); + self::$login_ok = false; + $conf = Minz_Configuration::get('system'); + Minz_Session::_param('currentUser', $conf->default_user); + Minz_Session::_param('csrf'); + + switch ($conf->auth_type) { + case 'form': + Minz_Session::_param('passwordHash'); + FreshRSS_FormAuth::deleteCookie(); + break; + case 'http_auth': + case 'none': + // Nothing to do... + break; + default: + // TODO: extensions + } + } + + /** + * Return if authentication is enabled on this instance of FRSS. + */ + public static function accessNeedsLogin() { + $conf = Minz_Configuration::get('system'); + $auth_type = $conf->auth_type; + return $auth_type !== 'none'; + } + + /** + * Return if authentication requires a PHP action. + */ + public static function accessNeedsAction() { + $conf = Minz_Configuration::get('system'); + $auth_type = $conf->auth_type; + return $auth_type === 'form'; + } + + public static function csrfToken() { + $csrf = Minz_Session::param('csrf'); + if ($csrf == '') { + $salt = FreshRSS_Context::$system_conf->salt; + $csrf = sha1($salt . uniqid(mt_rand(), true)); + Minz_Session::_param('csrf', $csrf); + } + return $csrf; + } + public static function isCsrfOk($token = null) { + $csrf = Minz_Session::param('csrf'); + if ($csrf == '') { + return true; //Not logged in yet + } + if ($token === null) { + $token = Minz_Request::fetchPOST('_csrf'); + } + return $token === $csrf; + } +} + + +class FreshRSS_FormAuth { + public static function checkCredentials($username, $hash, $nonce, $challenge) { + if (!ctype_alnum($username) || + !ctype_graph($challenge) || + !ctype_alnum($nonce)) { + Minz_Log::debug('Invalid credential parameters:' . + ' user=' . $username . + ' challenge=' . $challenge . + ' nonce=' . $nonce); + return false; + } + + if (!function_exists('password_verify')) { + include_once(LIB_PATH . '/password_compat.php'); + } + + return password_verify($nonce . $hash, $challenge); + } + + public static function getCredentialsFromCookie() { + $token = Minz_Session::getLongTermCookie('FreshRSS_login'); + if (!ctype_alnum($token)) { + return array(); + } + + $token_file = DATA_PATH . '/tokens/' . $token . '.txt'; + $mtime = @filemtime($token_file); + if ($mtime + 2629744 < time()) { + // Token has expired (> 1 month) or does not exist. + // TODO: 1 month -> use a configuration instead + @unlink($token_file); + return array(); + } + + $credentials = @file_get_contents($token_file); + return $credentials === false ? array() : explode("\t", $credentials, 2); + } + + public static function makeCookie($username, $password_hash) { + $conf = Minz_Configuration::get('system'); + do { + $token = sha1($conf->salt . $username . uniqid(mt_rand(), true)); + $token_file = DATA_PATH . '/tokens/' . $token . '.txt'; + } while (file_exists($token_file)); + + if (@file_put_contents($token_file, $username . "\t" . $password_hash) === false) { + return false; + } + + $limits = $conf->limits; + $cookie_duration = empty($limits['cookie_duration']) ? 2629744 : $limits['cookie_duration']; + $expire = time() + $cookie_duration; + Minz_Session::setLongTermCookie('FreshRSS_login', $token, $expire); + return $token; + } + + public static function deleteCookie() { + $token = Minz_Session::getLongTermCookie('FreshRSS_login'); + if (ctype_alnum($token)) { + Minz_Session::deleteLongTermCookie('FreshRSS_login'); + @unlink(DATA_PATH . '/tokens/' . $token . '.txt'); + } + + if (rand(0, 10) === 1) { + self::purgeTokens(); + } + } + + public static function purgeTokens() { + $conf = Minz_Configuration::get('system'); + $limits = $conf->limits; + $cookie_duration = empty($limits['cookie_duration']) ? 2629744 : $limits['cookie_duration']; + $oldest = time() - $cookie_duration; + foreach (new DirectoryIterator(DATA_PATH . '/tokens/') as $file_info) { + // $extension = $file_info->getExtension(); doesn't work in PHP < 5.3.7 + $extension = pathinfo($file_info->getFilename(), PATHINFO_EXTENSION); + if ($extension === 'txt' && $file_info->getMTime() < $oldest) { + @unlink($file_info->getPathname()); + } + } + } +} diff --git a/app/Models/Category.php b/app/Models/Category.php index 328bae799..9a44a2d09 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -6,66 +6,73 @@ class FreshRSS_Category extends Minz_Model { private $nbFeed = -1; private $nbNotRead = -1; private $feeds = null; + private $hasFeedsWithError = false; - public function __construct ($name = '', $feeds = null) { - $this->_name ($name); - if (isset ($feeds)) { - $this->_feeds ($feeds); + public function __construct($name = '', $feeds = null) { + $this->_name($name); + if (isset($feeds)) { + $this->_feeds($feeds); $this->nbFeed = 0; $this->nbNotRead = 0; foreach ($feeds as $feed) { $this->nbFeed++; - $this->nbNotRead += $feed->nbNotRead (); + $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } } - public function id () { + public function id() { return $this->id; } - public function name () { + public function name() { return $this->name; } - public function nbFeed () { + public function nbFeed() { if ($this->nbFeed < 0) { - $catDAO = new FreshRSS_CategoryDAO (); - $this->nbFeed = $catDAO->countFeed ($this->id ()); + $catDAO = new FreshRSS_CategoryDAO(); + $this->nbFeed = $catDAO->countFeed($this->id()); } return $this->nbFeed; } - public function nbNotRead () { + public function nbNotRead() { if ($this->nbNotRead < 0) { - $catDAO = new FreshRSS_CategoryDAO (); - $this->nbNotRead = $catDAO->countNotRead ($this->id ()); + $catDAO = new FreshRSS_CategoryDAO(); + $this->nbNotRead = $catDAO->countNotRead($this->id()); } return $this->nbNotRead; } - public function feeds () { + public function feeds() { if ($this->feeds === null) { - $feedDAO = new FreshRSS_FeedDAO (); - $this->feeds = $feedDAO->listByCategory ($this->id ()); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->feeds = $feedDAO->listByCategory($this->id()); $this->nbFeed = 0; $this->nbNotRead = 0; foreach ($this->feeds as $feed) { $this->nbFeed++; - $this->nbNotRead += $feed->nbNotRead (); + $this->nbNotRead += $feed->nbNotRead(); + $this->hasFeedsWithError |= $feed->inError(); } } return $this->feeds; } - public function _id ($value) { + public function hasFeedsWithError() { + return $this->hasFeedsWithError; + } + + public function _id($value) { $this->id = $value; } - public function _name ($value) { - $this->name = $value; + public function _name($value) { + $this->name = substr(trim($value), 0, 255); } - public function _feeds ($values) { - if (!is_array ($values)) { - $values = array ($values); + public function _feeds($values) { + if (!is_array($values)) { + $values = array($values); } $this->feeds = $values; diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 5355228a5..c2d57c241 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -1,171 +1,190 @@ <?php -class FreshRSS_CategoryDAO extends Minz_ModelPdo { - public function addCategory ($valuesTmp) { - $sql = 'INSERT INTO `' . $this->prefix . 'category` (name) VALUES(?)'; - $stm = $this->bd->prepare ($sql); +class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { - $values = array ( + const defaultCategoryId = 1; + + public function addCategory($valuesTmp) { + $sql = 'INSERT INTO `' . $this->prefix . 'category`(name) VALUES(?)'; + $stm = $this->bd->prepare($sql); + + $values = array( substr($valuesTmp['name'], 0, 255), ); - if ($stm && $stm->execute ($values)) { - return $this->bd->lastInsertId(); + if ($stm && $stm->execute($values)) { + return $this->bd->lastInsertId('"' . $this->prefix . 'category_id_seq"'); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error addCategory: ' . $info[2]); return false; } } - public function updateCategory ($id, $valuesTmp) { + public function addCategoryObject($category) { + $cat = $this->searchByName($category->name()); + if (!$cat) { + // Category does not exist yet in DB so we add it before continue + $values = array( + 'name' => $category->name(), + ); + return $this->addCategory($values); + } + + return $cat->id(); + } + + public function updateCategory($id, $valuesTmp) { $sql = 'UPDATE `' . $this->prefix . 'category` SET name=? WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ( + $values = array( $valuesTmp['name'], $id ); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateCategory: ' . $info[2]); return false; } } - public function deleteCategory ($id) { + public function deleteCategory($id) { + if ($id <= self::defaultCategoryId) { + return false; + } $sql = 'DELETE FROM `' . $this->prefix . 'category` WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($id); + $values = array($id); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error deleteCategory: ' . $info[2]); return false; } } - public function searchById ($id) { + public function searchById($id) { $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($id); + $values = array($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $cat = self::daoToCategory ($res); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $cat = self::daoToCategory($res); - if (isset ($cat[0])) { + if (isset($cat[0])) { return $cat[0]; } else { - return false; + return null; } } - public function searchByName ($name) { + public function searchByName($name) { $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE name=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($name); + $values = array($name); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $cat = self::daoToCategory ($res); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $cat = self::daoToCategory($res); - if (isset ($cat[0])) { + if (isset($cat[0])) { return $cat[0]; } else { - return false; + return null; } } - public function listCategories ($prePopulateFeeds = true, $details = false) { + public function listCategories($prePopulateFeeds = true, $details = false) { if ($prePopulateFeeds) { $sql = 'SELECT c.id AS c_id, c.name AS c_name, ' - . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.cache_nbEntries, f.cache_nbUnreads ') + . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.`cache_nbEntries`, f.`cache_nbUnreads` ') . 'FROM `' . $this->prefix . 'category` c ' - . 'LEFT OUTER JOIN `' . $this->prefix . 'feed` f ON f.category = c.id ' - . 'GROUP BY f.id ' + . 'LEFT OUTER JOIN `' . $this->prefix . 'feed` f ON f.category=c.id ' + . 'GROUP BY f.id, c_id ' . 'ORDER BY c.name, f.name'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); - return self::daoToCategoryPrepopulated ($stm->fetchAll (PDO::FETCH_ASSOC)); + $stm = $this->bd->prepare($sql); + $stm->execute(); + return self::daoToCategoryPrepopulated($stm->fetchAll(PDO::FETCH_ASSOC)); } else { $sql = 'SELECT * FROM `' . $this->prefix . 'category` ORDER BY name'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); - return self::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); + $stm = $this->bd->prepare($sql); + $stm->execute(); + return self::daoToCategory($stm->fetchAll(PDO::FETCH_ASSOC)); } } - public function getDefault () { - $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=1'; - $stm = $this->bd->prepare ($sql); + public function getDefault() { + $sql = 'SELECT * FROM `' . $this->prefix . 'category` WHERE id=' . self::defaultCategoryId; + $stm = $this->bd->prepare($sql); - $stm->execute (); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $cat = self::daoToCategory ($res); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $cat = self::daoToCategory($res); - if (isset ($cat[0])) { + if (isset($cat[0])) { return $cat[0]; } else { return false; } } - public function checkDefault () { - $def_cat = $this->searchById (1); + public function checkDefault() { + $def_cat = $this->searchById(self::defaultCategoryId); - if ($def_cat === false) { - $cat = new FreshRSS_Category (Minz_Translate::t ('default_category')); - $cat->_id (1); + if ($def_cat == null) { + $cat = new FreshRSS_Category(_t('gen.short.default_category')); + $cat->_id(self::defaultCategoryId); - $values = array ( - 'id' => $cat->id (), - 'name' => $cat->name (), + $values = array( + 'id' => $cat->id(), + 'name' => $cat->name(), ); - $this->addCategory ($values); + $this->addCategory($values); } } - public function count () { + public function count() { $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'category`'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; } - public function countFeed ($id) { + public function countFeed($id) { $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'feed` WHERE category=?'; - $stm = $this->bd->prepare ($sql); - $values = array ($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $stm = $this->bd->prepare($sql); + $values = array($id); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; } - public function countNotRead ($id) { - $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE category=? AND e.is_read=0'; - $stm = $this->bd->prepare ($sql); - $values = array ($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); + public function countNotRead($id) { + $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE category=? AND e.is_read=0'; + $stm = $this->bd->prepare($sql); + $values = array($id); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; } public static function findFeed($categories, $feed_id) { foreach ($categories as $category) { - foreach ($category->feeds () as $feed) { - if ($feed->id () === $feed_id) { + foreach ($category->feeds() as $feed) { + if ($feed->id() === $feed_id) { return $feed; } } @@ -176,8 +195,8 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { public static function CountUnreads($categories, $minPriority = 0) { $n = 0; foreach ($categories as $category) { - foreach ($category->feeds () as $feed) { - if ($feed->priority () >= $minPriority) { + foreach ($category->feeds() as $feed) { + if ($feed->priority() >= $minPriority) { $n += $feed->nbNotRead(); } } @@ -185,23 +204,24 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { return $n; } - public static function daoToCategoryPrepopulated ($listDAO) { - $list = array (); + public static function daoToCategoryPrepopulated($listDAO) { + $list = array(); - if (!is_array ($listDAO)) { - $listDAO = array ($listDAO); + if (!is_array($listDAO)) { + $listDAO = array($listDAO); } $previousLine = null; $feedsDao = array(); + $feedDao = FreshRSS_Factory::createFeedDAO(); foreach ($listDAO as $line) { if ($previousLine['c_id'] != null && $line['c_id'] !== $previousLine['c_id']) { // End of the current category, we add it to the $list - $cat = new FreshRSS_Category ( + $cat = new FreshRSS_Category( $previousLine['c_name'], - FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id']) + $feedDao->daoToFeed($feedsDao, $previousLine['c_id']) ); - $cat->_id ($previousLine['c_id']); + $cat->_id($previousLine['c_id']); $list[$previousLine['c_id']] = $cat; $feedsDao = array(); //Prepare for next category @@ -213,29 +233,29 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { // add the last category if ($previousLine != null) { - $cat = new FreshRSS_Category ( + $cat = new FreshRSS_Category( $previousLine['c_name'], - FreshRSS_FeedDAO::daoToFeed ($feedsDao, $previousLine['c_id']) + $feedDao->daoToFeed($feedsDao, $previousLine['c_id']) ); - $cat->_id ($previousLine['c_id']); + $cat->_id($previousLine['c_id']); $list[$previousLine['c_id']] = $cat; } return $list; } - public static function daoToCategory ($listDAO) { - $list = array (); + public static function daoToCategory($listDAO) { + $list = array(); - if (!is_array ($listDAO)) { - $listDAO = array ($listDAO); + if (!is_array($listDAO)) { + $listDAO = array($listDAO); } foreach ($listDAO as $key => $dao) { - $cat = new FreshRSS_Category ( + $cat = new FreshRSS_Category( $dao['name'] ); - $cat->_id ($dao['id']); + $cat->_id($dao['id']); $list[$key] = $cat; } diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php deleted file mode 100644 index 2b719c370..000000000 --- a/app/Models/Configuration.php +++ /dev/null @@ -1,249 +0,0 @@ -<?php - -class FreshRSS_Configuration { - private $filename; - - private $data = array( - 'language' => 'en', - 'old_entries' => 3, - 'keep_history_default' => 0, - 'mail_login' => '', - 'token' => '', - 'passwordHash' => '', //CRYPT_BLOWFISH - 'posts_per_page' => 20, - 'view_mode' => 'normal', - 'default_view' => 'not_read', - 'auto_load_more' => true, - 'display_posts' => false, - 'onread_jump_next' => true, - 'lazyload' => true, - 'sort_order' => 'DESC', - 'anon_access' => false, - 'mark_when' => array( - 'article' => true, - 'site' => true, - 'scroll' => false, - 'reception' => false, - ), - 'theme' => 'Origine', - 'shortcuts' => array( - 'mark_read' => 'r', - 'mark_favorite' => 'f', - 'go_website' => 'space', - 'next_entry' => 'j', - 'prev_entry' => 'k', - 'first_entry' => 'home', - 'last_entry' => 'end', - 'collapse_entry' => 'c', - 'load_more' => 'm', - 'auto_share' => 's', - ), - 'topline_read' => true, - 'topline_favorite' => true, - 'topline_date' => true, - 'topline_link' => true, - 'bottomline_read' => true, - 'bottomline_favorite' => true, - 'bottomline_sharing' => true, - 'bottomline_tags' => true, - 'bottomline_date' => true, - 'bottomline_link' => true, - 'sharing' => array( - 'shaarli' => '', - 'wallabag' => '', - 'diaspora' => '', - 'twitter' => true, - 'g+' => true, - 'facebook' => true, - 'email' => true, - 'print' => true, - ), - ); - - private $available_languages = array( - 'en' => 'English', - 'fr' => 'Français', - ); - - public function __construct ($user) { - $this->filename = DATA_PATH . '/' . $user . '_user.php'; - - $data = @include($this->filename); - if (!is_array($data)) { - throw new Minz_PermissionDeniedException($this->filename); - } - - foreach ($data as $key => $value) { - if (isset($this->data[$key])) { - $function = '_' . $key; - $this->$function($value); - } - } - $this->data['user'] = $user; - } - - public function save() { - @rename($this->filename, $this->filename . '.bak.php'); - if (file_put_contents($this->filename, "<?php\n return " . var_export($this->data, true) . ';', LOCK_EX) === false) { - throw new Minz_PermissionDeniedException($this->filename); - } - if (function_exists('opcache_invalidate')) { - opcache_invalidate($this->filename); //Clear PHP 5.5+ cache for include - } - invalidateHttpCache(); - return true; - } - - public function __get($name) { - if (array_key_exists($name, $this->data)) { - return $this->data[$name]; - } else { - $trace = debug_backtrace(); - trigger_error('Undefined FreshRSS_Configuration->' . $name . 'in ' . $trace[0]['file'] . ' line ' . $trace[0]['line'], E_USER_NOTICE); //TODO: Use Minz exceptions - return null; - } - } - - public function sharing($key = false) { - if ($key === false) { - return $this->data['sharing']; - } - if (isset($this->data['sharing'][$key])) { - return $this->data['sharing'][$key]; - } - return false; - } - - public function availableLanguages() { - return $this->available_languages; - } - - public function _language($value) { - if (!isset($this->available_languages[$value])) { - $value = 'en'; - } - $this->data['language'] = $value; - } - public function _posts_per_page ($value) { - $value = intval($value); - $this->data['posts_per_page'] = $value > 0 ? $value : 10; - } - public function _view_mode ($value) { - if ($value === 'global' || $value === 'reader') { - $this->data['view_mode'] = $value; - } else { - $this->data['view_mode'] = 'normal'; - } - } - public function _default_view ($value) { - $this->data['default_view'] = $value === 'all' ? 'all' : 'not_read'; - } - public function _display_posts ($value) { - $this->data['display_posts'] = ((bool)$value) && $value !== 'no'; - } - public function _onread_jump_next ($value) { - $this->data['onread_jump_next'] = ((bool)$value) && $value !== 'no'; - } - public function _lazyload ($value) { - $this->data['lazyload'] = ((bool)$value) && $value !== 'no'; - } - public function _sort_order ($value) { - $this->data['sort_order'] = $value === 'ASC' ? 'ASC' : 'DESC'; - } - public function _old_entries($value) { - $value = intval($value); - $this->data['old_entries'] = $value > 0 ? $value : 3; - } - public function _keep_history_default($value) { - $value = intval($value); - $this->data['keep_history_default'] = $value >= -1 ? $value : 0; - } - public function _shortcuts ($values) { - foreach ($values as $key => $value) { - if (isset($this->data['shortcuts'][$key])) { - $this->data['shortcuts'][$key] = $value; - } - } - } - public function _passwordHash ($value) { - $this->data['passwordHash'] = ctype_graph($value) && (strlen($value) >= 60) ? $value : ''; - } - public function _mail_login ($value) { - $value = filter_var($value, FILTER_VALIDATE_EMAIL); - if ($value) { - $this->data['mail_login'] = $value; - } else { - $this->data['mail_login'] = ''; - } - } - public function _anon_access ($value) { - $this->data['anon_access'] = ((bool)$value) && $value !== 'no'; - } - public function _mark_when ($values) { - foreach ($values as $key => $value) { - if (isset($this->data['mark_when'][$key])) { - $this->data['mark_when'][$key] = ((bool)$value) && $value !== 'no'; - } - } - } - public function _sharing ($values) { - $are_url = array ('shaarli', 'wallabag', 'diaspora'); - foreach ($values as $key => $value) { - if (in_array($key, $are_url)) { - $is_url = ( - filter_var ($value, FILTER_VALIDATE_URL) || - (version_compare(PHP_VERSION, '5.3.3', '<') && - (strpos($value, '-') > 0) && - ($value === filter_var($value, FILTER_SANITIZE_URL))) - ); //PHP bug #51192 - - if (!$is_url) { - $value = ''; - } - } elseif (!is_bool($value)) { - $value = true; - } - - $this->data['sharing'][$key] = $value; - } - } - public function _theme($value) { - $this->data['theme'] = $value; - } - public function _token($value) { - $this->data['token'] = $value; - } - public function _auto_load_more($value) { - $this->data['auto_load_more'] = ((bool)$value) && $value !== 'no'; - } - public function _topline_read($value) { - $this->data['topline_read'] = ((bool)$value) && $value !== 'no'; - } - public function _topline_favorite($value) { - $this->data['topline_favorite'] = ((bool)$value) && $value !== 'no'; - } - public function _topline_date($value) { - $this->data['topline_date'] = ((bool)$value) && $value !== 'no'; - } - public function _topline_link($value) { - $this->data['topline_link'] = ((bool)$value) && $value !== 'no'; - } - public function _bottomline_read($value) { - $this->data['bottomline_read'] = ((bool)$value) && $value !== 'no'; - } - public function _bottomline_favorite($value) { - $this->data['bottomline_favorite'] = ((bool)$value) && $value !== 'no'; - } - public function _bottomline_sharing($value) { - $this->data['bottomline_sharing'] = ((bool)$value) && $value !== 'no'; - } - public function _bottomline_tags($value) { - $this->data['bottomline_tags'] = ((bool)$value) && $value !== 'no'; - } - public function _bottomline_date($value) { - $this->data['bottomline_date'] = ((bool)$value) && $value !== 'no'; - } - public function _bottomline_link($value) { - $this->data['bottomline_link'] = ((bool)$value) && $value !== 'no'; - } -} diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php new file mode 100644 index 000000000..046f54955 --- /dev/null +++ b/app/Models/ConfigurationSetter.php @@ -0,0 +1,380 @@ +<?php + +class FreshRSS_ConfigurationSetter { + /** + * Return if the given key is supported by this setter. + * @param $key the key to test. + * @return true if the key is supported, false else. + */ + public function support($key) { + $name_setter = '_' . $key; + return is_callable(array($this, $name_setter)); + } + + /** + * Set the given key in data with the current value. + * @param $data an array containing the list of all configuration data. + * @param $key the key to update. + * @param $value the value to set. + */ + public function handle(&$data, $key, $value) { + $name_setter = '_' . $key; + call_user_func_array(array($this, $name_setter), array(&$data, $value)); + } + + /** + * A helper to set boolean values. + * + * @param $value the tested value. + * @return true if value is true and different from no, false else. + */ + private function handleBool($value) { + return ((bool)$value) && $value !== 'no'; + } + + /** + * The (long) list of setters for user configuration. + */ + private function _apiPasswordHash(&$data, $value) { + $data['apiPasswordHash'] = ctype_graph($value) && (strlen($value) >= 60) ? $value : ''; + } + + private function _content_width(&$data, $value) { + $value = strtolower($value); + if (!in_array($value, array('thin', 'medium', 'large', 'no_limit'))) { + $value = 'thin'; + } + + $data['content_width'] = $value; + } + + private function _default_state(&$data, $value) { + $data['default_state'] = (int)$value; + } + + private function _default_view(&$data, $value) { + switch ($value) { + case 'all': + $data['default_view'] = $value; + $data['default_state'] = (FreshRSS_Entry::STATE_READ + + FreshRSS_Entry::STATE_NOT_READ); + break; + case 'adaptive': + case 'unread': + default: + $data['default_view'] = $value; + $data['default_state'] = FreshRSS_Entry::STATE_NOT_READ; + } + } + + // It works for system config too! + private function _extensions_enabled(&$data, $value) { + if (!is_array($value)) { + $value = array($value); + } + $data['extensions_enabled'] = $value; + } + + private function _html5_notif_timeout(&$data, $value) { + $value = intval($value); + $data['html5_notif_timeout'] = $value >= 0 ? $value : 0; + } + + private function _keep_history_default(&$data, $value) { + $value = intval($value); + $data['keep_history_default'] = $value >= -1 ? $value : 0; + } + + // It works for system config too! + private function _language(&$data, $value) { + $value = strtolower($value); + $languages = Minz_Translate::availableLanguages(); + if (!in_array($value, $languages)) { + $value = 'en'; + } + $data['language'] = $value; + } + + private function _old_entries(&$data, $value) { + $value = intval($value); + $data['old_entries'] = $value > 0 ? $value : 3; + } + + private function _passwordHash(&$data, $value) { + $data['passwordHash'] = ctype_graph($value) && (strlen($value) >= 60) ? $value : ''; + } + + private function _posts_per_page(&$data, $value) { + $value = intval($value); + $data['posts_per_page'] = $value > 0 ? $value : 10; + } + + private function _queries(&$data, $values) { + $data['queries'] = array(); + foreach ($values as $value) { + if ($value instanceof FreshRSS_UserQuery) { + $data['queries'][] = $value->toArray(); + } elseif (is_array($value)) { + $data['queries'][] = $value; + } + } + } + + private function _sharing(&$data, $values) { + $data['sharing'] = array(); + foreach ($values as $value) { + if (!is_array($value)) { + continue; + } + + // Verify URL and add default value when needed + if (isset($value['url'])) { + $is_url = filter_var($value['url'], FILTER_VALIDATE_URL); + if (!$is_url) { + continue; + } + } else { + $value['url'] = null; + } + + $data['sharing'][] = $value; + } + } + + private function _shortcuts(&$data, $values) { + if (!is_array($values)) { + return; + } + + $data['shortcuts'] = $values; + } + + private function _sort_order(&$data, $value) { + $data['sort_order'] = $value === 'ASC' ? 'ASC' : 'DESC'; + } + + private function _ttl_default(&$data, $value) { + $value = intval($value); + $data['ttl_default'] = $value >= -1 ? $value : 3600; + } + + private function _view_mode(&$data, $value) { + $value = strtolower($value); + if (!in_array($value, array('global', 'normal', 'reader'))) { + $value = 'normal'; + } + $data['view_mode'] = $value; + } + + /** + * A list of boolean setters. + */ + private function _anon_access(&$data, $value) { + $data['anon_access'] = $this->handleBool($value); + } + + private function _auto_load_more(&$data, $value) { + $data['auto_load_more'] = $this->handleBool($value); + } + + private function _auto_remove_article(&$data, $value) { + $data['auto_remove_article'] = $this->handleBool($value); + } + + private function _mark_updated_article_unread(&$data, $value) { + $data['mark_updated_article_unread'] = $this->handleBool($value); + } + + private function _display_categories(&$data, $value) { + $data['display_categories'] = $this->handleBool($value); + } + + private function _display_posts(&$data, $value) { + $data['display_posts'] = $this->handleBool($value); + } + + private function _hide_read_feeds(&$data, $value) { + $data['hide_read_feeds'] = $this->handleBool($value); + } + + private function _lazyload(&$data, $value) { + $data['lazyload'] = $this->handleBool($value); + } + + private function _mark_when(&$data, $values) { + foreach ($values as $key => $value) { + $data['mark_when'][$key] = $this->handleBool($value); + } + } + + private function _onread_jump_next(&$data, $value) { + $data['onread_jump_next'] = $this->handleBool($value); + } + + private function _reading_confirm(&$data, $value) { + $data['reading_confirm'] = $this->handleBool($value); + } + + private function _sticky_post(&$data, $value) { + $data['sticky_post'] = $this->handleBool($value); + } + + private function _bottomline_date(&$data, $value) { + $data['bottomline_date'] = $this->handleBool($value); + } + private function _bottomline_favorite(&$data, $value) { + $data['bottomline_favorite'] = $this->handleBool($value); + } + private function _bottomline_link(&$data, $value) { + $data['bottomline_link'] = $this->handleBool($value); + } + private function _bottomline_read(&$data, $value) { + $data['bottomline_read'] = $this->handleBool($value); + } + private function _bottomline_sharing(&$data, $value) { + $data['bottomline_sharing'] = $this->handleBool($value); + } + private function _bottomline_tags(&$data, $value) { + $data['bottomline_tags'] = $this->handleBool($value); + } + + private function _topline_date(&$data, $value) { + $data['topline_date'] = $this->handleBool($value); + } + private function _topline_favorite(&$data, $value) { + $data['topline_favorite'] = $this->handleBool($value); + } + private function _topline_link(&$data, $value) { + $data['topline_link'] = $this->handleBool($value); + } + private function _topline_read(&$data, $value) { + $data['topline_read'] = $this->handleBool($value); + } + + /** + * The (not so long) list of setters for system configuration. + */ + private function _allow_anonymous(&$data, $value) { + $data['allow_anonymous'] = $this->handleBool($value) && FreshRSS_Auth::accessNeedsAction(); + } + + private function _allow_anonymous_refresh(&$data, $value) { + $data['allow_anonymous_refresh'] = $this->handleBool($value) && $data['allow_anonymous']; + } + + private function _api_enabled(&$data, $value) { + $data['api_enabled'] = $this->handleBool($value); + } + + private function _auth_type(&$data, $value) { + $value = strtolower($value); + if (!in_array($value, array('form', 'http_auth', 'none'))) { + $value = 'none'; + } + $data['auth_type'] = $value; + $this->_allow_anonymous($data, $data['allow_anonymous']); + } + + private function _db(&$data, $value) { + if (!isset($value['type'])) { + return; + } + + switch ($value['type']) { + case 'mysql': + case 'pgsql': + if (empty($value['host']) || + empty($value['user']) || + empty($value['base']) || + !isset($value['password'])) { + return; + } + + $data['db']['type'] = $value['type']; + $data['db']['host'] = $value['host']; + $data['db']['user'] = $value['user']; + $data['db']['base'] = $value['base']; + $data['db']['password'] = $value['password']; + $data['db']['prefix'] = isset($value['prefix']) ? $value['prefix'] : ''; + break; + case 'sqlite': + $data['db']['type'] = $value['type']; + $data['db']['host'] = ''; + $data['db']['user'] = ''; + $data['db']['base'] = ''; + $data['db']['password'] = ''; + $data['db']['prefix'] = ''; + break; + default: + return; + } + } + + private function _default_user(&$data, $value) { + $user_list = listUsers(); + if (in_array($value, $user_list)) { + $data['default_user'] = $value; + } + } + + private function _environment(&$data, $value) { + $value = strtolower($value); + if (!in_array($value, array('silent', 'development', 'production'))) { + $value = 'production'; + } + $data['environment'] = $value; + } + + private function _limits(&$data, $values) { + $max_small_int = 16384; + $limits_keys = array( + 'cache_duration' => array( + 'min' => 0, + ), + 'timeout' => array( + 'min' => 0, + ), + 'max_inactivity' => array( + 'min' => 0, + ), + 'max_feeds' => array( + 'min' => 0, + 'max' => $max_small_int, + ), + 'max_categories' => array( + 'min' => 0, + 'max' => $max_small_int, + ), + 'max_registrations' => array( + 'min' => 0, + ), + ); + + foreach ($values as $key => $value) { + if (!isset($limits_keys[$key])) { + continue; + } + + $value = intval($value); + $limits = $limits_keys[$key]; + if ( + (!isset($limits['min']) || $value >= $limits['min']) && + (!isset($limits['max']) || $value <= $limits['max']) + ) { + $data['limits'][$key] = $value; + } + } + } + + private function _unsafe_autologin_enabled(&$data, $value) { + $data['unsafe_autologin_enabled'] = $this->handleBool($value); + } + + private function _auto_update_url(&$data, $value) { + if (!$value) { + return; + } + + $data['auto_update_url'] = $value; + } +} diff --git a/app/Models/Context.php b/app/Models/Context.php new file mode 100644 index 000000000..fd0e79fc1 --- /dev/null +++ b/app/Models/Context.php @@ -0,0 +1,326 @@ +<?php + +/** + * The context object handles the current configuration file and different + * useful functions associated to the current view state. + */ +class FreshRSS_Context { + public static $user_conf = null; + public static $system_conf = null; + public static $categories = array(); + + public static $name = ''; + public static $description = ''; + + public static $total_unread = 0; + public static $total_starred = array( + 'all' => 0, + 'read' => 0, + 'unread' => 0, + ); + + public static $get_unread = 0; + public static $current_get = array( + 'all' => false, + 'starred' => false, + 'feed' => false, + 'category' => false, + ); + public static $next_get = 'a'; + + public static $state = 0; + public static $order = 'DESC'; + public static $number = 0; + public static $search; + public static $first_id = ''; + public static $next_id = ''; + public static $id_max = ''; + public static $sinceHours = 0; + + public static $isCli = false; + + /** + * Initialize the context. + * + * Set the correct configurations and $categories variables. + */ + public static function init() { + // Init configuration. + self::$system_conf = Minz_Configuration::get('system'); + self::$user_conf = Minz_Configuration::get('user'); + } + + /** + * Returns if the current state includes $state parameter. + */ + public static function isStateEnabled($state) { + return self::$state & $state; + } + + /** + * Returns the current state with or without $state parameter. + */ + public static function getRevertState($state) { + if (self::$state & $state) { + return self::$state & ~$state; + } else { + return self::$state | $state; + } + } + + /** + * Return the current get as a string or an array. + * + * If $array is true, the first item of the returned value is 'f' or 'c' and + * the second is the id. + */ + public static function currentGet($array = false) { + if (self::$current_get['all']) { + return 'a'; + } elseif (self::$current_get['starred']) { + return 's'; + } elseif (self::$current_get['feed']) { + if ($array) { + return array('f', self::$current_get['feed']); + } else { + return 'f_' . self::$current_get['feed']; + } + } elseif (self::$current_get['category']) { + if ($array) { + return array('c', self::$current_get['category']); + } else { + return 'c_' . self::$current_get['category']; + } + } + } + + /** + * Return true if the current request targets a feed (and not a category or all articles), false otherwise. + */ + public static function isFeed() { + return self::$current_get['feed'] != false; + } + + /** + * Return true if $get parameter correspond to the $current_get attribute. + */ + public static function isCurrentGet($get) { + $type = $get[0]; + $id = substr($get, 2); + + switch($type) { + case 'a': + return self::$current_get['all']; + case 's': + return self::$current_get['starred']; + case 'f': + return self::$current_get['feed'] == $id; + case 'c': + return self::$current_get['category'] == $id; + default: + return false; + } + } + + /** + * Set the current $get attribute. + * + * Valid $get parameter are: + * - a + * - s + * - f_<feed id> + * - c_<category id> + * + * $name and $get_unread attributes are also updated as $next_get + * Raise an exception if id or $get is invalid. + */ + public static function _get($get) { + $type = $get[0]; + $id = substr($get, 2); + $nb_unread = 0; + + if (empty(self::$categories)) { + $catDAO = new FreshRSS_CategoryDAO(); + self::$categories = $catDAO->listCategories(); + } + + switch($type) { + case 'a': + self::$current_get['all'] = true; + self::$name = _t('index.feed.title'); + self::$description = self::$system_conf->meta_description; + self::$get_unread = self::$total_unread; + break; + case 's': + self::$current_get['starred'] = true; + self::$name = _t('index.feed.title_fav'); + self::$description = self::$system_conf->meta_description; + self::$get_unread = self::$total_starred['unread']; + + // Update state if favorite is not yet enabled. + self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE; + break; + case 'f': + // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description + $feed = FreshRSS_Context::$system_conf->allow_robots ? null : FreshRSS_CategoryDAO::findFeed(self::$categories, $id); + if ($feed === null) { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feed = $feedDAO->searchById($id); + + if (!$feed) { + throw new FreshRSS_Context_Exception('Invalid feed: ' . $id); + } + } + + self::$current_get['feed'] = $id; + self::$current_get['category'] = $feed->category(); + self::$name = $feed->name(); + self::$description = $feed->description(); + self::$get_unread = $feed->nbNotRead(); + break; + case 'c': + // We try to find the corresponding category. + self::$current_get['category'] = $id; + if (!isset(self::$categories[$id])) { + $catDAO = new FreshRSS_CategoryDAO(); + $cat = $catDAO->searchById($id); + + if (!$cat) { + throw new FreshRSS_Context_Exception('Invalid category: ' . $id); + } + } else { + $cat = self::$categories[$id]; + } + + self::$name = $cat->name(); + self::$get_unread = $cat->nbNotRead(); + break; + default: + throw new FreshRSS_Context_Exception('Invalid getter: ' . $get); + } + + self::_nextGet(); + } + + /** + * Set the value of $next_get attribute. + */ + private static function _nextGet() { + $get = self::currentGet(); + // By default, $next_get == $get + self::$next_get = $get; + + if (empty(self::$categories)) { + $catDAO = new FreshRSS_CategoryDAO(); + self::$categories = $catDAO->listCategories(); + } + + if (self::$user_conf->onread_jump_next && strlen($get) > 2) { + $another_unread_id = ''; + $found_current_get = false; + switch ($get[0]) { + case 'f': + // We search the next feed with at least one unread article in + // same category as the currend feed. + foreach (self::$categories as $cat) { + if ($cat->id() != self::$current_get['category']) { + // We look into the category of the current feed! + continue; + } + + foreach ($cat->feeds() as $feed) { + if ($feed->id() == self::$current_get['feed']) { + // Here is our current feed! Fine, the next one will + // be a potential candidate. + $found_current_get = true; + continue; + } + + if ($feed->nbNotRead() > 0) { + $another_unread_id = $feed->id(); + if ($found_current_get) { + // We have found our current feed and now we + // have an feed with unread articles. Leave the + // loop! + break; + } + } + } + break; + } + + // If no feed have been found, next_get is the current category. + self::$next_get = empty($another_unread_id) ? + 'c_' . self::$current_get['category'] : + 'f_' . $another_unread_id; + break; + case 'c': + // We search the next category with at least one unread article. + foreach (self::$categories as $cat) { + if ($cat->id() == self::$current_get['category']) { + // Here is our current category! Next one could be our + // champion if it has unread articles. + $found_current_get = true; + continue; + } + + if ($cat->nbNotRead() > 0) { + $another_unread_id = $cat->id(); + if ($found_current_get) { + // Unread articles and the current category has + // already been found? Leave the loop! + break; + } + } + } + + // No unread category? The main stream will be our destination! + self::$next_get = empty($another_unread_id) ? + 'a' : + 'c_' . $another_unread_id; + break; + } + } + } + + /** + * Determine if the auto remove is available in the current context. + * This feature is available if: + * - it is activated in the configuration + * - the "read" state is not enable + * - the "unread" state is enable + * + * @return boolean + */ + public static function isAutoRemoveAvailable() { + if (!self::$user_conf->auto_remove_article) { + return false; + } + if (self::isStateEnabled(FreshRSS_Entry::STATE_READ)) { + return false; + } + if (!self::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ)) { + return false; + } + return true; + } + + /** + * Determine if the "sticky post" option is enabled. It can be enable + * by the user when it is selected in the configuration page or by the + * application when the context allows to auto-remove articles when they + * are read. + * + * @return boolean + */ + public static function isStickyPostEnabled() { + if (self::$user_conf->sticky_post) { + return true; + } + if (self::isAutoRemoveAvailable()) { + return true; + } + return false; + } + +} diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php new file mode 100644 index 000000000..0d85718e3 --- /dev/null +++ b/app/Models/DatabaseDAO.php @@ -0,0 +1,83 @@ +<?php + +/** + * This class is used to test database is well-constructed. + */ +class FreshRSS_DatabaseDAO extends Minz_ModelPdo { + public function tablesAreCorrect() { + $sql = 'SHOW TABLES'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + + $tables = array( + $this->prefix . 'category' => false, + $this->prefix . 'feed' => false, + $this->prefix . 'entry' => false, + ); + foreach ($res as $value) { + $tables[array_pop($value)] = true; + } + + return count(array_keys($tables, true, true)) == count($tables); + } + + public function getSchema($table) { + $sql = 'DESC ' . $this->prefix . $table; + $stm = $this->bd->prepare($sql); + $stm->execute(); + + return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function checkTable($table, $schema) { + $columns = $this->getSchema($table); + + $ok = (count($columns) == count($schema)); + foreach ($columns as $c) { + $ok &= in_array($c['name'], $schema); + } + + return $ok; + } + + public function categoryIsCorrect() { + return $this->checkTable('category', array( + 'id', 'name' + )); + } + + public function feedIsCorrect() { + return $this->checkTable('feed', array( + 'id', 'url', 'category', 'name', 'website', 'description', 'lastUpdate', + 'priority', 'pathEntries', 'httpAuth', 'error', 'keep_history', 'ttl', + 'cache_nbEntries', 'cache_nbUnreads' + )); + } + + public function entryIsCorrect() { + return $this->checkTable('entry', array( + 'id', 'guid', 'title', 'author', 'content_bin', 'link', 'date', 'is_read', + 'is_favorite', 'id_feed', 'tags' + )); + } + + public function daoToSchema($dao) { + return array( + 'name' => $dao['Field'], + 'type' => strtolower($dao['Type']), + 'notnull' => (bool)$dao['Null'], + 'default' => $dao['Default'], + ); + } + + public function listDaoToSchema($listDAO) { + $list = array(); + + foreach ($listDAO as $dao) { + $list[] = $this->daoToSchema($dao); + } + + return $list; + } +} diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php new file mode 100644 index 000000000..a4edaa448 --- /dev/null +++ b/app/Models/DatabaseDAOPGSQL.php @@ -0,0 +1,43 @@ +<?php + +/** + * This class is used to test database is well-constructed. + */ +class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAO { + public function tablesAreCorrect() { + $db = FreshRSS_Context::$system_conf->db; + $dbowner = $db['user']; + $sql = 'SELECT * FROM pg_catalog.pg_tables where tableowner=?'; + $stm = $this->bd->prepare($sql); + $values = array($dbowner); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + + $tables = array( + $this->prefix . 'category' => false, + $this->prefix . 'feed' => false, + $this->prefix . 'entry' => false, + ); + foreach ($res as $value) { + $tables[array_pop($value)] = true; + } + + return count(array_keys($tables, true, true)) == count($tables); + } + + public function getSchema($table) { + $sql = 'select column_name as field, data_type as type, column_default as default, is_nullable as null from INFORMATION_SCHEMA.COLUMNS where table_name = ?'; + $stm = $this->bd->prepare($sql); + $stm->execute(array($this->prefix . $table)); + return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function daoToSchema($dao) { + return array( + 'name' => $dao['field'], + 'type' => strtolower($dao['type']), + 'notnull' => (bool)$dao['null'], + 'default' => $dao['default'], + ); + } +} diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php new file mode 100644 index 000000000..7f53f967d --- /dev/null +++ b/app/Models/DatabaseDAOSQLite.php @@ -0,0 +1,48 @@ +<?php + +/** + * This class is used to test database is well-constructed (SQLite). + */ +class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO { + public function tablesAreCorrect() { + $sql = 'SELECT name FROM sqlite_master WHERE type="table"'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + + $tables = array( + 'category' => false, + 'feed' => false, + 'entry' => false, + ); + foreach ($res as $value) { + $tables[$value['name']] = true; + } + + return count(array_keys($tables, true, true)) == count($tables); + } + + public function getSchema($table) { + $sql = 'PRAGMA table_info(' . $table . ')'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + + return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function entryIsCorrect() { + return $this->checkTable('entry', array( + 'id', 'guid', 'title', 'author', 'content', 'link', 'date', 'is_read', + 'is_favorite', 'id_feed', 'tags' + )); + } + + public function daoToSchema($dao) { + return array( + 'name' => $dao['name'], + 'type' => strtolower($dao['type']), + 'notnull' => $dao['notnull'] === '1' ? true : false, + 'default' => $dao['dflt_value'], + ); + } +} diff --git a/app/Models/Entry.php b/app/Models/Entry.php index a6c67221b..a562a963a 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -1,6 +1,11 @@ <?php class FreshRSS_Entry extends Minz_Model { + const STATE_READ = 1; + const STATE_NOT_READ = 2; + const STATE_ALL = 3; + const STATE_FAVORITE = 4; + const STATE_NOT_FAVORITE = 8; private $id = 0; private $guid; @@ -9,139 +14,154 @@ class FreshRSS_Entry extends Minz_Model { private $content; private $link; private $date; - private $is_read; + private $hash = null; + private $is_read; //Nullable boolean private $is_favorite; private $feed; private $tags; - public function __construct ($feed = '', $guid = '', $title = '', $author = '', $content = '', - $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { - $this->_guid ($guid); - $this->_title ($title); - $this->_author ($author); - $this->_content ($content); - $this->_link ($link); - $this->_date ($pubdate); - $this->_isRead ($is_read); - $this->_isFavorite ($is_favorite); - $this->_feed ($feed); - $this->_tags (preg_split('/[\s#]/', $tags)); + public function __construct($feed = '', $guid = '', $title = '', $author = '', $content = '', + $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { + $this->_guid($guid); + $this->_title($title); + $this->_author($author); + $this->_content($content); + $this->_link($link); + $this->_date($pubdate); + $this->_isRead($is_read); + $this->_isFavorite($is_favorite); + $this->_feed($feed); + $this->_tags(preg_split('/[\s#]/', $tags)); } - public function id () { + public function id() { return $this->id; } - public function guid () { + public function guid() { return $this->guid; } - public function title () { + public function title() { return $this->title; } - public function author () { + public function author() { return $this->author === null ? '' : $this->author; } - public function content () { + public function content() { return $this->content; } - public function link () { + public function link() { return $this->link; } - public function date ($raw = false) { + public function date($raw = false) { if ($raw) { return $this->date; } else { - return timestamptodate ($this->date); + return timestamptodate($this->date); } } - public function dateAdded ($raw = false) { + public function dateAdded($raw = false) { $date = intval(substr($this->id, 0, -6)); if ($raw) { return $date; } else { - return timestamptodate ($date); + return timestamptodate($date); } } - public function isRead () { + public function isRead() { return $this->is_read; } - public function isFavorite () { + public function isFavorite() { return $this->is_favorite; } - public function feed ($object = false) { + public function feed($object = false) { if ($object) { - $feedDAO = new FreshRSS_FeedDAO (); - return $feedDAO->searchById ($this->feed); + $feedDAO = FreshRSS_Factory::createFeedDao(); + return $feedDAO->searchById($this->feed); } else { return $this->feed; } } - public function tags ($inString = false) { + public function tags($inString = false) { if ($inString) { - return empty ($this->tags) ? '' : '#' . implode(' #', $this->tags); + return empty($this->tags) ? '' : '#' . implode(' #', $this->tags); } else { return $this->tags; } } - public function _id ($value) { + public function hash() { + if ($this->hash === null) { + //Do not include $this->date because it may be automatically generated when lacking + $this->hash = md5($this->link . $this->title . $this->author . $this->content . $this->tags(true)); + } + return $this->hash; + } + + public function _id($value) { $this->id = $value; } - public function _guid ($value) { + public function _guid($value) { $this->guid = $value; } - public function _title ($value) { + public function _title($value) { + $this->hash = null; $this->title = $value; } - public function _author ($value) { + public function _author($value) { + $this->hash = null; $this->author = $value; } - public function _content ($value) { + public function _content($value) { + $this->hash = null; $this->content = $value; } - public function _link ($value) { + public function _link($value) { + $this->hash = null; $this->link = $value; } - public function _date ($value) { + public function _date($value) { + $this->hash = null; $value = intval($value); $this->date = $value > 1 ? $value : time(); } - public function _isRead ($value) { - $this->is_read = $value; + public function _isRead($value) { + $this->is_read = $value === null ? null : (bool)$value; } - public function _isFavorite ($value) { + public function _isFavorite($value) { $this->is_favorite = $value; } - public function _feed ($value) { + public function _feed($value) { $this->feed = $value; } - public function _tags ($value) { - if (!is_array ($value)) { - $value = array ($value); + public function _tags($value) { + $this->hash = null; + if (!is_array($value)) { + $value = array($value); } foreach ($value as $key => $t) { if (!$t) { - unset ($value[$key]); + unset($value[$key]); } } $this->tags = $value; } - public function isDay ($day, $today) { + public function isDay($day, $today) { $date = $this->dateAdded(true); switch ($day) { - case FreshRSS_Days::TODAY: - $tomorrow = $today + 86400; - return $date >= $today && $date < $tomorrow; - case FreshRSS_Days::YESTERDAY: - $yesterday = $today - 86400; - return $date >= $yesterday && $date < $today; - case FreshRSS_Days::BEFORE_YESTERDAY: - $yesterday = $today - 86400; - return $date < $yesterday; - default: - return false; + case FreshRSS_Days::TODAY: + $tomorrow = $today + 86400; + return $date >= $today && $date < $tomorrow; + case FreshRSS_Days::YESTERDAY: + $yesterday = $today - 86400; + return $date >= $yesterday && $date < $today; + case FreshRSS_Days::BEFORE_YESTERDAY: + $yesterday = $today - 86400; + return $date < $yesterday; + default: + return false; } } @@ -149,10 +169,10 @@ class FreshRSS_Entry extends Minz_Model { // Gestion du contenu // On cherche à récupérer les articles en entier... même si le flux ne le propose pas if ($pathEntries) { - $entryDAO = new FreshRSS_EntryDAO(); + $entryDAO = FreshRSS_Factory::createEntryDao(); $entry = $entryDAO->searchByGuid($this->feed, $this->guid); - if($entry) { + if ($entry) { // l'article existe déjà en BDD, en se contente de recharger ce contenu $this->content = $entry->content(); } else { @@ -162,25 +182,26 @@ class FreshRSS_Entry extends Minz_Model { htmlspecialchars_decode($this->link(), ENT_QUOTES), $pathEntries ); } catch (Exception $e) { - // rien à faire, on garde l'ancien contenu (requête a échoué) + // rien à faire, on garde l'ancien contenu(requête a échoué) } } } } - public function toArray () { - return array ( - 'id' => $this->id (), - 'guid' => $this->guid (), - 'title' => $this->title (), - 'author' => $this->author (), - 'content' => $this->content (), - 'link' => $this->link (), - 'date' => $this->date (true), - 'is_read' => $this->isRead (), - 'is_favorite' => $this->isFavorite (), - 'id_feed' => $this->feed (), - 'tags' => $this->tags (true), + public function toArray() { + return array( + 'id' => $this->id(), + 'guid' => $this->guid(), + 'title' => $this->title(), + 'author' => $this->author(), + 'content' => $this->content(), + 'link' => $this->link(), + 'date' => $this->date(true), + 'hash' => $this->hash(), + 'is_read' => $this->isRead(), + 'is_favorite' => $this->isFavorite(), + 'id_feed' => $this->feed(), + 'tags' => $this->tags(true), ); } } diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index aaf4dcf6a..397471baa 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1,453 +1,821 @@ <?php -class FreshRSS_EntryDAO extends Minz_ModelPdo { - public function addEntry ($valuesTmp) { - $sql = 'INSERT INTO `' . $this->prefix . 'entry`(id, guid, title, author, content_bin, link, date, is_read, is_favorite, id_feed, tags) ' - . 'VALUES(?, ?, ?, ?, COMPRESS(?), ?, ?, ?, ?, ?, ?)'; - $stm = $this->bd->prepare ($sql); - - $values = array ( - $valuesTmp['id'], - substr($valuesTmp['guid'], 0, 760), - substr($valuesTmp['title'], 0, 255), - substr($valuesTmp['author'], 0, 255), - $valuesTmp['content'], - substr($valuesTmp['link'], 0, 1023), - $valuesTmp['date'], - $valuesTmp['is_read'] ? 1 : 0, - $valuesTmp['is_favorite'] ? 1 : 0, - $valuesTmp['id_feed'], - substr($valuesTmp['tags'], 0, 1023), - ); +class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { + + public function isCompressed() { + return parent::$sharedDbType === 'mysql'; + } + + public function hasNativeHex() { + return parent::$sharedDbType !== 'sqlite'; + } + + public function sqlHexDecode($x) { + return 'unhex(' . $x . ')'; + } + + public function sqlHexEncode($x) { + return 'hex(' . $x . ')'; + } + + protected function addColumn($name) { + Minz_Log::warning('FreshRSS_EntryDAO::addColumn: ' . $name); + $hasTransaction = false; + try { + $stm = null; + if ($name === 'lastSeen') { //v1.1.1 + if (!$this->bd->inTransaction()) { + $this->bd->beginTransaction(); + $hasTransaction = true; + } + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN `lastSeen` INT(11) DEFAULT 0'); + if ($stm && $stm->execute()) { + $stm = $this->bd->prepare('CREATE INDEX entry_lastSeen_index ON `' . $this->prefix . 'entry`(`lastSeen`);'); //"IF NOT EXISTS" does not exist in MySQL 5.7 + if ($stm && $stm->execute()) { + if ($hasTransaction) { + $this->bd->commit(); + } + return true; + } + } + if ($hasTransaction) { + $this->bd->rollBack(); + } + } elseif ($name === 'hash') { //v1.1.1 + $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16)'); + return $stm && $stm->execute(); + } + } catch (Exception $e) { + Minz_Log::error('FreshRSS_EntryDAO::addColumn error: ' . $e->getMessage()); + if ($hasTransaction) { + $this->bd->rollBack(); + } + } + return false; + } + + private $triedUpdateToUtf8mb4 = false; - if ($stm && $stm->execute ($values)) { + protected function updateToUtf8mb4() { + if ($this->triedUpdateToUtf8mb4) { + return false; + } + $this->triedUpdateToUtf8mb4 = true; + $db = FreshRSS_Context::$system_conf->db; + if ($db['type'] === 'mysql') { + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); + if (defined('SQL_UPDATE_UTF8MB4')) { + Minz_Log::warning('Updating MySQL to UTF8MB4...'); + $hadTransaction = $this->bd->inTransaction(); + if ($hadTransaction) { + $this->bd->commit(); + } + $ok = false; + try { + $sql = sprintf(SQL_UPDATE_UTF8MB4, $this->prefix, $db['base']); + $stm = $this->bd->prepare($sql); + $ok = $stm->execute(); + } catch (Exception $e) { + Minz_Log::error('FreshRSS_EntryDAO::updateToUtf8mb4 error: ' . $e->getMessage()); + } + if ($hadTransaction) { + $this->bd->beginTransaction(); + //NB: Transaction not starting. Why? (tested on PHP 7.0.8-0ubuntu and MySQL 5.7.13-0ubuntu) + } + return $ok; + } + } + return false; + } + + protected function autoUpdateDb($errorInfo) { + if (isset($errorInfo[0])) { + if ($errorInfo[0] === '42S22') { //ER_BAD_FIELD_ERROR + //autoAddColumn + foreach (array('lastSeen', 'hash') as $column) { + if (stripos($errorInfo[2], $column) !== false) { + return $this->addColumn($column); + } + } + } + } + if (isset($errorInfo[1])) { + if ($errorInfo[1] == '1366') { //ER_TRUNCATED_WRONG_VALUE_FOR_FIELD + return $this->updateToUtf8mb4(); + } + } + return false; + } + + private $addEntryPrepared = null; + + public function addEntry($valuesTmp) { + if ($this->addEntryPrepared === null) { + $sql = 'INSERT INTO `' . $this->prefix . 'entry` (id, guid, title, author, ' + . ($this->isCompressed() ? 'content_bin' : 'content') + . ', link, date, `lastSeen`, hash, is_read, is_favorite, id_feed, tags) ' + . 'VALUES(:id, :guid, :title, :author, ' + . ($this->isCompressed() ? 'COMPRESS(:content)' : ':content') + . ', :link, :date, :last_seen, ' + . $this->sqlHexDecode(':hash') + . ', :is_read, :is_favorite, :id_feed, :tags)'; + $this->addEntryPrepared = $this->bd->prepare($sql); + } + $this->addEntryPrepared->bindParam(':id', $valuesTmp['id']); + $valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 760); + $valuesTmp['guid'] = safe_ascii($valuesTmp['guid']); + $this->addEntryPrepared->bindParam(':guid', $valuesTmp['guid']); + $valuesTmp['title'] = substr($valuesTmp['title'], 0, 255); + $this->addEntryPrepared->bindParam(':title', $valuesTmp['title']); + $valuesTmp['author'] = substr($valuesTmp['author'], 0, 255); + $this->addEntryPrepared->bindParam(':author', $valuesTmp['author']); + $this->addEntryPrepared->bindParam(':content', $valuesTmp['content']); + $valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023); + $valuesTmp['link'] = safe_ascii($valuesTmp['link']); + $this->addEntryPrepared->bindParam(':link', $valuesTmp['link']); + $this->addEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT); + $valuesTmp['lastSeen'] = time(); + $this->addEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT); + $valuesTmp['is_read'] = $valuesTmp['is_read'] ? 1 : 0; + $this->addEntryPrepared->bindParam(':is_read', $valuesTmp['is_read'], PDO::PARAM_INT); + $valuesTmp['is_favorite'] = $valuesTmp['is_favorite'] ? 1 : 0; + $this->addEntryPrepared->bindParam(':is_favorite', $valuesTmp['is_favorite'], PDO::PARAM_INT); + $this->addEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT); + $valuesTmp['tags'] = substr($valuesTmp['tags'], 0, 1023); + $this->addEntryPrepared->bindParam(':tags', $valuesTmp['tags']); + + if ($this->hasNativeHex()) { + $this->addEntryPrepared->bindParam(':hash', $valuesTmp['hash']); + } else { + $valuesTmp['hashBin'] = pack('H*', $valuesTmp['hash']); //hex2bin() is PHP5.4+ + $this->addEntryPrepared->bindParam(':hash', $valuesTmp['hashBin']); + } + + if ($this->addEntryPrepared && $this->addEntryPrepared->execute()) { return $this->bd->lastInsertId(); } else { - $info = $stm->errorInfo(); - if ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries - Minz_Log::record ('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title'], Minz_Log::ERROR); - } /*else { - Minz_Log::record ('SQL error ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] - . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title'], Minz_Log::DEBUG); - }*/ + $info = $this->addEntryPrepared == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $this->addEntryPrepared->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->addEntry($valuesTmp); + } elseif ((int)($info[0] / 1000) !== 23) { //Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries + Minz_Log::error('SQL error addEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); + } return false; } } - public function markFavorite ($id, $is_favorite = true) { - $sql = 'UPDATE `' . $this->prefix . 'entry` e ' - . 'SET e.is_favorite = ? ' - . 'WHERE e.id=?'; - $values = array ($is_favorite ? 1 : 0, $id); - $stm = $this->bd->prepare ($sql); - if ($stm && $stm->execute ($values)) { - return $stm->rowCount(); + private $updateEntryPrepared = null; + + public function updateEntry($valuesTmp) { + if (!isset($valuesTmp['is_read'])) { + $valuesTmp['is_read'] = null; + } + + if ($this->updateEntryPrepared === null) { + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET title=:title, author=:author, ' + . ($this->isCompressed() ? 'content_bin=COMPRESS(:content)' : 'content=:content') + . ', link=:link, date=:date, `lastSeen`=:last_seen, ' + . 'hash=' . $this->sqlHexDecode(':hash') + . ', ' . ($valuesTmp['is_read'] === null ? '' : 'is_read=:is_read, ') + . 'tags=:tags ' + . 'WHERE id_feed=:id_feed AND guid=:guid'; + $this->updateEntryPrepared = $this->bd->prepare($sql); + } + + $valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 760); + $this->updateEntryPrepared->bindParam(':guid', $valuesTmp['guid']); + $valuesTmp['title'] = substr($valuesTmp['title'], 0, 255); + $this->updateEntryPrepared->bindParam(':title', $valuesTmp['title']); + $valuesTmp['author'] = substr($valuesTmp['author'], 0, 255); + $this->updateEntryPrepared->bindParam(':author', $valuesTmp['author']); + $this->updateEntryPrepared->bindParam(':content', $valuesTmp['content']); + $valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023); + $valuesTmp['link'] = safe_ascii($valuesTmp['link']); + $this->updateEntryPrepared->bindParam(':link', $valuesTmp['link']); + $this->updateEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT); + $valuesTmp['lastSeen'] = time(); + $this->updateEntryPrepared->bindParam(':last_seen', $valuesTmp['lastSeen'], PDO::PARAM_INT); + if ($valuesTmp['is_read'] !== null) { + $this->updateEntryPrepared->bindValue(':is_read', $valuesTmp['is_read'] ? 1 : 0, PDO::PARAM_INT); + } + $this->updateEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT); + $valuesTmp['tags'] = substr($valuesTmp['tags'], 0, 1023); + $this->updateEntryPrepared->bindParam(':tags', $valuesTmp['tags']); + + if ($this->hasNativeHex()) { + $this->updateEntryPrepared->bindParam(':hash', $valuesTmp['hash']); + } else { + $valuesTmp['hashBin'] = pack('H*', $valuesTmp['hash']); //hex2bin() is PHP5.4+ + $this->updateEntryPrepared->bindParam(':hash', $valuesTmp['hashBin']); + } + + if ($this->updateEntryPrepared && $this->updateEntryPrepared->execute()) { + return $this->bd->lastInsertId(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $this->updateEntryPrepared == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $this->updateEntryPrepared->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->updateEntry($valuesTmp); + } + Minz_Log::error('SQL error updateEntry: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while updating entry with GUID ' . $valuesTmp['guid'] . ' in feed ' . $valuesTmp['id_feed']); return false; } } - public function markRead ($id, $is_read = true) { - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = ?,' - . 'f.cache_nbUnreads=f.cache_nbUnreads' . ($is_read ? '-' : '+') . '1 ' - . 'WHERE e.id=?'; - $values = array ($is_read ? 1 : 0, $id); - $stm = $this->bd->prepare ($sql); - if ($stm && $stm->execute ($values)) { + + /** + * Toggle favorite marker on one or more article + * + * @todo simplify the query by removing the str_repeat. I am pretty sure + * there is an other way to do that. + * + * @param integer|array $ids + * @param boolean $is_favorite + * @return false|integer + */ + public function markFavorite($ids, $is_favorite = true) { + if (!is_array($ids)) { + $ids = array($ids); + } + if (count($ids) < 1) { + return 0; + } + FreshRSS_UserDAO::touch(); + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET is_favorite=? ' + . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)'; + $values = array($is_favorite ? 1 : 0); + $values = array_merge($values, $ids); + $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markFavorite: ' . $info[2]); return false; } } - public function markReadEntries ($idMax = 0, $favorites = false) { - if ($idMax === 0) { - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' - . 'WHERE e.is_read = 0 AND '; - if ($favorites) { - $sql .= 'e.is_favorite = 1'; - } else { - $sql .= 'f.priority > 0'; - } - $stm = $this->bd->prepare ($sql); - if ($stm && $stm->execute ()) { - return $stm->rowCount(); - } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - return false; - } + + /** + * Update the unread article cache held on every feed details. + * Depending on the parameters, it updates the cache on one feed, on all + * feeds from one category or on all feeds. + * + * @todo It can use the query builder refactoring to build that query + * + * @param false|integer $catId category ID + * @param false|integer $feedId feed ID + * @return boolean + */ + protected function updateCacheUnreads($catId = false, $feedId = false) { + $sql = 'UPDATE `' . $this->prefix . 'feed` f ' + . 'LEFT OUTER JOIN (' + . 'SELECT e.id_feed, ' + . 'COUNT(*) AS nbUnreads ' + . 'FROM `' . $this->prefix . 'entry` e ' + . 'WHERE e.is_read=0 ' + . 'GROUP BY e.id_feed' + . ') x ON x.id_feed=f.id ' + . 'SET f.`cache_nbUnreads`=COALESCE(x.nbUnreads, 0)'; + $hasWhere = false; + $values = array(); + if ($feedId !== false) { + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' f.id=?'; + $values[] = $id; + } + if ($catId !== false) { + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' f.category=?'; + $values[] = $catId; + } + $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute($values)) { + return true; } else { - $this->bd->beginTransaction (); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateCacheUnreads: ' . $info[2]); + return false; + } + } - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = 1 ' - . 'WHERE e.is_read = 0 AND e.id <= ? AND '; - if ($favorites) { - $sql .= 'e.is_favorite = 1'; - } else { - $sql .= 'f.priority > 0'; + /** + * Toggle the read marker on one or more article. + * Then the cache is updated. + * + * @todo change the way the query is build because it seems there is + * unnecessary code in here. For instance, the part with the str_repeat. + * @todo remove code duplication. It seems the code is basically the + * same if it is an array or not. + * + * @param integer|array $ids + * @param boolean $is_read + * @return integer affected rows + */ + public function markRead($ids, $is_read = true) { + FreshRSS_UserDAO::touch(); + if (is_array($ids)) { //Many IDs at once (used by API) + if (count($ids) < 6) { //Speed heuristics + $affected = 0; + foreach ($ids as $id) { + $affected += $this->markRead($id, $is_read); + } + return $affected; } - $values = array ($idMax); - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); + + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET is_read=? ' + . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)'; + $values = array($is_read ? 1 : 0); + $values = array_merge($values, $ids); + $stm = $this->bd->prepare($sql); + if (!($stm && $stm->execute($values))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markRead: ' . $info[2]); return false; } $affected = $stm->rowCount(); - - if ($affected > 0) { - $sql = 'UPDATE `' . $this->prefix . 'feed` f ' - . 'LEFT OUTER JOIN (' - . 'SELECT e.id_feed, ' - . 'COUNT(*) AS nbUnreads ' - . 'FROM `' . $this->prefix . 'entry` e ' - . 'WHERE e.is_read = 0 ' - . 'GROUP BY e.id_feed' - . ') x ON x.id_feed=f.id ' - . 'SET f.cache_nbUnreads=COALESCE(x.nbUnreads, 0)'; - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ())) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); - return false; - } + if (($affected > 0) && (!$this->updateCacheUnreads(false, false))) { + return false; } - - $this->bd->commit (); return $affected; - } - } - public function markReadCat ($id, $idMax = 0) { - if ($idMax === 0) { - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' - . 'WHERE f.category = ? AND e.is_read = 0'; - $values = array ($id); - $stm = $this->bd->prepare ($sql); - if ($stm && $stm->execute ($values)) { + } else { + $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id ' + . 'SET e.is_read=?,' + . 'f.`cache_nbUnreads`=f.`cache_nbUnreads`' . ($is_read ? '-' : '+') . '1 ' + . 'WHERE e.id=? AND e.is_read=?'; + $values = array($is_read ? 1 : 0, $ids, $is_read ? 0 : 1); + $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - return false; - } - } else { - $this->bd->beginTransaction (); - - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = 1 ' - . 'WHERE f.category = ? AND e.is_read = 0 AND e.id <= ?'; - $values = array ($id, $idMax); - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markRead: ' . $info[2]); return false; } - $affected = $stm->rowCount(); + } + } - if ($affected > 0) { - $sql = 'UPDATE `' . $this->prefix . 'feed` f ' - . 'LEFT OUTER JOIN (' - . 'SELECT e.id_feed, ' - . 'COUNT(*) AS nbUnreads ' - . 'FROM `' . $this->prefix . 'entry` e ' - . 'WHERE e.is_read = 0 ' - . 'GROUP BY e.id_feed' - . ') x ON x.id_feed=f.id ' - . 'SET f.cache_nbUnreads=COALESCE(x.nbUnreads, 0) ' - . 'WHERE f.category = ?'; - $values = array ($id); - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); - return false; - } - } + /** + * Mark all entries as read depending on parameters. + * If $onlyFavorites is true, it is used when the user mark as read in + * the favorite pseudo-category. + * If $priorityMin is greater than 0, it is used when the user mark as + * read in the main feed pseudo-category. + * Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @todo refactor this method along with markReadCat and markReadFeed + * since they are all doing the same thing. I think we need to build a + * tool to generate the query instead of having queries all over the + * place. It will be reused also for the filtering making every thing + * separated. + * + * @param integer $idMax fail safe article ID + * @param boolean $onlyFavorites + * @param integer $priorityMin + * @return integer affected rows + */ + public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); + if ($idMax == 0) { + $idMax = time() . '000000'; + Minz_Log::debug('Calling markReadEntries(0) is deprecated!'); + } - $this->bd->commit (); - return $affected; + $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id ' + . 'SET e.is_read=1 ' + . 'WHERE e.is_read=0 AND e.id <= ?'; + if ($onlyFavorites) { + $sql .= ' AND e.is_favorite=1'; + } elseif ($priorityMin >= 0) { + $sql .= ' AND f.priority > ' . intval($priorityMin); + } + $values = array($idMax); + + list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markReadEntries: ' . $info[2]); + return false; + } + $affected = $stm->rowCount(); + if (($affected > 0) && (!$this->updateCacheUnreads(false, false))) { + return false; } + return $affected; } - public function markReadFeed ($id, $idMax = 0) { - if ($idMax === 0) { - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' - . 'WHERE f.id=? AND e.is_read = 0'; - $values = array ($id); - $stm = $this->bd->prepare ($sql); - if ($stm && $stm->execute ($values)) { - return $stm->rowCount(); - } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - return false; - } - } else { - $this->bd->beginTransaction (); - - $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'SET e.is_read = 1 ' - . 'WHERE f.id=? AND e.is_read = 0 AND e.id <= ?'; - $values = array ($id, $idMax); - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); - return false; - } - $affected = $stm->rowCount(); - if ($affected > 0) { - $sql = 'UPDATE `' . $this->prefix . 'feed` f ' - . 'SET f.cache_nbUnreads=f.cache_nbUnreads-' . $affected - . ' WHERE f.id=?'; - $values = array ($id); - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); - return false; - } - } + /** + * Mark all the articles in a category as read. + * There is a fail safe to prevent to mark as read articles that are + * loaded during the mark as read action. Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @param integer $id category ID + * @param integer $idMax fail safe article ID + * @return integer affected rows + */ + public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); + if ($idMax == 0) { + $idMax = time() . '000000'; + Minz_Log::debug('Calling markReadCat(0) is deprecated!'); + } - $this->bd->commit (); - return $affected; + $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id ' + . 'SET e.is_read=1 ' + . 'WHERE f.category=? AND e.is_read=0 AND e.id <= ?'; + $values = array($id, $idMax); + + list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markReadCat: ' . $info[2]); + return false; + } + $affected = $stm->rowCount(); + if (($affected > 0) && (!$this->updateCacheUnreads($id, false))) { + return false; + } + return $affected; + } + + /** + * Mark all the articles in a feed as read. + * There is a fail safe to prevent to mark as read articles that are + * loaded during the mark as read action. Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @param integer $id_feed feed ID + * @param integer $idMax fail safe article ID + * @return integer affected rows + */ + public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); + if ($idMax == 0) { + $idMax = time() . '000000'; + Minz_Log::debug('Calling markReadFeed(0) is deprecated!'); + } + $this->bd->beginTransaction(); + + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET is_read=1 ' + . 'WHERE id_feed=? AND is_read=0 AND id <= ?'; + $values = array($id_feed, $idMax); + + list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markReadFeed: ' . $info[2] . ' with SQL: ' . $sql . $search); + $this->bd->rollBack(); + return false; } + $affected = $stm->rowCount(); + + if ($affected > 0) { + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `cache_nbUnreads`=`cache_nbUnreads`-' . $affected + . ' WHERE id=?'; + $values = array($id_feed); + $stm = $this->bd->prepare($sql); + if (!($stm && $stm->execute($values))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markReadFeed cache: ' . $info[2]); + $this->bd->rollBack(); + return false; + } + } + + $this->bd->commit(); + return $affected; } - public function searchByGuid ($feed_id, $id) { + public function searchByGuid($id_feed, $guid) { // un guid est unique pour un flux donné - $sql = 'SELECT id, guid, title, author, UNCOMPRESS(content_bin) AS content, link, date, is_read, is_favorite, id_feed, tags ' + $sql = 'SELECT id, guid, title, author, ' + . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') + . ', link, date, is_read, is_favorite, id_feed, tags ' . 'FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ( - $feed_id, - $id + $values = array( + $id_feed, + $guid, ); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $entries = self::daoToEntry ($res); - return isset ($entries[0]) ? $entries[0] : false; + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $entries = self::daoToEntries($res); + return isset($entries[0]) ? $entries[0] : null; } - public function searchById ($id) { - $sql = 'SELECT id, guid, title, author, UNCOMPRESS(content_bin) AS content, link, date, is_read, is_favorite, id_feed, tags ' + public function searchById($id) { + $sql = 'SELECT id, guid, title, author, ' + . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') + . ', link, date, is_read, is_favorite, id_feed, tags ' . 'FROM `' . $this->prefix . 'entry` WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($id); + $values = array($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $entries = self::daoToEntry ($res); - return isset ($entries[0]) ? $entries[0] : false; + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $entries = self::daoToEntries($res); + return isset($entries[0]) ? $entries[0] : null; } - public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $keepHistoryDefault = 0) { - $where = ''; - $joinFeed = false; + protected function sqlConcat($s1, $s2) { + return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL + } + + protected function sqlListEntriesWhere($alias = '', $filter = null, $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $firstId = '', $date_min = 0) { + $search = ' '; $values = array(); - switch ($type) { - case 'a': - $where .= 'f.priority > 0 '; - $joinFeed = true; - break; - case 's': - $where .= 'e1.is_favorite = 1 '; - break; - case 'c': - $where .= 'f.category = ? '; - $values[] = intval($id); - $joinFeed = true; - break; - case 'f': - $where .= 'e1.id_feed = ? '; - $values[] = intval($id); - break; - default: - throw new FreshRSS_EntriesGetter_Exception ('Bad type in Entry->listByType: [' . $type . ']!'); + if ($state & FreshRSS_Entry::STATE_NOT_READ) { + if (!($state & FreshRSS_Entry::STATE_READ)) { + $search .= 'AND ' . $alias . 'is_read=0 '; + } } - switch ($state) { - case 'all': - break; - case 'not_read': - $where .= 'AND e1.is_read = 0 '; - break; - case 'read': - $where .= 'AND e1.is_read = 1 '; - break; - case 'favorite': - $where .= 'AND e1.is_favorite = 1 '; - break; - default: - throw new FreshRSS_EntriesGetter_Exception ('Bad state in Entry->listByType: [' . $state . ']!'); + elseif ($state & FreshRSS_Entry::STATE_READ) { + $search .= 'AND ' . $alias . 'is_read=1 '; + } + if ($state & FreshRSS_Entry::STATE_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { + $search .= 'AND ' . $alias . 'is_favorite=1 '; + } } + elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + $search .= 'AND ' . $alias . 'is_favorite=0 '; + } + switch ($order) { case 'DESC': case 'ASC': break; default: - throw new FreshRSS_EntriesGetter_Exception ('Bad order in Entry->listByType: [' . $order . ']!'); + throw new FreshRSS_EntriesGetter_Exception('Bad order in Entry->listByType: [' . $order . ']!'); } + /*if ($firstId === '' && parent::$sharedDbType === 'mysql') { + $firstId = $order === 'DESC' ? '9000000000'. '000000' : '0'; //MySQL optimization. TODO: check if this is needed again, after the filtering for old articles has been removed in 0.9-dev + }*/ if ($firstId !== '') { - $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; + $search .= 'AND ' . $alias . 'id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } - if (($date_min > 0) && ($type !== 's')) { - $where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_read = 0 OR e1.is_favorite = 1 OR (f.keep_history <> 0'; - if (intval($keepHistoryDefault) === 0) { - $where .= ' AND f.keep_history <> -2'; //default - } - $where .= ')) '; - $joinFeed = true; + if ($date_min > 0) { + $search .= 'AND ' . $alias . 'id >= ' . $date_min . '000000 '; } - $search = ''; - if ($filter !== '') { - $filter = trim($filter); - $filter = addcslashes($filter, '\\%_'); - if (stripos($filter, 'intitle:') === 0) { - $filter = substr($filter, strlen('intitle:')); - $intitle = true; - } else { - $intitle = false; + if ($filter) { + if ($filter->getIntitle()) { + $search .= 'AND ' . $alias . 'title LIKE ? '; + $values[] = "%{$filter->getIntitle()}%"; } - if (stripos($filter, 'inurl:') === 0) { - $filter = substr($filter, strlen('inurl:')); - $inurl = true; - } else { - $inurl = false; + if ($filter->getInurl()) { + $search .= 'AND CONCAT(' . $alias . 'link, ' . $alias . 'guid) LIKE ? '; + $values[] = "%{$filter->getInurl()}%"; } - if (stripos($filter, 'author:') === 0) { - $filter = substr($filter, strlen('author:')); - $author = true; - } else { - $author = false; + if ($filter->getAuthor()) { + $search .= 'AND ' . $alias . 'author LIKE ? '; + $values[] = "%{$filter->getAuthor()}%"; } - $terms = array_unique(explode(' ', $filter)); - sort($terms); //Put #tags first - foreach ($terms as $word) { - $word = trim($word); - if (strlen($word) > 0) { - if ($intitle) { - $search .= 'AND e1.title LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif ($inurl) { - $search .= 'AND CONCAT(e1.link, e1.guid) LIKE ? '; - $values[] = '%' . $word .'%'; - } elseif ($author) { - $search .= 'AND e1.author LIKE ? '; - $values[] = '%' . $word .'%'; - } else { - if ($word[0] === '#' && isset($word[1])) { - $search .= 'AND e1.tags LIKE ? '; - $values[] = '%' . $word .'%'; - } else { - $search .= 'AND CONCAT(e1.title, UNCOMPRESS(e1.content_bin)) LIKE ? '; - $values[] = '%' . $word .'%'; - } - } + if ($filter->getMinDate()) { + $search .= 'AND ' . $alias . 'id >= ? '; + $values[] = "{$filter->getMinDate()}000000"; + } + if ($filter->getMaxDate()) { + $search .= 'AND ' . $alias . 'id <= ? '; + $values[] = "{$filter->getMaxDate()}000000"; + } + if ($filter->getMinPubdate()) { + $search .= 'AND ' . $alias . 'date >= ? '; + $values[] = $filter->getMinPubdate(); + } + if ($filter->getMaxPubdate()) { + $search .= 'AND ' . $alias . 'date <= ? '; + $values[] = $filter->getMaxPubdate(); + } + if ($filter->getTags()) { + $tags = $filter->getTags(); + foreach ($tags as $tag) { + $search .= 'AND ' . $alias . 'tags LIKE ? '; + $values[] = "%{$tag}%"; } } + if ($filter->getSearch()) { + $search_values = $filter->getSearch(); + foreach ($search_values as $search_value) { + $search .= 'AND ' . $this->sqlconcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? '; + $values[] = "%{$search_value}%"; + } + } + } + return array($values, $search); + } + + private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + if (!$state) { + $state = FreshRSS_Entry::STATE_ALL; + } + $where = ''; + $joinFeed = false; + $values = array(); + switch ($type) { + case 'a': + $where .= 'f.priority > 0 '; + $joinFeed = true; + break; + case 's': //Deprecated: use $state instead + $where .= 'e.is_favorite=1 '; + break; + case 'c': + $where .= 'f.category=? '; + $values[] = intval($id); + $joinFeed = true; + break; + case 'f': + $where .= 'e.id_feed=? '; + $values[] = intval($id); + break; + case 'A': + $where .= '1 '; + break; + default: + throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!'); } - $sql = 'SELECT e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags ' - . 'FROM `' . $this->prefix . 'entry` e ' - . 'INNER JOIN (SELECT e1.id FROM `' . $this->prefix . 'entry` e1 ' - . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e1.id_feed = f.id ' : '') - . 'WHERE ' . $where - . $search - . 'ORDER BY e1.id ' . $order - . ($limit > 0 ? ' LIMIT ' . $limit : '') //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ - . ') e2 ON e2.id = e.id ' - . 'ORDER BY e.id ' . $order; + list($searchValues, $search) = $this->sqlListEntriesWhere('e.', $filter, $state, $order, $firstId, $date_min); - $stm = $this->bd->prepare ($sql); - $stm->execute ($values); + return array(array_merge($values, $searchValues), + 'SELECT e.id FROM `' . $this->prefix . 'entry` e ' + . ($joinFeed ? 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id ' : '') + . 'WHERE ' . $where + . $search + . 'ORDER BY e.id ' . $order + . ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ + } - return self::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC)); + public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); + + $sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, ' + . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') + . ', e0.link, e0.date, e0.is_read, e0.is_favorite, e0.id_feed, e0.tags ' + . 'FROM `' . $this->prefix . 'entry` e0 ' + . 'INNER JOIN (' + . $sql + . ') e2 ON e2.id=e0.id ' + . 'ORDER BY e0.id ' . $order; + + $stm = $this->bd->prepare($sql); + $stm->execute($values); + return $stm; } - public function listLastGuidsByFeed($id, $n) { - $sql = 'SELECT guid FROM `' . $this->prefix . 'entry` WHERE id_feed=? ORDER BY id DESC LIMIT ' . intval($n); - $stm = $this->bd->prepare ($sql); - $values = array ($id); - $stm->execute ($values); - return $stm->fetchAll (PDO::FETCH_COLUMN, 0); + public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + $stm = $this->listWhereRaw($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); + return self::daoToEntries($stm->fetchAll(PDO::FETCH_ASSOC)); } - public function countUnreadRead () { - $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE priority > 0' - . ' UNION SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE priority > 0 AND is_read = 0'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); - $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0); + public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { //For API + list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); + + $stm = $this->bd->prepare($sql); + $stm->execute($values); + + return $stm->fetchAll(PDO::FETCH_COLUMN, 0); + } + + public function listHashForFeedGuids($id_feed, $guids) { + if (count($guids) < 1) { + return array(); + } + $guids = array_unique($guids); + $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . ' AS hex_hash FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; + $stm = $this->bd->prepare($sql); + $values = array($id_feed); + $values = array_merge($values, $guids); + if ($stm && $stm->execute($values)) { + $result = array(); + $rows = $stm->fetchAll(PDO::FETCH_ASSOC); + foreach ($rows as $row) { + $result[$row['guid']] = $row['hex_hash']; + } + return $result; + } else { + $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->listHashForFeedGuids($id_feed, $guids); + } + Minz_Log::error('SQL error listHashForFeedGuids: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while querying feed ' . $id_feed); + return false; + } + } + + public function updateLastSeen($id_feed, $guids, $mtime = 0) { + if (count($guids) < 1) { + return 0; + } + $sql = 'UPDATE `' . $this->prefix . 'entry` SET `lastSeen`=? WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; + $stm = $this->bd->prepare($sql); + if ($mtime <= 0) { + $mtime = time(); + } + $values = array($mtime, $id_feed); + $values = array_merge($values, $guids); + if ($stm && $stm->execute($values)) { + return $stm->rowCount(); + } else { + $info = $stm == null ? array(0 => '', 1 => '', 2 => 'syntax error') : $stm->errorInfo(); + if ($this->autoUpdateDb($info)) { + return $this->updateLastSeen($id_feed, $guids); + } + Minz_Log::error('SQL error updateLastSeen: ' . $info[0] . ': ' . $info[1] . ' ' . $info[2] + . ' while updating feed ' . $id_feed); + return false; + } + } + + public function countUnreadRead() { + $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE priority > 0' + . ' UNION SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE priority > 0 AND is_read=0'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); $all = empty($res[0]) ? 0 : $res[0]; $unread = empty($res[1]) ? 0 : $res[1]; return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread); } - public function count ($minPriority = null) { - $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id'; + public function count($minPriority = null) { + $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id'; if ($minPriority !== null) { $sql = ' WHERE priority > ' . intval($minPriority); } - $stm = $this->bd->prepare ($sql); - $stm->execute (); - $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0); + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); return $res[0]; } - public function countNotRead ($minPriority = null) { - $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id WHERE is_read = 0'; + public function countNotRead($minPriority = null) { + $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed=f.id WHERE is_read=0'; if ($minPriority !== null) { $sql = ' AND priority > ' . intval($minPriority); } - $stm = $this->bd->prepare ($sql); - $stm->execute (); - $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0); + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); return $res[0]; } - public function countUnreadReadFavorites () { - $sql = 'SELECT COUNT(id) FROM `' . $this->prefix . 'entry` WHERE is_favorite=1' - . ' UNION SELECT COUNT(id) FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read = 0'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); - $res = $stm->fetchAll (PDO::FETCH_COLUMN, 0); + public function countUnreadReadFavorites() { + $sql = 'SELECT c FROM (' + . 'SELECT COUNT(id) AS c, 1 as o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 ' + . 'UNION SELECT COUNT(id) AS c, 2 AS o FROM `' . $this->prefix . 'entry` WHERE is_favorite=1 AND is_read=0' + . ') u ORDER BY o'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); $all = empty($res[0]) ? 0 : $res[0]; $unread = empty($res[1]) ? 0 : $res[1]; return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread); } public function optimizeTable() { - $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'entry`'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); + $sql = 'OPTIMIZE TABLE `' . $this->prefix . 'entry`'; //MySQL + $stm = $this->bd->prepare($sql); + if ($stm) { + return $stm->execute(); + } } - public static function daoToEntry ($listDAO) { - $list = array (); - - if (!is_array ($listDAO)) { - $listDAO = array ($listDAO); + public function size($all = false) { + $db = FreshRSS_Context::$system_conf->db; + $sql = 'SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema=?'; //MySQL + $values = array($db['base']); + if (!$all) { + $sql .= ' AND table_name LIKE ?'; + $values[] = $this->prefix . '%'; } + $stm = $this->bd->prepare($sql); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return $res[0]; + } - foreach ($listDAO as $key => $dao) { - $entry = new FreshRSS_Entry ( + public static function daoToEntry($dao) { + $entry = new FreshRSS_Entry( $dao['id_feed'], $dao['guid'], $dao['title'], @@ -459,13 +827,24 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { $dao['is_favorite'], $dao['tags'] ); - if (isset ($dao['id'])) { - $entry->_id ($dao['id']); - } - $list[] = $entry; + if (isset($dao['id'])) { + $entry->_id($dao['id']); + } + return $entry; + } + + private static function daoToEntries($listDAO) { + $list = array(); + + if (!is_array($listDAO)) { + $listDAO = array($listDAO); + } + + foreach ($listDAO as $key => $dao) { + $list[] = self::daoToEntry($dao); } - unset ($listDAO); + unset($listDAO); return $list; } diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php new file mode 100644 index 000000000..b96a62ebc --- /dev/null +++ b/app/Models/EntryDAOPGSQL.php @@ -0,0 +1,31 @@ +<?php + +class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite { + + public function sqlHexDecode($x) { + return 'decode(' . $x . ", 'hex')"; + } + + public function sqlHexEncode($x) { + return 'encode(' . $x . ", 'hex')"; + } + + protected function autoUpdateDb($errorInfo) { + return false; + } + + protected function addColumn($name) { + return false; + } + + public function size($all = true) { + $db = FreshRSS_Context::$system_conf->db; + $sql = 'SELECT pg_size_pretty(pg_database_size(?))'; + $values = array($db['base']); + $stm = $this->bd->prepare($sql); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return $res[0]; + } + +} diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php new file mode 100644 index 000000000..34e854608 --- /dev/null +++ b/app/Models/EntryDAOSQLite.php @@ -0,0 +1,204 @@ +<?php + +class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { + + public function sqlHexDecode($x) { + return $x; + } + + protected function autoUpdateDb($errorInfo) { + if (empty($errorInfo[0]) || $errorInfo[0] == '42S22') { //ER_BAD_FIELD_ERROR + //autoAddColumn + if ($tableInfo = $this->bd->query("SELECT sql FROM sqlite_master where name='entry'")) { + $showCreate = $tableInfo->fetchColumn(); + Minz_Log::debug('FreshRSS_EntryDAOSQLite::autoUpdateDb: ' . $showCreate); + foreach (array('lastSeen', 'hash') as $column) { + if (stripos($showCreate, $column) === false) { + return $this->addColumn($column); + } + } + } + } + return false; + } + + protected function sqlConcat($s1, $s2) { + return $s1 . '||' . $s2; + } + + protected function updateCacheUnreads($catId = false, $feedId = false) { + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `cache_nbUnreads`=(' + . 'SELECT COUNT(*) AS nbUnreads FROM `' . $this->prefix . 'entry` e ' + . 'WHERE e.id_feed=`' . $this->prefix . 'feed`.id AND e.is_read=0)'; + $hasWhere = false; + $values = array(); + if ($feedId !== false) { + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' id=?'; + $values[] = $feedId; + } + if ($catId !== false) { + $sql .= $hasWhere ? ' AND' : ' WHERE'; + $hasWhere = true; + $sql .= ' category=?'; + $values[] = $catId; + } + $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute($values)) { + return true; + } else { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateCacheUnreads: ' . $info[2]); + return false; + } + } + + /** + * Toggle the read marker on one or more article. + * Then the cache is updated. + * + * @todo change the way the query is build because it seems there is + * unnecessary code in here. For instance, the part with the str_repeat. + * @todo remove code duplication. It seems the code is basically the + * same if it is an array or not. + * + * @param integer|array $ids + * @param boolean $is_read + * @return integer affected rows + */ + public function markRead($ids, $is_read = true) { + if (is_array($ids)) { //Many IDs at once (used by API) + if (true) { //Speed heuristics //TODO: Not implemented yet for SQLite (so always call IDs one by one) + $affected = 0; + foreach ($ids as $id) { + $affected += $this->markRead($id, $is_read); + } + return $affected; + } + } else { + $this->bd->beginTransaction(); + $sql = 'UPDATE `' . $this->prefix . 'entry` SET is_read=? WHERE id=? AND is_read=?'; + $values = array($is_read ? 1 : 0, $ids, $is_read ? 0 : 1); + $stm = $this->bd->prepare($sql); + if (!($stm && $stm->execute($values))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markRead 1: ' . $info[2]); + $this->bd->rollBack(); + return false; + } + $affected = $stm->rowCount(); + if ($affected > 0) { + $sql = 'UPDATE `' . $this->prefix . 'feed` SET `cache_nbUnreads`=`cache_nbUnreads`' . ($is_read ? '-' : '+') . '1 ' + . 'WHERE id=(SELECT e.id_feed FROM `' . $this->prefix . 'entry` e WHERE e.id=?)'; + $values = array($ids); + $stm = $this->bd->prepare($sql); + if (!($stm && $stm->execute($values))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markRead 2: ' . $info[2]); + $this->bd->rollBack(); + return false; + } + } + $this->bd->commit(); + return $affected; + } + } + + /** + * Mark all entries as read depending on parameters. + * If $onlyFavorites is true, it is used when the user mark as read in + * the favorite pseudo-category. + * If $priorityMin is greater than 0, it is used when the user mark as + * read in the main feed pseudo-category. + * Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @todo refactor this method along with markReadCat and markReadFeed + * since they are all doing the same thing. I think we need to build a + * tool to generate the query instead of having queries all over the + * place. It will be reused also for the filtering making every thing + * separated. + * + * @param integer $idMax fail safe article ID + * @param boolean $onlyFavorites + * @param integer $priorityMin + * @return integer affected rows + */ + public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) { + if ($idMax == 0) { + $idMax = time() . '000000'; + Minz_Log::debug('Calling markReadEntries(0) is deprecated!'); + } + + $sql = 'UPDATE `' . $this->prefix . 'entry` SET is_read=1 WHERE is_read=0 AND id <= ?'; + if ($onlyFavorites) { + $sql .= ' AND is_favorite=1'; + } elseif ($priorityMin >= 0) { + $sql .= ' AND id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.priority > ' . intval($priorityMin) . ')'; + } + $values = array($idMax); + + list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markReadEntries: ' . $info[2]); + return false; + } + $affected = $stm->rowCount(); + if (($affected > 0) && (!$this->updateCacheUnreads(false, false))) { + return false; + } + return $affected; + } + + /** + * Mark all the articles in a category as read. + * There is a fail safe to prevent to mark as read articles that are + * loaded during the mark as read action. Then the cache is updated. + * + * If $idMax equals 0, a deprecated debug message is logged + * + * @param integer $id category ID + * @param integer $idMax fail safe article ID + * @return integer affected rows + */ + public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) { + if ($idMax == 0) { + $idMax = time() . '000000'; + Minz_Log::debug('Calling markReadCat(0) is deprecated!'); + } + + $sql = 'UPDATE `' . $this->prefix . 'entry` ' + . 'SET is_read=1 ' + . 'WHERE is_read=0 AND id <= ? AND ' + . 'id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.category=?)'; + $values = array($idMax, $id); + + list($searchValues, $search) = $this->sqlListEntriesWhere('', $filter, $state); + + $stm = $this->bd->prepare($sql . $search); + if (!($stm && $stm->execute(array_merge($values, $searchValues)))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error markReadCat: ' . $info[2]); + return false; + } + $affected = $stm->rowCount(); + if (($affected > 0) && (!$this->updateCacheUnreads($id, false))) { + return false; + } + return $affected; + } + + public function optimizeTable() { + //TODO: Search for an equivalent in SQLite + } + + public function size($all = false) { + return @filesize(join_path(DATA_PATH, 'users', $this->current_user, 'db.sqlite')); + } +} diff --git a/app/Models/Factory.php b/app/Models/Factory.php new file mode 100644 index 000000000..6502c38b7 --- /dev/null +++ b/app/Models/Factory.php @@ -0,0 +1,52 @@ +<?php + +class FreshRSS_Factory { + + public static function createFeedDao($username = null) { + $conf = Minz_Configuration::get('system'); + switch ($conf->db['type']) { + case 'sqlite': + case 'pgsql': + return new FreshRSS_FeedDAOSQLite($username); + default: + return new FreshRSS_FeedDAO($username); + } + } + + public static function createEntryDao($username = null) { + $conf = Minz_Configuration::get('system'); + switch ($conf->db['type']) { + case 'sqlite': + return new FreshRSS_EntryDAOSQLite($username); + case 'pgsql': + return new FreshRSS_EntryDAOPGSQL($username); + default: + return new FreshRSS_EntryDAO($username); + } + } + + public static function createStatsDAO($username = null) { + $conf = Minz_Configuration::get('system'); + switch ($conf->db['type']) { + case 'sqlite': + return new FreshRSS_StatsDAOSQLite($username); + case 'pgsql': + return new FreshRSS_StatsDAOPGSQL($username); + default: + return new FreshRSS_StatsDAO($username); + } + } + + public static function createDatabaseDAO($username = null) { + $conf = Minz_Configuration::get('system'); + switch ($conf->db['type']) { + case 'sqlite': + return new FreshRSS_DatabaseDAOSQLite($username); + case 'pgsql': + return new FreshRSS_DatabaseDAOPGSQL($username); + default: + return new FreshRSS_DatabaseDAO($username); + } + } + +} diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 73f9c32fb..97cb1c47e 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -16,98 +16,141 @@ class FreshRSS_Feed extends Minz_Model { private $httpAuth = ''; private $error = false; private $keep_history = -2; + private $ttl = -2; private $hash = null; + private $lockPath = ''; + private $hubUrl = ''; + private $selfUrl = ''; - public function __construct ($url, $validate=true) { + public function __construct($url, $validate=true) { if ($validate) { - $this->_url ($url); + $this->_url($url); } else { $this->url = $url; } } - public function id () { + public static function example() { + $f = new FreshRSS_Feed('http://example.net/', false); + $f->faviconPrepare(); + return $f; + } + + public function id() { return $this->id; } public function hash() { if ($this->hash === null) { - $this->hash = hash('crc32b', Minz_Configuration::salt() . $this->url); + $salt = FreshRSS_Context::$system_conf->salt; + $this->hash = hash('crc32b', $salt . $this->url); } return $this->hash; } - public function url () { + public function url() { return $this->url; } - public function category () { + public function selfUrl() { + return $this->selfUrl; + } + public function hubUrl() { + return $this->hubUrl; + } + public function category() { return $this->category; } - public function entries () { + public function entries() { return $this->entries === null ? array() : $this->entries; } - public function name () { + public function name() { return $this->name; } - public function website () { + public function website() { return $this->website; } - public function description () { + public function description() { return $this->description; } - public function lastUpdate () { + public function lastUpdate() { return $this->lastUpdate; } - public function priority () { + public function priority() { return $this->priority; } - public function pathEntries () { + public function pathEntries() { return $this->pathEntries; } - public function httpAuth ($raw = true) { + public function httpAuth($raw = true) { if ($raw) { return $this->httpAuth; } else { - $pos_colon = strpos ($this->httpAuth, ':'); - $user = substr ($this->httpAuth, 0, $pos_colon); - $pass = substr ($this->httpAuth, $pos_colon + 1); + $pos_colon = strpos($this->httpAuth, ':'); + $user = substr($this->httpAuth, 0, $pos_colon); + $pass = substr($this->httpAuth, $pos_colon + 1); - return array ( + return array( 'username' => $user, 'password' => $pass ); } } - public function inError () { + public function inError() { return $this->error; } - public function keepHistory () { + public function keepHistory() { return $this->keep_history; } - public function nbEntries () { + public function ttl() { + return $this->ttl; + } + // public function ttlExpire() { + // $ttl = $this->ttl; + // if ($ttl == -2) { //Default + // $ttl = FreshRSS_Context::$user_conf->ttl_default; + // } + // if ($ttl == -1) { //Never + // $ttl = 64000000; //~2 years. Good enough for PubSubHubbub logic + // } + // return $this->lastUpdate + $ttl; + // } + public function nbEntries() { if ($this->nbEntries < 0) { - $feedDAO = new FreshRSS_FeedDAO (); - $this->nbEntries = $feedDAO->countEntries ($this->id ()); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->nbEntries = $feedDAO->countEntries($this->id()); } return $this->nbEntries; } - public function nbNotRead () { + public function nbNotRead() { if ($this->nbNotRead < 0) { - $feedDAO = new FreshRSS_FeedDAO (); - $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->nbNotRead = $feedDAO->countNotRead($this->id()); } return $this->nbNotRead; } public function faviconPrepare() { - $file = DATA_PATH . '/favicons/' . $this->hash() . '.txt'; - if (!file_exists ($file)) { - $t = $this->website; - if (empty($t)) { - $t = $this->url; + global $favicons_dir; + require_once(LIB_PATH . '/favicons.php'); + $url = $this->website; + if ($url == '') { + $url = $this->url; + } + $txt = $favicons_dir . $this->hash() . '.txt'; + if (!file_exists($txt)) { + file_put_contents($txt, $url); + } + if (FreshRSS_Context::$isCli) { + $ico = $favicons_dir . $this->hash() . '.ico'; + $ico_mtime = @filemtime($ico); + $txt_mtime = @filemtime($txt); + if ($txt_mtime != false && + ($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (14 * 86400)))) { + // no ico file or we should download a new one. + $url = file_get_contents($txt); + download_favicon($url, $ico) || touch($ico); } - file_put_contents($file, $t); } } public static function faviconDelete($hash) { @@ -115,113 +158,134 @@ class FreshRSS_Feed extends Minz_Model { @unlink($path . '.ico'); @unlink($path . '.txt'); } - public function favicon () { - return Minz_Url::display ('/f.php?' . $this->hash()); + public function favicon() { + return Minz_Url::display('/f.php?' . $this->hash()); } - public function _id ($value) { + public function _id($value) { $this->id = $value; } - public function _url ($value, $validate=true) { + public function _url($value, $validate=true) { + $this->hash = null; if ($validate) { $value = checkUrl($value); } - if (empty ($value)) { - throw new FreshRSS_BadUrl_Exception ($value); + if (empty($value)) { + throw new FreshRSS_BadUrl_Exception($value); } $this->url = $value; } - public function _category ($value) { + public function _category($value) { $value = intval($value); $this->category = $value >= 0 ? $value : 0; } - public function _name ($value) { + public function _name($value) { $this->name = $value === null ? '' : $value; } - public function _website ($value, $validate=true) { + public function _website($value, $validate=true) { if ($validate) { $value = checkUrl($value); } - if (empty ($value)) { + if (empty($value)) { $value = ''; } $this->website = $value; } - public function _description ($value) { + public function _description($value) { $this->description = $value === null ? '' : $value; } - public function _lastUpdate ($value) { + public function _lastUpdate($value) { $this->lastUpdate = $value; } - public function _priority ($value) { + public function _priority($value) { $value = intval($value); $this->priority = $value >= 0 ? $value : 10; } - public function _pathEntries ($value) { + public function _pathEntries($value) { $this->pathEntries = $value; } - public function _httpAuth ($value) { + public function _httpAuth($value) { $this->httpAuth = $value; } - public function _error ($value) { + public function _error($value) { $this->error = (bool)$value; } - public function _keepHistory ($value) { + public function _keepHistory($value) { $value = intval($value); $value = min($value, 1000000); $value = max($value, -2); $this->keep_history = $value; } - public function _nbNotRead ($value) { + public function _ttl($value) { + $value = intval($value); + $value = min($value, 100000000); + $value = max($value, -2); + $this->ttl = $value; + } + public function _nbNotRead($value) { $this->nbNotRead = intval($value); } - public function _nbEntries ($value) { + public function _nbEntries($value) { $this->nbEntries = intval($value); } - public function load ($loadDetails = false) { + public function load($loadDetails = false, $noCache = false) { if ($this->url !== null) { if (CACHE_PATH === false) { - throw new Minz_FileNotExistException ( + throw new Minz_FileNotExistException( 'CACHE_PATH', Minz_Exception::ERROR ); } else { - $url = htmlspecialchars_decode ($this->url, ENT_QUOTES); + $url = htmlspecialchars_decode($this->url, ENT_QUOTES); if ($this->httpAuth != '') { - $url = preg_replace ('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url); + $url = preg_replace('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url); } $feed = customSimplePie(); - $feed->set_feed_url ($url); + if (substr($url, -11) === '#force_feed') { + $feed->force_feed(true); + $url = substr($url, 0, -11); + } + $feed->set_feed_url($url); + if (!$loadDetails) { //Only activates auto-discovery when adding a new feed + $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE); + } $mtime = $feed->init(); if ((!$mtime) || $feed->error()) { - throw new FreshRSS_Feed_Exception ($feed->error() . ' [' . $url . ']'); + $errorMessage = $feed->error(); + throw new FreshRSS_Feed_Exception(($errorMessage == '' ? 'Unknown error for feed' : $errorMessage) . ' [' . $url . ']'); } - // si on a utilisé l'auto-discover, notre url va avoir changé - $subscribe_url = $feed->subscribe_url (); - if ($subscribe_url !== null && $subscribe_url !== $this->url) { - if ($this->httpAuth != '') { - // on enlève les id si authentification HTTP - $subscribe_url = preg_replace ('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url); - } - $this->_url ($subscribe_url); - } + $links = $feed->get_links('self'); + $this->selfUrl = isset($links[0]) ? $links[0] : null; + $links = $feed->get_links('hub'); + $this->hubUrl = isset($links[0]) ? $links[0] : null; if ($loadDetails) { - $title = htmlspecialchars(html_only_entity_decode($feed->get_title()), ENT_COMPAT, 'UTF-8'); - $this->_name ($title === null ? $this->url : $title); + // si on a utilisé l'auto-discover, notre url va avoir changé + $subscribe_url = $feed->subscribe_url(false); + + $title = strtr(html_only_entity_decode($feed->get_title()), array('<' => '<', '>' => '>', '"' => '"')); //HTML to HTML-PRE //ENT_COMPAT except & + $this->_name($title == '' ? $url : $title); $this->_website(html_only_entity_decode($feed->get_link())); $this->_description(html_only_entity_decode($feed->get_description())); + } else { + //The case of HTTP 301 Moved Permanently + $subscribe_url = $feed->subscribe_url(true); + } + + $clean_url = SimplePie_Misc::url_remove_credentials($subscribe_url); + if ($subscribe_url !== null && $subscribe_url !== $url) { + $this->_url($clean_url); } - if (($mtime === true) || ($mtime > $this->lastUpdate)) { - syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url); + if (($mtime === true) || ($mtime > $this->lastUpdate) || $noCache) { + //Minz_Log::debug('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $clean_url); $this->loadEntries($feed); // et on charge les articles du flux } else { - syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url); + //Minz_Log::debug('FreshRSS use cache for ' . $clean_url); $this->entries = array(); } @@ -231,47 +295,54 @@ class FreshRSS_Feed extends Minz_Model { } } - private function loadEntries ($feed) { - $entries = array (); + public function loadEntries($feed) { + $entries = array(); - foreach ($feed->get_items () as $item) { - $title = html_only_entity_decode (strip_tags ($item->get_title ())); - $author = $item->get_author (); - $link = $item->get_permalink (); - $date = @strtotime ($item->get_date ()); + foreach ($feed->get_items() as $item) { + $title = html_only_entity_decode(strip_tags($item->get_title())); + $author = $item->get_author(); + $link = $item->get_permalink(); + $date = @strtotime($item->get_date()); // gestion des tags (catégorie == tag) - $tags_tmp = $item->get_categories (); - $tags = array (); + $tags_tmp = $item->get_categories(); + $tags = array(); if ($tags_tmp !== null) { foreach ($tags_tmp as $tag) { - $tags[] = html_only_entity_decode ($tag->get_label ()); + $tags[] = html_only_entity_decode($tag->get_label()); } } - $content = html_only_entity_decode ($item->get_content ()); + $content = html_only_entity_decode($item->get_content()); $elinks = array(); foreach ($item->get_enclosures() as $enclosure) { $elink = $enclosure->get_link(); - if (array_key_exists($elink, $elinks)) continue; - $elinks[$elink] = '1'; - $mime = strtolower($enclosure->get_type()); - if (strpos($mime, 'image/') === 0) { - $content .= '<br /><img src="' . $elink . '" alt="" />'; + if (empty($elinks[$elink])) { + $elinks[$elink] = '1'; + $mime = strtolower($enclosure->get_type()); + if (strpos($mime, 'image/') === 0) { + $content .= '<p class="enclosure"><img src="' . $elink . '" alt="" /></p>'; + } elseif (strpos($mime, 'audio/') === 0) { + $content .= '<p class="enclosure"><audio preload="none" src="' . $elink . '" controls="controls"></audio> <a download="" href="' . $elink . '">💾</a></p>'; + } elseif (strpos($mime, 'video/') === 0) { + $content .= '<p class="enclosure"><video preload="none" src="' . $elink . '" controls="controls"></video> <a download="" href="' . $elink . '">💾</a></p>'; + } else { + unset($elinks[$elink]); + } } } - $entry = new FreshRSS_Entry ( - $this->id (), - $item->get_id (), + $entry = new FreshRSS_Entry( + $this->id(), + $item->get_id(), $title === null ? '' : $title, - $author === null ? '' : html_only_entity_decode ($author->name), + $author === null ? '' : html_only_entity_decode($author->name), $content === null ? '' : $content, $link === null ? '' : $link, - $date ? $date : time () + $date ? $date : time() ); - $entry->_tags ($tags); + $entry->_tags($tags); // permet de récupérer le contenu des flux tronqués $entry->loadCompleteContent($this->pathEntries()); @@ -282,21 +353,155 @@ class FreshRSS_Feed extends Minz_Model { $this->entries = $entries; } + function cacheModifiedTime() { + return @filemtime(CACHE_PATH . '/' . md5($this->url) . '.spc'); + } + function lock() { - $lock = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock'; - if (file_exists($lock) && ((time() - @filemtime($lock)) > 3600)) { - @unlink($lock); + $this->lockPath = TMP_PATH . '/' . $this->hash() . '.freshrss.lock'; + if (file_exists($this->lockPath) && ((time() - @filemtime($this->lockPath)) > 3600)) { + @unlink($this->lockPath); } - if (($handle = @fopen($lock, 'x')) === false) { + if (($handle = @fopen($this->lockPath, 'x')) === false) { return false; } - //register_shutdown_function('unlink', $lock); + //register_shutdown_function('unlink', $this->lockPath); @fclose($handle); return true; } function unlock() { - $lock = TMP_PATH . '/' . md5(Minz_Configuration::salt() . $this->url) . '.freshrss.lock'; - @unlink($lock); + @unlink($this->lockPath); + } + + //<PubSubHubbub> + + function pubSubHubbubEnabled() { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + if ($hubFile = @file_get_contents($hubFilename)) { + $hubJson = json_decode($hubFile, true); + if ($hubJson && empty($hubJson['error']) && + (empty($hubJson['lease_end']) || $hubJson['lease_end'] > time())) { + return true; + } + } + return false; } + + function pubSubHubbubError($error = true) { + $url = $this->selfUrl ? $this->selfUrl : $this->url; + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($url) . '/!hub.json'; + $hubFile = @file_get_contents($hubFilename); + $hubJson = $hubFile ? json_decode($hubFile, true) : array(); + if (!isset($hubJson['error']) || $hubJson['error'] !== (bool)$error) { + $hubJson['error'] = (bool)$error; + file_put_contents($hubFilename, json_encode($hubJson)); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" + . 'Set error to ' . ($error ? 1 : 0) . ' for ' . $url . "\n", FILE_APPEND); + } + return false; + } + + function pubSubHubbubPrepare() { + $key = ''; + if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl && @is_dir(PSHB_PATH)) { + $path = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl); + $hubFilename = $path . '/!hub.json'; + if ($hubFile = @file_get_contents($hubFilename)) { + $hubJson = json_decode($hubFile, true); + if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { + $text = 'Invalid JSON for PubSubHubbub: ' . $this->url; + Minz_Log::warning($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + return false; + } + if ((!empty($hubJson['lease_end'])) && ($hubJson['lease_end'] < (time() + (3600 * 23)))) { //TODO: Make a better policy + $text = 'PubSubHubbub lease ends at ' + . date('c', empty($hubJson['lease_end']) ? time() : $hubJson['lease_end']) + . ' and needs renewal: ' . $this->url; + Minz_Log::warning($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + $key = $hubJson['key']; //To renew our lease + } elseif (((!empty($hubJson['error'])) || empty($hubJson['lease_end'])) && + (empty($hubJson['lease_start']) || $hubJson['lease_start'] < time() - (3600 * 23))) { //Do not renew too often + $key = $hubJson['key']; //To renew our lease + } + } else { + @mkdir($path, 0777, true); + $key = sha1($path . FreshRSS_Context::$system_conf->salt . uniqid(mt_rand(), true)); + $hubJson = array( + 'hub' => $this->hubUrl, + 'key' => $key, + ); + file_put_contents($hubFilename, json_encode($hubJson)); + @mkdir(PSHB_PATH . '/keys/'); + file_put_contents(PSHB_PATH . '/keys/' . $key . '.txt', base64url_encode($this->selfUrl)); + $text = 'PubSubHubbub prepared for ' . $this->url; + Minz_Log::debug($text); + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + } + $currentUser = Minz_Session::param('currentUser'); + if (ctype_alnum($currentUser) && !file_exists($path . '/' . $currentUser . '.txt')) { + touch($path . '/' . $currentUser . '.txt'); + } + } + return $key; + } + + //Parameter true to subscribe, false to unsubscribe. + function pubSubHubbubSubscribe($state) { + if (FreshRSS_Context::$system_conf->base_url && $this->hubUrl && $this->selfUrl) { + $hubFilename = PSHB_PATH . '/feeds/' . base64url_encode($this->selfUrl) . '/!hub.json'; + $hubFile = @file_get_contents($hubFilename); + if ($hubFile === false) { + Minz_Log::warning('JSON not found for PubSubHubbub: ' . $this->url); + return false; + } + $hubJson = json_decode($hubFile, true); + if (!$hubJson || empty($hubJson['key']) || !ctype_xdigit($hubJson['key'])) { + Minz_Log::warning('Invalid JSON for PubSubHubbub: ' . $this->url); + return false; + } + $callbackUrl = checkUrl(Minz_Request::getBaseUrl() . '/api/pshb.php?k=' . $hubJson['key']); + if ($callbackUrl == '') { + Minz_Log::warning('Invalid callback for PubSubHubbub: ' . $this->url); + return false; + } + if (!$state) { //unsubscribe + $hubJson['lease_end'] = time() - 60; + file_put_contents($hubFilename, json_encode($hubJson)); + } + $ch = curl_init(); + curl_setopt_array($ch, array( + CURLOPT_URL => $this->hubUrl, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_USERAGENT => 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')', + CURLOPT_POSTFIELDS => 'hub.verify=sync' + . '&hub.mode=' . ($state ? 'subscribe' : 'unsubscribe') + . '&hub.topic=' . urlencode($this->selfUrl) + . '&hub.callback=' . urlencode($callbackUrl) + ) + ); + $response = curl_exec($ch); + $info = curl_getinfo($ch); + + file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . + 'PubSubHubbub ' . ($state ? 'subscribe' : 'unsubscribe') . ' to ' . $this->selfUrl . + ' with callback ' . $callbackUrl . ': ' . $info['http_code'] . ' ' . $response . "\n", FILE_APPEND); + + if (substr($info['http_code'], 0, 1) == '2') { + return true; + } else { + $hubJson['lease_start'] = time(); //Prevent trying again too soon + $hubJson['error'] = true; + file_put_contents($hubFilename, json_encode($hubJson)); + return false; + } + } + return false; + } + + //</PubSubHubbub> } diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 7ebe68d2b..68398efd5 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -1,244 +1,300 @@ <?php -class FreshRSS_FeedDAO extends Minz_ModelPdo { - public function addFeed ($valuesTmp) { - $sql = 'INSERT INTO `' . $this->prefix . 'feed` (url, category, name, website, description, lastUpdate, priority, httpAuth, error, keep_history) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2)'; - $stm = $this->bd->prepare ($sql); +class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { + public function addFeed($valuesTmp) { + $sql = 'INSERT INTO `' . $this->prefix . 'feed` (url, category, name, website, description, `lastUpdate`, priority, `httpAuth`, error, keep_history, ttl) VALUES(?, ?, ?, ?, ?, ?, 10, ?, 0, -2, -2)'; + $stm = $this->bd->prepare($sql); + + $valuesTmp['url'] = safe_ascii($valuesTmp['url']); + $valuesTmp['website'] = safe_ascii($valuesTmp['website']); - $values = array ( + $values = array( substr($valuesTmp['url'], 0, 511), $valuesTmp['category'], substr($valuesTmp['name'], 0, 255), substr($valuesTmp['website'], 0, 255), substr($valuesTmp['description'], 0, 1023), $valuesTmp['lastUpdate'], - base64_encode ($valuesTmp['httpAuth']), + base64_encode($valuesTmp['httpAuth']), ); - if ($stm && $stm->execute ($values)) { - return $this->bd->lastInsertId(); + if ($stm && $stm->execute($values)) { + return $this->bd->lastInsertId('"' . $this->prefix . 'feed_id_seq"'); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error addFeed: ' . $info[2]); return false; } } - public function updateFeed ($id, $valuesTmp) { + public function addFeedObject($feed) { + // TODO: not sure if we should write this method in DAO since DAO + // should not be aware about feed class + + // Add feed only if we don't find it in DB + $feed_search = $this->searchByUrl($feed->url()); + if (!$feed_search) { + $values = array( + 'id' => $feed->id(), + 'url' => $feed->url(), + 'category' => $feed->category(), + 'name' => $feed->name(), + 'website' => $feed->website(), + 'description' => $feed->description(), + 'lastUpdate' => 0, + 'httpAuth' => $feed->httpAuth() + ); + + $id = $this->addFeed($values); + if ($id) { + $feed->_id($id); + $feed->faviconPrepare(); + } + + return $id; + } + + return $feed_search->id(); + } + + public function updateFeed($id, $valuesTmp) { + if (isset($valuesTmp['url'])) { + $valuesTmp['url'] = safe_ascii($valuesTmp['url']); + } + if (isset($valuesTmp['website'])) { + $valuesTmp['website'] = safe_ascii($valuesTmp['website']); + } + $set = ''; foreach ($valuesTmp as $key => $v) { $set .= $key . '=?, '; if ($key == 'httpAuth') { - $valuesTmp[$key] = base64_encode ($v); + $valuesTmp[$key] = base64_encode($v); } } - $set = substr ($set, 0, -2); + $set = substr($set, 0, -2); $sql = 'UPDATE `' . $this->prefix . 'feed` SET ' . $set . ' WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); foreach ($valuesTmp as $v) { $values[] = $v; } $values[] = $id; - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateFeed: ' . $info[2]); return false; } } - public function updateLastUpdate ($id, $inError = 0, $updateCache = true) { + public function updateLastUpdate($id, $inError = false, $updateCache = true, $mtime = 0) { if ($updateCache) { - $sql = 'UPDATE `' . $this->prefix . 'feed` f ' //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE - . 'SET f.cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=f.id),' - . 'f.cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=f.id AND e2.is_read=0),' - . 'lastUpdate=?, error=? ' - . 'WHERE f.id=?'; + $sql = 'UPDATE `' . $this->prefix . 'feed` ' //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE + . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' + . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0),' + . '`lastUpdate`=?, error=? ' + . 'WHERE id=?'; } else { - $sql = 'UPDATE `' . $this->prefix . 'feed` f ' - . 'SET lastUpdate=?, error=? ' - . 'WHERE f.id=?'; + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `lastUpdate`=?, error=? ' + . 'WHERE id=?'; } - $values = array ( - time(), - $inError, + if ($mtime <= 0) { + $mtime = time(); + } + + $values = array( + $mtime, + $inError ? 1 : 0, $id, ); - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateLastUpdate: ' . $info[2]); return false; } } - public function changeCategory ($idOldCat, $idNewCat) { - $catDAO = new FreshRSS_CategoryDAO (); - $newCat = $catDAO->searchById ($idNewCat); + public function changeCategory($idOldCat, $idNewCat) { + $catDAO = new FreshRSS_CategoryDAO(); + $newCat = $catDAO->searchById($idNewCat); if (!$newCat) { - $newCat = $catDAO->getDefault (); + $newCat = $catDAO->getDefault(); } $sql = 'UPDATE `' . $this->prefix . 'feed` SET category=? WHERE category=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ( - $newCat->id (), + $values = array( + $newCat->id(), $idOldCat ); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error changeCategory: ' . $info[2]); return false; } } - public function deleteFeed ($id) { - /*//For MYISAM (MySQL 5.5-) without FOREIGN KEY - $sql = 'DELETE FROM `' . $this->prefix . 'entry` WHERE id_feed=?'; - $stm = $this->bd->prepare ($sql); - $values = array ($id); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - return false; - }*/ - + public function deleteFeed($id) { $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($id); + $values = array($id); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error deleteFeed: ' . $info[2]); return false; } } - public function deleteFeedByCategory ($id) { - /*//For MYISAM (MySQL 5.5-) without FOREIGN KEY - $sql = 'DELETE FROM `' . $this->prefix . 'entry` e ' - . 'INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' - . 'WHERE f.category=?'; - $stm = $this->bd->prepare ($sql); - $values = array ($id); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - return false; - }*/ - + public function deleteFeedByCategory($id) { $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE category=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($id); + $values = array($id); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute($values)) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error deleteFeedByCategory: ' . $info[2]); return false; } } - public function searchById ($id) { + public function searchById($id) { $sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE id=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($id); + $values = array($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $feed = self::daoToFeed ($res); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $feed = self::daoToFeed($res); - if (isset ($feed[$id])) { + if (isset($feed[$id])) { return $feed[$id]; } else { - return false; + return null; } } - public function searchByUrl ($url) { + public function searchByUrl($url) { $sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE url=?'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($url); + $values = array($url); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); - $feed = current (self::daoToFeed ($res)); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $feed = current(self::daoToFeed($res)); - if (isset ($feed)) { + if (isset($feed) && $feed !== false) { return $feed; } else { - return false; + return null; } } - public function listFeeds () { + public function listFeedsIds() { + $sql = 'SELECT id FROM `' . $this->prefix . 'feed`'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + return $stm->fetchAll(PDO::FETCH_COLUMN, 0); + } + + public function listFeeds() { $sql = 'SELECT * FROM `' . $this->prefix . 'feed` ORDER BY name'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); + $stm = $this->bd->prepare($sql); + $stm->execute(); - return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function arrayFeedCategoryNames() { //For API + $sql = 'SELECT f.id, f.name, c.name as c_name FROM `' . $this->prefix . 'feed` f ' + . 'INNER JOIN `' . $this->prefix . 'category` c ON c.id = f.category'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $feedCategoryNames = array(); + foreach ($res as $line) { + $feedCategoryNames[$line['id']] = array( + 'name' => $line['name'], + 'c_name' => $line['c_name'], + ); + } + return $feedCategoryNames; } - public function listFeedsOrderUpdate ($cacheDuration = 1500) { - $sql = 'SELECT id, name, url, lastUpdate, pathEntries, httpAuth, keep_history ' + /** + * Use $defaultCacheDuration == -1 to return all feeds, without filtering them by TTL. + */ + public function listFeedsOrderUpdate($defaultCacheDuration = 3600) { + $sql = 'SELECT id, url, name, website, `lastUpdate`, `pathEntries`, `httpAuth`, keep_history, ttl ' . 'FROM `' . $this->prefix . 'feed` ' - . 'WHERE lastUpdate < ' . (time() - intval($cacheDuration)) - . ' ORDER BY lastUpdate'; - $stm = $this->bd->prepare ($sql); - $stm->execute (); + . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl <> -1 AND `lastUpdate` < (' . (time() + 60) . '-(CASE WHEN ttl=-2 THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ') + . 'ORDER BY `lastUpdate`'; + $stm = $this->bd->prepare($sql); + if (!($stm && $stm->execute())) { + $sql2 = 'ALTER TABLE `' . $this->prefix . 'feed` ADD COLUMN ttl INT NOT NULL DEFAULT -2'; //v0.7.3 + $stm = $this->bd->prepare($sql2); + $stm->execute(); + $stm = $this->bd->prepare($sql); + $stm->execute(); + } - return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); } - public function listByCategory ($cat) { + public function listByCategory($cat) { $sql = 'SELECT * FROM `' . $this->prefix . 'feed` WHERE category=? ORDER BY name'; - $stm = $this->bd->prepare ($sql); + $stm = $this->bd->prepare($sql); - $values = array ($cat); + $values = array($cat); - $stm->execute ($values); + $stm->execute($values); - return self::daoToFeed ($stm->fetchAll (PDO::FETCH_ASSOC)); + return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); } - public function countEntries ($id) { + public function countEntries($id) { $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` WHERE id_feed=?'; - $stm = $this->bd->prepare ($sql); - $values = array ($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $stm = $this->bd->prepare($sql); + $values = array($id); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; } - public function countNotRead ($id) { + + public function countNotRead($id) { $sql = 'SELECT COUNT(*) AS count FROM `' . $this->prefix . 'entry` WHERE id_feed=? AND is_read=0'; - $stm = $this->bd->prepare ($sql); - $values = array ($id); - $stm->execute ($values); - $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $stm = $this->bd->prepare($sql); + $values = array($id); + $stm->execute($values); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; } - public function updateCachedValues () { //For one single feed, call updateLastUpdate($id) + + public function updateCachedValues() { //For one single feed, call updateLastUpdate($id) $sql = 'UPDATE `' . $this->prefix . 'feed` f ' . 'INNER JOIN (' . 'SELECT e.id_feed, ' @@ -247,81 +303,82 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { . 'FROM `' . $this->prefix . 'entry` e ' . 'GROUP BY e.id_feed' . ') x ON x.id_feed=f.id ' - . 'SET f.cache_nbEntries=x.nbEntries, f.cache_nbUnreads=x.nbUnreads'; - $stm = $this->bd->prepare ($sql); - - $values = array ($feed_id); + . 'SET f.`cache_nbEntries`=x.nbEntries, f.`cache_nbUnreads`=x.nbUnreads'; + $stm = $this->bd->prepare($sql); - if ($stm && $stm->execute ($values)) { + if ($stm && $stm->execute()) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateCachedValues: ' . $info[2]); return false; } } - public function truncate ($id) { - $sql = 'DELETE e.* FROM `' . $this->prefix . 'entry` e WHERE e.id_feed=?'; + public function truncate($id) { + $sql = 'DELETE FROM `' . $this->prefix . 'entry` WHERE id_feed=?'; $stm = $this->bd->prepare($sql); $values = array($id); - $this->bd->beginTransaction (); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); - return false; - } + $this->bd->beginTransaction(); + if (!($stm && $stm->execute($values))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error truncate: ' . $info[2]); + $this->bd->rollBack(); + return false; + } $affected = $stm->rowCount(); - $sql = 'UPDATE `' . $this->prefix . 'feed` f ' - . 'SET f.cache_nbEntries=0, f.cache_nbUnreads=0 WHERE f.id=?'; - $values = array ($id); - $stm = $this->bd->prepare ($sql); - if (!($stm && $stm->execute ($values))) { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - $this->bd->rollBack (); + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `cache_nbEntries`=0, `cache_nbUnreads`=0 WHERE id=?'; + $values = array($id); + $stm = $this->bd->prepare($sql); + if (!($stm && $stm->execute($values))) { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error truncate: ' . $info[2]); + $this->bd->rollBack(); return false; } - $this->bd->commit (); + $this->bd->commit(); return $affected; } - public function cleanOldEntries ($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) just after - $sql = 'DELETE e.* FROM `' . $this->prefix . 'entry` e ' - . 'WHERE e.id_feed = :id_feed AND e.id <= :id_max AND e.is_favorite = 0 AND e.id NOT IN ' - . '(SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed = :id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select because of: MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' - $stm = $this->bd->prepare ($sql); - - $id_max = intval($date_min) . '000000'; + public function cleanOldEntries($id, $date_min, $keep = 15) { //Remember to call updateLastUpdate($id) or updateCachedValues() just after + $sql = 'DELETE FROM `' . $this->prefix . 'entry` ' + . 'WHERE id_feed=:id_feed AND id<=:id_max ' + . 'AND is_favorite=0 ' //Do not remove favourites + . 'AND `lastSeen` < (SELECT maxLastSeen FROM (SELECT (MAX(e3.`lastSeen`)-99) AS maxLastSeen FROM `' . $this->prefix . 'entry` e3 WHERE e3.id_feed=:id_feed) recent) ' //Do not remove the most newly seen articles, plus a few seconds of tolerance + . 'AND id NOT IN (SELECT id FROM (SELECT e2.id FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=:id_feed ORDER BY id DESC LIMIT :keep) keep)'; //Double select: MySQL doesn't support 'LIMIT & IN/ALL/ANY/SOME subquery' + $stm = $this->bd->prepare($sql); - $stm->bindParam(':id_feed', $id, PDO::PARAM_INT); - $stm->bindParam(':id_max', $id_max, PDO::PARAM_INT); - $stm->bindParam(':keep', $keep, PDO::PARAM_INT); + if ($stm) { + $id_max = intval($date_min) . '000000'; + $stm->bindParam(':id_feed', $id, PDO::PARAM_INT); + $stm->bindParam(':id_max', $id_max, PDO::PARAM_STR); + $stm->bindParam(':keep', $keep, PDO::PARAM_INT); + } - if ($stm && $stm->execute ()) { + if ($stm && $stm->execute()) { return $stm->rowCount(); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error cleanOldEntries: ' . $info[2]); return false; } } - public static function daoToFeed ($listDAO, $catID = null) { - $list = array (); + public static function daoToFeed($listDAO, $catID = null) { + $list = array(); - if (!is_array ($listDAO)) { - $listDAO = array ($listDAO); + if (!is_array($listDAO)) { + $listDAO = array($listDAO); } foreach ($listDAO as $key => $dao) { - if (!isset ($dao['name'])) { + if (!isset($dao['name'])) { continue; } - if (isset ($dao['id'])) { + if (isset($dao['id'])) { $key = $dao['id']; } if ($catID === null) { @@ -338,13 +395,14 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $myFeed->_lastUpdate(isset($dao['lastUpdate']) ? $dao['lastUpdate'] : 0); $myFeed->_priority(isset($dao['priority']) ? $dao['priority'] : 10); $myFeed->_pathEntries(isset($dao['pathEntries']) ? $dao['pathEntries'] : ''); - $myFeed->_httpAuth(isset($dao['httpAuth']) ? base64_decode ($dao['httpAuth']) : ''); + $myFeed->_httpAuth(isset($dao['httpAuth']) ? base64_decode($dao['httpAuth']) : ''); $myFeed->_error(isset($dao['error']) ? $dao['error'] : 0); $myFeed->_keepHistory(isset($dao['keep_history']) ? $dao['keep_history'] : -2); + $myFeed->_ttl(isset($dao['ttl']) ? $dao['ttl'] : -2); $myFeed->_nbNotRead(isset($dao['cache_nbUnreads']) ? $dao['cache_nbUnreads'] : 0); $myFeed->_nbEntries(isset($dao['cache_nbEntries']) ? $dao['cache_nbEntries'] : 0); - if (isset ($dao['id'])) { - $myFeed->_id ($dao['id']); + if (isset($dao['id'])) { + $myFeed->_id($dao['id']); } $list[$key] = $myFeed; } diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.php new file mode 100644 index 000000000..440ae74da --- /dev/null +++ b/app/Models/FeedDAOSQLite.php @@ -0,0 +1,19 @@ +<?php + +class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO { + + public function updateCachedValues() { //For one single feed, call updateLastUpdate($id) + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' + . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0)'; + $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute()) { + return $stm->rowCount(); + } else { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error updateCachedValues: ' . $info[2]); + return false; + } + } + +} diff --git a/app/Models/Log.php b/app/Models/Log.php index d2794458b..df2de72ac 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -5,22 +5,22 @@ class FreshRSS_Log extends Minz_Model { private $level; private $information; - public function date () { + public function date() { return $this->date; } - public function level () { + public function level() { return $this->level; } - public function info () { + public function info() { return $this->information; } - public function _date ($date) { + public function _date($date) { $this->date = $date; } - public function _level ($level) { + public function _level($level) { $this->level = $level; } - public function _info ($information) { + public function _info($information) { $this->information = $information; } } diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php index d1e515200..ab258cd58 100644 --- a/app/Models/LogDAO.php +++ b/app/Models/LogDAO.php @@ -2,15 +2,15 @@ class FreshRSS_LogDAO { public static function lines() { - $logs = array (); - $handle = @fopen(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', 'r'); + $logs = array(); + $handle = @fopen(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), 'r'); if ($handle) { while (($line = fgets($handle)) !== false) { - if (preg_match ('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) { + if (preg_match('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) { $myLog = new FreshRSS_Log (); - $myLog->_date ($matches[1]); - $myLog->_level ($matches[2]); - $myLog->_info ($matches[3]); + $myLog->_date($matches[1]); + $myLog->_level($matches[2]); + $myLog->_info($matches[3]); $logs[] = $myLog; } } @@ -20,6 +20,11 @@ class FreshRSS_LogDAO { } public static function truncate() { - file_put_contents(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', ''); + file_put_contents(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), ''); + if (FreshRSS_Auth::hasAccess('admin')) { + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log.txt'), ''); + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_api.txt'), ''); + file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_pshb.txt'), ''); + } } } diff --git a/app/Models/Search.php b/app/Models/Search.php new file mode 100644 index 000000000..575a9a2cb --- /dev/null +++ b/app/Models/Search.php @@ -0,0 +1,229 @@ +<?php + +require_once(LIB_PATH . '/lib_date.php'); + +/** + * Contains a search from the search form. + * + * It allows to extract meaningful bits of the search and store them in a + * convenient object + */ +class FreshRSS_Search { + + // This contains the user input string + private $raw_input = ''; + // The following properties are extracted from the raw input + private $intitle; + private $min_date; + private $max_date; + private $min_pubdate; + private $max_pubdate; + private $inurl; + private $author; + private $tags; + private $search; + + public function __construct($input) { + if (strcmp($input, '') == 0) { + return; + } + $this->raw_input = $input; + $input = $this->parseIntitleSearch($input); + $input = $this->parseAuthorSearch($input); + $input = $this->parseInurlSearch($input); + $input = $this->parsePubdateSearch($input); + $input = $this->parseDateSearch($input); + $input = $this->parseTagsSeach($input); + $this->parseSearch($input); + } + + public function __toString() { + return $this->getRawInput(); + } + + public function getRawInput() { + return $this->raw_input; + } + + public function getIntitle() { + return $this->intitle; + } + + public function getMinDate() { + return $this->min_date; + } + + public function getMaxDate() { + return $this->max_date; + } + + public function getMinPubdate() { + return $this->min_pubdate; + } + + public function getMaxPubdate() { + return $this->max_pubdate; + } + + public function getInurl() { + return $this->inurl; + } + + public function getAuthor() { + return $this->author; + } + + public function getTags() { + return $this->tags; + } + + public function getSearch() { + return $this->search; + } + + /** + * Parse the search string to find intitle keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseIntitleSearch($input) { + if (preg_match('/intitle:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->intitle = $matches['search']; + return str_replace($matches[0], '', $input); + } + if (preg_match('/intitle:(?P<search>\w*)/', $input, $matches)) { + $this->intitle = $matches['search']; + return str_replace($matches[0], '', $input); + } + return $input; + } + + /** + * Parse the search string to find author keyword and the search related + * to it. + * The search is the first word following the keyword except when using + * a delimiter. Supported delimiters are single quote (') and double + * quotes ("). + * + * @param string $input + * @return string + */ + private function parseAuthorSearch($input) { + if (preg_match('/author:(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->author = $matches['search']; + return str_replace($matches[0], '', $input); + } + if (preg_match('/author:(?P<search>\w*)/', $input, $matches)) { + $this->author = $matches['search']; + return str_replace($matches[0], '', $input); + } + return $input; + } + + /** + * Parse the search string to find inurl keyword and the search related + * to it. + * The search is the first word following the keyword except. + * + * @param string $input + * @return string + */ + private function parseInurlSearch($input) { + if (preg_match('/inurl:(?P<search>[^\s]*)/', $input, $matches)) { + $this->inurl = $matches['search']; + return str_replace($matches[0], '', $input); + } + return $input; + } + + /** + * Parse the search string to find date keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parseDateSearch($input) { + if (preg_match('/date:(?P<search>[^\s]*)/', $input, $matches)) { + list($this->min_date, $this->max_date) = parseDateInterval($matches['search']); + return str_replace($matches[0], '', $input); + } + return $input; + } + + /** + * Parse the search string to find pubdate keyword and the search related + * to it. + * The search is the first word following the keyword. + * + * @param string $input + * @return string + */ + private function parsePubdateSearch($input) { + if (preg_match('/pubdate:(?P<search>[^\s]*)/', $input, $matches)) { + list($this->min_pubdate, $this->max_pubdate) = parseDateInterval($matches['search']); + return str_replace($matches[0], '', $input); + } + return $input; + } + + /** + * Parse the search string to find tags keyword (# followed by a word) + * and the search related to it. + * The search is the first word following the #. + * + * @param string $input + * @return string + */ + private function parseTagsSeach($input) { + if (preg_match_all('/#(?P<search>[^\s]+)/', $input, $matches)) { + $this->tags = $matches['search']; + return str_replace($matches[0], '', $input); + } + return $input; + } + + /** + * Parse the search string to find search values. + * Every word is a distinct search value, except when using a delimiter. + * Supported delimiters are single quote (') and double quotes ("). + * + * @param string $input + * @return string + */ + private function parseSearch($input) { + $input = $this->cleanSearch($input); + if (strcmp($input, '') == 0) { + return; + } + if (preg_match_all('/(?P<delim>[\'"])(?P<search>.*)(?P=delim)/U', $input, $matches)) { + $this->search = $matches['search']; + $input = str_replace($matches[0], '', $input); + } + $input = $this->cleanSearch($input); + if (strcmp($input, '') == 0) { + return; + } + if (is_array($this->search)) { + $this->search = array_merge($this->search, explode(' ', $input)); + } else { + $this->search = explode(' ', $input); + } + } + + /** + * Remove all unnecessary spaces in the search + * + * @param string $input + * @return string + */ + private function cleanSearch($input) { + $input = preg_replace('/\s+/', ' ', $input); + return trim($input); + } + +} diff --git a/app/Models/Searchable.php b/app/Models/Searchable.php new file mode 100644 index 000000000..d5bcea49d --- /dev/null +++ b/app/Models/Searchable.php @@ -0,0 +1,6 @@ +<?php + +interface FreshRSS_Searchable { + + public function searchById($id); +} diff --git a/app/Models/Share.php b/app/Models/Share.php new file mode 100644 index 000000000..1c8a7e767 --- /dev/null +++ b/app/Models/Share.php @@ -0,0 +1,238 @@ +<?php + +/** + * Manage the sharing options in FreshRSS. + */ +class FreshRSS_Share { + /** + * The list of available sharing options. + */ + private static $list_sharing = array(); + + /** + * Register a new sharing option. + * @param $share_options is an array defining the share option. + */ + public static function register($share_options) { + $type = $share_options['type']; + + if (isset(self::$list_sharing[$type])) { + return; + } + + $help_url = isset($share_options['help']) ? $share_options['help'] : ''; + self::$list_sharing[$type] = new FreshRSS_Share( + $type, $share_options['url'], $share_options['transform'], + $share_options['form'], $help_url + ); + } + + /** + * Register sharing options in a file. + * @param $filename the name of the file to load. + */ + public static function load($filename) { + $shares_from_file = @include($filename); + if (!is_array($shares_from_file)) { + $shares_from_file = array(); + } + + foreach ($shares_from_file as $share_type => $share_options) { + $share_options['type'] = $share_type; + self::register($share_options); + } + } + + /** + * Return the list of sharing options. + * @return an array of FreshRSS_Share objects. + */ + public static function enum() { + return self::$list_sharing; + } + + /** + * Return FreshRSS_Share object related to the given type. + * @param $type the share type, null if $type is not registered. + */ + public static function get($type) { + if (!isset(self::$list_sharing[$type])) { + return null; + } + + return self::$list_sharing[$type]; + } + + /** + * + */ + private $type = ''; + private $name = ''; + private $url_transform = ''; + private $transform = array(); + private $form_type = 'simple'; + private $help_url = ''; + private $custom_name = null; + private $base_url = null; + private $title = null; + private $link = null; + + /** + * Create a FreshRSS_Share object. + * @param $type is a unique string defining the kind of share option. + * @param $url_transform defines the url format to use in order to share. + * @param $transform is an array of transformations to apply on link and title. + * @param $form_type defines which form we have to use to complete. "simple" + * is typically for a centralized service while "advanced" is for + * decentralized ones. + * @param $help_url is an optional url to give help on this option. + */ + private function __construct($type, $url_transform, $transform = array(), + $form_type, $help_url = '') { + $this->type = $type; + $this->name = _t('gen.share.' . $type); + $this->url_transform = $url_transform; + $this->help_url = $help_url; + + if (!is_array($transform)) { + $transform = array(); + } + $this->transform = $transform; + + if (!in_array($form_type, array('simple', 'advanced'))) { + $form_type = 'simple'; + } + $this->form_type = $form_type; + } + + /** + * Update a FreshRSS_Share object with information from an array. + * @param $options is a list of informations to update where keys should be + * in this list: name, url, title, link. + */ + public function update($options) { + $available_options = array( + 'name' => 'custom_name', + 'url' => 'base_url', + 'title' => 'title', + 'link' => 'link', + ); + + foreach ($options as $key => $value) { + if (isset($available_options[$key])) { + $this->{$available_options[$key]} = $value; + } + } + } + + /** + * Return the current type of the share option. + */ + public function type() { + return $this->type; + } + + /** + * Return the current form type of the share option. + */ + public function formType() { + return $this->form_type; + } + + /** + * Return the current help url of the share option. + */ + public function help() { + return $this->help_url; + } + + /** + * Return the current name of the share option. + */ + public function name($real = false) { + if ($real || is_null($this->custom_name) || empty($this->custom_name)) { + return $this->name; + } else { + return $this->custom_name; + } + } + + /** + * Return the current base url of the share option. + */ + public function baseUrl() { + return $this->base_url; + } + + /** + * Return the current url by merging url_transform and base_url. + */ + public function url() { + $matches = array( + '~URL~', + '~TITLE~', + '~LINK~', + ); + $replaces = array( + $this->base_url, + $this->title(), + $this->link(), + ); + return str_replace($matches, $replaces, $this->url_transform); + } + + /** + * Return the title. + * @param $raw true if we should get the title without transformations. + */ + public function title($raw = false) { + if ($raw) { + return $this->title; + } + + return $this->transform($this->title, $this->getTransform('title')); + } + + /** + * Return the link. + * @param $raw true if we should get the link without transformations. + */ + public function link($raw = false) { + if ($raw) { + return $this->link; + } + + return $this->transform($this->link, $this->getTransform('link')); + } + + /** + * Transform a data with the given functions. + * @param $data the data to transform. + * @param $tranform an array containing a list of functions to apply. + * @return the transformed data. + */ + private static function transform($data, $transform) { + if (!is_array($transform) || empty($transform)) { + return $data; + } + + foreach ($transform as $action) { + $data = call_user_func($action, $data); + } + + return $data; + } + + /** + * Get the list of transformations for the given attribute. + * @param $attr the attribute of which we want the transformations. + * @return an array containing a list of transformations to apply. + */ + private function getTransform($attr) { + if (array_key_exists($attr, $this->transform)) { + return $this->transform[$attr]; + } + + return $this->transform; + } +} diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index 60cec7847..2ce4f2944 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -2,124 +2,257 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo { + const ENTRY_COUNT_PERIOD = 30; + + protected function sqlFloor($s) { + return "FLOOR($s)"; + } + /** * Calculates entry repartition for all feeds and for main stream. + * + * @return array + */ + public function calculateEntryRepartition() { + return array( + 'main_stream' => $this->calculateEntryRepartitionPerFeed(null, true), + 'all_feeds' => $this->calculateEntryRepartitionPerFeed(null, false), + ); + } + + /** + * Calculates entry repartition for the selection. * The repartition includes: * - total entries * - read entries * - unread entries * - favorite entries - * - * @return type + * + * @param null|integer $feed feed id + * @param boolean $only_main + * @return array */ - public function calculateEntryRepartition() { - $repartition = array(); - - // Generates the repartition for the main stream of entry + public function calculateEntryRepartitionPerFeed($feed = null, $only_main = false) { + $filter = ''; + if ($only_main) { + $filter .= 'AND f.priority = 10'; + } + if (!is_null($feed)) { + $filter .= "AND e.id_feed = {$feed}"; + } $sql = <<<SQL -SELECT COUNT(1) AS `total`, -COUNT(1) - SUM(e.is_read) AS `unread`, -SUM(e.is_read) AS `read`, -SUM(e.is_favorite) AS `favorite` -FROM {$this->prefix}entry AS e -, {$this->prefix}feed AS f +SELECT COUNT(1) AS total, +COUNT(1) - SUM(e.is_read) AS count_unreads, +SUM(e.is_read) AS count_reads, +SUM(e.is_favorite) AS count_favorites +FROM `{$this->prefix}entry` AS e +, `{$this->prefix}feed` AS f WHERE e.id_feed = f.id -AND f.priority = 10 +{$filter} SQL; $stm = $this->bd->prepare($sql); $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - $repartition['main_stream'] = $res[0]; - // Generates the repartition for all entries + return $res[0]; + } + + /** + * Calculates entry count per day on a 30 days period. + * Returns the result as a JSON object. + * + * @return JSON object + */ + public function calculateEntryCount() { + $count = $this->initEntryCountArray(); + $midnight = mktime(0, 0, 0); + $oldest = $midnight - (self::ENTRY_COUNT_PERIOD * 86400); + + // Get stats per day for the last 30 days + $sqlDay = $this->sqlFloor("(date - $midnight) / 86400"); $sql = <<<SQL -SELECT COUNT(1) AS `total`, -COUNT(1) - SUM(e.is_read) AS `unread`, -SUM(e.is_read) AS `read`, -SUM(e.is_favorite) AS `favorite` -FROM {$this->prefix}entry AS e +SELECT {$sqlDay} AS day, +COUNT(*) as count +FROM `{$this->prefix}entry` +WHERE date >= {$oldest} AND date < {$midnight} +GROUP BY day +ORDER BY day ASC SQL; $stm = $this->bd->prepare($sql); $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - $repartition['all_feeds'] = $res[0]; - return $repartition; + foreach ($res as $value) { + $count[$value['day']] = (int) $value['count']; + } + + return $count; } /** - * Calculates entry count per day on a 30 days period. - * Returns the result as a JSON string. - * + * Initialize an array for the entry count. + * + * @return array + */ + protected function initEntryCountArray() { + return $this->initStatsArray(-self::ENTRY_COUNT_PERIOD, -1); + } + + /** + * Calculates the number of article per hour of the day per feed + * + * @param integer $feed id * @return string */ - public function calculateEntryCount() { - $count = array(); + public function calculateEntryRepartitionPerFeedPerHour($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('%H', $feed); + } + + /** + * Calculates the number of article per day of week per feed + * + * @param integer $feed id + * @return string + */ + public function calculateEntryRepartitionPerFeedPerDayOfWeek($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('%w', $feed); + } - // Generates a list of 30 last day to be sure we always have 30 days. - // If we do not do that kind of thing, we'll end up with holes in the - // days if the user do not have a lot of feeds. + /** + * Calculates the number of article per month per feed + * + * @param integer $feed + * @return string + */ + public function calculateEntryRepartitionPerFeedPerMonth($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('%m', $feed); + } + + /** + * Calculates the number of article per period per feed + * + * @param string $period format string to use for grouping + * @param integer $feed id + * @return string + */ + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + $restrict = ''; + if ($feed) { + $restrict = "WHERE e.id_feed = {$feed}"; + } $sql = <<<SQL -SELECT - (tens.val + units.val + 1) AS day -FROM ( - SELECT 0 AS val - UNION ALL SELECT 1 - UNION ALL SELECT 2 - UNION ALL SELECT 3 - UNION ALL SELECT 4 - UNION ALL SELECT 5 - UNION ALL SELECT 6 - UNION ALL SELECT 7 - UNION ALL SELECT 8 - UNION ALL SELECT 9 -) AS units -CROSS JOIN ( - SELECT 0 AS val - UNION ALL SELECT 10 - UNION ALL SELECT 20 -) AS tens -ORDER BY day ASC +SELECT DATE_FORMAT(FROM_UNIXTIME(e.date), '{$period}') AS period +, COUNT(1) AS count +FROM `{$this->prefix}entry` AS e +{$restrict} +GROUP BY period +ORDER BY period ASC SQL; + $stm = $this->bd->prepare($sql); $stm->execute(); - $res = $stm->fetchAll(PDO::FETCH_ASSOC); + $res = $stm->fetchAll(PDO::FETCH_NAMED); + + $repartition = array(); foreach ($res as $value) { - $count[$value['day']] = 0; + $repartition[(int) $value['period']] = (int) $value['count']; } - // Get stats per day for the last 30 days and applies the result on - // the array created with the last query. + return $repartition; + } + + /** + * Calculates the average number of article per hour per feed + * + * @param integer $feed id + * @return integer + */ + public function calculateEntryAveragePerFeedPerHour($feed = null) { + return $this->calculateEntryAveragePerFeedPerPeriod(1 / 24, $feed); + } + + /** + * Calculates the average number of article per day of week per feed + * + * @param integer $feed id + * @return integer + */ + public function calculateEntryAveragePerFeedPerDayOfWeek($feed = null) { + return $this->calculateEntryAveragePerFeedPerPeriod(7, $feed); + } + + /** + * Calculates the average number of article per month per feed + * + * @param integer $feed id + * @return integer + */ + public function calculateEntryAveragePerFeedPerMonth($feed = null) { + return $this->calculateEntryAveragePerFeedPerPeriod(30, $feed); + } + + /** + * Calculates the average number of article per feed + * + * @param float $period number used to divide the number of day in the period + * @param integer $feed id + * @return integer + */ + protected function calculateEntryAveragePerFeedPerPeriod($period, $feed = null) { + $restrict = ''; + if ($feed) { + $restrict = "WHERE e.id_feed = {$feed}"; + } $sql = <<<SQL -SELECT DATEDIFF(FROM_UNIXTIME(e.date), NOW()) AS day, -COUNT(1) AS count -FROM {$this->prefix}entry AS e -WHERE FROM_UNIXTIME(e.date, '%Y%m%d') BETWEEN DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -30 DAY), '%Y%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y%m%d') -GROUP BY day -ORDER BY day ASC +SELECT COUNT(1) AS count +, MIN(date) AS date_min +, MAX(date) AS date_max +FROM `{$this->prefix}entry` AS e +{$restrict} SQL; $stm = $this->bd->prepare($sql); $stm->execute(); - $res = $stm->fetchAll(PDO::FETCH_ASSOC); - - foreach ($res as $value) { - $count[$value['day']] = (int) $value['count']; + $res = $stm->fetch(PDO::FETCH_NAMED); + $date_min = new \DateTime(); + $date_min->setTimestamp($res['date_min']); + $date_max = new \DateTime(); + $date_max->setTimestamp($res['date_max']); + $interval = $date_max->diff($date_min, true); + $interval_in_days = $interval->format('%a'); + if ($interval_in_days <= 0) { + // Surely only one article. + // We will return count / (period/period) == count. + $interval_in_days = $period; } - return $this->convertToSerie($count); + return $res['count'] / ($interval_in_days / $period); + } + + /** + * Initialize an array for statistics depending on a range + * + * @param integer $min + * @param integer $max + * @return array + */ + protected function initStatsArray($min, $max) { + return array_map(function () { + return 0; + }, array_flip(range($min, $max))); } /** * Calculates feed count per category. - * Returns the result as a JSON string. - * - * @return string + * Returns the result as a JSON object. + * + * @return JSON object */ public function calculateFeedByCategory() { $sql = <<<SQL SELECT c.name AS label , COUNT(f.id) AS data -FROM {$this->prefix}category AS c, -{$this->prefix}feed AS f +FROM `{$this->prefix}category` AS c, +`{$this->prefix}feed` AS f WHERE c.id = f.category GROUP BY label ORDER BY data DESC @@ -128,22 +261,22 @@ SQL; $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - return $this->convertToPieSerie($res); + return $res; } /** * Calculates entry count per category. * Returns the result as a JSON string. - * - * @return string + * + * @return JSON object */ public function calculateEntryByCategory() { $sql = <<<SQL SELECT c.name AS label , COUNT(e.id) AS data -FROM {$this->prefix}category AS c, -{$this->prefix}feed AS f, -{$this->prefix}entry AS e +FROM `{$this->prefix}category` AS c, +`{$this->prefix}feed` AS f, +`{$this->prefix}entry` AS e WHERE c.id = f.category AND f.id = e.id_feed GROUP BY label @@ -153,12 +286,12 @@ SQL; $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - return $this->convertToPieSerie($res); + return $res; } /** * Calculates the 10 top feeds based on their number of entries - * + * * @return array */ public function calculateTopFeed() { @@ -167,12 +300,12 @@ SELECT f.id AS id , MAX(f.name) AS name , MAX(c.name) AS category , COUNT(e.id) AS count -FROM {$this->prefix}category AS c, -{$this->prefix}feed AS f, -{$this->prefix}entry AS e +FROM `{$this->prefix}category` AS c, +`{$this->prefix}feed` AS f, +`{$this->prefix}entry` AS e WHERE c.id = f.category AND f.id = e.id_feed -GROUP BY id +GROUP BY f.id ORDER BY count DESC LIMIT 10 SQL; @@ -181,25 +314,79 @@ SQL; return $stm->fetchAll(PDO::FETCH_ASSOC); } - private function convertToSerie($data) { - $serie = array(); - - foreach ($data as $key => $value) { - $serie[] = array($key, $value); - } + /** + * Calculates the last publication date for each feed + * + * @return array + */ + public function calculateFeedLastDate() { + $sql = <<<SQL +SELECT MAX(f.id) as id +, MAX(f.name) AS name +, MAX(date) AS last_date +, COUNT(*) AS nb_articles +FROM `{$this->prefix}feed` AS f, +`{$this->prefix}entry` AS e +WHERE f.id = e.id_feed +GROUP BY f.id +ORDER BY name +SQL; + $stm = $this->bd->prepare($sql); + $stm->execute(); + return $stm->fetchAll(PDO::FETCH_ASSOC); + } - return json_encode($serie); + /** + * Gets days ready for graphs + * + * @return string + */ + public function getDays() { + return $this->convertToTranslatedJson(array( + 'sun', + 'mon', + 'tue', + 'wed', + 'thu', + 'fri', + 'sat', + )); } - private function convertToPieSerie($data) { - $serie = array(); + /** + * Gets months ready for graphs + * + * @return string + */ + public function getMonths() { + return $this->convertToTranslatedJson(array( + 'jan', + 'feb', + 'mar', + 'apr', + 'may', + 'jun', + 'jul', + 'aug', + 'sep', + 'oct', + 'nov', + 'dec', + )); + } - foreach ($data as $value) { - $value['data'] = array(array(0, (int) $value['data'])); - $serie[] = $value; - } + /** + * Translates array content + * + * @param array $data + * @return JSON object + */ + private function convertToTranslatedJson($data = array()) { + $translated = array_map(function($a) { + return _t('gen.date.' . $a); + }, $data); - return json_encode($serie); + return $translated; } } diff --git a/app/Models/StatsDAOPGSQL.php b/app/Models/StatsDAOPGSQL.php new file mode 100644 index 000000000..1effbb64b --- /dev/null +++ b/app/Models/StatsDAOPGSQL.php @@ -0,0 +1,67 @@ +<?php + +class FreshRSS_StatsDAOPGSQL extends FreshRSS_StatsDAO { + + /** + * Calculates the number of article per hour of the day per feed + * + * @param integer $feed id + * @return string + */ + public function calculateEntryRepartitionPerFeedPerHour($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('hour', $feed); + } + + /** + * Calculates the number of article per day of week per feed + * + * @param integer $feed id + * @return string + */ + public function calculateEntryRepartitionPerFeedPerDayOfWeek($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('day', $feed); + } + + /** + * Calculates the number of article per month per feed + * + * @param integer $feed + * @return string + */ + public function calculateEntryRepartitionPerFeedPerMonth($feed = null) { + return $this->calculateEntryRepartitionPerFeedPerPeriod('month', $feed); + } + + /** + * Calculates the number of article per period per feed + * + * @param string $period format string to use for grouping + * @param integer $feed id + * @return string + */ + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + $restrict = ''; + if ($feed) { + $restrict = "WHERE e.id_feed = {$feed}"; + } + $sql = <<<SQL +SELECT extract( {$period} from to_timestamp(e.date)) AS period +, COUNT(1) AS count +FROM "{$this->prefix}entry" AS e +{$restrict} +GROUP BY period +ORDER BY period ASC +SQL; + + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_NAMED); + + foreach ($res as $value) { + $repartition[(int) $value['period']] = (int) $value['count']; + } + + return $repartition; + } + +} diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php new file mode 100644 index 000000000..6cfc20463 --- /dev/null +++ b/app/Models/StatsDAOSQLite.php @@ -0,0 +1,36 @@ +<?php + +class FreshRSS_StatsDAOSQLite extends FreshRSS_StatsDAO { + + protected function sqlFloor($s) { + return "CAST(($s) AS INT)"; + } + + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { + if ($feed) { + $restrict = "WHERE e.id_feed = {$feed}"; + } else { + $restrict = ''; + } + $sql = <<<SQL +SELECT strftime('{$period}', e.date, 'unixepoch') AS period +, COUNT(1) AS count +FROM `{$this->prefix}entry` AS e +{$restrict} +GROUP BY period +ORDER BY period ASC +SQL; + + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_NAMED); + + $repartition = array(); + foreach ($res as $value) { + $repartition[(int) $value['period']] = (int) $value['count']; + } + + return $repartition; + } + +} diff --git a/app/Models/Themes.php b/app/Models/Themes.php index c7099a1df..5a6ec0a05 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -31,7 +31,10 @@ class FreshRSS_Themes extends Minz_Model { if (file_exists($json_filename)) { $content = file_get_contents($json_filename); $res = json_decode($content, true); - if ($res && isset($res['files']) && is_array($res['files'])) { + if ($res && + !empty($res['name']) && + isset($res['files']) && + is_array($res['files'])) { $res['id'] = $theme_id; return $res; } @@ -70,6 +73,7 @@ class FreshRSS_Themes extends Minz_Model { 'add' => '✚', 'all' => '☰', 'bookmark' => '★', + 'bookmark-add' => '✚', 'category' => '☷', 'category-white' => '☷', 'close' => '❌', @@ -77,6 +81,9 @@ class FreshRSS_Themes extends Minz_Model { 'down' => '▽', 'favorite' => '★', 'help' => 'ⓘ', + 'icon' => '⊚', + 'import' => '⤓', + 'key' => '⚿', 'link' => '↗', 'login' => '🔒', 'logout' => '🔓', @@ -84,13 +91,18 @@ class FreshRSS_Themes extends Minz_Model { 'non-starred' => '☆', 'prev' => '⏪', 'read' => '☑', + 'rss' => '☄', 'unread' => '☐', 'refresh' => '🔃', //↻ 'search' => '🔍', 'share' => '♺', 'starred' => '★', + 'stats' => '%', 'tag' => '⚐', 'up' => '△', + 'view-normal' => '☰', + 'view-global' => '☷', + 'view-reader' => '☕', ); if (!isset($alts[$name])) { return ''; diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index a25b57f89..32bc6de2f 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -1,36 +1,97 @@ <?php class FreshRSS_UserDAO extends Minz_ModelPdo { - public function createUser($username) { - require_once(APP_PATH . '/sql.php'); - $db = Minz_Configuration::dataBase(); - - $sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_'); - $stm = $this->bd->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true)); - $values = array( - 'catName' => Minz_Translate::t('default_category'), - ); - if ($stm && $stm->execute($values)) { + public function createUser($username, $new_user_language, $insertDefaultFeeds = true) { + $db = FreshRSS_Context::$system_conf->db; + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + $userPDO = new Minz_ModelPdo($username); + + $currentLanguage = Minz_Translate::language(); + + try { + Minz_Translate::reset($new_user_language); + $ok = false; + $bd_prefix_user = $db['prefix'] . $username . '_'; + if (defined('SQL_CREATE_TABLES')) { //E.g. MySQL + $sql = sprintf(SQL_CREATE_TABLES, $bd_prefix_user, _t('gen.short.default_category')); + $stm = $userPDO->bd->prepare($sql); + $ok = $stm && $stm->execute(); + } else { //E.g. SQLite + global $SQL_CREATE_TABLES; + if (is_array($SQL_CREATE_TABLES)) { + $ok = true; + foreach ($SQL_CREATE_TABLES as $instruction) { + $sql = sprintf($instruction, $bd_prefix_user, _t('gen.short.default_category')); + $stm = $userPDO->bd->prepare($sql); + $ok &= ($stm && $stm->execute()); + } + } + } + if ($insertDefaultFeeds) { + if (defined('SQL_INSERT_FEEDS')) { //E.g. MySQL + $sql = sprintf(SQL_INSERT_FEEDS, $bd_prefix_user); + $stm = $userPDO->bd->prepare($sql); + $ok &= $stm && $stm->execute(); + } else { //E.g. SQLite + global $SQL_INSERT_FEEDS; + if (is_array($SQL_INSERT_FEEDS)) { + foreach ($SQL_INSERT_FEEDS as $instruction) { + $sql = sprintf($instruction, $bd_prefix_user); + $stm = $userPDO->bd->prepare($sql); + $ok &= ($stm && $stm->execute()); + } + } + } + } + } catch (Exception $e) { + Minz_Log::error('Error while creating user: ' . $e->getMessage()); + } + + Minz_Translate::reset($currentLanguage); + + if ($ok) { return true; } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); + $info = empty($stm) ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error: ' . $info[2]); return false; } } public function deleteUser($username) { - require_once(APP_PATH . '/sql.php'); - $db = Minz_Configuration::dataBase(); + $db = FreshRSS_Context::$system_conf->db; + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); - $sql = sprintf(SQL_DROP_TABLES, $db['prefix'] . $username . '_'); - $stm = $this->bd->prepare($sql); - if ($stm && $stm->execute()) { - return true; + if ($db['type'] === 'sqlite') { + return unlink(join_path(DATA_PATH, 'users', $username, 'db.sqlite')); } else { - $info = $stm->errorInfo(); - Minz_Log::record ('SQL error : ' . $info[2], Minz_Log::ERROR); - return false; + $userPDO = new Minz_ModelPdo($username); + + $sql = sprintf(SQL_DROP_TABLES, $db['prefix'] . $username . '_'); + $stm = $userPDO->bd->prepare($sql); + if ($stm && $stm->execute()) { + return true; + } else { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::error('SQL error : ' . $info[2]); + return false; + } + } + } + + public static function exist($username) { + return is_dir(join_path(DATA_PATH , 'users', $username)); + } + + public static function touch($username = '') { + if (($username == '') || (!ctype_alnum($username))) { + $username = Minz_Session::param('currentUser', '_'); } + return touch(join_path(DATA_PATH , 'users', $username, 'config.php')); + } + + public static function mtime($username) { + return @filemtime(join_path(DATA_PATH , 'users', $username, 'config.php')); } } diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php new file mode 100644 index 000000000..52747f538 --- /dev/null +++ b/app/Models/UserQuery.php @@ -0,0 +1,226 @@ +<?php + +/** + * Contains the description of a user query + * + * It allows to extract the meaningful bits of the query to be manipulated in an + * easy way. + */ +class FreshRSS_UserQuery { + + private $deprecated = false; + private $get; + private $get_name; + private $get_type; + private $name; + private $order; + private $search; + private $state; + private $url; + private $feed_dao; + private $category_dao; + + /** + * @param array $query + * @param FreshRSS_Searchable $feed_dao + * @param FreshRSS_Searchable $category_dao + */ + public function __construct($query, FreshRSS_Searchable $feed_dao = null, FreshRSS_Searchable $category_dao = null) { + $this->category_dao = $category_dao; + $this->feed_dao = $feed_dao; + if (isset($query['get'])) { + $this->parseGet($query['get']); + } + if (isset($query['name'])) { + $this->name = $query['name']; + } + if (isset($query['order'])) { + $this->order = $query['order']; + } + if (!isset($query['search'])) { + $query['search'] = ''; + } + // linked to deeply with the search object, need to use dependency injection + $this->search = new FreshRSS_Search($query['search']); + if (isset($query['state'])) { + $this->state = $query['state']; + } + if (isset($query['url'])) { + $this->url = $query['url']; + } + } + + /** + * Convert the current object to an array. + * + * @return array + */ + public function toArray() { + return array_filter(array( + 'get' => $this->get, + 'name' => $this->name, + 'order' => $this->order, + 'search' => $this->search->__toString(), + 'state' => $this->state, + 'url' => $this->url, + )); + } + + /** + * Parse the get parameter in the query string to extract its name and + * type + * + * @param string $get + */ + private function parseGet($get) { + $this->get = $get; + if (preg_match('/(?P<type>[acfs])(_(?P<id>\d+))?/', $get, $matches)) { + switch ($matches['type']) { + case 'a': + $this->parseAll(); + break; + case 'c': + $this->parseCategory($matches['id']); + break; + case 'f': + $this->parseFeed($matches['id']); + break; + case 's': + $this->parseFavorite(); + break; + } + } + } + + /** + * Parse the query string when it is an "all" query + */ + private function parseAll() { + $this->get_name = 'all'; + $this->get_type = 'all'; + } + + /** + * Parse the query string when it is a "category" query + * + * @param integer $id + * @throws FreshRSS_DAO_Exception + */ + private function parseCategory($id) { + if (is_null($this->category_dao)) { + throw new FreshRSS_DAO_Exception('Category DAO is not loaded in UserQuery'); + } + $category = $this->category_dao->searchById($id); + if ($category) { + $this->get_name = $category->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'category'; + } + + /** + * Parse the query string when it is a "feed" query + * + * @param integer $id + * @throws FreshRSS_DAO_Exception + */ + private function parseFeed($id) { + if (is_null($this->feed_dao)) { + throw new FreshRSS_DAO_Exception('Feed DAO is not loaded in UserQuery'); + } + $feed = $this->feed_dao->searchById($id); + if ($feed) { + $this->get_name = $feed->name(); + } else { + $this->deprecated = true; + } + $this->get_type = 'feed'; + } + + /** + * Parse the query string when it is a "favorite" query + */ + private function parseFavorite() { + $this->get_name = 'favorite'; + $this->get_type = 'favorite'; + } + + /** + * Check if the current user query is deprecated. + * It is deprecated if the category or the feed used in the query are + * not existing. + * + * @return boolean + */ + public function isDeprecated() { + return $this->deprecated; + } + + /** + * Check if the user query has parameters. + * If the type is 'all', it is considered equal to no parameters + * + * @return boolean + */ + public function hasParameters() { + if ($this->get_type === 'all') { + return false; + } + if ($this->hasSearch()) { + return true; + } + if ($this->state) { + return true; + } + if ($this->order) { + return true; + } + if ($this->get) { + return true; + } + return false; + } + + /** + * Check if there is a search in the search object + * + * @return boolean + */ + public function hasSearch() { + return $this->search->getRawInput() != ""; + } + + public function getGet() { + return $this->get; + } + + public function getGetName() { + return $this->get_name; + } + + public function getGetType() { + return $this->get_type; + } + + public function getName() { + return $this->name; + } + + public function getOrder() { + return $this->order; + } + + public function getSearch() { + return $this->search; + } + + public function getState() { + return $this->state; + } + + public function getUrl() { + return $this->url; + } + +} diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php new file mode 100644 index 000000000..a454829d5 --- /dev/null +++ b/app/SQL/install.sql.mysql.php @@ -0,0 +1,90 @@ +<?php +define('SQL_CREATE_DB', 'CREATE DATABASE IF NOT EXISTS %1$s DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'); + +define('SQL_CREATE_TABLES', ' +CREATE TABLE IF NOT EXISTS `%1$scategory` ( + `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 + `name` varchar(191) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY (`name`) -- v0.7 +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci +ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS `%1$sfeed` ( + `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 + `url` varchar(511) CHARACTER SET latin1 NOT NULL, + `category` SMALLINT DEFAULT 0, -- v0.7 + `name` varchar(191) NOT NULL, + `website` varchar(255) CHARACTER SET latin1, + `description` text, + `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 + `priority` tinyint(2) NOT NULL DEFAULT 10, + `pathEntries` varchar(511) DEFAULT NULL, + `httpAuth` varchar(511) DEFAULT NULL, + `error` boolean DEFAULT 0, + `keep_history` MEDIUMINT NOT NULL DEFAULT -2, -- v0.7 + `ttl` INT NOT NULL DEFAULT -2, -- v0.7.3 + `cache_nbEntries` int DEFAULT 0, -- v0.7 + `cache_nbUnreads` int DEFAULT 0, -- v0.7 + PRIMARY KEY (`id`), + FOREIGN KEY (`category`) REFERENCES `%1$scategory`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, + UNIQUE KEY (`url`), -- v0.7 + INDEX (`name`), -- v0.7 + INDEX (`priority`), -- v0.7 + INDEX (`keep_history`) -- v0.7 +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci +ENGINE = INNODB; + +CREATE TABLE IF NOT EXISTS `%1$sentry` ( + `id` bigint NOT NULL, -- v0.7 + `guid` varchar(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B + `title` varchar(255) NOT NULL, + `author` varchar(255), + `content_bin` blob, -- v0.7 + `link` varchar(1023) CHARACTER SET latin1 NOT NULL, + `date` int(11), -- Until year 2038 + `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 + `hash` BINARY(16), -- v1.1.1 + `is_read` boolean NOT NULL DEFAULT 0, + `is_favorite` boolean NOT NULL DEFAULT 0, + `id_feed` SMALLINT, -- v0.7 + `tags` varchar(1023), + PRIMARY KEY (`id`), + FOREIGN KEY (`id_feed`) REFERENCES `%1$sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE KEY (`id_feed`,`guid`), -- v0.7 + INDEX (`is_favorite`), -- v0.7 + INDEX (`is_read`), -- v0.7 + INDEX `entry_lastSeen_index` (`lastSeen`) -- v1.1.1 +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci +ENGINE = INNODB; + +INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s"); +'); + +define('SQL_INSERT_FEEDS', ' +INSERT IGNORE INTO `%1$sfeed` (url, category, name, website, description, ttl) VALUES("http://freshrss.org/feeds/all.atom.xml", 1, "FreshRSS.org", "http://freshrss.org/", "FreshRSS, a free, self-hostable aggregator…", 86400); +INSERT IGNORE INTO `%1$sfeed` (url, category, name, website, description, ttl) VALUES("https://github.com/FreshRSS/FreshRSS/releases.atom", 1, "FreshRSS @ GitHub", "https://github.com/FreshRSS/FreshRSS/", "FreshRSS releases @ GitHub", 86400); +'); + +define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS `%1$sentry`, `%1$sfeed`, `%1$scategory`'); + +define('SQL_UPDATE_UTF8MB4', ' +ALTER DATABASE `%2$s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +ALTER TABLE `%1$scategory` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +UPDATE `%1$scategory` SET name=SUBSTRING(name,1,190) WHERE LENGTH(name) > 191; +ALTER TABLE `%1$scategory` MODIFY `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +OPTIMIZE TABLE `%1$scategory`; + +ALTER TABLE `%1$sfeed` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +UPDATE `%1$sfeed` SET name=SUBSTRING(name,1,190) WHERE LENGTH(name) > 191; +ALTER TABLE `%1$sfeed` MODIFY `name` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `%1$sfeed` MODIFY `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +OPTIMIZE TABLE `%1$sfeed`; + +ALTER TABLE `%1$sentry` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `%1$sentry` MODIFY `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `%1$sentry` MODIFY `author` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `%1$sentry` MODIFY `tags` VARCHAR(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +OPTIMIZE TABLE `%1$sentry`; +'); diff --git a/app/SQL/install.sql.pgsql.php b/app/SQL/install.sql.pgsql.php new file mode 100644 index 000000000..9f4240b98 --- /dev/null +++ b/app/SQL/install.sql.pgsql.php @@ -0,0 +1,63 @@ +<?php +define('SQL_CREATE_DB', 'CREATE DATABASE %1$s ENCODING \'UTF8\';'); + +global $SQL_CREATE_TABLES; +$SQL_CREATE_TABLES = array( +'CREATE TABLE IF NOT EXISTS "%1$scategory" ( + "id" SERIAL PRIMARY KEY, + "name" VARCHAR(255) UNIQUE NOT NULL +);', + +'CREATE TABLE IF NOT EXISTS "%1$sfeed" ( + "id" SERIAL PRIMARY KEY, + "url" varchar(511) UNIQUE NOT NULL, + "category" SMALLINT DEFAULT 0, + "name" VARCHAR(255) NOT NULL, + "website" VARCHAR(255), + "description" text, + "lastUpdate" INT DEFAULT 0, + "priority" SMALLINT NOT NULL DEFAULT 10, + "pathEntries" VARCHAR(511) DEFAULT NULL, + "httpAuth" VARCHAR(511) DEFAULT NULL, + "error" smallint DEFAULT 0, + "keep_history" INT NOT NULL DEFAULT -2, + "ttl" INT NOT NULL DEFAULT -2, + "cache_nbEntries" INT DEFAULT 0, + "cache_nbUnreads" INT DEFAULT 0, + FOREIGN KEY ("category") REFERENCES "%1$scategory" ("id") ON DELETE SET NULL ON UPDATE CASCADE +);', +'CREATE INDEX %1$sname_index ON "%1$sfeed" ("name");', +'CREATE INDEX %1$spriority_index ON "%1$sfeed" ("priority");', +'CREATE INDEX %1$skeep_history_index ON "%1$sfeed" ("keep_history");', + +'CREATE TABLE IF NOT EXISTS "%1$sentry" ( + "id" BIGINT NOT NULL PRIMARY KEY, + "guid" VARCHAR(760) UNIQUE NOT NULL, + "title" VARCHAR(255) NOT NULL, + "author" VARCHAR(255), + "content" TEXT, + "link" VARCHAR(1023) NOT NULL, + "date" INT, + "lastSeen" INT DEFAULT 0, + "hash" BYTEA, + "is_read" SMALLINT NOT NULL DEFAULT 0, + "is_favorite" SMALLINT NOT NULL DEFAULT 0, + "id_feed" SMALLINT, + "tags" VARCHAR(1023), + FOREIGN KEY ("id_feed") REFERENCES "%1$sfeed" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE ("id_feed","guid") +);', +'CREATE INDEX %1$sis_favorite_index ON "%1$sentry" ("is_favorite");', +'CREATE INDEX %1$sis_read_index ON "%1$sentry" ("is_read");', +'CREATE INDEX %1$sentry_lastSeen_index ON "%1$sentry" ("lastSeen");', + +'INSERT INTO "%1$scategory" (name) SELECT \'%2$s\' WHERE NOT EXISTS (SELECT id FROM "%1$scategory" WHERE id = 1);', +); + +global $SQL_INSERT_FEEDS; +$SQL_INSERT_FEEDS = array( +'INSERT INTO "%1$sfeed" (url, category, name, website, description, ttl) SELECT \'http://freshrss.org/feeds/all.atom.xml\', 1, \'FreshRSS.org\', \'http://freshrss.org/\', \'FreshRSS, a free, self-hostable aggregator…\', 86400 WHERE NOT EXISTS (SELECT id FROM "%1$sfeed" WHERE url = \'http://freshrss.org/feeds/all.atom.xml\');', +'INSERT INTO "%1$sfeed" (url, category, name, website, description, ttl) SELECT \'https://github.com/FreshRSS/FreshRSS/releases.atom\', 1, \'FreshRSS @ GitHub\', \'https://github.com/FreshRSS/FreshRSS/\', \'FreshRSS releases @ GitHub\', 86400 WHERE NOT EXISTS (SELECT id FROM "%1$sfeed" WHERE url = \'https://github.com/FreshRSS/FreshRSS/releases.atom\');', +); + +define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS "%1$sentry", "%1$sfeed", "%1$scategory"'); diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php new file mode 100644 index 000000000..68d93ba92 --- /dev/null +++ b/app/SQL/install.sql.sqlite.php @@ -0,0 +1,66 @@ +<?php +global $SQL_CREATE_TABLES; +$SQL_CREATE_TABLES = array( +'CREATE TABLE IF NOT EXISTS `category` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + `name` varchar(255) NOT NULL, + UNIQUE (`name`) +);', + +'CREATE TABLE IF NOT EXISTS `feed` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + `url` varchar(511) NOT NULL, + `category` SMALLINT DEFAULT 0, + `name` varchar(255) NOT NULL, + `website` varchar(255), + `description` text, + `lastUpdate` int(11) DEFAULT 0, -- Until year 2038 + `priority` tinyint(2) NOT NULL DEFAULT 10, + `pathEntries` varchar(511) DEFAULT NULL, + `httpAuth` varchar(511) DEFAULT NULL, + `error` boolean DEFAULT 0, + `keep_history` MEDIUMINT NOT NULL DEFAULT -2, + `ttl` INT NOT NULL DEFAULT -2, + `cache_nbEntries` int DEFAULT 0, + `cache_nbUnreads` int DEFAULT 0, + FOREIGN KEY (`category`) REFERENCES `category`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, + UNIQUE (`url`) +);', + +'CREATE INDEX IF NOT EXISTS feed_name_index ON `feed`(`name`);', +'CREATE INDEX IF NOT EXISTS feed_priority_index ON `feed`(`priority`);', +'CREATE INDEX IF NOT EXISTS feed_keep_history_index ON `feed`(`keep_history`);', + +'CREATE TABLE IF NOT EXISTS `entry` ( + `id` bigint NOT NULL, + `guid` varchar(760) NOT NULL, + `title` varchar(255) NOT NULL, + `author` varchar(255), + `content` text, + `link` varchar(1023) NOT NULL, + `date` int(11), -- Until year 2038 + `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 + `hash` BINARY(16), -- v1.1.1 + `is_read` boolean NOT NULL DEFAULT 0, + `is_favorite` boolean NOT NULL DEFAULT 0, + `id_feed` SMALLINT, + `tags` varchar(1023), + PRIMARY KEY (`id`), + FOREIGN KEY (`id_feed`) REFERENCES `feed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, + UNIQUE (`id_feed`,`guid`) +);', + +'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `entry`(`is_favorite`);', +'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `entry`(`is_read`);', +'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `entry`(`lastSeen`);', //v1.1.1 + +'INSERT OR IGNORE INTO `category` (id, name) VALUES(1, "%2$s");', +); + +global $SQL_INSERT_FEEDS; +$SQL_INSERT_FEEDS = array( +'INSERT OR IGNORE INTO `feed` (url, category, name, website, description, ttl) VALUES("http://freshrss.org/feeds/all.atom.xml", 1, "FreshRSS.org", "http://freshrss.org/", "FreshRSS, a free, self-hostable aggregator…", 86400);', +'INSERT OR IGNORE INTO `feed` (url, category, name, website, description, ttl) VALUES("https://github.com/FreshRSS/FreshRSS/releases.atom", 1, "FreshRSS releases", "https://github.com/FreshRSS/FreshRSS/", "FreshRSS releases @ GitHub", 86400);', +); + +define('SQL_DROP_TABLES', 'DROP TABLE IF EXISTS entry, feed, category'); diff --git a/app/actualize_script.php b/app/actualize_script.php index 8d81e0189..deaa1bf7c 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -7,49 +7,81 @@ ob_implicit_flush(false); ob_start(); echo 'Results: ', "\n"; //Buffered -Minz_Configuration::init(); +if (defined('STDOUT')) { + $begin_date = date_create('now'); + fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered +} + + +// Set the header params ($_GET) to call the FRSS application. +$_GET['c'] = 'feed'; +$_GET['a'] = 'actualize'; +$_GET['ajax'] = 1; +$_GET['force'] = true; +$_SERVER['HTTP_HOST'] = ''; + + +$log_file = join_path(USERS_PATH, '_', 'log.txt'); + + +$app = new FreshRSS(); + +$system_conf = Minz_Configuration::get('system'); +$system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) +FreshRSS_Context::$isCli = true; +// Create the list of users to actualize. +// Users are processed in a random order but always start with admin $users = listUsers(); -shuffle($users); //Process users in random order -array_unshift($users, Minz_Configuration::defaultUser()); //But always start with admin -$users = array_unique($users); +shuffle($users); +if ($system_conf->default_user !== '') { + array_unshift($users, $system_conf->default_user); + $users = array_unique($users); +} + -foreach ($users as $myUser) { - syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser); +$limits = $system_conf->limits; +$min_last_activity = time() - $limits['max_inactivity']; +foreach ($users as $user) { + if (($user !== $system_conf->default_user) && + (FreshRSS_UserDAO::mtime($user) < $min_last_activity)) { + Minz_Log::notice('FreshRSS skip inactive user ' . $user, $log_file); + if (defined('STDOUT')) { + fwrite(STDOUT, 'FreshRSS skip inactive user ' . $user . "\n"); //Unbuffered + } + continue; + } + Minz_Log::notice('FreshRSS actualize ' . $user, $log_file); if (defined('STDOUT')) { - fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered + fwrite(STDOUT, 'Actualize ' . $user . "...\n"); //Unbuffered } - echo $myUser, ' '; //Buffered + echo $user, ' '; //Buffered - $_GET['c'] = 'feed'; - $_GET['a'] = 'actualize'; - $_GET['ajax'] = 1; - $_GET['force'] = true; - $_SERVER['HTTP_HOST'] = ''; - $freshRSS = new FreshRSS(); - $freshRSS->_useOb(false); + Minz_Session::_param('currentUser', $user); + new Minz_ModelPdo($user); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init + FreshRSS_Auth::giveAccess(); + $app->init(); + $app->run(); - Minz_Configuration::_authType('none'); - - Minz_Session::init('FreshRSS'); - Minz_Session::_param('currentUser', $myUser); - - $freshRSS->init(); - $freshRSS->run(); if (!invalidateHttpCache()) { - syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . LOG_PATH . '/*.log!'); + Minz_Log::notice('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'), + $log_file); if (defined('STDERR')) { - fwrite(STDERR, 'Write access problem in ' . LOG_PATH . '/*.log!' . "\n"); + fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n"); } } - Minz_Session::unset_session(true); - Minz_ModelPdo::clean(); } -syslog(LOG_INFO, 'FreshRSS actualize done.'); + + +Minz_Log::notice('FreshRSS actualize done.', $log_file); if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); + $end_date = date_create('now'); + $duration = date_diff($end_date, $begin_date); + fwrite(STDOUT, 'Ending feed actualization at ' . $end_date->format('c') . "\n"); //Unbuffered + fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%a day(s), %h hour(s), %i minute(s) and %s seconds') . ' for ' . count($users) . " users\n"); //Unbuffered } echo 'End.', "\n"; ob_end_flush(); diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php new file mode 100644 index 000000000..63cee3cca --- /dev/null +++ b/app/i18n/cz/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Umožnit anonymně číst články výchozího uživatele (%s)', + 'allow_anonymous_refresh' => 'Umožnit anonymní obnovení článků', + 'api_enabled' => 'Povolit přístup k <abbr>API</abbr> <small>(vyžadováno mobilními aplikacemi)</small>', + 'form' => 'Webový formulář (tradiční, vyžaduje JavaScript)', + 'http' => 'HTTP (pro pokročilé uživatele s HTTPS)', + 'none' => 'Žádný (nebezpečné)', + 'title' => 'Přihlášení', + 'title_reset' => 'Reset přihlášení', + 'token' => 'Authentizační token', + 'token_help' => 'Umožňuje přístup k RSS kanálu článků výchozího uživatele bez přihlášení:', + 'type' => 'Způsob přihlášení', + 'unsafe_autologin' => 'Povolit nebezpečné automatické přihlášení přes: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/cache</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', + ), + 'categories' => array( + 'nok' => 'Tabulka kategorií je nastavena špatně.', + 'ok' => 'Tabulka kategorií je v pořádku.', + ), + 'connection' => array( + 'nok' => 'Nelze navázat spojení s databází.', + 'ok' => 'Připojení k databázi je v pořádku.', + ), + 'ctype' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro ověřování znaků (php-ctype).', + 'ok' => 'Máte požadovanou knihovnu pro ověřování znaků (ctype).', + ), + 'curl' => array( + 'nok' => 'Nemáte cURL (balíček php-curl).', + 'ok' => 'Máte rozšíření cURL.', + ), + 'data' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře data jsou v pořádku.', + ), + 'database' => 'Instalace databáze', + 'dom' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro procházení DOM (balíček php-xml).', + 'ok' => 'Máte požadovanou knihovnu pro procházení DOM.', + ), + 'entries' => array( + 'nok' => 'Tabulka článků je nastavena špatně.', + 'ok' => 'Tabulka kategorií je v pořádku.', + ), + 'favicons' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/favicons</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře favicons jsou v pořádku.', + ), + 'feeds' => array( + 'nok' => 'Tabulka kanálů je nastavena špatně.', + 'ok' => 'Tabulka kanálů je v pořádku.', + ), + 'fileinfo' => array( + 'nok' => 'Nemáte PHP fileinfo (balíček fileinfo).', + 'ok' => 'Máte rozšíření fileinfo.', + ), + 'files' => 'Instalace souborů', + 'json' => array( + 'nok' => 'Nemáte JSON (balíček php5-json).', + 'ok' => 'Máte rozšíření JSON.', + ), + 'minz' => array( + 'nok' => 'Nemáte framework Minz.', + 'ok' => 'Máte framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro regulární výrazy (php-pcre).', + 'ok' => 'Máte požadovanou knihovnu pro regulární výrazy (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Nemáte PDO nebo některý z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Máte PDO a alespoň jeden z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP instalace', + 'nok' => 'Vaše verze PHP je %s, ale FreshRSS vyžaduje alespoň verzi %s.', + 'ok' => 'Vaše verze PHP je %s a je kompatibilní s FreshRSS.', + ), + 'tables' => array( + 'nok' => 'V databázi chybí jedna nevo více tabulek.', + 'ok' => 'V databázi jsou všechny tabulky.', + ), + 'title' => 'Kontrola instalace', + 'tokens' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/tokens</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře tokens jsou v pořádku.', + ), + 'users' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/users</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře users jsou v pořádku.', + ), + 'zip' => array( + 'nok' => 'Nemáte rozšíření ZIP (balíček php-zip).', + 'ok' => 'Máte rozšíření ZIP.', + ), + ), + 'extensions' => array( + 'disabled' => 'Vypnuto', + 'empty_list' => 'Není naistalováno žádné rozšíření', + 'enabled' => 'Zapnuto', + 'no_configure_view' => 'Toto rozšíření nemá žádné možnosti nastavení.', + 'system' => array( + '_' => 'Systémová rozšíření', + 'no_rights' => 'Systémová rozšíření (na ně nemáte oprávnění)', + ), + 'title' => 'Rozšíření', + 'user' => 'Uživatelská rozšíření', + ), + 'stats' => array( + '_' => 'Statistika', + 'all_feeds' => 'Všechny kanály', + 'category' => 'Kategorie', + 'entry_count' => 'Počet článků', + 'entry_per_category' => 'Článků na kategorii', + 'entry_per_day' => 'Článků za den (posledních 30 dní)', + 'entry_per_day_of_week' => 'Za den v týdnu (průměr: %.2f zprávy)', + 'entry_per_hour' => 'Za hodinu (průměr: %.2f zprávy)', + 'entry_per_month' => 'Za měsíc (průměr: %.2f zprávy)', + 'entry_repartition' => 'Rozdělení článků', + 'feed' => 'Kanál', + 'feed_per_category' => 'Článků na kategorii', + 'idle' => 'Neaktivní kanály', + 'main' => 'Přehled', + 'main_stream' => 'Všechny kanály', + 'menu' => array( + 'idle' => 'Neaktivní kanály', + 'main' => 'Přehled', + 'repartition' => 'Rozdělení článků', + ), + 'no_idle' => 'Žádné neaktivní kanály!', + 'number_entries' => '%d článků', + 'percent_of_total' => '%% ze všech', + 'repartition' => 'Rozdělení článků', + 'status_favorites' => 'Oblíbené', + 'status_read' => 'Přečtené', + 'status_total' => 'Celkem', + 'status_unread' => 'Nepřečtené', + 'title' => 'Statistika', + 'top_feed' => 'Top ten kanálů', + ), + 'system' => array( + '_' => 'System configuration', // @todo translate + 'auto-update-url' => 'Auto-update server URL', // @todo translate + 'instance-name' => 'Instance name', // @todo translate + 'max-categories' => 'Categories per user limit', // @todo translate + 'max-feeds' => 'Feeds per user limit', // @todo translate + 'registration' => array( + 'help' => '0 znamená žádná omezení účtu', + 'number' => 'Maximální počet účtů', + ), + ), + 'update' => array( + '_' => 'Aktualizace systému', + 'apply' => 'Použít', + 'check' => 'Zkontrolovat aktualizace', + 'current_version' => 'Vaše instalace FreshRSS je verze %s.', + 'last' => 'Poslední kontrola: %s', + 'none' => 'Žádné nové aktualizace', + 'title' => 'Aktualizovat systém', + ), + 'user' => array( + 'articles_and_size' => '%s článků (%s)', + 'create' => 'Vytvořit nového uživatele', + 'language' => 'Jazyk', + 'number' => 'Zatím je vytvořen %d účet', + 'numbers' => 'Zatím je vytvořeno %d účtů', + 'password_form' => 'Heslo<br /><small>(pro přihlášení webovým formulářem)</small>', + 'password_format' => 'Alespoň 7 znaků', + 'title' => 'Správa uživatelů', + 'user_list' => 'Seznam uživatelů', + 'username' => 'Přihlašovací jméno', + 'users' => 'Uživatelé', + ), +); diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php new file mode 100644 index 000000000..ec25f988c --- /dev/null +++ b/app/i18n/cz/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archivace', + 'advanced' => 'Pokročilé', + 'delete_after' => 'Smazat články starší než', + 'help' => 'Více možností je dostupných v nastavení jednotlivých kanálů', + 'keep_history_by_feed' => 'Zachovat tento minimální počet článků v každém kanálu', + 'optimize' => 'Optimalizovat databázi', + 'optimize_help' => 'Občasná údržba zmenší velikost databáze', + 'purge_now' => 'Vyčistit nyní', + 'title' => 'Archivace', + 'ttl' => 'Neaktualizovat častěji než', + ), + 'display' => array( + '_' => 'Zobrazení', + 'icon' => array( + 'bottom_line' => 'Spodní řádek', + 'entry' => 'Ikony článků', + 'publication_date' => 'Datum vydání', + 'related_tags' => 'Související tagy', + 'sharing' => 'Sdílení', + 'top_line' => 'Horní řádek', + ), + 'language' => 'Jazyk', + 'notif_html5' => array( + 'seconds' => 'sekund (0 znamená žádný timeout)', + 'timeout' => 'Timeout HTML5 notifikací', + ), + 'theme' => 'Vzhled', + 'title' => 'Zobrazení', + 'width' => array( + 'content' => 'Šířka obsahu', + 'large' => 'Velká', + 'medium' => 'Střední', + 'no_limit' => 'Bez limitu', + 'thin' => 'Tenká', + ), + ), + 'query' => array( + '_' => 'Uživatelské dotazy', + 'deprecated' => 'Tento dotaz již není platný. Odkazovaná kategorie nebo kanál byly smazány.', + 'filter' => 'Filtr aplikován:', + 'get_all' => 'Zobrazit všechny články', + 'get_category' => 'Zobrazit "%s" kategorii', + 'get_favorite' => 'Zobrazit oblíbené články', + 'get_feed' => 'Zobrazit "%s" článkek', + 'no_filter' => 'Zrušit filtr', + 'none' => 'Ještě jste nevytvořil žádný uživatelský dotaz.', + 'number' => 'Dotaz n°%d', + 'order_asc' => 'Zobrazit nejdříve nejstarší články', + 'order_desc' => 'Zobrazit nejdříve nejnovější články', + 'search' => 'Hledat "%s"', + 'state_0' => 'Zobrazit všechny články', + 'state_1' => 'Zobrazit přečtené články', + 'state_2' => 'Zobrazit nepřečtené články', + 'state_3' => 'Zobrazit všechny články', + 'state_4' => 'Zobrazit oblíbené články', + 'state_5' => 'Zobrazit oblíbené přečtené články', + 'state_6' => 'Zobrazit oblíbené nepřečtené články', + 'state_7' => 'Zobrazit oblíbené články', + 'state_8' => 'Zobrazit všechny články vyjma oblíbených', + 'state_9' => 'Zobrazit všechny přečtené články vyjma oblíbených', + 'state_10' => 'Zobrazit všechny nepřečtené články vyjma oblíbených', + 'state_11' => 'Zobrazit všechny články vyjma oblíbených', + 'state_12' => 'Zobrazit všechny články', + 'state_13' => 'Zobrazit přečtené články', + 'state_14' => 'Zobrazit nepřečtené články', + 'state_15' => 'Zobrazit všechny články', + 'title' => 'Uživatelské dotazy', + ), + 'profile' => array( + '_' => 'Správa profilu', + 'delete' => array( + '_' => 'Smazání účtu', + 'warn' => 'Váš účet bude smazán spolu se všemi souvisejícími daty', + ), + 'password_api' => 'Password API<br /><small>(tzn. pro mobilní aplikace)</small>', + 'password_form' => 'Heslo<br /><small>(pro přihlášení webovým formulářem)</small>', + 'password_format' => 'Alespoň 7 znaků', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Čtení', + 'after_onread' => 'Po “označit vše jako přečtené”,', + 'articles_per_page' => 'Počet článků na stranu', + 'auto_load_more' => 'Načítat další články dole na stránce', + 'auto_remove_article' => 'Po přečtení články schovat', + 'mark_updated_article_unread' => 'Označte aktualizované položky jako nepřečtené', + 'confirm_enabled' => 'Vyžadovat potvrzení pro akci “označit vše jako přečtené”', + 'display_articles_unfolded' => 'Ve výchozím stavu zobrazovat články otevřené', + 'display_categories_unfolded' => 'Ve výchozím stavu zobrazovat kategorie zavřené', + 'hide_read_feeds' => 'Schovat kategorie a kanály s nulovým počtem nepřečtených článků (nefunguje s nastavením “Zobrazit všechny články”)', + 'img_with_lazyload' => 'Použít "lazy load" mód pro načítaní obrázků', + 'jump_next' => 'skočit na další nepřečtený (kanál nebo kategorii)', + 'number_divided_when_reader' => 'V režimu “Čtení” děleno dvěma.', + 'read' => array( + 'article_open_on_website' => 'když je otevřen původní web s článkem', + 'article_viewed' => 'během čtení článku', + 'scroll' => 'během skrolování', + 'upon_reception' => 'po načtení článku', + 'when' => 'Označit článek jako přečtený…', + ), + 'show' => array( + '_' => 'Počet zobrazených článků', + 'adaptive' => 'Vyberte zobrazení', + 'all_articles' => 'Zobrazit všechny články', + 'unread' => 'Zobrazit jen nepřečtené', + ), + 'sort' => array( + '_' => 'Řazení', + 'newer_first' => 'Nejdříve nejnovější', + 'older_first' => 'Nejdříve nejstarší', + ), + 'sticky_post' => 'Při otevření posunout článek nahoru', + 'title' => 'Čtení', + 'view' => array( + 'default' => 'Výchozí', + 'global' => 'Přehled', + 'normal' => 'Normální', + 'reader' => 'Čtení', + ), + ), + 'sharing' => array( + '_' => 'Sdílení', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Více informací', + 'print' => 'Tisk', + 'shaarli' => 'Shaarli', + 'share_name' => 'Jméno pro zobrazení', + 'share_url' => 'Jakou URL použít pro sdílení', + 'title' => 'Sdílení', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Zkratky', + 'article_action' => 'Články - akce', + 'auto_share' => 'Sdílet', + 'auto_share_help' => 'Je-li nastavena pouze jedna možnost sdílení, bude použita. Další možnosti jsou dostupné pomocí jejich čísla.', + 'close_dropdown' => 'Zavřít menu', + 'collapse_article' => 'Srolovat', + 'first_article' => 'Skočit na první článek', + 'focus_search' => 'Hledání', + 'help' => 'Zobrazit documentaci', + 'javascript' => 'Pro použití zkratek musí být povolen JavaScript', + 'last_article' => 'Skočit na poslední článek', + 'load_more' => 'Načíst více článků', + 'mark_read' => 'Označit jako přečtené', + 'mark_favorite' => 'Označit jako oblíbené', + 'navigation' => 'Navigace', + 'navigation_help' => 'Pomocí přepínače "Shift" fungují navigační zkratky v rámci kanálů.<br/>Pomocí přepínače "Alt" fungují v rámci kategorií.', + 'next_article' => 'Skočit na další článek', + 'other_action' => 'Ostatní akce', + 'previous_article' => 'Skočit na předchozí článek', + 'see_on_website' => 'Navštívit původní webovou stránku', + 'shift_for_all_read' => '+ <code>shift</code> označí vše jako přečtené', + 'title' => 'Zkratky', + 'user_filter' => 'Aplikovat uživatelské filtry', + 'user_filter_help' => 'Je-li nastaven pouze jeden filtr, bude použit. Další filtry jsou dostupné pomocí jejich čísla.', + ), + 'user' => array( + 'articles_and_size' => '%s článků (%s)', + 'current' => 'Aktuální uživatel', + 'is_admin' => 'je administrátor', + 'users' => 'Uživatelé', + ), +); diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php new file mode 100644 index 000000000..f2bd87c77 --- /dev/null +++ b/app/i18n/cz/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimalizace dokončena', + ), + 'access' => array( + 'denied' => 'Nemáte oprávnění přistupovat na tuto stránku', + 'not_found' => 'Tato stránka neexistuje', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Nastal problém s konfigurací přihlašovacího systému. Zkuste to prosím později.', + 'set' => 'Webový formulář je nyní výchozí přihlašovací systém.', + ), + 'login' => array( + 'invalid' => 'Login není platný', + 'success' => 'Jste přihlášen', + ), + 'logout' => array( + 'success' => 'Jste odhlášen', + ), + 'no_password_set' => 'Heslo administrátora nebylo nastaveno. Tato funkce není k dispozici.', + ), + 'conf' => array( + 'error' => 'Během ukládání nastavení došlo k chybě', + 'query_created' => 'Dotaz "%s" byl vytvořen.', + 'shortcuts_updated' => 'Zkratky byly aktualizovány', + 'updated' => 'Nastavení bylo aktualizováno', + ), + 'extensions' => array( + 'already_enabled' => '%s je již zapnut', + 'disable' => array( + 'ko' => '%s nelze vypnout. Pro více detailů <a href="%s">zkontrolujte logy FressRSS</a>.', + 'ok' => '%s je nyní vypnut', + ), + 'enable' => array( + 'ko' => '%s nelze zapnout. Pro více detailů <a href="%s">zkontrolujte logy FressRSS</a>.', + 'ok' => '%s je nyní zapnut', + ), + 'no_access' => 'Nemáte přístup k %s', + 'not_enabled' => '%s není ještě zapnut', + 'not_found' => '%s neexistuje', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Na serveru není naistalována podpora ZIP. Zkuste prosím exportovat soubory jeden po druhém.', + 'feeds_imported' => 'Vaše kanály byly naimportovány a nyní budou aktualizovány', + 'feeds_imported_with_errors' => 'Vaše kanály byly naimportovány, došlo ale k nějakým chybám', + 'file_cannot_be_uploaded' => 'Soubor nelze nahrát!', + 'no_zip_extension' => 'Na serveru není naistalována podpora ZIP.', + 'zip_error' => 'Během importu ZIP souboru došlo k chybě.', + ), + 'sub' => array( + 'actualize' => 'Aktualizovat', + 'category' => array( + 'created' => 'Kategorie %s byla vytvořena.', + 'deleted' => 'Kategorie byla smazána.', + 'emptied' => 'Kategorie byla vyprázdněna', + 'error' => 'Kategorii nelze aktualizovat', + 'name_exists' => 'Název kategorie již existuje.', + 'no_id' => 'Musíte upřesnit id kategorie.', + 'no_name' => 'Název kategorie nemůže být prázdný.', + 'not_delete_default' => 'Nelze smazat výchozí kategorii!', + 'not_exist' => 'Tato kategorie neexistuje!', + 'over_max' => 'Dosáhl jste maximálního počtu kategorií (%d)', + 'updated' => 'Kategorie byla aktualizována.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> bylo aktualizováno', + 'actualizeds' => 'RSS kanály byly aktualizovány', + 'added' => 'RSS kanál <em>%s</em> byl přidán', + 'already_subscribed' => 'Již jste přihlášen k odběru <em>%s</em>', + 'deleted' => 'Kanál byl smazán', + 'error' => 'Kanál nelze aktualizovat', + 'internal_problem' => 'RSS kanál nelze přidat. Pro detaily <a href="%s">zkontrolujte logy FressRSS</a>.', + 'invalid_url' => 'URL <em>%s</em> není platné', + 'marked_read' => 'Kanály byly označeny jako přečtené', + 'n_actualized' => '%d kanálů bylo aktualizováno', + 'n_entries_deleted' => '%d článků bylo smazáno', + 'no_refresh' => 'Nelze obnovit žádné kanály…', + 'not_added' => '<em>%s</em> nemůže být přidán', + 'over_max' => 'Dosáhl jste maximálního počtu kanálů (%d)', + 'updated' => 'Kanál byl aktualizován', + ), + 'purge_completed' => 'Vyprázdněno (smazáno %d článků)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS bude nyní upgradováno na <strong>verzi %s</strong>.', + 'error' => 'Během upgrade došlo k chybě: %s', + 'file_is_nok' => 'Zkontrolujte oprávnění adresáře <em>%s</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'finished' => 'Upgrade hotov!', + 'none' => 'Novější verze není k dispozici', + 'server_not_found' => 'Nelze nalézt server s instalačním souborem. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Uživatel %s byl vytvořen', + 'error' => 'Uživatele %s nelze vytvořit', + ), + 'deleted' => array( + '_' => 'Uživatel %s byl smazán', + 'error' => 'Uživatele %s nelze smazat', + ), + ), + 'profile' => array( + 'error' => 'Váš profil nelze změnit', + 'updated' => 'Váš profil byl změněn', + ), +); diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php new file mode 100644 index 000000000..3db3a31da --- /dev/null +++ b/app/i18n/cz/gen.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Aktualizovat', + 'back_to_rss_feeds' => '← Zpět na seznam RSS kanálů', + 'cancel' => 'Zrušit', + 'create' => 'Vytvořit', + 'disable' => 'Zakázat', + 'empty' => 'Vyprázdnit', + 'enable' => 'Povolit', + 'export' => 'Export', + 'filter' => 'Filtrovat', + 'import' => 'Import', + 'manage' => 'Spravovat', + 'mark_read' => 'Označit jako přečtené', + 'mark_favorite' => 'Označit jako oblíbené', + 'remove' => 'Odstranit', + 'see_website' => 'Navštívit WWW stránku', + 'submit' => 'Odeslat', + 'truncate' => 'Smazat všechny články', + ), + 'auth' => array( + 'email' => 'Email', + 'keep_logged_in' => 'Zapamatovat přihlášení <small>(%s dny)</small>', + 'login' => 'Login', + 'logout' => 'Odhlášení', + 'password' => array( + '_' => 'Heslo', + 'format' => '<small>Alespoň 7 znaků</small>', + ), + 'registration' => array( + '_' => 'Nový účet', + 'ask' => 'Vytvořit účet?', + 'title' => 'Vytvoření účtu', + ), + 'reset' => 'Reset přihlášení', + 'username' => array( + '_' => 'Uživatel', + 'admin' => 'Název administrátorského účtu', + 'format' => '<small>maximálně 16 alfanumerických znaků</small>', + ), + ), + 'date' => array( + 'Apr' => '\\D\\u\\b\\e\\n', + 'Aug' => '\\S\\r\\p\\e\\n', + 'Dec' => '\\P\\r\\o\\s\\i\\n\\e\\c', + 'Feb' => '\\Ú\\n\\o\\r', + 'Jan' => '\\L\\e\\d\\e\\n', + 'Jul' => '\\Č\\e\\r\\v\\e\\n\\e\\c', + 'Jun' => '\\Č\\e\\r\\v\\e\\n', + 'Mar' => '\\B\\ř\\e\\z\\e\\n', + 'May' => '\\K\\v\\ě\\t\\e\\n', + 'Nov' => '\\L\\i\\s\\t\\o\\p\\a\\d', + 'Oct' => '\\Ř\\í\\j\\e\\n', + 'Sep' => '\\Z\\á\\ř\\í', + 'apr' => 'dub', + 'april' => 'Dub', + 'aug' => 'srp', + 'august' => 'Srp', + 'before_yesterday' => 'Předevčírem', + 'dec' => 'pro', + 'december' => 'Pro', + 'feb' => 'úno', + 'february' => 'Úno', + 'format_date' => 'j\\. %s Y', + 'format_date_hour' => 'j\\. %s Y \\v H\\:i', + 'fri' => 'Pá', + 'jan' => 'led', + 'january' => 'Led', + 'jul' => 'čvn', + 'july' => 'Čvn', + 'jun' => 'čer', + 'june' => 'Čer', + 'last_3_month' => 'Minulé tři měsíce', + 'last_6_month' => 'Minulých šest měsíců', + 'last_month' => 'Minulý měsíc', + 'last_week' => 'Minulý týden', + 'last_year' => 'Minulý rok', + 'mar' => 'bře', + 'march' => 'Bře', + 'may' => 'Kvě', + 'mon' => 'Po', + 'month' => 'měsíce', + 'nov' => 'lis', + 'november' => 'Lis', + 'oct' => 'říj', + 'october' => 'Říj', + 'sat' => 'So', + 'sep' => 'zář', + 'september' => 'Zář', + 'sun' => 'Ne', + 'thu' => 'Čt', + 'today' => 'Dnes', + 'tue' => 'Út', + 'wed' => 'St', + 'yesterday' => 'Včera', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'O FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Prázdná kategorie', + 'confirm_action' => 'Jste si jist, že chcete provést tuto akci? Změny nelze vrátit zpět!', + 'confirm_action_feed_cat' => 'Jste si jist, že chcete provést tuto akci? Přijdete o související oblíbené položky a uživatelské dotazy. Změny nelze vrátit zpět!', + 'feedback' => array( + 'body_new_articles' => 'Je %%d nových článků k přečtení v FreshRSS.', + 'request_failed' => 'Požadavek selhal, což může být způsobeno problémy s připojení k internetu.', + 'title_new_articles' => 'FreshRSS: nové články!', + ), + 'new_article' => 'Jsou k dispozici nové články, stránku obnovíte kliknutím zde.', + 'should_be_activated' => 'JavaScript musí být povolen', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'O aplikaci', + 'admin' => 'Administrace', + 'archiving' => 'Archivace', + 'authentication' => 'Přihlášení', + 'check_install' => 'Ověření instalace', + 'configuration' => 'Nastavení', + 'display' => 'Zobrazení', + 'extensions' => 'Rozšíření', + 'logs' => 'Logy', + 'queries' => 'Uživatelské dotazy', + 'reading' => 'Čtení', + 'search' => 'Hledat výraz nebo #tagy', + 'sharing' => 'Sdílení', + 'shortcuts' => 'Zkratky', + 'stats' => 'Statistika', + 'system' => 'System configuration',// @todo translate + 'update' => 'Aktualizace', + 'user_management' => 'Správa uživatelů', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'První', + 'last' => 'Poslední', + 'load_more' => 'Načíst více článků', + 'mark_all_read' => 'Označit vše jako přečtené', + 'next' => 'Další', + 'nothing_to_load' => 'Žádné nové články', + 'previous' => 'Předchozí', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Tisk', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Upozornění!', + 'blank_to_disable' => 'Zakázat - ponechte prázdné', + 'by_author' => 'Od <em>%s</em>', + 'by_default' => 'Výchozí', + 'damn' => 'Sakra!', + 'default_category' => 'Nezařazeno', + 'no' => 'Ne', + 'ok' => 'Ok!', + 'or' => 'nebo', + 'yes' => 'Ano', + ), +); diff --git a/app/i18n/cz/index.php b/app/i18n/cz/index.php new file mode 100644 index 000000000..cb0e5955d --- /dev/null +++ b/app/i18n/cz/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'O FreshRSS', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Hlášení chyb', + 'credits' => 'Poděkování', + 'credits_content' => 'Některé designové prvky pocházejí z <a href="http://twitter.github.io/bootstrap/">Bootstrap</a>, FreshRSS ale tuto platformu nevyužívá. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Ikony</a> pocházejí z <a href="https://www.gnome.org/">GNOME projektu</a>. Font <em>Open Sans</em> vytvořil <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS je založen na PHP framework <a href="https://github.com/marienfressinaud/MINZ">Minz</a>.', + 'freshrss_description' => 'FreshRSS je čtečka RSS kanálů určená k provozu na vlastním serveru, podobná <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> nebo <a href="http://projet.idleman.fr/leed/">Leed</a>. Je to nenáročný a jednoduchý, zároveň ale mocný a konfigurovatelný nástroj.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">na Github</a>', + 'license' => 'Licence', + 'project_website' => 'Stránka projektu', + 'title' => 'O FreshRSS', + 'version' => 'Verze', + 'website' => 'Webové stránka', + ), + 'feed' => array( + 'add' => 'Můžete přidat kanály.', + 'empty' => 'Žádné články k zobrazení.', + 'rss_of' => 'RSS kanál %s', + 'title' => 'RSS kanály', + 'title_global' => 'Přehled', + 'title_fav' => 'Oblíbené', + ), + 'log' => array( + '_' => 'Logy', + 'clear' => 'Vymazat logy', + 'empty' => 'Log je prázdný', + 'title' => 'Logy', + ), + 'menu' => array( + 'about' => 'O FreshRSS', + 'add_query' => 'Vytvořit dotaz', + 'before_one_day' => 'Den nazpět', + 'before_one_week' => 'Před týdnem', + 'favorites' => 'Oblíbené (%s)', + 'global_view' => 'Přehled', + 'main_stream' => 'Všechny kanály', + 'mark_all_read' => 'Označit vše jako přečtené', + 'mark_cat_read' => 'Označit kategorii jako přečtenou', + 'mark_feed_read' => 'Označit kanál jako přečtený', + 'newer_first' => 'Nové nejdříve', + 'non-starred' => 'Zobrazit vše vyjma oblíbených', + 'normal_view' => 'Normální', + 'older_first' => 'Nejstarší nejdříve', + 'queries' => 'Uživatelské dotazy', + 'read' => 'Zobrazovat přečtené', + 'reader_view' => 'Čtení', + 'rss_view' => 'RSS kanál', + 'search_short' => 'Hledat', + 'starred' => 'Zobrazit oblíbené', + 'stats' => 'Statistika', + 'subscription' => 'Správa subskripcí', + 'unread' => 'Zobrazovat nepřečtené', + ), + 'share' => 'Sdílet', + 'tag' => array( + 'related' => 'Související tagy', + ), +); diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php new file mode 100644 index 000000000..ea4812ea5 --- /dev/null +++ b/app/i18n/cz/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Dokončit instalaci', + 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'keep_install' => 'Zachovat předchozí instalaci', + 'next_step' => 'Přejít na další krok', + 'reinstall' => 'Reinstalovat FreshRSS', + ), + 'auth' => array( + 'form' => 'Webový formulář (tradiční, vyžaduje JavaScript)', + 'http' => 'HTTP (pro pokročilé uživatele s HTTPS)', + 'none' => 'Žádný (nebezpečné)', + 'password_form' => 'Heslo<br /><small>(pro přihlášení webovým formulářem)</small>', + 'password_format' => 'Alespoň 7 znaků', + 'type' => 'Způsob přihlášení', + ), + 'bdd' => array( + '_' => 'Databáze', + 'conf' => array( + '_' => 'Nastavení databáze', + 'ko' => 'Ověřte informace o databázi.', + 'ok' => 'Nastavení databáze bylo uloženo.', + ), + 'host' => 'Hostitel', + 'prefix' => 'Prefix tabulky', + 'password' => 'Heslo', + 'type' => 'Typ databáze', + 'username' => 'Uživatel', + ), + 'check' => array( + '_' => 'Kontrola', + 'already_installed' => 'Zjistili jsme, že FreshRSS je již nainstalován!', + 'cache' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/cache</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře cache jsou v pořádku.', + ), + 'ctype' => array( + 'nok' => 'Není nainstalována požadovaná knihovna pro ověřování znaků (php-ctype).', + 'ok' => 'Je nainstalována požadovaná knihovna pro ověřování znaků (ctype).', + ), + 'curl' => array( + 'nok' => 'Nemáte cURL (balíček php-curl).', + 'ok' => 'Máte rozšíření cURL.', + ), + 'data' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře data jsou v pořádku.', + ), + 'dom' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro procházení DOM.', + 'ok' => 'Máte požadovanou knihovnu pro procházení DOM.', + ), + 'favicons' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/favicons</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře favicons jsou v pořádku.', + ), + 'fileinfo' => array( + 'nok' => 'Nemáte PHP fileinfo (balíček fileinfo).', + 'ok' => 'Máte rozšíření fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Zkontrolujte prosím že neměníte HTTP REFERER.', + 'ok' => 'Váš HTTP REFERER je znám a odpovídá Vašemu serveru.', + ), + 'json' => array( + 'nok' => 'Pro parsování JSON chybí doporučená knihovna.', + 'ok' => 'Máte doporučenou knihovnu pro parsování JSON.', + ), + 'minz' => array( + 'nok' => 'Nemáte framework Minz.', + 'ok' => 'Máte framework Minz.', + ), + 'pcre' => array( + 'nok' => 'Nemáte požadovanou knihovnu pro regulární výrazy (php-pcre).', + 'ok' => 'Máte požadovanou knihovnu pro regulární výrazy (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Nemáte PDO nebo některý z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Máte PDO a alespoň jeden z podporovaných ovladačů (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Vaše verze PHP je %s, ale FreshRSS vyžaduje alespoň verzi %s.', + 'ok' => 'Vaše verze PHP je %s a je kompatibilní s FreshRSS.', + ), + 'users' => array( + 'nok' => 'Zkontrolujte oprávnění adresáře <em>./data/users</em>. HTTP server musí mít do tohoto adresáře práva zápisu', + 'ok' => 'Oprávnění adresáře users jsou v pořádku.', + ), + 'xml' => array( + 'nok' => 'Pro parsování XML chybí požadovaná knihovna.', + 'ok' => 'Máte požadovanou knihovnu pro parsování XML.', + ), + ), + 'conf' => array( + '_' => 'Obecná nastavení', + 'ok' => 'Nastavení bylo uloženo.', + ), + 'congratulations' => 'Gratulujeme!', + 'default_user' => 'Jméno výchozího uživatele <small>(maximálně 16 alfanumerických znaků)</small>', + 'delete_articles_after' => 'Smazat články starší než', + 'fix_errors_before' => 'Chyby prosím před přechodem na další krok opravte.', + 'javascript_is_better' => 'Práce s FreshRSS je příjemnější se zapnutým JavaScriptem', + 'js' => array( + 'confirm_reinstall' => 'Reinstalací FreshRSS ztratíte předchozí konfiguraci. Opravdu chcete pokračovat?', + ), + 'language' => array( + '_' => 'Jazyk', + 'choose' => 'Vyberte jazyk FreshRSS', + 'defined' => 'Jazyk byl nastaven.', + ), + 'not_deleted' => 'Nastala chyba, soubor <em>%s</em> musíte smazat ručně.', + 'ok' => 'Instalace byla úspěšná.', + 'step' => 'krok %d', + 'steps' => 'Kroky', + 'title' => 'Instalace · FreshRSS', + 'this_is_the_end' => 'Konec', +); diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php new file mode 100644 index 000000000..274cf16e1 --- /dev/null +++ b/app/i18n/cz/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Kategorie', + 'add' => 'Přidat kategorii', + 'empty' => 'Vyprázdit kategorii', + 'new' => 'Nová kategorie', + ), + 'feed' => array( + 'add' => 'Přidat RSS kanál', + 'advanced' => 'Pokročilé', + 'archiving' => 'Archivace', + 'auth' => array( + 'configuration' => 'Přihlášení', + 'help' => 'Umožní přístup k RSS kanálům chráneným HTTP autentizací', + 'http' => 'HTTP přihlášení', + 'password' => 'Heslo', + 'username' => 'Přihlašovací jméno', + ), + 'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)', + 'css_path' => 'Původní CSS soubor článku z webových stránek', + 'description' => 'Popis', + 'empty' => 'Kanál je prázdný. Ověřte prosím zda je ještě autorem udržován.', + 'error' => 'Vyskytl se problém s kanálem. Ověřte že je vždy dostupný, prosím, a poté jej aktualizujte.', + 'in_main_stream' => 'Zobrazit ve “Všechny kanály”', + 'informations' => 'Informace', + 'keep_history' => 'Zachovat tento minimální počet článků', + 'moved_category_deleted' => 'Po smazání kategorie budou v ní obsažené kanály automaticky přesunuty do <em>%s</em>.', + 'no_selected' => 'Nejsou označeny žádné kanály.', + 'number_entries' => '%d článků', + 'stats' => 'Statistika', + 'think_to_add' => 'Můžete přidat kanály.', + 'title' => 'Název', + 'title_add' => 'Přidat RSS kanál', + 'ttl' => 'Neobnovovat častěji než', + 'url' => 'URL kanálu', + 'validator' => 'Zkontrolovat platnost kanálu', + 'website' => 'URL webové stránky', + 'pubsubhubbub' => 'Okamžité oznámení s PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Export', + 'export_opml' => 'Exportovat seznam kanálů (OPML)', + 'export_starred' => 'Exportovat oblíbené', + 'feed_list' => 'Seznam %s článků', + 'file_to_import' => 'Soubor k importu<br />(OPML, JSON nebo ZIP)', + 'file_to_import_no_zip' => 'Soubor k importu<br />(OPML nebo JSON)', + 'import' => 'Import', + 'starred_list' => 'Seznam oblíbených článků', + 'title' => 'Import / export', + ), + 'menu' => array( + 'bookmark' => 'Přihlásit (FreshRSS bookmark)', + 'import_export' => 'Import / export', + 'subscription_management' => 'Správa subskripcí', + ), + 'title' => array( + '_' => 'Správa subskripcí', + 'feed_management' => 'Správa RSS kanálů', + ), +); diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php new file mode 100644 index 000000000..8fc43a7bb --- /dev/null +++ b/app/i18n/de/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Anonymes Lesen der Artikel des Standardbenutzers (%s) erlauben', + 'allow_anonymous_refresh' => 'Anonymes Aktualisieren der Artikel erlauben', + 'api_enabled' => '<abbr>API</abbr>-Zugriff erlauben <small>(für mobile Anwendungen benötigt)</small>', + 'form' => 'Webformular (traditionell, benötigt JavaScript)', + 'http' => 'HTTP (HTTPS für erfahrene Benutzer)', + 'none' => 'Keine (gefährlich)', + 'title' => 'Authentifizierung', + 'title_reset' => 'Zurücksetzen der Authentifizierung', + 'token' => 'Authentifizierungs-Token', + 'token_help' => 'Erlaubt den Zugriff auf die RSS-Ausgabe des Standardbenutzers ohne Authentifizierung.', + 'type' => 'Authentifizierungsmethode', + 'unsafe_autologin' => 'Erlaube unsicheres automatisches Anmelden mit folgendem Format: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/cache</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/cache</em> sind in Ordnung.', + ), + 'categories' => array( + 'nok' => 'Die Tabelle <em>category</em> ist schlecht konfiguriert.', + 'ok' => 'Die Tabelle <em>category</em> ist korrekt konfiguriert.', + ), + 'connection' => array( + 'nok' => 'Verbindung zur Datenbank kann nicht aufgebaut werden.', + 'ok' => 'Verbindung zur Datenbank konnte aufgebaut werden.', + ), + 'ctype' => array( + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für die Überprüfung von Zeichentypen (php-ctype).', + 'ok' => 'Sie haben die benötigte Bibliothek für die Überprüfung von Zeichentypen (ctype).', + ), + 'curl' => array( + 'nok' => 'Ihnen fehlt cURL (Paket php-curl).', + 'ok' => 'Sie haben die cURL-Erweiterung.', + ), + 'data' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data</em> sind in Ordnung.', + ), + 'database' => 'Datenbank-Installation', + 'dom' => array( + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek um DOM zu durchstöbern (Paket php-xml).', + 'ok' => 'Sie haben die benötigte Bibliothek um DOM zu durchstöbern.', + ), + 'entries' => array( + 'nok' => 'Die Tabelle <em>entry</em> ist schlecht konfiguriert.', + 'ok' => 'Die Tabelle <em>entry</em> ist korrekt konfiguriert.', + ), + 'favicons' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/favicons</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/favicons</em> sind in Ordnung.', + ), + 'feeds' => array( + 'nok' => 'Die Tabelle <em>feed</em> ist schlecht konfiguriert.', + 'ok' => 'Die Tabelle <em>feed</em> ist korrekt konfiguriert.', + ), + 'fileinfo' => array( + 'nok' => 'Ihnen fehlt PHP fileinfo (Paket fileinfo).', + 'ok' => 'Sie haben die fileinfo-Erweiterung.', + ), + 'files' => 'Datei-Installation', + 'json' => array( + 'nok' => 'Ihnen fehlt die JSON-Erweiterung (Paket php5-json).', + 'ok' => 'Sie haben die JSON-Erweiterung.', + ), + 'minz' => array( + 'nok' => 'Ihnen fehlt das Minz-Framework.', + 'ok' => 'Sie haben das Minz-Framework.', + ), + 'pcre' => array( + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für reguläre Ausdrücke (php-pcre).', + 'ok' => 'Sie haben die benötigte Bibliothek für reguläre Ausdrücke (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Ihnen fehlt PDO oder einer der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Sie haben PDO und mindestens einen der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP-Installation', + 'nok' => 'Ihre PHP-Version ist %s aber FreshRSS benötigt mindestens Version %s.', + 'ok' => 'Ihre PHP-Version ist %s, welche kompatibel mit FreshRSS ist.', + ), + 'tables' => array( + 'nok' => 'Es fehlen eine oder mehrere Tabellen in der Datenbank.', + 'ok' => 'Tabellen existieren in der Datenbank.', + ), + 'title' => 'Installationsüberprüfung', + 'tokens' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/tokens</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/tokens</em> sind in Ordnung.', + ), + 'users' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/users</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/users</em> sind in Ordnung.', + ), + 'zip' => array( + 'nok' => 'Ihnen fehlt die ZIP-Erweiterung (Paket php-zip).', + 'ok' => 'Sie haben die ZIP-Erweiterung.', + ), + ), + 'extensions' => array( + 'disabled' => 'Deaktiviert', + 'empty_list' => 'Es gibt keine installierte Erweiterung.', + 'enabled' => 'Aktiviert', + 'no_configure_view' => 'Diese Erweiterung kann nicht konfiguriert werden.', + 'system' => array( + '_' => 'System-Erweiterungen', + 'no_rights' => 'System-Erweiterung (Sie haben keine Berechtigung dafür)', + ), + 'title' => 'Erweiterungen', + 'user' => 'Benutzer-Erweiterungen', + ), + 'stats' => array( + '_' => 'Statistiken', + 'all_feeds' => 'Alle Feeds', + 'category' => 'Kategorie', + 'entry_count' => 'Anzahl der Einträge', + 'entry_per_category' => 'Einträge pro Kategorie', + 'entry_per_day' => 'Einträge pro Tag (letzten 30 Tage)', + 'entry_per_day_of_week' => 'Pro Wochentag (Durchschnitt: %.2f Nachrichten)', + 'entry_per_hour' => 'Pro Stunde (Durchschnitt: %.2f Nachrichten)', + 'entry_per_month' => 'Pro Monat (Durchschnitt: %.2f Nachrichten)', + 'entry_repartition' => 'Einträge-Verteilung', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds pro Kategorie', + 'idle' => 'Inaktive Feeds', + 'main' => 'Haupt-Statistiken', + 'main_stream' => 'Haupt-Feeds', + 'menu' => array( + 'idle' => 'Inaktive Feeds', + 'main' => 'Haupt-Statistiken', + 'repartition' => 'Artikel-Verteilung', + ), + 'no_idle' => 'Es gibt keinen inaktiven Feed!', + 'number_entries' => '%d Artikel', + 'percent_of_total' => '%% Gesamt', + 'repartition' => 'Artikel-Verteilung', + 'status_favorites' => 'Favoriten', + 'status_read' => 'Gelesen', + 'status_total' => 'Gesamt', + 'status_unread' => 'Ungelesen', + 'title' => 'Statistiken', + 'top_feed' => 'Top 10-Feeds', + ), + 'system' => array( + '_' => 'System configuration', // @todo translate + 'auto-update-url' => 'Auto-update server URL', // @todo translate + 'instance-name' => 'Instance name', // @todo translate + 'max-categories' => 'Categories per user limit', // @todo translate + 'max-feeds' => 'Feeds per user limit', // @todo translate + 'registration' => array( + 'help' => '0 meint, dass es kein Account Limit gibt', + 'number' => 'Maximale Anzahl von Accounts', + ), + ), + 'update' => array( + '_' => 'System aktualisieren', + 'apply' => 'Anwenden', + 'check' => 'Auf neue Aktualisierungen prüfen', + 'current_version' => 'Ihre aktuelle Version von FreshRSS ist %s.', + 'last' => 'Letzte Überprüfung: %s', + 'none' => 'Keine ausstehende Aktualisierung', + 'title' => 'System aktualisieren', + ), + 'user' => array( + 'articles_and_size' => '%s Artikel (%s)', + 'create' => 'Neuen Benutzer erstellen', + 'language' => 'Sprache', + 'number' => 'Es wurde bis jetzt %d Account erstellt', + 'numbers' => 'Es wurden bis jetzt %d Accounts erstellt', + 'password_form' => 'Passwort<br /><small>(für die Anmeldemethode per Webformular)</small>', + 'password_format' => 'mindestens 7 Zeichen', + 'title' => 'Benutzer verwalten', + 'user_list' => 'Liste der Benutzer', + 'username' => 'Nutzername', + 'users' => 'Benutzer', + ), +); diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php new file mode 100644 index 000000000..7c57d5655 --- /dev/null +++ b/app/i18n/de/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archivierung', + 'advanced' => 'Erweitert', + 'delete_after' => 'Entferne Artikel nach', + 'help' => 'Weitere Optionen sind in den Einstellungen der individuellen Feeds verfügbar.', + 'keep_history_by_feed' => 'Minimale Anzahl an Artikeln, die pro Feed behalten werden', + 'optimize' => 'Datenbank optimieren', + 'optimize_help' => 'Sollte gelegentlich durchgeführt werden, um die Größe der Datenbank zu reduzieren.', + 'purge_now' => 'Jetzt bereinigen', + 'title' => 'Archivierung', + 'ttl' => 'Aktualisiere automatisch nicht öfter als', + ), + 'display' => array( + '_' => 'Anzeige', + 'icon' => array( + 'bottom_line' => 'Fußzeile', + 'entry' => 'Artikel-Symbole', + 'publication_date' => 'Datum der Veröffentlichung', + 'related_tags' => 'Verwandte Tags', + 'sharing' => 'Teilen', + 'top_line' => 'Kopfzeile', + ), + 'language' => 'Sprache', + 'notif_html5' => array( + 'seconds' => 'Sekunden (0 bedeutet keine Zeitüberschreitung)', + 'timeout' => 'Zeitüberschreitung für HTML5-Benachrichtigung', + ), + 'theme' => 'Erscheinungsbild', + 'title' => 'Anzeige', + 'width' => array( + 'content' => 'Inhaltsbreite', + 'large' => 'Gross', + 'medium' => 'Mittel', + 'no_limit' => 'Keine Begrenzung', + 'thin' => 'Klein', + ), + ), + 'query' => array( + '_' => 'Benutzerabfragen', + 'deprecated' => 'Diese Abfrage ist nicht länger gültig. Die referenzierte Kategorie oder der Feed ist gelöscht worden.', + 'filter' => 'Angewendeter Filter:', + 'get_all' => 'Alle Artikel anzeigen', + 'get_category' => 'Kategorie "%s" anzeigen', + 'get_favorite' => 'Lieblingsartikel anzeigen', + 'get_feed' => 'Feed "%s" anzeigen', + 'no_filter' => 'Kein Filter', + 'none' => 'Sie haben bisher keine Benutzerabfrage erstellt.', + 'number' => 'Abfrage Nr. %d', + 'order_asc' => 'Älteste Artikel zuerst anzeigen', + 'order_desc' => 'Neueste Artikel zuerst anzeigen', + 'search' => 'Suche nach "%s"', + 'state_0' => 'Alle Artikel anzeigen', + 'state_1' => 'Gelesene Artikel anzeigen', + 'state_2' => 'Ungelesene Artikel anzeigen', + 'state_3' => 'Alle Artikel anzeigen', + 'state_4' => 'Lieblingsartikel anzeigen', + 'state_5' => 'Gelesene Lieblingsartikel anzeigen', + 'state_6' => 'Ungelesene Lieblingsartikel anzeigen', + 'state_7' => 'Lieblingsartikel anzeigen', + 'state_8' => 'Keine Lieblingsartikel anzeigen', + 'state_9' => 'Gelesene ohne Lieblingsartikel anzeigen', + 'state_10' => 'Ungelesene ohne Lieblingsartikel anzeigen', + 'state_11' => 'Keine Lieblingsartikel anzeigen', + 'state_12' => 'Alle Artikel anzeigen', + 'state_13' => 'Gelesene Artikel anzeigen', + 'state_14' => 'Ungelesene Artikel anzeigen', + 'state_15' => 'Alle Artikel anzeigen', + 'title' => 'Benutzerabfragen', + ), + 'profile' => array( + '_' => 'Profil-Verwaltung', + 'delete' => array( + '_' => 'Accountlöschung', + 'warn' => 'Dein Account und alle damit bezogenen Daten werden gelöscht.', + ), + 'password_api' => 'Passwort-API<br /><small>(z. B. für mobile Anwendungen)</small>', + 'password_form' => 'Passwort<br /><small>(für die Anmeldemethode per Webformular)</small>', + 'password_format' => 'mindestens 7 Zeichen', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Lesen', + 'after_onread' => 'Nach „Alle als gelesen markieren“,', + 'articles_per_page' => 'Anzahl der Artikel pro Seite', + 'auto_load_more' => 'Die nächsten Artikel am Seitenende laden', + 'auto_remove_article' => 'Artikel nach dem Lesen verstecken', + 'mark_updated_article_unread' => 'Markieren Sie aktualisierte Artikel als ungelesen', + 'confirm_enabled' => 'Bei der Aktion „Alle als gelesen markieren“ einen Bestätigungsdialog anzeigen', + 'display_articles_unfolded' => 'Artikel standardmäßig ausgeklappt zeigen', + 'display_categories_unfolded' => 'Kategorien standardmäßig eingeklappt zeigen', + 'hide_read_feeds' => 'Kategorien & Feeds ohne ungelesene Artikel verstecken (funktioniert nicht mit der Einstellung „Alle Artikel zeigen“)', + 'img_with_lazyload' => 'Verwende die "träges Laden"-Methode zum Laden von Bildern', + 'jump_next' => 'springe zum nächsten ungelesenen Geschwisterelement (Feed oder Kategorie)', + 'number_divided_when_reader' => 'Geteilt durch 2 in der Lese-Ansicht.', + 'read' => array( + 'article_open_on_website' => 'wenn der Artikel auf der Original-Webseite geöffnet wird', + 'article_viewed' => 'wenn der Artikel angesehen wird', + 'scroll' => 'beim Blättern', + 'upon_reception' => 'beim Empfang des Artikels', + 'when' => 'Artikel als gelesen markieren…', + ), + 'show' => array( + '_' => 'Artikel zum Anzeigen', + 'adaptive' => 'Anzeige anpassen', + 'all_articles' => 'Alle Artikel zeigen', + 'unread' => 'Nur ungelesene zeigen', + ), + 'sort' => array( + '_' => 'Sortierreihenfolge', + 'newer_first' => 'Neuere zuerst', + 'older_first' => 'Ältere zuerst', + ), + 'sticky_post' => 'Wenn geöffnet, den Artikel ganz oben anheften', + 'title' => 'Lesen', + 'view' => array( + 'default' => 'Standard-Ansicht', + 'global' => 'Globale Ansicht', + 'normal' => 'Normale Ansicht', + 'reader' => 'Lese-Ansicht', + ), + ), + 'sharing' => array( + '_' => 'Teilen', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'E-Mail', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Weitere Informationen', + 'print' => 'Drucken', + 'shaarli' => 'Shaarli', + 'share_name' => 'Anzuzeigender Teilen-Name', + 'share_url' => 'Zu verwendende Teilen-URL', + 'title' => 'Teilen', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Tastenkombination', + 'article_action' => 'Artikelaktionen', + 'auto_share' => 'Teilen', + 'auto_share_help' => 'Wenn es nur eine Option zum Teilen gibt, wird diese verwendet. Ansonsten sind die Optionen über ihre Nummer erreichbar.', + 'close_dropdown' => 'Menüs schließen', + 'collapse_article' => 'Einklappen', + 'first_article' => 'Zum ersten Artikel springen', + 'focus_search' => 'Auf das Suchfeld zugreifen', + 'help' => 'Dokumentation anzeigen', + 'javascript' => 'JavaScript muss aktiviert sein, um Tastaturkürzel benutzen zu können', + 'last_article' => 'Zum letzten Artikel springen', + 'load_more' => 'Weitere Artikel laden', + 'mark_read' => 'Als gelesen markieren', + 'mark_favorite' => 'Als Favorit markieren', + 'navigation' => 'Navigation', + 'navigation_help' => 'Mit der "Umschalttaste" finden die Tastenkombination auf Feeds Anwendung.<br/>Mit der "Alt-Taste" finden die Tastenkombination auf Kategorien Anwendung.', + 'next_article' => 'Zum nächsten Artikel springen', + 'other_action' => 'Andere Aktionen', + 'previous_article' => 'Zum vorherigen Artikel springen', + 'see_on_website' => 'Auf der Original-Webseite ansehen', + 'shift_for_all_read' => '+ <code>Umschalttaste</code>, um alle Artikel als gelesen zu markieren.', + 'title' => 'Tastenkombination', + 'user_filter' => 'Auf Benutzerfilter zugreifen', + 'user_filter_help' => 'Wenn es nur einen Benutzerfilter gibt, wird dieser verwendet. Ansonsten sind die Filter über ihre Nummer erreichbar.', + ), + 'user' => array( + 'articles_and_size' => '%s Artikel (%s)', + 'current' => 'Aktueller Benutzer', + 'is_admin' => 'ist Administrator', + 'users' => 'Benutzer', + ), +); diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php new file mode 100644 index 000000000..195083b36 --- /dev/null +++ b/app/i18n/de/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimierung abgeschlossen', + ), + 'access' => array( + 'denied' => 'Sie haben nicht die Berechtigung, diese Seite aufzurufen', + 'not_found' => 'Sie suchen nach einer Seite, die nicht existiert', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Während der Konfiguration des Authentifikationssystems trat ein Fehler auf. Bitte versuchen Sie es später erneut.', + 'set' => 'Formular ist ab sofort ihr Standard-Authentifikationssystem.', + ), + 'login' => array( + 'invalid' => 'Anmeldung ist ungültig', + 'success' => 'Sie sind angemeldet', + ), + 'logout' => array( + 'success' => 'Sie sind abgemeldet', + ), + 'no_password_set' => 'Administrator-Passwort ist nicht gesetzt worden. Dieses Feature ist nicht verfügbar.', + ), + 'conf' => array( + 'error' => 'Während der Speicherung der Konfiguration trat ein Fehler auf', + 'query_created' => 'Abfrage "%s" ist erstellt worden.', + 'shortcuts_updated' => 'Die Tastenkombinationen sind aktualisiert worden', + 'updated' => 'Die Konfiguration ist aktualisiert worden', + ), + 'extensions' => array( + 'already_enabled' => '%s ist bereits aktiviert', + 'disable' => array( + 'ko' => '%s kann nicht deaktiviert werden. Für Details <a href="%s">prüfen Sie die FressRSS-Protokolle</a>.', + 'ok' => '%s ist jetzt deaktiviert', + ), + 'enable' => array( + 'ko' => '%s kann nicht aktiviert werden. Für Details <a href="%s">prüfen Sie die FressRSS-Protokolle</a>.', + 'ok' => '%s ist jetzt aktiviert', + ), + 'no_access' => 'Sie haben keinen Zugang zu %s', + 'not_enabled' => '%s ist noch nicht aktiviert', + 'not_found' => '%s existiert nicht', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Die ZIP-Erweiterung fehlt auf Ihrem Server. Bitte versuchen Sie die Dateien eine nach der anderen zu exportieren.', + 'feeds_imported' => 'Ihre Feeds sind importiert worden und werden jetzt aktualisiert', + 'feeds_imported_with_errors' => 'Ihre Feeds sind importiert worden, aber es traten einige Fehler auf', + 'file_cannot_be_uploaded' => 'Die Datei kann nicht hochgeladen werden!', + 'no_zip_extension' => 'Die ZIP-Erweiterung ist auf Ihrem Server nicht vorhanden.', + 'zip_error' => 'Ein Fehler trat während des ZIP-Imports auf.', + ), + 'sub' => array( + 'actualize' => 'Aktualisieren', + 'category' => array( + 'created' => 'Die Kategorie %s ist erstellt worden.', + 'deleted' => 'Die Kategorie ist gelöscht worden.', + 'emptied' => 'Die Kategorie ist geleert worden.', + 'error' => 'Die Kategorie kann nicht aktualisiert werden', + 'name_exists' => 'Der Kategorie-Name existiert bereits.', + 'no_id' => 'Sie müssen die ID der Kategorie präzisieren.', + 'no_name' => 'Der Kategorie-Name kann nicht leer sein.', + 'not_delete_default' => 'Sie können die Vorgabe-Kategorie nicht löschen!', + 'not_exist' => 'Die Kategorie existiert nicht!', + 'over_max' => 'Sie haben Ihre Kategorien-Limite erreicht (%d)', + 'updated' => 'Die Kategorie ist aktualisiert worden.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> ist aktualisiert worden', + 'actualizeds' => 'Die RSS-Feeds sind aktualisiert worden', + 'added' => 'Der RSS-Feed <em>%s</em> ist hinzugefügt worden', + 'already_subscribed' => 'Sie haben <em>%s</em> bereits abonniert', + 'deleted' => 'Der Feed ist gelöscht worden', + 'error' => 'Der Feed kann nicht aktualisiert werden', + 'internal_problem' => 'Der RSS-Feed konnte nicht hinzugefügt werden. Für Details <a href="%s">prüfen Sie die FressRSS-Protokolle</a>.', + 'invalid_url' => 'Die URL <em>%s</em> ist ungültig', + 'marked_read' => 'Die Feeds sind als gelesen markiert worden', + 'n_actualized' => 'Die %d Feeds sind aktualisiert worden', + 'n_entries_deleted' => 'Die %d Artikel sind gelöscht worden', + 'no_refresh' => 'Es gibt keinen Feed zum Aktualisieren…', + 'not_added' => '<em>%s</em> konnte nicht hinzugefügt werden', + 'over_max' => 'Sie haben Ihre Feeds-Limite erreicht (%d)', + 'updated' => 'Der Feed ist aktualisiert worden', + ), + 'purge_completed' => 'Bereinigung abgeschlossen (%d Artikel gelöscht)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS wird nun auf die <strong>Version %s</strong> aktualisiert.', + 'error' => 'Der Aktualisierungsvorgang stieß auf einen Fehler: %s', + 'file_is_nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>%s</em>. Der HTTP-Server muss Schreibrechte besitzen', + 'finished' => 'Aktualisierung abgeschlossen!', + 'none' => 'Keine Aktualisierung zum Anwenden', + 'server_not_found' => 'Der Aktualisierungs-Server kann nicht gefunden werden. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Der Benutzer %s ist erstellt worden', + 'error' => 'Der Benutzer %s kann nicht erstellt werden', + ), + 'deleted' => array( + '_' => 'Der Benutzer %s ist gelöscht worden', + 'error' => 'Der Benutzer %s kann nicht gelöscht werden', + ), + ), + 'profile' => array( + 'error' => 'Ihr Profil kann nicht geändert werden', + 'updated' => 'Ihr Profil ist geändert worden', + ), +); diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php new file mode 100644 index 000000000..c73aedbfe --- /dev/null +++ b/app/i18n/de/gen.php @@ -0,0 +1,182 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Aktualisieren', + 'back_to_rss_feeds' => '← Zurück zu Ihren RSS-Feeds gehen', + 'cancel' => 'Abbrechen', + 'create' => 'Erstellen', + 'disable' => 'Deaktivieren', + 'empty' => 'Leeren', + 'enable' => 'Aktivieren', + 'export' => 'Exportieren', + 'filter' => 'Filtern', + 'import' => 'Importieren', + 'manage' => 'Verwalten', + 'mark_read' => 'Als gelesen markieren', + 'mark_favorite' => 'Als Favorit markieren', + 'remove' => 'Entfernen', + 'see_website' => 'Webseite ansehen', + 'submit' => 'Abschicken', + 'truncate' => 'Alle Artikel löschen', + ), + 'auth' => array( + 'email' => 'E-Mail-Adresse', + 'keep_logged_in' => 'Eingeloggt bleiben <small>(%s Tage)</small>', + 'login' => 'Anmelden', + 'logout' => 'Abmelden', + 'password' => array( + '_' => 'Passwort', + 'format' => '<small>mindestens 7 Zeichen</small>', + ), + 'registration' => array( + '_' => 'Neuer Account', + 'ask' => 'Erstelle einen Account?', + 'title' => 'Accounterstellung', + ), + 'reset' => 'Zurücksetzen der Authentifizierung', + 'username' => array( + '_' => 'Nutzername', + 'admin' => 'Administrator-Nutzername', + 'format' => '<small>maximal 16 alphanumerische Zeichen</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\z\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r', + 'Jan' => '\\J\\a\\n\\u\\a\\r', + 'Jul' => '\\J\\u\\l\\i', + 'Jun' => '\\J\\u\\n\\i', + 'Mar' => '\\M\\ä\\r\\z', + 'May' => '\\M\\a\\i', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\k\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'Apr', + 'april' => 'April', + 'aug' => 'Aug', + 'august' => 'August', + 'before_yesterday' => 'Vor vorgestern', + 'dec' => 'Dez', + 'december' => 'Dezember', + 'feb' => 'Feb', + 'february' => 'Februar', + 'format_date' => 'd\\. %s Y', + 'format_date_hour' => 'd\\. %s Y \\u\\m H\\:i', + 'fri' => 'Fr', + 'jan' => 'Jan', + 'january' => 'Januar', + 'jul' => 'Jul', + 'july' => 'Juli', + 'jun' => 'Jun', + 'june' => 'Juni', + 'last_3_month' => 'Letzte drei Monate', + 'last_6_month' => 'Letzte sechs Monate', + 'last_month' => 'Letzter Monat', + 'last_week' => 'Letzte Woche', + 'last_year' => 'Letztes Jahr', + 'mar' => 'Mär', + 'march' => 'März', + 'may' => 'Mai', + 'mon' => 'Mo', + 'month' => 'Monat(en)', + 'nov' => 'Nov', + 'november' => 'November', + 'oct' => 'Okt', + 'october' => 'Oktober', + 'sat' => 'Sa', + 'sep' => 'Sep', + 'september' => 'September', + 'sun' => 'So', + 'thu' => 'Do', + 'today' => 'Heute', + 'tue' => 'Di', + 'wed' => 'Mi', + 'yesterday' => 'Gestern', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'Über FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Kategorie leeren', + 'confirm_action' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Diese Aktion kann nicht abgebrochen werden!', + 'confirm_action_feed_cat' => 'Sind Sie sicher, dass Sie diese Aktion durchführen wollen? Sie werden zugehörige Favoriten und Benutzerabfragen verlieren. Dies kann nicht abgebrochen werden!', + 'feedback' => array( + 'body_new_articles' => 'Es gibt %%d neue Artikel zum Lesen auf FreshRSS.', + 'request_failed' => 'Eine Anfrage ist fehlgeschlagen, dies könnte durch Probleme mit der Internetverbindung verursacht worden sein.', + 'title_new_articles' => 'FreshRSS: neue Artikel!', + ), + 'new_article' => 'Es gibt neue verfügbare Artikel. Klicken Sie, um die Seite zu aktualisieren.', + 'should_be_activated' => 'JavaScript muss aktiviert sein', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'Über', + 'admin' => 'Administration', + 'archiving' => 'Archivierung', + 'authentication' => 'Authentifizierung', + 'check_install' => 'Installationsüberprüfung', + 'configuration' => 'Konfiguration', + 'display' => 'Anzeige', + 'extensions' => 'Erweiterungen', + 'logs' => 'Protokolle', + 'queries' => 'Benutzerabfragen', + 'reading' => 'Lesen', + 'search' => 'Suche Worte oder #Tags', + 'sharing' => 'Teilen', + 'shortcuts' => 'Tastaturkürzel', + 'stats' => 'Statistiken', + 'system' => 'System configuration',// @todo translate + 'update' => 'Aktualisieren', + 'user_management' => 'Benutzer verwalten', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'Erste', + 'last' => 'Letzte', + 'load_more' => 'Weitere Artikel laden', + 'mark_all_read' => 'Alle als gelesen markieren', + 'next' => 'Nächste', + 'nothing_to_load' => 'Es gibt keine weiteren Artikel', + 'previous' => 'Vorherige', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'E-Mail', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Drucken', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Achtung!', + 'blank_to_disable' => 'Zum Deaktivieren frei lassen', + 'by_author' => 'Von <em>%s</em>', + 'by_default' => 'standardmäßig', + 'damn' => 'Verdammt!', + 'default_category' => 'Unkategorisiert', + 'no' => 'Nein', + 'not_applicable' => 'Nicht verfügbar', + 'ok' => 'OK!', + 'or' => 'oder', + 'yes' => 'Ja', + ), +); diff --git a/app/i18n/de/index.php b/app/i18n/de/index.php new file mode 100644 index 000000000..df92d8085 --- /dev/null +++ b/app/i18n/de/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Über', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Fehlerberichte', + 'credits' => 'Credits', + 'credits_content' => 'Einige Designelemente stammen von <a href="http://twitter.github.io/bootstrap/">Bootstrap</a>, obwohl FreshRSS dieses Framework nicht nutzt. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> stammen vom <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> Font wurde von <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a> erstellt. FreshRSS basiert auf <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, einem PHP-Framework.', + 'freshrss_description' => 'FreshRSS ist ein RSS-Feedsaggregator zum selbst hosten wie zum Beispiel <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> oder <a href="http://projet.idleman.fr/leed/">Leed</a>. Er ist leicht und einfach zu handhaben und gleichzeitig ein leistungsstarkes und konfigurierbares Werkzeug.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">on Github</a>', + 'license' => 'Lizenz', + 'project_website' => 'Projekt-Webseite', + 'title' => 'Über', + 'version' => 'Version', + 'website' => 'Webseite', + ), + 'feed' => array( + 'add' => 'Sie können Feeds hinzufügen.', + 'empty' => 'Es gibt keinen Artikel zum Anzeigen.', + 'rss_of' => 'RSS-Feed von %s', + 'title' => 'Ihre RSS-Feeds', + 'title_global' => 'Globale Ansicht', + 'title_fav' => 'Ihre Favoriten', + ), + 'log' => array( + '_' => 'Protokolle', + 'clear' => 'Protokolle leeren', + 'empty' => 'Protokolldatei ist leer.', + 'title' => 'Protokolle', + ), + 'menu' => array( + 'about' => 'Über FreshRSS', + 'add_query' => 'Eine Abfrage hinzufügen', + 'before_one_day' => 'Vor einem Tag', + 'before_one_week' => 'Vor einer Woche', + 'favorites' => 'Favoriten (%s)', + 'global_view' => 'Globale Ansicht', + 'main_stream' => 'Haupt-Feeds', + 'mark_all_read' => 'Alle als gelesen markieren', + 'mark_cat_read' => 'Kategorie als gelesen markieren', + 'mark_feed_read' => 'Feed als gelesen markieren', + 'newer_first' => 'Neuere zuerst', + 'non-starred' => 'Alle außer Favoriten zeigen', + 'normal_view' => 'Normale Ansicht', + 'older_first' => 'Ältere zuerst', + 'queries' => 'Benutzerabfragen', + 'read' => 'Nur gelesene zeigen', + 'reader_view' => 'Lese-Ansicht', + 'rss_view' => 'RSS-Feed', + 'search_short' => 'Suchen', + 'starred' => 'Nur Favoriten zeigen', + 'stats' => 'Statistiken', + 'subscription' => 'Abonnementverwaltung', + 'unread' => 'Nur ungelesene zeigen', + ), + 'share' => 'Teilen', + 'tag' => array( + 'related' => 'Verwandte Tags', + ), +); diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php new file mode 100644 index 000000000..b747d1551 --- /dev/null +++ b/app/i18n/de/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Installation fertigstellen', + 'fix_errors_before' => 'Bitte Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'keep_install' => 'Vorherige Konfiguration beibehalten', + 'next_step' => 'Zum nächsten Schritt springen', + 'reinstall' => 'Neuinstallation von FreshRSS', + ), + 'auth' => array( + 'form' => 'Webformular (traditionell, benötigt JavaScript)', + 'http' => 'HTTP (HTTPS für erfahrene Benutzer)', + 'none' => 'Keine (gefährlich)', + 'password_form' => 'Passwort<br /><small>(für die Anmeldemethode per Webformular)</small>', + 'password_format' => 'mindestens 7 Zeichen', + 'type' => 'Authentifizierungsmethode', + ), + 'bdd' => array( + '_' => 'Datenbank', + 'conf' => array( + '_' => 'Datenbank-Konfiguration', + 'ko' => 'Überprüfen Sie Ihre Datenbank-Information.', + 'ok' => 'Datenbank-Konfiguration ist gespeichert worden.', + ), + 'host' => 'Host', + 'prefix' => 'Tabellen-Präfix', + 'password' => 'SQL-Password', + 'type' => 'Datenbank-Typ', + 'username' => 'SQL-Nutzername', + ), + 'check' => array( + '_' => 'Überprüfungen', + 'already_installed' => 'Wir haben festgestellt, dass FreshRSS bereits installiert wurde!', + 'cache' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/cache</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/cache</em> sind in Ordnung.', + ), + 'ctype' => array( + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für die Überprüfung von Zeichentypen (php-ctype).', + 'ok' => 'Sie haben die benötigte Bibliothek für die Überprüfung von Zeichentypen (ctype).', + ), + 'curl' => array( + 'nok' => 'Ihnen fehlt cURL (Paket php-curl).', + 'ok' => 'Sie haben die cURL-Erweiterung.', + ), + 'data' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data</em> sind in Ordnung.', + ), + 'dom' => array( + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek um DOM zu durchstöbern.', + 'ok' => 'Sie haben die benötigte Bibliothek um DOM zu durchstöbern.', + ), + 'favicons' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/favicons</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/favicons</em> sind in Ordnung.', + ), + 'fileinfo' => array( + 'nok' => 'Ihnen fehlt PHP fileinfo (Paket fileinfo).', + 'ok' => 'Sie haben die fileinfo-Erweiterung.', + ), + 'http_referer' => array( + 'nok' => 'Bitte stellen Sie sicher, dass Sie Ihren HTTP REFERER nicht abändern.', + 'ok' => 'Ihr HTTP REFERER ist bekannt und entspricht Ihrem Server.', + ), + 'json' => array( + 'nok' => 'Ihnen fehlt eine empfohlene Bibliothek um JSON zu parsen.', + 'ok' => 'Sie haben eine empfohlene Bibliothek um JSON zu parsen.', + ), + 'minz' => array( + 'nok' => 'Ihnen fehlt das Minz-Framework.', + 'ok' => 'Sie haben das Minz-Framework.', + ), + 'pcre' => array( + 'nok' => 'Ihnen fehlt eine benötigte Bibliothek für reguläre Ausdrücke (php-pcre).', + 'ok' => 'Sie haben die benötigte Bibliothek für reguläre Ausdrücke (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Ihnen fehlt PDO oder einer der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Sie haben PDO und mindestens einen der unterstützten Treiber (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Ihre PHP-Version ist %s aber FreshRSS benötigt mindestens Version %s.', + 'ok' => 'Ihre PHP-Version ist %s, welche kompatibel mit FreshRSS ist.', + ), + 'users' => array( + 'nok' => 'Überprüfen Sie die Berechtigungen des Verzeichnisses <em>./data/users</em>. Der HTTP-Server muss Schreibrechte besitzen.', + 'ok' => 'Die Berechtigungen des Verzeichnisses <em>./data/users</em> sind in Ordnung.', + ), + 'xml' => array( + 'nok' => 'Ihnen fehlt die benötigte Bibliothek um XML zu parsen.', + 'ok' => 'Sie haben die benötigte Bibliothek um XML zu parsen.', + ), + ), + 'conf' => array( + '_' => 'Allgemeine Konfiguration', + 'ok' => 'Die allgemeine Konfiguration ist gespeichert worden.', + ), + 'congratulations' => 'Glückwunsch!', + 'default_user' => 'Nutzername des Standardbenutzers <small>(maximal 16 alphanumerische Zeichen)</small>', + 'delete_articles_after' => 'Entferne Artikel nach', + 'fix_errors_before' => 'Bitte den Fehler korrigieren, bevor zum nächsten Schritt gesprungen wird.', + 'javascript_is_better' => 'FreshRSS ist ansprechender mit aktiviertem JavaScript', + 'js' => array( + 'confirm_reinstall' => 'Du wirst deine vorherige Konfiguration (Daten) verlieren FreshRSS. Bist du sicher, dass du fortfahren willst?', + ), + 'language' => array( + '_' => 'Sprache', + 'choose' => 'Wählen Sie eine Sprache für FreshRSS', + 'defined' => 'Die Sprache ist festgelegt worden.', + ), + 'not_deleted' => 'Etwas ist schiefgelaufen; Sie müssen die Datei <em>%s</em> manuell löschen.', + 'ok' => 'Der Installationsvorgang war erfolgreich.', + 'step' => 'Schritt %d', + 'steps' => 'Schritte', + 'title' => 'Installation · FreshRSS', + 'this_is_the_end' => 'Das ist das Ende', +); diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php new file mode 100644 index 000000000..cc98fd25c --- /dev/null +++ b/app/i18n/de/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Kategorie', + 'add' => 'Eine Kategorie hinzufügen', + 'empty' => 'Leere Kategorie', + 'new' => 'Neue Kategorie', + ), + 'feed' => array( + 'add' => 'Einen RSS-Feed hinzufügen', + 'advanced' => 'Erweitert', + 'archiving' => 'Archivierung', + 'auth' => array( + 'configuration' => 'Anmelden', + 'help' => 'Die Verbindung erlaubt Zugriff auf HTTP-geschützte RSS-Feeds', + 'http' => 'HTTP-Authentifizierung', + 'password' => 'HTTP-Passwort', + 'username' => 'HTTP-Nutzername', + ), + 'css_help' => 'Ruft gekürzte RSS-Feeds ab (Achtung, benötigt mehr Zeit!)', + 'css_path' => 'Pfad zur CSS-Datei des Artikels auf der Original-Webseite', + 'description' => 'Beschreibung', + 'empty' => 'Dieser Feed ist leer. Bitte stellen Sie sicher, dass er noch gepflegt wird.', + 'error' => 'Dieser Feed ist auf ein Problem gestoßen. Bitte stellen Sie sicher, dass er immer lesbar ist und aktualisieren Sie ihn dann.', + 'in_main_stream' => 'In Haupt-Feeds zeigen', + 'informations' => 'Information', + 'keep_history' => 'Minimale Anzahl an Artikeln, die behalten wird', + 'moved_category_deleted' => 'Wenn Sie eine Kategorie entfernen, werden deren Feeds automatisch in die Kategorie <em>%s</em> eingefügt.', + 'no_selected' => 'Kein Feed ausgewählt.', + 'number_entries' => '%d Artikel', + 'stats' => 'Statistiken', + 'think_to_add' => 'Sie können Feeds hinzufügen.', + 'title' => 'Titel', + 'title_add' => 'Einen RSS-Feed hinzufügen', + 'ttl' => 'Aktualisiere automatisch nicht öfter als', + 'url' => 'Feed-URL', + 'validator' => 'Überprüfen Sie die Gültigkeit des Feeds', + 'website' => 'Webseiten-URL', + 'pubsubhubbub' => 'Sofortbenachrichtigung mit PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Exportieren', + 'export_opml' => 'Liste der Feeds exportieren (OPML)', + 'export_starred' => 'Ihre Favoriten exportieren', + 'feed_list' => 'Liste von %s Artikeln', + 'file_to_import' => 'Zu importierende Datei<br />(OPML, JSON oder ZIP)', + 'file_to_import_no_zip' => 'Zu importierende Datei<br />(OPML oder JSON)', + 'import' => 'Importieren', + 'starred_list' => 'Liste der Lieblingsartikel', + 'title' => 'Importieren / Exportieren', + ), + 'menu' => array( + 'bookmark' => 'Abonnieren (FreshRSS-Lesezeichen)', + 'import_export' => 'Importieren / Exportieren', + 'subscription_management' => 'Abonnementverwaltung', + ), + 'title' => array( + '_' => 'Abonnementverwaltung', + 'feed_management' => 'Verwaltung der RSS-Feeds', + ), +); diff --git a/app/i18n/en.php b/app/i18n/en.php deleted file mode 100644 index 932513588..000000000 --- a/app/i18n/en.php +++ /dev/null @@ -1,326 +0,0 @@ -<?php - -return array ( - // LAYOUT - 'login' => 'Login', - 'login_with_persona' => 'Login with Persona', - 'logout' => 'Logout', - 'search' => 'Search words or #tags', - 'search_short' => 'Search', - - 'configuration' => 'Configuration', - 'users' => 'Users', - 'categories' => 'Categories', - 'category' => 'Category', - 'feed' => 'Feed', - 'feeds' => 'Feeds', - 'shortcuts' => 'Shortcuts', - 'about' => 'About', - 'stats' => 'Statistics', - - 'your_rss_feeds' => 'Your RSS feeds', - 'add_rss_feed' => 'Add a RSS feed', - 'no_rss_feed' => 'No RSS feed', - 'import_export_opml' => 'Import / export (OPML)', - - 'subscription_management' => 'Subscriptions management', - 'main_stream' => 'Main stream', - 'all_feeds' => 'All feeds', - 'favorite_feeds' => 'Favourites (%d)', - 'not_read' => '%d unread', - 'not_reads' => '%d unread', - - 'filter' => 'Filter', - 'see_website' => 'See website', - 'administration' => 'Manage', - 'actualize' => 'Actualize', - - 'mark_read' => 'Mark as read', - 'mark_favorite' => 'Mark as favourite', - 'mark_all_read' => 'Mark all as read', - 'mark_feed_read' => 'Mark feed as read', - 'mark_cat_read' => 'Mark category as read', - 'before_one_day' => 'Before one day', - 'before_one_week' => 'Before one week', - 'display' => 'Display', - 'normal_view' => 'Normal view', - 'reader_view' => 'Reading view', - 'global_view' => 'Global view', - 'rss_view' => 'RSS feed', - 'show_all_articles' => 'Show all articles', - 'show_not_reads' => 'Show only unread', - 'show_read' => 'Show only read', - 'show_favorite' => 'Show favorites', - 'older_first' => 'Oldest first', - 'newer_first' => 'Newer first', - - // Pagination - 'first' => 'First', - 'previous' => 'Previous', - 'next' => 'Next', - 'last' => 'Last', - - // CONTROLLERS - 'article_published_on' => 'This article originally appeared on <a href="%s">%s</a>', - 'article_published_on_author' => 'This article originally appeared on <a href="%s">%s</a> by %s', - - 'access_denied' => 'You don’t have permission to access this page', - 'page_not_found' => 'You are looking for a page which doesn’t exist', - 'error_occurred' => 'An error occurred', - 'error_occurred_update' => 'Nothing was changed', - - 'default_category' => 'Uncategorized', - 'categories_updated' => 'Categories have been updated', - 'categories_management' => 'Categories management', - 'feed_updated' => 'Feed has been updated', - 'rss_feed_management' => 'RSS feeds management', - 'configuration_updated' => 'Configuration has been updated', - 'sharing_management' => 'Sharing options management', - 'bad_opml_file' => 'Your OPML file is invalid', - 'shortcuts_updated' => 'Shortcuts have been updated', - 'shortcuts_management' => 'Shortcuts management', - 'shortcuts_navigation' => 'Navigation', - 'shortcuts_navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Alt" modifier, navigation shortcuts apply on categories.', - 'shortcuts_article_action' => 'Article actions', - 'shortcuts_other_action' => 'Other actions', - 'feeds_marked_read' => 'Feeds have been marked as read', - 'updated' => 'Modifications have been updated', - - 'already_subscribed' => 'You have already subscribed to <em>%s</em>', - 'feed_added' => 'RSS feed <em>%s</em> has been added', - 'feed_not_added' => '<em>%s</em> could not be added', - 'internal_problem_feed' => 'The RSS feed could not be added. Check FressRSS logs for details.', - 'invalid_url' => 'URL <em>%s</em> is invalid', - 'feed_actualized' => '<em>%s</em> has been updated', - 'n_feeds_actualized' => '%d feeds have been updated', - 'feeds_actualized' => 'RSS feeds have been updated', - 'no_feed_actualized' => 'No RSS feed has been updated', - 'n_entries_deleted' => '%d articles have been deleted', - 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', - 'feeds_imported' => 'Your feeds have been imported and will now be updated', - 'category_emptied' => 'Category has been emptied', - 'feed_deleted' => 'Feed has been deleted', - 'feed_validator' => 'Check the validity of the feed', - - 'optimization_complete' => 'Optimization complete', - - 'your_rss_feeds' => 'Your RSS feeds', - 'your_favorites' => 'Your favourites', - 'public' => 'Public', - 'invalid_login' => 'Login is invalid', - - // VIEWS - 'save' => 'Save', - 'delete' => 'Delete', - 'cancel' => 'Cancel', - - 'back_to_rss_feeds' => '← Go back to your RSS feeds', - 'feeds_moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under <em>%s</em>.', - 'category_number' => 'Category n°%d', - 'ask_empty' => 'Clear?', - 'number_feeds' => '%d feeds', - 'can_not_be_deleted' => 'Cannot be deleted', - 'add_category' => 'Add a category', - 'new_category' => 'New category', - - 'javascript_for_shortcuts' => 'JavaScript must be enabled in order to use shortcuts', - 'javascript_should_be_activated'=> 'JavaScript must be enabled', - 'shift_for_all_read' => '+ <code>shift</code> to mark all articles as read', - 'see_on_website' => 'See on original website', - 'next_article' => 'Skip to the next article', - 'last_article' => 'Skip to the last article', - 'previous_article' => 'Skip to the previous article', - 'first_article' => 'Skip to the first article', - 'next_page' => 'Skip to the next page', - 'previous_page' => 'Skip to the previous page', - 'collapse_article' => 'Collapse', - 'auto_share' => 'Share', - 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', - - 'file_to_import' => 'File to import', - 'import' => 'Import', - 'export' => 'Export', - 'or' => 'or', - - 'informations' => 'Information', - 'damn' => 'Damn!', - 'feed_in_error' => 'This feed has encountered a problem. Please verify that it is always reachable then actualize it.', - 'feed_empty' => 'This feed is empty. Please verify that it is still maintained.', - 'feed_description' => 'Description', - 'website_url' => 'Website URL', - 'feed_url' => 'Feed URL', - 'articles' => 'articles', - 'number_articles' => 'Number of articles', - 'by_feed' => 'by feed', - 'by_default' => 'By default', - 'keep_history' => 'Minimum number of articles to keep', - 'categorize' => 'Store in a category', - 'truncate' => 'Delete all articles', - 'advanced' => 'Advanced', - 'show_in_all_flux' => 'Show in main stream', - 'yes' => 'Yes', - 'no' => 'No', - 'css_path_on_website' => 'Articles CSS path on original website', - 'retrieve_truncated_feeds' => 'Retrieves truncated RSS feeds (attention, requires more time!)', - 'http_authentication' => 'HTTP Authentication', - 'http_username' => 'HTTP username', - 'http_password' => 'HTTP password', - 'blank_to_disable' => 'Leave blank to disable', - 'not_yet_implemented' => 'Not yet implemented', - 'access_protected_feeds' => 'Connection allows to access HTTP protected RSS feeds', - 'no_selected_feed' => 'No feed selected.', - 'think_to_add' => '<a href="./?c=configure&a=feed">You may add some feeds</a>.', - - 'current_user' => 'Current user', - 'default_user' => 'Username of the default user <small>(maximum 16 alphanumeric characters)</small>', - 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', - 'persona_connection_email' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', - 'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)', - 'allow_anonymous_refresh' => 'Allow anonymous refresh of the articles', - 'auth_token' => 'Authentication token', - 'explain_token' => 'Allows to access RSS output of the default user without authentication.<br /><kbd>%s?output=rss&token=%s</kbd>', - 'login_configuration' => 'Login', - 'is_admin' => 'is administrator', - 'auth_type' => 'Authentication method', - 'auth_none' => 'None (dangerous)', - 'auth_form' => 'Web form (traditional, requires JavaScript)', - 'http_auth' => 'HTTP (for advanced users with HTTPS)', - 'auth_persona' => 'Mozilla Persona (modern, requires JavaScript)', - 'users_list' => 'List of users', - 'create_user' => 'Create new user', - 'username' => 'Username', - 'password' => 'Password', - 'create' => 'Create', - 'user_created' => 'User %s has been created', - 'user_deleted' => 'User %s has been deleted', - - 'language' => 'Language', - 'month' => 'months', - 'archiving_configuration' => 'Archiving', - 'delete_articles_every' => 'Remove articles after', - 'purge_now' => 'Purge now', - 'purge_completed' => 'Purge completed (%d articles deleted)', - 'archiving_configuration_help' => 'More options are available in the individual stream settings', - 'reading_configuration' => 'Reading', - 'articles_per_page' => 'Number of articles per page', - 'default_view' => 'Default view', - 'sort_order' => 'Sort order', - 'auto_load_more' => 'Load next articles at the page bottom', - 'display_articles_unfolded' => 'Show articles unfolded by default', - 'after_onread' => 'After “mark all as read”,', - 'jump_next' => 'jump to next unread sibling (feed or category)', - 'reading_icons' => 'Reading icons', - 'top_line' => 'Top line', - 'bottom_line' => 'Bottom line', - 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', - 'auto_read_when' => 'Mark article as read…', - 'article_selected' => 'when article is selected', - 'article_open_on_website' => 'when article is opened on its original website', - 'scroll' => 'during page scrolls', - 'upon_reception' => 'upon reception of the article', - 'your_shaarli' => 'Your Shaarli', - 'your_wallabag' => 'Your wallabag', - 'your_diaspora_pod' => 'Your Diaspora* pod', - 'sharing' => 'Sharing', - 'share' => 'Share', - 'by_email' => 'By email', - 'optimize_bdd' => 'Optimize database', - 'optimize_todo_sometimes' => 'To do occasionally to reduce the size of the database', - 'theme' => 'Theme', - 'more_information' => 'More information', - 'activate_sharing' => 'Activate sharing', - 'shaarli' => 'Shaarli', - 'wallabag' => 'wallabag', - 'diaspora' => 'Diaspora*', - 'twitter' => 'Twitter', - 'g+' => 'Google+', - 'facebook' => 'Facebook', - 'email' => 'Email', - 'print' => 'Print', - - 'article' => 'Article', - 'title' => 'Title', - 'author' => 'Author', - 'publication_date' => 'Date of publication', - 'by' => 'by', - - 'load_more' => 'Load more articles', - 'nothing_to_load' => 'There are no more articles', - - 'rss_feeds_of' => 'RSS feed of %s', - - 'refresh' => 'Refresh', - 'no_feed_to_refresh' => 'There is no feed to refresh…', - - 'today' => 'Today', - 'yesterday' => 'Yesterday', - 'before_yesterday' => 'Before yesterday', - 'new_article' => 'There are new available articles, click to refresh the page.', - 'by_author' => 'By <em>%s</em>', - 'related_tags' => 'Related tags', - 'no_feed_to_display' => 'There is no article to show.', - - 'about_freshrss' => 'About FreshRSS', - 'project_website' => 'Project website', - 'lead_developer' => 'Lead developer', - 'website' => 'Website', - 'bugs_reports' => 'Bugs reports', - 'github_or_email' => '<a href="https://github.com/marienfressinaud/FreshRSS/issues">on Github</a> or <a href="mailto:dev@marienfressinaud.fr">by mail</a>', - 'license' => 'License', - 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', - 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> or <a href="http://projet.idleman.fr/leed/">Leed</a>. It is light and easy to take in hand while being powerful and configurable tool.', - 'credits' => 'Credits', - 'credits_content' => 'Some design elements come from <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> although FreshRSS doesn’t use this framework. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> come from <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> font police used has been created by <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. Favicons are collected with <a href="https://getfavicon.appspot.com/">getFavicon API</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.', - 'version' => 'Version', - - 'logs' => 'Logs', - 'logs_empty' => 'Log file is empty', - 'clear_logs' => 'Clear the logs', - - 'forbidden_access' => 'Access is forbidden!', - 'login_required' => 'Login required:', - - 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', - - // DATE - 'january' => 'january', - 'february' => 'february', - 'march' => 'march', - 'april' => 'april', - 'may' => 'may', - 'june' => 'june', - 'july' => 'july', - 'august' => 'august', - 'september' => 'september', - 'october' => 'october', - 'november' => 'november', - 'december' => 'december', - // special format for date() function - 'Jan' => '\J\a\n\u\a\r\y', - 'Feb' => '\F\e\b\r\u\a\r\y', - 'Mar' => '\M\a\r\c\h', - 'Apr' => '\A\p\r\i\l', - 'May' => '\M\a\y', - 'Jun' => '\J\u\n\e', - 'Jul' => '\J\u\l\y', - 'Aug' => '\A\u\g\u\s\t', - 'Sep' => '\S\e\p\t\e\m\b\e\r', - 'Oct' => '\O\c\t\o\b\e\r', - 'Nov' => '\N\o\v\e\m\b\e\r', - 'Dec' => '\D\e\c\e\m\b\e\r', - // format for date() function, %s allows to indicate month in letter - 'format_date' => '%s j\<\s\u\p\>S\<\/\s\u\p\> Y', - 'format_date_hour' => '%s j\<\s\u\p\>S\<\/\s\u\p\> Y \a\t H\:i', - - 'status_favorites' => 'Favourites', - 'status_read' => 'Read', - 'status_unread' => 'Unread', - 'status_total' => 'Total', - - 'stats_entry_repartition' => 'Entries repartition', - 'stats_entry_per_day' => 'Entries per day (last 30 days)', - 'stats_feed_per_category' => 'Feeds per category', - 'stats_entry_per_category' => 'Entries per category', - 'stats_top_feed' => 'Top ten feeds', - 'stats_entry_count' => 'Entry count', -); diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php new file mode 100644 index 000000000..e94d9fa80 --- /dev/null +++ b/app/i18n/en/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)', + 'allow_anonymous_refresh' => 'Allow anonymous refresh of the articles', + 'api_enabled' => 'Allow <abbr>API</abbr> access <small>(required for mobile apps)</small>', + 'form' => 'Web form (traditional, requires JavaScript)', + 'http' => 'HTTP (for advanced users with HTTPS)', + 'none' => 'None (dangerous)', + 'title' => 'Authentication', + 'title_reset' => 'Authentication reset', + 'token' => 'Authentication token', + 'token_help' => 'Allows access to RSS output of the default user without authentication:', + 'type' => 'Authentication method', + 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Check permissions on <em>./data/cache</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on cache directory are good.', + ), + 'categories' => array( + 'nok' => 'Category table is bad configured.', + 'ok' => 'Category table is ok.', + ), + 'connection' => array( + 'nok' => 'Connection to the database cannot being established.', + 'ok' => 'Connection to the database is ok.', + ), + 'ctype' => array( + 'nok' => 'Cannot find a required library for character type checking (php-ctype).', + 'ok' => 'You have the required library for character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'Cannot find the cURL library (php-curl package).', + 'ok' => 'You have the cURL library.', + ), + 'data' => array( + 'nok' => 'Check permissions on <em>./data</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on data directory are good.', + ), + 'database' => 'Database installation', + 'dom' => array( + 'nok' => 'Cannot find a required library to browse the DOM (php-xml package).', + 'ok' => 'You have the required library to browse the DOM.', + ), + 'entries' => array( + 'nok' => 'Entry table is bad configured.', + 'ok' => 'Entry table is ok.', + ), + 'favicons' => array( + 'nok' => 'Check permissions on <em>./data/favicons</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on favicons directory are good.', + ), + 'feeds' => array( + 'nok' => 'Feed table is bad configured.', + 'ok' => 'Feed table is ok.', + ), + 'fileinfo' => array( + 'nok' => 'Cannot find the PHP fileinfo library (fileinfo package).', + 'ok' => 'You have the fileinfo library.', + ), + 'files' => 'File installation', + 'json' => array( + 'nok' => 'Cannot find JSON (php5-json package).', + 'ok' => 'You have JSON extension.', + ), + 'minz' => array( + 'nok' => 'Cannot find the Minz framework.', + 'ok' => 'You have the Minz framework.', + ), + 'pcre' => array( + 'nok' => 'Cannot find a required library for regular expressions (php-pcre).', + 'ok' => 'You have the required library for regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Cannot find PDO or one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP installation', + 'nok' => 'Your PHP version is %s but FreshRSS requires at least version %s.', + 'ok' => 'Your PHP version is %s, which is compatible with FreshRSS.', + ), + 'tables' => array( + 'nok' => 'There is one or more lacking tables in the database.', + 'ok' => 'Tables are existing in the database.', + ), + 'title' => 'Installation checking', + 'tokens' => array( + 'nok' => 'Check permissions on <em>./data/tokens</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on tokens directory are good.', + ), + 'users' => array( + 'nok' => 'Check permissions on <em>./data/users</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on users directory are good.', + ), + 'zip' => array( + 'nok' => 'Cannot find ZIP extension (php-zip package).', + 'ok' => 'You have ZIP extension.', + ), + ), + 'extensions' => array( + 'disabled' => 'Disabled', + 'empty_list' => 'There is no installed extension', + 'enabled' => 'Enabled', + 'no_configure_view' => 'This extension cannot be configured.', + 'system' => array( + '_' => 'System extensions', + 'no_rights' => 'System extension (you have no rights on it)', + ), + 'title' => 'Extensions', + 'user' => 'User extensions', + ), + 'stats' => array( + '_' => 'Statistics', + 'all_feeds' => 'All feeds', + 'category' => 'Category', + 'entry_count' => 'Entry count', + 'entry_per_category' => 'Entries per category', + 'entry_per_day' => 'Entries per day (last 30 days)', + 'entry_per_day_of_week' => 'Per day of week (average: %.2f messages)', + 'entry_per_hour' => 'Per hour (average: %.2f messages)', + 'entry_per_month' => 'Per month (average: %.2f messages)', + 'entry_repartition' => 'Entries repartition', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per category', + 'idle' => 'Idle feeds', + 'main' => 'Main statistics', + 'main_stream' => 'Main stream', + 'menu' => array( + 'idle' => 'Idle feeds', + 'main' => 'Main statistics', + 'repartition' => 'Articles repartition', + ), + 'no_idle' => 'There is no idle feed!', + 'number_entries' => '%d articles', + 'percent_of_total' => '%% of total', + 'repartition' => 'Articles repartition', + 'status_favorites' => 'Favourites', + 'status_read' => 'Read', + 'status_total' => 'Total', + 'status_unread' => 'Unread', + 'title' => 'Statistics', + 'top_feed' => 'Top ten feeds', + ), + 'system' => array( + '_' => 'System configuration', + 'auto-update-url' => 'Auto-update server URL', + 'instance-name' => 'Instance name', + 'max-categories' => 'Categories per user limit', + 'max-feeds' => 'Feeds per user limit', + 'registration' => array( + 'help' => '0 means that there is no account limit', + 'number' => 'Max number of accounts', + ), + ), + 'update' => array( + '_' => 'Update system', + 'apply' => 'Apply', + 'check' => 'Check for new updates', + 'current_version' => 'Your current version of FreshRSS is the %s.', + 'last' => 'Last verification: %s', + 'none' => 'No update to apply', + 'title' => 'Update system', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'create' => 'Create new user', + 'language' => 'Language', + 'number' => 'There is %d account created yet', + 'numbers' => 'There are %d accounts created yet', + 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', + 'password_format' => 'At least 7 characters', + 'title' => 'Manage users', + 'user_list' => 'List of users', + 'username' => 'Username', + 'users' => 'Users', + ), +); diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php new file mode 100644 index 000000000..b5ab73510 --- /dev/null +++ b/app/i18n/en/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archiving', + 'advanced' => 'Advanced', + 'delete_after' => 'Remove articles after', + 'help' => 'More options are available in the individual feed settings', + 'keep_history_by_feed' => 'Minimum number of articles to keep by feed', + 'optimize' => 'Optimise database', + 'optimize_help' => 'To do occasionally to reduce the size of the database', + 'purge_now' => 'Purge now', + 'title' => 'Archiving', + 'ttl' => 'Do not automatically refresh more often than', + ), + 'display' => array( + '_' => 'Display', + 'icon' => array( + 'bottom_line' => 'Bottom line', + 'entry' => 'Article icons', + 'publication_date' => 'Date of publication', + 'related_tags' => 'Related tags', + 'sharing' => 'Sharing', + 'top_line' => 'Top line', + ), + 'language' => 'Language', + 'notif_html5' => array( + 'seconds' => 'seconds (0 means no timeout)', + 'timeout' => 'HTML5 notification timeout', + ), + 'theme' => 'Theme', + 'title' => 'Display', + 'width' => array( + 'content' => 'Content width', + 'large' => 'Large', + 'medium' => 'Medium', + 'no_limit' => 'No limit', + 'thin' => 'Thin', + ), + ), + 'query' => array( + '_' => 'User queries', + 'deprecated' => 'This query is no longer valid. The referenced category or feed has been deleted.', + 'filter' => 'Filter applied:', + 'get_all' => 'Display all articles', + 'get_category' => 'Display "%s" category', + 'get_favorite' => 'Display favorite articles', + 'get_feed' => 'Display "%s" feed', + 'no_filter' => 'No filter', + 'none' => 'You haven’t created any user query yet.', + 'number' => 'Query n°%d', + 'order_asc' => 'Display oldest articles first', + 'order_desc' => 'Display newest articles first', + 'search' => 'Search for "%s"', + 'state_0' => 'Display all articles', + 'state_1' => 'Display read articles', + 'state_2' => 'Display unread articles', + 'state_3' => 'Display all articles', + 'state_4' => 'Display favorite articles', + 'state_5' => 'Display read favorite articles', + 'state_6' => 'Display unread favorite articles', + 'state_7' => 'Display favorite articles', + 'state_8' => 'Display not favorite articles', + 'state_9' => 'Display read not favorite articles', + 'state_10' => 'Display unread not favorite articles', + 'state_11' => 'Display not favorite articles', + 'state_12' => 'Display all articles', + 'state_13' => 'Display read articles', + 'state_14' => 'Display unread articles', + 'state_15' => 'Display all articles', + 'title' => 'User queries', + ), + 'profile' => array( + '_' => 'Profile management', + 'delete' => array( + '_' => 'Account deletion', + 'warn' => 'Your account and all the related data will be deleted.', + ), + 'password_api' => 'API password<br /><small>(e.g., for mobile apps)</small>', + 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', + 'password_format' => 'At least 7 characters', + 'title' => 'Profile', + ), + 'reading' => array( + '_' => 'Reading', + 'after_onread' => 'After “mark all as read”,', + 'articles_per_page' => 'Number of articles per page', + 'auto_load_more' => 'Load next articles at the page bottom', + 'auto_remove_article' => 'Hide articles after reading', + 'mark_updated_article_unread' => 'Mark updated articles as unread', + 'confirm_enabled' => 'Display a confirmation dialog on “mark all as read” actions', + 'display_articles_unfolded' => 'Show articles unfolded by default', + 'display_categories_unfolded' => 'Show categories folded by default', + 'hide_read_feeds' => 'Hide categories & feeds with no unread article (does not work with “Show all articles” configuration)', + 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', + 'jump_next' => 'jump to next unread sibling (feed or category)', + 'number_divided_when_reader' => 'Divided by 2 in the reading view.', + 'read' => array( + 'article_open_on_website' => 'when article is opened on its original website', + 'article_viewed' => 'when article is viewed', + 'scroll' => 'while scrolling', + 'upon_reception' => 'upon reception of the article', + 'when' => 'Mark article as read…', + ), + 'show' => array( + '_' => 'Articles to display', + 'adaptive' => 'Adjust showing', + 'all_articles' => 'Show all articles', + 'unread' => 'Show only unread', + ), + 'sort' => array( + '_' => 'Sort order', + 'newer_first' => 'Newer first', + 'older_first' => 'Oldest first', + ), + 'sticky_post' => 'Stick the article to the top when opened', + 'title' => 'Reading', + 'view' => array( + 'default' => 'Default view', + 'global' => 'Global view', + 'normal' => 'Normal view', + 'reader' => 'Reading view', + ), + ), + 'sharing' => array( + '_' => 'Sharing', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'More information', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'share_name' => 'Share name to display', + 'share_url' => 'Share URL to use', + 'title' => 'Sharing', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Shortcuts', + 'article_action' => 'Article actions', + 'auto_share' => 'Share', + 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', + 'close_dropdown' => 'Close menus', + 'collapse_article' => 'Collapse', + 'first_article' => 'Skip to the first article', + 'focus_search' => 'Access search box', + 'help' => 'Display documentation', + 'javascript' => 'JavaScript must be enabled in order to use shortcuts', + 'last_article' => 'Skip to the last article', + 'load_more' => 'Load more articles', + 'mark_read' => 'Mark as read', + 'mark_favorite' => 'Mark as favourite', + 'navigation' => 'Navigation', + 'navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Alt" modifier, navigation shortcuts apply on categories.', + 'next_article' => 'Skip to the next article', + 'other_action' => 'Other actions', + 'previous_article' => 'Skip to the previous article', + 'see_on_website' => 'See on original website', + 'shift_for_all_read' => '+ <code>shift</code> to mark all articles as read', + 'title' => 'Shortcuts', + 'user_filter' => 'Access user filters', + 'user_filter_help' => 'If there is only one user filter, it is used. Else filters are accessible by their number.', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'current' => 'Current user', + 'is_admin' => 'is administrator', + 'users' => 'Users', + ), +); diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php new file mode 100644 index 000000000..e7f6b9f85 --- /dev/null +++ b/app/i18n/en/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimisation complete', + ), + 'access' => array( + 'denied' => 'You don’t have permission to access this page', + 'not_found' => 'You are looking for a page which doesn’t exist', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'A problem occured during authentication system configuration. Please retry later.', + 'set' => 'Form is now your default authentication system.', + ), + 'login' => array( + 'invalid' => 'Login is invalid', + 'success' => 'You are connected', + ), + 'logout' => array( + 'success' => 'You are disconnected', + ), + 'no_password_set' => 'Administrator password hasn’t been set. This feature isn’t available.', + ), + 'conf' => array( + 'error' => 'An error occurred during configuration saving', + 'query_created' => 'Query "%s" has been created.', + 'shortcuts_updated' => 'Shortcuts have been updated', + 'updated' => 'Configuration has been updated', + ), + 'extensions' => array( + 'already_enabled' => '%s is already enabled', + 'disable' => array( + 'ko' => '%s cannot be disabled. <a href="%s">Check FressRSS logs</a> for details.', + 'ok' => '%s is now disabled', + ), + 'enable' => array( + 'ko' => '%s cannot be enabled. <a href="%s">Check FressRSS logs</a> for details.', + 'ok' => '%s is now enabled', + ), + 'no_access' => 'You have no access on %s', + 'not_enabled' => '%s is not enabled yet', + 'not_found' => '%s does not exist', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP extension is not present on your server. Please try to export files one by one.', + 'feeds_imported' => 'Your feeds have been imported and will now be updated', + 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', + 'file_cannot_be_uploaded' => 'File cannot be uploaded!', + 'no_zip_extension' => 'ZIP extension is not present on your server.', + 'zip_error' => 'An error occured during ZIP import.', + ), + 'sub' => array( + 'actualize' => 'Actualise', + 'category' => array( + 'created' => 'Category %s has been created.', + 'deleted' => 'Category has been deleted.', + 'emptied' => 'Category has been emptied', + 'error' => 'Category cannot be updated', + 'name_exists' => 'Category name already exists.', + 'no_id' => 'You must precise the id of the category.', + 'no_name' => 'Category name cannot be empty.', + 'not_delete_default' => 'You cannot delete the default category!', + 'not_exist' => 'The category does not exist!', + 'over_max' => 'You have reached your limit of categories (%d)', + 'updated' => 'Category has been updated.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> has been updated', + 'actualizeds' => 'RSS feeds have been updated', + 'added' => 'RSS feed <em>%s</em> has been added', + 'already_subscribed' => 'You have already subscribed to <em>%s</em>', + 'deleted' => 'Feed has been deleted', + 'error' => 'Feed cannot be updated', + 'internal_problem' => 'The RSS feed could not be added. <a href="%s">Check FressRSS logs</a> for details.', + 'invalid_url' => 'URL <em>%s</em> is invalid', + 'marked_read' => 'Feeds have been marked as read', + 'n_actualized' => '%d feeds have been updated', + 'n_entries_deleted' => '%d articles have been deleted', + 'no_refresh' => 'There is no feed to refresh…', + 'not_added' => '<em>%s</em> could not be added', + 'over_max' => 'You have reached your limit of feeds (%d)', + 'updated' => 'Feed has been updated', + ), + 'purge_completed' => 'Purge completed (%d articles deleted)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS will now be updated to the <strong>version %s</strong>.', + 'error' => 'The update process has encountered an error: %s', + 'file_is_nok' => 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into', + 'finished' => 'Update completed!', + 'none' => 'No update to apply', + 'server_not_found' => 'Update server cannot be found. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'User %s has been created', + 'error' => 'User %s cannot be created', + ), + 'deleted' => array( + '_' => 'User %s has been deleted', + 'error' => 'User %s cannot be deleted', + ), + ), + 'profile' => array( + 'error' => 'Your profile cannot be modified', + 'updated' => 'Your profile has been modified', + ), +); diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php new file mode 100644 index 000000000..3f86cfd19 --- /dev/null +++ b/app/i18n/en/gen.php @@ -0,0 +1,182 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualize', + 'back_to_rss_feeds' => '← Go back to your RSS feeds', + 'cancel' => 'Cancel', + 'create' => 'Create', + 'disable' => 'Disable', + 'empty' => 'Empty', + 'enable' => 'Enable', + 'export' => 'Export', + 'filter' => 'Filter', + 'import' => 'Import', + 'manage' => 'Manage', + 'mark_read' => 'Mark as read', + 'mark_favorite' => 'Mark as favourite', + 'remove' => 'Remove', + 'see_website' => 'See website', + 'submit' => 'Submit', + 'truncate' => 'Delete all articles', + ), + 'auth' => array( + 'email' => 'Email address', + 'keep_logged_in' => 'Keep me logged in <small>(%s days)</small>', + 'login' => 'Login', + 'logout' => 'Logout', + 'password' => array( + '_' => 'Password', + 'format' => '<small>At least 7 characters</small>', + ), + 'registration' => array( + '_' => 'New account', + 'ask' => 'Create an account?', + 'title' => 'Account creation', + ), + 'reset' => 'Authentication reset', + 'username' => array( + '_' => 'Username', + 'admin' => 'Administrator username', + 'format' => '<small>maximum 16 alphanumeric characters</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'Jul' => '\\J\\u\\l\\y', + 'Jun' => '\\J\\u\\n\\e', + 'Mar' => '\\M\\a\\r\\c\\h', + 'May' => '\\M\\a\\y', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Before yesterday', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', + 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', + 'fri' => 'Fri', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Last three months', + 'last_6_month' => 'Last six months', + 'last_month' => 'Last month', + 'last_week' => 'Last week', + 'last_year' => 'Last year', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'May', + 'mon' => 'Mon', + 'month' => 'months', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'oct', + 'october' => 'Oct', + 'sat' => 'Sat', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Sun', + 'thu' => 'Thu', + 'today' => 'Today', + 'tue' => 'Tue', + 'wed' => 'Wed', + 'yesterday' => 'Yesterday', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'About FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Empty category', + 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You will lose related favorites and user queries. It cannot be cancelled!', + 'feedback' => array( + 'body_new_articles' => 'There are %%d new articles to read on FreshRSS.', + 'request_failed' => 'A request has failed, it may have been caused by Internet connection problems.', + 'title_new_articles' => 'FreshRSS: new articles!', + ), + 'new_article' => 'There are new available articles, click to refresh the page.', + 'should_be_activated' => 'JavaScript must be enabled', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'About', + 'admin' => 'Administration', + 'archiving' => 'Archiving', + 'authentication' => 'Authentication', + 'check_install' => 'Installation checking', + 'configuration' => 'Configuration', + 'display' => 'Display', + 'extensions' => 'Extensions', + 'logs' => 'Logs', + 'queries' => 'User queries', + 'reading' => 'Reading', + 'search' => 'Search words or #tags', + 'sharing' => 'Sharing', + 'shortcuts' => 'Shortcuts', + 'stats' => 'Statistics', + 'system' => 'System configuration', + 'update' => 'Update', + 'user_management' => 'Manage users', + 'user_profile' => 'Profile', + ), + 'pagination' => array( + 'first' => 'First', + 'last' => 'Last', + 'load_more' => 'Load more articles', + 'mark_all_read' => 'Mark all as read', + 'next' => 'Next', + 'nothing_to_load' => 'There are no more articles', + 'previous' => 'Previous', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Warning!', + 'blank_to_disable' => 'Leave blank to disable', + 'by_author' => 'By <em>%s</em>', + 'by_default' => 'By default', + 'damn' => 'Damn!', + 'default_category' => 'Uncategorized', + 'no' => 'No', + 'not_applicable' => 'Not available', + 'ok' => 'Ok!', + 'or' => 'or', + 'yes' => 'Yes', + ), +); diff --git a/app/i18n/en/index.php b/app/i18n/en/index.php new file mode 100644 index 000000000..eb6413e3c --- /dev/null +++ b/app/i18n/en/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'About', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Bugs reports', + 'credits' => 'Credits', + 'credits_content' => 'Some design elements come from <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> although FreshRSS doesn’t use this framework. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> come from <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> font police has been created by <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.', + 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> or <a href="http://projet.idleman.fr/leed/">Leed</a>. It is light and easy to take in hand while being powerful and configurable tool.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">on Github</a>', + 'license' => 'License', + 'project_website' => 'Project website', + 'title' => 'About', + 'version' => 'Version', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'You may add some feeds.', + 'empty' => 'There is no article to show.', + 'rss_of' => 'RSS feed of %s', + 'title' => 'Your RSS feeds', + 'title_global' => 'Global view', + 'title_fav' => 'Your favourites', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Clear the logs', + 'empty' => 'Log file is empty', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'About FreshRSS', + 'add_query' => 'Add a query', + 'before_one_day' => 'Before one day', + 'before_one_week' => 'Before one week', + 'favorites' => 'Favourites (%s)', + 'global_view' => 'Global view', + 'main_stream' => 'Main stream', + 'mark_all_read' => 'Mark all as read', + 'mark_cat_read' => 'Mark category as read', + 'mark_feed_read' => 'Mark feed as read', + 'newer_first' => 'Newer first', + 'non-starred' => 'Show all but favorites', + 'normal_view' => 'Normal view', + 'older_first' => 'Oldest first', + 'queries' => 'User queries', + 'read' => 'Show only read', + 'reader_view' => 'Reading view', + 'rss_view' => 'RSS feed', + 'search_short' => 'Search', + 'starred' => 'Show only favorites', + 'stats' => 'Statistics', + 'subscription' => 'Subscriptions management', + 'unread' => 'Show only unread', + ), + 'share' => 'Share', + 'tag' => array( + 'related' => 'Related tags', + ), +); diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php new file mode 100644 index 000000000..40fff37dd --- /dev/null +++ b/app/i18n/en/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Complete installation', + 'fix_errors_before' => 'Please fix errors before skipping to the next step.', + 'keep_install' => 'Keep previous configuration', + 'next_step' => 'Go to the next step', + 'reinstall' => 'Reinstall FreshRSS', + ), + 'auth' => array( + 'form' => 'Web form (traditional, requires JavaScript)', + 'http' => 'HTTP (for advanced users with HTTPS)', + 'none' => 'None (dangerous)', + 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', + 'password_format' => 'At least 7 characters', + 'type' => 'Authentication method', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Database configuration', + 'ko' => 'Verify your database information.', + 'ok' => 'Database configuration has been saved.', + ), + 'host' => 'Host', + 'prefix' => 'Table prefix', + 'password' => 'Database password', + 'type' => 'Type of database', + 'username' => 'Database username', + ), + 'check' => array( + '_' => 'Checks', + 'already_installed' => 'We have detected that FreshRSS is already installed!', + 'cache' => array( + 'nok' => 'Check permissions on <em>./data/cache</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on cache directory are good.', + ), + 'ctype' => array( + 'nok' => 'Cannot find a required library for character type checking (php-ctype).', + 'ok' => 'You have the required library for character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'Cannot find the cURL library (php-curl package).', + 'ok' => 'You have the cURL library.', + ), + 'data' => array( + 'nok' => 'Check permissions on <em>./data</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on data directory are good.', + ), + 'dom' => array( + 'nok' => 'Cannot find a required library to browse the DOM.', + 'ok' => 'You have the required library to browse the DOM.', + ), + 'favicons' => array( + 'nok' => 'Check permissions on <em>./data/favicons</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on favicons directory are good.', + ), + 'fileinfo' => array( + 'nok' => 'Cannot find the PHP fileinfo library (fileinfo package).', + 'ok' => 'You have the fileinfo library.', + ), + 'http_referer' => array( + 'nok' => 'Please check that you are not altering your HTTP REFERER.', + 'ok' => 'Your HTTP REFERER is known and corresponds to your server.', + ), + 'json' => array( + 'nok' => 'Cannot find a recommended library to parse JSON.', + 'ok' => 'You have a recommended library to parse JSON.', + ), + 'minz' => array( + 'nok' => 'Cannot find the Minz framework.', + 'ok' => 'You have the Minz framework.', + ), + 'pcre' => array( + 'nok' => 'Cannot find a required library for regular expressions (php-pcre).', + 'ok' => 'You have the required library for regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Cannot find PDO or one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Your PHP version is %s but FreshRSS requires at least version %s.', + 'ok' => 'Your PHP version is %s, which is compatible with FreshRSS.', + ), + 'users' => array( + 'nok' => 'Check permissions on <em>./data/users</em> directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on users directory are good.', + ), + 'xml' => array( + 'nok' => 'Cannot find the required library to parse XML.', + 'ok' => 'You have the required library to parse XML.', + ), + ), + 'conf' => array( + '_' => 'General configuration', + 'ok' => 'General configuration has been saved.', + ), + 'congratulations' => 'Congratulations!', + 'default_user' => 'Username of the default user <small>(maximum 16 alphanumeric characters)</small>', + 'delete_articles_after' => 'Remove articles after', + 'fix_errors_before' => 'Please fix errors before skipping to the next step.', + 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', + 'js' => array( + 'confirm_reinstall' => 'You will lose your previous configuration by reinstalling FreshRSS. Are you sure you want to continue?', + ), + 'language' => array( + '_' => 'Language', + 'choose' => 'Choose a language for FreshRSS', + 'defined' => 'Language has been defined.', + ), + 'not_deleted' => 'Something went wrong; you must delete the file <em>%s</em> manually.', + 'ok' => 'The installation process was successful.', + 'step' => 'step %d', + 'steps' => 'Steps', + 'title' => 'Installation · FreshRSS', + 'this_is_the_end' => 'This is the end', +); diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php new file mode 100644 index 000000000..789433ee6 --- /dev/null +++ b/app/i18n/en/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Category', + 'add' => 'Add a category', + 'empty' => 'Empty category', + 'new' => 'New category', + ), + 'feed' => array( + 'add' => 'Add a RSS feed', + 'advanced' => 'Advanced', + 'archiving' => 'Archivage', + 'auth' => array( + 'configuration' => 'Login', + 'help' => 'Connection allows to access HTTP protected RSS feeds', + 'http' => 'HTTP Authentication', + 'password' => 'HTTP password', + 'username' => 'HTTP username', + ), + 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', + 'css_path' => 'Articles CSS path on original website', + 'description' => 'Description', + 'empty' => 'This feed is empty. Please verify that it is still maintained.', + 'error' => 'This feed has encountered a problem. Please verify that it is always reachable then actualize it.', + 'in_main_stream' => 'Show in main stream', + 'informations' => 'Information', + 'keep_history' => 'Minimum number of articles to keep', + 'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under <em>%s</em>.', + 'no_selected' => 'No feed selected.', + 'number_entries' => '%d articles', + 'stats' => 'Statistics', + 'think_to_add' => 'You may add some feeds.', + 'title' => 'Title', + 'title_add' => 'Add a RSS feed', + 'ttl' => 'Do not automatically refresh more often than', + 'url' => 'Feed URL', + 'validator' => 'Check the validity of the feed', + 'website' => 'Website URL', + 'pubsubhubbub' => 'Instant notification with PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Export', + 'export_opml' => 'Export list of feeds (OPML)', + 'export_starred' => 'Export your favourites', + 'feed_list' => 'List of %s articles', + 'file_to_import' => 'File to import<br />(OPML, JSON or ZIP)', + 'file_to_import_no_zip' => 'File to import<br />(OPML or JSON)', + 'import' => 'Import', + 'starred_list' => 'List of favourite articles', + 'title' => 'Import / export', + ), + 'menu' => array( + 'bookmark' => 'Subscribe (FreshRSS bookmark)', + 'import_export' => 'Import / export', + 'subscription_management' => 'Subscriptions management', + ), + 'title' => array( + '_' => 'Subscriptions management', + 'feed_management' => 'RSS feeds management', + ), +); diff --git a/app/i18n/fr.php b/app/i18n/fr.php deleted file mode 100644 index ab7843d12..000000000 --- a/app/i18n/fr.php +++ /dev/null @@ -1,326 +0,0 @@ -<?php - -return array ( - // LAYOUT - 'login' => 'Connexion', - 'login_with_persona' => 'Connexion avec Persona', - 'logout' => 'Déconnexion', - 'search' => 'Rechercher des mots ou des #tags', - 'search_short' => 'Rechercher', - - 'configuration' => 'Configuration', - 'users' => 'Utilisateurs', - 'categories' => 'Catégories', - 'category' => 'Catégorie', - 'feed' => 'Flux', - 'feeds' => 'Flux', - 'shortcuts' => 'Raccourcis', - 'about' => 'À propos', - 'stats' => 'Statistiques', - - 'your_rss_feeds' => 'Vos flux RSS', - 'add_rss_feed' => 'Ajouter un flux RSS', - 'no_rss_feed' => 'Aucun flux RSS', - 'import_export_opml' => 'Importer / exporter (OPML)', - - 'subscription_management' => 'Gestion des abonnements', - 'main_stream' => 'Flux principal', - 'all_feeds' => 'Tous les flux', - 'favorite_feeds' => 'Favoris (%d)', - 'not_read' => '%d non lu', - 'not_reads' => '%d non lus', - - 'filter' => 'Filtrer', - 'see_website' => 'Voir le site', - 'administration' => 'Gestion', - 'actualize' => 'Actualiser', - - 'mark_read' => 'Marquer comme lu', - 'mark_favorite' => 'Mettre en favori', - 'mark_all_read' => 'Tout marquer comme lu', - 'mark_feed_read' => 'Marquer le flux comme lu', - 'mark_cat_read' => 'Marquer la catégorie comme lue', - 'before_one_day' => 'Antérieurs à 1 jour', - 'before_one_week' => 'Antérieurs à 1 semaine', - 'display' => 'Affichage', - 'normal_view' => 'Vue normale', - 'reader_view' => 'Vue lecture', - 'global_view' => 'Vue globale', - 'rss_view' => 'Flux RSS', - 'show_all_articles' => 'Afficher tous les articles', - 'show_not_reads' => 'Afficher les non lus', - 'show_read' => 'Afficher les lus', - 'show_favorite' => 'Afficher les favoris', - 'older_first' => 'Plus anciens en premier', - 'newer_first' => 'Plus récents en premier', - - // Pagination - 'first' => 'Début', - 'previous' => 'Précédent', - 'next' => 'Suivant', - 'last' => 'Fin', - - // CONTROLLERS - 'article_published_on' => 'Article publié initialement sur <a href="%s">%s</a>', - 'article_published_on_author' => 'Article publié initialement sur <a href="%s">%s</a> par %s', - - 'access_denied' => 'Vous n’avez pas le droit d’accéder à cette page', - 'page_not_found' => 'La page que vous cherchez n’existe pas', - 'error_occurred' => 'Une erreur est survenue', - 'error_occurred_update' => 'Rien n’a été modifié', - - 'default_category' => 'Sans catégorie', - 'categories_updated' => 'Les catégories ont été mises à jour', - 'categories_management' => 'Gestion des catégories', - 'feed_updated' => 'Le flux a été mis à jour', - 'rss_feed_management' => 'Gestion des flux RSS', - 'configuration_updated' => 'La configuration a été mise à jour', - 'sharing_management' => 'Gestion des options de partage', - 'bad_opml_file' => 'Votre fichier OPML n’est pas valide', - 'shortcuts_updated' => 'Les raccourcis ont été mis à jour', - 'shortcuts_management' => 'Gestion des raccourcis', - 'shortcuts_navigation' => 'Navigation', - 'shortcuts_navigation_help' => 'Avec le modificateur "Shift", les raccourcis de navigation s’appliquent aux flux.<br/>Avec le modificateur "Alt", les raccourcis de navigation s’appliquent aux catégories.', - 'shortcuts_article_action' => 'Actions associées à l’article courant', - 'shortcuts_other_action' => 'Autres actions', - 'feeds_marked_read' => 'Les flux ont été marqués comme lus', - 'updated' => 'Modifications enregistrées', - - 'already_subscribed' => 'Vous êtes déjà abonné à <em>%s</em>', - 'feed_added' => 'Le flux <em>%s</em> a bien été ajouté', - 'feed_not_added' => '<em>%s</em> n’a pas pu être ajouté', - 'internal_problem_feed' => 'Le flux n’a pas pu être ajouté. Consulter les logs de FreshRSS pour plus de détails.', - 'invalid_url' => 'L’url <em>%s</em> est invalide', - 'feed_actualized' => '<em>%s</em> a été mis à jour', - 'n_feeds_actualized' => '%d flux ont été mis à jour', - 'feeds_actualized' => 'Les flux ont été mis à jour', - 'no_feed_actualized' => 'Aucun flux n’a pu être mis à jour', - 'n_entries_deleted' => '%d articles ont été supprimés', - 'feeds_imported_with_errors' => 'Vos flux ont été importés mais des erreurs sont survenues', - 'feeds_imported' => 'Vos flux ont été importés et vont maintenant être actualisés', - 'category_emptied' => 'La catégorie a été vidée', - 'feed_deleted' => 'Le flux a été supprimé', - 'feed_validator' => 'Vérifier la valididé du flux', - - 'optimization_complete' => 'Optimisation terminée', - - 'your_rss_feeds' => 'Vos flux RSS', - 'your_favorites' => 'Vos favoris', - 'public' => 'Public', - 'invalid_login' => 'L’identifiant est invalide', - - // VIEWS - 'save' => 'Enregistrer', - 'delete' => 'Supprimer', - 'cancel' => 'Annuler', - - 'back_to_rss_feeds' => '← Retour à vos flux RSS', - 'feeds_moved_category_deleted' => 'Lors de la suppression d’une catégorie, ses flux seront automatiquement classés dans <em>%s</em>.', - 'category_number' => 'Catégorie n°%d', - 'ask_empty' => 'Vider ?', - 'number_feeds' => '%d flux', - 'can_not_be_deleted' => 'Ne peut pas être supprimée', - 'add_category' => 'Ajouter une catégorie', - 'new_category' => 'Nouvelle catégorie', - - 'javascript_for_shortcuts' => 'Le JavaScript doit être activé pour pouvoir profiter des raccourcis', - 'javascript_should_be_activated'=> 'Le JavaScript doit être activé', - 'shift_for_all_read' => '+ <code>shift</code> pour marquer tous les articles comme lus', - 'see_on_website' => 'Voir sur le site d’origine', - 'next_article' => 'Passer à l’article suivant', - 'last_article' => 'Passer au dernier article', - 'previous_article' => 'Passer à l’article précédent', - 'first_article' => 'Passer au premier article', - 'next_page' => 'Passer à la page suivante', - 'previous_page' => 'Passer à la page précédente', - 'collapse_article' => 'Refermer', - 'auto_share' => 'Partager', - 'auto_share_help' => 'Si il n’y a qu’un mode de partage, celui ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.', - - 'file_to_import' => 'Fichier à importer', - 'import' => 'Importer', - 'export' => 'Exporter', - 'or' => 'ou', - - 'informations' => 'Informations', - 'damn' => 'Arf !', - 'feed_in_error' => 'Ce flux a rencontré un problème. Veuillez vérifier qu’il est toujours accessible puis actualisez-le.', - 'feed_empty' => 'Ce flux est vide. Veuillez vérifier qu’il est toujours maintenu.', - 'feed_description' => 'Description', - 'website_url' => 'URL du site', - 'feed_url' => 'URL du flux', - 'articles' => 'articles', - 'number_articles' => 'Nombre d’articles', - 'by_feed' => 'par flux', - 'by_default' => 'Par défaut', - 'keep_history' => 'Nombre minimum d’articles à conserver', - 'categorize' => 'Ranger dans une catégorie', - 'truncate' => 'Supprimer tous les articles', - 'advanced' => 'Avancé', - 'show_in_all_flux' => 'Afficher dans le flux principal', - 'yes' => 'Oui', - 'no' => 'Non', - 'css_path_on_website' => 'Sélecteur CSS des articles sur le site d’origine', - 'retrieve_truncated_feeds' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)', - 'http_authentication' => 'Authentification HTTP', - 'http_username' => 'Identifiant HTTP', - 'http_password' => 'Mot de passe HTTP', - 'blank_to_disable' => 'Laissez vide pour désactiver', - 'not_yet_implemented' => 'Pas encore implémenté', - 'access_protected_feeds' => 'La connexion permet d’accéder aux flux protégés par une authentification HTTP', - 'no_selected_feed' => 'Aucun flux sélectionné.', - 'think_to_add' => '<a href="./?c=configure&a=feed">Vous pouvez ajouter des flux</a>.', - - 'current_user' => 'Utilisateur actuel', - 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', - 'default_user' => 'Nom de l’utilisateur par défaut <small>(16 caractères alphanumériques maximum)</small>', - 'persona_connection_email' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>', - 'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)', - 'allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux', - 'auth_token' => 'Jeton d’identification', - 'explain_token' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier.<br /><kbd>%s?output=rss&token=%s</kbd>', - 'login_configuration' => 'Identification', - 'is_admin' => 'est administrateur', - 'auth_type' => 'Méthode d’authentification', - 'auth_none' => 'Aucune (dangereux)', - 'auth_form' => 'Formulaire (traditionnel, requiert JavaScript)', - 'http_auth' => 'HTTP (pour utilisateurs avancés avec HTTPS)', - 'auth_persona' => 'Mozilla Persona (moderne, requiert JavaScript)', - 'users_list' => 'Liste des utilisateurs', - 'create_user' => 'Créer un nouvel utilisateur', - 'username' => 'Nom d’utilisateur', - 'password' => 'Mot de passe', - 'create' => 'Créer', - 'user_created' => 'L’utilisateur %s a été créé', - 'user_deleted' => 'L’utilisateur %s a été supprimé', - - 'language' => 'Langue', - 'month' => 'mois', - 'archiving_configuration' => 'Archivage', - 'delete_articles_every' => 'Supprimer les articles après', - 'purge_now' => 'Purger maintenant', - 'purge_completed' => 'Purge effectuée (%d articles supprimés)', - 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux', - 'reading_configuration' => 'Lecture', - 'articles_per_page' => 'Nombre d’articles par page', - 'default_view' => 'Vue par défaut', - 'sort_order' => 'Ordre de tri', - 'auto_load_more' => 'Charger les articles suivants en bas de page', - 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', - 'after_onread' => 'Après “marquer tout comme lu”,', - 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', - 'reading_icons' => 'Icônes de lecture', - 'top_line' => 'Ligne du haut', - 'bottom_line' => 'Ligne du bas', - 'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images', - 'auto_read_when' => 'Marquer un article comme lu…', - 'article_selected' => 'lorsque l’article est sélectionné', - 'article_open_on_website' => 'lorsque l’article est ouvert sur le site d’origine', - 'scroll' => 'au défilement de la page', - 'upon_reception' => 'dès la réception du nouvel article', - 'your_shaarli' => 'Votre Shaarli', - 'your_wallabag' => 'Votre wallabag', - 'your_diaspora_pod' => 'Votre pod Diaspora*', - 'sharing' => 'Partage', - 'share' => 'Partager', - 'by_email' => 'Par courriel', - 'optimize_bdd' => 'Optimiser la base de données', - 'optimize_todo_sometimes' => 'À faire de temps en temps pour réduire la taille de la BDD', - 'theme' => 'Thème', - 'more_information' => 'Plus d’informations', - 'activate_sharing' => 'Activer le partage', - 'shaarli' => 'Shaarli', - 'wallabag' => 'wallabag', - 'diaspora' => 'Diaspora*', - 'twitter' => 'Twitter', - 'g+' => 'Google+', - 'facebook' => 'Facebook', - 'email' => 'Courriel', - 'print' => 'Imprimer', - - 'article' => 'Article', - 'title' => 'Titre', - 'author' => 'Auteur', - 'publication_date' => 'Date de publication', - 'by' => 'par', - - 'load_more' => 'Charger plus d’articles', - 'nothing_to_load' => 'Fin des articles', - - 'rss_feeds_of' => 'Flux RSS de %s', - - 'refresh' => 'Actualisation', - 'no_feed_to_refresh' => 'Il n’y a aucun flux à actualiser…', - - 'today' => 'Aujourd’hui', - 'yesterday' => 'Hier', - 'before_yesterday' => 'À partir d’avant-hier', - 'new_article' => 'Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.', - 'by_author' => 'Par <em>%s</em>', - 'related_tags' => 'Tags associés', - 'no_feed_to_display' => 'Il n’y a aucun article à afficher.', - - 'about_freshrss' => 'À propos de FreshRSS', - 'project_website' => 'Site du projet', - 'lead_developer' => 'Développeur principal', - 'website' => 'Site Internet', - 'bugs_reports' => 'Rapports de bugs', - 'github_or_email' => '<a href="https://github.com/marienfressinaud/FreshRSS/issues">sur Github</a> ou <a href="mailto:dev@marienfressinaud.fr">par courriel</a>', - 'license' => 'Licence', - 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', - 'freshrss_description' => 'FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> ou <a href="http://projet.idleman.fr/leed/">Leed</a>. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable.', - 'credits' => 'Crédits', - 'credits_content' => 'Des éléments de design sont issus du <a href="http://twitter.github.io/bootstrap/">projet Bootstrap</a> bien que FreshRSS n’utilise pas ce framework. Les <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icônes</a> sont issues du <a href="https://www.gnome.org/">projet GNOME</a>. La police <em>Open Sans</em> utilisée a été créée par <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. Les favicons sont récupérés grâce au site <a href="https://getfavicon.appspot.com/">getFavicon</a>. FreshRSS repose sur <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.', - 'version' => 'Version', - - 'logs' => 'Logs', - 'logs_empty' => 'Les logs sont vides', - 'clear_logs' => 'Effacer les logs', - - 'forbidden_access' => 'L’accès vous est interdit !', - 'login_required' => 'Accès protégé par mot de passe :', - - 'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !', - - // DATE - 'january' => 'janvier', - 'february' => 'février', - 'march' => 'mars', - 'april' => 'avril', - 'may' => 'mai', - 'june' => 'juin', - 'july' => 'juillet', - 'august' => 'août', - 'september' => 'septembre', - 'october' => 'octobre', - 'november' => 'novembre', - 'december' => 'décembre', - // format spécial pour la fonction date() - 'Jan' => '\j\a\n\v\i\e\r', - 'Feb' => '\f\é\v\r\i\e\r', - 'Mar' => '\m\a\r\s', - 'Apr' => '\a\v\r\i\l', - 'May' => '\m\a\i', - 'Jun' => '\j\u\i\n', - 'Jul' => '\j\u\i\l\l\e\t', - 'Aug' => '\a\o\û\t', - 'Sep' => '\s\e\p\t\e\m\b\r\e', - 'Oct' => '\o\c\t\o\b\r\e', - 'Nov' => '\n\o\v\e\m\b\r\e', - 'Dec' => '\d\é\c\e\m\b\r\e', - // format pour la fonction date(), %s permet d'indiquer le mois en toutes lettres - 'format_date' => 'j %s Y', - 'format_date_hour' => 'j %s Y \à H\:i', - - 'status_favorites' => 'favoris', - 'status_read' => 'lus', - 'status_unread' => 'non lus', - 'status_total' => 'total', - - 'stats_entry_repartition' => 'Répartition des articles', - 'stats_entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)', - 'stats_feed_per_category' => 'Flux par catégorie', - 'stats_entry_per_category' => 'Articles par catégorie', - 'stats_top_feed' => 'Les dix plus gros flux', - 'stats_entry_count' => 'Nombre d’articles', -); diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php new file mode 100644 index 000000000..9a13ecc21 --- /dev/null +++ b/app/i18n/fr/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)', + 'allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux', + 'api_enabled' => 'Autoriser l’accès par <abbr>API</abbr> <small>(nécessaire pour les applis mobiles)</small>', + 'form' => 'Formulaire (traditionnel, requiert JavaScript)', + 'http' => 'HTTP (pour utilisateurs avancés avec HTTPS)', + 'none' => 'Aucune (dangereux)', + 'title' => 'Authentification', + 'title_reset' => 'Réinitialisation de l’authentification', + 'token' => 'Jeton d’identification', + 'token_help' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier :', + 'type' => 'Méthode d’authentification', + 'unsafe_autologin' => 'Autoriser les connexions automatiques non-sûres au format : ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/cache</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire de cache sont bons.', + ), + 'categories' => array( + 'nok' => 'La table category est mal configurée.', + 'ok' => 'La table category est bien configurée.', + ), + 'connection' => array( + 'nok' => 'La connexion à la base de données est impossible.', + 'ok' => 'La connexion à la base de données est bonne.', + ), + 'ctype' => array( + 'nok' => 'Impossible de trouver une librairie pour la vérification des types de caractères (php-ctype).', + 'ok' => 'Vous disposez de la librairie pour la vérification des types de caractères (ctype).', + ), + 'curl' => array( + 'nok' => 'Impossible de trouver la librairie cURL (paquet php-curl).', + 'ok' => 'Vous disposez de la librairie cURL.', + ), + 'data' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire de data sont bons.', + ), + 'database' => 'Installation de la base de données', + 'dom' => array( + 'nok' => 'Impossible de trouver une librairie pour parcourir le DOM (paquet php-xml).', + 'ok' => 'Vous disposez de la librairie pour parcourir le DOM.', + ), + 'entries' => array( + 'nok' => 'La table entry est mal configurée.', + 'ok' => 'La table entry est bien configurée.', + ), + 'favicons' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/favicons</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire des favicons sont bons.', + ), + 'feeds' => array( + 'nok' => 'La table feed est mal configurée.', + 'ok' => 'La table feed est bien configurée.', + ), + 'fileinfo' => array( + 'nok' => 'Impossible de trouver la librairie PHP fileinfo (paquet fileinfo).', + 'ok' => 'Vous disposez de la librairie fileinfo.', + ), + 'files' => 'Installation des fichiers', + 'json' => array( + 'nok' => 'Vous ne disposez pas de JSON (paquet php5-json).', + 'ok' => 'Vous disposez de l’extension JSON.', + ), + 'minz' => array( + 'nok' => 'Vous ne disposez pas de la librairie Minz.', + 'ok' => 'Vous disposez du framework Minz', + ), + 'pcre' => array( + 'nok' => 'Impossible de trouver une librairie pour les expressions régulières (php-pcre).', + 'ok' => 'Vous disposez de la librairie pour les expressions régulières (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Installation de PHP', + 'nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s.', + 'ok' => 'Votre version de PHP est la %s, qui est compatible avec FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Impossible de trouver une ou plusieurs tables en base de données.', + 'ok' => 'Les tables sont bien présentes en base de données.', + ), + 'title' => 'Vérification de l’installation', + 'tokens' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/tokens</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire des tokens sont bons.', + ), + 'users' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/users</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire des utilisateurs sont bons.', + ), + 'zip' => array( + 'nok' => 'Vous ne disposez pas de l’extension ZIP (paquet php-zip).', + 'ok' => 'Vous disposez de l’extension ZIP.', + ), + ), + 'extensions' => array( + 'disabled' => 'Désactivée', + 'empty_list' => 'Il n’y a aucune extension installée.', + 'enabled' => 'Activée', + 'no_configure_view' => 'Cette extension ne peut pas être configurée.', + 'system' => array( + '_' => 'Extensions système', + 'no_rights' => 'Extension système (vous n’avez aucun droit dessus)', + ), + 'title' => 'Extensions', + 'user' => 'Extensions utilisateur', + ), + 'stats' => array( + '_' => 'Statistiques', + 'all_feeds' => 'Tous les flux', + 'category' => 'Catégorie', + 'entry_count' => 'Nombre d’articles', + 'entry_per_category' => 'Articles par catégorie', + 'entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)', + 'entry_per_day_of_week' => 'Par jour de la semaine (moyenne : %.2f messages)', + 'entry_per_hour' => 'Par heure (moyenne : %.2f messages)', + 'entry_per_month' => 'Par mois (moyenne : %.2f messages)', + 'entry_repartition' => 'Répartition des articles', + 'feed' => 'Flux', + 'feed_per_category' => 'Flux par catégorie', + 'idle' => 'Flux inactifs', + 'main' => 'Statistiques principales', + 'main_stream' => 'Flux principal', + 'menu' => array( + 'idle' => 'Flux inactifs', + 'main' => 'Statistiques principales', + 'repartition' => 'Répartition des articles', + ), + 'no_idle' => 'Il n’y a aucun flux inactif !', + 'number_entries' => '%d articles', + 'percent_of_total' => '%% du total', + 'repartition' => 'Répartition des articles', + 'status_favorites' => 'favoris', + 'status_read' => 'lus', + 'status_total' => 'total', + 'status_unread' => 'non lus', + 'title' => 'Statistiques', + 'top_feed' => 'Les dix plus gros flux', + ), + 'system' => array( + '_' => 'Configuration du système', + 'auto-update-url' => 'URL du service de mise à jour', + 'instance-name' => 'Nom de l’instance', + 'max-categories' => 'Limite de catégories par utilisateur', + 'max-feeds' => 'Limite de flux par utilisateur', + 'registration' => array( + 'help' => 'Un chiffre de 0 signifie que l’on peut créer un nombre infini de comptes', + 'number' => 'Nombre max de comptes', + ), + ), + 'update' => array( + '_' => 'Système de mise à jour', + 'apply' => 'Appliquer la mise à jour', + 'check' => 'Vérifier les mises à jour', + 'current_version' => 'Votre version actuelle de FreshRSS est la %s.', + 'last' => 'Dernière vérification : %s', + 'none' => 'Aucune mise à jour à appliquer', + 'title' => 'Système de mise à jour', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'create' => 'Créer un nouvel utilisateur', + 'language' => 'Langue', + 'number' => '%d compte a déjà été créé', + 'numbers' => '%d comptes ont déjà été créés', + 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', + 'password_format' => '7 caractères minimum', + 'title' => 'Gestion des utilisateurs', + 'user_list' => 'Liste des utilisateurs', + 'username' => 'Nom d’utilisateur', + 'users' => 'Utilisateurs', + ), +); diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php new file mode 100644 index 000000000..7a6d12e17 --- /dev/null +++ b/app/i18n/fr/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archivage', + 'advanced' => 'Avancé', + 'delete_after' => 'Supprimer les articles après', + 'help' => 'D’autres options sont disponibles dans la configuration individuelle des flux.', + 'keep_history_by_feed' => 'Nombre minimum d’articles à conserver par flux', + 'optimize' => 'Optimiser la base de données', + 'optimize_help' => 'À faire de temps en temps pour réduire la taille de la BDD', + 'purge_now' => 'Purger maintenant', + 'title' => 'Archivage', + 'ttl' => 'Ne pas automatiquement rafraîchir plus souvent que', + ), + 'display' => array( + '_' => 'Affichage', + 'icon' => array( + 'bottom_line' => 'Ligne du bas', + 'entry' => 'Icônes d’article', + 'publication_date' => 'Date de publication', + 'related_tags' => 'Tags associés', + 'sharing' => 'Partage', + 'top_line' => 'Ligne du haut', + ), + 'language' => 'Langue', + 'notif_html5' => array( + 'seconds' => 'secondes (0 signifie aucun timeout)', + 'timeout' => 'Temps d’affichage de la notification HTML5', + ), + 'theme' => 'Thème', + 'title' => 'Affichage', + 'width' => array( + 'content' => 'Largeur du contenu', + 'large' => 'Large', + 'medium' => 'Moyenne', + 'no_limit' => 'Pas de limite', + 'thin' => 'Fine', + ), + ), + 'query' => array( + '_' => 'Filtres utilisateurs', + 'deprecated' => 'Ce filtre n’est plus valide. La catégorie ou le flux concerné a été supprimé.', + 'filter' => 'Filtres appliqués :', + 'get_all' => 'Afficher tous les articles', + 'get_category' => 'Afficher la catégorie "%s"', + 'get_favorite' => 'Afficher les articles favoris', + 'get_feed' => 'Afficher le flux "%s"', + 'no_filter' => 'Aucun filtre appliqué', + 'none' => 'Vous n’avez pas encore créé de filtre.', + 'number' => 'Filtre n°%d', + 'order_asc' => 'Afficher les articles les plus anciens en premier', + 'order_desc' => 'Afficher les articles les plus récents en premier', + 'search' => 'Recherche de "%s"', + 'state_0' => 'Afficher tous les articles', + 'state_1' => 'Afficher les articles lus', + 'state_2' => 'Afficher les articles non lus', + 'state_3' => 'Afficher tous les articles', + 'state_4' => 'Afficher les articles favoris', + 'state_5' => 'Afficher les articles lus et favoris', + 'state_6' => 'Afficher les articles non lus et favoris', + 'state_7' => 'Afficher les articles favoris', + 'state_8' => 'Afficher les articles non favoris', + 'state_9' => 'Afficher les articles lus et non favoris', + 'state_10' => 'Afficher les articles non lus et non favoris', + 'state_11' => 'Afficher les articles non favoris', + 'state_12' => 'Afficher tous les articles', + 'state_13' => 'Afficher les articles lus', + 'state_14' => 'Afficher les articles non lus', + 'state_15' => 'Afficher tous les articles', + 'title' => 'Filtres utilisateurs', + ), + 'profile' => array( + '_' => 'Gestion du profil', + 'delete' => array( + '_' => 'Suppression du compte', + 'warn' => 'Le compte et toutes les données associées vont être supprimées.', + ), + 'password_api' => 'Mot de passe API<br /><small>(ex. : pour applis mobiles)</small>', + 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', + 'password_format' => '7 caractères minimum', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Lecture', + 'after_onread' => 'Après “marquer tout comme lu”,', + 'articles_per_page' => 'Nombre d’articles par page', + 'auto_load_more' => 'Charger les articles suivants en bas de page', + 'auto_remove_article' => 'Cacher les articles après lecture', + 'mark_updated_article_unread' => 'Marquer les articles mis à jour comme non-lus', + 'confirm_enabled' => 'Afficher une confirmation lors des actions “marquer tout comme lu”', + 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', + 'display_categories_unfolded' => 'Afficher les catégories pliées par défaut', + 'hide_read_feeds' => 'Cacher les catégories & flux sans article non-lu (ne fonctionne pas avec la configuration “Afficher tous les articles”)', + 'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images', + 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', + 'number_divided_when_reader' => 'Divisé par 2 dans la vue de lecture.', + 'read' => array( + 'article_open_on_website' => 'lorsque l’article est ouvert sur le site d’origine', + 'article_viewed' => 'lorsque l’article est affiché', + 'scroll' => 'au défilement de la page', + 'upon_reception' => 'dès la réception du nouvel article', + 'when' => 'Marquer un article comme lu…', + ), + 'show' => array( + '_' => 'Articles à afficher', + 'adaptive' => 'Adapter l’affichage', + 'all_articles' => 'Afficher tous les articles', + 'unread' => 'Afficher les non lus', + ), + 'sort' => array( + '_' => 'Ordre de tri', + 'newer_first' => 'Plus récents en premier', + 'older_first' => 'Plus anciens en premier', + ), + 'sticky_post' => 'Aligner l’article en haut quand il est ouvert', + 'title' => 'Lecture', + 'view' => array( + 'default' => 'Vue par défaut', + 'global' => 'Vue globale', + 'normal' => 'Vue normale', + 'reader' => 'Vue lecture', + ), + ), + 'sharing' => array( + '_' => 'Partage', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Courriel', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Plus d’informations', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'share_name' => 'Nom du partage à afficher', + 'share_url' => 'URL du partage à utiliser', + 'title' => 'Partage', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Raccourcis', + 'article_action' => 'Actions associées à l’article courant', + 'auto_share' => 'Partager', + 'auto_share_help' => 'S’il n’y a qu’un mode de partage, celui-ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.', + 'close_dropdown' => 'Fermer les menus', + 'collapse_article' => 'Refermer', + 'first_article' => 'Passer au premier article', + 'focus_search' => 'Accéder à la recherche', + 'help' => 'Afficher la documentation', + 'javascript' => 'Le JavaScript doit être activé pour pouvoir profiter des raccourcis.', + 'last_article' => 'Passer au dernier article', + 'load_more' => 'Charger plus d’articles', + 'mark_read' => 'Marquer comme lu', + 'mark_favorite' => 'Mettre en favori', + 'navigation' => 'Navigation', + 'navigation_help' => 'Avec le modificateur "Shift", les raccourcis de navigation s’appliquent aux flux.<br/>Avec le modificateur "Alt", les raccourcis de navigation s’appliquent aux catégories.', + 'next_article' => 'Passer à l’article suivant', + 'other_action' => 'Autres actions', + 'previous_article' => 'Passer à l’article précédent', + 'see_on_website' => 'Voir sur le site d’origine', + 'shift_for_all_read' => '+ <code>shift</code> pour marquer tous les articles comme lus', + 'title' => 'Raccourcis', + 'user_filter' => 'Accéder aux filtres utilisateur', + 'user_filter_help' => 'S’il n’y a qu’un filtre utilisateur, celui-ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'current' => 'Utilisateur actuel', + 'is_admin' => 'est administrateur', + 'users' => 'Utilisateurs', + ), +); diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php new file mode 100644 index 000000000..5966fc3a7 --- /dev/null +++ b/app/i18n/fr/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimisation terminée.', + ), + 'access' => array( + 'denied' => 'Vous n’avez pas le droit d’accéder à cette page !', + 'not_found' => 'La page que vous cherchez n’existe pas !', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Un problème est survenu lors de la configuration de votre système d’authentification. Veuillez réessayer plus tard.', + 'set' => 'Le formulaire est désormais votre système d’authentification.', + ), + 'login' => array( + 'invalid' => 'L’identifiant est invalide', + 'success' => 'Vous êtes désormais connecté', + ), + 'logout' => array( + 'success' => 'Vous avez été déconnecté', + ), + 'no_password_set' => 'Aucun mot de passe administrateur n’a été précisé. Cette fonctionnalité n’est pas disponible.', + ), + 'conf' => array( + 'error' => 'Une erreur est survenue durant la sauvegarde de la configuration', + 'query_created' => 'Le filtre "%s" a bien été créé.', + 'shortcuts_updated' => 'Les raccourcis ont été mis à jour.', + 'updated' => 'La configuration a été mise à jour', + ), + 'extensions' => array( + 'already_enabled' => '%s est déjà activée', + 'disable' => array( + 'ko' => '%s ne peut pas être désactivée. <a href="%s">Consulter les logs de FreshRSS</a> pour plus de détails.', + 'ok' => '%s est désormais désactivée', + ), + 'enable' => array( + 'ko' => '%s ne peut pas être activée. <a href="%s">Consulter les logs de FreshRSS</a> pour plus de détails.', + 'ok' => '%s est désormais activée', + ), + 'no_access' => 'Vous n’avez aucun accès sur %s', + 'not_enabled' => '%s n’est pas encore activée', + 'not_found' => '%s n’existe pas', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'L’extension ZIP n’est pas présente sur votre serveur. Veuillez essayer d’exporter les fichiers un par un.', + 'feeds_imported' => 'Vos flux ont été importés et vont maintenant être actualisés.', + 'feeds_imported_with_errors' => 'Vos flux ont été importés mais des erreurs sont survenues.', + 'file_cannot_be_uploaded' => 'Le fichier ne peut pas être téléchargé !', + 'no_zip_extension' => 'L’extension ZIP n’est pas présente sur votre serveur.', + 'zip_error' => 'Une erreur est survenue durant l’import du fichier ZIP.', + ), + 'sub' => array( + 'actualize' => 'Actualiser', + 'category' => array( + 'created' => 'La catégorie %s a été créée.', + 'deleted' => 'La catégorie a été supprimée.', + 'emptied' => 'La catégorie a été vidée.', + 'error' => 'La catégorie n’a pas pu être modifiée', + 'name_exists' => 'Une catégorie possède déjà ce nom.', + 'no_id' => 'Vous devez préciser l’id de la catégorie.', + 'no_name' => 'Vous devez préciser un nom pour la catégorie.', + 'not_delete_default' => 'Vous ne pouvez pas supprimer la catégorie par défaut !', + 'not_exist' => 'Cette catégorie n’existe pas !', + 'over_max' => 'Vous avez atteint votre limite de catégories (%d)', + 'updated' => 'La catégorie a été mise à jour.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> a été mis à jour.', + 'actualizeds' => 'Les flux ont été mis à jour.', + 'added' => 'Le flux <em>%s</em> a bien été ajouté.', + 'already_subscribed' => 'Vous êtes déjà abonné à <em>%s</em>', + 'deleted' => 'Le flux a été supprimé.', + 'error' => 'Une erreur est survenue', + 'internal_problem' => 'Le flux ne peut pas être ajouté. <a href="%s">Consulter les logs de FreshRSS</a> pour plus de détails.', + 'invalid_url' => 'L’url <em>%s</em> est invalide.', + 'marked_read' => 'Les flux ont été marqués comme lus.', + 'n_actualized' => '%d flux ont été mis à jour.', + 'n_entries_deleted' => '%d articles ont été supprimés.', + 'no_refresh' => 'Il n’y a aucun flux à actualiser…', + 'not_added' => '<em>%s</em> n’a pas pu être ajouté.', + 'over_max' => 'Vous avez atteint votre limite de flux (%d)', + 'updated' => 'Le flux a été mis à jour', + ), + 'purge_completed' => 'Purge effectuée (%d articles supprimés).', + ), + 'update' => array( + 'can_apply' => 'FreshRSS va maintenant être mis à jour vers la <strong>version %s</strong>.', + 'error' => 'La mise à jour a rencontré un problème : %s', + 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'finished' => 'La mise à jour est terminée !', + 'none' => 'Aucune mise à jour à appliquer', + 'server_not_found' => 'Le serveur de mise à jour n’a pas été trouvé. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'L’utilisateur %s a été créé.', + 'error' => 'L’utilisateur %s ne peut pas être créé.', + ), + 'deleted' => array( + '_' => 'L’utilisateur %s a été supprimé.', + 'error' => 'L’utilisateur %s ne peut pas être supprimé.', + ), + ), + 'profile' => array( + 'error' => 'Votre profil n’a pas pu être mis à jour', + 'updated' => 'Votre profil a été mis à jour', + ), +); diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php new file mode 100644 index 000000000..b5dc098ae --- /dev/null +++ b/app/i18n/fr/gen.php @@ -0,0 +1,182 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualiser', + 'back_to_rss_feeds' => '← Retour à vos flux RSS', + 'cancel' => 'Annuler', + 'create' => 'Créer', + 'disable' => 'Désactiver', + 'empty' => 'Vider', + 'enable' => 'Activer', + 'export' => 'Exporter', + 'filter' => 'Filtrer', + 'import' => 'Importer', + 'manage' => 'Gérer', + 'mark_read' => 'Marquer comme lu', + 'mark_favorite' => 'Mettre en favori', + 'remove' => 'Supprimer', + 'see_website' => 'Voir le site', + 'submit' => 'Valider', + 'truncate' => 'Supprimer tous les articles', + ), + 'auth' => array( + 'email' => 'Adresse courriel', + 'keep_logged_in' => 'Rester connecté <small>(%s jours)</small>', + 'login' => 'Connexion', + 'logout' => 'Déconnexion', + 'password' => array( + '_' => 'Mot de passe', + 'format' => '<small>7 caractères minimum</small>', + ), + 'registration' => array( + '_' => 'Nouveau compte', + 'ask' => 'Créer un compte ?', + 'title' => 'Création de compte', + ), + 'reset' => 'Réinitialisation de l’authentification', + 'username' => array( + '_' => 'Nom d’utilisateur', + 'admin' => 'Nom d’utilisateur administrateur', + 'format' => '<small>16 caractères alphanumériques maximum</small>', + ), + ), + 'date' => array( + 'Apr' => '\\a\\v\\r\\i\\l', + 'Aug' => '\\a\\o\\û\\t', + 'Dec' => '\\d\\é\\c\\e\\m\\b\\r\\e', + 'Feb' => '\\f\\é\\v\\r\\i\\e\\r', + 'Jan' => '\\j\\a\\n\\v\\i\\e\\r', + 'Jul' => '\\j\\u\\i\\l\\l\\e\\t', + 'Jun' => '\\j\\u\\i\\n', + 'Mar' => '\\m\\a\\r\\s', + 'May' => '\\m\\a\\i', + 'Nov' => '\\n\\o\\v\\e\\m\\b\\r\\e', + 'Oct' => '\\o\\c\\t\\o\\b\\r\\e', + 'Sep' => '\\s\\e\\p\\t\\e\\m\\b\\r\\e', + 'apr' => 'avr.', + 'april' => 'avril', + 'aug' => 'août', + 'august' => 'août', + 'before_yesterday' => 'À partir d’avant-hier', + 'dec' => 'déc.', + 'december' => 'décembre', + 'feb' => 'fév.', + 'february' => 'février', + 'format_date' => 'j %s Y', + 'format_date_hour' => 'j %s Y \\à H\\:i', + 'fri' => 'ven.', + 'jan' => 'jan.', + 'january' => 'janvier', + 'jul' => 'jui.', + 'july' => 'juillet', + 'jun' => 'juin', + 'june' => 'juin', + 'last_3_month' => 'Depuis les trois derniers mois', + 'last_6_month' => 'Depuis les six derniers mois', + 'last_month' => 'Depuis le mois dernier', + 'last_week' => 'Depuis la semaine dernière', + 'last_year' => 'Depuis l’année dernière', + 'mar' => 'mar.', + 'march' => 'mars', + 'may' => 'mai.', + 'mon' => 'lun.', + 'month' => 'mois', + 'nov' => 'nov.', + 'november' => 'novembre', + 'oct' => 'oct.', + 'october' => 'octobre', + 'sat' => 'sam.', + 'sep' => 'sep.', + 'september' => 'septembre', + 'sun' => 'dim.', + 'thu' => 'jeu.', + 'today' => 'Aujourd’hui', + 'tue' => 'mar.', + 'wed' => 'mer.', + 'yesterday' => 'Hier', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'À propos de FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Catégorie vide', + 'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !', + 'confirm_action_feed_cat' => 'Êtes-vous sûr(e) de vouloir continuer ? Vous perdrez les favoris et les filtres associés. Cette action ne peut être annulée !', + 'feedback' => array( + 'body_new_articles' => 'Il y a %%d nouveaux articles à lire sur FreshRSS.', + 'request_failed' => 'Une requête a échoué, cela peut être dû à des problèmes de connexion à Internet.', + 'title_new_articles' => 'FreshRSS : nouveaux articles !', + ), + 'new_article' => 'Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.', + 'should_be_activated' => 'Le JavaScript doit être activé.', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'À propos', + 'admin' => 'Administration', + 'archiving' => 'Archivage', + 'authentication' => 'Authentification', + 'check_install' => 'Vérification de l’installation', + 'configuration' => 'Configuration', + 'display' => 'Affichage', + 'extensions' => 'Extensions', + 'logs' => 'Logs', + 'queries' => 'Filtres utilisateurs', + 'reading' => 'Lecture', + 'search' => 'Rechercher des mots ou des #tags', + 'sharing' => 'Partage', + 'shortcuts' => 'Raccourcis', + 'stats' => 'Statistiques', + 'system' => 'Configuration du système', + 'update' => 'Mise à jour', + 'user_management' => 'Gestion des utilisateurs', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'Début', + 'last' => 'Fin', + 'load_more' => 'Charger plus d’articles', + 'mark_all_read' => 'Tout marquer comme lu', + 'next' => 'Suivant', + 'nothing_to_load' => 'Fin des articles', + 'previous' => 'Précédent', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Courriel', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Imprimer', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Attention !', + 'blank_to_disable' => 'Laissez vide pour désactiver', + 'by_author' => 'Par <em>%s</em>', + 'by_default' => 'Par défaut', + 'damn' => 'Arf !', + 'default_category' => 'Sans catégorie', + 'no' => 'Non', + 'not_applicable' => 'Non disponible', + 'ok' => 'Ok !', + 'or' => 'ou', + 'yes' => 'Oui', + ), +); diff --git a/app/i18n/fr/index.php b/app/i18n/fr/index.php new file mode 100644 index 000000000..62eedc280 --- /dev/null +++ b/app/i18n/fr/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'À propos', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Rapports de bugs', + 'credits' => 'Crédits', + 'credits_content' => 'Des éléments de design sont issus du <a href="http://twitter.github.io/bootstrap/">projet Bootstrap</a> bien que FreshRSS n’utilise pas ce framework. Les <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icônes</a> sont issues du <a href="https://www.gnome.org/">projet GNOME</a>. La police <em>Open Sans</em> utilisée a été créée par <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS repose sur <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.', + 'freshrss_description' => 'FreshRSS est un agrégateur de flux RSS à auto-héberger à l’image de <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> ou <a href="http://projet.idleman.fr/leed/">Leed</a>. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">sur Github</a>', + 'license' => 'Licence', + 'project_website' => 'Site du projet', + 'title' => 'À propos', + 'version' => 'Version', + 'website' => 'Site Internet', + ), + 'feed' => array( + 'add' => 'Vous pouvez ajouter des flux.', + 'empty' => 'Il n’y a aucun article à afficher.', + 'rss_of' => 'Flux RSS de %s', + 'title' => 'Vos flux RSS', + 'title_global' => 'Vue globale', + 'title_fav' => 'Vos favoris', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Effacer les logs', + 'empty' => 'Les logs sont vides.', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'À propos de FreshRSS', + 'add_query' => 'Créer un filtre', + 'before_one_day' => 'Antérieurs à 1 jour', + 'before_one_week' => 'Antérieurs à 1 semaine', + 'favorites' => 'Favoris (%s)', + 'global_view' => 'Vue globale', + 'main_stream' => 'Flux principal', + 'mark_all_read' => 'Tout marquer comme lu', + 'mark_cat_read' => 'Marquer la catégorie comme lue', + 'mark_feed_read' => 'Marquer le flux comme lu', + 'newer_first' => 'Plus récents en premier', + 'non-starred' => 'Afficher tout sauf les favoris', + 'normal_view' => 'Vue normale', + 'older_first' => 'Plus anciens en premier', + 'queries' => 'Filtres utilisateurs', + 'read' => 'Afficher les lus', + 'reader_view' => 'Vue lecture', + 'rss_view' => 'Flux RSS', + 'search_short' => 'Rechercher', + 'starred' => 'Afficher les favoris', + 'stats' => 'Statistiques', + 'subscription' => 'Gestion des abonnements', + 'unread' => 'Afficher les non lus', + ), + 'share' => 'Partager', + 'tag' => array( + 'related' => 'Tags associés', + ), +); diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.php new file mode 100644 index 000000000..09625de78 --- /dev/null +++ b/app/i18n/fr/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Terminer l’installation', + 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', + 'keep_install' => 'Garder l’ancienne configuration', + 'next_step' => 'Passer à l’étape suivante', + 'reinstall' => 'Réinstaller FreshRSS', + ), + 'auth' => array( + 'form' => 'Formulaire (traditionnel, requiert JavaScript)', + 'http' => 'HTTP (pour utilisateurs avancés avec HTTPS)', + 'none' => 'Aucune (dangereux)', + 'password_form' => 'Mot de passe<br /><small>(pour connexion par formulaire)</small>', + 'password_format' => '7 caractères minimum', + 'type' => 'Méthode d’authentification', + ), + 'bdd' => array( + '_' => 'Base de données', + 'conf' => array( + '_' => 'Configuration de la base de données', + 'ko' => 'Vérifiez les informations d’accès à la base de données.', + 'ok' => 'La configuration de la base de données a été enregistrée.', + ), + 'host' => 'Hôte', + 'password' => 'Mot de passe pour base de données', + 'prefix' => 'Préfixe des tables', + 'type' => 'Type de base de données', + 'username' => 'Nom d’utilisateur pour base de données', + ), + 'check' => array( + '_' => 'Vérifications', + 'already_installed' => 'FreshRSS semble avoir déjà été installé !', + 'cache' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/cache</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire de cache sont bons.', + ), + 'ctype' => array( + 'nok' => 'Impossible de trouver une librairie pour la vérification des types de caractères (php-ctype).', + 'ok' => 'Vous disposez de la librairie pour la vérification des types de caractères (ctype).', + ), + 'curl' => array( + 'nok' => 'Vous ne disposez pas de cURL (paquet php-curl).', + 'ok' => 'Vous disposez de cURL.', + ), + 'data' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire de data sont bons.', + ), + 'dom' => array( + 'nok' => 'Impossible de trouver une librairie pour parcourir le DOM.', + 'ok' => 'Vous disposez de la librairie pour parcourir le DOM.', + ), + 'favicons' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/favicons</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire des favicons sont bons.', + ), + 'fileinfo' => array( + 'nok' => 'Vous ne disposez pas de PHP fileinfo (paquet fileinfo).', + 'ok' => 'Vous disposez de fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Veuillez vérifier que vous ne modifiez pas votre HTTP REFERER.', + 'ok' => 'Le HTTP REFERER est connu et semble correspondre à votre serveur.', + ), + 'json' => array( + 'nok' => 'Impossible de trouver une librairie recommandée pour JSON.', + 'ok' => 'Vouz disposez de la librairie recommandée pour JSON.', + ), + 'minz' => array( + 'nok' => 'Vous ne disposez pas de la librairie Minz.', + 'ok' => 'Vous disposez du framework Minz', + ), + 'pcre' => array( + 'nok' => 'Impossible de trouver une librairie pour les expressions régulières (php-pcre).', + 'ok' => 'Vous disposez de la librairie pour les expressions régulières (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s.', + 'ok' => 'Votre version de PHP est la %s, qui est compatible avec FreshRSS.', + ), + 'users' => array( + 'nok' => 'Veuillez vérifier les droits sur le répertoire <em>./data/users</em>. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire des utilisateurs sont bons.', + ), + 'xml' => array( + 'nok' => 'Impossible de trouver une librairie requise pour XML.', + 'ok' => 'Vouz disposez de la librairie requise pour XML.', + ), + ), + 'conf' => array( + '_' => 'Configuration générale', + 'ok' => 'La configuration générale a été enregistrée.', + ), + 'congratulations' => 'Félicitations !', + 'default_user' => 'Nom de l’utilisateur par défaut <small>(16 caractères alphanumériques maximum)</small>', + 'delete_articles_after' => 'Supprimer les articles après', + 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', + 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', + 'js' => array( + 'confirm_reinstall' => 'Réinstaller FreshRSS vous fera perdre la configuration précédente. Êtes-vous sûr de vouloir continuer ?', + ), + 'language' => array( + '_' => 'Langue', + 'choose' => 'Choisissez la langue pour FreshRSS', + 'defined' => 'La langue a bien été définie.', + ), + 'not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier <em>%s</em> à la main.', + 'ok' => 'L’installation s’est bien passée.', + 'step' => 'étape %d', + 'steps' => 'Étapes', + 'title' => 'Installation · FreshRSS', + 'this_is_the_end' => 'This is the end', +); diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php new file mode 100644 index 000000000..bb3f2fefc --- /dev/null +++ b/app/i18n/fr/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Catégorie', + 'add' => 'Ajouter une catégorie', + 'empty' => 'Catégorie vide', + 'new' => 'Nouvelle catégorie', + ), + 'feed' => array( + 'add' => 'Ajouter un flux RSS', + 'advanced' => 'Avancé', + 'archiving' => 'Archivage', + 'auth' => array( + 'configuration' => 'Identification', + 'help' => 'La connexion permet d’accéder aux flux protégés par une authentification HTTP.', + 'http' => 'Authentification HTTP', + 'password' => 'Mot de passe HTTP', + 'username' => 'Identifiant HTTP', + ), + 'css_help' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)', + 'css_path' => 'Sélecteur CSS des articles sur le site d’origine', + 'description' => 'Description', + 'empty' => 'Ce flux est vide. Veuillez vérifier qu’il est toujours maintenu.', + 'error' => 'Ce flux a rencontré un problème. Veuillez vérifier qu’il est toujours accessible puis actualisez-le.', + 'in_main_stream' => 'Afficher dans le flux principal', + 'informations' => 'Informations', + 'keep_history' => 'Nombre minimum d’articles à conserver', + 'moved_category_deleted' => 'Lors de la suppression d’une catégorie, ses flux seront automatiquement classés dans <em>%s</em>.', + 'no_selected' => 'Aucun flux sélectionné.', + 'number_entries' => '%d articles', + 'stats' => 'Statistiques', + 'think_to_add' => 'Vous pouvez ajouter des flux.', + 'title' => 'Titre', + 'title_add' => 'Ajouter un flux RSS', + 'ttl' => 'Ne pas automatiquement rafraîchir plus souvent que', + 'url' => 'URL du flux', + 'validator' => 'Vérifier la validité du flux', + 'website' => 'URL du site', + 'pubsubhubbub' => 'Notification instantanée par PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Exporter', + 'export_opml' => 'Exporter la liste des flux (OPML)', + 'export_starred' => 'Exporter les favoris', + 'feed_list' => 'Liste des articles de %s', + 'file_to_import' => 'Fichier à importer<br />(OPML, JSON ou ZIP)', + 'file_to_import_no_zip' => 'Fichier à importer<br />(OPML ou JSON)', + 'import' => 'Importer', + 'starred_list' => 'Liste des articles favoris', + 'title' => 'Importer / exporter', + ), + 'menu' => array( + 'bookmark' => 'S’abonner (bookmark FreshRSS)', + 'import_export' => 'Importer / exporter', + 'subscription_management' => 'Gestion des abonnements', + ), + 'title' => array( + '_' => 'Gestion des abonnements', + 'feed_management' => 'Gestion des flux RSS', + ), +); diff --git a/app/i18n/install.en.php b/app/i18n/install.en.php deleted file mode 100644 index 0311ee9a4..000000000 --- a/app/i18n/install.en.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -return array ( - 'freshrss_installation' => 'Installation · FreshRSS', - 'freshrss' => 'FreshRSS', - 'installation_step' => 'Installation — step %d · FreshRSS', - 'steps' => 'Steps', - 'checks' => 'Checks', - 'general_configuration' => 'General configuration', - 'bdd_configuration' => 'Database configuration', - 'bdd_type' => 'Type of database', - 'version_update' => 'Update', - 'this_is_the_end' => 'This is the end', - - 'ok' => 'Ok!', - 'congratulations' => 'Congratulations!', - 'attention' => 'Attention!', - 'damn' => 'Damn!', - 'oops' => 'Oops!', - 'next_step' => 'Go to the next step', - - 'language_defined' => 'Language has been defined.', - 'choose_language' => 'Choose a language for FreshRSS', - - 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', - 'php_is_ok' => 'Your PHP version is %s, which is compatible with FreshRSS', - 'php_is_nok' => 'Your PHP version is %s but FreshRSS requires at least version %s', - 'minz_is_ok' => 'You have the Minz framework', - 'minz_is_nok' => 'You lack the Minz framework. You should execute <em>build.sh</em> script or <a href="https://github.com/marienfressinaud/MINZ">download it on Github</a> and install in <em>%s</em> directory the content of its <em>/lib</em> directory.', - 'curl_is_ok' => 'You have version %s of cURL', - 'curl_is_nok' => 'You lack cURL (php5-curl package)', - 'pdomysql_is_ok' => 'You have PDO and its driver for MySQL', - 'pdomysql_is_nok' => 'You lack PDO or its driver for MySQL (php5-mysql package)', - 'dom_is_ok' => 'You have the required library to browse the DOM', - 'dom_is_nok' => 'You lack a required library to browse the DOM (php-xml package)', - 'pcre_is_ok' => 'You have the required library for regular expressions (PCRE)', - 'pcre_is_nok' => 'You lack a required library for regular expressions (php-pcre)', - 'ctype_is_ok' => 'You have the required library for character type checking (ctype)', - 'ctype_is_nok' => 'You lack a required library for character type checking (php-ctype)', - 'cache_is_ok' => 'Permissions on cache directory are good', - 'log_is_ok' => 'Permissions on logs directory are good', - 'favicons_is_ok' => 'Permissions on favicons directory are good', - 'data_is_ok' => 'Permissions on data directory are good', - 'persona_is_ok' => 'Permissions on Mozilla Persona directory are good', - 'file_is_nok' => 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into', - 'fix_errors_before' => 'Fix errors before skip to the next step.', - - 'general_conf_is_ok' => 'General configuration has been saved.', - 'random_string' => 'Random string', - 'change_value' => 'You should change this value by any other', - 'base_url' => 'Base URL', - 'do_not_change_if_doubt' => 'Don’t change if you doubt about it', - - 'bdd_conf_is_ok' => 'Database configuration has been saved.', - 'bdd_conf_is_ko' => 'Verify your database information.', - 'host' => 'Host', - 'bdd' => 'Database', - 'prefix' => 'Table prefix', - - 'update_start' => 'Start update process', - 'update_long' => 'This can take a long time, depending on the size of your database. You may have to wait for this page to time out (~5 minutes) and then refresh this page.', - 'update_end' => 'Update process is completed, now you can go to the final step.', - - - 'installation_is_ok' => 'The installation process was successful.<br />The final step will now attempt to delete the <kbd>./p/i/install.php</kbd> file and any database backup created during the update process.<br />You may choose to skip this step and delete <kbd>./p/i/install.php</kbd> manually.', - 'finish_installation' => 'Complete installation', - 'install_not_deleted' => 'Something went wrong; you must delete the file <em>%s</em> manually.', -); diff --git a/app/i18n/install.fr.php b/app/i18n/install.fr.php deleted file mode 100644 index bb183642f..000000000 --- a/app/i18n/install.fr.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -return array ( - 'freshrss_installation' => 'Installation · FreshRSS', - 'freshrss' => 'FreshRSS', - 'installation_step' => 'Installation — étape %d · FreshRSS', - 'steps' => 'Étapes', - 'checks' => 'Vérifications', - 'general_configuration' => 'Configuration générale', - 'bdd_configuration' => 'Base de données', - 'bdd_type' => 'Type de base de données', - 'version_update' => 'Mise à jour', - 'this_is_the_end' => 'This is the end', - - 'ok' => 'Ok !', - 'congratulations' => 'Félicitations !', - 'attention' => 'Attention !', - 'damn' => 'Arf !', - 'oops' => 'Oups !', - 'next_step' => 'Passer à l’étape suivante', - - 'language_defined' => 'La langue a bien été définie.', - 'choose_language' => 'Choisissez la langue pour FreshRSS', - - 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', - 'php_is_ok' => 'Votre version de PHP est la %s, qui est compatible avec FreshRSS', - 'php_is_nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s', - 'minz_is_ok' => 'Vous disposez du framework Minz', - 'minz_is_nok' => 'Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script <em>build.sh</em> ou bien <a href="https://github.com/marienfressinaud/MINZ">la télécharger sur Github</a> et installer dans le répertoire <em>%s</em> le contenu de son répertoire <em>/lib</em>.', - 'curl_is_ok' => 'Vous disposez de cURL dans sa version %s', - 'curl_is_nok' => 'Vous ne disposez pas de cURL (paquet php5-curl)', - 'pdomysql_is_ok' => 'Vous disposez de PDO et de son driver pour MySQL (paquet php5-mysql)', - 'pdomysql_is_nok' => 'Vous ne disposez pas de PDO ou de son driver pour MySQL', - 'dom_is_ok' => 'Vous disposez du nécessaire pour parcourir le DOM', - 'dom_is_nok' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml)', - 'pcre_is_ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE)', - 'pcre_is_nok' => 'Il manque une librairie pour les expressions régulières (php-pcre)', - 'ctype_is_ok' => 'Vous disposez du nécessaire pour la vérification des types de caractères (ctype)', - 'ctype_is_nok' => 'Il manque une librairie pour la vérification des types de caractères (php-ctype)', - 'cache_is_ok' => 'Les droits sur le répertoire de cache sont bons', - 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', - 'favicons_is_ok' => 'Les droits sur le répertoire des favicons sont bons', - 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', - 'persona_is_ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons', - 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire <em>%s</em>. Le serveur HTTP doit être capable d’écrire dedans', - 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', - - 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', - 'random_string' => 'Chaîne aléatoire', - 'change_value' => 'Vous devriez changer cette valeur par n’importe quelle autre', - 'base_url' => 'Base de l’URL', - 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', - - 'bdd_conf_is_ok' => 'La configuration de la base de données a été enregistrée.', - 'bdd_conf_is_ko' => 'Vérifiez les informations d’accès à la base de données.', - 'host' => 'Hôte', - 'bdd' => 'Base de données', - 'prefix' => 'Préfixe des tables', - - 'update_start' => 'Lancer la mise à jour', - 'update_long' => 'Ce processus peut prendre longtemps, selon la taille de votre base de données. Vous aurez peut-être à attendre que cette page dépasse son temps maximum d’exécution (~5 minutes) puis à la recharger.', - 'update_end' => 'La mise à jour est terminée, vous pouvez maintenant passer à l’étape finale.', - - 'installation_is_ok' => 'L’installation s’est bien passée.<br />La dernière étape va maintenant tenter de supprimer le fichier <kbd>./p/i/install.php</kbd>, ainsi que d’éventuelles copies de base de données créées durant le processus de mise à jour.<br />Vous pouvez choisir de sauter cette étape et de supprimer <kbd>./p/i/install.php</kbd> manuellement.', - 'finish_installation' => 'Terminer l’installation', - 'install_not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier <em>%s</em> à la main.', -); diff --git a/app/i18n/it/admin.php b/app/i18n/it/admin.php new file mode 100644 index 000000000..ae46818ae --- /dev/null +++ b/app/i18n/it/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Consenti la lettura agli utenti anonimi degli articoli dell utente predefinito (%s)', + 'allow_anonymous_refresh' => 'Consenti agli utenti anonimi di aggiornare gli articoli', + 'api_enabled' => 'Consenti le <abbr>API</abbr> di accesso <small>(richiesto per le app mobili)</small>', + 'form' => 'Web form (tradizionale, richiede JavaScript)', + 'http' => 'HTTP (per gli utenti avanzati con HTTPS)', + 'none' => 'Nessuno (pericoloso)', + 'title' => 'Autenticazione', + 'title_reset' => 'Reset autenticazione', + 'token' => 'Token di autenticazione', + 'token_help' => 'Consenti accesso agli RSS dell utente predefinito senza autenticazione:', + 'type' => 'Metodo di autenticazione', + 'unsafe_autologin' => 'Consenti accesso automatico non sicuro usando il formato: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/cache</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella della cache sono corretti.', + ), + 'categories' => array( + 'nok' => 'La tabella delle categorie ha una configurazione errata.', + 'ok' => 'Tabella delle categorie OK.', + ), + 'connection' => array( + 'nok' => 'La connessione al database non può essere stabilita.', + 'ok' => 'Connessione al database OK', + ), + 'ctype' => array( + 'nok' => 'Manca una libreria richiesta per il controllo dei caratteri (php-ctype).', + 'ok' => 'Libreria richiesta per il controllo dei caratteri presente (ctype).', + ), + 'curl' => array( + 'nok' => 'Manca il supporto per cURL (pacchetto php-curl).', + 'ok' => 'Estensione cURL presente.', + ), + 'data' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella data sono corretti.', + ), + 'database' => 'Installazione database', + 'dom' => array( + 'nok' => 'Manca una libreria richiesta per leggere DOM (pacchetto php-xml).', + 'ok' => 'Libreria richiesta per leggere DOM presente.', + ), + 'entries' => array( + 'nok' => 'La tabella Entry ha una configurazione errata.', + 'ok' => 'Tabella Entry OK.', + ), + 'favicons' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/favicons</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella favicons sono corretti.', + ), + 'feeds' => array( + 'nok' => 'La tabella Feed ha una configurazione errata.', + 'ok' => 'Tabella Feed OK.', + ), + 'fileinfo' => array( + 'nok' => 'Manca il supporto per PHP fileinfo (pacchetto fileinfo).', + 'ok' => 'Estensione fileinfo presente.', + ), + 'files' => 'Installazione files', + 'json' => array( + 'nok' => 'Manca il supoorto a JSON (pacchetto php5-json).', + 'ok' => 'Estensione JSON presente.', + ), + 'minz' => array( + 'nok' => 'Manca il framework Minz.', + 'ok' => 'Framework Minz presente.', + ), + 'pcre' => array( + 'nok' => 'Manca una libreria richiesta per le regular expressions (php-pcre).', + 'ok' => 'Libreria richiesta per le regular expressions presente (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Manca PDO o uno degli altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO e altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Installazione PHP', + 'nok' => 'Versione PHP %s FreshRSS richiede almeno la versione %s.', + 'ok' => 'Versione PHP %s, compatibile con FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Rilevate tabelle mancanti nel database.', + 'ok' => 'Tutte le tabelle sono presenti nel database.', + ), + 'title' => 'Verifica installazione', + 'tokens' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/tokens</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella tokens sono corretti.', + ), + 'users' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/users</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella users sono corretti.', + ), + 'zip' => array( + 'nok' => 'Manca estensione ZIP (pacchetto php-zip).', + 'ok' => 'Estensione ZIP presente.', + ), + ), + 'extensions' => array( + 'disabled' => 'Disabilitata', + 'empty_list' => 'Non ci sono estensioni installate', + 'enabled' => 'Abilitata', + 'no_configure_view' => 'Questa estensioni non può essere configurata.', + 'system' => array( + '_' => 'Estensioni di sistema', + 'no_rights' => 'Estensione di sistema (non hai i permessi su questo tipo)', + ), + 'title' => 'Estensioni', + 'user' => 'Estensioni utente', + ), + 'stats' => array( + '_' => 'Statistiche', + 'all_feeds' => 'Tutti i feeds', + 'category' => 'Categoria', + 'entry_count' => 'Articoli', + 'entry_per_category' => 'Articoli per categoria', + 'entry_per_day' => 'Articoli per giorno (ultimi 30 giorni)', + 'entry_per_day_of_week' => 'Per giorno della settimana (media: %.2f articoli)', + 'entry_per_hour' => 'Per ora (media: %.2f articoli)', + 'entry_per_month' => 'Per mese (media: %.2f articoli)', + 'entry_repartition' => 'Ripartizione contenuti', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per categoria', + 'idle' => 'Feeds non aggiornati', + 'main' => 'Statistiche principali', + 'main_stream' => 'Flusso principale', + 'menu' => array( + 'idle' => 'Feeds non aggiornati', + 'main' => 'Statistiche principali', + 'repartition' => 'Ripartizione articoli', + ), + 'no_idle' => 'Non ci sono feed non aggiornati', + 'number_entries' => '%d articoli', + 'percent_of_total' => '%% del totale', + 'repartition' => 'Ripartizione articoli', + 'status_favorites' => 'Preferiti', + 'status_read' => 'Letti', + 'status_total' => 'Totale', + 'status_unread' => 'Non letti', + 'title' => 'Statistiche', + 'top_feed' => 'I migliori 10 feeds', + ), + 'system' => array( + '_' => 'Configurazione di sistema', + 'auto-update-url' => 'Auto-update server URL', // @todo translate + 'instance-name' => 'Nome istanza', + 'max-categories' => 'Limite categorie per utente', + 'max-feeds' => 'Limite feeds per utente', + 'registration' => array( + 'help' => '0 significa che non esiste limite sui profili', + 'number' => 'Numero massimo di profili', + ), + ), + 'update' => array( + '_' => 'Aggiornamento sistema', + 'apply' => 'Applica', + 'check' => 'Controlla la presenza di nuovi aggiornamenti', + 'current_version' => 'FreshRSS versione %s.', + 'last' => 'Ultima verifica: %s', + 'none' => 'Nessun aggiornamento da applicare', + 'title' => 'Aggiorna sistema', + ), + 'user' => array( + 'articles_and_size' => '%s articoli (%s)', + 'create' => 'Crea nuovo utente', + 'language' => 'Lingua', + 'number' => ' %d profilo utente creato', + 'numbers' => 'Sono presenti %d profili utente', + 'password_form' => 'Password<br /><small>(per il login classico)</small>', + 'password_format' => 'Almeno 7 caratteri', + 'title' => 'Gestione utenti', + 'user_list' => 'Lista utenti', + 'username' => 'Nome utente', + 'users' => 'Utenti', + ), +); diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php new file mode 100644 index 000000000..19b62c9a7 --- /dev/null +++ b/app/i18n/it/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Archiviazione', + 'advanced' => 'Avanzate', + 'delete_after' => 'Rimuovi articoli dopo', + 'help' => 'Altre opzioni sono disponibili nelle impostazioni dei singoli feed', + 'keep_history_by_feed' => 'Numero minimo di articoli da mantenere per feed', + 'optimize' => 'Ottimizza database', + 'optimize_help' => 'Da fare occasionalmente per ridurre le dimensioni del database', + 'purge_now' => 'Cancella ora', + 'title' => 'Archiviazione', + 'ttl' => 'Non effettuare aggiornamenti per più di', + ), + 'display' => array( + '_' => 'Visualizzazione', + 'icon' => array( + 'bottom_line' => 'Barra in fondo', + 'entry' => 'Icone degli articoli', + 'publication_date' => 'Data di pubblicazione', + 'related_tags' => 'Tags correlati', + 'sharing' => 'Condivisione', + 'top_line' => 'Barra in alto', + ), + 'language' => 'Lingua', + 'notif_html5' => array( + 'seconds' => 'secondi (0 significa nessun timeout)', + 'timeout' => 'Notifica timeout HTML5', + ), + 'theme' => 'Tema', + 'title' => 'Visualizzazione', + 'width' => array( + 'content' => 'Larghezza contenuto', + 'large' => 'Largo', + 'medium' => 'Medio', + 'no_limit' => 'Nessun limite', + 'thin' => 'Stretto', + ), + ), + 'query' => array( + '_' => 'Ricerche personali', + 'deprecated' => 'Questa query non è più valida. La categoria o il feed di riferimento non stati cancellati.', + 'filter' => 'Filtro applicato:', + 'get_all' => 'Mostra tutti gli articoli', + 'get_category' => 'Mostra la categoria "%s" ', + 'get_favorite' => 'Mostra articoli preferiti', + 'get_feed' => 'Mostra feed "%s" ', + 'no_filter' => 'Nessun filtro', + 'none' => 'Non hai creato nessuna ricerca personale.', + 'number' => 'Ricerca n°%d', + 'order_asc' => 'Mostra prima gli articoli più vecchi', + 'order_desc' => 'Mostra prima gli articoli più nuovi', + 'search' => 'Cerca per "%s"', + 'state_0' => 'Mostra tutti gli articoli', + 'state_1' => 'Mostra gli articoli letti', + 'state_2' => 'Mostra gli articoli non letti', + 'state_3' => 'Mostra tutti gli articoli', + 'state_4' => 'Mostra gli articoli preferiti', + 'state_5' => 'Mostra gli articoli preferiti letti', + 'state_6' => 'Mostra gli articoli preferiti non letti', + 'state_7' => 'Mostra gli articoli preferiti', + 'state_8' => 'Non mostrare gli articoli preferiti', + 'state_9' => 'Mostra gli articoli letti non preferiti', + 'state_10' => 'Mostra gli articoli non letti e non preferiti', + 'state_11' => 'Non mostrare gli articoli preferiti', + 'state_12' => 'Mostra tutti gli articoli', + 'state_13' => 'Mostra gli articoli letti', + 'state_14' => 'Mostra gli articoli non letti', + 'state_15' => 'Mostra tutti gli articoli', + 'title' => 'Ricerche personali', + ), + 'profile' => array( + '_' => 'Gestione profili', + 'delete' => array( + '_' => 'Cancellazione account', + 'warn' => 'Il tuo account e tutti i dati associati saranno cancellati.', + ), + 'password_api' => 'Password API<br /><small>(e.g., per applicazioni mobili)</small>', + 'password_form' => 'Password<br /><small>(per il login classico)</small>', + 'password_format' => 'Almeno 7 caratteri', + 'title' => 'Profilo', + ), + 'reading' => array( + '_' => 'Lettura', + 'after_onread' => 'Dopo “segna tutto come letto”,', + 'articles_per_page' => 'Numero di articoli per pagina', + 'auto_load_more' => 'Carica articoli successivi a fondo pagina', + 'auto_remove_article' => 'Nascondi articoli dopo la lettura', + 'mark_updated_article_unread' => 'Segna articoli aggiornati come non letti', + 'confirm_enabled' => 'Mostra una conferma per “segna tutto come letto”', + 'display_articles_unfolded' => 'Mostra articoli aperti di predefinito', + 'display_categories_unfolded' => 'Mostra categorie aperte di predefinito', + 'hide_read_feeds' => 'Nascondi categorie e feeds con articoli già letti (non funziona se “Mostra tutti gli articoli” è selezionato)', + 'img_with_lazyload' => 'Usa la modalità "caricamento ritardato" per le immagini', + 'jump_next' => 'Salta al successivo feed o categoria non letto', + 'number_divided_when_reader' => 'Diviso 2 nella modalità di lettura.', + 'read' => array( + 'article_open_on_website' => 'Quando un articolo è aperto nel suo sito di origine', + 'article_viewed' => 'Quando un articolo viene letto', + 'scroll' => 'Scorrendo la pagina', + 'upon_reception' => 'Alla ricezione del contenuto', + 'when' => 'Segna articoli come letti…', + ), + 'show' => array( + '_' => 'Articoli da visualizzare', + 'adaptive' => 'Adatta visualizzazione', + 'all_articles' => 'Mostra tutti gli articoli', + 'unread' => 'Mostra solo non letti', + ), + 'sort' => array( + '_' => 'Ordinamento', + 'newer_first' => 'Prima i più recenti', + 'older_first' => 'Prima i più vecchi', + ), + 'sticky_post' => 'Blocca il contenuto a inizio pagina quando aperto', + 'title' => 'Lettura', + 'view' => array( + 'default' => 'Visualizzazione predefinita', + 'global' => 'Vista globale per categorie', + 'normal' => 'Vista elenco', + 'reader' => 'Modalità di lettura', + ), + ), + 'sharing' => array( + '_' => 'Condivisione', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Ulteriori informazioni', + 'print' => 'Stampa', + 'shaarli' => 'Shaarli', + 'share_name' => 'Nome condivisione', + 'share_url' => 'URL condivisione', + 'title' => 'Condividi', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Comandi tastiera', + 'article_action' => 'Azioni sugli articoli', + 'auto_share' => 'Condividi', + 'auto_share_help' => 'Se è presente un solo servizio di condivisione verrà usato quello, altrimenti usare anche il numero associato.', + 'close_dropdown' => 'Chiudi menù', + 'collapse_article' => 'Collassa articoli', + 'first_article' => 'Salta al primo articolo', + 'focus_search' => 'Modulo di ricerca', + 'help' => 'Mostra documentazione', + 'javascript' => 'JavaScript deve essere abilitato per poter usare i comandi da tastiera', + 'last_article' => 'Salta all ultimo articolo', + 'load_more' => 'Carica altri articoli', + 'mark_read' => 'Segna come letto', + 'mark_favorite' => 'Segna come preferito', + 'navigation' => 'Navigazione', + 'navigation_help' => 'Con il tasto "Shift" i comandi di navigazione verranno applicati ai feeds.<br/>Con il tasto "Alt" i comandi di navigazione verranno applicati alle categorie.', + 'next_article' => 'Salta al contenuto successivo', + 'other_action' => 'Altre azioni', + 'previous_article' => 'Salta al contenuto precedente', + 'see_on_website' => 'Vai al sito fonte', + 'shift_for_all_read' => '+ <code>shift</code> per segnare tutti gli articoli come letti', + 'title' => 'Comandi da tastiera', + 'user_filter' => 'Accedi alle ricerche personali', + 'user_filter_help' => 'Se è presente una sola ricerca personale verrà usata quella, altrimenti usare anche il numero associato.', + ), + 'user' => array( + 'articles_and_size' => '%s articoli (%s)', + 'current' => 'Utente connesso', + 'is_admin' => 'è amministratore', + 'users' => 'Utenti', + ), +); diff --git a/app/i18n/it/feedback.php b/app/i18n/it/feedback.php new file mode 100644 index 000000000..5851cb2e6 --- /dev/null +++ b/app/i18n/it/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Ottimizzazione completata', + ), + 'access' => array( + 'denied' => 'Non hai i permessi per accedere a questa pagina', + 'not_found' => 'Pagina non disponibile', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Si è verificato un problema alla configurazione del sistema di autenticazione. Per favore riprova più tardi.', + 'set' => 'Sistema di autenticazione tramite Form impostato come predefinito.', + ), + 'login' => array( + 'invalid' => 'Autenticazione non valida', + 'success' => 'Autenticazione effettuata', + ), + 'logout' => array( + 'success' => 'Disconnessione effettuata', + ), + 'no_password_set' => 'Password di amministrazione non impostata. Opzione non disponibile.', + ), + 'conf' => array( + 'error' => 'Si è verificato un errore durante il salvataggio della configurazione', + 'query_created' => 'Ricerca "%s" creata.', + 'shortcuts_updated' => 'Collegamenti tastiera aggiornati', + 'updated' => 'Configurazione aggiornata', + ), + 'extensions' => array( + 'already_enabled' => '%s è già abilitata', + 'disable' => array( + 'ko' => '%s non può essere disabilitata. <a href="%s">Verifica i logs</a> per dettagli.', + 'ok' => '%s è disabilitata', + ), + 'enable' => array( + 'ko' => '%s non può essere abilitata. <a href="%s">Verifica i logs</a> per dettagli.', + 'ok' => '%s è ora abilitata', + ), + 'no_access' => 'Accesso negato a %s', + 'not_enabled' => '%s non abilitato', + 'not_found' => '%s non disponibile', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'Estensione ZIP non presente sul server. Per favore esporta i files singolarmente.', + 'feeds_imported' => 'I tuoi feed sono stati importati e saranno aggiornati', + 'feeds_imported_with_errors' => 'I tuoi feeds sono stati importati ma si sono verificati alcuni errori', + 'file_cannot_be_uploaded' => 'Il file non può essere caricato!', + 'no_zip_extension' => 'Estensione ZIP non presente sul server.', + 'zip_error' => 'Si è verificato un errore importando il file ZIP', + ), + 'sub' => array( + 'actualize' => 'Aggiorna', + 'category' => array( + 'created' => 'Categoria %s creata.', + 'deleted' => 'Categoria cancellata', + 'emptied' => 'Categoria svuotata', + 'error' => 'Categoria non aggiornata', + 'name_exists' => 'Categoria già esistente.', + 'no_id' => 'Categoria senza ID.', + 'no_name' => 'Il nome della categoria non può essere lasciato vuoto.', + 'not_delete_default' => 'Non puoi cancellare la categoria predefinita!', + 'not_exist' => 'La categoria non esite!', + 'over_max' => 'Hai raggiunto il numero limite di categorie (%d)', + 'updated' => 'Categoria aggiornata.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> aggiornato', + 'actualizeds' => 'RSS feeds aggiornati', + 'added' => 'RSS feed <em>%s</em> aggiunti', + 'already_subscribed' => 'Hai già sottoscritto <em>%s</em>', + 'deleted' => 'Feed cancellato', + 'error' => 'Feed non aggiornato', + 'internal_problem' => 'RSS feed non aggiunto. <a href="%s">Verifica i logs</a> per dettagli.', + 'invalid_url' => 'URL <em>%s</em> non valido', + 'marked_read' => 'Feeds segnati come letti', + 'n_actualized' => '%d feeds aggiornati', + 'n_entries_deleted' => '%d articoli cancellati', + 'no_refresh' => 'Nessun aggiornamento disponibile…', + 'not_added' => '<em>%s</em> non può essere aggiunto', + 'over_max' => 'Hai raggiunto il numero limite di feed (%d)', + 'updated' => 'Feed aggiornato', + ), + 'purge_completed' => 'Svecchiamento completato (%d articoli cancellati)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS verrà aggiornato alla <strong>versione %s</strong>.', + 'error' => 'Il processo di aggiornamento ha riscontrato il seguente errore: %s', + 'file_is_nok' => 'Verifica i permessi della cartella <em>%s</em>. Il server HTTP deve avere i permessi per la scrittura ', + 'finished' => 'Aggiornamento completato con successo!', + 'none' => 'Nessun aggiornamento disponibile', + 'server_not_found' => 'Server per aggiornamento non disponibile. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Utente %s creato', + 'error' => 'Errore nella creazione utente %s ', + ), + 'deleted' => array( + '_' => 'Utente %s cancellato', + 'error' => 'Utente %s non cancellato', + ), + ), + 'profile' => array( + 'error' => 'Il tuo profilo non può essere modificato', + 'updated' => 'Il tuo profilo è stato modificato', + ), +); diff --git a/app/i18n/it/gen.php b/app/i18n/it/gen.php new file mode 100644 index 000000000..a9a8709d3 --- /dev/null +++ b/app/i18n/it/gen.php @@ -0,0 +1,182 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Aggiorna', + 'back_to_rss_feeds' => '← Indietro', + 'cancel' => 'Annulla', + 'create' => 'Crea', + 'disable' => 'Disabilita', + 'empty' => 'Vuoto', + 'enable' => 'Abilita', + 'export' => 'Esporta', + 'filter' => 'Filtra', + 'import' => 'Importa', + 'manage' => 'Gestisci', + 'mark_read' => 'Segna come letto', + 'mark_favorite' => 'Segna come preferito', + 'remove' => 'Rimuovi', + 'see_website' => 'Vai al sito', + 'submit' => 'Conferma', + 'truncate' => 'Cancella tutti gli articoli', + ), + 'auth' => array( + 'email' => 'Indirizzo email', + 'keep_logged_in' => 'Ricorda i dati <small>(%s giorni)</small>', + 'login' => 'Accedi', + 'logout' => 'Esci', + 'password' => array( + '_' => 'Password', + 'format' => '<small>almeno 7 caratteri</small>', + ), + 'registration' => array( + '_' => 'Nuovo profilo', + 'ask' => 'Vuoi creare un nuovo profilo?', + 'title' => 'Creazione profilo', + ), + 'reset' => 'Reset autenticazione', + 'username' => array( + '_' => 'Username', + 'admin' => 'Username amministratore', + 'format' => '<small>massimo 16 caratteri alfanumerici</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l\\e', + 'Aug' => '\\A\\g\\o\\s\\t\\o', + 'Dec' => '\\D\\i\\c\\e\\m\\b\\r\\e', + 'Feb' => '\\F\\e\\b\\b\\r\\a\\i\\o', + 'Jan' => '\\G\\e\\n\\u\\a\\i\\o', + 'Jul' => '\\L\\u\\g\\l\\i\\o', + 'Jun' => '\\G\\i\\u\\g\\n\\o', + 'Mar' => '\\M\\a\\r\\z\\o', + 'May' => '\\M\\a\\g\\g\\i\\o', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\r\\e', + 'Oct' => '\\O\\t\\t\\o\\b\\r\\e', + 'Sep' => '\\S\\e\\t\\t\\e\\m\\b\\r\\e', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Meno recenti', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + 'format_date' => 'j\\ %s Y', + 'format_date_hour' => 'j\\ %s Y \\o\\r\\e H\\:i', + 'fri' => 'Fri', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Ultimi 3 mesi', + 'last_6_month' => 'Ultimi 6 mesi', + 'last_month' => 'Ultimo mese', + 'last_week' => 'Ultima settimana', + 'last_year' => 'Ultimo anno', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'May', + 'mon' => 'Mon', + 'month' => 'mesi', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'oct', + 'october' => 'Oct', + 'sat' => 'Sat', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Sun', + 'thu' => 'Thu', + 'today' => 'Oggi', + 'tue' => 'Tue', + 'wed' => 'Wed', + 'yesterday' => 'Ieri', + ), + 'freshrss' => array( + '_' => 'Feed RSS Reader', + 'about' => 'Informazioni', + ), + 'js' => array( + 'category_empty' => 'Categoria vuota', + 'confirm_action' => 'Sei sicuro di voler continuare?', + 'confirm_action_feed_cat' => 'Sei sicuro di voler continuare? Verranno persi i preferiti e le ricerche utente correlate!', + 'feedback' => array( + 'body_new_articles' => 'Ci sono %%d nuovi articoli da leggere.', + 'request_failed' => 'Richiesta fallita, probabilmente a causa di problemi di connessione', + 'title_new_articles' => 'Feed RSS Reader: nuovi articoli!', + ), + 'new_article' => 'Sono disponibili nuovi articoli, clicca qui per caricarli.', + 'should_be_activated' => 'JavaScript deve essere abilitato', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'Informazioni', + 'admin' => 'Amministrazione', + 'archiving' => 'Archiviazione', + 'authentication' => 'Autenticazione', + 'check_install' => 'Installazione', + 'configuration' => 'Configurazione', + 'display' => 'Visualizzazione', + 'extensions' => 'Estensioni', + 'logs' => 'Logs', + 'queries' => 'Ricerche personali', + 'reading' => 'Lettura', + 'search' => 'Ricerca parole o #tags', + 'sharing' => 'Condivisione', + 'shortcuts' => 'Comandi tastiera', + 'stats' => 'Statistiche', + 'system' => 'Configurazione sistema', + 'update' => 'Aggiornamento', + 'user_management' => 'Gestione utenti', + 'user_profile' => 'Profilo', + ), + 'pagination' => array( + 'first' => 'Prima', + 'last' => 'Ultima', + 'load_more' => 'Carica altri articoli', + 'mark_all_read' => 'Segna tutto come letto', + 'next' => 'Successiva', + 'nothing_to_load' => 'Non ci sono altri articoli', + 'previous' => 'Precedente', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Stampa', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Attenzione!', + 'blank_to_disable' => 'Lascia vuoto per disabilitare', + 'by_author' => 'di <em>%s</em>', + 'by_default' => 'predefinito', + 'damn' => 'Ops!', + 'default_category' => 'Senza categoria', + 'no' => 'No', + 'not_applicable' => 'Non disponibile', + 'ok' => 'OK!', + 'or' => 'o', + 'yes' => 'Si', + ), +); diff --git a/app/i18n/it/index.php b/app/i18n/it/index.php new file mode 100644 index 000000000..d79502c79 --- /dev/null +++ b/app/i18n/it/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Informazioni', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Bugs', + 'credits' => 'Crediti', + 'credits_content' => 'Alcuni elementi di design provengono da <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> sebbene FreshRSS non usi questo framework. Le <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icone</a> provengono dal progetto <a href="https://www.gnome.org/">GNOME</a>. Il carattere <em>Open Sans</em> è stato creato da <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS è basato su <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.', + 'freshrss_description' => 'FreshRSS è un aggregatore di feeds RSS da installare sul proprio host come <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> o <a href="http://projet.idleman.fr/leed/">Leed</a>. Leggero e facile da mantenere pur essendo molto configurabile e potente.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">su Github</a>', + 'license' => 'Licenza', + 'project_website' => 'Sito del progetto', + 'title' => 'Informazioni', + 'version' => 'Versione', + 'website' => 'Sito', + ), + 'feed' => array( + 'add' => 'Aggiungi un Feed RSS', + 'empty' => 'Non ci sono articoli da mostrare.', + 'rss_of' => 'RSS feed di %s', + 'title' => 'RSS feeds', + 'title_global' => 'Vista globale per categorie', + 'title_fav' => 'Preferiti', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Svuota logs', + 'empty' => 'File di log vuoto', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'Informazioni', + 'add_query' => 'Aggiungi ricerca', + 'before_one_day' => 'Giorno precedente', + 'before_one_week' => 'Settimana precedente', + 'favorites' => 'Preferiti (%s)', + 'global_view' => 'Vista globale per categorie', + 'main_stream' => 'Flusso principale', + 'mark_all_read' => 'Segna tutto come letto', + 'mark_cat_read' => 'Segna la categoria come letta', + 'mark_feed_read' => 'Segna il feed come letto', + 'newer_first' => 'Mostra prima i recenti', + 'non-starred' => 'Escludi preferiti', + 'normal_view' => 'Vista elenco', + 'older_first' => 'Ordina per meno recenti', + 'queries' => 'Chiavi di ricerca', + 'read' => 'Mostra solo letti', + 'reader_view' => 'Modalità di lettura', + 'rss_view' => 'RSS feed', + 'search_short' => 'Cerca', + 'starred' => 'Mostra solo preferiti', + 'stats' => 'Statistiche', + 'subscription' => 'Gestione sottoscrizioni', + 'unread' => 'Mostra solo non letti', + ), + 'share' => 'Condividi', + 'tag' => array( + 'related' => 'Tags correlati', + ), +); diff --git a/app/i18n/it/install.php b/app/i18n/it/install.php new file mode 100644 index 000000000..18f8cc337 --- /dev/null +++ b/app/i18n/it/install.php @@ -0,0 +1,120 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Installazione completata', + 'fix_errors_before' => 'Per favore correggi gli errori prima di passare al passaggio successivo.', + 'keep_install' => 'Mantieni configurazione precedente', + 'next_step' => 'Vai al prossimo passaggio', + 'reinstall' => 'Reinstalla FreshRSS', + ), + 'auth' => array( + 'form' => 'Web form (tradizionale, richiede JavaScript)', + 'http' => 'HTTP (per gli utenti avanzati con HTTPS)', + 'none' => 'Nessuno (pericoloso)', + 'password_form' => 'Password<br /><small>(per il login tramite Web-form tradizionale)</small>', + 'password_format' => 'Almeno 7 caratteri', + 'type' => 'Metodo di autenticazione', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Configurazione database', + 'ko' => 'Verifica le informazioni del database.', + 'ok' => 'Le configurazioni del database sono state salvate.', + ), + 'host' => 'Host', + 'prefix' => 'Prefisso tabella', + 'password' => 'Password del database', + 'type' => 'Tipo di database', + 'username' => 'Nome utente del database', + ), + 'check' => array( + '_' => 'Controlli', + 'already_installed' => 'FreshRSS risulta già installato!', + 'cache' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/cache</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella della cache sono corretti.', + ), + 'ctype' => array( + 'nok' => 'Manca una libreria richiesta per il controllo dei caratteri (php-ctype).', + 'ok' => 'Libreria richiesta per il controllo dei caratteri presente (ctype).', + ), + 'curl' => array( + 'nok' => 'Manca il supporto per cURL (pacchetto php-curl).', + 'ok' => 'Estensione cURL presente.', + ), + 'data' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella data sono corretti.', + ), + 'dom' => array( + 'nok' => 'Manca una libreria richiesta per leggere DOM.', + 'ok' => 'Libreria richiesta per leggere DOM presente.', + ), + 'favicons' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/favicons</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella favicons sono corretti.', + ), + 'fileinfo' => array( + 'nok' => 'Manca il supporto per PHP fileinfo (pacchetto fileinfo).', + 'ok' => 'Estensione fileinfo presente.', + ), + 'http_referer' => array( + 'nok' => 'Per favore verifica che non stai alterando il tuo HTTP REFERER.', + 'ok' => 'Il tuo HTTP REFERER riconosciuto corrisponde al tuo server.', + ), + 'json' => array( + 'nok' => 'You lack a recommended library to parse JSON.', + 'ok' => 'You have a recommended library to parse JSON.', + ), + 'minz' => array( + 'nok' => 'Manca il framework Minz.', + 'ok' => 'Framework Minz presente.', + ), + 'pcre' => array( + 'nok' => 'Manca una libreria richiesta per le regular expressions (php-pcre).', + 'ok' => 'Libreria richiesta per le regular expressions presente (PCRE).', + ), + 'pdo' => array( + 'nok' => 'Manca PDO o uno degli altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO e altri driver supportati (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'Installazione PHP', + 'nok' => 'Versione di PHP %s FreshRSS richiede almeno la versione %s.', + 'ok' => 'Versione di PHP %s, compatibile con FreshRSS.', + ), + 'users' => array( + 'nok' => 'Verifica i permessi sulla cartella <em>./data/users</em>. Il server HTTP deve avere i permessi per scriverci dentro', + 'ok' => 'I permessi sulla cartella users sono corretti.', + ), + 'xml' => array( + 'nok' => 'You lack the required library to parse XML.', + 'ok' => 'You have the required library to parse XML.', + ), + ), + 'conf' => array( + '_' => 'Configurazioni generali', + 'ok' => 'Configurazioni generali salvate.', + ), + 'congratulations' => 'Congratulazione!', + 'default_user' => 'Username utente predefinito <small>(massimo 16 caratteri alfanumerici)</small>', + 'delete_articles_after' => 'Rimuovi articoli dopo', + 'fix_errors_before' => 'Per favore correggi gli errori prima di passare al passaggio successivo.', + 'javascript_is_better' => 'FreshRSS funziona meglio con JavaScript abilitato', + 'js' => array( + 'confirm_reinstall' => 'Reinstallando FreshRSS perderai la configurazione precedente. Sei sicuro di voler procedere?', + ), + 'language' => array( + '_' => 'Lingua', + 'choose' => 'Seleziona la lingua per FreshRSS', + 'defined' => 'Lingua impostata.', + ), + 'not_deleted' => 'Qualcosa non ha funzionato; devi cancellare il file <em>%s</em> manualmente.', + 'ok' => 'Processo di installazione terminato con successo.', + 'step' => 'Passaggio %d', + 'steps' => 'Passaggi', + 'title' => 'Installazione · FreshRSS', + 'this_is_the_end' => 'Fine', +); diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php new file mode 100644 index 000000000..758e322c5 --- /dev/null +++ b/app/i18n/it/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Categoria', + 'add' => 'Aggiungi una categoria', + 'empty' => 'Categoria vuota', + 'new' => 'Nuova categoria', + ), + 'feed' => array( + 'add' => 'Aggiungi un Feed RSS', + 'advanced' => 'Avanzate', + 'archiving' => 'Archiviazione', + 'auth' => array( + 'configuration' => 'Autenticazione', + 'help' => 'Accesso per feeds protetti', + 'http' => 'Autenticazione HTTP', + 'password' => 'HTTP password', + 'username' => 'HTTP username', + ), + 'css_help' => 'In caso di RSS feeds troncati (attenzione, richiede molto tempo!)', + 'css_path' => 'Percorso del foglio di stile CSS del sito di origine', + 'description' => 'Descrizione', + 'empty' => 'Questo feed non contiene articoli. Per favore verifica il sito direttamente.', + 'error' => 'Questo feed ha generato un errore. Per favore verifica se ancora disponibile.', + 'in_main_stream' => 'Mostra in homepage', + 'informations' => 'Informazioni', + 'keep_history' => 'Numero minimo di articoli da mantenere', + 'moved_category_deleted' => 'Cancellando una categoria i feed al suo interno verranno classificati automaticamente come <em>%s</em>.', + 'no_selected' => 'Nessun feed selezionato.', + 'number_entries' => '%d articoli', + 'stats' => 'Statistiche', + 'think_to_add' => 'Aggiungi feed.', + 'title' => 'Titolo', + 'title_add' => 'Aggiungi RSS feed', + 'ttl' => 'Non aggiornare automaticamente piu di', + 'url' => 'Feed URL', + 'validator' => 'Controlla la validita del feed ', + 'website' => 'URL del sito', + 'pubsubhubbub' => 'Notifica istantanea con PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Esporta', + 'export_opml' => 'Esporta tutta la lista dei feed (OPML)', + 'export_starred' => 'Esporta i tuoi preferiti', + 'feed_list' => 'Elenco di %s articoli', + 'file_to_import' => 'File da importare<br />(OPML, JSON o ZIP)', + 'file_to_import_no_zip' => 'File da importare<br />(OPML o JSON)', + 'import' => 'Importa', + 'starred_list' => 'Elenco articoli preferiti', + 'title' => 'Importa / esporta', + ), + 'menu' => array( + 'bookmark' => 'Bookmark (trascina nei preferiti)', + 'import_export' => 'Importa / esporta', + 'subscription_management' => 'Gestione sottoscrizioni', + ), + 'title' => array( + '_' => 'Gestione sottoscrizioni', + 'feed_management' => 'Gestione RSS feeds', + ), +); diff --git a/app/i18n/nl/admin.php b/app/i18n/nl/admin.php new file mode 100644 index 000000000..607fb1892 --- /dev/null +++ b/app/i18n/nl/admin.php @@ -0,0 +1,186 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'auth' => array( + 'allow_anonymous' => 'Sta bezoekers toe om artikelen te lezen van de standaard gebruiker (%s)', + 'allow_anonymous_refresh' => 'Sta bezoekers toe om de artikelen te vernieuwen', + 'api_enabled' => 'Sta <abbr>API</abbr> toegang toe <small>(nodig voor mobiele apps)</small>', + 'form' => 'Web formulier (traditioneel, benodigd JavaScript)', + 'http' => 'HTTP (voor geavanceerde gebruikers met HTTPS)', + 'none' => 'Geen (gevaarlijk)', + 'title' => 'Authenticatie', + 'title_reset' => 'Authenticatie terugzetten', + 'token' => 'Authenticatie teken', + 'token_help' => 'Sta toegang toe tot de RSS uitvoer van de standaard gebruiker zonder authenticatie:', + 'type' => 'Authenticatie methode', + 'unsafe_autologin' => 'Sta onveilige automatische log in toe met het volgende formaat: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Controleer de permissies van de <em>./data/cache</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies van de cache map zijn goed.', + ), + 'categories' => array( + 'nok' => 'Categorie tabel is slecht geconfigureerd.', + 'ok' => 'Categorie tabel is ok.', + ), + 'connection' => array( + 'nok' => 'Verbinding met de database kan niet worden gemaakt.', + 'ok' => 'Verbinding met de database is ok.', + ), + 'ctype' => array( + 'nok' => 'U mist de benodigde bibliotheek voor character type checking (php-ctype).', + 'ok' => 'U hebt de benodigde bibliotheek voor character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'U mist de cURL (php-curl package).', + 'ok' => 'U hebt de cURL uitbreiding.', + ), + 'data' => array( + 'nok' => 'Controleer de permissies op de <em>./data</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de data map zijn goed.', + ), + 'database' => 'Database installatie', + 'dom' => array( + 'nok' => 'U mist de benodigde bibliotheek voor het bladeren van DOM (php-xml package).', + 'ok' => 'U hebt de benodigde bibliotheek voor het bladeren van DOM.', + ), + 'entries' => array( + 'nok' => 'Invoer tabel is slecht geconfigureerd.', + 'ok' => 'Invoer tabel is ok.', + ), + 'favicons' => array( + 'nok' => 'Controleer de permissies op de <em>./data/favicons</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de favicons map zijn goed.', + ), + 'feeds' => array( + 'nok' => 'Feed tabel is slecht geconfigureerd.', + 'ok' => 'Feed tabel is ok.', + ), + 'fileinfo' => array( + 'nok' => 'U mist de PHP fileinfo (fileinfo package).', + 'ok' => 'U hebt de fileinfo uitbreiding.', + ), + 'files' => 'Bestanden installatie', + 'json' => array( + 'nok' => 'U mist JSON (php5-json package).', + 'ok' => 'U hebt JSON uitbreiding.', + ), + 'minz' => array( + 'nok' => 'U mist Minz framework.', + 'ok' => 'U hebt Minz framework.', + ), + 'pcre' => array( + 'nok' => 'U mist de benodigde bibliotheek voor regular expressions (php-pcre).', + 'ok' => 'U hebt de benodigde bibliotheek voor regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'U mist PDO of een van de ondersteunde drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'U hebt PDO en ten minste één van de ondersteunde drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP installatie', + 'nok' => 'Uw PHP versie is %s maar FreshRSS benodigd tenminste versie %s.', + 'ok' => 'Uw PHP versie is %s, welke compatibel is met FreshRSS.', + ), + 'tables' => array( + 'nok' => 'Er zijn één of meer ontbrekende tabellen in de database.', + 'ok' => 'Alle tabellen zijn aanwezig in de database.', + ), + 'title' => 'Installatie controle', + 'tokens' => array( + 'nok' => 'Controleer de permissies op de <em>./data/tokens</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de tokens map zijn goed.', + ), + 'users' => array( + 'nok' => 'Controleer de permissies op de <em>./data/users</em> map. HTTP server moet rechten hebben om hierin te schrijven', + 'ok' => 'Permissies op de users map zijn goed.', + ), + 'zip' => array( + 'nok' => 'U mist ZIP uitbreiding (php-zip package).', + 'ok' => 'U hebt ZIP uitbreiding.', + ), + ), + 'extensions' => array( + 'disabled' => 'Uitgeschakeld', + 'empty_list' => 'Er zijn geïnstalleerde uitbreidingen', + 'enabled' => 'Ingeschakeld', + 'no_configure_view' => 'Deze uitbreiding kan niet worden geconfigureerd.', + 'system' => array( + '_' => 'Systeem uitbreidingen', + 'no_rights' => 'Systeem uitbreidingen (U hebt hier geen rechten op)', + ), + 'title' => 'Uitbreidingen', + 'user' => 'Gebruikers uitbreidingen', + ), + 'stats' => array( + '_' => 'Statistieken', + 'all_feeds' => 'Alle feeds', + 'category' => 'Categorie', + 'entry_count' => 'Invoer aantallen', + 'entry_per_category' => 'Aantallen per categorie', + 'entry_per_day' => 'Aantallen per dag (laatste 30 dagen)', + 'entry_per_day_of_week' => 'Per dag of week (gemiddeld: %.2f berichten)', + 'entry_per_hour' => 'Per uur (gemiddeld: %.2f berichten)', + 'entry_per_month' => 'Per maand (gemiddeld: %.2f berichten)', + 'entry_repartition' => 'Invoer verdeling', + 'feed' => 'Feed', + 'feed_per_category' => 'Feeds per categorie', + 'idle' => 'Gepauzeerde feeds', + 'main' => 'Hoofd statistieken', + 'main_stream' => 'Overzicht', + 'menu' => array( + 'idle' => 'Gepauzeerde feeds', + 'main' => 'Hoofd statistieken', + 'repartition' => 'Artikelen verdeling', + ), + 'no_idle' => 'Er is geen gepauzeerde feed!', + 'number_entries' => '%d artikelen', + 'percent_of_total' => '%% van totaal', + 'repartition' => 'Artikelen verdeling', + 'status_favorites' => 'Favorieten', + 'status_read' => 'Gelezen', + 'status_total' => 'Totaal', + 'status_unread' => 'Ongelezen', + 'title' => 'Statistieken', + 'top_feed' => 'Top tien feeds', + ), + 'system' => array( + '_' => 'Systeem configuratie', + 'auto-update-url' => 'Automatische update server URL', + 'instance-name' => 'Voorbeeld naam', + 'max-categories' => 'Categoriën limiet per gebruiker', + 'max-feeds' => 'Feed limiet per gebruiker', + 'registration' => array( + 'help' => '0 betekent geen account limiet', + 'number' => 'Maximum aantal accounts', + ), + ), + 'update' => array( + '_' => 'Versie controle', + 'apply' => 'Toepassen', + 'check' => 'Controleer op nieuwe versies', + 'current_version' => 'Uw huidige versie van FreshRSS is %s.', + 'last' => 'Laatste controle: %s', + 'none' => 'Geen nieuwe versie om toe te passen', + 'title' => 'Vernieuw systeem', + ), + 'user' => array( + 'articles_and_size' => '%s artikelen (%s)', + 'create' => 'Creëer nieuwe gebruiker', + 'language' => 'Taal', + 'number' => 'Er is %d accounts gemaakt', + 'numbers' => 'Er zijn %d accounts gemaakt', + 'password_form' => 'Wachtwoord<br /><small>(voor de Web-formulier log in methode)</small>', + 'password_format' => 'Ten minste 7 tekens', + 'registration' => array( + 'allow' => 'Sta het maken van nieuwe accounts toe', + 'help' => '0 betekent dat er geen account limiet is', + 'number' => 'Max aantal accounts', + ), + 'title' => 'Beheer gebruikers', + 'user_list' => 'Lijst van gebruikers ', + 'username' => 'Gebruikers naam', + 'users' => 'Gebruikers', + ), +); diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php new file mode 100644 index 000000000..573dabf45 --- /dev/null +++ b/app/i18n/nl/conf.php @@ -0,0 +1,173 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'archiving' => array( + '_' => 'Archivering', + 'advanced' => 'Geavanceerd', + 'delete_after' => 'Verwijder artikelen na', + 'help' => 'Meer opties zijn beschikbaar in de persoonlijke stroom instellingen', + 'keep_history_by_feed' => 'Minimum aantal te behouden artikelen in de feed', + 'optimize' => 'Optimaliseer database', + 'optimize_help' => 'Doe dit zo af en toe om de omvang van de database te verkleinen', + 'purge_now' => 'Schoon nu op', + 'title' => 'Archivering', + 'ttl' => 'Vernieuw niet automatisch meer dan', + ), + 'display' => array( + '_' => 'Opmaak', + 'icon' => array( + 'bottom_line' => 'Onderaan', + 'entry' => 'Artikel pictogrammen', + 'publication_date' => 'Publicatie datum', + 'related_tags' => 'Gerelateerde labels', + 'sharing' => 'Delen', + 'top_line' => 'Bovenaan', + ), + 'language' => 'Taal', + 'notif_html5' => array( + 'seconds' => 'seconden (0 betekent geen stop)', + 'timeout' => 'HTML5 notificatie stop', + ), + 'theme' => 'Thema', + 'title' => 'Opmaak', + 'width' => array( + 'content' => 'Inhoud breedte', + 'large' => 'Breed', + 'medium' => 'Normaal', + 'no_limit' => 'Geen limiet', + 'thin' => 'Smal', + ), + ), + 'query' => array( + '_' => 'Gebruikers queries (informatie aanvragen)', + 'deprecated' => 'Deze query (informatie aanvraag) is niet langer geldig. De bedoelde categorie of feed is al verwijderd.', + 'filter' => 'Filter toegepast:', + 'get_all' => 'Toon alle artikelen', + 'get_category' => 'Toon "%s" categorie', + 'get_favorite' => 'Toon favoriete artikelen', + 'get_feed' => 'Toon "%s" feed', + 'no_filter' => 'Geen filter', + 'none' => 'U hebt nog geen gebruikers query aangemaakt..', + 'number' => 'Query n°%d', + 'order_asc' => 'Toon oudste artikelen eerst', + 'order_desc' => 'Toon nieuwste artikelen eerst', + 'search' => 'Zoek naar "%s"', + 'state_0' => 'Toon alle artikelen', + 'state_1' => 'Toon gelezen artikelen', + 'state_2' => 'Toon ongelezen artikelen', + 'state_3' => 'Toon alle artikelen', + 'state_4' => 'Toon favoriete artikelen', + 'state_5' => 'Toon gelezen favoriete artikelen', + 'state_6' => 'Toon ongelezen favoriete artikelen', + 'state_7' => 'Toon favoriete artikelen', + 'state_8' => 'Toon niet favoriete artikelen', + 'state_9' => 'Toon gelezen niet favoriete artikelen', + 'state_10' => 'Toon ongelezen niet favoriete artikelen', + 'state_11' => 'Toon niet favoriete artikelen', + 'state_12' => 'Toon alle artikelen', + 'state_13' => 'Toon gelezen artikelen', + 'state_14' => 'Toon ongelezen artikelen', + 'state_15' => 'Toon alle artikelen', + 'title' => 'Gebruikers queries', + ), + 'profile' => array( + '_' => 'Profiel beheer', + 'delete' => array( + '_' => 'Account verwijderen', + 'warn' => 'Uw account en alle gerelateerde gegvens worden verwijderd.', + ), + 'password_api' => 'Wachtwoord API<br /><small>(e.g., voor mobiele apps)</small>', + 'password_form' => 'Wachtwoord<br /><small>(voor de Web-formulier log in methode)</small>', + 'password_format' => 'Ten minste 7 tekens', + 'title' => 'Profiel', + ), + 'reading' => array( + '_' => 'Lezen', + 'after_onread' => 'Na “markeer alles als gelezen”,', + 'articles_per_page' => 'Aantal artikelen per pagina', + 'auto_load_more' => 'Laad volgende artikel onderaan de pagina', + 'auto_remove_article' => 'Verberg artikel na lezen', + 'confirm_enabled' => 'Toon een bevestigings dialoog op “markeer alles als gelezen” acties', + 'display_articles_unfolded' => 'Toon artikelen uitgeklapt als standaard', + 'display_categories_unfolded' => 'Toon categoriën ingeklapt als standaard', + 'hide_read_feeds' => 'Verberg categoriën en feeds zonder ongelezen artikelen (werkt niet met “Toon alle artikelen” configuratie)', + 'img_with_lazyload' => 'Gebruik "lazy load" methode om afbeeldingen te laden', + 'jump_next' => 'Ga naar volgende ongelezen (feed of categorie)', + 'mark_updated_article_unread' => 'Markeer vernieuwd artikel als ongelezen', + 'number_divided_when_reader' => 'Gedeeld door 2 in de lees modus.', + 'read' => array( + 'article_open_on_website' => 'Als het artikel is geopend op de originele website', + 'article_viewed' => 'Als het artikel is bekeken', + 'scroll' => 'Tijdens scrollen', + 'upon_reception' => 'Tijdens ontvangst van het artikel', + 'when' => 'Markeer artikel als gelezen…', + ), + 'show' => array( + '_' => 'Artikelen om te tonen', + 'adaptive' => 'Pas weergave aan', + 'all_articles' => 'Bekijk alle artikelen', + 'unread' => 'Bekijk alleen ongelezen', + ), + 'sort' => array( + '_' => 'Sorteer volgorde', + 'newer_first' => 'Nieuwste eerst', + 'older_first' => 'Oudste eerst', + ), + 'sticky_post' => 'Koppel artikel aan de bovenkant als het geopend wordt', + 'title' => 'Lees modus', + 'view' => array( + 'default' => 'Standaard weergave', + 'global' => 'Globale weergave', + 'normal' => 'Normale weergave', + 'reader' => 'Lees weergave', + ), + ), + 'sharing' => array( + '_' => 'Delen', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Meer informatie', + 'print' => 'Afdrukken', + 'shaarli' => 'Shaarli', + 'share_name' => 'Gedeelde naam om weer te geven', + 'share_url' => 'Deel URL voor gebruik', + 'title' => 'Delen', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Shortcuts', + 'article_action' => 'Artikel acties', + 'auto_share' => 'Delen', + 'auto_share_help' => 'Als er slechts één deel methode i, dan wordt deze gebruikt. Anders zijn ze toegankelijk met hun nummer.', + 'close_dropdown' => 'Sluit menu', + 'collapse_article' => 'Inklappen', + 'first_article' => 'Spring naar eerste artikel', + 'focus_search' => 'Toegang zoek venster', + 'help' => 'Toon documentatie', + 'javascript' => 'JavaScript moet geactiveerd zijn om verwijzingen te gebruiken', + 'last_article' => 'Spring naar laatste artikel', + 'load_more' => 'Laad meer artikelen', + 'mark_read' => 'Markeer als gelezen', + 'mark_favorite' => 'Markeer als favoriet', + 'navigation' => 'Navigatie', + 'navigation_help' => 'Met de "Shift" toets, kunt u navigatie verwijzingen voor feeds gebruiken.<br/>Met de "Alt" toets, kunt u navigatie verwijzingen voor categoriën gebruiken.', + 'next_article' => 'Spring naar volgende artikel', + 'other_action' => 'Andere acties', + 'previous_article' => 'Spring naar vorige artikel', + 'see_on_website' => 'Bekijk op originale website', + 'shift_for_all_read' => '+ <code>shift</code> om alle artikelen als gelezen te markeren', + 'title' => 'Verwijzingen', + 'user_filter' => 'Toegang gebruikers filters', + 'user_filter_help' => 'Als er slechts één gebruikers filter s, dan wordt deze gebruikt. Anders zijn ze toegankelijk met hun nummer.', + ), + 'user' => array( + 'articles_and_size' => '%s artikelen (%s)', + 'current' => 'Huidige gebruiker', + 'is_admin' => 'is administrateur', + 'users' => 'Gebruikers', + ), +); diff --git a/app/i18n/nl/feedback.php b/app/i18n/nl/feedback.php new file mode 100644 index 000000000..386b8d415 --- /dev/null +++ b/app/i18n/nl/feedback.php @@ -0,0 +1,110 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'admin' => array( + 'optimization_complete' => 'Optimalisatie compleet', + ), + 'access' => array( + 'denied' => 'U hebt geen rechten om deze pagina te bekijken.', + 'not_found' => 'Deze pagina bestaat niet', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Een probleem is opgetreden tijdens de controle van de systeem configuratie. Probeer het later nog eens.', + 'set' => 'Formulier is nu uw standaard authenticatie systeem.', + ), + 'login' => array( + 'invalid' => 'Log in is ongeldig', + 'success' => 'U bent ingelogd', + ), + 'logout' => array( + 'success' => 'U bent uitgelogd', + ), + 'no_password_set' => 'Administrateur wachtwoord is niet ingesteld. Deze mogelijkheid is niet beschikbaar.', + ), + 'conf' => array( + 'error' => 'Er is een fout opgetreden tijdens het opslaan van de configuratie', + 'query_created' => 'Query "%s" is gemaakt.', + 'shortcuts_updated' => 'Verwijzingen zijn vernieuwd', + 'updated' => 'Configuratie is vernieuwd', + ), + 'extensions' => array( + 'already_enabled' => '%s is al ingeschakeld', + 'disable' => array( + 'ko' => '%s kan niet worden uitgeschakeld. <a href="%s">Controleer FressRSS log bestanden</a> voor details.', + 'ok' => '%s is nu uitgeschakeld', + ), + 'enable' => array( + 'ko' => '%s kan niet worden ingeschakeld. <a href="%s">Controleer FressRSS log bestanden</a> voor details.', + 'ok' => '%s is nn ingeschakeld', + ), + 'no_access' => 'U hebt geen toegang voor %s', + 'not_enabled' => '%s is nog niet ingeschakeld', + 'not_found' => '%s bestaat niet', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP uitbreiding is niet aanwezig op uw server. Exporteer a.u.b. uw bestanden één voor één.', + 'feeds_imported' => 'Uw feeds zijn geimporteerd en worden nu vernieuwd', + 'feeds_imported_with_errors' => 'Uw feeds zijn geimporteerd maar er zijn enige fouten opgetreden', + 'file_cannot_be_uploaded' => 'Bestand kan niet worden verzonden!', + 'no_zip_extension' => 'ZIP uitbreiding is niet aanwezig op uw server.', + 'zip_error' => 'Er is een fout opgetreden tijdens het imporeren van het ZIP bestand.', + ), + 'sub' => array( + 'actualize' => 'Actualiseren', + 'category' => array( + 'created' => 'Categorie %s is gemaakt.', + 'deleted' => 'Categorie is verwijderd.', + 'emptied' => 'Categorie is leeg gemaakt', + 'error' => 'Categorie kan niet worden vernieuwd', + 'name_exists' => 'Categorie naam bestaat al.', + 'no_id' => 'U moet de id specificeren of de categorie.', + 'no_name' => 'Categorie naam mag niet leeg zijn.', + 'not_delete_default' => 'U kunt de standaard categorie niet verwijderen!', + 'not_exist' => 'De categorie bestaat niet!', + 'over_max' => 'U hebt het maximale aantal categoriën bereikt (%d)', + 'updated' => 'Categorie is vernieuwd.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> is vernieuwd', + 'actualizeds' => 'RSS feeds zijn vernieuwd', + 'added' => 'RSS feed <em>%s</em> is toegevoegd', + 'already_subscribed' => 'U bent al geabonneerd op <em>%s</em>', + 'deleted' => 'Feed is verwijderd', + 'error' => 'Feed kan niet worden vernieuwd', + 'internal_problem' => 'De RSS feed kon niet worden toegevoegd. <a href="%s">Controleer FressRSS log bestanden</a> voor details.', + 'invalid_url' => 'URL <em>%s</em> is ongeldig', + 'marked_read' => 'Feeds zijn gemarkeerd als gelezen', + 'n_actualized' => '%d feeds zijn vernieuwd', + 'n_entries_deleted' => '%d artikelen zijn verwijderd', + 'no_refresh' => 'Er is geen feed om te vernieuwen…', + 'not_added' => '<em>%s</em> kon niet worden toegevoegd', + 'over_max' => 'U hebt het maximale aantal feeds bereikt(%d)', + 'updated' => 'Feed is vernieuwd', + ), + 'purge_completed' => 'Opschonen klaar (%d artikelen verwijderd)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS word nu vernieud naar <strong>versie %s</strong>.', + 'error' => 'Het vernieuwingsproces kwam een fout tegen: %s', + 'file_is_nok' => 'Controleer permissies op <em>%s</em> map. HTTP server moet rechten hebben om er in te schrijven', + 'finished' => 'Vernieuwing compleet!', + 'none' => 'Geen vernieuwing om toe te passen', + 'server_not_found' => 'Vernieuwings server kan niet worden gevonden. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'Gebruiker %s is aangemaakt', + 'error' => 'Gebruiker %s kan niet worden aangemaakt', + ), + 'deleted' => array( + '_' => 'Gebruiker %s is verwijderd', + 'error' => 'Gebruiker %s kan niet worden verwijderd', + ), + 'set_registration' => 'Het maximale aantal accounts is vernieuwd.', + ), + 'profile' => array( + 'error' => 'Uw profiel kan niet worden aangepast', + 'updated' => 'Uw profiel is aangepast', + ), +); diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php new file mode 100644 index 000000000..83811ce68 --- /dev/null +++ b/app/i18n/nl/gen.php @@ -0,0 +1,182 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'action' => array( + 'actualize' => 'Actualiseren', + 'back_to_rss_feeds' => '← Ga terug naar je RSS feeds', + 'cancel' => 'Annuleren', + 'create' => 'Opslaan', + 'disable' => 'Uitzetten', + 'empty' => 'Leeg', + 'enable' => 'Aanzetten', + 'export' => 'Exporteren', + 'filter' => 'Filteren', + 'import' => 'Importeren', + 'manage' => 'Beheren', + 'mark_read' => 'Markeer als gelezen', + 'mark_favorite' => 'Markeer als favoriet', + 'remove' => 'Verwijder', + 'see_website' => 'Bekijk website', + 'submit' => 'Opslaan', + 'truncate' => 'Verwijder alle artikelen', + ), + 'auth' => array( + 'email' => 'Email adres', + 'keep_logged_in' => 'Ingelogd blijven voor <small>(%s dagen)</small>', + 'login' => 'Log in', + 'logout' => 'Log uit', + 'password' => array( + '_' => 'Wachtwoord', + 'format' => '<small>Ten minste 7 tekens</small>', + ), + 'registration' => array( + '_' => 'Nieuw account', + 'ask' => 'Maak een account?', + 'title' => 'Account maken', + ), + 'reset' => 'Authenticatie reset', + 'username' => array( + '_' => 'Gebruikersnaam', + 'admin' => 'Administrator gebruikersnaam', + 'format' => '<small>maximaal 16 alphanumerieke tekens</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t\\u\\s', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\i', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\i', + 'Jul' => '\\J\\u\\l\\i', + 'Jun' => '\\J\\u\\n\\i', + 'Mar' => '\\M\\a\\a\\r\\t', + 'May' => '\\M\\e\\i', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\k\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Ouder', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + 'format_date' => 'j %s Y', //<-- European date format // 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', + 'format_date_hour' => 'j %s Y \\o\\m H\\:i', //<-- European date format // 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', + 'fri' => 'Vr', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Laatste drie maanden', + 'last_6_month' => 'Laatste zes maanden', + 'last_month' => 'Vorige maand', + 'last_week' => 'Vorige week', + 'last_year' => 'Vorig jaar', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'Mei', + 'mon' => 'Ma', + 'month' => 'maanden', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'okt', + 'october' => 'Okt', + 'sat' => 'Za', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Zo', + 'thu' => 'Do', + 'today' => 'Vandaag', + 'tue' => 'Di', + 'wed' => 'Wo', + 'yesterday' => 'Gisteren', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'Over FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Lege categorie', + 'confirm_action' => 'Weet u zeker dat u dit wilt doen? Het kan niet ongedaan worden gemaakt!', + 'confirm_action_feed_cat' => 'Weet u zeker dat u dit wilt doen? U verliest alle gereleteerde favorieten en gebruikers informatie. Het kan niet ongedaan worden gemaakt!', + 'feedback' => array( + 'body_new_articles' => 'Er zijn %%d nieuwe artikelen om te lezen op FreshRSS.', + 'request_failed' => 'Een opdracht is mislukt, mogelijk door Internet verbindings problemen.', + 'title_new_articles' => 'FreshRSS: nieuwe artikelen!', + ), + 'new_article' => 'Er zijn nieuwe artikelen beschikbaar, klik om de pagina te vernieuwen.', + 'should_be_activated' => 'JavaScript moet aan staan', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'Over', + 'admin' => 'Administratie', + 'archiving' => 'Archiveren', + 'authentication' => 'Authenticatie', + 'check_install' => 'Installatie controle', + 'configuration' => 'Configuratie', + 'display' => 'Opmaak', + 'extensions' => 'Uitbreidingen', + 'logs' => 'Log boeken', + 'queries' => 'Gebruikers informatie', + 'reading' => 'Lezen', + 'search' => 'Zoek woorden of #labels', + 'sharing' => 'Delen', + 'shortcuts' => 'Snelle toegang', + 'stats' => 'Statistieken', + 'system' => 'Systeem configuratie', + 'update' => 'Versie controle', + 'user_management' => 'Beheer gebruikers', + 'user_profile' => 'Profiel', + ), + 'pagination' => array( + 'first' => 'Eerste', + 'last' => 'Laatste', + 'load_more' => 'Laad meer artikelen', + 'mark_all_read' => 'Markeer alle als gelezen', + 'next' => 'Volgende', + 'nothing_to_load' => 'Er zijn geen artikelen meer', + 'previous' => 'Vorige', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Attentie!', + 'blank_to_disable' => 'Laat leeg om uit te zetten', + 'by_author' => 'Door <em>%s</em>', + 'by_default' => 'Door standaard', + 'damn' => 'Potverdorie!', + 'default_category' => 'Niet ingedeeld', + 'no' => 'Nee', + 'not_applicable' => 'Niet aanwezig', + 'ok' => 'Ok!', + 'or' => 'of', + 'yes' => 'Ja', + ), +); diff --git a/app/i18n/nl/index.php b/app/i18n/nl/index.php new file mode 100644 index 000000000..751806bfa --- /dev/null +++ b/app/i18n/nl/index.php @@ -0,0 +1,61 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'about' => array( + '_' => 'Over', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Rapporteer fouten', + 'credits' => 'Waarderingen', + 'credits_content' => 'Sommige ontwerp elementen komen van <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> alhoewel FreshRSS dit raamwerk niet gebruikt. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Pictogrammen</a> komen van het <a href="https://www.gnome.org/">GNOME project</a>. <em>De Open Sans</em> font police is gemaakt door <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS is gebaseerd op <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, een PHP raamwerk. Nederlandse vertaling door Wanabo, <a href="http://www.nieuwskop.be" title="NieuwsKop">NieuwsKop.be</a>. Link naar de Nederlandse vertaling, <a href="https://github.com/Wanabo/FreshRSS-Dutch-translation/tree/master">FreshRSS-Dutch-translation</a>.', + 'freshrss_description' => 'FreshRSS is een RSS feed aggregator om zelf te hosten zoals <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> of <a href="http://projet.idleman.fr/leed/">Leed</a>. Het gebruikt weinig systeembronnen en is makkelijk te administreren terwijl het een krachtig en makkelijk te configureren programma is.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">op Github</a>', + 'license' => 'License', + 'project_website' => 'Project website', + 'title' => 'Over', + 'version' => 'Versie', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'U kunt wat feeds toevoegen.', + 'empty' => 'Er is geen artikel om te laten zien.', + 'rss_of' => 'RSS feed van %s', + 'title' => 'Overzicht RSS feeds', + 'title_global' => 'Globale weergave', + 'title_fav' => 'Uw favorieten', + ), + 'log' => array( + '_' => 'Log bestanden', + 'clear' => 'Leeg de log bestanden', + 'empty' => 'Log bestand is leeg', + 'title' => 'Log bestanden', + ), + 'menu' => array( + 'about' => 'Over FreshRSS', + 'add_query' => 'Voeg een query toe', + 'before_one_day' => 'Ouder als een dag', + 'before_one_week' => 'Ouder als een week', + 'favorites' => 'Favorieten (%s)', + 'global_view' => 'Globale weergave', + 'main_stream' => 'Overzicht', + 'mark_all_read' => 'Markeer alles als gelezen', + 'mark_cat_read' => 'Markeer categorie als gelezen', + 'mark_feed_read' => 'Markeer feed als gelezen', + 'newer_first' => 'Nieuwste eerst', + 'non-starred' => 'Laat alles zien behalve favorieten', + 'normal_view' => 'Normale weergave', + 'older_first' => 'Oudste eerst', + 'queries' => 'Gebruikers queries', + 'read' => 'Laat alleen gelezen zien', + 'reader_view' => 'Lees modus', + 'rss_view' => 'RSS feed', + 'search_short' => 'Zoeken', + 'starred' => 'Laat alleen favorieten zien', + 'stats' => 'Statistieken', + 'subscription' => 'Abonnementen beheer', + 'unread' => 'Laat alleen ongelezen zien', + ), + 'share' => 'Delen', + 'tag' => array( + 'related' => 'Verwante labels', + ), +); diff --git a/app/i18n/nl/install.php b/app/i18n/nl/install.php new file mode 100644 index 000000000..79db9c794 --- /dev/null +++ b/app/i18n/nl/install.php @@ -0,0 +1,119 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'action' => array( + 'finish' => 'Completeer installatie', + 'fix_errors_before' => 'Repareer de fouten alvorens naar de volgende stap te gaan.', + 'keep_install' => 'Behoud de vorige installatie', + 'next_step' => 'Ga naar de volgende stap', + 'reinstall' => 'Installeer FreshRSS opnieuw', + ), + 'auth' => array( + 'form' => 'Web formulier (traditioneel, benodigd JavaScript)', + 'http' => 'HTTP (voor geavanceerde gebruikers met HTTPS)', + 'none' => 'Geen (gevaarlijk)', + 'password_form' => 'Wachtwoord<br /><small>(voor de Web-formulier log in methode)</small>', + 'password_format' => 'Tenminste 7 tekens', + 'type' => 'Authenticatie methode', + ), + 'bdd' => array( + '_' => 'Database', + 'conf' => array( + '_' => 'Database configuratie', + 'ko' => 'Controleer uw database informatie.', + 'ok' => 'Database configuratie is opgeslagen.', + ), + 'host' => 'Host', + 'prefix' => 'Tabel voorvoegsel', + 'password' => 'Database wachtwoord', + 'type' => 'Type database', + 'username' => 'Database gebruikersnaam', + ), + 'check' => array( + '_' => 'Controles', + 'already_installed' => 'We hebben geconstateerd dat FreshRSS al is geïnstallerd!', + 'cache' => array( + 'nok' => 'Controleer permissies van de <em>./data/cache</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de cache map zijn goed.', + ), + 'ctype' => array( + 'nok' => 'U mist een benodigde bibliotheek voor character type checking (php-ctype).', + 'ok' => 'U hebt de benodigde bibliotheek voor character type checking (ctype).', + ), + 'curl' => array( + 'nok' => 'U mist cURL (php-curl package).', + 'ok' => 'U hebt de cURL uitbreiding.', + ), + 'data' => array( + 'nok' => 'Controleer permissies van de <em>./data</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de data map zijn goed.', + ), + 'dom' => array( + 'nok' => 'U mist een benodigde bibliotheek om te bladeren in de DOM.', + 'ok' => 'U hebt de benodigde bibliotheek om te bladeren in de DOM.', + ), + 'favicons' => array( + 'nok' => 'Controleer permissies van de <em>./data/favicons</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de favicons map zijn goed.', + ), + 'fileinfo' => array( + 'nok' => 'U mist PHP fileinfo (fileinfo package).', + 'ok' => 'U hebt de fileinfo uitbreiding.', + ), + 'http_referer' => array( + 'nok' => 'Controleer a.u.b. dat u niet uw HTTP REFERER wijzigd.', + 'ok' => 'Uw HTTP REFERER is bekend en komt overeen met uw server.', + ), + 'json' => array( + 'nok' => 'U mist een benodigede bibliotheek om JSON te gebruiken.', + 'ok' => 'U hebt de benodigde bibliotheek om JSON te gebruiken.', + ), + 'minz' => array( + 'nok' => 'U mist het Minz framework.', + 'ok' => 'U hebt het Minz framework.', + ), + 'pcre' => array( + 'nok' => 'U mist een benodigde bibliotheek voor regular expressions (php-pcre).', + 'ok' => 'U hebt de benodigde bibliotheek voor regular expressions (PCRE).', + ), + 'pdo' => array( + 'nok' => 'U mist PDO of één van de ondersteunde (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'U hebt PDO en ten minste één van de ondersteunde drivers (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'Uw PHP versie is %s maar FreshRSS benodigd tenminste versie %s.', + 'ok' => 'Uw PHP versie is %s, welke compatibel is met FreshRSS.', + ), + 'users' => array( + 'nok' => 'Controleer permissies van de <em>./data/users</em> map. HTTP server moet rechten hebben om er in te kunnen schrijven', + 'ok' => 'Permissies van de users map zijn goed.', + ), + 'xml' => array( + 'nok' => 'U mist de benodigde bibliotheek om XML te gebruiken.', + 'ok' => 'U hebt de benodigde bibliotheek om XML te gebruiken.', + ), + ), + 'conf' => array( + '_' => 'Algemene configuratie', + 'ok' => 'Algemene configuratie is opgeslagen.', + ), + 'congratulations' => 'Gefeliciteerd!', + 'default_user' => 'Gebruikersnaam van de standaard gebruiker <small>(maximaal 16 alphanumerieke tekens)</small>', + 'delete_articles_after' => 'Verwijder artikelen na', + 'fix_errors_before' => 'Repareer fouten alvorens U naar de volgende stap gaat.', + 'javascript_is_better' => 'FreshRSS werkt beter JavaScript ingeschakeld', + 'js' => array( + 'confirm_reinstall' => 'U verliest uw vorige configuratie door FreshRSS opnieuw te installeren. Weet u zeker dat u verder wilt gaan?', + ), + 'language' => array( + '_' => 'Taal', + 'choose' => 'Kies een taal voor FreshRSS', + 'defined' => 'Taal is bepaald.', + ), + 'not_deleted' => 'Er ging iets fout! U moet het bestand <em>%s</em> handmatig verwijderen.', + 'ok' => 'De installatie procedure is geslaagd.', + 'step' => 'stap %d', + 'steps' => 'Stappen', + 'title' => 'Installatie · FreshRSS', + 'this_is_the_end' => 'Dit is het einde', +); diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php new file mode 100644 index 000000000..a1ba3f03d --- /dev/null +++ b/app/i18n/nl/sub.php @@ -0,0 +1,62 @@ +<?php +/* Dutch translation by Wanabo. http://www.nieuwskop.be */ +return array( + 'category' => array( + '_' => 'Categorie', + 'add' => 'Voeg categorie toe', + 'empty' => 'Lege categorie', + 'new' => 'Nieuwe categorie', + ), + 'feed' => array( + 'add' => 'Voeg een RSS feed toe', + 'advanced' => 'Geavanceerd', + 'archiving' => 'Archiveren', + 'auth' => array( + 'configuration' => 'Log in', + 'help' => 'Verbinding toestaan toegang te krijgen tot HTTP beveiligde RSS feeds', + 'http' => 'HTTP Authenticatie', + 'password' => 'HTTP wachtwoord', + 'username' => 'HTTP gebruikers naam', + ), + 'css_help' => 'Haalt verstoorde RSS feeds op (attentie, heeft meer tijd nodig!)', + 'css_path' => 'Artikelen CSS pad op originele website', + 'description' => 'Omschrijving', + 'empty' => 'Deze feed is leeg. Controleer of deze nog actueel is.', + 'error' => 'Deze feed heeft problemen. Verifieer a.u.b het doeladres en actualiseer het.', + 'in_main_stream' => 'Zichtbaar in het overzicht', + 'informations' => 'Informatie', + 'keep_history' => 'Minimum aantal artikelen om te houden', + 'moved_category_deleted' => 'Als u een categorie verwijderd, worden de feeds automatisch geclassificeerd onder <em>%s</em>.', + 'no_selected' => 'Geen feed geselecteerd.', + 'number_entries' => '%d artikelen', + 'pubsubhubbub' => 'Directe notificaties met PubSubHubbub', + 'stats' => 'Statistieken', + 'think_to_add' => 'Voeg wat feeds toe.', + 'title' => 'Titel', + 'title_add' => 'Voeg een RSS feed toe', + 'ttl' => 'Vernieuw automatisch niet vaker dan', + 'url' => 'Feed URL', + 'validator' => 'Controleer de geldigheid van de feed', + 'website' => 'Website URL', + ), + 'import_export' => array( + 'export' => 'Exporteer', + 'export_opml' => 'Exporteer lijst van feeds (OPML)', + 'export_starred' => 'Exporteer je fovorieten', + 'feed_list' => 'Lijst van %s artikelen', + 'file_to_import' => 'Bestand om te importeren<br />(OPML, JSON of ZIP)', + 'file_to_import_no_zip' => 'Bestand om te importeren<br />(OPML of JSON)', + 'import' => 'Importeer', + 'starred_list' => 'Lijst van favoriete artikelen', + 'title' => 'Importeren / exporteren', + ), + 'menu' => array( + 'bookmark' => 'Abonneer (FreshRSS bladwijzer)', + 'import_export' => 'Importeer / exporteer', + 'subscription_management' => 'Abonnementen beheer', + ), + 'title' => array( + '_' => 'Abonnementen beheer', + 'feed_management' => 'RSS feed beheer', + ), +); diff --git a/app/i18n/ru/admin.php b/app/i18n/ru/admin.php new file mode 100644 index 000000000..f5da97371 --- /dev/null +++ b/app/i18n/ru/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Разрешить анонимное чтение статей для пользователя по умолчанию (%s)', + 'allow_anonymous_refresh' => 'Разрешить анонимное обновление статей', + 'api_enabled' => 'Включить доступ к <abbr>API</abbr> <small>(необходимо для мобильных приложений)</small>', + 'form' => 'На основе веб-формы (традиционный, необходим JavaScript)', + 'http' => 'HTTP (для продвинутых пользователей - по HTTPS)', + 'none' => 'Без аутентификации (небезопасный)', + 'title' => 'Аутентификации', + 'title_reset' => 'Сброс аутентицикации', + 'token' => 'Токен аутентификации', + 'token_help' => 'Разрешает доступ к RSS ленте пользователя по умолчанию без аутентификации:', + 'type' => 'Метод аутентификации', + 'unsafe_autologin' => 'Разрешить небезопасный автоматический вход с использованием следующего формата: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/cache</em>. Сервер HTTP должен иметь права на запись в эту папку', + 'ok' => 'Права на <em>./data/cache</em> в порядке.', + ), + 'categories' => array( + 'nok' => 'Таблица категорий настроена неправильно.', + 'ok' => 'Таблица категорий настроена правильно.', + ), + 'connection' => array( + 'nok' => 'Подключение к базе данных не может быть установлено.', + 'ok' => 'Подключение к базе данных в порядке.', + ), + 'ctype' => array( + 'nok' => 'У вас не установлена библиотека для проверки типов символов (php-ctype).', + 'ok' => 'У вас не установлена библиотека для проверки типов символов (ctype).', + ), + 'curl' => array( + 'nok' => 'У вас не установлено расширение cURL (пакет php-curl).', + 'ok' => 'У вас установлено расширение cURL.', + ), + 'data' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на <em>./data/</em> в порядке.', + ), + 'database' => 'Установка базы данных', + 'dom' => array( + 'nok' => 'У вас не установлена библиотека для просмотра DOM (пакет php-xml).', + 'ok' => 'У вас установлена библиотека для просмотра DOM.', + ), + 'entries' => array( + 'nok' => 'Таблица статей (entry) неправильно настроена.', + 'ok' => 'Таблица статей (entry) настроена правильно.', + ), + 'favicons' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/favicons</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку значков в порядке.', + ), + 'feeds' => array( + 'nok' => 'Таблица подписок (feed) неправильно настроена.', + 'ok' => 'Таблица подписок (feed) настроена правильно.', + ), + 'fileinfo' => array( + 'nok' => 'У вас не установлено расширение PHP fileinfo (пакет fileinfo).', + 'ok' => 'У вас установлено расширение fileinfo.', + ), + 'files' => 'Установка файлов', + 'json' => array( + 'nok' => 'У вас не установлена библиотека для работы с JSON (пакет php5-json).', + 'ok' => 'У вас установлена библиотека для работы с JSON.', + ), + 'minz' => array( + 'nok' => 'У вас не установлен фрейворк Minz.', + 'ok' => 'У вас установлен фрейворк Minz.', + ), + 'pcre' => array( + 'nok' => 'У вас не установлена необходимая библиотека для работы с регулярными выражениями (php-pcre).', + 'ok' => 'У вас установлена необходимая библиотека для работы с регулярными выражениями (PCRE).', + ), + 'pdo' => array( + 'nok' => 'У вас не установлен PDO или один из необходимых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'У вас установлен PDO и как минимум один из поддерживаемых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP installation', + 'nok' => 'У вас установлен PHP версии %s, но FreshRSS необходима версия не ниже %s.', + 'ok' => 'У вас установлен PHP версии %s, который совместим с FreshRSS.', + ), + 'tables' => array( + 'nok' => 'В базе данных отсуствует одна или больше таблица.', + 'ok' => 'Все таблицы есть в базе данных.', + ), + 'title' => 'Проверка установки и настройки', + 'tokens' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/tokens</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку tokens в порядке.', + ), + 'users' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/users</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку users в порядке.', + ), + 'zip' => array( + 'nok' => 'You lack ZIP extension (php-zip package).', + 'ok' => 'You have ZIP extension.', + ), + ), + 'extensions' => array( + 'disabled' => 'Отключены', + 'empty_list' => 'Расширения не установлены', + 'enabled' => 'Включены', + 'no_configure_view' => 'Это расширение нельзя настроить.', + 'system' => array( + '_' => 'Системные расширения', + 'no_rights' => 'Системные расширения (у вас нет к ним доступа)', + ), + 'title' => 'Расширения', + 'user' => 'Расширения пользователя', + ), + 'stats' => array( + '_' => 'Статистика', + 'all_feeds' => 'Все подписки', + 'category' => 'Категория', + 'entry_count' => 'Количество статей', + 'entry_per_category' => 'Статей в категории', + 'entry_per_day' => 'Статей за день (за последние 30 дней)', + 'entry_per_day_of_week' => 'За неделю (в среднем - %.2f сообщений)', + 'entry_per_hour' => 'За час (в среднем - %.2f сообщений)', + 'entry_per_month' => 'За месяц (в среднем - %.2f сообщений)', + 'entry_repartition' => 'Перерасределение статей', + 'feed' => 'Подписка', + 'feed_per_category' => 'Подписок в категории', + 'idle' => 'Неактивные подписки', + 'main' => 'Основная статистика', + 'main_stream' => 'Основной поток', + 'menu' => array( + 'idle' => 'Неактивные подписки', + 'main' => 'Основная статистика', + 'repartition' => 'Перерасределение статей', + ), + 'no_idle' => 'Нет неактивных подписок!', + 'number_entries' => 'статей: %d', + 'percent_of_total' => '%% от всего', + 'repartition' => 'Перераспределение статей', + 'status_favorites' => 'Избранное', + 'status_read' => 'Читать', + 'status_total' => 'Всего', + 'status_unread' => 'Не прочитано', + 'title' => 'Статистика', + 'top_feed' => '10 лучших подписок', + ), + 'system' => array( + '_' => 'Системные настройки', + 'auto-update-url' => 'Адрес сервера для автоматического обновления', + 'instance-name' => 'Название этого сервера', + 'max-categories' => 'Количество категорий на пользователя', + 'max-feeds' => 'Количество статей на пользователя', + 'registration' => array( + 'help' => '0 означает неограниченное количество пользователей', + 'number' => 'Максимальное количество пользователей', + ), + ), + 'update' => array( + '_' => 'Обновление системы', + 'apply' => 'Применить', + 'check' => 'Проверить обновления', + 'current_version' => 'Ваша текущая версия FreshRSS: %s.', + 'last' => 'Последняя проверка: %s', + 'none' => 'Нечего обновлять', + 'title' => 'Обновить систему', + ), + 'user' => array( + 'articles_and_size' => '%s статей (%s)', + 'create' => 'Создать нового пользователя', + 'language' => 'Язык', + 'number' => 'На данный момент создан %d аккаунт', + 'numbers' => 'На данный момент аккаунтов создано: %d', + 'password_form' => 'Пароль<br /><small>(для входа через Веб-форму)</small>', + 'password_format' => 'Минимум 7 символов', + 'title' => 'Управление пользователями', + 'user_list' => 'Список пользователей', + 'username' => 'Имя пользователя', + 'users' => 'Пользователи', + ), +); diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.php new file mode 100644 index 000000000..557fbe369 --- /dev/null +++ b/app/i18n/ru/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Архивация', + 'advanced' => 'Продвинутые настройки', + 'delete_after' => 'Удалять статьи после', + 'help' => 'Каждую подписку можно настроить более гибко', + 'keep_history_by_feed' => 'Minimum number of articles to keep by feed', + 'optimize' => 'Оптимизировать базу данных', + 'optimize_help' => 'To do occasionally to reduce the size of the database', + 'purge_now' => 'Очистить сейчас', + 'title' => 'Архивация', + 'ttl' => 'Не обновлять чаще чем', + ), + 'display' => array( + '_' => 'Display', + 'icon' => array( + 'bottom_line' => 'Bottom line', + 'entry' => 'Article icons', + 'publication_date' => 'Date of publication', + 'related_tags' => 'Related tags', + 'sharing' => 'Sharing', + 'top_line' => 'Top line', + ), + 'language' => 'Язык', + 'notif_html5' => array( + 'seconds' => 'seconds (0 means no timeout)', + 'timeout' => 'HTML5 notification timeout', + ), + 'theme' => 'Тема', + 'title' => 'Display', + 'width' => array( + 'content' => 'Content width', + 'large' => 'Large', + 'medium' => 'Medium', + 'no_limit' => 'No limit', + 'thin' => 'Thin', + ), + ), + 'query' => array( + '_' => 'User queries', + 'deprecated' => 'This query is no longer valid. The referenced category or feed has been deleted.', + 'filter' => 'Filter applied:', + 'get_all' => 'Display all articles', + 'get_category' => 'Display "%s" category', + 'get_favorite' => 'Display favorite articles', + 'get_feed' => 'Display "%s" feed', + 'no_filter' => 'No filter', + 'none' => 'You haven’t created any user query yet.', + 'number' => 'Query n°%d', + 'order_asc' => 'Display oldest articles first', + 'order_desc' => 'Display newest articles first', + 'search' => 'Search for "%s"', + 'state_0' => 'Display all articles', + 'state_1' => 'Display read articles', + 'state_2' => 'Display unread articles', + 'state_3' => 'Display all articles', + 'state_4' => 'Display favorite articles', + 'state_5' => 'Display read favorite articles', + 'state_6' => 'Display unread favorite articles', + 'state_7' => 'Display favorite articles', + 'state_8' => 'Display not favorite articles', + 'state_9' => 'Display read not favorite articles', + 'state_10' => 'Display unread not favorite articles', + 'state_11' => 'Display not favorite articles', + 'state_12' => 'Display all articles', + 'state_13' => 'Display read articles', + 'state_14' => 'Display unread articles', + 'state_15' => 'Display all articles', + 'title' => 'User queries', + ), + 'profile' => array( + '_' => 'Profile management', + 'delete' => array( + '_' => 'Account deletion', + 'warn' => 'Your account and all the related data will be deleted.', + ), + 'password_api' => 'Password API<br /><small>(e.g., for mobile apps)</small>', + 'password_form' => 'Password<br /><small>(for the Web-form login method)</small>', + 'password_format' => 'At least 7 characters', + 'title' => 'Profile', + ), + 'reading' => array( + '_' => 'Reading', + 'after_onread' => 'After “mark all as read”,', + 'articles_per_page' => 'Number of articles per page', + 'auto_load_more' => 'Load next articles at the page bottom', + 'auto_remove_article' => 'Hide articles after reading', + 'mark_updated_article_unread' => 'Mark updated articles as unread', + 'confirm_enabled' => 'Display a confirmation dialog on “mark all as read” actions', + 'display_articles_unfolded' => 'Show articles unfolded by default', + 'display_categories_unfolded' => 'Show categories folded by default', + 'hide_read_feeds' => 'Hide categories & feeds with no unread article (does not work with “Show all articles” configuration)', + 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', + 'jump_next' => 'jump to next unread sibling (feed or category)', + 'number_divided_when_reader' => 'Divided by 2 in the reading view.', + 'read' => array( + 'article_open_on_website' => 'when article is opened on its original website', + 'article_viewed' => 'when article is viewed', + 'scroll' => 'while scrolling', + 'upon_reception' => 'upon reception of the article', + 'when' => 'Mark article as read…', + ), + 'show' => array( + '_' => 'Articles to display', + 'adaptive' => 'Adjust showing', + 'all_articles' => 'Show all articles', + 'unread' => 'Show only unread', + ), + 'sort' => array( + '_' => 'Sort order', + 'newer_first' => 'Newer first', + 'older_first' => 'Oldest first', + ), + 'sticky_post' => 'Stick the article to the top when opened', + 'title' => 'Reading', + 'view' => array( + 'default' => 'Default view', + 'global' => 'Global view', + 'normal' => 'Normal view', + 'reader' => 'Reading view', + ), + ), + 'sharing' => array( + '_' => 'Sharing', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'More information', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'share_name' => 'Share name to display', + 'share_url' => 'Share URL to use', + 'title' => 'Sharing', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Shortcuts', + 'article_action' => 'Article actions', + 'auto_share' => 'Share', + 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.', + 'close_dropdown' => 'Close menus', + 'collapse_article' => 'Collapse', + 'first_article' => 'Skip to the first article', + 'focus_search' => 'Access search box', + 'help' => 'Display documentation', + 'javascript' => 'JavaScript must be enabled in order to use shortcuts', + 'last_article' => 'Skip to the last article', + 'load_more' => 'Load more articles', + 'mark_read' => 'Mark as read', + 'mark_favorite' => 'Mark as favourite', + 'navigation' => 'Navigation', + 'navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Alt" modifier, navigation shortcuts apply on categories.', + 'next_article' => 'Skip to the next article', + 'other_action' => 'Other actions', + 'previous_article' => 'Skip to the previous article', + 'see_on_website' => 'See on original website', + 'shift_for_all_read' => '+ <code>shift</code> to mark all articles as read', + 'title' => 'Shortcuts', + 'user_filter' => 'Access user filters', + 'user_filter_help' => 'If there is only one user filter, it is used. Else filters are accessible by their number.', + ), + 'user' => array( + 'articles_and_size' => '%s articles (%s)', + 'current' => 'Current user', + 'is_admin' => 'is administrator', + 'users' => 'Users', + ), +); diff --git a/app/i18n/ru/feedback.php b/app/i18n/ru/feedback.php new file mode 100644 index 000000000..e7f6b9f85 --- /dev/null +++ b/app/i18n/ru/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimisation complete', + ), + 'access' => array( + 'denied' => 'You don’t have permission to access this page', + 'not_found' => 'You are looking for a page which doesn’t exist', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'A problem occured during authentication system configuration. Please retry later.', + 'set' => 'Form is now your default authentication system.', + ), + 'login' => array( + 'invalid' => 'Login is invalid', + 'success' => 'You are connected', + ), + 'logout' => array( + 'success' => 'You are disconnected', + ), + 'no_password_set' => 'Administrator password hasn’t been set. This feature isn’t available.', + ), + 'conf' => array( + 'error' => 'An error occurred during configuration saving', + 'query_created' => 'Query "%s" has been created.', + 'shortcuts_updated' => 'Shortcuts have been updated', + 'updated' => 'Configuration has been updated', + ), + 'extensions' => array( + 'already_enabled' => '%s is already enabled', + 'disable' => array( + 'ko' => '%s cannot be disabled. <a href="%s">Check FressRSS logs</a> for details.', + 'ok' => '%s is now disabled', + ), + 'enable' => array( + 'ko' => '%s cannot be enabled. <a href="%s">Check FressRSS logs</a> for details.', + 'ok' => '%s is now enabled', + ), + 'no_access' => 'You have no access on %s', + 'not_enabled' => '%s is not enabled yet', + 'not_found' => '%s does not exist', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP extension is not present on your server. Please try to export files one by one.', + 'feeds_imported' => 'Your feeds have been imported and will now be updated', + 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', + 'file_cannot_be_uploaded' => 'File cannot be uploaded!', + 'no_zip_extension' => 'ZIP extension is not present on your server.', + 'zip_error' => 'An error occured during ZIP import.', + ), + 'sub' => array( + 'actualize' => 'Actualise', + 'category' => array( + 'created' => 'Category %s has been created.', + 'deleted' => 'Category has been deleted.', + 'emptied' => 'Category has been emptied', + 'error' => 'Category cannot be updated', + 'name_exists' => 'Category name already exists.', + 'no_id' => 'You must precise the id of the category.', + 'no_name' => 'Category name cannot be empty.', + 'not_delete_default' => 'You cannot delete the default category!', + 'not_exist' => 'The category does not exist!', + 'over_max' => 'You have reached your limit of categories (%d)', + 'updated' => 'Category has been updated.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> has been updated', + 'actualizeds' => 'RSS feeds have been updated', + 'added' => 'RSS feed <em>%s</em> has been added', + 'already_subscribed' => 'You have already subscribed to <em>%s</em>', + 'deleted' => 'Feed has been deleted', + 'error' => 'Feed cannot be updated', + 'internal_problem' => 'The RSS feed could not be added. <a href="%s">Check FressRSS logs</a> for details.', + 'invalid_url' => 'URL <em>%s</em> is invalid', + 'marked_read' => 'Feeds have been marked as read', + 'n_actualized' => '%d feeds have been updated', + 'n_entries_deleted' => '%d articles have been deleted', + 'no_refresh' => 'There is no feed to refresh…', + 'not_added' => '<em>%s</em> could not be added', + 'over_max' => 'You have reached your limit of feeds (%d)', + 'updated' => 'Feed has been updated', + ), + 'purge_completed' => 'Purge completed (%d articles deleted)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS will now be updated to the <strong>version %s</strong>.', + 'error' => 'The update process has encountered an error: %s', + 'file_is_nok' => 'Check permissions on <em>%s</em> directory. HTTP server must have rights to write into', + 'finished' => 'Update completed!', + 'none' => 'No update to apply', + 'server_not_found' => 'Update server cannot be found. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => 'User %s has been created', + 'error' => 'User %s cannot be created', + ), + 'deleted' => array( + '_' => 'User %s has been deleted', + 'error' => 'User %s cannot be deleted', + ), + ), + 'profile' => array( + 'error' => 'Your profile cannot be modified', + 'updated' => 'Your profile has been modified', + ), +); diff --git a/app/i18n/ru/gen.php b/app/i18n/ru/gen.php new file mode 100644 index 000000000..bc42afaa8 --- /dev/null +++ b/app/i18n/ru/gen.php @@ -0,0 +1,182 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Actualize', + 'back_to_rss_feeds' => '← Go back to your RSS feeds', + 'cancel' => 'Cancel', + 'create' => 'Create', + 'disable' => 'Disable', + 'empty' => 'Empty', + 'enable' => 'Enable', + 'export' => 'Export', + 'filter' => 'Filter', + 'import' => 'Import', + 'manage' => 'Manage', + 'mark_read' => 'Mark as read', + 'mark_favorite' => 'Mark as favourite', + 'remove' => 'Remove', + 'see_website' => 'See website', + 'submit' => 'Submit', + 'truncate' => 'Delete all articles', + ), + 'auth' => array( + 'email' => 'Email address', + 'keep_logged_in' => 'Keep me logged in <small>(%s дней)</small>', + 'login' => 'Login', + 'logout' => 'Logout', + 'password' => array( + '_' => 'Password', + 'format' => '<small>At least 7 characters</small>', + ), + 'registration' => array( + '_' => 'New account', + 'ask' => 'Create an account?', + 'title' => 'Account creation', + ), + 'reset' => 'Authentication reset', + 'username' => array( + '_' => 'Username', + 'admin' => 'Administrator username', + 'format' => '<small>maximum 16 alphanumeric characters</small>', + ), + ), + 'date' => array( + 'Apr' => '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'Jul' => '\\J\\u\\l\\y', + 'Jun' => '\\J\\u\\n\\e', + 'Mar' => '\\M\\a\\r\\c\\h', + 'May' => '\\M\\a\\y', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'apr' => 'apr', + 'april' => 'Apr', + 'aug' => 'aug', + 'august' => 'Aug', + 'before_yesterday' => 'Before yesterday', + 'dec' => 'dec', + 'december' => 'Dec', + 'feb' => 'feb', + 'february' => 'Feb', + 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', + 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', + 'fri' => 'Fri', + 'jan' => 'jan', + 'january' => 'Jan', + 'jul' => 'jul', + 'july' => 'Jul', + 'jun' => 'jun', + 'june' => 'Jun', + 'last_3_month' => 'Last three months', + 'last_6_month' => 'Last six months', + 'last_month' => 'Last month', + 'last_week' => 'Last week', + 'last_year' => 'Last year', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'May', + 'mon' => 'Mon', + 'month' => 'months', + 'nov' => 'nov', + 'november' => 'Nov', + 'oct' => 'oct', + 'october' => 'Oct', + 'sat' => 'Sat', + 'sep' => 'sep', + 'september' => 'Sep', + 'sun' => 'Sun', + 'thu' => 'Thu', + 'today' => 'Today', + 'tue' => 'Tue', + 'wed' => 'Wed', + 'yesterday' => 'Yesterday', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'About FreshRSS', + ), + 'js' => array( + 'category_empty' => 'Empty category', + 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You will lose related favorites and user queries. It cannot be cancelled!', + 'feedback' => array( + 'body_new_articles' => 'There are %%d new articles to read on FreshRSS.', + 'request_failed' => 'A request has failed, it may have been caused by Internet connection problems.', + 'title_new_articles' => 'FreshRSS: new articles!', + ), + 'new_article' => 'There are new available articles, click to refresh the page.', + 'should_be_activated' => 'JavaScript must be enabled', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'About', + 'admin' => 'Administration', + 'archiving' => 'Archiving', + 'authentication' => 'Authentication', + 'check_install' => 'Installation checking', + 'configuration' => 'Configuration', + 'display' => 'Display', + 'extensions' => 'Extensions', + 'logs' => 'Logs', + 'queries' => 'User queries', + 'reading' => 'Reading', + 'search' => 'Search words or #tags', + 'sharing' => 'Sharing', + 'shortcuts' => 'Shortcuts', + 'stats' => 'Statistics', + 'system' => 'System configuration', + 'update' => 'Update', + 'user_management' => 'Manage users', + 'user_profile' => 'Profile', + ), + 'pagination' => array( + 'first' => 'First', + 'last' => 'Last', + 'load_more' => 'Load more articles', + 'mark_all_read' => 'Mark all as read', + 'next' => 'Next', + 'nothing_to_load' => 'There are no more articles', + 'previous' => 'Previous', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'jdh' => 'Journal du hacker', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + ), + 'short' => array( + 'attention' => 'Warning!', + 'blank_to_disable' => 'Leave blank to disable', + 'by_author' => 'By <em>%s</em>', + 'by_default' => 'By default', + 'damn' => 'Damn!', + 'default_category' => 'Uncategorized', + 'no' => 'No', + 'not_applicable' => 'Not available', + 'ok' => 'Ok!', + 'or' => 'or', + 'yes' => 'Yes', + ), +); diff --git a/app/i18n/ru/index.php b/app/i18n/ru/index.php new file mode 100644 index 000000000..eb6413e3c --- /dev/null +++ b/app/i18n/ru/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'About', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Bugs reports', + 'credits' => 'Credits', + 'credits_content' => 'Some design elements come from <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> although FreshRSS doesn’t use this framework. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">Icons</a> come from <a href="https://www.gnome.org/">GNOME project</a>. <em>Open Sans</em> font police has been created by <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a>. FreshRSS is based on <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, a PHP framework.', + 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> or <a href="http://projet.idleman.fr/leed/">Leed</a>. It is light and easy to take in hand while being powerful and configurable tool.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">on Github</a>', + 'license' => 'License', + 'project_website' => 'Project website', + 'title' => 'About', + 'version' => 'Version', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'You may add some feeds.', + 'empty' => 'There is no article to show.', + 'rss_of' => 'RSS feed of %s', + 'title' => 'Your RSS feeds', + 'title_global' => 'Global view', + 'title_fav' => 'Your favourites', + ), + 'log' => array( + '_' => 'Logs', + 'clear' => 'Clear the logs', + 'empty' => 'Log file is empty', + 'title' => 'Logs', + ), + 'menu' => array( + 'about' => 'About FreshRSS', + 'add_query' => 'Add a query', + 'before_one_day' => 'Before one day', + 'before_one_week' => 'Before one week', + 'favorites' => 'Favourites (%s)', + 'global_view' => 'Global view', + 'main_stream' => 'Main stream', + 'mark_all_read' => 'Mark all as read', + 'mark_cat_read' => 'Mark category as read', + 'mark_feed_read' => 'Mark feed as read', + 'newer_first' => 'Newer first', + 'non-starred' => 'Show all but favorites', + 'normal_view' => 'Normal view', + 'older_first' => 'Oldest first', + 'queries' => 'User queries', + 'read' => 'Show only read', + 'reader_view' => 'Reading view', + 'rss_view' => 'RSS feed', + 'search_short' => 'Search', + 'starred' => 'Show only favorites', + 'stats' => 'Statistics', + 'subscription' => 'Subscriptions management', + 'unread' => 'Show only unread', + ), + 'share' => 'Share', + 'tag' => array( + 'related' => 'Related tags', + ), +); diff --git a/app/i18n/ru/install.php b/app/i18n/ru/install.php new file mode 100644 index 000000000..1dea2cd66 --- /dev/null +++ b/app/i18n/ru/install.php @@ -0,0 +1,111 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Завершить установку', + 'fix_errors_before' => 'Пожалуйста, исправьте ошибки прежде чем переходить к следующему этапу.', + 'keep_install' => 'Сохранить предыдущую установку', + 'next_step' => 'Перейти к следующему этапу', + 'reinstall' => 'Переустановить FreshRSS', + ), + 'auth' => array( + 'form' => 'Вэб-форма (традиционный, необходим JavaScript)', + 'http' => 'HTTP (для продвинутых пользователей с HTTPS)', + 'none' => 'Никакого (опасно)', + 'password_form' => 'Пароль<br /><small>(для метода аутентификации на Вэб-формах)</small>', + 'password_format' => 'Как минимум 7 букв', + 'type' => 'Метод аутентификации', + ), + 'bdd' => array( + '_' => 'База данных', + 'conf' => array( + '_' => 'Конфигурация базы данныхDatabase configuration', + 'ko' => 'Проверьте конфигурацию базы данных.', + 'ok' => 'Конфигурация базы данных сохранена.', + ), + 'host' => 'Хост', + 'prefix' => 'Префикс таблицы', + 'password' => 'Пароль базы данных', + 'type' => 'Тип базы данных', + 'username' => 'Имя пользователя базы данных', + ), + 'check' => array( + '_' => 'Проверки', + 'already_installed' => 'Обнаружена предыдущая установка FreshRSS!', + 'cache' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/cache</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку кэша в порядке.', + ), + 'ctype' => array( + 'nok' => 'У вас не установлена необходимая библиотека для проверки типов символов (php-ctype).', + 'ok' => 'У вас установлена необходимая библиотека для проверки типов символов (ctype).', + ), + 'curl' => array( + 'nok' => 'У вас нет расширения cURL (пакет php-curl).', + 'ok' => 'У вас установлено расширение cURL.', + ), + 'data' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на <em>./data/</em> в порядке.', + ), + 'dom' => array( + 'nok' => 'У вас не установлена необходимая библиотека для просмотра DOM (пакет php-xml).', + 'ok' => 'У вас установлена необходимая библиотека для просмотра DOM.', + ), + 'favicons' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/favicons</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку значков в порядке.', + ), + 'fileinfo' => array( + 'nok' => 'У вас нет расширения PHP fileinfo (пакет fileinfo).', + 'ok' => 'У вас установлено расширение fileinfo.', + ), + 'http_referer' => array( + 'nok' => 'Убедитесь, что вы не изменяете ваш HTTP REFERER.', + 'ok' => 'Ваш HTTP REFERER известен и соотвествует вашему серверу.', + ), + 'minz' => array( + 'nok' => 'У вас не установлен фрейворк Minz.', + 'ok' => 'У вас установлен фрейворк Minz.', + ), + 'pcre' => array( + 'nok' => 'У вас не установлена необходимая библиотека для работы с регулярными выражениями (php-pcre).', + 'ok' => 'У вас установлена необходимая библиотека для работы с регулярными выражениями (PCRE).', + ), + 'pdo' => array( + 'nok' => 'У вас не установлен PDO или один из необходимых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'У вас установлен PDO и как минимум один из поддерживаемых драйверов (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'У вас установлен PHP версии %s, но FreshRSS необходима версия не ниже %s.', + 'ok' => 'У вас установлен PHP версии %s, который совместим с FreshRSS.', + ), + 'users' => array( + 'nok' => 'Проверьте права доступа к папке <em>./data/users</em> . Сервер HTTP должен иметь права на запись в эту папку.', + 'ok' => 'Права на папку users в порядке.', + ), + ), + 'conf' => array( + '_' => 'Общие настройки', + 'ok' => 'Общие настройки были сохранены.', + ), + 'congratulations' => 'Поздравляем!', + 'default_user' => 'Имя пользователя по умолчанию <small>(максимум 16 латинских букв и/или цифр)</small>', + 'delete_articles_after' => 'Удалять статьи после', + 'fix_errors_before' => 'Пожалуйста, исправьте ошибки прежде чем переходить к следующему этапу..', + 'javascript_is_better' => 'FreshRSS принесёт больше удовольствия, если включить JavaScript', + 'js' => array( + 'confirm_reinstall' => 'Переустанавливая FreshRSS, вы потеряете предыдущую конфигурацию. Вы хотите продолжить?', + ), + 'language' => array( + '_' => 'Язык', + 'choose' => 'Выберите язык для FreshRSS', + 'defined' => 'Язык выбран.', + ), + 'not_deleted' => 'Что-то пошло не так; удалите файл <em>%s</em> вручную.', + 'ok' => 'Установка успешна.', + 'step' => '%d этап', + 'steps' => 'Этапы', + 'title' => 'Установка · FreshRSS', + 'this_is_the_end' => 'Это конец', +); diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php new file mode 100644 index 000000000..789433ee6 --- /dev/null +++ b/app/i18n/ru/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Category', + 'add' => 'Add a category', + 'empty' => 'Empty category', + 'new' => 'New category', + ), + 'feed' => array( + 'add' => 'Add a RSS feed', + 'advanced' => 'Advanced', + 'archiving' => 'Archivage', + 'auth' => array( + 'configuration' => 'Login', + 'help' => 'Connection allows to access HTTP protected RSS feeds', + 'http' => 'HTTP Authentication', + 'password' => 'HTTP password', + 'username' => 'HTTP username', + ), + 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', + 'css_path' => 'Articles CSS path on original website', + 'description' => 'Description', + 'empty' => 'This feed is empty. Please verify that it is still maintained.', + 'error' => 'This feed has encountered a problem. Please verify that it is always reachable then actualize it.', + 'in_main_stream' => 'Show in main stream', + 'informations' => 'Information', + 'keep_history' => 'Minimum number of articles to keep', + 'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under <em>%s</em>.', + 'no_selected' => 'No feed selected.', + 'number_entries' => '%d articles', + 'stats' => 'Statistics', + 'think_to_add' => 'You may add some feeds.', + 'title' => 'Title', + 'title_add' => 'Add a RSS feed', + 'ttl' => 'Do not automatically refresh more often than', + 'url' => 'Feed URL', + 'validator' => 'Check the validity of the feed', + 'website' => 'Website URL', + 'pubsubhubbub' => 'Instant notification with PubSubHubbub', + ), + 'import_export' => array( + 'export' => 'Export', + 'export_opml' => 'Export list of feeds (OPML)', + 'export_starred' => 'Export your favourites', + 'feed_list' => 'List of %s articles', + 'file_to_import' => 'File to import<br />(OPML, JSON or ZIP)', + 'file_to_import_no_zip' => 'File to import<br />(OPML or JSON)', + 'import' => 'Import', + 'starred_list' => 'List of favourite articles', + 'title' => 'Import / export', + ), + 'menu' => array( + 'bookmark' => 'Subscribe (FreshRSS bookmark)', + 'import_export' => 'Import / export', + 'subscription_management' => 'Subscriptions management', + ), + 'title' => array( + '_' => 'Subscriptions management', + 'feed_management' => 'RSS feeds management', + ), +); diff --git a/app/i18n/tr/admin.php b/app/i18n/tr/admin.php new file mode 100644 index 000000000..9d10ef9dd --- /dev/null +++ b/app/i18n/tr/admin.php @@ -0,0 +1,181 @@ +<?php + +return array( + 'auth' => array( + 'allow_anonymous' => 'Öntanımlı kullanıcının makalelerinin anonim okunmasına izin ver (%s)', + 'allow_anonymous_refresh' => 'Anonim makale yenilemesine izin ver', + 'api_enabled' => '<abbr>API</abbr> erişimine izin ver <small>(mobil uygulamalar için gerekli)</small>', + 'form' => 'Web formu (geleneksel, JavaScript gerektirir)', + 'http' => 'HTTP (ileri kullanıcılar için, HTTPS)', + 'none' => 'Hiçbiri (tehlikeli)', + 'title' => 'Kimlik doğrulama', + 'title_reset' => 'Kimlik doğrulama sıfırla', + 'token' => 'Kimlik doğrulama işareti', + 'token_help' => 'Kimlik doğrulama olmaksızın öntanımlı kullanıcının RSS çıktısına erişime izin ver:', + 'type' => 'Kimlik doğrulama yöntemi', + 'unsafe_autologin' => 'Güvensiz otomatik girişe izin ver: ', + ), + 'check_install' => array( + 'cache' => array( + 'nok' => '<em>./data/cache</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Önbellek klasörü yetkileri sorunsuz.', + ), + 'categories' => array( + 'nok' => 'Kategori tablosu kötü yapılandırılmış.', + 'ok' => 'Kategori tablosu sorunsuz.', + ), + 'connection' => array( + 'nok' => 'Veritabanı ile bağlantı kurulamıyor.', + 'ok' => 'Veritabanı ile bağlantı sorunsuz.', + ), + 'ctype' => array( + 'nok' => 'Karakter yazım kontrolü için kütüphane eksik (php-ctype).', + 'ok' => 'Karakter yazım kontrolü için kütüphane sorunsuz (ctype).', + ), + 'curl' => array( + 'nok' => 'cURL eksik (php-curl package).', + 'ok' => 'cURL eklentisi sorunsuz.', + ), + 'data' => array( + 'nok' => '<em>./data</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Veri klasörü yetkileri sorunsuz.', + ), + 'database' => 'Veritabanı kurulumu', + 'dom' => array( + 'nok' => 'DOM kütüpbanesi eksik (php-xml package).', + 'ok' => 'DOM kütüphanesi sorunsuz.', + ), + 'entries' => array( + 'nok' => 'Giriş tablosu kötü yapılandırılmış.', + 'ok' => 'Giriş tablosu sorunsuz.', + ), + 'favicons' => array( + 'nok' => '<em>./data/favicons</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Site ikonu klasörü yetkileri sorunsuz.', + ), + 'feeds' => array( + 'nok' => 'Akış tablosu kötü yapılandırılmış.', + 'ok' => 'Akış tablosu sorunsuz.', + ), + 'fileinfo' => array( + 'nok' => 'PHP fileinfo eksik (fileinfo package).', + 'ok' => 'fileinfo eklentisi sorunsuz.', + ), + 'files' => 'Dosya kurulumu', + 'json' => array( + 'nok' => 'JSON eklentisi eksik (php5-json package).', + 'ok' => 'JSON eklentisi sorunsuz.', + ), + 'minz' => array( + 'nok' => 'Minz framework eksik.', + 'ok' => 'Minz framework sorunsuz.', + ), + 'pcre' => array( + 'nok' => 'Düzenli ifadeler kütüphanesi eksik (php-pcre).', + 'ok' => 'Düzenli ifadeler kütüphanesi sorunsuz (PCRE).', + ), + 'pdo' => array( + 'nok' => 'PDO veya PDO destekli bir sürücü eksik (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO sorunsuz (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + '_' => 'PHP kurulumu', + 'nok' => 'PHP versiyonunuz %s fakat FreshRSS için gerekli olan en düşük sürüm %s.', + 'ok' => 'PHP versiyonunuz %s, FreshRSS ile tam uyumlu.', + ), + 'tables' => array( + 'nok' => 'Veritabanında bir veya daha fazla tablo eksik.', + 'ok' => 'Veritabanı tabloları sorunsuz.', + ), + 'title' => 'Kurulum kontrolü', + 'tokens' => array( + 'nok' => '<em>./data/tokens</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'İşaretler klasörü yetkileri sorunsuz..', + ), + 'users' => array( + 'nok' => '<em>./data/users</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Kullanıcılar klasörü yetkileri sorunsuz.', + ), + 'zip' => array( + 'nok' => 'ZIP eklentisi eksik (php-zip package).', + 'ok' => 'ZIP eklentisi sorunsuz.', + ), + ), + 'extensions' => array( + 'disabled' => 'Pasif', + 'empty_list' => 'Yüklenmiş eklenti bulunmamaktadır', + 'enabled' => 'Aktif', + 'no_configure_view' => 'Bu eklenti yapılandırılamaz.', + 'system' => array( + '_' => 'Sistem eklentileri', + 'no_rights' => 'Sistem eklentileri (düzenleme hakkınız yok)', + ), + 'title' => 'Eklentiler', + 'user' => 'Kullanıcı eklentileri', + ), + 'stats' => array( + '_' => 'İstatistikler', + 'all_feeds' => 'Tüm akış', + 'category' => 'Kategori', + 'entry_count' => 'Makale sayısı', + 'entry_per_category' => 'Kategori başı makale sayısı', + 'entry_per_day' => 'Günlük makale sayısı (last 30 days)', + 'entry_per_day_of_week' => 'Haftanın günü (ortalama: %.2f makale)', + 'entry_per_hour' => 'Saatlik (ortalama: %.2f makale)', + 'entry_per_month' => 'Aylık (average: %.2f makale)', + 'entry_repartition' => 'Giriş dağılımı', + 'feed' => 'Akış', + 'feed_per_category' => 'Kategoriye göre akışlar', + 'idle' => 'Boştaki akışlar', + 'main' => 'Ana istatistikler', + 'main_stream' => 'Ana akış', + 'menu' => array( + 'idle' => 'Boştaki akışlar', + 'main' => 'Ana istatistikler', + 'repartition' => 'Makale dağılımı', + ), + 'no_idle' => 'Boşta akış yok!', + 'number_entries' => '%d makale', + 'percent_of_total' => '%% toplamın yüzdesi', + 'repartition' => 'Makale dağılımı', + 'status_favorites' => 'Favoriler', + 'status_read' => 'Okunmuş', + 'status_total' => 'Toplam', + 'status_unread' => 'Okunmamış', + 'title' => 'İstatistikler', + 'top_feed' => 'İlk 10 akış', + ), + 'system' => array( + '_' => 'Sistem yapılandırması', + 'auto-update-url' => 'Otomatik güncelleme sunucu URL', + 'instance-name' => 'Örnek isim', + 'max-categories' => 'Kullanıcı başına kategori limiti', + 'max-feeds' => 'Kullanıcı başına akış limiti', + 'registration' => array( + 'help' => '0 sınır yok anlamındadır', + 'number' => 'En fazla hesap sayısı', + ), + ), + 'update' => array( + '_' => 'Sistem güncelleme', + 'apply' => 'Uygula', + 'check' => 'Güncelleme kontrolü', + 'current_version' => 'Mevcut FreshRSS sürümünüz %s.', + 'last' => 'Son kontrol: %s', + 'none' => 'Yeni güncelleme yok', + 'title' => 'Sistem güncelleme', + ), + 'user' => array( + 'articles_and_size' => '%s makale (%s)', + 'create' => 'Yeni kullanıcı oluştur', + 'language' => 'Dil', + 'number' => 'Oluşturulmuş %d hesap var', + 'numbers' => 'Oluşturulmuş %d hesap var', + 'password_form' => 'Şifre<br /><small>(Tarayıcı girişi için)</small>', + 'password_format' => 'En az 7 karakter', + 'title' => 'Kullanıcıları yönet', + 'user_list' => 'Kullanıcı listesi', + 'username' => 'Kullanıcı adı', + 'users' => 'Kullanıcılar', + ), +); diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.php new file mode 100644 index 000000000..2fdc248e4 --- /dev/null +++ b/app/i18n/tr/conf.php @@ -0,0 +1,173 @@ +<?php + +return array( + 'archiving' => array( + '_' => 'Arşiv', + 'advanced' => 'Gelişmiş', + 'delete_after' => 'Makelelerin tutulacağı süre', + 'help' => 'Akış ayarlarında daha çok ayar bulabilirsiniz', + 'keep_history_by_feed' => 'Akışta en az tutulacak makale sayısı', + 'optimize' => 'Veritabanı optimize et', + 'optimize_help' => 'Bu işlem bazen veritabanı boyutunu düşürmeye yardımcı olur', + 'purge_now' => 'Şimdi temizle', + 'title' => 'Arşiv', + 'ttl' => 'Şu süreden sık otomatik yenileme yapma', + ), + 'display' => array( + '_' => 'Görünüm', + 'icon' => array( + 'bottom_line' => 'Alt çizgi', + 'entry' => 'Makale ikonları', + 'publication_date' => 'Yayınlama Tarihi', + 'related_tags' => 'İlgili etiketler', + 'sharing' => 'Paylaşım', + 'top_line' => 'Üst çizgi', + ), + 'language' => 'Dil', + 'notif_html5' => array( + 'seconds' => 'saniye (0 zaman aşımı yok demektir)', + 'timeout' => 'HTML5 bildirim zaman aşımı', + ), + 'theme' => 'Tema', + 'title' => 'Görünüm', + 'width' => array( + 'content' => 'İçerik genişliği', + 'large' => 'Geniş', + 'medium' => 'Orta', + 'no_limit' => 'Sınırsız', + 'thin' => 'Zayıf', + ), + ), + 'query' => array( + '_' => 'Kullanıcı sorguları', + 'deprecated' => 'Bu sorgu artık geçerli değil. İlgili akış veya kategori silinmiş.', + 'filter' => 'Filtre uygulandı:', + 'get_all' => 'Tüm makaleleri göster', + 'get_category' => '"%s" kategorisini göster', + 'get_favorite' => 'Favori makaleleri göster', + 'get_feed' => '"%s" akışını göster', + 'no_filter' => 'Filtre yok', + 'none' => 'Henüz hiç kullanıcı sorgusu oluşturmadınız.', + 'number' => 'Sorgu n°%d', + 'order_asc' => 'Önce eski makaleleri göster', + 'order_desc' => 'Önce yeni makaleleri göster', + 'search' => '"%s" için arama', + 'state_0' => 'Tüm makaleleri göster', + 'state_1' => 'Okunmuş makaleleri göster', + 'state_2' => 'Okunmamış makaleleri göster', + 'state_3' => 'Tüm makaleleri göster', + 'state_4' => 'Favori makaleleri göster', + 'state_5' => 'Okunmuş favori makaleleri göster', + 'state_6' => 'Okunmamış favori makaleleri göster', + 'state_7' => 'Favori makaleleri göster', + 'state_8' => 'Favori olmayan makaleleri göster', + 'state_9' => 'Favori olmayan okunmuş makaleleri göster', + 'state_10' => 'Favori olmayan okunmamış makaleleri göster', + 'state_11' => 'Favori olmayan makaleleri göster', + 'state_12' => 'Tüm makaleleri göster', + 'state_13' => 'Okunmuş makaleleri göster', + 'state_14' => 'Okunmamış makaleleri göster', + 'state_15' => 'Tüm makaleleri göster', + 'title' => 'Kullanıcı sorguları', + ), + 'profile' => array( + '_' => 'Profil yönetimi', + 'delete' => array( + '_' => 'Hesap silme', + 'warn' => 'Hesabınız ve tüm verileriniz silinecek.', + ), + 'password_api' => 'API Şifresi<br /><small>(ör. mobil uygulamalar için)</small>', + 'password_form' => 'Şifre<br /><small>(Tarayıcı girişi için)</small>', + 'password_format' => 'En az 7 karakter', + 'title' => 'Profil', + ), + 'reading' => array( + '_' => 'Okuma', + 'after_onread' => '"Hepsini okundu say" dedinten sonra,', + 'articles_per_page' => 'Sayfa başına makale sayısı', + 'auto_load_more' => 'Sayfa sonunda yeni makaleleri yükle', + 'auto_remove_article' => 'Okuduktan sonra makaleleri gizle', + 'mark_updated_article_unread' => 'Güncellenen makaleleri okundu olarak işaretle', + 'confirm_enabled' => '"Hepsini okundu say" eylemi için onay iste', + 'display_articles_unfolded' => 'Show articles unfolded by default', + 'display_categories_unfolded' => 'Show categories folded by default', + 'hide_read_feeds' => 'Okunmamış makalesi olmayan kategori veya akışı gizle ("Tüm makaleleri göster" komutunda çalışmaz)', + 'img_with_lazyload' => 'Resimleri yüklemek için "tembel modu" kullan', + 'jump_next' => 'Bir sonraki benzer okunmamışa geç (akış veya kategori)', + 'number_divided_when_reader' => 'Okuma modunda ikiye bölünecek.', + 'read' => array( + 'article_open_on_website' => 'orijinal makale sitesi açıldığında', + 'article_viewed' => 'makale görüntülendiğinde', + 'scroll' => 'kaydırma yapılırken', + 'upon_reception' => 'makale üzerinde gelince', + 'when' => 'Makaleyi okundu olarak işaretle…', + ), + 'show' => array( + '_' => 'Gösterilecek makaleler', + 'adaptive' => 'Ayarlanmış gösterim', + 'all_articles' => 'Tüm makaleleri göster', + 'unread' => 'Sadece okunmamış makaleleri göster', + ), + 'sort' => array( + '_' => 'Sıralama', + 'newer_first' => 'Önce yeniler', + 'older_first' => 'Önce eskiler', + ), + 'sticky_post' => 'Makale açıldığında yukarı getir', + 'title' => 'Okuma', + 'view' => array( + 'default' => 'Öntanımlı görünüm', + 'global' => 'Global görünüm', + 'normal' => 'Normal görünüm', + 'reader' => 'Okuma görünümü', + ), + ), + 'sharing' => array( + '_' => 'Paylaşım', + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'more_information' => 'Daha fazla bilgi', + 'print' => 'Yazdır', + 'shaarli' => 'Shaarli', + 'share_name' => 'Paylaşım ismi', + 'share_url' => 'Paylaşım URL si', + 'title' => 'Paylaşım', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), + 'shortcut' => array( + '_' => 'Kısayollar', + 'article_action' => 'Makale eylemleri', + 'auto_share' => 'Paylaş', + 'auto_share_help' => 'Sadece 1 paylaşım modu varsa bu kullanılır. Yoksa kendi paylaşım numaraları ile kullanılır.', + 'close_dropdown' => 'Menüleri kapat', + 'collapse_article' => 'Kapat', + 'first_article' => 'İlk makaleyi atla', + 'focus_search' => 'Arama kutusuna eriş', + 'help' => 'Dokümantasyonu göster', + 'javascript' => 'Kısayolları kullanabilmek için JavaScript aktif olmalıdır', + 'last_article' => 'Son makaleyi atla', + 'load_more' => 'Daha fazla makale yükle', + 'mark_read' => 'Okundu olarak işaretle', + 'mark_favorite' => 'Favori olarak işaretle', + 'navigation' => 'Genel eylemler', + 'navigation_help' => '"Shift" tuşu ile kısayollar akışlar için geçerli olur.<br/>"Alt" tuşu ile kısayollar kategoriler için geçerli olur.', + 'next_article' => 'Sonraki makaleye geç', + 'other_action' => 'Diğer eylemler', + 'previous_article' => 'Önceki makaleye geç', + 'see_on_website' => 'Orijinal sitede göster', + 'shift_for_all_read' => '+ <code>shift</code> tuşu ile tüm makaleler okundu olarak işaretlenir', + 'title' => 'Kısayollar', + 'user_filter' => 'Kullanıcı filtrelerine eriş', + 'user_filter_help' => 'Eğer tek filtre varsa o kullanılır. Yoksa filtrelerin kendi numaralarıyla kullanılır.', + ), + 'user' => array( + 'articles_and_size' => '%s makale (%s)', + 'current' => 'Mevcut kullanıcı', + 'is_admin' => 'yöneticidir', + 'users' => 'Kullanıcılar', + ), +); diff --git a/app/i18n/tr/feedback.php b/app/i18n/tr/feedback.php new file mode 100644 index 000000000..87361ff51 --- /dev/null +++ b/app/i18n/tr/feedback.php @@ -0,0 +1,109 @@ +<?php + +return array( + 'admin' => array( + 'optimization_complete' => 'Optimizasyon tamamlandı', + ), + 'access' => array( + 'denied' => 'Bu sayfaya erişim yetkiniz yok', + 'not_found' => 'Varolmayan bir sayfa arıyorsunuz', + ), + 'auth' => array( + 'form' => array( + 'not_set' => 'Sistem yapılandırma kimlik doğrulaması sırasında hata oldu. Lütfen daha sonra tekrar deneyin.', + 'set' => 'Kimlik doğrulama sistemi tamamnaldı.', + ), + 'login' => array( + 'invalid' => 'Giriş geçersiz', + 'success' => 'Bağlantı kuruldu', + ), + 'logout' => array( + 'success' => 'Bağlantı koptu', + ), + 'no_password_set' => 'Yönetici şifresi ayarlanmadı. Bu özellik kullanıma uygun değil.', + ), + 'conf' => array( + 'error' => 'Yapılandırma ayarları kaydedilirken hata oluştu', + 'query_created' => 'Sorgu "%s" oluşturuldu.', + 'shortcuts_updated' => 'Kısayollar yenilendi', + 'updated' => 'Yapılandırm ayarları yenilendi', + ), + 'extensions' => array( + 'already_enabled' => '%s zaten aktif', + 'disable' => array( + 'ko' => '%s gösterilemiyor. Detaylar için <a href="%s">FressRSS log kayıtlarını</a> kontrol edin.', + 'ok' => '%s pasif', + ), + 'enable' => array( + 'ko' => '%s aktifleştirilemiyor. Detaylar için <a href="%s">FressRSS log kayıtlarını</a> kontrol edin.', + 'ok' => '%s aktif', + ), + 'no_access' => '%s de yetkiniz yok', + 'not_enabled' => '%s henüz aktif değil', + 'not_found' => '%s bulunmamaktadır', + ), + 'import_export' => array( + 'export_no_zip_extension' => 'ZIP eklentisi mevcut sunucunuzda yer almıyor. Lütfen başka dosya formatında dışarı aktarmayı deneyin.', + 'feeds_imported' => 'Akışlarınız içe aktarıldı ve şimdi güncellenecek', + 'feeds_imported_with_errors' => 'Akışlarınız içeri aktarıldı ama bazı hatalar meydana geldi', + 'file_cannot_be_uploaded' => 'Dosya yüklenemedi!', + 'no_zip_extension' => 'ZIP eklentisi mevcut sunucunuzda yer almıyor.', + 'zip_error' => 'ZIP içe aktarımı sırasında hata meydana geldi.', + ), + 'sub' => array( + 'actualize' => 'Güncelleme', + 'category' => array( + 'created' => 'Kategori %s oluşturuldu.', + 'deleted' => 'Kategori silindi.', + 'emptied' => 'Kategori boşaltıldı', + 'error' => 'Kategori güncellenemedi', + 'name_exists' => 'Kategori ismi zaten bulunmakta.', + 'no_id' => 'Kategori id sinden emin olmalısınız.', + 'no_name' => 'Kategori ismi boş olamaz.', + 'not_delete_default' => 'Öntanımlı kategoriyi silemezsiniz!', + 'not_exist' => 'Kategori bulunmamakta!', + 'over_max' => 'Kategori limitini aştınız (%d)', + 'updated' => 'Karegori güncellendi.', + ), + 'feed' => array( + 'actualized' => '<em>%s</em> güncellendi', + 'actualizeds' => 'RSS akışları güncellendi', + 'added' => '<em>%s</em> RSS akışı eklendi', + 'already_subscribed' => '<em>%s</em> için zaten aboneliğiniz bulunmakta', + 'deleted' => 'Akış silindi', + 'error' => 'Akış güncellenemiyor', + 'internal_problem' => 'RSS akışı eklenemiyor. Detaylar için <a href="%s">FressRSS log kayıtlarını</a> kontrol edin.', + 'invalid_url' => 'URL <em>%s</em> geçersiz', + 'marked_read' => 'Akışlar okundu olarak işaretlendi', + 'n_actualized' => '%d akışları güncellendi', + 'n_entries_deleted' => '%d makaleleri silindi', + 'no_refresh' => 'Yenilenecek akış yok…', + 'not_added' => '<em>%s</em> eklenemedi', + 'over_max' => 'Akış limitini aştınız (%d)', + 'updated' => 'Akış güncellendi', + ), + 'purge_completed' => 'Temizleme tamamlandı (%d makale silindi)', + ), + 'update' => array( + 'can_apply' => 'FreshRSS <strong>%s versiyonuna</strong> güncellenecek.', + 'error' => 'Güncelleme işlemi sırasında hata: %s', + 'file_is_nok' => '<em>%s</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'finished' => 'Güncelleme tamamlandı!', + 'none' => 'Güncelleme yok', + 'server_not_found' => 'Güncelleme sunucusu bulunamadı. [%s]', + ), + 'user' => array( + 'created' => array( + '_' => '%s kullanıcısı oluşturuldu', + 'error' => '%s kullanıcısı oluşturulamadı', + ), + 'deleted' => array( + '_' => '%s kullanıcısı silindi', + 'error' => '%s kullanıcısı silinemedi', + ), + ), + 'profile' => array( + 'error' => 'Profiliniz düzenlenemedi', + 'updated' => 'Profiliniz düzenlendi', + ), +); diff --git a/app/i18n/tr/gen.php b/app/i18n/tr/gen.php new file mode 100644 index 000000000..bcc839daf --- /dev/null +++ b/app/i18n/tr/gen.php @@ -0,0 +1,182 @@ +<?php + +return array( + 'action' => array( + 'actualize' => 'Yenile', + 'back_to_rss_feeds' => '← RSS akışlarınız için geri gidin', + 'cancel' => 'İptal', + 'create' => 'Oluştur', + 'disable' => 'Pasif', + 'empty' => 'Boş', + 'enable' => 'Aktif', + 'export' => 'Dışa Aktar', + 'filter' => 'Filtrele', + 'import' => 'İçe Aktar', + 'manage' => 'Yönet', + 'mark_read' => 'Okundu olarak işaretle', + 'mark_favorite' => 'Favoriye ekle', + 'remove' => 'Sil', + 'see_website' => 'Siteyi gör', + 'submit' => 'Onayla', + 'truncate' => 'Tüm makaleleri sil', + ), + 'auth' => array( + 'email' => 'Email adresleri', + 'keep_logged_in' => '<small>(%s günler)</small> oturumu açık tut', + 'login' => 'Giriş', + 'logout' => 'Çıkış', + 'password' => array( + '_' => 'Şifre', + 'format' => '<small>En az 7 karakter</small>', + ), + 'registration' => array( + '_' => 'Yeni hesap', + 'ask' => 'Yeni bir hesap oluştur', + 'title' => 'Hesap oluşturma', + ), + 'reset' => 'Kimlik doğrulama sıfırla', + 'username' => array( + '_' => 'Kullancı adı', + 'admin' => 'Yönetici kullanıcı adı', + 'format' => '<small>en fazla 16 alfanümerik karakter</small>', + ), + ), + 'date' => array( + 'Apr' => '\\N\\i\\s\\a\\n', + 'Aug' => '\\A\\ğ\\u\\s\\t\\o\\s', + 'Dec' => '\\A\\r\\a\\l\\ı\\k', + 'Feb' => '\\Ş\\u\\b\\a\\t', + 'Jan' => '\\O\\c\\a\\k', + 'Jul' => '\\T\\e\\m\\m\\u\\z', + 'Jun' => '\\H\\a\\z\\i\\r\\a\\n', + 'Mar' => '\\M\\a\\r\\t', + 'May' => '\\M\\a\\y\\ı\\s', + 'Nov' => '\\K\\a\\s\\ı\\m', + 'Oct' => '\\E\\k\\i\\m', + 'Sep' => '\\E\\y\\l\\ü\\l', + 'apr' => 'nis', + 'april' => 'Nis', + 'aug' => 'ağu', + 'august' => 'Ağu', + 'before_yesterday' => 'Dünden önceki gün', + 'dec' => 'ara', + 'december' => 'Ara', + 'feb' => 'şub', + 'february' => 'Şub', + 'format_date' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y', + 'format_date_hour' => '%s j\\<\\s\\u\\p\\>S\\<\\/\\s\\u\\p\\> Y \\a\\t H\\:i', + 'fri' => 'Cum', + 'jan' => 'oca', + 'january' => 'Oca', + 'jul' => 'tem', + 'july' => 'Tem', + 'jun' => 'haz', + 'june' => 'Haz', + 'last_3_month' => 'Son 3 ay', + 'last_6_month' => 'Son 6 ay', + 'last_month' => 'Geçen ay', + 'last_week' => 'Geçen hafta', + 'last_year' => 'Geçen yıl', + 'mar' => 'mar', + 'march' => 'Mar', + 'may' => 'May', + 'mon' => 'Pzt', + 'month' => 'ay', + 'nov' => 'kas', + 'november' => 'Kas', + 'oct' => 'ekm', + 'october' => 'Ekm', + 'sat' => 'Cts', + 'sep' => 'eyl', + 'september' => 'Eyl', + 'sun' => 'Pzr', + 'thu' => 'Per', + 'today' => 'Bugün', + 'tue' => 'Sal', + 'wed' => 'Çar', + 'yesterday' => 'Dün', + ), + 'freshrss' => array( + '_' => 'FreshRSS', + 'about' => 'FreshRSS hakkında', + ), + 'js' => array( + 'category_empty' => 'Boş kategori', + 'confirm_action' => 'Bunu yapmak istediğinize emin misiniz ? Daha sonra iptal edilemez!', + 'confirm_action_feed_cat' => 'Bunu yapmak istediğinize emin misiniz ? Favorileriniz ve sorgularınız silinecek. Daha sonra iptal edilemez!', + 'feedback' => array( + 'body_new_articles' => 'FreshRSS de okunmaz üzere %%d yeni makale var.', + 'request_failed' => 'Hata. İnternet bağlantınızı kontrol edin.', + 'title_new_articles' => 'FreshRSS: yeni makaleler!', + ), + 'new_article' => 'Yeni makaleler mevcut. Sayfayı yenilemek için tıklayın.', + 'should_be_activated' => 'JavaScript aktif olmalıdır.', + ), + 'lang' => array( + 'cz' => 'Čeština', + 'de' => 'Deutsch', + 'en' => 'English', + 'fr' => 'Français', + 'it' => 'Italiano', + 'nl' => 'Nederlands', + 'ru' => 'Русский', + 'tr' => 'Türkçe', + ), + 'menu' => array( + 'about' => 'Hakkında', + 'admin' => 'Yönetim', + 'archiving' => 'Arşiv', + 'authentication' => 'Kimlik doğrulama', + 'check_install' => 'Kurulum kontrolü', + 'configuration' => 'Yapılandırma', + 'display' => 'Görünüm', + 'extensions' => 'Eklentiler', + 'logs' => 'Log kayıtları', + 'queries' => 'Kullanıcı sorguları', + 'reading' => 'Okuma', + 'search' => 'Kelime veya #etiket ara', + 'sharing' => 'Paylaşım', + 'shortcuts' => 'Kısayollar', + 'stats' => 'İstatistikler', + 'system' => 'Sistem yapılandırması', + 'update' => 'Güncelleme', + 'user_management' => 'Kullanıcıları yönet', + 'user_profile' => 'Profil', + ), + 'pagination' => array( + 'first' => 'İlk', + 'last' => 'Son', + 'load_more' => 'Daha fazla makale yükle', + 'mark_all_read' => 'Tümünü okundu say', + 'next' => 'Sonraki', + 'nothing_to_load' => 'Başka makale yok', + 'previous' => 'Önceki', + ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'movim' => 'Movim', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag v1', + 'wallabagv2' => 'wallabag v2', + 'jdh' => 'Journal du hacker', + ), + 'short' => array( + 'attention' => 'Tehlike!', + 'blank_to_disable' => 'Devredışı bırakmak için boş bırakın', + 'by_author' => '<em>%s</em> tarafından', + 'by_default' => 'Öntanımlı', + 'damn' => 'Hay aksi!', + 'default_category' => 'Kategorisiz', + 'no' => 'Hayır', + 'not_applicable' => 'Uygun değil', + 'ok' => 'Tamam!', + 'or' => 'ya da', + 'yes' => 'Evet', + ), +); diff --git a/app/i18n/tr/index.php b/app/i18n/tr/index.php new file mode 100644 index 000000000..cb36d6717 --- /dev/null +++ b/app/i18n/tr/index.php @@ -0,0 +1,61 @@ +<?php + +return array( + 'about' => array( + '_' => 'Hakkında', + 'agpl3' => '<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a>', + 'bugs_reports' => 'Hata raporu', + 'credits' => 'Tanıtım', + 'credits_content' => 'Bu frameworkü kullanmamasına rağmen FreshRSS bazı tasarım ögelerini <a href="http://twitter.github.io/bootstrap/">Bootstrap</a> dan almıştır. <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">İkonlar</a> <a href="https://www.gnome.org/">GNOME projesinden</a> alınmıştır. <em>Open Sans</em> yazı tipi <a href="https://fonts.google.com/specimen/Open+Sans">Steve Matteson</a> tarafından oluşturulmuştur. FreshRSS bir PHP framework olan <a href="https://github.com/marienfressinaud/MINZ">Minz</a> i temel alır.', + 'freshrss_description' => 'FreshRSS <a href="http://tontof.net/kriss/feed/">Kriss Feed</a> veya <a href="http://projet.idleman.fr/leed/">Leed</a> gibi kendi hostunuzda çalışan bir RSS akış toplayıcısıdır. Güçlü ve yapılandırılabilir araçlarıyla basit ve kullanımı kolay bir uygulamadır.', + 'github' => '<a href="https://github.com/FreshRSS/FreshRSS/issues">Github sayfası</a>', + 'license' => 'Lisans', + 'project_website' => 'Proje sayfası', + 'title' => 'Hakkında', + 'version' => 'Versiyon', + 'website' => 'Website', + ), + 'feed' => array( + 'add' => 'Akış ekleyebilirsin.', + 'empty' => 'Gösterilecek makale yok.', + 'rss_of' => 'RSS feed of %s', + 'title' => 'RSS akışlarınız', + 'title_global' => 'Global görünüm', + 'title_fav' => 'Favorilerin', + ), + 'log' => array( + '_' => 'Log Kayıtları', + 'clear' => 'Log kayıt dosyasını temizle', + 'empty' => 'Log kayır dosyası boş', + 'title' => 'Log Kayıtları', + ), + 'menu' => array( + 'about' => 'FreshRSS hakkında', + 'add_query' => 'Sorgu ekle', + 'before_one_day' => 'Bir gün önce', + 'before_one_week' => 'Bir hafta önce', + 'favorites' => 'Favoriler (%s)', + 'global_view' => 'Global görünüm', + 'main_stream' => 'Ana akış', + 'mark_all_read' => 'Hepsini okundu olarak işaretle', + 'mark_cat_read' => 'Kategoriyi okundu olarak işaretle', + 'mark_feed_read' => 'Akışı okundu olarak işaretle', + 'newer_first' => 'Önce yeniler', + 'non-starred' => 'Favori dışındakileri göster', + 'normal_view' => 'Normal görünüm', + 'older_first' => 'Önce eskiler', + 'queries' => 'Kullanıcı sorguları', + 'read' => 'Okunmuşları göster', + 'reader_view' => 'Okuma görünümü', + 'rss_view' => 'RSS akışı', + 'search_short' => 'Ara', + 'starred' => 'Favorileri göster', + 'stats' => 'İstatistikler', + 'subscription' => 'Abonelik yönetimi', + 'unread' => 'Okunmamışları göster', + ), + 'share' => 'Share', + 'tag' => array( + 'related' => 'İlgili etiketler', + ), +); diff --git a/app/i18n/tr/install.php b/app/i18n/tr/install.php new file mode 100644 index 000000000..d5564297b --- /dev/null +++ b/app/i18n/tr/install.php @@ -0,0 +1,119 @@ +<?php + +return array( + 'action' => array( + 'finish' => 'Kurulumu tamamla', + 'fix_errors_before' => 'Lütfen sonraki adıma geçmek için hataları düzeltin.', + 'keep_install' => 'Önceki kuruluma devam et', + 'next_step' => 'Sonraki adım', + 'reinstall' => 'FreshRSS i yeniden yükle', + ), + 'auth' => array( + 'form' => 'Web formu (geleneksel, JavaScript gerektirir)', + 'http' => 'HTTP (ileri kullanıcılar için, HTTPS)', + 'none' => 'Hiçbiri (tehlikeli)', + 'password_form' => 'Şifre<br /><small>(Tarayıcı girişi için)</small>', + 'password_format' => 'En az 7 karakter', + 'type' => 'Kimlik doğrulama yöntemi', + ), + 'bdd' => array( + '_' => 'Veritabanı', + 'conf' => array( + '_' => 'Veritabanı yapılandırılması', + 'ko' => 'Veritabanı bilginizi doğrulayın.', + 'ok' => 'Veritabanı yapılandırılması kayıt edildi.', + ), + 'host' => 'Sunucu', + 'prefix' => 'Tablo ön eki', + 'password' => 'Veritabanı şifresi', + 'type' => 'Veritabanı türü', + 'username' => 'Veritabanı kullanıcı adı', + ), + 'check' => array( + '_' => 'Kontroller', + 'already_installed' => 'FreshRSS zaten yüklü!', + 'cache' => array( + 'nok' => '<em>./data/cache</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Önbellek klasörü yetkileri sorunsuz.', + ), + 'ctype' => array( + 'nok' => 'Karakter yazım kontrolü için kütüphane eksik (php-ctype).', + 'ok' => 'Karakter yazım kontrolü için kütüphane sorunsuz (ctype).', + ), + 'curl' => array( + 'nok' => 'cURL eksik (php-curl package).', + 'ok' => 'cURL eklentisi sorunsuz.', + ), + 'data' => array( + 'nok' => '<em>./data</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Veri klasörü yetkileri sorunsuz.', + ), + 'dom' => array( + 'nok' => 'DOM kütüpbanesi eksik.', + 'ok' => 'DOM kütüphanesi sorunsuz.', + ), + 'favicons' => array( + 'nok' => '<em>./data/favicons</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Site ikonu klasörü yetkileri sorunsuz.', + ), + 'fileinfo' => array( + 'nok' => 'PHP fileinfo eksik (fileinfo package).', + 'ok' => 'fileinfo eklentisi sorunsuz.', + ), + 'http_referer' => array( + 'nok' => 'Lütfen HTTP REFERER değiştirmediğinize emin olun.', + 'ok' => 'HTTP REFERER ve sunucunuz arası iletişim sorunsuz.', + ), + 'json' => array( + 'nok' => 'Tavsiye edilen JSON çözümleme kütüphanesi eksik.', + 'ok' => 'Tavsiye edilen JSON çözümleme kütüphanesi sorunsuz.', + ), + 'minz' => array( + 'nok' => 'Minz framework eksik.', + 'ok' => 'Minz framework sorunsuz.', + ), + 'pcre' => array( + 'nok' => 'Düzenli ifadeler kütüphanesi eksik (php-pcre).', + 'ok' => 'Düzenli ifadeler kütüphanesi sorunsuz (PCRE).', + ), + 'pdo' => array( + 'nok' => 'PDO veya PDO destekli bir sürücü eksik (pdo_mysql, pdo_sqlite, pdo_pgsql).', + 'ok' => 'PDO sorunsuz (pdo_mysql, pdo_sqlite, pdo_pgsql).', + ), + 'php' => array( + 'nok' => 'PHP versiyonunuz %s fakat FreshRSS için gerekli olan en düşük sürüm %s.', + 'ok' => 'PHP versiyonunuz %s, FreshRSS ile tam uyumlu.', + ), + 'users' => array( + 'nok' => '<em>./data/users</em> klasör yetkisini kontrol edin. HTTP yazma yetkisi olmalı', + 'ok' => 'Kullanıcılar klasörü yetkileri sorunsuz.', + ), + 'xml' => array( + 'nok' => 'You lack the required library to parse XML.', + 'ok' => 'You have the required library to parse XML.', + ), + ), + 'conf' => array( + '_' => 'Genel yapılandırma', + 'ok' => 'Genel yapılandırma ayarları kayıt edildi.', + ), + 'congratulations' => 'Tebrikler!', + 'default_user' => 'Öntanımlı kullanıcı adı <small>(en fazla 16 alfanümerik karakter)</small>', + 'delete_articles_after' => 'Makaleleri şu süre sonunda sil', + 'fix_errors_before' => 'Lütfen sonraki adıma geçmek için hataları düzeltin.', + 'javascript_is_better' => 'FreshRSS JavaScript ile daha işlevseldir', + 'js' => array( + 'confirm_reinstall' => 'FressRSS i yeniden kurarak önceki yapılandırma ayarlarınızı kaybedeceksiniz. Devam etmek istiyor musunuz ?', + ), + 'language' => array( + '_' => 'Dil', + 'choose' => 'FreshRSS için bir dil seçin', + 'defined' => 'Dil belirlendi.', + ), + 'not_deleted' => 'Hata meydana geldi; <em>%s</em> dosyasını elle silmelisiniz.', + 'ok' => 'Kurulum başarıyla tamamlandı.', + 'step' => 'adım %d', + 'steps' => 'Adımlar', + 'title' => 'Kurulum · FreshRSS', + 'this_is_the_end' => 'Son Adım', +); diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php new file mode 100644 index 000000000..7592096d9 --- /dev/null +++ b/app/i18n/tr/sub.php @@ -0,0 +1,62 @@ +<?php + +return array( + 'category' => array( + '_' => 'Kategori', + 'add' => 'Kategori ekle', + 'empty' => 'Boş kategori', + 'new' => 'Yeni kategori', + ), + 'feed' => array( + 'add' => 'RSS akışı ekle', + 'advanced' => 'Gelişmiş', + 'archiving' => 'Arşiv', + 'auth' => array( + 'configuration' => 'Giriş', + 'help' => 'HTTP korumalı RSS akışlarına bağlantı izni sağlar', + 'http' => 'HTTP Kimlik Doğrulama', + 'password' => 'HTTP şifre', + 'username' => 'HTTP kullanıcı adı', + ), + 'css_help' => 'Dikkat, daha çok zaman gerekir!', + 'css_path' => 'Makaleleri kendi CSS görünümü ile göster', + 'description' => 'Tanım', + 'empty' => 'Bu akış boş. Lütfen akışın aktif olduğuna emin olun.', + 'error' => 'Bu akışda bir hatayla karşılaşıldı. Lütfen akışın sürekli ulaşılabilir olduğuna emin olun.', + 'in_main_stream' => 'Ana akışda göster', + 'informations' => 'Bilgi', + 'keep_history' => 'En az tutulacak makale sayısı', + 'moved_category_deleted' => 'Bir kategoriyi silerseniz, içerisindeki akışlar <em>%s</em> içerisine yerleşir.', + 'no_selected' => 'Hiçbir akış seçilmedi.', + 'number_entries' => '%d makale', + 'stats' => 'İstatistikler', + 'think_to_add' => 'Akış ekleyebilirsiniz.', + 'title' => 'Başlık', + 'title_add' => 'RSS akışı ekle', + 'ttl' => 'Şu kadar süreden fazla otomatik yenileme yapma', + 'url' => 'Akış URL', + 'validator' => 'Akış geçerliliğini kontrol edin', + 'website' => 'Site URL', + 'pubsubhubbub' => 'PubSubHubbub ile anlık bildirim', + ), + 'import_export' => array( + 'export' => 'Dışa aktar', + 'export_opml' => 'Akış listesini dışarı aktar (OPML)', + 'export_starred' => 'Favorileri dışarı aktar', + 'feed_list' => '%s makalenin listesi', + 'file_to_import' => 'Dosyadan içe aktar<br />(OPML, JSON or ZIP)', + 'file_to_import_no_zip' => 'Dosyadan içe aktar<br />(OPML or JSON)', + 'import' => 'İçe aktar', + 'starred_list' => 'Favori makaleleirn listesi', + 'title' => 'İçe / dışa aktar', + ), + 'menu' => array( + 'bookmark' => 'Abonelik (FreshRSS yer imleri)', + 'import_export' => 'İçe / dışa aktar', + 'subscription_management' => 'Abonelik yönetimi', + ), + 'title' => array( + '_' => 'Abonelik yönetimi', + 'feed_management' => 'RSS akış yönetimi', + ), +); diff --git a/app/install.php b/app/install.php new file mode 100644 index 000000000..986a7dc60 --- /dev/null +++ b/app/install.php @@ -0,0 +1,786 @@ +<?php +if (function_exists('opcache_reset')) { + opcache_reset(); +} +header("Content-Security-Policy: default-src 'self'"); + +require(LIB_PATH . '/lib_install.php'); + +session_name('FreshRSS'); +session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true); +session_start(); + +if (isset($_GET['step'])) { + define('STEP',(int)$_GET['step']); +} else { + define('STEP', 0); +} + +if (STEP === 3 && isset($_POST['type'])) { + $_SESSION['bd_type'] = $_POST['type']; +} + +if (isset($_SESSION['bd_type'])) { + switch ($_SESSION['bd_type']) { + case 'mysql': + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); + break; + case 'sqlite': + include_once(APP_PATH . '/SQL/install.sql.sqlite.php'); + break; + case 'pgsql': + include_once(APP_PATH . '/SQL/install.sql.pgsql.php'); + break; + } +} + +function param($key, $default = false) { + if (isset($_POST[$key])) { + return $_POST[$key]; + } else { + return $default; + } +} + + +// gestion internationalisation +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']); +} + +function get_best_language() { + $accept = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + return strtolower(substr($accept, 0, 2)); +} + + +/*** SAUVEGARDES ***/ +function saveLanguage() { + if (!empty($_POST)) { + if (!isset($_POST['language'])) { + return false; + } + + $_SESSION['language'] = $_POST['language']; + + header('Location: index.php?step=1'); + } +} + +function saveStep1() { + if (isset($_POST['freshrss-keep-install']) && + $_POST['freshrss-keep-install'] === '1') { + // We want to keep our previous installation of FreshRSS + // so we need to make next steps valid by setting $_SESSION vars + // with values from the previous installation + + // First, we try to get previous configurations + Minz_Configuration::register('system', + join_path(DATA_PATH, 'config.php'), + join_path(DATA_PATH, 'config.default.php')); + $system_conf = Minz_Configuration::get('system'); + + $current_user = $system_conf->default_user; + Minz_Configuration::register('user', + join_path(USERS_PATH, $current_user, 'config.php'), + join_path(USERS_PATH, '_', 'config.default.php')); + $user_conf = Minz_Configuration::get('user'); + + // Then, we set $_SESSION vars + $_SESSION['title'] = $system_conf->title; + $_SESSION['auth_type'] = $system_conf->auth_type; + $_SESSION['old_entries'] = $user_conf->old_entries; + $_SESSION['default_user'] = $current_user; + $_SESSION['passwordHash'] = $user_conf->passwordHash; + + $db = $system_conf->db; + $_SESSION['bd_type'] = $db['type']; + $_SESSION['bd_host'] = $db['host']; + $_SESSION['bd_user'] = $db['user']; + $_SESSION['bd_password'] = $db['password']; + $_SESSION['bd_base'] = $db['base']; + $_SESSION['bd_prefix'] = $db['prefix']; + $_SESSION['bd_error'] = ''; + + header('Location: index.php?step=4'); + } +} + +function saveStep2() { + $user_default_config = Minz_Configuration::get('default_user'); + if (!empty($_POST)) { + $system_default_config = Minz_Configuration::get('default_system'); + $_SESSION['title'] = $system_default_config->title; + $_SESSION['old_entries'] = param('old_entries', $user_default_config->old_entries); + $_SESSION['auth_type'] = param('auth_type', 'form'); + $_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', param('default_user', '')), 0, 16); + + $password_plain = param('passwordPlain', false); + if ($password_plain !== false && cryptAvailable()) { + $_SESSION['passwordHash'] = FreshRSS_user_Controller::hashPassword($password_plain); + } + + if (empty($_SESSION['old_entries']) || + empty($_SESSION['auth_type']) || + empty($_SESSION['default_user'])) { + return false; + } + + if ($_SESSION['auth_type'] === 'form' && empty($_SESSION['passwordHash'])) { + return false; + } + + $_SESSION['salt'] = generateSalt(); + if ((!ctype_digit($_SESSION['old_entries'])) ||($_SESSION['old_entries'] < 1)) { + $_SESSION['old_entries'] = $user_default_config->old_entries; + } + + $token = ''; + + $config_array = array( + 'language' => $_SESSION['language'], + 'theme' => $user_default_config->theme, + 'old_entries' => $_SESSION['old_entries'], + 'passwordHash' => $_SESSION['passwordHash'], + 'token' => $token, + ); + + // Create default user files but first, we delete previous data to + // avoid access right problems. + $user_dir = join_path(USERS_PATH, $_SESSION['default_user']); + $user_config_path = join_path($user_dir, 'config.php'); + + recursive_unlink($user_dir); + mkdir($user_dir); + file_put_contents($user_config_path, "<?php\n return " . var_export($config_array, true) . ";\n"); + + header('Location: index.php?step=3'); + } +} + +function saveStep3() { + if (!empty($_POST)) { + if ($_SESSION['bd_type'] === 'sqlite') { + $_SESSION['bd_base'] = $_SESSION['default_user']; + $_SESSION['bd_host'] = ''; + $_SESSION['bd_user'] = ''; + $_SESSION['bd_password'] = ''; + $_SESSION['bd_prefix'] = ''; + $_SESSION['bd_prefix_user'] = ''; //No prefix for SQLite + } else { + if (empty($_POST['type']) || + empty($_POST['host']) || + empty($_POST['user']) || + empty($_POST['base'])) { + $_SESSION['bd_error'] = 'Missing parameters!'; + } + $_SESSION['bd_base'] = substr($_POST['base'], 0, 64); + $_SESSION['bd_host'] = $_POST['host']; + $_SESSION['bd_user'] = $_POST['user']; + $_SESSION['bd_password'] = $_POST['pass']; + $_SESSION['bd_prefix'] = substr($_POST['prefix'], 0, 16); + $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); + } + if ($_SESSION['bd_type'] === 'pgsql') { + $_SESSION['bd_base'] = strtolower($_SESSION['bd_base']); + } + + // We use dirname to remove the /i part + $base_url = dirname(Minz_Request::guessBaseUrl()); + $config_array = array( + 'salt' => $_SESSION['salt'], + 'base_url' => $base_url, + 'title' => $_SESSION['title'], + 'default_user' => $_SESSION['default_user'], + 'auth_type' => $_SESSION['auth_type'], + 'db' => array( + 'type' => $_SESSION['bd_type'], + 'host' => $_SESSION['bd_host'], + 'user' => $_SESSION['bd_user'], + 'password' => $_SESSION['bd_password'], + 'base' => $_SESSION['bd_base'], + 'prefix' => $_SESSION['bd_prefix'], + 'pdo_options' => array(), + ), + 'pubsubhubbub_enabled' => server_is_public($base_url), + ); + + @unlink(join_path(DATA_PATH, 'config.php')); //To avoid access-rights problems + file_put_contents(join_path(DATA_PATH, 'config.php'), "<?php\n return " . var_export($config_array, true) . ";\n"); + + $config_array['db']['default_user'] = $config_array['default_user']; + $config_array['db']['prefix_user'] = $_SESSION['bd_prefix_user']; + $ok = checkDb($config_array['db']) && checkDbUser($config_array['db']); + if (!$ok) { + @unlink(join_path(DATA_PATH, 'config.php')); + } + + if ($ok) { + $_SESSION['bd_error'] = ''; + header('Location: index.php?step=4'); + } else { + $_SESSION['bd_error'] = empty($config_array['db']['error']) ? 'Unknown error!' : $config_array['db']['error']; + } + } + invalidateHttpCache(); +} + + +/*** VÉRIFICATIONS ***/ +function checkStep() { + $s0 = checkStep0(); + $s1 = checkRequirements(); + $s2 = checkStep2(); + $s3 = checkStep3(); + if (STEP > 0 && $s0['all'] != 'ok') { + header('Location: index.php?step=0'); + } elseif (STEP > 1 && $s1['all'] != 'ok') { + header('Location: index.php?step=1'); + } elseif (STEP > 2 && $s2['all'] != 'ok') { + header('Location: index.php?step=2'); + } elseif (STEP > 3 && $s3['all'] != 'ok') { + header('Location: index.php?step=3'); + } + $_SESSION['actualize_feeds'] = true; +} + +function checkStep0() { + $languages = Minz_Translate::availableLanguages(); + $language = isset($_SESSION['language']) && + in_array($_SESSION['language'], $languages); + + return array( + 'language' => $language ? 'ok' : 'ko', + 'all' => $language ? 'ok' : 'ko' + ); +} + +function freshrss_already_installed() { + $conf_path = join_path(DATA_PATH, 'config.php'); + if (!file_exists($conf_path)) { + return false; + } + + // A configuration file already exists, we try to load it. + $system_conf = null; + try { + Minz_Configuration::register('system', $conf_path); + $system_conf = Minz_Configuration::get('system'); + } catch (Minz_FileNotExistException $e) { + return false; + } + + // ok, the global conf exists... but what about default user conf? + $current_user = $system_conf->default_user; + try { + Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php')); + } catch (Minz_FileNotExistException $e) { + return false; + } + + // ok, ok, default user exists too! + return true; +} + +function checkStep2() { + $conf = !empty($_SESSION['old_entries']) && + !empty($_SESSION['default_user']); + + $form = ( + isset($_SESSION['auth_type']) && + ($_SESSION['auth_type'] != 'form' || !empty($_SESSION['passwordHash'])) + ); + + $defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user']; + if ($defaultUser === null) { + $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user']; + } + $data = is_writable(join_path(USERS_PATH, $defaultUser, 'config.php')); + + return array( + 'conf' => $conf ? 'ok' : 'ko', + 'form' => $form ? 'ok' : 'ko', + 'data' => $data ? 'ok' : 'ko', + 'all' => $conf && $form && $data ? 'ok' : 'ko' + ); +} + +function checkStep3() { + $conf = is_writable(join_path(DATA_PATH, 'config.php')); + + $bd = isset($_SESSION['bd_type']) && + isset($_SESSION['bd_host']) && + isset($_SESSION['bd_user']) && + isset($_SESSION['bd_password']) && + isset($_SESSION['bd_base']) && + isset($_SESSION['bd_prefix']) && + isset($_SESSION['bd_error']); + $conn = empty($_SESSION['bd_error']); + + return array( + 'bd' => $bd ? 'ok' : 'ko', + 'conn' => $conn ? 'ok' : 'ko', + 'conf' => $conf ? 'ok' : 'ko', + 'all' => $bd && $conn && $conf ? 'ok' : 'ko' + ); +} + +function checkDbUser(&$dbOptions) { + $ok = false; + $str = $dbOptions['dsn']; + $driver_options = $dbOptions['options']; + try { + $c = new PDO($str, $dbOptions['user'], $dbOptions['password'], $driver_options); + + if (defined('SQL_CREATE_TABLES')) { + $sql = sprintf(SQL_CREATE_TABLES, $dbOptions['prefix_user'], _t('gen.short.default_category')); + $stm = $c->prepare($sql); + $ok = $stm->execute(); + } else { + global $SQL_CREATE_TABLES; + if (is_array($SQL_CREATE_TABLES)) { + $ok = true; + foreach ($SQL_CREATE_TABLES as $instruction) { + $sql = sprintf($instruction, $dbOptions['prefix_user'], _t('gen.short.default_category')); + $stm = $c->prepare($sql); + $ok &= $stm->execute(); + } + } + } + + if (defined('SQL_INSERT_FEEDS')) { + $sql = sprintf(SQL_INSERT_FEEDS, $dbOptions['prefix_user']); + $stm = $c->prepare($sql); + $ok &= $stm->execute(); + } else { + global $SQL_INSERT_FEEDS; + if (is_array($SQL_INSERT_FEEDS)) { + foreach ($SQL_INSERT_FEEDS as $instruction) { + $sql = sprintf($instruction, $dbOptions['prefix_user']); + $stm = $c->prepare($sql); + $ok &= $stm->execute(); + } + } + } + } catch (PDOException $e) { + $ok = false; + $dbOptions['error'] = $e->getMessage(); + } + return $ok; +} + +/*** AFFICHAGE ***/ +function printStep0() { + $actual = Minz_Translate::language(); + $languages = Minz_Translate::availableLanguages(); +?> + <?php $s0 = checkStep0(); if ($s0['all'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.language.defined'); ?></p> + <?php } ?> + + <form action="index.php?step=0" method="post"> + <legend><?php echo _t('install.language.choose'); ?></legend> + <div class="form-group"> + <label class="group-name" for="language"><?php echo _t('install.language'); ?></label> + <div class="group-controls"> + <select name="language" id="language" tabindex="1" > + <?php foreach ($languages as $lang) { ?> + <option value="<?php echo $lang; ?>"<?php echo $actual == $lang ? ' selected="selected"' : ''; ?>> + <?php echo _t('gen.lang.' . $lang); ?> + </option> + <?php } ?> + </select> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important" tabindex="2" ><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn" tabindex="3" ><?php echo _t('gen.action.cancel'); ?></button> + <?php if ($s0['all'] == 'ok') { ?> + <a class="btn btn-important next-step" href="?step=1" tabindex="4" ><?php echo _t('install.action.next_step'); ?></a> + <?php } ?> + </div> + </div> + </form> +<?php +} + +// @todo refactor this view with the check_install action +function printStep1() { + $res = checkRequirements(); +?> + <noscript><p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.attention'); ?></span> <?php echo _t('install.javascript_is_better'); ?></p></noscript> + + <?php if ($res['php'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.php.ok', PHP_VERSION); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.php.nok', PHP_VERSION, '5.3.3'); ?></p> + <?php } ?> + + <?php if ($res['minz'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.minz.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.minz.nok', join_path(LIB_PATH, 'Minz')); ?></p> + <?php } ?> + + <?php if ($res['pdo'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.pdo.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.pdo.nok'); ?></p> + <?php } ?> + + <?php if ($res['curl'] == 'ok') { ?> + <?php $version = curl_version(); ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.curl.ok', $version['version']); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.curl.nok'); ?></p> + <?php } ?> + + <?php if ($res['json'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.json.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.json.nok'); ?></p> + <?php } ?> + + <?php if ($res['pcre'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.pcre.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.pcre.nok'); ?></p> + <?php } ?> + + <?php if ($res['ctype'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.ctype.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.ctype.nok'); ?></p> + <?php } ?> + + <?php if ($res['dom'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.dom.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.dom.nok'); ?></p> + <?php } ?> + + <?php if ($res['xml'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.xml.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.xml.nok'); ?></p> + <?php } ?> + + <?php if ($res['fileinfo'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.fileinfo.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.fileinfo.nok'); ?></p> + <?php } ?> + + <?php if ($res['data'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.data.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.data.nok', DATA_PATH); ?></p> + <?php } ?> + + <?php if ($res['cache'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.cache.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.cache.nok', CACHE_PATH); ?></p> + <?php } ?> + + <?php if ($res['users'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.users.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.users.nok', USERS_PATH); ?></p> + <?php } ?> + + <?php if ($res['favicons'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.favicons.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.favicons.nok', DATA_PATH . '/favicons'); ?></p> + <?php } ?> + + <?php if ($res['http_referer'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.http_referer.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.http_referer.nok'); ?></p> + <?php } ?> + + <?php if (freshrss_already_installed() && $res['all'] == 'ok') { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.attention'); ?></span> <?php echo _t('install.check.already_installed'); ?></p> + + <form action="index.php?step=1" method="post"> + <input type="hidden" name="freshrss-keep-install" value="1" /> + <button type="submit" class="btn btn-important next-step" tabindex="1" ><?php echo _t('install.action.keep_install'); ?></button> + <a class="btn btn-attention next-step confirm" data-str-confirm="<?php echo _t('install.js.confirm_reinstall'); ?>" href="?step=2" tabindex="2" ><?php echo _t('install.action.reinstall'); ?></a> + </form> + + <?php } elseif ($res['all'] == 'ok') { ?> + <a class="btn btn-important next-step" href="?step=2" tabindex="1" ><?php echo _t('install.action.next_step'); ?></a> + <?php } else { ?> + <p class="alert alert-error"><?php echo _t('install.action.fix_errors_before'); ?></p> + <?php } ?> +<?php +} + +function printStep2() { + $user_default_config = Minz_Configuration::get('default_user'); +?> + <?php $s2 = checkStep2(); if ($s2['all'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.conf.ok'); ?></p> + <?php } elseif (!empty($_POST)) { ?> + <p class="alert alert-error"><?php echo _t('install.fix_errors_before'); ?></p> + <?php } ?> + + <form action="index.php?step=2" method="post"> + <legend><?php echo _t('install.conf'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="old_entries"><?php echo _t('install.delete_articles_after'); ?></label> + <div class="group-controls"> + <input type="number" id="old_entries" name="old_entries" required="required" min="1" max="1200" value="<?php echo isset($_SESSION['old_entries']) ? $_SESSION['old_entries'] : $user_default_config->old_entries; ?>" tabindex="2" /> <?php echo _t('gen.date.month'); ?> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="default_user"><?php echo _t('install.default_user'); ?></label> + <div class="group-controls"> + <input type="text" id="default_user" name="default_user" required="required" size="16" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" value="<?php echo isset($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?>" placeholder="<?php echo httpAuthUser() == '' ? 'alice' : httpAuthUser(); ?>" tabindex="3" /> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="auth_type"><?php echo _t('install.auth.type'); ?></label> + <div class="group-controls"> + <select id="auth_type" name="auth_type" required="required" tabindex="4"> + <?php + function no_auth($auth_type) { + return !in_array($auth_type, array('form', 'http_auth', 'none')); + } + $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : ''; + ?> + <option value="form"<?php echo $auth_type === 'form' || (no_auth($auth_type) && cryptAvailable()) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('install.auth.form'); ?></option> + <option value="http_auth"<?php echo $auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('install.auth.http'); ?>(REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option> + <option value="none"<?php echo $auth_type === 'none' || (no_auth($auth_type) && !cryptAvailable()) ? ' selected="selected"' : ''; ?>><?php echo _t('install.auth.none'); ?></option> + </select> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="passwordPlain"><?php echo _t('install.auth.password_form'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $auth_type === 'form' ? ' required="required"' : ''; ?> tabindex="5" /> + <a class="btn toggle-password" data-toggle="passwordPlain"><?php echo FreshRSS_Themes::icon('key'); ?></a> + </div> + <?php echo _i('help'); ?> <?php echo _t('install.auth.password_format'); ?> + <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important" tabindex="7" ><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn" tabindex="8" ><?php echo _t('gen.action.cancel'); ?></button> + <?php if ($s2['all'] == 'ok') { ?> + <a class="btn btn-important next-step" href="?step=3" tabindex="9" ><?php echo _t('install.action.next_step'); ?></a> + <?php } ?> + </div> + </div> + </form> +<?php +} + +function printStep3() { + $system_default_config = Minz_Configuration::get('default_system'); +?> + <?php $s3 = checkStep3(); if ($s3['all'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.bdd.conf.ok'); ?></p> + <?php } elseif ($s3['conn'] == 'ko') { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.bdd.conf.ko'),(empty($_SESSION['bd_error']) ? '' : ' : ' . $_SESSION['bd_error']); ?></p> + <?php } ?> + + <form action="index.php?step=3" method="post" autocomplete="off"> + <legend><?php echo _t('install.bdd.conf'); ?></legend> + <div class="form-group"> + <label class="group-name" for="type"><?php echo _t('install.bdd.type'); ?></label> + <div class="group-controls"> + <select name="type" id="type" tabindex="1"> + <?php if (extension_loaded('pdo_mysql')) {?> + <option value="mysql" + <?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>> + MySQL + </option> + <?php }?> + <?php if (extension_loaded('pdo_sqlite')) {?> + <option value="sqlite" + <?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite') ? 'selected="selected"' : ''; ?>> + SQLite + </option> + <?php }?> + <?php if (extension_loaded('pdo_pgsql')) {?> + <option value="pgsql" + <?php echo(isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'pgsql') ? 'selected="selected"' : ''; ?>> + PostgreSQL (⚠️ experimental) + </option> + <?php }?> + </select> + </div> + </div> + + <div id="mysql"> + <div class="form-group"> + <label class="group-name" for="host"><?php echo _t('install.bdd.host'); ?></label> + <div class="group-controls"> + <input type="text" id="host" name="host" pattern="[0-9A-Z/a-z_.-]{1,64}(:[0-9]{2,5})?" value="<?php echo isset($_SESSION['bd_host']) ? $_SESSION['bd_host'] : $system_default_config->db['host']; ?>" tabindex="2" /> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="user"><?php echo _t('install.bdd.username'); ?></label> + <div class="group-controls"> + <input type="text" id="user" name="user" maxlength="16" pattern="[0-9A-Za-z_.-]{1,16}" value="<?php echo isset($_SESSION['bd_user']) ? $_SESSION['bd_user'] : ''; ?>" tabindex="3" /> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="pass"><?php echo _t('install.bdd.password'); ?></label> + <div class="group-controls"> + <input type="password" id="pass" name="pass" value="<?php echo isset($_SESSION['bd_password']) ? $_SESSION['bd_password'] : ''; ?>" tabindex="4" autocomplete="off" /> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="base"><?php echo _t('install.bdd'); ?></label> + <div class="group-controls"> + <input type="text" id="base" name="base" maxlength="64" pattern="[0-9A-Za-z_]{1,64}" value="<?php echo isset($_SESSION['bd_base']) ? $_SESSION['bd_base'] : ''; ?>" tabindex="5" /> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="prefix"><?php echo _t('install.bdd.prefix'); ?></label> + <div class="group-controls"> + <input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : $system_default_config->db['prefix']; ?>" tabindex="6" /> + </div> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important" tabindex="7" ><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn" tabindex="8" ><?php echo _t('gen.action.cancel'); ?></button> + <?php if ($s3['all'] == 'ok') { ?> + <a class="btn btn-important next-step" href="?step=4" tabindex="9" ><?php echo _t('install.action.next_step'); ?></a> + <?php } ?> + </div> + </div> + </form> +<?php +} + +function printStep4() { +?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('install.congratulations'); ?></span> <?php echo _t('install.ok'); ?></p> + <a class="btn btn-important next-step" href="?step=5" tabindex="1"><?php echo _t('install.action.finish'); ?></a> +<?php +} + +function printStep5() { +?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.not_deleted', DATA_PATH . '/do-install.txt'); ?></p> +<?php +} + +initTranslate(); + +checkStep(); + +switch (STEP) { +case 0: +default: + saveLanguage(); + break; +case 1: + saveStep1(); + break; +case 2: + saveStep2(); + break; +case 3: + saveStep3(); + break; +case 4: + break; +case 5: + if (deleteInstall()) { + header('Location: index.php'); + } + break; +} +?> +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="initial-scale=1.0" /> + <title><?php echo _t('install.title'); ?></title> + <link rel="stylesheet" href="../themes/base-theme/template.css?<?php echo @filemtime(PUBLIC_PATH . '/themes/base-theme/template.css'); ?>" /> + <link rel="stylesheet" href="../themes/Origine/origine.css?<?php echo @filemtime(PUBLIC_PATH . '/themes/Origine/origine.css'); ?>" /> + <meta name="robots" content="noindex,nofollow" /> + </head> + <body> + +<div class="header"> + <div class="item title"> + <h1><a href="index.php"><?php echo _t('install.title'); ?></a></h1> + <h2><?php echo _t('install.step', STEP); ?></h2> + </div> +</div> + +<div id="global"> + <ul class="nav nav-list aside"> + <li class="nav-header"><?php echo _t('install.steps'); ?></li> + <li class="item<?php echo STEP == 0 ? ' active' : ''; ?>"><a href="?step=0"><?php echo _t('install.language'); ?></a></li> + <li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1"><?php echo _t('install.check'); ?></a></li> + <li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2"><?php echo _t('install.conf'); ?></a></li> + <li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3"><?php echo _t('install.bdd.conf'); ?></a></li> + <li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4"><?php echo _t('install.this_is_the_end'); ?></a></li> + </ul> + + <div class="post"> + <?php + switch (STEP) { + case 0: + default: + printStep0(); + break; + case 1: + printStep1(); + break; + case 2: + printStep2(); + break; + case 3: + printStep3(); + break; + case 4: + printStep4(); + break; + case 5: + printStep5(); + break; + } + ?> + </div> +</div> + <script src="../scripts/install.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/install.js'); ?>"></script> + </body> +</html> diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 27f11ab6d..d956ec21f 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -1,19 +1,49 @@ <ul class="nav nav-list aside"> - <li class="nav-header"><?php echo Minz_Translate::t ('configuration'); ?></li> - <li class="item<?php echo Minz_Request::actionName () == 'display' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Minz_Translate::t ('reading_configuration'); ?></a> + <li class="nav-header"><?php echo _t('gen.menu.configuration'); ?></li> + <li class="item<?php echo Minz_Request::actionName() === 'display' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'display'); ?>"><?php echo _t('gen.menu.display'); ?></a> </li> - <li class="item<?php echo Minz_Request::actionName () == 'archiving' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'archiving'); ?>"><?php echo Minz_Translate::t ('archiving_configuration'); ?></a> + <li class="item<?php echo Minz_Request::actionName() === 'reading' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'reading'); ?>"><?php echo _t('gen.menu.reading'); ?></a> </li> - <li class="item<?php echo Minz_Request::actionName () == 'sharing' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Minz_Translate::t ('sharing'); ?></a> + <li class="item<?php echo Minz_Request::actionName() === 'archiving' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'archiving'); ?>"><?php echo _t('gen.menu.archiving'); ?></a> </li> - <li class="item<?php echo Minz_Request::actionName () == 'shortcut' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Minz_Translate::t ('shortcuts'); ?></a> + <li class="item<?php echo Minz_Request::actionName() === 'sharing' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'sharing'); ?>"><?php echo _t('gen.menu.sharing'); ?></a> </li> - <li class="separator"></li> - <li class="item<?php echo Minz_Request::actionName () == 'users' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'users'); ?>"><?php echo Minz_Translate::t ('users'); ?></a> + <li class="item<?php echo Minz_Request::actionName() === 'shortcut' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'shortcut'); ?>"><?php echo _t('gen.menu.shortcuts'); ?></a> </li> + <li class="item<?php echo Minz_Request::actionName() === 'queries' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'queries'); ?>"><?php echo _t('gen.menu.queries'); ?></a> + </li> + <li class="item<?php echo Minz_Request::controllerName() === 'user' && + Minz_Request::actionName() === 'profile'? ' active' : ''; ?>"> + <a href="<?php echo _url('user', 'profile'); ?>"><?php echo _t('gen.menu.user_profile'); ?></a> + </li> + <li class="item<?php echo Minz_Request::controllerName() === 'extension' ? ' active' : ''; ?>"> + <a href="<?php echo _url('extension', 'index'); ?>"><?php echo _t('gen.menu.extensions'); ?></a> + </li> + <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> + <li class="nav-header"><?php echo _t('gen.menu.admin'); ?></li> + <li class="item<?php echo Minz_Request::actionName() === 'system' ? ' active' : ''; ?>"> + <a href="<?php echo _url('configure', 'system')?>"><?php echo _t('gen.menu.system'); ?></a> + </li> + <li class="item<?php echo Minz_Request::controllerName() === 'user' && + Minz_Request::actionName() === 'manage' ? ' active' : ''; ?>"> + <a href="<?php echo _url('user', 'manage'); ?>"><?php echo _t('gen.menu.user_management'); ?></a> + </li> + <li class="item<?php echo Minz_Request::controllerName() === 'auth' ? ' active' : ''; ?>"> + <a href="<?php echo _url('auth', 'index'); ?>"><?php echo _t('gen.menu.authentication'); ?></a> + </li> + <li class="item<?php echo Minz_Request::controllerName() === 'update' && + Minz_Request::actionName() === 'checkInstall' ? ' active' : ''; ?>"> + <a href="<?php echo _url('update', 'checkInstall'); ?>"><?php echo _t('gen.menu.check_install'); ?></a> + </li> + <li class="item<?php echo Minz_Request::controllerName() === 'update' && + Minz_Request::actionName() === 'index' ? ' active' : ''; ?>"> + <a href="<?php echo _url('update', 'index'); ?>"><?php echo _t('gen.menu.update'); ?></a> + </li> + <?php } ?> </ul> diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index e324b15bd..3e1ee44dd 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -1,64 +1,96 @@ -<ul class="nav nav-list aside aside_feed"> - <li class="nav-header"><?php echo Minz_Translate::t ('your_rss_feeds'); ?></li> +<?php + $class = ''; + if (FreshRSS_Context::$user_conf->hide_read_feeds && + FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && + !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) { + $class = ' state_unread'; + } +?> - <li class="nav-form"><form id="add_rss" method="post" action="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'add')); ?>" autocomplete="off"> - <div class="stick"> - <input type="url" name="url_rss" placeholder="<?php echo Minz_Translate::t ('add_rss_feed'); ?>" /> - <div class="dropdown"> - <div id="dropdown-cat" class="dropdown-target"></div> +<div class="aside aside_feed<?php echo $class; ?>" id="aside_feed"> + <a class="toggle_aside" href="#close"><?php echo _i('close'); ?></a> - <a class="dropdown-toggle btn" href="#dropdown-cat"><?php echo FreshRSS_Themes::icon('down'); ?></a> - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close">❌</a></li> - - <li class="dropdown-header"><?php echo Minz_Translate::t ('category'); ?></li> - - <li class="input"> - <select name="category" id="category"> - <?php foreach ($this->categories as $cat) { ?> - <option value="<?php echo $cat->id (); ?>"<?php echo $cat->id () == 1 ? ' selected="selected"' : ''; ?>> - <?php echo $cat->name (); ?> - </option> - <?php } ?> - </select> - </li> - - <li class="separator"></li> + <?php if (FreshRSS_Auth::hasAccess()) { ?> + <div class="stick configure-feeds no-mobile"> + <a class="btn btn-important" href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.menu.subscription'); ?></a> + <a class="btn btn-important" href="<?php echo _url('importExport', 'index'); ?>"><?php echo _i('import'); ?></a> + </div> + <?php } elseif (FreshRSS_Auth::accessNeedsLogin()) { ?> + <a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('index.menu.about'); ?></a> + <?php } ?> - <li class="dropdown-header"><?php echo Minz_Translate::t ('http_authentication'); ?></li> - <li class="input"> - <input type="text" name="http_user" id="http_user_add" autocomplete="off" placeholder="<?php echo Minz_Translate::t ('username'); ?>" /> - </li> - <li class="input"> - <input type="password" name="http_pass" id="http_pass_add" autocomplete="off" placeholder="<?php echo Minz_Translate::t ('password'); ?>" /> - </li> - </ul> + <form id="mark-read-aside" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <ul class="tree"> + <li class="tree-folder category all<?php echo FreshRSS_Context::isCurrentGet('a') ? ' active' : ''; ?>"> + <div class="tree-folder-title"> + <?php echo _i('all'); ?> <a class="title" data-unread="<?php echo format_number(FreshRSS_Context::$total_unread); ?>" href="<?php echo _url('index', 'index'); ?>"><?php echo _t('index.menu.main_stream'); ?></a> </div> - <button class="btn" type="submit"><?php echo FreshRSS_Themes::icon('add'); ?></button> - </div> - </form></li> + </li> - <li class="item<?php echo Minz_Request::actionName () == 'importExport' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'importExport'); ?>"><?php echo Minz_Translate::t ('import_export_opml'); ?></a> - </li> + <li class="tree-folder category favorites<?php echo FreshRSS_Context::isCurrentGet('s') ? ' active' : ''; ?>"> + <div class="tree-folder-title"> + <?php echo _i('bookmark'); ?> <a class="title" data-unread="<?php echo format_number(FreshRSS_Context::$total_starred['unread']); ?>" href="<?php echo _url('index', 'index', 'get', 's'); ?>"><?php echo _t('index.menu.favorites', format_number(FreshRSS_Context::$total_starred['all'])); ?></a> + </div> + </li> - <li class="item<?php echo Minz_Request::actionName () == 'categorize' ? ' active' : ''; ?>"> - <a href="<?php echo _url ('configure', 'categorize'); ?>"><?php echo Minz_Translate::t ('categories_management'); ?></a> - </li> + <?php + foreach ($this->categories as $cat) { + $feeds = $cat->feeds(); + if (!empty($feeds)) { + $c_active = FreshRSS_Context::isCurrentGet('c_' . $cat->id()); + $c_show = $c_active && (!FreshRSS_Context::$user_conf->display_categories || + FreshRSS_Context::$current_get['feed']); + ?> + <li class="tree-folder category<?php echo $c_active ? ' active' : ''; ?>" data-unread="<?php echo $cat->nbNotRead(); ?>"> + <div class="tree-folder-title"> + <a class="dropdown-toggle" href="#"><?php echo _i($c_show ? 'up' : 'down'); ?></a> + <a class="title<?php echo $cat->hasFeedsWithError() ? ' error' : ''; ?>" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id()); ?>"><?php echo $cat->name(); ?></a> + </div> - <li class="separator"></li> + <ul class="tree-folder-items<?php echo $c_show ? ' active' : ''; ?>"> + <?php + foreach ($feeds as $feed) { + $f_active = FreshRSS_Context::isCurrentGet('f_' . $feed->id()); + ?> + <li id="f_<?php echo $feed->id(); ?>" class="item feed<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError() ? ' error' : ''; ?><?php echo $feed->nbEntries() <= 0 ? ' empty' : ''; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>" data-priority="<?php echo $feed->priority(); ?>"> + <div class="dropdown no-mobile"> + <div class="dropdown-target"></div> + <a class="dropdown-toggle" data-fweb="<?php echo $feed->website(); ?>"><?php echo _i('configure'); ?></a> + <?php /* feed_config_template */ ?> + </div> + <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <a class="item-title" data-unread="<?php echo format_number($feed->nbNotRead()); ?>" href="<?php echo _url('index', 'index', 'get', 'f_' . $feed->id()); ?>"><?php echo $feed->name(); ?></a> + </li> + <?php } ?> + </ul> + </li> + <?php + } + } + ?> + </ul> + </form> +</div> - <?php if (!empty ($this->feeds)) { ?> - <?php foreach ($this->feeds as $feed) { ?> - <?php $nbEntries = $feed->nbEntries (); ?> - <li class="item<?php echo ($this->flux && $this->flux->id () == $feed->id ()) ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>"> - <a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>"> - <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> - <?php echo $feed->name (); ?> - </a> - </li> - <?php } ?> - <?php } else { ?> - <li class="item disable"><?php echo Minz_Translate::t ('no_rss_feed'); ?></li> - <?php } ?> -</ul> +<script id="feed_config_template" type="text/html"> + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close">❌</a></li> + <li class="item"><a href="<?php echo _url('index', 'index', 'get', 'f_------'); ?>"><?php echo _t('gen.action.filter'); ?></a></li> + <?php if (FreshRSS_Auth::hasAccess()) { ?> + <li class="item"><a href="<?php echo _url('stats', 'repartition', 'id', '------'); ?>"><?php echo _t('index.menu.stats'); ?></a></li> + <?php } ?> + <li class="item"><a target="_blank" rel="noreferrer" href="http://example.net/"><?php echo _t('gen.action.see_website'); ?></a></li> + <?php if (FreshRSS_Auth::hasAccess()) { ?> + <li class="separator"></li> + <li class="item"><a href="<?php echo _url('subscription', 'index', 'id', '------'); ?>"><?php echo _t('gen.action.manage'); ?></a></li> + <li class="item"><a href="<?php echo _url('feed', 'actualize', 'id', '------'); ?>"><?php echo _t('gen.action.actualize'); ?></a></li> + <li class="item"> + <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?> + <button class="read_all as-link <?php echo $confirm; ?>" + form="mark-read-aside" + formaction="<?php echo _url('entry', 'read', 'get', 'f_------'); ?>" + type="submit"><?php echo _t('gen.action.mark_read'); ?></button> + </li> + <?php } ?> + </ul> +</script> diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml deleted file mode 100644 index 817dae676..000000000 --- a/app/layout/aside_flux.phtml +++ /dev/null @@ -1,88 +0,0 @@ -<div class="aside aside_flux" id="aside_flux"> - <a class="toggle_aside" href="#close"><?php echo FreshRSS_Themes::icon('close'); ?></a> - - <ul class="categories"> - <?php if ($this->loginOk) { ?> - <li> - <div class="stick"> - <a class="btn btn-important" href="<?php echo _url ('configure', 'feed'); ?>"><?php echo Minz_Translate::t ('subscription_management'); ?></a> - <a class="btn btn-important" href="<?php echo _url ('configure', 'categorize'); ?>" title="<?php echo Minz_Translate::t ('categories_management'); ?>"><?php echo FreshRSS_Themes::icon('category-white'); ?></a> - </div> - </li> - <?php } elseif (Minz_Configuration::needsLogin()) { ?> - <li><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Minz_Translate::t ('about_freshrss'); ?></a></li> - <?php } ?> - - <?php - $arUrl = array('c' => 'index', 'a' => 'index', 'params' => array()); - if ($this->conf->view_mode !== Minz_Request::param('output', 'normal')) { - $arUrl['params']['output'] = 'normal'; - } - ?> - <li> - <div class="category all<?php echo $this->get_c == 'a' ? ' active' : ''; ?>"> - <a data-unread="<?php echo formatNumber($this->nb_not_read); ?>" class="btn<?php echo $this->get_c == 'a' ? ' active' : ''; ?>" href="<?php echo Minz_Url::display($arUrl); ?>"> - <?php echo FreshRSS_Themes::icon('all'); ?> - <?php echo Minz_Translate::t ('main_stream'); ?> - </a> - </div> - </li> - - <li> - <div class="category favorites<?php echo $this->get_c == 's' ? ' active' : ''; ?>"> - <a data-unread="<?php echo formatNumber($this->nb_favorites['unread']); ?>" class="btn<?php echo $this->get_c == 's' ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 's'; echo Minz_Url::display($arUrl); ?>"> - <?php echo FreshRSS_Themes::icon('bookmark'); ?> - <?php echo Minz_Translate::t('favorite_feeds', formatNumber($this->nb_favorites['all'])); ?> - </a> - </div> - </li> - - <?php - foreach ($this->cat_aside as $cat) { - $feeds = $cat->feeds (); - if (!empty ($feeds)) { - ?><li><?php - $c_active = false; - if ($this->get_c == $cat->id ()) { - $c_active = true; - } - ?><div class="category stick<?php echo $c_active ? ' active' : ''; ?>"><?php - ?><a data-unread="<?php echo formatNumber($cat->nbNotRead()); ?>" class="btn<?php echo $c_active ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id(); echo Minz_Url::display($arUrl); ?>"><?php echo $cat->name (); ?></a><?php - ?><a class="btn dropdown-toggle" href="#"><?php echo FreshRSS_Themes::icon($c_active ? 'up' : 'down'); ?></a><?php - ?></div><?php - ?><ul class="feeds<?php echo $c_active ? ' active' : ''; ?>"><?php - foreach ($feeds as $feed) { - $feed_id = $feed->id (); - $nbEntries = $feed->nbEntries (); - $f_active = ($this->get_f == $feed_id); - ?><li id="f_<?php echo $feed_id; ?>" class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>"><?php - ?><div class="dropdown"><?php - ?><div class="dropdown-target"></div><?php - ?><a class="dropdown-toggle" data-fweb="<?php echo $feed->website (); ?>"><?php echo FreshRSS_Themes::icon('configure'); ?></a><?php - /* feed_config_template */ - ?></div><?php - ?> <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <?php - ?><a class="feed" data-unread="<?php echo formatNumber($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed_id; echo Minz_Url::display($arUrl); ?>"><?php echo $feed->name(); ?></a><?php - ?></li><?php - } - ?></ul><?php - ?></li><?php - } - } ?> - </ul> - <span class="aside_flux_ender"><!-- For fixed menu --></span> -</div> - -<script id="feed_config_template" type="text/html"> - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close">❌</a></li> - <li class="item"><a href="<?php echo _url ('index', 'index', 'get', 'f_!!!!!!'); ?>"><?php echo Minz_Translate::t ('filter'); ?></a></li> - <li class="item"><a target="_blank" href="http://example.net/"><?php echo Minz_Translate::t ('see_website'); ?></a></li> - <?php if ($this->loginOk) { ?> - <li class="separator"></li> - <li class="item"><a href="<?php echo _url ('configure', 'feed', 'id', '!!!!!!'); ?>"><?php echo Minz_Translate::t ('administration'); ?></a></li> - <li class="item"><a href="<?php echo _url ('feed', 'actualize', 'id', '!!!!!!'); ?>"><?php echo Minz_Translate::t ('actualize'); ?></a></li> - <li class="item"><a href="<?php echo _url ('entry', 'read', 'get', 'f_!!!!!!'); ?>"><?php echo Minz_Translate::t ('mark_read'); ?></a></li> - <?php } ?> - </ul> -</script> diff --git a/app/layout/aside_stats.phtml b/app/layout/aside_stats.phtml new file mode 100644 index 000000000..4bdaf7165 --- /dev/null +++ b/app/layout/aside_stats.phtml @@ -0,0 +1,12 @@ +<ul class="nav nav-list aside"> + <li class="nav-header"><?php echo _t('admin.stats'); ?></li> + <li class="item<?php echo Minz_Request::actionName() == 'index' ? ' active' : ''; ?>"> + <a href="<?php echo _url('stats', 'index'); ?>"><?php echo _t('admin.stats.menu.main'); ?></a> + </li> + <li class="item<?php echo Minz_Request::actionName() == 'idle' ? ' active' : ''; ?>"> + <a href="<?php echo _url('stats', 'idle'); ?>"><?php echo _t('admin.stats.menu.idle'); ?></a> + </li> + <li class="item<?php echo Minz_Request::actionName() == 'repartition' ? ' active' : ''; ?>"> + <a href="<?php echo _url('stats', 'repartition'); ?>"><?php echo _t('admin.stats.menu.repartition'); ?></a> + </li> +</ul> diff --git a/app/layout/aside_subscription.phtml b/app/layout/aside_subscription.phtml new file mode 100644 index 000000000..e14afe2a7 --- /dev/null +++ b/app/layout/aside_subscription.phtml @@ -0,0 +1,17 @@ +<ul class="nav nav-list aside"> + <li class="nav-header"><?php echo _t('sub.menu.subscription_management'); ?></li> + + <li class="item<?php echo Minz_Request::controllerName() == 'subscription' ? ' active' : ''; ?>"> + <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('sub.menu.subscription_management'); ?></a> + </li> + + <li class="item<?php echo Minz_Request::controllerName() == 'importExport' ? ' active' : ''; ?>"> + <a href="<?php echo _url('importExport', 'index'); ?>"><?php echo _t('sub.menu.import_export'); ?></a> + </li> + + <li class="item"> + <a class="bookmarkClick" href="javascript:(function(){var%20url%20=%20location.href;var%20otherWindow=window.open('about:blank','_blank');otherWindow.opener=null;otherWindow.location='<?php echo Minz_Url::display(array('c' => 'feed', 'a' => 'add'), 'html', true); ?>&url_rss='+encodeURIComponent(url);})();"> + <?php echo _t('sub.menu.bookmark'); ?> + </a> + </li> +</ul> diff --git a/app/layout/header.phtml b/app/layout/header.phtml index d20f7487f..238c664b0 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -1,22 +1,12 @@ <?php -if (Minz_Configuration::canLogIn()) { + +if (FreshRSS_Auth::accessNeedsAction()) { ?><ul class="nav nav-head nav-login"><?php - switch (Minz_Configuration::authType()) { - case 'form': - if ($this->loginOk) { - ?><li class="item"><?php echo FreshRSS_Themes::icon('logout'); ?> <a class="signout" href="<?php echo _url ('index', 'formLogout'); ?>"><?php echo Minz_Translate::t ('logout'); ?></a></li><?php - } else { - ?><li class="item"><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="<?php echo _url ('index', 'formLogin'); ?>"><?php echo Minz_Translate::t ('login'); ?></a></li><?php - } - break; - case 'persona': - if ($this->loginOk) { - ?><li class="item"><?php echo FreshRSS_Themes::icon('logout'); ?> <a class="signout" href="#"><?php echo Minz_Translate::t ('logout'); ?></a></li><?php - } else { - ?><li class="item"><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="#"><?php echo Minz_Translate::t ('login'); ?></a></li><?php - } - break; - } + if (FreshRSS_Auth::hasAccess()) { + ?><li class="item"><?php echo _i('logout'); ?> <a class="signout" href="<?php echo _url('auth', 'logout'); ?>"><?php echo _t('gen.auth.logout'); ?></a></li><?php + } else { + ?><li class="item"><?php echo _i('login'); ?> <a class="signin" href="<?php echo _url('auth', 'login'); ?>"><?php echo _t('gen.auth.login'); ?></a></li><?php + } ?></ul><?php } ?> @@ -24,84 +14,80 @@ if (Minz_Configuration::canLogIn()) { <div class="header"> <div class="item title"> <h1> - <a href="<?php echo _url ('index', 'index'); ?>"> - <img class="logo" src="<?php echo Minz_Url::display ('/themes/icons/icon.svg'); ?>" alt="⊚" /> - <?php echo Minz_Configuration::title (); ?> + <a href="<?php echo _url('index', 'index'); ?>"> + <img class="logo" src="<?php echo _i('icon', true); ?>" alt="⊚" /> + <?php echo FreshRSS_Context::$system_conf->title; ?> </a> </h1> </div> <div class="item search"> - <?php if ($this->loginOk || Minz_Configuration::allowAnonymous()) { ?> - <form action="<?php echo _url ('index', 'index'); ?>" method="get"> + <?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::$system_conf->allow_anonymous) { ?> + <form action="<?php echo _url('index', 'index'); ?>" method="get"> <div class="stick"> - <?php $search = Minz_Request::param ('search', ''); ?> - <input type="search" name="search" id="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo Minz_Translate::t ('search'); ?>" /> + <input type="search" name="search" id="search" class="extend" value="<?php echo FreshRSS_Context::$search; ?>" placeholder="<?php echo _t('gen.menu.search'); ?>" /> - <?php $get = Minz_Request::param ('get', ''); ?> - <?php if($get != '') { ?> + <?php $get = Minz_Request::param('get', ''); ?> + <?php if ($get != '') { ?> <input type="hidden" name="get" value="<?php echo $get; ?>" /> <?php } ?> - <?php $order = Minz_Request::param ('order', ''); ?> - <?php if($order != '') { ?> + <?php $order = Minz_Request::param('order', ''); ?> + <?php if ($order != '') { ?> <input type="hidden" name="order" value="<?php echo $order; ?>" /> <?php } ?> - <?php $state = Minz_Request::param ('state', ''); ?> - <?php if($state != '') { ?> + <?php $state = Minz_Request::param('state', ''); ?> + <?php if ($state != '') { ?> <input type="hidden" name="state" value="<?php echo $state; ?>" /> <?php } ?> - <button class="btn" type="submit"><?php echo FreshRSS_Themes::icon('search'); ?></button> + <button class="btn" type="submit"><?php echo _i('search'); ?></button> </div> </form> <?php } ?> </div> - <?php if ($this->loginOk) { ?> + <?php if (FreshRSS_Auth::hasAccess()) { ?> <div class="item configure"> <div class="dropdown"> <div id="dropdown-configure" class="dropdown-target"></div> - <a class="btn dropdown-toggle" href="#dropdown-configure"><?php echo FreshRSS_Themes::icon('configure'); ?></a> + <a class="btn dropdown-toggle" href="#dropdown-configure"><?php echo _i('configure'); ?></a> <ul class="dropdown-menu"> <li class="dropdown-close"><a href="#close">❌</a></li> - <li class="dropdown-header"><?php echo Minz_Translate::t ('configuration'); ?></li> - <li class="item"><a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Minz_Translate::t ('reading_configuration'); ?></a></li> - <li class="item"><a href="<?php echo _url ('configure', 'archiving'); ?>"><?php echo Minz_Translate::t ('archiving_configuration'); ?></a></li> - <li class="item"><a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Minz_Translate::t ('sharing'); ?></a></li> - <li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Minz_Translate::t ('shortcuts'); ?></a></li> + <li class="dropdown-header"><?php echo _t('gen.menu.configuration'); ?></li> + <li class="item"><a href="<?php echo _url('configure', 'display'); ?>"><?php echo _t('gen.menu.display'); ?></a></li> + <li class="item"><a href="<?php echo _url('configure', 'reading'); ?>"><?php echo _t('gen.menu.reading'); ?></a></li> + <li class="item"><a href="<?php echo _url('configure', 'archiving'); ?>"><?php echo _t('gen.menu.archiving'); ?></a></li> + <li class="item"><a href="<?php echo _url('configure', 'sharing'); ?>"><?php echo _t('gen.menu.sharing'); ?></a></li> + <li class="item"><a href="<?php echo _url('configure', 'shortcut'); ?>"><?php echo _t('gen.menu.shortcuts'); ?></a></li> + <li class="item"><a href="<?php echo _url('configure', 'queries'); ?>"><?php echo _t('gen.menu.queries'); ?></a></li> + <li class="item"><a href="<?php echo _url('user', 'profile'); ?>"><?php echo _t('gen.menu.user_profile'); ?></a></li> + <li class="item"><a href="<?php echo _url('extension', 'index'); ?>"><?php echo _t('gen.menu.extensions'); ?></a></li> + <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> <li class="separator"></li> - <li class="item"><a href="<?php echo _url ('configure', 'users'); ?>"><?php echo Minz_Translate::t ('users'); ?></a></li> + <li class="dropdown-header"><?php echo _t('gen.menu.admin'); ?></li> + <li class="item"><a href="<?php echo _url('configure', 'system'); ?>"><?php echo _t('gen.menu.system'); ?></a></li> + <li class="item"><a href="<?php echo _url('user', 'manage'); ?>"><?php echo _t('gen.menu.user_management'); ?></a></li> + <li class="item"><a href="<?php echo _url('auth', 'index'); ?>"><?php echo _t('gen.menu.authentication'); ?></a></li> + <li class="item"><a href="<?php echo _url('update', 'checkInstall'); ?>"><?php echo _t('gen.menu.check_install'); ?></a></li> + <li class="item"><a href="<?php echo _url('update', 'index'); ?>"><?php echo _t('gen.menu.update'); ?></a></li> + <?php } ?> <li class="separator"></li> - <li class="item"><a href="<?php echo _url ('index', 'stats'); ?>"><?php echo Minz_Translate::t ('stats'); ?></a></li> - <li class="item"><a href="<?php echo _url ('index', 'logs'); ?>"><?php echo Minz_Translate::t ('logs'); ?></a></li> - <li class="item"><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Minz_Translate::t ('about'); ?></a></li> + <li class="item"><a href="<?php echo _url('stats', 'index'); ?>"><?php echo _t('gen.menu.stats'); ?></a></li> + <li class="item"><a href="<?php echo _url('index', 'logs'); ?>"><?php echo _t('gen.menu.logs'); ?></a></li> + <li class="item"><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('gen.menu.about'); ?></a></li> <?php - if (Minz_Configuration::canLogIn()) { - ?><li class="separator"></li><?php - switch (Minz_Configuration::authType()) { - case 'form': - ?><li class="item"><a class="signout" href="<?php echo _url ('index', 'formLogout'); ?>"><?php echo FreshRSS_Themes::icon('logout'), ' ', Minz_Translate::t ('logout'); ?></a></li><?php - break; - case 'persona': - ?><li class="item"><a class="signout" href="#"><?php echo FreshRSS_Themes::icon('logout'), ' ', Minz_Translate::t ('logout'); ?></a></li><?php - break; - } + if (FreshRSS_Auth::accessNeedsAction()) { + ?><li class="separator"></li> + <li class="item"><a class="signout" href="<?php echo _url('auth', 'logout'); ?>"><?php echo _i('logout'), ' ', _t('gen.auth.logout'); ?></a></li><?php } ?> </ul> </div> </div> - <?php } elseif (Minz_Configuration::canLogIn()) { - ?><div class="item configure"><?php - switch (Minz_Configuration::authType()) { - case 'form': - echo FreshRSS_Themes::icon('login'); ?><a class="signin" href="<?php echo _url ('index', 'formLogin'); ?>"><?php echo Minz_Translate::t ('login'); ?></a></li><?php - break; - case 'persona': - echo FreshRSS_Themes::icon('login'); ?><a class="signin" href="#"><?php echo Minz_Translate::t ('login'); ?></a></li><?php - break; - } - ?></div><?php - } ?> + <?php } elseif (FreshRSS_Auth::accessNeedsAction()) { ?> + <div class="item configure"> + <?php echo _i('login'); ?><a class="signin" href="<?php echo _url('auth', 'login'); ?>"><?php echo _t('gen.auth.login'); ?></a> + </div> + <?php } ?> </div> diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index 1501df3c3..1f11e0af1 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -1,53 +1,78 @@ +<?php FreshRSS::preLayout(); ?> <!DOCTYPE html> -<html lang="<?php echo $this->conf->language; ?>" xml:lang="<?php echo $this->conf->language; ?>"> +<html lang="<?php echo FreshRSS_Context::$user_conf->language; ?>" xml:lang="<?php echo FreshRSS_Context::$user_conf->language; ?>"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="initial-scale=1.0" /> - <?php echo self::headTitle (); ?> - <?php echo self::headStyle (); ?> - <?php echo self::headScript (); ?> - <script>//<![CDATA[ -<?php $this->renderHelper ('javascript_vars'); ?> - //]]></script> -<?php - if (!empty($this->nextId)) { - $params = Minz_Request::params (); - $params['next'] = $this->nextId; -?> - <link id="prefetch" rel="next prefetch" href="<?php echo Minz_Url::display (array ('c' => Minz_Request::controllerName (), 'a' => Minz_Request::actionName (), 'params' => $params)); ?>" /> -<?php } ?> - <link rel="shortcut icon" type="image/x-icon" sizes="16x16 64x64" href="<?php echo Minz_Url::display('/favicon.ico'); ?>" /> + <?php echo self::headStyle(); ?> + <script id="jsonVars" type="application/json"> +<?php $this->renderHelper('javascript_vars'); ?> + </script> + <?php echo self::headScript(); ?> + <link rel="shortcut icon" id="favicon" type="image/x-icon" sizes="16x16 64x64" href="<?php echo Minz_Url::display('/favicon.ico'); ?>" /> <link rel="icon msapplication-TileImage apple-touch-icon" type="image/png" sizes="256x256" href="<?php echo Minz_Url::display('/themes/icons/favicon-256.png'); ?>" /> -<?php if (isset ($this->rss_url)) { ?> - <link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display ($this->rss_url); ?>" /> -<?php } ?> - <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('starred', true); ?>"> - <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('non-starred', true); ?>"> - <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('read', true); ?>"> - <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('unread', true); ?>"> + <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('starred', true); ?>" /> + <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('non-starred', true); ?>" /> + <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('read', true); ?>" /> + <link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('unread', true); ?>" /> + <link rel="apple-touch-icon" href="<?php echo Minz_Url::display('/themes/icons/apple-touch-icon.png'); ?>" /> + <meta name="apple-mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-status-bar-style" content="black" /> + <meta name="apple-mobile-web-app-title" content="<?php echo FreshRSS_Context::$system_conf->title; ?>"> <meta name="msapplication-TileColor" content="#FFF" /> +<?php if (!FreshRSS_Context::$system_conf->allow_referrer) { ?> + <meta name="referrer" content="never" /> +<?php + } + flush(); + if (isset($this->callbackBeforeContent)) { + call_user_func($this->callbackBeforeContent, $this); + } +?> + <?php echo self::headTitle(); ?> +<?php + $url_base = Minz_Request::currentRequest(); + if (FreshRSS_Context::$next_id !== '') { + $url_next = $url_base; + $url_next['params']['next'] = FreshRSS_Context::$next_id; + $url_next['params']['ajax'] = 1; +?> + <link id="prefetch" rel="next prefetch" href="<?php echo Minz_Url::display($url_next); ?>" /> +<?php + } if (isset($this->rss_title)) { + $url_rss = $url_base; + $url_rss['a'] = 'rss'; + if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) { + $url_rss['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss; + } +?> + <link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display($url_rss); ?>" /> +<?php } if (FreshRSS_Context::$system_conf->allow_robots) { ?> + <meta name="description" content="<?php echo htmlspecialchars(FreshRSS_Context::$name . ' | ' . FreshRSS_Context::$description, ENT_COMPAT, 'UTF-8'); ?>" /> +<?php } else { ?> <meta name="robots" content="noindex,nofollow" /> +<?php } ?> </head> - <body class="<?php echo Minz_Request::param('output', 'normal'); ?>"> -<?php $this->partial ('header'); ?> + <body class="<?php echo Minz_Request::actionName(); ?>"> +<?php $this->partial('header'); ?> <div id="global"> - <?php $this->render (); ?> + <?php $this->render(); ?> </div> <?php $msg = ''; $status = 'closed'; - if (isset ($this->notification)) { + if (isset($this->notification)) { $msg = $this->notification['content']; $status = $this->notification['type']; invalidateHttpCache(); } ?> -<div id="notification" class="<?php echo $status; ?>"> +<div id="notification" class="notification <?php echo $status; ?>"> <span class="msg"><?php echo $msg; ?></span> - <a class="close" href=""><?php echo FreshRSS_Themes::icon('close'); ?></a> + <a class="close" href=""><?php echo _i('close'); ?></a> </div> </body> </html> diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml index 3141e92a0..ca6849193 100644 --- a/app/layout/nav_entries.phtml +++ b/app/layout/nav_entries.phtml @@ -1,5 +1,5 @@ <ul id="nav_entries"> - <li class="item"><a class="previous_entry" href="#"><?php echo FreshRSS_Themes::icon('prev'); ?></a></li> - <li class="item"><a class="up" href="#"><?php echo FreshRSS_Themes::icon('up'); ?></a></li> - <li class="item"><a class="next_entry" href="#"><?php echo FreshRSS_Themes::icon('next'); ?></a></li> + <li class="item"><a class="previous_entry" href="#"><?php echo _i('prev'); ?></a></li> + <li class="item"><a class="up" href="#"><?php echo _i('up'); ?></a></li> + <li class="item"><a class="next_entry" href="#"><?php echo _i('next'); ?></a></li> </ul>
\ No newline at end of file diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 98064a6f7..f6d824d55 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -1,228 +1,204 @@ -<?php - $actual_view = Minz_Request::param('output', 'normal'); -?> +<?php $actual_view = Minz_Request::actionName(); ?> + <div class="nav_menu"> <?php if ($actual_view === 'normal') { ?> - <a class="btn toggle_aside" href="#aside_flux"><?php echo FreshRSS_Themes::icon('category'); ?></a> + <a class="btn toggle_aside" href="#aside_feed"><?php echo _i('category'); ?></a> <?php } ?> - <?php if ($this->loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?> - <a id="actualize" class="btn" href="<?php echo _url ('feed', 'actualize'); ?>"><?php echo FreshRSS_Themes::icon('refresh'); ?></a> - <?php } ?> + <?php if (FreshRSS_Auth::hasAccess()) { ?> + <div id="nav_menu_actions" class="stick"> + <?php + $states = array( + 'read' => FreshRSS_Entry::STATE_READ, + 'unread' => FreshRSS_Entry::STATE_NOT_READ, + 'starred' => FreshRSS_Entry::STATE_FAVORITE, + 'non-starred' => FreshRSS_Entry::STATE_NOT_FAVORITE, + ); + + foreach ($states as $state_str => $state) { + $state_enabled = FreshRSS_Context::isStateEnabled($state); + $url_state = Minz_Request::currentRequest(); + $url_state['params']['state'] = FreshRSS_Context::getRevertState($state); + ?> + <a id="toggle-<?php echo $state_str; ?>" + class="btn <?php echo $state_enabled ? 'active' : ''; ?>" + role="checkbox" aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>" + title="<?php echo _t('index.menu.' . $state_str); ?>" + href="<?php echo Minz_Url::display($url_state); ?>"><?php echo _i($state_str); ?></a> + <?php } ?> + + <div class="dropdown"> + <div id="dropdown-query" class="dropdown-target"></div> + + <a class="dropdown-toggle btn" href="#dropdown-query"><?php echo _i('down'); ?></a> + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close">❌</a></li> + + <li class="dropdown-header"> + <?php echo _t('index.menu.queries'); ?> + <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a> + </li> + + <?php foreach (FreshRSS_Context::$user_conf->queries as $query) { ?> + <li class="item query"> + <a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a> + </li> + <?php } ?> + + <?php if (count(FreshRSS_Context::$user_conf->queries) > 0) { ?> + <li class="separator no-mobile"></li> + <?php } ?> + + <?php + $url_query = Minz_Request::currentRequest();; + $url_query['c'] = 'configure'; + $url_query['a'] = 'addQuery'; + ?> + <li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo _i('bookmark-add'); ?> <?php echo _t('index.menu.add_query'); ?></a></li> + </ul> + </div> + </div> - <?php if ($this->loginOk) { ?> <?php - $get = false; - $string_mark = Minz_Translate::t ('mark_all_read'); - if ($this->get_f) { - $get = 'f_' . $this->get_f; - $string_mark = Minz_Translate::t ('mark_feed_read'); - } elseif ($this->get_c && $this->get_c != 'a') { - if ($this->get_c === 's') { - $get = 's'; - } else { - $get = 'c_' . $this->get_c; - } - $string_mark = Minz_Translate::t ('mark_cat_read'); - } - $nextGet = $get; - if ($this->conf->onread_jump_next && (strlen ($get) > 2)) { - $anotherUnreadId = ''; - $foundCurrent = false; - switch ($get[0]) { - case 'c': - foreach ($this->cat_aside as $cat) { - if ($cat->id () == $this->get_c) { - $foundCurrent = true; - continue; - } - if ($cat->nbNotRead () <= 0) continue; - $anotherUnreadId = $cat->id (); - if ($foundCurrent) break; - } - $nextGet = empty ($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId; - break; - case 'f': - foreach ($this->cat_aside as $cat) { - if ($cat->id () == $this->get_c) { - foreach ($cat->feeds () as $feed) { - if ($feed->id () == $this->get_f) { - $foundCurrent = true; - continue; - } - if ($feed->nbNotRead () <= 0) continue; - $anotherUnreadId = $feed->id (); - if ($foundCurrent) break; - } - break; - } - } - $nextGet = empty ($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId; - break; - } + $get = FreshRSS_Context::currentGet(); + $string_mark = _t('index.menu.mark_all_read'); + if ($get[0] == 'f') { + $string_mark = _t('index.menu.mark_feed_read'); + } elseif ($get[0] == 'c') { + $string_mark = _t('index.menu.mark_cat_read'); } - $p = isset($this->entries[0]) ? $this->entries[0] : null; - $idMax = $p === null ? '0' : $p->id(); - $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax)); - $output = Minz_Request::param('output', ''); - if (($output != '') && ($this->conf->view_mode !== $output)) { - $arUrl['params']['output'] = $output; - } - $markReadUrl = Minz_Url::display($arUrl); - Minz_Session::_param ('markReadUrl', $markReadUrl); + $mark_read_url = array( + 'c' => 'entry', + 'a' => 'read', + 'params' => array( + 'get' => $get, + 'nextGet' => FreshRSS_Context::$next_get, + 'idMax' => FreshRSS_Context::$id_max, + 'search' => FreshRSS_Context::$search, + 'state' => FreshRSS_Context::$state, + ) + ); ?> <div class="stick" id="nav_menu_read_all"> - <a class="read_all btn" href="<?php echo $markReadUrl; ?>"><?php echo Minz_Translate::t ('mark_read'); ?></a> + <form id="mark-read-menu" method="post"> + <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?> + <button class="read_all btn <?php echo $confirm; ?>" + form="mark-read-menu" + formaction="<?php echo Minz_Url::display($mark_read_url); ?>" + type="submit"><?php echo _t('gen.action.mark_read'); ?></button> + <div class="dropdown"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <div id="dropdown-read" class="dropdown-target"></div> - <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo FreshRSS_Themes::icon('down'); ?></a> + <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a> <ul class="dropdown-menu"> <li class="dropdown-close"><a href="#close">❌</a></li> - <li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li> + <li class="item"> + <button class="as-link <?php echo $confirm; ?>" + form="mark-read-menu" + formaction="<?php echo Minz_Url::display($mark_read_url); ?>" + type="submit"><?php echo $string_mark; ?></button> + </li> <li class="separator"></li> <?php - $today = $this->today; - $one_week = $today - 604800; + $today = @strtotime('today'); + $mark_before_today = $mark_read_url; + $mark_before_today['params']['idMax'] = $today . '000000'; + $mark_before_one_week = $mark_read_url; + $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000'; ?> - <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'idMax', $today . '000000'); ?>"><?php echo Minz_Translate::t ('before_one_day'); ?></a></li> - <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'idMax', $one_week . '000000'); ?>"><?php echo Minz_Translate::t ('before_one_week'); ?></a></li> + <li class="item"> + <button class="as-link <?php echo $confirm; ?>" + form="mark-read-menu" + formaction="<?php echo Minz_Url::display($mark_before_today); ?>" + type="submit"><?php echo _t('index.menu.before_one_day'); ?></button> + </li> + <li class="item"> + <button class="as-link <?php echo $confirm; ?>" + form="mark-read-menu" + formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>" + type="submit"><?php echo _t('index.menu.before_one_week'); ?></button> + </li> </ul> </div> + </form> </div> <?php } ?> - <?php - $params = Minz_Request::params (); - if (isset ($params['search'])) { - $params['search'] = urlencode ($params['search']); - } - $url = array ( - 'c' => 'index', - 'a' => 'index', - 'params' => $params - ); - ?> - <div class="dropdown" id="nav_menu_views"> - <div id="dropdown-views" class="dropdown-target"></div> - <a class="dropdown-toggle btn" href="#dropdown-views"><?php echo Minz_Translate::t ('display'); ?> <?php echo FreshRSS_Themes::icon('down'); ?></a> - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close">❌</a></li> - - <?php - $url_output = $url; - if ($actual_view !== 'normal') { ?> - <li class="item"> - <?php $url_output['params']['output'] = 'normal'; ?> - <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>"> - <?php echo Minz_Translate::t ('normal_view'); ?> - </a> - </li> - <?php } if($actual_view !== 'reader') { ?> - <li class="item"> - <?php $url_output['params']['output'] = 'reader'; ?> - <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>"> - <?php echo Minz_Translate::t ('reader_view'); ?> - </a> - </li> - <?php } if($actual_view !== 'global') { ?> - <li class="item"> - <?php $url_output['params']['output'] = 'global'; ?> - <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>"> - <?php echo Minz_Translate::t ('global_view'); ?> - </a> - </li> - <?php } ?> - - <li class="separator"></li> - - <?php - $url_state = $url; - $url_state['params']['state'] = 'all'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'all') ? 'true' :'false'; ?>"> - <a class="print_all" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_all_articles'); ?> - </a> - </li> - <?php - $url_state['params']['state'] = 'not_read'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'not_read') ? 'true' :'false'; ?>"> - <a class="print_non_read" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_not_reads'); ?> - </a> - </li> - <?php - $url_state['params']['state'] = 'read'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'read') ? 'true' :'false'; ?>"> - <a class="print_read" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_read'); ?> - </a> - </li> - <?php - $url_state['params']['state'] = 'favorite'; - ?> - <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'favorite') ? 'true' :'false'; ?>"> - <a class="print_favorite" href="<?php echo Minz_Url::display ($url_state); ?>"> - <?php echo Minz_Translate::t ('show_favorite'); ?> - </a> - </li> - - <li class="separator"></li> - - <li class="item"> - <?php - $url_order = $url; - if ($this->order === 'DESC') { - $url_order['params']['order'] = 'ASC'; - ?> - <a href="<?php echo Minz_Url::display ($url_order); ?>"> - <?php echo Minz_Translate::t ('older_first'); ?> - </a> - <?php - } else { - $url_order['params']['order'] = 'DESC'; - ?> - <a href="<?php echo Minz_Url::display ($url_order); ?>"> - <?php echo Minz_Translate::t ('newer_first'); ?> - </a> - <?php } ?> - </li> - - <li class="separator"></li> - - <li class="item"> - <a class="view_rss" target="_blank" href="<?php echo Minz_Url::display ($this->rss_url); ?>"> - <?php echo Minz_Translate::t ('rss_view'); ?> - </a> - </li> - </ul> + <?php $url_output = Minz_Request::currentRequest(); ?> + <div class="stick" id="nav_menu_views"> + <?php $url_output['a'] = 'normal'; ?> + <a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('index.menu.normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>"> + <?php echo _i("view-normal"); ?> + </a> + + <?php $url_output['a'] = 'global'; ?> + <a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('index.menu.global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>"> + <?php echo _i("view-global"); ?> + </a> + + <?php $url_output['a'] = 'reader'; ?> + <a class="view_reader btn <?php echo $actual_view == 'reader'? 'active' : ''; ?>" title="<?php echo _t('index.menu.reader_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>"> + <?php echo _i("view-reader"); ?> + </a> + + <?php + $url_output['a'] = 'rss'; + if (FreshRSS_Context::$user_conf->token) { + $url_output['params']['token'] = FreshRSS_Context::$user_conf->token; + } + if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) { + $url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss; + } + ?> + <a class="view_rss btn" target="_blank" rel="noreferrer" title="<?php echo _t('index.menu.rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>"> + <?php echo _i('rss'); ?> + </a> </div> <div class="item search"> - <form action="<?php echo _url ('index', 'index'); ?>" method="get"> - <?php $search = Minz_Request::param ('search', ''); ?> - <input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo Minz_Translate::t ('search_short'); ?>" /> + <form action="<?php echo _url('index', 'index'); ?>" method="get"> + <input type="search" name="search" class="extend" value="<?php echo FreshRSS_Context::$search; ?>" placeholder="<?php echo _t('index.menu.search_short'); ?>" /> - <?php $get = Minz_Request::param ('get', ''); ?> + <?php $get = Minz_Request::param('get', ''); ?> <?php if($get != '') { ?> <input type="hidden" name="get" value="<?php echo $get; ?>" /> <?php } ?> - <?php $order = Minz_Request::param ('order', ''); ?> + <?php $order = Minz_Request::param('order', ''); ?> <?php if($order != '') { ?> <input type="hidden" name="order" value="<?php echo $order; ?>" /> <?php } ?> - <?php $state = Minz_Request::param ('state', ''); ?> + <?php $state = Minz_Request::param('state', ''); ?> <?php if($state != '') { ?> <input type="hidden" name="state" value="<?php echo $state; ?>" /> <?php } ?> </form> </div> + + <?php + if (FreshRSS_Context::$order === 'DESC') { + $order = 'ASC'; + $icon = 'up'; + $title = 'index.menu.older_first'; + } else { + $order = 'DESC'; + $icon = 'down'; + $title = 'index.menu.newer_first'; + } + $url_order = Minz_Request::currentRequest(); + $url_order['params']['order'] = $order; + ?> + <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>"> + <?php echo _i($icon); ?> + </a> + + <?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::$system_conf->allow_anonymous_refresh) { ?> + <a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>" title="<?php echo _t('gen.action.actualize'); ?>"><?php echo _i('refresh'); ?></a> + <?php } ?> </div> diff --git a/app/sql.php b/app/sql.php deleted file mode 100644 index 5cd7c52ed..000000000 --- a/app/sql.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -define('SQL_CREATE_TABLES', ' -CREATE TABLE IF NOT EXISTS `%1$scategory` ( - `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `name` varchar(255) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY (`name`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -ENGINE = INNODB; - -CREATE TABLE IF NOT EXISTS `%1$sfeed` ( - `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `url` varchar(511) CHARACTER SET latin1 NOT NULL, - `category` SMALLINT DEFAULT 0, -- v0.7 - `name` varchar(255) NOT NULL, - `website` varchar(255) CHARACTER SET latin1, - `description` text, - `lastUpdate` int(11) DEFAULT 0, - `priority` tinyint(2) NOT NULL DEFAULT 10, - `pathEntries` varchar(511) DEFAULT NULL, - `httpAuth` varchar(511) DEFAULT NULL, - `error` boolean DEFAULT 0, - `keep_history` MEDIUMINT NOT NULL DEFAULT -2, -- v0.7 - `cache_nbEntries` int DEFAULT 0, -- v0.7 - `cache_nbUnreads` int DEFAULT 0, -- v0.7 - PRIMARY KEY (`id`), - FOREIGN KEY (`category`) REFERENCES `%1$scategory`(`id`) ON DELETE SET NULL ON UPDATE CASCADE, - UNIQUE KEY (`url`), -- v0.7 - INDEX (`name`), -- v0.7 - INDEX (`priority`), -- v0.7 - INDEX (`keep_history`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -ENGINE = INNODB; - -CREATE TABLE IF NOT EXISTS `%1$sentry` ( - `id` bigint NOT NULL, -- v0.7 - `guid` varchar(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B - `title` varchar(255) NOT NULL, - `author` varchar(255), - `content_bin` blob, -- v0.7 - `link` varchar(1023) CHARACTER SET latin1 NOT NULL, - `date` int(11), - `is_read` boolean NOT NULL DEFAULT 0, - `is_favorite` boolean NOT NULL DEFAULT 0, - `id_feed` SMALLINT, -- v0.7 - `tags` varchar(1023), - PRIMARY KEY (`id`), - FOREIGN KEY (`id_feed`) REFERENCES `%1$sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE, - UNIQUE KEY (`id_feed`,`guid`), -- v0.7 - INDEX (`is_favorite`), -- v0.7 - INDEX (`is_read`) -- v0.7 -) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci -ENGINE = INNODB; - -INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, :catName); -'); - -define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml new file mode 100644 index 000000000..a8213b7ae --- /dev/null +++ b/app/views/auth/formLogin.phtml @@ -0,0 +1,33 @@ +<div class="prompt"> + <h1><?php echo _t('gen.auth.login'); ?></h1> + + <?php if (!max_registrations_reached()) { ?> + <a href="<?php echo _url('auth', 'register'); ?>"><?php echo _t('gen.auth.registration.ask'); ?></a> + <?php } ?> + + <form id="crypto-form" method="post" action="<?php echo _url('auth', 'login'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <div> + <label for="username"><?php echo _t('gen.auth.username'); ?></label> + <input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" /> + </div> + <div> + <label for="passwordPlain"><?php echo _t('gen.auth.password'); ?></label> + <input type="password" id="passwordPlain" required="required" /> + <input type="hidden" id="challenge" name="challenge" /><br /> + <noscript><strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </div> + <div> + <label class="checkbox" for="keep_logged_in"> + <input type="checkbox" name="keep_logged_in" id="keep_logged_in" value="1" /> + <?php echo _t('gen.auth.keep_logged_in', $this->cookie_days); ?> + </label> + <br /> + </div> + <div> + <button id="loginButton" type="submit" class="btn btn-important"><?php echo _t('gen.auth.login'); ?></button> + </div> + </form> + + <p><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('gen.freshrss.about'); ?></a></p> +</div> diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml new file mode 100644 index 000000000..010eae33f --- /dev/null +++ b/app/views/auth/index.phtml @@ -0,0 +1,85 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('auth', 'index'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('admin.auth.type'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="auth_type"><?php echo _t('admin.auth.type'); ?></label> + <div class="group-controls"> + <select id="auth_type" name="auth_type" required="required" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->auth_type; ?>"> + <?php if (!in_array(FreshRSS_Context::$system_conf->auth_type, array('form', 'http_auth', 'none'))) { ?> + <option selected="selected"></option> + <?php } ?> + <option value="form"<?php echo FreshRSS_Context::$system_conf->auth_type === 'form' ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('admin.auth.form'); ?></option> + <option value="http_auth"<?php echo FreshRSS_Context::$system_conf->auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('admin.auth.http'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option> + <option value="none"<?php echo FreshRSS_Context::$system_conf->auth_type === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('admin.auth.none'); ?></option> + </select> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="anon_access"> + <input type="checkbox" name="anon_access" id="anon_access" value="1"<?php echo FreshRSS_Context::$system_conf->allow_anonymous ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->allow_anonymous; ?>"/> + <?php echo _t('admin.auth.allow_anonymous', FreshRSS_Context::$system_conf->default_user); ?> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="anon_refresh"> + <input type="checkbox" name="anon_refresh" id="anon_refresh" value="1"<?php echo FreshRSS_Context::$system_conf->allow_anonymous_refresh ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->allow_anonymous_refresh; ?>"/> + <?php echo _t('admin.auth.allow_anonymous_refresh'); ?> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="unsafe_autologin"> + <input type="checkbox" name="unsafe_autologin" id="unsafe_autologin" value="1"<?php echo FreshRSS_Context::$system_conf->unsafe_autologin_enabled ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->unsafe_autologin_enabled; ?>"/> + <?php echo _t('admin.auth.unsafe_autologin'); ?> + <kbd><?php echo Minz_Url::display(array('c' => 'auth', 'a' => 'login', 'params' => array('u' => 'alice', 'p' => '1234')), 'html', true); ?></kbd> + </label> + </div> + </div> + + <?php if (FreshRSS_Auth::accessNeedsAction()) { ?> + <div class="form-group"> + <label class="group-name" for="token"><?php echo _t('admin.auth.token'); ?></label> + <?php $token = FreshRSS_Context::$user_conf->token; ?> + <div class="group-controls"> + <input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo _t('gen.short.blank_to_disable'); ?>"<?php + echo FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo $token; ?>"/> + <?php echo _i('help'); ?> <?php echo _t('admin.auth.token_help'); ?> + <kbd><?php echo Minz_Url::display(array('a' => 'rss', 'params' => array('token' => $token, 'hours' => FreshRSS_Context::$user_conf->since_hours_posts_per_rss)), 'html', true); ?></kbd> + </div> + </div> + <?php } ?> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="api_enabled"> + <input type="checkbox" name="api_enabled" id="api_enabled" value="1"<?php echo FreshRSS_Context::$system_conf->api_enabled ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsLogin() ? '' : ' disabled="disabled"'; ?> data-leave-validation="<?php echo FreshRSS_Context::$system_conf->api_enabled; ?>"/> + <?php echo _t('admin.auth.api_enabled'); ?> + </label> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> +</div> diff --git a/app/views/auth/logout.phtml b/app/views/auth/logout.phtml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/auth/logout.phtml diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml new file mode 100644 index 000000000..1f9976391 --- /dev/null +++ b/app/views/auth/register.phtml @@ -0,0 +1,34 @@ +<div class="prompt"> + <h1><?php echo _t('gen.auth.registration'); ?></h1> + + <form method="post" action="<?php echo _url('user', 'create'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <div> + <label class="group-name" for="new_user_name"><?php echo _t('gen.auth.username'), '<br />', _i('help'), ' ', _t('gen.auth.username.format'); ?></label> + <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" autocomplete="off" pattern="[0-9a-zA-Z]{1,16}" /> + </div> + + <div> + <label class="group-name" for="new_user_passwordPlain"><?php echo _t('gen.auth.password'), '<br />', _i('help'), ' ', _t('gen.auth.password.format'); ?></label> + <div class="stick"> + <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" required="required" autocomplete="off" pattern=".{7,}" /> + <a class="btn toggle-password" data-toggle="new_user_passwordPlain"><?php echo _i('key'); ?></a> + </div> + <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> + </div> + + <div> + <?php + $redirect_url = urlencode(Minz_Url::display( + array('c' => 'index', 'a' => 'index'), + 'php', true + )); + ?> + <input type="hidden" name="r" value="<?php echo $redirect_url; ?>" /> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.create'); ?></button> + <a class="btn" href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.cancel'); ?></a> + </div> + </form> + + <p><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('gen.freshrss.about'); ?></a></p> +</div> diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index e144d0f45..2254f5dba 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -1,56 +1,84 @@ <?php $this->partial('aside_configure'); ?> <div class="post"> - <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <form method="post" action="<?php echo _url('configure', 'archiving'); ?>"> - <legend><?php echo Minz_Translate::t('archiving_configuration'); ?></legend> - <p><?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('archiving_configuration_help'); ?></p> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.archiving'); ?></legend> + <p><?php echo _i('help'); ?> <?php echo _t('conf.archiving.help'); ?></p> <div class="form-group"> - <label class="group-name" for="old_entries"><?php echo Minz_Translate::t('delete_articles_every'); ?></label> + <label class="group-name" for="old_entries"><?php echo _t('conf.archiving.delete_after'); ?></label> <div class="group-controls"> - <input type="number" id="old_entries" name="old_entries" min="1" max="1200" value="<?php echo $this->conf->old_entries; ?>" /> <?php echo Minz_Translate::t('month'); ?> - <a class="btn confirm" href="<?php echo _url('entry', 'purge'); ?>"><?php echo Minz_Translate::t('purge_now'); ?></a> + <input type="number" id="old_entries" name="old_entries" min="1" max="1200" value="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->old_entries; ?>"/> <?php echo _t('gen.date.month'); ?> + <a class="btn confirm" href="<?php echo _url('entry', 'purge'); ?>"><?php echo _t('conf.archiving.purge_now'); ?></a> </div> </div> <div class="form-group"> - <label class="group-name" for="keep_history_default"><?php echo Minz_Translate::t('keep_history'), ' ', Minz_Translate::t('by_feed'); ?></label> + <label class="group-name" for="keep_history_default"><?php echo _t('conf.archiving.keep_history_by_feed'); ?></label> <div class="group-controls"> - <select class="number" name="keep_history_default" id="keep_history_default" required="required"><?php + <select class="number" name="keep_history_default" id="keep_history_default" required="required" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->keep_history_default; ?>"><?php foreach (array('' => '', 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) { - echo '<option value="' . $v . ($this->conf->keep_history_default == $v ? '" selected="selected' : '') . '">' . $t . ' </option>'; + echo '<option value="' . $v . (FreshRSS_Context::$user_conf->keep_history_default == $v ? '" selected="selected' : '') . '">' . $t . ' </option>'; } - ?></select> (<?php echo Minz_Translate::t('by_default'); ?>) + ?></select> (<?php echo _t('gen.short.by_default'); ?>) + </div> + </div> + <div class="form-group"> + <label class="group-name" for="ttl_default"><?php echo _t('conf.archiving.ttl'); ?></label> + <div class="group-controls"> + <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->ttl_default; ?>"><?php + $found = false; + foreach (array(1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', + 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', + 36000 => '10h', 43200 => '12h', 64800 => '18h', + 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d', + 604800 => '1wk', -1 => '∞') as $v => $t) { + echo '<option value="' . $v . (FreshRSS_Context::$user_conf->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>'; + if (FreshRSS_Context::$user_conf->ttl_default == $v) { + $found = true; + } + } + if (!$found) { + echo '<option value="' . intval(FreshRSS_Context::$user_conf->ttl_default) . '" selected="selected">' . intval(FreshRSS_Context::$user_conf->ttl_default) . 's</option>'; + } + ?></select> (<?php echo _t('gen.short.by_default'); ?>) </div> </div> <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> </div> </div> </form> <form method="post" action="<?php echo _url('entry', 'optimize'); ?>"> - <legend><?php echo Minz_Translate::t ('advanced'); ?></legend> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.archiving.advanced'); ?></legend> <div class="form-group"> - <p class="group-name"><?php echo Minz_Translate::t('current_user'); ?></p> + <label class="group-name"><?php echo _t('conf.user.current'); ?></label> <div class="group-controls"> - <p><?php echo formatNumber($this->nb_total), ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?></p> - <input type="hidden" name="optimiseDatabase" value="1" /> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('optimize_bdd'); ?></button> - <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('optimize_todo_sometimes'); ?> + <?php echo _t('conf.user.articles_and_size', format_number($this->nb_total), format_bytes($this->size_user)); ?> </div> </div> - <?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?> + <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> <div class="form-group"> - <p class="group-name"><?php echo Minz_Translate::t('users'); ?></p> + <label class="group-name"><?php echo _t('conf.user.users'); ?></label> <div class="group-controls"> - <p><?php echo formatBytes($this->size_total); ?></p> + <?php echo format_bytes($this->size_total); ?> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <input type="hidden" name="optimiseDatabase" value="1" /> + <button type="submit" class="btn btn-important"><?php echo _t('conf.archiving.optimize'); ?></button> + <?php echo _i('help'); ?> <?php echo _t('conf.archiving.optimize_help'); ?> </div> </div> <?php } ?> diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml deleted file mode 100644 index a564e8cdd..000000000 --- a/app/views/configure/categorize.phtml +++ /dev/null @@ -1,47 +0,0 @@ -<?php $this->partial ('aside_feed'); ?> - -<div class="post"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> - - <form method="post" action="<?php echo _url ('configure', 'categorize'); ?>"> - <legend><?php echo Minz_Translate::t ('categories_management'); ?></legend> - - <p class="alert alert-warn"><?php echo Minz_Translate::t ('feeds_moved_category_deleted', $this->defaultCategory->name ()); ?></p> - - <?php $i = 0; foreach ($this->categories as $cat) { $i++; ?> - <div class="form-group"> - <label class="group-name" for="cat_<?php echo $cat->id (); ?>"> - <?php echo Minz_Translate::t ('category_number', $i); ?> - </label> - <div class="group-controls"> - <input type="text" id="cat_<?php echo $cat->id (); ?>" name="categories[]" value="<?php echo $cat->name (); ?>" /> - - <?php if ($cat->nbFeed () > 0) { ?> - <a class="confirm" href="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Minz_Translate::t ('ask_empty'); ?></a> - <?php } ?> - (<?php echo Minz_Translate::t ('number_feeds', $cat->nbFeed ()); ?>) - - <?php if ($cat->id () == $this->defaultCategory->id ()) { ?> - <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('can_not_be_deleted'); ?> - <?php } ?> - - <input type="hidden" name="ids[]" value="<?php echo $cat->id (); ?>" /> - </div> - </div> - <?php } ?> - - <div class="form-group"> - <label class="group-name" for="new_category"><?php echo Minz_Translate::t ('add_category'); ?></label> - <div class="group-controls"> - <input type="text" id="new_category" name="new_category" placeholder="<?php echo Minz_Translate::t ('new_category'); ?>" /> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> - </div> - </div> - </form> -</div> diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 9104e4ef1..62ecc1080 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -1,194 +1,123 @@ -<?php $this->partial ('aside_configure'); ?> +<?php $this->partial('aside_configure'); ?> <div class="post"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> - <form method="post" action="<?php echo _url ('configure', 'display'); ?>"> - <legend><?php echo Minz_Translate::t ('theme'); ?></legend> + <form method="post" action="<?php echo _url('configure', 'display'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.display'); ?></legend> <div class="form-group"> - <label class="group-name" for="language"><?php echo Minz_Translate::t ('language'); ?></label> + <label class="group-name" for="language"><?php echo _t('conf.display.language'); ?></label> <div class="group-controls"> - <select name="language" id="language"> - <?php $languages = $this->conf->availableLanguages (); ?> - <?php foreach ($languages as $short => $lib) { ?> - <option value="<?php echo $short; ?>"<?php echo $this->conf->language === $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option> + <select name="language" id="language" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->language; ?>"> + <?php $languages = Minz_Translate::availableLanguages(); ?> + <?php foreach ($languages as $lang) { ?> + <option value="<?php echo $lang; ?>"<?php echo FreshRSS_Context::$user_conf->language === $lang ? ' selected="selected"' : ''; ?>><?php echo _t('gen.lang.' . $lang); ?></option> <?php } ?> </select> </div> </div> <div class="form-group"> - <label class="group-name" for="theme"><?php echo Minz_Translate::t ('theme'); ?></label> + <label class="group-name" for="theme"><?php echo _t('conf.display.theme'); ?></label> <div class="group-controls"> - <select name="theme" id="theme" required=""><?php - $found = false; - foreach ($this->themes as $theme) { - ?><option value="<?php echo $theme['id']; ?>"<?php if ($this->conf->theme === $theme['id']) { echo ' selected="selected"'; $found = true; } ?>><?php - echo $theme['name'] . ' — ' . Minz_Translate::t ('by') . ' ' . $theme['author']; - ?></option><?php - } - if (!$found) { - ?><option selected="selected"></option><?php - } - ?></select> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> - </div> - </div> - - <legend><?php echo Minz_Translate::t ('reading_configuration'); ?></legend> - - <div class="form-group"> - <label class="group-name" for="posts_per_page"><?php echo Minz_Translate::t ('articles_per_page'); ?></label> - <div class="group-controls"> - <input type="number" id="posts_per_page" name="posts_per_page" value="<?php echo $this->conf->posts_per_page; ?>" /> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="sort_order"><?php echo Minz_Translate::t ('sort_order'); ?></label> - <div class="group-controls"> - <select name="sort_order" id="sort_order"> - <option value="DESC"<?php echo $this->conf->sort_order === 'DESC' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('newer_first'); ?></option> - <option value="ASC"<?php echo $this->conf->sort_order === 'ASC' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('older_first'); ?></option> - </select> + <ul class="slides"> + <?php $slides = count($this->themes); $i = 1; ?> + <?php foreach($this->themes as $theme) { ?> + <input type="radio" name="theme" id="img-<?php echo $i ?>" <?php if (FreshRSS_Context::$user_conf->theme === $theme['id']) {echo "checked";}?> value="<?php echo $theme['id'] ?>" data-leave-validation="<?php echo (FreshRSS_Context::$user_conf->theme === $theme['id']) ? 1 : 0; ?>"/> + <li class="slide-container"> + <div class="slide"> + <img src="<?php echo Minz_Url::display('/themes/' . $theme['id'] . '/thumbs/original.png')?>"/> + </div> + <div class="nav"> + <?php if ($i !== 1) {?> + <label for="img-<?php echo $i - 1 ?>" class="prev">‹</label> + <?php } ?> + <?php if ($i !== $slides) {?> + <label for="img-<?php echo $i + 1 ?>" class="next">›</label> + <?php } ?> + </div> + <div class="properties"> + <div><?php echo sprintf('%s — %s', $theme['name'], _t('gen.short.by_author', $theme['author'])); ?></div> + <div><?php echo $theme['description'] ?></div> + <div class="page-number"><?php echo sprintf('%d/%d', $i, $slides) ?></div> + </div> + </li> + <?php $i++ ?> + <?php } ?> + </ul> </div> </div> + <?php $width = FreshRSS_Context::$user_conf->content_width; ?> <div class="form-group"> - <label class="group-name" for="view_mode"><?php echo Minz_Translate::t ('default_view'); ?></label> + <label class="group-name" for="content_width"><?php echo _t('conf.display.width.content'); ?></label> <div class="group-controls"> - <select name="view_mode" id="view_mode"> - <option value="normal"<?php echo $this->conf->view_mode === 'normal' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('normal_view'); ?></option> - <option value="reader"<?php echo $this->conf->view_mode === 'reader' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('reader_view'); ?></option> - <option value="global"<?php echo $this->conf->view_mode === 'global' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t ('global_view'); ?></option> + <select name="content_width" id="content_width" required="" data-leave-validation="<?php echo $width; ?>"> + <option value="thin" <?php echo $width === 'thin'? 'selected="selected"' : ''; ?>> + <?php echo _t('conf.display.width.thin'); ?> + </option> + <option value="medium" <?php echo $width === 'medium'? 'selected="selected"' : ''; ?>> + <?php echo _t('conf.display.width.medium'); ?> + </option> + <option value="large" <?php echo $width === 'large'? 'selected="selected"' : ''; ?>> + <?php echo _t('conf.display.width.large'); ?> + </option> + <option value="no_limit" <?php echo $width === 'no_limit'? 'selected="selected"' : ''; ?>> + <?php echo _t('conf.display.width.no_limit'); ?> + </option> </select> - <label class="radio" for="radio_all"> - <input type="radio" name="default_view" id="radio_all" value="all"<?php echo $this->conf->default_view === 'all' ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('show_all_articles'); ?> - </label> - <label class="radio" for="radio_not_read"> - <input type="radio" name="default_view" id="radio_not_read" value="not_read"<?php echo $this->conf->default_view === 'not_read' ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('show_not_reads'); ?> - </label> </div> </div> <div class="form-group"> - <div class="group-controls"> - <label class="checkbox" for="auto_load_more"> - <input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?php echo $this->conf->auto_load_more ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('auto_load_more'); ?> - <noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript> - </label> - </div> - </div> - - <div class="form-group"> - <div class="group-controls"> - <label class="checkbox" for="display_posts"> - <input type="checkbox" name="display_posts" id="display_posts" value="1"<?php echo $this->conf->display_posts ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('display_articles_unfolded'); ?> - <noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript> - </label> - </div> - </div> - - <div class="form-group"> - <div class="group-controls"> - <label class="checkbox" for="lazyload"> - <input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo $this->conf->lazyload ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('img_with_lazyload'); ?> - <noscript> — <strong><?php echo Minz_Translate::t ('javascript_should_be_activated'); ?></strong></noscript> - </label> - </div> - </div> - - <div class="form-group"> - <label class="group-name"><?php echo Minz_Translate::t ('auto_read_when'); ?></label> - <div class="group-controls"> - <label class="checkbox" for="check_open_article"> - <input type="checkbox" name="mark_open_article" id="check_open_article" value="1"<?php echo $this->conf->mark_when['article'] ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('article_selected'); ?> - </label> - <label class="checkbox" for="check_open_site"> - <input type="checkbox" name="mark_open_site" id="check_open_site" value="1"<?php echo $this->conf->mark_when['site'] ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('article_open_on_website'); ?> - </label> - <label class="checkbox" for="check_scroll"> - <input type="checkbox" name="mark_scroll" id="check_scroll" value="1"<?php echo $this->conf->mark_when['scroll'] ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('scroll'); ?> - </label> - <label class="checkbox" for="check_reception"> - <input type="checkbox" name="mark_upon_reception" id="check_reception" value="1"<?php echo $this->conf->mark_when['reception'] ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('upon_reception'); ?> - </label> - </div> - </div> - - <div class="form-group"> - <label class="group-name"><?php echo Minz_Translate::t ('after_onread'); ?></label> - <div class="group-controls"> - <label class="checkbox" for="onread_jump_next"> - <input type="checkbox" name="onread_jump_next" id="onread_jump_next" value="1"<?php echo $this->conf->onread_jump_next ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('jump_next'); ?> - </label> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> - </div> - </div> - - <legend><?php echo Minz_Translate::t ('reading_icons'); ?></legend> - <div class="form-group"> + <label class="group-name" for="theme"><?php echo _t('conf.display.icon.entry'); ?></label> <table> <thead> <tr> <th> </th> - <th title="<?php echo Minz_Translate::t ('mark_read'); ?>"><?php echo FreshRSS_Themes::icon('read'); ?></th> - <th title="<?php echo Minz_Translate::t ('mark_favorite'); ?>"><?php echo FreshRSS_Themes::icon('bookmark'); ?></th> - <th><?php echo Minz_Translate::t ('sharing'); ?></th> - <th><?php echo Minz_Translate::t ('related_tags'); ?></th> - <th><?php echo Minz_Translate::t ('publication_date'); ?></th> - <th><?php echo FreshRSS_Themes::icon('link'); ?></th> + <th title="<?php echo _t('gen.action.mark_read'); ?>"><?php echo _i('read'); ?></th> + <th title="<?php echo _t('gen.action.mark_favorite'); ?>"><?php echo _i('bookmark'); ?></th> + <th><?php echo _t('conf.display.icon.sharing'); ?></th> + <th><?php echo _t('conf.display.icon.related_tags'); ?></th> + <th><?php echo _t('conf.display.icon.publication_date'); ?></th> + <th><?php echo _i('link'); ?></th> </tr> </thead> <tbody> <tr> - <th><?php echo Minz_Translate::t ('top_line'); ?></th> - <td><input type="checkbox" name="topline_read" value="1"<?php echo $this->conf->topline_read ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="topline_favorite" value="1"<?php echo $this->conf->topline_favorite ? ' checked="checked"' : ''; ?> /></td> + <th><?php echo _t('conf.display.icon.top_line'); ?></th> + <td><input type="checkbox" name="topline_read" value="1"<?php echo FreshRSS_Context::$user_conf->topline_read ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_read; ?>"/></td> + <td><input type="checkbox" name="topline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->topline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_favorite; ?>"/></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" disabled="disabled" /></td> - <td><input type="checkbox" name="topline_date" value="1"<?php echo $this->conf->topline_date ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="topline_link" value="1"<?php echo $this->conf->topline_link ? ' checked="checked"' : ''; ?> /></td> + <td><input type="checkbox" name="topline_date" value="1"<?php echo FreshRSS_Context::$user_conf->topline_date ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_date; ?>"/></td> + <td><input type="checkbox" name="topline_link" value="1"<?php echo FreshRSS_Context::$user_conf->topline_link ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_link; ?>"/></td> </tr><tr> - <th><?php echo Minz_Translate::t ('bottom_line'); ?></th> - <td><input type="checkbox" name="bottomline_read" value="1"<?php echo $this->conf->bottomline_read ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_favorite" value="1"<?php echo $this->conf->bottomline_favorite ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_sharing" value="1"<?php echo $this->conf->bottomline_sharing ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_tags" value="1"<?php echo $this->conf->bottomline_tags ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_date" value="1"<?php echo $this->conf->bottomline_date ? ' checked="checked"' : ''; ?> /></td> - <td><input type="checkbox" name="bottomline_link" value="1"<?php echo $this->conf->bottomline_link ? ' checked="checked"' : ''; ?> /></td> + <th><?php echo _t('conf.display.icon.bottom_line'); ?></th> + <td><input type="checkbox" name="bottomline_read" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_read ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_read; ?>"/></td> + <td><input type="checkbox" name="bottomline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_favorite; ?>"/></td> + <td><input type="checkbox" name="bottomline_sharing" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_sharing ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_sharing; ?>"/></td> + <td><input type="checkbox" name="bottomline_tags" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_tags ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_tags; ?>"/></td> + <td><input type="checkbox" name="bottomline_date" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_date ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_date; ?>"/></td> + <td><input type="checkbox" name="bottomline_link" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_link ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_link; ?>"/></td> </tr> </tbody> </table><br /> </div> + + <div class="form-group"> + <label class="group-name" for="html5_notif_timeout"><?php echo _t('conf.display.notif_html5.timeout'); ?></label> + <div class="group-controls"> + <input type="number" id="html5_notif_timeout" name="html5_notif_timeout" value="<?php echo FreshRSS_Context::$user_conf->html5_notif_timeout; ?>" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->html5_notif_timeout; ?>"/> <?php echo _t('conf.display.notif_html5.seconds'); ?> + </div> + </div> <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> </div> </div> </form> diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml deleted file mode 100644 index 2da04ac2d..000000000 --- a/app/views/configure/feed.phtml +++ /dev/null @@ -1,150 +0,0 @@ -<?php $this->partial ('aside_feed'); ?> - -<?php if ($this->flux) { ?> -<div class="post"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> <?php echo Minz_Translate::t ('or'); ?> <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $this->flux->id ()); ?>"><?php echo Minz_Translate::t ('filter'); ?></a> - - <h1><?php echo $this->flux->name (); ?></h1> - <?php echo $this->flux->description (); ?> - - <?php $nbEntries = $this->flux->nbEntries (); ?> - - <?php if ($this->flux->inError ()) { ?> - <p class="alert alert-error"><span class="alert-head"><?php echo Minz_Translate::t ('damn'); ?></span> <?php echo Minz_Translate::t ('feed_in_error'); ?></p> - <?php } elseif ($nbEntries === 0) { ?> - <p class="alert alert-warn"><?php echo Minz_Translate::t ('feed_empty'); ?></p> - <?php } ?> - - <form method="post" action="<?php echo _url ('configure', 'feed', 'id', $this->flux->id ()); ?>" autocomplete="off"> - <legend><?php echo Minz_Translate::t ('informations'); ?></legend> - <div class="form-group"> - <label class="group-name" for="name"><?php echo Minz_Translate::t ('title'); ?></label> - <div class="group-controls"> - <input type="text" name="name" id="name" class="extend" value="<?php echo $this->flux->name () ; ?>" /> - </div> - </div> - <div class="form-group"> - <label class="group-name" for="description"><?php echo Minz_Translate::t ('feed_description'); ?></label> - <div class="group-controls"> - <textarea name="description" id="description"><?php echo htmlspecialchars($this->flux->description(), ENT_NOQUOTES, 'UTF-8'); ?></textarea> - </div> - </div> - <div class="form-group"> - <label class="group-name" for="website"><?php echo Minz_Translate::t ('website_url'); ?></label> - <div class="group-controls"> - <input type="text" name="website" id="website" class="extend" value="<?php echo $this->flux->website (); ?>" /> - <a target="_blank" href="<?php echo $this->flux->website (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a> - </div> - </div> - <div class="form-group"> - <label class="group-name" for="url"><?php echo Minz_Translate::t ('feed_url'); ?></label> - <div class="group-controls"> - <input type="text" name="url" id="url" class="extend" value="<?php echo $this->flux->url (); ?>" /> - <a target="_blank" href="<?php echo $this->flux->url (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a> - <a class="btn" target="_blank" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->flux->url (); ?>"><?php echo Minz_Translate::t ('feed_validator'); ?></a> - </div> - </div> - <div class="form-group"> - <label class="group-name" for="category"><?php echo Minz_Translate::t ('category'); ?></label> - <div class="group-controls"> - <select name="category" id="category"> - <?php foreach ($this->categories as $cat) { ?> - <option value="<?php echo $cat->id (); ?>"<?php echo $cat->id ()== $this->flux->category () ? ' selected="selected"' : ''; ?>> - <?php echo $cat->name (); ?> - </option> - <?php } ?> - </select> - </div> - </div> - <div class="form-group"> - <label class="group-name" for="priority"><?php echo Minz_Translate::t ('show_in_all_flux'); ?></label> - <div class="group-controls"> - <label class="checkbox" for="priority"> - <input type="checkbox" name="priority" id="priority" value="10"<?php echo $this->flux->priority () > 0 ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ('yes'); ?> - </label> - </div> - </div> - <div class="form-group form-actions"> - <div class="group-controls"> - <button class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Minz_Translate::t ('delete'); ?></button> - </div> - </div> - - <legend><?php echo Minz_Translate::t ('archiving_configuration'); ?></legend> - - <div class="form-group"> - <label class="group-name"></label> - <div class="group-controls"> - <a class="btn" href="<?php echo _url ('feed', 'actualize', 'id', $this->flux->id ()); ?>"> - <?php echo FreshRSS_Themes::icon('refresh'); ?> <?php echo Minz_Translate::t('actualize'); ?> - </a> - </div> - </div> - <div class="form-group"> - <label class="group-name"><?php echo Minz_Translate::t ('number_articles'); ?></label> - <div class="group-controls"> - <span class="control"><?php echo $nbEntries; ?></span> - </div> - </div> - <div class="form-group"> - <label class="group-name" for="keep_history"><?php echo Minz_Translate::t ('keep_history'); ?></label> - <div class="group-controls"> - <select class="number" name="keep_history" id="keep_history" required="required"><?php - foreach (array('' => '', -2 => Minz_Translate::t('by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) { - echo '<option value="' . $v . ($this->flux->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>'; - } - ?></select> - </div> - </div> - <div class="form-group form-actions"> - <div class="group-controls"> - <button class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'truncate', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Minz_Translate::t ('truncate'); ?></button> - </div> - </div> - - <legend><?php echo Minz_Translate::t ('login_configuration'); ?></legend> - <?php $auth = $this->flux->httpAuth (false); ?> - <div class="form-group"> - <label class="group-name" for="http_user"><?php echo Minz_Translate::t ('http_username'); ?></label> - <div class="group-controls"> - <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo $auth['username']; ?>" autocomplete="off" /> - <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('access_protected_feeds'); ?> - </div> - - <label class="group-name" for="http_pass"><?php echo Minz_Translate::t ('http_password'); ?></label> - <div class="group-controls"> - <input type="password" name="http_pass" id="http_pass" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" /> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> - </div> - </div> - - <legend><?php echo Minz_Translate::t ('advanced'); ?></legend> - <div class="form-group"> - <label class="group-name" for="path_entries"><?php echo Minz_Translate::t ('css_path_on_website'); ?></label> - <div class="group-controls"> - <input type="text" name="path_entries" id="path_entries" class="extend" value="<?php echo $this->flux->pathEntries (); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" /> - <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('retrieve_truncated_feeds'); ?> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> - </div> - </div> - </form> -</div> - -<?php } else { ?> -<div class="alert alert-warn"><span class="alert-head"><?php echo Minz_Translate::t ('no_selected_feed'); ?></span> <?php echo Minz_Translate::t ('think_to_add'); ?></div> -<?php } ?> diff --git a/app/views/configure/importExport.phtml b/app/views/configure/importExport.phtml deleted file mode 100644 index e2217d9ed..000000000 --- a/app/views/configure/importExport.phtml +++ /dev/null @@ -1,40 +0,0 @@ -<?php -require_once(LIB_PATH . '/lib_opml.php'); -if ($this->req == 'export') { - echo '<?xml version="1.0" encoding="UTF-8" ?>'; -?> -<!-- Generated by <?php echo Minz_Configuration::title (); ?> --> -<opml version="2.0"> - <head> - <title><?php echo Minz_Configuration::title (); ?> OPML Feed</title> - <dateCreated><?php echo date('D, d M Y H:i:s'); ?></dateCreated> - </head> - <body> -<?php echo opml_export ($this->categories); ?> - </body> -</opml> -<?php } else { ?> -<?php $this->partial ('aside_feed'); ?> - -<div class="post "> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> - - <form method="post" action="<?php echo Minz_Url::display (array ('c' => 'configure', 'a' => 'importExport', 'params' => array ('q' => 'import'))); ?>" enctype="multipart/form-data"> - <legend><?php echo Minz_Translate::t ('import_export_opml'); ?></legend> - <div class="form-group"> - <label class="group-name" for="file"><?php echo Minz_Translate::t ('file_to_import'); ?></label> - <div class="group-controls"> - <input type="file" name="file" id="file" /> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('import'); ?></button> - <?php echo Minz_Translate::t ('or'); ?> - <a target="_blank" class="btn btn-important" href="<?php echo _url ('configure', 'importExport', 'q', 'export'); ?>"><?php echo Minz_Translate::t ('export'); ?></a> - </div> - </div> - </form> -</div> -<?php } ?> diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml new file mode 100644 index 000000000..0dffa268d --- /dev/null +++ b/app/views/configure/queries.phtml @@ -0,0 +1,88 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('configure', 'queries'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.query'); ?></legend> + + <?php foreach ($this->queries as $key => $query) { ?> + <div class="form-group" id="query-group-<?php echo $key; ?>"> + <label class="group-name" for="queries_<?php echo $key; ?>_name"> + <?php echo _t('conf.query.number', $key + 1); ?> + </label> + + <div class="group-controls"> + <input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][url]" value="<?php echo $query->getUrl(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][search]" value="<?php echo $query->getSearch(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_state" name="queries[<?php echo $key; ?>][state]" value="<?php echo $query->getState(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_order" name="queries[<?php echo $key; ?>][order]" value="<?php echo $query->getOrder(); ?>"/> + <input type="hidden" id="queries_<?php echo $key; ?>_get" name="queries[<?php echo $key; ?>][get]" value="<?php echo $query->getGet(); ?>"/> + + <div class="stick"> + <input class="extend" + type="text" + id="queries_<?php echo $key; ?>_name" + name="queries[<?php echo $key; ?>][name]" + value="<?php echo $query->getName(); ?>" + data-leave-validation="<?php echo $query->getName(); ?>" + /> + + <a class="btn" href="<?php echo $query->getUrl(); ?>"> + <?php echo _i('link'); ?> + </a> + + <a class="btn btn-attention remove" href="#" data-remove="query-group-<?php echo $key; ?>"> + <?php echo _i('close'); ?> + </a> + </div> + + <?php if (!$query->hasParameters()) { ?> + <div class="alert alert-warn"> + <div class="alert-head"><?php echo _t('conf.query.no_filter'); ?></div> + </div> + <?php } elseif ($query->isDeprecated()) { ?> + <div class="alert alert-error"> + <div class="alert-head"><?php echo _t('conf.query.deprecated'); ?></div> + </div> + <?php } else { ?> + <div class="alert alert-success"> + <div class="alert-head"><?php echo _t('conf.query.filter'); ?></div> + + <ul> + <?php if ($query->hasSearch()) { ?> + <li class="item"><?php echo _t('conf.query.search', $query->getSearch()->getRawInput()); ?></li> + <?php } ?> + + <?php if ($query->getState()) { ?> + <li class="item"><?php echo _t('conf.query.state_' . $query->getState()); ?></li> + <?php } ?> + + <?php if ($query->getOrder()) { ?> + <li class="item"><?php echo _t('conf.query.order_' . strtolower($query->getOrder())); ?></li> + <?php } ?> + + <?php if ($query->getGet()) { ?> + <li class="item"><?php echo _t('conf.query.get_' . $query->getGetType(), $query->getGetName()); ?></li> + <?php } ?> + </ul> + </div> + <?php } ?> + </div> + </div> + <?php } ?> + + <?php if (count(FreshRSS_Context::$user_conf->queries) > 0) { ?> + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + <?php } else { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('conf.query.none'); ?></p> + <?php } ?> + </form> + +</div>
\ No newline at end of file diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml new file mode 100644 index 000000000..07dabf15f --- /dev/null +++ b/app/views/configure/reading.phtml @@ -0,0 +1,178 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('configure', 'reading'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.reading'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="posts_per_page"><?php echo _t('conf.reading.articles_per_page'); ?></label> + <div class="group-controls"> + <input type="number" id="posts_per_page" name="posts_per_page" value="<?php echo FreshRSS_Context::$user_conf->posts_per_page; ?>" min="5" max="500" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->posts_per_page; ?>"/> + <?php echo _i('help'); ?> <?php echo _t('conf.reading.number_divided_when_reader'); ?> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="sort_order"><?php echo _t('conf.reading.sort'); ?></label> + <div class="group-controls"> + <select name="sort_order" id="sort_order" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->sort_order; ?>"> + <option value="DESC"<?php echo FreshRSS_Context::$user_conf->sort_order === 'DESC' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.sort.newer_first'); ?></option> + <option value="ASC"<?php echo FreshRSS_Context::$user_conf->sort_order === 'ASC' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.sort.older_first'); ?></option> + </select> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="view_mode"><?php echo _t('conf.reading.view.default'); ?></label> + <div class="group-controls"> + <select name="view_mode" id="view_mode" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->view_mode; ?>"> + <option value="normal"<?php echo FreshRSS_Context::$user_conf->view_mode === 'normal' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.view.normal'); ?></option> + <option value="reader"<?php echo FreshRSS_Context::$user_conf->view_mode === 'reader' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.view.reader'); ?></option> + <option value="global"<?php echo FreshRSS_Context::$user_conf->view_mode === 'global' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.view.global'); ?></option> + </select> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="view_mode"><?php echo _t('conf.reading.show'); ?></label> + <div class="group-controls"> + <select name="default_view" id="default_view" data-leave-validation="<?php echo FreshRSS_Context::$user_conf->default_view; ?>"> + <option value="adaptive"<?php echo FreshRSS_Context::$user_conf->default_view === 'adaptive' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.show.adaptive'); ?></option> + <option value="all"<?php echo FreshRSS_Context::$user_conf->default_view === 'all' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.show.all_articles'); ?></option> + <option value="unread"<?php echo FreshRSS_Context::$user_conf->default_view === 'unread' ? ' selected="selected"' : ''; ?>><?php echo _t('conf.reading.show.unread'); ?></option> + </select> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="hide_read_feeds"> + <input type="checkbox" name="hide_read_feeds" id="hide_read_feeds" value="1"<?php echo FreshRSS_Context::$user_conf->hide_read_feeds ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->hide_read_feeds; ?>"/> + <?php echo _t('conf.reading.hide_read_feeds'); ?> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="display_posts"> + <input type="checkbox" name="display_posts" id="display_posts" value="1"<?php echo FreshRSS_Context::$user_conf->display_posts ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->display_posts; ?>"/> + <?php echo _t('conf.reading.display_articles_unfolded'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="display_categories"> + <input type="checkbox" name="display_categories" id="display_categories" value="1"<?php echo FreshRSS_Context::$user_conf->display_categories ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->display_categories; ?>"/> + <?php echo _t('conf.reading.display_categories_unfolded'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="sticky_post"> + <input type="checkbox" name="sticky_post" id="sticky_post" value="1"<?php echo FreshRSS_Context::$user_conf->sticky_post ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->sticky_post; ?>"/> + <?php echo _t('conf.reading.sticky_post'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="auto_load_more"> + <input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?php echo FreshRSS_Context::$user_conf->auto_load_more ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->auto_load_more; ?>"/> + <?php echo _t('conf.reading.auto_load_more'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="lazyload"> + <input type="checkbox" name="lazyload" id="lazyload" value="1"<?php echo FreshRSS_Context::$user_conf->lazyload ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->lazyload; ?>"/> + <?php echo _t('conf.reading.img_with_lazyload'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="reading_confirm"> + <input type="checkbox" name="reading_confirm" id="reading_confirm" value="1"<?php echo FreshRSS_Context::$user_conf->reading_confirm ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->reading_confirm; ?>"/> + <?php echo _t('conf.reading.confirm_enabled'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="auto_remove_article"> + <input type="checkbox" name="auto_remove_article" id="auto_remove_article" value="1"<?php echo FreshRSS_Context::$user_conf->auto_remove_article ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->auto_remove_article; ?>"/> + <?php echo _t('conf.reading.auto_remove_article'); ?> + <noscript> — <strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </label> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="mark_updated_article_unread"> + <input type="checkbox" name="mark_updated_article_unread" id="mark_updated_article_unread" value="1"<?php echo FreshRSS_Context::$user_conf->mark_updated_article_unread ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_updated_article_unread; ?>"/> + <?php echo _t('conf.reading.mark_updated_article_unread'); ?> + </label> + </div> + </div> + + <div class="form-group"> + <label class="group-name"><?php echo _t('conf.reading.read.when'); ?></label> + <div class="group-controls"> + <label class="checkbox" for="check_open_article"> + <input type="checkbox" name="mark_open_article" id="check_open_article" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['article'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['article']; ?>"/> + <?php echo _t('conf.reading.read.article_viewed'); ?> + </label> + <label class="checkbox" for="check_open_site"> + <input type="checkbox" name="mark_open_site" id="check_open_site" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['site'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['site']; ?>"/> + <?php echo _t('conf.reading.read.article_open_on_website'); ?> + </label> + <label class="checkbox" for="check_scroll"> + <input type="checkbox" name="mark_scroll" id="check_scroll" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['scroll'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['scroll']; ?>"/> + <?php echo _t('conf.reading.read.scroll'); ?> + </label> + <label class="checkbox" for="check_reception"> + <input type="checkbox" name="mark_upon_reception" id="check_reception" value="1"<?php echo FreshRSS_Context::$user_conf->mark_when['reception'] ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->mark_when['reception']; ?>"/> + <?php echo _t('conf.reading.read.upon_reception'); ?> + </label> + </div> + </div> + + <div class="form-group"> + <label class="group-name"><?php echo _t('conf.reading.after_onread'); ?></label> + <div class="group-controls"> + <label class="checkbox" for="onread_jump_next"> + <input type="checkbox" name="onread_jump_next" id="onread_jump_next" value="1"<?php echo FreshRSS_Context::$user_conf->onread_jump_next ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->onread_jump_next; ?>"/> + <?php echo _t('conf.reading.jump_next'); ?> + </label> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + + </form> +</div> diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index e3ea11665..ffcfb8b29 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -1,63 +1,66 @@ -<?php $this->partial ('aside_configure'); ?> +<?php $this->partial('aside_configure'); ?> <div class="post"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> - <form method="post" action="<?php echo _url ('configure', 'sharing'); ?>"> - <legend><?php echo Minz_Translate::t ('sharing'); ?></legend> - <div class="form-group"> - <label class="group-name" for="shaarli"> - <?php echo Minz_Translate::t ('your_shaarli'); ?> - </label> - <div class="group-controls"> - <input type="url" id="shaarli" name="shaarli" class="extend" value="<?php echo $this->conf->sharing ('shaarli'); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" size="64" /> - - <?php echo FreshRSS_Themes::icon('help'); ?> <a target="_blank" href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli"><?php echo Minz_Translate::t ('more_information'); ?></a> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="wallabag"> - <?php echo Minz_Translate::t ('your_wallabag'); ?> - </label> - <div class="group-controls"> - <input type="url" id="wallabag" name="wallabag" class="extend" value="<?php echo $this->conf->sharing ('wallabag'); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" size="64" /> - - <?php echo FreshRSS_Themes::icon('help'); ?> <a target="_blank" href="http://www.wallabag.org"><?php echo Minz_Translate::t ('more_information'); ?></a> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="diaspora"> - <?php echo Minz_Translate::t ('your_diaspora_pod'); ?> - </label> - <div class="group-controls"> - <input type="url" id="diaspora" name="diaspora" class="extend" value="<?php echo $this->conf->sharing ('diaspora'); ?>" placeholder="<?php echo Minz_Translate::t ('blank_to_disable'); ?>" size="64" /> - - <?php echo FreshRSS_Themes::icon('help'); ?> <a target="_blank" href="https://diasporafoundation.org/"><?php echo Minz_Translate::t ('more_information'); ?></a> + <form method="post" action="<?php echo _url('configure', 'sharing'); ?>" + data-simple='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"><div class="stick"><input type="text" id="share_##key##_name" name="share[##key##][name]" class="extend" value="##label##" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" /> + <input type="url" id="share_##key##_url" name="share[##key##][url]" class="extend" value="" placeholder="<?php echo _t('gen.short.not_applicable'); ?>" size="64" disabled /><a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo _i('close'); ?></a></div> + <input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" /></div></div>' + data-advanced='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"> + <input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" /> + <div class="stick"> + <input type="text" id="share_##key##_name" name="share[##key##][name]" class="extend" value="" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" /> + <input type="url" id="share_##key##_url" name="share[##key##][url]" class="extend" value="" placeholder="<?php echo _t('conf.sharing.share_url'); ?>" size="64" /> + <a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo _i('close'); ?></a></div> + <a target="_blank" rel="noreferrer" class="btn" title="<?php echo _t('conf.sharing.more_information'); ?>" href="##help##"><?php echo _i('help'); ?></a> + </div></div>'> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.sharing'); ?></legend> + <?php + foreach (FreshRSS_Context::$user_conf->sharing as $key => $share_options) { + $share = FreshRSS_Share::get($share_options['type']); + $share->update($share_options); + ?> + <div class="form-group group-share" id="group-share-<?php echo $key; ?>"> + <label class="group-name"> + <?php echo $share->name(true); ?> + </label> + <div class="group-controls"> + <input type='hidden' id='share_<?php echo $key; ?>_type' name="share[<?php echo $key; ?>][type]" value='<?php echo $share->type(); ?>' /> + <div class="stick"> + <input type="text" id="share_<?php echo $key; ?>_name" name="share[<?php echo $key; ?>][name]" class="extend" value="<?php echo $share->name(); ?>" placeholder="<?php echo _t('conf.sharing.share_name'); ?>" size="64" data-leave-validation="<?php echo $share->name(); ?>"/> + <?php if ($share->formType() === 'advanced') { ?> + <input type="url" id="share_<?php echo $key; ?>_url" name="share[<?php echo $key; ?>][url]" class="extend" value="<?php echo $share->baseUrl(); ?>" placeholder="<?php echo _t('conf.sharing.share_url'); ?>" size="64" data-leave-validation="<?php echo $share->baseUrl(); ?>"/> + <?php } else { ?> + <input type="url" id="share_<?php echo $key; ?>_url" name="share[<?php echo $key; ?>][url]" class="extend" value="<?php echo $share->baseUrl(); ?>" placeholder="<?php echo _t('gen.short.not_applicable'); ?>" size="64" disabled/> + <?php } ?> + <a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo _i('close'); ?></a> + </div> + <?php if ($share->formType() === 'advanced') { ?> + <a target="_blank" rel="noreferrer" class="btn" title="<?php echo _t('conf.sharing.more_information'); ?>" href="<?php echo $share->help(); ?>"><?php echo _i('help'); ?></a> + <?php } ?> + </div> </div> - </div> + <?php } ?> <div class="form-group"> - <label class="group-name"><?php echo Minz_Translate::t ('activate_sharing'); ?></label> <div class="group-controls"> - <?php - $services = array ('twitter', 'g+', 'facebook', 'email', 'print'); - - foreach ($services as $service) { - ?> - <label class="checkbox" for="<?php echo $service; ?>"> - <input type="checkbox" name="<?php echo $service; ?>" id="<?php echo $service; ?>" value="1"<?php echo $this->conf->sharing($service) ? ' checked="checked"' : ''; ?> /> - <?php echo Minz_Translate::t ($service); ?> - </label> - <?php } ?> + <select> + <?php foreach (FreshRSS_Share::enum() as $share) { ?> + <option value='<?php echo $share->type(); ?>' data-form='<?php echo $share->formType(); ?>' data-help='<?php echo $share->help(); ?>'> + <?php echo $share->name(true); ?> + </option> + <?php } ?> + </select> + <a href='#' class='share add btn'><?php echo _i('add'); ?></a> </div> </div> <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> </div> </div> </form> diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 748a65d17..dceeb17de 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -1,7 +1,7 @@ -<?php $this->partial ('aside_configure'); ?> +<?php $this->partial('aside_configure'); ?> <div class="post"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> <datalist id="keys"> <?php foreach ($this->list_keys as $key) { ?> @@ -9,97 +9,127 @@ <?php } ?> </datalist> - <?php $s = $this->conf->shortcuts; ?> + <?php $s = FreshRSS_Context::$user_conf->shortcuts; ?> - <form method="post" action="<?php echo _url ('configure', 'shortcut'); ?>"> - <legend><?php echo Minz_Translate::t ('shortcuts_management'); ?></legend> + <form method="post" action="<?php echo _url('configure', 'shortcut'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.shortcut'); ?></legend> - <noscript><p class="alert alert-error"><?php echo Minz_Translate::t ('javascript_for_shortcuts'); ?></p></noscript> + <noscript><p class="alert alert-error"><?php echo _t('conf.shortcut.javascript'); ?></p></noscript> - <legend><?php echo Minz_Translate::t ('shortcuts_navigation'); ?></legend> + <legend><?php echo _t('conf.shortcut.navigation'); ?></legend> + + <p class="alert alert-warn"><?php echo _t('conf.shortcut.navigation_help');?></p> + + <div class="form-group"> + <label class="group-name" for="next_entry"><?php echo _t('conf.shortcut.next_article'); ?></label> + <div class="group-controls"> + <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" data-leave-validation="<?php echo $s['next_entry']; ?>"/> + </div> + </div> <div class="form-group"> - <label class="group-name" for="next_entry"><?php echo Minz_Translate::t ('next_article'); ?></label> + <label class="group-name" for="prev_entry"><?php echo _t('conf.shortcut.previous_article'); ?></label> <div class="group-controls"> - <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" /> + <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" data-leave-validation="<?php echo $s['prev_entry']; ?>"/> </div> </div> <div class="form-group"> - <label class="group-name" for="prev_entry"><?php echo Minz_Translate::t ('previous_article'); ?></label> + <label class="group-name" for="first_entry"><?php echo _t('conf.shortcut.first_article'); ?></label> <div class="group-controls"> - <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" /> + <input type="text" id="first_entry" name="shortcuts[first_entry]" list="keys" value="<?php echo $s['first_entry']; ?>" data-leave-validation="<?php echo $s['first_entry']; ?>"/> </div> </div> <div class="form-group"> - <label class="group-name" for="first_entry"><?php echo Minz_Translate::t ('first_article'); ?></label> + <label class="group-name" for="last_entry"><?php echo _t('conf.shortcut.last_article'); ?></label> <div class="group-controls"> - <input type="text" id="first_entry" name="shortcuts[first_entry]" list="keys" value="<?php echo $s['first_entry']; ?>" /> + <input type="text" id="last_entry" name="shortcuts[last_entry]" list="keys" value="<?php echo $s['last_entry']; ?>" data-leave-validation="<?php echo $s['last_entry']; ?>"/> </div> </div> + <legend><?php echo _t('conf.shortcut.article_action');?></legend> + <div class="form-group"> - <label class="group-name" for="last_entry"><?php echo Minz_Translate::t ('last_article'); ?></label> + <label class="group-name" for="mark_read"><?php echo _t('conf.shortcut.mark_read'); ?></label> <div class="group-controls"> - <input type="text" id="last_entry" name="shortcuts[last_entry]" list="keys" value="<?php echo $s['last_entry']; ?>" /> + <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" data-leave-validation="<?php echo $s['mark_read']; ?>"/> + <?php echo _t('conf.shortcut.shift_for_all_read'); ?> </div> </div> - <div><?php echo Minz_Translate::t ('shortcuts_navigation_help');?></div> + <div class="form-group"> + <label class="group-name" for="mark_favorite"><?php echo _t('conf.shortcut.mark_favorite'); ?></label> + <div class="group-controls"> + <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" data-leave-validation="<?php echo $s['mark_favorite']; ?>"/> + </div> + </div> - <legend><?php echo Minz_Translate::t ('shortcuts_article_action');?></legend> + <div class="form-group"> + <label class="group-name" for="go_website"><?php echo _t('conf.shortcut.see_on_website'); ?></label> + <div class="group-controls"> + <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" data-leave-validation="<?php echo $s['go_website']; ?>"/> + </div> + </div> <div class="form-group"> - <label class="group-name" for="mark_read"><?php echo Minz_Translate::t ('mark_read'); ?></label> + <label class="group-name" for="auto_share_shortcut"><?php echo _t('conf.shortcut.auto_share'); ?></label> <div class="group-controls"> - <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" /> - <?php echo Minz_Translate::t ('shift_for_all_read'); ?> + <input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" data-leave-validation="<?php echo $s['auto_share']; ?>"/> + <?php echo _t('conf.shortcut.auto_share_help'); ?> </div> </div> <div class="form-group"> - <label class="group-name" for="mark_favorite"><?php echo Minz_Translate::t ('mark_favorite'); ?></label> + <label class="group-name" for="collapse_entry"><?php echo _t('conf.shortcut.collapse_article'); ?></label> <div class="group-controls"> - <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" /> + <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" data-leave-validation="<?php echo $s['collapse_entry']; ?>"/> </div> </div> + <legend><?php echo _t('conf.shortcut.other_action');?></legend> + <div class="form-group"> - <label class="group-name" for="go_website"><?php echo Minz_Translate::t ('see_on_website'); ?></label> + <label class="group-name" for="load_more_shortcut"><?php echo _t('conf.shortcut.load_more'); ?></label> <div class="group-controls"> - <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" /> + <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" data-leave-validation="<?php echo $s['load_more']; ?>"/> </div> </div> <div class="form-group"> - <label class="group-name" for="auto_share_shortcut"><?php echo Minz_Translate::t ('auto_share'); ?></label> + <label class="group-name" for="focus_search_shortcut"><?php echo _t('conf.shortcut.focus_search'); ?></label> <div class="group-controls"> - <input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" /> - <?php echo Minz_Translate::t ('auto_share_help'); ?> + <input type="text" id="focus_search_shortcut" name="shortcuts[focus_search]" list="keys" value="<?php echo $s['focus_search']; ?>" data-leave-validation="<?php echo $s['focus_search']; ?>"/> </div> </div> <div class="form-group"> - <label class="group-name" for="collapse_entry"><?php echo Minz_Translate::t ('collapse_article'); ?></label> + <label class="group-name" for="user_filter_shortcut"><?php echo _t('conf.shortcut.user_filter'); ?></label> <div class="group-controls"> - <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" /> + <input type="text" id="user_filter_shortcut" name="shortcuts[user_filter]" list="keys" value="<?php echo $s['user_filter']; ?>" data-leave-validation="<?php echo $s['user_filter']; ?>"/> + <?php echo _t('conf.shortcut.user_filter_help'); ?> </div> </div> - <legend><?php echo Minz_Translate::t ('shortcuts_other_action');?></legend> + <div class="form-group"> + <label class="group-name" for="close_dropdown_shortcut"><?php echo _t('conf.shortcut.close_dropdown'); ?></label> + <div class="group-controls"> + <input type="text" id="close_dropdown" name="shortcuts[close_dropdown]" list="keys" value="<?php echo $s['close_dropdown']; ?>" data-leave-validation="<?php echo $s['close_dropdown']; ?>"/> + </div> + </div> <div class="form-group"> - <label class="group-name" for="load_more_shortcut"><?php echo Minz_Translate::t ('load_more'); ?></label> + <label class="group-name" for="help_shortcut"><?php echo _t('conf.shortcut.help'); ?></label> <div class="group-controls"> - <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" /> + <input type="text" id="help_shortcut" name="shortcuts[help]" list="keys" value="<?php echo $s['help']; ?>" data-leave-validation="<?php echo $s['help']; ?>"/> </div> </div> <div class="form-group form-actions"> <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> </div> </div> </form> diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml new file mode 100644 index 000000000..935b49fda --- /dev/null +++ b/app/views/configure/system.phtml @@ -0,0 +1,62 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('configure', 'system'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('admin.system'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="instance-name"><?php echo _t('admin.system.instance-name'); ?></label> + <div class="group-controls"> + <input type="text" class="extend" id="instance-name" name="instance-name" value="<?php echo FreshRSS_Context::$system_conf->title; ?>" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->title; ?>"/> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="auto-update-url"><?php echo _t('admin.system.auto-update-url'); ?></label> + <div class="group-controls"> + <input type="text" class="extend" id="auto-update-url" name="auto-update-url" value="<?php echo FreshRSS_Context::$system_conf->auto_update_url; ?>" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->auto_update_url; ?>"/> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="max-registrations"><?php echo _t('admin.system.registration.number'); ?></label> + <div class="group-controls"> + <input type="number" id="max-registrations" name="max-registrations" value="<?php echo FreshRSS_Context::$system_conf->limits['max_registrations']; ?>" min="0" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->limits['max_registrations']; ?>"/> + <?php echo _i('help'); ?> <?php echo _t('admin.system.registration.help'); ?> + </div> + </div> + + <div class="form-group"> + <div class="group-controls"> + <?php + $number = count(listUsers()); + echo _t($number > 1 ? 'admin.user.numbers' : 'admin.user.number', $number); + ?> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="max-feeds"><?php echo _t('admin.system.max-feeds'); ?></label> + <div class="group-controls"> + <input type="number" id="max-feeds" name="max-feeds" value="<?php echo FreshRSS_Context::$system_conf->limits['max_feeds']; ?>" min="1" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->limits['max_feeds']; ?>"/> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="max-categories"><?php echo _t('admin.system.max-categories'); ?></label> + <div class="group-controls"> + <input type="number" id="max-categories" name="max-categories" value="<?php echo FreshRSS_Context::$system_conf->limits['max_categories']; ?>" min="1" data-leave-validation="<?php echo FreshRSS_Context::$system_conf->limits['max_categories']; ?>"/> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> +</div> diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml deleted file mode 100644 index 1305feac9..000000000 --- a/app/views/configure/users.phtml +++ /dev/null @@ -1,172 +0,0 @@ -<?php $this->partial('aside_configure'); ?> - -<div class="post"> - <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a> - - <form method="post" action="<?php echo _url('users', 'auth'); ?>"> - <legend><?php echo Minz_Translate::t('login_configuration'); ?></legend> - - <div class="form-group"> - <label class="group-name" for="current_user"><?php echo Minz_Translate::t('current_user'); ?></label> - <div class="group-controls"> - <input id="current_user" type="text" disabled="disabled" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" /> - <label class="checkbox" for="is_admin"> - <input type="checkbox" id="is_admin" disabled="disabled" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? 'checked="checked" ' : ''; ?>/> - <?php echo Minz_Translate::t('is_admin'); ?> - </label> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label> - <div class="group-controls"> - <input type="password" id="passwordPlain" name="passwordPlain" autocomplete="off" pattern=".{7,}" /> - <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="mail_login"><?php echo Minz_Translate::t('persona_connection_email'); ?></label> - <?php $mail = $this->conf->mail_login; ?> - <div class="group-controls"> - <input type="email" id="mail_login" name="mail_login" class="extend" autocomplete="off" value="<?php echo $mail; ?>" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" /> - <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button> - </div> - </div> - - <?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?> - - <legend><?php echo Minz_Translate::t('auth_type'); ?></legend> - - <div class="form-group"> - <label class="group-name" for="auth_type"><?php echo Minz_Translate::t('auth_type'); ?></label> - <div class="group-controls"> - <select id="auth_type" name="auth_type" required="required"> - <?php if (!in_array(Minz_Configuration::authType(), array('form', 'persona', 'http_auth', 'none'))) { ?> - <option selected="selected"></option> - <?php } ?> - <option value="form"<?php echo Minz_Configuration::authType() === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3', '<') ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_form'); ?></option> - <option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : '', $this->conf->mail_login == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('auth_persona'); ?></option> - <option value="http_auth"<?php echo Minz_Configuration::authType() === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo Minz_Translate::t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option> - <option value="none"<?php echo Minz_Configuration::authType() === 'none' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t('auth_none'); ?></option> - </select> - </div> - </div> - - <div class="form-group"> - <div class="group-controls"> - <label class="checkbox" for="anon_access"> - <input type="checkbox" name="anon_access" id="anon_access" value="1"<?php echo Minz_Configuration::allowAnonymous() ? ' checked="checked"' : '', - Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> /> - <?php echo Minz_Translate::t('allow_anonymous', Minz_Configuration::defaultUser()); ?> - </label> - </div> - </div> - - <div class="form-group"> - <div class="group-controls"> - <label class="checkbox" for="anon_refresh"> - <input type="checkbox" name="anon_refresh" id="anon_refresh" value="1"<?php echo Minz_Configuration::allowAnonymousRefresh() ? ' checked="checked"' : '', - Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> /> - <?php echo Minz_Translate::t('allow_anonymous_refresh'); ?> - </label> - </div> - </div> - - <?php if (Minz_Configuration::canLogIn()) { ?> - <div class="form-group"> - <label class="group-name" for="token"><?php echo Minz_Translate::t('auth_token'); ?></label> - <?php $token = $this->conf->token; ?> - <div class="group-controls"> - <input type="text" id="token" name="token" value="<?php echo $token; ?>" placeholder="<?php echo Minz_Translate::t('blank_to_disable'); ?>"<?php - echo Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> /> - <?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('explain_token', Minz_Url::display(null, 'html', true), $token); ?> - </div> - </div> - <?php } ?> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button> - </div> - </div> - </form> - - <form method="post" action="<?php echo _url('users', 'delete'); ?>"> - <legend><?php echo Minz_Translate::t('users'); ?></legend> - - <div class="form-group"> - <label class="group-name" for="users_list"><?php echo Minz_Translate::t('users_list'); ?></label> - <div class="group-controls"> - <select id="users_list" name="username"><?php - foreach (listUsers() as $user) { - echo '<option>', $user, '</option>'; - } - ?></select> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-attention confirm"><?php echo Minz_Translate::t('delete'); ?></button> - </div> - </div> - </form> - - <form method="post" action="<?php echo _url('users', 'create'); ?>"> - <legend><?php echo Minz_Translate::t('create_user'); ?></legend> - - <div class="form-group"> - <label class="group-name" for="new_user_language"><?php echo Minz_Translate::t ('language'); ?></label> - <div class="group-controls"> - <select name="new_user_language" id="new_user_language"> - <?php $languages = $this->conf->availableLanguages (); ?> - <?php foreach ($languages as $short => $lib) { ?> - <option value="<?php echo $short; ?>"<?php echo $this->conf->language === $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option> - <?php } ?> - </select> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="new_user_name"><?php echo Minz_Translate::t('username'); ?></label> - <div class="group-controls"> - <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" autocomplete="off" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" /> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="new_user_passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label> - <div class="group-controls"> - <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="off" pattern=".{7,}" /> - <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript> - </div> - </div> - - <div class="form-group"> - <label class="group-name" for="new_user_email"><?php echo Minz_Translate::t('persona_connection_email'); ?></label> - <?php $mail = $this->conf->mail_login; ?> - <div class="group-controls"> - <input type="email" id="new_user_email" name="new_user_email" class="extend" autocomplete="off" placeholder="alice@example.net" /> - </div> - </div> - - <div class="form-group form-actions"> - <div class="group-controls"> - <button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('create'); ?></button> - <button type="reset" class="btn"><?php echo Minz_Translate::t('cancel'); ?></button> - </div> - </div> - - </form> - - <?php } ?> -</div> diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index c1fc32b7f..d85706669 100755 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -1,16 +1,16 @@ <?php header('Content-Type: application/json; charset=UTF-8'); -if (Minz_Request::param ('is_favorite', true)) { - Minz_Request::_param ('is_favorite', 0); -} else { - Minz_Request::_param ('is_favorite', 1); -} +$url = array( + 'c' => Minz_Request::controllerName(), + 'a' => Minz_Request::actionName(), + 'params' => Minz_Request::fetchGET(), +); -$url = Minz_Url::display (array ( - 'c' => Minz_Request::controllerName (), - 'a' => Minz_Request::actionName (), - 'params' => Minz_Request::params (), -)); +$url['params']['is_favorite'] = Minz_Request::param('is_favorite', true) ? '0' : '1'; -echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => FreshRSS_Themes::icon(Minz_Request::param ('is_favorite') ? 'non-starred' : 'starred'))); +FreshRSS::loadStylesAndScripts(); +echo json_encode(array( + 'url' => str_ireplace('&', '&', Minz_Url::display($url)), + 'icon' => _i($url['params']['is_favorite'] === '1' ? 'non-starred' : 'starred') + )); diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtml index 9e79d4c07..73977d94b 100755 --- a/app/views/entry/read.phtml +++ b/app/views/entry/read.phtml @@ -1,16 +1,16 @@ <?php header('Content-Type: application/json; charset=UTF-8'); -if (Minz_Request::param ('is_read', true)) { - Minz_Request::_param ('is_read', 0); -} else { - Minz_Request::_param ('is_read', 1); -} +$url = array( + 'c' => Minz_Request::controllerName(), + 'a' => Minz_Request::actionName(), + 'params' => Minz_Request::fetchGET(), +); -$url = Minz_Url::display (array ( - 'c' => Minz_Request::controllerName (), - 'a' => Minz_Request::actionName (), - 'params' => Minz_Request::params (), -)); +$url['params']['is_read'] = Minz_Request::param('is_read', true) ? '0' : '1'; -echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => FreshRSS_Themes::icon(Minz_Request::param ('is_read') ? 'unread' : 'read'))); +FreshRSS::loadStylesAndScripts(); +echo json_encode(array( + 'url' => str_ireplace('&', '&', Minz_Url::display($url)), + 'icon' => _i($url['params']['is_read'] === '1' ? 'unread' : 'read') + )); diff --git a/app/views/error/index.phtml b/app/views/error/index.phtml index 6a09c3aa2..fe3abf8c4 100644 --- a/app/views/error/index.phtml +++ b/app/views/error/index.phtml @@ -1,18 +1,9 @@ <div class="post"> <div class="alert alert-error"> <h1 class="alert-head"><?php echo $this->code; ?></h1> - <p> - <?php - switch(Minz_Request::param ('code')) { - case 403: - echo Minz_Translate::t ('forbidden_access'); - break; - case 404: - default: - echo Minz_Translate::t ('page_not_found'); - } ?><br /> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> + <?php echo $this->errorMessage; ?><br /> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> </p> </div> </div> diff --git a/app/views/extension/configure.phtml b/app/views/extension/configure.phtml new file mode 100644 index 000000000..8933eeae5 --- /dev/null +++ b/app/views/extension/configure.phtml @@ -0,0 +1,3 @@ +<?php + +$this->renderHelper('extension/configure'); diff --git a/app/views/extension/index.phtml b/app/views/extension/index.phtml new file mode 100644 index 000000000..7cb16bfff --- /dev/null +++ b/app/views/extension/index.phtml @@ -0,0 +1,46 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h1><?php echo _t('admin.extensions.title'); ?></h1> + + <form id="form-extension" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <?php if (!empty($this->extension_list['system'])) { ?> + <h2><?php echo _t('admin.extensions.system'); ?></h2> + <?php + foreach ($this->extension_list['system'] as $ext) { + $this->ext_details = $ext; + $this->renderHelper('extension/details'); + } + ?> + <?php } ?> + + <?php if (!empty($this->extension_list['user'])) { ?> + <h2><?php echo _t('admin.extensions.user'); ?></h2> + <?php + foreach ($this->extension_list['user'] as $ext) { + $this->ext_details = $ext; + $this->renderHelper('extension/details'); + } + ?> + <?php + } + + if (empty($this->extension_list['system']) && empty($this->extension_list['user'])) { + ?> + <p class="alert alert-warn"><?php echo _t('admin.extensions.empty_list'); ?></p> + <?php } ?> + </form> +</div> + +<?php $class = isset($this->extension) ? ' class="active"' : ''; ?> +<a href="#" id="close-slider"<?php echo $class; ?>></a> +<div id="slider"<?php echo $class; ?>> +<?php + if (isset($this->extension)) { + $this->renderHelper('extension/configure'); + } +?> +</div> diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml new file mode 100644 index 000000000..5cd59d298 --- /dev/null +++ b/app/views/feed/add.phtml @@ -0,0 +1,92 @@ +<?php if ($this->feed) { ?> +<div class="post"> + <h1><?php echo _t('sub.feed.add'); ?></h1> + + <?php if (!$this->load_ok) { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('feedback.sub.feed.internal_problem', _url('index', 'logs')); ?></p> + <?php } ?> + + <form method="post" action="<?php echo _url('feed', 'add'); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('sub.feed.informations'); ?></legend> + <?php if ($this->load_ok) { ?> + <div class="form-group"> + <label class="group-name"><?php echo _t('sub.feed.title'); ?></label> + <div class="group-controls"> + <label><?php echo $this->feed->name() ; ?></label> + </div> + </div> + + <?php $desc = $this->feed->description(); if ($desc != '') { ?> + <div class="form-group"> + <label class="group-name"><?php echo _t('sub.feed.description'); ?></label> + <div class="group-controls"> + <label><?php echo htmlspecialchars($desc, ENT_NOQUOTES, 'UTF-8'); ?></label> + </div> + </div> + <?php } ?> + + <div class="form-group"> + <label class="group-name"><?php echo _t('sub.feed.website'); ?></label> + <div class="group-controls"> + <?php echo $this->feed->website(); ?> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a> + </div> + </div> + <?php } ?> + + <div class="form-group"> + <label class="group-name" for="url"><?php echo _t('sub.feed.url'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="text" name="url_rss" id="url" class="extend" value="<?php echo $this->feed->url(); ?>" /> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a> + </div> + <a class="btn" target="_blank" rel="noreferrer" href="http://validator.w3.org/feed/check.cgi?url=<?php echo $this->feed->url(); ?>"><?php echo _t('sub.feed.validator'); ?></a> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="category"><?php echo _t('sub.category'); ?></label> + <div class="group-controls"> + <select name="category" id="category"> + <?php foreach ($this->categories as $cat) { ?> + <option value="<?php echo $cat->id(); ?>"<?php echo $cat->id() == 1 ? ' selected="selected"' : ''; ?>> + <?php echo $cat->name(); ?> + </option> + <?php } ?> + <option value="nc"><?php echo _t('sub.category.new'); ?></option> + </select> + + <span aria-hidden="true"> + <input type="text" name="new_category[name]" id="new_category_name" autocomplete="off" placeholder="<?php echo _t('sub.category.new'); ?>" /> + </span> + </div> + </div> + + <legend><?php echo _t('sub.feed.auth.http'); ?></legend> + <?php $auth = $this->feed->httpAuth(false); ?> + <div class="form-group"> + <label class="group-name" for="http_user"><?php echo _t('sub.feed.auth.username'); ?></label> + <div class="group-controls"> + <input type="text" name="http_user" id="http_user" class="extend" value="<?php echo empty($auth['username']) ? ' ' : $auth['username']; ?>" autocomplete="off" /> + </div> + + <label class="group-name" for="http_pass"><?php echo _t('sub.feed.auth.password'); ?></label> + <div class="group-controls"> + <input type="password" name="http_pass" id="http_pass" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" /> + </div> + + <div class="group-controls"> + <?php echo _i('help'); ?> <?php echo _t('sub.feed.auth.help'); ?> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> +</div> +<?php } ?> diff --git a/app/views/feed/move.phtml b/app/views/feed/move.phtml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/feed/move.phtml diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml new file mode 100644 index 000000000..49c370023 --- /dev/null +++ b/app/views/helpers/export/articles.phtml @@ -0,0 +1,66 @@ +<?php +$username = Minz_Session::param('currentUser', '_'); + +$options = 0; +if (version_compare(PHP_VERSION, '5.4.0') >= 0) { + $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; +} + +$articles = array( + 'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, + 'title' => $this->list_title, + 'author' => $username, + 'items' => array(), +); + +echo rtrim(json_encode($articles, $options), " ]}\n\r\t"), "\n"; +$first = true; + +foreach ($this->entriesRaw as $entryRaw) { + if (empty($entryRaw)) { + continue; + } + $entry = FreshRSS_EntryDAO::daoToEntry($entryRaw); + if (!isset($this->feed)) { + $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed()); + if ($feed == null) { + $feed = $entry->feed(true); + } + } else { + $feed = $this->feed; + } + + $article = array( + 'id' => $entry->guid(), + 'categories' => array_values($entry->tags()), + 'title' => $entry->title(), + 'author' => $entry->author(), + 'published' => $entry->date(true), + 'updated' => $entry->date(true), + 'alternate' => array(array( + 'href' => $entry->link(), + 'type' => 'text/html', + )), + 'content' => array( + 'content' => $entry->content(), + ), + 'origin' => array( + 'streamId' => $feed == null ? '' : $feed->id(), + 'title' => $feed == null ? '' : $feed->name(), + 'htmlUrl' => $feed == null ? '' : $feed->website(), + 'feedUrl' => $feed == null ? '' : $feed->url(), + ) + ); + + $line = json_encode($article, $options); + if ($line != '') { + if ($first) { + $first = false; + } else { + echo ",\n"; + } + echo $line; + } +} + +echo "\n]}\n"; diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml new file mode 100644 index 000000000..236cca303 --- /dev/null +++ b/app/views/helpers/export/opml.phtml @@ -0,0 +1,28 @@ +<?php + +$opml_array = array( + 'head' => array( + 'title' => FreshRSS_Context::$system_conf->title, + 'dateCreated' => date('D, d M Y H:i:s') + ), + 'body' => array() +); + +foreach ($this->categories as $key => $cat) { + $opml_array['body'][$key] = array( + 'text' => $cat['name'], + '@outlines' => array() + ); + + foreach ($cat['feeds'] as $feed) { + $opml_array['body'][$key]['@outlines'][] = array( + 'text' => htmlspecialchars_decode($feed->name()), + 'type' => 'rss', + 'xmlUrl' => htmlspecialchars_decode($feed->url()), + 'htmlUrl' => htmlspecialchars_decode($feed->website()), + 'description' => htmlspecialchars_decode($feed->description()), + ); + } +} + +echo libopml_render($opml_array); diff --git a/app/views/helpers/extension/configure.phtml b/app/views/helpers/extension/configure.phtml new file mode 100644 index 000000000..95d968aba --- /dev/null +++ b/app/views/helpers/extension/configure.phtml @@ -0,0 +1,19 @@ +<div class="post"> + <h1> + <?php echo $this->extension->getName(); ?> (<?php echo $this->extension->getVersion(); ?>) — + <?php echo $this->extension->isEnabled() ? _t('admin.extensions.enabled') + : _t('admin.extensions.disabled'); ?> + </h1> + + <p class="alert alert-warn"><?php echo $this->extension->getDescription(); ?> — <?php echo _t('gen.short.by_author', $this->extension->getAuthor()); ?></p> + + <h2><?php echo _t('gen.action.manage'); ?></h2> + <?php + $configure_view = $this->extension->getConfigureView(); + if ($configure_view !== false) { + echo $configure_view; + } else { + ?> + <p class="alert alert-warn"><?php echo _t('admin.extensions.no_configure_view'); ?></p> + <?php } ?> +</div> diff --git a/app/views/helpers/extension/details.phtml b/app/views/helpers/extension/details.phtml new file mode 100644 index 000000000..acba4e816 --- /dev/null +++ b/app/views/helpers/extension/details.phtml @@ -0,0 +1,21 @@ +<ul class="horizontal-list"> + <li class="item"> + <?php if ($this->ext_details->getType() === 'user' || FreshRSS_Auth::hasAccess('admin')) { ?> + <?php $name_encoded = urlencode($this->ext_details->getName()); ?> + <div class="stick"> + <a class="btn open-slider" href="<?php echo _url('extension', 'configure', 'e', $name_encoded); ?>"><?php echo _i('configure'); ?> <?php echo _t('gen.action.manage'); ?></a> + <?php if ($this->ext_details->isEnabled()) { ?> + <button class="btn active" form="form-extension" formaction="<?php echo _url('extension', 'disable', 'e', $name_encoded); ?>"><?php echo _t('gen.action.disable'); ?></button> + <?php } else { ?> + <button class="btn" form="form-extension" formaction="<?php echo _url('extension', 'enable', 'e', $name_encoded); ?>"><?php echo _t('gen.action.enable'); ?></button> + <?php } ?> + <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> + <button class="btn btn-attention confirm" form="form-extension" formaction="<?php echo _url('extension', 'remove', 'e', $name_encoded); ?>"><?php echo _t('gen.action.remove'); ?></button> + <?php } ?> + </div> + <?php } else { ?> + <?php echo _t('admin.extensions.system.no_rights'); ?> + <?php } ?> + </li> + <li class="item"><?php echo $this->ext_details->getName(); ?></li> +</ul> diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml new file mode 100644 index 000000000..bf87a255a --- /dev/null +++ b/app/views/helpers/feed/update.phtml @@ -0,0 +1,183 @@ +<div class="post"> + <h1><?php echo $this->feed->name(); ?></h1> + + <div> + <a href="<?php echo _url('index', 'index', 'get', 'f_' . $this->feed->id()); ?>"><?php echo _i('link'); ?> <?php echo _t('gen.action.filter'); ?></a> + <?php echo _t('gen.short.or'); ?> + <a href="<?php echo _url('stats', 'repartition', 'id', $this->feed->id()); ?>"><?php echo _i('stats'); ?> <?php echo _t('sub.feed.stats'); ?></a> + </div> + + <p><?php echo $this->feed->description(); ?></p> + + <?php $nbEntries = $this->feed->nbEntries(); ?> + + <?php if ($this->feed->inError()) { ?> + <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('sub.feed.error'); ?></p> + <?php } elseif ($nbEntries === 0) { ?> + <p class="alert alert-warn"><?php echo _t('sub.feed.empty'); ?></p> + <?php } ?> + + <form method="post" action="<?php echo _url('subscription', 'feed', 'id', $this->feed->id()); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('sub.feed.informations'); ?></legend> + <div class="form-group"> + <label class="group-name" for="name"><?php echo _t('sub.feed.title'); ?></label> + <div class="group-controls"> + <input type="text" name="name" id="name" class="extend" value="<?php echo $this->feed->name() ; ?>" /> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="description"><?php echo _t('sub.feed.description'); ?></label> + <div class="group-controls"> + <textarea name="description" id="description"><?php echo htmlspecialchars($this->feed->description(), ENT_NOQUOTES, 'UTF-8'); ?></textarea> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="website"><?php echo _t('sub.feed.website'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="text" name="website" id="website" class="extend" value="<?php echo $this->feed->website(); ?>" /> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->website(); ?>"><?php echo _i('link'); ?></a> + </div> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="url"><?php echo _t('sub.feed.url'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="text" name="url" id="url" class="extend" value="<?php echo $this->feed->url(); ?>" /> + <a class="btn" target="_blank" rel="noreferrer" href="<?php echo $this->feed->url(); ?>"><?php echo _i('link'); ?></a> + </div> + + <a class="btn" target="_blank" rel="noreferrer" href="http://validator.w3.org/feed/check.cgi?url=<?php echo rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)); ?>"><?php echo _t('sub.feed.validator'); ?></a> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="category"><?php echo _t('sub.category'); ?></label> + <div class="group-controls"> + <select name="category" id="category"> + <?php foreach ($this->categories as $cat) { ?> + <option value="<?php echo $cat->id(); ?>"<?php echo $cat->id()== $this->feed->category() ? ' selected="selected"' : ''; ?>> + <?php echo $cat->name(); ?> + </option> + <?php } ?> + </select> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="priority"><?php echo _t('sub.feed.in_main_stream'); ?></label> + <div class="group-controls"> + <label class="checkbox" for="priority"> + <input type="checkbox" name="priority" id="priority" value="10"<?php echo $this->feed->priority() > 0 ? ' checked="checked"' : ''; ?> /> + <?php echo _t('gen.short.yes'); ?> + </label> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button class="btn btn-attention confirm" + data-str-confirm="<?php echo _t('gen.js.confirm_action_feed_cat'); ?>" + formaction="<?php echo _url('feed', 'delete', 'id', $this->feed->id()); ?>" + formmethod="post"><?php echo _t('gen.action.remove'); ?></button> + </div> + </div> + + <legend><?php echo _t('sub.feed.archiving'); ?></legend> + + <div class="form-group"> + <div class="group-controls"> + <div class="stick"> + <input type="text" value="<?php echo _t('sub.feed.number_entries', $nbEntries); ?>" disabled="disabled" /> + <a class="btn" href="<?php echo _url('feed', 'actualize', 'id', $this->feed->id()); ?>"> + <?php echo _i('refresh'); ?> <?php echo _t('gen.action.actualize'); ?> + </a> + </div> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="keep_history"><?php echo _t('sub.feed.keep_history'); ?></label> + <div class="group-controls"> + <select class="number" name="keep_history" id="keep_history" required="required"><?php + foreach (array('' => '', -2 => _t('gen.short.by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) { + echo '<option value="' . $v . ($this->feed->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>'; + } + ?></select> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="ttl"><?php echo _t('sub.feed.ttl'); ?></label> + <div class="group-controls"> + <select class="number" name="ttl" id="ttl" required="required"><?php + $found = false; + foreach (array(-2 => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', + 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', + 36000 => '10h', 43200 => '12h', 64800 => '18h', + 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d', + 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo', -1 => '∞') as $v => $t) { + echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>'; + if ($this->feed->ttl() == $v) { + $found = true; + } + } + if (!$found) { + echo '<option value="' . intval($this->feed->ttl()) . '" selected="selected">' . intval($this->feed->ttl()) . 's</option>'; + } + ?></select> + </div> + </div> + <div class="form-group"> + <label class="group-name" for="pubsubhubbub"><?php echo _t('sub.feed.pubsubhubbub'); ?></label> + <div class="group-controls"> + <label class="checkbox" for="pubsubhubbub"> + <input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1"<?php echo $this->feed->pubSubHubbubEnabled() ? ' checked="checked"' : ''; ?> /> + </label> + </div> + </div> + <div class="form-group form-actions"> + <div class="group-controls"> + <button class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo _url('feed', 'truncate', 'id', $this->feed->id()); ?>"><?php echo _t('gen.action.truncate'); ?></button> + </div> + </div> + + <legend><?php echo _t('sub.feed.auth.configuration'); ?></legend> + <?php $auth = $this->feed->httpAuth(false); ?> + <div class="form-group"> + <label class="group-name" for="http_user_feed<?php echo $this->feed->id(); ?>"><?php echo _t('sub.feed.auth.username'); ?></label> + <div class="group-controls"> + <input type="text" name="http_user_feed<?php echo $this->feed->id(); ?>" id="http_user_feed<?php echo $this->feed->id(); ?>" class="extend" value="<?php echo empty($auth['username']) ? ' ' : $auth['username']; ?>" autocomplete="off" /> + <?php echo _i('help'); ?> <?php echo _t('sub.feed.auth.help'); ?> + </div> + + <label class="group-name" for="http_pass_feed<?php echo $this->feed->id(); ?>"><?php echo _t('sub.feed.auth.password'); ?></label> + <div class="group-controls"> + <input type="password" name="http_pass_feed<?php echo $this->feed->id(); ?>" id="http_pass_feed<?php echo $this->feed->id(); ?>" class="extend" value="<?php echo $auth['password']; ?>" autocomplete="off" /> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + + <legend><?php echo _t('sub.feed.advanced'); ?></legend> + <div class="form-group"> + <label class="group-name" for="path_entries"><?php echo _t('sub.feed.css_path'); ?></label> + <div class="group-controls"> + <input type="text" name="path_entries" id="path_entries" class="extend" value="<?php echo $this->feed->pathEntries(); ?>" placeholder="<?php echo _t('gen.short.blank_to_disable'); ?>" /> + <?php echo _i('help'); ?> <?php echo _t('sub.feed.css_help'); ?> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> +</div> diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml new file mode 100644 index 000000000..a9d5a80ca --- /dev/null +++ b/app/views/helpers/index/normal/entry_bottom.phtml @@ -0,0 +1,86 @@ +<?php + $sharing = array(); + if (FreshRSS_Auth::hasAccess()) { + $sharing = FreshRSS_Context::$user_conf->sharing; + } + + $bottomline_read = FreshRSS_Context::$user_conf->bottomline_read; + $bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite; + $bottomline_sharing = FreshRSS_Context::$user_conf->bottomline_sharing && (count($sharing) > 0); + $bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags; + $bottomline_date = FreshRSS_Context::$user_conf->bottomline_date; + $bottomline_link = FreshRSS_Context::$user_conf->bottomline_link; +?><ul class="horizontal-list bottom"><?php + if (FreshRSS_Auth::hasAccess()) { + if ($bottomline_read) { + ?><li class="item manage"><?php + $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id())); + if ($this->entry->isRead()) { + $arUrl['params']['is_read'] = 0; + } + ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php + echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php + ?></li><?php + } + if ($bottomline_favorite) { + ?><li class="item manage"><?php + $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id())); + if ($this->entry->isFavorite()) { + $arUrl['params']['is_favorite'] = 0; + } + ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php + echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php + ?></li><?php + } + } ?> + <li class="item"><?php + if ($bottomline_sharing) { + ?><div class="dropdown"> + <div id="dropdown-share-<?php echo $this->entry->id();?>" class="dropdown-target"></div> + <a class="dropdown-toggle" href="#dropdown-share-<?php echo $this->entry->id();?>"> + <?php echo _i('share'); ?> + <?php echo _t('index.share'); ?> + </a> + + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close">❌</a></li><?php + $link = $this->entry->link(); + $title = $this->entry->title() . ' · ' . $this->feed->name(); + foreach (FreshRSS_Context::$user_conf->sharing as $share_options) { + $share = FreshRSS_Share::get($share_options['type']); + $share_options['link'] = $link; + $share_options['title'] = $title; + $share->update($share_options); + ?><li class="item share"> + <a target="_blank" rel="noreferrer" href="<?php echo $share->url(); ?>"><?php echo $share->name(); ?></a> + </li><?php + } + ?></ul> + </div> + <?php } ?> + </li><?php + $tags = $bottomline_tags ? $this->entry->tags() : null; + if (!empty($tags)) { + ?><li class="item"> + <div class="dropdown"> + <div id="dropdown-tags-<?php echo $this->entry->id();?>" class="dropdown-target"></div> + <?php echo _i('tag'); ?> + <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $this->entry->id();?>"><?php + echo _t('index.tag.related'); + ?></a> + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close">❌</a></li><?php + foreach($tags as $tag) { + ?><li class="item"><a href="<?php echo _url('index', 'index', 'search', '#' . htmlspecialchars_decode($tag)); ?>"><?php echo $tag; ?></a></li><?php + } ?> + </ul> + </div> + </li><?php + } + if ($bottomline_date) { + ?><li class="item date"><?php echo $this->entry->date(); ?></li><?php + } + if ($bottomline_link) { + ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php + } ?> +</ul> diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml new file mode 100644 index 000000000..86298e59f --- /dev/null +++ b/app/views/helpers/index/normal/entry_header.phtml @@ -0,0 +1,33 @@ +<?php + $topline_read = FreshRSS_Context::$user_conf->topline_read; + $topline_favorite = FreshRSS_Context::$user_conf->topline_favorite; + $topline_date = FreshRSS_Context::$user_conf->topline_date; + $topline_link = FreshRSS_Context::$user_conf->topline_link; +?><ul class="horizontal-list flux_header"><?php + if (FreshRSS_Auth::hasAccess()) { + if ($topline_read) { + ?><li class="item manage"><?php + $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id())); + if ($this->entry->isRead()) { + $arUrl['params']['is_read'] = 0; + } + ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php + echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php + ?></li><?php + } + if ($topline_favorite) { + ?><li class="item manage"><?php + $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id())); + if ($this->entry->isFavorite()) { + $arUrl['params']['is_favorite'] = 0; + } + ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php + echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php + ?></li><?php + } + } + ?><li class="item website"><a href="<?php echo _url('index', 'index', 'get', 'f_' . $this->feed->id()); ?>"><img class="favicon" src="<?php echo $this->feed->favicon(); ?>" alt="✇" /> <span><?php echo $this->feed->name(); ?></span></a></li> + <li class="item title"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></li> + <?php if ($topline_date) { ?><li class="item date"><?php echo $this->entry->date(); ?> </li><?php } ?> + <?php if ($topline_link) { ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php } ?> +</ul> diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 3d7c8a98f..745baa195 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -1,52 +1,53 @@ <?php - -echo '"use strict";', "\n"; - -$mark = $this->conf->mark_when; -echo 'var ', - 'hide_posts=', ($this->conf->display_posts || Minz_Request::param('output') === 'reader') ? 'false' : 'true', - ',auto_mark_article=', $mark['article'] ? 'true' : 'false', - ',auto_mark_site=', $mark['site'] ? 'true' : 'false', - ',auto_mark_scroll=', $mark['scroll'] ? 'true' : 'false', - ',auto_load_more=', $this->conf->auto_load_more ? 'true' : 'false', - ',full_lazyload=', $this->conf->lazyload && ($this->conf->display_posts || Minz_Request::param('output') === 'reader') ? 'true' : 'false', - ',does_lazyload=', $this->conf->lazyload ? 'true' : 'false'; - -$s = $this->conf->shortcuts; -echo ',shortcuts={', - 'mark_read:"', $s['mark_read'], '",', - 'mark_favorite:"', $s['mark_favorite'], '",', - 'go_website:"', $s['go_website'], '",', - 'prev_entry:"', $s['prev_entry'], '",', - 'next_entry:"', $s['next_entry'], '",', - 'first_entry:"', $s['first_entry'], '",', - 'last_entry:"', $s['last_entry'], '",', - 'collapse_entry:"', $s['collapse_entry'], '",', - 'load_more:"', $s['load_more'], '",', - 'auto_share:"', $s['auto_share'], '"', -"},\n"; - -if (Minz_Request::param ('output') === 'global') { - echo "iconClose='", FreshRSS_Themes::icon('close'), "',\n"; -} - -$authType = Minz_Configuration::authType(); -if ($authType === 'persona') { - // If user is disconnected, current_user_mail MUST be null - $mail = Minz_Session::param ('mail', false); - if ($mail) { - echo 'current_user_mail="' . $mail . '",'; - } else { - echo 'current_user_mail=null,'; - } -} - -echo 'authType="', $authType, '",', - 'url_freshrss="', _url ('index', 'index'), '",', - 'url_login="', _url ('index', 'login'), '",', - 'url_logout="', _url ('index', 'logout'), '",'; - -echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n"; - -$autoActualise = Minz_Session::param('actualize_feeds', false); -echo 'auto_actualize_feeds=', $autoActualise ? 'true' : 'false', ";\n"; +$mark = FreshRSS_Context::$user_conf->mark_when; +$s = FreshRSS_Context::$user_conf->shortcuts; +echo htmlspecialchars(json_encode(array( + 'context' => array( + 'auto_remove_article' => !!FreshRSS_Context::isAutoRemoveAvailable(), + 'hide_posts' => !(FreshRSS_Context::$user_conf->display_posts || Minz_Request::actionName() === 'reader'), + 'display_order' => Minz_Request::param('order', FreshRSS_Context::$user_conf->sort_order), + 'auto_mark_article' => !!$mark['article'], + 'auto_mark_site' => !!$mark['site'], + 'auto_mark_scroll' => !!$mark['scroll'], + 'auto_load_more' => !!FreshRSS_Context::$user_conf->auto_load_more, + 'auto_actualize_feeds' => !!Minz_Session::param('actualize_feeds', false), + 'does_lazyload' => !!FreshRSS_Context::$user_conf->lazyload , + 'sticky_post' => !!FreshRSS_Context::isStickyPostEnabled(), + 'html5_notif_timeout' => FreshRSS_Context::$user_conf->html5_notif_timeout, + 'auth_type' => FreshRSS_Context::$system_conf->auth_type, + 'current_view' => Minz_Request::actionName(), + 'csrf' => FreshRSS_Auth::csrfToken(), + ), + 'shortcuts' => array( + 'mark_read' => @$s['mark_read'], + 'mark_favorite' => @$s['mark_favorite'], + 'go_website' => @$s['go_website'], + 'prev_entry' => @$s['prev_entry'], + 'next_entry' => @$s['next_entry'], + 'first_entry' => @$s['first_entry'], + 'last_entry' => @$s['last_entry'], + 'collapse_entry' => @$s['collapse_entry'], + 'load_more' => @$s['load_more'], + 'auto_share' => @$s['auto_share'], + 'focus_search' => @$s['focus_search'], + 'user_filter' => @$s['user_filter'], + 'help' => @$s['help'], + 'close_dropdown' => @$s['close_dropdown'], + ), + 'url' => array( + 'index' => _url('index', 'index'), + 'login' => Minz_Url::display(array('c' => 'auth', 'a' => 'login'), 'php'), + 'logout' => Minz_Url::display(array('c' => 'auth', 'a' => 'logout'), 'php'), + 'help' => FRESHRSS_WIKI, + ), + 'i18n' => array( + 'confirmation_default' => _t('gen.js.confirm_action'), + 'notif_title_articles' => _t('gen.js.feedback.title_new_articles'), + 'notif_body_articles' => _t('gen.js.feedback.body_new_articles'), + 'notif_request_failed' => _t('gen.js.feedback.request_failed'), + 'category_empty' => _t('gen.js.category_empty'), + ), + 'icons' => array( + 'close' => _i('close'), + ), +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml index e3d14810e..bf9d91f04 100755 --- a/app/views/helpers/logs_pagination.phtml +++ b/app/views/helpers/logs_pagination.phtml @@ -1,7 +1,7 @@ <?php - $c = Minz_Request::controllerName (); - $a = Minz_Request::actionName (); - $params = Minz_Request::params (); + $c = Minz_Request::controllerName(); + $a = Minz_Request::actionName(); + $params = Minz_Request::fetchGET(); ?> <?php if ($this->nbPage > 1) { ?> @@ -9,14 +9,14 @@ <?php $params[$getteur] = 1; ?> <li class="item pager-first"> <?php if ($this->currentPage > 1) { ?> - <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« <?php echo Minz_Translate::t('first'); ?></a> + <a href="<?php echo Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)); ?>">« <?php echo _t('gen.pagination.first'); ?></a> <?php } ?> </li> <?php $params[$getteur] = $this->currentPage - 1; ?> <li class="item pager-previous"> <?php if ($this->currentPage > 1) { ?> - <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ <?php echo Minz_Translate::t('previous'); ?></a> + <a href="<?php echo Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ <?php echo _t('gen.pagination.previous'); ?></a> <?php } ?> </li> @@ -24,7 +24,7 @@ <?php if($i > 0 && $i <= $this->nbPage) { ?> <?php if ($i != $this->currentPage) { ?> <?php $params[$getteur] = $i; ?> - <li class="item pager-item"><a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo $i; ?></a></li> + <li class="item pager-item"><a href="<?php echo Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo $i; ?></a></li> <?php } else { ?> <li class="item pager-current"><?php echo $i; ?></li> <?php } ?> @@ -34,13 +34,13 @@ <?php $params[$getteur] = $this->currentPage + 1; ?> <li class="item pager-next"> <?php if ($this->currentPage < $this->nbPage) { ?> - <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Minz_Translate::t('next'); ?> ›</a> + <a href="<?php echo Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo _t('gen.pagination.next'); ?> ›</a> <?php } ?> </li> <?php $params[$getteur] = $this->nbPage; ?> <li class="item pager-last"> <?php if ($this->currentPage < $this->nbPage) { ?> - <a href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Minz_Translate::t('last'); ?> »</a> + <a href="<?php echo Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo _t('gen.pagination.last'); ?> »</a> <?php } ?> </li> </ul> diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml index d4983a32e..893451af9 100755 --- a/app/views/helpers/pagination.phtml +++ b/app/views/helpers/pagination.phtml @@ -1,26 +1,45 @@ <?php - $c = Minz_Request::controllerName (); - $a = Minz_Request::actionName (); - $params = Minz_Request::params (); - $markReadUrl = Minz_Session::param ('markReadUrl'); - Minz_Session::_param ('markReadUrl', false); + $url_next = Minz_Request::currentRequest(); + $url_next['params']['next'] = FreshRSS_Context::$next_id; + $url_next['params']['state'] = FreshRSS_Context::$state; + $url_next['params']['ajax'] = 1; + + $url_mark_read = array( + 'c' => 'entry', + 'a' => 'read', + 'params' => array( + 'get' => FreshRSS_Context::currentGet(), + 'nextGet' => FreshRSS_Context::$next_get, + 'idMax' => FreshRSS_Context::$id_max, + 'search' => FreshRSS_Context::$search, + 'state' => FreshRSS_Context::$state, + ) + ); ?> +<form id="mark-read-pagination" method="post"> +<input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <ul class="pagination"> <li class="item pager-next"> - <?php if (!empty($this->nextId)) { ?> - <?php $params['next'] = $this->nextId; ?> - <a id="load_more" href="<?php echo Minz_Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Minz_Translate::t ('load_more'); ?></a> - <?php } elseif ($markReadUrl) { ?> - <a id="bigMarkAsRead" href="<?php echo $markReadUrl; ?>"> - <?php echo Minz_Translate::t ('nothing_to_load'); ?><br /> - <span class="bigTick">✔</span><br /> - <?php echo Minz_Translate::t ('mark_all_read'); ?> - </a> + <?php if (FreshRSS_Context::$next_id) { ?> + <a id="load_more" href="<?php echo Minz_Url::display($url_next); ?>"> + <?php echo _t('gen.pagination.load_more'); ?> + </a> + <?php } elseif ($url_mark_read) { ?> + <button id="bigMarkAsRead" + class="as-link <?php echo FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>" + form="mark-read-pagination" + formaction="<?php echo Minz_Url::display($url_mark_read); ?>" + type="submit"> + <?php echo _t('gen.pagination.nothing_to_load'); ?><br /> + <span class="bigTick">✓</span><br /> + <?php echo _t('gen.pagination.mark_all_read'); ?> + </button> <?php } else { ?> - <a id="bigMarkAsRead" href="."> - <?php echo Minz_Translate::t ('nothing_to_load'); ?><br /> - </a> + <a id="bigMarkAsRead" href="."> + <?php echo _t('gen.pagination.nothing_to_load'); ?><br /> + </a> <?php } ?> </li> </ul> +</form> diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml deleted file mode 100644 index db937eeae..000000000 --- a/app/views/helpers/view/global_view.phtml +++ /dev/null @@ -1,45 +0,0 @@ -<?php $this->partial ('nav_menu'); ?> - -<div id="stream" class="global categories"> -<?php - $arUrl = array('c' => 'index', 'a' => 'index', 'params' => array()); - if ($this->conf->view_mode !== 'normal') { - $arUrl['params']['output'] = 'normal'; - } - $p = Minz_Request::param('state', ''); - if (($p != '') && ($this->conf->default_view !== $p)) { - $arUrl['params']['state'] = $p; - } - - foreach ($this->cat_aside as $cat) { - $feeds = $cat->feeds (); - if (!empty ($feeds)) { -?> - <div class="box-category"> - <div class="category"> - <a data-unread="<?php echo formatNumber($cat->nbNotRead()); ?>" class="btn" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id (); echo Minz_Url::display($arUrl); ?>"> - <?php echo $cat->name(); ?> - </a> - </div> - <ul class="feeds"> - <?php foreach ($feeds as $feed) { ?> - <?php $not_read = $feed->nbNotRead (); ?> - <li id="f_<?php echo $feed->id (); ?>" class="item<?php echo $feed->inError () ? ' error' : ''; ?><?php echo $feed->nbEntries () == 0 ? ' empty' : ''; ?>"> - <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> - <a class="feed" data-unread="<?php echo formatNumber($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed->id(); echo Minz_Url::display($arUrl); ?>"> - <?php echo $feed->name(); ?> - </a> - </li> - <?php } ?> - </ul> - </div> -<?php - } - } -?> -</div> - -<div id="overlay"></div> -<div id="panel"<?php echo $this->conf->display_posts ? '' : ' class="hide_posts"'; ?>> - <a class="close" href="#"><?php echo FreshRSS_Themes::icon('close'); ?></a> -</div> diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml deleted file mode 100644 index ae93b627c..000000000 --- a/app/views/helpers/view/normal_view.phtml +++ /dev/null @@ -1,240 +0,0 @@ -<?php - -$this->partial ('aside_flux'); -$this->partial ('nav_menu'); - -if (!empty($this->entries)) { - $display_today = true; - $display_yesterday = true; - $display_others = true; - if ($this->loginOk) { - $shaarli = $this->conf->sharing ('shaarli'); - $wallabag = $this->conf->sharing ('wallabag'); - $diaspora = $this->conf->sharing ('diaspora'); - } else { - $shaarli = ''; - $wallabag = ''; - $diaspora = ''; - } - $twitter = $this->conf->sharing ('twitter'); - $google_plus = $this->conf->sharing ('g+'); - $facebook = $this->conf->sharing ('facebook'); - $email = $this->conf->sharing ('email'); - $print = $this->conf->sharing ('print'); - $hidePosts = !$this->conf->display_posts; - $lazyload = $this->conf->lazyload; - $topline_read = $this->conf->topline_read; - $topline_favorite = $this->conf->topline_favorite; - $topline_date = $this->conf->topline_date; - $topline_link = $this->conf->topline_link; - $bottomline_read = $this->conf->bottomline_read; - $bottomline_favorite = $this->conf->bottomline_favorite; - $bottomline_sharing = $this->conf->bottomline_sharing && ( - $shaarli || $wallabag || $diaspora || $twitter || - $google_plus || $facebook || $email || $print); - $bottomline_tags = $this->conf->bottomline_tags; - $bottomline_date = $this->conf->bottomline_date; - $bottomline_link = $this->conf->bottomline_link; -?> - -<div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php - ?><div id="new-article"> - <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t ('new_article'); ?></a> - </div><?php - foreach ($this->entries as $item) { - if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) { - ?><div class="day" id="day_today"><?php - echo Minz_Translate::t ('today'); - ?><span class="date"> — <?php echo timestamptodate (time (), false); ?></span><?php - ?><span class="name"><?php echo $this->currentName; ?></span><?php - ?></div><?php - $display_today = false; - } - if ($display_yesterday && $item->isDay (FreshRSS_Days::YESTERDAY, $this->today)) { - ?><div class="day" id="day_yesterday"><?php - echo Minz_Translate::t ('yesterday'); - ?><span class="date"> — <?php echo timestamptodate (time () - 86400, false); ?></span><?php - ?><span class="name"><?php echo $this->currentName; ?></span><?php - ?></div><?php - $display_yesterday = false; - } - if ($display_others && $item->isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) { - ?><div class="day" id="day_before_yesterday"><?php - echo Minz_Translate::t ('before_yesterday'); - ?><span class="name"><?php echo $this->currentName; ?></span><?php - ?></div><?php - $display_others = false; - } - ?><div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>"> - <ul class="horizontal-list flux_header"><?php - if ($this->loginOk) { - if ($topline_read) { - ?><li class="item manage"><?php - $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ())); - if ($item->isRead()) { - $arUrl['params']['is_read'] = 0; - } - ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php - echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php - ?></li><?php - } - if ($topline_favorite) { - ?><li class="item manage"><?php - $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ())); - if ($item->isFavorite()) { - $arUrl['params']['is_favorite'] = 0; - } - ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php - echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php - ?></li><?php - } - } - $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache - if (empty($feed)) $feed = $item->feed (true); - ?><li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span></a></li> - <li class="item title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></li> - <?php if ($topline_date) { ?><li class="item date"><?php echo $item->date (); ?> </li><?php } ?> - <?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php } ?> - </ul> - - <div class="flux_content"> - <div class="content"> - <h1 class="title"><?php echo $item->title (); ?></h1> - <?php - $author = $item->author (); - echo $author != '' ? '<div class="author">' . Minz_Translate::t ('by_author', $author) . '</div>' : ''; - if ($lazyload) { - echo $hidePosts ? lazyIframe(lazyimg($item->content())) : lazyimg($item->content()); - } else { - echo $item->content(); - } - ?> - </div> - <ul class="horizontal-list bottom"><?php - if ($this->loginOk) { - if ($bottomline_read) { - ?><li class="item manage"><?php - $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ())); - if ($item->isRead()) { - $arUrl['params']['is_read'] = 0; - } - ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php - echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php - ?></li><?php - } - if ($bottomline_favorite) { - ?><li class="item manage"><?php - $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ())); - if ($item->isFavorite()) { - $arUrl['params']['is_favorite'] = 0; - } - ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php - echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php - ?></li><?php - } - } ?> - <li class="item"><?php - if ($bottomline_sharing) { - $link = urlencode ($item->link ()); - $title = urlencode ($item->title () . ' · ' . $feed->name ()); - ?><div class="dropdown"> - <div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div> - <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"> - <?php echo FreshRSS_Themes::icon('share'); ?> - <?php echo Minz_Translate::t ('share'); ?> - </a> - - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close">❌</a></li> - <?php if ($shaarli) { ?> - <li class="item share"> - <a target="_blank" href="<?php echo $shaarli . '?post=' . $link . '&title=' . $title . '&source=FreshRSS'; ?>"> - <?php echo Minz_Translate::t ('shaarli'); ?> - </a> - </li> - <?php } if ($wallabag) { ?> - <li class="item share"> - <a target="_blank" href="<?php echo $wallabag . '?action=add&url=' . base64_encode (urldecode($link)); ?>"> - <?php echo Minz_Translate::t ('wallabag'); ?> - </a> - </li> - <?php } if ($diaspora) { ?> - <li class="item share"> - <a target="_blank" href="<?php echo $diaspora . '/bookmarklet?url=' . $link . '&title=' . $title; ?>"> - <?php echo Minz_Translate::t ('diaspora'); ?> - </a> - </li> - <?php } if ($twitter) { ?> - <li class="item share"> - <a target="_blank" href="https://twitter.com/share?url=<?php echo $link; ?>&text=<?php echo $title; ?>"> - <?php echo Minz_Translate::t ('twitter'); ?> - </a> - </li> - <?php } if ($google_plus) { ?> - <li class="item share"> - <a target="_blank" href="https://plus.google.com/share?url=<?php echo $link; ?>"> - <?php echo Minz_Translate::t ('g+'); ?> - </a> - </li> - <?php } if ($facebook) { ?> - <li class="item share"> - <a target="_blank" href="https://www.facebook.com/sharer.php?u=<?php echo $link; ?>&t=<?php echo $title; ?>"> - <?php echo Minz_Translate::t ('facebook'); ?> - </a> - </li> - <?php } if ($email) { ?> - <li class="item share"> - <a href="mailto:?subject=<?php echo urldecode($title); ?>&body=<?php echo $link; ?>"> - <?php echo Minz_Translate::t ('by_email'); ?> - </a> - </li> - <?php } if ($print) { ?> - <li class="item share"> - <a href="#" class="print-article"> - <?php echo Minz_Translate::t ('print'); ?> - </a> - </li> - <?php } ?> - </ul> - </div> - <?php } ?> - </li><?php - $tags = $bottomline_tags ? $item->tags() : null; - if (!empty($tags)) { - ?><li class="item"> - <div class="dropdown"> - <div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div> - <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php - echo FreshRSS_Themes::icon('tag'), Minz_Translate::t ('related_tags'); - ?></a> - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close">❌</a></li><?php - foreach($tags as $tag) { - ?><li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php - } ?> - </ul> - </div> - </li><?php - } - if ($bottomline_date) { - ?><li class="item date"><?php echo $item->date (); ?></li><?php - } - if ($bottomline_link) { - ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php - } ?> - </ul> - </div> - </div> - <?php } ?> - - <?php $this->renderHelper('pagination'); ?> -</div> - -<?php $this->partial ('nav_entries'); ?> - -<?php } else { ?> -<div id="stream" class="alert alert-warn normal"> - <span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span> - <?php echo Minz_Translate::t ('think_to_add'); ?> -</div> -<?php } ?> diff --git a/app/views/helpers/view/reader_view.phtml b/app/views/helpers/view/reader_view.phtml deleted file mode 100644 index bda96e86d..000000000 --- a/app/views/helpers/view/reader_view.phtml +++ /dev/null @@ -1,49 +0,0 @@ -<?php -$this->partial ('nav_menu'); - -if (!empty($this->entries)) { - $lazyload = $this->conf->lazyload; -?> - -<div id="stream" class="reader"> - <?php foreach ($this->entries as $item) { ?> - - <div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>"> - <div class="flux_content"> - <div class="content"> - <?php - $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache - if (empty($feed)) $feed = $item->feed (true); - ?> - <a href="<?php echo $item->link (); ?>"> - <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span> - </a> - <h1 class="title"><?php echo $item->title (); ?></h1> - - <div class="author"> - <?php $author = $item->author (); ?> - <?php echo $author != '' ? Minz_Translate::t ('by_author', $author) . ' — ' : ''; ?> - <?php echo $item->date (); ?> - </div> - - <?php - if ($lazyload) { - echo lazyimg($item->content ()); - } else { - echo $item->content(); - } - ?> - </div> - </div> - </div> - <?php } ?> - - <?php $this->renderHelper('pagination'); ?> -</div> - -<?php } else { ?> -<div id="stream" class="alert alert-warn reader"> - <span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span> - <?php echo Minz_Translate::t ('think_to_add'); ?> -</div> -<?php } ?> diff --git a/app/views/importExport/export.phtml b/app/views/importExport/export.phtml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/importExport/export.phtml diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml new file mode 100644 index 000000000..c5049e3ea --- /dev/null +++ b/app/views/importExport/index.phtml @@ -0,0 +1,63 @@ +<?php $this->partial('aside_subscription'); ?> + +<div class="post "> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('importExport', 'import'); ?>" enctype="multipart/form-data"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('sub.import_export.import'); ?></legend> + <div class="form-group"> + <label class="group-name" for="file"> + <?php echo extension_loaded('zip') ? _t('sub.import_export.file_to_import') : _t('sub.import_export.file_to_import_no_zip'); ?> + </label> + <div class="group-controls"> + <input type="file" name="file" id="file" /> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.import'); ?></button> + </div> + </div> + </form> + + <?php if (count($this->feeds) > 0) { ?> + <form method="post" action="<?php echo _url('importExport', 'export'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('sub.import_export.export'); ?></legend> + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="export_opml"> + <input type="checkbox" name="export_opml" id="export_opml" value="1" checked="checked" /> + <?php echo _t('sub.import_export.export_opml'); ?> + </label> + + <label class="checkbox" for="export_starred"> + <input type="checkbox" name="export_starred" id="export_starred" value="1" <?php echo extension_loaded('zip') ? 'checked="checked"' : ''; ?> /> + <?php echo _t('sub.import_export.export_starred'); ?> + </label> + + <?php + $select_args = ''; + if (extension_loaded('zip')) { + $select_args = ' size="' . min(10, count($this->feeds)) .'" multiple="multiple"'; + } + ?> + <select name="export_feeds[]"<?php echo $select_args; ?> size="10"> + <?php echo extension_loaded('zip') ? '' : '<option></option>'; ?> + <?php foreach ($this->feeds as $feed) { ?> + <option value="<?php echo $feed->id(); ?>"><?php echo $feed->name(); ?></option> + <?php } ?> + </select> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.export'); ?></button> + </div> + </div> + </form> + <?php } ?> +</div> diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml index 76ff804d8..3fdb5160d 100644 --- a/app/views/index/about.phtml +++ b/app/views/index/about.phtml @@ -1,27 +1,24 @@ <div class="post content"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> - <h1><?php echo Minz_Translate::t ('about_freshrss'); ?></h1> + <h1><?php echo _t('index.about'); ?></h1> <dl class="infos"> - <dt><?php echo Minz_Translate::t ('project_website'); ?></dt> + <dt><?php echo _t('index.about.project_website'); ?></dt> <dd><a href="<?php echo FRESHRSS_WEBSITE; ?>"><?php echo FRESHRSS_WEBSITE; ?></a></dd> - <dt><?php echo Minz_Translate::t ('lead_developer'); ?></dt> - <dd><a href="mailto:contact@marienfressinaud.fr">Marien Fressinaud</a> — <a href="http://marienfressinaud.fr"><?php echo Minz_Translate::t ('website'); ?></a></dd> + <dt><?php echo _t('index.about.bugs_reports'); ?></dt> + <dd><?php echo _t('index.about.github'); ?></dd> - <dt><?php echo Minz_Translate::t ('bugs_reports'); ?></dt> - <dd><?php echo Minz_Translate::t ('github_or_email'); ?></dd> + <dt><?php echo _t('index.about.license'); ?></dt> + <dd><?php echo _t('index.about.agpl3'); ?></dd> - <dt><?php echo Minz_Translate::t ('license'); ?></dt> - <dd><?php echo Minz_Translate::t ('agpl3'); ?></dd> - - <dt><?php echo Minz_Translate::t ('version'); ?></dt> + <dt><?php echo _t('index.about.version'); ?></dt> <dd><?php echo FRESHRSS_VERSION; ?></dd> </dl> - <p><?php echo Minz_Translate::t ('freshrss_description'); ?></p> + <p><?php echo _t('index.about.freshrss_description'); ?></p> - <h1><?php echo Minz_Translate::t ('credits'); ?></h1> - <p><?php echo Minz_Translate::t ('credits_content'); ?></p> + <h1><?php echo _t('index.about.credits'); ?></h1> + <p><?php echo _t('index.about.credits_content'); ?></p> </div> diff --git a/app/views/index/formLogin.phtml b/app/views/index/formLogin.phtml deleted file mode 100644 index cc925ea59..000000000 --- a/app/views/index/formLogin.phtml +++ /dev/null @@ -1,32 +0,0 @@ -<div class="prompt"> - <h1><?php echo Minz_Translate::t('login'); ?></h1><?php - - switch (Minz_Configuration::authType()) { - case 'form': - ?><form id="loginForm" method="post" action="<?php echo _url('index', 'formLogin'); ?>"> - <div> - <label for="username"><?php echo Minz_Translate::t('username'); ?></label> - <input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" /> - </div> - <div> - <label for="passwordPlain"><?php echo Minz_Translate::t('password'); ?></label> - <input type="password" id="passwordPlain" required="required" /> - <input type="hidden" id="challenge" name="challenge" /><br /> - <noscript><strong><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></strong></noscript> - </div> - <div> - <button id="loginButton" type="submit" class="btn btn-important"><?php echo Minz_Translate::t('login'); ?></button> - </div> - </form><?php - break; - - case 'persona': - ?><p> - <?php echo FreshRSS_Themes::icon('login'); ?> - <a class="signin" href="#"><?php echo Minz_Translate::t('login_with_persona'); ?></a> - </p><?php - break; - } ?> - - <p><a href="<?php echo _url('index', 'about'); ?>"><?php echo Minz_Translate::t('about_freshrss'); ?></a></p> -</div> diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml new file mode 100644 index 000000000..f35732c8f --- /dev/null +++ b/app/views/index/global.phtml @@ -0,0 +1,57 @@ +<?php + $this->partial('nav_menu'); + + $class = ''; + if (FreshRSS_Context::$user_conf->hide_read_feeds && + FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && + !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) { + $class = ' state_unread'; + } +?> + +<div id="stream" class="global<?php echo $class; ?>"> +<?php + $params = Minz_Request::fetchGET(); + unset($params['c']); + unset($params['a']); + $url_base = array( + 'c' => 'index', + 'a' => 'normal', + 'params' => $params, + ); + + foreach ($this->categories as $cat) { + $feeds = $cat->feeds(); + $url_base['params']['get'] = 'c_' . $cat->id(); + + if (!empty($feeds)) { +?> + <div class="box category" data-unread="<?php echo $cat->nbNotRead(); ?>"> + <div class="box-title"><a class="title" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $cat->name(); ?></a></div> + + <ul class="box-content"> + <?php + foreach ($feeds as $feed) { + $nb_not_read = $feed->nbNotRead(); + $error = $feed->inError() ? ' error' : ''; + $empty = $feed->nbEntries() === 0 ? ' empty' : ''; + $url_base['params']['get'] = 'f_' . $feed->id(); + ?> + <li id="f_<?php echo $feed->id(); ?>" class="item feed<?php echo $error, $empty; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>" data-priority="<?php echo $feed->priority(); ?>"> + <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> + <a class="item-title" data-unread="<?php echo format_number($feed->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $feed->name(); ?></a> + </li> + <?php } ?> + </ul> + </div> +<?php + } + } +?> +</div> + +<div id="overlay"> + <a class="close" href="#"><?php echo _i('close'); ?></a> +</div> +<div id="panel"<?php echo FreshRSS_Context::$user_conf->display_posts ? '' : ' class="hide_posts"'; ?>> +</div> diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 1ff36ca8e..e69de29bb 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -1,25 +0,0 @@ -<?php - -$output = Minz_Request::param ('output', 'normal'); - -if ($this->loginOk || Minz_Configuration::allowAnonymous()) { - if ($output === 'normal') { - $this->renderHelper ('view/normal_view'); - } elseif ($output === 'reader') { - $this->renderHelper ('view/reader_view'); - } elseif ($output === 'global') { - $this->renderHelper ('view/global_view'); - } elseif ($output === 'rss') { - $this->renderHelper ('view/rss_view'); - } else { - Minz_Request::_param ('output', 'normal'); - $output = 'normal'; - $this->renderHelper ('view/normal_view'); - } -} elseif ($output === 'rss') { - // token has already been checked in the controller so we can show the view - $this->renderHelper ('view/rss_view'); -} else { - // Normally, it should not happen, but log it anyway - Minz_Log::record ('Something is wrong in ' . __FILE__ . ' line ' . __LINE__, Minz_Log::ERROR); -} diff --git a/app/views/index/login.phtml b/app/views/index/login.phtml deleted file mode 100644 index cc814deff..000000000 --- a/app/views/index/login.phtml +++ /dev/null @@ -1 +0,0 @@ -<?php print_r ($this->res); ?> diff --git a/app/views/index/logout.phtml b/app/views/index/logout.phtml deleted file mode 100644 index a0aba9318..000000000 --- a/app/views/index/logout.phtml +++ /dev/null @@ -1 +0,0 @@ -OK
\ No newline at end of file diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml index 1b77b39af..a88f89278 100644 --- a/app/views/index/logs.phtml +++ b/app/views/index/logs.phtml @@ -1,25 +1,26 @@ <div class="post content"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> - <h1><?php echo Minz_Translate::t ('logs'); ?></h1> - <form method="post" action="<?php echo _url ('index', 'logs'); ?>"><p> + <h1><?php echo _t('index.log'); ?></h1> + <form method="post" action="<?php echo _url('index', 'logs'); ?>"><p> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> <input type="hidden" name="clearLogs" /> - <button type="submit" class="btn"><?php echo Minz_Translate::t ('clear_logs'); ?></button> + <button type="submit" class="btn"><?php echo _t('index.log.clear'); ?></button> </p></form> - <?php $items = $this->logsPaginator->items (); ?> + <?php $items = $this->logsPaginator->items(); ?> - <?php if (!empty ($items)) { ?> - <div class="logs"> - <?php $this->logsPaginator->render ('logs_pagination.phtml', 'page'); ?> + <?php if (!empty($items)) { ?> + <div class="loglist"> + <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?> <?php foreach ($items as $log) { ?> - <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo @date ('Y-m-d H:i:s', @strtotime ($log->date ())); ?></span><?php echo htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></div> + <div class="log <?php echo $log->level(); ?>"><span class="date"><?php echo @date('Y-m-d H:i:s', @strtotime($log->date())); ?></span><?php echo htmlspecialchars($log->info(), ENT_NOQUOTES, 'UTF-8'); ?></div> <?php } ?> - <?php $this->logsPaginator->render ('logs_pagination.phtml','page'); ?> + <?php $this->logsPaginator->render('logs_pagination.phtml','page'); ?> </div> <?php } else { ?> - <p class="alert alert-warn"><?php echo Minz_Translate::t ('logs_empty'); ?></p> + <p class="alert alert-warn"><?php echo _t('index.log.empty'); ?></p> <?php } ?> </div> diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml new file mode 100644 index 000000000..6fda11ed9 --- /dev/null +++ b/app/views/index/normal.phtml @@ -0,0 +1,93 @@ +<?php + +$this->partial('aside_feed'); +$this->partial('nav_menu'); + +if (!empty($this->entries)) { + $display_today = true; + $display_yesterday = true; + $display_others = true; + $hidePosts = !FreshRSS_Context::$user_conf->display_posts; + $lazyload = FreshRSS_Context::$user_conf->lazyload; + $content_width = FreshRSS_Context::$user_conf->content_width; + + $today = @strtotime('today'); +?> + +<div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php + ?><div id="new-article"> + <a href="<?php echo Minz_Url::display(Minz_Request::currentRequest()); ?>"><?php echo _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a> + </div><?php + foreach ($this->entries as $item) { + $this->entry = Minz_ExtensionManager::callHook('entry_before_display', $item); + if (is_null($this->entry)) { + continue; + } + + // We most likely already have the feed object in cache + $this->feed = FreshRSS_CategoryDAO::findFeed($this->categories, $this->entry->feed()); + if ($this->feed == null) { + $this->feed = $this->entry->feed(true); + if ($this->feed == null) { + $this->feed = FreshRSS_Feed::example(); + } + } + + if ($display_today && $this->entry->isDay(FreshRSS_Days::TODAY, $today)) { + ?><div class="day" id="day_today"><?php + echo _t('gen.date.today'); + ?><span class="date"> — <?php echo timestamptodate(time(), false); ?></span><?php + ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php + ?></div><?php + $display_today = false; + } + if ($display_yesterday && $this->entry->isDay(FreshRSS_Days::YESTERDAY, $today)) { + ?><div class="day" id="day_yesterday"><?php + echo _t('gen.date.yesterday'); + ?><span class="date"> — <?php echo timestamptodate(time() - 86400, false); ?></span><?php + ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php + ?></div><?php + $display_yesterday = false; + } + if ($display_others && $this->entry->isDay(FreshRSS_Days::BEFORE_YESTERDAY, $today)) { + ?><div class="day" id="day_before_yesterday"><?php + echo _t('gen.date.before_yesterday'); + ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php + ?></div><?php + $display_others = false; + } + ?><div class="flux<?php echo !$this->entry->isRead() ? ' not_read' : ''; + ?><?php echo $this->entry->isFavorite() ? ' favorite' : ''; + ?>" id="flux_<?php echo $this->entry->id(); + ?>" data-feed="<?php echo $this->feed->id(); + ?>"><?php + + $this->renderHelper('index/normal/entry_header'); + + ?><div class="flux_content"> + <div class="content <?php echo $content_width; ?>"> + <h1 class="title"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></h1> + <?php + $author = $this->entry->author(); + echo $author != '' ? '<div class="author">' . _t('gen.short.by_author', $author) . '</div>' : '', + $lazyload && $hidePosts ? lazyimg($this->entry->content()) : $this->entry->content(); + ?> + </div><?php + + $this->renderHelper('index/normal/entry_bottom'); + + ?></div> + </div><?php + } + + $this->renderHelper('pagination'); +?></div> + +<?php $this->partial('nav_entries'); ?> + +<?php } else { ?> +<div id="stream" class="prompt alert alert-warn normal"> + <h2><?php echo _t('index.feed.empty'); ?></h2> + <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.feed.add'); ?></a><br /><br /> +</div> +<?php } ?> diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml new file mode 100644 index 000000000..a19ee322e --- /dev/null +++ b/app/views/index/reader.phtml @@ -0,0 +1,47 @@ +<?php +$this->partial('nav_menu'); + +if (!empty($this->entries)) { + $lazyload = FreshRSS_Context::$user_conf->lazyload; + $content_width = FreshRSS_Context::$user_conf->content_width; +?> + +<div id="stream" class="reader"><?php + foreach ($this->entries as $item) { + $item = Minz_ExtensionManager::callHook('entry_before_display', $item); + if (is_null($item)) { + continue; + } + ?><div class="flux<?php echo !$item->isRead() ? ' not_read' : ''; ?><?php echo $item->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id(); ?>"> + <div class="flux_content"> + <div class="content <?php echo $content_width; ?>"> + <?php + $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed()); //We most likely already have the feed object in cache + if (empty($feed)) $feed = $item->feed(true); + ?> + <a href="<?php echo $item->link(); ?>"> + <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span> + </a> + <h1 class="title"><?php echo $item->title(); ?></h1> + + <div class="author"><?php + $author = $item->author(); + echo $author != '' ? _t('gen.short.by_author', $author) . ' — ' : '', + $item->date(); + ?></div> + + <?php echo $item->content(); ?> + </div> + </div> + </div> + <?php } ?> + + <?php $this->renderHelper('pagination'); ?> +</div> + +<?php } else { ?> +<div id="stream" class="prompt alert alert-warn reader"> + <h2><?php echo _t('index.feed.empty'); ?></h2> + <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.feed.add'); ?></a><br /><br /> +</div> +<?php } ?> diff --git a/app/views/helpers/view/rss_view.phtml b/app/views/index/rss.phtml index 620bf1388..86074517c 100755 --- a/app/views/helpers/view/rss_view.phtml +++ b/app/views/index/rss.phtml @@ -3,25 +3,25 @@ <channel> <title><?php echo $this->rss_title; ?></title> <link><?php echo Minz_Url::display(null, 'html', true); ?></link> - <description><?php echo Minz_Translate::t ('rss_feeds_of', $this->rss_title); ?></description> + <description><?php echo _t('index.feed.rss_of', $this->rss_title); ?></description> <pubDate><?php echo date('D, d M Y H:i:s O'); ?></pubDate> <lastBuildDate><?php echo gmdate('D, d M Y H:i:s'); ?> GMT</lastBuildDate> - <atom:link href="<?php echo Minz_Url::display ($this->rss_url, 'html', true); ?>" rel="self" type="application/rss+xml" /> + <atom:link href="<?php echo Minz_Url::display($this->url, 'html', true); ?>" rel="self" type="application/rss+xml" /> <?php foreach ($this->entries as $item) { ?> <item> - <title><?php echo $item->title (); ?></title> - <link><?php echo $item->link (); ?></link> - <?php $author = $item->author (); ?> + <title><?php echo $item->title(); ?></title> + <link><?php echo $item->link(); ?></link> + <?php $author = $item->author(); ?> <?php if ($author != '') { ?> <dc:creator><?php echo $author; ?></dc:creator> <?php } ?> <description><![CDATA[<?php - echo $item->content (); + echo $item->content(); ?>]]></description> - <pubDate><?php echo date('D, d M Y H:i:s O', $item->date (true)); ?></pubDate> - <guid isPermaLink="false"><?php echo $item->id (); ?></guid> + <pubDate><?php echo date('D, d M Y H:i:s O', $item->date(true)); ?></pubDate> + <guid isPermaLink="false"><?php echo $item->id(); ?></guid> </item> <?php } ?> diff --git a/app/views/index/stats.phtml b/app/views/index/stats.phtml deleted file mode 100644 index b5c18813d..000000000 --- a/app/views/index/stats.phtml +++ /dev/null @@ -1,125 +0,0 @@ -<div class="post content"> - <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> - - <h1><?php echo Minz_Translate::t ('stats'); ?></h1> - - <div class="stat"> - <h2><?php echo Minz_Translate::t ('stats_entry_repartition'); ?></h2> - <table> - <thead> - <tr> - <th> </th> - <th><?php echo Minz_Translate::t ('main_stream'); ?></th> - <th><?php echo Minz_Translate::t ('all_feeds'); ?></th> - </tr> - </thead> - <tbody> - <tr> - <th><?php echo Minz_Translate::t ('status_total'); ?></th> - <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['total']); ?></td> - <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['total']); ?></td> - </tr> - <tr> - <th><?php echo Minz_Translate::t ('status_read'); ?></th> - <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['read']); ?></td> - <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['read']); ?></td> - </tr> - <tr> - <th><?php echo Minz_Translate::t ('status_unread'); ?></th> - <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['unread']); ?></td> - <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['unread']); ?></td> - </tr> - <tr> - <th><?php echo Minz_Translate::t ('status_favorites'); ?></th> - <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['favorite']); ?></td> - <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['favorite']); ?></td> - </tr> - </tbody> - </table> - </div> - - <div class="stat"> - <h2><?php echo Minz_Translate::t ('stats_entry_per_day'); ?></h2> - <div id="statsEntryPerDay" style="height: 300px"></div> - </div> - - <div class="stat"> - <h2><?php echo Minz_Translate::t ('stats_feed_per_category'); ?></h2> - <div id="statsFeedPerCategory" style="height: 300px"></div> - <div id="statsFeedPerCategoryLegend"></div> - </div> - - <div class="stat"> - <h2><?php echo Minz_Translate::t ('stats_entry_per_category'); ?></h2> - <div id="statsEntryPerCategory" style="height: 300px"></div> - <div id="statsEntryPerCategoryLegend"></div> - </div> - - <div class="stat"> - <h2><?php echo Minz_Translate::t ('stats_top_feed'); ?></h2> - <table> - <thead> - <tr> - <th><?php echo Minz_Translate::t ('feed'); ?></th> - <th><?php echo Minz_Translate::t ('category'); ?></th> - <th><?php echo Minz_Translate::t ('stats_entry_count'); ?></th> - </tr> - </thead> - <tbody> - <?php foreach ($this->topFeed as $feed): ?> - <tr> - <td><?php echo $feed['name']; ?></td> - <td><?php echo $feed['category']; ?></td> - <td class="numeric"><?php echo formatNumber($feed['count']); ?></td> - </tr> - <?php endforeach;?> - </tbody> - </table> - </div> -</div> - -<script> -"use strict"; -function initStats() { - if (!window.Flotr) { - if (window.console) { - console.log('FreshRSS waiting for Flotr…'); - } - window.setTimeout(initStats, 50); - return; - } - // Entry per day - Flotr.draw(document.getElementById('statsEntryPerDay'), - [<?php echo $this->count ?>], - { - grid: {verticalLines: false}, - bars: {horizontal: false, show: true}, - xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0}, - yaxis: {min: 0}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} - }); - // Feed per category - Flotr.draw(document.getElementById('statsFeedPerCategory'), - <?php echo $this->feedByCategory ?>, - { - grid: {verticalLines: false, horizontalLines: false}, - pie: {explode: 10, show: true, labelFormatter: function(){return '';}}, - xaxis: {showLabels: false}, - yaxis: {showLabels: false}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}}, - legend: {container: document.getElementById('statsFeedPerCategoryLegend'), noColumns: 3} - }); - // Entry per category - Flotr.draw(document.getElementById('statsEntryPerCategory'), - <?php echo $this->entryByCategory ?>, - { - grid: {verticalLines: false, horizontalLines: false}, - pie: {explode: 10, show: true, labelFormatter: function(){return '';}}, - xaxis: {showLabels: false}, - yaxis: {showLabels: false}, - mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}}, - legend: {container: document.getElementById('statsEntryPerCategoryLegend'), noColumns: 3} - }); -} -initStats(); -</script> diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index 3b12ad774..3baabf748 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -1,55 +1,13 @@ -"use strict"; -var feeds = [<?php - foreach ($this->feeds as $feed) { - echo "'", Minz_Url::display(array('c' => 'feed', 'a' => 'actualize', 'params' => array('id' => $feed->id(), 'ajax' => '1')), 'php'), "',\n"; - } - ?>], - feed_processed = 0, - feed_count = feeds.length; - -function initProgressBar(init) { - if (init) { - $("body").after("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\ - <?php echo Minz_Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feed_count + "</span><br />\ - <progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feed_count + "\"></progress>\ - </div>"); - } else { - window.location.reload(); - } -} -function updateProgressBar(i) { - $("#actualizeProgressBar").val(i); - $("#actualizeProgress .progress").html(i + " / " + feed_count); -} - -function updateFeeds() { - if (feed_count === 0) { - openNotification("<?php echo Minz_Translate::t ('no_feed_to_refresh'); ?>", "good"); - return; - } - initProgressBar(true); - - for (var i = 0; i < 10; i++) { - updateFeed(); - } -} - -function updateFeed() { - var feed = feeds.pop(); - if (feed == undefined) { - return; - } - $.ajax({ - type: 'POST', - url: feed, - }).complete(function (data) { - feed_processed++; - updateProgressBar(feed_processed); - - if (feed_processed === feed_count) { - initProgressBar(false); - } else { - updateFeed(); - } - }); -} +<?php +$feeds = array(); +foreach ($this->feeds as $feed) { + $feeds[] = array( + 'url' => Minz_Url::display(array('c' => 'feed', 'a' => 'actualize', 'params' => array('id' => $feed->id(), 'ajax' => '1')), 'php'), + 'title' => $feed->name(), + ); +} +echo json_encode(array( + 'feeds' => $feeds, + 'feedback_no_refresh' => _t('feedback.sub.feed.no_refresh'), + 'feedback_actualize' => _t('feedback.sub.actualize'), +)); diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml new file mode 100644 index 000000000..88c78d465 --- /dev/null +++ b/app/views/stats/idle.phtml @@ -0,0 +1,49 @@ +<?php $this->partial('aside_stats'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h1><?php echo _t('admin.stats.idle'); ?></h1> + + <?php + $current_url = Minz_Url::display( + array('c' => 'stats', 'a' => 'idle'), + 'php', true + ); + $nothing = true; + foreach ($this->idleFeeds as $period => $feeds) { + if (!empty($feeds)) { + $nothing = false; + ?> + <div class="stat"> + <h2><?php echo _t('gen.date.' . $period); ?></h2> + + <form id="form-delete" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <?php foreach ($feeds as $feed) { ?> + <ul class="horizontal-list"> + <li class="item"> + <div class="stick"> + <a class="btn" href="<?php echo _url('index', 'index', 'get', 'f_' . $feed['id']); ?>"><?php echo _i('link'); ?> <?php echo _t('gen.action.filter'); ?></a> + <a class="btn" href="<?php echo _url('subscription', 'index', 'id', $feed['id']); ?>"><?php echo _i('configure'); ?> <?php echo _t('gen.action.manage'); ?></a> + <button class="btn btn-attention confirm" form="form-delete" formaction="<?php echo _url('feed', 'delete', 'id', $feed['id'], 'r', $current_url); ?>"><?php echo _t('gen.action.remove'); ?></button> + </div> + </li> + <li class="item"> + <span title="<?php echo timestamptodate($feed['last_date'], false); ?>"><?php echo $feed['name']; ?> (<?php echo _t('admin.stats.number_entries', $feed['nb_articles']); ?>)</span> + </li> + </ul> + <?php } ?> + </form> + </div> + <?php + } + } + + if ($nothing) { + ?> + <p class="alert alert-warn"> + <span class="alert-head"><?php echo _t('admin.stats.no_idle'); ?></span> + </p> + <?php } ?> +</div> diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml new file mode 100644 index 000000000..a36f812a8 --- /dev/null +++ b/app/views/stats/index.phtml @@ -0,0 +1,93 @@ +<?php $this->partial('aside_stats'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h1><?php echo _t('admin.stats.main'); ?></h1> + + <div class="stat half"> + <h2><?php echo _t('admin.stats.entry_repartition'); ?></h2> + <table> + <thead> + <tr> + <th> </th> + <th><?php echo _t('admin.stats.main_stream'); ?></th> + <th><?php echo _t('admin.stats.all_feeds'); ?></th> + </tr> + </thead> + <tbody> + <tr> + <th><?php echo _t('admin.stats.status_total'); ?></th> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['total']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['total']); ?></td> + </tr> + <tr> + <th><?php echo _t('admin.stats.status_read'); ?></th> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_reads']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_reads']); ?></td> + </tr> + <tr> + <th><?php echo _t('admin.stats.status_unread'); ?></th> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_unreads']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_unreads']); ?></td> + </tr> + <tr> + <th><?php echo _t('admin.stats.status_favorites'); ?></th> + <td class="numeric"><?php echo format_number($this->repartition['main_stream']['count_favorites']); ?></td> + <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['count_favorites']); ?></td> + </tr> + </tbody> + </table> + </div><!-- + + --><div class="stat half"> + <h2><?php echo _t('admin.stats.top_feed'); ?></h2> + <table> + <thead> + <tr> + <th><?php echo _t('admin.stats.feed'); ?></th> + <th><?php echo _t('admin.stats.category'); ?></th> + <th><?php echo _t('admin.stats.entry_count'); ?></th> + <th><?php echo _t('admin.stats.percent_of_total'); ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($this->topFeed as $feed) { ?> + <tr> + <td><a href="<?php echo _url('stats', 'repartition', 'id', $feed['id']); ?>"><?php echo $feed['name']; ?></a></td> + <td><?php echo $feed['category']; ?></td> + <td class="numeric"><?php echo format_number($feed['count']); ?></td> + <td class="numeric"><?php echo format_number($feed['count'] / $this->repartition['all_feeds']['total'] * 100, 1);?></td> + </tr> + <?php } ?> + </tbody> + </table> + </div> + + <div class="stat"> + <h2><?php echo _t('admin.stats.entry_per_day'); ?></h2> + <div id="statsEntryPerDay" class="statGraph"></div> + </div> + + <div class="stat half"> + <h2><?php echo _t('admin.stats.feed_per_category'); ?></h2> + <div id="statsFeedPerCategory" class="statGraph"></div> + <div id="statsFeedPerCategoryLegend"></div> + </div> + + <div class="stat half"> + <h2><?php echo _t('admin.stats.entry_per_category'); ?></h2> + <div id="statsEntryPerCategory" class="statGraph"></div> + <div id="statsEntryPerCategoryLegend"></div> + </div> +</div> + +<script id="jsonStats" type="application/json"><?php +echo htmlspecialchars(json_encode(array( + 'average' => $this->average, + 'dataCount' => $this->count, + 'feedByCategory' => $this->feedByCategory, + 'entryByCategory' => $this->entryByCategory, +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); +?></script> +<script src="../scripts/stats.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/stats.js'); ?>"></script> diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml new file mode 100644 index 000000000..5ebcdce5a --- /dev/null +++ b/app/views/stats/repartition.phtml @@ -0,0 +1,74 @@ +<?php $this->partial('aside_stats'); ?> + +<div class="post "> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h1><?php echo _t('admin.stats.repartition'); ?></h1> + + <select id="feed_select" class="select-change"> + <option data-url="<?php echo _url('stats', 'repartition')?>"><?php echo _t('admin.stats.all_feeds')?></option> + <?php foreach ($this->categories as $category) { + $feeds = $category->feeds(); + if (!empty($feeds)) { + echo '<optgroup label="', $category->name(), '">'; + foreach ($feeds as $feed) { + if ($this->feed && $feed->id() == $this->feed->id()) { + echo '<option value="', $feed->id(), '" selected="selected" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>'; + } else { + echo '<option value="', $feed->id(), '" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>'; + } + } + echo '</optgroup>'; + } + }?> + </select> + + <?php if ($this->feed) {?> + <a class="btn" href="<?php echo _url('subscription', 'index', 'id', $this->feed->id()); ?>"> + <?php echo _i('configure'); ?> <?php echo _t('gen.action.manage'); ?> + </a> + <?php }?> + + <div class="stat"> + <table> + <tr> + <th><?php echo _t('admin.stats.status_total'); ?></th> + <th><?php echo _t('admin.stats.status_read'); ?></th> + <th><?php echo _t('admin.stats.status_unread'); ?></th> + <th><?php echo _t('admin.stats.status_favorites'); ?></th> + </tr> + <tr> + <td class="numeric"><?php echo $this->repartition['total']; ?></td> + <td class="numeric"><?php echo $this->repartition['count_reads']; ?></td> + <td class="numeric"><?php echo $this->repartition['count_unreads']; ?></td> + <td class="numeric"><?php echo $this->repartition['count_favorites']; ?></td> + </tr> + </table> + </div> + + <div class="stat"> + <h2><?php echo _t('admin.stats.entry_per_hour', $this->averageHour); ?></h2> + <div id="statsEntryPerHour" class="statGraph"></div> + </div> + + <div class="stat half"> + <h2><?php echo _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek); ?></h2> + <div id="statsEntryPerDayOfWeek" class="statGraph"></div> + </div> + + <div class="stat half"> + <h2><?php echo _t('admin.stats.entry_per_month', $this->averageMonth); ?></h2> + <div id="statsEntryPerMonth" class="statGraph"></div> + </div> +</div> + +<script id="jsonRepartition" type="application/json"><?php +echo htmlspecialchars(json_encode(array( + 'repartitionHour' => $this->repartitionHour, + 'repartitionDayOfWeek' => $this->repartitionDayOfWeek, + 'days' => $this->days, + 'repartitionMonth' => $this->repartitionMonth, + 'months' => $this->months, +), JSON_UNESCAPED_UNICODE), ENT_NOQUOTES); +?></script> +<script src="../scripts/repartition.js?<?php echo @filemtime(PUBLIC_PATH . '/scripts/repartition.js'); ?>"></script> diff --git a/app/views/subscription/feed.phtml b/app/views/subscription/feed.phtml new file mode 100644 index 000000000..60664fdee --- /dev/null +++ b/app/views/subscription/feed.phtml @@ -0,0 +1,15 @@ +<?php + +if (!Minz_Request::param('ajax')) { + $this->partial('aside_subscription'); +} + +if ($this->feed) { + $this->renderHelper('feed/update'); +} else { +?> +<div class="alert alert-warn"> + <span class="alert-head"><?php echo _t('sub.feed.no_selected'); ?></span> + <?php echo _t('sub.feed.think_to_add'); ?> +</div> +<?php } ?> diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml new file mode 100644 index 000000000..48f760d3e --- /dev/null +++ b/app/views/subscription/index.phtml @@ -0,0 +1,153 @@ +<?php $this->partial('aside_subscription'); ?> + +<div class="post drop-section"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h2><?php echo _t('sub.title'); ?></h2> + + <form id="add_rss" method="post" action="<?php echo _url('feed', 'add'); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <div class="stick"> + <input type="url" name="url_rss" class="long" placeholder="<?php echo _t('sub.feed.add'); ?>" /> + <div class="dropdown"> + <div id="dropdown-cat" class="dropdown-target"></div> + + <a class="dropdown-toggle btn" href="#dropdown-cat"><?php echo _i('down'); ?></a> + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close">❌</a></li> + + <li class="dropdown-header"><?php echo _t('sub.category'); ?></li> + + <li class="input"> + <select name="category" id="category"> + <?php foreach ($this->categories as $cat) { ?> + <option value="<?php echo $cat->id(); ?>"<?php echo $cat->id() == 1 ? ' selected="selected"' : ''; ?>> + <?php echo $cat->name(); ?> + </option> + <?php } ?> + <option value="nc"><?php echo _t('sub.category.new'); ?></option> + </select> + </li> + + <li class="input" aria-hidden="true"> + <input type="text" name="new_category[name]" id="new_category_name" autocomplete="off" placeholder="<?php echo _t('sub.category.new'); ?>" /> + </li> + + <li class="separator"></li> + + <li class="dropdown-header"><?php echo _t('sub.feed.auth.http'); ?></li> + <li class="input"> + <input type="text" name="http_user" id="http_user_feed" value=" " autocomplete="off" placeholder="<?php echo _t('sub.feed.auth.username'); ?>" /> + </li> + <li class="input"> + <input type="password" name="http_pass" id="http_pass_feed" autocomplete="off" placeholder="<?php echo _t('sub.feed.auth.password'); ?>" /> + </li> + </ul> + </div> + <button class="btn" type="submit"><?php echo _i('add'); ?></button> + </div> + </form> + + <p class="alert alert-warn"> + <?php echo _t('sub.feed.moved_category_deleted', $this->default_category->name()); ?> + </p> + + <div class="box"> + <div class="box-title"><label for="new-category"><?php echo _t('sub.category.add'); ?></label></div> + + <ul class="box-content box-content-centered"> + <form action="<?php echo _url('category', 'create'); ?>" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <li class="item"><input type="text" id="new-category" name="new-category" placeholder="<?php echo _t('sub.category.new'); ?>" /></li> + <li class="item"><button class="btn btn-important" type="submit"><?php echo _t('gen.action.submit'); ?></button></li> + </form> + </ul> + </div> + + <form id="controller-category" method="post" aria-hidden="true"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + </form> + + <?php + foreach ($this->categories as $cat) { + $feeds = $cat->feeds(); + ?> + <div class="box"> + <div class="box-title"> + <form action="<?php echo _url('category', 'update', 'id', $cat->id()); ?>" method="post"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <input type="text" name="name" value="<?php echo $cat->name(); ?>" /> + + <div class="dropdown"> + <div id="dropdown-cat-<?php echo $cat->id(); ?>" class="dropdown-target"></div> + + <a class="dropdown-toggle btn" href="#dropdown-cat-<?php echo $cat->id(); ?>"><?php echo _i('down'); ?></a> + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close">❌</a></li> + + <li class="item"><a href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id()); ?>"><?php echo _t('gen.action.filter'); ?></a></li> + + <?php + $no_feed = empty($feeds); + $is_default = ($cat->id() === $this->default_category->id()); + + if (!$no_feed || !$is_default) { + ?> + <li class="separator"></li> + <?php } if (!$no_feed) { ?> + <li class="item"> + <button class="as-link confirm" + data-str-confirm="<?php echo _t('gen.js.confirm_action_feed_cat'); ?>" + type="submit" + form="controller-category" + formaction="<?php echo _url('category', 'empty', 'id', $cat->id()); ?>"> + <?php echo _t('gen.action.empty'); ?></button> + </li> + <?php } if (!$is_default) { ?> + <li class="item"> + <button class="as-link confirm" + data-str-confirm="<?php echo _t('gen.js.confirm_action_feed_cat'); ?>" + type="submit" + form="controller-category" + formaction="<?php echo _url('category', 'delete', 'id', $cat->id()); ?>"> + <?php echo _t('gen.action.remove'); ?></button> + </li> + <?php } ?> + </ul> + </div> + </form> + </div> + + <ul class="box-content" data-cat-id="<?php echo $cat->id(); ?>"> + <?php if (!empty($feeds)) { ?> + <?php + foreach ($feeds as $feed) { + $error = $feed->inError() ? ' error' : ''; + $empty = $feed->nbEntries() == 0 ? ' empty' : ''; + ?> + <li class="item feed<?php echo $error, $empty; ?>" + draggable="true" + data-feed-id="<?php echo $feed->id(); ?>" + dropzone="move"> + <a class="configure open-slider" href="<?php echo _url('subscription', 'feed', 'id', $feed->id()); ?>"><?php echo _i('configure'); ?></a> + <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <?php echo $feed->name(); ?> + </li> + <?php } + } else { + ?> + <li class="item disabled" dropzone="move"><?php echo _t('sub.category.empty'); ?></li> + <?php } ?> + </ul> + </div> + <?php } ?> +</div> + +<?php $class = isset($this->feed) ? ' class="active"' : ''; ?> +<a href="#" id="close-slider"<?php echo $class; ?>></a> +<div id="slider"<?php echo $class; ?>> +<?php + if (isset($this->feed)) { + $this->renderHelper('feed/update'); + } +?> +</div> diff --git a/app/views/update/apply.phtml b/app/views/update/apply.phtml new file mode 100644 index 000000000..8221929ae --- /dev/null +++ b/app/views/update/apply.phtml @@ -0,0 +1,9 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h1><?php echo _t('admin.update'); ?></h1> + + <?php ask_info_update(); ?> +</div> diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml new file mode 100644 index 000000000..543ab43de --- /dev/null +++ b/app/views/update/checkInstall.phtml @@ -0,0 +1,38 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h2><?php echo _t('admin.check_install.php'); ?></h2> + + <?php foreach ($this->status_php as $key => $status) { ?> + <p class="alert <?php echo $status ? 'alert-success' : 'alert-error'; ?>"> + <?php + if ($key === 'php') { + echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok'), PHP_VERSION, '5.3.3'); + } else { + echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok')); + } + ?> + </p> + <?php } ?> + + <h2><?php echo _t('admin.check_install.files'); ?></h2> + + <?php foreach ($this->status_files as $key => $status) { ?> + <p class="alert <?php echo $status ? 'alert-success' : 'alert-error'; ?>"> + <?php echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok')); ?> + </p> + <?php } ?> + + <?php /* + <h2><?php echo _t('admin.check_install.database'); ?></h2> + + <?php foreach ($this->status_database as $key => $status) { ?> + <p class="alert <?php echo $status ? 'alert-success' : 'alert-error'; ?>"> + <?php echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok')); ?> + </p> + <?php } ?> + */ ?> + +</div> diff --git a/app/views/update/index.phtml b/app/views/update/index.phtml new file mode 100644 index 000000000..da1bc7ef5 --- /dev/null +++ b/app/views/update/index.phtml @@ -0,0 +1,34 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <h1><?php echo _t('admin.update'); ?></h1> + + <p> + <?php echo _i('help'); ?> <?php echo _t('admin.update.current_version', FRESHRSS_VERSION); ?> + </p> + + <p> + <?php echo _t('admin.update.last', $this->last_update_time); ?> + </p> + + <?php if (!empty($this->message)) { ?> + <p class="alert <?php echo $this->message['status'] === 'bad' ? 'alert-error' : 'alert-warn'; ?>"> + <span class="alert-head"><?php echo $this->message['title']; ?></span> + <?php echo $this->message['body']; ?> + </p> + <?php } ?> + + <?php + if (empty($this->message) || $this->message['status'] !== 'good') { + ?> + <p> + <a href="<?php echo _url('update', 'check'); ?>" class="btn"><?php echo _t('admin.update.check'); ?></a> + </p> + <?php } ?> + + <?php if ($this->update_to_apply) { ?> + <a class="btn btn-important" href="<?php echo _url('update', 'apply'); ?>"><?php echo _t('admin.update.apply'); ?></a> + <?php } ?> +</div> diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml new file mode 100644 index 000000000..a32247d14 --- /dev/null +++ b/app/views/user/manage.phtml @@ -0,0 +1,74 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('user', 'create'); ?>" autocomplete="off"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('admin.user.create'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="new_user_language"><?php echo _t('admin.user.language'); ?></label> + <div class="group-controls"> + <select name="new_user_language" id="new_user_language"> + <?php $languages = Minz_Translate::availableLanguages(); ?> + <?php foreach ($languages as $lang) { ?> + <option value="<?php echo $lang; ?>"<?php echo FreshRSS_Context::$user_conf->language === $lang ? ' selected="selected"' : ''; ?>><?php echo _t('gen.lang.' . $lang); ?></option> + <?php } ?> + </select> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="new_user_name"><?php echo _t('admin.user.username'); ?></label> + <div class="group-controls"> + <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" autocomplete="off" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" /> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="new_user_passwordPlain"><?php echo _t('admin.user.password_form'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="new-password" pattern=".{7,}" /> + <a class="btn toggle-password" data-toggle="new_user_passwordPlain"><?php echo _i('key'); ?></a> + </div> + <?php echo _i('help'); ?> <?php echo _t('admin.user.password_format'); ?> + <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.create'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> + + <form method="post" action="<?php echo _url('user', 'delete'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('admin.user.users'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="user-list"><?php echo _t('admin.user.user_list'); ?></label> + <div class="group-controls"> + <select id="user-list" class="select-change" name="username"> + <?php foreach (listUsers() as $username) { ?> + <option data-url="<?php echo _url('user', 'manage', 'u', $username); ?>" <?php echo $this->current_user === $username ? 'selected="selected"' : ''; ?> value="<?php echo $username; ?>"><?php echo $username; ?></option> + <?php } ?> + </select> + + <p><?php echo _t('admin.user.articles_and_size', + format_number($this->nb_articles), + format_bytes($this->size_user)); ?></p> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-attention confirm"><?php echo _t('gen.action.remove'); ?></button> + </div> + </div> + </form> +</div> diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml new file mode 100644 index 000000000..429375e44 --- /dev/null +++ b/app/views/user/profile.phtml @@ -0,0 +1,85 @@ +<?php $this->partial('aside_configure'); ?> + +<div class="post"> + <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a> + + <form method="post" action="<?php echo _url('user', 'profile'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.profile'); ?></legend> + + <div class="form-group"> + <label class="group-name" for="current_user"><?php echo _t('conf.user.current'); ?></label> + <div class="group-controls"> + <input id="current_user" type="text" disabled="disabled" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" /> + <label class="checkbox" for="is_admin"> + <input type="checkbox" id="is_admin" disabled="disabled" <?php echo FreshRSS_Auth::hasAccess('admin') ? 'checked="checked" ' : ''; ?>/> + <?php echo _t('conf.user.is_admin'); ?> + </label> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="newPasswordPlain"><?php echo _t('conf.profile.password_form'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="password" id="newPasswordPlain" name="newPasswordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> + <a class="btn toggle-password" data-toggle="newPasswordPlain"><?php echo _i('key'); ?></a> + </div> + <?php echo _i('help'); ?> <?php echo _t('conf.profile.password_format'); ?> + <noscript><b><?php echo _t('gen.js.should_be_activated'); ?></b></noscript> + </div> + </div> + + <?php if (FreshRSS_Context::$system_conf->api_enabled) { ?> + <div class="form-group"> + <label class="group-name" for="apiPasswordPlain"><?php echo _t('conf.profile.password_api'); ?></label> + <div class="group-controls"> + <div class="stick"> + <input type="password" id="apiPasswordPlain" name="apiPasswordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/> + <a class="btn toggle-password" data-toggle="apiPasswordPlain"><?php echo _i('key'); ?></a> + </div> + <?php echo _i('help'); ?> <kbd><a href="../api/"><?php echo Minz_Url::display('/api/greader.php', 'html', true); ?></a></kbd> + </div> + </div> + <?php } ?> + + <div class="form-group form-actions"> + <div class="group-controls"> + <button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button> + <button type="reset" class="btn"><?php echo _t('gen.action.cancel'); ?></button> + </div> + </div> + </form> + + <?php if (!FreshRSS_Auth::hasAccess('admin')) { ?> + <form id="crypto-form" method="post" action="<?php echo _url('user', 'delete'); ?>"> + <input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" /> + <legend><?php echo _t('conf.profile.delete'); ?></legend> + + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.attention'); ?></span> <?php echo _t('conf.profile.delete.warn'); ?></p> + + <div class="form-group"> + <label class="group-name" for="passwordPlain"><?php echo _t('gen.auth.password'); ?></label> + <div class="group-controls"> + <input type="password" id="passwordPlain" required="required" /> + <input type="hidden" id="challenge" name="challenge" /><br /> + <noscript><strong><?php echo _t('gen.js.should_be_activated'); ?></strong></noscript> + </div> + </div> + + <div class="form-group form-actions"> + <div class="group-controls"> + <?php + $redirect_url = urlencode(Minz_Url::display( + array('c' => 'user', 'a' => 'profile'), + 'php', true + )); + ?> + <input type="hidden" name="r" value="<?php echo $redirect_url; ?>" /> + <input type="hidden" name="username" id="username" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" /> + <button type="submit" class="btn btn-attention confirm"><?php echo _t('gen.action.remove'); ?></button> + </div> + </div> + </form> + <?php } ?> +</div> |
