mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-06-07 00:47:00 +03:00
Don't close the database connection and make it global. Also, honour the account that is set in pdns, unless its empty
This commit is contained in:
parent
92ac4576ab
commit
77192d84b1
2 changed files with 10 additions and 14 deletions
|
@ -112,7 +112,6 @@ function add_db_zone($zonename, $accountname) {
|
|||
$q->bindValue(1, $zonename, SQLITE3_TEXT);
|
||||
$q->bindValue(2, $accountname, SQLITE3_TEXT);
|
||||
$q->execute();
|
||||
$db->close();
|
||||
}
|
||||
|
||||
function delete_db_zone($zonename) {
|
||||
|
@ -123,7 +122,6 @@ function delete_db_zone($zonename) {
|
|||
$q = $db->prepare("DELETE FROM zones WHERE zone = ?");
|
||||
$q->bindValue(1, $zonename, SQLITE3_TEXT);
|
||||
$q->execute();
|
||||
$db->close();
|
||||
}
|
||||
|
||||
function get_zone_account($zonename, $default) {
|
||||
|
@ -135,7 +133,6 @@ function get_zone_account($zonename, $default) {
|
|||
$q->bindValue(1, $zonename, SQLITE3_TEXT);
|
||||
$result = $q->execute();
|
||||
$zoneinfo = $result->fetchArray(SQLITE3_ASSOC);
|
||||
$db->close();
|
||||
if (isset($zoneinfo['emailaddress']) && $zoneinfo['emailaddress'] != null ) {
|
||||
return $zoneinfo['emailaddress'];
|
||||
}
|
||||
|
@ -165,7 +162,9 @@ case "listslaves":
|
|||
foreach ($api->listzones($q) as $sresult) {
|
||||
$zone = new Zone();
|
||||
$zone->parse($sresult);
|
||||
$zone->setAccount(get_zone_account($zone->name, 'admin'));
|
||||
if ($zone->account == '') {
|
||||
$zone->setAccount(get_zone_account($zone->name, 'admin'));
|
||||
}
|
||||
|
||||
if (!check_account($zone))
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue