示例#1
0
                }
                $rslt = mysql_to_mysqli($stmt, $link);
                $result = _QXZ("SUCCESS");
                $result_reason = _QXZ("pause_code function sent");
                echo "{$result}: {$result_reason} - {$agent_user}\n";
                $data = "{$epoch}";
                api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data);
            } else {
                $result = _QXZ("ERROR");
                $result_reason = _QXZ("pause_code error - agent is not paused");
                echo "{$result}: {$result_reason} - {$agent_user}\n";
                api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data);
            }
        } else {
            $result = _QXZ("ERROR");
            $result_reason = _QXZ("agent_user is not logged in");
            echo "{$result}: {$result_reason} - {$agent_user}\n";
            api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data);
        }
    }
}
################################################################################
### END - pause_code
################################################################################
################################################################################
### BEGIN - optional "close window" link
################################################################################
if ($close_window_link > 0) {
    $close_this_window_text = 'Close This Window';
    if ($language == 'es') {
        $close_this_window_text = 'Cerrar esta ventana';
    if ($group == $group) {
        $groups_list .= "<option selected value=\"{$rowx['0']}\">{$rowx['0']} - {$rowx['1']}</option>\n";
    } else {
        $groups_list .= "<option value=\"{$rowx['0']}\">{$rowx['0']} - {$rowx['1']}</option>\n";
    }
    $o++;
}
echo "{$groups_list}</select><br>\n";
echo _QXZ("status") . ": <input type=text name=status size=10 maxlength=10 value=\"{$status}\"> &nbsp; (" . _QXZ("example") . ": XFER)<br>\n";
echo _QXZ("date with hour") . ": <input type=text name=date_with_hour size=14 maxlength=13 value=\"{$date_with_hour}\"> &nbsp; (" . _QXZ("example") . ": 2004-06-25 14)<br>\n";
echo "<input type=submit name=submit value='" . _QXZ("SUBMIT") . "'>\n";
echo "<BR><BR><BR>\n";
$ENDtime = date("U");
$RUNtime = $ENDtime - $STARTtime;
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\n" . _QXZ("script runtime") . ": {$RUNtime} " . _QXZ("seconds") . "</font>";
?>


</TD></TR></TABLE>
</body>
</html>

<?php 
if ($db_source == 'S') {
    mysqli_close($link);
    $use_slave_server = 0;
    $db_source = 'M';
    require "dbconnect_mysqli.php";
}
$endMS = microtime();
    if ($agent_ready > 9) {
        $B = '<FONT class="b3">';
        $BG = '</FONT>';
    }
    if ($agent_ready > 14) {
        $B = '<FONT class="b4">';
        $BG = '</FONT>';
    }
    echo "\n<BR>\n";
    echo "{$NFB}{$agent_total}{$NFE} " . _QXZ("agents logged in") . " &nbsp; &nbsp; &nbsp; &nbsp; \n";
    echo "{$NFB}{$agent_incall}{$NFE} " . _QXZ("agents in calls") . " &nbsp; &nbsp; &nbsp; \n";
    echo "{$NFB}{$B} &nbsp;{$agent_ready} {$BG}{$NFE} " . _QXZ("agents waiting") . " &nbsp; &nbsp; &nbsp; \n";
    echo "{$NFB}{$agent_paused}{$NFE} " . _QXZ("paused agents") . " &nbsp; &nbsp; &nbsp; \n";
    echo "{$NFB}{$agent_dead}{$NFE} " . _QXZ("agents in dead calls") . "&nbsp; &nbsp; &nbsp; \n";
    echo "{$NFB}{$agent_dispo}{$NFE} " . _QXZ("agents in dispo") . "&nbsp; &nbsp; &nbsp; \n";
    echo "<PRE><FONT SIZE=2>";
    echo "";
    echo "{$Cecho}";
    echo "{$Aecho}";
} else {
    echo " " . _QXZ("NO AGENTS ON CALLS") . " \n";
    echo "<PRE>{$Cecho}";
}
echo "</PRE>";
if ($RTajax < 1) {
    echo "</TD></TR></TABLE>";
}
?>

