Integrated all QC code into standard admin code, removing includes as well

git-svn-id: svn://192.168.202.10@2149 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2014-07-06 13:05:49 +00:00
parent 7360f5be6f
commit 0771e2fb63
21 changed files with 2648 additions and 2803 deletions
+2
View File
@@ -75,6 +75,8 @@ OTHER CHANGES:
7. Added ability to use Wrap-Up messages with calls terminated through Hotkeys 7. Added ability to use Wrap-Up messages with calls terminated through Hotkeys
8. Integrated all QC code into standard admin code, removing includes as well
+248 -17
View File
@@ -57,6 +57,7 @@ $usergroups_font = 'BLACK';
$scripts_font = 'BLACK'; $scripts_font = 'BLACK';
$filters_font = 'BLACK'; $filters_font = 'BLACK';
$admin_font = 'BLACK'; $admin_font = 'BLACK';
$qc_font = 'BLACK';
$reports_font = 'BLACK'; $reports_font = 'BLACK';
$times_font = 'BLACK'; $times_font = 'BLACK';
$phones_font = 'BLACK'; $phones_font = 'BLACK';
@@ -72,8 +73,6 @@ $reports_font = 'BLACK';
$cts_font = 'BLACK'; $cts_font = 'BLACK';
$subcamp_font = 'BLACK'; $subcamp_font = 'BLACK';
### QC font and color variables
require_once('qc/QC_admin_variables.php');
### comment this section out for colorful section headings ### comment this section out for colorful section headings
$users_color = '#E6E6E6'; $users_color = '#E6E6E6';
$campaigns_color = '#E6E6E6'; $campaigns_color = '#E6E6E6';
@@ -84,6 +83,7 @@ $usergroups_color = '#E6E6E6';
$scripts_color = '#E6E6E6'; $scripts_color = '#E6E6E6';
$filters_color = '#E6E6E6'; $filters_color = '#E6E6E6';
$admin_color = '#E6E6E6'; $admin_color = '#E6E6E6';
$qc_color = '#E6E6E6';
$reports_color = '#E6E6E6'; $reports_color = '#E6E6E6';
$times_color = '#C6C6C6'; $times_color = '#C6C6C6';
$shifts_color = '#C6C6C6'; $shifts_color = '#C6C6C6';
@@ -3347,12 +3347,13 @@ else
# 140621-2136 - Added DID pre-filter phone-group redirection and no-agent-ingroup redirection options # 140621-2136 - Added DID pre-filter phone-group redirection and no-agent-ingroup redirection options
# 140623-2147 - Added wrapup_bypass and script_message changes # 140623-2147 - Added wrapup_bypass and script_message changes
# 140625-1931 - Added wrapup_after_hotkey campaign option # 140625-1931 - Added wrapup_after_hotkey campaign option
# 140706-0829 - Incorporated QC includes into code
# #
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
$admin_version = '2.10-446a'; $admin_version = '2.10-447a';
$build = '140625-1931'; $build = '140706-0829';
$STARTtime = date("U"); $STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s"); $SQLdate = date("Y-m-d H:i:s");
@@ -3505,7 +3506,31 @@ else
############################################## ##############################################
# Include QC Agents with no other permission # # Include QC Agents with no other permission #
############################################## ##############################################
require_once('qc/QC_admin_include02.php'); //Get QC User permissions
$stmt="SELECT qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit from vicidial_users where user='$PHP_AUTH_USER' and user_level > 1 and active='Y' and qc_enabled='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$qc_auth=$row[0];
//Not "qc_" as it will interfere with ADD=4A storage of modified user.
if ($qc_auth=='1')
{
$qcuser_level=$row[1];
$qcpass=$row[2];
$qcfinish=$row[3];
$qccommit=$row[4];
}
//Modify menuing to allow qc users into the system (if they have no permission otherwise)
//Copied Reports-Only user setup for QC-Only user (Poundteam QC setup)
$qc_only_user=0;
if ( ($qc_auth > 0) and ($auth < 1) )
{
if ($ADD != '881')
{
$ADD=100000000000000;
}
$qc_only_user=1;
}
$stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin,force_change_password,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,modify_contacts,modify_same_user_level,alter_admin_interface_options,modify_custom_dialplans from vicidial_users where user='$PHP_AUTH_USER';"; $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin,force_change_password,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,modify_contacts,modify_same_user_level,alter_admin_interface_options,modify_custom_dialplans from vicidial_users where user='$PHP_AUTH_USER';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
@@ -4080,8 +4105,8 @@ if ($ADD==180000000000) {$hh='admin'; $sh='label'; echo "SCREEN LABELS LIST";}
if ($ADD==190000000000) {$hh='admin'; $sh='cts'; echo "CONTACTS LIST";} if ($ADD==190000000000) {$hh='admin'; $sh='cts'; echo "CONTACTS LIST";}
if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";} if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo "CONFERENCE LIST";}
if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "AGENT CONFERENCE LIST";} if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo "AGENT CONFERENCE LIST";}
##QC if ($ADD==100000000000000) {$hh='qc'; echo "Quality Control";}
require_once('qc/QC_admin_variables01.php'); if ($ADD==881) {$hh='qc'; echo "Quality Control Campaign $campaign_id";}
if ($ADD==550) {$hh='users'; echo "Search Form";} if ($ADD==550) {$hh='users'; echo "Search Form";}
if ($ADD==551) {$hh='users'; echo "SEARCH PHONES";} if ($ADD==551) {$hh='users'; echo "SEARCH PHONES";}
if ($ADD==660) {$hh='users'; echo "Search Results";} if ($ADD==660) {$hh='users'; echo "Search Results";}
@@ -10722,11 +10747,6 @@ if ($ADD==231111111111111)
######################
# ADD=241111111111111 adds the new qc status code to the system
######################
//Moved to qc/QC_status_codes_include.php include file
###################################################################################################### ######################################################################################################
@@ -29253,15 +29273,126 @@ if ($ADD==331111111111111)
} }
######################
# ADD=241111111111111 adds the new qc status code to the system
######################
if ($ADD==241111111111111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT count(*) from vicidial_qc_codes where code='$code';";
$rslt=mysql_query($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{echo "<br>QC STATUS CODE NOT ADDED - there is already a qc status code in the system with this name: $row[0]\n";}
else
{
if ( (strlen($code) < 1) or (strlen($code_name) < 2) )
{
echo "<br>QC STATUS CODE NOT ADDED - Please go back and look at the data you entered\n";
echo "<br>code must be between 1 and 8 characters in length\n";
echo "<br>code name must be between 2 and 30 characters in length\n";
}
else
{
echo "<br><B>QC STATUS CODE ADDED: $code_name - $code</B>\n";
if (isset($_POST["qc_category"])) {$qc_category=$_POST["qc_category"];}
$stmt="INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) values('$code','$code_name','$qc_category');";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/', '', $SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='QCSTATUSES', event_type='ADD', record_id='$code', event_code='ADMIN ADD QC STATUS', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
}
$ADD=341111111111111;
}
##QC
require_once('qc/QC_status_codes_include.php');
###################### ######################
# ADD=341111111111111 modify vicidial QC status code # ADD=341111111111111 modify vicidial QC status code
###################### ######################
//This section moved to include file as part of QC
if ($ADD==341111111111111)
{
if ( ($LOGmodify_servers==1) and ($SSqc_features_active > 0) )
{
if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) )
{
$modify_url = "$PHP_SELF?ADD=341111111111111";
$modify_footer_refresh=1;
}
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br><center>\n";
echo "<b>QC STATUS CODES WITHIN THIS SYSTEM: &nbsp; $NWB#vicidial_qc_status_codes$NWE</b><br>\n";
echo "<TABLE width=600 cellspacing=3>\n";
echo "<tr><td>STATUS CODE</td><td>DESCRIPTION</td><td>QC CATEGORY</td><td>MODIFY/DELETE</td></tr>\n";
##### go through each QC status code
$stmt="SELECT count(*) from vicidial_qc_codes;";
$rslt=mysql_query($stmt, $link);
$rowx=mysqli_fetch_row($rslt);
if ($rowx[0] > 0)
{
$stmt="SELECT code,code_name,qc_result_type from vicidial_qc_codes order by code;";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($statuses_to_print > $o)
{
$rowx=mysqli_fetch_row($rslt);
$o++;
if (preg_match("/1$|3$|5$|7$|9$/i", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<tr $bgcolor><td><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=441111111111111>\n";
echo "<input type=hidden name=stage value=modify>\n";
echo "<input type=hidden name=code value=\"$rowx[0]\">\n";
echo "<font size=2><B>$rowx[0]</B></td>\n";
echo "<td><input type=text name=code_name size=20 maxlength=30 value=\"$rowx[1]\"></td>\n";
echo "<td><font size=2><B>$rowx[2]</B></td>\n";
echo "<td align=center nowrap><font size=1><input type=submit name=submit value=MODIFY> &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo " &nbsp; \n";
if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0]))
{
echo "<DEL>DELETE</DEL>\n";
}
else
{
echo "<a href=\"$PHP_SELF?ADD=441111111111111&code=$rowx[0]&stage=delete\">DELETE</a>\n";
}
echo "</form></td></tr>\n";
}
}
echo "</table>\n";
echo "<br>ADD NEW QC STATUS CODE<BR><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=241111111111111>\n";
echo "Status: <input type=text name=code size=9 maxlength=8> &nbsp; \n";
echo "Description: <input type=text name=code_name size=25 maxlength=30> \n";
echo "QC Category: <select name=qc_category><option selected value=''>-Choose-</option><option value='PASS'>PASS</option><option value='FAIL'>FAIL</option><option value='CANCEL'>CANCEL</option><option value='COMMIT'>COMMIT</option><BR>\n";
echo "<input type=submit name=submit value=ADD><BR>\n";
echo "</FORM><br>\n";
}
else
{
echo "You do not have permission to view this page\n";
exit;
}
}
###################### ######################
# ADD=550 user search form # ADD=550 user search form
@@ -31092,7 +31223,107 @@ if ($ADD==10000000000000)
###################### ######################
# ADD=100000000000000 display all qc campaigns # ADD=100000000000000 display all qc campaigns
###################### ######################
require_once('qc/QC_admin_include01.php'); if (($ADD==100000000000000) && ($qc_auth=='1'))
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
//SELECT campaign_id,campaign_name from vicidial_campaigns where active = 'Y' and qc_enabled='Y' order by campaign_name
$stmt="SELECT campaign_id,campaign_name, qc_statuses from vicidial_campaigns where active = 'Y' and qc_enabled='Y' order by campaign_name";
// echo $stmt="SELECT conf_exten,server_ip,extension from vicidial_conferences order by conf_exten";
$rslt=mysql_to_mysqli($stmt, $link);
$vicidialconf_to_print = mysqli_num_rows($rslt);
echo "<br>VICIDIAL QUALITY LISTINGS:\n";
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
echo "<tr bgcolor=black>";
echo "<td><font size=1 color=white align=left><B>CAMPAIGN ID</B></td>";
echo "<td><font size=1 color=white><B>CAMPAIGN NAME</B></td>";
echo "<td><font size=1 color=white><B>QC STATUSES</B></td>";
echo "<td align=center><font size=1 color=white><B>MODIFY</B></td></tr>\n";
$o=0;
while ($vicidialconf_to_print > $o)
{
$row=mysqli_fetch_row($rslt);
if (preg_match("/1$|3$|5$|7$|9$/i", $o))
{
$bgcolor='bgcolor="#B9CBFD"';
}
else
{
$bgcolor='bgcolor="#9BB9FB"';
}
echo "<tr $bgcolor><td><font size=1><a href=\"$PHP_SELF?ADD=881&campaign_id=$row[0]\">$row[0]</a></td>";
echo "<td><font size=1> $row[1]</td>";
echo "<td><font size=1> $row[2]</td>";
echo "<td align=center><font size=1><a href=\"$PHP_SELF?ADD=31&campaign_id=$row[0]\">MODIFY</a></td></tr>\n";
$o++;
}
echo "</TABLE></center>\n";
}
######################
# ADD=881 VIEW one qc campaign
######################
if (($ADD==881) && ($qc_auth=='1'))
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT campaign_id,campaign_name, qc_statuses from vicidial_campaigns where active = 'Y' and qc_enabled='Y' and campaign_id='$campaign_id' limit 1";
$rslt=mysql_to_mysqli($stmt, $link);
$vicidialconf_to_print = mysqli_num_rows($rslt);
$o=0;
while ($vicidialconf_to_print > $o)
{
$row=mysqli_fetch_row($rslt);
$o++;
}
$qc_status_list=substr($row[2],0,strlen($row[2])-2);
echo "<br>$campaign_id - {$row[1]} - Quality Control Queue<br>QC statuses: $qc_status_list\n";
$qc_statuses=explode(' ',$qc_status_list);
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
foreach ( $qc_statuses as $qc_status )
{
$stmt="SELECT lead_id,first_name,last_name,modify_date,user from vicidial_list inner join vicidial_lists on vicidial_list.list_id=vicidial_lists.list_id where campaign_id='$campaign_id' and status='$qc_status' order by status, modify_date";
$rslt=mysql_to_mysqli($stmt, $link);
$vicidialconf_to_print = mysqli_num_rows($rslt);
$o=0;
while ($vicidialconf_to_print > $o)
{
if($o==0)
{
echo "<tr bgcolor=black>";
echo "<td><font size=1 color=white align=left><B>$qc_status ($vicidialconf_to_print)</B></td>";
echo "<td><font size=1 color=white align=left><B>LEAD ID</B></td>";
echo "<td><font size=1 color=white><B>NAME</B></td>";
echo "<td><font size=1 color=white><B>Last Modified</B></td>";
echo "<td align=center><font size=1 color=white><B>UserID</B></td></tr>\n";
}
$row=mysqli_fetch_row($rslt);
if (preg_match("/1$|3$|5$|7$|9$/i", $o))
{
$bgcolor='bgcolor="#B9CBFD"';
}
else
{
$bgcolor='bgcolor="#9BB9FB"';
}
echo "<tr $bgcolor><td><font size=1>&nbsp;</td>";
echo "<td><font size=1> $row[0]</td>";
$lead_name=trim($row[1].' '.$row[2]);
$lead_nameENC=urlencode($lead_name);
if (strlen($lead_name)<1) $lead_name='No Name';
echo "<td><font size=1><a href=\"qc_modify_lead.php?lead_id=$row[0]&campaign_id=$campaign_id&lead_name=$lead_nameENC\">$lead_name</a></td>";
echo "<td><font size=1> $row[3]</td>";
echo "<td align=center><font size=1><a href=\"$PHP_SELF?ADD=3&user=$row[4]\">$row[4]</a></td></tr>\n";
$o++;
}
}
echo "</TABLE></center>\n";
}
###################### ######################
+77 -5
View File
@@ -45,6 +45,7 @@
# 130615-2314 - Changed Reports only and QC only headers # 130615-2314 - Changed Reports only and QC only headers
# 130824-2324 - Changed to mysqli PHP functions # 130824-2324 - Changed to mysqli PHP functions
# 140126-1022 - Added VMAIL_NO_INST option # 140126-1022 - Added VMAIL_NO_INST option
# 140706-0828 - Incorporated QC includes into code
# #
@@ -60,7 +61,14 @@ if($short_header)
?> ?>
<TD> &nbsp; <A HREF="admin.php?ADD=0A" ALT="Users"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Users</B></FONT></A> &nbsp; </TD> <TD> &nbsp; <A HREF="admin.php?ADD=0A" ALT="Users"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Users</B></FONT></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10" ALT="Campaigns"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Campaigns</B></FONT></A> &nbsp; </TD> <TD> &nbsp; <A HREF="admin.php?ADD=10" ALT="Campaigns"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Campaigns</B></FONT></A> &nbsp; </TD>
<?php include 'qc/QC_header_include02.php'; ?> <?php
if (($SSqc_features_active=='1') && ($qc_auth=='1'))
{
?>
<TD> &nbsp; <A HREF="admin.php?ADD=100000000000000" ALT="Quality Control"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Quality Control</B></FONT></A> &nbsp; </TD>
<?php
}
?>
<TD> &nbsp; <A HREF="admin.php?ADD=100" ALT="Lists"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Lists</B></FONT></A> &nbsp; </TD> <TD> &nbsp; <A HREF="admin.php?ADD=100" ALT="Lists"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Lists</B></FONT></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000000" ALT="Scripts"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Scripts</B></FONT></A> &nbsp; </TD> <TD> &nbsp; <A HREF="admin.php?ADD=1000000" ALT="Scripts"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Scripts</B></FONT></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000000" ALT="Filters"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Filters</B></FONT></A> &nbsp; </TD> <TD> &nbsp; <A HREF="admin.php?ADD=10000000" ALT="Filters"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Filters</B></FONT></A> &nbsp; </TD>
@@ -84,7 +92,12 @@ if($short_header)
} }
else else
{ {
include 'qc/QC_header_include02.php'; if (($SSqc_features_active=='1') && ($qc_auth=='1'))
{
?>
<TD> &nbsp; <A HREF="admin.php?ADD=100000000000000" ALT="Quality Control"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Quality Control</B></FONT></A> &nbsp; </TD>
<?php
}
} }
} }
?> ?>
@@ -134,7 +147,9 @@ if ($hh=='admin')
if ($hh=='reports') if ($hh=='reports')
{$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";} {$reports_hh="bgcolor=\"$reports_color\""; $reports_fc="$reports_font"; $reports_bold="$header_selected_bold";}
else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";} else {$reports_hh=''; $reports_fc='WHITE'; $reports_bold="$header_nonselected_bold";}
include('qc/QC_header_include01.php'); if ($hh=='qc')
{$qc_hh="bgcolor=\"$qc_color\""; $qc_fc="$qc_font"; $qc_bold="$header_selected_bold";}
else {$qc_hh=''; $qc_fc='WHITE'; $qc_bold="$header_nonselected_bold";}
echo "</title>\n"; echo "</title>\n";
echo "<script language=\"Javascript\">\n"; echo "<script language=\"Javascript\">\n";
@@ -1239,8 +1254,37 @@ $SSlevel_8_disable_add = $row[5];
<?php <?php
} }
} }
if (($SSqc_features_active=='1') && ($qc_auth=='1'))
{ ?>
<TR>
<TD <?php echo $qc_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $qc_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $qc_bold ?> Quality Control </FONT></a>
</TD>
</TR>
<?php
if (strlen($qc_hh) > 1)
{
?>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show QC Campaigns </FONT></a>
</TD>
</TR>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Enter QC Queue </FONT></a>
</TD>
</TR>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=341111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Modify QC Codes </FONT></a>
</TD>
</TR>
<?php }
}
?> ?>
<?php include 'qc/QC_header_include.php'; ?>
<!-- SCRIPTS NAVIGATION --> <!-- SCRIPTS NAVIGATION -->
<TR><TD <?php echo $scripts_hh ?>> <TR><TD <?php echo $scripts_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=1000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $scripts_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $scripts_bold ?> Scripts </a> <a href="<?php echo $ADMIN ?>?ADD=1000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $scripts_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $scripts_bold ?> Scripts </a>
@@ -1523,7 +1567,35 @@ $SSlevel_8_disable_add = $row[5];
} }
else else
{ {
include 'qc/QC_header_include.php'; if (($SSqc_features_active=='1') && ($qc_auth=='1'))
{ ?>
<TR>
<TD <?php echo $qc_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $qc_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $qc_bold ?> Quality Control </FONT></a>
</TD>
</TR>
<?php
if (strlen($qc_hh) > 1)
{
?>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show QC Campaigns </FONT></a>
</TD>
</TR>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Enter QC Queue </FONT></a>
</TD>
</TR>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=341111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Modify QC Codes </FONT></a>
</TD>
</TR>
<?php }
}
} }
} }
?> ?>
+33 -3
View File
@@ -1,5 +1,5 @@
<?php <?php
# admin_modify_lead.php version 2.8 # admin_modify_lead.php version 2.10
# #
# ViciDial database administration modify lead in vicidial_list # ViciDial database administration modify lead in vicidial_list
# admin_modify_lead.php # admin_modify_lead.php
@@ -59,6 +59,7 @@
# 130926-2053 - Added option for viewing/modifying vicidial_list_archive leads # 130926-2053 - Added option for viewing/modifying vicidial_list_archive leads
# 140125-1100 - Fixed issue with Callback records having no campaign_id # 140125-1100 - Fixed issue with Callback records having no campaign_id
# 140304-2034 - Fixed issue with special characters in standard data fields # 140304-2034 - Fixed issue with special characters in standard data fields
# 140706-0827 - Incorporated QC includes into code
# #
require("dbconnect_mysqli.php"); require("dbconnect_mysqli.php");
@@ -1494,8 +1495,37 @@ else
{ {
echo "<a href=\"./admin.php?ADD=720000000000000&stage=$lead_id&category=LEADS\">Click here to see Lead Modify changes to this lead</a>\n"; echo "<a href=\"./admin.php?ADD=720000000000000&stage=$lead_id&category=LEADS\">Click here to see Lead Modify changes to this lead</a>\n";
} }
//Display link to QC if user has QC permissions //Display link to QC if user has QC permissions
require('./qc/QC_admin_modify_lead_include.php'); //Get QC User permissions
$stmt="SELECT qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit from vicidial_users where user='$PHP_AUTH_USER' and user_level > 1 and active='Y' and qc_enabled='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$qc_auth=$row[0];
//Not "qc_" as it will interfere with ADD=4A storage of modified user.
if ($qc_auth=='1')
{
$qcuser_level=$row[1];
$qcpass=$row[2];
$qcfinish=$row[3];
$qccommit=$row[4];
}
//Modify menuing to allow qc users into the system (if they have no permission otherwise)
//Copied Reports-Only user setup for QC-Only user (Poundteam QC setup)
$qc_only_user=0;
if ( ($qc_auth > 0) and ($auth < 1) )
{
if ($ADD != '881')
{
$ADD=100000000000000;
}
$qc_only_user=1;
}
if ($qcuser_level > 0)
{
echo "<br><br><a href=\"qc_modify_lead.php?lead_id=$lead_id\">Click here to QC Modify this lead</a>\n";
}
echo "</center>\n"; echo "</center>\n";
} }
} }
+1 -112
View File
@@ -1,112 +1 @@
<?php file depricated, integrated into standard admin directory
# QC_admin_include01.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to be used by admin.php with QC enabled, contributed by poundteam.com
#
# changes:
# 121116-1334 - First build, added to vicidial codebase
# 130621-2351 - Finalized changing of all ereg instances to preg
# 130902-0907 - Changed to mysqli PHP functions, fixes for issue #699
#
//Line 28030 admin.php
######################
# ADD=100000000000000 display all qc campaigns
######################
if (($ADD==100000000000000) && ($qc_auth=='1')) {
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
//SELECT campaign_id,campaign_name from vicidial_campaigns where active = 'Y' and qc_enabled='Y' order by campaign_name
$stmt="SELECT campaign_id,campaign_name, qc_statuses from vicidial_campaigns where active = 'Y' and qc_enabled='Y' order by campaign_name";
// echo $stmt="SELECT conf_exten,server_ip,extension from vicidial_conferences order by conf_exten";
$rslt=mysql_to_mysqli($stmt, $link);
$vicidialconf_to_print = mysqli_num_rows($rslt);
echo "<br>VICIDIAL QUALITY LISTINGS:\n";
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
echo "<tr bgcolor=black>";
echo "<td><font size=1 color=white align=left><B>CAMPAIGN ID</B></td>";
echo "<td><font size=1 color=white><B>CAMPAIGN NAME</B></td>";
echo "<td><font size=1 color=white><B>QC STATUSES</B></td>";
echo "<td align=center><font size=1 color=white><B>MODIFY</B></td></tr>\n";
$o=0;
while ($vicidialconf_to_print > $o) {
$row=mysqli_fetch_row($rslt);
if (preg_match("/1$|3$|5$|7$|9$/i", $o))
{
$bgcolor='bgcolor="#B9CBFD"';
}
else
{
$bgcolor='bgcolor="#9BB9FB"';
}
echo "<tr $bgcolor><td><font size=1><a href=\"$PHP_SELF?ADD=881&campaign_id=$row[0]\">$row[0]</a></td>";
echo "<td><font size=1> $row[1]</td>";
echo "<td><font size=1> $row[2]</td>";
echo "<td align=center><font size=1><a href=\"$PHP_SELF?ADD=31&campaign_id=$row[0]\">MODIFY</a></td></tr>\n";
$o++;
}
echo "</TABLE></center>\n";
}
######################
# ADD=881 VIEW one qc campaign
######################
if (($ADD==881) && ($qc_auth=='1')) {
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT campaign_id,campaign_name, qc_statuses from vicidial_campaigns where active = 'Y' and qc_enabled='Y' and campaign_id='$campaign_id' limit 1";
$rslt=mysql_to_mysqli($stmt, $link);
$vicidialconf_to_print = mysqli_num_rows($rslt);
$o=0;
while ($vicidialconf_to_print > $o) {
$row=mysqli_fetch_row($rslt);
$o++;
}
$qc_status_list=substr($row[2],0,strlen($row[2])-2);
echo "<br>$campaign_id - {$row[1]} - Quality Control Queue<br>QC statuses: $qc_status_list\n";
$qc_statuses=explode(' ',$qc_status_list);
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
foreach ( $qc_statuses as $qc_status ) {
$stmt="SELECT lead_id,first_name,last_name,modify_date,user from vicidial_list inner join vicidial_lists on vicidial_list.list_id=vicidial_lists.list_id where campaign_id='$campaign_id' and status='$qc_status' order by status, modify_date";
$rslt=mysql_to_mysqli($stmt, $link);
$vicidialconf_to_print = mysqli_num_rows($rslt);
$o=0;
while ($vicidialconf_to_print > $o) {
if($o==0){
echo "<tr bgcolor=black>";
echo "<td><font size=1 color=white align=left><B>$qc_status ($vicidialconf_to_print)</B></td>";
echo "<td><font size=1 color=white align=left><B>LEAD ID</B></td>";
echo "<td><font size=1 color=white><B>NAME</B></td>";
echo "<td><font size=1 color=white><B>Last Modified</B></td>";
echo "<td align=center><font size=1 color=white><B>UserID</B></td></tr>\n";
}
$row=mysqli_fetch_row($rslt);
if (preg_match("/1$|3$|5$|7$|9$/i", $o))
{
$bgcolor='bgcolor="#B9CBFD"';
}
else
{
$bgcolor='bgcolor="#9BB9FB"';
}
echo "<tr $bgcolor><td><font size=1>&nbsp;</td>";
echo "<td><font size=1> $row[0]</td>";
$lead_name=trim($row[1].' '.$row[2]);
$lead_nameENC=urlencode($lead_name);
if (strlen($lead_name)<1) $lead_name='No Name';
echo "<td><font size=1><a href=\"/vicidial/qc/qc_modify_lead.php?lead_id=$row[0]&campaign_id=$campaign_id&lead_name=$lead_nameENC\">$lead_name</a></td>";
echo "<td><font size=1> $row[3]</td>";
echo "<td align=center><font size=1><a href=\"$PHP_SELF?ADD=3&user=$row[4]\">$row[4]</a></td></tr>\n";
$o++;
}
}
echo "</TABLE></center>\n";
}
?>
+1 -35
View File
@@ -1,35 +1 @@
<?php file depricated, integrated into standard admin directory
# QC_admin_include02.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to be used by admin.php with QC enabled, contributed by poundteam.com
#
# changes:
# 121116-1333 - First build, added to vicidial codebase
# 130902-0902 - Changed to mysqli PHP functions
#
//Get QC User permissions
$stmt="SELECT qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit from vicidial_users where user='$PHP_AUTH_USER' and user_level > 1 and active='Y' and qc_enabled='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$qc_auth=$row[0];
//Not "qc_" as it will interfere with ADD=4A storage of modified user.
if ($qc_auth=='1') {
$qcuser_level=$row[1];
$qcpass=$row[2];
$qcfinish=$row[3];
$qccommit=$row[4];
}
//Modify menuing to allow qc users into the system (if they have no permission otherwise)
//Copied Reports-Only user setup for QC-Only user (Poundteam QC setup)
$qc_only_user=0;
if ( ($qc_auth > 0) and ($auth < 1) )
{
if ($ADD != '881'){
$ADD=100000000000000;
}
$qc_only_user=1;
}
?>
@@ -1,20 +1 @@
<?php file depricated, integrated into standard admin directory
//Line 1349 admin_modify_lead.php
# QC_admin_modify_lead_include.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to be used by admin.php with QC enabled, contributed by poundteam.com
#
# changes:
# 121116-1332 - First build, added to vicidial codebase
#
######################
# //Display link to QC if user has QC permissions
######################
require('QC_admin_include02.php');
if ($qcuser_level > 0)
{
echo "<br><br><a href=\"./qc/qc_modify_lead.php?lead_id=$lead_id\">Click here to QC Modify this lead</a>\n";
}
?>
+1 -15
View File
@@ -1,15 +1 @@
<?php file depricated, integrated into standard admin directory
//line 65 admin.php
# QC_admin_variables.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to be used by admin.php with QC enabled, contributed by poundteam.com
#
# changes:
# 121116-1331 - First build, added to vicidial codebase
#
$qc_font = 'BLACK';
$qc_color = '#E6E6E6';
+1 -16
View File
@@ -1,16 +1 @@
<?php file depricated, integrated into standard admin directory
//admin.php line 3160
//##QC
//require_once('qc/QC_admin_variables01.php');
# QC_admin_variables01.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to be used by admin.php with QC enabled, contributed by poundteam.com
#
# changes:
# 121116-1330 - First build, added to vicidial codebase
#
if ($ADD==100000000000000) {$hh='qc'; echo "Quality Control";}
if ($ADD==881) {$hh='qc'; echo "Quality Control Campaign $campaign_id";}
+1 -264
View File
@@ -1,264 +1 @@
<?php file depricated, integrated into standard admin directory
# qc_modify_lead.php modified from:
//admin_modify_lead.php version 2.4
#
# ViciDial database administration modify lead in vicidial_list
# QC_call_client_iframe.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to allow QC review and modification of leads, contributed by poundteam.com
#
# changes:
# 121116-1328 - First build, added to vicidial codebase
# 130621-2352 - Finalized changing of all ereg instances to preg
# - Added filtering of input to prevent SQL injection attacks and new user auth
# 130902-0905 - Changed to mysqli PHP functions
#
require("../dbconnect_mysqli.php");
require("../functions.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["old_phone"])) {$old_phone=$_GET["old_phone"];}
elseif (isset($_POST["old_phone"])) {$old_phone=$_POST["old_phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
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["lead_name"])) {$lead_name=$_GET["lead_name"];}
elseif (isset($_POST["lead_name"])) {$lead_name=$_POST["lead_name"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];}
elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];}
elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];}
if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];}
elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];}
if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];}
elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];}
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["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
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"])) {$security=$_GET["security"];}
elseif (isset($_POST["security"])) {$security=$_POST["security"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
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["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];}
elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];}
if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];}
elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];}
if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];}
elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];}
if (isset($_GET["CBchangeDATE"])) {$CBchangeDATE=$_GET["CBchangeDATE"];}
elseif (isset($_POST["CBchangeDATE"])) {$CBchangeDATE=$_POST["CBchangeDATE"];}
if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];}
elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];}
if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];}
elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];}
if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];}
elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];}
if (isset($_GET["modify_closer_logs"])) {$modify_closer_logs=$_GET["modify_closer_logs"];}
elseif (isset($_POST["modify_closer_logs"])) {$modify_closer_logs=$_POST["modify_closer_logs"];}
if (isset($_GET["modify_agent_logs"])) {$modify_agent_logs=$_GET["modify_agent_logs"];}
elseif (isset($_POST["modify_agent_logs"])) {$modify_agent_logs=$_POST["modify_agent_logs"];}
if (isset($_GET["add_closer_record"])) {$add_closer_record=$_GET["add_closer_record"];}
elseif (isset($_POST["add_closer_record"])) {$add_closer_record=$_POST["add_closer_record"];}
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"];}
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
$custom_fields_enabled = $row[1];
}
##### END SETTINGS LOOKUP #####
###########################################
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
if ($non_latin < 1)
{
$PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/','',$PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/','',$PHP_AUTH_PW);
$old_phone = preg_replace('/[^0-9]/','',$old_phone);
$phone_number = preg_replace('/[^0-9]/','',$phone_number);
$alt_phone = preg_replace('/[^0-9]/','',$alt_phone);
} # end of non_latin
else
{
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
}
if (strlen($phone_number)<6) {$phone_number=$old_phone;}
$auth=0;
$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'QC',1);
if ($auth_message == 'GOOD')
{$auth=1;}
if ($auth < 1)
{
$VDdisplayMESSAGE = "Login incorrect, please try again";
if ($auth_message == 'LOCK')
{
$VDdisplayMESSAGE = "Too many login attempts, try again in 15 minutes";
Header ("Content-type: text/html; charset=utf-8");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
exit;
}
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
exit;
}
$rights_stmt = "SELECT modify_leads,qc_enabled,qc_user_level from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rights_rslt=mysql_to_mysqli($rights_stmt, $link);
$rights_row=mysqli_fetch_row($rights_rslt);
$modify_leads = $rights_row[0];
$qc_enabled = $rights_row[1];
$qc_user_level = $rights_row[2];
if ( $qc_enabled < 1 )
{
header ("Content-type: text/html; charset=utf-8");
echo "QC is not enabled for your user account\n";
exit;
}
if ( $qc_user_level < 1 )
{
header ("Content-type: text/html; charset=utf-8");
echo "QC user level is too low\n";
exit;
}
$label_title = 'Title';
$label_first_name = 'First';
$label_middle_initial = 'MI';
$label_last_name = 'Last';
$label_address1 = 'Address1';
$label_address2 = 'Address2';
$label_address3 = 'Address3';
$label_city = 'City';
$label_state = 'State';
$label_province = 'Province';
$label_postal_code = 'Postal Code';
$label_vendor_lead_code = 'Vendor ID';
$label_gender = 'Gender';
$label_phone_number = 'Phone';
$label_phone_code = 'DialCode';
$label_alt_phone = 'Alt. Phone';
$label_security_phrase = 'Show';
$label_email = 'Email';
$label_comments = 'Comments';
### find any custom field labels
$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_to_mysqli($stmt, $link);
$row=mysqli_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];}
include('QC_call_client_include.php');
$qc_user_logged_in=is_user_logged_in($PHP_AUTH_USER);
if ($qc_user_logged_in===true){
echo "<A HREF=/vicidial/qc/qc_api.php?source=test&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&agent_user=$PHP_AUTH_USER&function=external_dial_lead&value=$phone_number&phone_code=$phone_code&search=YES&preview=NO&focus=YES target='_SELF'>Call Lead</A>";
} else {
echo "$qc_user_logged_in";
}
echo "&nbsp;<A HREF=$PHP_SELF?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6>Refresh</A>";
?>
+1 -46
View File
@@ -1,46 +1 @@
<?php file depricated, integrated into standard admin directory
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# changes:
# 121116-1328 - First build, added to vicidial codebase
# 130902-0909 - Changed to mysqli PHP functions
#
/* QC_call_client_include.php
* Part of QC system by Poundteam.
* Location: /vicidial/qc
* Included in: qc_modify_lead.php
* Purpose: Determine availability of "Call Lead" button and call the lead when button is pressed.
* Also: display REASON if lead cannot be called by pressing button (to allow agent to resolve the reason without guessing)
*/
/* 1. Is logged in admin user also logged in as an agent?
* If not: display admin user name followed by "not logged in as agent"
* 2. Is logged in agent available to manual dial this prospect?
* Requires pause or manual mode and campaign with this prospect available.
* 3. If possible, log the agent in with NO permission to change data on the agent screen. Require changes ONLY on QC screen (except hangup button).
*/
//Is logged in admin user also logged in as an agent?
function is_user_logged_in($user){
global $link;
$stmt="select status from vicidial_live_agents where user='$user'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$live_agent_count = mysqli_num_rows($rslt);
if($live_agent_count != '1'){
if($live_agent_count == '0'){
return "Cannot call prospect. You are not logged in as $user.";
} else {
return "Cannot call prospect. $live_agent_count agents logged in as $user.";
}
}
$row=mysqli_fetch_row($rslt);
$status = $row[0];
if($status!='PAUSED'){
return "Status must be paused to call lead. $user is presently in $status status.";
}
//@TODO: check user is in the correct CAMPAIGN for this lead.
return true;
}
?>
+1 -42
View File
@@ -1,42 +1 @@
<!-- QC NAVIGATION --> file depricated, integrated into standard admin directory
<?php
# QC_header_include.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to display header contents for QC, contributed by poundteam.com
#
# changes:
# 121116-1327 - First build, added to vicidial codebase
#
if (($SSqc_features_active=='1') && ($qc_auth=='1')) { ?>
<TR>
<TD <?php echo $qc_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $qc_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $qc_bold ?> Quality Control </FONT></a>
</TD>
</TR>
<?php
if (strlen($qc_hh) > 1) {
?>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show QC Campaigns </FONT></a>
</TD>
</TR>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100000000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Enter QC Queue </FONT></a>
</TD>
</TR>
<TR BGCOLOR=<?php echo $qc_color ?>>
<TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=341111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Modify QC Codes </FONT></a>
</TD>
</TR>
<?php }
}
?>
+1 -16
View File
@@ -1,16 +1 @@
<?php file depricated, integrated into standard admin directory
# QC_header_include01.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to display header contents for QC, contributed by poundteam.com
#
# changes:
# 121116-1326 - First build, added to vicidial codebase
#
if ($hh=='qc')
{$qc_hh="bgcolor=\"$qc_color\""; $qc_fc="$qc_font"; $qc_bold="$header_selected_bold";}
else {$qc_hh=''; $qc_fc='WHITE'; $qc_bold="$header_nonselected_bold";}
?>
+1 -17
View File
@@ -1,17 +1 @@
<?PHP file depricated, integrated into standard admin directory
# QC_header_include02.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to display header contents for QC, contributed by poundteam.com
#
# changes:
# 121116-1325 - First build, added to vicidial codebase
#
if (($SSqc_features_active=='1') && ($qc_auth=='1')) {
?>
<TD> &nbsp; <A HREF="admin.php?ADD=100000000000000" ALT="Quality Control"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Quality Control</B></FONT></A> &nbsp; </TD>
<?PHP
}
?>
+1 -143
View File
@@ -1,143 +1 @@
<?php file depricated, integrated into standard admin directory
# QC_status_codes_include.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to display admin sections for QC functions, contributed by poundteam.com
#
# changes:
# 121116-1323 - First build, added to vicidial codebase
# 130621-2353 - Finalized changing of all ereg instances to preg
# 130902-0903 - Changed to mysqli PHP functions
#
/*
* include at line 26437 replacing existing section entirely
//##QC
//require_once('qc/QC_status_codes_include.php');
*/
######################
# ADD=241111111111111 adds the new qc status code to the system
######################
//Moved to qc/QC_status_codes_include.php include file
if ($ADD==241111111111111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT count(*) from vicidial_qc_codes where code='$code';";
$rslt=mysql_query($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{echo "<br>QC STATUS CODE NOT ADDED - there is already a qc status code in the system with this name: $row[0]\n";}
else
{
if ( (strlen($code) < 1) or (strlen($code_name) < 2) )
{
echo "<br>QC STATUS CODE NOT ADDED - Please go back and look at the data you entered\n";
echo "<br>code must be between 1 and 8 characters in length\n";
echo "<br>code name must be between 2 and 30 characters in length\n";
}
else
{
echo "<br><B>QC STATUS CODE ADDED: $code_name - $code</B>\n";
if (isset($_POST["qc_category"])) {$qc_category=$_POST["qc_category"];}
$stmt="INSERT INTO vicidial_qc_codes (code,code_name,qc_result_type) values('$code','$code_name','$qc_category');";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/', '', $SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='QCSTATUSES', event_type='ADD', record_id='$code', event_code='ADMIN ADD QC STATUS', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
}
$ADD=341111111111111;
}
######################
# ADD=341111111111111 modify vicidial QC status code
######################
if ($ADD==341111111111111)
{
if ( ($LOGmodify_servers==1) and ($SSqc_features_active > 0) )
{
if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) )
{
$modify_url = "$PHP_SELF?ADD=341111111111111";
$modify_footer_refresh=1;
}
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br><center>\n";
echo "<b>QC STATUS CODES WITHIN THIS SYSTEM: &nbsp; $NWB#vicidial_qc_status_codes$NWE</b><br>\n";
echo "<TABLE width=600 cellspacing=3>\n";
echo "<tr><td>STATUS CODE</td><td>DESCRIPTION</td><td>QC CATEGORY</td><td>MODIFY/DELETE</td></tr>\n";
##### go through each QC status code
$stmt="SELECT count(*) from vicidial_qc_codes;";
$rslt=mysql_query($stmt, $link);
$rowx=mysqli_fetch_row($rslt);
if ($rowx[0] > 0)
{
$stmt="SELECT code,code_name,qc_result_type from vicidial_qc_codes order by code;";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($statuses_to_print > $o)
{
$rowx=mysqli_fetch_row($rslt);
$o++;
if (preg_match("/1$|3$|5$|7$|9$/i", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<tr $bgcolor><td><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=441111111111111>\n";
echo "<input type=hidden name=stage value=modify>\n";
echo "<input type=hidden name=code value=\"$rowx[0]\">\n";
echo "<font size=2><B>$rowx[0]</B></td>\n";
echo "<td><input type=text name=code_name size=20 maxlength=30 value=\"$rowx[1]\"></td>\n";
echo "<td><font size=2><B>$rowx[2]</B></td>\n";
echo "<td align=center nowrap><font size=1><input type=submit name=submit value=MODIFY> &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo " &nbsp; \n";
if (preg_match("/^B$|^NA$|^DNC$|^NA$|^DROP$|^INCALL$|^QUEUE$|^NEW$/i",$rowx[0]))
{
echo "<DEL>DELETE</DEL>\n";
}
else
{
echo "<a href=\"$PHP_SELF?ADD=441111111111111&code=$rowx[0]&stage=delete\">DELETE</a>\n";
}
echo "</form></td></tr>\n";
}
}
echo "</table>\n";
echo "<br>ADD NEW QC STATUS CODE<BR><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=241111111111111>\n";
echo "Status: <input type=text name=code size=9 maxlength=8> &nbsp; \n";
echo "Description: <input type=text name=code_name size=25 maxlength=30> \n";
echo "QC Category: <select name=qc_category><option selected value=''>-Choose-</option><option value='PASS'>PASS</option><option value='FAIL'>FAIL</option><option value='CANCEL'>CANCEL</option><option value='COMMIT'>COMMIT</option><BR>\n";
echo "<input type=submit name=submit value=ADD><BR>\n";
echo "</FORM><br>\n";
}
else
{
echo "You do not have permission to view this page\n";
exit;
}
}
?>
+1 -99
View File
@@ -1,99 +1 @@
<?php file depricated, integrated into standard admin directory
# audit_comments.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
#
# This script is designed to be used by the QC application, contributed by poundteam.com
#
# changes:
# 121116-1335 - First build, added to vicidial codebase
# 130902-0910 - Changed to mysqli PHP functions
#
function audit_comments($lead_id,$list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log,$campaign) {
$audit_comments_active=audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log);
if ($audit_comments_active) {
//Get comment from list
$stmt="select comments from vicidial_list where lead_id='$lead_id' limit 1;";
if ($format=='debug') {
echo "\n<!-- $stmt -->";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments2',$user,$server_ip,$session_name,$one_mysql_log);
}
$row=mysqli_fetch_row($rslt);
if (strlen($row[0]) > 0) {
$comment=$row[0];
//Put comment in comment table
$stmt="INSERT INTO vicidial_comments (lead_id,user_id,list_id,campaign_id,comment) VALUES ('$lead_id','$user','$list_id','$campaign','$comment');";
if ($format=='debug') {
echo "\n<!-- $stmt -->";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments3',$user,$server_ip,$session_name,$one_mysql_log);
}
$affected=mysqli_affected_rows($link);
if($affected>0) {
$stmt="UPDATE vicidial_list set comments='' where lead_id='$lead_id';";
if ($format=='debug') {
echo "\n<!-- $stmt -->";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments4',$user,$server_ip,$session_name,$one_mysql_log);
}
} else {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditCommentsERROR-Comment not moved',$user,$server_ip,$session_name,$one_mysql_log);
echo "\n<!-- 00142-AuditCommentsERROR-Comment not moved -->";
}
}
}
}
function audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log){
$stmt="select count(audit_comments) from vicidial_lists_custom where list_id='$list_id' and audit_comments='1' limit 1;";
if ($format=='debug') {
echo "\n<!-- $stmt -->";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments5',$user,$server_ip,$session_name,$one_mysql_log);
}
$row=mysqli_fetch_row($rslt);
if ($row[0] == '1') {
return true;
} else {
return false;
}
}
function get_audited_comments($lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log) {
global $ACcount;
global $ACcomments;
$stmt="select user_id,comment from vicidial_comments where lead_id='$lead_id';";
if ($mel > 0) {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,"00142-65-AuditComments:$stmt LeadID: $lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log",$user,$server_ip,$session_name,$one_mysql_log);
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-69-AuditComments',$user,$server_ip,$session_name,$one_mysql_log);
}
$ACcount=mysqli_num_rows($rslt);
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-72-AuditComments $ACcount='.$ACcount,$user,$server_ip,$session_name,$one_mysql_log);
if($ACcount>0) {
$i=0;
while ($i < $ACcount) {
$row=mysqli_fetch_row($rslt);
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-77-AuditComments UserID='.$row[0],$user,$server_ip,$session_name,$one_mysql_log);
$ACcomments .= "UserID: $row[0]\n";
mysqli_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-79-AuditComments Comment='.$row[1],$user,$server_ip,$session_name,$one_mysql_log);
$ACcomments .= $row[1];
$ACcomments .= "\n----------------------------------\n";
$i++;
}
return true;
} else {
return false;
}
}
?>
+1 -646
View File
@@ -1,646 +1 @@
<?php file depricated, integrated into standard admin directory
# qc_api.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to allow API functions for QC applications, contributed by poundteam.com
#
# changes:
# 121116-1329 - First build, added to vicidial codebase
# 130622-0001 - Finalized changing of all ereg instances to preg
# - Added filtering of input to prevent SQL injection attacks and new user auth
# 130902-0906 - Changed to mysqli PHP functions
#
$version = '2.8-3';
$build = '130902-0906';
require("../dbconnect_mysqli.php");
require("../functions.php");
$query_string = getenv("QUERY_STRING");
### 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["agent_user"])) {$agent_user=$_GET["agent_user"];}
elseif (isset($_POST["agent_user"])) {$agent_user=$_POST["agent_user"];}
if (isset($_GET["function"])) {$function=$_GET["function"];}
elseif (isset($_POST["function"])) {$function=$_POST["function"];}
if (isset($_GET["value"])) {$value=$_GET["value"];}
elseif (isset($_POST["value"])) {$value=$_POST["value"];}
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["focus"])) {$focus=$_GET["focus"];}
elseif (isset($_POST["focus"])) {$focus=$_POST["focus"];}
if (isset($_GET["preview"])) {$preview=$_GET["preview"];}
elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];}
if (isset($_GET["notes"])) {$notes=$_GET["notes"];}
elseif (isset($_POST["notes"])) {$notes=$_POST["notes"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["search"])) {$search=$_GET["search"];}
elseif (isset($_POST["search"])) {$search=$_POST["search"];}
if (isset($_GET["group_alias"])) {$group_alias=$_GET["group_alias"];}
elseif (isset($_POST["group_alias"])) {$group_alias=$_POST["group_alias"];}
if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];}
elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];}
if (isset($_GET["source"])) {$source=$_GET["source"];}
elseif (isset($_POST["source"])) {$source=$_POST["source"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["vtiger_callback"])) {$vtiger_callback=$_GET["vtiger_callback"];}
elseif (isset($_POST["vtiger_callback"])) {$vtiger_callback=$_POST["vtiger_callback"];}
if (isset($_GET["blended"])) {$blended=$_GET["blended"];}
elseif (isset($_POST["blended"])) {$blended=$_POST["blended"];}
if (isset($_GET["ingroup_choices"])) {$ingroup_choices=$_GET["ingroup_choices"];}
elseif (isset($_POST["ingroup_choices"])) {$ingroup_choices=$_POST["ingroup_choices"];}
if (isset($_GET["set_as_default"])) {$set_as_default=$_GET["set_as_default"];}
elseif (isset($_POST["set_as_default"])) {$set_as_default=$_POST["set_as_default"];}
if (isset($_GET["alt_user"])) {$alt_user=$_GET["alt_user"];}
elseif (isset($_POST["alt_user"])) {$alt_user=$_POST["alt_user"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];}
elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];}
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_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["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["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["stage"])) {$stage=$_GET["stage"];}
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["close_window_link"])) {$close_window_link=$_GET["close_window_link"];}
elseif (isset($_POST["close_window_link"])) {$close_window_link=$_POST["close_window_link"];}
if (isset($_GET["dnc_check"])) {$dnc_check=$_GET["dnc_check"];}
elseif (isset($_POST["dnc_check"])) {$dnc_check=$_POST["dnc_check"];}
if (isset($_GET["campaign_dnc_check"])) {$campaign_dnc_check=$_GET["campaign_dnc_check"];}
elseif (isset($_POST["campaign_dnc_check"])) {$campaign_dnc_check=$_POST["campaign_dnc_check"];}
if (isset($_GET["dial_override"])) {$dial_override=$_GET["dial_override"];}
elseif (isset($_POST["dial_override"])) {$dial_override=$_POST["dial_override"];}
if (isset($_GET["consultative"])) {$consultative=$_GET["consultative"];}
elseif (isset($_POST["consultative"])) {$consultative=$_POST["consultative"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
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_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
}
##### END SETTINGS LOOKUP #####
###########################################
$ingroup_choices = preg_replace("/\+/"," ",$ingroup_choices);
$query_string = preg_replace("/'|\"|\\\\|;/","",$query_string);
if ($non_latin < 1)
{
$user=preg_replace("/[^0-9a-zA-Z]/","",$user);
$pass=preg_replace("/[^0-9a-zA-Z]/","",$pass);
$agent_user=preg_replace("/[^0-9a-zA-Z]/","",$agent_user);
$function = preg_replace("/[^-\_0-9a-zA-Z]/","",$function);
$value = preg_replace("/[^-\_0-9a-zA-Z]/","",$value);
$vendor_id = preg_replace("/[^-\.\_0-9a-zA-Z]/","",$vendor_id);
$focus = preg_replace("/[^-\_0-9a-zA-Z]/","",$focus);
$preview = preg_replace("/[^-\_0-9a-zA-Z]/","",$preview);
$notes = preg_replace("/\+/"," ",$notes);
$notes = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$notes);
$phone_code = preg_replace("/[^0-9X]/","",$phone_code);
$search = preg_replace("/[^-\_0-9a-zA-Z]/","",$search);
$group_alias = preg_replace("/[^0-9a-zA-Z]/","",$group_alias);
$dial_prefix = preg_replace("/[^0-9a-zA-Z]/","",$dial_prefix);
$source = preg_replace("/[^0-9a-zA-Z]/","",$source);
$format = preg_replace("/[^0-9a-zA-Z]/","",$format);
$vtiger_callback = preg_replace("/[^A-Z]/","",$vtiger_callback);
$alt_dial = preg_replace("/[^0-9A-Z]/","",$alt_dial);
$blended = preg_replace("/[^A-Z]/","",$blended);
$ingroup_choices = preg_replace("/[^- \_0-9a-zA-Z]/","",$ingroup_choices);
$set_as_default = preg_replace("/[^A-Z]/","",$set_as_default);
$phone_number = preg_replace("/[^0-9]/","",$phone_number);
$address1 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address1);
$address2 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address2);
$address3 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address3);
$alt_phone = preg_replace("/[^- \_0-9a-zA-Z]/","",$alt_phone);
$city = preg_replace("/[^- \_0-9a-zA-Z]/","",$city);
$comments = preg_replace("/[^- \_0-9a-zA-Z]/","",$comments);
$country_code = preg_replace("/[^A-Z]/","",$country_code);
$date_of_birth = preg_replace("/[^- \_0-9]/","",$date_of_birth);
$email = preg_replace("/[^-\.\:\/\@\_0-9a-zA-Z]/","",$email);
$first_name = preg_replace("/[^- \_0-9a-zA-Z]/","",$first_name);
$gender = preg_replace("/[^A-Z]/","",$gender);
$gmt_offset_now = preg_replace("/[^- \.\_0-9]/","",$gmt_offset_now);
$last_name = preg_replace("/[^- \_0-9a-zA-Z]/","",$last_name);
$lead_id = preg_replace("/[^0-9]/","",$lead_id);
$middle_initial = preg_replace("/[^- \_0-9a-zA-Z]/","",$middle_initial);
$province = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$province);
$security_phrase = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$security_phrase);
$source_id = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$source_id);
$state = preg_replace("/[^- \_0-9a-zA-Z]/","",$state);
$title = preg_replace("/[^- \_0-9a-zA-Z]/","",$title);
$vendor_lead_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$vendor_lead_code);
$rank = preg_replace("/[^-0-9]/","",$rank);
$owner = preg_replace("/[^-\.\:\/\@\_0-9a-zA-Z]/","",$owner);
$dial_override = preg_replace("/[^A-Z]/","",$dial_override);
$consultative = preg_replace("/[^A-Z]/","",$consultative);
$callback_datetime = preg_replace("/\+/"," ",$callback_datetime);
$callback_datetime = preg_replace("/[^- \:\.\_0-9a-zA-Z]/","",$callback_datetime);
$callback_type = preg_replace("/[^A-Z]/","",$callback_type);
$callback_comments = preg_replace("/\+/"," ",$callback_comments);
$callback_comments = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$callback_comments);
$qm_dispo_code = preg_replace("/[^-\.\_0-9a-zA-Z]/","",$qm_dispo_code);
$alt_user = preg_replace("/[^0-9a-zA-Z]/","",$alt_user);
$postal_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$postal_code);
}
else
{
$user = preg_replace("/'|\"|\\\\|;/","",$user);
$pass = preg_replace("/'|\"|\\\\|;/","",$pass);
$source = preg_replace("/'|\"|\\\\|;/","",$source);
$agent_user = preg_replace("/'|\"|\\\\|;/","",$agent_user);
$alt_user = preg_replace("/'|\"|\\\\|;/","",$alt_user);
}
### date and fixed variables
$epoch = date("U");
$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]='';
$api_script = 'agent';
$api_logging = 1;
if ($consultative != 'YES') {$consultative='NO';}
################################################################################
### BEGIN - version - show version and date information for the API
################################################################################
if ($function == 'version')
{
$data = "VERSION: $version|BUILD: $build|DATE: $NOW_TIME|EPOCH: $StarTtime";
$result = 'SUCCESS';
echo "$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
################################################################################
### END - version
################################################################################
################################################################################
### BEGIN - user validation section (most functions run through this first)
################################################################################
if ($ACTION == 'LogiNCamPaigns')
{
$skip_user_validation=1;
}
else
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$auth=0;
$auth_message = user_authorization($user,$pass,'',0);
if ($auth_message == 'GOOD')
{$auth=1;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$auth_api=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($auth_api==0))
{
$result = 'ERROR';
$result_reason = "Invalid Username/Password";
echo "$result: $result_reason: |$user|$pass|$auth|$auth_api|$auth_message|\n";
$data = "$user|$pass|$auth";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from system_settings where vdc_agent_api_active='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
$result = 'ERROR';
$result_reason = "System API NOT ACTIVE";
echo "$result: $result_reason\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
# do nothing for now
}
}
}
}
if ($format=='debug')
{
$DB=1;
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build USER: $user\n";
echo "<title>VICIDiaL Agent API";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
################################################################################
### END - user validation section
################################################################################
################################################################################
### BEGIN - external_dial_lead - manual dial a specific Lead
################################################################################
if ($function == 'external_dial_lead')
{
$value = preg_replace("/[^0-9]/","",$value);
if ( (strlen($value)<1) or ( (strlen($agent_user)<2) and (strlen($alt_user)<2) ) or (strlen($search)<2) or (strlen($preview)<2) or (strlen($focus)<2) )
{
$result = 'ERROR';
$result_reason = "external_dial not valid";
$data = "$phone_code|$search|$preview|$focus";
echo "$result: $result_reason - $value|$data|$agent_user|$alt_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
if (strlen($alt_user)>1)
{
$stmt = "select count(*) from vicidial_users where custom_three='$alt_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$agent_user = $row[0];
}
else
{
$result = 'ERROR';
$result_reason = "no user found";
echo "$result: $result_reason - $alt_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';";
$rslt=mysql_to_mysqli($stmt, $link);
$vlac_conf_ct = mysqli_num_rows($rslt);
if ($vlac_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vac_campaign_id = $row[0];
}
$stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$vac_campaign_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$vcc_conf_ct = mysqli_num_rows($rslt);
if ($vcc_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$api_manual_dial = $row[0];
}
if ($api_manual_dial=='STANDARD')
{
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status='PAUSED' and lead_id < 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$agent_ready = $row[0];
}
else
{
$agent_ready=1;
}
if ($agent_ready > 0)
{
$stmt = "select count(*) from vicidial_users where user='$agent_user' and agentcall_manual='1';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{
if (strlen($group_alias)>1)
{
$stmt = "select caller_id_number from groups_alias where group_alias_id='$group_alias';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$VDIG_cidnum_ct = mysqli_num_rows($rslt);
if ($VDIG_cidnum_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$caller_id_number = $row[0];
if ($caller_id_number < 4)
{
$result = 'ERROR';
$result_reason = "caller_id_number from group_alias is not valid";
$data = "$group_alias|$caller_id_number";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
else
{
$result = 'ERROR';
$result_reason = "group_alias is not valid";
$data = "$group_alias";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
####### Begin Vtiger CallBack Launching #######
$vtiger_callback_id='';
if ( (preg_match("/YES/i",$vtiger_callback)) and (preg_match("/^99/",$value)) )
{
$value = preg_replace("/^99/",'',$value);
$value = ($value + 0);
$stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
$ss_conf_ct = mysqli_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$enable_vtiger_integration = $row[0];
$vtiger_server_ip = $row[1];
$vtiger_dbname = $row[2];
$vtiger_login = $row[3];
$vtiger_pass = $row[4];
$vtiger_url = $row[5];
}
if ($enable_vtiger_integration > 0)
{
$stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';";
$rslt=mysql_to_mysqli($stmt, $link);
$vtc_camp_ct = mysqli_num_rows($rslt);
if ($vtc_camp_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$campaign_id = $row[0];
}
$stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='$campaign_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$vtc_conf_ct = mysqli_num_rows($rslt);
if ($vtc_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vtiger_search_category = $row[0];
$vtiger_create_call_record = $row[1];
$vtiger_create_lead_record = $row[2];
$vtiger_search_dead = $row[3];
$vtiger_status_call = $row[4];
}
### connect to your vtiger database
$linkV=mysqli_connect("$vtiger_server_ip", "$vtiger_login", "$vtiger_pass", "$vtiger_dbname");
if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysqli_error());}
echo "Connected successfully\n<BR>\n";
# make sure the ID is present in Vtiger database as an account
$stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $linkV);
$vt_act_ct = mysqli_num_rows($rslt);
if ($vt_act_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$activity_check = $row[0];
}
if ($activity_check > 0)
{
$stmt="SELECT crmid from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $linkV);
$vt_actsel_ct = mysqli_num_rows($rslt);
if ($vt_actsel_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vendor_id = $row[0];
}
if (strlen($vendor_id) > 0)
{
$stmt="SELECT phone from vtiger_account where accountid='$vendor_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $linkV);
$vt_acct_ct = mysqli_num_rows($rslt);
if ($vt_acct_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vtiger_callback_id="$value";
$value = $row[0];
}
}
}
else
{
$result = 'ERROR';
$result_reason = "vtiger callback activity does not exist in vtiger system";
echo "$result: $result_reason - $value\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
}
####### End Vtiger CallBack Launching #######
$success=0;
### If no errors, run the update to place the call ###
if ($api_manual_dial=='STANDARD')
{
$stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$success=1;
}
else
{
$stmt = "select count(*) from vicidial_manual_dial_queue where user='$agent_user' and phone_number='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] < 1)
{
$stmt="INSERT INTO vicidial_manual_dial_queue set user='$agent_user',phone_number='$value',entry_time=NOW(),status='READY',external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id';";
if ($DB) {echo "$stmt\n";}
$success=1;
}
else
{
$result = 'ERROR';
$result_reason = "phone_number is already in this agents manual dial queue";
echo "$result: $result_reason - $agent_user|$value\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
if ($success > 0)
{
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_dial function set";
$data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias|$caller_id_number";
echo "$result: Dispo in Agent Screen FIRST.\n";
// echo "$result: $result_reason - $value|$agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not allowed to place manual dial calls";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not paused";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
// external_dial
################################################################################
### END - external_dial
################################################################################
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
##### FUNCTIONS #####
##### Logging #####
function api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data)
{
if ($api_logging > 0)
{
$NOW_TIME = date("Y-m-d H:i:s");
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$agent_user',function='$function',value='$value',result='$result',result_reason='$result_reason',source='$source',data='$data',api_date='$NOW_TIME',api_script='$api_script';";
$rslt=mysql_to_mysqli($stmt, $link);
}
return 1;
}
?>
File diff suppressed because it is too large Load Diff
+646
View File
@@ -0,0 +1,646 @@
<?php
# qc_api.php
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to allow API functions for QC applications, contributed by poundteam.com
#
# changes:
# 121116-1329 - First build, added to vicidial codebase
# 130622-0001 - Finalized changing of all ereg instances to preg
# - Added filtering of input to prevent SQL injection attacks and new user auth
# 130902-0906 - Changed to mysqli PHP functions
# 140706-0834 - Incorporated into standard admin code
#
$version = '2.10-4';
$build = '140706-0834';
require("dbconnect_mysqli.php");
require("functions.php");
$query_string = getenv("QUERY_STRING");
### 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["agent_user"])) {$agent_user=$_GET["agent_user"];}
elseif (isset($_POST["agent_user"])) {$agent_user=$_POST["agent_user"];}
if (isset($_GET["function"])) {$function=$_GET["function"];}
elseif (isset($_POST["function"])) {$function=$_POST["function"];}
if (isset($_GET["value"])) {$value=$_GET["value"];}
elseif (isset($_POST["value"])) {$value=$_POST["value"];}
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["focus"])) {$focus=$_GET["focus"];}
elseif (isset($_POST["focus"])) {$focus=$_POST["focus"];}
if (isset($_GET["preview"])) {$preview=$_GET["preview"];}
elseif (isset($_POST["preview"])) {$preview=$_POST["preview"];}
if (isset($_GET["notes"])) {$notes=$_GET["notes"];}
elseif (isset($_POST["notes"])) {$notes=$_POST["notes"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["search"])) {$search=$_GET["search"];}
elseif (isset($_POST["search"])) {$search=$_POST["search"];}
if (isset($_GET["group_alias"])) {$group_alias=$_GET["group_alias"];}
elseif (isset($_POST["group_alias"])) {$group_alias=$_POST["group_alias"];}
if (isset($_GET["dial_prefix"])) {$dial_prefix=$_GET["dial_prefix"];}
elseif (isset($_POST["dial_prefix"])) {$dial_prefix=$_POST["dial_prefix"];}
if (isset($_GET["source"])) {$source=$_GET["source"];}
elseif (isset($_POST["source"])) {$source=$_POST["source"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["vtiger_callback"])) {$vtiger_callback=$_GET["vtiger_callback"];}
elseif (isset($_POST["vtiger_callback"])) {$vtiger_callback=$_POST["vtiger_callback"];}
if (isset($_GET["blended"])) {$blended=$_GET["blended"];}
elseif (isset($_POST["blended"])) {$blended=$_POST["blended"];}
if (isset($_GET["ingroup_choices"])) {$ingroup_choices=$_GET["ingroup_choices"];}
elseif (isset($_POST["ingroup_choices"])) {$ingroup_choices=$_POST["ingroup_choices"];}
if (isset($_GET["set_as_default"])) {$set_as_default=$_GET["set_as_default"];}
elseif (isset($_POST["set_as_default"])) {$set_as_default=$_POST["set_as_default"];}
if (isset($_GET["alt_user"])) {$alt_user=$_GET["alt_user"];}
elseif (isset($_POST["alt_user"])) {$alt_user=$_POST["alt_user"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["vendor_lead_code"])) {$vendor_lead_code=$_GET["vendor_lead_code"];}
elseif (isset($_POST["vendor_lead_code"])) {$vendor_lead_code=$_POST["vendor_lead_code"];}
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_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["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["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["stage"])) {$stage=$_GET["stage"];}
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["close_window_link"])) {$close_window_link=$_GET["close_window_link"];}
elseif (isset($_POST["close_window_link"])) {$close_window_link=$_POST["close_window_link"];}
if (isset($_GET["dnc_check"])) {$dnc_check=$_GET["dnc_check"];}
elseif (isset($_POST["dnc_check"])) {$dnc_check=$_POST["dnc_check"];}
if (isset($_GET["campaign_dnc_check"])) {$campaign_dnc_check=$_GET["campaign_dnc_check"];}
elseif (isset($_POST["campaign_dnc_check"])) {$campaign_dnc_check=$_POST["campaign_dnc_check"];}
if (isset($_GET["dial_override"])) {$dial_override=$_GET["dial_override"];}
elseif (isset($_POST["dial_override"])) {$dial_override=$_POST["dial_override"];}
if (isset($_GET["consultative"])) {$consultative=$_GET["consultative"];}
elseif (isset($_POST["consultative"])) {$consultative=$_POST["consultative"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
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_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
}
##### END SETTINGS LOOKUP #####
###########################################
$ingroup_choices = preg_replace("/\+/"," ",$ingroup_choices);
$query_string = preg_replace("/'|\"|\\\\|;/","",$query_string);
if ($non_latin < 1)
{
$user=preg_replace("/[^0-9a-zA-Z]/","",$user);
$pass=preg_replace("/[^0-9a-zA-Z]/","",$pass);
$agent_user=preg_replace("/[^0-9a-zA-Z]/","",$agent_user);
$function = preg_replace("/[^-\_0-9a-zA-Z]/","",$function);
$value = preg_replace("/[^-\_0-9a-zA-Z]/","",$value);
$vendor_id = preg_replace("/[^-\.\_0-9a-zA-Z]/","",$vendor_id);
$focus = preg_replace("/[^-\_0-9a-zA-Z]/","",$focus);
$preview = preg_replace("/[^-\_0-9a-zA-Z]/","",$preview);
$notes = preg_replace("/\+/"," ",$notes);
$notes = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$notes);
$phone_code = preg_replace("/[^0-9X]/","",$phone_code);
$search = preg_replace("/[^-\_0-9a-zA-Z]/","",$search);
$group_alias = preg_replace("/[^0-9a-zA-Z]/","",$group_alias);
$dial_prefix = preg_replace("/[^0-9a-zA-Z]/","",$dial_prefix);
$source = preg_replace("/[^0-9a-zA-Z]/","",$source);
$format = preg_replace("/[^0-9a-zA-Z]/","",$format);
$vtiger_callback = preg_replace("/[^A-Z]/","",$vtiger_callback);
$alt_dial = preg_replace("/[^0-9A-Z]/","",$alt_dial);
$blended = preg_replace("/[^A-Z]/","",$blended);
$ingroup_choices = preg_replace("/[^- \_0-9a-zA-Z]/","",$ingroup_choices);
$set_as_default = preg_replace("/[^A-Z]/","",$set_as_default);
$phone_number = preg_replace("/[^0-9]/","",$phone_number);
$address1 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address1);
$address2 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address2);
$address3 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address3);
$alt_phone = preg_replace("/[^- \_0-9a-zA-Z]/","",$alt_phone);
$city = preg_replace("/[^- \_0-9a-zA-Z]/","",$city);
$comments = preg_replace("/[^- \_0-9a-zA-Z]/","",$comments);
$country_code = preg_replace("/[^A-Z]/","",$country_code);
$date_of_birth = preg_replace("/[^- \_0-9]/","",$date_of_birth);
$email = preg_replace("/[^-\.\:\/\@\_0-9a-zA-Z]/","",$email);
$first_name = preg_replace("/[^- \_0-9a-zA-Z]/","",$first_name);
$gender = preg_replace("/[^A-Z]/","",$gender);
$gmt_offset_now = preg_replace("/[^- \.\_0-9]/","",$gmt_offset_now);
$last_name = preg_replace("/[^- \_0-9a-zA-Z]/","",$last_name);
$lead_id = preg_replace("/[^0-9]/","",$lead_id);
$middle_initial = preg_replace("/[^- \_0-9a-zA-Z]/","",$middle_initial);
$province = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$province);
$security_phrase = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$security_phrase);
$source_id = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$source_id);
$state = preg_replace("/[^- \_0-9a-zA-Z]/","",$state);
$title = preg_replace("/[^- \_0-9a-zA-Z]/","",$title);
$vendor_lead_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$vendor_lead_code);
$rank = preg_replace("/[^-0-9]/","",$rank);
$owner = preg_replace("/[^-\.\:\/\@\_0-9a-zA-Z]/","",$owner);
$dial_override = preg_replace("/[^A-Z]/","",$dial_override);
$consultative = preg_replace("/[^A-Z]/","",$consultative);
$callback_datetime = preg_replace("/\+/"," ",$callback_datetime);
$callback_datetime = preg_replace("/[^- \:\.\_0-9a-zA-Z]/","",$callback_datetime);
$callback_type = preg_replace("/[^A-Z]/","",$callback_type);
$callback_comments = preg_replace("/\+/"," ",$callback_comments);
$callback_comments = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$callback_comments);
$qm_dispo_code = preg_replace("/[^-\.\_0-9a-zA-Z]/","",$qm_dispo_code);
$alt_user = preg_replace("/[^0-9a-zA-Z]/","",$alt_user);
$postal_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$postal_code);
}
else
{
$user = preg_replace("/'|\"|\\\\|;/","",$user);
$pass = preg_replace("/'|\"|\\\\|;/","",$pass);
$source = preg_replace("/'|\"|\\\\|;/","",$source);
$agent_user = preg_replace("/'|\"|\\\\|;/","",$agent_user);
$alt_user = preg_replace("/'|\"|\\\\|;/","",$alt_user);
}
### date and fixed variables
$epoch = date("U");
$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]='';
$api_script = 'agent';
$api_logging = 1;
if ($consultative != 'YES') {$consultative='NO';}
################################################################################
### BEGIN - version - show version and date information for the API
################################################################################
if ($function == 'version')
{
$data = "VERSION: $version|BUILD: $build|DATE: $NOW_TIME|EPOCH: $StarTtime";
$result = 'SUCCESS';
echo "$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
################################################################################
### END - version
################################################################################
################################################################################
### BEGIN - user validation section (most functions run through this first)
################################################################################
if ($ACTION == 'LogiNCamPaigns')
{
$skip_user_validation=1;
}
else
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$auth=0;
$auth_message = user_authorization($user,$pass,'',0);
if ($auth_message == 'GOOD')
{$auth=1;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$auth_api=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($auth_api==0))
{
$result = 'ERROR';
$result_reason = "Invalid Username/Password";
echo "$result: $result_reason: |$user|$pass|$auth|$auth_api|$auth_message|\n";
$data = "$user|$pass|$auth";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT count(*) from system_settings where vdc_agent_api_active='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
$result = 'ERROR';
$result_reason = "System API NOT ACTIVE";
echo "$result: $result_reason\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
# do nothing for now
}
}
}
}
if ($format=='debug')
{
$DB=1;
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build USER: $user\n";
echo "<title>VICIDiaL Agent API";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
################################################################################
### END - user validation section
################################################################################
################################################################################
### BEGIN - external_dial_lead - manual dial a specific Lead
################################################################################
if ($function == 'external_dial_lead')
{
$value = preg_replace("/[^0-9]/","",$value);
if ( (strlen($value)<1) or ( (strlen($agent_user)<2) and (strlen($alt_user)<2) ) or (strlen($search)<2) or (strlen($preview)<2) or (strlen($focus)<2) )
{
$result = 'ERROR';
$result_reason = "external_dial not valid";
$data = "$phone_code|$search|$preview|$focus";
echo "$result: $result_reason - $value|$data|$agent_user|$alt_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
if (strlen($alt_user)>1)
{
$stmt = "select count(*) from vicidial_users where custom_three='$alt_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "select user from vicidial_users where custom_three='$alt_user' order by user;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$agent_user = $row[0];
}
else
{
$result = 'ERROR';
$result_reason = "no user found";
echo "$result: $result_reason - $alt_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';";
$rslt=mysql_to_mysqli($stmt, $link);
$vlac_conf_ct = mysqli_num_rows($rslt);
if ($vlac_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vac_campaign_id = $row[0];
}
$stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$vac_campaign_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$vcc_conf_ct = mysqli_num_rows($rslt);
if ($vcc_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$api_manual_dial = $row[0];
}
if ($api_manual_dial=='STANDARD')
{
$stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status='PAUSED' and lead_id < 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$agent_ready = $row[0];
}
else
{
$agent_ready=1;
}
if ($agent_ready > 0)
{
$stmt = "select count(*) from vicidial_users where user='$agent_user' and agentcall_manual='1';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{
if (strlen($group_alias)>1)
{
$stmt = "select caller_id_number from groups_alias where group_alias_id='$group_alias';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$VDIG_cidnum_ct = mysqli_num_rows($rslt);
if ($VDIG_cidnum_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$caller_id_number = $row[0];
if ($caller_id_number < 4)
{
$result = 'ERROR';
$result_reason = "caller_id_number from group_alias is not valid";
$data = "$group_alias|$caller_id_number";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
else
{
$result = 'ERROR';
$result_reason = "group_alias is not valid";
$data = "$group_alias";
echo "$result: $result_reason - $agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
####### Begin Vtiger CallBack Launching #######
$vtiger_callback_id='';
if ( (preg_match("/YES/i",$vtiger_callback)) and (preg_match("/^99/",$value)) )
{
$value = preg_replace("/^99/",'',$value);
$value = ($value + 0);
$stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
$ss_conf_ct = mysqli_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$enable_vtiger_integration = $row[0];
$vtiger_server_ip = $row[1];
$vtiger_dbname = $row[2];
$vtiger_login = $row[3];
$vtiger_pass = $row[4];
$vtiger_url = $row[5];
}
if ($enable_vtiger_integration > 0)
{
$stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';";
$rslt=mysql_to_mysqli($stmt, $link);
$vtc_camp_ct = mysqli_num_rows($rslt);
if ($vtc_camp_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$campaign_id = $row[0];
}
$stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='$campaign_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$vtc_conf_ct = mysqli_num_rows($rslt);
if ($vtc_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vtiger_search_category = $row[0];
$vtiger_create_call_record = $row[1];
$vtiger_create_lead_record = $row[2];
$vtiger_search_dead = $row[3];
$vtiger_status_call = $row[4];
}
### connect to your vtiger database
$linkV=mysqli_connect("$vtiger_server_ip", "$vtiger_login", "$vtiger_pass", "$vtiger_dbname");
if (!$linkV) {die("Could not connect: $vtiger_server_ip|$vtiger_dbname|$vtiger_login|$vtiger_pass" . mysqli_error());}
echo "Connected successfully\n<BR>\n";
# make sure the ID is present in Vtiger database as an account
$stmt="SELECT count(*) from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $linkV);
$vt_act_ct = mysqli_num_rows($rslt);
if ($vt_act_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$activity_check = $row[0];
}
if ($activity_check > 0)
{
$stmt="SELECT crmid from vtiger_seactivityrel where activityid='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $linkV);
$vt_actsel_ct = mysqli_num_rows($rslt);
if ($vt_actsel_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vendor_id = $row[0];
}
if (strlen($vendor_id) > 0)
{
$stmt="SELECT phone from vtiger_account where accountid='$vendor_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $linkV);
$vt_acct_ct = mysqli_num_rows($rslt);
if ($vt_acct_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$vtiger_callback_id="$value";
$value = $row[0];
}
}
}
else
{
$result = 'ERROR';
$result_reason = "vtiger callback activity does not exist in vtiger system";
echo "$result: $result_reason - $value\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
}
####### End Vtiger CallBack Launching #######
$success=0;
### If no errors, run the update to place the call ###
if ($api_manual_dial=='STANDARD')
{
$stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' where user='$agent_user';";
if ($DB) {echo "$stmt\n";}
$success=1;
}
else
{
$stmt = "select count(*) from vicidial_manual_dial_queue where user='$agent_user' and phone_number='$value';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] < 1)
{
$stmt="INSERT INTO vicidial_manual_dial_queue set user='$agent_user',phone_number='$value',entry_time=NOW(),status='READY',external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id';";
if ($DB) {echo "$stmt\n";}
$success=1;
}
else
{
$result = 'ERROR';
$result_reason = "phone_number is already in this agents manual dial queue";
echo "$result: $result_reason - $agent_user|$value\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
if ($success > 0)
{
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_to_mysqli($stmt, $link);
$result = 'SUCCESS';
$result_reason = "external_dial function set";
$data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias|$caller_id_number";
echo "$result: Dispo in Agent Screen FIRST.\n";
// echo "$result: $result_reason - $value|$agent_user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not allowed to place manual dial calls";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not paused";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'ERROR';
$result_reason = "agent_user is not logged in";
echo "$result: $result_reason - $agent_user\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
}
// external_dial
################################################################################
### END - external_dial
################################################################################
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
##### FUNCTIONS #####
##### Logging #####
function api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data)
{
if ($api_logging > 0)
{
$NOW_TIME = date("Y-m-d H:i:s");
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$agent_user',function='$function',value='$value',result='$result',result_reason='$result_reason',source='$source',data='$data',api_date='$NOW_TIME',api_script='$api_script';";
$rslt=mysql_to_mysqli($stmt, $link);
}
return 1;
}
?>
+294
View File
@@ -0,0 +1,294 @@
<?php
# qc_call_client_iframe.php
#
# ViciDial database administration modify lead in vicidial_list
#
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to allow QC review and modification of leads, contributed by poundteam.com
#
# changes:
# 121116-1328 - First build, added to vicidial codebase
# 130621-2352 - Finalized changing of all ereg instances to preg
# - Added filtering of input to prevent SQL injection attacks and new user auth
# 130902-0905 - Changed to mysqli PHP functions
# 140706-0826 - Incorporated includes into code
#
require("dbconnect_mysqli.php");
require("functions.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["old_phone"])) {$old_phone=$_GET["old_phone"];}
elseif (isset($_POST["old_phone"])) {$old_phone=$_POST["old_phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
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["lead_name"])) {$lead_name=$_GET["lead_name"];}
elseif (isset($_POST["lead_name"])) {$lead_name=$_POST["lead_name"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];}
elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];}
elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];}
if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];}
elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];}
if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];}
elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];}
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["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
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"])) {$security=$_GET["security"];}
elseif (isset($_POST["security"])) {$security=$_POST["security"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
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["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];}
elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];}
if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];}
elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];}
if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];}
elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];}
if (isset($_GET["CBchangeDATE"])) {$CBchangeDATE=$_GET["CBchangeDATE"];}
elseif (isset($_POST["CBchangeDATE"])) {$CBchangeDATE=$_POST["CBchangeDATE"];}
if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];}
elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];}
if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];}
elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];}
if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];}
elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];}
if (isset($_GET["modify_closer_logs"])) {$modify_closer_logs=$_GET["modify_closer_logs"];}
elseif (isset($_POST["modify_closer_logs"])) {$modify_closer_logs=$_POST["modify_closer_logs"];}
if (isset($_GET["modify_agent_logs"])) {$modify_agent_logs=$_GET["modify_agent_logs"];}
elseif (isset($_POST["modify_agent_logs"])) {$modify_agent_logs=$_POST["modify_agent_logs"];}
if (isset($_GET["add_closer_record"])) {$add_closer_record=$_GET["add_closer_record"];}
elseif (isset($_POST["add_closer_record"])) {$add_closer_record=$_POST["add_closer_record"];}
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"];}
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
$custom_fields_enabled = $row[1];
}
##### END SETTINGS LOOKUP #####
###########################################
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
if ($non_latin < 1)
{
$PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/','',$PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/','',$PHP_AUTH_PW);
$old_phone = preg_replace('/[^0-9]/','',$old_phone);
$phone_number = preg_replace('/[^0-9]/','',$phone_number);
$alt_phone = preg_replace('/[^0-9]/','',$alt_phone);
} # end of non_latin
else
{
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
}
if (strlen($phone_number)<6) {$phone_number=$old_phone;}
$auth=0;
$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'QC',1);
if ($auth_message == 'GOOD')
{$auth=1;}
if ($auth < 1)
{
$VDdisplayMESSAGE = "Login incorrect, please try again";
if ($auth_message == 'LOCK')
{
$VDdisplayMESSAGE = "Too many login attempts, try again in 15 minutes";
Header ("Content-type: text/html; charset=utf-8");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
exit;
}
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
exit;
}
$rights_stmt = "SELECT modify_leads,qc_enabled,qc_user_level from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rights_rslt=mysql_to_mysqli($rights_stmt, $link);
$rights_row=mysqli_fetch_row($rights_rslt);
$modify_leads = $rights_row[0];
$qc_enabled = $rights_row[1];
$qc_user_level = $rights_row[2];
if ( $qc_enabled < 1 )
{
header ("Content-type: text/html; charset=utf-8");
echo "QC is not enabled for your user account\n";
exit;
}
if ( $qc_user_level < 1 )
{
header ("Content-type: text/html; charset=utf-8");
echo "QC user level is too low\n";
exit;
}
$label_title = 'Title';
$label_first_name = 'First';
$label_middle_initial = 'MI';
$label_last_name = 'Last';
$label_address1 = 'Address1';
$label_address2 = 'Address2';
$label_address3 = 'Address3';
$label_city = 'City';
$label_state = 'State';
$label_province = 'Province';
$label_postal_code = 'Postal Code';
$label_vendor_lead_code = 'Vendor ID';
$label_gender = 'Gender';
$label_phone_number = 'Phone';
$label_phone_code = 'DialCode';
$label_alt_phone = 'Alt. Phone';
$label_security_phrase = 'Show';
$label_email = 'Email';
$label_comments = 'Comments';
### find any custom field labels
$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_to_mysqli($stmt, $link);
$row=mysqli_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];}
//Is logged in admin user also logged in as an agent?
function is_user_logged_in($user)
{
global $link;
$stmt="select status from vicidial_live_agents where user='$user'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$live_agent_count = mysqli_num_rows($rslt);
if($live_agent_count != '1')
{
if($live_agent_count == '0')
{
return "Cannot call prospect. You are not logged in as $user.";
}
else
{
return "Cannot call prospect. $live_agent_count agents logged in as $user.";
}
}
$row=mysqli_fetch_row($rslt);
$status = $row[0];
if($status!='PAUSED')
{
return "Status must be paused to call lead. $user is presently in $status status.";
}
//@TODO: check user is in the correct CAMPAIGN for this lead.
return true;
}
$qc_user_logged_in=is_user_logged_in($PHP_AUTH_USER);
if ($qc_user_logged_in===true)
{
echo "<A HREF=qc_api.php?source=test&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&agent_user=$PHP_AUTH_USER&function=external_dial_lead&value=$phone_number&phone_code=$phone_code&search=YES&preview=NO&focus=YES target='_SELF'>Call Lead</A>";
}
else
{
echo "$qc_user_logged_in";
}
echo "&nbsp;<A HREF=$PHP_SELF?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6>Refresh</A>";
?>
File diff suppressed because it is too large Load Diff