diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-06-09 20:55:02 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-06-09 20:55:02 +0000 |
commit | 4b9b4ed1f443882c7962da3a01a9be90972496a9 (patch) | |
tree | 4de6dc2f11a147d7acde364b36f8b015ef090870 /etc/inc/captiveportal.inc | |
parent | 2ab9b89e8c79c91d57dfa46ded3a0a4ad7a65028 (diff) | |
download | pfsense-4b9b4ed1f443882c7962da3a01a9be90972496a9.zip pfsense-4b9b4ed1f443882c7962da3a01a9be90972496a9.tar.gz |
Unbreak captive portal images.
Diffstat (limited to 'etc/inc/captiveportal.inc')
-rw-r--r-- | etc/inc/captiveportal.inc | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index c25b7d8..6b0f9a1 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -936,19 +936,23 @@ function captiveportal_write_elements() { mkdir($g['captiveportal_element_path']); } - if (is_array($config['captiveportal']['element'])) { - - foreach ($config['captiveportal']['element'] as $data) { - $fd = @fopen($g['captiveportal_element_path'] . '/' . $data['name'], "wb"); - if (!$fd) { - printf("Error: cannot open '{$data['name']}' in captiveportal_write_elements().\n"); - return 1; - } - $decoded = base64_decode($data['content']); - fwrite($fd,$decoded); - fclose($fd); - } - } + 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) { + printf("Error: cannot open '{$data['name']}' in captiveportal_write_elements().\n"); + return 1; + } + $decoded = base64_decode($data['content']); + fwrite($fd,$decoded); + fclose($fd); + unlink_if_exists("{$g['captiveportal_path']}/{$data['name']}"); + 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; } |