diff --git a/ispapi_monitoring.php b/ispapi_monitoring.php index 3622293..9a61777 100644 --- a/ispapi_monitoring.php +++ b/ispapi_monitoring.php @@ -114,16 +114,18 @@ private static function getActiveDomainsWHMCS() if (!is_null($tmp)) { return $tmp; } - $result = DB::table("tbldomains") + $result = json_decode(DB::table("tbldomains") ->select("id", "domain", "idprotection", "additionalnotes", "is_premium") ->where([ ["registrar", "=", "ispapi"], ["status", "=", "active"] ]) - ->get()->toJson(); + ->get()->toJson(), true); $tmp = []; - foreach ($result as $row) { - $tmp[$row["domain"]] = $row; + if (!empty($result)) { + foreach ($result as $row) { + $tmp[$row["domain"]] = $row; + } } return $tmp; } @@ -426,9 +428,11 @@ private static function getDataWPAPICASE(&$data) $domainsWHMCS = self::getActiveDomainsWHMCS(); $items = []; $casesAPI = self::getIdProtectedDomainsAPI(); - foreach ($casesAPI as $c) { - if (isset($domainsWHMCS[$c]) && empty($domainsWHMCS[$c]["is_premium"]) /* null, 0, empty str */) { - $items[] = $c; + if (!empty($casesAPI)) { + foreach ($casesAPI as $c) { + if (isset($domainsWHMCS[$c]) && empty($domainsWHMCS[$c]["is_premium"]) /* null, 0, empty str */) { + $items[] = $c; + } } } if (!empty($items)) { @@ -447,9 +451,11 @@ private static function getDataTLAPICASE(&$data) $domainsWHMCS = self::getActiveDomainsWHMCS(); $items = []; $casesAPI = self::getTransferUnlockedDomainsAPI(); - foreach ($casesAPI as $c) { - if (isset($domainsWHMCS[$c])) { - $items[] = $c; + if (!empty($casesAPI)) { + foreach ($casesAPI as $c) { + if (isset($domainsWHMCS[$c])) { + $items[] = $c; + } } } if (!empty($items)) {