Skip to content

Commit

Permalink
Check that Shaarli has the right to write in its own directory.
Browse files Browse the repository at this point in the history
Because some user forget to check this at installation.
  • Loading branch information
sebsauvage committed Mar 4, 2013
1 parent 8a80e4f commit f2cb5f9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function stripslashes_deep($value) { $value = is_array($value) ? array_map('stri
header("Pragma: no-cache");

// Directories creations (Note that your web host may require differents rights than 705.)
if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>');
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.
Expand Down

1 comment on commit f2cb5f9

@sebsauvage
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit closes issue #31

Please sign in to comment.