4
0
Эх сурвалжийг харах

Merge from dev

https://github.com/FreshRSS/FreshRSS/issues/312
Alexandre Alapetite 11 жил өмнө
parent
commit
137c498c84

+ 5 - 3
CHANGELOG.md

@@ -6,11 +6,12 @@
 	* Support for PubSubHubbub for instant notifications from compatible Web sites.
 	* 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
 * Features
 	* New option to detect and mark updated articles as unread.
 	* New option to detect and mark updated articles as unread.
 	* Support for internationalized domain name (IDN).
 	* Support for internationalized domain name (IDN).
+	* Improved logic for automatic deletion of old articles.
 * API
 * API
 	* Work-around for News+ bug when there is no unread article on the server.
 	* Work-around for News+ bug when there is no unread article on the server.
 * UI
 * UI
@@ -18,9 +19,10 @@
 * Bug fixing
 * Bug fixing
 	* Corrected bug introduced in previous beta about handling of HTTP 301 (feeds that have changed address) 
 	* Corrected bug introduced in previous beta about handling of HTTP 301 (feeds that have changed address) 
 	* Corrected bug in FreshRSS RSS feeds.
 	* Corrected bug in FreshRSS RSS feeds.
+* Security
+	* Sanitize HTTP request header `Host`.
 * Misc.
 * 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)
 ## 2015-01-31 FreshRSS 1.0.0 / 1.1.0 (beta)

+ 39 - 3
README.fr.md

@@ -14,16 +14,20 @@ Il supporte [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) pour des not
 
 
 ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png)
 ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png)
 
 
-# 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 :
 **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é.
 * 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.
 * [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 !
 * 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.
 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).
 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
 # Prérequis
 * Serveur modeste, par exemple sous Linux ou Windows
 * Serveur modeste, par exemple sous Linux ou Windows
@@ -39,13 +43,45 @@ Les demandes de fonctionnalités, rapports de bugs, et autres contributions sont
 ![Capture d’écran de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_default-design.png)
 ![Capture d’écran de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_default-design.png)
 
 
 # Installation
 # 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/`)
 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/`
 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
 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.
 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).
 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
 # 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 :
 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+)
 * En utilisant l’identification par formulaire (requiert JavaScript, et PHP 5.3.7+ recommandé – fonctionne avec certaines versions de PHP 5.3.3+)

+ 37 - 1
README.md

@@ -14,7 +14,10 @@ It supports [PubSubHubbub](https://code.google.com/p/pubsubhubbub/) for instant
 
 
 ![FreshRSS logo](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png)
 ![FreshRSS logo](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png)
 
 
-# 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:
 **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.
 * 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
 # Disclaimer
 This application was developed to fulfil personal needs primarily, and comes with absolutely no warranty.
 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).
 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
 # Requirements
 * Light server running Linux or Windows
 * 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.
 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).
 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
 # Access control
 It is needed for the multi-user mode to limit access to FreshRSS. You can:
 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+)
 * use form authentication (need JavaScript and PHP 5.3.7+, works with some PHP 5.3.3+)

+ 1 - 0
app/Controllers/indexController.php

@@ -137,6 +137,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
 		}
 		}
 
 
 		// No layout for RSS output.
 		// 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->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
 		$this->view->_useLayout(false);
 		$this->view->_useLayout(false);
 		header('Content-Type: application/rss+xml; charset=utf-8');
 		header('Content-Type: application/rss+xml; charset=utf-8');

+ 3 - 3
app/Models/EntryDAO.php

@@ -11,7 +11,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
 		$hasTransaction = false;
 		$hasTransaction = false;
 		try {
 		try {
 			$stm = null;
 			$stm = null;
-			if ($name === 'lastSeen') {	//v1.2
+			if ($name === 'lastSeen') {	//v1.1.1
 				if (!$this->bd->inTransaction()) {
 				if (!$this->bd->inTransaction()) {
 					$this->bd->beginTransaction();
 					$this->bd->beginTransaction();
 					$hasTransaction = true;
 					$hasTransaction = true;
@@ -29,7 +29,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
 				if ($hasTransaction) {
 				if ($hasTransaction) {
 					$this->bd->rollBack();
 					$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)');
 				$stm = $this->bd->prepare('ALTER TABLE `' . $this->prefix . 'entry` ADD COLUMN hash BINARY(16)');
 				return $stm && $stm->execute();
 				return $stm && $stm->execute();
 			}
 			}
@@ -92,7 +92,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
 				return $this->addEntry($valuesTmp);
 				return $this->addEntry($valuesTmp);
 			} elseif ((int)($info[0] / 1000) !== 23) {	//Filter out "SQLSTATE Class code 23: Constraint Violation" because of expected duplicate entries
 			} 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]
 				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;
 			return false;
 		}
 		}

+ 4 - 4
app/SQL/install.sql.mysql.php

@@ -41,8 +41,8 @@ CREATE TABLE IF NOT EXISTS `%1$sentry` (
 	`content_bin` blob,	-- v0.7
 	`content_bin` blob,	-- v0.7
 	`link` varchar(1023) CHARACTER SET latin1 NOT NULL,
 	`link` varchar(1023) CHARACTER SET latin1 NOT NULL,
 	`date` int(11),	-- Until year 2038
 	`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_read` boolean NOT NULL DEFAULT 0,
 	`is_favorite` boolean NOT NULL DEFAULT 0,
 	`is_favorite` boolean NOT NULL DEFAULT 0,
 	`id_feed` SMALLINT,	-- v0.7
 	`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,
 	FOREIGN KEY (`id_feed`) REFERENCES `%1$sfeed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
 	UNIQUE KEY (`id_feed`,`guid`),	-- v0.7
 	UNIQUE KEY (`id_feed`,`guid`),	-- v0.7
 	INDEX (`is_favorite`),	-- 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
 ) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
 ENGINE = INNODB;
 ENGINE = INNODB;
 
 

+ 3 - 3
app/SQL/install.sql.sqlite.php

@@ -39,8 +39,8 @@ $SQL_CREATE_TABLES = array(
 	`content` text,
 	`content` text,
 	`link` varchar(1023) NOT NULL,
 	`link` varchar(1023) NOT NULL,
 	`date` int(11),	-- Until year 2038
 	`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_read` boolean NOT NULL DEFAULT 0,
 	`is_favorite` boolean NOT NULL DEFAULT 0,
 	`is_favorite` boolean NOT NULL DEFAULT 0,
 	`id_feed` SMALLINT,
 	`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_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_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");',
 'INSERT OR IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s");',
 );
 );

