Correct the str_to_named_array function so that the result is null.

This commit is contained in:
markjcrane 2016-04-28 22:15:30 -06:00
parent 5afd832204
commit 283e30b9fb
1 changed files with 5 additions and 3 deletions

View File

@ -45,7 +45,6 @@ else {
//convert the string to a named array //convert the string to a named array
function str_to_named_array($tmp_str, $tmp_delimiter) { function str_to_named_array($tmp_str, $tmp_delimiter) {
$tmp_array = explode ("\n", $tmp_str); $tmp_array = explode ("\n", $tmp_str);
$result = '';
if (trim(strtoupper($tmp_array[0])) != "+OK") { if (trim(strtoupper($tmp_array[0])) != "+OK") {
$tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]); $tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]);
$x = 0; $x = 0;
@ -57,6 +56,10 @@ else {
$tmp_name = $tmp_field_name_array[$y]; $tmp_name = $tmp_field_name_array[$y];
if (trim(strtoupper($tmp_value)) != "+OK") { if (trim(strtoupper($tmp_value)) != "+OK") {
$result[$x][$tmp_name] = $tmp_value; $result[$x][$tmp_name] = $tmp_value;
return $result;
}
else {
return false;
} }
$y++; $y++;
} }
@ -65,7 +68,6 @@ else {
} }
unset($row); unset($row);
} }
return $result;
} }
//alternate the color of the row //alternate the color of the row
@ -116,7 +118,7 @@ else {
} }
//sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING //sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
array_multisort($tier_result, SORT_ASC); if (isset($tier_result)) { array_multisort($tier_result, SORT_ASC); }
//send the event socket command and get the response //send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] | //callcenter_config queue list agents [queue_name] [status] |