diff options
| author | 2015-06-01 19:40:30 +0200 | |
|---|---|---|
| committer | 2015-06-01 19:40:30 +0200 | |
| commit | 137c498c84da23f9abad2217c5fd716d6c514573 (patch) | |
| tree | c4bcf466e174c9abc1f15b29e8940e5fabad803d | |
| parent | ae277ddefcd7b5a776ec4b30562d5dca6479b6dd (diff) | |
| parent | 384a146883548ba0274f8cbee0c2e67dc053f70e (diff) | |
Merge from dev
https://github.com/FreshRSS/FreshRSS/issues/312
| -rw-r--r-- | CHANGELOG.md | 8 | ||||
| -rw-r--r-- | README.fr.md | 42 | ||||
| -rw-r--r-- | README.md | 38 | ||||
| -rwxr-xr-x | app/Controllers/indexController.php | 1 | ||||
| -rw-r--r-- | app/Models/EntryDAO.php | 6 | ||||
| -rw-r--r-- | app/SQL/install.sql.mysql.php | 8 | ||||
| -rw-r--r-- | app/SQL/install.sql.sqlite.php | 6 | ||||
| -rw-r--r-- | constants.php | 5 | ||||
| -rw-r--r-- | lib/Minz/Request.php | 46 | ||||
| -rw-r--r-- | lib/Minz/Url.php | 16 | ||||
| -rw-r--r-- | p/scripts/main.js | 12 |
11 files changed, 118 insertions, 70 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b9fe400f2..605b4256c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,12 @@ * Support for PubSubHubbub for instant notifications from compatible Web sites. -## 2015-xx-xx FreshRSS 1.1.1 (beta) +## 2015-05-31 FreshRSS 1.1.1 (beta) * Features * New option to detect and mark updated articles as unread. * Support for internationalized domain name (IDN). + * Improved logic for automatic deletion of old articles. * API * Work-around for News+ bug when there is no unread article on the server. * UI @@ -18,9 +19,10 @@ * Bug fixing * Corrected bug introduced in previous beta about handling of HTTP 301 (feeds that have changed address) * Corrected bug in FreshRSS RSS feeds. +* Security + * Sanitize HTTP request header `Host`. * Misc. - * Improved logic for automatic deletion of old articles. - * Attempt to better handle encoded titles. + * Attempt to better handle encoded article titles. ## 2015-01-31 FreshRSS 1.0.0 / 1.1.0 (beta) diff --git a/README.fr.md b/README.fr.md index 1110eb8e5..de7dd1fb2 100644 --- a/README.fr.md +++ b/README.fr.md @@ -14,16 +14,20 @@ Il supporte [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) pour des not  -# Note sur les branches +# Téléchargement +Voir la [liste des versions](../../releases). + +## Note sur les branches **Ce logiciel est en développement permanent !** Veuillez vous assurer d'utiliser la branche qui vous correspond : * Utilisez [la branche master](https://github.com/FreshRSS/FreshRSS/tree/master/) si vous visez la stabilité. * [La branche beta](https://github.com/FreshRSS/FreshRSS/tree/beta) est celle par défaut : les nouveautés y sont ajoutées environ tous les mois. * Pour les développeurs et ceux qui veulent aider à tester les toutes dernières fonctionnalités, [la branche dev](https://github.com/FreshRSS/FreshRSS/tree/dev) vous ouvre les bras ! -# Disclaimer +# Avertissements Cette application a été développée pour s’adapter principalement à des besoins personnels, et aucune garantie n'est fournie. Les demandes de fonctionnalités, rapports de bugs, et autres contributions sont les bienvenues. Privilégiez pour cela des [demandes sur GitHub](https://github.com/FreshRSS/FreshRSS/issues). +Nous sommes une communauté amicale. # Prérequis * Serveur modeste, par exemple sous Linux ou Windows @@ -39,13 +43,45 @@ Les demandes de fonctionnalités, rapports de bugs, et autres contributions sont  # Installation -1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](https://github.com/FreshRSS/FreshRSS/archive/master.zip) +1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](../releases) 2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./p/`) 3. Le serveur Web doit avoir les droits d’écriture dans le répertoire `./data/` 4. Accédez à FreshRSS à travers votre navigateur Web et suivez les instructions d’installation 5. Tout devrait fonctionner :) En cas de problème, n’hésitez pas à me contacter. 6. Des paramètres de configuration avancée peuvent être accédés depuis [config.php](./data/config.default.php). +## Exemple d’installation complète sur Linux Debian/Ubuntu +```sh +# Si vous utilisez le serveur Web Apache (sinon il faut un autre serveur Web) +sudo apt-get install apache2 +sudo a2enmod headers expires rewrite ssl +# (optionnel) Si vous voulez un serveur de base de données MySQL +sudo apt-get install mysql-server mysql-client php5-mysql +# Composants principaux (git est optionnel si vous déployez manuellement les fichiers d’installation) +sudo apt-get install git php5 php5-curl php5-gd php5-intl php5-json php5-gmp php5-sqlite +# Redémarrage du serveur Web +sudo service apache2 restart + +# Pour FreshRSS lui-même +cd /usr/share/ +sudo git clone https://github.com/FreshRSS/FreshRSS.git +# Mettre les droits d’accès pour le serveur Web +cd FreshRSS +sudo chown -R :www-data . +sudo chmod -R g+w ./data/ +# Publier FreshRSS dans votre répertoire HTML public +sudo ln -s /usr/share/FreshRSS/p /var/www/html/FreshRSS +# Naviguez vers http://example.net/FreshRSS pour terminer l’installation. +# (Si vous le faite depuis localhost, vous pourrez avoir à ajuster le réglage de votre adresse publique) + +# Mettre à jour FreshRSS vers une nouvelle version +cd /usr/share/FreshRSS +sudo git reset --hard +sudo git pull +sudo chown -R :www-data . +sudo chmod -R g+w ./data/ +``` + # Contrôle d’accès Il est requis pour le mode multi-utilisateur, et recommandé dans tous les cas, de limiter l’accès à votre FreshRSS. Au choix : * En utilisant l’identification par formulaire (requiert JavaScript, et PHP 5.3.7+ recommandé – fonctionne avec certaines versions de PHP 5.3.3+) @@ -14,7 +14,10 @@ It supports [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) for instant  -# Note on branches +# Releases +See the [list of releases](../../releases). + +## Note on branches **This application is under continuous development!** Please use the branch that suits your needs: * Use [the master branch](https://github.com/FreshRSS/FreshRSS/tree/master/) if you need a stable version. @@ -24,6 +27,7 @@ It supports [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) for instant # Disclaimer This application was developed to fulfil personal needs primarily, and comes with absolutely no warranty. Feature requests, bug reports, and other contributions are welcome. The best way is to [open issues on GitHub](https://github.com/FreshRSS/FreshRSS/issues). +We are a friendly community. # Requirements * Light server running Linux or Windows @@ -46,6 +50,38 @@ Feature requests, bug reports, and other contributions are welcome. The best way 5. Everything should be working :) If you encounter any problem, feel free to contact me. 6. Advanced configuration settings can be seen in [config.php](./data/config.default.php). +## Example of full installation on Linux Debian/Ubuntu +```sh +# If you use an Apache Web server (otherwise you need another Web server) +sudo apt-get install apache2 +sudo a2enmod headers expires rewrite ssl +# (Optional) If you want a MySQL database server +sudo apt-get install mysql-server mysql-client php5-mysql +# Main components (git is optional if you manually download the installation files) +sudo apt-get install git php5 php5-curl php5-gd php5-intl php5-json php5-gmp php5-sqlite +# Restart Web server +sudo service apache2 restart + +# For FreshRSS itself +cd /usr/share/ +sudo git clone https://github.com/FreshRSS/FreshRSS.git +# Set the rights so that your Web browser can access the files +cd FreshRSS +sudo chown -R :www-data . +sudo chmod -R g+w ./data/ +# Publish FreshRSS in your public HTML directory +sudo ln -s /usr/share/FreshRSS/p /var/www/html/FreshRSS +# Navigate to http://example.net/FreshRSS to complete the installation. +# (If you do it from localhost, you may have to adjust the setting of your public address later) + +# Update to a newer version of FreshRSS +cd /usr/share/FreshRSS +sudo git reset --hard +sudo git pull +sudo chown -R :www-data . +sudo chmod -R g+w ./data/ +``` + # Access control It is needed for the multi-user mode to limit access to FreshRSS. You can: * use form authentication (need JavaScript and PHP 5.3.7+, works with some PHP 5.3.3+) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index c1aaca53f..baaf99065 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -137,6 +137,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { } // 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'); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index f939a0fb3..9ddcfcfb3 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -11,7 +11,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $hasTransaction = false; try { $stm = null; - if ($name === 'lastSeen') { //v1.2 + if ($name === 'lastSeen') { //v1.1.1 if (!$this->bd->inTransaction()) { $this->bd->beginTransaction(); $hasTransaction = true; @@ -29,7 +29,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if ($hasTransaction) { $this->bd->rollBack(); } - } elseif ($name === 'hash') { //v1.2 + } elseif ($name === 'hash') { //v1.1.1 $stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16)'); return $stm && $stm->execute(); } @@ -92,7 +92,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { 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']. ' ' . $this->addEntryPrepared); + . ' while adding entry in feed ' . $valuesTmp['id_feed'] . ' with title: ' . $valuesTmp['title']); } return false; } diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index 9c6af405d..c5787d25b 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -41,8 +41,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( `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.2, Until year 2038 - `hash` BINARY(16), -- v1.2 + `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 @@ -51,8 +51,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` ( 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.2 + INDEX (`is_read`), -- v0.7 + INDEX `entry_lastSeen_index` (`lastSeen`) -- v1.1.1 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB; diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 77e8e094c..71bad7311 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -39,8 +39,8 @@ $SQL_CREATE_TABLES = array( `content` text, `link` varchar(1023) NOT NULL, `date` int(11), -- Until year 2038 - `lastSeen` INT(11) DEFAULT 0, -- v1.2, Until year 2038 - `hash` BINARY(16), -- v1.2 + `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, @@ -52,7 +52,7 @@ $SQL_CREATE_TABLES = array( 'CREATE INDEX IF NOT EXISTS entry_is_favorite_index ON `%1$sentry`(`is_favorite`);', 'CREATE INDEX IF NOT EXISTS entry_is_read_index ON `%1$sentry`(`is_read`);', -'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `%1$sentry`(`lastSeen`);', //v1.2 +'CREATE INDEX IF NOT EXISTS entry_lastSeen_index ON `%1$sentry`(`lastSeen`);', //v1.1.1 'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");', ); diff --git a/constants.php b/constants.php index 5bb410e29..d5f0cc06b 100644 --- a/constants.php +++ b/constants.php @@ -1,5 +1,5 @@ <?php -define('FRESHRSS_VERSION', '1.2-dev'); +define('FRESHRSS_VERSION', '1.1.2-dev'); define('FRESHRSS_WEBSITE', 'http://freshrss.org'); define('FRESHRSS_UPDATE_WEBSITE', 'https://update.freshrss.org?v=' . FRESHRSS_VERSION); define('FRESHRSS_WIKI', 'http://doc.freshrss.org'); @@ -11,7 +11,8 @@ define('PHP_COMPRESSION', false); define('FRESHRSS_PATH', dirname(__FILE__)); define('PUBLIC_PATH', FRESHRSS_PATH . '/p'); - define('INDEX_PATH', PUBLIC_PATH . '/i'); + define('PUBLIC_TO_INDEX_PATH', '/i'); + define('INDEX_PATH', PUBLIC_PATH . PUBLIC_TO_INDEX_PATH); define('PUBLIC_RELATIVE', '..'); define('DATA_PATH', FRESHRSS_PATH . '/data'); diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index 6db2e9c7a..b9eda82a5 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -85,44 +85,26 @@ class Minz_Request { } /** - * Retourn le nom de domaine du site - */ - public static function getDomainName() { - return $_SERVER['HTTP_HOST']; - } - - /** * Détermine la base de l'url * @return la base de l'url */ - public static function getBaseUrl() { + public static function getBaseUrl($baseUrlSuffix = '') { $conf = Minz_Configuration::get('system'); - $defaultBaseUrl = $conf->base_url; - if (!empty($defaultBaseUrl)) { - return $defaultBaseUrl; - } elseif (isset($_SERVER['REQUEST_URI'])) { - return dirname($_SERVER['REQUEST_URI']) . '/'; - } else { - return '/'; - } - } - - /** - * Récupère l'URI de la requête - * @return l'URI - */ - public static function getURI() { - if (isset($_SERVER['REQUEST_URI'])) { - $base_url = self::getBaseUrl(); - $uri = $_SERVER['REQUEST_URI']; - - $len_base_url = strlen($base_url); - $real_uri = substr($uri, $len_base_url); + $url = $conf->base_url; + if ($url == '' || !preg_match('%^https?://%i', $url)) { + $url = 'http'; + $host = empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; + $port = empty($_SERVER['SERVER_PORT']) ? 80 : $_SERVER['SERVER_PORT']; + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { + $url .= 's://' . $host . ($port == 443 ? '' : ':' . $port); + } else { + $url .= '://' . $host . ($port == 80 ? '' : ':' . $port); + } + $url .= isset($_SERVER['REQUEST_URI']) ? dirname($_SERVER['REQUEST_URI']) : ''; } else { - $real_uri = ''; + $url = rtrim($url, '/\\') . $baseUrlSuffix; } - - return $real_uri; + return filter_var($url . '/', FILTER_SANITIZE_URL); } /** diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php index af555a277..879077d0f 100644 --- a/lib/Minz/Url.php +++ b/lib/Minz/Url.php @@ -10,7 +10,6 @@ class Minz_Url { * $url['c'] = controller * $url['a'] = action * $url['params'] = tableau des paramètres supplémentaires - * $url['protocol'] = protocole à utiliser (http par défaut) * ou comme une chaîne de caractère * @param $encodage pour indiquer comment encoder les & (& ou & pour html) * @return l'url formatée @@ -19,28 +18,21 @@ class Minz_Url { $isArray = is_array($url); if ($isArray) { - $url = self::checkUrl ($url); + $url = self::checkUrl($url); } $url_string = ''; if ($absolute) { - if ($isArray && isset ($url['protocol'])) { - $protocol = $url['protocol']; - } elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { - $protocol = 'https:'; - } else { - $protocol = 'http:'; - } - $url_string = $protocol . '//' . Minz_Request::getDomainName () . Minz_Request::getBaseUrl (); + $url_string = Minz_Request::getBaseUrl(PUBLIC_TO_INDEX_PATH); } else { $url_string = $isArray ? '.' : PUBLIC_RELATIVE; } if ($isArray) { - $url_string .= self::printUri ($url, $encodage); + $url_string .= self::printUri($url, $encodage); } else { - $url_string .= $url; + $url_string = Minz_Helper::htmlspecialchars_utf8($url_string . $url); } return $url_string; diff --git a/p/scripts/main.js b/p/scripts/main.js index eaf6067f7..f64927c14 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1230,13 +1230,11 @@ function init_slider_observers() { } function init_configuration_alert() { - $(window).on('beforeunload', function(e){ - if (e.originalEvent.explicitOriginalTarget.type === 'submit') { - // we don't want an alert when submitting the form with the submit button - return; - } - if ($(e.originalEvent.explicitOriginalTarget).attr('data-leave-validation') !== undefined) { - // we don't want an alert when submitting the form by pressing the enter key + $(window).on('submit', function(e) { + window.hasSubmit = true; + }); + $(window).on('beforeunload', function(e) { + if (window.hasSubmit) { return; } var fields = $("[data-leave-validation]"); |