+ 3 - 2
constants.php

@@ -1,5 +1,5 @@
 <?php
 <?php
-define('FRESHRSS_VERSION', '1.2-dev');
+define('FRESHRSS_VERSION', '1.1.2-dev');
 define('FRESHRSS_WEBSITE', 'http://freshrss.org');
 define('FRESHRSS_WEBSITE', 'http://freshrss.org');
 define('FRESHRSS_UPDATE_WEBSITE', 'https://update.freshrss.org?v=' . FRESHRSS_VERSION);
 define('FRESHRSS_UPDATE_WEBSITE', 'https://update.freshrss.org?v=' . FRESHRSS_VERSION);
 define('FRESHRSS_WIKI', 'http://doc.freshrss.org');
 define('FRESHRSS_WIKI', 'http://doc.freshrss.org');
@@ -11,7 +11,8 @@ define('PHP_COMPRESSION', false);
 define('FRESHRSS_PATH', dirname(__FILE__));
 define('FRESHRSS_PATH', dirname(__FILE__));
 
 
 	define('PUBLIC_PATH', FRESHRSS_PATH . '/p');
 	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('PUBLIC_RELATIVE', '..');
 
 
 	define('DATA_PATH', FRESHRSS_PATH . '/data');
 	define('DATA_PATH', FRESHRSS_PATH . '/data');

+ 14 - 32
lib/Minz/Request.php

@@ -84,45 +84,27 @@ class Minz_Request {
 		self::magicQuotesOff();
 		self::magicQuotesOff();
 	}
 	}
 
 
-	/**
-	 * Retourn le nom de domaine du site
-	 */
-	public static function getDomainName() {
-		return $_SERVER['HTTP_HOST'];
-	}
-
 	/**
 	/**
 	 * Détermine la base de l'url
 	 * Détermine la base de l'url
 	 * @return 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');
 		$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 {
 		} else {
-			$real_uri = '';
+			$url = rtrim($url, '/\\') . $baseUrlSuffix;
 		}
 		}
-
-		return $real_uri;
+		return filter_var($url . '/', FILTER_SANITIZE_URL);
 	}
 	}
 
 
 	/**
 	/**

+ 4 - 12
lib/Minz/Url.php

@@ -10,7 +10,6 @@ class Minz_Url {
 	 *                    $url['c'] = controller
 	 *                    $url['c'] = controller
 	 *                    $url['a'] = action
 	 *                    $url['a'] = action
 	 *                    $url['params'] = tableau des paramètres supplémentaires
 	 *                    $url['params'] = tableau des paramètres supplémentaires
-	 *                    $url['protocol'] = protocole à utiliser (http par défaut)
 	 *             ou comme une chaîne de caractère
 	 *             ou comme une chaîne de caractère
 	 * @param $encodage pour indiquer comment encoder les & (& ou &amp; pour html)
 	 * @param $encodage pour indiquer comment encoder les & (& ou &amp; pour html)
 	 * @return l'url formatée
 	 * @return l'url formatée
@@ -19,28 +18,21 @@ class Minz_Url {
 		$isArray = is_array($url);
 		$isArray = is_array($url);
 
 
 		if ($isArray) {
 		if ($isArray) {
-			$url = self::checkUrl ($url);
+			$url = self::checkUrl($url);
 		}
 		}
 
 
 		$url_string = '';
 		$url_string = '';
 
 
 		if ($absolute) {
 		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 {
 		} else {
 			$url_string = $isArray ? '.' : PUBLIC_RELATIVE;
 			$url_string = $isArray ? '.' : PUBLIC_RELATIVE;
 		}
 		}
 
 
 		if ($isArray) {
 		if ($isArray) {
-			$url_string .= self::printUri ($url, $encodage);
+			$url_string .= self::printUri($url, $encodage);
 		} else {
 		} else {
-			$url_string .= $url;
+			$url_string = Minz_Helper::htmlspecialchars_utf8($url_string . $url);
 		}
 		}
 
 
 		return $url_string;
 		return $url_string;

+ 5 - 7
p/scripts/main.js

@@ -1230,13 +1230,11 @@ function init_slider_observers() {
 }
 }
 
 
 function init_configuration_alert() {
 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;
 			return;
 		}
 		}
 		var fields = $("[data-leave-validation]");
 		var fields = $("[data-leave-validation]");