mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Fix TXT-record quoting
This commit is contained in:
parent
b34d7ee2f1
commit
32f0456f21
1 changed files with 8 additions and 0 deletions
|
@ -387,6 +387,14 @@ case "createrecord":
|
||||||
jtable_respond(null, 'error', "Please only use ASCII-characters in your fields");
|
jtable_respond(null, 'error', "Please only use ASCII-characters in your fields");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($type === 'TXT') {
|
||||||
|
# empty TXT records are ok, otherwise require surrounding quotes: "..."
|
||||||
|
if (strlen($content) == 1 || substr($content, 0, 1) !== '"' || substr($content, -1) !== '"') {
|
||||||
|
# fix quoting: first escape all \, then all ", then surround with quotes.
|
||||||
|
$content = '"'.str_replace('"', '\\"', str_replace('\\', '\\\\', $content)).'"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$record = $zone->addRecord($name, $type, $content, $_POST['disabled'], $_POST['ttl'], $_POST['setptr']);
|
$record = $zone->addRecord($name, $type, $content, $_POST['disabled'], $_POST['ttl'], $_POST['setptr']);
|
||||||
$api->savezone($zone->export());
|
$api->savezone($zone->export());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue