mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Symlink captive portal elements over to /var/db/cpelements on bootup and creation/deletion
This commit is contained in:
parent
551ef384b1
commit
f85166d320
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user