From 9c5c023e36a24b58baeab108012cd9eb42ccda60 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 17 Nov 2013 02:56:30 +0100 Subject: Réorganisation des fichiers utilisateur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/248 --- data/.gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 data/.gitignore (limited to 'data') diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 000000000..0e407f099 --- /dev/null +++ b/data/.gitignore @@ -0,0 +1,6 @@ +cache +log +application.ini +Configuration.array.php +*.sqlite +touch.txt \ No newline at end of file -- cgit v1.2.3 From 2c02fcaa606813db0965a9e8a555fb3c75d18857 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 17 Nov 2013 12:31:51 +0100 Subject: Protection répertoire data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/.htaccess | 3 +++ data/index.html | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 data/.htaccess create mode 100644 data/index.html (limited to 'data') diff --git a/data/.htaccess b/data/.htaccess new file mode 100644 index 000000000..9e768397d --- /dev/null +++ b/data/.htaccess @@ -0,0 +1,3 @@ +Order Allow,Deny +Deny from all +Satisfy all diff --git a/data/index.html b/data/index.html new file mode 100644 index 000000000..2f3b51848 --- /dev/null +++ b/data/index.html @@ -0,0 +1,13 @@ + + + + + +Redirection + + + + +

Redirection

+ + -- cgit v1.2.3 From 9ec13c6c32ad0f8fb50f100e6ae127abe1535ccc Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 17 Nov 2013 15:24:30 +0100 Subject: Début de multi-utilisateurs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Préparation de https://github.com/marienfressinaud/FreshRSS/issues/126 Suite de https://github.com/marienfressinaud/FreshRSS/issues/248 Nécessite un script de mise à jour https://github.com/marienfressinaud/FreshRSS/issues/255 Install.php n'est pas encore testé https://github.com/marienfressinaud/FreshRSS/issues/273 --- app/i18n/en.php | 3 ++- app/i18n/fr.php | 3 ++- app/models/Entry.php | 8 ++++---- app/models/Feed.php | 4 ++-- app/models/RSSConfiguration.php | 3 ++- data/.gitignore | 2 +- lib/minz/Configuration.php | 12 ++++++++++++ lib/minz/dao/Model_pdo.php | 3 ++- public/index.php | 1 - public/install.php | 20 +++++++++++++++----- 10 files changed, 42 insertions(+), 17 deletions(-) (limited to 'data') diff --git a/app/i18n/en.php b/app/i18n/en.php index 8243756bd..e5aec3bc1 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -151,7 +151,8 @@ return array ( 'language' => 'Language', 'delete_articles_every' => 'Remove articles every', 'month' => 'months', - 'persona_connection_email' => 'Login mail address (use Persona)', + 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', + 'persona_connection_email' => 'Login mail address (use Mozilla Persona)', 'allow_anonymous' => 'Allow anonymous reading', 'auth_token' => 'Authentication token', 'explain_token' => 'Allows to access RSS output without authentication.
%s?token=%s', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 8040a6a44..8bffd5287 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -151,7 +151,8 @@ return array ( 'language' => 'Langue', 'delete_articles_every' => 'Supprimer les articles tous les', 'month' => 'mois', - 'persona_connection_email' => 'Adresse courriel de connexion (utilise Persona)', + 'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)', + 'persona_connection_email' => 'Adresse courriel de connexion (utilise Mozilla Persona)', 'allow_anonymous' => 'Autoriser la lecture anonyme', 'auth_token' => 'Jeton d’identification', 'explain_token' => 'Permet d’accéder à la sortie RSS sans besoin de s’authentifier.
%s?output=rss&token=%s', diff --git a/app/models/Entry.php b/app/models/Entry.php index 8b817cc14..c4856af8b 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -311,11 +311,11 @@ class EntryDAO extends Model_pdo { $affected = $stm->rowCount(); if ($affected > 0) { - $sql = 'UPDATE freshrss_feed f ' + $sql = 'UPDATE ' . $this->prefix . 'feed f ' . 'LEFT OUTER JOIN (' . 'SELECT e.id_feed, ' . 'COUNT(*) AS nbUnreads ' - . 'FROM freshrss_entry e ' + . 'FROM ' . $this->prefix . 'entry e ' . 'WHERE e.is_read = 0 ' . 'GROUP BY e.id_feed' . ') x ON x.id_feed=f.id ' @@ -364,11 +364,11 @@ class EntryDAO extends Model_pdo { $affected = $stm->rowCount(); if ($affected > 0) { - $sql = 'UPDATE freshrss_feed f ' + $sql = 'UPDATE ' . $this->prefix . 'feed f ' . 'LEFT OUTER JOIN (' . 'SELECT e.id_feed, ' . 'COUNT(*) AS nbUnreads ' - . 'FROM freshrss_entry e ' + . 'FROM ' . $this->prefix . 'entry e ' . 'WHERE e.is_read = 0 ' . 'GROUP BY e.id_feed' . ') x ON x.id_feed=f.id ' diff --git a/app/models/Feed.php b/app/models/Feed.php index adc8e1677..549603664 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -530,12 +530,12 @@ class FeedDAO extends Model_pdo { return $res[0]['count']; } public function updateCachedValues () { //For one single feed, call updateLastUpdate($id) - $sql = 'UPDATE freshrss_feed f ' + $sql = 'UPDATE ' . $this->prefix . 'feed f ' . 'INNER JOIN (' . 'SELECT e.id_feed, ' . 'COUNT(CASE WHEN e.is_read = 0 THEN 1 END) AS nbUnreads, ' . 'COUNT(e.id) AS nbEntries ' - . 'FROM freshrss_entry e ' + . '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'; diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index f8379a625..9604bee1d 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -348,7 +348,7 @@ class RSSConfigurationDAO extends Model_array { public $bottomline_link = 'yes'; public function __construct () { - parent::__construct (DATA_PATH . '/Configuration.array.php'); + parent::__construct (DATA_PATH . Configuration::currentUser () . '_user.php'); // TODO : simplifier ce code, une boucle for() devrait suffir ! if (isset ($this->array['language'])) { @@ -441,5 +441,6 @@ class RSSConfigurationDAO extends Model_array { } $this->writeFile($this->array); + touch(DATA_PATH . '/touch.txt'); } } diff --git a/data/.gitignore b/data/.gitignore index 0e407f099..9c60990ac 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,6 +1,6 @@ cache log application.ini -Configuration.array.php +*_user.php *.sqlite touch.txt \ No newline at end of file diff --git a/lib/minz/Configuration.php b/lib/minz/Configuration.php index bdd6af0fb..5be2ea63d 100755 --- a/lib/minz/Configuration.php +++ b/lib/minz/Configuration.php @@ -50,6 +50,8 @@ class Configuration { private static $language = 'en'; private static $cache_enabled = false; private static $delay_cache = 3600; + private static $default_user = ''; + private static $current_user = ''; private static $db = array ( 'host' => false, @@ -88,6 +90,12 @@ class Configuration { public static function dataBase () { return self::$db; } + public static function defaultUser () { + return self::$default_user; + } + public static function currentUser () { + return self::$current_user; + } /** * Initialise les variables de configuration @@ -193,6 +201,10 @@ class Configuration { if (isset ($general['delay_cache'])) { self::$delay_cache = $general['delay_cache']; } + if (isset ($general['default_user'])) { + self::$default_user = $general['default_user']; + self::$current_user = self::$default_user; + } // Base de données $db = false; diff --git a/lib/minz/dao/Model_pdo.php b/lib/minz/dao/Model_pdo.php index beeb65ea8..810e69847 100755 --- a/lib/minz/dao/Model_pdo.php +++ b/lib/minz/dao/Model_pdo.php @@ -60,7 +60,8 @@ class Model_pdo { ); self::$sharedBd = $this->bd; - $this->prefix = $db['prefix']; + $userPrefix = Configuration::currentUser (); + $this->prefix = $db['prefix'] . (empty($userPrefix) ? '' : ($userPrefix . '_')); self::$sharedPrefix = $this->prefix; } catch (Exception $e) { throw new PDOConnectionException ( diff --git a/public/index.php b/public/index.php index d989bc11d..108853fb7 100755 --- a/public/index.php +++ b/public/index.php @@ -28,7 +28,6 @@ if (file_exists ('install.php')) { $dateLastModification = max( @filemtime(DATA_PATH . '/touch.txt'), @filemtime(LOG_PATH . '/application.log'), - @filemtime(DATA_PATH . '/Configuration.array.php'), @filemtime(DATA_PATH . '/application.ini') ); if (httpConditional($dateLastModification, 0, 0, false, false, true)) { diff --git a/public/install.php b/public/install.php index 085a412ff..42f2d2651 100644 --- a/public/install.php +++ b/public/install.php @@ -159,6 +159,7 @@ function saveStep2 () { $_SESSION['old_entries'] = 3; } $_SESSION['mail_login'] = addslashes ($_POST['mail_login']); + $_SESSION['default_user'] = substr(0, 16, preg_replace ('/[^a-zA-Z0-9]/', '', $_POST['default_user'])); $token = ''; if ($_SESSION['mail_login']) { @@ -166,7 +167,7 @@ function saveStep2 () { . small_hash ($_SESSION['base_url'] . $_SESSION['sel']); } - $file_data = DATA_PATH . '/Configuration.array.php'; + $file_data = DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php'; $f = fopen ($file_data, 'w'); writeLine ($f, ' $conf ? 'ok' : 'ko', @@ -512,6 +515,13 @@ function printStep2 () { +
+ +
+ +
+
+
@@ -586,14 +596,14 @@ function printStep3 () {
- +
- +
-- cgit v1.2.3 From 609a2f1c271382b72cc132bb5a685b9b8ac6be25 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 17 Nov 2013 17:16:06 +0100 Subject: Changements .gitignore dans ./data --- data/.gitignore | 2 -- data/cache/.gitignore | 1 + data/log/.gitignore | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 data/cache/.gitignore create mode 100644 data/log/.gitignore (limited to 'data') diff --git a/data/.gitignore b/data/.gitignore index 9c60990ac..5d36792ba 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,5 +1,3 @@ -cache -log application.ini *_user.php *.sqlite diff --git a/data/cache/.gitignore b/data/cache/.gitignore new file mode 100644 index 000000000..0307e6493 --- /dev/null +++ b/data/cache/.gitignore @@ -0,0 +1 @@ +*.spc \ No newline at end of file diff --git a/data/log/.gitignore b/data/log/.gitignore new file mode 100644 index 000000000..bf0824e59 --- /dev/null +++ b/data/log/.gitignore @@ -0,0 +1 @@ +*.log \ No newline at end of file -- cgit v1.2.3 From dc2e1dc0817f0818943647d6b005ea35683c9c1b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 28 Nov 2013 16:37:27 +0100 Subject: Annulation du cache via no-cache.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La présence du fichier DATA_PATH/no-cache.txt permet de désactiver le cache. Ce fichier n'est pas présent par défaut Corrige #297 --- data/.gitignore | 3 ++- public/index.php | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'data') diff --git a/data/.gitignore b/data/.gitignore index 5d36792ba..677c8f58c 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,4 +1,5 @@ application.ini *_user.php *.sqlite -touch.txt \ No newline at end of file +touch.txt +no-cache.txt \ No newline at end of file diff --git a/public/index.php b/public/index.php index 9d1ee711c..9bf4fc073 100755 --- a/public/index.php +++ b/public/index.php @@ -24,14 +24,16 @@ if (file_exists ('install.php')) { require('../constants.php'); session_cache_limiter(''); - require (LIB_PATH . '/http-conditional.php'); - $dateLastModification = max( - @filemtime(DATA_PATH . '/touch.txt') - 1, - @filemtime(LOG_PATH . '/application.log') - 1, - @filemtime(DATA_PATH . '/application.ini') - 1 - ); - if (httpConditional($dateLastModification, 0, 0, false, false, true)) { - exit(); //No need to send anything + if (!file_exists(DATA_PATH . '/no-cache.txt')) { + require (LIB_PATH . '/http-conditional.php'); + $dateLastModification = max( + @filemtime(DATA_PATH . '/touch.txt') - 1, + @filemtime(LOG_PATH . '/application.log') - 1, + @filemtime(DATA_PATH . '/application.ini') - 1 + ); + if (httpConditional($dateLastModification, 0, 0, false, false, true)) { + exit(); //No need to send anything + } } set_include_path (get_include_path () -- cgit v1.2.3 From b0cbc6fe5da527aa2a4fedf4b138264ff983d159 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 1 Dec 2013 22:58:15 +0100 Subject: Favicons en parallèle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nouvelle méthode pour afficher les favicons à la demande et en parallèle. Déplacement du dossier des favicons sous /data/favicons/ Devrait permettre de fermer le problème d'import OPML https://github.com/marienfressinaud/FreshRSS/issues/228 Voir aussi https://github.com/marienfressinaud/FreshRSS/issues/290 --- app/models/Feed.php | 11 +++----- data/favicons/.gitignore | 2 ++ lib/lib_rss.php | 35 ------------------------ public/f.php | 67 ++++++++++++++++++++++++++++++++++++++++++++++ public/favicons/.gitignore | 1 - 5 files changed, 73 insertions(+), 43 deletions(-) create mode 100644 data/favicons/.gitignore create mode 100644 public/f.php delete mode 100644 public/favicons/.gitignore (limited to 'data') diff --git a/app/models/Feed.php b/app/models/Feed.php index f183b2aa7..41eb3df23 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -96,14 +96,11 @@ class Feed extends Model { return $this->nbNotRead; } public function favicon () { - $file = '/favicons/' . $this->id () . '.ico'; - - $favicon_url = Url::display ($file); - if (!file_exists (PUBLIC_PATH . $file)) { - download_favicon ($this->website (), $this->id ()); + $file = DATA_PATH . '/favicons/' . $this->id () . '.txt'; + if (!file_exists ($file)) { + file_put_contents($file, $this->website ()); } - - return $favicon_url; + return Url::display ('/f.php?' . $this->id ()); } public function _id ($value) { diff --git a/data/favicons/.gitignore b/data/favicons/.gitignore new file mode 100644 index 000000000..5ec725522 --- /dev/null +++ b/data/favicons/.gitignore @@ -0,0 +1,2 @@ +*.ico +*.txt \ No newline at end of file diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 46bf76d2c..c4ca03165 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -198,41 +198,6 @@ function get_content_by_parsing ($url, $path) { } } -/* Télécharge le favicon d'un site, le place sur le serveur et retourne l'URL */ -function download_favicon ($website, $id) { - $url = 'http://g.etfv.co/' . $website; - $favicons_dir = PUBLIC_PATH . '/favicons'; - $dest = $favicons_dir . '/' . $id . '.ico'; - - if (!is_dir ($favicons_dir)) { - if (!mkdir ($favicons_dir, 0755, true)) { - return $url; - } - } - - if (!file_exists ($dest)) { - $c = curl_init ($url); - curl_setopt ($c, CURLOPT_HEADER, false); - curl_setopt ($c, CURLOPT_RETURNTRANSFER, true); - curl_setopt ($c, CURLOPT_BINARYTRANSFER, true); - $imgRaw = curl_exec ($c); - - if (curl_getinfo ($c, CURLINFO_HTTP_CODE) == 200) { - $file = fopen ($dest, 'w'); - if ($file === false) { - return $url; - } - - fwrite ($file, $imgRaw); - fclose ($file); - } else { - return $url; - } - - curl_close ($c); - } -} - /** * Add support of image lazy loading * Move content from src attribute to data-original diff --git a/public/f.php b/public/f.php new file mode 100644 index 000000000..3be74776e --- /dev/null +++ b/public/f.php @@ -0,0 +1,67 @@ + $icoMTime)) { + if ($txtMTime == false) { + header('HTTP/1.1 404 Not Found'); + die(); + } + $url = file_get_contents($txt); + if (!download_favicon($url, $ico)) { + die(); + } +} + +header('Content-Type: image/x-icon'); +header('Content-Disposition: inline; filename="' . $id . '.ico"'); + +require(LIB_PATH . '/http-conditional.php'); +if (!httpConditional($icoMTime, 31557600, 2)) { + readfile($ico); +} diff --git a/public/favicons/.gitignore b/public/favicons/.gitignore deleted file mode 100644 index 29d1aae76..000000000 --- a/public/favicons/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.ico \ No newline at end of file -- cgit v1.2.3 From 415d7a5a716726759c30151af11bd588d52acbb2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 22 Dec 2013 16:08:24 +0100 Subject: config.php plutôt que application.ini MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/272 --- data/.gitignore | 1 + lib/Minz/Configuration.php | 8 ++--- public/index.php | 2 +- public/install.php | 80 +++++++++++++++++++++++++--------------------- 4 files changed, 48 insertions(+), 43 deletions(-) (limited to 'data') diff --git a/data/.gitignore b/data/.gitignore index 677c8f58c..a8091901a 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -1,4 +1,5 @@ application.ini +config.php *_user.php *.sqlite touch.txt diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 9fc913964..1b108dcdf 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -8,7 +8,7 @@ * La classe Configuration permet de gérer la configuration de l'application */ class Minz_Configuration { - const CONF_PATH_NAME = '/application.ini'; + const CONF_PATH_NAME = '/config.php'; /** * VERSION est la version actuelle de MINZ @@ -126,10 +126,7 @@ class Minz_Configuration { ); } - $ini_array = parse_ini_file ( - DATA_PATH . self::CONF_PATH_NAME, - true - ); + $ini_array = include(DATA_PATH . self::CONF_PATH_NAME); if (!$ini_array) { throw new Minz_PermissionDeniedException ( @@ -147,7 +144,6 @@ class Minz_Configuration { } $general = $ini_array['general']; - // sel_application est obligatoire if (!isset ($general['sel_application'])) { throw new Minz_BadConfigurationException ( diff --git a/public/index.php b/public/index.php index 829e418f9..c8b15b3d9 100755 --- a/public/index.php +++ b/public/index.php @@ -29,7 +29,7 @@ if (file_exists ('install.php')) { $dateLastModification = max( @filemtime(DATA_PATH . '/touch.txt'), @filemtime(LOG_PATH . '/application.log'), - @filemtime(DATA_PATH . '/application.ini') + @filemtime(DATA_PATH . '/config.php') ); $_SERVER['QUERY_STRING'] .= '&utime=' . file_get_contents(DATA_PATH . '/touch.txt'); //For ETag if (httpConditional($dateLastModification, 0, 0, false, false, true)) { diff --git a/public/install.php b/public/install.php index 7fbae3436..dbbecb1a3 100644 --- a/public/install.php +++ b/public/install.php @@ -261,23 +261,29 @@ function saveStep3 () { $_SESSION['bd_prefix'] = addslashes ($_POST['prefix']); $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_')); - $file_conf = DATA_PATH . '/application.ini'; - $f = fopen ($file_conf, 'w'); - writeLine ($f, '[general]'); - writeLine ($f, 'environment = "' . empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'] . '"'); - writeLine ($f, 'use_url_rewriting = false'); - writeLine ($f, 'sel_application = "' . $_SESSION['sel_application'] . '"'); - writeLine ($f, 'base_url = ""'); - writeLine ($f, 'title = "' . $_SESSION['title'] . '"'); - writeLine ($f, 'default_user = "' . $_SESSION['default_user'] . '"'); - writeLine ($f, '[db]'); - writeLine ($f, 'type = "' . $_SESSION['bd_type'] . '"'); - writeLine ($f, 'host = "' . $_SESSION['bd_host'] . '"'); - writeLine ($f, 'user = "' . $_SESSION['bd_user'] . '"'); - writeLine ($f, 'password = "' . $_SESSION['bd_password'] . '"'); - writeLine ($f, 'base = "' . $_SESSION['bd_base'] . '"'); - writeLine ($f, 'prefix = "' . $_SESSION['bd_prefix'] . '"'); - fclose ($f); + $ini_array = array( + 'general' => array( + 'environment' => empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'], + 'use_url_rewriting' => false, + 'sel_application' => $_SESSION['sel_application'], + 'base_url' => '', + 'title' => $_SESSION['title'], + 'default_user' => $_SESSION['default_user'], + ), + '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'], + ), + ); + file_put_contents(DATA_PATH . '/config.php', " Date: Thu, 26 Dec 2013 13:26:05 +0100 Subject: Déplacement de ./actualize_script.php sous ./app/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pour une meilleure protection par défaut --- CHANGELOG | 1 + README.md | 2 +- actualize_script.php | 15 --------------- app/.htaccess | 3 +++ app/actualize_script.php | 15 +++++++++++++++ app/index.html | 13 +++++++++++++ data/index.html | 2 +- index.html | 1 + lib/.htaccess | 3 +++ 9 files changed, 38 insertions(+), 17 deletions(-) delete mode 100755 actualize_script.php create mode 100644 app/.htaccess create mode 100755 app/actualize_script.php create mode 100644 app/index.html create mode 100644 lib/.htaccess (limited to 'data') diff --git a/CHANGELOG b/CHANGELOG index 9ae3d3f62..336245269 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -53,6 +53,7 @@ * Déplacement de “./public/data/Configuration.array.php” vers “./data/*_user.php” * Déplacement de “./public/index.php” vers “./p/i/index.php” (voir cookie ci-dessous) * Déplacement de “./public/” vers “./p/” + * Déplacement de “./actualize_script.php” vers “./app/actualize_script.php” * Divers : * Nouvelle politique de cookie de session (témoin de connexion) * Utilise un nom poli “FreshRSS” diff --git a/README.md b/README.md index 210ec64cc..5051a936c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Il est recommandé de limiter l’accès à votre FreshRSS, soit : # Rafraîchissement automatique des flux * Vous pouvez ajouter une tâche CRON sur le script d’actualisation des flux. Par exemple, pour exécuter le script toutes les heures : ``` -7 * * * * php /chemin/vers/freshrss/actualize_script.php >/dev/null 2>&1 +7 * * * * php /chemin/vers/FreshRSS/app/actualize_script.php >/dev/null 2>&1 ``` # Conseils diff --git a/actualize_script.php b/actualize_script.php deleted file mode 100755 index 7986ba0b5..000000000 --- a/actualize_script.php +++ /dev/null @@ -1,15 +0,0 @@ -init (); -Minz_Session::_param('mail', true); // permet de se passer de la phase de connexion -$front_controller->run (); -invalidateHttpCache(); diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 000000000..9e768397d --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,3 @@ +Order Allow,Deny +Deny from all +Satisfy all diff --git a/app/actualize_script.php b/app/actualize_script.php new file mode 100755 index 000000000..20438128a --- /dev/null +++ b/app/actualize_script.php @@ -0,0 +1,15 @@ +init (); +Minz_Session::_param('mail', true); // permet de se passer de la phase de connexion +$front_controller->run (); +invalidateHttpCache(); diff --git a/app/index.html b/app/index.html new file mode 100644 index 000000000..85faaa37e --- /dev/null +++ b/app/index.html @@ -0,0 +1,13 @@ + + + + + +Redirection + + + + +

Redirection

+ + diff --git a/data/index.html b/data/index.html index 2f3b51848..85faaa37e 100644 --- a/data/index.html +++ b/data/index.html @@ -4,7 +4,7 @@ Redirection - + diff --git a/index.html b/index.html index bbea573c7..1bfdea859 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ Redirection + diff --git a/lib/.htaccess b/lib/.htaccess new file mode 100644 index 000000000..9e768397d --- /dev/null +++ b/lib/.htaccess @@ -0,0 +1,3 @@ +Order Allow,Deny +Deny from all +Satisfy all -- cgit v1.2.3 From 9ac1496d63da32524a33696187342ce061e9ef28 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 28 Dec 2013 13:54:52 +0100 Subject: Bouge anon_access dans config.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'accès anonyme n'est pas au niveau utilisateur mais au niveau global. Bouge FreshRSS_Configuration::conf->anonAccess() qui était stocké dans *_user.php vers Minz_Configuration::allowAnonymous() stocké dans config.php Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126 + autres optimisations Contribue à https://github.com/marienfressinaud/FreshRSS/issues/260 --- app/Controllers/configureController.php | 11 ++++--- app/Controllers/indexController.php | 6 ++-- app/Models/Configuration.php | 12 ------- app/Models/ConfigurationDAO.php | 4 --- app/layout/header.phtml | 2 +- app/views/configure/users.phtml | 2 +- app/views/index/index.phtml | 2 +- data/.gitignore | 3 +- lib/Minz/Configuration.php | 58 ++++++++++++++++++++++++++------- 9 files changed, 61 insertions(+), 39 deletions(-) (limited to 'data') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 487f6e4ad..dd9674588 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -398,15 +398,13 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $current_token = $this->view->conf->token(); $mail = Minz_Request::param('mail_login', false); - $anon = Minz_Request::param('anon_access', 'no'); $token = Minz_Request::param('token', $current_token); + $this->view->conf->_mailLogin($mail); - $this->view->conf->_anonAccess($anon); $this->view->conf->_token($token); $values = array( 'mail_login' => $this->view->conf->mailLogin(), - 'anon_access' => $this->view->conf->anonAccess(), 'token' => $this->view->conf->token(), ); @@ -415,7 +413,12 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Session::_param('conf', $this->view->conf); Minz_Session::_param('mail', $this->view->conf->mailLogin()); - // notif + $anon = (bool)(Minz_Request::param('anon_access', false)); + if ($anon != Minz_Configuration::allowAnonymous()) { + Minz_Configuration::_allowAnonymous($anon); + Minz_Configuration::writeFile(); + } + $notif = array( 'type' => 'good', 'content' => Minz_Translate::t('configuration_updated') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 6c0ba9058..0c229aedb 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -24,7 +24,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { // check if user is log in if(login_is_conf ($this->view->conf) && !is_logged() && - $this->view->conf->anonAccess() === 'no' && + !Minz_Configuration::allowAnonymous() && !($output === 'rss' && $token_is_ok)) { return; } @@ -36,8 +36,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { $params['search'] = urlencode ($params['search']); } if (login_is_conf($this->view->conf) && - $this->view->conf->anonAccess() === 'no' && - $token != '') { + !Minz_Configuration::allowAnonymous() && + $token !== '') { $params['token'] = $token; } $this->view->rss_url = array ( diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index cb2f90655..7f4be474d 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -20,7 +20,6 @@ class FreshRSS_Configuration extends Minz_Model { private $mark_when = array (); private $sharing = array (); private $theme; - private $anon_access; private $token; private $auto_load_more; private $topline_read; @@ -52,7 +51,6 @@ class FreshRSS_Configuration extends Minz_Model { $this->_sharing ($confDAO->sharing); $this->_theme ($confDAO->theme); FreshRSS_Themes::setThemeId ($confDAO->theme); - $this->_anonAccess ($confDAO->anon_access); $this->_token ($confDAO->token); $this->_autoLoadMore ($confDAO->auto_load_more); $this->_topline_read ($confDAO->topline_read); @@ -132,9 +130,6 @@ class FreshRSS_Configuration extends Minz_Model { public function theme () { return $this->theme; } - public function anonAccess () { - return $this->anon_access; - } public function token () { return $this->token; } @@ -283,13 +278,6 @@ class FreshRSS_Configuration extends Minz_Model { public function _theme ($value) { $this->theme = $value; } - public function _anonAccess ($value) { - if ($value == 'yes') { - $this->anon_access = 'yes'; - } else { - $this->anon_access = 'no'; - } - } public function _token ($value) { $this->token = $value; } diff --git a/app/Models/ConfigurationDAO.php b/app/Models/ConfigurationDAO.php index 91210e701..fa4d3338f 100644 --- a/app/Models/ConfigurationDAO.php +++ b/app/Models/ConfigurationDAO.php @@ -38,7 +38,6 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { 'print' => true ); public $theme = 'default'; - public $anon_access = 'no'; public $token = ''; public $auto_load_more = 'yes'; public $topline_read = 'yes'; @@ -108,9 +107,6 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { if (isset ($this->array['theme'])) { $this->theme = $this->array['theme']; } - if (isset ($this->array['anon_access'])) { - $this->anon_access = $this->array['anon_access']; - } if (isset ($this->array['token'])) { $this->token = $this->array['token']; } diff --git a/app/layout/header.phtml b/app/layout/header.phtml index bba22508e..aeb417a6e 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -21,7 +21,7 @@