'; $alert_danger_html = '' . '|'); } elseif (!is_file($_POST['file'])) { print('|3|' . $alert_danger_html . gettext("File does not exist or is not a regular file") . '' . '|'); } else { $data = file_get_contents(urldecode($_POST['file'])); if ($data === false) { print('|1|' . $alert_danger_html . gettext("Failed to read file") . '' . '|'); } else { $data = base64_encode($data); print("|0|{$_POST['file']}|{$data}|"); } } exit; case 'save': if (strlen($_POST['file']) < 1) { print('|' . $alert_danger_html . gettext("No file name specified") . '' . '|'); } else { conf_mount_rw(); $_POST['data'] = str_replace("\r", "", base64_decode($_POST['data'])); $ret = file_put_contents($_POST['file'], $_POST['data']); conf_mount_ro(); if ($_POST['file'] == "/conf/config.xml" || $_POST['file'] == "/cf/conf/config.xml") { if (file_exists("/tmp/config.cache")) { unlink("/tmp/config.cache"); } disable_security_checks(); } if ($ret === false) { print('|' . $alert_danger_html . gettext("Failed to write file") . '' . '|'); } elseif ($ret != strlen($_POST['data'])) { print('|' . $alert_danger_html . gettext("Error while writing file") . '' . '|'); } else { print('|' . $alert_success_html . gettext("File saved successfully") . '' . '|'); } } exit; } exit; } require("head.inc"); ?>