Skip to content

A free, self-hostable news aggregator…

Cookie : sous-répertoire pour index (changements de répertoires !)

Alexandre Alapetite58300c36ad77
diff --git a/README.md b/README.md
index 716859ccf..62d7e0c25 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ Privilégiez pour cela des demandes sur GitHub
# Installation
1. Récupérez l’application FreshRSS via la commande git ou [en téléchargeant l’archive](https://github.com/marienfressinaud/FreshRSS/archive/master.zip)
-2. Placez l’application sur votre serveur (la partie à exposer au Web est le répertoire `./public/`)
+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.
@@ -49,7 +49,7 @@ Il est recommandé de limiter l’accès à votre FreshRSS, soit :
```
# Conseils
-* Pour une meilleure sécurité, faites en sorte que seul le répertoire `./public` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`.
+* Pour une meilleure sécurité, faites en sorte que seul le répertoire `./p/` soit accessible depuis le Web, par exemple en faisant pointer un sous-domaine sur le répertoire `./public`.
* Les données personnelles se trouvent dans le répertoire `./data/` (déjà protégé par un .htaccess pour Apache - vérifiez que cela fonctionne -, à protéger vous-même dans le cas d’autres serveurs Web).
* Le fichier `./constants.php` définit les chemins d’accès aux répertoires clés de l’application. Si vous les bougez, tout se passe ici.
* En cas de problème, les logs peuvent être utile à lire, soit depuis l’interface de FreshRSS, soit manuellement depuis `./data/log/*.log`.
diff --git a/constants.php b/constants.php
index c22209efe..0c7adc57e 100644
--- a/constants.php
+++ b/constants.php
@@ -3,12 +3,15 @@ define('FRESHRSS_VERSION', '0.7-beta3');
define('FRESHRSS_WEBSITE', 'http://freshrss.org');
// Constantes de chemins
-define ('FRESHRSS_PATH', dirname(__FILE__));
+define('FRESHRSS_PATH', dirname(__FILE__));
-define ('PUBLIC_PATH', FRESHRSS_PATH . '/public');
-define ('DATA_PATH', FRESHRSS_PATH . '/data');
-define ('LIB_PATH', FRESHRSS_PATH . '/lib');
-define ('APP_PATH', FRESHRSS_PATH . '/app');
+ define('PUBLIC_PATH', FRESHRSS_PATH . '/p');
+ define('INDEX_PATH', PUBLIC_PATH . '/i');
+ define('PUBLIC_RELATIVE', '..');
-define ('LOG_PATH', DATA_PATH . '/log');
-define ('CACHE_PATH', DATA_PATH . '/cache');
+ define('DATA_PATH', FRESHRSS_PATH . '/data');
+ define('LOG_PATH', DATA_PATH . '/log');
+ define('CACHE_PATH', DATA_PATH . '/cache');
+
+ define('LIB_PATH', FRESHRSS_PATH . '/lib');
+ define('APP_PATH', FRESHRSS_PATH . '/app');
diff --git a/index.html b/index.html
index 937659d57..bbea573c7 100644
--- a/index.html
+++ b/index.html
@@ -2,12 +2,11 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
<head>
<meta charset="UTF-8" />
-<meta http-equiv="Refresh" content="0; url=public/" />
+<meta http-equiv="Refresh" content="0; url=p/i/" />
<title>Redirection</title>
-<meta name="robots" content="noindex,follow" />
</head>
<body>
-<p><a href="./public/">FreshRSS</a></p>
+<p><a href="p/i/">FreshRSS</a></p>
</body>
</html>
diff --git a/index.php b/index.php
new file mode 100644
index 000000000..3fdae4285
--- /dev/null
+++ b/index.php
@@ -0,0 +1,3 @@
+<?php
+header('Location: p/i/', true, 301);
+include('index.html');
diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php
index c2af920df..f527322f5 100644
--- a/lib/Minz/Session.php
+++ b/lib/Minz/Session.php
@@ -18,6 +18,7 @@ class Minz_Session {
public static function init ($name) {
// démarre la session
session_name ($name);
+ session_set_cookie_params (0, './', null, false, true);
session_start ();
if (isset ($_SESSION)) {
diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php
index 30f7f6231..17f1ddece 100644
--- a/lib/Minz/Url.php
+++ b/lib/Minz/Url.php
@@ -17,12 +17,16 @@ class Minz_Url {
* @return l'url formatée
*/
public static function display ($url = array (), $encodage = 'html', $absolute = false) {
- $url = self::checkUrl ($url);
+ $isArray = is_array($url);
+
+ if ($isArray) {
+ $url = self::checkUrl ($url);
+ }
$url_string = '';
if ($absolute) {
- if (is_array ($url) && isset ($url['protocol'])) {
+ if ($isArray && isset ($url['protocol'])) {
$protocol = $url['protocol'];
} elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https:';
@@ -30,12 +34,11 @@ class Minz_Url {
$protocol = 'http:';
}
$url_string = $protocol . '//' . Minz_Request::getDomainName () . Minz_Request::getBaseUrl ();
- }
- else {
- $url_string = '.';
+ } else {
+ $url_string = $isArray ? '.' : PUBLIC_RELATIVE;
}
- if (is_array ($url)) {
+ if ($isArray) {
$router = new Minz_Router ();
if (Minz_Configuration::useUrlRewriting ()) {
diff --git a/public/.htaccess b/p/.htaccess
similarity index 100%
rename from public/.htaccess
rename to p/.htaccess
diff --git a/public/f.php b/p/f.php
similarity index 100%
rename from public/f.php
rename to p/f.php
diff --git a/public/favicon.ico b/p/favicon.ico
similarity index 100%
rename from public/favicon.ico
rename to p/favicon.ico
diff --git a/public/favicon.png b/p/favicon.png
similarity index 100%
rename from public/favicon.png
rename to p/favicon.png
diff --git a/public/index.php b/p/i/index.php
similarity index 98%
rename from public/index.php
rename to p/i/index.php
index c8b15b3d9..6c25b2c54 100755
--- a/public/index.php
+++ b/p/i/index.php
@@ -21,7 +21,7 @@
if (file_exists ('install.php')) {
require('install.php');
} else {
- require('../constants.php');
+ require('../../constants.php');
session_cache_limiter('');
if (!file_exists(DATA_PATH . '/no-cache.txt')) {
diff --git a/public/install.php b/p/i/install.php
similarity index 98%
rename from public/install.php
rename to p/i/install.php
index ad5527765..fa37ae19a 100644
--- a/public/install.php
+++ b/p/i/install.php
@@ -1,8 +1,9 @@
<?php
-require('../constants.php');
+require('../../constants.php');
include(LIB_PATH . '/lib_rss.php');
session_name('FreshRSS');
+session_set_cookie_params(0, './', null, false, true);
session_start();
if (isset ($_GET['step'])) {
@@ -381,7 +382,7 @@ function updateDatabase($perform = false) {
}
function deleteInstall () {
- $res = unlink (PUBLIC_PATH . '/install.php');
+ $res = unlink (INDEX_PATH . '/install.php');
if ($res) {
header ('Location: index.php');
}
@@ -455,16 +456,6 @@ function delTree($dir) { //http://php.net/rmdir#110489
return rmdir($dir);
}
-function removeOldFiles() {
- $oldDirs = array('/app/configuration/', '/cache/', '/log/', '/public/data/', '/public/themes/printer/'); //v0.6
-
- $ok = true;
- foreach ($oldDirs as $oldDir) {
- $ok &= delTree(FRESHRSS_PATH . $oldDir);
- }
- return $ok;
-}
-
/*** VÉRIFICATIONS ***/
function checkStep () {
$s0 = checkStep0 ();
@@ -483,7 +474,7 @@ function checkStep () {
$_SESSION['actualize_feeds'] = true;
}
function checkStep0 () {
- moveOldFiles() && removeOldFiles();
+ moveOldFiles();
if (file_exists(DATA_PATH . '/config.php')) {
$ini_array = include(DATA_PATH . '/config.php');
@@ -934,7 +925,7 @@ function printStep5 () {
function printStep6 () {
?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('oops'); ?></span> <?php echo _t ('install_not_deleted', PUBLIC_PATH . '/install.php'); ?></p>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('oops'); ?></span> <?php echo _t ('install_not_deleted', INDEX_PATH . '/install.php'); ?></p>
<?php
}
diff --git a/p/index.html b/p/index.html
new file mode 100644
index 000000000..af91b717e
--- /dev/null
+++ b/p/index.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=i/" />
+<title>Redirection</title>
+</head>
+
+<body>
+<p><a href="i/">FreshRSS</a></p>
+</body>
+</html>
diff --git a/p/index.php b/p/index.php
new file mode 100644
index 000000000..e90662078
--- /dev/null
+++ b/p/index.php
@@ -0,0 +1,3 @@
+<?php
+header('Location: i/', true, 301);
+include('index.html');
diff --git a/public/robots.txt b/p/robots.txt
similarity index 100%
rename from public/robots.txt
rename to p/robots.txt
diff --git a/public/scripts/global_view.js b/p/scripts/global_view.js
similarity index 100%
rename from public/scripts/global_view.js
rename to p/scripts/global_view.js
diff --git a/public/scripts/jquery-2.0.3.min.map b/p/scripts/jquery-2.0.3.min.map
similarity index 100%
rename from public/scripts/jquery-2.0.3.min.map
rename to p/scripts/jquery-2.0.3.min.map
diff --git a/public/scripts/jquery.lazyload.min.js b/p/scripts/jquery.lazyload.min.js
similarity index 100%
rename from public/scripts/jquery.lazyload.min.js
rename to p/scripts/jquery.lazyload.min.js
diff --git a/public/scripts/jquery.min.js b/p/scripts/jquery.min.js
similarity index 100%
rename from public/scripts/jquery.min.js
rename to p/scripts/jquery.min.js
diff --git a/public/scripts/main.js b/p/scripts/main.js
similarity index 100%
rename from public/scripts/main.js
rename to p/scripts/main.js
diff --git a/public/scripts/shortcut.js b/p/scripts/shortcut.js
similarity index 100%
rename from public/scripts/shortcut.js
rename to p/scripts/shortcut.js
diff --git a/public/themes/default/freshrss.css b/p/themes/default/freshrss.css
similarity index 100%
rename from public/themes/default/freshrss.css
rename to p/themes/default/freshrss.css
diff --git a/public/themes/default/global.css b/p/themes/default/global.css
similarity index 100%
rename from public/themes/default/global.css
rename to p/themes/default/global.css
diff --git a/public/themes/default/loader.gif b/p/themes/default/loader.gif
similarity index 100%
rename from public/themes/default/loader.gif
rename to p/themes/default/loader.gif
diff --git a/public/themes/default/metadata.json b/p/themes/default/metadata.json
similarity index 100%
rename from public/themes/default/metadata.json
rename to p/themes/default/metadata.json
diff --git a/public/themes/flat-design/freshrss.css b/p/themes/flat-design/freshrss.css
similarity index 100%
rename from public/themes/flat-design/freshrss.css
rename to p/themes/flat-design/freshrss.css
diff --git a/public/themes/flat-design/global.css b/p/themes/flat-design/global.css
similarity index 100%
rename from public/themes/flat-design/global.css
rename to p/themes/flat-design/global.css
diff --git a/public/themes/flat-design/icons/add.svg b/p/themes/flat-design/icons/add.svg
similarity index 100%
rename from public/themes/flat-design/icons/add.svg
rename to p/themes/flat-design/icons/add.svg
diff --git a/public/themes/flat-design/icons/all.svg b/p/themes/flat-design/icons/all.svg
similarity index 100%
rename from public/themes/flat-design/icons/all.svg
rename to p/themes/flat-design/icons/all.svg
diff --git a/public/themes/flat-design/icons/close.svg b/p/themes/flat-design/icons/close.svg
similarity index 100%
rename from public/themes/flat-design/icons/close.svg
rename to p/themes/flat-design/icons/close.svg
diff --git a/public/themes/flat-design/icons/configure.svg b/p/themes/flat-design/icons/configure.svg
similarity index 100%
rename from public/themes/flat-design/icons/configure.svg
rename to p/themes/flat-design/icons/configure.svg
diff --git a/public/themes/flat-design/icons/down.svg b/p/themes/flat-design/icons/down.svg
similarity index 100%
rename from public/themes/flat-design/icons/down.svg
rename to p/themes/flat-design/icons/down.svg
diff --git a/public/themes/flat-design/icons/next.svg b/p/themes/flat-design/icons/next.svg
similarity index 100%
rename from public/themes/flat-design/icons/next.svg
rename to p/themes/flat-design/icons/next.svg
diff --git a/public/themes/flat-design/icons/prev.svg b/p/themes/flat-design/icons/prev.svg
similarity index 100%
rename from public/themes/flat-design/icons/prev.svg
rename to p/themes/flat-design/icons/prev.svg
diff --git a/public/themes/flat-design/icons/refresh.svg b/p/themes/flat-design/icons/refresh.svg
similarity index 100%
rename from public/themes/flat-design/icons/refresh.svg
rename to p/themes/flat-design/icons/refresh.svg
diff --git a/public/themes/flat-design/icons/search.svg b/p/themes/flat-design/icons/search.svg
similarity index 100%
rename from public/themes/flat-design/icons/search.svg
rename to p/themes/flat-design/icons/search.svg
diff --git a/public/themes/flat-design/icons/up.svg b/p/themes/flat-design/icons/up.svg
similarity index 100%
rename from public/themes/flat-design/icons/up.svg
rename to p/themes/flat-design/icons/up.svg
diff --git a/public/themes/flat-design/loader.gif b/p/themes/flat-design/loader.gif
similarity index 100%
rename from public/themes/flat-design/loader.gif
rename to p/themes/flat-design/loader.gif
diff --git a/public/themes/flat-design/metadata.json b/p/themes/flat-design/metadata.json
similarity index 100%
rename from public/themes/flat-design/metadata.json
rename to p/themes/flat-design/metadata.json
diff --git a/public/themes/fonts/openSans.woff b/p/themes/fonts/openSans.woff
similarity index 100%
rename from public/themes/fonts/openSans.woff
rename to p/themes/fonts/openSans.woff
diff --git a/public/themes/icons/add.svg b/p/themes/icons/add.svg
similarity index 100%
rename from public/themes/icons/add.svg
rename to p/themes/icons/add.svg
diff --git a/public/themes/icons/all.svg b/p/themes/icons/all.svg
similarity index 100%
rename from public/themes/icons/all.svg
rename to p/themes/icons/all.svg
diff --git a/public/themes/icons/bookmark.svg b/p/themes/icons/bookmark.svg
similarity index 100%
rename from public/themes/icons/bookmark.svg
rename to p/themes/icons/bookmark.svg
diff --git a/public/themes/icons/category-white.svg b/p/themes/icons/category-white.svg
similarity index 100%
rename from public/themes/icons/category-white.svg
rename to p/themes/icons/category-white.svg
diff --git a/public/themes/icons/category.svg b/p/themes/icons/category.svg
similarity index 100%
rename from public/themes/icons/category.svg
rename to p/themes/icons/category.svg
diff --git a/public/themes/icons/close.svg b/p/themes/icons/close.svg
similarity index 100%
rename from public/themes/icons/close.svg
rename to p/themes/icons/close.svg
diff --git a/public/themes/icons/configure.svg b/p/themes/icons/configure.svg
similarity index 100%
rename from public/themes/icons/configure.svg
rename to p/themes/icons/configure.svg
diff --git a/public/themes/icons/down.svg b/p/themes/icons/down.svg
similarity index 100%
rename from public/themes/icons/down.svg
rename to p/themes/icons/down.svg
diff --git a/public/themes/icons/grey.gif b/p/themes/icons/grey.gif
similarity index 100%
rename from public/themes/icons/grey.gif
rename to p/themes/icons/grey.gif
diff --git a/public/themes/icons/help.svg b/p/themes/icons/help.svg
similarity index 100%
rename from public/themes/icons/help.svg
rename to p/themes/icons/help.svg
diff --git a/public/themes/icons/icon.svg b/p/themes/icons/icon.svg
similarity index 100%
rename from public/themes/icons/icon.svg
rename to p/themes/icons/icon.svg
diff --git a/public/themes/icons/link.svg b/p/themes/icons/link.svg
similarity index 100%
rename from public/themes/icons/link.svg
rename to p/themes/icons/link.svg
diff --git a/public/themes/icons/login.svg b/p/themes/icons/login.svg
similarity index 100%
rename from public/themes/icons/login.svg
rename to p/themes/icons/login.svg
diff --git a/public/themes/icons/logout.svg b/p/themes/icons/logout.svg
similarity index 100%
rename from public/themes/icons/logout.svg
rename to p/themes/icons/logout.svg
diff --git a/public/themes/icons/next.svg b/p/themes/icons/next.svg
similarity index 100%
rename from public/themes/icons/next.svg
rename to p/themes/icons/next.svg
diff --git a/public/themes/icons/non-starred.svg b/p/themes/icons/non-starred.svg
similarity index 100%
rename from public/themes/icons/non-starred.svg
rename to p/themes/icons/non-starred.svg
diff --git a/public/themes/icons/prev.svg b/p/themes/icons/prev.svg
similarity index 100%
rename from public/themes/icons/prev.svg
rename to p/themes/icons/prev.svg
diff --git a/public/themes/icons/read.svg b/p/themes/icons/read.svg
similarity index 100%
rename from public/themes/icons/read.svg
rename to p/themes/icons/read.svg
diff --git a/public/themes/icons/refresh.svg b/p/themes/icons/refresh.svg
similarity index 100%
rename from public/themes/icons/refresh.svg
rename to p/themes/icons/refresh.svg
diff --git a/public/themes/icons/rss.svg b/p/themes/icons/rss.svg
similarity index 100%
rename from public/themes/icons/rss.svg
rename to p/themes/icons/rss.svg
diff --git a/public/themes/icons/search.svg b/p/themes/icons/search.svg
similarity index 100%
rename from public/themes/icons/search.svg
rename to p/themes/icons/search.svg
diff --git a/public/themes/icons/share.svg b/p/themes/icons/share.svg
similarity index 100%
rename from public/themes/icons/share.svg
rename to p/themes/icons/share.svg
diff --git a/public/themes/icons/starred.svg b/p/themes/icons/starred.svg
similarity index 100%
rename from public/themes/icons/starred.svg
rename to p/themes/icons/starred.svg
diff --git a/public/themes/icons/tag.svg b/p/themes/icons/tag.svg
similarity index 100%
rename from public/themes/icons/tag.svg
rename to p/themes/icons/tag.svg
diff --git a/public/themes/icons/unread.svg b/p/themes/icons/unread.svg
similarity index 100%
rename from public/themes/icons/unread.svg
rename to p/themes/icons/unread.svg
diff --git a/public/themes/icons/up.svg b/p/themes/icons/up.svg
similarity index 100%
rename from public/themes/icons/up.svg
rename to p/themes/icons/up.svg