</BODY></HTML>
示例#4
0
function lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmt, $postal_code)
{
    require "dbconnect_mysqli.php";
    $postalgmt_found = 0;
    if (preg_match("/POSTAL/i", $postalgmt) && strlen($postal_code) > 4) {
        if (preg_match('/^1$/', $phone_code)) {
            $stmt = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='{$phone_code}' and postal_code LIKE \"{$postal_code}%\";";
            $rslt = mysql_to_mysqli($stmt, $link);
            $pc_recs = mysqli_num_rows($rslt);
            if ($pc_recs > 0) {
                $row = mysqli_fetch_row($rslt);
                $gmt_offset = $row[2];
                $gmt_offset = preg_replace("/\\+/i", "", $gmt_offset);
                $dst = $row[3];
                $dst_range = $row[4];
                $PC_processed++;
                $postalgmt_found++;
                $post++;
            }
        }
    }
    if ($postalgmt_found < 1) {
        $PC_processed = 0;
        ### UNITED STATES ###
        if ($phone_code == '1') {
            $stmt = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='{$phone_code}' and areacode='{$USarea}';";
            $rslt = mysql_to_mysqli($stmt, $link);
            $pc_recs = mysqli_num_rows($rslt);
            if ($pc_recs > 0) {
                $row = mysqli_fetch_row($rslt);
                $gmt_offset = $row[4];
                $gmt_offset = preg_replace("/\\+/i", "", $gmt_offset);
                $dst = $row[5];
                $dst_range = $row[6];
                $PC_processed++;
            }
        }
        ### MEXICO ###
        if ($phone_code == '52') {
            $stmt = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='{$phone_code}' and areacode='{$USarea}';";
            $rslt = mysql_to_mysqli($stmt, $link);
            $pc_recs = mysqli_num_rows($rslt);
            if ($pc_recs > 0) {
                $row = mysqli_fetch_row($rslt);
                $gmt_offset = $row[4];
                $gmt_offset = preg_replace("/\\+/i", "", $gmt_offset);
                $dst = $row[5];
                $dst_range = $row[6];
                $PC_processed++;
            }
        }
        ### AUSTRALIA ###
        if ($phone_code == '61') {
            $stmt = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='{$phone_code}' and state='{$state}';";
            $rslt = mysql_to_mysqli($stmt, $link);
            $pc_recs = mysqli_num_rows($rslt);
            if ($pc_recs > 0) {
                $row = mysqli_fetch_row($rslt);
                $gmt_offset = $row[4];
                $gmt_offset = preg_replace("/\\+/i", "", $gmt_offset);
                $dst = $row[5];
                $dst_range = $row[6];
                $PC_processed++;
            }
        }
        ### ALL OTHER COUNTRY CODES ###
        if (!$PC_processed) {
            $PC_processed++;
            $stmt = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='{$phone_code}';";
            $rslt = mysql_to_mysqli($stmt, $link);
            $pc_recs = mysqli_num_rows($rslt);
            if ($pc_recs > 0) {
                $row = mysqli_fetch_row($rslt);
                $gmt_offset = $row[4];
                $gmt_offset = preg_replace("/\\+/i", "", $gmt_offset);
                $dst = $row[5];
                $dst_range = $row[6];
                $PC_processed++;
            }
        }
    }
    ### Find out if DST to raise the gmt offset ###
    $AC_GMT_diff = $gmt_offset - $LOCAL_GMT_OFF_STD;
    $AC_localtime = mktime($Shour + $AC_GMT_diff, $Smin, $Ssec, $Smon, $Smday, $Syear);
    $hour = date("H", $AC_localtime);
    $min = date("i", $AC_localtime);
    $sec = date("s", $AC_localtime);
    $mon = date("m", $AC_localtime);
    $mday = date("d", $AC_localtime);
    $wday = date("w", $AC_localtime);
    $year = date("Y", $AC_localtime);
    $dsec = $hour * 3600 + $min * 60 + $sec;
    $AC_processed = 0;
    if (!$AC_processed and $dst_range == 'SSM-FSN') {
        if ($DBX) {
            print "     " . _QXZ("Second Sunday March to First Sunday November") . "\n";
        }
        #**********************************************************************
        # SSM-FSN
        #     This is returns 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on Second Sunday March to First Sunday November at 2 am.
        #     INPUTS:
        #       mm              INTEGER       Month.
        #       dd              INTEGER       Day of the month.
        #       ns              INTEGER       Seconds into the day.
        #       dow             INTEGER       Day of week (0=Sunday, to 6=Saturday)
        #     OPTIONAL INPUT:
        #       timezone        INTEGER       hour difference UTC - local standard time
        #                                      (DEFAULT is blank)
        #                                     make calculations based on UTC time,
        #                                     which means shift at 10:00 UTC in April
        #                                     and 9:00 UTC in October
        #     OUTPUT:
        #                       INTEGER       1 = DST, 0 = not DST
        #
        # S  M  T  W  T  F  S
        # 1  2  3  4  5  6  7
        # 8  9 10 11 12 13 14
        #15 16 17 18 19 20 21
        #22 23 24 25 26 27 28
        #29 30 31
        #
        # S  M  T  W  T  F  S
        #    1  2  3  4  5  6
        # 7  8  9 10 11 12 13
        #14 15 16 17 18 19 20
        #21 22 23 24 25 26 27
        #28 29 30 31
        #
        #**********************************************************************
        $USACAN_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 3 || $mm > 11) {
            $USACAN_DST = 0;
        } elseif ($mm >= 4 and $mm <= 10) {
            $USACAN_DST = 1;
        } elseif ($mm == 3) {
            if ($dd > 13) {
                $USACAN_DST = 1;
            } elseif ($dd >= $dow + 8) {
                if ($timezone) {
                    if ($dow == 0 and $ns < 7200 + $timezone * 3600) {
                        $USACAN_DST = 0;
                    } else {
                        $USACAN_DST = 1;
                    }
                } else {
                    if ($dow == 0 and $ns < 7200) {
                        $USACAN_DST = 0;
                    } else {
                        $USACAN_DST = 1;
                    }
                }
            } else {
                $USACAN_DST = 0;
            }
        } elseif ($mm == 11) {
            if ($dd > 7) {
                $USACAN_DST = 0;
            } elseif ($dd < $dow + 1) {
                $USACAN_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 7200 + ($timezone - 1) * 3600) {
                        $USACAN_DST = 1;
                    } else {
                        $USACAN_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 7200) {
                        $USACAN_DST = 1;
                    } else {
                        $USACAN_DST = 0;
                    }
                }
            } else {
                $USACAN_DST = 0;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$USACAN_DST}\n";
        }
        if ($USACAN_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'FSA-LSO') {
        if ($DBX) {
            print "     " . _QXZ("First Sunday April to Last Sunday October") . "\n";
        }
        #**********************************************************************
        # FSA-LSO
        #     This is returns 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on first Sunday in April and last Sunday in October at 2 am.
        #**********************************************************************
        $USA_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 4 || $mm > 10) {
            $USA_DST = 0;
        } elseif ($mm >= 5 and $mm <= 9) {
            $USA_DST = 1;
        } elseif ($mm == 4) {
            if ($dd > 7) {
                $USA_DST = 1;
            } elseif ($dd >= $dow + 1) {
                if ($timezone) {
                    if ($dow == 0 and $ns < 7200 + $timezone * 3600) {
                        $USA_DST = 0;
                    } else {
                        $USA_DST = 1;
                    }
                } else {
                    if ($dow == 0 and $ns < 7200) {
                        $USA_DST = 0;
                    } else {
                        $USA_DST = 1;
                    }
                }
            } else {
                $USA_DST = 0;
            }
        } elseif ($mm == 10) {
            if ($dd < 25) {
                $USA_DST = 1;
            } elseif ($dd < $dow + 25) {
                $USA_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 7200 + ($timezone - 1) * 3600) {
                        $USA_DST = 1;
                    } else {
                        $USA_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 7200) {
                        $USA_DST = 1;
                    } else {
                        $USA_DST = 0;
                    }
                }
            } else {
                $USA_DST = 0;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$USA_DST}\n";
        }
        if ($USA_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'LSM-LSO') {
        if ($DBX) {
            print "     " . _QXZ("Last Sunday March to Last Sunday October") . "\n";
        }
        #**********************************************************************
        #     This is s 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on last Sunday in March and last Sunday in October at 1 am.
        #**********************************************************************
        $GBR_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 3 || $mm > 10) {
            $GBR_DST = 0;
        } elseif ($mm >= 4 and $mm <= 9) {
            $GBR_DST = 1;
        } elseif ($mm == 3) {
            if ($dd < 25) {
                $GBR_DST = 0;
            } elseif ($dd < $dow + 25) {
                $GBR_DST = 0;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $GBR_DST = 0;
                    } else {
                        $GBR_DST = 1;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $GBR_DST = 0;
                    } else {
                        $GBR_DST = 1;
                    }
                }
            } else {
                $GBR_DST = 1;
            }
        } elseif ($mm == 10) {
            if ($dd < 25) {
                $GBR_DST = 1;
            } elseif ($dd < $dow + 25) {
                $GBR_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $GBR_DST = 1;
                    } else {
                        $GBR_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $GBR_DST = 1;
                    } else {
                        $GBR_DST = 0;
                    }
                }
            } else {
                $GBR_DST = 0;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$GBR_DST}\n";
        }
        if ($GBR_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'LSO-LSM') {
        if ($DBX) {
            print "     " . _QXZ("Last Sunday October to Last Sunday March") . "\n";
        }
        #**********************************************************************
        #     This is s 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on last Sunday in October and last Sunday in March at 1 am.
        #**********************************************************************
        $AUS_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 3 || $mm > 10) {
            $AUS_DST = 1;
        } elseif ($mm >= 4 and $mm <= 9) {
            $AUS_DST = 0;
        } elseif ($mm == 3) {
            if ($dd < 25) {
                $AUS_DST = 1;
            } elseif ($dd < $dow + 25) {
                $AUS_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $AUS_DST = 1;
                    } else {
                        $AUS_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $AUS_DST = 1;
                    } else {
                        $AUS_DST = 0;
                    }
                }
            } else {
                $AUS_DST = 0;
            }
        } elseif ($mm == 10) {
            if ($dd < 25) {
                $AUS_DST = 0;
            } elseif ($dd < $dow + 25) {
                $AUS_DST = 0;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $AUS_DST = 0;
                    } else {
                        $AUS_DST = 1;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $AUS_DST = 0;
                    } else {
                        $AUS_DST = 1;
                    }
                }
            } else {
                $AUS_DST = 1;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$AUS_DST}\n";
        }
        if ($AUS_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'FSO-LSM') {
        if ($DBX) {
            print "     " . _QXZ("First Sunday October to Last Sunday March") . "\n";
        }
        #**********************************************************************
        #   TASMANIA ONLY
        #     This is s 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on first Sunday in October and last Sunday in March at 1 am.
        #**********************************************************************
        $AUST_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 3 || $mm > 10) {
            $AUST_DST = 1;
        } elseif ($mm >= 4 and $mm <= 9) {
            $AUST_DST = 0;
        } elseif ($mm == 3) {
            if ($dd < 25) {
                $AUST_DST = 1;
            } elseif ($dd < $dow + 25) {
                $AUST_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $AUST_DST = 1;
                    } else {
                        $AUST_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $AUST_DST = 1;
                    } else {
                        $AUST_DST = 0;
                    }
                }
            } else {
                $AUST_DST = 0;
            }
        } elseif ($mm == 10) {
            if ($dd > 7) {
                $AUST_DST = 1;
            } elseif ($dd >= $dow + 1) {
                if ($timezone) {
                    if ($dow == 0 and $ns < 7200 + $timezone * 3600) {
                        $AUST_DST = 0;
                    } else {
                        $AUST_DST = 1;
                    }
                } else {
                    if ($dow == 0 and $ns < 3600) {
                        $AUST_DST = 0;
                    } else {
                        $AUST_DST = 1;
                    }
                }
            } else {
                $AUST_DST = 0;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$AUST_DST}\n";
        }
        if ($AUST_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'FSO-FSA') {
        if ($DBX) {
            print "     " . _QXZ("Sunday in October to First Sunday in April") . "\n";
        }
        #**********************************************************************
        # FSO-FSA
        #   2008+ AUSTRALIA ONLY (country code 61)
        #     This is returns 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on first Sunday in October and first Sunday in April at 1 am.
        #**********************************************************************
        $AUSE_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 4 or $mm > 10) {
            $AUSE_DST = 1;
        } elseif ($mm >= 5 and $mm <= 9) {
            $AUSE_DST = 0;
        } elseif ($mm == 4) {
            if ($dd > 7) {
                $AUSE_DST = 0;
            } elseif ($dd >= $dow + 1) {
                if ($timezone) {
                    if ($dow == 0 and $ns < 3600 + $timezone * 3600) {
                        $AUSE_DST = 1;
                    } else {
                        $AUSE_DST = 0;
                    }
                } else {
                    if ($dow == 0 and $ns < 7200) {
                        $AUSE_DST = 1;
                    } else {
                        $AUSE_DST = 0;
                    }
                }
            } else {
                $AUSE_DST = 1;
            }
        } elseif ($mm == 10) {
            if ($dd >= 8) {
                $AUSE_DST = 1;
            } elseif ($dd >= $dow + 1) {
                if ($timezone) {
                    if ($dow == 0 and $ns < 7200 + $timezone * 3600) {
                        $AUSE_DST = 0;
                    } else {
                        $AUSE_DST = 1;
                    }
                } else {
                    if ($dow == 0 and $ns < 3600) {
                        $AUSE_DST = 0;
                    } else {
                        $AUSE_DST = 1;
                    }
                }
            } else {
                $AUSE_DST = 0;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$AUSE_DST}\n";
        }
        if ($AUSE_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'FSO-TSM') {
        if ($DBX) {
            print "     " . _QXZ("First Sunday October to Third Sunday March") . "\n";
        }
        #**********************************************************************
        #     This is s 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on first Sunday in October and third Sunday in March at 1 am.
        #**********************************************************************
        $NZL_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 3 || $mm > 10) {
            $NZL_DST = 1;
        } elseif ($mm >= 4 and $mm <= 9) {
            $NZL_DST = 0;
        } elseif ($mm == 3) {
            if ($dd < 14) {
                $NZL_DST = 1;
            } elseif ($dd < $dow + 14) {
                $NZL_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $NZL_DST = 1;
                    } else {
                        $NZL_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $NZL_DST = 1;
                    } else {
                        $NZL_DST = 0;
                    }
                }
            } else {
                $NZL_DST = 0;
            }
        } elseif ($mm == 10) {
            if ($dd > 7) {
                $NZL_DST = 1;
            } elseif ($dd >= $dow + 1) {
                if ($timezone) {
                    if ($dow == 0 and $ns < 7200 + $timezone * 3600) {
                        $NZL_DST = 0;
                    } else {
                        $NZL_DST = 1;
                    }
                } else {
                    if ($dow == 0 and $ns < 3600) {
                        $NZL_DST = 0;
                    } else {
                        $NZL_DST = 1;
                    }
                }
            } else {
                $NZL_DST = 0;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$NZL_DST}\n";
        }
        if ($NZL_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'LSS-FSA') {
        if ($DBX) {
            print "     " . _QXZ("Last Sunday in September to First Sunday in April") . "\n";
        }
        #**********************************************************************
        # LSS-FSA
        #   2007+ NEW ZEALAND (country code 64)
        #     This is returns 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect.
        #     Based on last Sunday in September and first Sunday in April at 1 am.
        #**********************************************************************
        $NZLN_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 4 || $mm > 9) {
            $NZLN_DST = 1;
        } elseif ($mm >= 5 && $mm <= 9) {
            $NZLN_DST = 0;
        } elseif ($mm == 4) {
            if ($dd > 7) {
                $NZLN_DST = 0;
            } elseif ($dd >= $dow + 1) {
                if ($timezone) {
                    if ($dow == 0 && $ns < 3600 + $timezone * 3600) {
                        $NZLN_DST = 1;
                    } else {
                        $NZLN_DST = 0;
                    }
                } else {
                    if ($dow == 0 && $ns < 7200) {
                        $NZLN_DST = 1;
                    } else {
                        $NZLN_DST = 0;
                    }
                }
            } else {
                $NZLN_DST = 1;
            }
        } elseif ($mm == 9) {
            if ($dd < 25) {
                $NZLN_DST = 0;
            } elseif ($dd < $dow + 25) {
                $NZLN_DST = 0;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $NZLN_DST = 0;
                    } else {
                        $NZLN_DST = 1;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $NZLN_DST = 0;
                    } else {
                        $NZLN_DST = 1;
                    }
                }
            } else {
                $NZLN_DST = 1;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$NZLN_DST}\n";
        }
        if ($NZLN_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed and $dst_range == 'TSO-LSF') {
        if ($DBX) {
            print "     " . _QXZ("Third Sunday October to Last Sunday February") . "\n";
        }
        #**********************************************************************
        # TSO-LSF
        #     This is returns 1 if Daylight Savings Time is in effect and 0 if
        #       Standard time is in effect. Brazil
        #     Based on Third Sunday October to Last Sunday February at 1 am.
        #**********************************************************************
        $BZL_DST = 0;
        $mm = $mon;
        $dd = $mday;
        $ns = $dsec;
        $dow = $wday;
        if ($mm < 2 || $mm > 10) {
            $BZL_DST = 1;
        } elseif ($mm >= 3 and $mm <= 9) {
            $BZL_DST = 0;
        } elseif ($mm == 2) {
            if ($dd < 22) {
                $BZL_DST = 1;
            } elseif ($dd < $dow + 22) {
                $BZL_DST = 1;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $BZL_DST = 1;
                    } else {
                        $BZL_DST = 0;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $BZL_DST = 1;
                    } else {
                        $BZL_DST = 0;
                    }
                }
            } else {
                $BZL_DST = 0;
            }
        } elseif ($mm == 10) {
            if ($dd < 22) {
                $BZL_DST = 0;
            } elseif ($dd < $dow + 22) {
                $BZL_DST = 0;
            } elseif ($dow == 0) {
                if ($timezone) {
                    # UTC calculations
                    if ($ns < 3600 + ($timezone - 1) * 3600) {
                        $BZL_DST = 0;
                    } else {
                        $BZL_DST = 1;
                    }
                } else {
                    # local time calculations
                    if ($ns < 3600) {
                        $BZL_DST = 0;
                    } else {
                        $BZL_DST = 1;
                    }
                }
            } else {
                $BZL_DST = 1;
            }
        }
        # end of month checks
        if ($DBX) {
            print "     DST: {$BZL_DST}\n";
        }
        if ($BZL_DST) {
            $gmt_offset++;
        }
        $AC_processed++;
    }
    if (!$AC_processed) {
        if ($DBX) {
            print "     " . _QXZ("No DST Method Found") . "\n";
        }
        if ($DBX) {
            print "     DST: 0\n";
        }
        $AC_processed++;
    }
    return $gmt_offset;
}
    echo "<tr bgcolor=#B6D3FC><td align=right>" . _QXZ("Run") . ": </td><td align=left><input type=text name=run size=5 maxlength=4></td></tr>\n";
    echo "<tr bgcolor=#B6D3FC><td align=right>" . _QXZ("Batch") . ": </td><td align=left><input type=text name=batch size=6 maxlength=5></td></tr>\n";
    echo "<tr bgcolor=#B6D3FC><td align=right>" . _QXZ("Sequence") . ": </td><td align=left><input type=text name=sequence size=6 maxlength=5></td></tr>\n";
    echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=SUBMIT value='" . _QXZ("SUBMIT") . "'></td></tr>\n";
    echo "</TABLE></center>\n";
    echo "\n";
    echo "</center>\n";
}
### END search
?>



