File and directory rights
- Sets the file and directory permissions from the FP main directory when executing the setup - See #307
This commit is contained in:
parent
1df9314223
commit
e46963dd7f
10
defaults.php
10
defaults.php
@ -18,10 +18,11 @@
|
||||
define('DUMB_MODE_ENABLED', false);
|
||||
|
||||
// default file permissions
|
||||
// change file to 776 and dir to 776 if your webserver "complains"
|
||||
// https://binary-butterfly.de/artikel/dateirechte-wie-stelle-ich-das-bei-meinem-hoster-ein/
|
||||
// change file to 666 and dir to 777 if your webserver "complains"
|
||||
// Note: Lowering the directory and file permissions may result in FlatPress or some additional plugins not working correctly.
|
||||
define('FILE_PERMISSIONS', 0776);
|
||||
define('DIR_PERMISSIONS', 0776);
|
||||
define('FILE_PERMISSIONS', 0666);
|
||||
define('DIR_PERMISSIONS', 0777);
|
||||
|
||||
// first some webserver setup...
|
||||
|
||||
@ -34,6 +35,9 @@ define('SESSION_PATH', '');
|
||||
define('ABS_PATH', dirname(__FILE__) . '/');
|
||||
// here was blog root in earlier versions. This has been moved to config_load()
|
||||
|
||||
// Is required so that the file and directory permissions can be set when executing the setup
|
||||
define('BASE_DIR', dirname(__FILE__));
|
||||
|
||||
// here are default config files
|
||||
define('FP_DEFAULTS', 'fp-defaults/');
|
||||
|
||||
|
@ -1,36 +1,36 @@
|
||||
<?php
|
||||
error_reporting($_SERVER ["SERVER_NAME"] == "localhost" ? E_ALL : 0);
|
||||
@error_reporting($_SERVER ["SERVER_NAME"] == "localhost" ? E_ALL : 0);
|
||||
|
||||
// Changing file/directory permissions recursively
|
||||
$start_dir = FP_CONTENT; // Starting directory
|
||||
$start_dir = BASE_DIR; // Starting directory
|
||||
$perms ['file'] = FILE_PERMISSIONS; // chmod value for files
|
||||
$perms ['folder'] = DIR_PERMISSIONS; // chmod value for folders
|
||||
|
||||
function chmod_file_folder($dir) {
|
||||
function chmod_r($dir) {
|
||||
global $perms;
|
||||
|
||||
$dh = @opendir($dir);
|
||||
$dp = @opendir($dir);
|
||||
while($file = readdir($dp)) {
|
||||
if (($file == ".") || ($file == ".."))
|
||||
continue;
|
||||
|
||||
if ($dh) {
|
||||
$fullPath = $dir . '/' . $file;
|
||||
|
||||
while (false !== ($file = readdir($dh))) {
|
||||
|
||||
if ($file != "." && $file != "..") {
|
||||
|
||||
$fullpath = $dir . '/' . $file;
|
||||
if (!is_dir($fullpath)) {
|
||||
|
||||
chmod($fullpath, $perms ['file']);
|
||||
if(is_dir($fullPath)) {
|
||||
// echo('DIR:' . $fullPath . "\n");
|
||||
@chmod($fullPath, $perms ['folder']);
|
||||
chmod_r($fullPath, $perms ['folder'], $perms ['file']);
|
||||
} else {
|
||||
chmod($fullpath, $perms ['folder']);
|
||||
chmod_file_folder($fullpath);
|
||||
// echo('FILE:' . $fullPath . "\n");
|
||||
@chmod($fullPath, $perms ['file']);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
closedir($dp);
|
||||
}
|
||||
|
||||
chmod_r($start_dir, $perms ['folder'], $perms ['file']);
|
||||
|
||||
// Sets the local language based on the browser
|
||||
$language = @$_POST ['language'] ? $_POST ['language'] : $browserLang;
|
||||
|
||||
$lf = "lang.$language.php";
|
||||
|
Loading…
x
Reference in New Issue
Block a user