Added Japanese agent interface, set 2.4 branch for RC 2

git-svn-id: svn://192.168.202.10@1836 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2012-06-28 03:06:58 +00:00
parent d176caaf8a
commit 3d26ea0cd1
90 changed files with 36193 additions and 0 deletions
+483
View File
@@ -0,0 +1,483 @@
<?php
# active_list_refresh.php version 2.2.0
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to serve updates of the live data to the display scripts
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $ADD - ('1','2','3','4','5')
# - $order - ('asc','desc')
# - $format - ('text','table','menu','selectlist','textarea')
# - $bgcolor - ('#123456','white','black','etc...')
# - $txtcolor - ('#654321','black','white','etc...')
# - $txtsize - ('1','2','3','etc...')
# - $selectsize - ('2','3','4','etc...')
# - $selectfontsize - ('8','10','12','etc...')
# - $selectedext - ('cc100')
# - $selectedtrunk - ('Zap/25-1')
# - $selectedlocal - ('SIP/cc100')
# - $textareaheight - ('8','10','12','etc...')
# - $textareawidth - ('8','10','12','etc...')
# - $field_name - ('extension','busyext','extension_xfer','etc...')
#
#
# changes
# 50323-1147 - First build of script
# 50401-1132 - small formatting changes
# 50502-1402 - added field_name as modifiable variable
# 50503-1213 - added session_name checking for extra security
# 50503-1311 - added conferences list
# 50610-1155 - Added NULL check on MySQL results to reduced errors
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1118 - Added variable filters to close security holes for login form
# 90508-0727 - Changed to PHP long tags
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
if (isset($_GET["order"])) {$order=$_GET["order"];}
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
### security strip all non-alphanumeric characters out of the variables ###
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
$ADD=ereg_replace("[^0-9]","",$ADD);
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
# default optional vars if not set
if (!isset($ADD)) {$ADD="1";}
if (!isset($order)) {$order='desc';}
if (!isset($format)) {$format="text";}
if (!isset($bgcolor)) {$bgcolor='white';}
if (!isset($txtcolor)) {$txtcolor='black';}
if (!isset($txtsize)) {$txtsize='2';}
if (!isset($selectsize)) {$selectsize='4';}
if (!isset($selectfontsize)) {$selectfontsize='10';}
if (!isset($textareaheight)) {$textareaheight='10';}
if (!isset($textareawidth)) {$textareawidth='20';}
$version = '0.0.8';
$build = '60619-1118';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='table')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build ADD: $ADD server_ip: $server_ip-->\n";
echo "<title>リスト表示: ";
if ($ADD==1) {echo "ライブ内線";}
if ($ADD==2) {echo "話し中の内線";}
if ($ADD==3) {echo "外線";}
if ($ADD==4) {echo "ローカル内線";}
if ($ADD==5) {echo "会議";}
if ($ADD==99999) {echo "ヘルプ";}
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";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
$o=0;
while ($phones_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedext") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=2 display all busy extensions on a server
######################
if ($ADD==2)
{
if (!$field_name) {$field_name = 'busyext';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
$o=0;
while ($busys_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedext") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=3 display all busy outside lines(trunks) on a server
######################
if ($ADD==3)
{
if (!$field_name) {$field_name = 'trunk';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
$o=0;
while ($busys_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=4 display all busy Local lines on a server
######################
if ($ADD==4)
{
if (!$field_name) {$field_name = 'local';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
$o=0;
while ($busys_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=5 display all agc-usable conferences on a server
######################
if ($ADD==5)
{
$pt='pt';
if (!$field_name) {$field_name = 'conferences';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
$o=0;
while ($phones_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedext") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
if ($format=='table') {echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";}
if ($format=='table') {echo "\n</body>\n</html>\n";}
exit;
?>
File diff suppressed because it is too large Load Diff
+95
View File
@@ -0,0 +1,95 @@
/* calendar icon */
img.tcalIcon {
cursor: pointer;
margin-left: 1px;
vertical-align: middle;
}
/* calendar container element */
div#tcal {
position: absolute;
visibility: hidden;
z-index: 100;
width: 158px;
padding: 2px 0 0 0;
}
/* all tables in calendar */
div#tcal table {
width: 100%;
border: 1px solid silver;
border-collapse: collapse;
background-color: white;
}
/* navigation table */
div#tcal table.ctrl {
border-bottom: 0;
}
/* navigation buttons */
div#tcal table.ctrl td {
width: 15px;
height: 20px;
}
/* month year header */
div#tcal table.ctrl th {
background-color: white;
color: black;
border: 0;
}
/* week days header */
div#tcal th {
border: 1px solid silver;
border-collapse: collapse;
text-align: center;
padding: 3px 0;
font-family: tahoma, verdana, arial;
font-size: 10px;
background-color: gray;
color: white;
}
/* date cells */
div#tcal td {
border: 0;
border-collapse: collapse;
text-align: center;
padding: 2px 0;
font-family: tahoma, verdana, arial;
font-size: 11px;
width: 22px;
cursor: pointer;
}
/* date highlight
in case of conflicting settings order here determines the priority from least to most important */
div#tcal td.othermonth {
color: silver;
}
div#tcal td.weekend {
background-color: #ACD6F5;
}
div#tcal td.today {
border: 1px solid red;
}
div#tcal td.selected {
background-color: #FFB3BE;
}
/* iframe element used to suppress windowed controls in IE5/6 */
iframe#tcalIF {
position: absolute;
visibility: hidden;
z-index: 98;
border: 0;
}
/* transparent shadow */
div#tcalShade {
position: absolute;
visibility: hidden;
z-index: 99;
}
div#tcalShade table {
border: 0;
border-collapse: collapse;
width: 100%;
}
div#tcalShade table td {
border: 0;
border-collapse: collapse;
padding: 0;
}
+335
View File
@@ -0,0 +1,335 @@
// Tigra Calendar v4.0.2 (2009-01-12) Database (yyyy-mm-dd)
// http://www.softcomplex.com/products/tigra_calendar/
// Public Domain Software... You're welcome.
// default settins
var A_TCALDEF = {
'months' : ['1月', 'February', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
'weekdays' : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
'yearscroll': true, // show year scroller
'weekstart': 0, // first day of week: 0-Su or 1-Mo
'centyear' : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
'imgpath' : '../agc/images/' // directory with calendar images
}
// date parsing function
function f_tcalParseDate (s_date) {
var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/;
if (!re_date.exec(s_date))
return alert ("無効 date: '" + s_date + "'.\nAccepted format is yyyy-mm-dd.")
var n_day = Number(RegExp.$3),
n_month = Number(RegExp.$2),
n_year = Number(RegExp.$1);
if (n_year < 100)
n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900);
if (n_month < 1 || n_month > 12)
return alert ("無効 month value: '" + n_month + "'.\nAllowed range is 01-12.");
var d_numdays = new Date(n_year, n_month, 0);
if (n_day > d_numdays.getDate())
return alert("無効 day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + ".");
return new Date (n_year, n_month - 1, n_day);
}
// date generating function
function f_tcalGenerDate (d_date) {
return (
d_date.getFullYear() + "-"
+ (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
);
}
// implementation
function tcal (a_cfg, a_tpl) {
// apply default template if not specified
if (!a_tpl)
a_tpl = A_TCALDEF;
// register in global collections
if (!window.A_TCALS)
window.A_TCALS = [];
if (!window.A_TCALSIDX)
window.A_TCALSIDX = [];
this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length;
window.A_TCALS[this.s_id] = this;
window.A_TCALSIDX[window.A_TCALSIDX.length] = this;
// assign methods
this.f_show = f_tcal_show;
this.f_hide = f_tcal_hide;
this.f_toggle = f_tcalToggle;
this.f_update = f_tcalUpdate;
this.f_relDate = f_tcalRelDate;
this.f_parseDate = f_tcalParseDate;
this.f_generDate = f_tcalGenerDate;
// create calendar icon
this.s_iconId = 'tcalico_' + this.s_id;
this.e_icon = f_getElement(this.s_iconId);
if (!this.e_icon) {
document.write('<img src="' + a_tpl.imgpath + 'cal.gif" id="' + this.s_iconId + '" onclick="A_TCALS[\'' + this.s_id + '\'].f_toggle()" class="tcalIcon" alt="Open Calendar" />');
this.e_icon = f_getElement(this.s_iconId);
}
// save received parameters
this.a_cfg = a_cfg;
this.a_tpl = a_tpl;
}
function f_tcal_show (d_date) {
// find input field
if (!this.a_cfg.controlname)
throw("TC: control name is not specified");
if (this.a_cfg.formname) {
var e_form = document.forms[this.a_cfg.formname];
if (!e_form)
throw("TC: form '" + this.a_cfg.formname + "' can not be found");
this.e_input = e_form.elements[this.a_cfg.controlname];
}
else
this.e_input = f_getElement(this.a_cfg.controlname);
if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT')
throw("TC: element '" + this.a_cfg.controlname + "' does not exist in "
+ (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document'));
// dynamically create HTML elements if needed
this.e_div = f_getElement('tcal');
if (!this.e_div) {
this.e_div = document.createElement("DIV");
this.e_div.id = 'tcal';
document.body.appendChild(this.e_div);
}
this.e_shade = f_getElement('tcalShade');
if (!this.e_shade) {
this.e_shade = document.createElement("DIV");
this.e_shade.id = 'tcalShade';
document.body.appendChild(this.e_shade);
}
this.e_iframe = f_getElement('tcalIF')
if (b_ieFix && !this.e_iframe) {
this.e_iframe = document.createElement("IFRAME");
this.e_iframe.style.filter = 'alpha(opacity=0)';
this.e_iframe.id = 'tcalIF';
this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif';
document.body.appendChild(this.e_iframe);
}
// hide all calendars
f_tcal_hideAll();
// generate HTML and show calendar
this.e_icon = f_getElement(this.s_iconId);
if (!this.f_update())
return;
this.e_div.style.visibility = 'visible';
this.e_shade.style.visibility = 'visible';
if (this.e_iframe)
this.e_iframe.style.visibility = 'visible';
// change icon and status
this.e_icon.src = this.a_tpl.imgpath + 'no_cal.gif';
this.e_icon.title = 'Close Calendar';
this.b_visible = true;
}
function f_tcal_hide (n_date) {
if (n_date)
this.e_input.value = this.f_generDate(new Date(n_date));
// no action if not visible
if (!this.b_visible)
return;
// hide elements
if (this.e_iframe)
this.e_iframe.style.visibility = 'hidden';
if (this.e_shade)
this.e_shade.style.visibility = 'hidden';
this.e_div.style.visibility = 'hidden';
// change icon and status
this.e_icon = f_getElement(this.s_iconId);
this.e_icon.src = this.a_tpl.imgpath + 'cal.gif';
this.e_icon.title = 'Open Calendar';
this.b_visible = false;
}
function f_tcalToggle () {
return this.b_visible ? this.f_hide() : this.f_show();
}
function f_tcalUpdate (d_date) {
var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : f_tcalResetTime(new Date());
var d_selected = this.e_input.value == ''
? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today)
: this.f_parseDate(this.e_input.value);
// figure out date to display
if (!d_date)
// selected by default
d_date = d_selected;
else if (typeof(d_date) == 'number')
// get from number
d_date = f_tcalResetTime(new Date(d_date));
else if (typeof(d_date) == 'string')
// parse from string
this.f_parseDate(d_date);
if (!d_date) return false;
// first date to display
var d_firstday = new Date(d_date);
d_firstday.setDate(1);
d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
var a_class, s_html = '<table class="ctrl"><tbody><tr>'
+ (this.a_tpl.yearscroll ? '<td' + this.f_relDate(d_date, -1, 'y') + ' title="Previous Year"><img src="' + this.a_tpl.imgpath + 'prev_year.gif" /></td>' : '')
+ '<td' + this.f_relDate(d_date, -1) + ' title="Previous Month"><img src="' + this.a_tpl.imgpath + 'prev_mon.gif" /></td><th>'
+ this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
+ '</th><td' + this.f_relDate(d_date, 1) + ' title="Next Month"><img src="' + this.a_tpl.imgpath + 'next_mon.gif" /></td>'
+ (this.a_tpl.yearscroll ? '<td' + this.f_relDate(d_date, 1, 'y') + ' title="Next Year"><img src="' + this.a_tpl.imgpath + 'next_year.gif" /></td></td>' : '')
+ '</tr></tbody></table><table><tbody><tr class="wd">';
// print weekdays titles
for (var i = 0; i < 7; i++)
s_html += '<th>' + this.a_tpl.weekdays[(this.a_tpl.weekstart + i) % 7] + '</th>';
s_html += '</tr>' ;
// print calendar table
var n_date, n_month, d_current = new Date(d_firstday);
while (d_current.getMonth() == d_date.getMonth() ||
d_current.getMonth() == d_firstday.getMonth()) {
// print row heder
s_html +='<tr>';
for (var n_wday = 0; n_wday < 7; n_wday++) {
a_class = [];
n_date = d_current.getDate();
n_month = d_current.getMonth();
// other month
if (d_current.getMonth() != d_date.getMonth())
a_class[a_class.length] = 'othermonth';
// weekend
if (d_current.getDay() == 0 || d_current.getDay() == 6)
a_class[a_class.length] = 'weekend';
// today
if (d_current.valueOf() == d_today.valueOf())
a_class[a_class.length] = 'today';
// selected
if (d_current.valueOf() == d_selected.valueOf())
a_class[a_class.length] = 'selected';
s_html += '<td onclick="A_TCALS[\'' + this.s_id + '\'].f_hide(' + d_current.valueOf() + ')"' + (a_class.length ? ' class="' + a_class.join(' ') + '">' : '>') + n_date + '</td>'
d_current.setDate(++n_date);
while (d_current.getDate() != n_date && d_current.getMonth() == n_month) {
d_current.setHours(d_current.getHours + 1);
d_current = f_tcalResetTime(d_current);
}
}
// print row footer
s_html +='</tr>';
}
s_html +='</tbody></table>';
// update HTML, positions and sizes
this.e_div.innerHTML = s_html;
var n_width = this.e_div.offsetWidth;
var n_height = this.e_div.offsetHeight;
var n_top = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight;
var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth;
if (n_left < 0) n_left = 0;
this.e_div.style.left = n_left + 'px';
this.e_div.style.top = n_top + 'px';
this.e_shade.style.width = (n_width + 8) + 'px';
this.e_shade.style.left = (n_left - 1) + 'px';
this.e_shade.style.top = (n_top - 1) + 'px';
this.e_shade.innerHTML = b_ieFix
? '<table><tbody><tr><td rowspan="2" colspan="2" width="6"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td width="7" height="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_tr.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tr><td height="' + (n_height - 7) + '" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_mr.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tr><td width="7" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_bl.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_bm.png\', sizingMethod=\'scale\');" height="7" align="left"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + this.a_tpl.imgpath + 'shade_br.png\', sizingMethod=\'scale\');"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tbody></table>'
: '<table><tbody><tr><td rowspan="2" width="6"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td rowspan="2"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td width="7" height="7"><img src="' + this.a_tpl.imgpath + 'shade_tr.png"></td></tr><tr><td background="' + this.a_tpl.imgpath + 'shade_mr.png" height="' + (n_height - 7) + '"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td></tr><tr><td><img src="' + this.a_tpl.imgpath + 'shade_bl.png"></td><td background="' + this.a_tpl.imgpath + 'shade_bm.png" height="7" align="left"><img src="' + this.a_tpl.imgpath + 'pixel.gif"></td><td><img src="' + this.a_tpl.imgpath + 'shade_br.png"></td></tr><tbody></table>';
if (this.e_iframe) {
this.e_iframe.style.left = n_left + 'px';
this.e_iframe.style.top = n_top + 'px';
this.e_iframe.style.width = (n_width + 6) + 'px';
this.e_iframe.style.height = (n_height + 6) +'px';
}
return true;
}
function f_getPosition (e_elemRef, s_coord) {
var n_pos = 0, n_offset,
e_elem = e_elemRef;
while (e_elem) {
n_offset = e_elem["offset" + s_coord];
n_pos += n_offset;
e_elem = e_elem.offsetParent;
}
// margin correction in some browsers
if (b_ieMac)
n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']);
else if (b_safari)
n_pos -= n_offset;
e_elem = e_elemRef;
while (e_elem != document.body) {
n_offset = e_elem["scroll" + s_coord];
if (n_offset && e_elem.style.overflow == 'scroll')
n_pos -= n_offset;
e_elem = e_elem.parentNode;
}
return n_pos;
}
function f_tcalRelDate (d_date, d_diff, s_units) {
var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
var d_result = new Date(d_date);
d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
if (d_result.getDate() != d_date.getDate())
d_result.setDate(0);
return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"';
}
function f_tcal_hideAll () {
for (var i = 0; i < window.A_TCALSIDX.length; i++)
window.A_TCALSIDX[i].f_hide();
}
function f_tcalResetTime (d_date) {
d_date.setHours(0);
d_date.setMinutes(0);
d_date.setSeconds(0);
d_date.setMilliseconds(0);
return d_date;
}
f_getElement = document.all ?
function (s_id) { return document.all[s_id] } :
function (s_id) { return document.getElementById(s_id) };
if (document.addEventListener)
window.addEventListener('scroll', f_tcal_hideAll, false);
if (window.attachEvent)
window.attachEvent('onscroll', f_tcal_hideAll);
// global variables
var s_userAgent = navigator.userAgent.toLowerCase(),
re_webkit = /WebKit\/(\d+)/i;
var b_mac = s_userAgent.indexOf('mac') != -1,
b_ie5 = s_userAgent.indexOf('msie 5') != -1,
b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
var b_ieFix = b_ie5 || b_ie6,
b_ieMac = b_mac && b_ie5,
b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;
+197
View File
@@ -0,0 +1,197 @@
<?php
# call_log_display.php version 2.2.0
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to send the inbound and outbound calls for a specific phone
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
# - $protocol - ('SIP','Zap','IAX2',...)
# - $in_limit - ('10','20','50','100',...)
# - $out_limit - ('10','20','50','100',...)
#
#
# changes
# 50406-1013 - First build of script
# 50407-1452 - Added definable limits
# 50503-1236 - added session_name checking for extra security
# 50610-1158 - Added NULL check on MySQL results to reduced errors
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
# 60323-1550 - added option for showing different number dialed in log
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1202 - Added variable filters to close security holes for login form
# 90508-0727 - Changed to PHP long tags
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
if (!isset($in_limit)) {$in_limit="100";}
if (!isset($out_limit)) {$out_limit="100";}
$number_dialed = 'number_dialed';
#$number_dialed = 'extension';
$version = '0.0.8';
$build = '60619-1202';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build EXTEN: $exten server_ip: $server_ip-->\n";
echo "<title>電話ログ表示";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo "Exten $exten 有効ではない またはプロトコル $protocol 有効ではない\n";
exit;
}
else
{
##### print outbound calls from the call_log table
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
echo "$out_calls_count|";
$loop_count=0;
while ($out_calls_count>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
$call_time_M = ($row[3] / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
}
echo "\n";
##### print inbound calls from the live_inbound_log table
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
echo "$in_calls_count|";
$loop_count=0;
while ($in_calls_count>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
$call_time_M = ($row[4] / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$callerIDnum = $row[3]; $callerIDname = $row[3];
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
}
echo "\n";
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
+778
View File
@@ -0,0 +1,778 @@
<?php
# conf_exten_check.php version 2.4
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $ACTION - ('refresh','register')
# - $client - ('agc','vdc')
# - $conf_exten - ('8600011',...)
# - $exten - ('123test',...)
# - $auto_dial_level - ('0','1','1.2',...)
# - $campagentstdisp - ('YES',...)
#
# changes
# 50509-1054 - First build of script
# 50511-1112 - Added ability to register a conference room
# 50610-1159 - Added NULL check on MySQL results to reduced errors
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
# 50706-1525 - Added date-time display for vicidial client display
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
# 60410-1424 - Added ability to grab calls-being-placed and agent status
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1201 - Added variable filters to close security holes for login form
# 61128-2255 - Added update for manual dial vicidial_live_agents
# 70319-1542 - Added agent disabled display function
# 71122-0205 - Added vicidial_live_agent status output
# 80424-0442 - Added non_latin lookup from system_settings
# 80519-1425 - Added calls-in-queue tally
# 80703-1106 - Added API functionality for Hangup and Dispo
# 81104-0229 - Added mysql error logging capability
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
# 90102-1402 - Added check for system and database time synchronization
# 90120-1720 - Added compatibility for API pause/resume and dial a number
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
# 90408-0020 - Added API vtiger specific callback activity record ability
# 90508-0727 - Changed to PHP long tags
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
# 90908-1037 - Added DEAD call logging
# 91130-2022 - Added code for manager override of in-group selection
# 91228-1341 - Added API fields update functions
# 100109-1337 - Fixed Manual dial live call detection
# 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions
# 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination
# 101123-1105 - Added api manual dial queue feature to external_dial function
# 101208-0308 - Moved the Calls in Queue count and other counts outside of the autodial section (issue 406)
# 110610-0059 - Small fix for manual dial calls lasting more than 100 minutes in real-time report
#
$version = '2.4-30';
$build = '110610-0059';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=38;
$one_mysql_log=0;
$DB=0;
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
if (isset($_GET["client"])) {$client=$_GET["client"];}
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
}
else
{
$user = ereg_replace("'|\"|\\\\|;","",$user);
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
}
# default optional vars if not set
if (!isset($format)) {$format="text";}
if (!isset($ACTION)) {$ACTION="refresh";}
if (!isset($client)) {$client="agc";}
$Alogin='N';
$RingCalls='N';
$DiaLCalls='N';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_TIME = date("Ymd_His");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$random = (rand(1000000, 9999999) + 10000000);
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
echo "<title>会議内線チェック";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
if ($ACTION == 'refresh')
{
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if (strlen($conf_exten)<1)
{
$channel_live=0;
echo "Conf Exten $conf_exten 有効ではない\n";
exit;
}
else
{
if ($client == 'vdc')
{
$Acount=0;
$AexternalDEAD=0;
$Aagent_log_id='';
$Acallerid='';
$DEADcustomer=0;
$Astatus='';
$Acampaign_id='';
### see if the agent has a record in the vicidial_live_agents table
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$Acount=$row[0];
if ($Acount > 0)
{
$stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$Astatus = $row[0];
$Acallerid = $row[1];
$Aagent_log_id = $row[2];
$Acampaign_id = $row[3];
$Alead_id = $row[4];
$api_manual_dial='STANDARD';
$stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';";
$rslt=mysql_query($stmt, $link);
$vcc_conf_ct = mysql_num_rows($rslt);
if ($vcc_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$api_manual_dial = $row[0];
}
}
# ### find out if external table shows agent should be disabled
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
# if ($DB) {echo "|$stmt|\n";}
# $rslt=mysql_query($stmt, $link);
# $row=mysql_fetch_row($rslt);
# $AexternalDEAD=$row[0];
##### BEGIN check オンcalls in queue, number of active calls in the campaign
if ($campagentstdisp == 'YES')
{
$ADsql='';
### grab the status of this agent to display
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$Alogin=$row[0];
$Acampaign=$row[1];
$AccampSQL=$row[2];
$AccampSQL = ereg_replace(' -','', $AccampSQL);
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
if (eregi('AGENTDIRECT', $AccampSQL))
{
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
}
### grab the number of calls being placed from this server and campaign
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$RingCalls=$row[0];
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">列になっている電話: $RingCalls</font>";}
else {$RingCalls = "<font class=\"queue_text\">列になっている電話: $RingCalls</font>";}
### grab the number of calls being placed from this server and campaign
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$DiaLCalls=$row[0];
}
else
{
$Alogin='N';
$RingCalls='N';
$DiaLCalls='N';
}
##### END check オンcalls in queue, number of active calls in the campaign
if ($auto_dial_level > 0)
{
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
$retry_count=0;
while ( ($errno > 0) and ($retry_count < 5) )
{
$rslt=mysql_query($stmt, $link);
$one_mysql_log=1;
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
$one_mysql_log=0;
$retry_count++;
}
##### BEGIN DEAD logging section #####
### find whether the call the agent is オンis hung up
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$AcalleridCOUNT=$row[0];
if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) and (preg_match("/^M/",$Acallerid)) )
{
$updateNOW_TIME = date("Y-m-d H:i:s");
$stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
{
$DEADcustomer++;
### find whether the agent log record has already logged DEAD
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$Aagent_log_idCOUNT=$row[0];
if ($Aagent_log_idCOUNT < 1)
{
$NEWdead_epoch = date("U");
$deadNOW_TIME = date("Y-m-d H:i:s");
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
##### END DEAD logging section #####
}
else
{
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
$retry_count=0;
while ( ($errno > 0) and ($retry_count < 5) )
{
$rslt=mysql_query($stmt, $link);
$one_mysql_log=1;
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
$one_mysql_log=0;
$retry_count++;
}
##### BEGIN DEAD logging section #####
### find whether the call the agent is オンis hung up
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03029',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$AcalleridCOUNT=$row[0];
if ( ($AcalleridCOUNT > 0) and (eregi("INCALL",$Astatus)) )
{
$updateNOW_TIME = date("Y-m-d H:i:s");
$stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
{
$DEADcustomer++;
### find whether the agent log record has already logged DEAD
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03030',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$Aagent_log_idCOUNT=$row[0];
if ($Aagent_log_idCOUNT < 1)
{
$NEWdead_epoch = date("U");
$deadNOW_TIME = date("Y-m-d H:i:s");
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03031',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03032',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
##### END DEAD logging section #####
}
### grab the API hangup and API dispo fields in vicidial_live_agents
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds,external_dtmf,external_transferconf,external_park,external_timer_action_destination from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$external_hangup = $row[0];
$external_status = $row[1];
$external_pause = $row[2];
$external_dial = $row[3];
$external_update_fields = $row[4];
$external_update_fields_data = $row[5];
$timer_action = $row[6];
$timer_action_message = $row[7];
$timer_action_seconds = $row[8];
$external_dtmf = $row[9];
$external_transferconf = $row[10];
$external_park = $row[11];
$timer_action_destination = $row[12];
$MDQ_count=0;
if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') )
{
$stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$mdq_count_record_ct = mysql_num_rows($rslt);
if ($mdq_count_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$MDQ_count = $row[0];
}
if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) )
{
$stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$mdq_record_ct = mysql_num_rows($rslt);
if ($mdq_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$MDQ_mdq_id = $row[0];
$MDQ_external_dial = $row[1];
$external_dial = $MDQ_external_dial;
$stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$UMDQaffected_rows_update = mysql_affected_rows($link);
if ($UMDQaffected_rows_update > 0)
{
$stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VLAMDQaffected_rows_update = mysql_affected_rows($link);
}
}
}
}
if (strlen($external_status)<1) {$external_status = '::::::::::';}
$web_epoch = date("U");
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$server_epoch = $row[0];
$db_epoch = $row[1];
$time_diff = ($server_epoch - $db_epoch);
$web_diff = ($db_epoch - $web_epoch);
##### check for in-group change details
$InGroupChangeDetails = '0|||';
$manager_ingroup_set=0;
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$mis_record_ct = mysql_num_rows($rslt);
if ($mis_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$manager_ingroup_set = $row[0];
}
if ($manager_ingroup_set > 0)
{
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VLAMISaffected_rows_update = mysql_affected_rows($link);
if ($VLAMISaffected_rows_update > 0)
{
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$migs_record_ct = mysql_num_rows($rslt);
if ($migs_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$external_ingroups = $row[0];
$external_blended = $row[1];
$external_igb_set_user = $row[2];
$outbound_autodial = $row[3];
$dial_method = $row[4];
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$mign_record_ct = mysql_num_rows($rslt);
if ($mign_record_ct > 0)
{
$row=mysql_fetch_row($rslt);
$external_igb_set_name = $row[0];
}
$NEWoutbound_autodial='N';
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
{$NEWoutbound_autodial='Y';}
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
}
##### grab the shift information the agent
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$VU_user_group = $row[0];
$VU_agent_shift_enforcement_override = $row[1];
### Gather timeclock and shift enforcement restriction settings
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$shift_enforcement = $row[0];
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
$Ashift_logout=0;
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|START",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
{
$shift_ok=0;
if (strlen($LOGgroup_shiftsSQL) < 3)
{$Ashift_logout++;}
else
{
$HHMM = date("Hi");
$wday = date("w");
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
$shifts_to_print = mysql_num_rows($rslt);
$o=0;
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
{
$rowx=mysql_fetch_row($rslt);
$shift_id = $rowx[0];
$shift_start_time = $rowx[1];
$shift_length = $rowx[2];
$shift_weekdays = $rowx[3];
if (eregi("$wday",$shift_weekdays))
{
$HHshift_length = substr($shift_length,0,2);
$MMshift_length = substr($shift_length,3,2);
$HHshift_start_time = substr($shift_start_time,0,2);
$MMshift_start_time = substr($shift_start_time,2,2);
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
if ($MMshift_end_time > 59)
{
$MMshift_end_time = ($MMshift_end_time - 60);
$HHshift_end_time++;
}
if ($HHshift_end_time > 23)
{$HHshift_end_time = ($HHshift_end_time - 24);}
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
if (
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
)
{$shift_ok++;}
}
$o++;
}
if ($shift_ok < 1)
{$Ashift_logout++;}
}
}
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
{$Alogin='TIME_SYNC';}
if ($Acount < 1)
{$Alogin='DEAD_VLA';}
if ($AexternalDEAD > 0)
{$Alogin='DEAD_EXTERNAL';}
if ($Ashift_logout > 0)
{$Alogin='SHIFT_LOGOUT';}
if ($external_pause == 'LOGOUT')
{
$Alogin='API_LOGOUT';
$external_pause='';
}
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|ステータス: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . "\n";
if (strlen($timer_action) > 3)
{
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VLAETAaffected_rows_update = mysql_affected_rows($link);
}
}
$total_conf=0;
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
# echo "$sip_list|";
$loop_count=0;
while ($sip_list>$loop_count)
{
$loop_count++; $total_conf++;
$row=mysql_fetch_row($rslt);
$ChannelA[$total_conf] = "$row[0]";
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
}
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
# echo "$channels_list|";
$loop_count=0;
while ($channels_list>$loop_count)
{
$loop_count++; $total_conf++;
$row=mysql_fetch_row($rslt);
$ChannelA[$total_conf] = "$row[0]";
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
}
}
$channels_list = ($channels_list + $sip_list);
echo "$channels_list|";
$counter=0;
$countecho='';
while($total_conf > $counter)
{
$counter++;
$countecho = "$countecho$ChannelA[$counter] ~";
# echo "$ChannelA[$counter] ~";
}
echo "$countecho\n";
}
if ($ACTION == 'register')
{
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
{
$channel_live=0;
echo "Conf Exten $conf_exten 有効ではない or Exten $exten 有効ではない\n";
exit;
}
else
{
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
}
echo "会議 $conf_exten 登録されています $exten\n";
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";
echo "\n</body>\n</html>\n";
}
exit;
##### MySQL Error Logging #####
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
{
$NOW_TIME = date("Y-m-d H:i:s");
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
$errno=''; $error='';
if ( ($mel > 0) or ($one_mysql_log > 0) )
{
$errno = mysql_errno($link);
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
{
$error = mysql_error($link);
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
fclose($efp);
}
}
$one_mysql_log=0;
return $errno;
}
?>
+61
View File
@@ -0,0 +1,61 @@
<?php
#
# dbconnect.php version 2.2.0
#
# database connection settings and some global web settings
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
if ( file_exists("/etc/astguiclient.conf") )
{
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARserver_ip", $DBCline))
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_port = '3306';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass");
if (!$link)
{
die('MySQL connect ERROR: ' . mysql_error());
}
mysql_select_db("$VARDB_database");
$local_DEF = 'Local/';
$conf_silent_prefix = '7';
$local_AMP = '@';
$ext_context = 'demo';
$recording_exten = '8309';
$WeBRooTWritablE = '1';
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
$flag_channels=0;
$flag_string = 'VICIast20';
?>
File diff suppressed because it is too large Load Diff
+352
View File
@@ -0,0 +1,352 @@
<?php
# inbound_popup.php version 2.2.0
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to open up when a live_inbound call comes in giving the user
# options of what to do with the call or options to lookup the callerID on various web sites
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $uniqueid - ('1234567890.123456',...)
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $vmail_box - ('101','1234',...)
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
# - $ext_context - ('default','demo',...)
# - $ext_priority - ('1','2',...)
# - $voicemail_dump_exten - ('85026666666666')
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
#
#
# changes
# 50428-1500 - First build of script display only
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
# 50503-1244 - added session_name checking for extra security
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1205 - Added variable filters to close security holes for login form
# 90508-0727 - Changed to PHP long tags
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
else {$local_web_callerID_URL = '';}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
$version = '0.0.6';
$build = '60619-1205';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$DO = '-1';
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
$forever_stop=0;
$user_abb = "$user$user$user$user";
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
?>
<script language="Javascript">
var server_ip = '<?php echo $server_ip ?>';
var epoch_sec = '<?php echo $StarTtime ?>';
var user_abb = '<?php echo $user_abb ?>';
var vmail_box = '<?php echo $vmail_box ?>';
var ext_context = '<?php echo $ext_context ?>';
var ext_priority = '<?php echo $ext_priority ?>';
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
var session_name = '<?php echo $session_name ?>';
var user = '<?php echo $user ?>';
var pass = '<?php echo $pass ?>';
// ################################################################################
// Send Hangup command for Live call connected to phone now to Manager
function livehangup_send_hangup(taskvar)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
var queryCID = "HLagcP" + epoch_sec + user_abb;
var hangupvalue = taskvar;
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
xmlhttp.open('POST', 'manager_send.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(livehangup_query);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
Nactiveext = null;
Nactiveext = xmlhttp.responseText;
alert(xmlhttp.responseText);
}
}
delete xmlhttp;
}
call_action_link_clear();
}
// ################################################################################
// Send Redirect command for ringing call to go directly to your voicemail
function liveredirect_send_vmail(taskvar,taskbox)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
var queryCID = "RVagcP" + epoch_sec + user_abb;
var hangupvalue = taskvar;
var mailboxvalue = taskbox;
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
xmlhttp.open('POST', 'manager_send.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(liveredirect_query);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
Nactiveext = null;
Nactiveext = xmlhttp.responseText;
alert(xmlhttp.responseText);
}
}
delete xmlhttp;
}
call_action_link_clear();
}
// ################################################################################
// timeout to deactivate the call action links after 30 秒
function link_timeout()
{
window.focus();
setTimeout("call_action_link_clear()", 30000);
}
// ################################################################################
// deactivates the call action links
function call_action_link_clear()
{
document.getElementById("callactions").innerHTML = "";
}
</script>
<?php
echo "<title>ライブ内部向け電話";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
echo "<CENTER><H2>ライブ内部向け電話</H2>\n";
echo "<B>$NOW_TIME</B><BR><BR>\n";
}
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if (strlen($uniqueid)<9)
{
$channel_live=0;
echo "Uniqueid $uniqueid 有効ではない\n";
exit;
}
else
{
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$channels_list = mysql_num_rows($rslt);
if ($channels_list>0)
{
$row=mysql_fetch_row($rslt);
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>Channel: </td><td align=left>$row[1]</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
$phone = eregi_replace(".*\<","",$row[3]);
$phone = eregi_replace("\>.*","",$phone);
$NPA = substr($phone, 0, 3);
$NXX = substr($phone, 3, 3);
$XXXX = substr($phone, 6, 4);
$D='-';
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_電話?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
echo "<a href=\"http://www.411.com/10742/search/Reverse_電話?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_電話?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
$local_web_callerID_QUERY_STRING ='';
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
$local_web_callerID_QUERY_STRING.="&callerID_Channel=$row[1]";
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">CUSTOM</a> - \n";
echo "</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>ダイアルした番号: </td><td align=left>$row[8]</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>注:</td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">電話を切る</a> - \n";
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">マイボイスメールに送信する</a>\n";
echo "</span></td></tr>\n";
echo "</table>\n";
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
}
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
+279
View File
@@ -0,0 +1,279 @@
<?php
# live_exten_check.php version 2.2.0
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to send whether the client channel is live and to what channel it is connected
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
# - $protocol - ('SIP','Zap','IAX2',...)
#
#
# changes
# 50404-1249 - First build of script
# 50406-1402 - added connected trunk lookup
# 50428-1452 - added live_inbound check for exten on 2nd line of output
# 50503-1233 - added session_name checking for extra security
# 50524-1429 - added parked calls count
# 50610-1204 - Added NULL check on MySQL results to reduced errors
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
# 60103-1541 - added favorite extens status display
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1203 - Added variable filters to close security holes for login form
# 60825-1029 - Fixed translation variable issue ChannelA
# 90508-0727 - Changed to PHP long tags
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
$version = '2.0.1';
$build = '60825-1029';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build EXTEN: $exten server_ip: $server_ip-->\n";
echo "<title>ライブ内線チェック";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
echo "DateTime: $NOW_TIME|";
echo "UnixTime: $StarTtime|";
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
echo "$row[0]|";
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo "Exten $exten 有効ではない またはプロトコル $protocol 有効ではない\n";
exit;
}
else
{
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
echo "$channels_list|";
$loop_count=0;
while ($channels_list>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
$ChanneLA[$loop_count] = "$row[0]";
$ChanneLB[$loop_count] = "$row[1]";
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
}
}
$counter=0;
while($loop_count > $counter)
{
$counter++;
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $ChanneLA[$counter]|";
}
}
}
}
}
echo "\n";
### check for live_inbound entry
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
if ($channels_list>0)
{
$row=mysql_fetch_row($rslt);
$LIuniqueid = "$row[0]";
$LIchannel = "$row[1]";
$LIcallerid = "$row[3]";
$LIdatetime = "$row[6]";
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
}
echo "\n";
### if favorites are present do a lookup to see if any are active
if ($favorites_count > 0)
{
$favorites = explode(',',$favorites_list);
$h=0;
$favs_print='';
while ($favorites_count > $h)
{
$fav_extension = explode('/',$favorites[$h]);
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$favs_print .= "$fav_extension[1]: $row[0] ~";
$h++;
}
echo "$favs_print\n";
}
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
File diff suppressed because it is too large Load Diff
+147
View File
@@ -0,0 +1,147 @@
<?php
# park_calls_display.php version 2.2.0
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to send the details on the parked calls on the server
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
# - $protocol - ('SIP','Zap','IAX2',...)
#
#
# changes
# 50524-1515 - First build of script
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1205 - Added variable filters to close security holes for login form
# 90508-0727 - Changed to PHP long tags
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
if (!isset($park_limit)) {$park_limit="1000";}
$version = '0.0.4';
$build = '60619-1205';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build EXTEN: $exten server_ip: $server_ip-->\n";
echo "<title>保留中の電話表示";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo "Exten $exten 有効ではない またはプロトコル $protocol 有効ではない\n";
exit;
}
else
{
##### print parked calls from the parked_channels table
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$park_calls_count = mysql_num_rows($rslt);
echo "$park_calls_count\n";
$loop_count=0;
while ($park_calls_count>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
}
echo "\n";
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
+839
View File
@@ -0,0 +1,839 @@
<?php
# phone_only.php - the web-based web-phone-only client application
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 110511-1336 - First Build
# 110526-1757 - Added webphone_auto_answer option
# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled
#
$version = '2.4-3p';
$build = '120223-2124';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=72;
$one_mysql_log=0;
require("dbconnect.php");
require("functions.php");
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];}
elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];}
if (!isset($phone_login))
{
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
}
if (!isset($phone_pass))
{
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
}
if (!isset($flag_channels))
{
$flag_channels=0;
$flag_string='';
}
### security strip all non-alphanumeric characters out of the variables ###
$DB=ereg_replace("[^0-9a-z]","",$DB);
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
$VD_login=ereg_replace("[^-_0-9a-zA-Z]","",$VD_login);
$VD_pass=ereg_replace("[^-_0-9a-zA-Z]","",$VD_pass);
$forever_stop=0;
if ($force_logout)
{
echo "今、ログアウトしています。ありがとうございました。\n";
exit;
}
$isdst = date("I");
$StarTtimE = date("U");
$NOW_TIME = date("Y-m-d H:i:s");
$tsNOW_TIME = date("YmdHis");
$FILE_TIME = date("Ymd-His");
$loginDATE = date("Ymd");
$CIDdate = date("ymdHis");
$month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y"));
$past_month_date = date("Y-m-d H:i:s",$month_old);
$minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y"));
$past_minutes_date = date("Y-m-d H:i:s",$minutes_old);
$webphone_width = 460;
$webphone_height = 500;
$PHP_SELF=$_SERVER['PHP_SELF'];
$random = (rand(1000000, 9999999) + 10000000);
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$vdc_header_date_format = $row[1];
$vdc_customer_date_format = $row[2];
$vdc_header_phone_format = $row[3];
$WeBRooTWritablE = $row[4];
$timeclock_end_of_day = $row[5];
$vtiger_url = $row[6];
$enable_vtiger_integration = $row[7];
$outbound_autodial_active = $row[8];
$enable_second_webform = $row[9];
$user_territories_active = $row[10];
$static_agent_url = $row[11];
$custom_fields_enabled = $row[12];
}
##### END SETTINGS LOOKUP #####
###########################################
##### DEFINABLE SETTINGS AND OPTIONS
###########################################
# set defaults for hard-coded variables
$clientDST = '1'; # set to 1 to check for DST オンserver for agent time
$PhonESComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login
$hide_timeclock_link = '0'; # set to 1 to hide the timeclock link オンthe agent login screen
$stretch_dimensions = '1'; # sets the vicidial screen to the size of the browser window
$BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500
$BROWSER_WIDTH = 770; # set to the minimum browser width, default=770
$webphone_width = 460; # set the webphone frame width
$webphone_height = 500; # set the webphone frame height
$webphone_pad = 0; # set the table cellpadding for the webphone
$webphone_location = 'right'; # set the location オンthe agent screen 'right' or 'bar'
$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6
$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
$FORM_COLOR = '#EFEFEF';
$SIDEBAR_COLOR = '#F6F6F6';
# if options file exists, use the override values for the above variables
# see the options-example.php file for more information
if (file_exists('options.php'))
{
require('options.php');
}
$US='_';
$CL=':';
$AT='@';
$DS='-';
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
$script_name = getenv("SCRIPT_NAME");
$server_name = getenv("SERVER_NAME");
$server_port = getenv("SERVER_PORT");
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
else {$HTTPprotocol = 'http://';}
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
else {$server_port = "$CL$server_port";}
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
$agcDIR = eregi_replace('phone_only.php','',$agcPAGE);
if (strlen($static_agent_url) > 5)
{$agcPAGE = $static_agent_url;}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../agc/css/style.css" />
<link rel="stylesheet" type="text/css" href="../agc/css/custom.css" />
';
echo "<!-- バージョン: $version ビルド: $build -->\n";
echo "<!-- BROWSER: $BROWSER_WIDTH x $BROWSER_HEIGHT $JS_browser_width x $JS_browser_height -->\n";
$stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass';";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$VU_user_group=$row[0];
if ($relogin == 'YES')
{
echo "<title>電話 web client: Login</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
if ($hide_timeclock_link < 1)
{echo "<a href=\"./timeclock.php?referrer=agent&amp;pl=$phone_login&amp;pp=$phone_pass&amp;VD_login=$VD_login&amp;VD_pass=$VD_pass\"> タイムクロック</a><br />\n";}
echo "<table width=\"100%\"><tr><td></td>\n";
echo "<!-- ILPV -->\n";
echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_jp/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">日本語 <img src=\"../agc/images/jp.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n"; echo "</tr></table>\n";
echo "<form name=\"vicidial_form\" id=\"vicidial_form\" action=\"$agcPAGE\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DB\" id=\"DB\" value=\"$DB\" />\n";
echo "<br /><br /><br /><center><table width=\"460px\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$MAIN_COLOR\"><tr bgcolor=\"white\">";
echo "<td align=\"left\" valign=\"bottom\"><img src=\"../agc/images/vdc_tab_vicidial.gif\" border=\"0\" alt=\"VICIdial\" /></td>";
echo "<td align=\"center\" valign=\"middle\"> 電話-Only ログイン</td>";
echo "</tr>\n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"> &nbsp; </font></td></tr>\n";
echo "<tr><td align=\"right\">電話ログイン: </td>";
echo "<td align=\"left\"><input type=\"text\" name=\"phone_login\" size=\"10\" maxlength=\"20\" value=\"$phone_login\" /></td></tr>\n";
echo "<tr><td align=\"right\">電話パスワード: </td>";
echo "<td align=\"left\"><input type=\"password\" name=\"phone_pass\" size=\"10\" maxlength=\"20\" value=\"$phone_pass\" /></td></tr>\n";
echo "<tr><td align=\"right\">ユーザログイン: </td>";
echo "<td align=\"left\"><input type=\"text\" name=\"VD_login\" size=\"10\" maxlength=\"20\" value=\"$VD_login\" /></td></tr>\n";
echo "<tr><td align=\"right\">ユーザパスワード: </td>";
echo "<td align=\"left\"><input type=\"password\" name=\"VD_pass\" size=\"10\" maxlength=\"20\" value=\"$VD_pass\" /></td></tr>\n";
echo "<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" name=\"送信\" value=\"Submit\" /> &nbsp; \n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"><br />バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</font></td></tr>\n";
echo "</table></center>\n";
echo "</form>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) )
{
echo "<title>電話 web client: 電話ログイン</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
if ($hide_timeclock_link < 1)
{echo "<a href=\"./timeclock.php?referrer=agent&amp;pl=$phone_login&amp;pp=$phone_pass&amp;VD_login=$VD_login&amp;VD_pass=$VD_pass\"> タイムクロック</a><br />\n";}
echo "<table width=100%><tr><td></td>\n";
echo "<!-- ILPV -->\n";
echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_jp/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">日本語 <img src=\"../agc/images/jp.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n"; echo "</tr></table>\n";
echo "<form name=\"vicidial_form\" id=\"vicidial_form\" action=\"$agcPAGE\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DB\" value=\"$DB\" />\n";
echo "<br /><br /><br /><center><table width=\"460px\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$MAIN_COLOR\"><tr bgcolor=\"white\">";
echo "<td align=\"left\" valign=\"bottom\"><img src=\"../agc/images/vdc_tab_vicidial.gif\" border=\"0\" alt=\"VICIdial\" /></td>";
echo "<td align=\"center\" valign=\"middle\"> 電話-Only ログイン</td>";
echo "</tr>\n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"> &nbsp; </font></td></tr>\n";
echo "<tr><td align=\"right\">電話ログイン: </td>";
echo "<td align=\"left\"><input type=\"text\" name=\"phone_login\" size=\"10\" maxlength=\"20\" value=\"\" /></td></tr>\n";
echo "<tr><td align=\"right\">電話パスワード: </td>";
echo "<td align=\"left\"><input type=\"password\" name=\"phone_pass\" size=\"10\" maxlength=\"20\" value=\"\" /></td></tr>\n";
echo "<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" name=\"送信\" value=\"Submit\" /> &nbsp; \n";
echo "<span id=\"LogiNReseT\"></span></td></tr>\n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"><br />バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</font></td></tr>\n";
echo "</table></center>\n";
echo "</form>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
else
{
if ($WeBRooTWritablE > 0)
{$fp = fopen ("./vicidial_auth_entries.txt", "a");}
$VDloginDISPLAY=0;
if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) )
{
$VDloginDISPLAY=1;
}
else
{
$stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09003',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if($auth>0)
{
$login=strtoupper($VD_login);
$password=strtoupper($VD_pass);
##### grab the full name of the agent
$stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login' and pass='$VD_pass'";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$LOGfullname = $row[0];
$user_level = $row[1];
$VU_user_group = $row[10];
### Gather timeclock and shift enforcement restriction settings
$stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time,agent_call_log_view,agent_xfer_consultative,agent_xfer_dial_override,agent_xfer_vm_transfer,agent_xfer_blind_transfer,agent_xfer_dial_with_customer,agent_xfer_park_customer_dial,agent_fullscreen,webphone_url_override,webphone_dialpad_override,webphone_systemkey_override from vicidial_user_groups where user_group='$VU_user_group';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$agent_fullscreen = $row[12];
$webphone_url = $row[13];
$webphone_dialpad_override = $row[14];
$system_key = $row[15];
if ( ($webphone_dialpad_override != 'DISABLED') and (strlen($webphone_dialpad_override) > 0) )
{$webphone_dialpad = $webphone_dialpad_override;}
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
$user_abb = "$VD_login$VD_login$VD_login$VD_login";
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
}
else
{
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n");
fclose($fp);
}
$VDloginDISPLAY=1;
$VDdisplayMESSAGE = "ログインが間違っています。再度試してください。<br />";
}
}
if ($VDloginDISPLAY)
{
echo "<title>電話 web client: Login</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
if ($hide_timeclock_link < 1)
{echo "<a href=\"./timeclock.php?referrer=agent&amp;pl=$phone_login&amp;pp=$phone_pass&amp;VD_login=$VD_login&amp;VD_pass=$VD_pass\"> タイムクロック</a><br />\n";}
echo "<table width=\"100%\"><tr><td></td>\n";
echo "<!-- ILPV -->\n";
echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_jp/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">日本語 <img src=\"../agc/images/jp.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n"; echo "</tr></table>\n";
echo "<form name=\"vicidial_form\" id=\"vicidial_form\" action=\"$agcPAGE\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DB\" value=\"$DB\" />\n";
echo "<input type=\"hidden\" name=\"phone_login\" value=\"$phone_login\" />\n";
echo "<input type=\"hidden\" name=\"phone_pass\" value=\"$phone_pass\" />\n";
echo "<center><br /><b>$VDdisplayMESSAGE</b><br /><br />";
echo "<table width=\"460px\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$MAIN_COLOR\"><tr bgcolor=\"white\">";
echo "<td align=\"left\" valign=\"bottom\"><img src=\"../agc/images/vdc_tab_vicidial.gif\" border=\"0\" alt=\"VICIdial\" /></td>";
echo "<td align=\"center\" valign=\"middle\"> 電話-Only ログイン</td>";
echo "</tr>\n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"> &nbsp; </font></td></tr>\n";
echo "<tr><td align=\"right\">ユーザログイン: </td>";
echo "<td align=\"left\"><input type=\"text\" name=\"VD_login\" size=\"10\" maxlength=\"20\" value=\"$VD_login\" /></td></tr>\n";
echo "<tr><td align=\"right\">ユーザパスワード: </td>";
echo "<td align=\"left\"><input type=\"password\" name=\"VD_pass\" size=\"10\" maxlength=\"20\" value=\"$VD_pass\" /></td></tr>\n";
echo "<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" name=\"送信\" value=\"Submit\" /> &nbsp; \n";
echo "<span id=\"LogiNReseT\"></span></td></tr>\n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"><br />バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</font></td></tr>\n";
echo "</table>\n";
echo "</form>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
$original_phone_login = $phone_login;
# code for parsing load-balanced agent phone allocation where agent interface
# will send multiple phones-table logins so that the script can determine the
# server that has the fewest agents logged into it.
# login: ca101,cb101,cc101
$alias_found=0;
$stmt="select count(*) from phones_alias where alias_id = '$phone_login';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$alias_ct = mysql_num_rows($rslt);
if ($alias_ct > 0)
{
$row=mysql_fetch_row($rslt);
$alias_found = "$row[0]";
}
if ($alias_found > 0)
{
$stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$alias_ct = mysql_num_rows($rslt);
if ($alias_ct > 0)
{
$row=mysql_fetch_row($rslt);
$alias_name = "$row[0]";
$phone_login = "$row[1]";
}
}
$pa=0;
if ( (eregi(',',$phone_login)) and (strlen($phone_login) > 2) )
{
$phoneSQL = "(";
$phones_auto = explode(',',$phone_login);
$phones_auto_ct = count($phones_auto);
while($pa < $phones_auto_ct)
{
if ($pa > 0)
{$phoneSQL .= " or ";}
$desc = ($phones_auto_ct - $pa); # traverse in reverse order
$phoneSQL .= "(login='$phones_auto[$desc]' and pass='$phone_pass')";
$pa++;
}
$phoneSQL .= ")";
}
else {$phoneSQL = "login='$phone_login' and pass='$phone_pass'";}
$authphone=0;
#$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';";
$stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_asterisk_server='Y' and phones.server_ip=servers.server_ip;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$authphone=$row[0];
if (!$authphone)
{
echo "<title>電話 web client: 電話ログイン Error</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
if ($hide_timeclock_link < 1)
{echo "<a href=\"./timeclock.php?referrer=agent&amp;pl=$phone_login&amp;pp=$phone_pass&amp;VD_login=$VD_login&amp;VD_pass=$VD_pass\"> タイムクロック</a><br />\n";}
echo "<table width=\"100%\"><tr><td></td>\n";
echo "<!-- ILPV -->\n";
echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_jp/phone_only.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">日本語 <img src=\"../agc/images/jp.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n"; echo "</tr></table>\n";
echo "<form name=\"vicidial_form\" id=\"vicidial_form\" action=\"$agcPAGE\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"DB\" value=\"$DB\">\n";
echo "<input type=\"hidden\" name=\"VD_login\" value=\"$VD_login\" />\n";
echo "<input type=\"hidden\" name=\"VD_pass\" value=\"$VD_pass\" />\n";
echo "<br /><br /><br /><center><table width=\"460px\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$MAIN_COLOR\"><tr bgcolor=\"white\">";
echo "<td align=\"left\" valign=\"bottom\"><img src=\"../agc/images/vdc_tab_vicidial.gif\" border=\"0\" alt=\"VICIdial\" /></td>";
echo "<td align=\"center\" valign=\"middle\"> 電話-Only ログインError</td>";
echo "</tr>\n";
echo "<tr><td align=\"center\" colspan=\"2\"><font size=\"1\"> &nbsp; <br /><font size=\"3\">すみません。あなたの電話ログインとパスワードはこのシステムでアクティブではありません。再度試してください。: <br /> &nbsp;</font></td></tr>\n";
echo "<tr><td align=\"right\">電話ログイン: </td>";
echo "<td align=\"left\"><input type=\"text\" name=\"phone_login\" size=\"10\" maxlength=\"20\" value=\"$phone_login\"></td></tr>\n";
echo "<tr><td align=\"right\">電話パスワード: </td>";
echo "<td align=\"left\"><input type=\"password\" name=\"phone_pass\" size=10 maxlength=20 value=\"$phone_pass\"></td></tr>\n";
echo "<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" name=\"送信\" value=\"Submit\" /></td></tr>\n";
echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\"><br />バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</font></td></tr>\n";
echo "</table></center>\n";
echo "</form>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
else
{
### go through the entered phones to figure out which server has fewest agents
### logged in and use that phone login account
if ($pa > 0)
{
$pb=0;
$pb_login='';
$pb_server_ip='';
$pb_count=0;
$pb_log='';
while($pb < $phones_auto_ct)
{
### find the server_ip of each phone_login
$stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';";
if ($DB) {echo "|$stmtx|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmtx, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowx=mysql_fetch_row($rslt);
### get number of agents logged in to each server
$stmt="SELECT count(*) from web_client_sessions where server_ip = '$rowx[0]';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09010',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
### find out whether the server is set to active
$stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y' and active_asterisk_server='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowy=mysql_fetch_row($rslt);
### find out if this server has a twin
$twin_not_live=0;
$stmt="SELECT active_twin_server_ip from servers where server_ip = '$rowx[0]';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowyy=mysql_fetch_row($rslt);
if (strlen($rowyy[0]) > 4)
{
### find out whether the twin server_updater is running
$stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[0]' and last_update > '$past_minutes_date';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowyz=mysql_fetch_row($rslt);
if ($rowyz[0] < 1) {$twin_not_live=1;}
}
### find out whether the server_updater is running
$stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09014',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$rowz=mysql_fetch_row($rslt);
$pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]|$twin_not_live| ";
if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) )
{
if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) )
{
$pb_count=$row[0];
$pb_server_ip=$rowx[0];
$phone_login=$phones_auto[$pb];
}
}
$pb++;
}
echo "<!-- 電話s balance selection: $phone_login|$pb_server_ip|$past_minutes_date| |$pb_log -->\n";
}
echo "<title>電話 web client</title>\n";
$stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret,is_webphone,use_external_server_ip,codecs_list,webphone_dialpad,phone_ring_timeout,on_hook_agent,webphone_auto_answer from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$extension=$row[0];
$dialplan_number=$row[1];
$voicemail_id=$row[2];
$phone_ip=$row[3];
$computer_ip=$row[4];
$server_ip=$row[5];
$login=$row[6];
$pass=$row[7];
$status=$row[8];
$active=$row[9];
$phone_type=$row[10];
$fullname=$row[11];
$company=$row[12];
$picture=$row[13];
$messages=$row[14];
$old_messages=$row[15];
$protocol=$row[16];
$local_gmt=$row[17];
$ASTmgrUSERNAME=$row[18];
$ASTmgrSECRET=$row[19];
$login_user=$row[20];
$login_pass=$row[21];
$login_campaign=$row[22];
$park_on_extension=$row[23];
$conf_on_extension=$row[24];
$VICIDiaL_park_on_extension=$row[25];
$VICIDiaL_park_on_filename=$row[26];
$monitor_prefix=$row[27];
$recording_exten=$row[28];
$voicemail_exten=$row[29];
$voicemail_dump_exten=$row[30];
$ext_context=$row[31];
$dtmf_send_extension=$row[32];
$call_out_number_group=$row[33];
$client_browser=$row[34];
$install_directory=$row[35];
$local_web_callerID_URL=$row[36];
$VICIDiaL_web_URL=$row[37];
$AGI_call_logging_enabled=$row[38];
$user_switching_enabled=$row[39];
$conferencing_enabled=$row[40];
$admin_hangup_enabled=$row[41];
$admin_hijack_enabled=$row[42];
$admin_monitor_enabled=$row[43];
$call_parking_enabled=$row[44];
$updater_check_enabled=$row[45];
$AFLogging_enabled=$row[46];
$QUEUE_ACTION_enabled=$row[47];
$CallerID_popup_enabled=$row[48];
$voicemail_button_enabled=$row[49];
$enable_fast_refresh=$row[50];
$fast_refresh_rate=$row[51];
$enable_persistant_mysql=$row[52];
$auto_dial_next_number=$row[53];
$VDstop_rec_after_each_call=$row[54];
$DBX_server=$row[55];
$DBX_database=$row[56];
$DBX_user=$row[57];
$DBX_pass=$row[58];
$DBX_port=$row[59];
$outbound_cid=$row[65];
$enable_sipsak_messages=$row[66];
$conf_secret=$row[72];
$is_webphone=$row[73];
$use_external_server_ip=$row[74];
$codecs_list=$row[75];
$webphone_dialpad=$row[76];
$phone_ring_timeout=$row[77];
$on_hook_agent=$row[78];
$webphone_auto_answer=$row[79];
$no_empty_session_warnings=0;
if ( ($phone_login == 'nophone') or ($on_hook_agent == 'Y') )
{
$no_empty_session_warnings=1;
}
if ($PhonESComPIP == '1')
{
if (strlen($computer_ip) < 4)
{
$stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
}
}
if ($PhonESComPIP == '2')
{
$stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09017',$VD_login,$server_ip,$session_name,$one_mysql_log);}
}
if ($clientDST)
{
$local_gmt = ($local_gmt + $isdst);
}
if ($protocol == 'EXTERNAL')
{
$protocol = 'Local';
$extension = "$dialplan_number$AT$ext_context";
}
$SIP_user = "$protocol/$extension";
$SIP_user_DiaL = "$protocol/$extension";
if ( (ereg('8300',$dialplan_number)) and (strlen($dialplan_number)<5) and ($protocol == 'Local') )
{
$SIP_user = "$protocol/$extension$VD_login";
}
$session_ext = eregi_replace("[^a-z0-9]", "", $extension);
if (strlen($session_ext) > 10) {$session_ext = substr($session_ext, 0, 10);}
$session_rand = (rand(1,9999999) + 10000000);
$session_name = "$StarTtimE$US$session_ext$session_rand";
if ($webform_sessionname)
{$webform_sessionname = "&session_name=$session_name";}
else
{$webform_sessionname = '';}
$stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'phone';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$NOW_TIME','$session_name');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);}
$VICIDiaL_is_logged_in=1;
$webphone_content='';
### build Iframe variable content for webphone here
$codecs_list = preg_replace("/ /",'',$codecs_list);
$codecs_list = preg_replace("/-/",'',$codecs_list);
$codecs_list = preg_replace("/&/",'',$codecs_list);
$webphone_server_ip = $server_ip;
if ($use_external_server_ip=='Y')
{
##### find external_server_ip if enabled for this phone account
$stmt="SELECT external_server_ip FROM servers where server_ip='$server_ip' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09020',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$exip_ct = mysql_num_rows($rslt);
if ($exip_ct > 0)
{
$row=mysql_fetch_row($rslt);
$webphone_server_ip =$row[0];
}
}
if (strlen($webphone_url) < 6)
{
##### find webphone_url in system_settings and generate IFRAME code for it #####
$stmt="SELECT webphone_url FROM system_settings LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09021',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$wu_ct = mysql_num_rows($rslt);
if ($wu_ct > 0)
{
$row=mysql_fetch_row($rslt);
$webphone_url =$row[0];
}
}
if (strlen($system_key) < 1)
{
##### find system_key in system_settings if populated #####
$stmt="SELECT webphone_systemkey FROM system_settings LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09022',$VD_login,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$wsk_ct = mysql_num_rows($rslt);
if ($wsk_ct > 0)
{
$row=mysql_fetch_row($rslt);
$system_key =$row[0];
}
}
$webphone_options='INITIAL_LOAD';
if ($webphone_dialpad == 'Y') {$webphone_options .= "--DIALPAD_Y";}
if ($webphone_dialpad == 'N') {$webphone_options .= "--DIALPAD_N";}
if ($webphone_dialpad == 'TOGGLE') {$webphone_options .= "--DIALPAD_TOGGLE";}
if ($webphone_dialpad == 'TOGGLE_OFF') {$webphone_options .= "--DIALPAD_OFF_TOGGLE";}
if ($webphone_auto_answer == 'Y') {$webphone_options .= "--AUTOANSWER_Y";}
if ($webphone_auto_answer == 'N') {$webphone_options .= "--AUTOANSWER_N";}
### base64 encode variables
$b64_phone_login = base64_encode($extension);
$b64_phone_pass = base64_encode($conf_secret);
$b64_session_name = base64_encode($session_name);
$b64_server_ip = base64_encode($webphone_server_ip);
$b64_callerid = base64_encode($outbound_cid);
$b64_protocol = base64_encode($protocol);
$b64_codecs = base64_encode($codecs_list);
$b64_options = base64_encode($webphone_options);
$b64_system_key = base64_encode($system_key);
$WebPhonEurl = "$webphone_url?phone_login=$b64_phone_login&phone_login=$b64_phone_login&phone_pass=$b64_phone_pass&server_ip=$b64_server_ip&callerid=$b64_callerid&protocol=$b64_protocol&codecs=$b64_codecs&options=$b64_options&system_key=$b64_system_key";
if ($webphone_location == 'bar')
{
$webphone_content = "<iframe src=\"$WebPhonEurl\" style=\"width:1100px;height:500px;background-color:transparent;z-index:17;\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" id=\"webphone\" name=\"webphone\" width=\"" . $webphone_width . "px\" height=\"" . $webphone_height . "px\"> </iframe>";
}
else
{
$webphone_content = "<iframe src=\"$WebPhonEurl\" style=\"width:1100px;height:500px;background-color:transparent;z-index:17;\" scrolling=\"auto\" frameborder=\"0\" allowtransparency=\"true\" id=\"webphone\" name=\"webphone\" width=\"" . $webphone_width . "px\" height=\"" . $webphone_height . "px\"> </iframe>";
}
if (ereg('MSIE',$browser))
{
$useIE=1;
echo "<!-- client web browser used: MSIE |$browser|$useIE| -->\n";
}
else
{
$useIE=0;
echo "<!-- client web browser used: W3C-Compliant |$browser|$useIE| -->\n";
}
}
}
### SCREEN WIDTH AND HEIGHT CALCULATIONS ###
### DO NOT EDIT! ###
if ($stretch_dimensions > 0)
{
if ($agent_status_view < 1)
{
if ($JS_browser_width >= 510)
{$BROWSER_WIDTH = ($JS_browser_width - 80);}
}
else
{
if ($JS_browser_width >= 730)
{$BROWSER_WIDTH = ($JS_browser_width - 300);}
}
if ($JS_browser_height >= 340)
{$BROWSER_HEIGHT = ($JS_browser_height - 40);}
}
if ($agent_fullscreen=='Y')
{
$BROWSER_WIDTH = ($JS_browser_width - 10);
$BROWSER_HEIGHT = $JS_browser_height;
}
$MASTERwidth=($BROWSER_WIDTH - 340);
$MASTERheight=($BROWSER_HEIGHT - 200);
if ($MASTERwidth < 430) {$MASTERwidth = '430';}
if ($MASTERheight < 300) {$MASTERheight = '300';}
if ($webphone_location == 'bar') {$MASTERwidth = ($MASTERwidth + $webphone_height);}
$CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...)
$SBwidth = ($MASTERwidth + 331); # 761 - SideBar starting point
$MNwidth = ($MASTERwidth + 330); # 760 - main frame
$XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference
$HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks
$CQwidth = ($MASTERwidth + 300); # 730 - calls in queue listings
$AMwidth = ($MASTERwidth + 270); # 700 - refresh links
$SCwidth = ($MASTERwidth + 230); # 670 - live call 秒 counter, sidebar link
$PDwidth = ($MASTERwidth + 210); # 650 - preset-dial links
$MUwidth = ($MASTERwidth + 180); # 610 - agent mute
$SSwidth = ($MASTERwidth + 176); # 606 - scroll script
$SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session
$HKwidth = ($MASTERwidth + 20); # 450 - Hotkeys button
$HSwidth = ($MASTERwidth + 1); # 431 - Header spacer
$PBwidth = ($MASTERwidth + 0); # 430 - Presets list
$CLwidth = ($MASTERwidth - 120); # 310 - Calls in queue link
$GHheight = ($MASTERheight + 1260);# 1560 - Gender Hide span
$DBheight = ($MASTERheight + 260); # 560 - Debug span
$WRheight = ($MASTERheight + 160); # 460 - Warning boxes
$CQheight = ($MASTERheight + 140); # 440 - Calls in queue section
$SLheight = ($MASTERheight + 122); # 422 - SideBar link, Agents view link
$QLheight = ($MASTERheight + 112); # 412 - Calls in queue link
$HKheight = ($MASTERheight + 105); # 405 - HotKey active Button
$AMheight = ($MASTERheight + 100); # 400 - Agent mute buttons
$PBheight = ($MASTERheight + 90); # 390 - preset dial links
$MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons
$CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status
$SSheight = ($MASTERheight + 31); # 331 - script content
$HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey
$BPheight = ($MASTERheight - 250); # 50 - bottom buffer, Agent Xfer Span
$SCheight = 49; # 49 - 秒 オンcall display
$SFheight = 65; # 65 - height of the script and form contents
$SRheight = 69; # 69 - height of the script and form refrech links
if ($webphone_location == 'bar')
{
$SCheight = ($SCheight + $webphone_height);
# $SFheight = ($SFheight + $webphone_height);
$SRheight = ($SRheight + $webphone_height);
}
$AVTheight = '0';
if ($is_webphone) {$AVTheight = '20';}
echo "</head>\n";
$zi=2;
echo "<body bgcolor=\"white\">\n";
echo " 電話: $original_phone_login - $server_ip &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?relogin=YES&session_epoch=1234567890&session_id=&session_name=$session_name&VD_login=$VD_login&phone_login=$original_phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Logout</a><BR>\n";
if ($webphone_location == 'bar')
{
echo "<span style=\"position:absolute;left:0px;top:30px;height:500px;width=".$webphone_width."px;overflow:hidden;z-index:$zi;background-color:$SIDEBAR_COLOR;\" id=\"webphoneSpanBAR\"><span id=\"webphonecontent\" style=\"overflow:hidden;\">$webphone_content</span></span>\n";
}
else
{
echo "<span style=\"position:absolute;left:0px;top:30px;height:500px;overflow:scroll;z-index:$zi;background-color:$SIDEBAR_COLOR;\" id=\"webphoneSpanDEFAULT\"><table cellpadding=\"$webphone_pad\" cellspacing=\"0\" border=\"0\"><tr><td width=\"5px\" rowspan=\"2\">&nbsp;</td><td align=\"center\"><font class=\"body_text\">
Web 電話: &nbsp; </font></td></tr><tr><td align=\"center\"><span id=\"webphonecontent\">$webphone_content</span></td></tr></table></span>\n";
}
?>
</body>
</html>
<?php
exit;
?>
+458
View File
@@ -0,0 +1,458 @@
<?php
# timeclock.php - VICIDIAL system user timeclock
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGELOG
# 80523-0134 - First Build
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
# 80525-2351 - Added an audit log that is not to be editable
# 80602-0641 - Fixed status update bug
# 90508-0727 - Changed to PHP long tags
# 100621-1023 - Added admin_web_directory variable
#
$version = '2.2.0-6';
$build = '100621-1023';
$StarTtimE = date("U");
$NOW_TIME = date("Y-m-d H:i:s");
$last_action_date = $NOW_TIME;
$US='_';
$CL=':';
$AT='@';
$DS='-';
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
$script_name = getenv("SCRIPT_NAME");
$server_name = getenv("SERVER_NAME");
$server_port = getenv("SERVER_PORT");
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
else {$HTTPprotocol = 'http://';}
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
else {$server_port = "$CL$server_port";}
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (!isset($phone_login))
{
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
}
if (!isset($phone_pass))
{
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
}
### security strip all non-alphanumeric characters out of the variables ###
$DB=ereg_replace("[^0-9a-z]","",$DB);
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
require("dbconnect.php");
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,admin_home_url,admin_web_directory FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$welcomeURL = $row[1];
$admin_web_directory = $row[2];
$i++;
}
##### END SETTINGS LOOKUP #####
###########################################
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
if ( ($stage == 'login') or ($stage == 'logout') )
{
### see if user/pass exist for this user in vicidial_users table
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$valid_user=$row[0];
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
if ($valid_user < 1)
{
### NOT A VALID USER/PASS
$VDdisplayMESSAGE = "入力したユーザ名とパスワードはこのシステム内では有効ではありません。<BR>再度、お試しください。:";
echo"<HTML><HEAD>\n";
echo"<TITLE>Agent タイムクロック</TITLE>\n";
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"</HEAD>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> タイムクロック </B></TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>ユーザログイン: </TD>";
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>ユーザパスワード: </TD>";
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=送信 VALUE=送信> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
else
{
### VALID USER/PASS, CONTINUE
### get name and group for this user
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$full_name = $row[0];
$user_group = $row[1];
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
### get vicidial_timeclock_status record count for this user
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$vts_count = $row[0];
$last_action_sec=99;
if ($vts_count > 0)
{
### vicidial_timeclock_status record found, grab status and date of last activity
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$status = $row[0];
$event_epoch = $row[1];
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
$last_action_sec = ($StarTtimE - $event_epoch);
if ($last_action_sec > 0)
{
$totTIME_H = ($last_action_sec / 3600);
$totTIME_H_int = round($totTIME_H, 2);
$totTIME_H_int = intval("$totTIME_H");
$totTIME_M = ($totTIME_H - $totTIME_H_int);
$totTIME_M = ($totTIME_M * 60);
$totTIME_M_int = round($totTIME_M, 2);
$totTIME_M_int = intval("$totTIME_M");
$totTIME_S = ($totTIME_M - $totTIME_M_int);
$totTIME_S = ($totTIME_S * 60);
$totTIME_S = round($totTIME_S, 0);
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
}
else
{
$totTIME_HMS='0:00:00';
}
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
}
else
{
### No vicidial_timeclock_status record found, insert one
$stmt="INSERT INTO vicidial_timeclock_status set status='START', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$status='START';
$totTIME_HMS='0:00:00';
$affected_rows = mysql_affected_rows($link);
print "<!-- 新 vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
}
if ( ($last_action_sec < 30) and ($status != 'START') )
{
### You cannot log in or out within 30 秒 of your last login/logout
$VDdisplayMESSAGE = "最後にログインまたはログアウトの30秒以内にログインまたはログアウトすることができません。";
echo"<HTML><HEAD>\n";
echo"<TITLE>Agent タイムクロック</TITLE>\n";
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"</HEAD>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> タイムクロック </B></TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>ユーザログイン: </TD>";
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>ユーザパスワード: </TD>";
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=送信 VALUE=送信> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
if ($commit == 'YES')
{
if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') )
{
$VDdisplayMESSAGE = "今、ログインしました。";
$LOGtimeMESSAGE = "でログインしました。 $NOW_TIME";
### Add a record to the timeclock log
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
$timeclock_id = mysql_insert_id($link);
print "<!-- 新 vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
### Update the user's timeclock status record
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
### Add a record to the timeclock audit log
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
print "<!-- 新 vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
}
if ( ($status=='LOGIN') and ($stage=='logout') )
{
$VDdisplayMESSAGE = "今、ログアウトしました。";
$LOGtimeMESSAGE = "でログアウトしました。$NOW_TIME<BR>ログインしていた時間:$totTIME_HMS";
### Add a record to the timeclock log
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
$timeclock_id = mysql_insert_id($link);
print "<!-- 新 vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
### Update last login record in the timeclock log
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
### Update the user's timeclock status record
$stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
### Add a record to the timeclock audit log
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
print "<!-- 新 vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
### Update last login record in the timeclock audit log
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
}
if ( ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
{echo "エラー:タイムクロックログ入力がすでに行われました:$status|$stage"; exit;}
if ($referrer=='agent')
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">エージェントログイン画面に戻る</font></A>";}
if ($referrer=='admin')
{$BACKlink = "<A HREF=\"/$admin_web_directory/admin.php\"><font color=\"#003333\">管理に戻る</font></A>";}
if ($referrer=='welcome')
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">ようこそ画面に戻る</font></A>";}
echo"<HTML><HEAD>\n";
echo"<TITLE>Agent タイムクロック</TITLE>\n";
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"</HEAD>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> タイムクロック </B></TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR>&nbsp; </B></TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR>&nbsp; </B></TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</TD></TR>\n";
echo "</TABLE>\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') )
{
$VDdisplayMESSAGE = "最後にログインしてからの時間:$totTIME_HMS";
$log_action = 'login';
$button_name = 'LOGIN';
$LOGtimeMESSAGE = "以下の時間に最後にログアウトしました:$last_action_date<BR><BR>ログインするために以下のログインをクリックする";
}
if ($status=='LOGIN')
{
$VDdisplayMESSAGE = "ログインしていた時間:$totTIME_HMS";
$log_action = 'logout';
$button_name = 'LOGOUT';
$LOGtimeMESSAGE = "以下の時間にログインしました: $last_action_date<BR>ログインしていた時間:$totTIME_HMS<BR><BR>ログアウトするために以下のログアウトをクリックする";
}
echo"<HTML><HEAD>\n";
echo"<TITLE>Agent タイムクロック</TITLE>\n";
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"</HEAD>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> タイムクロック </B></TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR>&nbsp; </B></TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
exit;
}
}
else
{
echo"<HTML><HEAD>\n";
echo"<TITLE>Agent タイムクロック</TITLE>\n";
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"</HEAD>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> タイムクロック </B></TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>ユーザログイン: </TD>";
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
echo "<TR><TD ALIGN=RIGHT>ユーザパスワード: </TD>";
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=送信 VALUE=送信> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>バージョン: $version &nbsp; &nbsp; &nbsp; ビルド: $build</TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
}
exit;
?>
File diff suppressed because it is too large Load Diff
+469
View File
@@ -0,0 +1,469 @@
<?php
# vdc_form_display.php
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed display the contents of the FORM tab in the agent
# interface, as well as take submission of the form submission when the agent
# dispositions the call
#
# CHANGELOG:
# 100630-1119 - First build of script
# 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log
# 100712-2322 - Added code to log vicidial_list.entry_list_id field if data altered
# 100916-1749 - Added non-lead variable parsing
# 110719-0856 - Added HIDEBLOB type
# 110730-2335 - Added call_id variable
# 111025-1433 - Fixed case sensitivity on list fields
# 120315-1729 - Filtere out single quotes and backslashes from custom fields
#
$version = '2.4-8';
$build = '120315-1729';
require("dbconnect.php");
require_once("functions.php");
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
if (isset($_GET["submit_button"])) {$submit_button=$_GET["submit_button"];}
elseif (isset($_POST["submit_button"])) {$submit_button=$_POST["submit_button"];}
if (isset($_GET["admin_submit"])) {$admin_submit=$_GET["admin_submit"];}
elseif (isset($_POST["admin_submit"])) {$admin_submit=$_POST["admin_submit"];}
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];}
elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];}
if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];}
elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];}
if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];}
elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];}
if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];}
elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];}
if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];}
elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];}
if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];}
elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];}
elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];}
if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];}
elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
if ($stage=='WELCOME')
{echo "FORM"; exit;}
$txt = '.txt';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$CIDdate = date("mdHis");
$ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
$script_height = ($script_height - 20);
if (strlen($bgcolor) < 6) {$bgcolor='FFFFFF';}
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|';
$IFRAME=0;
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$timeclock_end_of_day = $row[1];
$agentonly_callback_campaign_lock = $row[2];
$custom_fields_enabled = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
$phone_code = ereg_replace("[^0-9]","",$phone_code);
$phone_number = ereg_replace("[^0-9]","",$phone_number);
}
else
{
$user = ereg_replace("'|\"|\\\\|;","",$user);
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
}
# default optional vars if not set
if (!isset($format)) {$format="text";}
if ($format == 'debug') {$DB=1;}
if (!isset($ACTION)) {$ACTION="refresh";}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and modify_leads='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VUmodify=$row[0];
$stmt="SELECT count(*) from vicidial_live_agents where user='$user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LVAactive=$row[0];
if ($custom_fields_enabled < 1)
{
echo "Custom Fields Disabled: |$custom_fields_enabled|\n";
echo "<form action=./vdc_form_display.php method=POST name=form_custom_fields id=form_custom_fields>\n";
echo "<input type=hidden name=user id=user value=\"$user\">\n";
echo "</form>\n";
exit;
}
if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ( ($LVAactive < 1) and ($VUmodify < 1) ) )
{
echo "Invalid Username/Password: |$user|$pass|\n";
echo "<form action=./vdc_form_display.php method=POST name=form_custom_fields id=form_custom_fields>\n";
echo "<input type=hidden name=user id=user value=\"$user\">\n";
echo "</form>\n";
exit;
}
else
{
# do nothing for now
}
### BEGIN parse submission of the custom fields form ###
if ($stage=='SUBMIT')
{
$update_sent=0;
$CFoutput='';
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06001',$user,$server_ip,$session_name,$one_mysql_log);}
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$update_SQL='';
$VL_update_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06003',$user,$server_ip,$session_name,$one_mysql_log);}
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote
$form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes
if ( ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='CHECKBOX') or ($A_field_type[$o]=='RADIO') )
{
$k=0;
$multi_count = count($form_field_value);
$multi_array = $form_field_value;
while ($k < $multi_count)
{
$new_field_value .= "$multi_array[$k],";
$k++;
}
$form_field_value = preg_replace("/,$/","",$new_field_value);
}
if ($A_field_type[$o]=='TIME')
{
if (isset($_GET["MINUTE_$field_name_id"])) {$form_field_valueM=$_GET["MINUTE_$field_name_id"];}
elseif (isset($_POST["MINUTE_$field_name_id"])) {$form_field_valueM=$_POST["MINUTE_$field_name_id"];}
if (isset($_GET["HOUR_$field_name_id"])) {$form_field_valueH=$_GET["HOUR_$field_name_id"];}
elseif (isset($_POST["HOUR_$field_name_id"])) {$form_field_valueH=$_POST["HOUR_$field_name_id"];}
$form_field_value = "$form_field_valueH:$form_field_valueM:00";
}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='READONLY') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields))
{
$VL_update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
else
{
$update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
$SUBMIT_output .= "<b>$A_field_name[$o]:</b> $A_field_value[$o]<BR>";
}
$o++;
}
$custom_update_count=0;
if (strlen($update_SQL)>3)
{
$custom_record_lead_count=0;
$stmt="SELECT count(*) from custom_$list_id where lead_id='$lead_id';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06004',$user,$server_ip,$session_name,$one_mysql_log);}
$fieldleadcount_to_print = mysql_num_rows($rslt);
if ($fieldleadcount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_record_lead_count = $rowx[0];
}
$update_SQL = preg_replace("/,$/","",$update_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$update_SQL;";
if ($custom_record_lead_count > 0)
{$custom_table_update_SQL = "UPDATE custom_$list_id SET $update_SQL where lead_id='$lead_id';";}
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_update_count = mysql_affected_rows($link);
if ($DB) {echo "$custom_update_count|$custom_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$update_sent++;
}
if (strlen($VL_update_SQL)>3)
{
$custom_update_vl_SQL='';
if ($custom_update_count > 0)
{$custom_update_vl_SQL = "entry_list_id='$list_id',";}
$VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL);
$list_table_update_SQL = "UPDATE vicidial_list SET $custom_update_vl_SQL $VL_update_SQL where lead_id='$lead_id';";
$rslt=mysql_query($list_table_update_SQL, $link);
$list_update_count = mysql_affected_rows($link);
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$update_sent++;
}
else
{
if ($custom_update_count > 0)
{
$list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
$rslt=mysql_query($list_table_update_SQL, $link);
$list_update_count = mysql_affected_rows($link);
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
}
}
if ( ($admin_submit=='YES') and ($update_sent > 0) )
{
### LOG INSERTION Admin Log Table ###
$ip = getenv("REMOTE_ADDR");
$SQL_log = "$list_table_update_SQL|$custom_table_update_SQL|";
$SQL_log = ereg_replace(';','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LEADS', event_type='MODIFY', record_id='$lead_id', event_code='ADMIN MODIFY CUSTOM LEAD', event_sql=\"$SQL_log\", event_notes='$custom_update_count|$list_update_count';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
}
else
{$CFoutput .= "ERROR: no custom list fields table\n";}
echo "Custom Form Output:\n<BR>\n";
echo "$SUBMIT_output";
echo "<form action=./vdc_form_display.php method=POST name=form_custom_fields id=form_custom_fields>\n";
echo "<input type=hidden name=user id=user value=\"$user\">\n";
echo "</form>\n";
}
### END parse submission of the custom fields form ###
else
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
echo "<title>ViciDial Form Display Script";
echo "</title>\n";
echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo " <link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo " <script language=\"Javascript\">\n";
echo " function open_help(taskspan,taskhelp) \n";
echo " {\n";
echo " document.getElementById(\"P_\" + taskspan).innerHTML = \" &nbsp; <a href=\\\"javascript:close_help('\" + taskspan + \"','\" + taskhelp + \"');\\\">help-</a><BR> &nbsp; \";\n";
echo " document.getElementById(taskspan).innerHTML = \"<B>\" + taskhelp + \"</B>\";\n";
echo " document.getElementById(taskspan).style.background = \"#FFFF99\";\n";
echo " }\n";
echo " function close_help(taskspan,taskhelp) \n";
echo " {\n";
echo " document.getElementById(\"P_\" + taskspan).innerHTML = \"\";\n";
echo " document.getElementById(taskspan).innerHTML = \" &nbsp; <a href=\\\"javascript:open_help('\" + taskspan + \"','\" + taskhelp + \"');\\\">help+</a>\";\n";
echo " document.getElementById(taskspan).style.background = \"white\";\n";
echo " }\n";
echo " </script>\n";
echo " <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "</head>\n";
echo "<BODY BGCOLOR=\"#" . $bgcolor . "\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"parent.document.getElementById('FORM_LOADED').value='1';\">";
echo "\n";
echo "<form action=./vdc_form_display.php method=POST name=form_custom_fields id=form_custom_fields>\n";
echo "<input type=hidden name=lead_id id=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=list_id id=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=user id=user value=\"$user\">\n";
echo "<input type=hidden name=pass id=pass value=\"$pass\">\n";
echo "\n";
require_once("functions.php");
$CFoutput = custom_list_fields_values($lead_id,$list_id,$uniqueid,$user);
echo "$CFoutput";
if ($submit_button=='YES')
{
echo "<input type=hidden name=admin_submit id=admin_submit value=\"YES\">\n";
echo "<BR><BR><input type=submit name=VCformSubmit id=VCformSubmit value=submit>\n";
}
echo "</form></center><BR><BR>\n";
echo "</BODY></HTML>\n";
}
exit;
?>
+523
View File
@@ -0,0 +1,523 @@
<?php
# vdc_script_display.php
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed display the contents of the SCRIPT tab in the agent interface
#
# CHANGELOG:
# 90824-1435 - First build of script
# 90827-1548 - Added list override script option
# 91204-1913 - Added recording_filename and recording_id variables
# 91211-1103 - Added user_custom_... variables
# 100116-0702 - Added preset variables
# 100127-1611 - Added ignore_list_script_override option
# 100823-1644 - Added DID variables
# 100902-1344 - Added closecallid, xfercallid, agent_log_id variables
# 110420-1201 - Added web_vars variable
# 110730-2339 - Added call_id variable
# 120227-2017 - Added parsing of IGNORENOSCROLL option in script to force scroll
#
$version = '2.4-11';
$build = '120227-2017';
require("dbconnect.php");
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
$vendor_lead_code = $vendor_id;
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["title"])) {$title=$_GET["title"];}
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
if (isset($_GET["city"])) {$city=$_GET["city"];}
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
if (isset($_GET["state"])) {$state=$_GET["state"];}
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
if (isset($_GET["email"])) {$email=$_GET["email"];}
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];}
elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];}
if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];}
elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];}
if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];}
elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];}
if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];}
elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];}
if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];}
elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];}
if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];}
elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_uses_custom_fields"];}
elseif (isset($_POST["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_POST["CF_uses_custom_fields"];}
if (isset($_GET["entry_list_id"])) {$entry_list_id=$_GET["entry_list_id"];}
elseif (isset($_POST["entry_list_id"])) {$entry_list_id=$_POST["entry_list_id"];}
if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];}
elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];}
if (isset($_GET["web_vars"])) {$web_vars=$_GET["web_vars"];}
elseif (isset($_POST["web_vars"])) {$web_vars=$_POST["web_vars"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
$txt = '.txt';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$CIDdate = date("mdHis");
$ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
$script_height = ($script_height - 20);
$IFRAME=0;
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$timeclock_end_of_day = $row[1];
$agentonly_callback_campaign_lock = $row[2];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
$phone_code = ereg_replace("[^0-9]","",$phone_code);
$phone_number = ereg_replace("[^0-9]","",$phone_number);
}
else
{
$user = ereg_replace("'|\"|\\\\|;","",$user);
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
}
# default optional vars if not set
if (!isset($format)) {$format="text";}
if ($format == 'debug') {$DB=1;}
if (!isset($ACTION)) {$ACTION="refresh";}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
# do nothing for now
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
echo "<title>VICIDiaL Script Display Script";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
if (strlen($in_script) < 1)
{$call_script = $camp_script;}
else
{$call_script = $in_script;}
$ignore_list_script_override='N';
$stmt = "SELECT ignore_list_script_override FROM vicidial_inbound_groups where group_id='$group';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ilso_ct = mysql_num_rows($rslt);
if ($ilso_ct > 0)
{
$row=mysql_fetch_row($rslt);
$ignore_list_script_override = $row[0];
}
if ($ignore_list_script_override=='Y')
{$ignore_list_script=1;}
if ($ignore_list_script < 1)
{
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$agent_script_override = $row[0];
if (strlen($agent_script_override) > 0)
{$call_script = $agent_script_override;}
}
$stmt="SELECT list_name,list_description from vicidial_lists where list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$list_name = $row[0];
$list_description = $row[1];
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$script_name = $row[0];
$script_text = stripslashes($row[1]);
if (eregi("iframe src",$script_text))
{
$IFRAME=1;
$lead_id = eregi_replace(' ','+',$lead_id);
$vendor_id = eregi_replace(' ','+',$vendor_id);
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
$list_id = eregi_replace(' ','+',$list_id);
$list_name = eregi_replace(' ','+',$list_name);
$list_description = eregi_replace(' ','+',$list_description);
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
$phone_code = eregi_replace(' ','+',$phone_code);
$phone_number = eregi_replace(' ','+',$phone_number);
$title = eregi_replace(' ','+',$title);
$first_name = eregi_replace(' ','+',$first_name);
$middle_initial = eregi_replace(' ','+',$middle_initial);
$last_name = eregi_replace(' ','+',$last_name);
$address1 = eregi_replace(' ','+',$address1);
$address2 = eregi_replace(' ','+',$address2);
$address3 = eregi_replace(' ','+',$address3);
$city = eregi_replace(' ','+',$city);
$state = eregi_replace(' ','+',$state);
$province = eregi_replace(' ','+',$province);
$postal_code = eregi_replace(' ','+',$postal_code);
$country_code = eregi_replace(' ','+',$country_code);
$gender = eregi_replace(' ','+',$gender);
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
$alt_phone = eregi_replace(' ','+',$alt_phone);
$email = eregi_replace(' ','+',$email);
$security_phrase = eregi_replace(' ','+',$security_phrase);
$comments = eregi_replace(' ','+',$comments);
$user = eregi_replace(' ','+',$user);
$pass = eregi_replace(' ','+',$pass);
$campaign = eregi_replace(' ','+',$campaign);
$phone_login = eregi_replace(' ','+',$phone_login);
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
$phone_pass = eregi_replace(' ','+',$phone_pass);
$fronter = eregi_replace(' ','+',$fronter);
$closer = eregi_replace(' ','+',$closer);
$group = eregi_replace(' ','+',$group);
$channel_group = eregi_replace(' ','+',$channel_group);
$SQLdate = eregi_replace(' ','+',$SQLdate);
$epoch = eregi_replace(' ','+',$epoch);
$uniqueid = eregi_replace(' ','+',$uniqueid);
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
$server_ip = eregi_replace(' ','+',$server_ip);
$SIPexten = eregi_replace(' ','+',$SIPexten);
$session_id = eregi_replace(' ','+',$session_id);
$phone = eregi_replace(' ','+',$phone);
$parked_by = eregi_replace(' ','+',$parked_by);
$dispo = eregi_replace(' ','+',$dispo);
$dialed_number = eregi_replace(' ','+',$dialed_number);
$dialed_label = eregi_replace(' ','+',$dialed_label);
$source_id = eregi_replace(' ','+',$source_id);
$rank = eregi_replace(' ','+',$rank);
$owner = eregi_replace(' ','+',$owner);
$camp_script = eregi_replace(' ','+',$camp_script);
$in_script = eregi_replace(' ','+',$in_script);
$script_width = eregi_replace(' ','+',$script_width);
$script_height = eregi_replace(' ','+',$script_height);
$fullname = eregi_replace(' ','+',$fullname);
$recording_filename = eregi_replace(' ','+',$recording_filename);
$recording_id = eregi_replace(' ','+',$recording_id);
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
$preset_number_a = eregi_replace(' ','+',$preset_number_a);
$preset_number_b = eregi_replace(' ','+',$preset_number_b);
$preset_number_c = eregi_replace(' ','+',$preset_number_c);
$preset_number_d = eregi_replace(' ','+',$preset_number_d);
$preset_number_e = eregi_replace(' ','+',$preset_number_e);
$preset_number_f = eregi_replace(' ','+',$preset_number_f);
$preset_dtmf_a = eregi_replace(' ','+',$preset_dtmf_a);
$preset_dtmf_b = eregi_replace(' ','+',$preset_dtmf_b);
$did_id = eregi_replace(' ','+',$did_id);
$did_extension = eregi_replace(' ','+',$did_extension);
$did_pattern = eregi_replace(' ','+',$did_pattern);
$did_description = eregi_replace(' ','+',$did_description);
$web_vars = eregi_replace(' ','+',$web_vars);
}
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
$script_text = eregi_replace('--A--list_name--B--',"$list_name",$script_text);
$script_text = eregi_replace('--A--list_description--B--',"$list_description",$script_text);
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
$script_text = eregi_replace('--A--preset_number_a--B--',"$preset_number_a",$script_text);
$script_text = eregi_replace('--A--preset_number_b--B--',"$preset_number_b",$script_text);
$script_text = eregi_replace('--A--preset_number_c--B--',"$preset_number_c",$script_text);
$script_text = eregi_replace('--A--preset_number_d--B--',"$preset_number_d",$script_text);
$script_text = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$script_text);
$script_text = eregi_replace('--A--preset_number_f--B--',"$preset_number_f",$script_text);
$script_text = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$script_text);
$script_text = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$script_text);
$script_text = eregi_replace('--A--did_id--B--',"$did_id",$script_text);
$script_text = eregi_replace('--A--did_extension--B--',"$did_extension",$script_text);
$script_text = eregi_replace('--A--did_pattern--B--',"$did_pattern",$script_text);
$script_text = eregi_replace('--A--did_description--B--',"$did_description",$script_text);
$script_text = eregi_replace('--A--closecallid--B--',"$closecallid",$script_text);
$script_text = eregi_replace('--A--xfercallid--B--',"$xfercallid",$script_text);
$script_text = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$script_text);
$script_text = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$script_text);
$script_text = eregi_replace('--A--call_id--B--',"$call_id",$script_text);
$script_text = eregi_replace('--A--web_vars--B--',"$web_vars",$script_text);
if ($CF_uses_custom_fields=='Y')
{
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$field_name_id = $row[0];
$field_name_tag = "--A--" . $field_name_id . "--B--";
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$script_text = eregi_replace("$field_name_tag","$form_field_value",$script_text);
if ($DB) {echo "$d|$field_name_id|$field_name_tag|$form_field_value|<br>\n";}
$d++;
}
}
$script_text = eregi_replace("\n","<BR>",$script_text);
$script_text = stripslashes($script_text);
echo "<!-- IFRAME$IFRAME -->\n";
echo "<!-- $script_id -->\n";
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) )
{echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
echo "<center><B>$script_name</B><BR></center>\n";
echo "$script_text\n";
if ( ( ($IFRAME < 1) and ($ScrollDIV > 0) ) or (eregi("IGNORENOSCROLL",$script_text)) )
{echo "</div>";}
echo "</TD></TR></TABLE>\n";
exit;
?>
+648
View File
@@ -0,0 +1,648 @@
<?php
# vdc_script_notes.php
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed open in the SCRIPT tab in the agent interface through
# an IFRAME. It will create a new record for every SUBMIT
#
# Example of a ViciDial agent SCRIPT using this script:
# <iframe src="./vdc_script_notes.php?lead_id=--A--lead_id--B--&vendor_id=--A--vendor_lead_code--B--&list_id=--A--list_id--B--&gmt_offset_now=--A--gmt_offset_now--B--&phone_code=--A--phone_code--B--&phone_number=--A--phone_number--B--&title=--A--title--B--&first_name=--A--first_name--B--&middle_initial=--A--middle_initial--B--&last_name=--A--last_name--B--&address1=--A--address1--B--&address2=--A--address2--B--&address3=--A--address3--B--&city=--A--city--B--&state=--A--state--B--&province=--A--province--B--&postal_code=--A--postal_code--B--&country_code=--A--country_code--B--&gender=--A--gender--B--&date_of_birth=--A--date_of_birth--B--&alt_phone=--A--alt_phone--B--&email=--A--email--B--&security_phrase=--A--security_phrase--B--&comments=--A--comments--B--&user=--A--user--B--&pass=--A--pass--B--&campaign=--A--campaign--B--&phone_login=--A--phone_login--B--&fronter=--A--fronter--B--&closer=--A--user--B--&group=--A--group--B--&channel_group=--A--group--B--&SQLdate=--A--SQLdate--B--&epoch=--A--epoch--B--&uniqueid=--A--uniqueid--B--&rank=--A--rank--B--&owner=--A--owner--B--&customer_zap_channel=--A--customer_zap_channel--B--&server_ip=--A--server_ip--B--&SIPexten=--A--SIPexten--B--&session_id=--A--session_id--B--" style="background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="--A--script_width--B--" height="--A--script_height--B--" STYLE="z-index:17"> </iframe>
#
# CHANGELOG:
# 100215-0744 - First build of script
# 100622-2230 - Added field labels
#
$version = '2.4-2';
$build = '100622-2230';
require("dbconnect.php");
if (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
elseif (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
if (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
elseif (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
$vendor_lead_code = $vendor_id;
if (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
elseif (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
if (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
elseif (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
if (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
elseif (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
if (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
elseif (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
if (isset($_POST["title"])) {$title=$_POST["title"];}
elseif (isset($_GET["title"])) {$title=$_GET["title"];}
if (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
elseif (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
if (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
elseif (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
if (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
elseif (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
if (isset($_POST["address1"])) {$address1=$_POST["address1"];}
elseif (isset($_GET["address1"])) {$address1=$_GET["address1"];}
if (isset($_POST["address2"])) {$address2=$_POST["address2"];}
elseif (isset($_GET["address2"])) {$address2=$_GET["address2"];}
if (isset($_POST["address3"])) {$address3=$_POST["address3"];}
elseif (isset($_GET["address3"])) {$address3=$_GET["address3"];}
if (isset($_POST["city"])) {$city=$_POST["city"];}
elseif (isset($_GET["city"])) {$city=$_GET["city"];}
if (isset($_POST["state"])) {$state=$_POST["state"];}
elseif (isset($_GET["state"])) {$state=$_GET["state"];}
if (isset($_POST["province"])) {$province=$_POST["province"];}
elseif (isset($_GET["province"])) {$province=$_GET["province"];}
if (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
elseif (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
if (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
elseif (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
if (isset($_POST["gender"])) {$gender=$_POST["gender"];}
elseif (isset($_GET["gender"])) {$gender=$_GET["gender"];}
if (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
elseif (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
if (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
elseif (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
if (isset($_POST["email"])) {$email=$_POST["email"];}
elseif (isset($_GET["email"])) {$email=$_GET["email"];}
if (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
elseif (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
if (isset($_POST["comments"])) {$comments=$_POST["comments"];}
elseif (isset($_GET["comments"])) {$comments=$_GET["comments"];}
if (isset($_POST["user"])) {$user=$_POST["user"];}
elseif (isset($_GET["user"])) {$user=$_GET["user"];}
if (isset($_POST["pass"])) {$pass=$_POST["pass"];}
elseif (isset($_GET["pass"])) {$pass=$_GET["pass"];}
if (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
elseif (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
if (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
elseif (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
if (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
elseif (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
if (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
elseif (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
if (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
elseif (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
if (isset($_POST["closer"])) {$closer=$_POST["closer"];}
elseif (isset($_GET["closer"])) {$closer=$_GET["closer"];}
if (isset($_POST["group"])) {$group=$_POST["group"];}
elseif (isset($_GET["group"])) {$group=$_GET["group"];}
if (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
elseif (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
if (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
elseif (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
if (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
elseif (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
if (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
elseif (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
if (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
elseif (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
if (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
elseif (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
if (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
elseif (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
if (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
elseif (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
if (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
elseif (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
if (isset($_POST["phone"])) {$phone=$_POST["phone"];}
elseif (isset($_GET["phone"])) {$phone=$_GET["phone"];}
if (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
elseif (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
if (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
elseif (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
if (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
elseif (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
if (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
elseif (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
if (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
elseif (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
if (isset($_POST["rank"])) {$rank=$_POST["rank"];}
elseif (isset($_GET["rank"])) {$rank=$_GET["rank"];}
if (isset($_POST["owner"])) {$owner=$_POST["owner"];}
elseif (isset($_GET["owner"])) {$owner=$_GET["owner"];}
if (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
elseif (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
if (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
elseif (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
if (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
elseif (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
if (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
elseif (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
if (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
elseif (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
if (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
elseif (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
if (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
elseif (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
if (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
elseif (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
if (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
elseif (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
if (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
elseif (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
if (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
elseif (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
if (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
elseif (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
if (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
elseif (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
if (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
elseif (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
if (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
elseif (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
if (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
elseif (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
if (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
elseif (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
if (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
elseif (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
if (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
elseif (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
if (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
elseif (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
if (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
elseif (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
if (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
elseif (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
if (isset($_POST["DB"])) {$DB=$_POST["DB"];}
elseif (isset($_GET["DB"])) {$DB=$_GET["DB"];}
if (isset($_POST["process"])) {$process=$_POST["process"];}
elseif (isset($_GET["process"])) {$process=$_GET["process"];}
if (isset($_POST["vicidial_id"])) {$vicidial_id=$_POST["vicidial_id"];}
elseif (isset($_GET["vicidial_id"])) {$vicidial_id=$_GET["vicidial_id"];}
if (isset($_POST["call_date"])) {$call_date=$_POST["call_date"];}
elseif (isset($_GET["call_date"])) {$call_date=$_GET["call_date"];}
if (isset($_POST["order_id"])) {$order_id=$_POST["order_id"];}
elseif (isset($_GET["order_id"])) {$order_id=$_GET["order_id"];}
if (isset($_POST["appointment_date"])) {$appointment_date=$_POST["appointment_date"];}
elseif (isset($_GET["appointment_date"])) {$appointment_date=$_GET["appointment_date"];}
if (isset($_POST["appointment_time"])) {$appointment_time=$_POST["appointment_time"];}
elseif (isset($_GET["appointment_time"])) {$appointment_time=$_GET["appointment_time"];}
if (isset($_POST["call_notes"])) {$call_notes=$_POST["call_notes"];}
elseif (isset($_GET["call_notes"])) {$call_notes=$_GET["call_notes"];}
if (isset($_POST["notesid"])) {$notesid=$_POST["notesid"];}
elseif (isset($_GET["notesid"])) {$notesid=$_GET["notesid"];}
if ($notesid < 100)
{$notesid=0;}
if (strlen($vicidial_id) < 1)
{$vicidial_id = $uniqueid;}
if (strlen($appointment_time) < 1)
{$appointment_time = '12:00:00';}
$appointment_timeARRAY = explode(":",$appointment_time);
$appointment_hour = $appointment_timeARRAY[0];
$appointment_min = $appointment_timeARRAY[1];
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
$txt = '.txt';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$CIDdate = date("mdHis");
$ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
if (strlen($call_date) < 1)
{$call_date = $NOW_TIME;}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$timeclock_end_of_day = $row[1];
$agentonly_callback_campaign_lock = $row[2];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
$phone_code = ereg_replace("[^0-9]","",$phone_code);
$phone_number = ereg_replace("[^0-9]","",$phone_number);
}
else
{
$user = ereg_replace("'|\"|\\\\|;","",$user);
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
}
if ($DB > 0)
{
echo "<BR>$lead_id|$entry_date|$modify_date|$status|$user|$vendor_lead_code|$source_id|$list_id|$gmt_offset_now|$called_since_last_reset|$phone_code|$phone_number|$title|$first_name|$middle_initial|$last_name|$address1|$address2|$address3|$city|$state|$province|$postal_code|$country_code|$gender|$date_of_birth|$alt_phone|$email|$security_phrase|$comments|$called_count|$last_local_call_time|$rank|$owner|\n<BR>";
}
### BEGIN find any custom field labels ###
$label_title = 'タイトル';
$label_first_name = '最初';
$label_middle_initial = 'MI';
$label_last_name = '最後';
$label_address1 = '住所1';
$label_address2 = '住所2';
$label_address3 = '住所3';
$label_city = '市町村';
$label_state = '都道府県';
$label_province = '都道府県';
$label_postal_code = '郵便番号';
$label_vendor_lead_code = 'ベンダーID';
$label_gender = 'Gender';
$label_phone_number = '電話';
$label_phone_code = 'ダイアルコード';
$label_alt_phone = '代替電話';
$label_security_phrase = '示す';
$label_email = 'メール';
$label_comments = 'コメント';
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if (strlen($row[0])>0) {$label_title = $row[0];}
if (strlen($row[1])>0) {$label_first_name = $row[1];}
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
if (strlen($row[3])>0) {$label_last_name = $row[3];}
if (strlen($row[4])>0) {$label_address1 = $row[4];}
if (strlen($row[5])>0) {$label_address2 = $row[5];}
if (strlen($row[6])>0) {$label_address3 = $row[6];}
if (strlen($row[7])>0) {$label_city = $row[7];}
if (strlen($row[8])>0) {$label_state = $row[8];}
if (strlen($row[9])>0) {$label_province = $row[9];}
if (strlen($row[10])>0) {$label_postal_code = $row[10];}
if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];}
if (strlen($row[12])>0) {$label_gender = $row[12];}
if (strlen($row[13])>0) {$label_phone_number = $row[13];}
if (strlen($row[14])>0) {$label_phone_code = $row[14];}
if (strlen($row[15])>0) {$label_alt_phone = $row[15];}
if (strlen($row[16])>0) {$label_security_phrase = $row[16];}
if (strlen($row[17])>0) {$label_email = $row[17];}
if (strlen($row[18])>0) {$label_comments = $row[18];}
### END find any custom field labels ###
# default optional vars if not set
if (!isset($format)) {$format="text";}
if ($format == 'debug') {$DB=1;}
if (!isset($ACTION)) {$ACTION="refresh";}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
# do nothing for now
}
echo "<HTML>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build USER: $user server_ip: $server_ip-->\n";
echo "<title>ViciDial 注";
echo "</title>\n";
echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
?>
<?php
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
if ($process > 0)
{
#Update vicidial_list record
$stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
#Update the agent screen with new data
$stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner' where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
if ($notesid < 100)
{
# Insert into vicidial_call_notes
$stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
$notesid = mysql_insert_id($link);
}
else
{
# update vicidial_call_notes record
$stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
}
echo "<BR><b>Data Changes Accepted</b><BR><BR>";
}
$URLarray = explode("?", $PHP_SELF);
$URLsubmit = $URLarray[0];
?>
<TABLE Border=0 CELLPADDING=0 CELLSPACING=2 WIDTH=450>
<TR><TD COLSPAN=2 ALIGN=CENTER>
<FORM METHOD=POST NAME=vsn ID=vsn ACTION="<?php echo $URLsubmit ?>">
<input type=hidden name=DB id=DB value=<?php echo $DB ?>>
<input type=hidden name=process id=process value=1>
<input type=hidden name=lead_id id=lead_id value="<?php echo $lead_id ?>">
<input type=hidden name=user id=user value="<?php echo $user ?>">
<input type=hidden name=pass id=user value="<?php echo $pass ?>">
<input type=hidden name=notesid id=notesid value="<?php echo $notesid ?>">
<input type=hidden name=vendor_id id=vendor_id value="<?php echo $vendor_id ?>">
<input type=hidden name=title id=title value="<?php echo $title ?>">
<input type=hidden name=middle_initial id=middle_initial value="<?php echo $middle_initial ?>">
<input type=hidden name=province id=province value="<?php echo $middle_initial ?>">
<input type=hidden name=phone_code id=phone_code value="<?php echo $phone_code ?>">
<input type=hidden name=gender id=gender value="<?php echo $gender ?>">
<input type=hidden name=date_of_birth id=date_of_birth value="<?php echo $date_of_birth ?>">
<input type=hidden name=alt_phone id=alt_phone value="<?php echo $alt_phone ?>">
<input type=hidden name=email id=email value="<?php echo $email ?>">
<input type=hidden name=security_phrase id=security_phrase value="<?php echo $security_phrase ?>">
<input type=hidden name=comments id=comments value="<?php echo $comments ?>">
<input type=hidden name=rank id=rank value="<?php echo $rank ?>">
<input type=hidden name=owner id=owner value="<?php echo $owner ?>">
</TD></TR>
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">ベンダーID: </TD><TD ALIGN=LEFT><input type=text name=vendor_id id=vendor_id size=20 maxlength=20 value="<?php echo $vendor_id ?>"></TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">Source ID: </TD><TD ALIGN=LEFT>$source_id<input type=hidden name=source_id id=source_id value="<?php echo $source_id ?>"></TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">タイトル: </TD><TD ALIGN=LEFT><input type=text name=title id=title size=5 maxlength=4 value="<?php echo $title ?>"></TD>
</TR> -->
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_first_name ?>: </TD><TD ALIGN=LEFT><input type=text name=first_name id=first_name size=30 maxlength=30 value="<?php echo $first_name ?>"> *</TD>
</TR>
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">Middle Initial: </TD><TD ALIGN=LEFT><input type=text name=middle_initial id=middle_initial size=2 maxlength=1 value="<?php echo $middle_initial ?>"></TD>
</TR> -->
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_last_name ?>: </TD><TD ALIGN=LEFT><input type=text name=last_name id=last_name size=30 maxlength=30 value="<?php echo $last_name ?>"> *</TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_address1 ?>: </TD><TD ALIGN=LEFT><input type=text name=address1 id=address1 size=30 maxlength=100 value="<?php echo $address1 ?>"> *</TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_address2 ?>: </TD><TD ALIGN=LEFT><input type=text name=address2 id=address2 size=30 maxlength=100 value="<?php echo $address2 ?>"></TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_address3 ?>: </TD><TD ALIGN=LEFT><input type=text name=address3 id=address3 size=30 maxlength=100 value="<?php echo $address3 ?>"></TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_city ?>: </TD><TD ALIGN=LEFT><input type=text name=city id=city size=30 maxlength=50 value="<?php echo $city ?>"> *</TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_state ?>: </TD><TD ALIGN=LEFT>
<SELECT name="state" id=state>
<OPTION value="<?php echo $state ?>" selected><?php echo $state ?></OPTION>
<OPTGROUP label="United 都道府県s">
<OPTION value="AL">Alabama</OPTION>
<OPTION value="AK">Alaska</OPTION>
<OPTION value="AZ">Arizona</OPTION>
<OPTION value="AR">Arkansas</OPTION>
<OPTION value="CA">California</OPTION>
<OPTION value="CO">Colorado</OPTION>
<OPTION value="CT">Connecticut</OPTION>
<OPTION value="DE">Delaware</OPTION>
<OPTION value="FL">Florida</OPTION>
<OPTION value="GA">Georgia</OPTION>
<OPTION value="HI">Hawaii</OPTION>
<OPTION value="ID">Idaho</OPTION>
<OPTION value="IL">Illinois</OPTION>
<OPTION value="IN">Indiana</OPTION>
<OPTION value="IA">Iowa</OPTION>
<OPTION value="KS">Kansas</OPTION>
<OPTION value="KY">Kentucky</OPTION>
<OPTION value="LA">Louisiana</OPTION>
<OPTION value="ME">Maine</OPTION>
<OPTION value="MD">Maryland</OPTION>
<OPTION value="MA">Massachusetts</OPTION>
<OPTION value="MI">Michigan</OPTION>
<OPTION value="MN">Minnesota</OPTION>
<OPTION value="MS">Mississippi</OPTION>
<OPTION value="MO">Missouri</OPTION>
<OPTION value="MT">Montana</OPTION>
<OPTION value="NE">Nebraska</OPTION>
<OPTION value="NV">Nevada</OPTION>
<OPTION value="NH">New Hampshire</OPTION>
<OPTION value="NJ">New Jersey</OPTION>
<OPTION value="NM">New Mexico</OPTION>
<OPTION value="NY">New York</OPTION>
<OPTION value="NC">North Carolina</OPTION>
<OPTION value="ND">North Dakota</OPTION>
<OPTION value="OH">Ohio</OPTION>
<OPTION value="OK">Oklahoma</OPTION>
<OPTION value="OR">Oregon</OPTION>
<OPTION value="PA">Pennsylvania</OPTION>
<OPTION value="RI">Rhode Island</OPTION>
<OPTION value="SC">South Carolina</OPTION>
<OPTION value="SD">South Dakota</OPTION>
<OPTION value="TN">Tennessee</OPTION>
<OPTION value="TX">Texas</OPTION>
<OPTION value="UT">Utah</OPTION>
<OPTION value="VT">Vermont</OPTION>
<OPTION value="VA">Virginia</OPTION>
<OPTION value="WA">Washington</OPTION>
<OPTION value="DC">Washington, DC</OPTION>
<OPTION value="WV">West Virginia</OPTION>
<OPTION value="WI">Wisconsin</OPTION>
<OPTION value="WY">Wyoming</OPTION>
</OPTGROUP>
<!--
<OPTGROUP label="Canada">
<OPTION value="AB">ALBERTA</OPTION>
<OPTION value="NT">NORTHWEST TERRITORY</OPTION>
<OPTION value="BC">BRITISH COLUMBIA</OPTION>
<OPTION value="ON">ONTARIO</OPTION>
<OPTION value="LB">LABRADOR</OPTION>
<OPTION value="PE">PRINCE EDWARDISLAND</OPTION>
<OPTION value="MB">MANITOBA</OPTION>
<OPTION value="PQ">QUEBEC</OPTION>
<OPTION value="NB">NEW BRUNSWICK</OPTION>
<OPTION value="SK">SASKATCHEWAN</OPTION>
<OPTION value="NF">NEWFOUNDLAND</OPTION>
<OPTION value="YT">YUKON TERRITORY</OPTION>
<OPTION value="NS">NOVA SCOTIA</OPTION>
</OPTGROUP>
-->
</SELECT> *</TD>
</TR>
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">都道府県: </TD><TD ALIGN=LEFT><input type=text name=province id=province size=20 maxlength=50 value="<?php echo $province ?>"></TD>
</TR> -->
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_postal_code ?>: </TD><TD ALIGN=LEFT><input type=text name=postal_code id=postal_code size=6 maxlength=5 value="<?php echo $postal_code ?>"> *</TD>
</TR>
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">電話 Code: </TD><TD ALIGN=LEFT><input type=text name=phone_code id=phone_code size=10 maxlength=10 value="<?php echo $phone_code ?>"></TD>
</TR> -->
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA"><?php echo $label_phone_number ?>: </TD><TD ALIGN=LEFT><input type=text name=phone_number id=phone_number size=18 maxlength=18 value="<?php echo $phone_number ?>"> *</TD>
</TR>
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">性別:</TD><TD ALIGN=LEFT><input type=text name=gender id=gender size=2 maxlength=1 value="<?php echo $gender ?>"></TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">誕生日:</TD><TD ALIGN=LEFT><input type=text name=date_if_birth id=date_if_birth size=12 maxlength=12 value="<?php echo $date_of_birth ?>"></TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">代替電話: </TD><TD ALIGN=LEFT><input type=text name=alt_phone id=alt_phone size=12 maxlength=12 value="<?php echo $alt_phone ?>"> *</TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">メール: </TD><TD ALIGN=LEFT><input type=text name=email id=email size=30 maxlength=70 value="<?php echo $email ?>"> *</TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">示す: </TD><TD ALIGN=LEFT><input type=text name=security_phrase id=security_phrase size=30 maxlength=100 value="<?php echo $security_phrase ?>"> *</TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">コメント:</TD><TD ALIGN=LEFT><input type=text name=comments id=comments size=40 maxlength=255 value="<?php echo $comments ?>"> *</TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">Rank: </TD><TD ALIGN=LEFT><input type=text name=rank id=rank size=5 maxlength=5 value="<?php echo $rank ?>"> *</TD>
</TR> -->
<!-- <TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">Owner: </TD><TD ALIGN=LEFT><input type=text name=owner id=owner size=20 maxlength=20 value="<?php echo $owner ?>"> *</TD>
</TR> -->
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">Order ID: </TD><TD ALIGN=LEFT><input type=text name=order_id id=order_id size=20 maxlength=20 value="<?php echo $order_id ?>"></TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA">Appointment Date/Time: </TD><TD ALIGN=LEFT><input type=text name=appointment_date id=appointment_date size=10 maxlength=10 value="<?php echo $appointment_date ?>">
<script language="JavaScript">
var o_cal = new tcal ({
// form name
'formname': 'vsn',
// input name
'controlname': 'appointment_date'
});
o_cal.a_tpl.yearscroll = false;
// o_cal.a_tpl.weekstart = 1; // Monday week start
</script>
<input type=hidden name=appointment_time id=appointment_time value="<?php echo $appointment_time ?>">
<SELECT name=appointment_hour id=appointment_hour>
<option>00</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<OPTION value="<?php echo $appointment_hour ?>" selected><?php echo $appointment_hour ?></OPTION>
</SELECT>
<SELECT name=appointment_min id=appointment_min>
<option>00</option>
<option>05</option>
<option>10</option>
<option>15</option>
<option>20</option>
<option>25</option>
<option>30</option>
<option>35</option>
<option>40</option>
<option>45</option>
<option>50</option>
<option>55</option>
<OPTION value="<?php echo $appointment_min ?>" selected><?php echo $appointment_min ?></OPTION>
</SELECT>
</TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=CENTER COLSPAN=2><FONT FACE="ARIAL,HELVETICA" size=2>Appointment 注:<BR><TEXTAREA NAME=call_notes ID=call_notes ROWS=5 COLS=50><?php echo $call_notes ?></TEXTAREA></font><br>
</TD>
</TR>
<TR BGCOLOR="#E6E6E6">
<TD ALIGN=CENTER COLSPAN=2><FONT FACE="ARIAL,HELVETICA" size=1>Please click 送信 to commit the changes, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * denotes required fields</font><br>
</TD>
</TR>
<TR BGCOLOR=white>
<TD ALIGN=CENTER COLSPAN=2>
<SCRIPT LANGUAGE="JavaScript">
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="送信" name=smt id=smt onClick="submit_form()">
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
</B></FONT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
File diff suppressed because it is too large Load Diff
+141
View File
@@ -0,0 +1,141 @@
<?php
# voicemail_check.php version 2.2.0
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $vmail_box - ('101','1234',...)
#
#
# changes
# 50422-1147 - First build of script
# 50503-1241 - added session_name checking for extra security
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1204 - Added variable filters to close security holes for login form
# 90508-0727 - Changed to PHP long tags
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
$version = '0.0.5';
$build = '60619-1204';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "無効 ユーザ名/パスワード: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "無効 server_ip: |$server_ip| or 無効 session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "無効 session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- バージョン: $version ビルド: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
echo "<title>ボイスメールチェック";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
$MT[0]='';
$row=''; $rowx='';
if (strlen($vmail_box)<1)
{
$channel_live=0;
echo "ボイスメールボックス $vmail_box 有効ではない\n";
exit;
}
else
{
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$vmails_list = mysql_num_rows($rslt);
$loop_count=0;
while ($vmails_list>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
echo "$row[0]|$row[1]";
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
}
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- スクリプトの実行時間: $RUNtime 秒 -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
+2
View File
@@ -69,6 +69,8 @@ OTHER CHANGES:
5. Added Safe Harbor Audio Field to campaign options which allows for a lead 5. Added Safe Harbor Audio Field to campaign options which allows for a lead
field to be used as an override safe harbor audio on a per-lead basis field to be used as an override safe harbor audio on a per-lead basis
6. Added Japanese agent web interface translation
@@ -18,6 +18,13 @@ DIAL IN-GROUP||
Dial In-Group|| Dial In-Group||
Click Here to Activate|| Click Here to Activate||
Click Here to Deactivate|| Click Here to Deactivate||
ERROR: You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name||
ERROR: You must enter in search terms, one of these must be populated: office number, last name, first name||
ERROR: There was a problem with your search terms||
Phone and Post Code Time Zone Mismatch||
Last Local Call Time||
Called Count||
Unidentified Hangup Cause Code||
############################################################ MANAGER Manual ############################################################ MANAGER Manual
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+3
View File
@@ -62,6 +62,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../agc_se/vicidial.php?relogin=YES&VD_lo
echo "</TD></TR>\n"; echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >"; echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_dk/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/dk.gif\" border=0> Danish Agent Login</a>"; echo "<font size=3><b> &nbsp; <a href=\"../agc_dk/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/dk.gif\" border=0> Danish Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_jp/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/jp.gif\" border=0> Japanese Agent Login</a>";
echo "</TD></TR></TABLE>\n"; echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n"; echo "</TD><TD VALIGN=TOP>\n";
+3
View File
@@ -62,6 +62,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../agc_se/vicidial.php\"><IMG SRC=\"../a
echo "</TD></TR>\n"; echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >"; echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_dk/vicidial.php\"><IMG SRC=\"../agc/images/dk.gif\" border=0> Danish Agent Login</a>"; echo "<font size=3><b> &nbsp; <a href=\"../agc_dk/vicidial.php\"><IMG SRC=\"../agc/images/dk.gif\" border=0> Danish Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_jp/vicidial.php\"><IMG SRC=\"../agc/images/jp.gif\" border=0> Japanese Agent Login</a>";
echo "</TD></TR></TABLE>\n"; echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n"; echo "</TD><TD VALIGN=TOP>\n";