Symlink captive portal elements over to /var/db/cpelements on bootup and creation/deletion

This commit is contained in:
Scott Ullrich 2006-01-31 20:37:10 +00:00
parent 551ef384b1
commit f85166d320
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}