diff --git a/mocha-php/src/mocha-php/ui/pages/SUVPage.phpx.php b/mocha-php/src/mocha-php/ui/pages/SUVPage.phpx.php index 7850195..c5b98fd 100644 --- a/mocha-php/src/mocha-php/ui/pages/SUVPage.phpx.php +++ b/mocha-php/src/mocha-php/ui/pages/SUVPage.phpx.php @@ -26,7 +26,7 @@ catch (\Exception $ex) { $pdoex = $ex; - echo($pdoex); die(); + // echo($pdoex); die(); } $basepath = $_SERVER["SERVER_NAME"]; @@ -34,31 +34,33 @@ { protected function OnPreRender(CancelEventArgs $e) { - global $pdo; global $basepath; $e->Cancel = true; if ($_POST["reset"] == "1") { - $stmt = $pdo->prepare("DELETE FROM mocha_attributes WHERE tenant_id > 2"); - $stmt->execute(); - - $stmt = $pdo->prepare("DELETE FROM mocha_relationships WHERE tenant_id > 2"); - $stmt->execute(); + global $pdo; + if ($pdo !== null) { + $stmt = $pdo->prepare("DELETE FROM mocha_attributes WHERE tenant_id > 2"); + $stmt->execute(); - $stmt = $pdo->prepare("DELETE FROM mocha_instances WHERE tenant_id > 2"); - $stmt->execute(); - - $stmt = $pdo->prepare("DELETE FROM mocha_tenant_references WHERE source_tenant_id > 2"); - $stmt->execute(); - - $stmt = $pdo->prepare("DELETE FROM mocha_tenants WHERE id > 2"); - $stmt->execute(); + $stmt = $pdo->prepare("DELETE FROM mocha_relationships WHERE tenant_id > 2"); + $stmt->execute(); - header("HTTP/1.1 302 Found"); - header("Location: /suv/suvinfo.html"); - exit(); + $stmt = $pdo->prepare("DELETE FROM mocha_instances WHERE tenant_id > 2"); + $stmt->execute(); + + $stmt = $pdo->prepare("DELETE FROM mocha_tenant_references WHERE source_tenant_id > 2"); + $stmt->execute(); + + $stmt = $pdo->prepare("DELETE FROM mocha_tenants WHERE id > 2"); + $stmt->execute(); + + header("HTTP/1.1 302 Found"); + header("Location: /suv/suvinfo.html"); + exit(); + } } $path = System::GetVirtualPath(); @@ -328,39 +330,40 @@ EOF else { global $pdo; - global $basepath; - - $query = "SELECT * FROM mocha_tenants"; - $stmt = $pdo->prepare($query); - try - { - $result = $stmt->execute(); - $rows = $stmt->fetchAll(); - foreach ($rows as $values) - { - if ($values["is_library"] != 0) - { - continue; + if ($pdo !== null) { + global $basepath; + + $query = "SELECT * FROM mocha_tenants"; + $stmt = $pdo->prepare($query); + try { + $result = $stmt->execute(); + $rows = $stmt->fetchAll(); + foreach ($rows as $values) { + if ($values["is_library"] != 0) { + continue; + } + ?> +