From f2cb5f95a9505d0a656990307daaef441505d213 Mon Sep 17 00:00:00 2001 From: Sebastien SAUVAGE Date: Mon, 4 Mar 2013 21:14:07 +0100 Subject: [PATCH] Check that Shaarli has the right to write in its own directory. Because some user forget to check this at installation. --- index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/index.php b/index.php index 8197719..7b2781f 100644 --- a/index.php +++ b/index.php @@ -78,6 +78,7 @@ header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // Directories creations (Note that your web host may require differents rights than 705.) +if (!is_writable(realpath(dirname(__FILE__)))) die('
ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').
'); if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files. if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.