<BR><font size=1><?php 
echo _QXZ("CallCard");
?>
 &nbsp; &nbsp; <?php 
echo _QXZ("VERSION");
?>
: <?php 
echo $version;
?>
 &nbsp; &nbsp; <?php 
echo _QXZ("BUILD");
?>
: <?php 
echo $build;
?>
 &nbsp; &nbsp; </td></tr>
</TD></TR></TABLE>
示例#6
0
<?php

# welcome.php - VICIDIAL welcome page
#
# Copyright (C) 2014  Matt Florell <*****@*****.**>    LICENSE: AGPLv2
#
# CHANGELOG:
# 141007-2140 - Finalized adding QXZ translation to all admin files
header("Content-type: text/html; charset=utf-8");
require "functions.php";
echo "<title>" . _QXZ("ViciDial Welcome") . "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<BR><BR><BR><BR><BR><CENTER><TABLE WIDTH=300 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCCCCC\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" BORDER=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE> " . _QXZ("Welcome") . " </TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><b> <a href=\"../agc/vicidial.php\">" . _QXZ("Agent Login") . "</a> </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><b> <a href=\"../agc/timeclock.php?referrer=welcome\"> " . _QXZ("Timeclock") . "</a> </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><b> <a href=\"../vicidial/admin.php\">" . _QXZ("Administration") . "</a> </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
 $query_date_BEGIN = "{$query_date} 00:00:00";
 $query_date_END = "{$end_date} 23:59:59";
 $MAIN .= _QXZ("Inbound Summary Hourly Report") . ": {$group_string}          {$NOW_TIME}\n";
 $CSV_main .= _QXZ("Inbound Summary Hourly Report") . ":,{$NOW_TIME}\n";
 $JS_text .= "<script language='Javascript'>\n";
 $JS_onload = "onload = function() {\n";
 if ($group_ct > 0) {
     $ASCII_text .= "\n";
     $ASCII_text .= "---------- " . _QXZ("MULTI-GROUP BREAKDOWN") . ":\n";
     $ASCII_text .= "+------------------------------------------+--------+--------+-----------+---------+-----------+---------+---------+--------+\n";
     $ASCII_text .= "|                                          |        |        |           |         | " . _QXZ("TOTAL", 9) . " | " . _QXZ("AVERAGE", 7) . " | " . _QXZ("MAXIMUM", 7) . " | " . _QXZ("TOTAL", 6) . " |\n";
     $ASCII_text .= "|                                          | " . _QXZ("TOTAL", 6) . " | " . _QXZ("TOTAL", 6) . " | " . _QXZ("TOTAL", 9) . " | " . _QXZ("AVERAGE", 7) . " | " . _QXZ("QUEUE", 9) . " | " . _QXZ("QUEUE", 7) . " | " . _QXZ("QUEUE", 7) . " | " . _QXZ("ABANDON", 7) . "|\n";
     $ASCII_text .= "| " . _QXZ("IN-GROUP", 40) . " | " . _QXZ("CALLS", 6) . " | " . _QXZ("ANSWER", 6) . " | " . _QXZ("TALK", 9) . " | " . _QXZ("TALK", 7) . " | " . _QXZ("TIME", 9) . " | " . _QXZ("TIME", 7) . " | " . _QXZ("TIME", 7) . " | " . _QXZ("CALLS", 6) . " |\n";
     $ASCII_text .= "+------------------------------------------+--------+--------+-----------+---------+-----------+---------+---------+--------+\n";
     $CSV_main .= "\"" . _QXZ("MULTI-GROUP BREAKDOWN") . ":\"\n";
     $CSV_main .= "\"" . _QXZ("IN-GROUP") . "\",\"" . _QXZ("TOTAL CALLS") . "\",\"" . _QXZ("TOTAL ANSWER") . "\",\" " . _QXZ("TOTAL TALK") . "\",\" " . _QXZ("AVERAGE TALK") . "\",\" " . _QXZ("TOTAL QUEUE TIME") . "\",\" " . _QXZ("AVERAGE QUEUE TIME") . "\",\" " . _QXZ("MAXIMUM QUEUE TIME") . "\",\" " . _QXZ("TOTAL ABANDON CALLS") . "\"\n";
     $CSV_subreports = "";
     $graph_stats = array();
     $max_calls = 1;
     $max_answer = 1;
     $max_talk = 1;
     $max_avgtalk = 1;
     $max_queue = 1;
     $max_avgqueue = 1;
     $max_maxqueue = 1;
     $max_totalabandons = 1;
     $GRAPH = "<BR><BR><a name='multigroup_graph'/><table border='0' cellpadding='0' cellspacing='2' width='800'>";
     $GRAPH .= "<tr><th width='12%' class='grey_graph_cell' id='multigroup_graph1'><a href='#' onClick=\"DrawGraph('CALLS', '1'); return false;\">TOTAL CALLS</a></th><th width='12%' class='grey_graph_cell' id='multigroup_graph2'><a href='#' onClick=\"DrawGraph('ANSWER', '2'); return false;\">TOTAL ANSWER</a></th><th width='12%' class='grey_graph_cell' id='multigroup_graph3'><a href='#' onClick=\"DrawGraph('TALK', '3'); return false;\">TOTAL TALK</a></th><th width='12%' class='grey_graph_cell' id='multigroup_graph4'><a href='#' onClick=\"DrawGraph('AVGTALK', '4'); return false;\">AVERAGE TALK</a></th><th width='13%' class='grey_graph_cell' id='multigroup_graph5'><a href='#' onClick=\"DrawGraph('QUEUE', '5'); return false;\">TOTAL QUEUE TIME</a></th><th width='13%' class='grey_graph_cell' id='multigroup_graph6'><a href='#' onClick=\"DrawGraph('AVGQUEUE', '6'); return false;\">AVERAGE QUEUE TIME</a></th><th width='13%' class='grey_graph_cell' id='multigroup_graph7'><a href='#' onClick=\"DrawGraph('MAXQUEUE', '7'); return false;\">MAXIMUM QUEUE TIME</a></th><th width='13%' class='grey_graph_cell' id='multigroup_graph8'><a href='#' onClick=\"DrawGraph('TOTALABANDONS', '8'); return false;\">TOTAL ABANDON CALLS</a></th></tr>";
     $GRAPH .= "<tr><td colspan='8' class='graph_span_cell'><span id='multigroup_stats_graph'><BR>&nbsp;<BR></span></td></tr></table><BR><BR>";
     $graph_header = "<table cellspacing='0' cellpadding='0' class='horizontalgraph'><caption align='top'>INBOUND SERVICE LEVEL REPORT</caption><tr><th class='thgraph' scope='col'>IN-GROUP</th>";
     $CALLS_graph = $graph_header . "<th class='thgraph' scope='col'>TOTAL CALLS </th></tr>";
        echo "<font class=\"select_bold\"><B>" . _QXZ("User Groups") . ":</B></font><BR><CENTER>\n";
        echo "<SELECT SIZE=20 NAME=user_group[] multiple>\n";
        $o = 0;
        while ($user_groups_to_print > $o) {
            if (preg_match("/\\|{$LISTuser_groups[$o]}\\|/", $user_group_string)) {
                echo "<option selected value=\"{$LISTuser_groups[$o]}\">{$LISTuser_groups[$o]}</option>\n";
            } else {
                echo "<option value=\"{$LISTuser_groups[$o]}\">{$LISTuser_groups[$o]}</option>\n";
            }
            $o++;
        }
        echo "</SELECT>\n";
    }
    echo "</TD></TR><TR></TD><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> &nbsp; \n";
    echo "</TD></TR><TR></TD><TD ALIGN=CENTER VALIGN=TOP COLSPAN=5>\n";
    echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE='" . _QXZ("SUBMIT") . "'>\n";
    echo "</TD></TR></TABLE>\n";
    echo "</FORM>\n\n";
}
if ($db_source == 'S') {
    mysqli_close($link);
    $use_slave_server = 0;
    $db_source = 'M';
    require "dbconnect_mysqli.php";
}
$endMS = microtime();
$startMSary = explode(" ", $startMS);
$endMSary = explode(" ", $endMS);
$runS = $endMSary[0] - $startMSary[0];
$runM = $endMSary[1] - $startMSary[1];
$TOTALrun = $runS + $runM;
        echo "<td align=left><select size=5 id=custom_reports_user_groups" . $id . " name=custom_reports_user_groups" . $id . " multiple><option value='---ALL---'>" . _QXZ("ALL USER GROUPS") . "</option>";
        $stmt = "SELECT user_group,group_name from vicidial_user_groups {$whereLOGadmin_viewable_groupsSQL} order by user_group;";
        $rslt = mysql_to_mysqli($stmt, $link);
        $usergroups_to_print = mysqli_num_rows($rslt);
        $i = 0;
        while ($i < $usergroups_to_print) {
            $ug_row = mysqli_fetch_row($rslt);
            if (in_array("{$ug_row['0']}", $UGarray)) {
                $x = "selected";
            } else {
                $x = "";
            }
            echo "<option value='{$ug_row['0']}' {$x}>{$ug_row['1']}</option>";
            $i++;
        }
        echo "<td align='center'><input type='button' value='" . _QXZ("UPDATE") . "' onClick=\"SubmitIDValues({$id})\"><BR><BR><a href='vicidial_custom_reports_admin.php?delete_custom_report=" . $id . "'>" . _QXZ("DELETE") . "</a></td>";
        echo "</tr>\n";
    }
}
echo "</table>";
echo "<input type=hidden name='upd_custom_report_id' id='upd_custom_report_id'>";
echo "<input type=hidden name='upd_report_name' id='upd_report_name'>";
echo "<input type=hidden name='upd_domain' id='upd_domain'>";
# echo "<input type=hidden name='upd_slave' id='upd_slave'>";
echo "<input type=hidden name='upd_path_name' id='upd_path_name'>";
echo "<input type=hidden name='upd_custom_reports_user_groups' id='upd_custom_reports_user_groups'>";
echo "</form>";
echo "</TD></TR></TABLE>\n";
echo "</BODY></HTML>";
?>
                 $CSV_text .= "\"{$count_count[$o]}\",";
             }
             $o++;
         }
         if (!$called_printed) {
             $MAIN .= "<td {$AB}><font size=1> &nbsp;</td>";
             $CSV_text .= "\"\",";
         }
         $first++;
     }
     $MAIN .= "<td><font size=1>{$leads_in_sts[$sts]}</td></tr>\n\n";
     $CSV_text .= "\"{$leads_in_sts[$sts]}\"\n";
     $sts++;
 }
 $MAIN .= "<tr><td align=center colspan=2><b><font size=1>" . _QXZ("TOTAL") . "</td>";
 $CSV_text .= "\"\",\"" . _QXZ("TOTAL") . "\",";
 $first = $all_called_first;
 while ($first <= $all_called_last) {
     if (preg_match('/1$|3$|5$|7$|9$/i', $first)) {
         $AB = 'bgcolor="#AFEEEE"';
     } else {
         $AB = 'bgcolor="#E0FFFF"';
     }
     $MAIN .= "<td align=center {$AB}><b><font size=1>{$all_called_count[$first]}</td>";
     $CSV_text .= "\"{$all_called_count[$first]}\",";
     $first++;
 }
 $MAIN .= "<td align=center><b><font size=1>{$leads_in_list}</td></tr>\n";
 $CSV_text .= "\"{$leads_in_list}\",";
 $MAIN .= "</table></center><br>\n";
 $MAIN .= "</BODY></HTML>\n";
