From 2da7c05fa6768b95a5cd0bd1c8f9934bbff05a03 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 6 Dec 2014 17:15:20 +0100 Subject: Update i18n (extensions) See https://github.com/FreshRSS/FreshRSS/issues/252 --- app/i18n/en/admin.php | 5 +++++ app/i18n/en/feedback.php | 8 ++++++++ app/i18n/en/gen.php | 7 +++++++ app/i18n/fr/admin.php | 5 +++++ app/i18n/fr/feedback.php | 8 ++++++++ app/i18n/fr/gen.php | 7 +++++++ 6 files changed, 40 insertions(+) (limited to 'app/i18n') diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 74f01ae06..d73775d96 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -86,6 +86,11 @@ return array( 'ok' => 'You have ZIP extension.', ), ), + 'extensions' => array( + 'empty_list' => 'There is no installed extension', + 'system' => 'System extension (you have no rights on it)', + 'title' => 'Extensions', + ), 'users' => array( 'articles_and_size' => '%s articles (%s)', ), diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index b3866f1dc..df1dc5725 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -1,6 +1,14 @@ array( + 'already_enabled' => '%s is already enabled', + 'disabled' => '%s is now disabled', + 'enabled' => '%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', + ), 'login' => array( 'error' => 'Login is invalid', 'success' => 'You are connected', diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 9e06357bc..ba5f0c86d 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -190,10 +190,17 @@ return array( 'freshrss_installation' => 'Installation · FreshRSS', 'fri' => 'Fri', 'g+' => 'Google+', + 'actions' => array( + 'disable' => 'Disable', + 'enable' => 'Enable', + 'manage' => 'Manage', + 'remove' => 'Remove', + ), 'menu' => array( 'admin' => 'Administration', 'authentication' => 'Authentication', 'check_install' => 'Installation checking', + 'extensions' => 'Extensions', 'user_management' => 'Manage users', 'user_profile' => 'Profile', ), diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index ad1fae6c0..e46a5a7b0 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -86,6 +86,11 @@ return array( 'ok' => 'Vous disposez de l\'extension ZIP.', ), ), + 'extensions' => array( + 'empty_list' => 'Il n’y a aucune extension installée.', + 'system' => 'Extension système (vous n’avez aucun droit dessus)', + 'title' => 'Extensions', + ), 'users' => array( 'articles_and_size' => '%s articles (%s)', ), diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index f4bb7cccf..7d3ab9db7 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -1,6 +1,14 @@ array( + 'already_enabled' => '%s est déjà activée', + 'disabled' => '%s est désormais désactivée', + 'enabled' => '%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', + ), 'login' => array( 'error' => 'L’identifiant est invalide !', 'success' => 'Vous êtes désormais connecté', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 0b2395bd0..44d8fb837 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -191,10 +191,17 @@ return array( 'freshrss_installation' => 'Installation · FreshRSS', 'fri' => 'ven.', 'g+' => 'Google+', + 'actions' => array( + 'disable' => 'Désactiver', + 'enable' => 'Activer', + 'manage' => 'Gérer', + 'remove' => 'Supprimer', + ), 'menu' => array( 'admin' => 'Administration', 'authentication' => 'Authentification', 'check_install' => 'Vérification de l’installation', + 'extensions' => 'Extensions', 'user_management' => 'Gestion des utilisateurs', 'user_profile' => 'Profil', ), -- cgit v1.2.3 From 67aa7e76c186e43a5e0290ed2c512791c7a3005c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 13 Dec 2014 10:01:31 +0100 Subject: Fix strings and url on auth configuration page --- app/i18n/en/admin.php | 2 +- app/i18n/fr/admin.php | 2 +- app/views/auth/index.phtml | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'app/i18n') diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 26af23225..083cabfed 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -12,7 +12,7 @@ return array( 'title' => 'Authentication', 'title_reset' => 'Authentication reset', 'token' => 'Authentication token', - 'token_help' => 'Allows to access RSS output of the default user without authentication.
%s?output=rss&token=%s', + 'token_help' => 'Allows to access RSS output of the default user without authentication:', 'type' => 'Authentication method', 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ', ), diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index a0d173b0c..1d327a33c 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -12,7 +12,7 @@ return array( '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.
%s?output=rss&token=%s', + '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 : ', ), diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml index 420937042..ee1e2d8b9 100644 --- a/app/views/auth/index.phtml +++ b/app/views/auth/index.phtml @@ -47,7 +47,7 @@ /> - p/i/?a=formLogin&u=Alice&p=1234 + 'auth', 'a' => 'login', 'params' => array('u' => 'alice', 'p' => '1234')), 'html', true); ?> @@ -59,7 +59,8 @@
/> - + + array('output' => 'rss', 'token' => $token)), 'html', true); ?>
-- cgit v1.2.3 From 039a83759d41615aaa593fa62deff4c25fc126a2 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 28 Dec 2014 17:42:46 +0100 Subject: Fix install.php to consider new data organization - Introduce USERS_PATH - Remove LOG_PATH - Use join_path in install.php - Change references to old data files to the new ones - Update i18n See https://github.com/FreshRSS/FreshRSS/issues/729 --- app/i18n/en/install.php | 9 +++++---- app/i18n/fr/install.php | 9 +++++---- app/install.php | 49 +++++++++++++++++++++++++++---------------------- constants.php | 2 +- 4 files changed, 38 insertions(+), 31 deletions(-) (limited to 'app/i18n') diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index ed3210190..e8073e8b6 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -3,6 +3,7 @@ return array( 'action' => array( 'finish' => 'Complete installation', + 'fix_errors_before' => 'Fix errors before skip to the next step.', 'next_step' => 'Go to the next step', ), 'auth' => array( @@ -57,10 +58,6 @@ return array( 'nok' => 'Please check that you are not altering your HTTP REFERER.', 'ok' => 'Your HTTP REFERER is known and corresponds to your server.', ), - 'logs' => array( - 'nok' => 'Check permissions on ./data/logs directory. HTTP server must have rights to write into', - 'ok' => 'Permissions on logs directory are good.', - ), 'minz' => array( 'nok' => 'You lack the Minz framework.', 'ok' => 'You have the Minz framework.', @@ -81,6 +78,10 @@ return 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 ./data/users directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on users directory are good.', + ), ), 'conf' => array( '_' => 'General configuration', diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.php index f1ef2ea3f..d1b78ffb6 100644 --- a/app/i18n/fr/install.php +++ b/app/i18n/fr/install.php @@ -3,6 +3,7 @@ return array( 'action' => array( 'finish' => 'Terminer l’installation', + 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l’étape suivante.', 'next_step' => 'Passer à l’étape suivante', ), 'auth' => array( @@ -57,10 +58,6 @@ return array( 'nok' => 'Veuillez vérifier que vous ne modifiez pas votre HTTP REFERER.', 'ok' => 'Le HTTP REFERER est connu et semble correspondre à votre serveur.', ), - 'logs' => array( - 'nok' => 'Veuillez vérifier les droits sur le répertoire ./data/logs. Le serveur HTTP doit être capable d’écrire dedans', - 'ok' => 'Les droits sur le répertoire des logs sont bons.', - ), 'minz' => array( 'nok' => 'Vous ne disposez pas de la librairie Minz.', 'ok' => 'Vous disposez du framework Minz', @@ -81,6 +78,10 @@ return 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 ./data/users. Le serveur HTTP doit être capable d’écrire dedans', + 'ok' => 'Les droits sur le répertoire des utilisateurs sont bons.', + ), ), 'conf' => array( '_' => 'Configuration générale', diff --git a/app/install.php b/app/install.php index 8091a9eb0..8b65fbb6f 100644 --- a/app/install.php +++ b/app/install.php @@ -132,12 +132,17 @@ function saveStep2() { 'token' => $token, ); - $configPath = DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'; - @unlink($configPath); //To avoid access-rights problems - file_put_contents($configPath, " PDO::ERRMODE_EXCEPTION, ); @@ -229,7 +234,7 @@ function newPdo() { } function deleteInstall() { - $res = unlink(DATA_PATH . '/do-install.txt'); + $res = unlink(join_path(DATA_PATH, 'do-install.txt')); if (!$res) { return false; @@ -270,7 +275,7 @@ function checkStep0() { function checkStep1() { $php = version_compare(PHP_VERSION, '5.2.1') >= 0; - $minz = file_exists(LIB_PATH . '/Minz'); + $minz = file_exists(join_path(LIB_PATH, 'Minz')); $curl = extension_loaded('curl'); $pdo_mysql = extension_loaded('pdo_mysql'); $pdo_sqlite = extension_loaded('pdo_sqlite'); @@ -280,9 +285,9 @@ function checkStep1() { $dom = class_exists('DOMDocument'); $data = DATA_PATH && is_writable(DATA_PATH); $cache = CACHE_PATH && is_writable(CACHE_PATH); - $log = LOG_PATH && is_writable(LOG_PATH); - $favicons = is_writable(DATA_PATH . '/favicons'); - $persona = is_writable(DATA_PATH . '/persona'); + $users = USERS_PATH && is_writable(USERS_PATH); + $favicons = is_writable(join_path(DATA_PATH, 'favicons')); + $persona = is_writable(join_path(DATA_PATH, 'persona')); $http_referer = is_referer_from_same_domain(); return array( @@ -297,12 +302,12 @@ function checkStep1() { 'dom' => $dom ? 'ok' : 'ko', 'data' => $data ? 'ok' : 'ko', 'cache' => $cache ? 'ok' : 'ko', - 'log' => $log ? 'ok' : 'ko', + 'users' => $users ? 'ok' : 'ko', 'favicons' => $favicons ? 'ok' : 'ko', 'persona' => $persona ? 'ok' : 'ko', 'http_referer' => $http_referer ? 'ok' : 'ko', 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && - $data && $cache && $log && $favicons && $persona && $http_referer ? + $data && $cache && $users && $favicons && $persona && $http_referer ? 'ok' : 'ko' ); } @@ -327,7 +332,7 @@ function checkStep2() { if ($defaultUser === null) { $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user']; } - $data = is_writable(DATA_PATH . '/' . $defaultUser . '_user.php'); + $data = is_writable(join_path(USERS_PATH, $defaultUser, 'config.php')); return array( 'conf' => $conf ? 'ok' : 'ko', @@ -339,7 +344,7 @@ function checkStep2() { } function checkStep3() { - $conf = is_writable(DATA_PATH . '/config.php'); + $conf = is_writable(join_path(DATA_PATH, 'config.php')); $bd = isset($_SESSION['bd_type']) && isset($_SESSION['bd_host']) && @@ -382,7 +387,7 @@ function checkBD() { $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base']; break; case 'sqlite': - $str = 'sqlite:' . DATA_PATH . '/' . $_SESSION['default_user'] . '.sqlite'; + $str = 'sqlite:' . join_path(USERS_PATH, $_SESSION['default_user'], 'db.sqlite'); $driver_options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ); @@ -414,7 +419,7 @@ function checkBD() { } if (!$ok) { - @unlink(DATA_PATH . '/config.php'); + @unlink(join_path(DATA_PATH, 'config.php')); } return $ok; @@ -470,7 +475,7 @@ function printStep1() {

