diff --git a/actions.php b/actions.php index 6f6df6eef..b786ed849 100644 --- a/actions.php +++ b/actions.php @@ -27,7 +27,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') { } // Controllo sui permessi di scrittura per il file system - elseif ((!is_dir($upload_dir) && !mkdir($upload_dir)) || (is_dir($upload_dir) && !is_writable($upload_dir))) { + elseif ((!is_dir($upload_dir) && !create_dir($upload_dir)) || (is_dir($upload_dir) && !is_writable($upload_dir))) { $_SESSION['errors'][] = str_replace('_DIR_', '"files"', tr('Non hai i permessi di scrittura nella cartella _DIR_!')); } diff --git a/index.php b/index.php index 9604accfd..3b9543ab8 100644 --- a/index.php +++ b/index.php @@ -35,7 +35,7 @@ switch ($op) { } elseif (empty($backup_dir)) { $_SESSION['errors'][] = tr('Non è possibile eseguire i backup poichè la cartella di backup non esiste!!!'); } elseif (!file_exists($backup_dir)) { - if (mkdir($backup_dir)) { + if (create_dir($backup_dir)) { $_SESSION['infos'][] = tr('La cartella di backup è stata creata correttamente.'); if (do_backup()) { $_SESSION['infos'][] = tr('Backup automatico eseguito correttamente!'); diff --git a/lib/functions.php b/lib/functions.php index a9b6cf989..102939228 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -73,12 +73,12 @@ function deltree($path) * * @see http://aidanlister.com/repos/v/function.copyr.php * - * @param string $source - * Source path - * @param string $dest - * Destination path + * @param string $source + * Source path + * @param string $dest + * Destination path * @param array|string $ignores - * Paths to ingore + * Paths to ingore * * @return bool Returns TRUE on success, FALSE on failure */ @@ -95,7 +95,7 @@ function copyr($source, $dest, $ignores = []) // Make destination directory if (!is_dir($dest)) { - mkdir($dest); + create_dir($dest); } // If the source is a symlink @@ -244,7 +244,7 @@ function do_backup() } // Creazione cartella temporanea - if (file_exists($backup_dir.$tmp_backup_dir) || @mkdir($backup_dir.$tmp_backup_dir)) { + if (file_exists($backup_dir.$tmp_backup_dir) || @create_dir($backup_dir.$tmp_backup_dir)) { $do_backup = true; } else { $do_backup = false; @@ -592,7 +592,7 @@ function create_thumbnails($tmp, $filename, $dir) $name = $infos['filename']; $extension = strtolower($infos['extension']); - if ((is_dir($dir) && !is_writable($dir)) || (!is_dir($dir) && !mkdir($dir))) { + if ((is_dir($dir) && !is_writable($dir)) || (!is_dir($dir) && !create_dir($dir))) { return false; } @@ -870,7 +870,8 @@ function sum($first, $second = null, $decimals = null) return $result; } -function redirectOperation(){ +function redirectOperation() +{ $backto = filter('backto'); // Scelta del redirect dopo un submit if (!empty($backto)) { @@ -885,3 +886,8 @@ function redirectOperation(){ } } } + +function create_dir($path) +{ + return create_dir($path, 0777, true); +} diff --git a/modules/aggiornamenti/upload_modules.php b/modules/aggiornamenti/upload_modules.php index 73a0a3a0d..a4e678754 100644 --- a/modules/aggiornamenti/upload_modules.php +++ b/modules/aggiornamenti/upload_modules.php @@ -22,7 +22,7 @@ if (!extension_loaded('zip')) { if ($zip->open($tmp)) { $tmpdir = 'tmp/'; if (!file_exists($docroot.'/'.$tmpdir)) { - mkdir($docroot.'/'.$tmpdir, 0755, true); + create_dir($docroot.'/'.$tmpdir, 0755, true); } $zip->extractTo($docroot.'/'.$tmpdir); diff --git a/modules/backup/edit.php b/modules/backup/edit.php index 0d9102d5a..2720cffda 100644 --- a/modules/backup/edit.php +++ b/modules/backup/edit.php @@ -38,7 +38,7 @@ echo ' // Se la cartella di backup non esiste provo a crearla if (!file_exists($backup_dir)) { - mkdir($backup_dir); + create_dir($backup_dir); } //Lettura file di backup diff --git a/modules/interventi/actions.php b/modules/interventi/actions.php index 29e285b57..ea8addeae 100644 --- a/modules/interventi/actions.php +++ b/modules/interventi/actions.php @@ -528,7 +528,7 @@ switch (post('op')) { break; case 'firma': - $directory_exists = (file_exists($docroot.'/files/interventi') || @mkdir($docroot.'/files/interventi')); + $directory_exists = (file_exists($docroot.'/files/interventi') || @create_dir($docroot.'/files/interventi')); if ($directory_exists) { if (post('firma_base64') != '') { diff --git a/pdfgen.php b/pdfgen.php index 7b7c1c9cc..1bde4e890 100644 --- a/pdfgen.php +++ b/pdfgen.php @@ -101,7 +101,7 @@ $report = str_replace('$rootdir$', $rootdir, $report); // Individuazione dellla configurazione $directory = dirname($filename); -if (!empty($filename) && ((is_dir($directory) && !is_writable($directory)) || (!is_dir($directory) && !mkdir($directory)))) { +if (!empty($filename) && ((is_dir($directory) && !is_writable($directory)) || (!is_dir($directory) && !create_dir($directory)))) { $error = str_replace('_DIRECTORY_', $directory, tr('Non hai i permessi per creare directory e files in _DIRECTORY_')); $_SESSION['errors'][] = $error;