LICENSE: AGPLv2 # # CHANGES # 131016-1948 - Initial Build based upon lead_tools.php # 140113-0853 - Added USERONLY to ANYONE callback switcher # 140606-1242 - Added the state field as an option to Move, Update, and Delete # 141007-2036 - Finalized adding QXZ translation to all admin files # 141229-2028 - Added code for on-the-fly language translations display # 150312-1508 - Allow for single quotes in vicidial_list data fields # 170225-1436 - Added date/time range options # 170409-1554 - Added IP List validation code # 170711-1104 - Added screen colors # 170819-1003 - Added allow_manage_active_lists option, Changed list selection to multi # 191119-1817 - Fixes for translations compatibility, issue #1142 # 210607-0923 - Added option to reset called_count to 0 # 220228-1012 - Added allow_web_debug system setting # $version = '2.14-13'; $build = '220228-1012'; # This limit is to prevent data inconsistancies. # If there are too many leads in a list this # script might not finish before the php execution limit. $list_lead_limit = 100000; # maximum call count the script will work with $max_count = 20; 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']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); $ip = getenv("REMOTE_ADDR"); $SQLdate = date("Y-m-d H:i:s"); $DB=0; $move_submit=""; $update_submit=""; $delete_submit=""; $reset_called_count_submit=""; $callback_submit=""; $confirm_move=""; $confirm_update=""; $confirm_delete=""; $confirm_reset_called_count=""; $confirm_callback=""; if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["move_submit"])) {$move_submit=$_GET["move_submit"];} elseif (isset($_POST["move_submit"])) {$move_submit=$_POST["move_submit"];} if (isset($_GET["update_submit"])) {$update_submit=$_GET["update_submit"];} elseif (isset($_POST["update_submit"])) {$update_submit=$_POST["update_submit"];} if (isset($_GET["delete_submit"])) {$delete_submit=$_GET["delete_submit"];} elseif (isset($_POST["delete_submit"])) {$delete_submit=$_POST["delete_submit"];} if (isset($_GET["reset_called_count_submit"])) {$reset_called_count_submit=$_GET["reset_called_count_submit"];} elseif (isset($_POST["reset_called_count_submit"])) {$reset_called_count_submit=$_POST["reset_called_count_submit"];} if (isset($_GET["callback_submit"])) {$callback_submit=$_GET["callback_submit"];} elseif (isset($_POST["callback_submit"])) {$callback_submit=$_POST["callback_submit"];} if (isset($_GET["confirm_move"])) {$confirm_move=$_GET["confirm_move"];} elseif (isset($_POST["confirm_move"])) {$confirm_move=$_POST["confirm_move"];} if (isset($_GET["confirm_update"])) {$confirm_move=$_GET["confirm_update"];} elseif (isset($_POST["confirm_update"])) {$confirm_update=$_POST["confirm_update"];} if (isset($_GET["confirm_delete"])) {$confirm_delete=$_GET["confirm_delete"];} elseif (isset($_POST["confirm_delete"])) {$confirm_delete=$_POST["confirm_delete"];} if (isset($_GET["confirm_reset_called_count"])) {$confirm_reset_called_count=$_GET["confirm_reset_called_count"];} elseif (isset($_POST["confirm_reset_called_count"])) {$confirm_reset_called_count=$_POST["confirm_reset_called_count"];} if (isset($_GET["confirm_callback"])) {$confirm_callback=$_GET["confirm_callback"];} elseif (isset($_POST["confirm_callback"])) {$confirm_callback=$_POST["confirm_callback"];} # Several sets of variable inputs are further down in the code as well $DB = preg_replace('/[^0-9]/','',$DB); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $sys_settings_stmt = "SELECT use_non_latin,outbound_autodial_active,sounds_central_control_active,enable_languages,language_method,admin_screen_colors,report_default_format,allow_manage_active_lists,allow_web_debug FROM system_settings;"; $sys_settings_rslt=mysql_to_mysqli($sys_settings_stmt, $link); #if ($DB) {echo "$sys_settings_stmt\n";} $num_rows = mysqli_num_rows($sys_settings_rslt); if ($num_rows > 0) { $sys_settings_row=mysqli_fetch_row($sys_settings_rslt); $non_latin = $sys_settings_row[0]; $SSoutbound_autodial_active = $sys_settings_row[1]; $sounds_central_control_active = $sys_settings_row[2]; $SSenable_languages = $sys_settings_row[3]; $SSlanguage_method = $sys_settings_row[4]; $SSadmin_screen_colors = $sys_settings_row[5]; $SSreport_default_format = $sys_settings_row[6]; $SSallow_manage_active_lists = $sys_settings_row[7]; $SSallow_web_debug = $sys_settings_row[8]; } else { # there is something really weird if there are no system settings exit; } if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### ########################################### $move_submit = preg_replace('/[^-_0-9a-zA-Z]/','',$move_submit); $update_submit = preg_replace('/[^-_0-9a-zA-Z]/','',$update_submit); $delete_submit = preg_replace('/[^-_0-9a-zA-Z]/','',$delete_submit); $reset_called_count_submit = preg_replace('/[^- _0-9a-zA-Z]/','',$reset_called_count_submit); $callback_submit = preg_replace('/[^-_0-9a-zA-Z]/','',$callback_submit); $confirm_move = preg_replace('/[^-_0-9a-zA-Z]/','',$confirm_move); $confirm_update = preg_replace('/[^-_0-9a-zA-Z]/','',$confirm_update); $confirm_delete = preg_replace('/[^-_0-9a-zA-Z]/','',$confirm_delete); $confirm_reset_called_count = preg_replace('/[^-_0-9a-zA-Z]/','',$confirm_reset_called_count); $confirm_callback = preg_replace('/[^-_0-9a-zA-Z]/','',$confirm_callback); $delete_status = preg_replace('/[^-_0-9a-zA-Z]/','',$delete_status); $reset_called_count_status = preg_replace('/[^-_0-9a-zA-Z]/','',$reset_called_count_status); 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); } else { $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); } $DBlink=''; if ($DB) { $DBlink="?DB=$DB"; echo "
DB = $DB | "._QXZ("move_submit")." = $move_submit | "._QXZ("update_submit")." = $update_submit | "._QXZ("delete_submit")." = $delete_submit | "._QXZ("reset_called_count_submit")." = $reset_called_count_submit | "._QXZ("callback_submit")." = $callback_submit | "._QXZ("confirm_move")." = $confirm_move | "._QXZ("confirm_update")." = $confirm_update | "._QXZ("confirm_delete")." = $confirm_delete | "._QXZ("confirm_reset_called_count")." = $confirm_reset_called_count | "._QXZ("confirm_callback")." = $confirm_callback
"; } $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,0); 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; } if ($auth_message == 'IPBLOCK') { $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; 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; } 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 # valid user $rights_stmt = "SELECT load_leads,user_group, delete_lists, modify_leads, modify_lists 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); $load_leads = $rights_row[0]; $user_group = $rights_row[1]; $delete_lists = $rights_row[2]; $modify_leads = $rights_row[3]; $modify_lists = $rights_row[4]; # check their permissions if ( $load_leads < 1 ) { header ("Content-type: text/html; charset=utf-8"); echo _QXZ("You do not have permissions to load leads")."\n"; exit; } if ( $modify_leads < 1 ) { header ("Content-type: text/html; charset=utf-8"); echo _QXZ("You do not have permissions to modify leads")."\n"; exit; } if ( $modify_lists < 1 ) { header ("Content-type: text/html; charset=utf-8"); echo _QXZ("You do not have permissions to modify lists")."\n"; exit; } $SSmenu_background='015B91'; $SSframe_background='D9E6FE'; $SSstd_row1_background='9BB9FB'; $SSstd_row2_background='B9CBFD'; $SSstd_row3_background='8EBCFD'; $SSstd_row4_background='B6D3FC'; $SSstd_row5_background='A3C3D6'; $SSalt_row1_background='BDFFBD'; $SSalt_row2_background='99FF99'; $SSalt_row3_background='CCFFCC'; if ($SSadmin_screen_colors != 'default') { $stmt = "SELECT menu_background,frame_background,std_row1_background,std_row2_background,std_row3_background,std_row4_background,std_row5_background,alt_row1_background,alt_row2_background,alt_row3_background,web_logo FROM vicidial_screen_colors where colors_id='$SSadmin_screen_colors';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $colors_ct = mysqli_num_rows($rslt); if ($colors_ct > 0) { $row=mysqli_fetch_row($rslt); $SSmenu_background = $row[0]; $SSframe_background = $row[1]; $SSstd_row1_background = $row[2]; $SSstd_row2_background = $row[3]; $SSstd_row3_background = $row[4]; $SSstd_row4_background = $row[5]; $SSstd_row5_background = $row[6]; $SSalt_row1_background = $row[7]; $SSalt_row2_background = $row[8]; $SSalt_row3_background = $row[9]; $SSweb_logo = $row[10]; } } $Mhead_color = $SSstd_row5_background; $Mmain_bgcolor = $SSmenu_background; $Mhead_color = $SSstd_row5_background; $selected_logo = "./images/vicidial_admin_web_logo.png"; $selected_small_logo = "./images/vicidial_admin_web_logo.png"; $logo_new=0; $logo_old=0; $logo_small_old=0; if (file_exists('./images/vicidial_admin_web_logo.png')) {$logo_new++;} if (file_exists('vicidial_admin_web_logo_small.gif')) {$logo_small_old++;} if (file_exists('vicidial_admin_web_logo.gif')) {$logo_old++;} if ($SSweb_logo=='default_new') { $selected_logo = "./images/vicidial_admin_web_logo.png"; $selected_small_logo = "./images/vicidial_admin_web_logo.png"; } if ( ($SSweb_logo=='default_old') and ($logo_old > 0) ) { $selected_logo = "./vicidial_admin_web_logo.gif"; $selected_small_logo = "./vicidial_admin_web_logo_small.gif"; } if ( ($SSweb_logo!='default_new') and ($SSweb_logo!='default_old') ) { if (file_exists("./images/vicidial_admin_web_logo$SSweb_logo")) { $selected_logo = "./images/vicidial_admin_web_logo$SSweb_logo"; $selected_small_logo = "./images/vicidial_admin_web_logo$SSweb_logo"; } } echo "\n"; echo "\n"; echo "\n"; echo "\n"; ?> "._QXZ("ADMINISTRATION").": "._QXZ("Advanced Lead Tools")."\n"; ##### BEGIN Set variables to make header show properly ##### $ADD = '999998'; $hh = 'admin'; $LOGast_admin_access = '1'; $SSoutbound_autodial_active = '1'; $ADMIN = 'admin.php'; $page_width='870'; $section_width='850'; $header_font_size='3'; $subheader_font_size='2'; $subcamp_font_size='2'; $header_selected_bold=''; $header_nonselected_bold=''; $admin_color = '#FFFF99'; $admin_font = 'BLACK'; $admin_color = '#E6E6E6'; $subcamp_color = '#C6C6C6'; ##### END Set variables to make header show properly ##### require("admin_header.php"); echo "| \n"; echo "\n"; echo " "._QXZ("Basic Lead Tools")." | "._QXZ("Advanced Lead Tools")."\n"; echo "\n"; echo " | \n"; echo "\n"; echo " |
| \n";
##### BEGIN move functions #####
# move confirmation page
if ($move_submit == _QXZ("move") )
{
# get the variables
$enable_move_status="";
$enable_move_country_code="";
$enable_move_vendor_lead_code="";
$enable_move_source_id="";
$enable_move_owner="";
$enable_move_state="";
$enable_move_entry_date="";
$enable_move_modify_date="";
$enable_move_security_phrase="";
$enable_move_count="";
$move_country_code="";
$move_vendor_lead_code="";
$move_source_id="";
$move_owner="";
$move_state="";
$move_entry_date="";
$move_entry_date_end="";
$move_entry_date_op="";
$move_modify_date="";
$move_modify_date_end="";
$move_modify_date_op="";
$move_security_phrase="";
$move_from_list="";
$move_to_list="";
$move_status="";
$move_count_op="";
$move_count_num="";
# check the get / post data for the variables
if (isset($_GET["enable_move_status"])) {$enable_move_status=$_GET["enable_move_status"];}
elseif (isset($_POST["enable_move_status"])) {$enable_move_status=$_POST["enable_move_status"];}
if (isset($_GET["enable_move_country_code"])) {$enable_move_country_code=$_GET["enable_move_country_code"];}
elseif (isset($_POST["enable_move_country_code"])) {$enable_move_country_code=$_POST["enable_move_country_code"];}
if (isset($_GET["enable_move_vendor_lead_code"])) {$enable_move_vendor_lead_code=$_GET["enable_move_vendor_lead_code"];}
elseif (isset($_POST["enable_move_vendor_lead_code"])) {$enable_move_vendor_lead_code=$_POST["enable_move_vendor_lead_code"];}
if (isset($_GET["enable_move_source_id"])) {$enable_move_source_id=$_GET["enable_move_source_id"];}
elseif (isset($_POST["enable_move_source_id"])) {$enable_move_source_id=$_POST["enable_move_source_id"];}
if (isset($_GET["enable_move_owner"])) {$enable_move_owner=$_GET["enable_move_owner"];}
elseif (isset($_POST["enable_move_owner"])) {$enable_move_owner=$_POST["enable_move_owner"];}
if (isset($_GET["enable_move_state"])) {$enable_move_state=$_GET["enable_move_state"];}
elseif (isset($_POST["enable_move_state"])) {$enable_move_state=$_POST["enable_move_state"];}
if (isset($_GET["enable_move_entry_date"])) {$enable_move_entry_date=$_GET["enable_move_entry_date"];}
elseif (isset($_POST["enable_move_entry_date"])) {$enable_move_entry_date=$_POST["enable_move_entry_date"];}
if (isset($_GET["enable_move_modify_date"])) {$enable_move_modify_date=$_GET["enable_move_modify_date"];}
elseif (isset($_POST["enable_move_modify_date"])) {$enable_move_modify_date=$_POST["enable_move_modify_date"];}
if (isset($_GET["enable_move_security_phrase"])) {$enable_move_security_phrase=$_GET["enable_move_security_phrase"];}
elseif (isset($_POST["enable_move_security_phrase"])) {$enable_move_security_phrase=$_POST["enable_move_security_phrase"];}
if (isset($_GET["enable_move_count"])) {$enable_move_count=$_GET["enable_move_count"];}
elseif (isset($_POST["enable_move_count"])) {$enable_move_count=$_POST["enable_move_count"];}
if (isset($_GET["move_country_code"])) {$move_country_code=$_GET["move_country_code"];}
elseif (isset($_POST["move_country_code"])) {$move_country_code=$_POST["move_country_code"];}
if (isset($_GET["move_vendor_lead_code"])) {$move_vendor_lead_code=$_GET["move_vendor_lead_code"];}
elseif (isset($_POST["move_vendor_lead_code"])) {$move_vendor_lead_code=$_POST["move_vendor_lead_code"];}
if (isset($_GET["move_source_id"])) {$move_source_id=$_GET["move_source_id"];}
elseif (isset($_POST["move_source_id"])) {$move_source_id=$_POST["move_source_id"];}
if (isset($_GET["move_owner"])) {$move_owner=$_GET["move_owner"];}
elseif (isset($_POST["move_owner"])) {$move_owner=$_POST["move_owner"];}
if (isset($_GET["move_state"])) {$move_state=$_GET["move_state"];}
elseif (isset($_POST["move_state"])) {$move_state=$_POST["move_state"];}
if (isset($_GET["move_entry_date"])) {$move_entry_date=$_GET["move_entry_date"];}
elseif (isset($_POST["move_entry_date"])) {$move_entry_date=$_POST["move_entry_date"];}
if (isset($_GET["move_entry_date_end"])) {$move_entry_date_end=$_GET["move_entry_date_end"];}
elseif (isset($_POST["move_entry_date_end"])) {$move_entry_date_end=$_POST["move_entry_date_end"];}
if (isset($_GET["move_entry_date_op"])) {$move_entry_date_op=$_GET["move_entry_date_op"];}
elseif (isset($_POST["move_entry_date_op"])) {$move_entry_date_op=$_POST["move_entry_date_op"];}
if (isset($_GET["move_modify_date"])) {$move_modify_date=$_GET["move_modify_date"];}
elseif (isset($_POST["move_modify_date"])) {$move_modify_date=$_POST["move_modify_date"];}
if (isset($_GET["move_modify_date_end"])) {$move_modify_date_end=$_GET["move_modify_date_end"];}
elseif (isset($_POST["move_modify_date_end"])) {$move_modify_date_end=$_POST["move_modify_date_end"];}
if (isset($_GET["move_modify_date_op"])) {$move_modify_date_op=$_GET["move_modify_date_op"];}
elseif (isset($_POST["move_modify_date_op"])) {$move_modify_date_op=$_POST["move_modify_date_op"];}
if (isset($_GET["move_security_phrase"])) {$move_security_phrase=$_GET["move_security_phrase"];}
elseif (isset($_POST["move_security_phrase"])) {$move_security_phrase=$_POST["move_security_phrase"];}
if (isset($_GET["move_from_list"])) {$move_from_list=$_GET["move_from_list"];}
elseif (isset($_POST["move_from_list"])) {$move_from_list=$_POST["move_from_list"];}
if (isset($_GET["move_to_list"])) {$move_to_list=$_GET["move_to_list"];}
elseif (isset($_POST["move_to_list"])) {$move_to_list=$_POST["move_to_list"];}
if (isset($_GET["move_status"])) {$move_status=$_GET["move_status"];}
elseif (isset($_POST["move_status"])) {$move_status=$_POST["move_status"];}
if (isset($_GET["move_count_op"])) {$move_count_op=$_GET["move_count_op"];}
elseif (isset($_POST["move_count_op"])) {$move_count_op=$_POST["move_count_op"];}
if (isset($_GET["move_count_num"])) {$move_count_num=$_GET["move_count_num"];}
elseif (isset($_POST["move_count_num"])) {$move_count_num=$_POST["move_count_num"];}
if ($DB)
{
echo " "._QXZ("enable_move_status")." = $enable_move_status | "._QXZ("enable_move_country_code")." = $enable_move_country_code | "._QXZ("enable_move_vendor_lead_code")." = $enable_move_vendor_lead_code | "._QXZ("enable_move_source_id")." = $enable_move_source_id | "._QXZ("enable_move_owner")." = $enable_move_owner | "._QXZ("enable_move_state")." = $enable_move_state | "._QXZ("enable_move_entry_date")." = $enable_move_entry_date | "._QXZ("enable_move_modify_date")." = $enable_move_modify_date | "._QXZ("enable_move_security_phrase")." = $enable_move_security_phrase | "._QXZ("enable_move_count")." = $enable_move_count | "._QXZ("move_country_code")." = $move_country_code | "._QXZ("move_vendor_lead_code")." = $move_vendor_lead_code | "._QXZ("move_source_id")." = $move_source_id | "._QXZ("move_owner")." = $move_owner | "._QXZ("move_state")." = $move_state | "._QXZ("move_entry_date")." = $move_entry_date | "._QXZ("move_entry_date_end")." = $move_entry_date_end | "._QXZ("move_entry_date_op")." = $move_entry_date_op | "._QXZ("move_modify_date")." = $move_modify_date | "._QXZ("move_modify_date_end")." = $move_modify_date_end | "._QXZ("move_modify_date_op")." = $move_modify_date_op | "._QXZ("move_security_phrase")." = $move_security_phrase | "._QXZ("move_from_list")." = $move_from_list | "._QXZ("move_to_list")." = $move_to_list | "._QXZ("move_status")." = $move_status | "._QXZ("move_count_op")." = $move_count_op | "._QXZ("move_count_num")." = $move_count_num "; } # filter out anything bad $enable_move_status = preg_replace('/[^a-zA-Z]/','',$enable_move_status); $enable_move_country_code = preg_replace('/[^a-zA-Z]/','',$enable_move_country_code); $enable_move_vendor_lead_code = preg_replace('/[^a-zA-Z]/','',$enable_move_vendor_lead_code); $enable_move_source_id = preg_replace('/[^a-zA-Z]/','',$enable_move_source_id); $enable_move_owner = preg_replace('/[^a-zA-Z]/','',$enable_move_owner); $enable_move_state = preg_replace('/[^a-zA-Z]/','',$enable_move_state); $enable_move_entry_date = preg_replace('/[^a-zA-Z]/','',$enable_move_entry_date); $enable_move_modify_date = preg_replace('/[^a-zA-Z]/','',$enable_move_modify_date); $enable_move_security_phrase = preg_replace('/[^a-zA-Z]/','',$enable_move_security_phrase); $enable_move_count = preg_replace('/[^a-zA-Z]/','',$enable_move_count); $move_country_code = preg_replace('/[^-_%a-zA-Z0-9]/','',$move_country_code); $move_vendor_lead_code = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_vendor_lead_code); $move_source_id = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_source_id); $move_owner = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_owner); $move_state = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_state); $move_entry_date = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_entry_date); $move_entry_date_end = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_entry_date_end); $move_entry_date_op = preg_replace('/[^<>=_0-9a-zA-Z]/','',$move_entry_date_op); $move_modify_date = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_modify_date); $move_modify_date_end = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_modify_date_end); $move_modify_date_op = preg_replace('/[^<>=_0-9a-zA-Z]/','',$move_modify_date_op); $move_security_phrase = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_security_phrase); $move_status = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_status); $move_from_list = preg_replace('/[^0-9\|]/','',$move_from_list); $move_to_list = preg_replace('/[^0-9]/','',$move_to_list); $move_count_num = preg_replace('/[^0-9]/','',$move_count_num); $move_count_op = preg_replace('/[^<>=]/','',$move_count_op); # build the count operation phrase $move_count_op_phrase=""; if ( $move_count_op == "<" ) { $move_count_op_phrase= _QXZ("less than")." "; } elseif ( $move_count_op == "<=" ) { $move_count_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $move_count_op == ">" ) { $move_count_op_phrase= _QXZ("greater than")." "; } elseif ( $move_count_op == ">=" ) { $move_count_op_phrase= _QXZ("greater than or equal to")." "; } # build the move_entry_date operation phrase $move_entry_date_op_phrase=""; $move_entry_operator_a = '>='; $move_entry_operator_b = '<='; if ( $move_entry_date_op == "<" ) { $move_entry_operator_a = '>='; $move_entry_operator_b = '<'; $move_entry_date_end = $move_entry_date; $move_entry_date = '0000-00-00 00:00:00'; $move_entry_date_op_phrase= _QXZ("less than")." "; } elseif ( $move_entry_date_op == "<=" ) { $move_entry_date_end = $move_entry_date; $move_entry_date = '0000-00-00 00:00:00'; $move_entry_date_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $move_entry_date_op == ">" ) { $move_entry_operator_a = '>'; $move_entry_operator_b = '<'; $move_entry_date_end = '2100-00-00 00:00:00'; $move_entry_date_op_phrase= _QXZ("greater than")." "; } elseif ( $move_entry_date_op == ">=" ) { $move_entry_date_end = '2100-00-00 00:00:00'; $move_entry_date_op_phrase= _QXZ("greater than or equal to")." "; } elseif ( $move_entry_date_op == "range" ) { $move_entry_date_op_phrase= _QXZ("range")." "; } elseif ( $move_entry_date_op == "=" ) { $move_entry_date_end = $move_entry_date; $move_entry_date_op_phrase= _QXZ("equal to")." "; } # build the move_modify_date operation phrase $move_modify_date_op_phrase=""; $move_modify_operator_a = '>='; $move_modify_operator_b = '<='; if ( $move_modify_date_op == "<" ) { $move_modify_operator_a = '>='; $move_modify_operator_b = '<'; $move_entry_date_end = $move_entry_date; $move_entry_date = '0000-00-00 00:00:00'; $move_modify_date_op_phrase= _QXZ("less than")." "; } elseif ( $move_modify_date_op == "<=" ) { $move_entry_date_end = $move_entry_date; $move_entry_date = '0000-00-00 00:00:00'; $move_modify_date_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $move_modify_date_op == ">" ) { $move_modify_operator_a = '>'; $move_modify_operator_b = '<'; $move_entry_date_end = '2100-00-00 00:00:00'; $move_modify_date_op_phrase= _QXZ("greater than")." "; } elseif ( $move_modify_date_op == ">=" ) { $move_entry_date_end = '2100-00-00 00:00:00'; $move_modify_date_op_phrase= _QXZ("greater than or equal to")." "; } elseif ( $move_modify_date_op == "range" ) { $move_modify_date_op_phrase= _QXZ("range")." "; } elseif ( $move_modify_date_op == "=" ) { $move_entry_date_end = $move_entry_date; $move_modify_date_op_phrase= _QXZ("equal to")." "; } if (strlen($move_entry_date) == 10) {$move_entry_date .= " 00:00:00";} if (strlen($move_entry_date_end) == 10) {$move_entry_date_end .= " 23:59:59";} if (strlen($move_modify_date) == 10) {$move_modify_date .= " 00:00:00";} if (strlen($move_modify_date_end) == 10) {$move_modify_date_end .= " 23:59:59";} if ($DB) { echo ""._QXZ("enable_move_status")." = $enable_move_status | "._QXZ("enable_move_country_code")." = $enable_move_country_code | "._QXZ("enable_move_vendor_lead_code")." = $enable_move_vendor_lead_code | "._QXZ("enable_move_source_id")." = $enable_move_source_id | "._QXZ("enable_move_owner")." = $enable_move_owner | "._QXZ("enable_move_state")." = $enable_move_state | "._QXZ("enable_move_entry_date")." = $enable_move_entry_date | "._QXZ("enable_move_modify_date")." = $enable_move_modify_date | "._QXZ("enable_move_security_phrase")." = $enable_move_security_phrase | "._QXZ("enable_move_count")." = $enable_move_count | "._QXZ("move_country_code")." = $move_country_code | "._QXZ("move_vendor_lead_code")." = $move_vendor_lead_code | "._QXZ("move_source_id")." = $move_source_id | "._QXZ("move_owner")." = $move_owner | "._QXZ("move_state")." = $move_state | "._QXZ("move_entry_date")." = $move_entry_date | "._QXZ("move_entry_date_end")." = $move_entry_date_end | "._QXZ("move_entry_date_op")." = $move_entry_date_op | "._QXZ("move_modify_date")." = $move_modify_date | "._QXZ("move_modify_date_end")." = $move_modify_date_end | "._QXZ("move_modify_date_op")." = $move_modify_date_op | "._QXZ("move_security_phrase")." = $move_security_phrase | "._QXZ("move_from_list")." = $move_from_list | "._QXZ("move_to_list")." = $move_to_list | "._QXZ("move_status")." = $move_status | "._QXZ("move_count_op")." = $move_count_op | "._QXZ("move_count_num")." = $move_count_num "; } # make sure the required fields are set if ($move_from_list == '') { missing_required_field('From List'); } if ($move_to_list == '') { missing_required_field('To List'); } # build the sql query's where phrase and the move phrase $sql_where = ""; $move_parm = ""; if (($enable_move_status == "enabled") && ($move_status != '')) { if ($move_status == '---BLANK---') {$move_status = '';} $sql_where = $sql_where . " and status like '$move_status' "; $move_parm = $move_parm . " "._QXZ("status is like")." $move_status"; if ($move_status == '') {$move_status = '---BLANK---';} } elseif ($enable_move_status == "enabled") { blank_field('Status',true); } if (($enable_move_country_code == "enabled") && ($move_country_code != '')) { if ($move_country_code == '---BLANK---') {$move_country_code = '';} $sql_where = $sql_where . " and country_code like \"$move_country_code\" "; $move_parm = $move_parm . " "._QXZ("country code is like")." $move_country_code "; if ($move_country_code == '') {$move_country_code = '---BLANK---';} } elseif ($enable_move_country_code == "enabled") { blank_field('Country Code',true); } if (($enable_move_vendor_lead_code == "enabled") && ($move_vendor_lead_code != '')) { if ($move_vendor_lead_code == '---BLANK---') {$move_vendor_lead_code = '';} $sql_where = $sql_where . " and vendor_lead_code like \"$move_vendor_lead_code\" "; $move_parm = $move_parm . " "._QXZ("vendor lead code is like")." $move_vendor_lead_code "; if ($move_vendor_lead_code == '') {$move_vendor_lead_code = '---BLANK---';} } elseif ($enable_move_vendor_lead_code == "enabled") { blank_field('Vendor Lead Code',true); } if (($enable_move_source_id == "enabled") && ( $move_source_id != '')) { if ($move_source_id == '---BLANK---') {$move_source_id = '';} $sql_where = $sql_where . " and source_id like \"$move_source_id\" "; $move_parm = $move_parm . " "._QXZ("source id is like")." $move_source_id "; if ($move_source_id == '') {$move_source_id = '---BLANK---';} } elseif ($enable_move_source_id == "enabled") { blank_field('Source ID',true); } if (($enable_move_owner == "enabled") && ($move_owner != '')) { if ($move_owner == '---BLANK---') {$move_owner = '';} $sql_where = $sql_where . " and owner like \"$move_owner\" "; $move_parm = $move_parm . " "._QXZ("owner is like")." $move_owner "; if ($move_owner == '') {$move_owner = '---BLANK---';} } elseif ($enable_move_owner == "enabled") { blank_field('Owner',true); } if (($enable_move_state == "enabled") && ($move_state != '')) { if ($move_state == '---BLANK---') {$move_state = '';} $sql_where = $sql_where . " and state like \"$move_state\" "; $move_parm = $move_parm . " "._QXZ("state is like")." $move_state "; if ($move_state == '') {$move_state = '---BLANK---';} } elseif ($enable_move_state == "enabled") { blank_field('State',true); } if (($enable_move_security_phrase == "enabled") && ($move_security_phrase != '')) { if ($move_security_phrase == '---BLANK---') {$move_security_phrase = '';} $sql_where = $sql_where . " and security_phrase like \"$move_security_phrase\" "; $move_parm = $move_parm . " "._QXZ("security phrase is like")." $move_security_phrase "; if ($move_security_phrase == '') {$move_security_phrase = '---BLANK---';} } elseif ($enable_move_security_phrase == "enabled") { blank_field('Security Phrase',true); } if (($enable_move_entry_date == "enabled") && ($move_entry_date != '')) { if ($move_entry_date == '---BLANK---') { $sql_where = $sql_where . " and entry_date == '' "; $move_parm = $move_parm . " "._QXZ("entry date is blank")." "; } else { $sql_where = $sql_where . " and entry_date $move_entry_operator_a '$move_entry_date' and entry_date $move_entry_operator_b '$move_entry_date_end' "; $move_parm = $move_parm . " "._QXZ("entry date was on")." $move_entry_date - $move_entry_date_end "; } } elseif ($enable_move_entry_date == "enabled") { blank_field('Entry Date',true); } if (($enable_move_modify_date == "enabled") && ($move_modify_date != '')) { if ($move_modify_date == '---BLANK---') { $sql_where = $sql_where . " and modify_date == '' "; $move_parm = $move_parm . " "._QXZ("modify date is blank")." "; } else { $sql_where = $sql_where . " and modify_date $move_modify_operator_a '$move_modify_date' and modify_date $move_modify_operator_b '$move_modify_date_end' "; $move_parm = $move_parm . " "._QXZ("last modify date was on")." $move_modify_date - $move_modify_date_end "; } } elseif ($enable_move_modify_date == "enabled") { blank_field('Modify Date',true); } if (($enable_move_count == "enabled") && ($move_count_op != '') && ($move_count_num != '')) { if ($move_count_op == '---BLANK---') {$move_count_op = '';} if ($move_count_num == '---BLANK---') {$move_count_num = '';} $sql_where = $sql_where . " and called_count $move_count_op $move_count_num"; $move_parm = $move_parm . " "._QXZ("called count is")." $move_count_op_phrase $move_count_num "; if ($move_count_op == '') {$move_count_op = '---BLANK---';} if ($move_count_num == '') {$move_count_num = '---BLANK---';} } elseif ($enable_move_count == "enabled") { blank_field('Move Count',true); } # get the number of leads this action will move $move_lead_count=0; $move_lead_count_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id IN('".implode("','", $move_from_list)."') $sql_where"; if ($DB) { echo "|$move_lead_count_stmt|\n"; } $move_lead_count_rslt = mysql_to_mysqli($move_lead_count_stmt, $link); $move_lead_count_row = mysqli_fetch_row($move_lead_count_rslt); $move_lead_count = $move_lead_count_row[0]; # get the number of leads in the list this action will move to $to_list_lead_count=0; $to_list_lead_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id = '$move_to_list'"; if ($DB) { echo "|$to_list_lead_stmt|\n"; } $to_list_lead_rslt = mysql_to_mysqli($to_list_lead_stmt, $link); $to_list_lead_row = mysqli_fetch_row($to_list_lead_rslt); $to_list_lead_count = $to_list_lead_row[0]; # check to see if we will exceed list_lead_limit in the move to list if ( $to_list_lead_count + $move_lead_count > $list_lead_limit ) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " "._QXZ("Sorry. This operation will cause list")." $move_to_list "._QXZ("to exceed")." $list_lead_limit "._QXZ("leads which is not allowed").". \n"; echo ""._QXZ("Click here to start over").". \n"; echo "\n\n"; } else { echo ""._QXZ("You are about to move")." $move_lead_count "._QXZ("leads from list")." ".implode(",", $move_from_list)." "._QXZ("to")." $move_to_list "._QXZ("with the following parameters").": "._QXZ("Click here to start over").". \n"; echo "\n\n"; } } # actually do the move if ($confirm_move == _QXZ("confirm")) { # get the variables $enable_move_status=""; $enable_move_country_code=""; $enable_move_vendor_lead_code=""; $enable_move_source_id=""; $enable_move_owner=""; $enable_move_state=""; $enable_move_entry_date=""; $enable_move_modify_date=""; $enable_move_security_phrase=""; $enable_move_count=""; $move_country_code=""; $move_vendor_lead_code=""; $move_source_id=""; $move_owner=""; $move_state=""; $move_entry_date=""; $move_entry_date_end=""; $move_entry_date_op=""; $move_modify_date=""; $move_modify_date_end=""; $move_modify_date_op=""; $move_security_phrase=""; $move_from_list=""; $move_to_list=""; $move_status=""; $move_count_op=""; $move_count_num=""; # check the get / post data for the variables if (isset($_GET["enable_move_status"])) {$enable_move_status=$_GET["enable_move_status"];} elseif (isset($_POST["enable_move_status"])) {$enable_move_status=$_POST["enable_move_status"];} if (isset($_GET["enable_move_country_code"])) {$enable_move_country_code=$_GET["enable_move_country_code"];} elseif (isset($_POST["enable_move_country_code"])) {$enable_move_country_code=$_POST["enable_move_country_code"];} if (isset($_GET["enable_move_vendor_lead_code"])) {$enable_move_vendor_lead_code=$_GET["enable_move_vendor_lead_code"];} elseif (isset($_POST["enable_move_vendor_lead_code"])) {$enable_move_vendor_lead_code=$_POST["enable_move_vendor_lead_code"];} if (isset($_GET["enable_move_source_id"])) {$enable_move_source_id=$_GET["enable_move_source_id"];} elseif (isset($_POST["enable_move_source_id"])) {$enable_move_source_id=$_POST["enable_move_source_id"];} if (isset($_GET["enable_move_owner"])) {$enable_move_owner=$_GET["enable_move_owner"];} elseif (isset($_POST["enable_move_owner"])) {$enable_move_owner=$_POST["enable_move_owner"];} if (isset($_GET["enable_move_state"])) {$enable_move_state=$_GET["enable_move_state"];} elseif (isset($_POST["enable_move_state"])) {$enable_move_state=$_POST["enable_move_state"];} if (isset($_GET["enable_move_entry_date"])) {$enable_move_entry_date=$_GET["enable_move_entry_date"];} elseif (isset($_POST["enable_move_entry_date"])) {$enable_move_entry_date=$_POST["enable_move_entry_date"];} if (isset($_GET["enable_move_modify_date"])) {$enable_move_modify_date=$_GET["enable_move_modify_date"];} elseif (isset($_POST["enable_move_modify_date"])) {$enable_move_modify_date=$_POST["enable_move_modify_date"];} if (isset($_GET["enable_move_security_phrase"])) {$enable_move_security_phrase=$_GET["enable_move_security_phrase"];} elseif (isset($_POST["enable_move_security_phrase"])) {$enable_move_security_phrase=$_POST["enable_move_security_phrase"];} if (isset($_GET["enable_move_count"])) {$enable_move_count=$_GET["enable_move_count"];} elseif (isset($_POST["enable_move_count"])) {$enable_move_count=$_POST["enable_move_count"];} if (isset($_GET["move_country_code"])) {$move_country_code=$_GET["move_country_code"];} elseif (isset($_POST["move_country_code"])) {$move_country_code=$_POST["move_country_code"];} if (isset($_GET["move_vendor_lead_code"])) {$move_vendor_lead_code=$_GET["move_vendor_lead_code"];} elseif (isset($_POST["move_vendor_lead_code"])) {$move_vendor_lead_code=$_POST["move_vendor_lead_code"];} if (isset($_GET["move_source_id"])) {$move_source_id=$_GET["move_source_id"];} elseif (isset($_POST["move_source_id"])) {$move_source_id=$_POST["move_source_id"];} if (isset($_GET["move_owner"])) {$move_owner=$_GET["move_owner"];} elseif (isset($_POST["move_owner"])) {$move_owner=$_POST["move_owner"];} if (isset($_GET["move_state"])) {$move_state=$_GET["move_state"];} elseif (isset($_POST["move_state"])) {$move_state=$_POST["move_state"];} if (isset($_GET["move_entry_date"])) {$move_entry_date=$_GET["move_entry_date"];} elseif (isset($_POST["move_entry_date"])) {$move_entry_date=$_POST["move_entry_date"];} if (isset($_GET["move_entry_date_end"])) {$move_entry_date_end=$_GET["move_entry_date_end"];} elseif (isset($_POST["move_entry_date_end"])) {$move_entry_date_end=$_POST["move_entry_date_end"];} if (isset($_GET["move_entry_date_op"])) {$move_entry_date_op=$_GET["move_entry_date_op"];} elseif (isset($_POST["move_entry_date_op"])) {$move_entry_date_op=$_POST["move_entry_date_op"];} if (isset($_GET["move_modify_date"])) {$move_modify_date=$_GET["move_modify_date"];} elseif (isset($_POST["move_modify_date"])) {$move_modify_date=$_POST["move_modify_date"];} if (isset($_GET["move_modify_date_end"])) {$move_modify_date_end=$_GET["move_modify_date_end"];} elseif (isset($_POST["move_modify_date_end"])) {$move_modify_date_end=$_POST["move_modify_date_end"];} if (isset($_GET["move_modify_date_op"])) {$move_modify_date_op=$_GET["move_modify_date_op"];} elseif (isset($_POST["move_modify_date_op"])) {$move_modify_date_op=$_POST["move_modify_date_op"];} if (isset($_GET["move_security_phrase"])) {$move_security_phrase=$_GET["move_security_phrase"];} elseif (isset($_POST["move_security_phrase"])) {$move_security_phrase=$_POST["move_security_phrase"];} if (isset($_GET["move_from_list"])) {$move_from_list=$_GET["move_from_list"];} elseif (isset($_POST["move_from_list"])) {$move_from_list=$_POST["move_from_list"];} if (isset($_GET["move_to_list"])) {$move_to_list=$_GET["move_to_list"];} elseif (isset($_POST["move_to_list"])) {$move_to_list=$_POST["move_to_list"];} if (isset($_GET["move_status"])) {$move_status=$_GET["move_status"];} elseif (isset($_POST["move_status"])) {$move_status=$_POST["move_status"];} if (isset($_GET["move_count_op"])) {$move_count_op=$_GET["move_count_op"];} elseif (isset($_POST["move_count_op"])) {$move_count_op=$_POST["move_count_op"];} if (isset($_GET["move_count_num"])) {$move_count_num=$_GET["move_count_num"];} elseif (isset($_POST["move_count_num"])) {$move_count_num=$_POST["move_count_num"];} if ($DB) { echo ""._QXZ("enable_move_status")." = $enable_move_status | "._QXZ("enable_move_country_code")." = $enable_move_country_code | "._QXZ("enable_move_vendor_lead_code")." = $enable_move_vendor_lead_code | "._QXZ("enable_move_source_id")." = $enable_move_source_id | "._QXZ("enable_move_owner")." = $enable_move_owner | "._QXZ("enable_move_state")." = $enable_move_state | "._QXZ("enable_move_entry_date")." = $enable_move_entry_date | "._QXZ("enable_move_modify_date")." = $enable_move_modify_date | "._QXZ("enable_move_security_phrase")." = $enable_move_security_phrase | "._QXZ("enable_move_count")." = $enable_move_count | "._QXZ("move_country_code")." = $move_country_code | "._QXZ("move_vendor_lead_code")." = $move_vendor_lead_code | "._QXZ("move_source_id")." = $move_source_id | "._QXZ("move_owner")." = $move_owner | "._QXZ("move_state")." = $move_state | "._QXZ("move_entry_date")." = $move_entry_date | "._QXZ("move_entry_date_end")." = $move_entry_date_end | "._QXZ("move_entry_date_op")." = $move_entry_date_op | "._QXZ("move_modify_date")." = $move_modify_date | "._QXZ("move_modify_date_end")." = $move_modify_date_end | "._QXZ("move_modify_date_op")." = $move_modify_date_op | "._QXZ("move_security_phrase")." = $move_security_phrase | "._QXZ("move_from_list")." = $move_from_list | "._QXZ("move_to_list")." = $move_to_list | "._QXZ("move_status")." = $move_status | "._QXZ("move_count_op")." = $move_count_op | "._QXZ("move_count_num")." = $move_count_num "; } # filter out anything bad $enable_move_status = preg_replace('/[^a-zA-Z]/','',$enable_move_status); $enable_move_country_code = preg_replace('/[^a-zA-Z]/','',$enable_move_country_code); $enable_move_vendor_lead_code = preg_replace('/[^a-zA-Z]/','',$enable_move_vendor_lead_code); $enable_move_source_id = preg_replace('/[^a-zA-Z]/','',$enable_move_source_id); $enable_move_owner = preg_replace('/[^a-zA-Z]/','',$enable_move_owner); $enable_move_state = preg_replace('/[^a-zA-Z]/','',$enable_move_state); $enable_move_entry_date = preg_replace('/[^a-zA-Z]/','',$enable_move_entry_date); $enable_move_modify_date = preg_replace('/[^a-zA-Z]/','',$enable_move_modify_date); $enable_move_security_phrase = preg_replace('/[^a-zA-Z]/','',$enable_move_security_phrase); $enable_move_count = preg_replace('/[^a-zA-Z]/','',$enable_move_count); $move_country_code = preg_replace('/[^-_%a-zA-Z0-9]/','',$move_country_code); $move_vendor_lead_code = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_vendor_lead_code); $move_source_id = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_source_id); $move_owner = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_owner); $move_state = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_state); $move_entry_date = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_entry_date); $move_entry_date_end = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_entry_date_end); $move_entry_date_op = preg_replace('/[^<>=_0-9a-zA-Z]/','',$move_entry_date_op); $move_modify_date = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_modify_date); $move_modify_date_end = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$move_modify_date_end); $move_modify_date_op = preg_replace('/[^<>=_0-9a-zA-Z]/','',$move_modify_date_op); $move_security_phrase = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$move_security_phrase); $move_status = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_status); $move_from_list = preg_replace('/[^0-9\|]/','',$move_from_list); $move_to_list = preg_replace('/[^0-9]/','',$move_to_list); $move_count_num = preg_replace('/[^0-9]/','',$move_count_num); $move_count_op = preg_replace('/[^<>=]/','',$move_count_op); # count operator $move_count_op_phrase=""; if ( $move_count_op == "<" ) { $move_count_op_phrase= _QXZ("less than")." "; } elseif ( $move_count_op == "<=" ) { $move_count_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $move_count_op == ">" ) { $move_count_op_phrase= _QXZ("greater than")." "; } elseif ( $move_count_op == ">=" ) { $move_count_op_phrase= _QXZ("greater than or equal to")." "; } # build the move_entry_date operation phrase $move_entry_date_op_phrase=""; $move_entry_operator_a = '>='; $move_entry_operator_b = '<='; if ( $move_entry_date_op == "<" ) { $move_entry_operator_a = '>='; $move_entry_operator_b = '<'; $move_entry_date_op_phrase= _QXZ("less than")." "; } elseif ( $move_entry_date_op == "<=" ) { $move_entry_date_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $move_entry_date_op == ">" ) { $move_entry_operator_a = '>'; $move_entry_operator_b = '<'; $move_entry_date_op_phrase= _QXZ("greater than")." "; } elseif ( $move_entry_date_op == ">=" ) { $move_entry_date_op_phrase= _QXZ("greater than or equal to")." "; } elseif ( $move_entry_date_op == "range" ) { $move_entry_date_op_phrase= _QXZ("range")." "; } elseif ( $move_entry_date_op == "=" ) { $move_entry_date_op_phrase= _QXZ("equal to")." "; } # build the move_modify_date operation phrase $move_modify_date_op_phrase=""; $move_modify_operator_a = '>='; $move_modify_operator_b = '<='; if ( $move_modify_date_op == "<" ) { $move_modify_operator_a = '>='; $move_modify_operator_b = '<'; $move_modify_date_op_phrase= _QXZ("less than")." "; } elseif ( $move_modify_date_op == "<=" ) { $move_modify_date_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $move_modify_date_op == ">" ) { $move_modify_operator_a = '>'; $move_modify_operator_b = '<'; $move_modify_date_op_phrase= _QXZ("greater than")." "; } elseif ( $move_modify_date_op == ">=" ) { $move_modify_date_op_phrase= _QXZ("greater than or equal to")." "; } elseif ( $move_modify_date_op == "range" ) { $move_modify_date_op_phrase= _QXZ("range")." "; } elseif ( $move_modify_date_op == "=" ) { $move_modify_date_op_phrase= _QXZ("equal to")." "; } if (strlen($move_entry_date) == 10) {$move_entry_date .= " 00:00:00";} if (strlen($move_entry_date_end) == 10) {$move_entry_date_end .= " 23:59:59";} if (strlen($move_modify_date) == 10) {$move_modify_date .= " 00:00:00";} if (strlen($move_modify_date_end) == 10) {$move_modify_date_end .= " 23:59:59";} if ($DB) { echo ""._QXZ("enable_move_status")." = $enable_move_status | "._QXZ("enable_move_country_code")." = $enable_move_country_code | "._QXZ("enable_move_vendor_lead_code")." = $enable_move_vendor_lead_code | "._QXZ("enable_move_source_id")." = $enable_move_source_id | "._QXZ("enable_move_owner")." = $enable_move_owner | "._QXZ("enable_move_state")." = $enable_move_state | "._QXZ("enable_move_entry_date")." = $enable_move_entry_date | "._QXZ("enable_move_modify_date")." = $enable_move_modify_date | "._QXZ("enable_move_security_phrase")." = $enable_move_security_phrase | "._QXZ("enable_move_count")." = $enable_move_count | "._QXZ("move_country_code")." = $move_country_code | "._QXZ("move_vendor_lead_code")." = $move_vendor_lead_code | "._QXZ("move_source_id")." = $move_source_id | "._QXZ("move_owner")." = $move_owner | "._QXZ("move_state")." = $move_state | "._QXZ("move_entry_date")." = $move_entry_date | "._QXZ("move_entry_date_end")." = $move_entry_date_end | "._QXZ("move_entry_date_op")." = $move_entry_date_op | "._QXZ("move_modify_date")." = $move_modify_date | "._QXZ("move_modify_date_end")." = $move_modify_date_end | "._QXZ("move_modify_date_op")." = $move_modify_date_op | "._QXZ("move_security_phrase")." = $move_security_phrase | "._QXZ("move_from_list")." = $move_from_list | "._QXZ("move_to_list")." = $move_to_list | "._QXZ("move_status")." = $move_status | "._QXZ("move_count_op")." = $move_count_op | "._QXZ("move_count_num")." = $move_count_num "; } # make sure the required fields are set if ($move_from_list == '') { missing_required_field('From List'); } if ($move_to_list == '') { missing_required_field('To List'); } # build the sql query's where phrase and the move phrase $sql_where = ""; $move_parm = ""; if (($enable_move_status == "enabled") && ($move_status != '')) { if ($move_status == '---BLANK---') {$move_status = '';} $sql_where = $sql_where . " and status like '$move_status' "; $move_parm = $move_parm . " "._QXZ("status is like")." $move_status"; if ($move_status == '') {$move_status = '---BLANK---';} } elseif ($enable_move_status == "enabled") { blank_field('Status',true); } if (($enable_move_country_code == "enabled") && ($move_country_code != '')) { if ($move_country_code == '---BLANK---') {$move_country_code = '';} $sql_where = $sql_where . " and country_code like \"$move_country_code\" "; $move_parm = $move_parm . " "._QXZ("country code is like")." $move_country_code "; if ($move_country_code == '') {$move_country_code = '---BLANK---';} } elseif ($enable_move_country_code == "enabled") { blank_field('Country Code',true); } if (($enable_move_vendor_lead_code == "enabled") && ($move_vendor_lead_code != '')) { if ($move_vendor_lead_code == '---BLANK---') {$move_vendor_lead_code = '';} $sql_where = $sql_where . " and vendor_lead_code like \"$move_vendor_lead_code\" "; $move_parm = $move_parm . " "._QXZ("vendor lead code is like")." $move_vendor_lead_code "; if ($move_vendor_lead_code == '') {$move_vendor_lead_code = '---BLANK---';} } elseif ($enable_move_vendor_lead_code == "enabled") { blank_field('Vendor Lead Code',true); } if (($enable_move_source_id == "enabled") && ( $move_source_id != '')) { if ($move_source_id == '---BLANK---') {$move_source_id = '';} $sql_where = $sql_where . " and source_id like \"$move_source_id\" "; $move_parm = $move_parm . " "._QXZ("source id is like")." $move_source_id "; if ($move_source_id == '') {$move_source_id = '---BLANK---';} } elseif($enable_move_source_id == "enabled") { blank_field('Source ID',true); } if (($enable_move_owner == "enabled") && ($move_owner != '')) { if ($move_owner == '---BLANK---') {$move_owner = '';} $sql_where = $sql_where . " and owner like \"$move_owner\" "; $move_parm = $move_parm . " "._QXZ("owner is like")." $move_owner "; if ($move_owner == '') {$move_owner = '---BLANK---';} } elseif ($enable_move_owner == "enabled") { blank_field('Owner',true); } if (($enable_move_state == "enabled") && ($move_state != '')) { if ($move_state == '---BLANK---') {$move_state = '';} $sql_where = $sql_where . " and state like \"$move_state\" "; $move_parm = $move_parm . " "._QXZ("state is like")." $move_state "; if ($move_state == '') {$move_state = '---BLANK---';} } elseif ($enable_move_state == "enabled") { blank_field('State',true); } if (($enable_move_security_phrase == "enabled") && ($move_security_phrase != '')) { if ($move_security_phrase == '---BLANK---') {$move_security_phrase = '';} $sql_where = $sql_where . " and security_phrase like \"$move_security_phrase\" "; $move_parm = $move_parm . " "._QXZ("security phrase is like")." $move_security_phrase "; if ($move_security_phrase == '') {$move_security_phrase = '---BLANK---';} } elseif ($enable_move_security_phrase == "enabled") { blank_field('Security Phrase',true); } if (($enable_move_entry_date == "enabled") && ($move_entry_date != '')) { if ($move_entry_date == '---BLANK---') { $sql_where = $sql_where . " and entry_date == '' "; $move_parm = $move_parm . " "._QXZ("entry date is blank")." "; } else { $sql_where = $sql_where . " and entry_date $move_entry_operator_a '$move_entry_date' and entry_date $move_entry_operator_b '$move_entry_date_end' "; $move_parm = $move_parm . " "._QXZ("entry date was on")." $move_entry_date - $move_entry_date_end "; } } elseif ($enable_move_entry_date == "enabled") { blank_field('Entry Date',true); } if (($enable_move_modify_date == "enabled") && ($move_modify_date != '')) { if ($move_modify_date == '---BLANK---') { $sql_where = $sql_where . " and modify_date == '' "; $move_parm = $move_parm . " "._QXZ("modify date is blank")." "; } else { $sql_where = $sql_where . " and modify_date $move_modify_operator_a '$move_modify_date' and modify_date $move_modify_operator_b '$move_modify_date_end' "; $move_parm = $move_parm . " "._QXZ("last modify date was on")." $move_modify_date - $move_modify_date_end "; } } elseif ($enable_move_modify_date == "enabled") { blank_field('Modify Date',true); } if (($enable_move_count == "enabled") && ($move_count_op != '') && ($move_count_num != '')) { if ($move_count_op == '---BLANK---') {$move_count_op = '';} if ($move_count_num == '---BLANK---') {$move_count_num = '';} $sql_where = $sql_where . " and called_count $move_count_op $move_count_num"; $move_parm = $move_parm . " "._QXZ("called count is")." $move_count_op_phrase $move_count_num "; if ($move_count_op == '') {$move_count_op = '---BLANK---';} if ($move_count_num == '') {$move_count_num = '---BLANK---';} } elseif ($enable_move_count == "enabled") { blank_field('Move Count',true); } $move_from_list_array=explode("|", $move_from_list); $move_lead_stmt = "UPDATE vicidial_list SET list_id = '$move_to_list' WHERE list_id IN('".implode("', '", $move_from_list_array)."') $sql_where"; if ($DB) { echo "|$move_lead_stmt|\n"; } $move_lead_rslt = mysql_to_mysqli($move_lead_stmt, $link); $move_lead_count = mysqli_affected_rows($link); $move_sentence = "$move_lead_count "._QXZ("leads have been moved from list")." $move_from_list "._QXZ("to")." $move_to_list "._QXZ("with the following parameters").": $move_parm "; $SQL_log = "$move_lead_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = preg_replace('/\"/', "'", $SQL_log); $admin_log_stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LISTS', event_type='OTHER', record_id='$move_from_list', event_code='ADMIN MOVE LEADS', event_sql=\"$SQL_log\", event_notes=\"$move_sentence\";"; if ($DB) {echo "|$admin_log_stmt|\n";} $admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link); echo " $move_sentence "; echo ""._QXZ("Click here to start over").". \n"; } ##### END move process ##### ##### BEGIN update confirmation page ##### if ($update_submit == _QXZ("update") ) { # get the variables $enable_update_from_status=""; $enable_update_country_code=""; $enable_update_vendor_lead_code=""; $enable_update_source_id=""; $enable_update_owner=""; $enable_update_state=""; $enable_update_entry_date=""; $enable_update_modify_date=""; $enable_update_security_phrase=""; $enable_update_count=""; $update_country_code=""; $update_vendor_lead_code=""; $update_source_id=""; $update_owner=""; $update_state=""; $update_entry_date=""; $update_entry_date_end=""; $update_entry_date_op=""; $update_modify_date=""; $update_modify_date_end=""; $update_modify_date_op=""; $update_security_phrase=""; $update_list=""; $update_to_status=""; $update_from_status=""; $update_count_op=""; $update_count_num=""; # check the get / post data for the variables if (isset($_GET["enable_update_from_status"])) {$enable_update_from_status=$_GET["enable_update_from_status"];} elseif (isset($_POST["enable_update_from_status"])) {$enable_update_from_status=$_POST["enable_update_from_status"];} if (isset($_GET["enable_update_country_code"])) {$enable_update_country_code=$_GET["enable_update_country_code"];} elseif (isset($_POST["enable_update_country_code"])) {$enable_update_country_code=$_POST["enable_update_country_code"];} if (isset($_GET["enable_update_vendor_lead_code"])) {$enable_update_vendor_lead_code=$_GET["enable_update_vendor_lead_code"];} elseif (isset($_POST["enable_update_vendor_lead_code"])) {$enable_update_vendor_lead_code=$_POST["enable_update_vendor_lead_code"];} if (isset($_GET["enable_update_source_id"])) {$enable_update_source_id=$_GET["enable_update_source_id"];} elseif (isset($_POST["enable_update_source_id"])) {$enable_update_source_id=$_POST["enable_update_source_id"];} if (isset($_GET["enable_update_owner"])) {$enable_update_owner=$_GET["enable_update_owner"];} elseif (isset($_POST["enable_update_owner"])) {$enable_update_owner=$_POST["enable_update_owner"];} if (isset($_GET["enable_update_state"])) {$enable_update_state=$_GET["enable_update_state"];} elseif (isset($_POST["enable_update_state"])) {$enable_update_state=$_POST["enable_update_state"];} if (isset($_GET["enable_update_entry_date"])) {$enable_update_entry_date=$_GET["enable_update_entry_date"];} elseif (isset($_POST["enable_update_entry_date"])) {$enable_update_entry_date=$_POST["enable_update_entry_date"];} if (isset($_GET["enable_update_modify_date"])) {$enable_update_modify_date=$_GET["enable_update_modify_date"];} elseif (isset($_POST["enable_update_modify_date"])) {$enable_update_modify_date=$_POST["enable_update_modify_date"];} if (isset($_GET["enable_update_security_phrase"])) {$enable_update_security_phrase=$_GET["enable_update_security_phrase"];} elseif (isset($_POST["enable_update_security_phrase"])) {$enable_update_security_phrase=$_POST["enable_update_security_phrase"];} if (isset($_GET["enable_update_count"])) {$enable_update_count=$_GET["enable_update_count"];} elseif (isset($_POST["enable_update_count"])) {$enable_update_count=$_POST["enable_update_count"];} if (isset($_GET["update_country_code"])) {$update_country_code=$_GET["update_country_code"];} elseif (isset($_POST["update_country_code"])) {$update_country_code=$_POST["update_country_code"];} if (isset($_GET["update_vendor_lead_code"])) {$update_vendor_lead_code=$_GET["update_vendor_lead_code"];} elseif (isset($_POST["update_vendor_lead_code"])) {$update_vendor_lead_code=$_POST["update_vendor_lead_code"];} if (isset($_GET["update_source_id"])) {$update_source_id=$_GET["update_source_id"];} elseif (isset($_POST["update_source_id"])) {$update_source_id=$_POST["update_source_id"];} if (isset($_GET["update_owner"])) {$update_owner=$_GET["update_owner"];} elseif (isset($_POST["update_owner"])) {$update_owner=$_POST["update_owner"];} if (isset($_GET["update_state"])) {$update_state=$_GET["update_state"];} elseif (isset($_POST["update_state"])) {$update_state=$_POST["update_state"];} if (isset($_GET["update_entry_date"])) {$update_entry_date=$_GET["update_entry_date"];} elseif (isset($_POST["update_entry_date"])) {$update_entry_date=$_POST["update_entry_date"];} if (isset($_GET["update_entry_date_end"])) {$update_entry_date_end=$_GET["update_entry_date_end"];} elseif (isset($_POST["update_entry_date_end"])) {$update_entry_date_end=$_POST["update_entry_date_end"];} if (isset($_GET["update_entry_date_op"])) {$update_entry_date_op=$_GET["update_entry_date_op"];} elseif (isset($_POST["update_entry_date_op"])) {$update_entry_date_op=$_POST["update_entry_date_op"];} if (isset($_GET["update_modify_date"])) {$update_modify_date=$_GET["update_modify_date"];} elseif (isset($_POST["update_modify_date"])) {$update_modify_date=$_POST["update_modify_date"];} if (isset($_GET["update_modify_date_end"])) {$update_modify_date_end=$_GET["update_modify_date_end"];} elseif (isset($_POST["update_modify_date_end"])) {$update_modify_date_end=$_POST["update_modify_date_end"];} if (isset($_GET["update_modify_date_op"])) {$update_modify_date_op=$_GET["update_modify_date_op"];} elseif (isset($_POST["update_modify_date_op"])) {$update_modify_date_op=$_POST["update_modify_date_op"];} if (isset($_GET["update_security_phrase"])) {$update_security_phrase=$_GET["update_security_phrase"];} elseif (isset($_POST["update_security_phrase"])) {$update_security_phrase=$_POST["update_security_phrase"];} if (isset($_GET["update_list"])) {$update_list=$_GET["update_list"];} elseif (isset($_POST["update_list"])) {$update_list=$_POST["update_list"];} if (isset($_GET["update_from_status"])) {$update_from_status=$_GET["update_from_status"];} elseif (isset($_POST["update_from_status"])) {$update_from_status=$_POST["update_from_status"];} if (isset($_GET["update_to_status"])) {$update_to_status=$_GET["update_to_status"];} elseif (isset($_POST["update_to_status"])) {$update_to_status=$_POST["update_to_status"];} if (isset($_GET["update_count_op"])) {$update_count_op=$_GET["update_count_op"];} elseif (isset($_POST["update_count_op"])) {$update_count_op=$_POST["update_count_op"];} if (isset($_GET["update_count_num"])) {$update_count_num=$_GET["update_count_num"];} elseif (isset($_POST["update_count_num"])) {$update_count_num=$_POST["update_count_num"];} if ($DB) { echo ""._QXZ("enable_update_from_status")." = $enable_update_from_status | "._QXZ("enable_update_country_code")." = $enable_update_country_code | "._QXZ("enable_update_vendor_lead_code")." = $enable_update_vendor_lead_code | "._QXZ("enable_update_source_id")." = $enable_update_source_id | "._QXZ("enable_update_owner")." = $enable_update_owner | "._QXZ("enable_update_state")." = $enable_update_state | "._QXZ("enable_update_entry_date")." = $enable_update_entry_date | "._QXZ("enable_update_modify_date")." = $enable_update_modify_date | "._QXZ("enable_update_security_phrase")." = $enable_update_security_phrase | "._QXZ("enable_update_count")." = $enable_update_count | "._QXZ("update_country_code")." = $update_country_code | "._QXZ("update_vendor_lead_code")." = $update_vendor_lead_code | "._QXZ("update_source_id")." = $update_source_id | "._QXZ("update_owner")." = $update_owner | "._QXZ("update_state")." = $update_state | "._QXZ("update_entry_date")." = $update_entry_date | "._QXZ("update_entry_date_end")." = $update_entry_date_end | "._QXZ("update_entry_date_op")." = $update_entry_date_op | "._QXZ("update_modify_date")." = $update_modify_date | "._QXZ("update_modify_date_end")." = $update_modify_date_end | "._QXZ("update_modify_date_op")." = $update_modify_date_op | "._QXZ("update_security_phrase")." = $update_security_phrase | "._QXZ("update_list")." = $update_list | "._QXZ("update_to_status")." = $ update_to_status | "._QXZ("update_from_status")." = $update_from_status | "._QXZ("update_count_op")." = $update_count_op | "._QXZ("update_count_num")." = $update_count_num "; } # filter out anything bad $enable_update_from_status = preg_replace('/[^a-zA-Z]/','',$enable_update_from_status); $enable_update_country_code = preg_replace('/[^a-zA-Z]/','',$enable_update_country_code); $enable_update_vendor_lead_code = preg_replace('/[^a-zA-Z]/','',$enable_update_vendor_lead_code); $enable_update_source_id = preg_replace('/[^a-zA-Z]/','',$enable_update_source_id); $enable_update_owner = preg_replace('/[^a-zA-Z]/','',$enable_update_owner); $enable_update_state = preg_replace('/[^a-zA-Z]/','',$enable_update_state); $enable_update_entry_date = preg_replace('/[^a-zA-Z]/','',$enable_update_entry_date); $enable_update_modify_date = preg_replace('/[^a-zA-Z]/','',$enable_update_modify_date); $enable_update_security_phrase = preg_replace('/[^a-zA-Z]/','',$enable_update_security_phrase); $enable_update_count = preg_replace('/[^a-zA-Z]/','',$enable_update_count); $update_country_code = preg_replace('/[^-_%a-zA-Z0-9]/','',$update_country_code); $update_vendor_lead_code = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$update_vendor_lead_code); $update_source_id = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$update_source_id); $update_owner = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$update_owner); $update_state = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_state); $update_entry_date = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$update_entry_date); $update_entry_date_end = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$update_entry_date_end); $update_entry_date_op = preg_replace('/[^<>=_0-9a-zA-Z]/','',$update_entry_date_op); $update_modify_date = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$update_modify_date); $update_modify_date_end = preg_replace('/[^- \:_%0-9a-zA-Z]/','',$update_modify_date_end); $update_modify_date_op = preg_replace('/[^<>=_0-9a-zA-Z]/','',$update_modify_date_op); $update_security_phrase = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$update_security_phrase); $update_to_status = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_to_status); $update_from_status = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_from_status); $update_list = preg_replace('/[^0-9\|]/','',$update_list); $update_count_num = preg_replace('/[^0-9]/','',$update_count_num); $update_count_op = preg_replace('/[^<>=]/','',$update_count_op); $update_count_op_phrase=""; if ( $update_count_op == "<" ) { $update_count_op_phrase= _QXZ("less than")." "; } elseif ( $update_count_op == "<=" ) { $update_count_op_phrase= _QXZ("less than or equal to")." "; } elseif ( $update_count_op == ">" ) { $update_count_op_phrase= _QXZ("greater than")." "; } elseif ( $update_count_op == ">=" ) { $update_count_op_phrase= _QXZ("greater than or equal to")." "; } # build the update_entry_date operation phrase $update_entry_date_op_phrase=""; $update_entry_operator_a = '>='; $update_entry_operator_b = '<='; if ( $update_entry_date_op == "<" ) { $update_entry_operator_a = '>='; $update_entry_operator_b = '<'; $update_entry_date_end = $update_entry_date; $update_entry_date = '0000-00-00 00:00:00'; $update_entry_date_op_phrase= _QXZ("less than")." $update_entry_date_end"; } elseif ( $update_entry_date_op == "<=" ) { $update_entry_date_end = $update_entry_date; $update_entry_date = '0000-00-00 00:00:00'; $update_entry_date_op_phrase= _QXZ("less than or equal to")." $update_entry_date_end"; } elseif ( $update_entry_date_op == ">" ) { $update_entry_operator_a = '>'; $update_entry_operator_b = '<'; $update_entry_date_end = '2100-00-00 00:00:00'; $update_entry_date_op_phrase= _QXZ("greater than")." $update_entry_date"; } elseif ( $update_entry_date_op == ">=" ) { $update_entry_date_end = '2100-00-00 00:00:00'; $update_entry_date_op_phrase= _QXZ("greater than or equal to")." $update_entry_date"; } elseif ( $update_entry_date_op == "range" ) { $update_entry_date_op_phrase= _QXZ("range")." $update_entry_date - $update_entry_date_end"; } elseif ( $update_entry_date_op == "=" ) { $update_entry_date_end = $update_entry_date; $update_entry_date_op_phrase= _QXZ("equal to")." $update_entry_date"; } # build the update_modify_date operation phrase $update_modify_date_op_phrase=""; $update_modify_operator_a = '>='; $update_modify_operator_b = '<='; if ( $update_modify_date_op == "<" ) { $update_modify_operator_a = '>='; $update_modify_operator_b = '<'; $update_modify_date_end = $update_modify_date; $update_modify_date = '0000-00-00 00:00:00'; $update_modify_date_op_phrase= _QXZ("less than")." $update_modify_date_end"; } elseif ( $update_modify_date_op == "<=" ) { $update_modify_date_end = $update_modify_date; $update_modify_date = '0000-00-00 00:00:00'; $update_modify_date_op_phrase= _QXZ("less than or equal to")." $update_modify_date_end"; } elseif ( $update_modify_date_op == ">" ) { $update_modify_operator_a = '>'; $update_modify_operator_b = '<'; $update_modify_date_end = '2100-00-00 00:00:00'; $update_modify_date_op_phrase= _QXZ("greater than")." $update_modify_date"; } elseif ( $update_modify_date_op == ">=" ) { $update_modify_date_end = '2100-00-00 00:00:00'; $update_modify_date_op_phrase= _QXZ("greater than or equal to")." $update_modify_date"; } elseif ( $update_modify_date_op == "range" ) { $update_modify_date_op_phrase= _QXZ("range")." $update_modify_date - $update_modify_date_end"; } elseif ( $update_modify_date_op == "=" ) { $update_modify_date_end = $update_modify_date; $update_modify_date_op_phrase= _QXZ("equal to")." $update_modify_date"; } if (strlen($update_entry_date) == 10) {$update_entry_date .= " 00:00:00";} if (strlen($update_entry_date_end) == 10) {$update_entry_date_end .= " 23:59:59";} if (strlen($update_modify_date) == 10) {$update_modify_date .= " 00:00:00";} if (strlen($update_modify_date_end) == 10) {$update_modify_date_end .= " 23:59:59";} if ($DB) { echo ""._QXZ("enable_update_from_status")." = $enable_update_from_status | "._QXZ("enable_update_country_code")." = $enable_update_country_code | "._QXZ("enable_update_vendor_lead_code")." = $enable_update_vendor_lead_code | "._QXZ("enable_update_source_id")." = $enable_update_source_id | "._QXZ("enable_update_owner")." = $enable_update_owner | "._QXZ("enable_update_state")." = $enable_update_state | "._QXZ("enable_update_entry_date")." = $enable_update_entry_date | "._QXZ("enable_update_modify_date")." = $enable_update_modify_date | "._QXZ("enable_update_security_phrase")." = $enable_update_security_phrase | "._QXZ("enable_update_count")." = $enable_update_count | "._QXZ("update_country_code")." = $update_country_code | "._QXZ("update_vendor_lead_code")." = $update_vendor_lead_code | "._QXZ("update_source_id")." = $update_source_id | "._QXZ("update_owner")." = $update_owner | "._QXZ("update_state")." = $update_state | "._QXZ("update_entry_date")." = $update_entry_date | "._QXZ("update_entry_date_end")." = $update_entry_date_end | "._QXZ("update_entry_date_op")." = $update_entry_date_op | "._QXZ("update_modify_date")." = $update_modify_date | "._QXZ("update_modify_date_end")." = $update_modify_date_end | "._QXZ("update_modify_date_op")." = $update_modify_date_op | "._QXZ("update_security_phrase")." = $update_security_phrase | "._QXZ("update_list")." = $update_list | "._QXZ("update_to_status")." = $ update_to_status | "._QXZ("update_from_status")." = $update_from_status | "._QXZ("update_count_op")." = $update_count_op | "._QXZ("update_count_num")." = $update_count_num "; } # make sure the required fields are set if ($update_to_status == '') { missing_required_field('To Status'); } if ($update_list == '') { missing_required_field('List ID'); } # build the sql query's where phrase and the move phrase $sql_where = ""; $update_parm = ""; if (($enable_update_from_status == "enabled") && ($update_from_status != '')) { if ($update_from_status == '---BLANK---') {$update_from_status = '';} $sql_where = $sql_where . " and status like '$update_from_status' "; $update_parm = $update_parm . " "._QXZ("status is like")." $update_from_status"; if ($update_from_status == '') {$update_from_status = '---BLANK---';} } elseif ($enable_update_from_status == "enabled") { blank_field('Status',true); } if (($enable_update_country_code == "enabled") && ($update_country_code != '')) { if ($update_country_code == '---BLANK---') {$update_country_code = '';} $sql_where = $sql_where . " and country_code like \"$update_country_code\" "; $update_parm = $update_parm . " "._QXZ("country code is like")." $update_country_code "; if ($update_country_code == '') {$update_country_code = '---BLANK---';} } elseif ($enable_update_country_code == "enabled") { blank_field('Country Code',true); } if (($enable_update_vendor_lead_code == "enabled") && ($update_vendor_lead_code != '')) { if ($update_vendor_lead_code == '---BLANK---') {$update_vendor_lead_code = '';} $sql_where = $sql_where . " and vendor_lead_code like \"$update_vendor_lead_code\" "; $update_parm = $update_parm . " "._QXZ("vendor lead code is like")." $update_vendor_lead_code "; if ($update_vendor_lead_code == '') {$update_vendor_lead_code = '---BLANK---';} } elseif ($enable_update_vendor_lead_code == "enabled") { blank_field('Vendor Lead Code',true); } if (($enable_update_source_id == "enabled") && ( $update_source_id != '')) { if ($update_source_id == '---BLANK---') {$update_source_id = '';} $sql_where = $sql_where . " and source_id like \"$update_source_id\" "; $update_parm = $update_parm . " "._QXZ("source id is like")." $update_source_id "; if ($update_source_id == '') {$update_source_id = '---BLANK---';} } elseif ($enable_update_source_id == "enabled") { blank_field('Source ID',true); } if (($enable_update_owner == "enabled") && ($update_owner != '')) { if ($update_owner == '---BLANK---') {$update_owner = '';} $sql_where = $sql_where . " and owner like \"$update_owner\" "; $update_parm = $update_parm . " "._QXZ("owner is like")." $update_owner "; if ($update_owner == '') {$update_owner = '---BLANK---';} } elseif ($enable_update_owner == "enabled") { blank_field('Owner',true); } if (($enable_update_state == "enabled") && ($update_state != '')) { if ($update_state == '---BLANK---') {$update_state = '';} $sql_where = $sql_where . " and state like \"$update_state\" "; $update_parm = $update_parm . " "._QXZ("state is like")." $update_state "; if ($update_state == '') {$update_state = '---BLANK---';} } elseif ($enable_update_state == "enabled") { blank_field('State',true); } if (($enable_update_security_phrase == "enabled") && ($update_security_phrase != '')) { if ($update_security_phrase == '---BLANK---') {$update_security_phrase = '';} $sql_where = $sql_where . " and security_phrase like \"$update_security_phrase\" "; $update_parm = $update_parm . " "._QXZ("security phrase is like")." $update_security_phrase "; if ($update_security_phrase == '') {$update_security_phrase = '---BLANK---';} } elseif ($enable_update_security_phrase == "enabled") { blank_field('Security Phrase',true); } if (($enable_update_entry_date == "enabled") && ($update_entry_date != '')) { if ($update_entry_date == '---BLANK---') { $sql_where = $sql_where . " and entry_date == '' "; $update_parm = $update_parm . " "._QXZ("entry date is blank")." "; } else { $sql_where = $sql_where . " and entry_date $update_entry_operator_a '$update_entry_date' and entry_date $update_entry_operator_b '$update_entry_date_end' "; $update_parm = $update_parm . " "._QXZ("entry date was")." $update_entry_date_op_phrase "; } } elseif ($enable_update_entry_date == "enabled") { blank_field('Entry Date',true); } if (($enable_update_modify_date == "enabled") && ($update_modify_date != '')) { if ($update_modify_date == '---BLANK---') { $sql_where = $sql_where . " and modify_date == '' "; $update_parm = $update_parm . " "._QXZ("modify date is blank")." "; } else { $sql_where = $sql_where . " and modify_date $update_modify_operator_a '$update_modify_date' and modify_date $update_modify_operator_b '$update_modify_date_end' "; $update_parm = $update_parm . " "._QXZ("last modify date was")." $update_modify_date_op_phrase "; } } elseif ($enable_update_modify_date == "enabled") { blank_field('Modify Date',true); } if (($enable_update_count == "enabled") && ($update_count_op != '') && ($update_count_num != '')) { if ($update_count_op == '---BLANK---') {$update_count_op = '';} if ($update_count_num == '---BLANK---') {$update_count_num = '';} $sql_where = $sql_where . " and called_count $update_count_op $update_count_num"; $update_parm = $update_parm . " "._QXZ("called count is")." $update_count_op_phrase $update_count_num "; if ($update_count_op == '') {$update_count_op = '---BLANK---';} if ($update_count_num == '') {$update_count_num = '---BLANK---';} } elseif ($enable_update_count == "enabled") { blank_field('Move Count'); } # get the number of leads this action will move $update_lead_count=0; $update_lead_count_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id IN('".implode("','", $update_list)."') $sql_where"; if ($DB) { echo "|$update_lead_count_stmt|\n"; } $update_lead_count_rslt = mysql_to_mysqli($update_lead_count_stmt, $link); $update_lead_count_row = mysqli_fetch_row($update_lead_count_rslt); $update_lead_count = $update_lead_count_row[0]; echo " "._QXZ("You are about to update")." $update_lead_count "._QXZ("leads in list")." ".implode(",", $update_list)." "._QXZ("to the status")." $update_to_status "._QXZ("with the following parameters").": | |