function is_user_logged_in($user)
{
    global $link;
    $stmt = "select status from vicidial_live_agents where user='******'";
    if ($DB) {
        echo "|{$stmt}|\n";
    }
    $rslt = mysql_to_mysqli($stmt, $link);
    $live_agent_count = mysqli_num_rows($rslt);
    if ($live_agent_count != '1') {
        if ($live_agent_count == '0') {
            return _QXZ("Cannot call prospect. You are not logged in as") . " {$user}.";
        } else {
            return _QXZ("Cannot call prospect") . ". {$live_agent_count} " . _QXZ("agents logged in as") . " {$user}.";
        }
    }
    $row = mysqli_fetch_row($rslt);
    $status = $row[0];
    if ($status != 'PAUSED') {
        return _QXZ("Status must be paused to call lead") . ". {$user} " . _QXZ("is presently in") . " {$status} " . _QXZ("status") . ".";
    }
    //@TODO: check user is in the correct CAMPAIGN for this lead.
    return true;
}
function delete_field_function($DB, $link, $linkCUSTOM, $ip, $user, $table_exists, $field_id, $list_id, $field_label, $field_name, $field_description, $field_rank, $field_help, $field_type, $field_options, $field_size, $field_max, $field_default, $field_required, $field_cost, $multi_position, $name_position, $field_order, $vicidial_list_fields)
{
    $SQLexecuted = 0;
    if ($field_type == 'DISPLAY' or $field_type == 'SCRIPT' or preg_match("/\\|{$field_label}\\|/i", $vicidial_list_fields)) {
        if ($DB) {
            echo "Non-DB {$field_type} field type, {$field_label}\n";
        }
        $SQLexecuted++;
    } else {
        $stmtCUSTOM = "ALTER TABLE custom_{$list_id} DROP {$field_label};";
        $rsltCUSTOM = mysql_to_mysqli($stmtCUSTOM, $linkCUSTOM);
        $table_update = mysqli_affected_rows($linkCUSTOM);
        if ($DB) {
            echo "{$table_update}|{$stmtCUSTOM}\n";
        }
        if (!$rsltCUSTOM) {
            echo _QXZ("Could not execute") . ': ' . mysqli_error() . "|{$stmtCUSTOM}|<BR><B>" . _QXZ("FIELD NOT DELETED, PLEASE GO BACK AND TRY AGAIN") . "</b>";
            ### LOG INSERTION Admin Log Table ###
            $SQL_log = "{$stmt}|{$stmtCUSTOM}";
            $SQL_log = preg_replace('/;/', '', $SQL_log);
            $SQL_log = addslashes($SQL_log);
            $stmt = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='******', ip_address='{$ip}', event_section='CUSTOM_FIELDS', event_type='OTHER', record_id='{$list_id}', event_code='ADMIN DELETE CUSTOM LIST FIELD ERROR', event_sql=\"{$SQL_log}\", event_notes='DELETE ERROR:" . mysqli_error() . "';";
            if ($DB) {
                echo "|{$stmt}|\n";
            }
            $rslt = mysql_to_mysqli($stmt, $link);
        } else {
            $SQLexecuted++;
        }
    }
    if ($SQLexecuted > 0) {
        $stmt = "DELETE FROM vicidial_lists_fields WHERE field_label='{$field_label}' and field_id='{$field_id}' and list_id='{$list_id}' LIMIT 1;";
        $rslt = mysql_to_mysqli($stmt, $link);
        $field_update = mysqli_affected_rows($link);
        if ($DB) {
            echo "{$field_update}|{$stmt}\n";
        }
        if (!$rslt) {
            echo _QXZ("Could not execute") . ': ' . mysqli_error() . "|{$stmt}|";
        }
        ### LOG INSERTION Admin Log Table ###
        $SQL_log = "{$stmt}|{$stmtCUSTOM}";
        $SQL_log = preg_replace('/;/', '', $SQL_log);
        $SQL_log = addslashes($SQL_log);
        $stmt = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='******', ip_address='{$ip}', event_section='CUSTOM_FIELDS', event_type='DELETE', record_id='{$list_id}', event_code='ADMIN DELETE CUSTOM LIST FIELD', event_sql=\"{$SQL_log}\", event_notes='';";
        if ($DB) {
            echo "|{$stmt}|\n";
        }
        $rslt = mysql_to_mysqli($stmt, $link);
    }
    return $SQLexecuted;
}
         $TOTALS_array[$x] = sprintf("%0.2f", MathZDC(100 * $TOTALS_array[$x - 1], $TOTALS_array[$x - 2]));
         $x++;
         $CSV_text .= "\"{$val[$x]}\",";
         $ASCII_text .= " " . sprintf("%12s", $val[$x]) . " |";
         $x++;
         $CSV_text .= "\"" . sec_convert($val[$x], 'H') . "\",";
         $ASCII_text .= " " . sprintf("%9s", sec_convert($val[$x], 'H')) . " ||";
         $TOTALS_array[$x] += $val[$x];
         $TOTALS_array[$x - 1] = sprintf("%0.2f", MathZDC($TOTALS_array[$x - 3], MathZDC($TOTALS_array[$x], 3600)));
         # Go back to get last result
     }
     $ASCII_text .= "\n";
     $CSV_text .= "\n";
 }
 $ASCII_text .= $ASCII_header2;
 $CSV_text .= '"","' . _QXZ("TOTALS") . '",';
 $ASCII_text .= "| " . sprintf("%26s", $TOTALS_array[0]) . " ||";
 $GRAPH_text .= $GRAPH . $GRAPH2 . $GRAPH3;
 for ($i = 1; $i < count($TOTALS_array); $i++) {
     $CSV_text .= "\"{$TOTALS_array[$i]}\",";
     switch ($i % 5) {
         case "1":
         case "2":
             $ASCII_text .= " " . sprintf("%5s", $TOTALS_array[$i]) . " |";
             break;
         case "3":
             $ASCII_text .= " " . sprintf("%10s", $TOTALS_array[$i]) . "% |";
             break;
         case "4":
             $ASCII_text .= " " . sprintf("%12s", $TOTALS_array[$i]) . " |";
             break;
        if ($call_time_SEC < 10) {
            $call_time_SEC = "0{$call_time_SEC}";
        }
        $call_time_MS = "{$call_time_M_int}:{$call_time_SEC}";
        $call_time_MS = sprintf("%7s", $call_time_MS);
        $G = '';
        $EG = '';
        if (preg_match("/LIVE/i", $status)) {
            $G = '<SPAN class="green"><B>';
            $EG = '</B></SPAN>';
        }
        #	if ($call_time_M_int >= 6) {$G='<SPAN class="red"><B>'; $EG='</B></SPAN>';}
        echo "| {$G}{$channel}{$EG} | {$G}{$status}{$EG} | {$G}{$campaign}{$EG} | {$G}{$number_dialed}{$EG} | {$G}{$start_time}{$EG} | {$G}{$call_time_MS}{$EG} |\n";
        $i++;
    }
    echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
    echo "  {$i} " . _QXZ("calls being placed on server") . " {$server_ip}\n\n";
    echo "  <SPAN class=\"green\"><B>          </SPAN> - " . _QXZ("LIVE CALL WAITING") . "</B>\n";
    #	echo "  <SPAN class=\"red\"><B>          </SPAN> - Over 5 minutes on hold</B>\n";
} else {
    echo "***************************************************************************************\n";
    echo "***************************************************************************************\n";
    echo "******************************* " . _QXZ("NO LIVE CALLS WAITING", 21) . " *********************************\n";
    echo "***************************************************************************************\n";
    echo "***************************************************************************************\n";
}
?>
</PRE>
</TD></TR></TABLE>

