From ed44cbea39ff36f2c4ea02de8d3968d83cb06d5d Mon Sep 17 00:00:00 2001 From: crestAT Date: Tue, 2 Aug 2016 08:35:55 +0200 Subject: [PATCH] force common directory to set below /mnt/ --- OBI.php | 33 ++++++++++-------- .../ext/onebuttoninstaller-config.php | 15 +++++--- onebuttoninstaller/ext/onebuttoninstaller.php | 6 ++-- .../locale-obi/de/LC_MESSAGES/nas4free.mo | Bin 8333 -> 8698 bytes 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/OBI.php b/OBI.php index 59b05ee..f0a51e5 100644 --- a/OBI.php +++ b/OBI.php @@ -76,21 +76,26 @@ if (isset($_POST['save']) && $_POST['save']) { if (empty($input_errors)) { $config['onebuttoninstaller']['storage_path'] = !empty($_POST['storage_path']) ? $_POST['storage_path'] : $g['media_path']; $config['onebuttoninstaller']['storage_path'] = rtrim($config['onebuttoninstaller']['storage_path'],'/'); // ensure to have NO trailing slash - if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); - change_perms($config['onebuttoninstaller']['storage_path']); - $install_dir = $config['onebuttoninstaller']['storage_path']."/"; // get directory where the installer script resides - if (!is_dir("{$install_dir}onebuttoninstaller/log")) { mkdir("{$install_dir}onebuttoninstaller/log", 0775, true); } - $return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true); - if ($return_val == 0) { - chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); - require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + if (strpos($config['onebuttoninstaller']['storage_path'], "/mnt/") === false) { + $input_errors[] = gettext("The common directory for all extensions MUST be set to a directory below '/mnt/' to prevent to loose the extensions after a reboot on embedded systems!"); } - else { - $input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); - exit; + else { + if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); + change_perms($config['onebuttoninstaller']['storage_path']); + $install_dir = $config['onebuttoninstaller']['storage_path']."/"; // get directory where the installer script resides + if (!is_dir("{$install_dir}onebuttoninstaller/log")) { mkdir("{$install_dir}onebuttoninstaller/log", 0775, true); } + $return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", true); + if ($return_val == 0) { + chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); + require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + } + else { + $input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); + exit; + } + mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); + header("Location:onebuttoninstaller-config.php"); } - mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); - header("Location:onebuttoninstaller-config.php"); } } @@ -111,7 +116,7 @@ include("fbegin.inc"); ?> - /mnt/)."), $pconfig['storage_path'], true, 60);?> + /mnt/)."), $pconfig['storage_path'], true, 60);?>
"/> diff --git a/onebuttoninstaller/ext/onebuttoninstaller-config.php b/onebuttoninstaller/ext/onebuttoninstaller-config.php index 25a9e49..f9a9379 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller-config.php +++ b/onebuttoninstaller/ext/onebuttoninstaller-config.php @@ -82,10 +82,15 @@ if (isset($_POST['save']) && $_POST['save']) { $config['onebuttoninstaller']['enable'] = isset($_POST['enable']) ? true : false; $config['onebuttoninstaller']['storage_path'] = !empty($_POST['storage_path']) ? $_POST['storage_path'] : $g['media_path']; $config['onebuttoninstaller']['storage_path'] = rtrim($config['onebuttoninstaller']['storage_path'],'/'); // ensure to have NO trailing slash - if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); - change_perms($_POST['storage_path']); - $config['onebuttoninstaller']['auto_update'] = isset($_POST['auto_update']) ? true : false; - $savemsg .= get_std_save_message(write_config()); + if (strpos($config['onebuttoninstaller']['storage_path'], "/mnt/") === false) { + $input_errors[] = gettext("The common directory for all extensions MUST be set to a directory below '/mnt/' to prevent to loose the extensions after a reboot on embedded systems!"); + } + else { + if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); + change_perms($_POST['storage_path']); + $config['onebuttoninstaller']['auto_update'] = isset($_POST['auto_update']) ? true : false; + $savemsg .= get_std_save_message(write_config()); + } } // end of empty input_errors } @@ -126,7 +131,7 @@ function enable_change(enable_change) { - /mnt/)."), $pconfig['storage_path'], true, 60);?> + /mnt/)."), $pconfig['storage_path'], true, 60);?>
diff --git a/onebuttoninstaller/ext/onebuttoninstaller.php b/onebuttoninstaller/ext/onebuttoninstaller.php index 9aee530..ff2e710 100644 --- a/onebuttoninstaller/ext/onebuttoninstaller.php +++ b/onebuttoninstaller/ext/onebuttoninstaller.php @@ -232,9 +232,9 @@ bindtextdomain("nas4free", "/usr/local/share/locale-obi"); ?>
".gettext("Some extensions need to finish their installation procedures on their own extension page before they will be shown as installed!")."

");?> - -    
-    

+ +    
+    

" value="" onclick="return confirm('')" /> diff --git a/onebuttoninstaller/locale-obi/de/LC_MESSAGES/nas4free.mo b/onebuttoninstaller/locale-obi/de/LC_MESSAGES/nas4free.mo index 520cfe40361ff438e95ec52430b0995459a075af..cdfd6ca359dd1bf83bdd31fb9779ef7b27ca0673 100644 GIT binary patch delta 1493 zcmYk+TWkzb7{KwvE^Sd%+ETZkRn)B)y(n5mL}*efDPE}9wWsaI&I~iNtqNHp5f3hr z4G$iqL0l4PB%2TqB5p5IZTiRqA`v_Zk+?*{|J!cD$)5S0IWu#g8>ed+;K|nqAw3)oSX4VRpT)7Qz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