File and directory rights
- Sets the file and directory permissions from the FP main directory and its subdirectories when executing the setup. - See #307
This commit is contained in:
commit
94780adfdf
10
defaults.php
10
defaults.php
@ -18,10 +18,11 @@
|
|||||||
define('DUMB_MODE_ENABLED', false);
|
define('DUMB_MODE_ENABLED', false);
|
||||||
|
|
||||||
// default file permissions
|
// 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.
|
// Note: Lowering the directory and file permissions may result in FlatPress or some additional plugins not working correctly.
|
||||||
define('FILE_PERMISSIONS', 0776);
|
define('FILE_PERMISSIONS', 0666);
|
||||||
define('DIR_PERMISSIONS', 0776);
|
define('DIR_PERMISSIONS', 0777);
|
||||||
|
|
||||||
// first some webserver setup...
|
// first some webserver setup...
|
||||||
|
|
||||||
@ -34,6 +35,9 @@ define('SESSION_PATH', '');
|
|||||||
define('ABS_PATH', dirname(__FILE__) . '/');
|
define('ABS_PATH', dirname(__FILE__) . '/');
|
||||||
// here was blog root in earlier versions. This has been moved to config_load()
|
// 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
|
// here are default config files
|
||||||
define('FP_DEFAULTS', 'fp-defaults/');
|
define('FP_DEFAULTS', 'fp-defaults/');
|
||||||
|
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
error_reporting($_SERVER ["SERVER_NAME"] == "localhost" ? E_ALL : 0);
|
@error_reporting($_SERVER ["SERVER_NAME"] == "localhost" ? E_ALL : 0);
|
||||||
|
|
||||||
// Changing file/directory permissions recursively
|
// 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 ['file'] = FILE_PERMISSIONS; // chmod value for files
|
||||||
$perms ['folder'] = DIR_PERMISSIONS; // chmod value for folders
|
$perms ['folder'] = DIR_PERMISSIONS; // chmod value for folders
|
||||||
|
|
||||||
function chmod_file_folder($dir) {
|
function chmod_r($dir) {
|
||||||
global $perms;
|
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(is_dir($fullPath)) {
|
||||||
|
// echo('DIR:' . $fullPath . "\n");
|
||||||
if ($file != "." && $file != "..") {
|
@chmod($fullPath, $perms ['folder']);
|
||||||
|
chmod_r($fullPath, $perms ['folder'], $perms ['file']);
|
||||||
$fullpath = $dir . '/' . $file;
|
|
||||||
if (!is_dir($fullpath)) {
|
|
||||||
|
|
||||||
chmod($fullpath, $perms ['file']);
|
|
||||||
} else {
|
} else {
|
||||||
chmod($fullpath, $perms ['folder']);
|
// echo('FILE:' . $fullPath . "\n");
|
||||||
chmod_file_folder($fullpath);
|
@chmod($fullPath, $perms ['file']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
closedir($dp);
|
||||||
closedir($dh);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chmod_r($start_dir, $perms ['folder'], $perms ['file']);
|
||||||
|
|
||||||
|
// Sets the local language based on the browser
|
||||||
$language = @$_POST ['language'] ? $_POST ['language'] : $browserLang;
|
$language = @$_POST ['language'] ? $_POST ['language'] : $browserLang;
|
||||||
|
|
||||||
$lf = "lang.$language.php";
|
$lf = "lang.$language.php";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user