</BODY></HTML>
function submit_form()
	{
	var appointment_hourFORM = document.getElementById('appointment_hour');
	var appointment_hourVALUE = appointment_hourFORM[appointment_hourFORM.selectedIndex].text;
	var appointment_minFORM = document.getElementById('appointment_min');
	var appointment_minVALUE = appointment_minFORM[appointment_minFORM.selectedIndex].text;

	document.vsn.appointment_time.value = appointment_hourVALUE + ":" + appointment_minVALUE + ":00";

	document.vsn.submit();
	}

</SCRIPT>

<input type=button value="<?php 
echo _QXZ("SUBMIT");
?>
" name=smt id=smt onClick="submit_form()">
</TD>
</TR>

</TABLE>

</FORM>
</CENTER>

</B></FONT>
</TD>

</TR>
</TABLE>
     $time_scale_abb = '40 ' . _QXZ("minutes");
     $time_scale_tick = '10 ' . _QXZ("minutes");
 }
 if ($i > 5000) {
     $time_scale_abb = '60 ' . _QXZ("minutes");
     $time_scale_tick = '15 ' . _QXZ("minutes");
 }
 if ($i > 6000) {
     $time_scale_abb = '90 ' . _QXZ("minutes");
     $time_scale_tick = '15 ' . _QXZ("minutes");
 }
 if ($i > 7000) {
     $time_scale_abb = '120 ' . _QXZ("minutes");
     $time_scale_tick = '30 ' . _QXZ("minutes");
 }
 print _QXZ("rows") . ": {$i}   " . _QXZ("tick") . ": {$time_scale_abb}   " . _QXZ("scale") . ": {$time_scale_tick}\n";
 $HTMcontent = '';
 $HTMcontent .= "#proc page\n";
 $HTMcontent .= "#if @DEVICE in png,gif\n";
 $HTMcontent .= "   scale: 0.6\n";
 $HTMcontent .= "\n";
 $HTMcontent .= "#endif\n";
 $HTMcontent .= "#proc getdata\n";
 $HTMcontent .= "file: {$DOCroot}/{$DATfile}\n";
 $HTMcontent .= "fieldnames: userproc sysproc datetime load processes channels\n";
 $HTMcontent .= "\n";
 $HTMcontent .= "#proc areadef\n";
 $HTMcontent .= "title: Server {$group}   {$query_date_BEGIN} to {$query_date_END}\n";
 $HTMcontent .= "titledetails: size=14  align=C\n";
 $HTMcontent .= "rectangle: 1 1 12 7\n";
 $HTMcontent .= "xscaletype: datetime yyyy-mm-dd.hh:mm:ss\n";
                $row = explode($delimiter, preg_replace('/[\'\\"]/i', '', $buffer));
            }
            echo "<table border=0 width='100%' cellpadding=0 cellspacing=0>";
            $rslt = mysql_to_mysqli("{$fields_stmt}", $link);
            $custom_fields_count = mysqli_num_fields($rslt) - $vl_fields_count;
            while ($fieldinfo = mysqli_fetch_field($rslt)) {
                $rslt_field_name = $fieldinfo->name;
                if (preg_match("/{$rslt_field_name}/", $vicidial_list_fields)) {
                    $bgcolor = "#D9E6FE";
                } else {
                    $bgcolor = "#FED9D9";
                }
                echo "  <tr bgcolor='{$bgcolor}'>\r\n";
                echo "    <td align=right nowrap><font class=standard>" . strtoupper(preg_replace('/_/i', ' ', $rslt_field_name)) . ": </font></td>\r\n";
                if ($rslt_field_name != "list_id") {
                    echo "    <td align=left><select name='{$field_prefix}" . $rslt_field_name . "_field' onChange='DrawTemplateStrings()'>\r\n";
                    echo "     <option value='-1'>(" . _QXZ("none") . ")</option>\r\n";
                    for ($j = 0; $j < count($row); $j++) {
                        preg_replace('/\\"/i', '', $row[$j]);
                        echo "     <option value='{$j}'>\"{$row[$j]}\"</option>\r\n";
                    }
                    echo "    </select></td>\r\n";
                } else {
                    echo "    <td align=left>&nbsp;<font class='standard_bold'>{$list_id}<input type='hidden' name='" . $field_prefix . $list_id . "' value='{$list_id}'></font></td>\r\n";
                }
                echo "  </tr>\r\n";
            }
            echo "</table>";
        }
    }
}
    }
    $TOTcalls = sprintf("%-7s", $TOTcalls);
    $TOTtotTALK_M = $TOTtotTALK / 60;
    $TOTtotTALK_M = round($TOTtotTALK_M, 2);
    $TOTtotTALK_M_int = intval("{$TOTtotTALK_M}");
    $TOTtotTALK_S = $TOTtotTALK_M - $TOTtotTALK_M_int;
    $TOTtotTALK_S = $TOTtotTALK_S * 60;
    $TOTtotTALK_S = round($TOTtotTALK_S, 0);
    if ($TOTtotTALK_S < 10) {
        $TOTtotTALK_S = "0{$TOTtotTALK_S}";
    }
    $TOTtotTALK_MS = "{$TOTtotTALK_M_int}:{$TOTtotTALK_S}";
    $TOTtotTALK_MS = sprintf("%7s", $TOTtotTALK_MS);
    while (strlen($TOTtotTALK_MS) > 7) {
        $TOTtotTALK_MS = substr("{$TOTtotTALK_MS}", 0, -1);
    }
    $TOT_A = sprintf("%-5s", $TOT_A);
    $TOT_B = sprintf("%-5s", $TOT_B);
    $TOT_DC = sprintf("%-5s", $TOT_DC);
    $TOT_DNC = sprintf("%-5s", $TOT_DNC);
    $TOT_N = sprintf("%-5s", $TOT_N);
    $TOT_NI = sprintf("%-5s", $TOT_NI);
    $TOT_SALE = sprintf("%-5s", $TOT_SALE);
    echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
    echo "|  " . _QXZ("TOTALS", 25) . " | {$TOTcalls}| {$TOTtotTALK_MS}|        | {$TOT_A}| {$TOT_B}| {$TOT_DC}| {$TOT_DNC}| {$TOT_N}| {$TOT_NI}| {$TOT_SALE}|\n";
    echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
    echo "\n";
}
?>

