diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 789b8539e1..8810a52426 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -892,7 +892,7 @@ function captiveportal_write_elements() { } if (is_array($config['captiveportal']['element'])) { - + conf_mount_rw(); foreach ($config['captiveportal']['element'] as $data) { $fd = @fopen($g['captiveportal_element_path'] . '/' . $data['name'], "wb"); if (!$fd) { @@ -902,7 +902,10 @@ function captiveportal_write_elements() { $decoded = base64_decode($data['content']); fwrite($fd,$decoded); fclose($fd); + unlink_if_exists("{$g['captiveportal_path']}/{$data['name']}"); + mwexec("cd {$g['captiveportal_path']}/ && ln -s {$g['captiveportal_element_path']}/{$data['name']} {$data['name']}"); } + conf_mount_ro(); } return 0; diff --git a/usr/local/www/services_captiveportal_filemanager.php b/usr/local/www/services_captiveportal_filemanager.php index dc52194bfa..d4192e7a33 100755 --- a/usr/local/www/services_captiveportal_filemanager.php +++ b/usr/local/www/services_captiveportal_filemanager.php @@ -83,9 +83,12 @@ if ($_POST) { } } else { if (($_GET['act'] == "del") && $a_element[$_GET['id']]) { + conf_mount_rw(); + unlink_if_exists($g['captiveportal_path'] . "/" . $a_element[$id]['name']); unset($a_element[$_GET['id']]); write_config(); captiveportal_write_elements(); + conf_mount_ro(); header("Location: services_captiveportal_filemanager.php"); exit; }