The goal is to increase confidence in fusionpbx, one step is to run by default with error_reporting (E_ALL ^ E_NOTICE);

So, please find in this set numerous small changes which eliminate numerous php warning messages.

Also, a small bug fix in an sql statistics routine, naming a count(*) field as count, so displaying correct detail.

If any of the proposed changes are omitted, the relevant page will experience php warnings.

There are no doubt fusionpbx pages I've yet to visit that still generate warnings, this set is nearly certainly not comprehensive.
This commit is contained in:
Harry G. Coin
2016-04-25 20:19:58 -05:00
parent b4c5c79a4d
commit 8abe003a71
21 changed files with 52 additions and 57 deletions
-2
View File
@@ -698,13 +698,11 @@ require_once "resources/require.php";
}
}
}
closedir($dh_sub);
}
echo "</optgroup>";
}
}
}
closedir($dh);
}
echo "</select>\n";
echo "<br />\n";
+1 -3
View File
@@ -926,7 +926,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the users
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
foreach($assigned_user_uuids as $assigned_user_uuid) {
if (isset($assigned_user_uuids)) foreach($assigned_user_uuids as $assigned_user_uuid) {
$sql .= "and user_uuid <> '".$assigned_user_uuid."' ";
}
unset($assigned_user_uuids);
@@ -1289,13 +1289,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
}
}
closedir($dh_sub);
}
echo "</optgroup>";
}
}
}
closedir($dh);
}
echo "</select>\n";
echo " </td>\n";
+2 -2
View File
@@ -235,9 +235,9 @@ else {
echo "<br><br>";
/* close the connection */
imap_close($inbox);
imap_close($connection);
//show the footer
require_once "resources/footer.php";
?>
?>
+1 -1
View File
@@ -80,7 +80,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
}
//get the domain_name and domain_uuid
if ($_SESSION['provision']['http_domain_filter']['text'] == "false") {
if ((!isset($_SESSION['provision']['http_domain_filter'])) or $_SESSION['provision']['http_domain_filter']['text'] == "false") {
//get the domain_uuid
$sql = "SELECT domain_uuid FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac."' ";
+1 -1
View File
@@ -703,7 +703,7 @@ else {
echo " <td class='vncell' valign='top'>".$text['label-user_list']."</td>";
echo " <td class='vtable'>";
echo " <table width='52%'>\n";
foreach($ring_group_users as $field) {
if (isset($ring_group_users)) foreach($ring_group_users as $field) {
echo " <tr>\n";
echo " <td class='vtable'>".$field['username']."</td>\n";
echo " <td>\n";
@@ -42,7 +42,7 @@
}
//set the voicemail id and voicemail uuid arrays
foreach ($_SESSION['user']['extension'] as $index => $row) {
if (isset($_SESSION['user']['extension'])) foreach ($_SESSION['user']['extension'] as $index => $row) {
if (strlen($row['number_alias']) > 0) {
$voicemail_ids[$index]['voicemail_id'] = $row['number_alias'];
}
@@ -50,7 +50,7 @@
$voicemail_ids[$index]['voicemail_id'] = $row['user'];
}
}
foreach ($_SESSION['user']['voicemail'] as $row) {
if (isset($_SESSION['user']['voicemail'])) foreach ($_SESSION['user']['voicemail'] as $row) {
if (strlen($row['voicemail_uuid']) > 0) {
$voicemail_uuids[]['voicemail_uuid'] = $row['voicemail_uuid'];
}
+2 -2
View File
@@ -43,7 +43,7 @@ else {
$order = check_str($_GET["order"]);
//set the voicemail id and voicemail uuid arrays
foreach ($_SESSION['user']['extension'] as $index => $row) {
if (isset($_SESSION['user']['extension'])) foreach ($_SESSION['user']['extension'] as $index => $row) {
if (strlen($row['number_alias']) > 0) {
$voicemail_ids[$index]['voicemail_id'] = $row['number_alias'];
}
@@ -51,7 +51,7 @@ else {
$voicemail_ids[$index]['voicemail_id'] = $row['user'];
}
}
foreach ($_SESSION['user']['voicemail'] as $row) {
if (isset($_SESSION['user']['voicemail'])) foreach ($_SESSION['user']['voicemail'] as $row) {
if (strlen($row['voicemail_uuid']) > 0) {
$voicemail_uuids[]['voicemail_uuid'] = $row['voicemail_uuid'];
}
+4 -4
View File
@@ -105,10 +105,10 @@
}
unset ($sql, $prep_statement, $result, $row_count);
// create list of extensions for query below
foreach ($extensions as $extension => $blah) {
if (isset($extensions)) foreach ($extensions as $extension => $blah) {
$ext_array[] = $extension;
}
$ext_list = implode("','", $ext_array);
$ext_list = (isset($ext_array)) ? implode("','", $ext_array) : "";
//calculate the summary data
$sql = "select ";
@@ -300,7 +300,7 @@
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
foreach ($extensions as $extension => $ext) {
if (isset($extensions)) foreach ($extensions as $extension => $ext) {
$seconds['inbound'] = $summary[$extension]['inbound']['seconds'];
$seconds['outbound'] = $summary[$extension]['outbound']['seconds'];
if ($summary[$extension]['missed'] == null) {
@@ -320,7 +320,7 @@
$volume = $summary[$extension]['inbound']['count'] + $summary[$extension]['outbound']['count'];
//average length of call
$summary[$extension]['aloc'] = ($seconds['inbound'] + $seconds['outbound']) / ($volume - $missed);
$summary[$extension]['aloc'] = $volume==0 ? 0 : ($seconds['inbound'] + $seconds['outbound']) / ($volume - $missed);
$tr_link = "xhref='xml_cdr.php?'";
echo "<tr ".$tr_link.">\n";
+14 -14
View File
@@ -326,8 +326,8 @@ else {
$stats[$i]['volume'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $sql_where);
$stats[$i]['seconds'] = get_call_seconds_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], '');
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / 60;
$stats[$i]['avg_sec'] = ($stats[$i]['volume']==0) ? 0 : $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = (($stats[$i]['volume']==0) ? 0 : $stats[$i]['volume'] - $stats[$i]['missed']) / 60;
//answer / seizure ratio
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
@@ -338,10 +338,10 @@ else {
$where .= " billsec = '0' and ";
$where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['asr'] = ($stats[$i]['volume']==0) ? 0 : (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
//average length of call
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$stats[$i]['aloc'] = ($stats[$i]['volume']==0) ? 0 : $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
}
//call info for a day
@@ -356,7 +356,7 @@ else {
$stats[$i]['volume'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $sql_where);
$stats[$i]['seconds'] = get_call_seconds_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], '');
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_sec'] = ($stats[$i]['volume']==0) ? 0 : $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24);
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where = "where ";
@@ -366,8 +366,8 @@ else {
$where .= " billsec = '0' and ";
$where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$stats[$i]['asr'] = ($stats[$i]['volume']==0) ? 0 :(($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = ($stats[$i]['volume']==0) ? 0 :$stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$i++;
//call info for a week
@@ -381,8 +381,8 @@ else {
$stats[$i]['volume'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $sql_where);
$stats[$i]['seconds'] = get_call_seconds_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], '');
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*7);
$stats[$i]['avg_sec'] = ($stats[$i]['volume']==0) ? 0 :$stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume']==0) ? 0 :($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*7);
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where = "where ";
} else {
@@ -391,8 +391,8 @@ else {
$where .= " billsec = '0' and ";
$where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$stats[$i]['asr'] = ($stats[$i]['volume']==0) ? 0 :(($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = ($stats[$i]['volume']==0) ? 0 :$stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$i++;
//call info for a month
@@ -406,7 +406,7 @@ else {
$stats[$i]['volume'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $sql_where);
$stats[$i]['seconds'] = get_call_seconds_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], '');
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_sec'] = ($stats[$i]['volume']==0) ? 0 :$stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*30);
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where = "where ";
@@ -416,8 +416,8 @@ else {
$where .= " billsec = '0' and ";
$where .= " direction = 'inbound' and ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] = $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$stats[$i]['asr'] = ($stats[$i]['volume']==0) ? 0 :(($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
$stats[$i]['aloc'] =($stats[$i]['volume']==0) ? 0 : $stats[$i]['minutes'] / ($stats[$i]['volume'] - $stats[$i]['missed']);
$i++;
//show the graph