</BODY></HTML>
     if ($DB) {
         echo "{$found_sec}";
     }
     echo "\n";
     $i++;
 }
 $TOTcount = sprintf("%-8s", $TOTcount);
 $Tcall_time_MS = sec_convert($total_sec, 'M');
 $Tcall_time_MS = sprintf("%10s", $Tcall_time_MS);
 echo "+------------------------------------------------------------------------+------------+----------+\n";
 echo "                                                                         | {$Tcall_time_MS} | {$TOTcount} |\n";
 echo "                                                                         +------------+----------+\n";
 echo "\n</PRE>\n";
 $ENDtime = date("U");
 $RUNtime = $ENDtime - $STARTtime;
 echo "<BR><BR>\n" . _QXZ("Run Time") . ": {$RUNtime} " . _QXZ("seconds") . "\n";
 if ($db_source == 'S') {
     mysqli_close($link);
     $use_slave_server = 0;
     $db_source = 'M';
     require "dbconnect_mysqli.php";
 }
 $endMS = microtime();
 $startMSary = explode(" ", $startMS);
 $endMSary = explode(" ", $endMS);
 $runS = $endMSary[0] - $startMSary[0];
 $runM = $endMSary[1] - $startMSary[1];
 $TOTALrun = $runS + $runM;
 $stmt = "UPDATE vicidial_report_log set run_time='{$TOTALrun}' where report_log_id='{$report_log_id}';";
 if ($DB) {
     echo "|{$stmt}|\n";
示例#20
0
        if ($FPG_count > 0) {
            $stmt = "INSERT INTO vicidial_filter_phone_numbers SET filter_phone_group_id='{$FPG_id}', phone_number='{$phone_number}';";
            if ($DB) {
                echo "{$stmt}\n";
            }
            $rslt = mysql_to_mysqli($stmt, $link);
            $affected_rows = mysqli_affected_rows($link);
            $SQL_log = "{$stmt}|{$stmtB}|{$CBaffected_rows}|";
            $SQL_log = preg_replace('/;/', '', $SQL_log);
            $SQL_log = addslashes($SQL_log);
            $stmt = "INSERT INTO vicidial_api_log set user='******',agent_user='******',function='dispo_add_FPG',value='{$phone_number}',result='{$affected_rows}',result_reason='{$FPG_id}',source='vdc',data='{$SQL_log}',api_date='{$NOW_TIME}',api_script='{$api_script}';";
            $rslt = mysql_to_mysqli($stmt, $link);
            $MESSAGE = _QXZ("DONE: %1s match found, %2s inserted into %3s with %4s status", 0, '', $FPG_count, $affected_rows, $FPG_id, $dispo);
            echo "{$MESSAGE}\n";
        } else {
            $MESSAGE = _QXZ("DONE: no filter phone group found %1s", 0, '', $FPG_id);
            echo "{$MESSAGE}\n";
        }
    } else {
        $MESSAGE = _QXZ("DONE: %1s or %2s are invalid", 0, '', $phone_number, $FPG_id);
        echo "{$MESSAGE}\n";
    }
} else {
    $MESSAGE = _QXZ("DONE: dispo is not a sale status: %1s", 0, '', $dispo);
    echo "{$MESSAGE}\n";
}
if ($log_to_file > 0) {
    $fp = fopen("./add_FPG.txt", "a");
    fwrite($fp, "{$NOW_TIME}|{$k}|{$phone_number}|{$FPG_id}|{$sale_status}|{$dispo}|{$user}|XXXX|{$DB}|{$log_to_file}|{$MESSAGE}|\n");
    fclose($fp);
}
 }
 $JS_onload .= "}\n";
 if ($report_display_type == 'HTML') {
     $JS_text .= $JS_onload;
 }
 $JS_text .= "</script>\n";
 if ($report_display_type == "HTML") {
     $MAIN .= $JS_text . $GRAPH . $WTD_GRAPH . $MTD_GRAPH . $QTD_GRAPH;
 } else {
     $MAIN .= $ASCII_text;
 }
 $hour_multiplier = MathZDC(20, $hi_hour_count);
 $hold_multiplier = MathZDC(20, $hi_hold_count);
 $ENDtime = date("U");
 $RUNtime = $ENDtime - $STARTtime;
 $MAIN .= "\n" . _QXZ("Run Time") . ": {$RUNtime} " . _QXZ("seconds") . "|{$db_source}\n";
 $MAIN .= "</PRE>\n";
 $MAIN .= "</TD></TR></TABLE>\n";
 $MAIN .= "</FORM>\n\n";
 $MAIN .= "</BODY></HTML>\n";
 if ($file_download > 0) {
     $FILE_TIME = date("Ymd-His");
     $CSVfilename = "Inbound_Daily_Report_{$US}{$FILE_TIME}.csv";
     $CSV_text = preg_replace('/ +\\"/', '"', $CSV_text);
     $CSV_text = preg_replace('/\\" +/', '"', $CSV_text);
     // We'll be outputting a TXT file
     header('Content-type: application/octet-stream');
     // It will be called LIST_101_20090209-121212.txt
     header("Content-Disposition: attachment; filename=\"{$CSVfilename}\"");
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    $stmt = "SELECT event_date,lead_id,vendor_id,phone_number,status,old_status,filename,result,result_rows,list_id from vicidial_list_update_log where event_date >= '{$query_date}' and event_date <= '{$end_date}' order by event_date,filename;";
    $rslt = mysql_to_mysqli($stmt, $link);
    if ($DB) {
        echo "{$stmt}\n";
    }
    $records_to_grab = mysqli_num_rows($rslt);
    $i = 0;
    while ($i < $records_to_grab) {
        $row = mysqli_fetch_row($rslt);
        $row[6] = trim($row[6]);
        echo "<TR><TD>{$row['0']}</TD><TD>{$row['1']}</TD><TD>{$row['2']}</TD><TD>{$row['3']}</TD><TD>{$row['4']}</TD><TD>{$row['5']}</TD><TD>{$row['9']}</TD><TD>{$row['6']}</TD><TD>{$row['7']}</TD><TD>{$row['8']}</TD></TR>\n";
        $i++;
    }
    $ENDtime = date("U");
    $RUNtime = $ENDtime - $STARTtime;
    echo "</TABLE><BR>\n" . _QXZ("Run Time") . ": {$RUNtime} " . _QXZ("seconds") . "|{$db_source}\n";
}
if ($db_source == 'S') {
    mysqli_close($link);
    $use_slave_server = 0;
    $db_source = 'M';
    require "dbconnect_mysqli.php";
}
$endMS = microtime();
$startMSary = explode(" ", $startMS);
$endMSary = explode(" ", $endMS);
$runS = $endMSary[0] - $startMSary[0];
$runM = $endMSary[1] - $startMSary[1];
$TOTALrun = $runS + $runM;
$stmt = "UPDATE vicidial_report_log set run_time='{$TOTALrun}' where report_log_id='{$report_log_id}';";
if ($DB) {
     $campaign_id = sprintf("%-8s", $row[2]);
     $status = sprintf("%-6s", $row[3]);
     $time = sprintf("%-19s", $row[4]);
     $user_list .= "{$row['0']}---{$row['3']}|";
     echo "| {$FMT_i} | <a href=\"./user_status.php?user={$row['0']}\">{$user}</a> | <a href=\"./admin.php?ADD=34&campaign_id={$row['2']}\">{$campaign_id}</a>   <a href=\"./AST_timeonVDADall.php?RR=4&DB=0&group={$row['2']}\">" . _QXZ("Real-Time", 9) . "</a> | {$status} | {$time} |\n";
 }
 echo "+------+--------------------------------+----------------------+--------+---------------------+\n";
 if ($DB) {
     echo "\n{$user_list}\n";
 }
 ##############################
 #########  ALL AGENT STATS
 echo "\n";
 echo "---------- " . _QXZ("DEFAULT AGENTS IN IN-GROUP") . "\n";
 echo "+------+--------------------------------+-----------+\n";
 echo "| #    | " . _QXZ("USER", 30) . " | " . _QXZ("LOGGED IN", 9) . " |\n";
 echo "+------+--------------------------------+-----------+\n";
 $stmt = "select vu.user,vu.full_name from vicidial_users vu where vu.closer_campaigns LIKE\"% " . mysqli_real_escape_string($link, $group) . " %\" order by vu.user limit 2000;";
 $rslt = mysql_to_mysqli($stmt, $link);
 if ($DB) {
     echo "{$stmt}\n";
 }
 $Xusers_to_print = mysqli_num_rows($rslt);
 $i = 0;
 while ($i < $Xusers_to_print) {
     $row = mysqli_fetch_row($rslt);
     $i++;
     $FMT_i = sprintf("%-4s", $i);
     $user = sprintf("%-30s", "{$row['0']} - {$row['1']}");
     while (strlen($user) > 30) {
         $user = substr("{$user}", 0, -1);
示例#24
0
        echo "<select size=1 name=delete_status>\n";
        echo "<option value='-'>" . _QXZ("Select A Status") . "</option>\n";
        $i = 0;
        while ($i < $status_count) {
            echo "<option value='{$statuses[$i]}'>{$statuses[$i]}</option>\n";
            $i++;
        }
        echo "</select></td></tr>\n";
        echo "<tr bgcolor=#B6D3FC><td align=right>" . _QXZ("Called Count") . "</td><td align=left>\n";
        echo "<select size=1 name=delete_count_op>\n";
        echo "<option value='<'><</option>\n";
        echo "<option value='<='><=</option>\n";
        echo "<option value='>'>></option>\n";
        echo "<option value='>='>>=</option>\n";
        echo "<option value='='>=</option>\n";
        echo "</select>\n";
        echo "<select size=1 name=delete_count_num>\n";
        $i = 0;
        while ($i <= $max_count) {
            echo "<option value='{$i}'>{$i}</option>\n";
            $i++;
        }
        echo "</select></td></tr>\n";
        echo "<tr bgcolor=#B6D3FC><td colspan=2 align=center><input type=submit name=delete_submit value='" . _QXZ("delete") . "'></td></tr>\n";
        # END Delete Leads
    }
    echo "</table></center>\n";
    echo "</form>\n";
    echo "</body></html>\n";
}
echo "</td></tr></table>\n";
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('CALLSdisplay','');\"><font size=1><span id=CALLSdisplayTXT>" . _QXZ("SHOW WAITING CALLS") . "</span></font></a>";
}
if ($ALLINGROUPstats > 0) {
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('ALLINGROUPstats','');\"><font size=1><span id=ALLINGROUPstatsTXT>" . _QXZ("HIDE IN-GROUP STATS") . "</span></font></a>";
} else {
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('ALLINGROUPstats','');\"><font size=1><span id=ALLINGROUPstatsTXT>" . _QXZ("SHOW IN-GROUP STATS") . "</span></font></a>";
}
if ($PHONEdisplay > 0) {
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('PHONEdisplay','');\"><font size=1><span id=PHONEdisplayTXT>" . _QXZ("HIDE PHONES") . "</span></font></a>";
} else {
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('PHONEdisplay','');\"><font size=1><span id=PHONEdisplayTXT>" . _QXZ("SHOW PHONES") . "</span></font></a>";
}
if ($CUSTPHONEdisplay > 0) {
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('CUSTPHONEdisplay','');\"><font size=1><span id=CUSTPHONEdisplayTXT>" . _QXZ("HIDE CUSTPHONES") . "</span></font></a>";
} else {
    echo " &nbsp; &nbsp; &nbsp; <a href=\"#\" onclick=\"update_variables('CUSTPHONEdisplay','');\"><font size=1><span id=CUSTPHONEdisplayTXT>" . _QXZ("SHOW CUSTPHONES") . "</span></font></a>";
}
#echo "</TD></TR></TABLE>";
##### END header formatting #####
#echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
echo "<span id=realtime_content name=realtime_content></span>\n";
if ($db_source == 'S') {
    mysqli_close($link);
    $use_slave_server = 0;
    $db_source = 'M';
    require "dbconnect_mysqli.php";
}
$endMS = microtime();
$startMSary = explode(" ", $startMS);
$endMSary = explode(" ", $endMS);
$runS = $endMSary[0] - $startMSary[0];
			else
				{
				full_msg+=msg_line+"\n";
				msg_line="> "+msg_array[i]+" ";
				}
			}
			full_msg+=msg_line+"\n";
			var email_field_value=document.getElementById("reply_message").value+"\n";
			email_field_value+=full_msg;
			document.getElementById("reply_message").value=email_field_value;
		}
	</script>
	<style type="text/css">
	pre { white-space: pre-wrap; }
	</style>
	<body>
	<form action='<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
