Added ALT Multi Dispo URL option to restrict URL sending by list ID.

Added Admin Bulk Tools page, linked from Admin Utilities page.

git-svn-id: svn://192.168.202.10@2575 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2016-08-02 01:25:44 +00:00
parent 44d463cdb6
commit 41a8ccbc43
5 changed files with 2252 additions and 24 deletions
+2
View File
@@ -284,6 +284,8 @@ OTHER CHANGES:
77. Added ALT Multi Dispo URL option to restrict URL sending by list ID. 77. Added ALT Multi Dispo URL option to restrict URL sending by list ID.
78. Added Admin Bulk Tools page, linked from Admin Utilities page
+38 -21
View File
@@ -19,7 +19,7 @@
# VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=10411099&sale_status=SALE---SSALE---XSALE&reset_dialed=Y&log_to_file=1 # VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=10411099&sale_status=SALE---SSALE---XSALE&reset_dialed=Y&log_to_file=1
# #
# Another example of what to put in the Dispo URL field(using status exclude with talk trigger): # Another example of what to put in the Dispo URL field(using status exclude with talk trigger):
# VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&talk_time=--A--talk_time--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=332&sale_status=DNC---BILLNW---POST&exclude_status=Y&talk_time_trigger=240&log_to_file=1 # VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&talk_time=--A--talk_time--B--&called_count=--A--called_count--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=332&sale_status=DNC---BILLNW---POST&exclude_status=Y&talk_time_trigger=240&called_count_trigger=4&log_to_file=1
# #
# Example of what to put in the No Agent Call URL field: # Example of what to put in the No Agent Call URL field:
# (user needs to be NOAGENTURL and pass needs to be set to the call_id) # (user needs to be NOAGENTURL and pass needs to be set to the call_id)
@@ -30,10 +30,11 @@
# - sale_status - (SALE---XSALE) a triple-dash "---" delimited list of the statuses that are to be moved # - sale_status - (SALE---XSALE) a triple-dash "---" delimited list of the statuses that are to be moved
# - exclude_status - (Y,N) if set to Y, will trigger for all statuses EXCEPT for those listed in sale_status, default is N # - exclude_status - (Y,N) if set to Y, will trigger for all statuses EXCEPT for those listed in sale_status, default is N
# - talk_time_trigger - (0,1,2,3,...) if set to number greater than 0, will only trigger for talk_time at or above set number, default is 0 # - talk_time_trigger - (0,1,2,3,...) if set to number greater than 0, will only trigger for talk_time at or above set number, default is 0
# - called_count_trigger - (1,2,3,...) if set to number greater than 0, will only trigger for called_count at or above set number, default is 0
# - new_list_id - (999,etc...) the list_id that you want the matching status leads to be moved to # - new_list_id - (999,etc...) the list_id that you want the matching status leads to be moved to
# - reset_dialed - (Y,N) if set to Y, will reset the called_since_last_reset flag on the lead # - reset_dialed - (Y,N) if set to Y, will reset the called_since_last_reset flag on the lead
# Multiple sets of statuses: # Multiple sets of statuses:
# - sale_status_1, new_list_id_1, reset_dialed_1, exclude_status_1 - adding an underscore and number(1-99) will allow for another set of statuses to check for and what to do with them # - sale_status_1, new_list_id_1, reset_dialed_1, exclude_status_1, called_count_trigger_1 - adding an underscore and number(1-99) will allow for another set of statuses to check for and what to do with them
# #
# CHANGES # CHANGES
# 100915-1600 - First Build # 100915-1600 - First Build
@@ -48,9 +49,10 @@
# 141216-2110 - Added language settings lookups and user/pass variable standardization # 141216-2110 - Added language settings lookups and user/pass variable standardization
# 150703-1453 - Added options so it would work with No-Agent Call URL # 150703-1453 - Added options so it would work with No-Agent Call URL
# 160309-1239 - Added talk_time_trigger and exclude_status options # 160309-1239 - Added talk_time_trigger and exclude_status options
# 160801-1032 - Added called_count_trigger options
# #
$api_script = 'deactivate'; $api_script = 'movelist';
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
@@ -81,6 +83,10 @@ if (isset($_GET["talk_time"])) {$talk_time=$_GET["talk_time"];}
elseif (isset($_POST["talk_time"])) {$talk_time=$_POST["talk_time"];} elseif (isset($_POST["talk_time"])) {$talk_time=$_POST["talk_time"];}
if (isset($_GET["talk_time_trigger"])) {$talk_time_trigger=$_GET["talk_time_trigger"];} if (isset($_GET["talk_time_trigger"])) {$talk_time_trigger=$_GET["talk_time_trigger"];}
elseif (isset($_POST["talk_time_trigger"])) {$talk_time_trigger=$_POST["talk_time_trigger"];} elseif (isset($_POST["talk_time_trigger"])) {$talk_time_trigger=$_POST["talk_time_trigger"];}
if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];}
elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];}
if (isset($_GET["called_count_trigger"])) {$called_count_trigger=$_GET["called_count_trigger"];}
elseif (isset($_POST["called_count_trigger"])) {$called_count_trigger=$_POST["called_count_trigger"];}
if (isset($_GET["user"])) {$user=$_GET["user"];} if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
@@ -139,14 +145,17 @@ if ($non_latin < 1)
$user=preg_replace("/[^-_0-9a-zA-Z]/","",$user); $user=preg_replace("/[^-_0-9a-zA-Z]/","",$user);
} }
if ($DB>0) {echo "$lead_id|$search_field|$campaign_check|$sale_status|$dispo|$new_status|$user|$pass|$DB|$log_to_file|$talk_time|$talk_time_trigger|$exclude_status|\n";} if ($DB>0) {echo "$lead_id|$search_field|$campaign_check|$sale_status|$dispo|$new_status|$user|$pass|$DB|$log_to_file|$talk_time|$talk_time_trigger|$exclude_status|$called_count|$called_count_trigger|\n";}
if ( ( (strlen($talk_time_trigger)>0) and ($talk_time > $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) ) if ( ( (strlen($called_count_trigger)>0) and ($called_count >= $called_count_trigger) ) or (strlen($called_count_trigger)<1) or ($called_count_trigger < 1) )
{ {
if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) ) if ( ( (strlen($talk_time_trigger)>0) and ($talk_time >= $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) )
{$primary_match_found=1;} {
if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) )
{$primary_match_found=1;}
}
} }
$first_pass_vars = "$new_list_id|$reset_dialed|$sale_status|$talk_time_trigger|$exclude_status"; $first_pass_vars = "$new_list_id|$reset_dialed|$sale_status|$talk_time_trigger|$exclude_status$called_count_trigger|";
if ($primary_match_found > 0) if ($primary_match_found > 0)
{$match_found=1;} {$match_found=1;}
else else
@@ -154,6 +163,7 @@ else
$sale_status=''; $sale_status='';
$exclude_status=''; $exclude_status='';
$talk_time_trigger=''; $talk_time_trigger='';
$called_count_trigger='';
$new_list_id=''; $new_list_id='';
$reset_dialed=''; $reset_dialed='';
while( ($match_found < 1) and ($k < 99) ) while( ($match_found < 1) and ($k < 99) )
@@ -162,33 +172,40 @@ else
$sale_status=''; $sale_status='';
$exclude_status=''; $exclude_status='';
$talk_time_trigger=''; $talk_time_trigger='';
$called_count_trigger='';
$statusfield = "sale_status_$k"; $statusfield = "sale_status_$k";
$excludefield = "exclude_status_$k"; $excludefield = "exclude_status_$k";
$talktriggerfield = "talk_time_trigger_$k"; $talktriggerfield = "talk_time_trigger_$k";
$counttriggerfield = "called_count_trigger_$k";
if (isset($_GET["$excludefield"])) {$exclude_status=$_GET["$excludefield"];} if (isset($_GET["$excludefield"])) {$exclude_status=$_GET["$excludefield"];}
elseif (isset($_POST["$excludefield"])) {$exclude_status=$_POST["$excludefield"];} elseif (isset($_POST["$excludefield"])) {$exclude_status=$_POST["$excludefield"];}
if (isset($_GET["$talktriggerfield"])) {$talk_time_trigger=$_GET["$talktriggerfield"];} if (isset($_GET["$talktriggerfield"])) {$talk_time_trigger=$_GET["$talktriggerfield"];}
elseif (isset($_POST["$talktriggerfield"])) {$talk_time_trigger=$_POST["$talktriggerfield"];} elseif (isset($_POST["$talktriggerfield"])) {$talk_time_trigger=$_POST["$talktriggerfield"];}
if (isset($_GET["$counttriggerfield"])) {$called_count_trigger=$_GET["$counttriggerfield"];}
elseif (isset($_POST["$counttriggerfield"])) {$called_count_trigger=$_POST["$counttriggerfield"];}
if (isset($_GET["$statusfield"])) {$sale_status=$_GET["$statusfield"];} if (isset($_GET["$statusfield"])) {$sale_status=$_GET["$statusfield"];}
elseif (isset($_POST["$statusfield"])) {$sale_status=$_POST["$statusfield"];} elseif (isset($_POST["$statusfield"])) {$sale_status=$_POST["$statusfield"];}
$sale_status = "$TD$sale_status$TD"; $sale_status = "$TD$sale_status$TD";
if ($DB) {echo _QXZ("MULTI_MATCH CHECK:")." $k|$sale_status|$statusfield|$exclude_status|$excludefield|$talk_time_trigger|$talktriggerfield|\n";} if ($DB) {echo _QXZ("MULTI_MATCH CHECK:")." $k|$sale_status|$statusfield|$exclude_status|$excludefield|$talk_time_trigger|$talktriggerfield|$called_count_trigger|$counttriggerfield|\n";}
if ( ( (strlen($talk_time_trigger)>0) and ($talk_time > $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) ) if ( ( (strlen($called_count_trigger)>0) and ($called_count >= $called_count_trigger) ) or (strlen($called_count_trigger)<1) or ($called_count_trigger < 1) )
{ {
if (strlen($sale_status)>0) if ( ( (strlen($talk_time_trigger)>0) and ($talk_time >= $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) )
{ {
if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) ) if (strlen($sale_status)>0)
{ {
$match_found=1; if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) )
$newlistfield = "new_list_id_$k"; {
$resetfield = "reset_dialed_$k"; $match_found=1;
if (isset($_GET["$newlistfield"])) {$new_list_id=$_GET["$newlistfield"];} $newlistfield = "new_list_id_$k";
elseif (isset($_POST["$newlistfield"])) {$new_list_id=$_POST["$newlistfield"];} $resetfield = "reset_dialed_$k";
if (isset($_GET["$resetfield"])) {$reset_dialed=$_GET["$resetfield"];} if (isset($_GET["$newlistfield"])) {$new_list_id=$_GET["$newlistfield"];}
elseif (isset($_POST["$resetfield"])) {$reset_dialed=$_POST["$resetfield"];} elseif (isset($_POST["$newlistfield"])) {$new_list_id=$_POST["$newlistfield"];}
if ($DB) {echo _QXZ("MULTI_MATCH:")." $k|$sale_status|$new_list_id|$reset_dialed|$exclude_status|$talk_time_trigger|\n";} if (isset($_GET["$resetfield"])) {$reset_dialed=$_GET["$resetfield"];}
elseif (isset($_POST["$resetfield"])) {$reset_dialed=$_POST["$resetfield"];}
if ($DB) {echo _QXZ("MULTI_MATCH:")." $k|$sale_status|$new_list_id|$reset_dialed|$exclude_status|$talk_time_trigger|$called_count_trigger|\n";}
}
} }
} }
} }
@@ -318,6 +335,6 @@ else
if ($log_to_file > 0) if ($log_to_file > 0)
{ {
$fp = fopen ("./dispo_move_list.txt", "a"); $fp = fopen ("./dispo_move_list.txt", "a");
fwrite ($fp, "$NOW_TIME|$k|$lead_id|$dispo|$user|XXXX|$DB|$log_to_file|$talk_time|$first_pass_vars|$new_list_id|$sale_status|$talk_time_trigger|$exclude_status|$MESSAGE|\n"); fwrite ($fp, "$NOW_TIME|$k|$lead_id|$dispo|$user|XXXX|$DB|$log_to_file|$talk_time|$called_count|$first_pass_vars|$new_list_id|$sale_status|$talk_time_trigger|$exclude_status|$called_count_trigger|$MESSAGE|\n");
fclose($fp); fclose($fp);
} }
+4 -3
View File
@@ -3848,12 +3848,13 @@ else
# 160621-1733 - Added agent_screen_colors and script_remove_js settings to system settings # 160621-1733 - Added agent_screen_colors and script_remove_js settings to system settings
# 160708-0745 - Added more Automatic Hopper Multiplier options, up to 4 # 160708-0745 - Added more Automatic Hopper Multiplier options, up to 4
# 160731-1026 - Added campaign option to automatically manual dial next number in agent screen after X seconds # 160731-1026 - Added campaign option to automatically manual dial next number in agent screen after X seconds
# 160801-2119 - Added Admin Bulk Tools page link from Admin Utilities page
# #
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 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 9 to access this page the first time
$admin_version = '2.12-562a'; $admin_version = '2.12-563a';
$build = '160731-1026'; $build = '160801-2119';
$STARTtime = date("U"); $STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s"); $SQLdate = date("Y-m-d H:i:s");
@@ -37240,7 +37241,7 @@ if ($ADD==999994)
echo "<LI><a href=\"AST_recording_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Recording Access Log")."</a></FONT>\n"; echo "<LI><a href=\"AST_recording_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Recording Access Log")."</a></FONT>\n";
echo "<LI><a href=\"admin.php?ADD=800000000000000\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Admin Report Log Viewer")."</a></FONT>\n"; echo "<LI><a href=\"admin.php?ADD=800000000000000\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Admin Report Log Viewer")."</a></FONT>\n";
echo "<BR><BR>\n"; echo "<BR><BR>\n";
echo "<LI><a href=\"admin_phones_bulk_insert.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Bulk Phone Insert Page")."</a></FONT>\n"; echo "<LI><a href=\"admin_bulk_tools.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Admin Bulk Tools")."</FONT></a> | <a href=\"admin_phones_bulk_insert.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Bulk Phone Insert Page")."</FONT></a>\n";
echo "<LI><a href=\"lead_tools.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Basic Lead Management Tools")."</FONT></a> | <a href=\"lead_tools_advanced.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Advanced Lead Management Tools")."</FONT></a> | <a href=\"list_split.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("List Split")."</FONT></a>\n"; echo "<LI><a href=\"lead_tools.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Basic Lead Management Tools")."</FONT></a> | <a href=\"lead_tools_advanced.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Advanced Lead Management Tools")."</FONT></a> | <a href=\"list_split.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("List Split")."</FONT></a>\n";
echo "<LI><a href=\"reset_campaign_lists.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Reset Campaign Lists")."</a></FONT>\n"; echo "<LI><a href=\"reset_campaign_lists.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Reset Campaign Lists")."</a></FONT>\n";
echo "<LI><a href=\"callbacks_bulk_change.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Callbacks Transferral Page")."</a></FONT> | <a href=\"callbacks_bulk_move.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Callbacks Bulk Move")."</FONT></a>\n"; echo "<LI><a href=\"callbacks_bulk_change.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Callbacks Transferral Page")."</a></FONT> | <a href=\"callbacks_bulk_move.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>"._QXZ("Callbacks Bulk Move")."</FONT></a>\n";
@@ -0,0 +1,460 @@
<?php
# admin_amm_multi.php
#
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# this screen will control the *amd* settings needed when the Campaign setting
# "AM Message Wildcards" is enabled. This screen allows for multiple messages
# and fields to be entered and ranked in the order in which they are are to be
# searched.
#
# changes:
# 151109-1653 - First Build
# 160801-1201 - Added colors features
#
$admin_version = '2.12-2';
$build = '160801-1201';
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["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["action"])) {$action=$_GET["action"];}
elseif (isset($_POST["action"])) {$action=$_POST["action"];}
if (isset($_GET["amm_id"])) {$amm_id=$_GET["amm_id"];}
elseif (isset($_POST["amm_id"])) {$amm_id=$_POST["amm_id"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["entry_type"])) {$entry_type=$_GET["entry_type"];}
elseif (isset($_POST["entry_type"])) {$entry_type=$_POST["entry_type"];}
if (isset($_GET["active"])) {$active=$_GET["active"];}
elseif (isset($_POST["active"])) {$active=$_POST["active"];}
if (isset($_GET["amm_field"])) {$amm_field=$_GET["amm_field"];}
elseif (isset($_POST["amm_field"])) {$amm_field=$_POST["amm_field"];}
if (isset($_GET["amm_rank"])) {$amm_rank=$_GET["amm_rank"];}
elseif (isset($_POST["amm_rank"])) {$amm_rank=$_POST["amm_rank"];}
if (isset($_GET["amm_wildcard"])) {$amm_wildcard=$_GET["amm_wildcard"];}
elseif (isset($_POST["amm_wildcard"])) {$amm_wildcard=$_POST["amm_wildcard"];}
if (isset($_GET["amm_description"])) {$amm_description=$_GET["amm_description"];}
elseif (isset($_POST["amm_description"])) {$amm_description=$_POST["amm_description"];}
if (isset($_GET["amm_filename"])) {$amm_filename=$_GET["amm_filename"];}
elseif (isset($_POST["amm_filename"])) {$amm_filename=$_POST["amm_filename"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
if (strlen($action) < 2)
{$action = 'BLANK';}
if (strlen($DB) < 1)
{$DB=0;}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,enable_languages,language_method FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysqli_num_rows($rslt);
if ($ss_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
$webroot_writable = $row[1];
$SSenable_languages = $row[2];
$SSlanguage_method = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
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);
$amm_id = preg_replace('/[^0-9]/','',$amm_id);
$campaign_id = preg_replace('/[^-_0-9a-zA-Z]/','',$campaign_id);
$entry_type = preg_replace('/[^_0-9a-zA-Z]/','',$entry_type);
$active = preg_replace('/[^A-Z]/','',$active);
$amm_field = preg_replace('/[^_0-9a-zA-Z]/','',$amm_field);
$amm_rank = preg_replace('/[^-0-9]/','',$amm_rank);
$amm_wildcard = preg_replace('/[^- _0-9a-zA-Z]/','',$amm_wildcard);
$amm_description = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$amm_description);
$amm_filename = preg_replace('/[^- \|\.\,\_0-9a-zA-Z]/','',$amm_filename);
} # end of non_latin
else
{
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
}
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
$user = $PHP_AUTH_USER;
$NWB = " &nbsp; <a href=\"javascript:openNewWindow('help.php";
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$sl_ct = mysqli_num_rows($rslt);
if ($sl_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$VUselected_language = $row[0];
}
$auth=0;
$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'',1);
if ($auth_message == 'GOOD')
{$auth=1;}
if ($auth < 1)
{
$VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
if ($auth_message == 'LOCK')
{
$VDdisplayMESSAGE = _QXZ("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=\"CONTACT-CENTER-ADMIN\"");
Header("HTTP/1.0 401 Unauthorized");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
exit;
}
$stmt="SELECT full_name,modify_campaigns,user_level from vicidial_users where user='$PHP_AUTH_USER';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGfullname = $row[0];
$LOGmodify_campaigns = $row[1];
$LOGuser_level = $row[2];
if ($LOGmodify_campaigns < 1)
{
Header ("Content-type: text/html; charset=utf-8");
echo _QXZ("You do not have permissions to modify campaigns")."\n";
exit;
}
##### BEGIN Set variables to make header show properly #####
$ADD = '31';
$SUB = '26';
$hh = 'campaigns';
$sh = 'detail';
$LOGast_admin_access = '1';
$SSoutbound_autodial_active = '1';
$ADMIN = 'admin.php';
$page_width='770';
$section_width='750';
$header_font_size='3';
$subheader_font_size='2';
$subcamp_font_size='2';
$header_selected_bold='<b>';
$header_nonselected_bold='';
$campaigns_color = '#FFFF99';
$campaigns_font = 'BLACK';
$campaigns_color = '#E6E6E6';
$subcamp_color = '#C6C6C6';
$ingroups_font = 'BLACK';
$ingroups_color = '#E6E6E6';
$lists_font = 'BLACK';
$lists_color = '#E6E6E6';
##### END Set variables to make header show properly #####
if (strlen($campaign_id) < 1)
{
echo _QXZ("ERROR: ID not defined:");
exit;
}
if ($entry_type == 'campaign')
{
$ADD = '31';
$hh = 'campaigns';
$stmt_name="SELECT campaign_name from vicidial_campaigns where campaign_id='$campaign_id';";
$mod_link = "ADD=$ADD&campaign_id=";
$event_section = 'CAMPAIGNS';
$stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and am_message_wildcards='Y';";
}
elseif ($entry_type == 'ingroup')
{
$ADD = '3111';
$hh = 'ingroups';
$stmt_name="SELECT group_name from vicidial_inbound_groups where group_id='$campaign_id';";
$mod_link = "ADD=$ADD&group_id=";
$event_section = 'INGROUPS';
$stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id' and am_message_wildcards='Y';";
}
else
{
echo _QXZ("ERROR: no entry type defined:") . $entry_type;
exit;
}
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$camp_multi=$row[0];
$camp_name='';
$rslt=mysql_to_mysqli($stmt_name, $link);
$names_to_print = mysqli_num_rows($rslt);
if ($names_to_print > 0)
{
$row=mysqli_fetch_row($rslt);
$camp_name = $row[0];
}
?>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title><?php echo _QXZ("ADMINISTRATION: AM Message Multi Entry") . " " . $campaign_id . " - " . $camp_name; ?>
<?php
require("admin_header.php");
if ($camp_multi < 1)
{
echo _QXZ("AM Message Wildcards is not set to active")."$entry_type|$campaign_id\n";
exit;
}
if ($DB > 0)
{
echo "$DB,$action,$campaign_id,$amm_id,$entry_type,$active,$amm_field,$amm_rank,$amm_wildcard,$amm_description\n<BR>";
}
################################################################################
##### BEGIN AMM multi NEW section
if ($action == "AMM_MULTI_NEW")
{
if ( (strlen($active)<1) or (strlen($amm_rank)<1) or (strlen($amm_wildcard)<1) or (strlen($amm_description)<1) or (strlen($amm_filename)<1) )
{
echo _QXZ("ERROR: You must fill in all fields").": |$active|$amm_rank|$amm_wildcard|$amm_description|$amm_filename|\n<BR>";
exit;
}
$stmt="INSERT INTO vicidial_amm_multi SET campaign_id='$campaign_id',entry_type='$entry_type',amm_field='$amm_field',active='$active',amm_rank='$amm_rank',amm_wildcard='$amm_wildcard',amm_description='$amm_description',amm_filename='" . mysqli_real_escape_string($link, $amm_filename) . "';";
$rslt=mysql_to_mysqli($stmt, $link);
$affected_rows = mysqli_affected_rows($link);
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
if ($affected_rows > 0)
{
### 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='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='$event_section', event_type='ADD', record_id='$campaign_id', event_code='ADD MULTI AMM', event_sql=\"$SQL_log\", event_notes='$amm_field';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB > 0) {echo "$campaign_id|$stmt\n<BR>";}
echo "<BR><b>$affected_rows "._QXZ("MULTI AM MESSAGE ADDED")."</b><BR><BR>";
}
else
{echo _QXZ("ERROR: Problem adding AM Message").": $affected_rows|$stmt\n<BR>";}
$action='BLANK';
}
##### END AMM multi NEW section
################################################################################
##### BEGIN AMM multi MODIFY section
if ($action == "AMM_MULTI_MODIFY")
{
if ( (strlen($amm_id)<1) or (strlen($active)<1) or (strlen($amm_rank)<1) or (strlen($amm_wildcard)<1) or (strlen($amm_description)<1) or (strlen($amm_filename)<1) )
{
echo _QXZ("ERROR: You must fill in all fields").": |$amm_id|$active|$amm_rank|$amm_wildcard|$amm_description|$amm_filename|\n<BR>";
exit;
}
$stmt="SELECT count(*) from vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$amm_count=$row[0];
if ($amm_count < 1)
{
echo _QXZ("ERROR: AM MESSAGE entry does not exist").": |$amm_id|$campaign_id|$entry_type|$amm_field|\n<BR>";
exit;
}
$stmt="UPDATE vicidial_amm_multi SET active='$active',amm_rank='$amm_rank',amm_wildcard='$amm_wildcard',amm_description='$amm_description',amm_filename='" . mysqli_real_escape_string($link, $amm_filename) . "' where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$affected_rows = mysqli_affected_rows($link);
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
if ($affected_rows > 0)
{
### 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='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='$event_section', event_type='MODIFY', record_id='$campaign_id', event_code='MODIFY MULTI AMM', event_sql=\"$SQL_log\", event_notes='$amm_field ID: $amm_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB > 0) {echo "$campaign_id|$stmt\n<BR>";}
echo "<BR><b>$affected_rows "._QXZ("MULTI AM MESSAGE MODIFIED")." (ID: $amm_id)</b><BR><BR>";
}
else
{echo _QXZ("ERROR: Problem modifying AM MESSAGE").": $affected_rows|$stmt\n<BR>";}
$action='BLANK';
}
##### END AMM multi MODIFY section
################################################################################
##### BEGIN AMM multi DELETE section
if ($action == "AMM_MULTI_DELETE")
{
if ( (strlen($amm_id)<1) or (strlen($campaign_id)<1) or (strlen($entry_type)<1) or (strlen($amm_field)<1) )
{
echo _QXZ("ERROR: You must fill in all fields").": |$amm_id|$campaign_id|$entry_type|$amm_field|\n<BR>";
exit;
}
$stmt="SELECT count(*) from vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id' and active='N';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$amm_count=$row[0];
if ($amm_count < 1)
{
echo _QXZ("ERROR: AM MESSAGE entry must be set to not active before you delete it").": |$amm_id|$campaign_id|$entry_type|$amm_field|\n<BR>";
}
else
{
$stmt="DELETE FROM vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id' and active='N';";
$rslt=mysql_to_mysqli($stmt, $link);
$affected_rows = mysqli_affected_rows($link);
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
if ($affected_rows > 0)
{
### 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='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='$event_section', event_type='DELETE', record_id='$campaign_id', event_code='DELETE MULTI AMM', event_sql=\"$SQL_log\", event_notes='$amm_field ID: $amm_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB > 0) {echo "$campaign_id|$stmt\n<BR>";}
echo "<BR><b>$affected_rows "._QXZ("MULTI AM MESSAGE DELETED")." (ID: $amm_id)</b><BR><BR>";
}
else
{echo _QXZ("ERROR: Problem deleting AM MESSAGE").": $affected_rows|$stmt\n<BR>";}
}
$action='BLANK';
}
##### END AMM multi DELETE section
################################################################################
##### BEGIN AMM multi control form
if ($action == "BLANK")
{
$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>"._QXZ("AM Message Wildcards Form");
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr><td align=center colspan=2>\n";
echo "<br><b>"._QXZ("AM Messages for %1s",0,'',$entry_type).": <a href=\"./admin.php?$mod_link$campaign_id\">$campaign_id</a></b> &nbsp; $NWB#amm_multi$NWE\n";
echo "<TABLE width=700 cellspacing=3>\n";
echo "<tr><td>#</td><td>"._QXZ("ACTIVE")."</td><td>"._QXZ("RANK")."</td><td>"._QXZ("WILDCARD")."</td><td>"._QXZ("FIELD")."</td><td>"._QXZ("SUBMIT")."</td></tr>\n";
$stmt="SELECT amm_id,active,amm_rank,amm_wildcard,amm_description,amm_filename,amm_field from vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' order by amm_rank limit 1000;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$types_to_print = mysqli_num_rows($rslt);
$o=0;
while ($types_to_print > $o)
{
$rowx=mysqli_fetch_row($rslt);
$Ramm_id = $rowx[0];
$Ractive = $rowx[1];
$Ramm_rank = $rowx[2];
$Ramm_wildcard = $rowx[3];
$Ramm_description = $rowx[4];
$Ramm_filename = $rowx[5];
$Ramm_field = $rowx[6];
if (preg_match('/1$|3$|5$|7$|9$/i', $o))
{$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';}
else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
$o++;
echo "<tr $bgcolor>";
echo "<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=entry_type value=\"$entry_type\">\n";
echo "<input type=hidden name=amm_id value=\"$Ramm_id\">\n";
echo "<input type=hidden name=action value=AMM_MULTI_MODIFY>\n";
echo "<td><font size=1>$o</td>";
echo "<td><font size=1><select size=1 name=active><option value='Y'>"._QXZ("Y")."</option><option value='N'>"._QXZ("N")."</option><option SELECTED>$Ractive</option></select></td>";
echo "<td><font size=1><input type=text size=4 maxlength=3 name=amm_rank value=\"$Ramm_rank\"></td>";
echo "<td><font size=1><input type=text size=20 maxlength=1000 name=amm_wildcard value=\"$Ramm_wildcard\"></td>";
echo "<td><font size=1><input type=text size=30 maxlength=255 name=amm_description value=\"$Ramm_description\"></td>";
echo "<td rowspan=2><font size=1><input type=submit name=SUBMIT value='"._QXZ("SUBMIT")."'>";
echo "<BR><BR>";
if ($Ractive == 'N')
{echo "<a href=\"$PHP_SELF?DB=$DB&campaign_id=$campaign_id&entry_type=$entry_type&amm_field=$amm_field&amm_id=$Ramm_id&action=AMM_MULTI_DELETE\">"._QXZ("DELETE")."</a>";}
else
{echo "<DEL>"._QXZ("DELETE")."</DEL>";}
echo "</td>";
echo "</tr>";
echo "<tr $bgcolor>";
echo "<td colspan=2><font size=1><select name=amm_field><option>vendor_lead_code</option><option>source_id</option><option>list_id</option><option>phone_number</option><option>title</option><option>first_name</option><option>middle_initial</option><option>last_name</option><option>address1</option><option>address2</option><option>address3</option><option>city</option><option>state</option><option>province</option><option>postal_code</option><option>country_code</option><option>gender</option><option>date_of_birth</option><option>alt_phone</option><option>email</option><option>security_phrase</option><option>comments</option><option>rank</option><option>owner</option><option selected>$Ramm_field</option></select></td>";
echo "<td colspan=3><font size=1>"._QXZ("AM MESSAGE").":<input type=text size=40 maxlength=255 name=amm_filename value=\"$Ramm_filename\"></td>";
echo "</form>\n";
echo "</tr>\n";
}
echo "</table></center><br>\n";
echo "<br>"._QXZ("Add a new %1s AM Message",0,'',$amm_field).":<br>";
echo "</td></tr>\n";
echo "<TABLE width=700 cellspacing=3>\n";
echo "<tr $bgcolor>";
echo "<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=entry_type value=\"$entry_type\">\n";
echo "<input type=hidden name=active value=\"N\">\n";
echo "<input type=hidden name=action value=AMM_MULTI_NEW>\n";
echo "<td><font size=1>"._QXZ("RANK").": <input type=text size=4 maxlength=3 name=amm_rank value=\"\"></td>";
echo "<td><font size=1>"._QXZ("WILDCARD").": <input type=text size=20 maxlength=1000 name=amm_wildcard value=\"\"></td>";
echo "<td><font size=1>"._QXZ("DESCRIPTION").": <input type=text size=30 maxlength=255 name=amm_description value=\"\"></td>";
echo "<td rowspan=2><font size=1><input type=submit name=SUBMIT value='"._QXZ("SUBMIT")."'></td>";
echo "</tr>";
echo "<tr $bgcolor>";
echo "<td><font size=1>"._QXZ("FIELD").": <select name=amm_field><option>vendor_lead_code</option><option>source_id</option><option>list_id</option><option>phone_number</option><option>title</option><option>first_name</option><option>middle_initial</option><option>last_name</option><option>address1</option><option>address2</option><option>address3</option><option>city</option><option>state</option><option>province</option><option>postal_code</option><option>country_code</option><option>gender</option><option>date_of_birth</option><option>alt_phone</option><option>email</option><option>security_phrase</option><option>comments</option><option>rank</option><option>owner</option></select></td>";
echo "<td colspan=2><font size=1>"._QXZ("AM MESSAGE").":<input type=text size=40 maxlength=255 name=amm_filename id=amm_filename value=\"\"> <a href=\"javascript:launch_chooser('amm_filename','date',100);\">"._QXZ("audio chooser")."</a></td>";
echo "</form>\n";
echo "</tr>\n";
echo "</table></center><br>\n";
echo "</TABLE></center>\n";
echo "</TD></TR></TABLE>\n";
}
### END AMM multi control form
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n<font size=1> "._QXZ("runtime").": $RUNtime "._QXZ("seconds")." &nbsp; &nbsp; &nbsp; &nbsp; "._QXZ("Version").": $admin_version &nbsp; &nbsp; "._QXZ("Build").": $build</font>";
?>
</body>
</html>
File diff suppressed because it is too large Load Diff