From 666ee2fc8586629e281754a10eed7aa2e2bc661e Mon Sep 17 00:00:00 2001 From: James Finstrom Date: Tue, 10 May 2016 11:08:55 -0700 Subject: [PATCH] FREEPBX-12237 Clean up and fix whoops errors in reverse australia source --- sources/source-ReverseAustralia_AU.module | 31 ++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/sources/source-ReverseAustralia_AU.module b/sources/source-ReverseAustralia_AU.module index 399820c9..108db4e7 100644 --- a/sources/source-ReverseAustralia_AU.module +++ b/sources/source-ReverseAustralia_AU.module @@ -1,7 +1,15 @@ DebugPrint(_("A valid API Key is required to use this lookup source")); } else { - $caller_id = null; - $name = ""; - $spam = ""; - $this->DebugPrint("Searching reverseaustralia.com - {$this->thenumber} ... "); + $this->DebugPrint("Searching reverseaustralia.com - {$thenumber} ... "); if ($run_param['Spam_Threshold']) { $spam = "&spamthreshold=".$run_param['Spam_Threshold']; - } else { - $spam = ""; } - // Search reverseaustralia.com. URL taken from - // http://www.reverseaustralia.com/developer/callerid.html for suggested format for PBX lookup - $url = "http://api.reverseaustralia.com/cidlookup.php?format=json&key={$run_param['API_Key']}&q=$thenumber".$spam; + $url = 'http://api.reverseaustralia.com/cidlookup.php?format=json&key='.$run_param['API_Key'].'&q='.$thenumber.$spam; // $this->DebugPrint($url); // for debug $value = $this->get_url_contents($url); @@ -55,7 +62,7 @@ class ReverseAustralia_AU extends superfecta_base { //record not found } } else { - $name = $result['name']; + $name = isset($result['name'])?$result['name']:''; } // If we found a match, return it