' method='post' name="email_display_form" id="email_display_form" onSubmit="if (this.submitted) return false; this.submitted=true" enctype="multipart/form-data">
	<?php 
        echo $EMAIL_form;
        ?>
	</form>
	</body>
	</html>
<?php 
    }
} else {
    echo _QXZ("ERROR - ID variable missing");
}
                        array_push($chat_members, "{$row['4']}");
                    }
                }
                ## GRAB CHAT MESSAGES AND DISPLAY THEM
                if (!$user_level || $user_level == 0) {
                    $user_level_clause = " and chat_level='0' ";
                } else {
                    $user_level_clause = "";
                }
                $stmt = "SELECT * from vicidial_chat_log where chat_id='{$chat_id}' {$user_level_clause} order by message_time asc";
                $rslt = mysql_to_mysqli($stmt, $link);
                while ($row = mysqli_fetch_row($rslt)) {
                    $chat_color_key = array_search("{$row['4']}", $chat_members);
                    $row[2] = preg_replace('/\\n/', '<BR/>', $row[2]);
                    echo "<li><font color='{$color_array[$chat_color_key]}' class='chat_message bold'>{$row['5']}</font> <font class='chat_timestamp bold'>({$row['3']})</font> - <font class='chat_message " . $style_array[$row[6]] . "'>{$row['2']}</font></li>\n";
                }
                ## PLAY AUDIO FILE IF THERE ARE NEW MESSAGES
                $current_messages = mysqli_num_rows($rslt);
                echo "<input type='hidden' id='current_message_count' name='current_message_count' value='{$current_messages}'>\n";
            } else {
                echo "<font class='chat_title bold'>" . _QXZ("You have left chat") . ": {$chat_id}.</font><BR/><BR/><font class='chat_title'><a href='" . $chat_url . "?group_id={$group_id}&language={$language}&available_agents={$available_agents}&show_email={$show_email}'>" . _QXZ("GO BACK TO CHAT FORM") . "</a></font>\n";
            }
        } else {
            if ($status_row[1] == "NONE") {
                echo "<font class='chat_title bold'>" . _QXZ("Waiting for next available agent...") . "</font><BR/>\n";
            } else {
                echo "<font class='chat_title alert'>" . _QXZ("SYSTEM ERROR") . "</font><BR/>\n";
            }
        }
    }
}
        }
        $carrier_rpt_hf .= sprintf("%-145s", " ");
        if ($lower_limit + 1000 < mysqli_num_rows($rpt_rslt)) {
            if ($upper_limit + 1000 >= mysqli_num_rows($rpt_rslt)) {
                $max_limit = mysqli_num_rows($rpt_rslt) - $upper_limit;
            } else {
                $max_limit = 1000;
            }
            $carrier_rpt_hf .= "<a href=\"{$PHP_SELF}?SUBMIT={$SUBMIT}&DB={$DB}&type={$type}&query_date={$query_date}&query_date_D={$query_date_D}&query_date_T={$query_date_T}{$server_ipQS}&lower_limit=" . ($lower_limit + 1000) . "\">[" . _QXZ("NEXT") . " {$max_limit} " . _QXZ("records") . " >>>]</a>";
        } else {
            $carrier_rpt_hf .= sprintf("%23s", " ");
        }
        $carrier_rpt_hf .= "\n";
        $MAIN .= $carrier_rpt_hf . $carrier_rpt . $carrier_rpt_hf;
    } else {
        $MAIN .= "*** " . _QXZ("NO RECORDS FOUND") . " ***\n";
    }
    $MAIN .= "</font></PRE>\n";
    $MAIN .= "</form></BODY></HTML>\n";
}
if ($file_download > 0) {
    $FILE_TIME = date("Ymd-His");
    $CSVfilename = "AST_carrier_log_report_{$US}{$FILE_TIME}.csv";
    $CSV_text = preg_replace('/ +\\"/', '"', $CSV_text);
    $CSV_text = preg_replace('/\\" +/', '"', $CSV_text);
    // We'll be outputting a TXT file
    header('Content-type: application/octet-stream');
    // It will be called LIST_101_20090209-121212.txt
    header("Content-Disposition: attachment; filename=\"{$CSVfilename}\"");
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        echo _QXZ("Live Extensions");
    }
    if ($ADD == 2) {
        echo _QXZ("Busy Extensions");
    }
    if ($ADD == 3) {
        echo _QXZ("Outside Lines");
    }
    if ($ADD == 4) {
        echo _QXZ("Local Extensions");
    }
    if ($ADD == 5) {
        echo _QXZ("Conferences");
    }
    if ($ADD == 99999) {
        echo _QXZ("HELP");
    }
    echo "</title>\n";
    echo "</head>\n";
    echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
