Revision bdba4fa7
Added by Ermal LUÇI almost 12 years ago
etc/inc/captiveportal.inc | ||
---|---|---|
1319 | 1319 |
|
1320 | 1320 |
$cpcfg = $config['captiveportal'][$cpzone]; |
1321 | 1321 |
|
1322 |
/* delete any existing elements */ |
|
1323 |
if (is_dir($g['captiveportal_element_path'])) { |
|
1324 |
$dh = opendir($g['captiveportal_element_path']); |
|
1325 |
while (($file = readdir($dh)) !== false) { |
|
1326 |
if ($file != "." && $file != "..") |
|
1327 |
unlink($g['captiveportal_element_path'] . "/" . $file); |
|
1328 |
} |
|
1329 |
closedir($dh); |
|
1330 |
} else { |
|
1322 |
if (!is_dir($g['captiveportal_element_path'])) |
|
1331 | 1323 |
@mkdir($g['captiveportal_element_path']); |
1332 |
} |
|
1333 | 1324 |
|
1334 | 1325 |
if (is_array($cpcfg['element'])) { |
1335 | 1326 |
conf_mount_rw(); |
... | ... | |
1338 | 1329 |
printf(gettext("Error: cannot open '%s' in captiveportal_write_elements()%s"), $data['name'], "\n"); |
1339 | 1330 |
return 1; |
1340 | 1331 |
} |
1341 |
unlink_if_exists("{$g['captiveportal_path']}/{$data['name']}");
|
|
1342 |
@symlink("{$g['captiveportal_element_path']}/{$data['name']}", "{$g['captiveportal_path']}/{$data['name']}"); |
|
1332 |
if (!file_exists("{$g['captiveportal_path']}/{$data['name']}"))
|
|
1333 |
@symlink("{$g['captiveportal_element_path']}/{$data['name']}", "{$g['captiveportal_path']}/{$data['name']}");
|
|
1343 | 1334 |
} |
1344 | 1335 |
conf_mount_ro(); |
1345 | 1336 |
} |
Also available in: Unified diff
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