diff --git a/resources/pdo.php b/resources/pdo.php index 9436ea0970..d360d70763 100644 --- a/resources/pdo.php +++ b/resources/pdo.php @@ -17,15 +17,17 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2015 + Portions created by the Initial Developer are Copyright (C) 2008-2016 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane Raymond Chandler */ -include "root.php"; -require_once "resources/functions.php"; + +//includes + include "root.php"; + require_once "resources/functions.php"; //set defaults if (isset($dbtype)) { @@ -267,31 +269,38 @@ if ($db_type == "pgsql") { unset($prep_statement); //put the domains in natural order - natsort($domain_names); - //build the domains array in the correct order - foreach ($domain_names as $dn) { - foreach ($result as $row) { - if ($row['domain_name'] == $dn) { - $domains[] = $row; - } - } + if (is_array($domain_names)) { + natsort($domain_names); } - unset($result); - foreach($domains as $row) { - if (count($domains) == 1) { - $_SESSION["domain_uuid"] = $row["domain_uuid"]; - $_SESSION["domain_name"] = $row['domain_name']; - } - else { - if ($row['domain_name'] == $domain_array[0] || $row['domain_name'] == 'www.'.$domain_array[0]) { - $_SESSION["domain_uuid"] = $row["domain_uuid"]; - $_SESSION["domain_name"] = $row["domain_name"]; + //build the domains array in the correct order + if (is_array($domain_names)) { + foreach ($domain_names as $dn) { + foreach ($result as $row) { + if ($row['domain_name'] == $dn) { + $domains[] = $row; + } } } - $_SESSION['domains'][$row['domain_uuid']] = $row; + unset($result); + } + + if (is_array($domains)) { + foreach($domains as $row) { + if (count($domains) == 1) { + $_SESSION["domain_uuid"] = $row["domain_uuid"]; + $_SESSION["domain_name"] = $row['domain_name']; + } + else { + if ($row['domain_name'] == $domain_array[0] || $row['domain_name'] == 'www.'.$domain_array[0]) { + $_SESSION["domain_uuid"] = $row["domain_uuid"]; + $_SESSION["domain_name"] = $row["domain_name"]; + } + } + $_SESSION['domains'][$row['domain_uuid']] = $row; + } + unset($domains, $prep_statement); } - unset($domains, $prep_statement); } //get the software name