Эх сурвалжийг харах

Update pdo.php

Prevent php warnings.
FusionPBX 8 жил өмнө
parent
commit
8d48bd4336
1 өөрчлөгдсөн 28 нэмэгдсэн , 19 устгасан
  1. 28 19
      resources/pdo.php

+ 28 - 19
resources/pdo.php

@@ -17,15 +17,17 @@
 
  The Initial Developer of the Original Code is
  Mark J Crane <[email protected]>
- 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 <[email protected]>
  Raymond Chandler <[email protected]>
  */
-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);
+			if (is_array($domain_names)) {
+				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)) { 
+				foreach ($domain_names as $dn) {
+					foreach ($result as $row) {
+						if ($row['domain_name'] == $dn) {
+							$domains[] = $row;
+						}
 					}
 				}
+				unset($result);
 			}
-			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]) {
+			if (is_array($domains)) { 
+				foreach($domains as $row) {
+					if (count($domains) == 1) {
 						$_SESSION["domain_uuid"] = $row["domain_uuid"];
-						$_SESSION["domain_name"] = $row["domain_name"];
+						$_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;
 				}
-				$_SESSION['domains'][$row['domain_uuid']] = $row;
+				unset($domains, $prep_statement);
 			}
-			unset($domains, $prep_statement);
 	}
 
 //get the software name