-

+

@@ -516,10 +521,10 @@ function printStep1() {

- -

+ +

-

+

diff --git a/constants.php b/constants.php index f66a012b0..07dd6f18e 100644 --- a/constants.php +++ b/constants.php @@ -16,7 +16,7 @@ define('FRESHRSS_PATH', dirname(__FILE__)); define('DATA_PATH', FRESHRSS_PATH . '/data'); define('UPDATE_FILENAME', DATA_PATH . '/update.php'); - define('LOG_PATH', DATA_PATH . '/log'); + define('USERS_PATH', DATA_PATH . '/users'); define('CACHE_PATH', DATA_PATH . '/cache'); define('LIB_PATH', FRESHRSS_PATH . '/lib'); -- cgit v1.2.3 From 249a474703259a3e2b7e9064ed2052c20c207a8c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 28 Dec 2014 19:59:07 +0100 Subject: Fix i18n for check installation Add keys for user directory checking See https://github.com/FreshRSS/FreshRSS/issues/729 --- app/i18n/en/admin.php | 8 ++++---- app/i18n/fr/admin.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app/i18n') diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 083cabfed..5653453df 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -63,10 +63,6 @@ return array( 'nok' => 'You lack JSON (php5-json package).', 'ok' => 'You have JSON extension.', ), - 'logs' => array( - 'nok' => 'Check permissions on ./data/logs directory. HTTP server must have rights to write into', - 'ok' => 'Permissions on logs directory are good.', - ), 'minz' => array( 'nok' => 'You lack the Minz framework.', 'ok' => 'You have the Minz framework.', @@ -97,6 +93,10 @@ return array( 'nok' => 'Check permissions on ./data/tokens directory. HTTP server must have rights to write into', 'ok' => 'Permissions on tokens directory are good.', ), + 'users' => array( + 'nok' => 'Check permissions on ./data/users directory. HTTP server must have rights to write into', + 'ok' => 'Permissions on users directory are good.', + ), 'zip' => array( 'nok' => 'You lack ZIP extension (php5-zip package).', 'ok' => 'You have ZIP extension.', diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index 1d327a33c..7a4215722 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -63,10 +63,6 @@ return array( 'nok' => 'Vous ne disposez pas de JSON (paquet php5-json).', 'ok' => 'Vous disposez de l\'extension JSON.', ), - 'logs' => array( - 'nok' => 'Veuillez vérifier les droits sur le répertoire ./data/logs. Le serveur HTTP doit être capable d’écrire dedans', - 'ok' => 'Les droits sur le répertoire des logs sont bons.', - ), 'minz' => array( 'nok' => 'Vous ne disposez pas de la librairie Minz.', 'ok' => 'Vous disposez du framework Minz', @@ -97,6 +93,10 @@ return array( 'nok' => 'Veuillez vérifier les droits sur le répertoire ./data/tokens. 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 ./data/users. 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 php5-zip).', 'ok' => 'Vous disposez de l\'extension ZIP.', -- cgit v1.2.3 From 0140448a562b97859be0b9a6e480e1f6aa4d1b1d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 7 Jan 2015 14:59:18 +0100 Subject: Refactor FreshRSS_Share object to be more usable - FreshRSS_Share is the only object we manipulate - Add a way to register new share options easily - Move some i18n keys from index.php to gen.php See https://github.com/FreshRSS/FreshRSS/issues/730 --- app/FreshRSS.php | 3 + app/Models/Share.php | 232 +++++++++++++++++++++++++++++++++++--- app/i18n/en/gen.php | 11 ++ app/i18n/en/index.php | 13 +-- app/i18n/fr/conf.php | 2 +- app/i18n/fr/gen.php | 11 ++ app/i18n/fr/index.php | 13 +-- app/views/configure/sharing.phtml | 27 +++-- app/views/index/normal.phtml | 28 +++-- p/scripts/main.js | 2 +- 10 files changed, 272 insertions(+), 70 deletions(-) (limited to 'app/i18n') diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 06976c88b..254e35fee 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -32,6 +32,9 @@ class FreshRSS extends Minz_FrontController { FreshRSS_Context::init(); $this->initI18n(); + + FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php')); + $this->loadStylesAndScripts(); $this->loadNotifications(); $this->loadExtensions(); diff --git a/app/Models/Share.php b/app/Models/Share.php index b146db722..db6feda19 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -1,44 +1,240 @@ $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])) { + continue; + } + + $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)) { + 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( - $selected['url'], - self::transformData($title, self::getTransform($share, 'title')), - self::transformData($link, self::getTransform($share, 'link')), + $this->base_url, + $this->title(), + $this->link(), ); - $url = str_replace($matches, $replaces, $share['url']); - return $url; + return str_replace($matches, $replaces, $this->url_transform); } - static private function transformData($data, $transform) { - if (!is_array($transform)) { - return $data; + /** + * Return the title. + * @param $raw true if we should get the title without transformations. + */ + public function title($raw = false) { + if ($raw) { + return $this->title; } - if (count($transform) === 0) { + + 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; } - static private function getTransform($options, $type) { - $transform = $options['transform']; - - if (array_key_exists($type, $transform)) { - return $transform[$type]; + /** + * 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 $transform; + return $this->transform; } - } diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 43f94f1bc..4a6f8a71b 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -128,6 +128,17 @@ return array( 'nothing_to_load' => 'There are no more articles', 'previous' => 'Previous', ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Email', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'print' => 'Print', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), 'short' => array( 'attention' => 'Attention!', 'blank_to_disable' => 'Leave blank to disable', diff --git a/app/i18n/en/index.php b/app/i18n/en/index.php index 941388b68..8e7d81db8 100644 --- a/app/i18n/en/index.php +++ b/app/i18n/en/index.php @@ -55,18 +55,7 @@ return array( 'subscription' => 'Subscriptions management', 'unread' => 'Show only unread', ), - 'share' => array( - '_' => 'Share', - 'blogotext' => 'Blogotext', - 'diaspora' => 'Diaspora*', - 'email' => 'Email', - 'facebook' => 'Facebook', - 'g+' => 'Google+', - 'print' => 'Print', - 'shaarli' => 'Shaarli', - 'twitter' => 'Twitter', - 'wallabag' => 'wallabag', - ), + 'share' => 'Share', 'tag' => array( 'related' => 'Related tags', ), diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index 62d6342e9..e91aeb66a 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -121,7 +121,7 @@ return array( '_' => 'Partage', 'blogotext' => 'Blogotext', 'diaspora' => 'Diaspora*', - 'email' => 'Email', + 'email' => 'Courriel', 'facebook' => 'Facebook', 'g+' => 'Google+', 'more_information' => 'Plus d’informations', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index bb4478360..d990dad4a 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -128,6 +128,17 @@ return array( 'nothing_to_load' => 'Fin des articles', 'previous' => 'Précédent', ), + 'share' => array( + 'blogotext' => 'Blogotext', + 'diaspora' => 'Diaspora*', + 'email' => 'Courriel', + 'facebook' => 'Facebook', + 'g+' => 'Google+', + 'print' => 'Imprimer', + 'shaarli' => 'Shaarli', + 'twitter' => 'Twitter', + 'wallabag' => 'wallabag', + ), 'short' => array( 'attention' => 'Attention !', 'blank_to_disable' => 'Laissez vide pour désactiver', diff --git a/app/i18n/fr/index.php b/app/i18n/fr/index.php index 3279543bd..f9975c593 100644 --- a/app/i18n/fr/index.php +++ b/app/i18n/fr/index.php @@ -55,18 +55,7 @@ return array( 'subscription' => 'Gestion des abonnements', 'unread' => 'Afficher les non lus', ), - 'share' => array( - '_' => 'Partager', - 'blogotext' => 'Blogotext', - 'diaspora' => 'Diaspora*', - 'email' => 'Courriel', - 'facebook' => 'Facebook', - 'g+' => 'Google+', - 'print' => 'Imprimer', - 'shaarli' => 'Shaarli', - 'twitter' => 'Twitter', - 'wallabag' => 'wallabag', - ), + 'share' => 'Partager', 'tag' => array( 'related' => 'Tags associés', ), diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index f5c133f07..da7557480 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -15,22 +15,25 @@ '> - sharing as $key => $sharing) { ?> - shares[$sharing['type']]; ?> -
+ sharing as $key => $share_options) { + $share = FreshRSS_Share::get($share_options['type']); + $share->update($share_options); + ?> +
- ' /> - + + formType() === 'advanced') { ?>
- - + +
- + @@ -41,8 +44,10 @@
diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index c2cf7c887..8c6ddd1ee 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -129,8 +129,6 @@ if (!empty($this->entries)) { } ?>
  • link()); - $title = urlencode($item->title() . ' · ' . $feed->name()); ?>
  • link(); + $title = $item->title() . ' · ' . $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); + ?>
    Date: Thu, 8 Jan 2015 14:50:21 +0100 Subject: Fix Minz_Translate::availableLanguages() method --- app/Models/ConfigurationSetter.php | 2 +- app/i18n/en/gen.php | 4 ++++ app/i18n/fr/gen.php | 4 ++++ app/views/configure/display.phtml | 4 ++-- lib/Minz/Translate.php | 28 +++++++++++++++++++++++++--- 5 files changed, 36 insertions(+), 6 deletions(-) (limited to 'app/i18n') diff --git a/app/Models/ConfigurationSetter.php b/app/Models/ConfigurationSetter.php index e5ea6ff6f..f1c465c7c 100644 --- a/app/Models/ConfigurationSetter.php +++ b/app/Models/ConfigurationSetter.php @@ -89,7 +89,7 @@ class FreshRSS_ConfigurationSetter { private function _language(&$data, $value) { $value = strtolower($value); $languages = Minz_Translate::availableLanguages(); - if (!isset($languages[$value])) { + if (!in_array($value, $languages)) { $value = 'en'; } $data['language'] = $value; diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index b3b8d8647..6271717d4 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -100,6 +100,10 @@ return array( 'notif_title_new_articles' => 'FreshRSS: new articles!', 'should_be_activated' => 'JavaScript must be enabled', ), + 'lang' => array( + 'en' => 'English', + 'fr' => 'Français', + ), 'menu' => array( 'about' => 'About', 'admin' => 'Administration', diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index 996c81cf5..6b449484f 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -100,6 +100,10 @@ return array( 'notif_title_new_articles' => 'FreshRSS : nouveaux articles !', 'should_be_activated' => 'Le JavaScript doit être activé.', ), + 'lang' => array( + 'en' => 'English', + 'fr' => 'Français', + ), 'menu' => array( 'about' => 'À propos', 'admin' => 'Administration', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 36a075ea7..02249bc55 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -11,8 +11,8 @@
    diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index b05c9c695..d870b6bb2 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -9,6 +9,11 @@ * It uses files in `./app/i18n/` */ class Minz_Translate { + /** + * $path_list is the list of registered base path to search translations. + */ + private static $path_list = array(); + /** * $lang_name is the name of the current language to use. */ @@ -30,6 +35,7 @@ class Minz_Translate { */ public static function init($lang_name) { self::$lang_name = $lang_name; + self::$path_list = array(); self::$lang_files = array(); self::$translates = array(); self::registerPath(APP_PATH . '/i18n'); @@ -45,11 +51,21 @@ class Minz_Translate { /** * Return the list of available languages. - * @return an array. - * @todo fix this method. + * @return an array containing langs found in different registered paths. */ public static function availableLanguages() { - return array(); + $list_langs = array(); + + foreach (self::$path_list as $path) { + $path_langs = array_values(array_diff( + scandir($path), + array('..', '.') + )); + + $list_langs = array_merge($list_langs, $path_langs); + } + + return array_unique($list_langs); } /** @@ -58,6 +74,12 @@ class Minz_Translate { * @param $path a path containing i18n directories (e.g. ./en/, ./fr/). */ public static function registerPath($path) { + if (in_array($path, self::$path_list)) { + return; + } + + self::$path_list[] = $path; + // We load first i18n files for the current language. $lang_path = $path . '/' . self::$lang_name; $list_i18n_files = array_values(array_diff( -- cgit v1.2.3 From b23fc3187cb90800aad6417badf7822a8d280b74 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 8 Jan 2015 21:32:21 +0100 Subject: Fix translation bug A path registered after initialization must be loaded. --- app/i18n/en/admin.php | 1 + app/i18n/fr/admin.php | 1 + lib/Minz/Translate.php | 1 + 3 files changed, 3 insertions(+) (limited to 'app/i18n') diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 83c06bfb4..6a89d4a31 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -104,6 +104,7 @@ return array( ), 'extensions' => array( 'empty_list' => 'There is no installed extension', + 'no_configure_view' => 'This extension cannot be configured.', 'system' => 'System extension (you have no rights on it)', 'title' => 'Extensions', ), diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index b16e2be54..2e879da61 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -104,6 +104,7 @@ return array( ), 'extensions' => array( 'empty_list' => 'Il n’y a aucune extension installée.', + 'no_configure_view' => 'Cette extension ne peut pas être configurée.', 'system' => 'Extension système (vous n’avez aucun droit dessus)', 'title' => 'Extensions', ), diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index d8ce2a0f7..baddcb424 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -85,6 +85,7 @@ class Minz_Translate { } self::$path_list[] = $path; + self::loadLang($path); } /** -- cgit v1.2.3 From 0cba8dd69156eab50142efe67f4f3fac22a08081 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 13 Jan 2015 11:32:29 +0100 Subject: Show current version of FRSS on the update page See https://github.com/FreshRSS/FreshRSS/issues/699 --- app/i18n/en/admin.php | 1 + app/i18n/fr/admin.php | 1 + app/views/update/index.phtml | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app/i18n') diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 6a89d4a31..3161683a8 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -144,6 +144,7 @@ return 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', diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index 2e879da61..3d69e4daf 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -144,6 +144,7 @@ return 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', diff --git a/app/views/update/index.phtml b/app/views/update/index.phtml index 5c07d307e..4c88a0d18 100644 --- a/app/views/update/index.phtml +++ b/app/views/update/index.phtml @@ -6,7 +6,11 @@

    - last_update_time); ?> + +

    + +

    + last_update_time); ?>

    message)) { ?> -- cgit v1.2.3 From e7c24b5d41c293fa13e4d92efb2aee7778ddcab4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 13 Jan 2015 12:02:35 +0100 Subject: Show the version number during update process. Number is stored inside the data/last_update.txt file and shown if there is an update script. See https://github.com/FreshRSS/FreshRSS/issues/699 --- app/Controllers/updateController.php | 17 +++++++++++------ app/i18n/en/feedback.php | 2 +- app/i18n/fr/feedback.php | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'app/i18n') diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 1b44a739c..4bdd96f6d 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -1,8 +1,8 @@ view->update_to_apply = false; $this->view->last_update_time = 'unknown'; $this->view->check_last_hour = false; - $timestamp = (int)@file_get_contents(DATA_PATH . '/last_update.txt'); - if (is_numeric($timestamp) && $timestamp > 0) { + $timestamp = @filemtime(join_path(DATA_PATH, 'last_update.txt')); + if ($timestamp !== false) { $this->view->last_update_time = timestamptodate($timestamp); $this->view->check_last_hour = (time() - 3600) <= $timestamp; } @@ -30,11 +30,12 @@ class FreshRSS_update_Controller extends Minz_ActionController { ); } elseif (file_exists(UPDATE_FILENAME)) { // There is an update file to apply! + $version = file_get_contents(join_path(DATA_PATH, 'last_update.txt')); $this->view->update_to_apply = true; $this->view->message = array( 'status' => 'good', 'title' => _t('gen.short.ok'), - 'body' => _t('feedback.update.can_apply') + 'body' => _t('feedback.update.can_apply', $version) ); } } @@ -82,13 +83,17 @@ class FreshRSS_update_Controller extends Minz_ActionController { 'body' => _t('feedback.update.none') ); - @file_put_contents(DATA_PATH . '/last_update.txt', time()); + @touch(join_path(DATA_PATH, 'last_update.txt')); return; } $script = $res_array[1]; if (file_put_contents(UPDATE_FILENAME, $script) !== false) { + $version = explode(' ', $status, 2); + $version = $version[1]; + @file_put_contents(join_path(DATA_PATH, 'last_update.txt'), $version); + Minz_Request::forward(array('c' => 'update')); } else { $this->view->message = array( @@ -111,7 +116,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { if ($res === true) { @unlink(UPDATE_FILENAME); - @file_put_contents(DATA_PATH . '/last_update.txt', time()); + @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), diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index 5f7183da3..e9499ed46 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -80,7 +80,7 @@ return array( 'purge_completed' => 'Purge completed (%d articles deleted)', ), 'update' => array( - 'can_apply' => 'An update is available.', + 'can_apply' => 'FreshRSS will be now updated to the version %s.', 'error' => 'The update process has encountered an error: %s', 'file_is_nok' => 'Check permissions on %s directory. HTTP server must have rights to write into', 'finished' => 'Update completed!', diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index 5c71bbae1..c99314411 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -80,7 +80,7 @@ return array( 'purge_completed' => 'Purge effectuée (%d articles supprimés).', ), 'update' => array( - 'can_apply' => 'Une mise à jour est disponible.', + 'can_apply' => 'FreshRSS va maintenant être mis à jour vers la version %s.', 'error' => 'La mise à jour a rencontré un problème : %s', 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire %s. Le serveur HTTP doit être capable d’écrire dedans', 'finished' => 'La mise à jour est terminée !', -- cgit v1.2.3 From 806b4de54ffd1dd682ec7b42a5be8343a464e5f0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 14 Jan 2015 21:38:35 +0100 Subject: Add mechanism at (un)install of an extension Test if the install or uninstall has been successfully performed. If these methods return true, all is ok but if a string is returned, the string must explain the problem. This problem is stored in log file. A feedback is given to explain to check log file. This commit fix a problem in the english translation of feedback.sub.feed.internal_problem. --- app/Controllers/extensionController.php | 40 +++++++++++++++++++++------------ app/i18n/en/feedback.php | 12 +++++++--- app/i18n/fr/feedback.php | 10 +++++++-- lib/Minz/Extension.php | 14 ++++++++++-- 4 files changed, 55 insertions(+), 21 deletions(-) (limited to 'app/i18n') diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index e013bb369..692595a4c 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -88,15 +88,21 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $url_redirect); } - $ext->install(); + $res = $ext->install(); - $ext_list = $conf->extensions_enabled; - array_push_unique($ext_list, $ext_name); - $conf->extensions_enabled = $ext_list; - $conf->save(); + 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.enabled', $ext_name), - $url_redirect); + 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); @@ -138,15 +144,21 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $url_redirect); } - $ext->uninstall(); + $res = $ext->uninstall(); - $ext_list = $conf->extensions_enabled; - array_remove($ext_list, $ext_name); - $conf->extensions_enabled = $ext_list; - $conf->save(); + 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.disabled', $ext_name), - $url_redirect); + 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); diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index e9499ed46..19af81e5b 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -31,8 +31,14 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s is already enabled', - 'disabled' => '%s is now disabled', - 'enabled' => '%s is now enabled', + 'disable' => array( + 'ko' => '%s cannot be disabled. Check FressRSS logs for details.', + 'ok' => '%s is now disabled', + ), + 'enable' => array( + 'ko' => '%s cannot be enabled. Check FressRSS logs 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', @@ -67,7 +73,7 @@ return array( 'already_subscribed' => 'You have already subscribed to %s', 'deleted' => 'Feed has been deleted', 'error' => 'Feed cannot be updated', - 'internal_problem_feed' => 'The RSS feed could not be added. Check FressRSS logs for details.', + 'internal_problem' => 'The RSS feed could not be added. Check FressRSS logs for details.', 'invalid_url' => 'URL %s is invalid', 'marked_read' => 'Feeds have been marked as read', 'n_actualized' => '%d feeds have been updated', diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index c99314411..e2364a251 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -31,8 +31,14 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s est déjà activée', - 'disabled' => '%s est désormais désactivée', - 'enabled' => '%s est désormais activée', + 'disable' => array( + 'ko' => '%s ne peut pas être désactivée. Consulter les logs de FreshRSS pour plus de détails.', + 'ok' => '%s est désormais désactivée', + ), + 'enable' => array( + 'ko' => '%s ne peut pas être activée. Consulter les logs de FreshRSS 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', diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php index b3991c129..ac7231e9c 100644 --- a/lib/Minz/Extension.php +++ b/lib/Minz/Extension.php @@ -51,16 +51,26 @@ class Minz_Extension { * Used when installing an extension (e.g. update the database scheme). * * It must be redefined by child classes. + * + * @return true if the extension has been installed or a string explaining + * the problem. */ - public function install() {} + public function install() { + return true; + } /** * Used when uninstalling an extension (e.g. revert the database scheme to * cancel changes from install). * * It must be redefined by child classes. + * + * @return true if the extension has been uninstalled or a string explaining + * the problem. */ - public function uninstall() {} + public function uninstall() { + return true; + } /** * Call at the initialization of the extension (i.e. when the extension is -- cgit v1.2.3 From 2f1116818d7d9a6ef413b2c06e9603ffceaf7867 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 14 Jan 2015 23:30:19 +0100 Subject: Fix extension interface - Seperate user and system extensions on extension/index - extension/configure shows index page with the slider opened if request is done with ajax - Reorganize some extension view files --- app/Controllers/extensionController.php | 13 ++++++- app/i18n/en/admin.php | 8 +++- app/i18n/fr/admin.php | 8 +++- app/views/extension/configure.phtml | 22 +---------- app/views/extension/index.phtml | 57 ++++++++++++++++------------- app/views/helpers/extension/configure.phtml | 19 ++++++++++ app/views/helpers/extension/details.phtml | 21 +++++++++++ 7 files changed, 98 insertions(+), 50 deletions(-) create mode 100644 app/views/helpers/extension/configure.phtml create mode 100644 app/views/helpers/extension/details.phtml (limited to 'app/i18n') diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index 5dd7eac89..ec5eecadb 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -20,7 +20,15 @@ class FreshRSS_extension_Controller extends Minz_ActionController { */ public function indexAction() { Minz_View::prependTitle(_t('admin.extensions.title') . ' · '); - $this->view->extension_list = Minz_ExtensionManager::list_extensions(); + $this->view->extension_list = array( + 'system' => array(), + 'user' => array(), + ); + + $extensions = Minz_ExtensionManager::list_extensions(); + foreach ($extensions as $ext) { + $this->view->extension_list[$ext->getType()][] = $ext; + } } /** @@ -36,6 +44,9 @@ class FreshRSS_extension_Controller extends Minz_ActionController { 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')); diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 3161683a8..947d0e6c7 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -103,10 +103,16 @@ return array( ), ), 'extensions' => array( + 'disabled' => 'Disabled', 'empty_list' => 'There is no installed extension', + 'enabled' => 'Enabled', 'no_configure_view' => 'This extension cannot be configured.', - 'system' => 'System extension (you have no rights on it)', + 'system' => array( + '_' => 'System extensions', + 'no_rights' => 'System extension (you have no rights on it)', + ), 'title' => 'Extensions', + 'user' => 'User extensions', ), 'stats' => array( '_' => 'Statistics', diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index 3d69e4daf..980f1fccf 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -103,10 +103,16 @@ return array( ), ), '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' => 'Extension système (vous n’avez aucun droit dessus)', + 'system' => array( + '_' => 'Extensions système', + 'no_rights' => 'Extension système (vous n’avez aucun droit dessus)', + ), 'title' => 'Extensions', + 'user' => 'Extensions utilisateur', ), 'stats' => array( '_' => 'Statistiques', diff --git a/app/views/extension/configure.phtml b/app/views/extension/configure.phtml index c03439a75..8933eeae5 100644 --- a/app/views/extension/configure.phtml +++ b/app/views/extension/configure.phtml @@ -1,23 +1,3 @@ partial('aside_configure'); -} - -?> - -
    -

    extension->getName(); ?> (extension->getVersion(); ?>) — extension->getType(); ?>

    - -

    extension->getDescription(); ?> — extension->getAuthor()); ?>

    - -

    - extension->getConfigureView(); - if ($configure_view !== false) { - echo $configure_view; - } else { - ?> -

    - -
    +$this->renderHelper('extension/configure'); diff --git a/app/views/extension/index.phtml b/app/views/extension/index.phtml index 25b0eb9ee..f2d05028f 100644 --- a/app/views/extension/index.phtml +++ b/app/views/extension/index.phtml @@ -5,35 +5,40 @@

    - extension_list)) { ?> - extension_list as $ext) { ?> -
      -
    • - getType() === 'user' || FreshRSS_Auth::hasAccess('admin')) { ?> - getName()); ?> -
      - - isEnabled()) { ?> - - - - - - - -
      - - - -
    • -
    • getName(); ?>
    • -
    + extension_list['system'])) { ?> +

    + extension_list['system'] as $ext) { + $this->ext_details = $ext; + $this->renderHelper('extension/details'); + } + ?> - + + extension_list['user'])) { ?> +

    + extension_list['user'] as $ext) { + $this->ext_details = $ext; + $this->renderHelper('extension/details'); + } + ?> + extension_list['system']) && empty($this->extension_list['user'])) { + ?>

    - -
    +extension) ? ' class="active"' : ''; ?> +> +
    > +extension)) { + $this->renderHelper('extension/configure'); + } +?> +
    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 @@ +
    +

    + extension->getName(); ?> (extension->getVersion(); ?>) — + extension->isEnabled() ? _t('admin.extensions.enabled') + : _t('admin.extensions.disabled'); ?> +

    + +

    extension->getDescription(); ?> — extension->getAuthor()); ?>

    + +

    + extension->getConfigureView(); + if ($configure_view !== false) { + echo $configure_view; + } else { + ?> +

    + +
    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 @@ +
      +
    • + ext_details->getType() === 'user' || FreshRSS_Auth::hasAccess('admin')) { ?> + ext_details->getName()); ?> +
      + + ext_details->isEnabled()) { ?> + + + + + + + +
      + + + +
    • +
    • ext_details->getName(); ?>
    • +
    -- cgit v1.2.3