Miraty пре 3 година
родитељ
комит
fdfec134b9
1 измењених фајлова са 11 додато и 3 уклоњено
  1. 11 3
      ns/zone.php

+ 11 - 3
ns/zone.php

@@ -26,7 +26,6 @@ if (isset($_POST['domain']) AND isset($_SESSION['username'])) {
   $knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['domain'] . "zone";
   $knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['domain'] . "zone";
   $knotZone = file_get_contents(NIVER_TEMPLATE_PATH . "/knot.template");
   $knotZone = file_get_contents(NIVER_TEMPLATE_PATH . "/knot.template");
   $knotZone = preg_replace("/DOMAIN/", $_POST['domain'], $knotZone);
   $knotZone = preg_replace("/DOMAIN/", $_POST['domain'], $knotZone);
-
   file_put_contents($knotZonePath, $knotZone);
   file_put_contents($knotZonePath, $knotZone);
   chmod($knotZonePath, 0660);
   chmod($knotZonePath, 0660);
 
 
@@ -64,9 +63,18 @@ if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
 
 
   nsCheckZonePossession($_POST['zone']);
   nsCheckZonePossession($_POST['zone']);
 
 
-  $knotZonePath = KNOT_ZONES_PATH . "/" . $_POST['zone'] . "zone";
-  unlink($knotZonePath);
+  // Remove Knot zone file
+  unlink(KNOT_ZONES_PATH . "/" . $_POST['zone'] . "zone");
+
+  // Remove Knot tied data
+  exec(KNOTC_PATH . " zone-purge" . $_POST['zone']);
+
+  // Remove from Knot configuration
+  exec(KNOTC_PATH . " conf-begin");
+  exec(KNOTC_PATH . " conf-unset 'zone[" . $_POST['domain'] . "]'");
+  exec(KNOTC_PATH . " conf-commit");
 
 
+  // Remove from Niver's database
   $db = new PDO('sqlite:' . DB_PATH);
   $db = new PDO('sqlite:' . DB_PATH);
   $stmt = $db->prepare("DELETE FROM zones WHERE zone = :zone AND username = :username");
   $stmt = $db->prepare("DELETE FROM zones WHERE zone = :zone AND username = :username");