summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-07-02 19:05:07 +0000
committerErmal <eri@pfsense.org>2013-07-02 19:05:07 +0000
commitbdba4fa76214dc8c73e679f6da1d346d1e77b4b2 (patch)
treedd561402737dee8f13cb5a6f9f80d4ab15d6b27e
parent97752da5426af63b168f3af71090f034c08c7374 (diff)
downloadpfsense-bdba4fa76214dc8c73e679f6da1d346d1e77b4b2.zip
pfsense-bdba4fa76214dc8c73e679f6da1d346d1e77b4b2.tar.gz
Correct variable used to delete symlinks and files delete from CP filemanager. Reported-by: http://forum.pfsense.org/index.php/topic,64016.0/topicseen.html. While here reduce some uneeded extra operations
-rw-r--r--etc/inc/captiveportal.inc15
-rwxr-xr-xusr/local/www/services_captiveportal_filemanager.php6
2 files changed, 6 insertions, 15 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index 2aceff1..669c98a 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1319,17 +1319,8 @@ function captiveportal_write_elements() {
$cpcfg = $config['captiveportal'][$cpzone];
- /* delete any existing elements */
- if (is_dir($g['captiveportal_element_path'])) {
- $dh = opendir($g['captiveportal_element_path']);
- while (($file = readdir($dh)) !== false) {
- if ($file != "." && $file != "..")
- unlink($g['captiveportal_element_path'] . "/" . $file);
- }
- closedir($dh);
- } else {
+ if (!is_dir($g['captiveportal_element_path']))
@mkdir($g['captiveportal_element_path']);
- }
if (is_array($cpcfg['element'])) {
conf_mount_rw();
@@ -1338,8 +1329,8 @@ function captiveportal_write_elements() {
printf(gettext("Error: cannot open '%s' in captiveportal_write_elements()%s"), $data['name'], "\n");
return 1;
}
- unlink_if_exists("{$g['captiveportal_path']}/{$data['name']}");
- @symlink("{$g['captiveportal_element_path']}/{$data['name']}", "{$g['captiveportal_path']}/{$data['name']}");
+ if (!file_exists("{$g['captiveportal_path']}/{$data['name']}"))
+ @symlink("{$g['captiveportal_element_path']}/{$data['name']}", "{$g['captiveportal_path']}/{$data['name']}");
}
conf_mount_ro();
}
diff --git a/usr/local/www/services_captiveportal_filemanager.php b/usr/local/www/services_captiveportal_filemanager.php
index aedd191..2c673a0 100755
--- a/usr/local/www/services_captiveportal_filemanager.php
+++ b/usr/local/www/services_captiveportal_filemanager.php
@@ -123,11 +123,11 @@ if ($_POST) {
}
} else if (($_GET['act'] == "del") && !empty($cpzone) && $a_element[$_GET['id']]) {
conf_mount_rw();
- unlink_if_exists($g['captiveportal_path'] . "/" . $a_element[$id]['name']);
+ @unlink("{$g['captiveportal_element_path']}/" . $a_element[$_GET['id']]['name']);
+ @unlink("{$g['captiveportal_path']}/" . $a_element[$_GET['id']]['name']);
+ conf_mount_ro();
unset($a_element[$_GET['id']]);
write_config();
- captiveportal_write_elements();
- conf_mount_ro();
header("Location: services_captiveportal_filemanager.php?zone={$cpzone}");
exit;
}
OpenPOWER on IntegriCloud