Devices: Database class integration.

This commit is contained in:
Nate
2019-08-03 20:21:56 -06:00
parent bc786a8f65
commit f841650075
26 changed files with 1420 additions and 1789 deletions
+162 -164
View File
@@ -50,19 +50,18 @@
$sql .= "v_domains as d2 ";
$sql .= "where ";
$sql .= "d1.domain_uuid = d2.domain_uuid and ";
$sql .= "d1.device_mac_address = '".check_str($_GET["mac"])."' ";
if ($_GET["device_uuid"] != '') {
$sql .= " and d1.device_uuid <> '".check_str($_GET["device_uuid"])."' ";
$sql .= "d1.device_mac_address = :device_mac_address ";
if (is_uuid($_GET["device_uuid"])) {
$sql .= " and d1.device_uuid <> :device_uuid ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['domain_name'] != '') {
echo $text['message-duplicate'].((if_group("superadmin") && $_SESSION["domain_name"] != $row["domain_name"]) ? ": ".$row["domain_name"] : null);
}
$parameters['device_mac_address'] = $_GET["mac"];
$parameters['device_uuid'] = $_GET["device_uuid"];
$database = new database;
$domain_name = $database->select($sql, $parameters, 'column');
if ($domain_name != '') {
echo $text['message-duplicate'].(if_group("superadmin") && $_SESSION["domain_name"] != $domain_name ? ": ".$domain_name : null);
}
unset($prep_statement);
unset($sql, $parameters, $domain_name);
}
//username
@@ -75,22 +74,22 @@
$sql .= "v_domains as d2 ";
$sql .= "where ";
$sql .= "d1.domain_uuid = d2.domain_uuid and ";
$sql .= "d1.device_username = '".check_str($_GET["username"])."' ";
if ($_GET['domain_uuid'] != '') {
$sql .= "and d2.domain_uuid = '".check_str($_GET['domain_uuid'])."' ";
$sql .= "d1.device_username = :device_username ";
if (is_uuid($_GET['domain_uuid'])) {
$sql .= "and d2.domain_uuid = :domain_uuid ";
}
if ($_GET['device_uuid'] != '') {
$sql .= "and d1.device_uuid <> '".check_str($_GET["device_uuid"])."' ";
if (is_uuid($_GET['device_uuid'])) {
$sql .= "and d1.device_uuid <> :device_uuid ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['domain_name'] != '') {
echo $text['message-duplicate_username'].((if_group("superadmin")) ? ": ".format_mac($row['device_mac_address']).(($_SESSION["domain_name"] != $row["domain_name"]) ? " (".$row["domain_name"].")" : null) : null);
}
$parameters['device_username'] = $_GET["username"];
$parameters['domain_uuid'] = $_GET["domain_uuid"];
$parameters['device_uuid'] = $_GET["device_uuid"];
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0 && $row['domain_name'] != '') {
echo $text['message-duplicate_username'].(if_group("superadmin") ? ": ".format_mac($row['device_mac_address']).($_SESSION["domain_name"] != $row["domain_name"] ? " (".$row["domain_name"].")" : null) : null);
}
unset($prep_statement);
unset($sql, $parameters, $row);
}
exit;
@@ -100,9 +99,9 @@
require_once "app/devices/resources/classes/device.php";
//action add or update
if (isset($_REQUEST["id"])) {
if (is_uuid($_REQUEST["id"])) {
$action = "update";
$device_uuid = check_str($_REQUEST["id"]);
$device_uuid = $_REQUEST["id"];
}
else {
$action = "add";
@@ -111,19 +110,16 @@
//get total device count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['devices']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_devices = $row['num_rows'];
}
unset($prep_statement, $row);
$sql = "select count(*) from v_devices where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$total_devices = $database->select($sql, $parameters, 'column');
if ($total_devices >= $_SESSION['limit']['devices']['numeric']) {
message::add($text['message-maximum_devices'].' '.$_SESSION['limit']['devices']['numeric'], 'negative');
header('Location: devices.php');
return;
exit;
}
unset($sql, $parameters, $total_devices);
}
}
@@ -131,60 +127,60 @@
if (count($_POST) > 0) {
//device mac address
if (permission_exists('device_mac_address')) {
$device_mac_address = check_str($_POST["device_mac_address"]);
$device_mac_address = $_POST["device_mac_address"];
$device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address));
$_POST["device_mac_address"] = $device_mac_address;
}
else {
$sql = "select * from v_devices ";
$sql .= "where device_uuid = '$device_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$sql .= "where device_uuid = :device_uuid ";
$parameters['device_uuid'] = $device_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$device_mac_address = $row["device_mac_address"];
$_POST["device_mac_address"] = $device_mac_address;
}
unset ($prep_statement);
unset($sql, $parameters, $row);
}
//get assigned user
$device_user_uuid = check_str($_POST["device_user_uuid"]);
$device_user_uuid = $_POST["device_user_uuid"];
//devices
$device_label = check_str($_POST["device_label"]);
$device_vendor = check_str($_POST["device_vendor"]);
$device_uuid_alternate = check_str($_POST["device_uuid_alternate"]);
$device_model = check_str($_POST["device_model"]);
$device_firmware_version = check_str($_POST["device_firmware_version"]);
$device_enabled = check_str($_POST["device_enabled"]);
$device_template = check_str($_POST["device_template"]);
$device_description = check_str($_POST["device_description"]);
$device_label = $_POST["device_label"];
$device_vendor = $_POST["device_vendor"];
$device_uuid_alternate = $_POST["device_uuid_alternate"];
$device_model = $_POST["device_model"];
$device_firmware_version = $_POST["device_firmware_version"];
$device_enabled = $_POST["device_enabled"];
$device_template = $_POST["device_template"];
$device_description = $_POST["device_description"];
//lines
$line_number = check_str($_POST["line_number"]);
$server_address = check_str($_POST["server_address"]);
$outbound_proxy_primary = check_str($_POST["outbound_proxy_primary"]);
$outbound_proxy_secondary = check_str($_POST["outbound_proxy_secondary"]);
$display_name = check_str($_POST["display_name"]);
$user_id = check_str($_POST["user_id"]);
$auth_id = check_str($_POST["auth_id"]);
$password = check_str($_POST["password"]);
$line_number = $_POST["line_number"];
$server_address = $_POST["server_address"];
$outbound_proxy_primary = $_POST["outbound_proxy_primary"];
$outbound_proxy_secondary = $_POST["outbound_proxy_secondary"];
$display_name = $_POST["display_name"];
$user_id = $_POST["user_id"];
$auth_id = $_POST["auth_id"];
$password = $_POST["password"];
//profile
$device_profile_uuid = check_str($_POST["device_profile_uuid"]);
$device_profile_uuid = $_POST["device_profile_uuid"];
//keys
$device_key_category = check_str($_POST["device_key_category"]);
$device_key_id = check_str($_POST["device_key_id"]);
$device_key_type = check_str($_POST["device_key_type"]);
$device_key_line = check_str($_POST["device_key_line"]);
$device_key_value = check_str($_POST["device_key_value"]);
$device_key_extension = check_str($_POST["device_key_extension"]);
$device_key_label = check_str($_POST["device_key_label"]);
$device_key_icon = check_str($_POST["device_key_icon"]);
$device_key_category = $_POST["device_key_category"];
$device_key_id = $_POST["device_key_id"];
$device_key_type = $_POST["device_key_type"];
$device_key_line = $_POST["device_key_line"];
$device_key_value = $_POST["device_key_value"];
$device_key_extension = $_POST["device_key_extension"];
$device_key_label = $_POST["device_key_label"];
$device_key_icon = $_POST["device_key_icon"];
//settings
//$device_setting_category = check_str($_POST["device_setting_category"]);
$device_setting_subcategory = check_str($_POST["device_setting_subcategory"]);
//$device_setting_name = check_str($_POST["device_setting_name"]);
$device_setting_value = check_str($_POST["device_setting_value"]);
$device_setting_enabled = check_str($_POST["device_setting_enabled"]);
$device_setting_description = check_str($_POST["device_setting_description"]);
//$device_setting_category = $_POST["device_setting_category"]);
$device_setting_subcategory = $_POST["device_setting_subcategory"];
//$device_setting_name = $_POST["device_setting_name"];
$device_setting_value = $_POST["device_setting_value"];
$device_setting_enabled = $_POST["device_setting_enabled"];
$device_setting_description = $_POST["device_setting_description"];
}
//use the mac address to get the vendor
@@ -259,7 +255,7 @@
unset($_POST["device_keys"][$x]);
}
//unset device_detail_uuid if the field has no value
if (strlen($row["device_key_uuid"]) == 0) {
if (!is_uuid($row["device_key_uuid"])) {
unset($_POST["device_keys"][$x]["device_key_uuid"]);
}
//increment the row
@@ -272,7 +268,7 @@
unset($_POST["device_settings"][$x]);
}
//unset device_detail_uuid if the field has no value
if (strlen($row["device_setting_uuid"]) == 0) {
if (!is_uuid($row["device_setting_uuid"])) {
unset($_POST["device_settings"][$x]["device_setting_uuid"]);
}
//increment the row
@@ -308,12 +304,12 @@
$database = new database;
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
if (strlen($device_uuid) > 0) {
if (is_uuid($device_uuid)) {
$database->uuid($device_uuid);
}
$database->save($array);
$response = $database->message;
if (strlen($response['uuid']) > 0) {
if (is_uuid($response['uuid'])) {
$device_uuid = $response['uuid'];
}
}
@@ -348,11 +344,11 @@
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$sql = "select * from v_devices ";
$sql .= "where device_uuid = '$device_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$sql .= "where device_uuid = :device_uuid ";
$parameters['device_uuid'] = $device_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$device_mac_address = $row["device_mac_address"];
$device_provisioned_ip = $row["device_provisioned_ip"];
$domain_uuid = $row["domain_uuid"];
@@ -371,7 +367,7 @@
$device_profile_uuid = $row["device_profile_uuid"];
$device_description = $row["device_description"];
}
unset ($prep_statement);
unset($sql, $parameters, $row);
}
//use the mac address to get the vendor
@@ -384,23 +380,26 @@
$x = "999";
//alternate device settings
if (strlen($device_uuid_alternate) > 0) {
if (is_uuid($device_uuid_alternate)) {
$sql = "select * from v_devices ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
$sql .= "and device_uuid = '$device_uuid_alternate' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_alternate = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "and device_uuid = :device_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['device_uuid'] = $device_uuid_alternate;
$database = new database;
$device_alternate = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
}
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql = "select * from v_device_lines ";
$sql .= "where device_uuid = :device_uuid ";
$sql .= "order by cast(line_number as int) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$parameters['device_uuid'] = $device_uuid;
$database = new database;
$device_lines = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$device_lines[$x]['line_number'] = '';
$device_lines[$x]['server_address'] = '';
$device_lines[$x]['outbound_proxy_primary'] = $_SESSION['provision']['outbound_proxy_primary']['text'];
@@ -418,31 +417,28 @@
$device_lines[$x]['register_expires'] = $_SESSION['provision']['line_register_expires']['numeric'];
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql = "select * from v_device_keys ";
$sql .= "where device_uuid = :device_uuid ";
$sql .= "order by ";
$sql .= "device_key_vendor asc, ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memory' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "WHEN 'expansion-1' THEN 5 ";
$sql .= "WHEN 'expansion-2' THEN 6 ";
$sql .= "WHEN 'expansion-3' THEN 7 ";
$sql .= "WHEN 'expansion-4' THEN 8 ";
$sql .= "WHEN 'expansion-5' THEN 9 ";
$sql .= "WHEN 'expansion-6' THEN 10 ";
$sql .= "ELSE 100 END, ";
if ($db_type == "mysql") {
$sql .= "device_key_id asc ";
}
else {
$sql .= "cast(device_key_id as numeric) asc ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$sql .= "case device_key_category ";
$sql .= "when 'line' then 1 ";
$sql .= "when 'memory' then 2 ";
$sql .= "when 'programmable' then 3 ";
$sql .= "when 'expansion' then 4 ";
$sql .= "when 'expansion-1' then 5 ";
$sql .= "when 'expansion-2' then 6 ";
$sql .= "when 'expansion-3' then 7 ";
$sql .= "when 'expansion-4' then 8 ";
$sql .= "when 'expansion-5' then 9 ";
$sql .= "when 'expansion-6' then 10 ";
$sql .= "else 100 end, ";
$sql .= $db_type == "mysql" ? "device_key_id asc " : "cast(device_key_id as numeric) asc ";
$parameters['device_uuid'] = $device_uuid;
$database = new database;
$device_keys = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$device_keys[$x]['device_key_category'] = '';
$device_keys[$x]['device_key_id'] = '';
$device_keys[$x]['device_key_type'] = '';
@@ -453,45 +449,48 @@
$device_keys[$x]['device_key_icon'] = '';
//get the device vendors
$sql = "SELECT name ";
$sql .= "FROM v_device_vendors ";
$sql .= "WHERE enabled = 'true' ";
$sql .= "ORDER BY name ASC ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_vendors = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$sql = "select name ";
$sql .= "from v_device_vendors ";
$sql .= "where enabled = 'true' ";
$sql .= "order by name asc ";
$database = new database;
$device_vendors = $database->select($sql, null, 'all');
unset($sql);
//get the vendor functions
$sql = "SELECT v.name as vendor_name, f.name, f.value ";
$sql .= "FROM v_device_vendors as v, v_device_vendor_functions as f ";
$sql .= "WHERE v.device_vendor_uuid = f.device_vendor_uuid ";
$sql = "select v.name as vendor_name, f.name, f.value ";
$sql .= "from v_device_vendors as v, v_device_vendor_functions as f ";
$sql .= "where v.device_vendor_uuid = f.device_vendor_uuid ";
$sql .= "and v.enabled = 'true' ";
$sql .= "and f.enabled = 'true' ";
$sql .= "order by v.name asc, f.name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$vendor_functions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$database = new database;
$vendor_functions = $database->select($sql, null, 'all');
unset($sql);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$sql = "select * from v_device_settings ";
$sql .= "where device_uuid = :device_uuid ";
$sql .= "order by device_setting_subcategory asc ";
$parameters['device_uuid'] = $device_uuid;
$database = new database;
$device_settings = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$device_settings[$x]['device_setting_name'] = '';
$device_settings[$x]['device_setting_value'] = '';
$device_settings[$x]['enabled'] = '';
$device_settings[$x]['device_setting_description'] = '';
//get the users
$sql = "SELECT * FROM v_users ";
$sql .= "WHERE domain_uuid = '".$domain_uuid."' ";
$sql .= "AND user_enabled = 'true' ";
$sql .= "ORDER by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$users = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$sql = "select * from v_users ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and user_enabled = 'true' ";
$sql .= "order by username asc ";
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$users = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//use the mac address to get the vendor
if (strlen($device_vendor) == 0) {
@@ -901,7 +900,7 @@
if (strlen($row['register_expires']) == 0) { $row['register_expires'] = $_SESSION['provision']['line_register_expires']['numeric']; }
//determine whether to hide the element
if (strlen($device_line_uuid) == 0) {
if (!is_uuid($device_line_uuid)) {
$element['hidden'] = false;
$element['visibility'] = "visibility:visible;";
}
@@ -910,7 +909,7 @@
$element['visibility'] = "visibility:hidden;";
}
//add the primary key uuid
if (strlen($row['device_line_uuid']) > 0) {
if (is_uuid($row['device_line_uuid'])) {
echo " <input name='device_lines[".$x."][device_line_uuid]' type='hidden' value=\"".escape($row['device_line_uuid'])."\"/>\n";
}
//show each row in the array
@@ -1027,7 +1026,7 @@
echo " </td>\n";
echo " <td>\n";
if (strlen($row['device_line_uuid']) > 0) {
if (is_uuid($row['device_line_uuid'])) {
if (permission_exists('device_delete')) {
echo " <a href='device_line_delete.php?device_uuid=".escape($row['device_uuid'])."&id=".escape($row['device_line_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
@@ -1047,14 +1046,12 @@
if (permission_exists('device_profile_edit')) {
//device profile
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "order by device_profile_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$result = $database->select($sql, $parameters, 'all');
if (is_array($result) && @sizeof($result) != 0) {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-profile']."</td>";
echo " <td class='vtable' align='left'>";
@@ -1070,6 +1067,7 @@
echo " </td>";
echo " </tr>";
}
unset($sql, $parameters, $result);
}
if (permission_exists('device_key_edit')) {
@@ -1124,7 +1122,7 @@
echo " </tr>\n";
}
//determine whether to hide the element
if (strlen($device_key_uuid) == 0) {
if (!is_uuid($device_key_uuid)) {
$element['hidden'] = false;
$element['visibility'] = "visibility:visible;";
}
@@ -1133,7 +1131,7 @@
$element['visibility'] = "visibility:hidden;";
}
//add the primary key uuid
if (strlen($row['device_key_uuid']) > 0) {
if (is_uuid($row['device_key_uuid'])) {
echo " <input name='device_keys[".$x."][device_key_uuid]' type='hidden' value=\"".escape($row['device_key_uuid'])."\"/>\n";
}
//show all the rows in the array
@@ -1307,7 +1305,7 @@
//echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'/>\n";
//echo " </td>\n";
echo " <td nowrap='nowrap'>\n";
if (strlen($row['device_key_uuid']) > 0) {
if (is_uuid($row['device_key_uuid'])) {
if (permission_exists('device_key_delete')) {
echo " <a href='device_key_delete.php?device_uuid=".escape($row['device_uuid'])."&id=".escape($row['device_key_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
@@ -1344,7 +1342,7 @@
$x = 0;
foreach($device_settings as $row) {
//determine whether to hide the element
if (strlen($device_setting_uuid) == 0) {
if (!is_uuid($device_setting_uuid)) {
$element['hidden'] = false;
$element['visibility'] = "visibility:visible;";
}
@@ -1353,7 +1351,7 @@
$element['visibility'] = "visibility:hidden;";
}
//add the primary key uuid
if (strlen($row['device_setting_uuid']) > 0) {
if (is_uuid($row['device_setting_uuid'])) {
echo " <input name='device_settings[".$x."][device_setting_uuid]' type='hidden' value=\"".escape($row['device_setting_uuid'])."\"/>\n";
}
@@ -1395,7 +1393,7 @@
echo " </td>";
echo " <td>\n";
if (strlen($row['device_setting_uuid']) > 0) {
if (is_uuid($row['device_setting_uuid'])) {
if (permission_exists('device_edit')) {
echo " <a href='device_setting_edit.php?device_uuid=".escape($row['device_uuid'])."&id=".escape($row['device_setting_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
}
@@ -1449,7 +1447,7 @@
echo "</tr>\n";
}
if (permission_exists('device_alternate') && strlen($device_uuid_alternate) > 0) {
if (permission_exists('device_alternate') && is_uuid($device_uuid_alternate)) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_uuid_alternate']."\n";
@@ -1516,7 +1514,7 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid' id='domain_uuid'>\n";
if (strlen($domain_uuid) == 0) {
if (!is_uuid($domain_uuid)) {
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
}
else {