######################
# ADD=1 display all live extensions on a server
######################
if ($ADD == 1) {
    $pt = 'pt';
    if (!$field_name) {
        $field_name = 'extension';
    }
    if ($format == 'table') {
        echo "<TABLE WIDTH=120 BGCOLOR={$bgcolor} cellpadding=0 cellspacing=0>\n";
    $CSV_text .= "\"" . _QXZ("VICIDIAL REPORT LOG") . "\"\n";
    $CSV_text .= "\"" . _QXZ("WEB SERVER") . "\",\"" . _QXZ("COUNT") . "\"\n";
    $vrlog_div = "+----------------------------------------------------+--------+\n";
    $MAIN .= "\n" . _QXZ("VICIDIAL REPORT LOG") . "\n";
    $MAIN .= $vrlog_div;
    $MAIN .= "| " . _QXZ("WEB SERVER", 50) . " | " . _QXZ("COUNT", 6) . " |\n";
    $MAIN .= $vrlog_div;
    $report_TOTAL = 0;
    while ($row = mysqli_fetch_row($rslt)) {
        $MAIN .= "| " . sprintf("%-50s", substr($webserver_array[$row[0]], 0, 50)) . " | " . sprintf("%6s", $row[1]) . " |\n";
        $CSV_text .= "\"" . $webserver_array[$row[0]] . "\",\"{$row['1']}\"\n";
        $report_TOTAL += $row[1];
    }
    $MAIN .= $vrlog_div;
    $MAIN .= "| " . _QXZ("TOTAL", 50, "r") . " | " . sprintf("%6s", $report_TOTAL) . " |\n";
    $CSV_text .= "\"" . _QXZ("TOTAL") . "\",\"{$report_TOTAL}\"\n\n";
    $MAIN .= $vrlog_div;
    $MAIN .= "\n\n";
    $MAIN .= "</PRE>\n";
}
if ($file_download > 0) {
    $FILE_TIME = date("Ymd-His");
    $CSVfilename = "AST_webserver_url_report_{$US}{$FILE_TIME}.csv";
    $CSV_text = preg_replace('/ +\\"/', '"', $CSV_text);
    $CSV_text = preg_replace('/\\" +/', '"', $CSV_text);
    // We'll be outputting a TXT file
    header('Content-type: application/octet-stream');
    // It will be called LIST_101_20090209-121212.txt
    header("Content-Disposition: attachment; filename=\"{$CSVfilename}\"");
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');